1var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`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`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function ee(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function te(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,te(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),te(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=te(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=te(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return te(ee(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return te(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)}
vendor: 14,039 bytes, line 1
1,P={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=P,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.6`})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(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_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`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,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 s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.6`})),o=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var ne=Array.isArray,N=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ie=[],ae=-1;function oe(e){return{current:e}}function se(e){0>ae||(e.current=ie[ae],ie[ae]=null,ae--)}function F(e,t){ae++,ie[ae]=e.current,e.current=t}var ce=oe(null),le=oe(null),ue=oe(null),I=oe(null);function de(e,t){switch(F(ue,t),F(le,e),F(ce,null),t.nodeType){case 9:case 11:e=(e
vendor: 7,630 bytes, lines 1-8
1=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}se(ce),F(ce,e)}function fe(){se(ce),se(le),se(ue)}function pe(e){e.memoizedState!==null&&F(I,e);var t=ce.current,n=Kd(t,e.type);t!==n&&(F(le,e),F(ce,n))}function me(e){le.current===e&&(se(ce),se(le)),I.current===e&&(se(I),np._currentValue=re)}var he,L;function ge(e){if(he===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||``,L=-1<e.stack.indexOf(` 2 at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return` 3`+he+e+L}var R=!1;function _e(e,t){if(!e||R)return``;R=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(` 4`),l=s.split(` 5`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=` 6`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{R=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ge(n):``}function ve(e,t){switch(e.tag){case 26:case 27:case 5:return ge(e.type);case 16:return ge(`Lazy`);case 13:return e.child!==t&&t!==null?ge(`Suspense Fallback`):ge(`Suspense`);case 19:return ge(`SuspenseList`);case 0:case 15:return _e(e.type,!1);case 11:return _e(e.type.render,!1);case 1:return _e(e.type,!0);case 31:return ge(`Activity`);default:return``}}function ye(e){try{var t=``,n=null;do t+=ve(e,n),n=e,e=e.return;while(e);return t}catch(e){return` 7Error generating stack: `+e.message+` 8`+e.stack}}var z=Object.prototype.hasOwnProperty,be=t.unstable_scheduleCallback,B=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,Ce=t.unstable_now,we=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,ke=t.unstable_IdlePriority,Ae=t.log,je=t.unstable_setDisableYieldValue,Me=null,Ne=null;function Pe(e){if(typeof Ae==`function`&&je(e),Ne&&typeof Ne.setStrictMode==`function`)try{Ne.setStrictMode(Me,e)}catch{}}var Fe=Math.clz32?Math.clz32:Re,Ie=Math.log,Le=Math.LN2;function Re(e){return e>>>=0,e===0?32:31-(Ie(e)/Le|0)|0}var ze=256,V=262144,Be=4194304;function Ve(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function He(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ve(n))):i=Ve(o):i=Ve(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ve(n))):i=Ve(o)):i=Ve(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ue(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ge(){var e=Be;return Be<<=1,!(Be&62914560)&&(Be=4194304),e}function Ke(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Fe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ye(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ye(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Fe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Xe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Fe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ze(e,t){var n=t&-t;return n=n&42?1:Qe(n),(n&(e.suspendedLanes|t))===0?n:0}function Qe(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function $e(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function et(){var e=P.p;return e===0?(e=window.event,e===void 0?32:vp(e.type)):e}function tt(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var nt=Math.random().toString(36).slice(2),rt=`__reactFiber$`+nt,it=`__reactProps$`+nt,at=`__reactContainer$`+nt,ot=`__reactEvents$`+nt,st=`__reactListeners$`+nt,ct=`__reactHandles$`+nt,lt=`__reactResources$`+nt,ut=`__reactMarker$`+nt;function dt(e){delete e[rt],delete e[it],delete e[ot],delete e[st],delete e[ct]}function ft(e){var t=e[rt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[at]||n[rt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[rt])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function pt(e){if(e=e[rt]||e[at]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function ht(e){var t=e[lt];return t||=e[lt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function gt(e){e[ut]=!0}var _t=new Set,vt={};function yt(e,t){bt(e,t),bt(e+`Capture`,t)}function bt(e,t){for(vt[e]=t,e=0;e<t.length;e++)_t.add(t[e])}var xt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u
8037D\\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]*$`),St={},Ct={};function wt(e){return z.call(Ct,e)?!0:z.call(St,e)?!1:xt.test(e)?Ct[e]=!0:(St[e]=!0,!1)}function Tt(e,t,n){if(wt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Et(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Dt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Ot(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function kt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function At(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jt(e){if(!e._valueTracker){var t=kt(e)?`checked`:`value`;e._valueTracker=At(e,t,``+e[t])}}function Mt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=kt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Nt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Pt=/[\n"\\]/g;function Ft(e){return e.replace(Pt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function It(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Ot(t)):e.value!==``+Ot(t)&&(e.value=``+Ot(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Rt(e,o,Ot(n)):Rt(e,o,Ot(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Ot(s):e.removeAttribute(`name`)}function Lt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){jt(e);return}n=n==null?``:``+Ot(n),t=t==null?n:``+Ot(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),jt(e)}function Rt(e,t,n){t===`number`&&Nt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function zt(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=``+Ot(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Bt(e,t,n){if(t!=null&&(t=``+Ot(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ot(n)}function Vt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(ne(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n??=``,t=n}
vendor: 9,499 bytes, line 8
8n=Ot(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),jt(e)}function Ht(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ut=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Wt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Ut.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Gt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(s(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Wt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Wt(e,a,t[a])}function Kt(e){if(e.indexOf(`-`)===-1)return!1;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 qt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`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`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`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`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`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`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Jt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Yt(e){return Jt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Xt(){}var Zt=null;function Qt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var $t=null,en=null;function tn(e){var t=pt(e);if(t&&(e=t.stateNode)){var n=e[it]||null;a:switch(e=t.stateNode,t.type){case`input`:if(It(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Ft(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[it]||null;if(!i)throw Error(s(90));It(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Mt(r)}break a;case`textarea`:Bt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&zt(e,!!n.multiple,t,!1)}}}var nn=!1;function rn(e,t,n){if(nn)return e(t,n);nn=!0;try{return e(t)}finally{if(nn=!1,($t!==null||en!==null)&&(xu(),$t&&(t=$t,e=en,en=$t=null,tn(t),e)))for(t=0;t<e.length;t++)tn(e[t])}}function an(e,t){var n=e.stateNode;if(n===null)return null;var r=n[it]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(s(231,t,typeof n));return n}var on=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),sn=!1;if(on)try{var cn={};Object.defineProperty(cn,`passive`,{get:function(){sn=!0}}),window.addEventListener(`test`,cn,cn),window.removeEventListener(`test`,cn,cn)}catch{sn=!1}var ln=null,un=null,dn=null;function fn(){if(dn)return dn;var e,t=un,n=t.length,r,i=`value`in ln?ln.value:ln.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return dn=i.slice(e,1<r?1-r:void 0)}function pn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function mn(){return!0}function hn(){return!1}function H(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?mn:hn,this.isPropagationStopped=hn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=mn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=mn)},persist:function(){},isPersistent:mn}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=H(gn),vn=h({},gn,{view:0,detail:0}),yn=H(vn),bn,xn,Sn,Cn=h({},vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Sn&&(Sn&&e.type===`mousemove`?(bn=e.screenX-Sn.screenX,xn=e.screenY-Sn.screenY):xn=bn=0,Sn=e),bn)},movementY:function(e){return`movementY`in e?e.movementY:xn}}),wn=H(Cn),Tn=H(h({},Cn,{dataTransfer:0})),En=H(h({},vn,{relatedTarget:0})),Dn=H(h({},gn,{animationName:0,elapsedTime:0,pseudoElement:0})),On=H(h({},gn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),kn=H(h({},gn,{data:0})),An={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},jn={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:`F
85`,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 Nn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mn[e])?!!t[e]:!1}function Pn(){return Nn}var Fn=H(h({},vn,{key:function(e){if(e.key){var t=An[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=pn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pn,charCode:function(e){return e.type===`keypress`?pn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?pn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),In=H(h({},Cn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ln=H(h({},vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pn})),Rn=H(h({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0})),zn=H(h({},Cn,{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})),Bn=H(h({},gn,{newState:0,oldState:0})),Vn=[9,13,27,32],Hn=on&&`CompositionEvent`in window,Un=null;on&&`documentMode`in document&&(Un=document.documentMode);var Wn=on&&`TextEvent`in window&&!Un,Gn=on&&(!Hn||Un&&8<Un&&11>=Un),Kn=` `,qn=!1;function U(e,t){switch(e){case`keyup`:return Vn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Jn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var W=!1;function Yn(e,t){switch(e){case`compositionend`:return Jn(t);case`keypress`:return t.which===32?(qn=!0,Kn):null;case`textInput`:return e=t.data,e===Kn&&qn?null:e;default:return null}}function Xn(e,t){if(W)return e===`compositionend`||!Hn&&U(e,t)?(e=fn(),dn=un=ln=null,W=!1,e):null;switch(e){case`paste`: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 Gn&&t.locale!==`ko`?null:t.data;default:return null}}var Zn={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 Qn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Zn[e.type]:t===`textarea`}function $n(e,t,n,r){$t?en?en.push(r):en=[r]:$t=r,t=kd(t,`onChange`),0<t.length&&(n=new _n(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var er=null,tr=null;function nr(e){xd(e,0)}function rr(e){if(Mt(mt(e)))return e}function ir(e,t){if(e===`change`)return t}var ar=!1;if(on){var or;if(on){var sr=`oninput`in document;if(!sr){var cr=document.createElement(`div`);cr.setAttribute(`oninput`,`return;`),sr=typeof cr.oninput==`function`}or=sr}else or=!1;ar=or&&(!document.documentMode||9<document.documentMode)}function lr(){er&&(er.detachEvent(`onpropertychange`,ur),tr=er=null)}function ur(e){if(e.propertyName===`value`&&rr(tr)){var t=[];$n(t,tr,e,Qt(e)),rn(nr,t)}}function dr(e,t,n){e===`focusin`?(lr(),er=t,tr=n,er.attachEvent(`onpropertychange`,ur)):e===`focusout`&&lr()}function fr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return rr(tr)}function pr(e,t){if(e===`click`)return rr(t)}function mr(e,t){if(e===`input`||e===`change`)return rr(t)}function hr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var gr=typeof Object.is==`function`?Object.is:hr;function _r(e,t){if(gr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!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(!z.call(t,i)||!gr(e[i],t[i]))return!1}return!0}function vr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yr(e,t){var n=vr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=vr(n)}}function br(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?br(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Nt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nt(e.document)}return t}function Sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Cr=on&&`documentMode`in document&&11>=document.documentMode,wr=null,Tr=null,Er=null,Dr=!1;function Or(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Dr||wr==null||wr!==Nt(r)||(r=wr,`selectionStart`in r&&Sr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 118,520 bytes, lines 8-9
8sNode:r.focusNode,focusOffset:r.focusOffset}),Er&&_r(Er,r)||(Er=r,r=kd(Tr,`onSelect`),0<r.length&&(t=new _n(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=wr)))}function kr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ar={animationend:kr(`Animation`,`AnimationEnd`),animationiteration:kr(`Animation`,`AnimationIteration`),animationstart:kr(`Animation`,`AnimationStart`),transitionrun:kr(`Transition`,`TransitionRun`),transitionstart:kr(`Transition`,`TransitionStart`),transitioncancel:kr(`Transition`,`TransitionCancel`),transitionend:kr(`Transition`,`TransitionEnd`)},jr={},Mr={};on&&(Mr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ar.animationend.animation,delete Ar.animationiteration.animation,delete Ar.animationstart.animation),`TransitionEvent`in window||delete Ar.transitionend.transition);function Nr(e){if(jr[e])return jr[e];if(!Ar[e])return e;var t=Ar[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Mr)return jr[e]=t[n];return e}var Pr=Nr(`animationend`),Fr=Nr(`animationiteration`),Ir=Nr(`animationstart`),Lr=Nr(`transitionrun`),Rr=Nr(`transitionstart`),zr=Nr(`transitioncancel`),Br=Nr(`transitionend`),Vr=new Map,Hr=`abort auxClick beforeToggle 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(` `);Hr.push(`scrollEnd`);function Ur(e,t){Vr.set(e,t),yt(t,[e])}var Wr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Gr=[],Kr=0,qr=0;function Jr(){for(var e=Kr,t=qr=Kr=0;t<e;){var n=Gr[t];Gr[t++]=null;var r=Gr[t];Gr[t++]=null;var i=Gr[t];Gr[t++]=null;var a=Gr[t];if(Gr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Qr(n,i,a)}}function Yr(e,t,n,r){Gr[Kr++]=e,Gr[Kr++]=t,Gr[Kr++]=n,Gr[Kr++]=r,qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Xr(e,t,n,r){return Yr(e,t,n,r),$r(e)}function Zr(e,t){return Yr(e,null,null,t),$r(e)}function Qr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Fe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function $r(e){if(50<fu)throw fu=0,pu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ei={};function ti(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.refCleanup=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 ni(e,t,n,r){return new ti(e,t,n,r)}function ri(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ii(e,t){var n=e.alternate;return n===null?(n=ni(e.tag,t,e.key,e.mode),n.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=e.flags&65011712,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=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ai(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function oi(e,t,n,r,i,a){var o=0;if(r=e,typeof e==`function`)ri(e)&&(o=1);else if(typeof e==`string`)o=qf(e,n,ce.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ni(31,n,t,i),e.elementType=k,e.lanes=a,e;case y:return si(n.children,i,a,t);case b:o=8,i|=24;break;case x:return e=ni(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=ni(13,n,t,i),e.elementType=T,e.lanes=a,e;case E:return e=ni(19,n,t,i),e.elementType=E,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:o=10;break a;case S:o=9;break a;case w:o=11;break a;case D:o=14;break a;case O:o=16,r=null;break a}o=29,n=Error(s(130,e===null?`null`:typeof e,``)),r=null}return t=ni(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function si(e,t,n,r){return e=ni(7,e,r,t),e.lanes=n,e}function ci(e,t,n){return e=ni(6,e,null,t),e.lanes=n,e}function li(e){var t=ni(18,null,null,0);return t.stateNode=e,t}function ui(e,t,n){return t=ni(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var di=new WeakMap;function fi(e,t){if(typeof e==`object`&&e){var n=di.get(e);return n===void 0?(t={value:e,source:t,stack:ye(t)},di.set(e,t),t):n}return{value:e,source:t,stack:ye(t)}}var pi=[],mi=0,hi=null,gi=0,_i=[],vi=0,yi=null,bi=1,xi=``;function Si(e,t){pi[mi++]=gi,pi[mi++]=hi,hi=e,gi=t}function Ci(e,t,n){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,yi=e;var r=bi;e=xi;var i=32-Fe(r)-1;r&=~(1<<i),n+=1;var a=32-Fe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,bi=1<<32-Fe(t)+i|n<<i|r,xi=a+e}else bi=1<<a|n<<i|r,xi=e}function wi(e){e.return!==null&&(Si(e,1),Ci(e,1,0))}function Ti(e){for(;e===hi;)hi=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null;for(;e===yi;)yi=_i[--vi],_i[vi]=null,xi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null}function Ei(e,t){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,bi=t.id,xi=t.overflow,yi=e}var Di=null,Oi=null,ki=!1,Ai=null,ji=!1,Mi=Error(s(519));function Ni(e){throw zi(fi(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Mi}function Pi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[rt]=e,t[it]=r,n){case`dialog`:Sd(`cancel`,t),Sd(`close`,t);break;case`iframe`:case`object`:case`embed`:Sd(`load`,t);break;case`video`:case`audio`:for(n=0;n<yd.length;n++)Sd(yd[n],t);break;case`source`:Sd(`error`,t);break;case`img`:case`image`:case`link`:Sd(`error`,t),Sd(`load`,t);break;case`details`:Sd(`toggle`,t);break;case`input`:Sd(`invalid`,t),Lt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Sd(`invalid`,t);break;case`textarea`:Sd(`invalid`,t),Vt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Fd(t.textContent,n)?(r.popover!=null&&(Sd(`beforetoggle`,t),Sd(`toggle`,t)),r.onScroll!=null&&Sd(`scroll`,t),r.onScrollEnd!=null&&Sd(`scrollend`,t),r.onClick!=null&&(t.onclick=Xt),t=!0):t=!1,t||Ni(e,!0)}function Fi(e){for(Di=e.return;Di;)switch(Di.tag){case 5:case 31:case 13:ji=!1;return;case 27:case 3:ji=!0;return;default:Di=Di.return}}function Ii(e){if(e!==Di)return!1;if(!ki)return Fi(e),ki=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||qd(e.type,e.memoizedProps)),n=!n),n&&Oi&&Ni(e),Fi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Oi=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Oi=mf(e)}else t===27?(t=Oi,tf(e.type)?(e=pf,pf=null,Oi=e):Oi=t):Oi=Di?ff(e.stateNode.nextSibling):null;return!0}function Li(){Oi=Di=null,ki=!1}function Ri(){var e=Ai;return e!==null&&(Ql===null?Ql=e:Ql.push.apply(Ql,e),Ai=null),e}function zi(e){Ai===null?Ai=[e]:Ai.push(e)}var Bi=oe(null),Vi=null,Hi=null;function Ui(e,t,n){F(Bi,t._currentValue),t._currentValue=n}function Wi(e){e._currentValue=Bi.current,se(Bi)}function Gi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ki(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var o=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Gi(a.return,n,e),r||(o=null);break a}a=c.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(s(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Gi(o,n,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function qi(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(s(387));if(o=o.memoizedProps,o!==null){var c=i.type;gr(i.pendingProps.value,o.value)||(e===null?e=[c]:e.push(c))}}else if(i===I.current){if(o=i.alternate,o===null)throw Error(s(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[np]:e.push(np))}i=i.return}e!==null&&Ki(t,e,n,r),t.flags|=262144}function Ji(e){for(e=e.firstContext;e!==null;){if(!gr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Vi=e,Hi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Xi(e){return Qi(Vi,e)}function Zi(e,t){return Vi===null&&Yi(e),Qi(e,t)}function Qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Hi===null){if(e===null)throw Error(s(308));Hi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Hi=Hi.next=t;return n}var $i=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ea=t.unstable_scheduleCallback,ta=t.unstable_NormalPriority,na={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ra(){return{controller:new $i,data:new Map,refCount:0}}function ia(e){e.refCount--,e.refCount===0&&ea(ta,function(){e.controller.abort()})}var aa=null,oa=0,sa=0,ca=null;function la(e,t){if(aa===null){var n=aa=[];oa=0,sa=pd(),ca={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return oa++,t.then(ua,ua),t}function ua(){if(--oa===0&&aa!==null){ca!==null&&(ca.status=`fulfilled`);var e=aa;aa=null,sa=0,ca=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function da(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var fa=N.S;N.S=function(e,t){tu=Ce(),typeof t==`object`&&t&&typeof t.then==`function`&&la(e,t),fa!==null&&fa(e,t)};var pa=oe(null);function ma(){var e=pa.current;return e===null?Il.pooledCache:e}function ha(e,t){t===null?F(pa,pa.current):F(pa,t.pool)}function ga(){var e=ma();return e===null?null:{parent:na._currentValue,pool:e}}var _a=Error(s(460)),va=Error(s(474)),ya=Error(s(542)),ba={then:function(){}};function xa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Sa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Xt,Xt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e;default:if(typeof t.status==`string`)t.then(Xt,Xt);else{if(e=Il,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e}throw wa=t,_a}}function Ca(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(wa=e,_a):e}}var wa=null;function Ta(){if(wa===null)throw Error(s(459));var e=wa;return wa=null,e}function Ea(e){if(e===_a||e===ya)throw Error(s(483))}var Da=null,Oa=0;function ka(e){var t=Oa;return Oa+=1,Da===null&&(Da=[]),Sa(Da,e,t)}function Aa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ja(e,t){throw t.$$typeof===g?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=ii(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function o(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ci(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===O&&Ca(a)===t.type)?(t=i(t,n.props),Aa(t,n),t.return=e,t):(t=oi(n.type,n.key,n.props,null,e.mode,r),Aa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ui(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=si(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ci(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=oi(t.type,t.key,t.props,null,e.mode,n),Aa(n,t),n.return=e,n;case v:return t=ui(t,e.mode,n),t.return=e,t;case O:return t=Ca(t),f(e,t,n)}if(ne(t)||ee(t))return t=si(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ka(t),n);if(t.$$typeof===C)return f(e,Zi(e,t),n);ja(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Ca(n),p(e,t,n,r)}if(ne(n)||ee(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ka(n),r);if(n.$$typeof===C)return p(e,t,Zi(e,n),r);ja(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Ca(r),m(e,t,n,r,i)}if(ne(r)||ee(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,ka(r),i);if(r.$$typeof===C)return m(e,t,n,Zi(t,r),i);ja(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),ki&&Si(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return ki&&Si(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),ki&&Si(i,h),l}function g(i,o,c,l){if(c==null)throw Error(s(151));for(var u=null,d=null,h=o,g=o=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),ki&&Si(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return ki&&Si(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),ki&&Si(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ca(l)===r.type){n(e,r.sibling),c=i(r,a.props),Aa(c,a),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}a.type===y?(c=si(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=oi(a.type,a.key,a.props,null,e.mode,c),Aa(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ui(a,e.mode,c),c.return=e,e=c}return o(e);case O:return a=Ca(a),b(e,r,a,c)}if(ne(a))return h(e,r,a,c);if(ee(a)){if(l=ee(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,ka(a),c);if(a.$$typeof===C)return b(e,r,Zi(e,a),c);ja(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=ci(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===_a||t===ya)throw t;var a=ni(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=$r(e),Qr(e,null,n),t}return Yr(e,r,t,n),$r(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=ca;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Rl&f)===f:(r&f)===f){f!==0&&f===sa&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Fa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Kl|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ga(n[e],t)}var qa=oe(null),Ja=oe(0);function Ya(e,t){e=Wl,F(Ja,e),F(qa,t),Wl=e|t.baseLanes}function Xa(){F(Ja,Wl),F(qa,qa.current)}function Za(){Wl=Ja.current,se(qa),se(Ja)}var Qa=oe(null),$a=null;function eo(e){var t=e.alternate;F(ao,ao.current&1),F(Qa,e),$a===null&&(t===null||qa.current!==null||t.memoizedState!==null)&&($a=e)}function to(e){F(ao,ao.current),F(Qa,e),$a===null&&($a=e)}function no(e){e.tag===22?(F(ao,ao.current),F(Qa,e),$a===null&&($a=e)):ro(e)}function ro(){F(ao,ao.current),F(Qa,Qa.current)}function io(e){se(Qa),$a===e&&($a=null),se(ao)}var ao=oe(0);function oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||uf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var so=0,co=null,lo=null,uo=null,fo=!1,po=!1,mo=!1,ho=0,go=0,_o=null,vo=0;function yo(){throw Error(s(321))}function bo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gr(e[n],t[n]))return!1;return!0}function xo(e,t,n,r,i,a){return so=a,co=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?Fs:Is,mo=!1,a=n(r,i),mo=!1,po&&(a=Co(t,n,r,i)),So(e),a}function So(e){N.H=Ps;var t=lo!==null&&lo.next!==null;if(so=0,uo=lo=co=null,fo=!1,go=0,_o=null,t)throw Error(s(300));e===null||$s||(e=e.dependencies,e!==null&&Ji(e)&&($s=!0))}function Co(e,t,n,r){co=e;var i=0;do{if(po&&(_o=null),go=0,po=!1,25<=i)throw Error(s(301));if(i+=1,uo=lo=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}N.H=Ls,a=t(n,r)}while(po);return a}function wo(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?jo(t):t,e=e.useState()[0],(lo===null?null:lo.memoizedState)!==e&&(co.flags|=1024),t}function To(){var e=ho!==0;return ho=0,e}function Eo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Do(e){if(fo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}fo=!1}so=0,uo=lo=co=null,po=!1,go=ho=0,_o=null}function Oo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return uo===null?co.memoizedState=uo=e:uo=uo.next=e,uo}function ko(){if(lo===null){var e=co.alternate;e=e===null?null:e.memoizedState}else e=lo.next;var t=uo===null?co.memoizedState:uo.next;if(t!==null)uo=t,lo=e;else{if(e===null)throw co.alternate===null?Error(s(467)):Error(s(310));lo=e,e={memoizedState:lo.memoizedState,baseState:lo.baseState,baseQueue:lo.baseQueue,queue:lo.queue,next:null},uo===null?co.memoizedState=uo=e:uo=uo.next=e}return uo}function Ao(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function jo(e){var t=go;return go+=1,_o===null&&(_o=[]),e=Sa(_o,e,t),t=co,(uo===null?t.memoizedState:uo.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?Fs:Is),e}function Mo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return jo(e);if(e.$$typeof===C)return Xi(e)}throw Error(s(438,String(e)))}function No(e){var t=null,n=co.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=co.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Ao(),co.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Po(e,t){return typeof t==`function`?t(e):t}function Fo(e){return Io(ko(),lo,e)}function Io(e,t,n){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=o=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(so&f)===f:(Rl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===sa&&(d=!0);else if((so&p)===p){u=u.next,p===sa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,o=a):l=l.next=f,co.lanes|=p,Kl|=p;f=u.action,mo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,o=a):l=l.next=p,co.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!gr(a,e.memoizedState)&&($s=!0,d&&(n=ca,n!==null)))throw n;e.memoizedState=a,e.baseState=o,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Lo(e){var t=ko(),n=t.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);gr(a,t.memoizedState)||($s=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Ro(e,t,n){var r=co,i=ko(),a=ki;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!gr((lo||i).memoizedState,n);if(o&&(i.memoizedState=n,$s=!0),i=i.queue,ss(Vo.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||uo!==null&&uo.memoizedState.tag&1){if(r.flags|=2048,ns(9,{destroy:void 0},Bo.bind(null,r,i,n,t),null),Il===null)throw Error(s(349));a||so&127||zo(r,t,n)}return n}function zo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=co.updateQueue,t===null?(t=Ao(),co.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Bo(e,t,n,r){t.value=n,t.getSnapshot=r,G(t)&&Ho(e)}function Vo(e,t,n){return n(function(){G(t)&&Ho(e)})}function G(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gr(e,n)}catch{return!0}}function Ho(e){var t=Zr(e,2);t!==null&&gu(t,e,2)}function Uo(e){var t=Oo();if(typeof e==`function`){var n=e;if(e=n(),mo){Pe(!0);try{n()}finally{Pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:e},t}function Wo(e,t,n,r){return e.baseState=n,Io(e,lo,typeof r==`function`?r:Po)}function Go(e,t,n,r,i){if(q(e))throw Error(s(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};N.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Ko(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Ko(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),K(e,t,s)}catch(n){Jo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),K(e,t,a)}catch(n){Jo(e,t,n)}}function K(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qo(e,t,n)},function(n){return Jo(e,t,n)}):qo(e,t,n)}function qo(e,t,n){t.status=`fulfilled`,t.value=n,Yo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ko(e,n)))}function Jo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yo(t),t=t.next;while(t!==r)}e.action=null}function Yo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xo(e,t){return t}function Zo(e,t){if(ki){var n=Il.formState;if(n!==null){a:{var r=co;if(ki){if(Oi){b:{for(var i=Oi,a=ji;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Oi=ff(i.nextSibling),r=i.data===`F!`;break a}}Ni(r)}r=!1}r&&(t=n[0])}}return n=Oo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:t},n.queue=r,n=ks.bind(null,co,r),r.dispatch=n,r=Uo(!1),a=js.bind(null,co,!1,r.queue),r=Oo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Go.bind(null,co,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Qo(e){return $o(ko(),lo,e)}function $o(e,t,n){if(t=Io(e,t,Xo)[0],e=Fo(Po)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=jo(t)}catch(e){throw e===_a?ya:e}else r=t;t=ko();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(co.flags|=2048,ns(9,{destroy:void 0},es.bind(null,i,n),null)),[r,a,e]}function es(e,t){e.action=t}function ts(e){var t=ko(),n=lo;if(n!==null)return $o(t,n,e);ko(),t=t.memoizedState,n=ko();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ns(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=co.updateQueue,t===null&&(t=Ao(),co.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function rs(){return ko().memoizedState}function is(e,t,n,r){var i=Oo();co.flags|=e,i.memoizedState=ns(1|t,{destroy:void 0},n,r===void 0?null:r)}function as(e,t,n,r){var i=ko();r=r===void 0?null:r;var a=i.memoizedState.inst;lo!==null&&r!==null&&bo(r,lo.memoizedState.deps)?i.memoizedState=ns(t,a,n,r):(co.flags|=e,i.memoizedState=ns(1|t,a,n,r))}function os(e,t){is(8390656,8,e,t)}function ss(e,t){as(2048,8,e,t)}function cs(e){co.flags|=4;var t=co.updateQueue;if(t===null)t=Ao(),co.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ls(e){var t=ko().memoizedState;return cs({ref:t,nextImpl:e}),function(){if(Fl&2)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function us(e,t){return as(4,2,e,t)}function ds(e,t){return as(4,4,e,t)}function fs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ps(e,t,n){n=n==null?null:n.concat([e]),as(4,4,fs.bind(null,t,e),n)}function ms(){}function hs(e,t){var n=ko();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&bo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function gs(e,t){var n=ko();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&bo(t,r[1]))return r[0];if(r=e(),mo){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r}function _s(e,t,n){return n===void 0||so&1073741824&&!(Rl&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),co.lanes|=e,Kl|=e,n)}function vs(e,t,n,r){return gr(n,t)?n:qa.current===null?!(so&42)||so&1073741824&&!(Rl&261930)?($s=!0,e.memoizedState=n):(e=hu(),co.lanes|=e,Kl|=e,t):(e=_s(e,n,r),gr(e,t)||($s=!0),e)}function ys(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,js(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,da(c,r),mu(e)):As(e,t,r,mu(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=Ss(e).queue;ys(e,i,t,re,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:re},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},mu())}function ws(){return Xi(np)}function Ts(){return ko().memoizedState}function Es(){return ko().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=Ra(n);var r=za(t,e,n);r!==null&&(gu(r,t,n),Ba(r,t,n)),t={cache:ra()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},q(e)?Ms(t,n):(n=Xr(e,t,n,r),n!==null&&(gu(n,e,r),Ns(n,t,r)))}function ks(e,t,n){As(e,t,n,mu())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(q(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,gr(s,o))return Yr(e,t,i,0),Il===null&&Jr(),!1}catch{}if(n=Xr(e,t,i,r),n!==null)return gu(n,e,r),Ns(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},q(e)){if(t)throw Error(s(479))}else t=Xr(e,n,r,2),t!==null&&gu(t,e,2)}function q(e){var t=e.alternate;return e===co||t!==null&&t===co}function Ms(e,t){po=fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}var Ps={readContext:Xi,use:Mo,useCallback:yo,useContext:yo,useEffect:yo,useImperativeHandle:yo,useLayoutEffect:yo,useInsertionEffect:yo,useMemo:yo,useReducer:yo,useRef:yo,useState:yo,useDebugValue:yo,useDeferredValue:yo,useTransition:yo,useSyncExternalStore:yo,useId:yo,useHostTransitionStatus:yo,useFormState:yo,useActionState:yo,useOptimistic:yo,useMemoCache:yo,useCacheRefresh:yo};Ps.useEffectEvent=yo;var Fs={readContext:Xi,use:Mo,useCallback:function(e,t){return Oo().memoizedState=[e,t===void 0?null:t],e},useContext:Xi,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Oo();t=t===void 0?null:t;var r=e();if(mo){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Oo();if(n!==void 0){var i=n(t);if(mo){Pe(!0);try{n(t)}finally{Pe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Os.bind(null,co,e),[r.memoizedState,e]},useRef:function(e){var t=Oo();return e={current:e},t.memoizedState=e},useState:function(e){e=Uo(e);var t=e.queue,n=ks.bind(null,co,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Oo(),e,t)},useTransition:function(){var e=Uo(!1);return e=ys.bind(null,co,e.queue,!0,!1),Oo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=co,i=Oo();if(ki){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Il===null)throw Error(s(349));Rl&127||zo(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,os(Vo.bind(null,r,a,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},Bo.bind(null,r,a,n,t),null),n},useId:function(){var e=Oo(),t=Il.identifierPrefix;if(ki){var n=xi,r=bi;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=ho++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=vo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ws,useFormState:Zo,useActionState:Zo,useOptimistic:function(e){var t=Oo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=js.bind(null,co,!0,n),n.dispatch=t,[e,t]},useMemoCache:No,useCacheRefresh:function(){return Oo().memoizedState=Ds.bind(null,co)},useEffectEvent:function(e){var t=Oo(),n={impl:e};return t.memoizedState=n,function(){if(Fl&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Is={readContext:Xi,use:Mo,useCallback:hs,useContext:Xi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:Fo,useRef:rs,useState:function(){return Fo(Po)},useDebugValue:ms,useDeferredValue:function(e,t){return vs(ko(),lo.memoizedState,e,t)},useTransition:function(){var e=Fo(Po)[0],t=ko().memoizedState;return[typeof e==`boolean`?e:jo(e),t]},useSyncExternalStore:Ro,useId:Ts,useHostTransitionStatus:ws,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){return Wo(ko(),lo,e,t)},useMemoCache:No,useCacheRefresh:Es};Is.useEffectEvent=ls;var Ls={readContext:Xi,use:Mo,useCallback:hs,useContext:Xi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:Lo,useRef:rs,useState:function(){return Lo(Po)},useDebugValue:ms,useDeferredValue:function(e,t){var n=ko();return lo===null?_s(n,e,t):vs(n,lo.memoizedState,e,t)},useTransition:function(){var e=Lo(Po)[0],t=ko().memoizedState;return[typeof e==`boolean`?e:jo(e),t]},useSyncExternalStore:Ro,useId:Ts,useHostTransitionStatus:ws,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){var n=ko();return lo===null?(n.baseState=e,[e,n.queue.dispatch]):Wo(n,lo,e,t)},useMemoCache:No,useCacheRefresh:Es};Ls.useEffectEvent=ls;function Rs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var zs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ra(r);i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(gu(t,e,r),Ba(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ra(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(gu(t,e,r),Ba(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=Ra(n);r.tag=2,t!=null&&(r.callback=t),t=za(e,r,n),t!==null&&(gu(t,e,n),Ba(t,e,n))}};function Bs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!_r(n,r)||!_r(i,a):!0}function Vs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&zs.enqueueReplaceState(t,t.state,null)}function Hs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Us(e){Wr(e)}function Ws(e){console.error(e)}function Gs(e){Wr(e)}function Ks(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){return n=Ra(n),n.tag=3,n.payload={element:null},n.callback=function(){Ks(e,t)},n}function Ys(e){return e=Ra(e),e.tag=3,e}function Xs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){qs(t,n,r),typeof i!=`function`&&(iu===null?iu=new Set([this]):iu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Zs(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&qi(t,n,i,!0),n=Qa.current,n!==null){switch(n.tag){case 31:case 13:return $a===null?Ou():n.alternate===null&&Gl===0&&(Gl=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,i)),!1;case 22:return n.flags|=65536,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),qu(e,r,i)),!1}throw Error(s(435,n.tag))}return qu(e,r,i),Ou(),!1}if(ki)return t=Qa.current,t===null?(r!==Mi&&(t=Error(s(423),{cause:r}),zi(fi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=fi(r,n),i=Js(e.stateNode,r,i),Va(e,i),Gl!==4&&(Gl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Mi&&(e=Error(s(422),{cause:r}),zi(fi(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=fi(a,n),Zl===null?Zl=[a]:Zl.push(a),Gl!==4&&(Gl=2),t===null)return!0;r=fi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Js(n.stateNode,r,e),Va(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(iu===null||!iu.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Ys(i),Xs(i,e,n,r),Va(n,i),!1}n=n.return}while(n!==null);return!1}var Qs=Error(s(461)),$s=!1;function ec(e,t,n,r){t.child=e===null?Pa(t,null,n,r):Na(t,e.child,n,r)}function tc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Yi(t),r=xo(e,t,n,o,a,i),s=To(),e!==null&&!$s?(Eo(e,t,i),Tc(e,t,i)):(ki&&s&&wi(t),t.flags|=1,ec(e,t,r,i),t.child)}function nc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ri(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,rc(e,t,a,r,i)):(e=oi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ec(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?_r:n,n(o,r)&&e.ref===t.ref)return Tc(e,t,i)}return t.flags|=1,e=ii(a,r),e.ref=t.ref,e.return=t,t.child=e}function rc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(_r(a,r)&&e.ref===t.ref)if($s=!1,t.pendingProps=r=a,Ec(e,i))e.flags&131072&&($s=!0);else return t.lanes=e.lanes,Tc(e,t,i)}return dc(e,t,n,r,i)}function ic(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return oc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ha(t,a===null?null:a.cachePool),a===null?Xa():Ya(t,a),no(t);else return r=t.lanes=536870912,oc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ha(t,null),Xa(),ro(t)):(ha(t,a.cachePool),Ya(t,a),ro(t),t.memoizedState=null);return ec(e,t,i,n),t.child}function ac(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function oc(e,t,n,r,i){var a=ma();return a=a===null?null:{parent:na._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ha(t,null),Xa(),no(t),e!==null&&qi(e,t,r,!0),t.childLanes=i,null}function sc(e,t){return t=bc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function cc(e,t,n){return Na(t,e.child,null,n),e=sc(t,t.pendingProps),e.flags|=2,io(t),t.memoizedState=null,e}function lc(e,t,n){var r=t.pendingProps,i=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(ki){if(r.mode===`hidden`)return e=sc(t,r),t.lanes=536870912,ac(null,e);if(to(t),(e=Oi)?(e=cf(e,ji),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return t.lanes=536870912,null}return sc(t,r)}var a=e.memoizedState;if(a!==null){var o=a.dehydrated;if(to(t),i)if(t.flags&256)t.flags&=-257,t=cc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if($s||qi(e,t,n,!1),i=(n&e.childLanes)!==0,$s||i){if(r=Il,r!==null&&(o=Ze(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,Zr(e,o),gu(r,e,o),Qs;Ou(),t=cc(e,t,n)}else e=a.treeContext,Oi=ff(o.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=sc(t,r),t.flags|=4096;return t}return e=ii(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function uc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(s(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function dc(e,t,n,r,i){return Yi(t),n=xo(e,t,n,r,void 0,i),r=To(),e!==null&&!$s?(Eo(e,t,i),Tc(e,t,i)):(ki&&r&&wi(t),t.flags|=1,ec(e,t,n,i),t.child)}function fc(e,t,n,r,i,a){return Yi(t),t.updateQueue=null,n=Co(t,r,n,i),So(e),r=To(),e!==null&&!$s?(Eo(e,t,a),Tc(e,t,a)):(ki&&r&&wi(t),t.flags|=1,ec(e,t,n,a),t.child)}function pc(e,t,n,r,i){if(Yi(t),t.stateNode===null){var a=ei,o=n.contextType;typeof o==`object`&&o&&(a=Xi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=zs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ia(t),o=n.contextType,a.context=typeof o==`object`&&o?Xi(o):ei,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Rs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&zs.enqueueReplaceState(a,a.state,null),Wa(t,r,a,i),Ua(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Hs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ei,typeof u==`object`&&u&&(o=Xi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Vs(t,a,r,o),Fa=!1;var f=t.memoizedState;a.state=f,Wa(t,r,a,i),Ua(),l=t.memoizedState,s||f!==l||Fa?(typeof d==`function`&&(Rs(t,n,d,r),l=t.memoizedState),(c=Fa||Bs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,La(e,t),o=t.memoizedProps,u=Hs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ei,typeof l==`object`&&l&&(c=Xi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Vs(t,a,r,c),Fa=!1,f=t.memoizedState,a.state=f,Wa(t,r,a,i),Ua();var p=t.memoizedState;o!==d||f!==p||Fa||e!==null&&e.dependencies!==null&&Ji(e.dependencies)?(typeof s==`function`&&(Rs(t,n,s,r),p=t.memoizedState),(u=Fa||Bs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ji(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,uc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Na(t,e.child,null,i),t.child=Na(t,null,n,i)):ec(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Tc(e,t,i),e}function mc(e,t,n,r){return Li(),t.flags|=256,ec(e,t,n,r),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:ga()}}function _c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function vc(e,t,n){var r=t.pendingProps,i=!1,a=(t.flags&128)!=0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(ao.current&2)!=0),o&&(i=!0,t.flags&=-129),o=(t.flags&32)!=0,t.flags&=-33,e===null){if(ki){if(i?eo(t):ro(t),(e=Oi)?(e=cf(e,ji),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(ro(t),i=t.mode,c=bc({mode:`hidden`,children:c},i),r=si(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,o,n),t.memoizedState=hc,ac(null,r)):(eo(t),yc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(eo(t),t.flags&=-257,t=xc(e,t,n)):t.memoizedState===null?(ro(t),c=r.fallback,i=t.mode,r=bc({mode:`visible`,children:r.children},i),c=si(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Na(t,e.child,null,n),r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,o,n),t.memoizedState=hc,t=ac(null,r)):(ro(t),t.child=e.child,t.flags|=128,t=null);else if(eo(t),uf(c)){if(o=c.nextSibling&&c.nextSibling.dataset,o)var u=o.dgst;o=u,r=Error(s(419)),r.stack=``,r.digest=o,zi({value:r,source:null,stack:null}),t=xc(e,t,n)}else if($s||qi(e,t,n,!1),o=(n&e.childLanes)!==0,$s||o){if(o=Il,o!==null&&(r=Ze(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Zr(e,r),gu(o,e,r),Qs;lf(c)||Ou(),t=xc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Oi=ff(c.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=yc(t,r.children),t.flags|=4096);return t}return i?(ro(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=ii(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=si(c,i,n,null),c.flags|=2):c=ii(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ac(null,r),r=t.child,c=e.child.memoizedState,c===null?c=gc(n):(i=c.cachePool,i===null?i=ga():(l=na._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=_c(e,o,n),t.memoizedState=hc,ac(e.child,r)):(eo(t),n=e.child,e=n.sibling,n=ii(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function yc(e,t){return t=bc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function bc(e,t){return e=ni(22,e,null,t),e.lanes=0,e}function xc(e,t,n){return Na(t,e.child,null,n),e=yc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gi(e.return,t,n)}function Cc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function wc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ao.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,F(ao,o),ec(e,t,r,n),r=ki?gi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sc(e,n,t);else if(e.tag===19)Sc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&oo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Cc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&oo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Cc(t,!0,n,null,a,r);break;case`together`:Cc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,n=ii(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ii(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ec(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ji(e))):!0}function Dc(e,t,n){switch(t.tag){case 3:de(t,t.stateNode.containerInfo),Ui(t,na,e.memoizedState.cache),Li();break;case 27:case 5:pe(t);break;case 4:de(t,t.stateNode.containerInfo);break;case 10:Ui(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,to(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(eo(t),e=Tc(e,t,n),e===null?null:e.sibling):vc(e,t,n):(eo(t),t.flags|=128,null);eo(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return wc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),F(ao,ao.current),r)break;return null;case 22:return t.lanes=0,ic(e,t,n,t.pendingProps);case 24:Ui(t,na,e.memoizedState.cache)}return Tc(e,t,n)}function Oc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)$s=!0;else{if(!Ec(e,n)&&!(t.flags&128))return $s=!1,Dc(e,t,n);$s=!!(e.flags&131072)}else $s=!1,ki&&t.flags&1048576&&Ci(t,gi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ca(t.elementType),t.type=e,typeof e==`function`)ri(e)?(r=Hs(e,r),t.tag=1,t=pc(null,t,e,r,n)):(t.tag=0,t=dc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===w){t.tag=11,t=tc(null,t,e,r,n);break a}else if(i===D){t.tag=14,t=nc(null,t,e,r,n);break a}}throw t=M(e)||e,Error(s(306,t,``))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Hs(r,t.pendingProps),pc(e,t,r,i,n);case 3:a:{if(de(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,La(e,t),Wa(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Ui(t,na,r),r!==a.cache&&Ki(t,[na],n,!0),Ua(),r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=mc(e,t,r,n);break a}else if(r!==i){i=fi(Error(s(424)),t),zi(i),t=mc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Oi=ff(e.firstChild),Di=t,ki=!0,Ai=null,ji=!0,n=Pa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Li(),r===i){t=Tc(e,t,n);break a}ec(e,t,r,n)}t=t.child}return t;case 26:return uc(e,t),e===null?(n=Nf(t.type,null,t.pendingProps,null))?t.memoizedState=n:ki||(n=t.type,e=t.pendingProps,r=Wd(ue.current).createElement(n),r[rt]=t,r[it]=e,Rd(r,n,e),gt(r),t.stateNode=r):t.memoizedState=Nf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pe(t),e===null&&ki&&(r=t.stateNode=gf(t.type,t.pendingProps,ue.current),Di=t,ji=!0,i=Oi,tf(t.type)?(pf=i,Oi=ff(r.firstChild)):Oi=i),ec(e,t,t.pendingProps.children,n),uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ki&&((i=r=Oi)&&(r=of(r,t.type,t.pendingProps,ji),r===null?i=!1:(t.stateNode=r,Di=t,Oi=ff(r.firstChild),ji=!1,i=!0)),i||Ni(t)),pe(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,r=a.children,qd(i,a)?r=null:o!==null&&qd(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=xo(e,t,wo,null,null,n),np._currentValue=i),uc(e,t),ec(e,t,r,n),t.child;case 6:return e===null&&ki&&((e=n=Oi)&&(n=sf(n,t.pendingProps,ji),n===null?e=!1:(t.stateNode=n,Di=t,Oi=null,e=!0)),e||Ni(t)),null;case 13:return vc(e,t,n);case 4:return de(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Na(t,null,r,n):ec(e,t,r,n),t.child;case 11:return tc(e,t,t.type,t.pendingProps,n);case 7:return ec(e,t,t.pendingProps,n),t.child;case 8:return ec(e,t,t.pendingProps.children,n),t.child;case 12:return ec(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ui(t,t.type,r.value),ec(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Yi(t),i=Xi(i),r=r(i),t.flags|=1,ec(e,t,r,n),t.child;case 14:return nc(e,t,t.type,t.pendingProps,n);case 15:return rc(e,t,t.type,t.pendingProps,n);case 19:return wc(e,t,n);case 31:return lc(e,t,n);case 22:return ic(e,t,n,t.pendingProps);case 24:return Yi(t),r=Xi(na),e===null?(i=ma(),i===null&&(i=Il,a=ra(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Ia(t),Ui(t,na,i)):((e.lanes&n)!==0&&(La(e,t),Wa(t,null,null,n),Ua()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Ui(t,na,r),r!==i.cache&&Ki(t,[na],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Ui(t,na,r))),ec(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function kc(e){e.flags|=4}function Ac(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Tu())e.flags|=8192;else throw wa=ba,va}else e.flags&=-16777217}function jc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Jf(t))if(Tu())e.flags|=8192;else throw wa=ba,va}function Mc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ge(),e.lanes|=t,Xl|=t)}function Nc(e,t){if(!ki)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Pc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)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 Fc(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pc(t),null;case 1:return Pc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Wi(na),fe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ii(t)?kc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ri())),Pc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(kc(t),a===null?(Pc(t),Ac(t,i,null,r,n)):(Pc(t),jc(t,a))):a?a===e.memoizedState?(Pc(t),t.flags&=-16777217):(kc(t),Pc(t),jc(t,a)):(e=e.memoizedProps,e!==r&&kc(t),Pc(t),Ac(t,i,e,r,n)),null;case 27:if(me(t),n=ue.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Pc(t),null}e=ce.current,Ii(t)?Pi(t,e):(e=gf(i,r,n),t.stateNode=e,kc(t))}return Pc(t),null;case 5:if(me(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Pc(t),null}if(a=ce.current,Ii(t))Pi(t,a);else{var o=Wd(ue.current);switch(a){case 1:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=o.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[rt]=t,a[it]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Rd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=ue.current,Ii(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Di,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[rt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Fd(e.nodeValue,n)),e||Ni(t,!0)}else e=Wd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ii(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[rt]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(s(558))}return Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Ii(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[rt]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),i=!1}else i=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Mc(t,t.updateQueue),Pc(t),null);case 4:return fe(),e===null&&Td(t.stateNode.containerInfo),Pc(t),null;case 10:return Wi(t.type),Pc(t),null;case 19:if(se(ao),r=t.memoizedState,r===null)return Pc(t),null;if(i=(t.flags&128)!=0,a=r.rendering,a===null)if(i)Nc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=oo(e),a!==null){for(t.flags|=128,Nc(r,!1),e=a.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ai(n,e),n=n.sibling;return F(ao,ao.current&1|2),ki&&Si(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ce()>nu&&(t.flags|=128,i=!0,Nc(r,!1),t.lanes=4194304)}else{if(!i)if(e=oo(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!ki)return Pc(t),null}else 2*Ce()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,i=!0,Nc(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ce(),e.sibling=null,n=ao.current,F(ao,i?n&1|2:n&1),ki&&Si(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&se(pa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wi(na),Pc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Ic(e,t){switch(Ti(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wi(na),fe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return me(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(s(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return se(ao),null;case 4:return fe(),null;case 10:return Wi(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&se(pa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wi(na),null;case 25:return null;default:return null}}function Lc(e,t){switch(Ti(t),t.tag){case 3:Wi(na),fe();break;case 26:case 27:case 5:me(t);break;case 4:fe();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:se(ao);break;case 10:Wi(t.type);break;case 22:case 23:io(t),Za(),e!==null&&se(pa);break;case 24:Wi(na)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ku(t,t.return,e)}}function J(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Ku(e,e.return,t)}}}function Bc(e,t,n){n.props=Hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function Vc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ku(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ku(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ku(e,t,n)}else n.current=null}function Y(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ku(e,e.return,t)}}function Uc(e,t,n){try{var r=e.stateNode;zd(r,e.type,n,t),r[it]=t}catch(t){Ku(e,e.return,t)}}function Wc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function Gc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Wc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Xt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Rd(t,r,n),t[rt]=e,t[it]=n}catch(t){Ku(e,e.return,t)}}var Yc=!1,Xc=!1,Zc=!1,Qc=typeof WeakSet==`function`?WeakSet:Set,$c=null;function el(e,t){if(e=e.containerInfo,Hd=dp,e=xr(e),Sr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ud={focusedElem:e,selectionRange:n},dp=!1,$c=t;$c!==null;)if(t=$c,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,$c=e;else for(;$c!==null;){switch(t=$c,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Hs(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,$c=e;break}$c=t.return}}function tl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:gl(e,n),r&4&&Rc(5,n);break;case 1:if(gl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=Hs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}r&64&&zc(n),r&512&&Vc(n,n.return);break;case 3:if(gl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ka(e,t)}catch(e){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&Jc(n);case 26:case 5:gl(e,n),t===null&&r&4&&Y(n),r&512&&Vc(n,n.return);break;case 12:gl(e,n);break;case 31:gl(e,n),r&4&&sl(e,n);break;case 13:gl(e,n),r&4&&cl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||Yc,!r){t=t!==null&&t.memoizedState!==null||Xc,i=Yc;var a=Xc;Yc=r,(Xc=t)&&!a?vl(e,n,(n.subtreeFlags&8772)!=0):gl(e,n),Yc=i,Xc=a}break;case 30:break;default:gl(e,n)}}function nl(e){var t=e.alternate;t!==null&&(e.alternate=null,nl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&dt(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}var rl=null,il=!1;function al(e,t,n){for(n=n.child;n!==null;)ol(e,t,n),n=n.sibling}function ol(e,t,n){if(Ne&&typeof Ne.onCommitFiberUnmount==`function`)try{Ne.onCommitFiberUnmount(Me,n)}catch{}switch(n.tag){case 26:Xc||Hc(n,t),al(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Xc||Hc(n,t);var r=rl,i=il;tf(n.type)&&(rl=n.stateNode,il=!1),al(e,t,n),_f(n.stateNode),rl=r,il=i;break;case 5:Xc||Hc(n,t);case 6:if(r=rl,i=il,rl=null,al(e,t,n),rl=r,il=i,rl!==null)if(il)try{(rl.nodeType===9?rl.body:rl.nodeName===`HTML`?rl.ownerDocument.body:rl).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{rl.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}break;case 18:rl!==null&&(il?(e=rl,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Lp(e)):nf(rl,n.stateNode));break;case 4:r=rl,i=il,rl=n.stateNode.containerInfo,il=!0,al(e,t,n),rl=r,il=i;break;case 0:case 11:case 14:case 15:J(2,n,t),Xc||J(4,n,t),al(e,t,n);break;case 1:Xc||(Hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Bc(n,t,r)),al(e,t,n);break;case 21:al(e,t,n);break;case 22:Xc=(r=Xc)||n.memoizedState!==null,al(e,t,n),Xc=r;break;default:al(e,t,n)}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Lp(e)}catch(e){Ku(t,t.return,e)}}}function cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Lp(e)}catch(e){Ku(t,t.return,e)}}function ll(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Qc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Qc),t;default:throw Error(s(435,e.tag))}}function ul(e,t){var n=ll(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function dl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,o=t,c=o;a:for(;c!==null;){switch(c.tag){case 27:if(tf(c.type)){rl=c.stateNode,il=!1;break a}break;case 5:rl=c.stateNode,il=!1;break a;case 3:case 4:rl=c.stateNode.containerInfo,il=!0;break a}c=c.return}if(rl===null)throw Error(s(160));ol(a,o,i),rl=null,il=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)pl(t,e),t=t.sibling}var fl=null;function pl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:dl(t,e),ml(e),r&4&&(J(3,e,e.return),Rc(3,e),J(5,e,e.return));break;case 1:dl(t,e),ml(e),r&512&&(Xc||n===null||Hc(n,n.return)),r&64&&Yc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=fl;if(dl(t,e),ml(e),r&512&&(Xc||n===null||Hc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[ut]||a[rt]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),Rd(a,r,n),a[rt]=e,gt(a),r=a;break a;case`link`:var o=Gf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(c,1);break b}}a=i.createElement(r),Rd(a,r,n),i.head.appendChild(a);break;case`meta`:if(o=Gf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(c,1);break b}}a=i.createElement(r),Rd(a,r,n),i.head.appendChild(a);break;default:throw Error(s(468,r))}a[rt]=e,gt(a),r=a}e.stateNode=r}else Kf(i,e.type,e.stateNode);else e.stateNode=Bf(i,r,e.memoizedProps);else a===r?r===null&&e.stateNode!==null&&Uc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?Kf(i,e.type,e.stateNode):Bf(i,r,e.memoizedProps))}break;case 27:dl(t,e),ml(e),r&512&&(Xc||n===null||Hc(n,n.return)),n!==null&&r&4&&Uc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(dl(t,e),ml(e),r&512&&(Xc||n===null||Hc(n,n.return)),e.flags&32){i=e.stateNode;try{Ht(i,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Uc(e,i,n===null?i:n.memoizedProps)),r&1024&&(Zc=!0);break;case 6:if(dl(t,e),ml(e),r&4){if(e.stateNode===null)throw Error(s(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(Wf=null,i=fl,fl=bf(t.containerInfo),dl(t,e),fl=i,ml(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Lp(t.containerInfo)}catch(t){Ku(e,e.return,t)}Zc&&(Zc=!1,hl(e));break;case 4:r=fl,fl=bf(e.stateNode.containerInfo),dl(t,e),ml(e),fl=r;break;case 12:dl(t,e),ml(e);break;case 31:dl(t,e),ml(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ul(e,r)));break;case 13:dl(t,e),ml(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(eu=Ce()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ul(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Yc,d=Xc;if(Yc=u||i,Xc=d||l,dl(t,e),Xc=d,Yc=u,ml(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Yc||Xc||_l(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?rf(m,!0):rf(l.stateNode,!1)}catch(e){Ku(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ul(e,n))));break;case 19:dl(t,e),ml(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ul(e,r)));break;case 30:break;case 21:break;default:dl(t,e),ml(e)}}function ml(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Wc(r)){n=r;break}r=r.return}if(n==null)throw Error(s(160));switch(n.tag){case 27:var i=n.stateNode;qc(e,Gc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(Ht(a,``),n.flags&=-33),qc(e,Gc(e),a);break;case 3:case 4:var o=n.stateNode.containerInfo;Kc(e,Gc(e),o);break;default:throw Error(s(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function hl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;hl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function gl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)tl(e,t.alternate,t),t=t.sibling}function _l(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:J(4,t,t.return),_l(t);break;case 1:Hc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Bc(t,t.return,n),_l(t);break;case 27:_f(t.stateNode);case 26:case 5:Hc(t,t.return),_l(t);break;case 22:t.memoizedState===null&&_l(t);break;case 30:_l(t);break;default:_l(t)}e=e.sibling}}function vl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:vl(i,a,n),Rc(4,a);break;case 1:if(vl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ga(c[i],s)}catch(e){Ku(r,r.return,e)}}n&&o&64&&zc(a),Vc(a,a.return);break;case 27:Jc(a);case 26:case 5:vl(i,a,n),n&&r===null&&o&4&&Y(a),Vc(a,a.return);break;case 12:vl(i,a,n);break;case 31:vl(i,a,n),n&&o&4&&sl(i,a);break;case 13:vl(i,a,n),n&&o&4&&cl(i,a);break;case 22:a.memoizedState===null&&vl(i,a,n),Vc(a,a.return);break;case 30:break;default:vl(i,a,n)}t=t.sibling}}function yl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ia(n))}function bl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e))}function xl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Sl(e,t,n,r),t=t.sibling}function Sl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:xl(e,t,n,r),i&2048&&Rc(9,t);break;case 1:xl(e,t,n,r);break;case 3:xl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e)));break;case 12:if(i&2048){xl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ku(t,t.return,e)}}else xl(e,t,n,r);break;case 31:xl(e,t,n,r);break;case 13:xl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?xl(e,t,n,r):(a._visibility|=2,Cl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?xl(e,t,n,r):wl(e,t),i&2048&&yl(o,t);break;case 24:xl(e,t,n,r),i&2048&&bl(t.alternate,t);break;default:xl(e,t,n,r)}}function Cl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Cl(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Cl(a,o,s,c,i)):u._visibility&2?Cl(a,o,s,c,i):wl(a,o),i&&l&2048&&yl(o.alternate,o);break;case 24:Cl(a,o,s,c,i),i&&l&2048&&bl(o.alternate,o);break;default:Cl(a,o,s,c,i)}t=t.sibling}}function wl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:wl(n,r),i&2048&&yl(r.alternate,r);break;case 24:wl(n,r),i&2048&&bl(r.alternate,r);break;default:wl(n,r)}t=t.sibling}}var Tl=8192;function El(e,t,n){if(e.subtreeFlags&Tl)for(e=e.child;e!==null;)Dl(e,t,n),e=e.sibling}function Dl(e,t,n){switch(e.tag){case 26:El(e,t,n),e.flags&Tl&&e.memoizedState!==null&&Yf(n,fl,e.memoizedState,e.memoizedProps);break;case 5:El(e,t,n);break;case 3:case 4:var r=fl;fl=bf(e.stateNode.containerInfo),El(e,t,n),fl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Tl,Tl=16777216,El(e,t,n),Tl=r):El(e,t,n));break;default:El(e,t,n)}}function Ol(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function kl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];$c=r,Ml(r,e)}Ol(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Al(e),e=e.sibling}function Al(e){switch(e.tag){case 0:case 11:case 15:kl(e),e.flags&2048&&J(9,e,e.return);break;case 3:kl(e);break;case 12:kl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,jl(e)):kl(e);break;default:kl(e)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];$c=r,Ml(r,e)}Ol(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:J(8,t,t.return),jl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,jl(t));break;default:jl(t)}e=e.sibling}}function Ml(e,t){for(;$c!==null;){var n=$c;switch(n.tag){case 0:case 11:case 15:J(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ia(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,$c=r;else a:for(n=e;$c!==null;){r=$c;var i=r.sibling,a=r.return;if(nl(r),r===n){$c=null;break a}if(i!==null){i.return=a,$c=i;break a}$c=a}}}var Nl={getCacheForType:function(e){var t=Xi(na),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Xi(na).controller.signal}},Pl=typeof WeakMap==`function`?WeakMap:Map,Fl=0,Il=null,Ll=null,Rl=0,zl=0,Bl=null,Vl=!1,Hl=!1,Ul=!1,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,Ql=null,$l=!1,eu=0,tu=0,nu=1/0,ru=null,iu=null,au=0,ou=null,su=null,cu=0,lu=0,uu=null,du=null,fu=0,pu=null;function mu(){return Fl&2&&Rl!==0?Rl&-Rl:N.T===null?et():pd()}function hu(){if(Yl===0)if(!(Rl&536870912)||ki){var e=V;V<<=1,!(V&3932160)&&(V=262144),Yl=e}else Yl=536870912;return e=Qa.current,e!==null&&(e.flags|=32),Yl}function gu(e,t,n){(e===Il&&(zl===2||zl===9)||e.cancelPendingCommit!==null)&&(Cu(e,0),bu(e,Rl,Yl,!1)),qe(e,n),(!(Fl&2)||e!==Il)&&(e===Il&&(!(Fl&2)&&(ql|=n),Gl===4&&bu(e,Rl,Yl,!1)),ad(e))}function _u(e,t,n){if(Fl&6)throw Error(s(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ue(e,t),i=r?ju(e,t):ku(e,t,!0),a=r;do{if(i===0){Hl&&!r&&bu(e,t,0,!1);break}else{if(n=e.current.alternate,a&&!yu(n)){i=ku(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=e.pendingLanes&-536870913,o=o===0?o&536870912?536870912:0:o;if(o!==0){t=o;a:{var c=e;i=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Cu(c,o).flags|=256),o=ku(c,o,!1),o!==2){if(Ul&&!l){c.errorRecoveryDisabledLanes|=a,ql|=a,i=4;break a}a=Ql,Ql=i,a!==null&&(Ql===null?Ql=a:Ql.push.apply(Ql,a))}i=o}if(a=!1,i!==2)continue}}if(i===1){Cu(e,0),bu(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:bu(r,t,Yl,!Vl);break a;case 2:Ql=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=eu+300-Ce(),10<i)){if(bu(r,t,Yl,!Vl),He(r,0,!0)!==0)break a;cu=t,r.timeoutHandle=Xd(vu.bind(null,r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,a,`Throttled`,-0,0),i);break a}vu(r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,a,null,-0,0)}}break}while(1);ad(e)}function vu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xt},Dl(t,a,d);var m=(a&62914560)===a?eu-Ce():(a&4194048)===a?tu-Ce():0;if(m=Zf(d,m),m!==null){cu=a,e.cancelPendingCommit=m(Ru.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),bu(e,a,o,!l);return}}Ru(e,t,a,n,r,i,o,s,c)}function yu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!gr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Fe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ye(e,n,t)}function xu(){return Fl&6?!0:(od(0,!1),!1)}function Su(){if(Ll!==null){if(zl===0)var e=Ll.return;else e=Ll,Hi=Vi=null,Do(e),Da=null,Oa=0,e=Ll;for(;e!==null;)Lc(e.alternate,e),e=e.return;Ll=null}}function Cu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cu=0,Su(),Il=e,Ll=n=ii(e.current,null),Rl=t,zl=0,Bl=null,Vl=!1,Hl=Ue(e,t),Ul=!1,Xl=Yl=Jl=ql=Kl=Gl=0,Ql=Zl=null,$l=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Fe(r),a=1<<i;t|=e[i],r&=~a}return Wl=t,Jr(),n}function wu(e,t){co=null,N.H=Ps,t===_a||t===ya?(t=Ta(),zl=3):t===va?(t=Ta(),zl=4):zl=t===Qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Bl=t,Ll===null&&(Gl=1,Ks(e,fi(t,e.current)))}function Tu(){var e=Qa.current;return e===null?!0:(Rl&4194048)===Rl?$a===null:(Rl&62914560)===Rl||Rl&536870912?e===$a:!1}function Eu(){var e=N.H;return N.H=Ps,e===null?Ps:e}function Du(){var e=N.A;return N.A=Nl,e}function Ou(){Gl=4,Vl||(Rl&4194048)!==Rl&&Qa.current!==null||(Hl=!0),!(Kl&134217727)&&!(ql&134217727)||Il===null||bu(Il,Rl,Yl,!1)}function ku(e,t,n){var r=Fl;Fl|=2;var i=Eu(),a=Du();(Il!==e||Rl!==t)&&(ru=null,Cu(e,t)),t=!1;var o=Gl;a:do try{if(zl!==0&&Ll!==null){var s=Ll,c=Bl;switch(zl){case 8:Su(),o=6;break a;case 3:case 2:case 9:case 6:Qa.current===null&&(t=!0);var l=zl;if(zl=0,Bl=null,Fu(e,s,c,l),n&&Hl){o=0;break a}break;default:l=zl,zl=0,Bl=null,Fu(e,s,c,l)}}Au(),o=Gl;break}catch(t){wu(e,t)}while(1);return t&&e.shellSuspendCounter++,Hi=Vi=null,Fl=r,N.H=i,N.A=a,Ll===null&&(Il=null,Rl=0,Jr()),o}function Au(){for(;Ll!==null;)Nu(Ll)}function ju(e,t){var n=Fl;Fl|=2;var r=Eu(),i=Du();Il!==e||Rl!==t?(ru=null,nu=Ce()+500,Cu(e,t)):Hl=Ue(e,t);a:do try{if(zl!==0&&Ll!==null){t=Ll;var a=Bl;b:switch(zl){case 1:zl=0,Bl=null,Fu(e,t,a,1);break;case 2:case 9:if(xa(a)){zl=0,Bl=null,Pu(t);break}t=function(){zl!==2&&zl!==9||Il!==e||(zl=7),ad(e)},a.then(t,t);break a;case 3:zl=7;break a;case 4:zl=5;break a;case 7:xa(a)?(zl=0,Bl=null,Pu(t)):(zl=0,Bl=null,Fu(e,t,a,7));break;case 5:var o=null;switch(Ll.tag){case 26:o=Ll.memoizedState;case 5:case 27:var c=Ll;if(o?Jf(o):c.stateNode.complete){zl=0,Bl=null;var l=c.sibling;if(l!==null)Ll=l;else{var u=c.return;u===null?Ll=null:(Ll=u,Iu(u))}break b}}zl=0,Bl=null,Fu(e,t,a,5);break;case 6:zl=0,Bl=null,Fu(e,t,a,6);break;case 8:Su(),Gl=6;break a;default:throw Error(s(462))}}Mu();break}catch(t){wu(e,t)}while(1);return Hi=Vi=null,N.H=r,N.A=i,Fl=n,Ll===null?(Il=null,Rl=0,Jr(),Gl):0}function Mu(){for(;Ll!==null&&!xe();)Nu(Ll)}function Nu(e){var t=Oc(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Pu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fc(n,t,t.pendingProps,t.type,void 0,Rl);break;case 11:t=fc(n,t,t.pendingProps,t.type.render,t.ref,Rl);break;case 5:Do(t);default:Lc(n,t),t=Ll=ai(t,Wl),t=Oc(n,t,Wl)}e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Fu(e,t,n,r){Hi=Vi=null,Do(t),Da=null,Oa=0;var i=t.return;try{if(Zs(e,i,t,n,Rl)){Gl=1,Ks(e,fi(n,e.current)),Ll=null;return}}catch(t){if(i!==null)throw Ll=i,t;Gl=1,Ks(e,fi(n,e.current)),Ll=null;return}t.flags&32768?(ki||r===1?e=!0:Hl||Rl&536870912?e=!1:(Vl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Lu(t,e)):Iu(t)}function Iu(e){var t=e;do{if(t.flags&32768){Lu(t,Vl);return}e=t.return;var n=Fc(t.alternate,t,Wl);if(n!==null){Ll=n;return}if(t=t.sibling,t!==null){Ll=t;return}Ll=t=e}while(t!==null);Gl===0&&(Gl=5)}function Lu(e,t){do{var n=Ic(e.alternate,e);if(n!==null){n.flags&=32767,Ll=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ll=e;return}Ll=e=n}while(e!==null);Gl=6,Ll=null}function Ru(e,t,n,r,i,a,o,c,l){e.cancelPendingCommit=null;do Uu();while(au!==0);if(Fl&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(a=t.lanes|t.childLanes,a|=qr,Je(e,n,a,o,c,l),e===Il&&(Ll=Il=null,Rl=0),su=t,ou=e,cu=n,lu=a,uu=i,du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(De,function(){return Wu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=N.T,N.T=null,i=P.p,P.p=2,o=Fl,Fl|=4;try{el(e,t,n)}finally{Fl=o,P.p=i,N.T=r}}au=1,zu(),Bu(),Vu()}}function zu(){if(au===1){au=0;var e=ou,t=su,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Fl;Fl|=4;try{pl(t,e);var a=Ud,o=xr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&br(s.ownerDocument.documentElement,s)){if(c!==null&&Sr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=yr(s,h),v=yr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}dp=!!Hd,Ud=Hd=null}finally{Fl=i,P.p=r,N.T=n}}e.current=t,au=2}}function Bu(){if(au===2){au=0;var e=ou,t=su,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Fl;Fl|=4;try{tl(e,t.alternate,t)}finally{Fl=i,P.p=r,N.T=n}}au=3}}function Vu(){if(au===4||au===3){au=0,Se();var e=ou,t=su,n=cu,r=du;t.subtreeFlags&10256||t.flags&10256?au=5:(au=0,su=ou=null,Hu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(iu=null),$e(n),t=t.stateNode,Ne&&typeof Ne.onCommitFiberRoot==`function`)try{Ne.onCommitFiberRoot(Me,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{N.T=t,P.p=i}}cu&3&&Uu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===pu?fu++:(fu=0,pu=e):fu=0,od(0,!1)}}function Hu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ia(t)))}function Uu(){return zu(),Bu(),Vu(),Wu()}function Wu(){if(au!==5)return!1;var e=ou,t=lu;lu=0;var n=$e(cu),r=N.T,i=P.p;try{P.p=32>n?32:n,N.T=null,n=uu,uu=null;var a=ou,o=cu;if(au=0,su=ou=null,cu=0,Fl&6)throw Error(s(331));var c=Fl;if(Fl|=4,Al(a.current),Sl(a,a.current,o,n),Fl=c,od(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot==`function`)try{Ne.onPostCommitFiberRoot(Me,a)}catch{}return!0}finally{P.p=i,N.T=r,Hu(e,t)}}function Gu(e,t,n){t=fi(n,t),t=Js(e.stateNode,t,2),e=za(e,t,2),e!==null&&(qe(e,2),ad(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=fi(n,e),n=Ys(2),r=za(t,n,2),r!==null&&(Xs(n,r,t,e),qe(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Pl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Rl&n)===n&&(Gl===4||Gl===3&&(Rl&62914560)===Rl&&300>Ce()-eu?!(Fl&2)&&Cu(e,0):Jl|=n,Xl===Rl&&(Xl=0)),ad(e)}function Yu(e,t){t===0&&(t=Ge()),e=Zr(e,t),e!==null&&(qe(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),Yu(e,n)}function Qu(e,t){return be(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Fe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=Rl,a=He(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ue(r,a)||(n=!0,dd(r,a));r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&Yd()&&(e=id);for(var t=Ce(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}au!==0&&au!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Fe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=We(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Il,n=Rl,n=He(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(zl===2||zl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&B(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ue(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&B(r),$e(n)){case 2:case 8:n=Ee;break;case 32:n=De;break;case 268435456:n=ke;break;default:n=De}return r=ud.bind(null,e),n=be(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&B(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(au!==0&&au!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uu()&&e.callbackNode!==n)return null;var r=Rl;return r=He(e,e===Il?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(_u(e,r,t),ld(e,Ce()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Uu())return null;_u(e,t,!0)}function fd(){$d(function(){Fl&6?be(Te,sd):cd()})}function pd(){if(id===0){var e=sa;e===0&&(e=ze,ze<<=1,!(ze&261888)&&(ze=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Yt(``+e)}function hd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[it]||null).action),o=r.submitter;o&&(t=(t=o[it]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new _n(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);xs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),xs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<Hr.length;_d++){var vd=Hr[_d];Ur(vd.toLowerCase(),`on`+(vd[0].toUpperCase()+vd.slice(1)))}Ur(Pr,`onAnimationEnd`),Ur(Fr,`onAnimationIteration`),Ur(Ir,`onAnimationStart`),Ur(`dblclick`,`onDoubleClick`),Ur(`focusin`,`onFocus`),Ur(`focusout`,`onBlur`),Ur(Lr,`onTransitionRun`),Ur(Rr,`onTransitionStart`),Ur(zr,`onTransitionCancel`),Ur(Br,`onTransitionEnd`),bt(`onMouseEnter`,[`mouseout`,`mouseover`]),bt(`onMouseLeave`,[`mouseout`,`mouseover`]),bt(`onPointerEnter`,[`pointerout`,`pointerover`]),bt(`onPointerLeave`,[`pointerout`,`pointerover`]),yt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),yt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),yt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),yt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var yd=`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(` `),bd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(yd));function xd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}}}}function Sd(e,t){var n=t[ot];n===void 0&&(n=t[ot]=new Set);var r=e+`__bubble`;n.has(r)||(Ed(t,e,2,!1),n.add(r))}function Cd(e,t,n){var r=0;t&&(r|=4),Ed(n,e,r,t)}var wd=`_reactListening`+Math.random().toString(36).slice(2);function Td(e){if(!e[wd]){e[wd]=!0,_t.forEach(function(t){t!==`selectionchange`&&(bd.has(t)||Cd(t,!1,e),Cd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wd]||(t[wd]=!0,Cd(`selectionchange`,!1,t))}}function Ed(e,t,n,r){switch(vp(t)){case 2:var i=fp;break;case 8:i=pp;break;default:i=mp}n=i.bind(null,t,n,e),i=void 0,!sn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Dd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=ft(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}rn(function(){var r=a,i=Qt(n),o=[];a:{var s=Vr.get(e);if(s!==void 0){var c=_n,u=e;switch(e){case`keypress`:if(pn(n)===0)break a;case`keydown`:case`keyup`:c=Fn;break;case`focusin`:u=`focus`,c=En;break;case`focusout`:u=`blur`,c=En;break;case`beforeblur`:case`afterblur`:c=En;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Tn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Ln;break;case Pr:case Fr:case Ir:c=Dn;break;case Br:c=Rn;break;case`scroll`:case`scrollend`:c=yn;break;case`wheel`:c=zn;break;case`copy`:case`cut`:case`paste`:c=On;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=In;break;case`toggle`:case`beforetoggle`:c=Bn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=an(m,p),g!=null&&d.push(Od(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Zt&&(u=n.relatedTarget||n.fromElement)&&(ft(u)||u[at]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(u=n.relatedTarget||n.toElement,c=r,u=u?ft(u):null,u!==null&&(f=l(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(c=null,u=r),c!==u)){if(d=wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=In,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:mt(c),h=u==null?s:mt(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,ft(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,c&&u)b:{for(d=Ad,p=c,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;c!==null&&jd(o,s,c,d,!1),u!==null&&f!==null&&jd(o,f,u,d,!0)}}a:{if(s=r?mt(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=ir;else if(Qn(s))if(ar)v=mr;else{v=fr;var y=dr}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Kt(r.elementType)&&(v=ir):v=pr;if(v&&=v(e,r)){$n(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Rt(s,`number`,s.value)}switch(y=r?mt(r):window,e){case`focusin`:(Qn(y)||y.contentEditable===`true`)&&(wr=y,Tr=r,Er=null);break;case`focusout`:Er=Tr=wr=null;break;case`mousedown`:Dr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Dr=!1,Or(o,n,i);break;case`selectionchange`:if(Cr)break;case`keydown`:case`keyup`:Or(o,n,i)}var b;if(Hn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else W?U(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Gn&&n.locale!==`ko`&&(W||x!==`onCompositionStart`?x===`onCompositionEnd`&&W&&(b=fn()):(ln=i,un=`value`in ln?ln.value:ln.textContent,W=!0)),y=kd(r,x),0<y.length&&(x=new kn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Jn(n),b!==null&&(x.data=b)))),(b=Wn?Yn(e,n):Xn(e,n))&&(x=kd(r,`onBeforeInput`),0<x.length&&(y=new kn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),gd(o,e,r,n,i)}xd(o,t)})}function Od(e,t,n){return{instance:e,listener:t,currentTarget:n}}function kd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=an(e,n),i!=null&&r.unshift(Od(e,i,a)),i=an(e,t),i!=null&&r.push(Od(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ad(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function jd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=an(n,a),l!=null&&o.unshift(Od(n,l,c))):i||(l=an(n,a),l!=null&&o.push(Od(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Md=/\r\n?/g,Nd=/\u0000|\uFFFD/g;function Pd(e){return(typeof e==`string`?e:``+e).replace(Md,` 9`).replace(Nd,``)}function Fd(e,t){return t=Pd(t),Pd(e)===t}function Id(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ht(e,``+r);break;case`className`:Et(e,`class`,r);break;case`tabIndex`:Et(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Et(e,n,r);break;case`style`:Gt(e,r,a);break;case`data`:if(t!==`object`){Et(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof a==`function`&&(n===`formAction`?(t!==`input`&&Id(e,t,`name`,i.name,i,null),Id(e,t,`formEncType`,i.formEncType,i,null),Id(e,t,`formMethod`,i.formMethod,i,null),Id(e,t,`formTarget`,i.formTarget,i,null)):(Id(e,t,`encType`,i.encType,i,null),Id(e,t,`method`,i.method,i,null),Id(e,t,`target`,i.target,i,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Yt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Sd(`beforetoggle`,e),Sd(`toggle`,e),Tt(e,`popover`,r);break;case`xlinkActuate`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Tt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=qt.get(n)||n,Tt(e,n,r))}}function Ld(e,t,n,r,i,a){switch(n){case`style`:Gt(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ht(e,``+r);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!vt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[it]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Tt(e,n,r)}}}function Rd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Sd(`error`,e),Sd(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var o=n[a];if(o!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Id(e,t,a,o,n,null)}}i&&Id(e,t,`srcSet`,n.srcSet,n,null),r&&Id(e,t,`src`,n.src,n,null);return;case`input`:Sd(`invalid`,e);var c=a=o=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:o=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(s(137,t));break;default:Id(e,t,r,d,n,null)}}Lt(e,a,c,l,u,o,i,!1);return;case`select`:for(i in Sd(`invalid`,e),r=o=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:o=c;break;case`multiple`:r=c;default:Id(e,t,i,c,n,null)}t=a,n=o,e.multiple=!!r,t==null?n!=null&&zt(e,!!r,n,!0):zt(e,!!r,t,!1);return;case`textarea`:for(o in Sd(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(o)&&(c=n[o],c!=null))switch(o){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(s(91));break;default:Id(e,t,o,c,n,null)}Vt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Id(e,t,l,r,n,null)}return;case`dialog`:Sd(`beforetoggle`,e),Sd(`toggle`,e),Sd(`cancel`,e),Sd(`close`,e);break;case`iframe`:case`object`:Sd(`load`,e);break;case`video`:case`audio`:for(r=0;r<yd.length;r++)Sd(yd[r],e);break;case`image`:Sd(`error`,e),Sd(`load`,e);break;case`details`:Sd(`toggle`,e);break;case`embed`:case`source`:case`link`:Sd(`error`,e),Sd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Id(e,t,u,r,n,null)}return;default:if(Kt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ld(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Id(e,t,c,r,n,null))}function zd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,o=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Id(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:o=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(s(137,t));break;default:m!==f&&Id(e,t,p,m,r,f)}}It(e,o,c,l,u,d,a,i);return;case`select`:for(a in m=o=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Id(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:o=a;default:a!==l&&Id(e,t,i,a,r,l)}t=c,n=o,r=m,p==null?!!r!=!!n&&(t==null?zt(e,!!n,n?[]:``,!1):zt(e,!!n,t,!0)):zt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Id(e,t,c,null,r,i)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(s(91));break;default:i!==a&&Id(e,t,o,i,r,a)}Bt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Id(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Id(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Id(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(s(137,t));break;default:Id(e,t,u,p,r,m)}return;default:if(Kt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ld(e,t,_,void 0,r,p);
vendor: 4,463 bytes, line 9
9for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Ld(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Id(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Id(e,t,f,p,r,m)}function Bd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Vd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Bd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Bd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Hd=null,Ud=null;function Wd(e){return e.nodeType===9?e:e.ownerDocument}function Gd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Kd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function qd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jd=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Lp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ut]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body);n=i}while(n);Lp(t)}function rf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function af(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:af(n),dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ut])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;
vendor: 20,906 bytes, line 9
9e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function ff(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function gf(e,t,n){switch(t=Wd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(s(452));return e;case`head`:if(e=t.head,!e)throw Error(s(453));return e;case`body`:if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);dt(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=P.d;P.d={f:Sf,r:Cf,D:Ef,C:Df,L:Of,m:kf,X:jf,S:Af,M:Mf};function Sf(){var e=xf.f(),t=xu();return e||t}function Cf(e){var t=pt(e);t!==null&&t.tag===5&&t.type===`form`?Cs(t):xf.r(e)}var wf=typeof document>`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=Ft(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Rd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ft(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ft(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ft(n.imageSizes)+`"]`)):i+=`[href="`+Ft(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),Rd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ft(r)+`"][href="`+Ft(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),Rd(r,`link`,e),gt(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=ht(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);gt(c),Rd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=ht(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=h({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),gt(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=ht(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),gt(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t,n,r){var i=(i=ue.current)?bf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Pf(n.href),n=ht(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pf(n.href);var a=ht(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(Ff(e)))&&!a._p&&(o.instance=a,o.state.loading=5),vf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vf.set(e,n),a||Lf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Rf(n),n=ht(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Pf(e){return`href="`+Ft(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Rd(t,`link`,n),gt(t),e.head.appendChild(t))}function Rf(e){return`[src="`+Ft(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ft(n.href)+`"]`);if(r)return t.instance=r,gt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),gt(r),Rd(r,`style`,i),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pf(n.href);var a=e.querySelector(Ff(i));if(a)return t.state.loading|=4,t.instance=a,gt(a),a;r=If(n),(i=vf.get(i))&&Hf(r,i),a=(e.ownerDocument||e).createElement(`link`),gt(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Rd(a,`link`,r),t.state.loading|=4,Vf(a,n.precedence,e),t.instance=a;case`script`:return a=Rf(n.src),(i=e.querySelector(zf(a)))?(t.instance=i,gt(i),i):(r=n,(i=vf.get(a))&&(r=h({},n),Uf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),gt(i),Rd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vf(r,n.precedence,e));return t.instance}function Vf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wf=null;function Gf(e,t,n){if(Wf===null){var r=new Map,i=Wf=new Map;i.set(n,r)}else i=Wf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ut]||a[rt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Kf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,gt(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Rd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Xf===0&&(Xf=62500*Vd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Qf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var np={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function rp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ke(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ke(0),this.hiddenUpdates=Ke(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ip(e,t,n,r,i,a,o,s,c,l,u,d){return e=new rp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ni(3,null,null,t),e.current=a,a.stateNode=e,t=ra(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ia(a),e}function ap(e){return e?(e=ei,e):ei}function op(e,t,n,r,i,a){i=ap(i),r.context===null?r.context=i:r.pendingContext=i,r=Ra(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=za(e,r,t),n!==null&&(gu(n,e,t),Ba(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function lp(e){if(e.tag===13||e.tag===31){var t=Zr(e,67108864);t!==null&&gu(t,e,67108864),cp(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=mu();t=Qe(t);var n=Zr(e,t);n!==null&&gu(n,e,t),cp(e,t)}}var dp=!0;function fp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,mp(e,t,n,r)}finally{P.p=a,N.T=i}}function pp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,mp(e,t,n,r)}finally{P.p=a,N.T=i}}function mp(e,t,n,r){if(dp){var i=hp(r);if(i===null)Dd(e,t,r,gp,n),Dp(e,r);else if(kp(i,e,t,n,r))r.stopPropagation();else if(Dp(e,r),t&4&&-1<Ep.indexOf(e)){for(;i!==null;){var a=pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ve(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Fe(o);s.entanglements[1]|=c,o&=~c}ad(a),!(Fl&6)&&(nu=Ce()+500,od(0,!1))}}break;case 31:case 13:s=Zr(a,2),s!==null&&gu(s,a,2),xu(),cp(a,2)}if(a=hp(r),a===null&&Dd(e,t,r,gp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Dd(e,t,r,null,n)}}function hp(e){return e=Qt(e),_p(e)}var gp=null;function _p(e){if(gp=null,e=ft(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return gp=e,null}function vp(e){switch(e){case`beforetoggle`: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`toggle`: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 2;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`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(we()){case Te:return 2;case Ee:return 8;case De:case Oe:return 32;case ke:return 268435456;default:return 32}default:return 32}}var yp=!1,bp=null,xp=null,Sp=null,Cp=new Map,wp=new Map,Tp=[],Ep=`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`.split(` `);function Dp(e,t){switch(e){case`focusin`:case`focusout`:bp=null;break;case`dragenter`:case`dragleave`:xp=null;break;case`mouseover`:case`mouseout`:Sp=null;break;case`pointerover`:case`pointerout`:Cp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:wp.delete(t.pointerId)}}function Op(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=pt(t),t!==null&&lp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function kp(e,t,n,r,i){switch(t){case`focusin`:return bp=Op(bp,e,t,n,r,i),!0;case`dragenter`:return xp=Op(xp,e,t,n,r,i),!0;case`mouseover`:return Sp=Op(Sp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Cp.set(a,Op(Cp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,wp.set(a,Op(wp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ap(e){var t=ft(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,tt(e.priority,function(){up(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,tt(e.priority,function(){up(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Zt=r,n.target.dispatchEvent(r),Zt=null}else return t=pt(n),t!==null&&lp(t),e.blockedOn=n,!1;t.shift()}return!0}function Mp(e,t,n){jp(e)&&n.delete(t)}function Np(){yp=!1,bp!==null&&jp(bp)&&(bp=null),xp!==null&&jp(xp)&&(xp=null),Sp!==null&&jp(Sp)&&(Sp=null),Cp.forEach(Mp),wp.forEach(Mp)}function Pp(e,n){e.blockedOn===n&&(e.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Np)))}var Fp=null;function Ip(e){Fp!==e&&(Fp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fp===e&&(Fp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(_p(r||n)===null)continue;break}var a=pt(n);a!==null&&(e.splice(t,3),t-=3,xs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Lp(e){function t(t){return Pp(t,e)}bp!==null&&Pp(bp,e),xp!==null&&Pp(xp,e),Sp!==null&&Pp(Sp,e),Cp.forEach(t),wp.forEach(t);for(var n=0;n<Tp.length;n++){var r=Tp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Tp.length&&(n=Tp[0],n.blockedOn===null);)Ap(n),n.blockedOn===null&&Tp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[it]||null;if(typeof a==`function`)o||Ip(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[it]||null)s=o.formAction;else if(_p(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Ip(n)}}}function Rp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function zp(e){this._internalRoot=e}Bp.prototype.render=zp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current;op(n,mu(),e,t,null,null)},Bp.prototype.unmount=zp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;op(e.current,2,null,e,null,null),xu(),t[at]=null}};function Bp(e){this._internalRoot=e}Bp.prototype.unstable_scheduleHydration=function(e){if(e){var t=et();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tp.length&&t!==0&&t<Tp[n].priority;n++);Tp.splice(n,0,e),n===0&&Ap(e)}};var Vp=r.version;if(Vp!==`19.2.6`)throw Error(s(527,Vp,`19.2.6`));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(s(188)):(e=Object.keys(e).join(`,`),Error(s(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Hp={bundleType:0,version:`19.2.6`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.6`};
9if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Up=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Up.isDisabled&&Up.supportsFiber)try{Me=Up.inject(Hp),Ne=Up}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(s(299));var n=!1,r=``,i=Us,a=Ws,o=Gs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ip(e,1,!1,null,null,n,r,null,i,a,o,Rp),e[at]=t.current,Td(e),new zp(t)}})),c=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),u=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),d=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),f=e=>{let t=d(e);return t.charAt(0).toUpperCase()+t.slice(1)},p={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`},m=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},h=n(),g=(0,h.createContext)({}),_=()=>(0,h.useContext)(g),v=(0,h.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:g=`currentColor`,className:v=``}=_()??{},y=r??f?Number(n??d)*24/Number(t??u):n??d;return(0,h.createElement)(`svg`,{ref:c,...p,width:t??u??p.width,height:t??u??p.height,stroke:e??g,strokeWidth:y,className:l(`lucide`,v,i),...!a&&!m(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,h.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),y=(e,t)=>{let n=(0,h.forwardRef)(({className:n,...r},i)=>(0,h.createElement)(v,{ref:i,iconNode:t,className:l(`lucide-${u(f(e))}`,`lucide-${e}`,n),...r}));return n.displayName=f(e),n},b=y(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),x=y(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),S=y(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),C=y(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),w=y(`calculator`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]),T=y(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),E=y(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),D=y(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),O=y(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),k=y(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),A=y(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),j=y(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),ee=y(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),te=y(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),M=y(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),ne=y(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),N=y(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),P=y(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),re=y(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ie=y(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),ae=y(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),oe=y(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}
9],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),se=y(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),F=y(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ce=y(`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`}]]),le=y(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),ue=y(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),I=y(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),de=y(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),fe=y(`move-vertical`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m8 18 4 4 4-4`,key:`bh5tu3`}],[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}]]),pe=y(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),me=y(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),he=y(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),L=y(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),ge=y(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),R=y(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),_e=y(`ruler`,[[`path`,{d:`M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z`,key:`icamh8`}],[`path`,{d:`m14.5 12.5 2-2`,key:`inckbg`}],[`path`,{d:`m11.5 9.5 2-2`,key:`fmmyf7`}],[`path`,{d:`m8.5 6.5 2-2`,key:`vc6u1g`}],[`path`,{d:`m17.5 15.5 2-2`,key:`wo5hmg`}]]),ve=y(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),ye=y(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),z=y(`shield-check`,[[`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`}]]),be=y(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),B=y(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594
91.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),xe=y(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Se=y(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),Ce=y(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),we=y(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Te=y(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Ee=y(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),De=y(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Oe=y(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ke=o(),Ae=c(),je={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Me={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Ne=1e3,Pe=1001,Fe=1002,Ie=1003,Le=1004,Re=1005,ze=1006,V=1007,Be=1008,Ve=1009,He=1010,Ue=1011,We=1012,Ge=1013,Ke=1014,qe=1015,Je=1016,Ye=1017,Xe=1018,Ze=1020,Qe=35902,$e=35899,et=1021,tt=1022,nt=1023,rt=1026,it=1027,at=1028,ot=1029,st=1030,ct=1031,lt=1033,ut=33776,dt=33777,ft=33778,pt=33779,mt=35840,ht=35841,gt=35842,_t=35843,vt=36196,yt=37492,bt=37496,xt=37488,St=37489,Ct=37490,wt=37491,Tt=37808,Et=37809,Dt=37810,Ot=37811,kt=37812,At=37813,jt=37814,Mt=37815,Nt=37816,Pt=37817,Ft=37818,It=37819,Lt=37820,Rt=37821,zt=36492,Bt=36494,Vt=36495,Ht=36283,Ut=36284,Wt=36285,Gt=36286,Kt=2300,qt=2301,Jt=2302,Yt=2303,Xt=2400,Zt=2401,Qt=2402,$t=3200,en=`srgb`,tn=`srgb-linear`,nn=`linear`,rn=`srgb`,an=7680,on=35044,sn=2e3;function cn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function ln(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function un(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function dn(){let e=un(`canvas`);return e.style.display=`block`,e}var fn={},pn=null;function mn(...e){let t=`THREE.`+e.shift();pn?pn(`log`,t,...e):console.log(t,...e)}function hn(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function H(...e){e=hn(e);let t=`THREE.`+e.shift();if(pn)pn(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function gn(...e){e=hn(e);let t=`THREE.`+e.shift();if(pn)pn(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function _n(...e){let t=e.join(` `);t in fn||(fn[t]=!0,H(...e))}
vendor: 5,458 bytes, line 9
9function vn(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}var yn={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},bn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},xn=`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`.split(`.`),Sn=1234567,Cn=Math.PI/180,wn=180/Math.PI;function Tn(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(xn[e&255]+xn[e>>8&255]+xn[e>>16&255]+xn[e>>24&255]+`-`+xn[t&255]+xn[t>>8&255]+`-`+xn[t>>16&15|64]+xn[t>>24&255]+`-`+xn[n&63|128]+xn[n>>8&255]+`-`+xn[n>>16&255]+xn[n>>24&255]+xn[r&255]+xn[r>>8&255]+xn[r>>16&255]+xn[r>>24&255]).toLowerCase()}function En(e,t,n){return Math.max(t,Math.min(n,e))}function Dn(e,t){return(e%t+t)%t}function On(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function kn(e,t,n){return e===t?0:(n-e)/(t-e)}function An(e,t,n){return(1-n)*e+n*t}function jn(e,t,n,r){return An(e,t,1-Math.exp(-n*r))}function Mn(e,t=1){return t-Math.abs(Dn(e,t*2)-t)}function Nn(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Pn(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Fn(e,t){return e+Math.floor(Math.random()*(t-e+1))}function In(e,t){return e+Math.random()*(t-e)}function Ln(e){return e*(.5-Math.random())}function Rn(e){e!==void 0&&(Sn=e);let t=Sn+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function zn(e){return e*Cn}function Bn(e){return e*wn}function Vn(e){return(e&e-1)==0&&e!==0}function Hn(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Un(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function Wn(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:H(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function Gn(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 Error(`Invalid component type.`)}}function Kn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var qn={DEG2RAD:Cn,RAD2DEG:wn,generateUUID:Tn,clamp:En,euclideanModulo:Dn,mapLinear:On,inverseLerp:kn,lerp:An,damp:jn,pingpong:Mn,smoothstep:Nn,smootherstep:Pn,randInt:Fn,randFloat:In,randFloatSpread:Ln,seededRandom:Rn,degToRad:zn,radToDeg:Bn,isPowerOfTwo:Vn,ceilPowerOfTwo:Hn,floorPowerOfTwo:Un,setQuaternionFromProperEuler:Wn,normalize:Kn,denormalize:Gn},U=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=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 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 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}
vendor: 5,414 bytes, line 9
9sub(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){let 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=En(this.x,e.x,t.x),this.y=En(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=En(this.x,e,t),this.y=En(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(En(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){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(En(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Jn=class{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,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,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){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:H(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let 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){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/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)>
vendor: 12,147 bytes, line 9
9Math.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(En(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let 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 e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,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+a*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+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let 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}},W=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(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 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 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(Xn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Xn.setFromAxisAngle(e,t))}applyMatrix3(e){let 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){let t=this.x,n=this.y,r=this.z,i=e.elements,a=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])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let 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=En(this.x,e.x,t.x),this.y=En(this.y,e.y,t.y),this.z=En(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=En(this.x,e,t),this.y=En(this.y,e,t),this.z=En(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(En(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){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Yn.copy(this).projectOnVector(e),this.sub(Yn)}reflect(e){return this.sub(Yn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(En(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let 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){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let 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,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-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}},Yn=new W,Xn=new Jn,Zn=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let 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){let 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){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,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){let 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,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Qn.makeScale(e,t)),this}rotate(e){return this.premultiply(Qn.makeRotation(-e)),this}translate(e,t){return this.premultiply(Qn.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){let 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){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])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){let 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)}},Qn=new Zn,$n=new Zn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),er=new Zn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.20397
97,1.0569715);function tr(){let e={enabled:!0,workingColorSpace:tn,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=rr(e.r),e.g=rr(e.g),e.b=rr(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===`srgb`&&(e.r=ir(e.r),e.g=ir(e.g),e.b=ir(e.b)),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===``?nn: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 _n(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return _n(`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({[tn]:{primaries:t,whitePoint:r,transfer:nn,toXYZ:$n,fromXYZ:er,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:en},outputColorSpaceConfig:{drawingBufferColorSpace:en}},[en]:{primaries:t,whitePoint:r,transfer:rn,toXYZ:$n,fromXYZ:er,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:en}}}),e}var nr=tr();function rr(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function ir(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var ar,or=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ar===void 0&&(ar=un(`canvas`)),ar.width=e.width,ar.height=e.height;let t=ar.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=ar}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=un(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=rr(i[e]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(rr(t[e]/255)*255):t[e]=rr(t[e]);return{data:t,width:e.width,height:e.height}}else return H(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},sr=0,cr=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,`id`,{value:sr++}),this.uuid=Tn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(lr(r[t].image)):e.push(lr(r[t]))}else e=lr(r);n.url=e}return t||(e.images[this.uuid]=n),n}};function lr(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?or.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(H(`Texture: Unable to serialize Texture.`),{})}var ur=0,dr=new W,fr=class e extends bn{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=Pe,i=Pe,a=ze,o=Be,s=nt,c=Ve,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,`id`,{value:ur++}),this.uuid=Tn(),this.name=``,this.source=new cr(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new
9U(0,0),this.repeat=new U(1,1),this.center=new U(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Zn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(dr).x}get height(){return this.source.getSize(dr).y}get depth(){return this.source.getSize(dr).z}get image(){return this.source.data}set image(e){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.normalized=e.normalized,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(let t in e){let n=e[t];if(n===void 0){H(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){H(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let 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,normalized:this.normalized,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!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ne:e.x-=Math.floor(e.x);break;case Pe:e.x=e.x<0?0:1;break;case Fe:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ne:e.y-=Math.floor(e.y);break;case Pe:e.y=e.y<0?0:1;break;case Fe:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};fr.DEFAULT_IMAGE=null,fr.DEFAULT_MAPPING=300,fr.DEFAULT_ANISOTROPY=1;var pr=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){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 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 Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,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}
vendor: 5,506 bytes, line 9
9sub(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){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[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);let 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,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let 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=En(this.x,e.x,t.x),this.y=En(this.y,e.y,t.y),this.z=En(this.z,e.z,t.z),this.w=En(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=En(this.x,e,t),this.y=En(this.y,e,t),this.z=En(this.z,e,t),this.w=En(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(En(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}},mr=class extends bn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ze,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 pr(0,0,e,t),this.scissorTest=!1,this.viewport=new pr(0,0,e,t),this.textures=[];let r=new fr({width:e,height:t,depth:n.depth}),i=n.count;for(let e=0;e<i;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].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={}){let t={minFilter:ze,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace
vendor: 10,438 bytes, line 9
9=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(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,this.textures[r].isData3DTexture!==!0&&(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;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new cr(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:`dispose`})}},hr=class extends mr{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},gr=class extends fr{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=Ie,this.minFilter=Ie,this.wrapR=Pe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},_r=class extends fr{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=Ie,this.minFilter=Ie,this.wrapR=Pe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},vr=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,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 e().fromArray(this.elements)}copy(e){let 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){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let 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 this.determinant()===0?(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(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,r=1/yr.setFromMatrixColumn(e,0).length(),i=1/yr.setFromMatrixColumn(e,1).length(),a=1/yr.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]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,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(xr,e,Sr)}lookAt(e,t,n){let r=this.elements;return Tr.subVectors(e,t),Tr.lengthSq()===0&&(Tr.z=1),Tr.normalize(),Cr.crossVectors(n,Tr),Cr.lengthSq()===0&&(Math.abs(n.z)===1?Tr.x+=1e-4:Tr.z+=1e-4,Tr.normalize(),Cr.crossVectors(n,Tr)),Cr.normalize(),wr.crossVectors(Tr,Cr),r[0]=Cr.x,r[4]=wr.x,r[8]=Tr.x,r[1]=Cr.y,r[5]=wr.y,r[9]=Tr.y,r[2]=Cr.z,r[6]=wr.z,r[10]=Tr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],ee=r[14],te=r[3],M=r[7],ne=r[11],N=r[15];return i[0]=a*x+o*T+s*k+c*te,i[4]=a*S+o*E+s*A+c*M,i[8]=a*C+o*D+s*j+c*ne,i[12]=a*w+o*O+s*ee+c*N,i[1]=l*x+u*T+d*k+f*te,i[5]=l*S+u*E+d*A+f*M,i[9]=l*C+u*D+d*j+f*ne,i[13]=l*w+u*O+d*ee+f*N,i[2]=p*x+m*T+h*k+g*te,i[6]=p*S+m*E+h*A+g*M,i[10]=p*C+m*D+h*j+g*ne,i[14]=p*w+m*O+h*ee+g*N,i[3]=_*x+v*T+y*k+b*te,i[7]=_*S+v*E+y*A+b*M,i[11]=_*C+v*D+y*j+b*ne,i[15]=_*w+v*O+y*ee+b*N,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}transpose(){let e=this.elements,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){let 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(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let 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(){let 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){let 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){let 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){let 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){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,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,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinant();if(i===0)return n.set(1,1,1),t.identity(),this;let a=yr.set(r[0],r[1],r[2]).length(),o=yr.set(r[4],r[5],r[6]).length(),s=yr.set(r[8],r[9],r[10]).length();i<0&&(a=-a),br.copy(this);let c=1/a,l=1/o,u=1/s;return br.elements[0]*=c,br.elements[1]*=c,br.elements[2]*=c,br.elements[4]*=l,br.elements[5]*=l,br.elements[6]*=l,br.elements[8]*=u,br.elements[9]*=u,br.elements[10]*=u,t.setFromRotationMatrix(br),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=sn,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=sn,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);
vendor: 5,352 bytes, line 9
9else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])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){let 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}},yr=new W,br=new vr,xr=new W(0,0,0),Sr=new W(1,1,1),Cr=new W,wr=new W,Tr=new W,Er=new vr,Dr=new Jn,Or=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,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){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(En(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-En(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(En(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-En(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(En(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-En(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:H(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Er.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Er,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Dr.setFromEuler(this),this.setFromQuaternion(Dr,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Or.DEFAULT_ORDER=`XYZ`;var kr=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!=0}},Ar=0,jr=new W,Mr=new Jn,Nr=new vr,Pr=new W,Fr=new W,Ir=new W,Lr=new Jn,Rr=new W(1,0,0),zr=new W(0,1,0),Br=new W(0,0,1),Vr={type:`added`},Hr={type:`removed`},Ur={type:`childadded`,child:null},Wr={type:`childremoved`,child:null},Gr=class e extends bn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,`id`,{value:Ar++}),this.uuid=Tn(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new W,n=new Or,r=new Jn,i=new W(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new vr},normalMatrix:{value:new Zn}}),this.matrix=new vr,this.matrixWorld=new vr,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new kr,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.static=!1,this.userData={},this.pivot=null}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)}
vendor: 4,399 bytes, line 9
9setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Mr.setFromAxisAngle(e,t),this.quaternion.multiply(Mr),this}rotateOnWorldAxis(e,t){return Mr.setFromAxisAngle(e,t),this.quaternion.premultiply(Mr),this}rotateX(e){return this.rotateOnAxis(Rr,e)}rotateY(e){return this.rotateOnAxis(zr,e)}rotateZ(e){return this.rotateOnAxis(Br,e)}translateOnAxis(e,t){return jr.copy(e).applyQuaternion(this.quaternion),this.position.add(jr.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Rr,e)}translateY(e){return this.translateOnAxis(zr,e)}translateZ(e){return this.translateOnAxis(Br,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Nr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Pr.copy(e):Pr.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),Fr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Nr.lookAt(Fr,Pr,this.up):Nr.lookAt(Pr,Fr,this.up),this.quaternion.setFromRotationMatrix(Nr),r&&(Nr.extractRotation(r.matrixWorld),Mr.setFromRotationMatrix(Nr),this.quaternion.premultiply(Mr.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(gn(`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(Vr),Ur.child=e,this.dispatchEvent(Ur),Ur.child=null):gn(`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}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Hr),Wr.child=e,this.dispatchEvent(Wr),Wr.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Nr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Nr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Nr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Vr),Ur.child=e,this.dispatchEvent(Ur),Ur.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++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;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(Fr,e,Ir),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fr,Lr,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 19,116 bytes, line 9
9):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){let e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),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(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(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),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(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&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let 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++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let 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.pivot=e.pivot===null?null:e.pivot.clone(),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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}};Gr.DEFAULT_UP=new W(0,1,0),Gr.DEFAULT_MATRIX_AUTO_UPDATE=!0,Gr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Kr=class extends Gr{constructor(){super(),this.isGroup=!0,this.type=`Group`}},qr={type:`move`},Jr=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Kr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Kr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new W,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new W),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Kr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new W,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new W,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let 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}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position),s=.02,l=.005;c.inputState.pinching&&o>s+l?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=s-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(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,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(qr)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Kr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Yr={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},Xr={h:0,s:0,l:0},Zr={h:0,s:0,l:0};function Qr(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var $r=class{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(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&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=en){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,nr.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=nr.workingColorSpace){return this.r=e,this.g=t,this.b=n,nr.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=nr.workingColorSpace){if(e=Dn(e,1),t=En(t,0,1),n=En(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Qr(i,r,e+1/3),this.g=Qr(i,r,e),this.b=Qr(i,r,e-1/3)}return nr.colorSpaceToWorking(this,r),this}setStyle(e,t=en){function n(t){t!==void 0&&parseFloat(t)<1&&H(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))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(o))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(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:H(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);H(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=en){let n=Yr[e.toLowerCase()];return n===void 0?H(`Color: Unknown color `+e):this.setHex(n,t),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=rr(e.r),this.g=rr(e.g),this.b=rr(e.b),this}copyLinearToSRGB(e){return this.r=ir(e.r),this.g=ir(e.g),this.b=ir(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=en){return nr.workingToColorSpace(ei.copy(this),e),Math.round(En(ei.r*255,0,255))*65536+Math.round(En(ei.g*255,0,255))*256+Math.round(En(ei.b*255,0,255))}getHexString(e=en){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=nr.workingColorSpace){nr.workingToColorSpace(ei.copy(this),t);let n=ei.r,r=ei.g,i=ei.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){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;break}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=nr.workingColorSpace){return nr.workingToColorSpace(ei.copy(this),t),e.r=ei.r,e.g=ei.g,e.b=ei.b,e}getStyle(e=en){nr.workingToColorSpace(ei.copy(this),e);let t=ei.r,n=ei.g,r=ei.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(Xr),this.setHSL(Xr.h+e,Xr.s+t,Xr.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(Xr),e.getHSL(Zr);let n=An(Xr.h,Zr.h,t),r=An(Xr.s,Zr.s,t),i=An(Xr.l,Zr.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){let 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}},ei=new $r;$r.NAMES=Yr;var ti=class extends Gr{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 Or,this.environmentIntensity=1,this.environmentRotation=new Or,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},ni=new W,ri=new W,ii=new W,ai=new W,oi=new W,si=new W,ci=new W,li=new W,ui=new W,di=new W,fi=new pr,pi=new pr,mi=new pr,hi=class e{constructor(e=new W,t=new W,n=new W){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),ni.subVectors(e,t),r.cross(ni);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){ni.subVectors(r,t),ri.subVectors(n,t),ii.subVectors(e,t);let a=ni.dot(ni),o=ni.dot(ri),s=ni.dot(ii),c=ri.dot(ri),l=ri.dot(ii),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,ai)===null?!1:ai.x>=0&&ai.y>=0&&ai.x+ai.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ai)===null?(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,ai.x),s.addScaledVector(a,ai.y),s.addScaledVector(o,ai.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return fi.setScalar(0),pi.setScalar(0),mi.setScalar(0),fi.fromBufferAttribute(e,t),pi.fromBufferAttribute(e,n),mi.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(fi,i.x),a.addScaledVector(pi,i.y),a.addScaledVector(mi,i.z),a}
vendor: 16,221 bytes, line 9
9static isFrontFacing(e,t,n,r){return ni.subVectors(n,t),ri.subVectors(e,t),ni.cross(ri).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 ni.subVectors(this.c,this.b),ri.subVectors(this.a,this.b),ni.cross(ri).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;oi.subVectors(r,n),si.subVectors(i,n),li.subVectors(e,n);let s=oi.dot(li),c=si.dot(li);if(s<=0&&c<=0)return t.copy(n);ui.subVectors(e,r);let l=oi.dot(ui),u=si.dot(ui);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(oi,a);di.subVectors(e,i);let f=oi.dot(di),p=si.dot(di);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(si,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return ci.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(ci,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(oi,a).addScaledVector(si,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},gi=class{constructor(e=new W(1/0,1/0,1/0),t=new W(-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(vi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(vi.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){let n=vi.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);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,vi):vi.fromBufferAttribute(r,t),vi.applyMatrix4(e.matrixWorld),this.expandByPoint(vi);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),yi.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),yi.copy(e.boundingBox)),yi.applyMatrix4(e.matrixWorld),this.union(yi)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],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,vi),vi.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(Ei),Di.subVectors(this.max,Ei),bi.subVectors(e.a,Ei),xi.subVectors(e.b,Ei),Si.subVectors(e.c,Ei),Ci.subVectors(xi,bi),wi.subVectors(Si,xi),Ti.subVectors(bi,Si);let t=[0,-Ci.z,Ci.y,0,-wi.z,wi.y,0,-Ti.z,Ti.y,Ci.z,0,-Ci.x,wi.z,0,-wi.x,Ti.z,0,-Ti.x,-Ci.y,Ci.x,0,-wi.y,wi.x,0,-Ti.y,Ti.x,0];return!Ai(t,bi,xi,Si,Di)||(t=[1,0,0,0,1,0,0,0,1],!Ai(t,bi,xi,Si,Di))?!1:(Oi.crossVectors(Ci,wi),t=[Oi.x,Oi.y,Oi.z],Ai(t,bi,xi,Si,Di))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(vi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_i[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_i[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_i[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_i[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_i[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_i[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_i[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_i[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_i),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}},_i=[new W,new W,new W,new W,new W,new W,new W,new W],vi=new W,yi=new gi,bi=new W,xi=new W,Si=new W,Ci=new W,wi=new W,Ti=new W,Ei=new W,Di=new W,Oi=new W,ki=new W;function Ai(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){ki.fromArray(e,a);let o=i.x*Math.abs(ki.x)+i.y*Math.abs(ki.y)+i.z*Math.abs(ki.z),s=t.dot(ki),c=n.dot(ki),l=r.dot(ki);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var ji=new W,Mi=new U,Ni=0,Pi=class extends bn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,`id`,{value:Ni++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=on,this.updateRanges=[],this.gpuType=qe,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,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(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Mi.fromBufferAttribute(this,t),Mi.applyMatrix3(e),this.setXY(t,Mi.x,Mi.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ji.fromBufferAttribute(this,t),ji.applyMatrix3(e),this.setXYZ(t,ji.x,ji.y,ji.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ji.fromBufferAttribute(this,t),ji.applyMatrix4(e),this.setXYZ(t,ji.x,ji.y,ji.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ji.fromBufferAttribute(this,t),ji.applyNormalMatrix(e),this.setXYZ(t,ji.x,ji.y,ji.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ji.fromBufferAttribute(this,t),ji.transformDirection(e),this.setXYZ(t,ji.x,ji.y,ji.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=Gn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Kn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Gn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Kn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Gn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Kn(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=Gn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Kn(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=Gn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Kn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Kn(t,this.array),n=Kn(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=Kn(t,this.array),n=Kn(n,this.array),r=Kn(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=Kn(t,this.array),n=Kn(n,this.array),r=Kn(r,this.array),i=Kn(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(){let 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!==35044&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:`dispose`})}},Fi=class extends Pi{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Ii=class extends Pi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},Li=class extends Pi{constructor(e,t,n){super(new Float32Array(e),t,n)}},Ri=new gi,zi=new W,Bi=new W,Vi=class{constructor(e=new W,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){let n=this.center;t===void 0?Ri.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));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){let 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){let 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*=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;zi.subVectors(e,this.center);let t=zi.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(zi,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Bi.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zi.copy(e.center).add(Bi)),this.expandByPoint(zi.copy(e.center).sub(Bi))),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}},Hi=0,Ui=new vr,Wi=new Gr,Gi=new W,Ki=new gi,qi=new gi,Ji=new W,Yi=class e extends bn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,`id`,{value:Hi++}),this.uuid=Tn(),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(cn(e)?Ii:Fi)(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 this.attributes[e]!==void 0}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){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new Zn().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ui.makeRotationFromQuaternion(e),this.applyMatrix4(Ui),this}rotateX(e){return Ui.makeRotationX(e),this.applyMatrix4(Ui),this}rotateY(e){return Ui.makeRotationY(e),this.applyMatrix4(Ui),this}rotateZ(e){return Ui.makeRotationZ(e),this.applyMatrix4(Ui),this}translate(e,t,n){return Ui.makeTranslation(e,t,n),this.applyMatrix4(Ui),this}scale(e,t,n){return Ui.makeScale(e,t,n),this.applyMatrix4(Ui),this}lookAt(e){return Wi.lookAt(e),Wi.updateMatrix(),this.applyMatrix4(Wi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gi).negate(),this.translate(Gi.x,Gi.y,Gi.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new Li(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&H(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gi);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){gn(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new W(-1/0,-1/0,-1/0),new W(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Ki.setFromBufferAttribute(n),this.morphTargetsRelative?(Ji.addVectors(this.boundingBox.min,Ki.min),this.boundingBox.expandByPoint(Ji
vendor: 13,677 bytes, line 9
9),Ji.addVectors(this.boundingBox.max,Ki.max),this.boundingBox.expandByPoint(Ji)):(this.boundingBox.expandByPoint(Ki.min),this.boundingBox.expandByPoint(Ki.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&gn(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Vi);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){gn(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new W,1/0);return}if(e){let n=this.boundingSphere.center;if(Ki.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];qi.setFromBufferAttribute(n),this.morphTargetsRelative?(Ji.addVectors(Ki.min,qi.min),Ki.expandByPoint(Ji),Ji.addVectors(Ki.max,qi.max),Ki.expandByPoint(Ji)):(Ki.expandByPoint(qi.min),Ki.expandByPoint(qi.max))}Ki.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)Ji.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(Ji));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)Ji.fromBufferAttribute(a,t),o&&(Gi.fromBufferAttribute(e,t),Ji.add(Gi)),r=Math.max(r,n.distanceToSquared(Ji))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&gn(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){gn(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv;this.hasAttribute(`tangent`)===!1&&this.setAttribute(`tangent`,new Pi(new Float32Array(4*n.count),4));let a=this.getAttribute(`tangent`),o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new W,s[e]=new W;let c=new W,l=new W,u=new W,d=new U,f=new U,p=new U,m=new W,h=new W;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new W,y=new W,b=new W,x=new W;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0)n=new Pi(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new W,i=new W,a=new W,o=new W,s=new W,c=new W,l=new W,u=new W;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ji.fromBufferAttribute(e,t),Ji.normalize(),e.setXYZ(t,Ji.x,Ji.y,Ji.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new Pi(a,r,i)}if(this.index===null)return H(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let 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),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.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;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(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`})}},Xi=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=on,this.updateRanges=[],this.version=0,this.uuid=Tn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,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){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Tn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let 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 e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Tn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(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}}},Zi=new W,Qi=class e{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++)Zi.fromBufferAttribute(this,t),Zi.applyMatrix4(e),this.setXYZ(t,Zi.x,Zi.y,Zi.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Zi.fromBufferAttribute(this,t),Zi.applyNormalMatrix(e),this.setXYZ(t,Zi.x,Zi.y,Zi.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Zi.fromBufferAttribute(this,t),Zi.transformDirection(e),this.setXYZ(t,Zi.x,Zi.y,Zi.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Gn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Kn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Kn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Kn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Kn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Kn(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=Gn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Gn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Gn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Gn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Kn(t,this.array),n=Kn(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=Kn(t,this.array),n=Kn(n,this.array),r=Kn(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=Kn(t,this.array),n=Kn(n,this.array),r=Kn(r,this.array),i=Kn(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(t){if(t===void 0){mn(`InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new Pi(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){mn(`InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let 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}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},$i=0,ea=class extends bn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,`id`,{value:$i++}),this.uuid=Tn(),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=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new $r(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=an,this.stencilZFail=an,this.stencilZPass=an,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(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){H(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){H
vendor: 10,041 bytes, line 9
9(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(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),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(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),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(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,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let 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;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=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){e===!0&&this.version++}},
vendor: 3,451 bytes, line 9
9ta=class extends ea{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new $r(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}},na,ra=new W,ia=new W,aa=new W,oa=new U,sa=new U,ca=new vr,la=new W,ua=new W,da=new W,fa=new U,pa=new U,ma=new U,ha=class extends Gr{constructor(e=new ta){if(super(),this.isSprite=!0,this.type=`Sprite`,na===void 0){na=new Yi;let e=new Xi(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);na.setIndex([0,1,2,0,2,3]),na.setAttribute(`position`,new Qi(e,3,0,!1)),na.setAttribute(`uv`,new Qi(e,2,3,!1))}this.geometry=na,this.material=e,this.center=new U(.5,.5),this.count=1}raycast(e,t){e.camera===null&&gn(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),ia.setFromMatrixScale(this.matrixWorld),ca.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),aa.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ia.multiplyScalar(-aa.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;ga(la.set(-.5,-.5,0),aa,a,ia,r,i),ga(ua.set(.5,-.5,0),aa,a,ia,r,i),ga(da.set(.5,.5,0),aa,a,ia,r,i),fa.set(0,0),pa.set(1,0),ma.set(1,1);let o=e.ray.intersectTriangle(la,ua,da,!1,ra);if(o===null&&(ga(ua.set(-.5,.5,0),aa,a,ia,r,i),pa.set(0,1),o=e.ray.intersectTriangle(la,da,ua,!1,ra),o===null))return;let s=e.ray.origin.distanceTo(ra);s<e.near||s>e.far||t.push({distance:s,point:ra.clone(),uv:hi.getInterpolation(ra,la,ua,da,fa,pa,ma,new U),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function ga(e,t,n,r,i,a){oa.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?sa.copy(oa):(sa.x=a*oa.x-i*oa.y,sa.y=i*oa.x+a*oa.y),e.copy(t),e.x+=sa.x,e.y+=sa.y,e.applyMatrix4(ca)}var _a=new W,va=new W,ya=new W,ba=new W,xa=new W,Sa=new W,Ca=new W,wa=class{constructor(e=new W,t=new W(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,_a)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let 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){let t=_a.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(_a.copy(this.origin).addScaledVector(this.direction,t),_a.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){va.copy(e).add(t).multiplyScalar(.5),ya.copy(t).sub(e).normalize(),ba.copy(this.origin).sub(va);let i=e.distanceTo(t)*.5,a=-this.direction.dot(ya),o=ba.dot(this.direction),s=-ba.dot(ya),c=ba.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}
vendor: 4,971 bytes, line 9
9else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(va).addScaledVector(ya,d),f}intersectSphere(e,t){_a.subVectors(e.center,this.origin);let n=_a.dot(this.direction),r=_a.dot(_a)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,_a)!==null}intersectTriangle(e,t,n,r,i){xa.subVectors(t,e),Sa.subVectors(n,e),Ca.crossVectors(xa,Sa);let a=this.direction.dot(Ca),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ba.subVectors(this.origin,e);let s=o*this.direction.dot(Sa.crossVectors(ba,Sa));if(s<0)return null;let c=o*this.direction.dot(xa.cross(ba));if(c<0||s+c>a)return null;let l=-o*ba.dot(Ca);return l<0?null:this.at(l/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)}},Ta=class extends ea{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new $r(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 Or,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}},Ea=new vr,Da=new wa,Oa=new Vi,ka=new W,Aa=new W,ja=new W,Ma=new W,Na=new W,Pa=new W,Fa=new W,Ia=new W,La=class extends Gr{constructor(e=new Yi,t=new Ta){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),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){Pa.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(Na.fromBufferAttribute(s,e),a?Pa.addScaledVector(Na,r):Pa.addScaledVector(Na.sub(t),r))}t.add(Pa)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Oa.copy(n.boundingSphere),Oa.applyMatrix4(i),Da.c
vendor: 4,233 bytes, line 9
9opy(e.ray).recast(e.near),!(Oa.containsPoint(Da.origin)===!1&&(Da.intersectSphere(Oa,ka)===null||Da.origin.distanceToSquared(ka)>(e.far-e.near)**2))&&(Ea.copy(i).invert(),Da.copy(e.ray).applyMatrix4(Ea),!(n.boundingBox!==null&&Da.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Da)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=za(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=za(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}else if(s!==void 0)if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=za(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=za(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}};function Ra(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;Ia.copy(s),Ia.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(Ia);return l<n.near||l>n.far?null:{distance:l,point:Ia.clone(),object:e}}function za(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,Aa),e.getVertexPosition(c,ja),e.getVertexPosition(l,Ma);let u=Ra(e,t,n,r,Aa,ja,Ma,Fa);if(u){let e=new W;hi.getBarycoord(Fa,Aa,ja,Ma,e),i&&(u.uv=hi.getInterpolatedAttribute(i,s,c,l,e,new U)),a&&(u.uv1=hi.getInterpolatedAttribute(a,s,c,l,e,new U)),o&&(u.normal=hi.getInterpolatedAttribute(o,s,c,l,e,new W),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new W,materialIndex:0};hi.getNormal(Aa,ja,Ma,t.normal),u.face=t,u.barycoord=e}return u}var Ba=class extends fr{constructor(e=null,t=1,n=1,r,i,a,o,s,c=Ie,l=Ie,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Va=new W,Ha=new W,Ua=new Zn,Wa=class{constructor(e=new W(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){let r=Va.subVectors(n,t).cross(Ha.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let 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,n=!0){let r=e.delta(Va),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let 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){let n=t||Ua.getNormalMatrix(e),r=this.coplanarPoint(Va).applyMatrix4(e),i=this.normal.applyM
vendor: 4,281 bytes, line 9
9atrix3(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)}},Ga=new Vi,Ka=new U(.5,.5),qa=new W,Ja=class{constructor(e=new Wa,t=new Wa,n=new Wa,r=new Wa,i=new Wa,a=new Wa){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=sn,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ga.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ga.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ga)}intersectsSprite(e){return Ga.center.set(0,0,0),Ga.radius=.7071067811865476+Ka.distanceTo(e.center),Ga.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ga)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(qa.x=r.normal.x>0?e.max.x:e.min.x,qa.y=r.normal.y>0?e.max.y:e.min.y,qa.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(qa)<0)return!1}return!0}containsPoint(e){let 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)}},Ya=class extends ea{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new $r(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}},Xa=new W,Za=new W,Qa=new vr,$a=new wa,eo=new Vi,to=new W,no=new W,ro=class extends Gr{constructor(e=new Yi,t=new Ya){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(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)Xa.fromBufferAttribute(t,e-1),Za.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Xa.distanceTo(Za);e.setAttribute(`lineDistance`,new Li(n,1))}else H(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),eo.copy(n.boundingSphere),eo.applyMatrix4(r),eo.radius+=i,e.ray.intersectsSphere(eo)===!1)return;Qa.copy(r).invert(),$a.copy(e.ray).applyMatrix4(Qa);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=this.isLineSegments?2:1,l=n.index,u=n.attributes.position;if(l!==null){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=l.getX(i),r=l.getX(i+1),a=io(this,e,$a,s,n,r,i);a&&t.push(a)}if(this.isLineLoop){let i=l.getX(r-1),a=l.getX(n),o=io(this,e,$a,s,i,a,r-1);o&&t.push(o)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=io(this,e,$a,s,i,i+1,i);
vendor: 10,161 bytes, line 9
9n&&t.push(n)}if(this.isLineLoop){let i=io(this,e,$a,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function io(e,t,n,r,i,a,o){let s=e.geometry.attributes.position;if(Xa.fromBufferAttribute(s,i),Za.fromBufferAttribute(s,a),n.distanceSqToSegment(Xa,Za,to,no)>r)return;to.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(to);if(!(c<t.near||c>t.far))return{distance:c,point:no.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var ao=new W,oo=new W,so=class extends ro{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)ao.fromBufferAttribute(t,e),oo.fromBufferAttribute(t,e+1),n[e]=e===0?0:n[e-1],n[e+1]=n[e]+ao.distanceTo(oo);e.setAttribute(`lineDistance`,new Li(n,1))}else H(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}},co=class extends ea{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new $r(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}},lo=new vr,uo=new wa,fo=new Vi,po=new W,mo=class extends Gr{constructor(e=new Yi,t=new co){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){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),fo.copy(n.boundingSphere),fo.applyMatrix4(r),fo.radius+=i,e.ray.intersectsSphere(fo)===!1)return;lo.copy(r).invert(),uo.copy(e.ray).applyMatrix4(lo);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=n.index,l=n.attributes.position;if(c!==null){let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let a=n,o=i;a<o;a++){let n=c.getX(a);po.fromBufferAttribute(l,n),ho(po,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n,o=i;a<o;a++)po.fromBufferAttribute(l,a),ho(po,a,s,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function ho(e,t,n,r,i,a,o){let s=uo.distanceSqToPoint(e);if(s<n){let n=new W;uo.closestPointToPoint(e,n),n.applyMatrix4(r);let c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var go=class extends fr{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},_o=class extends fr{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},vo=class extends fr{constructor(e,t,n=Ke,r,i,a,o=Ie,s=Ie,c,l=rt,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new cr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},yo=class extends vo{constructor(e,t=Ke,n=301,r,i,a=Ie,o=Ie,s,c=rt){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},bo=class extends fr{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},xo=class e extends Yi{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,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 Li(c,3)),this.setAttribute(`normal`,new Li(l,3)),this.setAttribute(`uv`,new Li(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new W;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},So=class e extends Yi{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new Li(u,3)),this.setAttribute(`normal`,new Li(d,3)),this.setAttribute(`uv`,new Li(f,2));function _(){let a=new W,_=new W,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){let a=m[r][n],o=m[r+1][n],s=m[r+1][n+1],c=m[r][n+1];(e>0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new U,m=new W,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=i+e,r=b+e;n===!0?l.push(r,r+1,t):l.push(r+1,r,t),_+=3}c.addGroup(g,_,n===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Co=class e extends So{constructor(e=1,t=1,n=32,r=1,i=!1,a=0,o=Math.PI*2){super(0,e,t,n,r,i,a,o),this.type=`ConeGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}static fromJSON(t){return new e(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},wo=new W,To=new W,Eo=new W,Do=new hi,Oo=class extends Yi{constructor(e=null,t=1){if(super(),this.type=`EdgesGeometry`,this.parameters={geometry:e,thresholdAngle:t},e!==null){let n=10**4,r=Math.cos(Cn*t),i=e.getIndex(),a=e.getAttribute(`position`),o=i?i.count:a.count,s=[0,0,0],c=[`a`,`b`,`c`],l=[,,,],u={},d=[];for(let e=0;e<o;e+=3){i?(s[0]=i.getX(e),s[1]=i.getX(e+1),s[2]=i.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);let{a:t,b:o,c:f}=Do;if(t.fromBufferAttribute(a,s[0]),o.fromBufferAttribute(a,s[1]),f.fromBufferAttribute(a,s[2]),Do.getNormal(Eo),l[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,l[1]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,l[2]=`${Math.round(f.x*n)},${Math.round(f.y*n)},${Math.round(f.z*n)}`,!(l[0]===l[1]||l[1]===l[2]||l[2]===l[0]))for(let e=0;e<3;e++){let t=(e+1)%3,n=l[e],i=l[t],a=Do[c[e]],o=Do[c[t]],f=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(Eo.dot(u[p].normal)<=r&&(d.push(a.x,a.y,a.z),d.push(o.x,o.y,o.z)),u[p]=null):f in u||(u[f]={index0:s[e],index1:s[t],normal:Eo.clone()})}}for(let e in u)if(u[e]){let{index0:t,index1:n}=u[e];wo.fromBufferAttribute(a,t),To.fromBufferAttribute(a,n),d.push(wo.x,wo.y,wo.z),d.push(To.x,To.y,To.z)}this.setAttribute(`position`,new Li(d,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}},ko=class{constructor(){this.type=`Curve`,this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){H(`Curve: .getPoint() not implemented.`)}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let 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;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/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){let n=this.getLengths(),r=0,i=n.length,a;a=t||e*n[i-1];let o=0,s=i-1,c;for(;o<=s;
vendor: 4,440 bytes, line 9
9)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new U:new W);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new W,r=[],i=[],a=[],o=new W,s=new vr;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new W)}i[0]=new W,a[0]=new W;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(En(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(En(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let 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}},Ao=class extends ko{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!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=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new U){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}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(){let 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}},jo=class extends Ao{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}};function Mo(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}var No=new W,Po=new W,Fo=new Mo,Io=new Mo,Lo=new Mo,Ro=class extends ko{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 W){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(Po.subVectors(r[0],r[1]).add(r[0]),c=Po);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(No.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=No),this.curveType===`centripetal`||this.curveType===`chordal`){let e=this.curveType===`chordal`?.5:.25,t=c.distanceToSquared(u)**+e,n=u.distanceToSquared(d)**+e,r=d.distanceToSquared(l)**+e;n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),Fo.initNonuniformCatmullRom(c.x,u.x,d.x,l.x,t,n,r),Io.initNonuniformCatmullRom(c.y,u.y,d.y,l.y,t,n,r),Lo.initNonuniformCatmullRom(c.z,u.z,d.z,l.z,t,n,r)}
vendor: 14,801 bytes, lines 9-13
9else this.curveType===`catmullrom`&&(Fo.initCatmullRom(c.x,u.x,d.x,l.x,this.tension),Io.initCatmullRom(c.y,u.y,d.y,l.y,this.tension),Lo.initCatmullRom(c.z,u.z,d.z,l.z,this.tension));return n.set(Fo.calc(s),Io.calc(s),Lo.calc(s)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let 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++){let n=e.points[t];this.points.push(new W().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function zo(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Bo(e,t){let n=1-e;return n*n*t}function Vo(e,t){return 2*(1-e)*e*t}function G(e,t){return e*e*t}function Ho(e,t,n,r){return Bo(e,t)+Vo(e,n)+G(e,r)}function Uo(e,t){let n=1-e;return n*n*n*t}function Wo(e,t){let n=1-e;return 3*n*n*e*t}function Go(e,t){return 3*(1-e)*e*e*t}function Ko(e,t){return e*e*e*t}function K(e,t,n,r,i){return Uo(e,t)+Wo(e,n)+Go(e,r)+Ko(e,i)}var qo=class extends ko{constructor(e=new U,t=new U,n=new U,r=new U){super(),this.isCubicBezierCurve=!0,this.type=`CubicBezierCurve`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new U){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(K(e,r.x,i.x,a.x,o.x),K(e,r.y,i.y,a.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.v3.copy(e.v3),this}toJSON(){let 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}},Jo=class extends ko{constructor(e=new W,t=new W,n=new W,r=new W){super(),this.isCubicBezierCurve3=!0,this.type=`CubicBezierCurve3`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new W){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(K(e,r.x,i.x,a.x,o.x),K(e,r.y,i.y,a.y,o.y),K(e,r.z,i.z,a.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.v3.copy(e.v3),this}toJSON(){let 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}},Yo=class extends ko{constructor(e=new U,t=new U){super(),this.isLineCurve=!0,this.type=`LineCurve`,this.v1=e,this.v2=t}getPoint(e,t=new U){let n=t;return e===1?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 U){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(){let 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}},Xo=class extends ko{constructor(e=new W,t=new W){super(),this.isLineCurve3=!0,this.type=`LineCurve3`,this.v1=e,this.v2=t}getPoint(e,t=new W){let n=t;return e===1?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 W){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(){let 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}},Zo=class extends ko{constructor(e=new U,t=new U,n=new U){super(),this.isQuadraticBezierCurve=!0,this.type=`QuadraticBezierCurve`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new U){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Ho(e,r.x,i.x,a.x),Ho(e,r.y,i.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}toJSON(){let 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}},Qo=class extends ko{constructor(e=new W,t=new W,n=new W){super(),this.isQuadraticBezierCurve3=!0,this.type=`QuadraticBezierCurve3`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new W){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Ho(e,r.x,i.x,a.x),Ho(e,r.y,i.y,a.y),Ho(e,r.z,i.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}toJSON(){let 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}},$o=Object.freeze({__proto__:null,ArcCurve:jo,CatmullRomCurve3:Ro,CubicBezierCurve:qo,CubicBezierCurve3:Jo,EllipseCurve:Ao,LineCurve:Yo,LineCurve3:Xo,QuadraticBezierCurve:Zo,QuadraticBezierCurve3:Qo,SplineCurve:class extends ko{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=`SplineCurve`,this.points=e}getPoint(e,t=new U){let n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(zo(o,s.x,c.x,l.x,u.x),zo(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let 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++){let n=e.points[t];this.points.push(new U().fromArray(n))}return this}}}),es=class e extends Yi{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new Li(p,3)),this.setAttribute(`normal`,new Li(m,3)),this.setAttribute(`uv`,new Li(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}},ts=class e extends Yi{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new W,d=new W,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=0;f===0&&a===0?v=.5/t:f===n&&s===Math.PI&&(v=-.5/t);for(let n=0;n<=t;n++){let s=n/t;u.x=-e*Math.cos(r+s*i)*Math.sin(a+_*o),u.y=e*Math.cos(a+_*o),u.z=e*Math.sin(r+s*i)*Math.sin(a+_*o),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(s+v,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new Li(p,3)),this.setAttribute(`normal`,new Li(m,3)),this.setAttribute(`uv`,new Li(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},ns=class e extends Yi{constructor(e=1,t=.4,n=12,r=48,i=Math.PI*2,a=0,o=Math.PI*2){super(),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i,thetaStart:a,thetaLength:o},n=Math.floor(n),r=Math.floor(r);let s=[],c=[],l=[],u=[],d=new W,f=new W,p=new W;for(let s=0;s<=n;s++){let m=a+s/n*o;for(let a=0;a<=r;a++){let o=a/r*i;f.x=(e+t*Math.cos(m))*Math.cos(o),f.y=(e+t*Math.cos(m))*Math.sin(o),f.z=t*Math.sin(m),c.push(f.x,f.y,f.z),d.x=e*Math.cos(o),d.y=e*Math.sin(o),p.subVectors(f,d).normalize(),l.push(p.x,p.y,p.z),u.push(a/r),u.push(s/n)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,a=(r+1)*(e-1)+t,o=(r+1)*e+t;s.push(n,i,o),s.push(i,a,o)}this.setIndex(s),this.setAttribute(`position`,new Li(c,3)),this.setAttribute(`normal`,new Li(l,3)),this.setAttribute(`uv`,new Li(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},rs=class e extends Yi{constructor(e=new Qo(new W(-1,-1,0),new W(-1,1,0),new W(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};let a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let o=new W,s=new W,c=new U,l=new W,u=[],d=[],f=[],p=[];m(),this.setIndex(p),this.setAttribute(`position`,new Li(u,3)),this.setAttribute(`normal`,new Li(d,3)),this.setAttribute(`uv`,new Li(f,2));function m(){for(let e=0;e<t;e++)h(e);h(i===!1?t:0),_(),g()}function h(i){l=e.getPointAt(i/t,l);let c=a.normals[i],f=a.binormals[i];for(let e=0;e<=r;e++){let t=e/r*Math.PI*2,i=Math.sin(t),a=-Math.cos(t);s.x=a*c.x+i*f.x,s.y=a*c.y+i*f.y,s.z=a*c.z+i*f.z,s.normalize(),d.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,u.push(o.x,o.y,o.z)}}function g(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,o=(r+1)*(e-1)+t;p.push(n,i,o),p.push(i,a,o)}}function _(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)c.x=e/t,c.y=n/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(t){return new e(new $o[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},is=class extends Yi{constructor(e=null){if(super(),this.type=`WireframeGeometry`,this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new W,i=new W;if(e.index!==null){let a=e.attributes.position,o=e.index,s=e.groups;s.length===0&&(s=[{start:0,count:o.count,materialIndex:0}]);for(let e=0,c=s.length;e<c;++e){let c=s[e],l=c.start,u=c.count;for(let e=l,s=l+u;e<s;e+=3)for(let s=0;s<3;s++){let c=o.getX(e+s),l=o.getX(e+(s+1)%3);r.fromBufferAttribute(a,c),i.fromBufferAttribute(a,l),as(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{let a=e.attributes.position;for(let e=0,o=a.count/3;e<o;e++)for(let o=0;o<3;o++){let s=3*e+o,c=3*e+(o+1)%3;r.fromBufferAttribute(a,s),i.fromBufferAttribute(a,c),as(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute(`position`,new Li(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function as(e,t,n){let 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 n.has(r)===!0||n.has(i)===!0?!1:(n.add(r),n.add(i),!0)}function os(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];if(cs(i))i.isRenderTargetTexture?(H(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone();else if(Array.isArray(i))if(cs(i[0])){let e=[];for(let t=0,n=i.length;t<n;t++)e[t]=i[t].clone();t[n][r]=e}else t[n][r]=i.slice();else t[n][r]=i}}return t}function ss(e){let t={};for(let n=0;n<e.length;n++){let r=os(e[n]);for(let e in r)t[e]=r[e]}return t}function cs(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function ls(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function us(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:nr.workingColorSpace}var ds={clone:os,merge:ss},fs=`void main() { 10 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 11}`,ps=`void main() { 12 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 13}`,ms=class extends ea{constructor(e){super(),this.isShaderMaterial=!0,this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=fs,this.fragmentShader=ps,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=os(e.uniforms),this.uniformsGroups=ls(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){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}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;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},hs=class extends ms{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type=`RawS
13haderMaterial`}},gs=class extends ea{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new $r(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 $r(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new U(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 Or,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}},_s=class extends ea{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=`MeshPhongMaterial`,this.color=new $r(16777215),this.specular=new $r(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new $r(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new U(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Or,this.combine=0,this.reflectivity=1,this.envMapIntensity=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.envMapIntensity=e.envMapIntensity,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}},vs=class extends ea{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=$t,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}},ys=class extends ea{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}},bs=class extends Ya{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 xs(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}var Ss=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){let o=t[1];e<o&&(n=2,i=o);for(let a=n-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){let r=n+a>>>1;e<t[r]?a=r:n=r+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)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){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw Error(`call to abstract method`)}intervalChanged_(){}},Cs=class extends Ss{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:Xt,endingEnd:Xt}}intervalChanged_(e,t,n){let r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Zt:i=e,o=2*t-n;break;case Qt:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case Zt:a=e,s=2*n-t;break;case Qt:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}let c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m;for(let e=0;e!==o;++e)i[e]=g*a[l+e]+_*a[c+e]+v*a[s+e]+y*a[u+e];return i}},ws=class extends Ss{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l;for(let e=0;e!==o;++e)i[e]=a[c+e]*u+a[s+e]*l;return i}},Ts=class extends Ss{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},Es=class extends Ss{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this.settings||this.DefaultSettings_,u=l.inTangents,d=l.outTangents;if(!u||!d){let e=(n-t)/(r-t),l=1-e;for(let t=0;t!==o;++t)i[t]=a[c+t]*l+a[s+t]*e;return i}let f=o*2,p=e-1;for(let l=0;l!==o;
vendor: 17,451 bytes, line 13
13++l){let o=a[c+l],m=a[s+l],h=p*f+l*2,g=d[h],_=d[h+1],v=e*f+l*2,y=u[v],b=u[v+1],x=(n-t)/(r-t),S,C,w,T,E;for(let e=0;e<8;e++){S=x*x,C=S*x,w=1-x,T=w*w,E=T*w;let e=E*t+3*T*x*g+3*w*S*y+C*r-n;if(Math.abs(e)<1e-10)break;let i=3*T*(g-t)+6*w*x*(y-g)+3*S*(r-y);if(Math.abs(i)<1e-10)break;x-=e/i,x=Math.max(0,Math.min(1,x))}i[l]=E*o+3*T*x*_+3*w*S*b+C*m}return i}},Ds=class{constructor(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=xs(t,this.TimeBufferType),this.values=xs(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:xs(e.times,Array),values:xs(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Ts(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ws(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Cs(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Es(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case Kt:t=this.InterpolantFactoryMethodDiscrete;break;case qt:t=this.InterpolantFactoryMethodLinear;break;case Jt:t=this.InterpolantFactoryMethodSmooth;break;case Yt:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let t=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return H(`KeyframeTrack:`,t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Kt;case this.InterpolantFactoryMethodLinear:return qt;case this.InterpolantFactoryMethodSmooth:return Jt;case this.InterpolantFactoryMethodBezier:return Yt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,i=0,a=r-1;for(;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(gn(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(gn(`KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){gn(`KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){gn(`KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&ln(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){gn(`KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Jt,i=e.length-1,a=1;for(let o=1;o<i;++o){let i=!1,s=e[o];if(s!==e[o+1]&&(o!==1||s!==e[0]))if(r)i=!0;else{let e=o*n,r=e-n,a=e+n;for(let o=0;o!==n;++o){let n=t[e+o];if(n!==t[r+o]||n!==t[a+o]){i=!0;break}}}if(i){if(o!==a){e[a]=e[o];let r=o*n,i=a*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Ds.prototype.ValueTypeName=``,Ds.prototype.TimeBufferType=Float32Array,Ds.prototype.ValueBufferType=Float32Array,Ds.prototype.DefaultInterpolation=qt;var Os=class extends Ds{constructor(e,t,n){super(e,t,n)}};Os.prototype.ValueTypeName=`bool`,Os.prototype.ValueBufferType=Array,Os.prototype.DefaultInterpolation=Kt,Os.prototype.InterpolantFactoryMethodLinear=void 0,Os.prototype.InterpolantFactoryMethodSmooth=void 0;var ks=class extends Ds{constructor(e,t,n,r){super(e,t,n,r)}};ks.prototype.ValueTypeName=`color`;var As=class extends Ds{constructor(e,t,n,r){super(e,t,n,r)}};As.prototype.ValueTypeName=`number`;var js=class extends Ss{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Jn.slerpFlat(i,0,a,c-o,a,c,s);return i}},q=class extends Ds{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new js(this.times,this.values,this.getValueSize(),e)}};q.prototype.ValueTypeName=`quaternion`,q.prototype.InterpolantFactoryMethodSmooth=void 0;var Ms=class extends Ds{constructor(e,t,n){super(e,t,n)}};Ms.prototype.ValueTypeName=`string`,Ms.prototype.ValueBufferType=Array,Ms.prototype.DefaultInterpolation=Kt,Ms.prototype.InterpolantFactoryMethodLinear=void 0,Ms.prototype.InterpolantFactoryMethodSmooth=void 0;var Ns=class extends Ds{constructor(e,t,n,r){super(e,t,n,r)}};Ns.prototype.ValueTypeName=`vector`;var Ps={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(Fs(e)||(this.files[e]=t))},get:function(e){if(this.enabled!==!1&&!Fs(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Fs(e){try{let t=e.slice(e.indexOf(`:`)+1);return new URL(t).protocol===`blob:`}catch{return!1}}var Is=new class{constructor(e,t,n){let r=this,i=!1,a=0,o=0,s,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=c.length;t<n;t+=2){let n=c[t],r=c[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||=new AbortController,this._abortController}},Ls=class{constructor(e){this.manager=e===void 0?Is:e,this.crossOrigin=`anonymous`,this.withCredentials=!1,this.path=``,this.resourcePath=``,this.requestHeader={},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}load(){}loadAsync(e,t){let 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}};Ls.DEFAULT_MATERIAL_NAME=`__DEFAULT`;var Rs={},zs=class extends Error{constructor(e,t){super(e),this.response=t}},Bs=class extends Ls{constructor(e){super(e),this.mimeType=``,this.responseType=``,this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=Ps.get(`file:${e}`);if(i!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(i),this.manager.itemEnd(e)},0);return}if(Rs[e]!==void 0){Rs[e].push({onLoad:t,onProgress:n,onError:r});return}Rs[e]=[],Rs[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`,signal:typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&H(`FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=Rs[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e<t;e++){let t=n[e];t.onProgress&&t.onProgress(r)}e.enqueue(i),t()}},t=>{e.error(t)})}}});return new Response(c)}else throw new zs(`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,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{Ps.add(`file:${e}`,t);let n=Rs[e];delete Rs[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let n=Rs[e];if(n===void 0)throw this.manager.itemError(e),t;delete Rs[e];for(let e=0,r=n.length;e<r;e++){let 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}},Vs=new WeakMap,Hs=class extends Ls{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=Ps.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0);else{let e=Vs.get(a);e===void 0&&(e=[],Vs.set(a,e)),e.push({onLoad:t,onError:r})}return a}let o=un(`img`);function s(){l(),t&&t(this);let n=Vs.get(this)||[];for(let e=0;e<n.length;e++){let t=n[e];t.onLoad&&t.onLoad(this)}Vs.delete(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),Ps.remove(`image:${e}`);let n=Vs.get(this)||[];for(let e=0;e<n.length;e++){let r=n[e];r.onError&&r.onError(t)}Vs.delete(this),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Ps.add(`image:${e}`,o),i.manager.itemStart(e),o.src=e,o}},Us=class extends Ls{constructor(e){super(e)}load(e,t,n,r){let i=new fr,a=new Hs(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},Ws=class extends Gr{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new $r(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){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},Gs=class extends Ws{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(Gr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new $r(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},Ks=new vr,qs=new W,Js=new W,Ys=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new U(512,512),this.mapType=Ve,this.map=null,this.mapPass=null,this.matrix=new vr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ja,this._frameExtents=new U(1,1),this._viewportCount=1,this._viewports=[new pr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;qs.setFromMatrixPosition(e.matrixWorld),t.position.copy(qs),Js.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Js),t.updateMatrixWorld(),Ks.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ks,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||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(Ks)}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.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},Xs=new W,Zs=new Jn,Qs=new W,$s=class extends Gr{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new vr,this.projectionMatrix=new vr,this.projectionMatrixInverse=new vr,this.coordinateSystem=sn,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.matrixWorld.decompose(Xs,Zs,Qs),Qs.x===1&&Qs.y===1&&Qs.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Xs,Zs,Qs.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(Xs,Zs,Qs),Qs.x===1&&Qs.y===1&&Qs.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Xs,Zs,Qs.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},ec=new W,tc=new U,nc=new U,rc=class extends $s{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=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=wn*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Cn*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return wn*2*Math.atan(Math.tan(Cn*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ec.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ec.x,ec.y).multiplyScalar(-e/ec.z),ec.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ec.x,ec.y).multiplyScalar(-e/ec.z)}getViewSize(e,t){return this.getViewBounds(e,tc,nc),t.subVectors(nc,tc)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Cn*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/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){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},ic=class extends $s{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`Orthogra
13phicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let 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,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let 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,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},ac=class extends Ys{constructor(){super(new ic(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},oc=class extends Ws{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(Gr.DEFAULT_UP),this.updateMatrix(),this.target=new Gr,this.shadow=new ac}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){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},sc=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||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)}},cc=-90,lc=1,uc=class extends Gr{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new rc(cc,lc,e,t);r.layers=this.layers,this.add(r);let i=new rc(cc,lc,e,t);i.layers=this.layers,this.add(i);let a=new rc(cc,lc,e,t);a.layers=this.layers,this.add(a);let o=new rc(cc,lc,e,t);o.layers=this.layers,this.add(o);let s=new rc(cc,lc,e,t);s.layers=this.layers,this.add(s);let c=new rc(cc,lc,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)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),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)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),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let h=!1;h=e.isWebGLRenderer===!0?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(n,0,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,i),e.setRenderTarget(n,1,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,4,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},dc=class extends rc{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},fc=`\\[\\]\\.:\\/`,pc=RegExp(`[`+fc+`]`,`g`),mc=`[^`+fc+`]`,hc=`[^`+fc.replace(`\\.`,``)+`]`,gc=`((?:WC+[\\/:])*)`.replace(`WC`,mc),_c=`(WCOD+)?`.replace(`WCOD`,hc),vc=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,mc),yc=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,mc),bc=RegExp(`^`+gc+_c+vc+yc+`$`),xc=[`material`,`materials`,`bones`,`map`],Sc=class{constructor(e,t,n){let r=n||Cc.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Cc=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(pc,``)}static parseTrackName(e){let t=bc.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);xc.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let a=n(i.children);if(a)return a}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){let 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){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}
vendor: 4,148 bytes, line 13
13_setValue_array_setMatrixWorldNeedsUpdate(e,t){let 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 t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){H(`PropertyBinding: No target node found for track: `+this.path+`.`);return}if(r){let e=n.objectIndex;switch(r){case`materials`:if(!t.material){gn(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.materials){gn(`PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}t=t.material.materials;break;case`bones`:if(!t.skeleton){gn(`PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}t=t.skeleton.bones;for(let n=0;n<t.length;n++)if(t[n].name===e){e=n;break}break;case`map`:if(`map`in t){t=t.map;break}if(!t.material){gn(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.map){gn(`PropertyBinding: Can not bind to material.map as node.material does not have a map.`,this);return}t=t.material.map;break;default:if(t[r]===void 0){gn(`PropertyBinding: Can not bind to objectName of node undefined.`,this);return}t=t[r]}if(e!==void 0){if(t[e]===void 0){gn(`PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,t);return}t=t[e]}}let o=t[i];if(o===void 0){let e=n.nodeName;gn(`PropertyBinding: Trying to update property for track: `+e+`.`+i+` but it wasn't found.`,t);return}let s=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?s=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(s=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(a!==void 0){if(i===`morphTargetInfluences`){if(!t.geometry){gn(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(!t.geometry.morphAttributes){gn(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}t.morphTargetDictionary[a]!==void 0&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Cc.Composite=Sc,Cc.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Cc.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Cc.prototype.GetterByBindingType=[Cc.prototype._getValue_direct,Cc.prototype._getValue_array,Cc.prototype._getValue_arrayElement,Cc.prototype._getValue_toArray],Cc.prototype.SetterByBindingTypeAndVersioning=[[Cc.prototype._setValue_direct,Cc.prototype._setValue_direct_setNeedsUpdate,Cc.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Cc.prototype._setValue_array,Cc.prototype._setValue_array_setNeedsUpdate,Cc.prototype._setValue_array_setMatr
vendor: 4,997 bytes, line 13
13ixWorldNeedsUpdate],[Cc.prototype._setValue_arrayElement,Cc.prototype._setValue_arrayElement_setNeedsUpdate,Cc.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Cc.prototype._setValue_fromArray,Cc.prototype._setValue_fromArray_setNeedsUpdate,Cc.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var wc=new vr,Tc=class{constructor(e,t,n=0,r=1/0){this.ray=new wa(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new kr,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):gn(`Raycaster: Unsupported camera type: `+t.type)}setFromXRController(e){return wc.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(wc),this}intersectObject(e,t=!0,n=[]){return Dc(e,this,n,t),n.sort(Ec),n}intersectObjects(e,t=!0,n=[]){for(let r=0,i=e.length;r<i;r++)Dc(e[r],this,n,t);return n.sort(Ec),n}};function Ec(e,t){return e.distance-t.distance}function Dc(e,t,n,r){let i=!0;if(e.layers.test(t.layers)&&e.raycast(t,n)===!1&&(i=!1),i===!0&&r===!0){let r=e.children;for(let e=0,i=r.length;e<i;e++)Dc(r[e],t,n,!0)}}var Oc=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(){let e=1e-6;return this.phi=En(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),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(En(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};(class e{static{e.prototype.isMatrix2=!0}constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&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){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}});var kc=new W,Ac=new W,jc=new W,Mc=new W,Nc=new W,Pc=new W,Fc=new W,Ic=class{constructor(e=new W,t=new W){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){kc.subVectors(e,this.start),Ac.subVectors(this.end,this.start);let n=Ac.dot(Ac);if(n===0)return 0;let r=Ac.dot(kc)/n;return t&&(r=En(r,0,1)),r}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=Pc,n=Fc){let r=1e-8*1e-8,i,a,o=this.start,s=e.start,c=this.end,l=e.end;jc.subVectors(c,o),Mc.subVectors(l,s),Nc.subVectors(o,s);let u=jc.dot(jc),d=Mc.dot(Mc),f=Mc.dot(Nc);if(u<=r&&d<=r)return t.copy(o),n.copy(s),t.sub(n),t.dot(t);if(u<=r)i=0,a=f/d,a=En(a,0,1);else{let e=jc.dot(Nc);if(d<=r)a=0,i=En(-e/u,0,1);else{let t=jc.dot(Mc),n=u*d-t*t;i=n===0?0:En((t*f-e*d)/n,0,1),a=(t*i+f)/d,a<0?(a=0,i=En(-e/u,0,1)):a>1&&(a=1,i=En((t-e)/u,0,1))}}return t.copy(o).addScaledVector(jc,i),n.copy(s).addScaledVector(Mc,a),t.distanceToSquared(n)}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)}},Lc=class extends so{constructor(e=10,t=10,n=4473924,r=8947848){n=new $r(n),r=new $r(r);let i=t/2,a=e/t,o=e/2,s=[],c=[];for(let e=0,l=0,u=-o;e<=t;e++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);let t=e===i?n:r;t.toArray(c,l),l+=3,t.toArray(c,l),l+=3,t.toArray(c,l),l+=3,t.toArray(c,l),l+=3}let l=new Yi;l.setAttribute(`position`,new Li(s,3)),l.setAttribute(`color`,new Li(c,3));let u=new Ya({vertexColors:!0,toneMapped:!1});super(l,u),this.type=`GridHelper`}dispose(){this.geometry.dispose(),this.material.dispose()}},Rc=class extends bn{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){if(e===void 0){H(`Controls: connect() now requires an element.`);return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function J(e,t,n,r){let i=zc(r);switch(n){case et:return e*t;
vendor: 6,972 bytes, lines 13-72
13case at:return e*t/i.components*i.byteLength;case ot:return e*t/i.components*i.byteLength;case st:return e*t*2/i.components*i.byteLength;case ct:return e*t*2/i.components*i.byteLength;case tt:return e*t*3/i.components*i.byteLength;case nt:return e*t*4/i.components*i.byteLength;case lt:return e*t*4/i.components*i.byteLength;case ut:case dt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case ft:case pt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case ht:case _t:return Math.max(e,16)*Math.max(t,8)/4;case mt:case gt:return Math.max(e,8)*Math.max(t,8)/2;case vt:case yt:case xt:case St:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case bt:case Ct:case wt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Tt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Et:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case Dt:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Ot:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case kt:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case At:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case jt:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Mt:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case Nt:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case Pt:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Ft:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case It:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case Lt:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case Rt:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case zt:case Bt:case Vt:return Math.ceil(e/4)*Math.ceil(t/4)*16;case Ht:case Ut:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Wt:case Gt:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function zc(e){switch(e){case Ve:case He:return{byteLength:1,components:1};case We:case Ue:case Je:return{byteLength:2,components:1};case Ye:case Xe:return{byteLength:2,components:4};case Ke:case Ge:case qe:return{byteLength:4,components:1};case Qe:case $e:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${e}.`)}typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`184`}})),typeof window<`u`&&(window.__THREE__?H(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`184`);function Bc(){let e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){t!==!0&&n!==null&&e!==null&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e!==null&&e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Vc(e){let t=new WeakMap;function n(t,n){let r=t.array,i=t.usage,a=r.byteLength,o=e.createBuffer();e.bindBuffer(n,o),e.bufferData(n,r,i),t.onUploadCallback();let s;if(r instanceof Float32Array)s=e.FLOAT;else if(typeof Float16Array<`u`&&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)s=e.UNSIGNED_BYTE;else throw Error(`THREE.WebGLAttributes: Unsupported buffer data format: `+r);return{buffer:o,type:s,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:a}}function r(t,n,r){let i=n.array,a=n.updateRanges;if(e.bindBuffer(r,t),a.length===0)e.bufferSubData(r,0,i);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let n=a[t],r=a[e];r.start<=n.start+n.count+1?n.count=Math.max(n.count,r.start+r.count-n.start):(++t,a[t]=r)}a.length=t+1;for(let t=0,n=a.length;t<n;t++){let n=a[t];e.bufferSubData(r,n.start*i.BYTES_PER_ELEMENT,i,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}function i(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)}function a(n){n.isInterleavedBufferAttribute&&(n=n.data);let r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))}function o(e,i){if(e.isInterleavedBufferAttribute&&(e=e.data),e.isGLBufferAttribute){let n=t.get(e);(!n||n.version<e.version)&&t.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version});return}let a=t.get(e);if(a===void 0)t.set(e,n(e,i));else if(a.version<e.version){if(a.size!==e.array.byteLength)throw Error(`THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.`);r(a.buffer,e,i),a.version=e.version}}return{get:i,remove:a,update:o}}var Hc={alphahash_fragment:`#ifdef USE_ALPHAHASH 14 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 15#endif`,alphahash_pars_fragment:`#ifdef USE_ALPHAHASH 16 const float ALPHA_HASH_SCALE = 0.05; 17 float hash2D( vec2 value ) { 18 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 19 } 20 float hash3D( vec3 value ) { 21 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 22 } 23 float getAlphaHashThreshold( vec3 position ) { 24 float maxDeriv = max( 25 length( dFdx( position.xyz ) ), 26 length( dFdy( position.xyz ) ) 27 ); 28 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 29 vec2 pixScales = vec2( 30 exp2( floor( log2( pixScale ) ) ), 31 exp2( ceil( log2( pixScale ) ) ) 32 ); 33 vec2 alpha = vec2( 34 hash3D( floor( pixScales.x * position.xyz ) ), 35 hash3D( floor( pixScales.y * position.xyz ) ) 36 ); 37 float lerpFactor = fract( log2( pixScale ) ); 38 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 39 float a = min( lerpFactor, 1.0 - lerpFactor ); 40 vec3 cases = vec3( 41 x * x / ( 2.0 * a * ( 1.0 - a ) ), 42 ( x - 0.5 * a ) / ( 1.0 - a ), 43 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 44 ); 45 float threshold = ( x < ( 1.0 - a ) ) 46 ? ( ( x < a ) ? cases.x : cases.y ) 47 : cases.z; 48 return clamp( threshold , 1.0e-6, 1.0 ); 49 } 50#endif`,alphamap_fragment:`#ifdef USE_ALPHAMAP 51 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 52#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP 53 uniform sampler2D alphaMap; 54#endif`,alphatest_fragment:`#ifdef USE_ALPHATEST 55 #ifdef ALPHA_TO_COVERAGE 56 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 57 if ( diffuseColor.a == 0.0 ) discard; 58 #else 59 if ( diffuseColor.a < alphaTest ) discard; 60 #endif 61#endif`,alphatest_pars_fragment:`#ifdef USE_ALPHATEST 62 uniform float alphaTest; 63#endif`,aomap_fragment:`#ifdef USE_AOMAP 64 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 65 reflectedLight.indirectDiffuse *= ambientOcclusion; 66 #if defined( USE_CLEARCOAT ) 67 clearcoatSpecularIndirect *= ambientOcclusion; 68 #endif 69 #if defined( USE_SHEEN ) 70 sheenSpecularIndirect *= ambientOcclusion; 71 #endif 72 #if defined( USE_ENVMAP ) && defined( STANDARD )
73 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 74 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 75 #endif 76#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP 77 uniform sampler2D aoMap; 78 uniform float aoMapIntensity; 79#endif`,batching_pars_vertex:`#ifdef USE_BATCHING 80 #if ! defined( GL_ANGLE_multi_draw ) 81 #define gl_DrawID _gl_DrawID 82 uniform int _gl_DrawID; 83 #endif 84 uniform highp sampler2D batchingTexture; 85 uniform highp usampler2D batchingIdTexture; 86 mat4 getBatchingMatrix( const in float i ) { 87 int size = textureSize( batchingTexture, 0 ).x; 88 int j = int( i ) * 4; 89 int x = j % size; 90 int y = j / size; 91 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 92 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 93 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 94 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 95 return mat4( v1, v2, v3, v4 ); 96 } 97 float getIndirectIndex( const in int i ) { 98 int size = textureSize( batchingIdTexture, 0 ).x; 99 int x = i % size; 100 int y = i / size; 101 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 102 } 103#endif 104#ifdef USE_BATCHING_COLOR 105 uniform sampler2D batchingColorTexture; 106 vec4 getBatchingColor( const in float i ) { 107 int size = textureSize( batchingColorTexture, 0 ).x; 108 int j = int( i ); 109 int x = j % size; 110 int y = j / size; 111 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ); 112 } 113#endif`,batching_vertex:`#ifdef USE_BATCHING 114 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 115#endif`,begin_vertex:`vec3 transformed = vec3( position ); 116#ifdef USE_ALPHAHASH 117 vPosition = vec3( position ); 118#endif`,beginnormal_vertex:`vec3 objectNormal = vec3( normal ); 119#ifdef USE_TANGENT 120 vec3 objectTangent = vec3( tangent.xyz ); 121#endif`,bsdfs:`float G_BlinnPhong_Implicit( ) { 122 return 0.25; 123} 124float D_BlinnPhong( const in float shininess, const in float dotNH ) { 125 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 126} 127vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 128 vec3 halfDir = normalize( lightDir + viewDir ); 129 float dotNH = saturate( dot( normal, halfDir ) ); 130 float dotVH = saturate( dot( viewDir, halfDir ) ); 131 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 132 float G = G_BlinnPhong_Implicit( ); 133 float D = D_BlinnPhong( shininess, dotNH ); 134 return F * ( G * D ); 135} // validated`,iridescence_fragment:`#ifdef USE_IRIDESCENCE 136 const mat3 XYZ_TO_REC709 = mat3( 137 3.2404542, -0.9692660, 0.0556434, 138 -1.5371385, 1.8760108, -0.2040259, 139 -0.4985314, 0.0415560, 1.0572252 140 ); 141 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 142 vec3 sqrtF0 = sqrt( fresnel0 ); 143 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 144 } 145 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 146 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 147 } 148 float IorToFresnel0( float transmittedIor, float incidentIor ) { 149 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 150 } 151 vec3 evalSensitivity( float OPD, vec3 shift ) { 152 float phase = 2.0 * PI * OPD * 1.0e-9; 153 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 154 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 155 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 156 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 157 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 158 xyz /= 1.0685e-7; 159 vec3 rgb = XYZ_TO_REC709 * xyz; 160 return rgb; 161 } 162 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 163 vec3 I; 164 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 165 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 166 float cosTheta2Sq = 1.0 - sinTheta2Sq; 167 if ( cosTheta2Sq < 0.0 ) { 168 return vec3( 1.0 ); 169 } 170 float cosTheta2 = sqrt( cosTheta2Sq ); 171 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
172 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 173 float T121 = 1.0 - R12; 174 float phi12 = 0.0; 175 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 176 float phi21 = PI - phi12; 177 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 178 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 179 vec3 phi23 = vec3( 0.0 ); 180 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 181 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 182 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 183 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 184 vec3 phi = vec3( phi21 ) + phi23; 185 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 186 vec3 r123 = sqrt( R123 ); 187 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 188 vec3 C0 = R12 + Rs; 189 I = C0; 190 vec3 Cm = Rs - T121; 191 for ( int m = 1; m <= 2; ++ m ) { 192 Cm *= r123; 193 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 194 I += Cm * Sm; 195 } 196 return max( I, vec3( 0.0 ) ); 197 } 198#endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP 199 uniform sampler2D bumpMap; 200 uniform float bumpScale; 201 vec2 dHdxy_fwd() { 202 vec2 dSTdx = dFdx( vBumpMapUv ); 203 vec2 dSTdy = dFdy( vBumpMapUv ); 204 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 205 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 206 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 207 return vec2( dBx, dBy ); 208 } 209 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 210 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 211 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 212 vec3 vN = surf_norm; 213 vec3 R1 = cross( vSigmaY, vN ); 214 vec3 R2 = cross( vN, vSigmaX ); 215 float fDet = dot( vSigmaX, R1 ) * faceDirection; 216 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 217 return normalize( abs( fDet ) * surf_norm - vGrad ); 218 } 219#endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0 220 vec4 plane; 221 #ifdef ALPHA_TO_COVERAGE 222 float distanceToPlane, distanceGradient; 223 float clipOpacity = 1.0; 224 #pragma unroll_loop_start 225 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 226 plane = clippingPlanes[ i ]; 227 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 228 distanceGradient = fwidth( distanceToPlane ) / 2.0; 229 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 230 if ( clipOpacity == 0.0 ) discard; 231 } 232 #pragma unroll_loop_end 233 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 234 float unionClipOpacity = 1.0; 235 #pragma unroll_loop_start 236 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 237 plane = clippingPlanes[ i ]; 238 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 239 distanceGradient = fwidth( distanceToPlane ) / 2.0; 240 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 241 } 242 #pragma unroll_loop_end 243 clipOpacity *= 1.0 - unionClipOpacity; 244 #endif 245 diffuseColor.a *= clipOpacity; 246 if ( diffuseColor.a == 0.0 ) discard; 247 #else 248 #pragma unroll_loop_start 249 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 250 plane = clippingPlanes[ i ]; 251 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 252 } 253 #pragma unroll_loop_end 254 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 255 bool clipped = true; 256 #pragma unroll_loop_start 257 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 258 plane = clippingPlanes[ i ]; 259 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 260 } 261 #pragma unroll_loop_end 262 if ( clipped ) discard; 263 #endif 264 #endif 265#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 266 varying vec3 vClipPosition; 267 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 268#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 269 varying vec3 vClipPosition; 270#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 271 vClipPosition = - mvPosition.xyz; 272#endif`,color_fragment:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 273 diffuseColor *= vColor; 274#endif`,color_pars_fragment:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 275 varying vec4 vColor; 276#endif`,color_pars_vertex:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 277 varying vec4 vColor; 278#endif`,color_vertex:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 279 vColor = vec4( 1.0 ); 280#endif 281#ifdef USE_COLOR_ALPHA 282 vColor *= color; 283#elif defined( USE_COLOR ) 284 vColor.rgb *= color; 285#endif 286#ifdef USE_INSTANCING_COLOR 287 vColor.rgb *= instanceColor.rgb; 288#endif 289#ifdef USE_BATCHING_COLOR 290 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); 291#endif`,common:`#define PI 3.141592653589793 292#define PI2 6.283185307179586 293#define PI_HALF 1.5707963267948966 294#define RECIPROCAL_PI 0.3183098861837907 295#define RECIPROCAL_PI2 0.15915494309189535 296#define EPSILON 1e-6 297#ifndef saturate 298#define saturate( a ) clamp( a, 0.0, 1.0 ) 299#endif 300#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 301float pow2( const in float x ) { return x*x; } 302vec3 pow2( const in vec3 x ) { return x*x; } 303float pow3( const in float x ) { return x*x*x; } 304float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 305float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 306float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 307highp float rand( const in vec2 uv ) { 308 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 309 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 310 return fract( sin( sn ) * c ); 311} 312#ifdef HIGH_PRECISION 313 float precisionSafeLength( vec3 v ) { return length( v ); } 314#else 315 float precisionSafeLength( vec3 v ) { 316 float maxComponent = max3( abs( v ) ); 317 return length( v / maxComponent ) * maxComponent; 318 } 319#endif 320struct IncidentLight { 321 vec3 color; 322 vec3 direction; 323 bool visible; 324}; 325struct ReflectedLight { 326 vec3 directDiffuse; 327 vec3 directSpecular; 328 vec3 indirectDiffuse; 329 vec3 indirectSpecular; 330}; 331#ifdef USE_ALPHAHASH 332 varying vec3 vPosition; 333#endif 334vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 335 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 336} 337vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 338 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz )
vendor: 7,098 bytes, lines 338-520
338; 339} 340bool isPerspectiveMatrix( mat4 m ) { 341 return m[ 2 ][ 3 ] == - 1.0; 342} 343vec2 equirectUv( in vec3 dir ) { 344 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 345 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 346 return vec2( u, v ); 347} 348vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 349 return RECIPROCAL_PI * diffuseColor; 350} 351vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 352 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 353 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 354} 355float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 356 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 357 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 358} // validated`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV 359 #define cubeUV_minMipLevel 4.0 360 #define cubeUV_minTileSize 16.0 361 float getFace( vec3 direction ) { 362 vec3 absDirection = abs( direction ); 363 float face = - 1.0; 364 if ( absDirection.x > absDirection.z ) { 365 if ( absDirection.x > absDirection.y ) 366 face = direction.x > 0.0 ? 0.0 : 3.0; 367 else 368 face = direction.y > 0.0 ? 1.0 : 4.0; 369 } else { 370 if ( absDirection.z > absDirection.y ) 371 face = direction.z > 0.0 ? 2.0 : 5.0; 372 else 373 face = direction.y > 0.0 ? 1.0 : 4.0; 374 } 375 return face; 376 } 377 vec2 getUV( vec3 direction, float face ) { 378 vec2 uv; 379 if ( face == 0.0 ) { 380 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 381 } else if ( face == 1.0 ) { 382 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 383 } else if ( face == 2.0 ) { 384 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 385 } else if ( face == 3.0 ) { 386 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 387 } else if ( face == 4.0 ) { 388 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 389 } else { 390 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 391 } 392 return 0.5 * ( uv + 1.0 ); 393 } 394 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 395 float face = getFace( direction ); 396 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 397 mipInt = max( mipInt, cubeUV_minMipLevel ); 398 float faceSize = exp2( mipInt ); 399 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 400 if ( face > 2.0 ) { 401 uv.y += faceSize; 402 face -= 3.0; 403 } 404 uv.x += face * faceSize; 405 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 406 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 407 uv.x *= CUBEUV_TEXEL_WIDTH; 408 uv.y *= CUBEUV_TEXEL_HEIGHT; 409 #ifdef texture2DGradEXT 410 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 411 #else 412 return texture2D( envMap, uv ).rgb; 413 #endif 414 } 415 #define cubeUV_r0 1.0 416 #define cubeUV_m0 - 2.0 417 #define cubeUV_r1 0.8 418 #define cubeUV_m1 - 1.0 419 #define cubeUV_r4 0.4 420 #define cubeUV_m4 2.0 421 #define cubeUV_r5 0.305 422 #define cubeUV_m5 3.0 423 #define cubeUV_r6 0.21 424 #define cubeUV_m6 4.0 425 float roughnessToMip( float roughness ) { 426 float mip = 0.0; 427 if ( roughness >= cubeUV_r1 ) { 428 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 429 } else if ( roughness >= cubeUV_r4 ) { 430 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 431 } else if ( roughness >= cubeUV_r5 ) { 432 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 433 } else if ( roughness >= cubeUV_r6 ) { 434 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 435 } else { 436 mip = - 2.0 * log2( 1.16 * roughness ); } 437 return mip; 438 } 439 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 440 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 441 float mipF = fract( mip ); 442 float mipInt = floor( mip ); 443 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 444 if ( mipF == 0.0 ) { 445 return vec4( color0, 1.0 ); 446 } else { 447 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 448 return vec4( mix( color0, color1, mipF ), 1.0 ); 449 } 450 } 451#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; 452#ifdef USE_TANGENT 453 vec3 transformedTangent = objectTangent; 454#endif 455#ifdef USE_BATCHING 456 mat3 bm = mat3( batchingMatrix ); 457 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 458 transformedNormal = bm * transformedNormal; 459 #ifdef USE_TANGENT 460 transformedTangent = bm * transformedTangent; 461 #endif 462#endif 463#ifdef USE_INSTANCING 464 mat3 im = mat3( instanceMatrix ); 465 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 466 transformedNormal = im * transformedNormal; 467 #ifdef USE_TANGENT 468 transformedTangent = im * transformedTangent; 469 #endif 470#endif 471transformedNormal = normalMatrix * transformedNormal; 472#ifdef FLIP_SIDED 473 transformedNormal = - transformedNormal; 474#endif 475#ifdef USE_TANGENT 476 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 477 #ifdef FLIP_SIDED 478 transformedTangent = - transformedTangent; 479 #endif 480#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP 481 uniform sampler2D displacementMap; 482 uniform float displacementScale; 483 uniform float displacementBias; 484#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP 485 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); 486#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP 487 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 488 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 489 emissiveColor = sRGBTransferEOTF( emissiveColor ); 490 #endif 491 totalEmissiveRadiance *= emissiveColor.rgb; 492#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP 493 uniform sampler2D emissiveMap; 494#endif`,colorspace_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,colorspace_pars_fragment:`vec4 LinearTransferOETF( in vec4 value ) { 495 return value; 496} 497vec4 sRGBTransferEOTF( in vec4 value ) { 498 return 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 ); 499} 500vec4 sRGBTransferOETF( in vec4 value ) { 501 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 502}`,envmap_fragment:`#ifdef USE_ENVMAP 503 #ifdef ENV_WORLDPOS 504 vec3 cameraToFrag; 505 if ( isOrthographic ) { 506 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 507 } else { 508 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 509 } 510 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 511 #ifdef ENVMAP_MODE_REFLECTION 512 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 513 #else 514 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 515 #endif 516 #else 517 vec3 reflectVec = vReflect; 518 #endif 519 #ifdef ENVMAP_TYPE_CUBE 520 vec4 envColor = textureCube( envMap, envMapRotation *
520reflectVec ); 521 #ifdef ENVMAP_BLENDING_MULTIPLY 522 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 523 #elif defined( ENVMAP_BLENDING_MIX ) 524 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 525 #elif defined( ENVMAP_BLENDING_ADD ) 526 outgoingLight += envColor.xyz * specularStrength * reflectivity; 527 #endif 528 #endif 529#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP 530 uniform float envMapIntensity; 531 uniform mat3 envMapRotation; 532 #ifdef ENVMAP_TYPE_CUBE 533 uniform samplerCube envMap; 534 #else 535 uniform sampler2D envMap; 536 #endif 537#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP 538 uniform float reflectivity; 539 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 540 #define ENV_WORLDPOS 541 #endif 542 #ifdef ENV_WORLDPOS 543 varying vec3 vWorldPosition; 544 uniform float refractionRatio; 545 #else 546 varying vec3 vReflect; 547 #endif 548#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP 549 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 550 #define ENV_WORLDPOS 551 #endif 552 #ifdef ENV_WORLDPOS 553 554 varying vec3 vWorldPosition; 555 #else 556 varying vec3 vReflect; 557 uniform float refractionRatio; 558 #endif 559#endif`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP 560 vec3 getIBLIrradiance( const in vec3 normal ) { 561 #ifdef ENVMAP_TYPE_CUBE_UV 562 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 563 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 564 return PI * envMapColor.rgb * envMapIntensity; 565 #else 566 return vec3( 0.0 ); 567 #endif 568 } 569 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 570 #ifdef ENVMAP_TYPE_CUBE_UV 571 vec3 reflectVec = reflect( - viewDir, normal ); 572 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness )
vendor: 8,183 bytes, lines 572-776
572) ); 573 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 574 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 575 return envMapColor.rgb * envMapIntensity; 576 #else 577 return vec3( 0.0 ); 578 #endif 579 } 580 #ifdef USE_ANISOTROPY 581 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 582 #ifdef ENVMAP_TYPE_CUBE_UV 583 vec3 bentNormal = cross( bitangent, viewDir ); 584 bentNormal = normalize( cross( bentNormal, bitangent ) ); 585 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 586 return getIBLRadiance( viewDir, bentNormal, roughness ); 587 #else 588 return vec3( 0.0 ); 589 #endif 590 } 591 #endif 592#endif`,envmap_vertex:`#ifdef USE_ENVMAP 593 #ifdef ENV_WORLDPOS 594 vWorldPosition = worldPosition.xyz; 595 #else 596 vec3 cameraToVertex; 597 if ( isOrthographic ) { 598 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 599 } else { 600 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 601 } 602 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 603 #ifdef ENVMAP_MODE_REFLECTION 604 vReflect = reflect( cameraToVertex, worldNormal ); 605 #else 606 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 607 #endif 608 #endif 609#endif`,fog_vertex:`#ifdef USE_FOG 610 vFogDepth = - mvPosition.z; 611#endif`,fog_pars_vertex:`#ifdef USE_FOG 612 varying float vFogDepth; 613#endif`,fog_fragment:`#ifdef USE_FOG 614 #ifdef FOG_EXP2 615 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 616 #else 617 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 618 #endif 619 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 620#endif`,fog_pars_fragment:`#ifdef USE_FOG 621 uniform vec3 fogColor; 622 varying float vFogDepth; 623 #ifdef FOG_EXP2 624 uniform float fogDensity; 625 #else 626 uniform float fogNear; 627 uniform float fogFar; 628 #endif 629#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP 630 uniform sampler2D gradientMap; 631#endif 632vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 633 float dotNL = dot( normal, lightDirection ); 634 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 635 #ifdef USE_GRADIENTMAP 636 return vec3( texture2D( gradientMap, coord ).r ); 637 #else 638 vec2 fw = fwidth( coord ) * 0.5; 639 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 640 #endif 641}`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP 642 uniform sampler2D lightMap; 643 uniform float lightMapIntensity; 644#endif`,lights_lambert_fragment:`LambertMaterial material; 645material.diffuseColor = diffuseColor.rgb; 646material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; 647struct LambertMaterial { 648 vec3 diffuseColor; 649 float specularStrength; 650}; 651void 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 ) { 652 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 653 vec3 irradiance = dotNL * directLight.color; 654 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 655} 656void 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 ) { 657 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 658} 659#define RE_Direct RE_Direct_Lambert 660#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; 661uniform vec3 ambientLightColor; 662#if defined( USE_LIGHT_PROBES ) 663 uniform vec3 lightProbe[ 9 ]; 664#endif 665vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 666 float x = normal.x, y = normal.y, z = normal.z; 667 vec3 result = shCoefficients[ 0 ] * 0.886227; 668 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 669 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 670 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 671 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 672 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 673 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 674 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 675 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 676 return result; 677} 678vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 679 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 680 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 681 return irradiance; 682} 683vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 684 vec3 irradiance = ambientLightColor; 685 return irradiance; 686} 687float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 688 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 689 if ( cutoffDistance > 0.0 ) { 690 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 691 } 692 return distanceFalloff; 693} 694float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 695 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 696} 697#if NUM_DIR_LIGHTS > 0 698 struct DirectionalLight { 699 vec3 direction; 700 vec3 color; 701 }; 702 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 703 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 704 light.color = directionalLight.color; 705 light.direction = directionalLight.direction; 706 light.visible = true; 707 } 708#endif 709#if NUM_POINT_LIGHTS > 0 710 struct PointLight { 711 vec3 position; 712 vec3 color; 713 float distance; 714 float decay; 715 }; 716 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 717 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 718 vec3 lVector = pointLight.position - geometryPosition; 719 light.direction = normalize( lVector ); 720 float lightDistance = length( lVector ); 721 light.color = pointLight.color; 722 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 723 light.visible = ( light.color != vec3( 0.0 ) ); 724 } 725#endif 726#if NUM_SPOT_LIGHTS > 0 727 struct SpotLight { 728 vec3 position; 729 vec3 direction; 730 vec3 color; 731 float distance; 732 float decay; 733 float coneCos; 734 float penumbraCos; 735 }; 736 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 737 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 738 vec3 lVector = spotLight.position - geometryPosition; 739 light.direction = normalize( lVector ); 740 float angleCos = dot( light.direction, spotLight.direction ); 741 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 742 if ( spotAttenuation > 0.0 ) { 743 float lightDistance = length( lVector ); 744 light.color = spotLight.color * spotAttenuation; 745 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 746 light.visible = ( light.color != vec3( 0.0 ) ); 747 } else { 748 light.color = vec3( 0.0 ); 749 light.visible = false; 750 } 751 } 752#endif 753#if NUM_RECT_AREA_LIGHTS > 0 754 struct RectAreaLight { 755 vec3 color; 756 vec3 position; 757 vec3 halfWidth; 758 vec3 halfHeight; 759 }; 760 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 761 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 762#endif 763#if NUM_HEMI_LIGHTS > 0 764 struct HemisphereLight { 765 vec3 direction; 766 vec3 skyColor; 767 vec3 groundColor; 768 }; 769 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 770 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 771 float dotNL = dot( normal, hemiLight.direction ); 772 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 773 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 774 return irradiance; 775 } 776#endif
776 777#include <lightprobes_pars_fragment>`,lights_toon_fragment:`ToonMaterial material; 778material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; 779struct ToonMaterial { 780 vec3 diffuseColor; 781}; 782void 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 ) { 783 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 784 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 785} 786void 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 ) { 787 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 788} 789#define RE_Direct RE_Direct_Toon 790#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; 791material.diffuseColor = diffuseColor.rgb; 792material.specularColor = specular; 793material.specularShininess = shininess; 794material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; 795struct BlinnPhongMaterial { 796 vec3 diffuseColor; 797 vec3 specularColor; 798 float specularShininess; 799 float specularStrength; 800}; 801void 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 ) { 802 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 803 vec3 irradiance = dotNL * directLight.color; 804 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 805 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 806} 807void 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 ) { 808 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 809} 810#define RE_Direct RE_Direct_BlinnPhong 811#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; 812material.diffuseColor = diffuseColor.rgb; 813material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 814material.metalness = metalnessFactor; 815vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 816float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 817material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 818material.roughness = min( material.roughness, 1.0 ); 819#ifdef IOR 820 material.ior = ior; 821 #ifdef USE_SPECULAR 822 float specularIntensityFactor = specularIntensity; 823 vec3 specularColorFactor = specularColor; 824 #ifdef USE_SPECULAR_COLORMAP 825 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 826 #endif 827 #ifdef USE_SPECULAR_INTENSITYMAP 828 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 829 #endif 830 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 831 #else 832 float specularIntensityFactor = 1.0; 833 vec3 specularColorFactor = vec3( 1.0 ); 834 material.specularF90 = 1.0; 835 #endif 836 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 837 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 838#else 839 material.specularColor = vec3( 0.04 ); 840 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 841 material.specularF90 = 1.0; 842#endif 843#ifdef USE_CLEARCOAT 844 material.clearcoat = clearcoat; 845 material.clearcoatRoughness = clearcoatRoughness; 846 material.clearcoatF0 = vec3( 0.04 ); 847 material.clearcoatF90 = 1.0; 848 #ifdef USE_CLEARCOATMAP 849 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 850 #endif 851 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 852 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 853 #endif 854 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 855 material.clearcoatRoughness += geometryRoughness; 856 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 857#endif 858#ifdef USE_DISPERSION
859 material.dispersion = dispersion; 860#endif 861#ifdef USE_IRIDESCENCE 862 material.iridescence = iridescence; 863 material.iridescenceIOR = iridescenceIOR; 864 #ifdef USE_IRIDESCENCEMAP 865 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 866 #endif 867 #ifdef USE_IRIDESCENCE_THICKNESSMAP 868 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 869 #else 870 material.iridescenceThickness = iridescenceThicknessMaximum; 871 #endif 872#endif 873#ifdef USE_SHEEN 874 material.sheenColor = sheenColor; 875 #ifdef USE_SHEEN_COLORMAP 876 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 877 #endif 878 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 879 #ifdef USE_SHEEN_ROUGHNESSMAP 880 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 881 #endif 882#endif 883#ifdef USE_ANISOTROPY 884 #ifdef USE_ANISOTROPYMAP 885 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 886 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 887 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 888 #else 889 vec2 anisotropyV = anisotropyVector; 890 #endif 891 material.anisotropy = length( anisotropyV ); 892 if( material.anisotropy == 0.0 ) { 893 anisotropyV = vec2( 1.0, 0.0 ); 894 } else { 895 anisotropyV /= material.anisotropy; 896 material.anisotropy = saturate( material.anisotropy ); 897 } 898 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); 899 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 900 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 901#endif`,lights_physical_pars_fragment:`uniform sampler2D dfgLUT; 902struct PhysicalMaterial { 903 vec3 diffuseColor; 904 vec3 diffuseContribution; 905 vec3 specularColor; 906 vec3 specularColorBlended; 907 float roughness; 908 float metalness; 909 float specularF90; 910 float dispersion; 911 #ifdef USE_CLEARCOAT 912 float clearcoat; 913 float clearcoatRoughness; 914 vec3 clearcoatF0; 915 float clearcoatF90; 916 #endif 917 #ifdef USE_IRIDESCENCE 918 float iridescence; 919 float iridescenceIOR; 920 float iridescenceThickness; 921 vec3 iridescenceFresnel; 922 vec3 iridescenceF0; 923 vec3 iridescenceFresnelDielectric; 924 vec3 iridescenceFresnelMetallic; 925 #endif 926 #ifdef USE_SHEEN 927 vec3 sheenColor; 928 float sheenRoughness; 929 #endif 930 #ifdef IOR 931 float ior; 932 #endif 933 #ifdef USE_TRANSMISSION 934 float transmission; 935 float transmissionAlpha; 936 float thickness; 937 float attenuationDistance; 938 vec3 attenuationColor; 939 #endif 940 #ifdef USE_ANISOTROPY 941 float anisotropy; 942 float alphaT; 943 vec3 anisotropyT; 944 vec3 anisotropyB; 945 #endif 946}; 947vec3 clearcoatSpecularDirect = vec3( 0.0 ); 948vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 949vec3 sheenSpecularDirect = vec3( 0.0 ); 950vec3 sheenSpecularIndirect = vec3(0.0 ); 951vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 952 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 953 float x2 = x * x; 954 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 955 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 956} 957float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 958 float a2 = pow2( alpha ); 959 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 960 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 961 return 0.5 / max( gv + gl, EPSILON ); 962} 963float D_GGX( const in float alpha, const in float dotNH ) { 964 float a2 = pow2( alpha ); 965 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 966 return RECIPROCAL_PI * a2 / pow2( denom ); 967} 968#ifdef USE_ANISOTROPY 969 float 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 ) { 970 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 971 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 972 return 0.5 / max( gv + gl, EPSILON )
vendor: 3,169 bytes, lines 972-1047
972; 973 } 974 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 975 float a2 = alphaT * alphaB; 976 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 977 highp float v2 = dot( v, v ); 978 float w2 = a2 / v2; 979 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 980 } 981#endif 982#ifdef USE_CLEARCOAT 983 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 984 vec3 f0 = material.clearcoatF0; 985 float f90 = material.clearcoatF90; 986 float roughness = material.clearcoatRoughness; 987 float alpha = pow2( roughness ); 988 vec3 halfDir = normalize( lightDir + viewDir ); 989 float dotNL = saturate( dot( normal, lightDir ) ); 990 float dotNV = saturate( dot( normal, viewDir ) ); 991 float dotNH = saturate( dot( normal, halfDir ) ); 992 float dotVH = saturate( dot( viewDir, halfDir ) ); 993 vec3 F = F_Schlick( f0, f90, dotVH ); 994 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 995 float D = D_GGX( alpha, dotNH ); 996 return F * ( V * D ); 997 } 998#endif 999vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1000 vec3 f0 = material.specularColorBlended; 1001 float f90 = material.specularF90; 1002 float roughness = material.roughness; 1003 float alpha = pow2( roughness ); 1004 vec3 halfDir = normalize( lightDir + viewDir ); 1005 float dotNL = saturate( dot( normal, lightDir ) ); 1006 float dotNV = saturate( dot( normal, viewDir ) ); 1007 float dotNH = saturate( dot( normal, halfDir ) ); 1008 float dotVH = saturate( dot( viewDir, halfDir ) ); 1009 vec3 F = F_Schlick( f0, f90, dotVH ); 1010 #ifdef USE_IRIDESCENCE 1011 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1012 #endif 1013 #ifdef USE_ANISOTROPY 1014 float dotTL = dot( material.anisotropyT, lightDir ); 1015 float dotTV = dot( material.anisotropyT, viewDir ); 1016 float dotTH = dot( material.anisotropyT, halfDir ); 1017 float dotBL = dot( material.anisotropyB, lightDir ); 1018 float dotBV = dot( material.anisotropyB, viewDir ); 1019 float dotBH = dot( material.anisotropyB, halfDir ); 1020 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1021 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1022 #else 1023 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1024 float D = D_GGX( alpha, dotNH ); 1025 #endif 1026 return F * ( V * D ); 1027} 1028vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1029 const float LUT_SIZE = 64.0; 1030 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1031 const float LUT_BIAS = 0.5 / LUT_SIZE; 1032 float dotNV = saturate( dot( N, V ) ); 1033 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1034 uv = uv * LUT_SCALE + LUT_BIAS; 1035 return uv; 1036} 1037float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1038 float l = length( f ); 1039 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1040} 1041vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1042 float x = dot( v1, v2 ); 1043 float y = abs( x ); 1044 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1045 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1046 float v = a / b; 1047 float theta_sintheta = ( x >
vendor: 4,203 bytes, lines 1047-1131
1047 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1048 return cross( v1, v2 ) * theta_sintheta; 1049} 1050vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1051 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1052 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1053 vec3 lightNormal = cross( v1, v2 ); 1054 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1055 vec3 T1, T2; 1056 T1 = normalize( V - N * dot( V, N ) ); 1057 T2 = - cross( N, T1 ); 1058 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 1059 vec3 coords[ 4 ]; 1060 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1061 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1062 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1063 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1064 coords[ 0 ] = normalize( coords[ 0 ] ); 1065 coords[ 1 ] = normalize( coords[ 1 ] ); 1066 coords[ 2 ] = normalize( coords[ 2 ] ); 1067 coords[ 3 ] = normalize( coords[ 3 ] ); 1068 vec3 vectorFormFactor = vec3( 0.0 ); 1069 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1070 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1071 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1072 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1073 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1074 return vec3( result ); 1075} 1076#if defined( USE_SHEEN ) 1077float D_Charlie( float roughness, float dotNH ) { 1078 float alpha = pow2( roughness ); 1079 float invAlpha = 1.0 / alpha; 1080 float cos2h = dotNH * dotNH; 1081 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1082 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1083} 1084float V_Neubelt( float dotNV, float dotNL ) { 1085 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1086} 1087vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1088 vec3 halfDir = normalize( lightDir + viewDir ); 1089 float dotNL = saturate( dot( normal, lightDir ) ); 1090 float dotNV = saturate( dot( normal, viewDir ) ); 1091 float dotNH = saturate( dot( normal, halfDir ) ); 1092 float D = D_Charlie( sheenRoughness, dotNH ); 1093 float V = V_Neubelt( dotNV, dotNL ); 1094 return sheenColor * ( D * V ); 1095} 1096#endif 1097float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1098 float dotNV = saturate( dot( normal, viewDir ) ); 1099 float r2 = roughness * roughness; 1100 float rInv = 1.0 / ( roughness + 0.1 ); 1101 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 1102 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 1103 float DG = exp( a * dotNV + b ); 1104 return saturate( DG ); 1105} 1106vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1107 float dotNV = saturate( dot( normal, viewDir ) ); 1108 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1109 return specularColor * fab.x + specularF90 * fab.y; 1110} 1111#ifdef USE_IRIDESCENCE 1112void 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 ) { 1113#else 1114void 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 ) { 1115#endif 1116 float dotNV = saturate( dot( normal, viewDir ) ); 1117 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1118 #ifdef USE_IRIDESCENCE 1119 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1120 #else 1121 vec3 Fr = specularColor; 1122 #endif 1123 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1124 float Ess = fab.x + fab.y; 1125 float Ems = 1.0 - Ess; 1126 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1127 singleScatter += FssEss; 1128 multiScatter += Fms * Ems; 1129} 1130vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1131 vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 6,009 bytes, lines 1132-1230
1132 float dotNL = saturate( dot( normal, lightDir ) ); 1133 float dotNV = saturate( dot( normal, viewDir ) ); 1134 vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; 1135 vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; 1136 vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; 1137 vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; 1138 float Ess_V = dfgV.x + dfgV.y; 1139 float Ess_L = dfgL.x + dfgL.y; 1140 float Ems_V = 1.0 - Ess_V; 1141 float Ems_L = 1.0 - Ess_L; 1142 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; 1143 vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); 1144 float compensationFactor = Ems_V * Ems_L; 1145 vec3 multiScatter = Fms * compensationFactor; 1146 return singleScatter + multiScatter; 1147} 1148#if NUM_RECT_AREA_LIGHTS > 0 1149 void 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 ) { 1150 vec3 normal = geometryNormal; 1151 vec3 viewDir = geometryViewDir; 1152 vec3 position = geometryPosition; 1153 vec3 lightPos = rectAreaLight.position; 1154 vec3 halfWidth = rectAreaLight.halfWidth; 1155 vec3 halfHeight = rectAreaLight.halfHeight; 1156 vec3 lightColor = rectAreaLight.color; 1157 float roughness = material.roughness; 1158 vec3 rectCoords[ 4 ]; 1159 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1160 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1161 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1162 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1163 vec4 t1 = texture2D( ltc_1, uv ); 1164 vec4 t2 = texture2D( ltc_2, uv ); 1165 mat3 mInv = mat3( 1166 vec3( t1.x, 0, t1.y ), 1167 vec3( 0, 1, 0 ), 1168 vec3( t1.z, 0, t1.w ) 1169 ); 1170 vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); 1171 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1172 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1173 #ifdef USE_CLEARCOAT 1174 vec3 Ncc = geometryClearcoatNormal; 1175 vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); 1176 vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); 1177 vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); 1178 mat3 mInvClearcoat = mat3( 1179 vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), 1180 vec3( 0, 1, 0 ), 1181 vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) 1182 ); 1183 vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; 1184 clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); 1185 #endif 1186 } 1187#endif 1188void 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 ) { 1189 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1190 vec3 irradiance = dotNL * directLight.color; 1191 #ifdef USE_CLEARCOAT 1192 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1193 vec3 ccIrradiance = dotNLcc * directLight.color; 1194 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1195 #endif 1196 #ifdef USE_SHEEN 1197 1198 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1199 1200 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1201 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 1202 1203 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 1204 1205 irradiance *= sheenEnergyComp; 1206 1207 #endif 1208 reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); 1209 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); 1210} 1211void 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 ) { 1212 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); 1213 #ifdef USE_SHEEN 1214 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1215 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1216 diffuse *= sheenEnergyComp; 1217 #endif 1218 reflectedLight.indirectDiffuse += diffuse; 1219} 1220void 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) { 1221 #ifdef USE_CLEARCOAT 1222 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1223 #endif 1224 #ifdef USE_SHEEN 1225 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 1226 #endif 1227 vec3 singleScatteringDielectric = vec3( 0.0 ); 1228 vec3 multiScatteringDielectric = vec3( 0.0 ); 1229 vec3 singleScatteringMetallic = vec3( 0.0 ); 1230 vec3 multiScatteringMetallic = vec3( 0.0 );
vendor: 8,137 bytes, lines 1231-1373
1231 #ifdef USE_IRIDESCENCE 1232 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1233 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1234 #else 1235 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1236 computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1237 #endif 1238 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 1239 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 1240 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 1241 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 1242 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1243 vec3 indirectSpecular = radiance * singleScattering; 1244 indirectSpecular += multiScattering * cosineWeightedIrradiance; 1245 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 1246 #ifdef USE_SHEEN 1247 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1248 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1249 indirectSpecular *= sheenEnergyComp; 1250 indirectDiffuse *= sheenEnergyComp; 1251 #endif 1252 reflectedLight.indirectSpecular += indirectSpecular; 1253 reflectedLight.indirectDiffuse += indirectDiffuse; 1254} 1255#define RE_Direct RE_Direct_Physical 1256#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1257#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1258#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1259float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1260 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1261}`,lights_fragment_begin:` 1262vec3 geometryPosition = - vViewPosition; 1263vec3 geometryNormal = normal; 1264vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1265vec3 geometryClearcoatNormal = vec3( 0.0 ); 1266#ifdef USE_CLEARCOAT 1267 geometryClearcoatNormal = clearcoatNormal; 1268#endif 1269#ifdef USE_IRIDESCENCE 1270 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1271 if ( material.iridescenceThickness == 0.0 ) { 1272 material.iridescence = 0.0; 1273 } else { 1274 material.iridescence = saturate( material.iridescence ); 1275 } 1276 if ( material.iridescence > 0.0 ) { 1277 material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1278 material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 1279 material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); 1280 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1281 } 1282#endif 1283IncidentLight directLight; 1284#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1285 PointLight pointLight; 1286 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1287 PointLightShadow pointLightShadow; 1288 #endif 1289 #pragma unroll_loop_start 1290 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1291 pointLight = pointLights[ i ]; 1292 getPointLightInfo( pointLight, geometryPosition, directLight ); 1293 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 1294 pointLightShadow = pointLightShadows[ i ]; 1295 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1296 #endif 1297 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1298 } 1299 #pragma unroll_loop_end 1300#endif 1301#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1302 SpotLight spotLight; 1303 vec4 spotColor; 1304 vec3 spotLightCoord; 1305 bool inSpotLightMap; 1306 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1307 SpotLightShadow spotLightShadow; 1308 #endif 1309 #pragma unroll_loop_start 1310 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1311 spotLight = spotLights[ i ]; 1312 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1313 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1314 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1315 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1316 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1317 #else 1318 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1319 #endif 1320 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1321 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1322 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1323 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1324 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1325 #endif 1326 #undef SPOT_LIGHT_MAP_INDEX 1327 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1328 spotLightShadow = spotLightShadows[ i ]; 1329 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1330 #endif 1331 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1332 } 1333 #pragma unroll_loop_end 1334#endif 1335#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1336 DirectionalLight directionalLight; 1337 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1338 DirectionalLightShadow directionalLightShadow; 1339 #endif 1340 #pragma unroll_loop_start 1341 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1342 directionalLight = directionalLights[ i ]; 1343 getDirectionalLightInfo( directionalLight, directLight ); 1344 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1345 directionalLightShadow = directionalLightShadows[ i ]; 1346 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1347 #endif 1348 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1349 } 1350 #pragma unroll_loop_end 1351#endif 1352#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1353 RectAreaLight rectAreaLight; 1354 #pragma unroll_loop_start 1355 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1356 rectAreaLight = rectAreaLights[ i ]; 1357 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1358 } 1359 #pragma unroll_loop_end 1360#endif 1361#if defined( RE_IndirectDiffuse ) 1362 vec3 iblIrradiance = vec3( 0.0 ); 1363 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1364 #if defined( USE_LIGHT_PROBES ) 1365 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1366 #endif 1367 #if ( NUM_HEMI_LIGHTS > 0 ) 1368 #pragma unroll_loop_start 1369 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1370 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1371 } 1372 #pragma unroll_loop_end 1373 #endif
1374 #ifdef USE_LIGHT_PROBES_GRID 1375 vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz; 1376 vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix ); 1377 irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal ); 1378 #endif 1379#endif 1380#if defined( RE_IndirectSpecular ) 1381 vec3 radiance = vec3( 0.0 ); 1382 vec3 clearcoatRadiance = vec3( 0.0 ); 1383#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) 1384 #ifdef USE_LIGHTMAP 1385 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1386 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1387 irradiance += lightMapIrradiance; 1388 #endif 1389 #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) 1390 #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) 1391 iblIrradiance += getIBLIrradiance( geometryNormal ); 1392 #endif 1393 #endif 1394#endif 1395#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1396 #ifdef USE_ANISOTROPY 1397 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1398 #else 1399 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1400 #endif 1401 #ifdef USE_CLEARCOAT 1402 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1403 #endif 1404#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) 1405 #if defined( LAMBERT ) || defined( PHONG ) 1406 irradiance += iblIrradiance; 1407 #endif 1408 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1409#endif 1410#if defined( RE_IndirectSpecular ) 1411 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1412#endif`,lightprobes_pars_fragment:`#ifdef USE_LIGHT_PROBES_GRID 1413uniform highp sampler3D probesSH; 1414uniform vec3 probesMin; 1415uniform vec3 probesMax; 1416uniform vec3 probesResolution; 1417vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { 1418 vec3 res = probesResolution; 1419 vec3 gridRange = probesMax - probesMin; 1420 vec3 resMinusOne = res - 1.0; 1421 vec3 probeSpacing = gridRange / resMinusOne; 1422 vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5; 1423 vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 ); 1424 uvw = uvw * resMinusOne / res + 0.5 / res; 1425 float nz = res.z; 1426 float paddedSlices = nz + 2.0; 1427 float atlasDepth = 7.0 * paddedSlices; 1428 float uvZBase = uvw.z * nz + 1.0; 1429 vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) ); 1430 vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) ); 1431 vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) ); 1432 vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) ); 1433 vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) ); 1434 vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) ); 1435 vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) ); 1436 vec3 c0 = s0.xyz; 1437 vec3 c1 = vec3( s0.w, s1.xy ); 1438 vec3 c2 = vec3( s1.zw, s2.x ); 1439 vec3 c3 = s2.yzw; 1440 vec3 c4 = s3.xyz; 1441 vec3 c5 = vec3( s3.w, s4.xy ); 1442 vec3 c6 = vec3( s4.zw, s5.x ); 1443 vec3 c7 = s5.yzw; 1444 vec3 c8 = s6.xyz; 1445 float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z; 1446 vec3 result = c0 * 0.886227; 1447 result += c1 * 2.0 * 0.511664 * y; 1448 result += c2 * 2.0 * 0.511664 * z; 1449 result += c3 * 2.0 * 0.511664 * x; 1450 result += c4 * 2.0 * 0.429043 * x * y; 1451 result += c5 * 2.0 * 0.429043 * y * z; 1452 result += c6 * ( 0.743125 * z * z - 0.247708 ); 1453 result += c7 * 2.0 * 0.429043 * x * z; 1454 result += c8 * 0.429043 * ( x * x - y * y ); 1455 return max( result, vec3( 0.0 ) ); 1456} 1457#endif`,logdepthbuf_fragment:`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1458 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1459#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1460 uniform float logDepthBufFC; 1461 varying float vFragDepth; 1462 varying float vIsPerspective; 1463#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1464 varying float vFragDepth; 1465 varying float vIsPerspective; 1466#endif`,logdepthbuf_vertex:`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1467 vFragDepth = 1.0 + gl_Position.w; 1468 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1469#endif`,map_fragment:`#ifdef USE_MAP 1470 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1471 #ifdef DECODE_VIDEO_TEXTURE 1472 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1473 #endif 1474 diffuseColor *= sampledDiffuseColor; 1475#endif`,map_pars_fragment:`#ifdef USE_MAP 1476 uniform sampler2D map; 1477#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1478 #if defined( USE_POINTS_UV ) 1479 vec2 uv = vUv; 1480 #else 1481 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1482 #endif 1483#endif 1484#ifdef USE_MAP 1485 diffuseColor *= texture2D( map, uv ); 1486#endif 1487#ifdef USE_ALPHAMAP 1488 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1489#endif`,map_particle_pars_fragment:`#if defined( USE_POINTS_UV ) 1490 varying vec2 vUv; 1491#else 1492 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1493 uniform mat3 uvTransform; 1494 #endif 1495#endif 1496#ifdef USE_MAP 1497 uniform sampler2D map; 1498#endif 1499#ifdef USE_ALPHAMAP 1500 uniform sampler2D alphaMap; 1501#endif`,metalnessmap_fragment:`float metalnessFactor = metalness; 1502#ifdef USE_METALNESSMAP 1503 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1504 metalnessFactor *= texelMetalness.b; 1505#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP 1506 uniform sampler2D metalnessMap; 1507#endif`,morphinstance_vertex:`#ifdef USE_INSTANCING_MORPH 1508 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1509 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1510 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1511 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1512 } 1513#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) 1514 vColor *= morphTargetBaseInfluence; 1515 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1516 #if defined( USE_COLOR_ALPHA ) 1517 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1518 #elif defined( USE_COLOR ) 1519 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1520 #endif 1521 } 1522#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS 1523 objectNormal *= morphTargetBaseInfluence; 1524 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1525 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1526 } 1527#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS 1528 #ifndef USE_INSTANCING_MORPH 1529 uniform float morphTargetBaseInfluence; 1530 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1531 #endif 1532 uniform sampler2DArray morphTargetsTexture; 1533 uniform ivec2 morphTargetsTextureSize; 1534 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1535 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1536 int y = texelIndex / morphTargetsTextureSize.x; 1537 int x = texelIndex - y * morphTargetsTextureSize.x; 1538 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1539 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1540 } 1541#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS 1542 transformed *= morphTargetBaseInfluence; 1543 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1544 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1545 } 1546#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1547#ifdef FLAT_SHADED 1548 vec3 fdx = dFdx( vViewPosition ); 1549 vec3 fdy = dFdy( vViewPosition ); 1550 vec3 normal = normalize( cross( fdx, fdy ) ); 1551#else 1552 vec3 normal = normalize( vNormal ); 1553 #ifdef DOUBLE_SIDED 1554 normal *= faceDirection; 1555 #endif 1556#endif 1557#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1558 #ifdef USE_TANGENT 1559 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1560 #else 1561 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1562 #if defined( USE_NORMALMAP ) 1563 vNormalMapUv 1564 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1565 vClearcoatNormalMapUv 1566 #else 1567 vUv 1568 #endif 1569 ); 1570 #endif 1571 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1572 tbn[0] *= faceDirection; 1573 tbn[1] *= faceDirection; 1574 #endif 1575#endif 1576#ifdef USE_CLEARCOAT_NORMALMAP 1577 #ifdef USE_TANGENT 1578 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1579 #else 1580 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1581 #endif 1582 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1583 tbn2[0] *= faceDirection; 1584 tbn2[1] *= faceDirection; 1585 #endif 1586#endif 1587vec3 nonPerturbedNormal = normal;`,normal_fragment_maps:`#ifdef USE_NORMALMAP_OBJECTSPACE 1588 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1589 #ifdef FLIP_SIDED 1590 normal = - normal; 1591 #endif 1592 #ifdef DOUBLE_SIDED 1593 normal = normal * faceDirection; 1594 #endif 1595 normal = normalize( normalMatrix * normal ); 1596#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1597 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1598 #if defined( USE_PACKED_NORMALMAP ) 1599 mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) ); 1600 #endif
vendor: 4,891 bytes, lines 1600-1733
1600 1601 mapN.xy *= normalScale; 1602 normal = normalize( tbn * mapN ); 1603#elif defined( USE_BUMPMAP ) 1604 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1605#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED 1606 varying vec3 vNormal; 1607 #ifdef USE_TANGENT 1608 varying vec3 vTangent; 1609 varying vec3 vBitangent; 1610 #endif 1611#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED 1612 varying vec3 vNormal; 1613 #ifdef USE_TANGENT 1614 varying vec3 vTangent; 1615 varying vec3 vBitangent; 1616 #endif 1617#endif`,normal_vertex:`#ifndef FLAT_SHADED 1618 vNormal = normalize( transformedNormal ); 1619 #ifdef USE_TANGENT 1620 vTangent = normalize( transformedTangent ); 1621 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1622 #endif 1623#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP 1624 uniform sampler2D normalMap; 1625 uniform vec2 normalScale; 1626#endif 1627#ifdef USE_NORMALMAP_OBJECTSPACE 1628 uniform mat3 normalMatrix; 1629#endif 1630#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1631 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1632 vec3 q0 = dFdx( eye_pos.xyz ); 1633 vec3 q1 = dFdy( eye_pos.xyz ); 1634 vec2 st0 = dFdx( uv.st ); 1635 vec2 st1 = dFdy( uv.st ); 1636 vec3 N = surf_norm; 1637 vec3 q1perp = cross( q1, N ); 1638 vec3 q0perp = cross( N, q0 ); 1639 vec3 T = q1perp * st0.x + q0perp * st1.x; 1640 vec3 B = q1perp * st0.y + q0perp * st1.y; 1641 float det = max( dot( T, T ), dot( B, B ) ); 1642 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1643 return mat3( T * scale, B * scale, N ); 1644 } 1645#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT 1646 vec3 clearcoatNormal = nonPerturbedNormal; 1647#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP 1648 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1649 clearcoatMapN.xy *= clearcoatNormalScale; 1650 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1651#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP 1652 uniform sampler2D clearcoatMap; 1653#endif 1654#ifdef USE_CLEARCOAT_NORMALMAP 1655 uniform sampler2D clearcoatNormalMap; 1656 uniform vec2 clearcoatNormalScale; 1657#endif 1658#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1659 uniform sampler2D clearcoatRoughnessMap; 1660#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP 1661 uniform sampler2D iridescenceMap; 1662#endif 1663#ifdef USE_IRIDESCENCE_THICKNESSMAP 1664 uniform sampler2D iridescenceThicknessMap; 1665#endif`,opaque_fragment:`#ifdef OPAQUE 1666diffuseColor.a = 1.0; 1667#endif 1668#ifdef USE_TRANSMISSION 1669diffuseColor.a *= material.transmissionAlpha; 1670#endif 1671gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { 1672 return normalize( normal ) * 0.5 + 0.5; 1673} 1674vec3 unpackRGBToNormal( const in vec3 rgb ) { 1675 return 2.0 * rgb.xyz - 1.0; 1676} 1677const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1678const float Inv255 = 1. / 255.; 1679const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1680const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1681const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1682const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1683vec4 packDepthToRGBA( const in float v ) { 1684 if( v <= 0.0 ) 1685 return vec4( 0., 0., 0., 0. ); 1686 if( v >= 1.0 ) 1687 return vec4( 1., 1., 1., 1. ); 1688 float vuf; 1689 float af = modf( v * PackFactors.a, vuf ); 1690 float bf = modf( vuf * ShiftRight8, vuf ); 1691 float gf = modf( vuf * ShiftRight8, vuf ); 1692 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1693} 1694vec3 packDepthToRGB( const in float v ) { 1695 if( v <= 0.0 ) 1696 return vec3( 0., 0., 0. ); 1697 if( v >= 1.0 ) 1698 return vec3( 1., 1., 1. ); 1699 float vuf; 1700 float bf = modf( v * PackFactors.b, vuf ); 1701 float gf = modf( vuf * ShiftRight8, vuf ); 1702 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1703} 1704vec2 packDepthToRG( const in float v ) { 1705 if( v <= 0.0 ) 1706 return vec2( 0., 0. ); 1707 if( v >= 1.0 ) 1708 return vec2( 1., 1. ); 1709 float vuf; 1710 float gf = modf( v * 256., vuf ); 1711 return vec2( vuf * Inv255, gf ); 1712} 1713float unpackRGBAToDepth( const in vec4 v ) { 1714 return dot( v, UnpackFactors4 ); 1715} 1716float unpackRGBToDepth( const in vec3 v ) { 1717 return dot( v, UnpackFactors3 ); 1718} 1719float unpackRGToDepth( const in vec2 v ) { 1720 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1721} 1722vec4 pack2HalfToRGBA( const in vec2 v ) { 1723 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1724 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1725} 1726vec2 unpackRGBATo2Half( const in vec4 v ) { 1727 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1728} 1729float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1730 return ( viewZ + near ) / ( near - far ); 1731} 1732float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1733
1733#ifdef USE_REVERSED_DEPTH_BUFFER 1734 1735 return depth * ( far - near ) - far; 1736 #else 1737 return depth * ( near - far ) - near; 1738 #endif 1739} 1740float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1741 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1742} 1743float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1744 1745 #ifdef USE_REVERSED_DEPTH_BUFFER 1746 return ( near * far ) / ( ( near - far ) * depth - near ); 1747 #else 1748 return ( near * far ) / ( ( far - near ) * depth - far ); 1749 #endif 1750}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA 1751 gl_FragColor.rgb *= gl_FragColor.a; 1752#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); 1753#ifdef USE_BATCHING 1754 mvPosition = batchingMatrix * mvPosition; 1755#endif 1756#ifdef USE_INSTANCING 1757 mvPosition = instanceMatrix * mvPosition; 1758#endif 1759mvPosition = modelViewMatrix * mvPosition; 1760gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING 1761 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1762#endif`,dithering_pars_fragment:`#ifdef DITHERING 1763 vec3 dithering( vec3 color ) { 1764 float grid_position = rand( gl_FragCoord.xy ); 1765 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1766 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1767 return color + dither_shift_RGB; 1768 } 1769#endif`,roughnessmap_fragment:`float roughnessFactor = roughness; 1770#ifdef USE_ROUGHNESSMAP 1771 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1772 roughnessFactor *= texelRoughness.g; 1773#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP 1774 uniform sampler2D roughnessMap; 1775#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0 1776 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1777#endif 1778#if NUM_SPOT_LIGHT_MAPS > 0 1779 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1780#endif 1781#ifdef USE_SHADOWMAP 1782 #if NUM_DIR_LIGHT_SHADOWS > 0 1783 #if defined( SHADOWMAP_TYPE_PCF ) 1784 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1785 #else 1786 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1787 #endif 1788 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1789 struct DirectionalLightShadow { 1790 float shadowIntensity; 1791 float shadowBias; 1792 float shadowNormalBias; 1793 float shadowRadius; 1794 vec2 shadowMapSize; 1795 }; 1796 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1797 #endif 1798 #if NUM_SPOT_LIGHT_SHADOWS > 0 1799 #if defined( SHADOWMAP_TYPE_PCF ) 1800 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1801 #else 1802 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1803 #endif 1804 struct SpotLightShadow { 1805 float shadowIntensity; 1806 float shadowBias; 1807 float shadowNormalBias; 1808 float shadowRadius; 1809 vec2 shadowMapSize; 1810 }; 1811 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1812 #endif 1813 #if NUM_POINT_LIGHT_SHADOWS > 0 1814 #if defined( SHADOWMAP_TYPE_PCF ) 1815 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1816 #elif defined( SHADOWMAP_TYPE_BASIC ) 1817 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1818 #endif 1819 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1820 struct PointLightShadow { 1821 float shadowIntensity; 1822 float shadowBias; 1823 float shadowNormalBias; 1824 float shadowRadius; 1825 vec2 shadowMapSize; 1826 float shadowCameraNear; 1827 float shadowCameraFar; 1828 }; 1829 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1830 #endif 1831 #if defined( SHADOWMAP_TYPE_PCF ) 1832 float interleavedGradientNoise( vec2 position ) { 1833 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 1834 } 1835 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 1836 const float goldenAngle = 2.399963229728653; 1837 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 1838 float theta = float( sampleIndex ) * goldenAngle + phi; 1839 return vec2( cos( theta ), sin( theta ) ) * r; 1840 } 1841 #endif 1842 #if defined( SHADOWMAP_TYPE_PCF ) 1843 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1844 float shadow = 1.0; 1845 shadowCoord.xyz /= shadowCoord.w; 1846 shadowCoord.z += shadowBias; 1847 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1848 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1849 if ( frustumTest ) { 1850 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1851 float radius = shadowRadius * texelSize.x; 1852 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1853 shadow = ( 1854 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 1855 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 1856 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 1857 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 1858 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 1859 ) * 0.2; 1860 } 1861 return mix( 1.0, shadow, shadowIntensity ); 1862 } 1863 #elif defined( SHADOWMAP_TYPE_VSM ) 1864 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1865 float shadow = 1.0; 1866 shadowCoord.xyz /= shadowCoord.w; 1867 #ifdef USE_REVERSED_DEPTH_BUFFER 1868 shadowCoord.z -= shadowBias; 1869 #else 1870 shadowCoord.z += shadowBias; 1871 #endif 1872 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1873 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1874 if ( frustumTest ) { 1875 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 1876 float mean = distribution.x; 1877 float variance = distribution.y * distribution.y; 1878 #ifdef USE_REVERSED_DEPTH_BUFFER 1879 float hard_shadow = step( mean, shadowCoord.z ); 1880 #else 1881 float hard_shadow = step( shadowCoord.z, mean ); 1882 #endif 1883 1884 if ( hard_shadow == 1.0 ) { 1885 shadow = 1.0; 1886 } else { 1887 variance = max( variance, 0.0000001 ); 1888 float d = shadowCoord.z - mean; 1889 float p_max = variance / ( variance + d * d ); 1890 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 1891 shadow = max( hard_shadow, p_max ); 1892 } 1893 } 1894 return mix( 1.0, shadow, shadowIntensity ); 1895 } 1896 #else 1897 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1898 float shadow = 1.0; 1899 shadowCoord.xyz /= shadowCoord.w; 1900 #ifdef USE_REVERSED_DEPTH_BUFFER 1901 shadowCoord.z -= shadowBias; 1902 #else 1903 shadowCoord.z += shadowBias; 1904 #endif 1905 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1906 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1907 if ( frustumTest ) { 1908 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 1909 #ifdef USE_REVERSED_DEPTH_BUFFER 1910 shadow = step( depth, shadowCoord.z ); 1911 #else 1912 shadow = step( shadowCoord.z, depth ); 1913 #endif 1914 } 1915 return mix( 1.0, shadow, shadowIntensity ); 1916 } 1917 #endif 1918 #if NUM_POINT_LIGHT_SHADOWS > 0 1919 #if defined( SHADOWMAP_TYPE_PCF ) 1920 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1921 float shadow = 1.0; 1922 vec3 lightToPosition = shadowCoord.xyz; 1923 vec3 bd3D = normalize( lightToPosition ); 1924 vec3 absVec = abs( lightToPosition ); 1925 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1926 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1927 #ifdef USE_REVERSED_DEPTH_BUFFER 1928 float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1929 dp -= shadowBias; 1930 #else 1931 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1932 dp += shadowBias; 1933 #endif 1934 float texelSize = shadowRadius / shadowMapSize.x; 1935 vec3 absDir = abs( bd3D ); 1936 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 1937 tangent = normalize( cross( bd3D, tangent ) ); 1938 vec3 bitangent = cross( bd3D, tangent ); 1939 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1940 vec2 sample0 = vogelDiskSample( 0, 5, phi ); 1941 vec2 sample1 = vogelDiskSample( 1, 5, phi ); 1942 vec2 sample2 = vogelDiskSample( 2, 5, phi ); 1943 vec2 sample3 = vogelDiskSample( 3, 5, phi ); 1944 vec2 sample4 = vogelDiskSample( 4, 5, phi ); 1945 shadow = ( 1946 texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + 1947 texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + 1948 texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + 1949 texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + 1950 texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) 1951 ) * 0.2; 1952 } 1953 return mix( 1.0, shadow, shadowIntensity ); 1954 } 1955 #elif defined( SHADOWMAP_TYPE_BASIC ) 1956 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1957 float shadow = 1.0; 1958 vec3 lightToPosition = shadowCoord.xyz; 1959 vec3 absVec = abs( lightToPosition ); 1960 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1961 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1962 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1963 dp += shadowBias; 1964 vec3 bd3D = normalize( lightToPosition ); 1965 float depth = textureCube( shadowMap, bd3D ).r; 1966 #ifdef USE_REVERSED_DEPTH_BUFFER 1967 depth = 1.0 - depth; 1968 #endif 1969 shadow = step( dp, depth ); 1970 } 1971 return mix( 1.0, shadow, shadowIntensity ); 1972 } 1973 #endif 1974 #endif 1975#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 1976 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1977 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1978#endif 1979#ifdef USE_SHADOWMAP 1980 #if NUM_DIR_LIGHT_SHADOWS > 0 1981 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1982 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1983 struct DirectionalLightShadow { 1984 float shadowIntensity; 1985 float shadowBias; 1986 float shadowNormalBias; 1987 float shadowRadius; 1988 vec2 shadowMapSize; 1989 }; 1990 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1991 #endif 1992 #if NUM_SPOT_LIGHT_SHADOWS > 0 1993 struct SpotLightShadow { 1994 float shadowIntensity; 1995 float shadowBias; 1996 float shadowNormalBias; 1997 float shadowRadius; 1998 vec2 shadowMapSize; 1999 }; 2000 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 2001 #endif 2002 #if NUM_POINT_LIGHT_SHADOWS > 0 2003 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 2004 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 2005 struct PointLightShadow { 2006 float shadowIntensity; 2007 float shadowBias; 2008 float shadowNormalBias; 2009 float shadowRadius; 2010 vec2 shadowMapSize; 2011 float shadowCameraNear; 2012 float shadowCameraFar; 2013 }; 2014 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 2015 #endif 2016#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 2017 #ifdef HAS_NORMAL 2018 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 2019 #else 2020 vec3 shadowWorldNormal = vec3( 0.0 ); 2021 #endif
vendor: 15,483 bytes, lines 2021-2383
2021 2022 vec4 shadowWorldPosition; 2023#endif 2024#if defined( USE_SHADOWMAP ) 2025 #if NUM_DIR_LIGHT_SHADOWS > 0 2026 #pragma unroll_loop_start 2027 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2028 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 2029 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 2030 } 2031 #pragma unroll_loop_end 2032 #endif 2033 #if NUM_POINT_LIGHT_SHADOWS > 0 2034 #pragma unroll_loop_start 2035 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2036 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 2037 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 2038 } 2039 #pragma unroll_loop_end 2040 #endif 2041#endif 2042#if NUM_SPOT_LIGHT_COORDS > 0 2043 #pragma unroll_loop_start 2044 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 2045 shadowWorldPosition = worldPosition; 2046 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 2047 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 2048 #endif 2049 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 2050 } 2051 #pragma unroll_loop_end 2052#endif`,shadowmask_pars_fragment:`float getShadowMask() { 2053 float shadow = 1.0; 2054 #ifdef USE_SHADOWMAP 2055 #if NUM_DIR_LIGHT_SHADOWS > 0 2056 DirectionalLightShadow directionalLight; 2057 #pragma unroll_loop_start 2058 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2059 directionalLight = directionalLightShadows[ i ]; 2060 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2061 } 2062 #pragma unroll_loop_end 2063 #endif 2064 #if NUM_SPOT_LIGHT_SHADOWS > 0 2065 SpotLightShadow spotLight; 2066 #pragma unroll_loop_start 2067 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2068 spotLight = spotLightShadows[ i ]; 2069 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2070 } 2071 #pragma unroll_loop_end 2072 #endif 2073 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 2074 PointLightShadow pointLight; 2075 #pragma unroll_loop_start 2076 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2077 pointLight = pointLightShadows[ i ]; 2078 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2079 } 2080 #pragma unroll_loop_end 2081 #endif 2082 #endif 2083 return shadow; 2084}`,skinbase_vertex:`#ifdef USE_SKINNING 2085 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2086 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2087 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2088 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2089#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING 2090 uniform mat4 bindMatrix; 2091 uniform mat4 bindMatrixInverse; 2092 uniform highp sampler2D boneTexture; 2093 mat4 getBoneMatrix( const in float i ) { 2094 int size = textureSize( boneTexture, 0 ).x; 2095 int j = int( i ) * 4; 2096 int x = j % size; 2097 int y = j / size; 2098 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2099 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2100 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2101 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2102 return mat4( v1, v2, v3, v4 ); 2103 } 2104#endif`,skinning_vertex:`#ifdef USE_SKINNING 2105 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2106 vec4 skinned = vec4( 0.0 ); 2107 skinned += boneMatX * skinVertex * skinWeight.x; 2108 skinned += boneMatY * skinVertex * skinWeight.y; 2109 skinned += boneMatZ * skinVertex * skinWeight.z; 2110 skinned += boneMatW * skinVertex * skinWeight.w; 2111 transformed = ( bindMatrixInverse * skinned ).xyz; 2112#endif`,skinnormal_vertex:`#ifdef USE_SKINNING 2113 mat4 skinMatrix = mat4( 0.0 ); 2114 skinMatrix += skinWeight.x * boneMatX; 2115 skinMatrix += skinWeight.y * boneMatY; 2116 skinMatrix += skinWeight.z * boneMatZ; 2117 skinMatrix += skinWeight.w * boneMatW; 2118 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2119 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2120 #ifdef USE_TANGENT 2121 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2122 #endif 2123#endif`,specularmap_fragment:`float specularStrength; 2124#ifdef USE_SPECULARMAP 2125 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2126 specularStrength = texelSpecular.r; 2127#else 2128 specularStrength = 1.0; 2129#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP 2130 uniform sampler2D specularMap; 2131#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) 2132 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2133#endif`,tonemapping_pars_fragment:`#ifndef saturate 2134#define saturate( a ) clamp( a, 0.0, 1.0 ) 2135#endif 2136uniform float toneMappingExposure; 2137vec3 LinearToneMapping( vec3 color ) { 2138 return saturate( toneMappingExposure * color ); 2139} 2140vec3 ReinhardToneMapping( vec3 color ) { 2141 color *= toneMappingExposure; 2142 return saturate( color / ( vec3( 1.0 ) + color ) ); 2143} 2144vec3 CineonToneMapping( vec3 color ) { 2145 color *= toneMappingExposure; 2146 color = max( vec3( 0.0 ), color - 0.004 ); 2147 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2148} 2149vec3 RRTAndODTFit( vec3 v ) { 2150 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2151 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2152 return a / b; 2153} 2154vec3 ACESFilmicToneMapping( vec3 color ) { 2155 const mat3 ACESInputMat = mat3( 2156 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2157 vec3( 0.04823, 0.01566, 0.83777 ) 2158 ); 2159 const mat3 ACESOutputMat = mat3( 2160 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2161 vec3( -0.07367, -0.00605, 1.07602 ) 2162 ); 2163 color *= toneMappingExposure / 0.6; 2164 color = ACESInputMat * color; 2165 color = RRTAndODTFit( color ); 2166 color = ACESOutputMat * color; 2167 return saturate( color ); 2168} 2169const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2170 vec3( 1.6605, - 0.1246, - 0.0182 ), 2171 vec3( - 0.5876, 1.1329, - 0.1006 ), 2172 vec3( - 0.0728, - 0.0083, 1.1187 ) 2173); 2174const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2175 vec3( 0.6274, 0.0691, 0.0164 ), 2176 vec3( 0.3293, 0.9195, 0.0880 ), 2177 vec3( 0.0433, 0.0113, 0.8956 ) 2178); 2179vec3 agxDefaultContrastApprox( vec3 x ) { 2180 vec3 x2 = x * x; 2181 vec3 x4 = x2 * x2; 2182 return + 15.5 * x4 * x2 2183 - 40.14 * x4 * x 2184 + 31.96 * x4 2185 - 6.868 * x2 * x 2186 + 0.4298 * x2 2187 + 0.1191 * x 2188 - 0.00232; 2189} 2190vec3 AgXToneMapping( vec3 color ) { 2191 const mat3 AgXInsetMatrix = mat3( 2192 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2193 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2194 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2195 ); 2196 const mat3 AgXOutsetMatrix = mat3( 2197 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2198 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2199 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2200 ); 2201 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2202 color *= toneMappingExposure; 2203 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2204 color = AgXInsetMatrix * color; 2205 color = max( color, 1e-10 ); color = log2( color ); 2206 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2207 color = clamp( color, 0.0, 1.0 ); 2208 color = agxDefaultContrastApprox( color ); 2209 color = AgXOutsetMatrix * color; 2210 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2211 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2212 color = clamp( color, 0.0, 1.0 ); 2213 return color; 2214} 2215vec3 NeutralToneMapping( vec3 color ) { 2216 const float StartCompression = 0.8 - 0.04; 2217 const float Desaturation = 0.15; 2218 color *= toneMappingExposure; 2219 float x = min( color.r, min( color.g, color.b ) ); 2220 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2221 color -= offset; 2222 float peak = max( color.r, max( color.g, color.b ) ); 2223 if ( peak < StartCompression ) return color; 2224 float d = 1. - StartCompression; 2225 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2226 color *= newPeak / peak; 2227 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2228 return mix( color, vec3( newPeak ), g ); 2229} 2230vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION 2231 material.transmission = transmission; 2232 material.transmissionAlpha = 1.0; 2233 material.thickness = thickness; 2234 material.attenuationDistance = attenuationDistance; 2235 material.attenuationColor = attenuationColor; 2236 #ifdef USE_TRANSMISSIONMAP 2237 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2238 #endif 2239 #ifdef USE_THICKNESSMAP 2240 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2241 #endif 2242 vec3 pos = vWorldPosition; 2243 vec3 v = normalize( cameraPosition - pos ); 2244 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2245 vec4 transmitted = getIBLVolumeRefraction( 2246 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, 2247 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2248 material.attenuationColor, material.attenuationDistance ); 2249 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2250 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2251#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION 2252 uniform float transmission; 2253 uniform float thickness; 2254 uniform float attenuationDistance; 2255 uniform vec3 attenuationColor; 2256 #ifdef USE_TRANSMISSIONMAP 2257 uniform sampler2D transmissionMap; 2258 #endif 2259 #ifdef USE_THICKNESSMAP 2260 uniform sampler2D thicknessMap; 2261 #endif 2262 uniform vec2 transmissionSamplerSize; 2263 uniform sampler2D transmissionSamplerMap; 2264 uniform mat4 modelMatrix; 2265 uniform mat4 projectionMatrix; 2266 varying vec3 vWorldPosition; 2267 float w0( float a ) { 2268 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2269 } 2270 float w1( float a ) { 2271 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2272 } 2273 float w2( float a ){ 2274 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2275 } 2276 float w3( float a ) { 2277 return ( 1.0 / 6.0 ) * ( a * a * a ); 2278 } 2279 float g0( float a ) { 2280 return w0( a ) + w1( a ); 2281 } 2282 float g1( float a ) { 2283 return w2( a ) + w3( a ); 2284 } 2285 float h0( float a ) { 2286 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2287 } 2288 float h1( float a ) { 2289 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2290 } 2291 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2292 uv = uv * texelSize.zw + 0.5; 2293 vec2 iuv = floor( uv ); 2294 vec2 fuv = fract( uv ); 2295 float g0x = g0( fuv.x ); 2296 float g1x = g1( fuv.x ); 2297 float h0x = h0( fuv.x ); 2298 float h1x = h1( fuv.x ); 2299 float h0y = h0( fuv.y ); 2300 float h1y = h1( fuv.y ); 2301 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2302 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2303 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2304 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2305 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2306 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2307 } 2308 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2309 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2310 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2311 vec2 fLodSizeInv = 1.0 / fLodSize; 2312 vec2 cLodSizeInv = 1.0 / cLodSize; 2313 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2314 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2315 return mix( fSample, cSample, fract( lod ) ); 2316 } 2317 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2318 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2319 vec3 modelScale; 2320 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2321 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2322 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2323 return normalize( refractionVector ) * thickness * modelScale; 2324 } 2325 float applyIorToRoughness( const in float roughness, const in float ior ) { 2326 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2327 } 2328 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2329 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2330 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2331 } 2332 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2333 if ( isinf( attenuationDistance ) ) { 2334 return vec3( 1.0 ); 2335 } else { 2336 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2337 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2338 } 2339 } 2340 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2341 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2342 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2343 const in vec3 attenuationColor, const in float attenuationDistance ) { 2344 vec4 transmittedLight; 2345 vec3 transmittance; 2346 #ifdef USE_DISPERSION 2347 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2348 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2349 for ( int i = 0; i < 3; i ++ ) { 2350 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2351 vec3 refractedRayExit = position + transmissionRay; 2352 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2353 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2354 refractionCoords += 1.0; 2355 refractionCoords /= 2.0; 2356 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2357 transmittedLight[ i ] = transmissionSample[ i ]; 2358 transmittedLight.a += transmissionSample.a; 2359 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2360 } 2361 transmittedLight.a /= 3.0; 2362 #else 2363 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2364 vec3 refractedRayExit = position + transmissionRay; 2365 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2366 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2367 refractionCoords += 1.0; 2368 refractionCoords /= 2.0; 2369 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2370 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2371 #endif 2372 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2373 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2374 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2375 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2376 } 2377#endif`,uv_pars_fragment:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2378 varying vec2 vUv; 2379#endif 2380#ifdef USE_MAP 2381 varying vec2 vMapUv; 2382#endif 2383#ifdef USE_ALPHAMAP
vendor: 8,035 bytes, lines 2384-2650
2384 varying vec2 vAlphaMapUv; 2385#endif 2386#ifdef USE_LIGHTMAP 2387 varying vec2 vLightMapUv; 2388#endif 2389#ifdef USE_AOMAP 2390 varying vec2 vAoMapUv; 2391#endif 2392#ifdef USE_BUMPMAP 2393 varying vec2 vBumpMapUv; 2394#endif 2395#ifdef USE_NORMALMAP 2396 varying vec2 vNormalMapUv; 2397#endif 2398#ifdef USE_EMISSIVEMAP 2399 varying vec2 vEmissiveMapUv; 2400#endif 2401#ifdef USE_METALNESSMAP 2402 varying vec2 vMetalnessMapUv; 2403#endif 2404#ifdef USE_ROUGHNESSMAP 2405 varying vec2 vRoughnessMapUv; 2406#endif 2407#ifdef USE_ANISOTROPYMAP 2408 varying vec2 vAnisotropyMapUv; 2409#endif 2410#ifdef USE_CLEARCOATMAP 2411 varying vec2 vClearcoatMapUv; 2412#endif 2413#ifdef USE_CLEARCOAT_NORMALMAP 2414 varying vec2 vClearcoatNormalMapUv; 2415#endif 2416#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2417 varying vec2 vClearcoatRoughnessMapUv; 2418#endif 2419#ifdef USE_IRIDESCENCEMAP 2420 varying vec2 vIridescenceMapUv; 2421#endif 2422#ifdef USE_IRIDESCENCE_THICKNESSMAP 2423 varying vec2 vIridescenceThicknessMapUv; 2424#endif 2425#ifdef USE_SHEEN_COLORMAP 2426 varying vec2 vSheenColorMapUv; 2427#endif 2428#ifdef USE_SHEEN_ROUGHNESSMAP 2429 varying vec2 vSheenRoughnessMapUv; 2430#endif 2431#ifdef USE_SPECULARMAP 2432 varying vec2 vSpecularMapUv; 2433#endif 2434#ifdef USE_SPECULAR_COLORMAP 2435 varying vec2 vSpecularColorMapUv; 2436#endif 2437#ifdef USE_SPECULAR_INTENSITYMAP 2438 varying vec2 vSpecularIntensityMapUv; 2439#endif 2440#ifdef USE_TRANSMISSIONMAP 2441 uniform mat3 transmissionMapTransform; 2442 varying vec2 vTransmissionMapUv; 2443#endif 2444#ifdef USE_THICKNESSMAP 2445 uniform mat3 thicknessMapTransform; 2446 varying vec2 vThicknessMapUv; 2447#endif`,uv_pars_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2448 varying vec2 vUv; 2449#endif 2450#ifdef USE_MAP 2451 uniform mat3 mapTransform; 2452 varying vec2 vMapUv; 2453#endif 2454#ifdef USE_ALPHAMAP 2455 uniform mat3 alphaMapTransform; 2456 varying vec2 vAlphaMapUv; 2457#endif 2458#ifdef USE_LIGHTMAP 2459 uniform mat3 lightMapTransform; 2460 varying vec2 vLightMapUv; 2461#endif 2462#ifdef USE_AOMAP 2463 uniform mat3 aoMapTransform; 2464 varying vec2 vAoMapUv; 2465#endif 2466#ifdef USE_BUMPMAP 2467 uniform mat3 bumpMapTransform; 2468 varying vec2 vBumpMapUv; 2469#endif 2470#ifdef USE_NORMALMAP 2471 uniform mat3 normalMapTransform; 2472 varying vec2 vNormalMapUv; 2473#endif 2474#ifdef USE_DISPLACEMENTMAP 2475 uniform mat3 displacementMapTransform; 2476 varying vec2 vDisplacementMapUv; 2477#endif 2478#ifdef USE_EMISSIVEMAP 2479 uniform mat3 emissiveMapTransform; 2480 varying vec2 vEmissiveMapUv; 2481#endif 2482#ifdef USE_METALNESSMAP 2483 uniform mat3 metalnessMapTransform; 2484 varying vec2 vMetalnessMapUv; 2485#endif 2486#ifdef USE_ROUGHNESSMAP 2487 uniform mat3 roughnessMapTransform; 2488 varying vec2 vRoughnessMapUv; 2489#endif 2490#ifdef USE_ANISOTROPYMAP 2491 uniform mat3 anisotropyMapTransform; 2492 varying vec2 vAnisotropyMapUv; 2493#endif 2494#ifdef USE_CLEARCOATMAP 2495 uniform mat3 clearcoatMapTransform; 2496 varying vec2 vClearcoatMapUv; 2497#endif 2498#ifdef USE_CLEARCOAT_NORMALMAP 2499 uniform mat3 clearcoatNormalMapTransform; 2500 varying vec2 vClearcoatNormalMapUv; 2501#endif 2502#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2503 uniform mat3 clearcoatRoughnessMapTransform; 2504 varying vec2 vClearcoatRoughnessMapUv; 2505#endif 2506#ifdef USE_SHEEN_COLORMAP 2507 uniform mat3 sheenColorMapTransform; 2508 varying vec2 vSheenColorMapUv; 2509#endif 2510#ifdef USE_SHEEN_ROUGHNESSMAP 2511 uniform mat3 sheenRoughnessMapTransform; 2512 varying vec2 vSheenRoughnessMapUv; 2513#endif 2514#ifdef USE_IRIDESCENCEMAP 2515 uniform mat3 iridescenceMapTransform; 2516 varying vec2 vIridescenceMapUv; 2517#endif 2518#ifdef USE_IRIDESCENCE_THICKNESSMAP 2519 uniform mat3 iridescenceThicknessMapTransform; 2520 varying vec2 vIridescenceThicknessMapUv; 2521#endif 2522#ifdef USE_SPECULARMAP 2523 uniform mat3 specularMapTransform; 2524 varying vec2 vSpecularMapUv; 2525#endif 2526#ifdef USE_SPECULAR_COLORMAP 2527 uniform mat3 specularColorMapTransform; 2528 varying vec2 vSpecularColorMapUv; 2529#endif 2530#ifdef USE_SPECULAR_INTENSITYMAP 2531 uniform mat3 specularIntensityMapTransform; 2532 varying vec2 vSpecularIntensityMapUv; 2533#endif 2534#ifdef USE_TRANSMISSIONMAP 2535 uniform mat3 transmissionMapTransform; 2536 varying vec2 vTransmissionMapUv; 2537#endif 2538#ifdef USE_THICKNESSMAP 2539 uniform mat3 thicknessMapTransform; 2540 varying vec2 vThicknessMapUv; 2541#endif`,uv_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2542 vUv = vec3( uv, 1 ).xy; 2543#endif 2544#ifdef USE_MAP 2545 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2546#endif 2547#ifdef USE_ALPHAMAP 2548 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2549#endif 2550#ifdef USE_LIGHTMAP 2551 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2552#endif 2553#ifdef USE_AOMAP 2554 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2555#endif 2556#ifdef USE_BUMPMAP 2557 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2558#endif 2559#ifdef USE_NORMALMAP 2560 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2561#endif 2562#ifdef USE_DISPLACEMENTMAP 2563 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2564#endif 2565#ifdef USE_EMISSIVEMAP 2566 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2567#endif 2568#ifdef USE_METALNESSMAP 2569 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2570#endif 2571#ifdef USE_ROUGHNESSMAP 2572 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2573#endif 2574#ifdef USE_ANISOTROPYMAP 2575 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2576#endif 2577#ifdef USE_CLEARCOATMAP 2578 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2579#endif 2580#ifdef USE_CLEARCOAT_NORMALMAP 2581 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2582#endif 2583#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2584 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2585#endif 2586#ifdef USE_IRIDESCENCEMAP 2587 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2588#endif 2589#ifdef USE_IRIDESCENCE_THICKNESSMAP 2590 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2591#endif 2592#ifdef USE_SHEEN_COLORMAP 2593 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2594#endif 2595#ifdef USE_SHEEN_ROUGHNESSMAP 2596 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2597#endif 2598#ifdef USE_SPECULARMAP 2599 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2600#endif 2601#ifdef USE_SPECULAR_COLORMAP 2602 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2603#endif 2604#ifdef USE_SPECULAR_INTENSITYMAP 2605 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2606#endif 2607#ifdef USE_TRANSMISSIONMAP 2608 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2609#endif 2610#ifdef USE_THICKNESSMAP 2611 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2612#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2613 vec4 worldPosition = vec4( transformed, 1.0 ); 2614 #ifdef USE_BATCHING 2615 worldPosition = batchingMatrix * worldPosition; 2616 #endif 2617 #ifdef USE_INSTANCING 2618 worldPosition = instanceMatrix * worldPosition; 2619 #endif 2620 worldPosition = modelMatrix * worldPosition; 2621#endif`,background_vert:`varying vec2 vUv; 2622uniform mat3 uvTransform; 2623void main() { 2624 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2625 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2626}`,background_frag:`uniform sampler2D t2D; 2627uniform float backgroundIntensity; 2628varying vec2 vUv; 2629void main() { 2630 vec4 texColor = texture2D( t2D, vUv ); 2631 #ifdef DECODE_VIDEO_TEXTURE 2632 texColor = 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 ); 2633 #endif 2634 texColor.rgb *= backgroundIntensity; 2635 gl_FragColor = texColor; 2636 #include <tonemapping_fragment> 2637 #include <colorspace_fragment> 2638}`,backgroundCube_vert:`varying vec3 vWorldDirection; 2639#include <common> 2640void main() { 2641 vWorldDirection = transformDirection( position, modelMatrix ); 2642 #include <begin_vertex> 2643 #include <project_vertex> 2644 gl_Position.z = gl_Position.w; 2645}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE 2646 uniform samplerCube envMap; 2647#elif defined( ENVMAP_TYPE_CUBE_UV ) 2648 uniform sampler2D envMap; 2649#endif 2650uniform float
2650backgroundBlurriness; 2651uniform float backgroundIntensity; 2652uniform mat3 backgroundRotation; 2653varying vec3 vWorldDirection; 2654#include <cube_uv_reflection_fragment> 2655void main() { 2656 #ifdef ENVMAP_TYPE_CUBE 2657 vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection ); 2658 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2659 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2660 #else 2661 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2662 #endif 2663 texColor.rgb *= backgroundIntensity; 2664 gl_FragColor = texColor; 2665 #include <tonemapping_fragment> 2666 #include <colorspace_fragment> 2667}`,cube_vert:`varying vec3 vWorldDirection; 2668#include <common> 2669void main() { 2670 vWorldDirection = transformDirection( position, modelMatrix ); 2671 #include <begin_vertex> 2672 #include <project_vertex> 2673 gl_Position.z = gl_Position.w; 2674}`,cube_frag:`uniform samplerCube tCube; 2675uniform float tFlip; 2676uniform float opacity; 2677varying vec3 vWorldDirection; 2678void main() { 2679 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2680 gl_FragColor = texColor; 2681 gl_FragColor.a *= opacity; 2682 #include <tonemapping_fragment> 2683 #include <colorspace_fragment> 2684}`,depth_vert:`#include <common> 2685#include <batching_pars_vertex> 2686#include <uv_pars_vertex> 2687#include <displacementmap_pars_vertex> 2688#include <morphtarget_pars_vertex> 2689#include <skinning_pars_vertex> 2690#include <logdepthbuf_pars_vertex> 2691#include <clipping_planes_pars_vertex> 2692varying vec2 vHighPrecisionZW; 2693void main() { 2694 #include <uv_vertex> 2695 #include <batching_vertex> 2696 #include <skinbase_vertex> 2697 #include <morphinstance_vertex> 2698 #ifdef USE_DISPLACEMENTMAP 2699 #include <beginnormal_vertex> 2700 #include <morphnormal_vertex> 2701 #include <skinnormal_vertex> 2702 #endif 2703 #include <begin_vertex> 2704 #include <morphtarget_vertex> 2705 #include <skinning_vertex> 2706 #include <displacementmap_vertex> 2707 #include <project_vertex> 2708 #include <logdepthbuf_vertex> 2709 #include <clipping_planes_vertex> 2710 vHighPrecisionZW = gl_Position.zw; 2711}`,depth_frag:`#if DEPTH_PACKING == 3200 2712 uniform float opacity; 2713#endif 2714#include <common> 2715#include <packing> 2716#include <uv_pars_fragment> 2717#include <map_pars_fragment> 2718#include <alphamap_pars_fragment> 2719#include <alphatest_pars_fragment> 2720#include <alphahash_pars_fragment> 2721#include <logdepthbuf_pars_fragment> 2722#include <clipping_planes_pars_fragment> 2723varying vec2 vHighPrecisionZW; 2724void main() { 2725 vec4 diffuseColor = vec4( 1.0 ); 2726 #include <clipping_planes_fragment> 2727 #if DEPTH_PACKING == 3200 2728 diffuseColor.a = opacity; 2729 #endif 2730 #include <map_fragment> 2731 #include <alphamap_fragment> 2732 #include <alphatest_fragment> 2733 #include <alphahash_fragment> 2734 #include <logdepthbuf_fragment> 2735 #ifdef USE_REVERSED_DEPTH_BUFFER 2736 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2737 #else 2738 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2739 #endif 2740 #if DEPTH_PACKING == 3200 2741 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2742 #elif DEPTH_PACKING == 3201 2743 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2744 #elif DEPTH_PACKING == 3202 2745 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2746 #elif DEPTH_PACKING == 3203 2747 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2748 #endif 2749}`,distance_vert:`#define DISTANCE 2750varying vec3 vWorldPosition; 2751#include <common> 2752#include <batching_pars_vertex> 2753#include <uv_pars_vertex> 2754#include <displacementmap_pars_vertex> 2755#include <morphtarget_pars_vertex> 2756#include <skinning_pars_vertex> 2757#include <clipping_planes_pars_vertex> 2758void main() { 2759 #include <uv_vertex> 2760 #include <batching_vertex> 2761 #include <skinbase_vertex> 2762 #include <morphinstance_vertex> 2763 #ifdef USE_DISPLACEMENTMAP 2764 #include <beginnormal_vertex> 2765 #include <morphnormal_vertex> 2766 #include <skinnormal_vertex> 2767 #endif 2768 #include <begin_vertex> 2769 #include <morphtarget_vertex> 2770 #include <skinning_vertex> 2771 #include <displacementmap_vertex> 2772 #include <project_vertex> 2773 #include <worldpos_vertex> 2774 #include <clipping_planes_vertex> 2775 vWorldPosition = worldPosition.xyz; 2776}`,distance_frag:`#define DISTANCE 2777uniform vec3 referencePosition; 2778uniform float nearDistance; 2779uniform float farDistance; 2780varying vec3 vWorldPosition; 2781#include <common> 2782#include <uv_pars_fragment> 2783#include <map_pars_fragment> 2784#include <alphamap_pars_fragment> 2785#include <alphatest_pars_fragment> 2786#include <alphahash_pars_fragment> 2787#include <clipping_planes_pars_fragment> 2788void main () { 2789 vec4 diffuseColor = vec4( 1.0 ); 2790 #include <clipping_planes_fragment> 2791 #include <map_fragment> 2792 #include <alphamap_fragment> 2793 #include <alphatest_fragment> 2794 #include <alphahash_fragment> 2795 float dist = length( vWorldPosition - referencePosition ); 2796 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2797 dist = saturate( dist ); 2798 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 2799}`,equirect_vert:`varying vec3 vWorldDirection; 2800#include <common> 2801void main() { 2802 vWorldDirection = transformDirection( position, modelMatrix ); 2803 #include <begin_vertex> 2804 #include <project_vertex> 2805}`,equirect_frag:`uniform sampler2D tEquirect; 2806varying vec3 vWorldDirection; 2807#include <common> 2808void main() { 2809 vec3 direction = normalize( vWorldDirection ); 2810 vec2 sampleUV = equirectUv( direction ); 2811 gl_FragColor = texture2D( tEquirect, sampleUV ); 2812 #include <tonemapping_fragment> 2813 #include <colorspace_fragment> 2814}`,linedashed_vert:`uniform float scale; 2815attribute float lineDistance; 2816varying float vLineDistance; 2817#include <common> 2818#include <uv_pars_vertex> 2819#include <color_pars_vertex> 2820#include <fog_pars_vertex> 2821#include <morphtarget_pars_vertex> 2822#include <logdepthbuf_pars_vertex> 2823#include <clipping_planes_pars_vertex> 2824void main() { 2825 vLineDistance = scale * lineDistance; 2826 #include <uv_vertex> 2827 #include <color_vertex> 2828 #include <morphinstance_vertex> 2829 #include <morphcolor_vertex> 2830 #include <begin_vertex> 2831 #include <morphtarget_vertex> 2832 #include <project_vertex> 2833 #include <logdepthbuf_vertex> 2834 #include <clipping_planes_vertex> 2835 #include <fog_vertex> 2836}`,linedashed_frag:`uniform vec3 diffuse; 2837uniform float opacity; 2838uniform float dashSize; 2839uniform float totalSize; 2840varying float vLineDistance; 2841#include <common> 2842#include <color_pars_fragment> 2843#include <uv_pars_fragment> 2844#include <map_pars_fragment> 2845#include <fog_pars_fragment> 2846#include <logdepthbuf_pars_fragment> 2847#include <clipping_planes_pars_fragment> 2848void main() { 2849 vec4 diffuseColor = vec4( diffuse, opacity ); 2850 #include <clipping_planes_fragment> 2851 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2852 discard; 2853 } 2854 vec3 outgoingLight = vec3( 0.0 ); 2855 #include <logdepthbuf_fragment> 2856 #include <map_fragment> 2857 #include <color_fragment> 2858 outgoingLight = diffuseColor.rgb; 2859 #include <opaque_fragment> 2860 #include <tonemapping_fragment> 2861 #include <colorspace_fragment> 2862 #include <fog_fragment> 2863 #include <premultiplied_alpha_fragment> 2864}`,meshbasic_vert:`#include <common> 2865#include <batching_pars_vertex> 2866#include <uv_pars_vertex> 2867#include <envmap_pars_vertex> 2868#include <color_pars_vertex> 2869#include <fog_pars_vertex> 2870#include <morphtarget_pars_vertex> 2871#include <skinning_pars_vertex> 2872#include <logdepthbuf_pars_vertex> 2873#include <clipping_planes_pars_vertex> 2874void main() { 2875 #include <uv_vertex> 2876 #include <color_vertex> 2877 #include <morphinstance_vertex> 2878 #include <morphcolor_vertex> 2879 #include <batching_vertex> 2880 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2881 #include <beginnormal_vertex> 2882 #include <morphnormal_vertex> 2883 #include <skinbase_vertex> 2884 #include <skinnormal_vertex> 2885 #include <defaultnormal_vertex> 2886 #endif 2887 #include <begin_vertex> 2888 #include <morphtarget_vertex> 2889 #include <skinning_vertex> 2890 #include <project_vertex> 2891 #include <logdepthbuf_vertex> 2892 #include <clipping_planes_vertex> 2893 #include <worldpos_vertex> 2894 #include <envmap_vertex> 2895 #include <fog_vertex> 2896}`,meshbasic_frag:`uniform vec3 diffuse; 2897uniform float opacity; 2898#ifndef FLAT_SHADED 2899 varying vec3 vNormal; 2900#endif 2901#include <common> 2902#include <dithering_pars_fragment> 2903#include <color_pars_fragment> 2904#include <uv_pars_fragment> 2905#include <map_pars_fragment> 2906#include <alphamap_pars_fragment> 2907#include <alphatest_pars_fragment> 2908#include <alphahash_pars_fragment> 2909#include <aomap_pars_fragment> 2910#include <lightmap_pars_fragment> 2911#include <envmap_common_pars_fragment> 2912#include <envmap_pars_fragment> 2913#include <fog_pars_fragment> 2914#include <specularmap_pars_fragment> 2915#include <logdepthbuf_pars_fragment> 2916#include <clipping_planes_pars_fragment> 2917void main() { 2918 vec4 diffuseColor = vec4( diffuse, opacity ); 2919 #include <clipping_planes_fragment> 2920 #include <logdepthbuf_fragment> 2921 #include <map_fragment> 2922 #include <color_fragment> 2923 #include <alphamap_fragment> 2924 #include <alphatest_fragment> 2925 #include <alphahash_fragment> 2926 #include <specularmap_fragment> 2927 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2928 #ifdef USE_LIGHTMAP 2929 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2930 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2931 #else 2932 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2933 #endif 2934 #include <aomap_fragment> 2935 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2936 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2937 #include <envmap_fragment> 2938 #include <opaque_fragment> 2939 #include <tonemapping_fragment> 2940 #include <colorspace_fragment> 2941 #include <fog_fragment> 2942 #include <premultiplied_alpha_fragment> 2943 #include <dithering_fragment> 2944}`,meshlambert_vert:`#define LAMBERT 2945varying vec3 vViewPosition; 2946#include <common> 2947#include <batching_pars_vertex> 2948#include <uv_pars_vertex> 2949#include <displacementmap_pars_vertex> 2950#include <envmap_pars_vertex> 2951#include <color_pars_vertex> 2952#include <fog_pars_vertex> 2953#include <normal_pars_vertex> 2954#include <morphtarget_pars_vertex> 2955#include <skinning_pars_vertex> 2956#include <shadowmap_pars_vertex> 2957#include <logdepthbuf_pars_vertex> 2958#include <clipping_planes_pars_vertex> 2959void main() { 2960 #include <uv_vertex> 2961 #include <color_vertex> 2962 #include <morphinstance_vertex> 2963 #include <morphcolor_vertex> 2964 #include <batching_vertex> 2965 #include <beginnormal_vertex> 2966 #include <morphnormal_vertex> 2967 #include <skinbase_vertex> 2968 #include <skinnormal_vertex> 2969 #include <defaultnormal_vertex> 2970 #include <normal_vertex> 2971 #include <begin_vertex> 2972 #include <morphtarget_vertex> 2973 #include <skinning_vertex> 2974 #include <displacementmap_vertex> 2975 #include <project_vertex> 2976 #include <logdepthbuf_vertex> 2977 #include <clipping_planes_vertex> 2978 vViewPosition = - mvPosition.xyz; 2979 #include <worldpos_vertex> 2980 #include <envmap_vertex> 2981 #include <shadowmap_vertex> 2982 #include <fog_vertex> 2983}`,meshlambert_frag:`#define LAMBERT 2984uniform vec3 diffuse; 2985uniform vec3 emissive; 2986uniform float opacity; 2987#include <common> 2988#include <dithering_pars_fragment> 2989#include <color_pars_fragment> 2990#include <uv_pars_fragment> 2991#include <map_pars_fragment> 2992#include <alphamap_pars_fragment> 2993#include <alphatest_pars_fragment> 2994#include <alphahash_pars_fragment> 2995#include <aomap_pars_fragment> 2996#include <lightmap_pars_fragment> 2997#include <emissivemap_pars_fragment> 2998#include <cube_uv_reflection_fragment> 2999#include <envmap_common_pars_fragment> 3000#include <envmap_pars_fragment> 3001#include <envmap_physical_pars_fragment> 3002#include <fog_pars_fragment> 3003#include <bsdfs> 3004#include <lights_pars_begin> 3005#include <normal_pars_fragment> 3006#include <lights_lambert_pars_fragment> 3007#include <shadowmap_pars_fragment> 3008#include <bumpmap_pars_fragment> 3009#include <normalmap_pars_fragment> 3010#include <specularmap_pars_fragment> 3011#include <logdepthbuf_pars_fragment> 3012#include <clipping_planes_pars_fragment> 3013void main() { 3014 vec4 diffuseColor = vec4( diffuse, opacity ); 3015 #include <clipping_planes_fragment> 3016 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3017 vec3 totalEmissiveRadiance = emissive; 3018 #include <logdepthbuf_fragment> 3019 #include <map_fragment> 3020 #include <color_fragment> 3021 #include <alphamap_fragment> 3022 #include <alphatest_fragment> 3023 #include <alphahash_fragment> 3024 #include <specularmap_fragment> 3025 #include <normal_fragment_begin> 3026 #include <normal_fragment_maps> 3027 #include <emissivemap_fragment> 3028 #include <lights_lambert_fragment> 3029 #include <lights_fragment_begin> 3030 #include <lights_fragment_maps> 3031 #include <lights_fragment_end> 3032 #include <aomap_fragment> 3033 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3034 #include <envmap_fragment> 3035 #include <opaque_fragment> 3036 #include <tonemapping_fragment> 3037 #include <colorspace_fragment> 3038 #include <fog_fragment> 3039 #include <premultiplied_alpha_fragment> 3040 #include <dithering_fragment> 3041}`,meshmatcap_vert:`#define MATCAP 3042varying vec3 vViewPosition; 3043#include <common> 3044#include <batching_pars_vertex> 3045#include <uv_pars_vertex> 3046#include <color_pars_vertex> 3047#include <displacementmap_pars_vertex> 3048#include <fog_pars_vertex> 3049#include <normal_pars_vertex> 3050#include <morphtarget_pars_vertex> 3051#include <skinning_pars_vertex> 3052#include <logdepthbuf_pars_vertex> 3053#include <clipping_planes_pars_vertex> 3054void main() { 3055 #include <uv_vertex> 3056 #include <color_vertex> 3057 #include <morphinstance_vertex> 3058 #include <morphcolor_vertex> 3059 #include <batching_vertex> 3060 #include <beginnormal_vertex> 3061 #include <morphnormal_vertex> 3062 #include <skinbase_vertex> 3063 #include <skinnormal_vertex> 3064 #include <defaultnormal_vertex> 3065 #include <normal_vertex> 3066 #include <begin_vertex> 3067 #include <morphtarget_vertex> 3068 #include <skinning_vertex> 3069 #include <displacementmap_vertex> 3070 #include <project_vertex> 3071 #include <logdepthbuf_vertex> 3072 #include <clipping_planes_vertex> 3073 #include <fog_vertex> 3074 vViewPosition = - mvPosition.xyz; 3075}`,meshmatcap_frag:`#define MATCAP 3076uniform vec3 diffuse; 3077uniform float opacity; 3078uniform sampler2D matcap; 3079varying vec3 vViewPosition; 3080#include <common> 3081#include <dithering_pars_fragment> 3082#include <color_pars_fragment> 3083#include <uv_pars_fragment> 3084#include <map_pars_fragment> 3085#include <alphamap_pars_fragment> 3086#include <alphatest_pars_fragment> 3087#include <alphahash_pars_fragment> 3088#include <fog_pars_fragment> 3089#include <normal_pars_fragment> 3090#include <bumpmap_pars_fragment> 3091#include <normalmap_pars_fragment> 3092#include <logdepthbuf_pars_fragment> 3093#include <clipping_planes_pars_fragment> 3094void main() { 3095 vec4 diffuseColor = vec4( diffuse, opacity ); 3096 #include <clipping_planes_fragment> 3097 #include <logdepthbuf_fragment> 3098 #include <map_fragment> 3099 #include <color_fragment> 3100 #include <alphamap_fragment> 3101 #include <alphatest_fragment> 3102 #include <alphahash_fragment> 3103 #include <normal_fragment_begin> 3104 #include <normal_fragment_maps> 3105 vec3 viewDir = normalize( vViewPosition ); 3106 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3107 vec3 y = cross( viewDir, x ); 3108 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3109 #ifdef USE_MATCAP
3110 vec4 matcapColor = texture2D( matcap, uv ); 3111 #else 3112 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3113 #endif 3114 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3115 #include <opaque_fragment> 3116 #include <tonemapping_fragment> 3117 #include <colorspace_fragment> 3118 #include <fog_fragment> 3119 #include <premultiplied_alpha_fragment> 3120 #include <dithering_fragment> 3121}`,meshnormal_vert:`#define NORMAL 3122#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3123 varying vec3 vViewPosition; 3124#endif 3125#include <common> 3126#include <batching_pars_vertex> 3127#include <uv_pars_vertex> 3128#include <displacementmap_pars_vertex> 3129#include <normal_pars_vertex> 3130#include <morphtarget_pars_vertex> 3131#include <skinning_pars_vertex> 3132#include <logdepthbuf_pars_vertex> 3133#include <clipping_planes_pars_vertex> 3134void main() { 3135 #include <uv_vertex> 3136 #include <batching_vertex> 3137 #include <beginnormal_vertex> 3138 #include <morphinstance_vertex> 3139 #include <morphnormal_vertex> 3140 #include <skinbase_vertex> 3141 #include <skinnormal_vertex> 3142 #include <defaultnormal_vertex> 3143 #include <normal_vertex> 3144 #include <begin_vertex> 3145 #include <morphtarget_vertex> 3146 #include <skinning_vertex> 3147 #include <displacementmap_vertex> 3148 #include <project_vertex> 3149 #include <logdepthbuf_vertex> 3150 #include <clipping_planes_vertex> 3151#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3152 vViewPosition = - mvPosition.xyz; 3153#endif 3154}`,meshnormal_frag:`#define NORMAL 3155uniform float opacity; 3156#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3157 varying vec3 vViewPosition; 3158#endif 3159#include <uv_pars_fragment> 3160#include <normal_pars_fragment> 3161#include <bumpmap_pars_fragment> 3162#include <normalmap_pars_fragment> 3163#include <logdepthbuf_pars_fragment> 3164#include <clipping_planes_pars_fragment> 3165void main() { 3166 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3167 #include <clipping_planes_fragment> 3168 #include <logdepthbuf_fragment> 3169 #include <normal_fragment_begin> 3170 #include <normal_fragment_maps> 3171 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 3172 #ifdef OPAQUE 3173 gl_FragColor.a = 1.0; 3174 #endif 3175}`,meshphong_vert:`#define PHONG 3176varying vec3 vViewPosition; 3177#include <common> 3178#include <batching_pars_vertex> 3179#include <uv_pars_vertex> 3180#include <displacementmap_pars_vertex> 3181#include <envmap_pars_vertex> 3182#include <color_pars_vertex> 3183#include <fog_pars_vertex> 3184#include <normal_pars_vertex> 3185#include <morphtarget_pars_vertex> 3186#include <skinning_pars_vertex> 3187#include <shadowmap_pars_vertex> 3188#include <logdepthbuf_pars_vertex> 3189#include <clipping_planes_pars_vertex> 3190void main() { 3191 #include <uv_vertex> 3192 #include <color_vertex> 3193 #include <morphcolor_vertex> 3194 #include <batching_vertex> 3195 #include <beginnormal_vertex> 3196 #include <morphinstance_vertex> 3197 #include <morphnormal_vertex> 3198 #include <skinbase_vertex> 3199 #include <skinnormal_vertex> 3200 #include <defaultnormal_vertex> 3201 #include <normal_vertex> 3202 #include <begin_vertex> 3203 #include <morphtarget_vertex> 3204 #include <skinning_vertex> 3205 #include <displacementmap_vertex> 3206 #include <project_vertex> 3207 #include <logdepthbuf_vertex> 3208 #include <clipping_planes_vertex> 3209 vViewPosition = - mvPosition.xyz; 3210 #include <worldpos_vertex> 3211 #include <envmap_vertex> 3212 #include <shadowmap_vertex> 3213 #include <fog_vertex> 3214}`,meshphong_frag:`#define PHONG 3215uniform vec3 diffuse; 3216uniform vec3 emissive; 3217uniform vec3 specular; 3218uniform float shininess; 3219uniform float opacity; 3220#include <common> 3221#include <dithering_pars_fragment> 3222#include <color_pars_fragment> 3223#include <uv_pars_fragment> 3224#include <map_pars_fragment> 3225#include <alphamap_pars_fragment> 3226#include <alphatest_pars_fragment> 3227#include <alphahash_pars_fragment> 3228#include <aomap_pars_fragment> 3229#include <lightmap_pars_fragment> 3230#include <emissivemap_pars_fragment> 3231#include <cube_uv_reflection_fragment> 3232#include <envmap_common_pars_fragment> 3233#include <envmap_pars_fragment> 3234#include <envmap_physical_pars_fragment> 3235#include <fog_pars_fragment> 3236#include <bsdfs> 3237#include <lights_pars_begin> 3238#include <normal_pars_fragment> 3239#include <lights_phong_pars_fragment> 3240#include <shadowmap_pars_fragment> 3241#include <bumpmap_pars_fragment> 3242#include <normalmap_pars_fragment> 3243#include <specularmap_pars_fragment> 3244#include <logdepthbuf_pars_fragment> 3245#include <clipping_planes_pars_fragment> 3246void main() { 3247 vec4 diffuseColor = vec4( diffuse, opacity ); 3248 #include <clipping_planes_fragment> 3249 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3250 vec3 totalEmissiveRadiance = emissive; 3251 #include <logdepthbuf_fragment> 3252 #include <map_fragment> 3253 #include <color_fragment> 3254 #include <alphamap_fragment> 3255 #include <alphatest_fragment> 3256 #include <alphahash_fragment> 3257 #include <specularmap_fragment> 3258 #include <normal_fragment_begin> 3259 #include <normal_fragment_maps> 3260 #include <emissivemap_fragment> 3261 #include <lights_phong_fragment> 3262 #include <lights_fragment_begin> 3263 #include <lights_fragment_maps> 3264 #include <lights_fragment_end> 3265 #include <aomap_fragment> 3266 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3267 #include <envmap_fragment> 3268 #include <opaque_fragment> 3269 #include <tonemapping_fragment> 3270 #include <colorspace_fragment> 3271 #include <fog_fragment> 3272 #include <premultiplied_alpha_fragment> 3273 #include <dithering_fragment> 3274}`,meshphysical_vert:`#define STANDARD 3275varying vec3 vViewPosition; 3276#ifdef USE_TRANSMISSION 3277 varying vec3 vWorldPosition; 3278#endif 3279#include <common> 3280#include <batching_pars_vertex> 3281#include <uv_pars_vertex> 3282#include <displacementmap_pars_vertex> 3283#include <color_pars_vertex> 3284#include <fog_pars_vertex> 3285#include <normal_pars_vertex> 3286#include <morphtarget_pars_vertex> 3287#include <skinning_pars_vertex> 3288#include <shadowmap_pars_vertex> 3289#include <logdepthbuf_pars_vertex> 3290#include <clipping_planes_pars_vertex> 3291void main() { 3292 #include <uv_vertex> 3293 #include <color_vertex> 3294 #include <morphinstance_vertex> 3295 #include <morphcolor_vertex> 3296 #include <batching_vertex> 3297 #include <beginnormal_vertex> 3298 #include <morphnormal_vertex> 3299 #include <skinbase_vertex> 3300 #include <skinnormal_vertex> 3301 #include <defaultnormal_vertex> 3302 #include <normal_vertex> 3303 #include <begin_vertex> 3304 #include <morphtarget_vertex> 3305 #include <skinning_vertex> 3306 #include <displacementmap_vertex> 3307 #include <project_vertex> 3308 #include <logdepthbuf_vertex> 3309 #include <clipping_planes_vertex> 3310 vViewPosition = - mvPosition.xyz; 3311 #include <worldpos_vertex> 3312 #include <shadowmap_vertex> 3313 #include <fog_vertex> 3314#ifdef USE_TRANSMISSION 3315 vWorldPosition = worldPosition.xyz; 3316#endif 3317}`,meshphysical_frag:`#define STANDARD 3318#ifdef PHYSICAL 3319 #define IOR 3320 #define USE_SPECULAR 3321#endif 3322uniform vec3 diffuse; 3323uniform vec3 emissive; 3324uniform float roughness; 3325uniform float metalness; 3326uniform float opacity; 3327#ifdef IOR 3328 uniform float ior; 3329#endif 3330#ifdef USE_SPECULAR 3331 uniform float specularIntensity; 3332 uniform vec3 specularColor; 3333 #ifdef USE_SPECULAR_COLORMAP 3334 uniform sampler2D specularColorMap; 3335 #endif 3336 #ifdef USE_SPECULAR_INTENSITYMAP 3337 uniform sampler2D specularIntensityMap; 3338 #endif 3339#endif 3340#ifdef USE_CLEARCOAT 3341 uniform float clearcoat; 3342 uniform float clearcoatRoughness; 3343#endif 3344#ifdef USE_DISPERSION 3345 uniform float dispersion; 3346#endif
3347#ifdef USE_IRIDESCENCE 3348 uniform float iridescence; 3349 uniform float iridescenceIOR; 3350 uniform float iridescenceThicknessMinimum; 3351 uniform float iridescenceThicknessMaximum; 3352#endif 3353#ifdef USE_SHEEN 3354 uniform vec3 sheenColor; 3355 uniform float sheenRoughness; 3356 #ifdef USE_SHEEN_COLORMAP 3357 uniform sampler2D sheenColorMap; 3358 #endif 3359 #ifdef USE_SHEEN_ROUGHNESSMAP 3360 uniform sampler2D sheenRoughnessMap; 3361 #endif 3362#endif 3363#ifdef USE_ANISOTROPY 3364 uniform vec2 anisotropyVector; 3365 #ifdef USE_ANISOTROPYMAP 3366 uniform sampler2D anisotropyMap; 3367 #endif 3368#endif 3369varying vec3 vViewPosition; 3370#include <common> 3371#include <dithering_pars_fragment> 3372#include <color_pars_fragment> 3373#include <uv_pars_fragment> 3374#include <map_pars_fragment> 3375#include <alphamap_pars_fragment> 3376#include <alphatest_pars_fragment> 3377#include <alphahash_pars_fragment> 3378#include <aomap_pars_fragment> 3379#include <lightmap_pars_fragment> 3380#include <emissivemap_pars_fragment> 3381#include <iridescence_fragment> 3382#include <cube_uv_reflection_fragment> 3383#include <envmap_common_pars_fragment> 3384#include <envmap_physical_pars_fragment> 3385#include <fog_pars_fragment> 3386#include <lights_pars_begin> 3387#include <normal_pars_fragment> 3388#include <lights_physical_pars_fragment> 3389#include <transmission_pars_fragment> 3390#include <shadowmap_pars_fragment> 3391#include <bumpmap_pars_fragment> 3392#include <normalmap_pars_fragment> 3393#include <clearcoat_pars_fragment> 3394#include <iridescence_pars_fragment> 3395#include <roughnessmap_pars_fragment> 3396#include <metalnessmap_pars_fragment> 3397#include <logdepthbuf_pars_fragment> 3398#include <clipping_planes_pars_fragment> 3399void main() { 3400 vec4 diffuseColor = vec4( diffuse, opacity ); 3401 #include <clipping_planes_fragment> 3402 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3403 vec3 totalEmissiveRadiance = emissive; 3404 #include <logdepthbuf_fragment> 3405 #include <map_fragment> 3406 #include <color_fragment> 3407 #include <alphamap_fragment> 3408 #include <alphatest_fragment> 3409 #include <alphahash_fragment> 3410 #include <roughnessmap_fragment> 3411 #include <metalnessmap_fragment> 3412 #include <normal_fragment_begin> 3413 #include <normal_fragment_maps> 3414 #include <clearcoat_normal_fragment_begin> 3415 #include <clearcoat_normal_fragment_maps> 3416 #include <emissivemap_fragment> 3417 #include <lights_physical_fragment> 3418 #include <lights_fragment_begin> 3419 #include <lights_fragment_maps> 3420 #include <lights_fragment_end> 3421 #include <aomap_fragment> 3422 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3423 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3424 #include <transmission_fragment> 3425 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3426 #ifdef USE_SHEEN 3427 3428 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 3429 3430 #endif 3431 #ifdef USE_CLEARCOAT 3432 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3433 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3434 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3435 #endif 3436 #include <opaque_fragment> 3437 #include <tonemapping_fragment> 3438 #include <colorspace_fragment> 3439 #include <fog_fragment> 3440 #include <premultiplied_alpha_fragment> 3441 #include <dithering_fragment> 3442}`,meshtoon_vert:`#define TOON 3443varying vec3 vViewPosition; 3444#include <common> 3445#include <batching_pars_vertex> 3446#include <uv_pars_vertex> 3447#include <displacementmap_pars_vertex> 3448#include <color_pars_vertex> 3449#include <fog_pars_vertex> 3450#include <normal_pars_vertex> 3451#include <morphtarget_pars_vertex> 3452#include <skinning_pars_vertex> 3453#include <shadowmap_pars_vertex> 3454#include <logdepthbuf_pars_vertex> 3455#include <clipping_planes_pars_vertex> 3456void main() { 3457 #include <uv_vertex> 3458 #include <color_vertex> 3459 #include <morphinstance_vertex> 3460 #include <morphcolor_vertex> 3461 #include <batching_vertex> 3462 #include <beginnormal_vertex> 3463 #include <morphnormal_vertex> 3464 #include <skinbase_vertex> 3465 #include <skinnormal_vertex> 3466 #include <defaultnormal_vertex> 3467 #include <normal_vertex> 3468 #include <begin_vertex> 3469 #include <morphtarget_vertex> 3470 #include <skinning_vertex> 3471 #include <displacementmap_vertex> 3472 #include <project_vertex> 3473 #include <logdepthbuf_vertex> 3474 #include <clipping_planes_vertex> 3475 vViewPosition = - mvPosition.xyz; 3476 #include <worldpos_vertex> 3477 #include <shadowmap_vertex> 3478 #include <fog_vertex> 3479}`,meshtoon_frag:`#define TOON 3480uniform vec3 diffuse; 3481uniform vec3 emissive; 3482uniform float opacity; 3483#include <common> 3484#include <dithering_pars_fragment> 3485#include <color_pars_fragment> 3486#include <uv_pars_fragment> 3487#include <map_pars_fragment> 3488#include <alphamap_pars_fragment> 3489#include <alphatest_pars_fragment> 3490#include <alphahash_pars_fragment> 3491#include <aomap_pars_fragment> 3492#include <lightmap_pars_fragment> 3493#include <emissivemap_pars_fragment> 3494#include <gradientmap_pars_fragment> 3495#include <fog_pars_fragment> 3496#include <bsdfs> 3497#include <lights_pars_begin> 3498#include <normal_pars_fragment> 3499#include <lights_toon_pars_fragment> 3500#include <shadowmap_pars_fragment> 3501#include <bumpmap_pars_fragment> 3502#include <normalmap_pars_fragment> 3503#include <logdepthbuf_pars_fragment> 3504#include <clipping_planes_pars_fragment> 3505void main() { 3506 vec4 diffuseColor = vec4( diffuse, opacity ); 3507 #include <clipping_planes_fragment> 3508 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3509 vec3 totalEmissiveRadiance = emissive; 3510 #include <logdepthbuf_fragment> 3511 #include <map_fragment> 3512 #include <color_fragment> 3513 #include <alphamap_fragment> 3514 #include <alphatest_fragment> 3515 #include <alphahash_fragment> 3516 #include <normal_fragment_begin> 3517 #include <normal_fragment_maps> 3518 #include <emissivemap_fragment> 3519 #include <lights_toon_fragment> 3520 #include <lights_fragment_begin> 3521 #include <lights_fragment_maps> 3522 #include <lights_fragment_end> 3523 #include <aomap_fragment> 3524 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3525 #include <opaque_fragment> 3526 #include <tonemapping_fragment> 3527 #include <colorspace_fragment> 3528 #include <fog_fragment> 3529 #include <premultiplied_alpha_fragment> 3530 #include <dithering_fragment> 3531}`,points_vert:`uniform float size; 3532uniform float scale; 3533#include <common> 3534#include <color_pars_vertex> 3535#include <fog_pars_vertex> 3536#include <morphtarget_pars_vertex> 3537#include <logdepthbuf_pars_vertex> 3538#include <clipping_planes_pars_vertex> 3539#ifdef USE_POINTS_UV 3540 varying vec2 vUv; 3541 uniform mat3 uvTransform; 3542#endif 3543void main() { 3544 #ifdef USE_POINTS_UV 3545 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3546 #endif 3547 #include <color_vertex> 3548 #include <morphinstance_vertex> 3549 #include <morphcolor_vertex> 3550 #include <begin_vertex> 3551 #include <morphtarget_vertex> 3552 #include <project_vertex> 3553 gl_PointSize = size; 3554 #ifdef USE_SIZEATTENUATION 3555 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3556 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3557 #endif 3558 #include <logdepthbuf_vertex> 3559 #include <clipping_planes_vertex> 3560 #include <worldpos_vertex> 3561 #include <fog_vertex> 3562}`,points_frag:`uniform vec3 diffuse; 3563uniform float opacity; 3564#include <common> 3565#include <color_pars_fragment> 3566#include <map_particle_pars_fragment> 3567#include <alphatest_pars_fragment> 3568#include <alphahash_pars_fragment> 3569#include <fog_pars_fragment> 3570#include <logdepthbuf_pars_fragment> 3571#include <clipping_planes_pars_fragment> 3572void main() { 3573 vec4 diffuseColor = vec4( diffuse, opacity ); 3574 #include <clipping_planes_fragment> 3575 vec3 outgoingLight = vec3( 0.0 ); 3576 #include <logdepthbuf_fragment> 3577 #include <map_particle_fragment> 3578 #include <color_fragment> 3579 #include <alphatest_fragment> 3580 #include <alphahash_fragment> 3581 outgoingLight = diffuseColor.rgb; 3582 #include <opaque_fragment> 3583 #include <tonemapping_fragment> 3584 #include <colorspace_fragment> 3585 #include <fog_fragment> 3586 #include <premultiplied_alpha_fragment> 3587}`,shadow_vert:`#include <common> 3588#include <batching_pars_vertex> 3589#include <fog_pars_vertex> 3590#include <morphtarget_pars_vertex> 3591#include <skinning_pars_vertex> 3592#include <logdepthbuf_pars_vertex> 3593#include <shadowmap_pars_vertex> 3594void main() { 3595 #include <batching_vertex> 3596 #include <beginnormal_vertex> 3597 #include <morphinstance_vertex> 3598 #include <morphnormal_vertex> 3599 #include <skinbase_vertex> 3600 #include <skinnormal_vertex> 3601 #include <defaultnormal_vertex> 3602 #include <begin_vertex> 3603 #include <morphtarget_vertex> 3604 #include <skinning_vertex> 3605 #include <project_vertex> 3606 #include <logdepthbuf_vertex> 3607 #include <worldpos_vertex> 3608 #include <shadowmap_vertex> 3609 #include <fog_vertex> 3610}`,shadow_frag:`uniform vec3 color; 3611uniform float opacity; 3612#include <common> 3613#include <fog_pars_fragment> 3614#include <bsdfs> 3615#include <lights_pars_begin> 3616#include <logdepthbuf_pars_fragment> 3617#include <shadowmap_pars_fragment> 3618#include <shadowmask_pars_fragment> 3619void main() { 3620 #include <logdepthbuf_fragment> 3621 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3622 #include <tonemapping_fragment> 3623 #include <colorspace_fragment> 3624 #include <fog_fragment> 3625 #include <premultiplied_alpha_fragment> 3626}`,sprite_vert:`uniform float rotation; 3627uniform vec2 center; 3628#include <common> 3629#include <uv_pars_vertex> 3630#include <fog_pars_vertex> 3631#include <logdepthbuf_pars_vertex> 3632#include <clipping_planes_pars_vertex> 3633void main() { 3634 #include <uv_vertex> 3635 vec4 mvPosition = modelViewMatrix[ 3 ]; 3636 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3637 #ifndef USE_SIZEATTENUATION 3638 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3639 if ( isPerspective ) scale *= - mvPosition.z; 3640 #endif 3641 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3642 vec2 rotatedPosition; 3643 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3644 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3645 mvPosition.xy += rotatedPosition; 3646 gl_Position = projectionMatrix * mvPosition; 3647 #include <logdepthbuf_vertex> 3648 #include <clipping_planes_vertex> 3649 #include <fog_vertex> 3650}`,sprite_frag:`uniform vec3 diffuse; 3651uniform float opacity; 3652#include <common> 3653#include <uv_pars_fragment> 3654#include <map_pars_fragment> 3655#include <alphamap_pars_fragment> 3656#include <alphatest_pars_fragment> 3657#include <alphahash_pars_fragment> 3658#include <fog_pars_fragment> 3659#include <logdepthbuf_pars_fragment> 3660#include <clipping_planes_pars_fragment> 3661void main() { 3662 vec4 diffuseColor = vec4( diffuse, opacity ); 3663 #include <clipping_planes_fragment> 3664 vec3 outgoingLight = vec3( 0.0 ); 3665 #include <logdepthbuf_fragment> 3666 #include <map_fragment> 3667 #include <alphamap_fragment> 3668 #include <alphatest_fragment> 3669 #include <alphahash_fragment> 3670 outgoingLight = diffuseColor.rgb; 3671 #include <opaque_fragment> 3672 #include <tonemapping_fragment> 3673 #include <colorspace_fragment> 3674 #include <fog_fragment> 3675}`},Y={common:{diffuse:{value:new $r(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Zn},alphaMap:{value:null},alphaMapTransform:{value:new Zn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Zn}},envmap:{envMap:{value:null},envMapRotation:{value:new Zn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Zn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Zn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Zn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Zn},normalScale:{value:new U(1,1)}}
vendor: 14,298 bytes, line 3675
3675,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Zn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Zn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Zn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Zn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new $r(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new W},probesMax:{value:new W},probesResolution:{value:new W}},points:{diffuse:{value:new $r(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Zn},alphaTest:{value:0},uvTransform:{value:new Zn}},sprite:{diffuse:{value:new $r(16777215)},opacity:{value:1},center:{value:new U(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Zn},alphaMap:{value:null},alphaMapTransform:{value:new Zn},alphaTest:{value:0}}},Uc={basic:{uniforms:ss([Y.common,Y.specularmap,Y.envmap,Y.aomap,Y.lightmap,Y.fog]),vertexShader:Hc.meshbasic_vert,fragmentShader:Hc.meshbasic_frag},lambert:{uniforms:ss([Y.common,Y.specularmap,Y.envmap,Y.aomap,Y.lightmap,Y.emissivemap,Y.bumpmap,Y.normalmap,Y.displacementmap,Y.fog,Y.lights,{emissive:{value:new $r(0)},envMapIntensity:{value:1}}]),vertexShader:Hc.meshlambert_vert,fragmentShader:Hc.meshlambert_frag},phong:{uniforms:ss([Y.common,Y.specularmap,Y.envmap,Y.aomap,Y.lightmap,Y.emissivemap,Y.bumpmap,Y.normalmap,Y.displacementmap,Y.fog,Y.lights,{emissive:{value:new $r(0)},specular:{value:new $r(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Hc.meshphong_vert,fragmentShader:Hc.meshphong_frag},standard:{uniforms:ss([Y.common,Y.envmap,Y.aomap,Y.lightmap,Y.emissivemap,Y.bumpmap,Y.normalmap,Y.displacementmap,Y.roughnessmap,Y.metalnessmap,Y.fog,Y.lights,{emissive:{value:new $r(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Hc.meshphysical_vert,fragmentShader:Hc.meshphysical_frag},toon:{uniforms:ss([Y.common,Y.aomap,Y.lightmap,Y.emissivemap,Y.bumpmap,Y.normalmap,Y.displacementmap,Y.gradientmap,Y.fog,Y.lights,{emissive:{value:new $r(0)}}]),vertexShader:Hc.meshtoon_vert,fragmentShader:Hc.meshtoon_frag},matcap:{uniforms:ss([Y.common,Y.bumpmap,Y.normalmap,Y.displacementmap,Y.fog,{matcap:{value:null}}]),vertexShader:Hc.meshmatcap_vert,fragmentShader:Hc.meshmatcap_frag},points:{uniforms:ss([Y.points,Y.fog]),vertexShader:Hc.points_vert,fragmentShader:Hc.points_frag},dashed:{uniforms:ss([Y.common,Y.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Hc.linedashed_vert,fragmentShader:Hc.linedashed_frag},depth:{uniforms:ss([Y.common,Y.displacementmap]),vertexShader:Hc.depth_vert,fragmentShader:Hc.depth_frag},normal:{uniforms:ss([Y.common,Y.bumpmap,Y.normalmap,Y.displacementmap,{opacity:{value:1}}]),vertexShader:Hc.meshnormal_vert,fragmentShader:Hc.meshnormal_frag},sprite:{uniforms:ss([Y.sprite,Y.fog]),vertexShader:Hc.sprite_vert,fragmentShader:Hc.sprite_frag},background:{uniforms:{uvTransform:{value:new Zn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Hc.background_vert,fragmentShader:Hc.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Zn}},vertexShader:Hc.backgroundCube_vert,fragmentShader:Hc.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Hc.cube_vert,fragmentShader:Hc.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Hc.equirect_vert,fragmentShader:Hc.equirect_frag},distance:{uniforms:ss([Y.common,Y.displacementmap,{referencePosition:{value:new W},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Hc.distance_vert,fragmentShader:Hc.distance_frag},shadow:{uniforms:ss([Y.lights,Y.fog,{color:{value:new $r(0)},opacity:{value:1}}]),vertexShader:Hc.shadow_vert,fragmentShader:Hc.shadow_frag}};Uc.physical={uniforms:ss([Uc.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Zn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Zn},clearcoatNormalScale:{value:new U(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Zn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Zn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Zn},sheen:{value:0},sheenColor:{value:new $r(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Zn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Zn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Zn},transmissionSamplerSize:{value:new U},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Zn},attenuationDistance:{value:0},attenuationColor:{value:new $r(0)},specularColor:{value:new $r(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Zn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Zn},anisotropyVector:{value:new U},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Zn}}]),vertexShader:Hc.meshphysical_vert,fragmentShader:Hc.meshphysical_frag};var Wc={r:0,b:0,g:0},Gc=new vr,Kc=new Zn;Kc.set(-1,0,0,0,1,0,0,0,1);function qc(e,t,n,r,i,a){let o=new $r(0),s=i===!0?0:1,c,l,u=null,d=0,f=null;function p(e){let n=e.isScene===!0?e.background:null;if(n&&n.isTexture){let r=e.backgroundBlurriness>0;n=t.get(n,r)}return n}function m(t){let r=!1,i=p(t);i===null?g(o,s):i&&i.isColor&&(g(i,1),r=!0);let c=e.xr.getEnvironmentBlendMode();c===`additive`?n.buffers.color.setClear(0,0,0,1,a):c===`alpha-blend`&&n.buffers.color.setClear(0,0,0,0,a),(e.autoClear||r)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function h(t,n){let i=p(n);i&&(i.isCubeTexture||i.mapping===306)?(l===void 0&&(l=new La(new xo(1,1,1),new ms({name:`BackgroundCubeMaterial`,uniforms:os(Uc.backgroundCube.uniforms),vertexShader:Uc.backgroundCube.vertexShader,fragmentShader:Uc.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),l.geometry.deleteAttribute(`uv`),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,`envMap`,{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=i,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Gc.makeRotationFromEuler(n.backgroundRotation)).transpose(),i.isCubeTexture&&i.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(Kc),l.material.toneMapped=nr.getTransfer(i.colorSpace)!==rn,(u!==i||d!==i.version||f!==e.toneMapping)&&(l.material.needsUpdate=!0,u=i,d=i.version,f=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):i&&i.isTexture&&(c===void 0&&(c=new La(new es(2,2),new ms({name:`BackgroundMaterial`,uniforms:os(Uc.background.uniforms),vertexShader:Uc.background.vertexShader,fragmentShader:Uc.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute(`normal`),Object.defineProperty(c.material,`map`,{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=i,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.toneMapped=nr.getTransfer(i.colorSpace)!==rn,i.matrixAutoUpdate===!0&&i.updateMatrix(),c.material.uniforms.uvTransform.value.copy(i.matrix),(u!==i||d!==i.version||f!==e.toneMapping)&&(c.material.needsUpdate=!0,u=i,d=i.version,f=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null))}function g(t,r){t.getRGB(Wc,us(e)),n.buffers.color.setClear(Wc.r,Wc.g,Wc.b,r,a)}function _(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),s=t,g(o,s)},getClearAlpha:function(){return s},setClearAlpha:function(e){s=e,g(o,s)},render:m,addToRenderList:h,dispose:_}}function Jc(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(n,s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n,i){let a=i.wireframe===!0,o=r[t.id];o===void 0&&(o={},r[t.id]=o);let s=e.isInstancedMesh===!0?e.id:0,l=o[s];l===void 0&&(l={},o[s]=l);let u=l[n.id];u===void 0&&(u={},l[n.id]=u);let d=u[a];return d===void 0&&(d=f(c()),u[a]=d),d}function f(e){let t=[],r=[],i=[];for(let e=0;e<n;e++)t[e]=0,r[e]=0,i[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:i,object:e,attributes:{},index:null}}function p(e,t,n,r){let i=a.attributes,o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function g(e){_(e,0)}function _(t,n){let r=a.newAttributes,i=a.enabledAttributes,o=a.attributeDivisors;r[t]=1,i[t]===0&&(e.enableVertexAttribArray(t),i[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function v(){let t=a.newAttributes,n=a.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function y(t,n,r,i,a,o,s){s===!0?e.vertexAttribIPointer(t,n,r,a,o):e.vertexAttribPointer(t,n,r,i,a,o)}function b(n,r,i,a){h();let o=a.attributes,s=i.getAttributes(),c=r.defaultAttributeValues;for(let r in s){let i=s[r];if(i.location>=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<i.locationSize;e++)_(i.location+e,t.meshPerAttribute);n.isInstancedMesh!==!0&&a._maxInstanceCount===void 0&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<i.locationSize;e++)g(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,l);for(let e=0;e<i.locationSize;e++)y(i.location+e,o/i.locationSize,u,r,c*d,(p+o/i.locationSize*e)*d,f)}else{if(s.isInstancedBufferAttribute){for(let e=0;e<i.locationSize;e++)_(i.location+e,s.meshPerAttribute);n.isInstancedMesh!==!0&&a._maxInstanceCount===void 0&&(a._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let e=0;e<i.locationSize;e++)g(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,l);for(let e=0;e<i.locationSize;e++)y(i.location+e,o/i.locationSize,u,r,o*d,o/i.locationSize*e*d,f)}}else if(c!==void 0){let t=c[r];if(t!==void 0)switch(t.length){case 2:e.vertexAttrib2fv(i.location,t);break;case 3:e.vertexAttrib3fv(i.location,t);break;case 4:e.vertexAttrib4fv(i.location,t);break;default:e.vertexAttrib1fv(i.location,t)}}}}v()}function x(){T();for(let e in r){let t=r[e];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)u(t[e].object),delete t[e];delete n[e]}}delete r[e]}}function S(e){if(r[e.id]===void 0)return;let t=r[e.id];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)u(t[e].object),delete t[e];delete n[e]}}delete r[e.id]}function C(e){for(let t in r){let n=r[t];for(let t in n){let r=n[t];if(r[e.id]===void 0)continue;let i=r[e.id];for(let e in i)u(i[e].object),delete i[e];delete r[e.id]}}}function w(e){for(let t in r){let n=r[t],i=e.isInstancedMesh===!0?e.id:0,a=n[i];if(a!==void 0){for(let e in a){let t=a[e];for(let e in t)u(t[e].object),delete t[e];delete a[e]}delete n[i],Object.keys(n).length===0&&delete r[t]}}}function T(){E(),o=!0,a!==i&&(a=i,l(a.object))}
vendor: 7,173 bytes, line 3675
3675function E(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:s,reset:T,resetDefaultState:E,dispose:x,releaseStatesOfGeometry:S,releaseStatesOfObject:w,releaseStatesOfProgram:C,initAttributes:h,enableAttribute:g,disableUnusedAttributes:v}}function Yc(e,t,n){let r;function i(e){r=e}function a(t,i){e.drawArrays(r,t,i),n.update(i,r,1)}function o(t,i,a){a!==0&&(e.drawArraysInstanced(r,t,i,a),n.update(i,r,a))}function s(e,i,a){if(a===0)return;t.get(`WEBGL_multi_draw`).multiDrawArraysWEBGL(r,e,0,i,0,a);let o=0;for(let e=0;e<a;e++)o+=i[e];n.update(o,r,1)}this.setMode=i,this.render=a,this.renderInstances=o,this.renderMultiDraw=s}function Xc(e,t,n,r){let i;function a(){if(i!==void 0)return i;if(t.has(`EXT_texture_filter_anisotropic`)===!0){let n=t.get(`EXT_texture_filter_anisotropic`);i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(t){return!(t!==1023&&r.convert(t)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))}function s(n){let i=n===1016&&(t.has(`EXT_color_buffer_half_float`)||t.has(`EXT_color_buffer_float`));return!(n!==1009&&r.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==1015&&!i)}function c(t){if(t===`highp`){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 t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(H(`WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reversedDepthBuffer===!0&&t.has(`EXT_clip_control`);n.reversedDepthBuffer===!0&&f===!1&&H(`WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.`);let p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=e.getParameter(e.MAX_SAMPLES),S=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reversedDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,maxSamples:x,samples:S}}function Zc(e){let t=this,n=null,r=0,i=!1,a=!1,o=new Wa,s=new Zn,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length<t)&&(l=new Float32Array(t));for(let t=0,n=r;t!==a;++t,n+=4)o.copy(e[t]).applyMatrix4(i,s),o.normal.toArray(l,n),l[n+3]=o.constant}c.value=l,c.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,l}}var Qc=4,$c=[.125,.215,.35,.446,.526,.582],el=20,tl=256,nl=new ic,rl=new $r,il=null,al=0,ol=0,sl=!1,cl=new W,ll=class{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={}){let{size:a=256,position:o=cl}=i;il=this._renderer.getRenderTarget(),al=this._renderer.getActiveCubeFace(),ol=this._renderer.getActiveMipmapLevel(),sl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=gl(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=hl(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(il,al,ol),this._renderer.xr.enabled=sl,e.scissorTest=!1,fl(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===301||e.mapping===302?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),il=this._renderer.getRenderTarget(),al=this._renderer.getActiveCubeFace(),ol=this._renderer.getActiveMipmapLevel(),sl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:ze,minFilter:ze,generateMipmaps:!1,type:Je,format:nt,colorSpace:tn,depthBuffer:!1},r=dl(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=dl(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=ul(r)),this._blurMaterial=ml(r,e,t),this._ggxMaterial=pl(r,e,t)}return r}_compileMaterial(e){let t=new La(new Yi,e);this._renderer.compile(t,nl)}_sceneToCubeUV(e,t,n,r,i){let a=new rc(90,1,t,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],c=this._renderer,l=c.autoClear,u=c.toneMapping;c.getClearColor(rl),c.toneMapping=0,c.autoClear=!1,c.state.buffers.depth.getReversed()&&(c.setRenderTarget(r),c.clearDepth(),c.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new La(new xo,new Ta({name:`PMREM.Backgroun
3675d`,side:1,depthWrite:!1,depthTest:!1})));let d=this._backgroundBox,f=d.material,p=!1,m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,p=!0):(f.color.copy(rl),p=!0);for(let t=0;t<6;t++){let n=t%3;n===0?(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x+s[t],i.y,i.z)):n===1?(a.up.set(0,0,o[t]),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y+s[t],i.z)):(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y,i.z+s[t]));let l=this._cubeSize;fl(r,n*l,t>2?l:0,l,l),c.setRenderTarget(r),p&&c.render(d,a),c.render(e,a)}c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=gl()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=hl());let i=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=i;let o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;fl(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,nl)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;t<r;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,i=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;let s=a.uniforms,c=n/(this._lodMeshes.length-1),l=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-l*l)*(0+c*1.25),{_lodMax:d}=this,f=this._sizeLods[n],p=3*f*(n>d-Qc?n-d+Qc:0),m=4*(this._cubeSize-f);s.envMap.value=e.texture,s.roughness.value=u,s.mipInt.value=d-t,fl(i,p,m,3*f,2*f),r.setRenderTarget(i),r.render(o,nl),s.envMap.value=i.texture,s.roughness.value=0,s.mipInt.value=d-n,fl(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,nl)}_blur(e,t,n,r,i){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,`latitudinal`,i),this._halfBlur(a,e,n,n,r,`longitudinal`,i)}_halfBlur(e,t,n,r,i,a,o){let s=this._renderer,c=this._blurMaterial;a!==`latitudinal`&&a!==`longitudinal`&&gn(`blur direction must be either latitudinal or longitudinal!`);let l=this._lodMeshes[r];l.material=c;let u=c.uniforms,d=this._sizeLods[n]-1,f=isFinite(i)?Math.PI/(2*d):2*Math.PI/(2*el-1),p=i/f,m=isFinite(i)?1+Math.floor(3*p):el;m>el&&H(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${el}`);let h=[],g=0;for(let e=0;e<el;++e){let t=e/p,n=Math.exp(-t*t/2);h.push(n),e===0?g+=n:e<m&&(g+=2*n)}for(let e=0;e<h.length;e++)h[e]=h[e]/g;u.envMap.value=e.texture,u.samples.value=m,u.weights.value=h,u.latitudinal.value=a===`latitudinal`,o&&(u.poleAxis.value=o);let{_lodMax:_}=this;u.dTheta.value=f,u.mipInt.value=_-n;let v=this._sizeLods[r];fl(t,3*v*(r>_-Qc?r-_+Qc:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,nl)}};function ul(e){let t=[],n=[],r=[],i=e,a=e-Qc+1+$c.length;for(let o=0;o<a;o++){let a=2**i;t.push(a);let s=1/a;o>e-Qc?s=$c[o-e+Qc-1]:o===0&&(s=0),n.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let 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];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new Yi;h.setAttribute(`position`,new Pi(f,3)),h.setAttribute(`uv`,new Pi(p,2)),h.setAttribute(`faceIndex`,new Pi(m,1)),r.push(new La(h,null)),i>Qc&&i--}return{lodMeshes:r,sizeLods:t,sigmas:n}}function dl(e,t,n){let r=new hr(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function fl(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function pl(e,t,n){return new ms({name:`PMREMGGXConvolution`,defines:{GGX_SAMPLES:tl,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:_l(),fragmentShader:` 3676 3677 precision highp float; 3678 precision highp int; 3679 3680 varying vec3 vOutputDirection; 3681 3682 uniform sampler2D envMap; 3683 uniform float roughness; 3684 uniform float mipInt; 3685 3686 #define ENVMAP_TYPE_CUBE_UV 3687 #include <cube_uv_reflection_fragment> 3688 3689 #define PI 3.14159265359 3690 3691 // Van der Corput radical inverse 3692 float radicalInverse_VdC(uint bits) { 3693 bits = (bits << 16u) | (bits >> 16u); 3694 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 3695 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 3696 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 3697 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 3698 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 3699 } 3700 3701 // Hammersley sequence 3702 vec2 hammersley(uint i, uint N) { 3703 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 3704 } 3705 3706 // GGX VNDF importance sampling (Eric Heitz 2018) 3707 // "Sampling the GGX Distribution of Visible Normals" 3708 // https://jcgt.org/published/0007/04/01/ 3709 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 3710 float alpha = roughness * roughness; 3711 3712 // Section 4.1: Orthonormal basis 3713 vec3 T1 = vec3(1.0, 0.0, 0.0); 3714 vec3 T2 = cross(V, T1); 3715 3716 // Section 4.2: Parameterization of projected area 3717 float r = sqrt(Xi.x); 3718 float phi = 2.0 * PI * Xi.y; 3719 float t1 = r * cos(phi); 3720 float t2 = r * sin(phi); 3721 float s = 0.5 * (1.0 + V.z); 3722 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 3723 3724 // Section 4.3: Reprojection onto hemisphere 3725 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 3726 3727 // Section 3.4: Transform back to ellipsoid configuration 3728 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 3729 } 3730 3731 void main() { 3732 vec3 N = normalize(vOutputDirection); 3733 vec3 V = N; // Assume view direction equals normal for pre-filtering 3734 3735 vec3 prefilteredColor = vec3(0.0); 3736 float totalWeight = 0.0; 3737 3738 // For very low roughness, just sample the environment directly 3739 if (roughness < 0.001) { 3740 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 3741 return; 3742 } 3743 3744 // Tangent space basis for VNDF sampling 3745 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 3746 vec3 tangent = normalize(cross(up, N)); 3747 vec3 bitangent = cross(N, tangent); 3748
3749 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 3750 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 3751 3752 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 3753 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 3754 3755 // Transform H back to world space 3756 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 3757 vec3 L = normalize(2.0 * dot(V, H) * H - V); 3758 3759 float NdotL = max(dot(N, L), 0.0); 3760 3761 if(NdotL > 0.0) { 3762 // Sample environment at fixed mip level 3763 // VNDF importance sampling handles the distribution filtering 3764 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 3765 3766 // Weight by NdotL for the split-sum approximation 3767 // VNDF PDF naturally accounts for the visible microfacet distribution 3768 prefilteredColor += sampleColor * NdotL; 3769 totalWeight += NdotL; 3770 } 3771 } 3772 3773 if (totalWeight > 0.0) { 3774 prefilteredColor = prefilteredColor / totalWeight; 3775 } 3776 3777 gl_FragColor = vec4(prefilteredColor, 1.0); 3778 } 3779 `,blending:0,depthTest:!1,depthWrite:!1})}function ml(e,t,n){let r=new Float32Array(el),i=new W(0,1,0);return new ms({name:`SphericalGaussianBlur`,defines:{n:el,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:_l(),fragmentShader:` 3780 3781 precision mediump float; 3782 precision mediump int; 3783 3784 varying vec3 vOutputDirection; 3785 3786 uniform sampler2D envMap; 3787 uniform int samples; 3788 uniform float weights[ n ]; 3789 uniform bool latitudinal; 3790 uniform float dTheta; 3791 uniform float mipInt; 3792 uniform vec3 poleAxis; 3793 3794 #define ENVMAP_TYPE_CUBE_UV 3795 #include <cube_uv_reflection_fragment> 3796 3797 vec3 getSample( float theta, vec3 axis ) { 3798 3799 float cosTheta = cos( theta ); 3800 // Rodrigues' axis-angle rotation 3801 vec3 sampleDirection = vOutputDirection * cosTheta 3802 + cross( axis, vOutputDirection ) * sin( theta ) 3803 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3804 3805 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3806 3807 } 3808 3809 void main() { 3810 3811 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3812 3813 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3814 3815 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3816 3817 } 3818 3819 axis = normalize( axis ); 3820 3821 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3822 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3823 3824 for ( int i = 1; i < n; i++ ) { 3825 3826 if ( i >= samples ) { 3827 3828 break; 3829 3830 } 3831 3832 float theta = dTheta * float( i ); 3833 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3834 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3835 3836 } 3837 3838 } 3839 `,blending:0,depthTest:!1,depthWrite:!1})}function hl(){return new ms({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:_l(),fragmentShader:` 3840 3841 precision mediump float; 3842 precision mediump int; 3843 3844 varying vec3 vOutputDirection; 3845 3846 uniform sampler2D envMap; 3847 3848 #include <common> 3849 3850 void main() { 3851 3852 vec3 outputDirection = normalize( vOutputDirection ); 3853 vec2 uv = equirectUv( outputDirection ); 3854 3855 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3856 3857 } 3858 `,blending:0,depthTest:!1,depthWrite:!1})}function gl(){return new ms({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_l(),fragmentShader:` 3859 3860 precision mediump float; 3861 precision mediump int; 3862 3863 uniform float flipEnvMap; 3864 3865 varying vec3 vOutputDirection; 3866 3867 uniform samplerCube envMap; 3868 3869 void main() { 3870 3871 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3872 3873 } 3874 `,blending:0,depthTest:!1,depthWrite:!1})}function _l(){return` 3875 3876 precision mediump float; 3877 precision mediump int; 3878 3879 attribute float faceIndex; 3880 3881 varying vec3 vOutputDirection; 3882 3883 // RH coordinate system; PMREM face-indexing convention 3884 vec3 getDirection( vec2 uv, float face ) { 3885 3886 uv = 2.0 * uv - 1.0; 3887 3888 vec3 direction = vec3( uv, 1.0 ); 3889 3890 if ( face == 0.0 ) { 3891 3892 direction = direction.zyx; // ( 1, v, u ) pos x 3893 3894 } else if ( face == 1.0 ) { 3895 3896 direction = direction.xzy; 3897 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3898 3899 } else if ( face == 2.0 ) { 3900 3901 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3902 3903 } else if ( face == 3.0 ) { 3904 3905 direction = direction.zyx; 3906 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3907 3908 } else if ( face == 4.0 ) { 3909 3910 direction = direction.xzy; 3911 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3912 3913 } else if ( face == 5.0 ) { 3914 3915 direction.z *= -1.0; // ( u, v, -1 ) neg z 3916 3917 } 3918 3919 return direction; 3920 3921 } 3922 3923 void main() { 3924 3925 vOutputDirection = getDirection( uv, faceIndex ); 3926 gl_Position = vec4( position, 1.0 ); 3927 3928 } 3929 `}var vl=class extends hr{constructor(e=1,t={}
vendor: 25,338 bytes, lines 3929-4045
3929){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new go(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;let n={uniforms:{tEquirect:{value:null}},vertexShader:` 3930 3931 varying vec3 vWorldDirection; 3932 3933 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 3934 3935 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 3936 3937 } 3938 3939 void main() { 3940 3941 vWorldDirection = transformDirection( position, modelMatrix ); 3942 3943 #include <begin_vertex> 3944 #include <project_vertex> 3945 3946 } 3947 `,fragmentShader:` 3948 3949 uniform sampler2D tEquirect; 3950 3951 varying vec3 vWorldDirection; 3952 3953 #include <common> 3954 3955 void main() { 3956 3957 vec3 direction = normalize( vWorldDirection ); 3958 3959 vec2 sampleUV = equirectUv( direction ); 3960 3961 gl_FragColor = texture2D( tEquirect, sampleUV ); 3962 3963 } 3964 `},r=new xo(5,5,5),i=new ms({name:`CubemapFromEquirect`,uniforms:os(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new La(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=ze),new uc(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}};function yl(e){let t=new WeakMap,n=new WeakMap,r=null;function i(e,t=!1){return e==null?null:t?o(e):a(e)}function a(n){if(n&&n.isTexture){let r=n.mapping;if(r===303||r===304)if(t.has(n)){let e=t.get(n).texture;return s(e,n.mapping)}else{let r=n.image;if(r&&r.height>0){let i=new vl(r.height);return i.fromEquirectangularTexture(e,n),t.set(n,i),n.addEventListener(`dispose`,l),s(i.texture,n.mapping)}else return null}}return n}function o(t){if(t&&t.isTexture){let i=t.mapping,a=i===303||i===304,o=i===301||i===302;if(a||o){let i=n.get(t),s=i===void 0?0:i.texture.pmremVersion;if(t.isRenderTargetTexture&&t.pmremVersion!==s)return r===null&&(r=new ll(e)),i=a?r.fromEquirectangular(t,i):r.fromCubemap(t,i),i.texture.pmremVersion=t.pmremVersion,n.set(t,i),i.texture;if(i!==void 0)return i.texture;{let s=t.image;return a&&s&&s.height>0||o&&s&&c(s)?(r===null&&(r=new ll(e)),i=a?r.fromEquirectangular(t):r.fromCubemap(t),i.texture.pmremVersion=t.pmremVersion,n.set(t,i),t.addEventListener(`dispose`,u),i.texture):null}}}return t}function s(e,t){return t===303?e.mapping=301:t===304&&(e.mapping=302),e}function c(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function l(e){let n=e.target;n.removeEventListener(`dispose`,l);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function u(e){let t=e.target;t.removeEventListener(`dispose`,u);let r=n.get(t);r!==void 0&&(n.delete(t),r.dispose())}function d(){t=new WeakMap,n=new WeakMap,r!==null&&(r.dispose(),r=null)}return{get:i,dispose:d}}function bl(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r=e.getExtension(n);return t[n]=r,r}return{has:function(e){return n(e)!==null},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){let t=n(e);return t===null&&_n(`WebGLRenderer: `+e+` extension not supported.`),t}}}function xl(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(i===void 0)return;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],i=e[t+1],a=e[t+2];n.push(r,i,i,a,a,r)}}else{let e=i.array;o=i.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,i=t+2;n.push(e,r,r,i,i,e)}}let s=new(i.count>=65535?Ii:Fi)(n,1);s.version=o;let c=a.get(e);c&&t.remove(c),a.set(e,s)}function u(e){let t=a.get(e);if(t){let n=e.index;n!==null&&t.version<n.version&&l(e)}else l(e);return a.get(e)}return{get:s,update:c,getWireframeAttribute:u}}function Sl(e,t,n){let r;function i(e){r=e}let a,o;function s(e){a=e.type,o=e.bytesPerElement}function c(t,i){e.drawElements(r,i,a,t*o),n.update(i,r,1)}function l(t,i,s){s!==0&&(e.drawElementsInstanced(r,i,a,t*o,s),n.update(i,r,s))}function u(e,i,o){if(o===0)return;t.get(`WEBGL_multi_draw`).multiDrawElementsWEBGL(r,i,0,a,e,0,o);let s=0;for(let e=0;e<o;e++)s+=i[e];n.update(s,r,1)}this.setMode=i,this.setIndex=s,this.render=c,this.renderInstances=l,this.renderMultiDraw=u}function Cl(e){let t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(t,r,i){switch(n.calls++,r){case e.TRIANGLES:n.triangles+=t/3*i;break;case e.LINES:n.lines+=t/2*i;break;case e.LINE_STRIP:n.lines+=i*(t-1);break;case e.LINE_LOOP:n.lines+=i*t;break;case e.POINTS:n.points+=i*t;break;default:gn(`WebGLInfo: Unknown draw mode:`,r);break}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:i,update:r}}function wl(e,t,n){let r=new WeakMap,i=new pr;function a(a,o,s){let c=a.morphTargetInfluences,l=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=l===void 0?0:l.length,d=r.get(o);if(d===void 0||d.count!==u){d!==void 0&&d.texture.dispose();let e=o.morphAttributes.position!==void 0,n=o.morphAttributes.normal!==void 0,a=o.morphAttributes.color!==void 0,s=o.morphAttributes.position||[],c=o.morphAttributes.normal||[],l=o.morphAttributes.color||[],f=0;e===!0&&(f=1),n===!0&&(f=2),a===!0&&(f=3);let p=o.attributes.position.count*f,m=1;p>t.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new gr(h,p,m,u);g.type=qe,g.needsUpdate=!0;let _=f*4;for(let t=0;t<u;t++){let r=s[t],o=c[t],u=l[t],d=p*m*4*t;for(let t=0;t<r.count;t++){let s=t*_;e===!0&&(i.fromBufferAttribute(r,t),h[d+s+0]=i.x,h[d+s+1]=i.y,h[d+s+2]=i.z,h[d+s+3]=0),n===!0&&(i.fromBufferAttribute(o,t),h[d+s+4]=i.x,h[d+s+5]=i.y,h[d+s+6]=i.z,h[d+s+7]=0),a===!0&&(i.fromBufferAttribute(u,t),h[d+s+8]=i.x,h[d+s+9]=i.y,h[d+s+10]=i.z,h[d+s+11]=u.itemSize===4?i.w:1)}}d={count:u,texture:g,size:new U(p,m)},r.set(o,d);function v(){g.dispose(),r.delete(o),o.removeEventListener(`dispose`,v)}o.addEventListener(`dispose`,v)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)s.getUniforms().setValue(e,`morphTexture`,a.morphTexture,n);else{let t=0;for(let e=0;e<c.length;e++)t+=c[e];let n=o.morphTargetsRelative?1:1-t;s.getUniforms().setValue(e,`morphTargetBaseInfluence`,n),s.getUniforms().setValue(e,`morphTargetInfluences`,c)}s.getUniforms().setValue(e,`morphTargetsTexture`,d.texture,n),s.getUniforms().setValue(e,`morphTargetsTextureSize`,d.size)}return{update:a}}function Tl(e,t,n,r,i){let a=new WeakMap;function o(r){let o=i.render.frame,s=r.geometry,l=t.get(r,s);if(a.get(l)!==o&&(t.update(l),a.set(l,o)),r.isInstancedMesh&&(r.hasEventListener(`dispose`,c)===!1&&r.addEventListener(`dispose`,c),a.get(r)!==o&&(n.update(r.instanceMatrix,e.ARRAY_BUFFER),r.instanceColor!==null&&n.update(r.instanceColor,e.ARRAY_BUFFER),a.set(r,o))),r.isSkinnedMesh){let e=r.skeleton;a.get(e)!==o&&(e.update(),a.set(e,o))}return l}function s(){a=new WeakMap}function c(e){let t=e.target;t.removeEventListener(`dispose`,c),r.releaseStatesOfObject(t),n.remove(t.instanceMatrix),t.instanceColor!==null&&n.remove(t.instanceColor)}return{update:o,dispose:s}}var El={1:`LINEAR_TONE_MAPPING`,2:`REINHARD_TONE_MAPPING`,3:`CINEON_TONE_MAPPING`,4:`ACES_FILMIC_TONE_MAPPING`,6:`AGX_TONE_MAPPING`,7:`NEUTRAL_TONE_MAPPING`,5:`CUSTOM_TONE_MAPPING`};function Dl(e,t,n,r,i){let a=new hr(t,n,{type:e,depthBuffer:r,stencilBuffer:i,depthTexture:r?new vo(t,n):void 0}),o=new hr(t,n,{type:Je,depthBuffer:!1,stencilBuffer:!1}),s=new Yi;s.setAttribute(`position`,new Li([-1,3,0,-1,-1,0,3,-1,0],3)),s.setAttribute(`uv`,new Li([0,2,0,0,2,0],2));let c=new hs({uniforms:{tDiffuse:{value:null}},vertexShader:` 3965 precision highp float; 3966 3967 uniform mat4 modelViewMatrix; 3968 uniform mat4 projectionMatrix; 3969 3970 attribute vec3 position; 3971 attribute vec2 uv; 3972 3973 varying vec2 vUv; 3974 3975 void main() { 3976 vUv = uv; 3977 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3978 }`,fragmentShader:` 3979 precision highp float; 3980 3981 uniform sampler2D tDiffuse; 3982 3983 varying vec2 vUv; 3984 3985 #include <tonemapping_pars_fragment> 3986 #include <colorspace_pars_fragment> 3987 3988 void main() { 3989 gl_FragColor = texture2D( tDiffuse, vUv ); 3990 3991 #ifdef LINEAR_TONE_MAPPING 3992 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 3993 #elif defined( REINHARD_TONE_MAPPING ) 3994 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 3995 #elif defined( CINEON_TONE_MAPPING ) 3996 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 3997 #elif defined( ACES_FILMIC_TONE_MAPPING ) 3998 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 3999 #elif defined( AGX_TONE_MAPPING ) 4000 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 4001 #elif defined( NEUTRAL_TONE_MAPPING ) 4002 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 4003 #elif defined( CUSTOM_TONE_MAPPING ) 4004 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 4005 #endif 4006 4007 #ifdef SRGB_TRANSFER 4008 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 4009 #endif 4010 }`,depthTest:!1,depthWrite:!1}),l=new La(s,c),u=new ic(-1,1,1,-1,0,1),d=null,f=null,p=!1,m,h=null,g=[],_=!1;this.setSize=function(e,t){a.setSize(e,t),o.setSize(e,t);for(let n=0;n<g.length;n++){let r=g[n];r.setSize&&r.setSize(e,t)}},this.setEffects=function(e){g=e,_=g.length>0&&g[0].isRenderPass===!0;let t=a.width,n=a.height;for(let e=0;e<g.length;e++){let r=g[e];r.setSize&&r.setSize(t,n)}},this.begin=function(e,t){if(p||e.toneMapping===0&&g.length===0)return!1;if(h=t,t!==null){let e=t.width,n=t.height;(a.width!==e||a.height!==n)&&this.setSize(e,n)}return _===!1&&e.setRenderTarget(a),m=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return _},this.end=function(e,t){e.toneMapping=m,p=!0;let n=a,r=o;for(let i=0;i<g.length;i++){let a=g[i];if(a.enabled!==!1&&(a.render(e,r,n,t),a.needsSwap!==!1)){let e=n;n=r,r=e}}if(d!==e.outputColorSpace||f!==e.toneMapping){d=e.outputColorSpace,f=e.toneMapping,c.defines={},nr.getTransfer(d)===`srgb`&&(c.defines.SRGB_TRANSFER=``);let t=El[f];t&&(c.defines[t]=``),c.needsUpdate=!0}c.uniforms.tDiffuse.value=n.texture,e.setRenderTarget(h),e.render(l,u),h=null,p=!1},this.isCompositing=function(){return p},this.dispose=function(){a.depthTexture&&a.depthTexture.dispose(),a.dispose(),o.dispose(),s.dispose(),c.dispose()}}var Ol=new fr,kl=new vo(1,1),Al=new gr,jl=new _r,Ml=new go,Nl=[],Pl=[],Fl=new Float32Array(16),Il=new Float32Array(9),Ll=new Float32Array(4);function Rl(e,t,n){let r=e[0];if(r<=0||r>0)return e;let i=t*n,a=Nl[i];if(a===void 0&&(a=new Float32Array(i),Nl[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function zl(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 Bl(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function Vl(e,t){let n=Pl[t];n===void 0&&(n=new Int32Array(t),Pl[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Hl(e,t){let n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ul(e,t){let n=this.cache;if(t.x!==void 0)(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(zl(n,t))return;e.uniform2fv(this.addr,t),Bl(n,t)}}function Wl(e,t){let n=this.cache;if(t.x!==void 0)(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(t.r!==void 0)(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(zl(n,t))return;e.uniform3fv(this.addr,t),Bl(n,t)}}function Gl(e,t){let n=this.cache;if(t.x!==void 0)(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(zl(n,t))return;e.uniform4fv(this.addr,t),Bl(n,t)}}function Kl(e,t){let n=this.cache,r=t.elements;if(r===void 0){if(zl(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Bl(n,t)}else{if(zl(n,r))return;Ll.set(r),e.uniformMatrix2fv(this.addr,!1,Ll),Bl(n,r)}}function ql(e,t){let n=this.cache,r=t.elements;if(r===void 0){if(zl(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Bl(n,t)}else{if(zl(n,r))return;Il.set(r),e.uniformMatrix3fv(this.addr,!1,Il),Bl(n,r)}}function Jl(e,t){let n=this.cache,r=t.elements;if(r===void 0){if(zl(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Bl(n,t)}else{if(zl(n,r))return;Fl.set(r),e.uniformMatrix4fv(this.addr,!1,Fl),Bl(n,r)}}function Yl(e,t){let n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Xl(e,t){let n=this.cache;if(t.x!==void 0)(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(zl(n,t))return;e.uniform2iv(this.addr,t),Bl(n,t)}}function Zl(e,t){let n=this.cache;if(t.x!==void 0)(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(zl(n,t))return;e.uniform3iv(this.addr,t),Bl(n,t)}}function Ql(e,t){let n=this.cache;if(t.x!==void 0)(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(zl(n,t))return;e.uniform4iv(this.addr,t),Bl(n,t)}}function $l(e,t){let n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function eu(e,t){let n=this.cache;if(t.x!==void 0)(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(zl(n,t))return;e.uniform2uiv(this.addr,t),Bl(n,t)}}function tu(e,t){let n=this.cache;if(t.x!==void 0)(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(zl(n,t))return;e.uniform3uiv(this.addr,t),Bl(n,t)}}function nu(e,t){let n=this.cache;if(t.x!==void 0)(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(zl(n,t))return;e.uniform4uiv(this.addr,t),Bl(n,t)}}function ru(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i);let a;this.type===e.SAMPLER_2D_SHADOW?(kl.compareFunction=n.isReversedDepthBuffer()?518:515,a=kl):a=Ol,n.setTexture2D(t||a,i)}function iu(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||jl,i)}function au(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||Ml,i)}function ou(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||Al,i)}function su(e){switch(e){case 5126:return Hl;case 35664:return Ul;case 35665:return Wl;case 35666:return Gl;case 35674:return Kl;case 35675:return ql;case 35676:return Jl;case 5124:case 35670:return Yl;case 35667:case 35671:return Xl;case 35668:case 35672:return Zl;case 35669:case 35673:return Ql;case 5125:return $l;case 36294:return eu;case 36295:return tu;case 36296:return nu;case 35678:case 36198:case 36298:case 36306:case 35682:return ru;case 35679:case 36299:case 36307:return iu;case 35680:case 36300:case 36308:case 36293:return au;case 36289:case 36303:case 36311:case 36292:return ou}}function cu(e,t){e.uniform1fv(this.addr,t)}function lu(e,t){let n=Rl(t,this.size,2);e.uniform2fv(this.addr,n)}function uu(e,t){let n=Rl(t,this.size,3);e.uniform3fv(this.addr,n)}function du(e,t){let n=Rl(t,this.size,4);e.uniform4fv(this.addr,n)}function fu(e,t){let n=Rl(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function pu(e,t){let n=Rl(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function mu(e,t){let n=Rl(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function hu(e,t){e.uniform1iv(this.addr,t)}function gu(e,t){e.uniform2iv(this.addr,t)}function _u(e,t){e.uniform3iv(this.addr,t)}function vu(e,t){e.uniform4iv(this.addr,t)}function yu(e,t){e.uniform1uiv(this.addr,t)}function bu(e,t){e.uniform2uiv(this.addr,t)}function xu(e,t){e.uniform3uiv(this.addr,t)}function Su(e,t){e.uniform4uiv(this.addr,t)}function Cu(e,t,n){let r=this.cache,i=t.length,a=Vl(n,i);zl(r,a)||(e.uniform1iv(this.addr,a),Bl(r,a));let o;o=this.type===e.SAMPLER_2D_SHADOW?kl:Ol;for(let e=0;e!==i;++e)n.setTexture2D(t[e]||o,a[e])}function wu(e,t,n){let r=this.cache,i=t.length,a=Vl(n,i);zl(r,a)||(e.uniform1iv(this.addr,a),Bl(r,a));for(let e=0;e!==i;++e)n.setTexture3D(t[e]||jl,a[e])}function Tu(e,t,n){let r=this.cache,i=t.length,a=Vl(n,i);zl(r,a)||(e.uniform1iv(this.addr,a),Bl(r,a));for(let e=0;e!==i;++e)n.setTextureCube(t[e]||Ml,a[e])}function Eu(e,t,n){let r=this.cache,i=t.length,a=Vl(n,i);zl(r,a)||(e.uniform1iv(this.addr,a),Bl(r,a));for(let e=0;e!==i;++e)n.setTexture2DArray(t[e]||Al,a[e])}function Du(e){switch(e){case 5126:return cu;case 35664:return lu;case 35665:return uu;case 35666:return du;case 35674:return fu;case 35675:return pu;case 35676:return mu;case 5124:case 35670:return hu;case 35667:case 35671:return gu;case 35668:case 35672:return _u;case 35669:case 35673:return vu;case 5125:return yu;case 36294:return bu;case 36295:return xu;case 36296:return Su;case 35678:case 36198:case 36298:case 36306:case 35682:return Cu;case 35679:case 36299:case 36307:return wu;case 35680:case 36300:case 36308:case 36293:return Tu;case 36289:case 36303:case 36311:case 36292:return Eu}}var Ou=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=su(t.type)}},ku=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Du(t.type)}},Au=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let i=0,a=r.length;i!==a;++i){let a=r[i];a.setValue(e,t[a.id],n)}}},ju=/(\w+)(\])?(\[|\.)?/g;function Mu(e,t){e.seq.push(t),e.map[t.id]=t}function Nu(e,t,n){let r=e.name,i=r.length;for(ju.lastIndex=0;;){let a=ju.exec(r),o=ju.lastIndex,s=a[1],c=a[2]===`]`,l=a[3];if(c&&(s|=0),l===void 0||l===`[`&&o+2===i){Mu(n,l===void 0?new Ou(s,e,t):new ku(s,e,t));break}else{let e=n.map[s];e===void 0&&(e=new Au(s),Mu(n,e)),n=e}}}var Pu=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){let n=e.getActiveUniform(t,r);Nu(n,e.getUniformLocation(t,n.name),this)}let r=[],i=[];for(let t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(t):i.push(t);r.length>0&&(this.seq=r.concat(i))}setValue(e,t,n,r){let i=this.map[t];i!==void 0&&i.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let i=0,a=t.length;i!==a;++i){let a=t[i],o=n[a.id];o.needsUpdate!==!1&&a.setValue(e,o.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,i=e.length;r!==i;++r){let i=e[r];i.id in t&&n.push(i)}return n}};function Fu(e,t,n){let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}var Iu=37297,Lu=0;function Ru(e,t){let n=e.split(` 4011`),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=i;e<a;e++){let i=e+1;r.push(`${i===t?`>`:` `} ${i}: ${n[e]}`)}return r.join(` 4012`)}var zu=new Zn;function Bu(e){nr._getMatrix(zu,nr.workingColorSpace,e);let t=`mat3( ${zu.elements.map(e=>e.toFixed(4))} )`;switch(nr.getTransfer(e)){case nn:return[t,`LinearTransferOETF`];case rn:return[t,`sRGBTransferOETF`];default:return H(`WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function Vu(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||``).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` 4013 4014`+i+` 4015 4016`+Ru(e.getShaderSource(t),r)}else return i}function Hu(e,t){let n=Bu(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(` 4017`)}var Uu={1:`Linear`,2:`Reinhard`,3:`Cineon`,4:`ACESFilmic`,6:`AgX`,7:`Neutral`,5:`Custom`};function Wu(e,t){let n=Uu[t];return n===void 0?(H(`WebGLProgram: Unsupported toneMapping:`,t),`vec3 `+e+`( vec3 color ) { return LinearToneMapping( color ); }`):`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}var Gu=new W;function Ku(){return nr.getLuminanceCoefficients(Gu),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${Gu.x.toFixed(4)}, ${Gu.y.toFixed(4)}, ${Gu.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` 4018`)}function qu(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(Xu).join(` 4019`)}function Ju(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(` 4020`)}function Yu(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){let r=e.getActiveAttrib(t,i),a=r.name,o=1;r.type===e.FLOAT_MAT2&&(o=2),r.type===e.FLOAT_MAT3&&(o=3),r.type===e.FLOAT_MAT4&&(o=4),n[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:o}}return n}function Xu(e){return e!==``}function Zu(e,t){let 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 Qu(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var $u=/^[ \t]*#include +<([\w\d./]+)>/gm;function ed(e){return e.replace($u,nd)}var td=new Map;function nd(e,t){let n=Hc[t];if(n===void 0){let e=td.get(t);if(e!==void 0)n=Hc[e],H(`WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`Can not resolve #include <`+t+`>`)}return ed(n)}var rd=/#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 id(e){return e.replace(rd,ad)}function ad(e,t,n,r){let i=``;for(let e=parseInt(t);e<parseInt(n);e++)i+=r.replace(/\[\s*i\s*\]/g,`[ `+e+` ]`).replace(/UNROLLED_LOOP_INDEX/g,e);return i}function od(e){let t=`precision ${e.precision} float; 4021 precision ${e.precision} int; 4022 precision ${e.precision} sampler2D; 4023 precision ${e.precision} samplerCube; 4024 precision ${e.precision} sampler3D; 4025 precision ${e.precision} sampler2DArray; 4026 precision ${e.precision} sampler2DShadow; 4027 precision ${e.precision} samplerCubeShadow; 4028 precision ${e.precision} sampler2DArrayShadow; 4029 precision ${e.precision} isampler2D; 4030 precision ${e.precision} isampler3D; 4031 precision ${e.precision} isamplerCube; 4032 precision ${e.precision} isampler2DArray; 4033 precision ${e.precision} usampler2D; 4034 precision ${e.precision} usampler3D; 4035 precision ${e.precision} usamplerCube; 4036 precision ${e.precision} usampler2DArray; 4037 `;return e.precision===`highp`?t+=` 4038#define HIGH_PRECISION`:e.precision===`mediump`?t+=` 4039#define MEDIUM_PRECISION`:e.precision===`lowp`&&(t+=` 4040#define LOW_PRECISION`),t}var sd={1:`SHADOWMAP_TYPE_PCF`,3:`SHADOWMAP_TYPE_VSM`};function cd(e){return sd[e.shadowMapType]||`SHADOWMAP_TYPE_BASIC`}var ld={301:`ENVMAP_TYPE_CUBE`,302:`ENVMAP_TYPE_CUBE`,306:`ENVMAP_TYPE_CUBE_UV`};function ud(e){return e.envMap===!1?`ENVMAP_TYPE_CUBE`:ld[e.envMapMode]||`ENVMAP_TYPE_CUBE`}var dd={302:`ENVMAP_MODE_REFRACTION`};function fd(e){return e.envMap===!1?`ENVMAP_MODE_REFLECTION`:dd[e.envMapMode]||`ENVMAP_MODE_REFLECTION`}var pd={0:`ENVMAP_BLENDING_MULTIPLY`,1:`ENVMAP_BLENDING_MIX`,2:`ENVMAP_BLENDING_ADD`};function md(e){return e.envMap===!1?`ENVMAP_BLENDING_NONE`:pd[e.combine]||`ENVMAP_BLENDING_NONE`}function hd(e){let t=e.envMapCubeUVHeight;if(t===null)return null;let n=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(2**n,112)),texelHeight:r,maxMip:n}}function gd(e,t,n,r){let i=e.getContext(),a=n.defines,o=n.vertexShader,s=n.fragmentShader,c=cd(n),l=ud(n),u=fd(n),d=md(n),f=hd(n),p=qu(n),m=Ju(a),h=i.createProgram(),g,_,v=n.glslVersion?`#version `+n.glslVersion+` 4041`:``;n.isRawShaderMaterial?(g=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(Xu).join(` 4042`),g.length>0&&(g+=` 4043`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(Xu).join(` 4044`),_.length>0&&(_+=` 4045`)):(g=[od(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionCl
vendor: 5,561 bytes, lines 4045-4047
4045ipCullDistance?`#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&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexNormals?`#define HAS_NORMAL`:``,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&&n.flatShading===!1?`#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 `+c:``,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`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` 4046`].filter(Xu).join(` 4047`),_=[od(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,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.matc
vendor: 21,551 bytes, lines 4047-4061
4047ap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.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.packedNormalMap?`#define USE_PACKED_NORMALMAP`:``,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&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor?`#define USE_COLOR`:``,n.vertexAlphas||n.batchingColor?`#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 `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.numLightProbeGrids>0?`#define USE_LIGHT_PROBES_GRID`:``,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;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:Hc.tonemapping_pars_fragment,n.toneMapping===0?``:Wu(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,Hc.colorspace_pars_fragment,Hu(`linearToOutputTexel`,n.outputColorSpace),Ku(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` 4048`].filter(Xu).join(` 4049`)),o=ed(o),o=Zu(o,n),o=Qu(o,n),s=ed(s),s=Zu(s,n),s=Qu(s,n),o=id(o),s=id(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es 4050`,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` 4051`)+` 4052`+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#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(` 4053`)+` 4054`+_);let y=v+g+o,b=v+_+s,x=Fu(i,i.VERTEX_SHADER,y),S=Fu(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.morphTargets===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h)||``,r=i.getShaderInfoLog(x)||``,a=i.getShaderInfoLog(S)||``,o=n.trim(),s=r.trim(),c=a.trim(),l=!0,u=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1)if(l=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=Vu(i,x,`vertex`),n=Vu(i,S,`fragment`);gn(`THREE.WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` 4055 4056Material Name: `+t.name+` 4057Material Type: `+t.type+` 4058 4059Program Info Log: `+o+` 4060`+e+` 4061`+n)}else o===``?(s===``||c===``)&&(u=!1):H(`WebGLProgram: Program Info Log:`,o);u&&(t.diagnostics={runnable:l,programLog:o,vertexShader:{log:s,prefix:g},fragmentShader:{log:c,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new Pu(i,h),T=Yu(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,Iu)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Lu++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var _d=0,vd=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.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){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new yd(e),t.set(e,n)),n}},yd=class{constructor(e){this.id=_d++,this.code=e,this.usedTimes=0}};function bd(e){return e===1030||e===37490||e===36285}function xd(e,t,n,r,i,a){let o=new kr,s=new vd,c=new Set,l=[],u=new Map,d=r.logarithmicDepthBuffer,f=r.precision,p={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),e===0?`uv`:`uv${e}`}function h(i,o,l,u,h,g){let _=u.fog,v=h.geometry,y=i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial?u.environment:null,b=i.isMeshStandardMaterial||i.isMeshLambertMaterial&&!i.envMap||i.isMeshPhongMaterial&&!i.envMap,x=t.get(i.envMap||y,b),S=x&&x.mapping===306?x.image.height:null,C=p[i.type];i.precision!==null&&(f=r.getMaxPrecision(i.precision),f!==i.precision&&H(`WebGLProgram.getParameters:`,i.precision,`not supported, using`,f,`instead.`));let w=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,T=w===void 0?0:w.length,E=0;v.morphAttributes.position!==void 0&&(E=1),v.morphAttributes.normal!==void 0&&(E=2),v.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=Uc[C];D=e.vertexShader,O=e.fragmentShader}else D=i.vertexShader,O=i.fragmentShader,s.update(i),k=s.getVertexShaderID(i),A=s.getFragmentShaderID(i);let j=e.getRenderTarget(),ee=e.state.buffers.depth.getReversed(),te=h.isInstancedMesh===!0,M=h.isBatchedMesh===!0,ne=!!i.map,N=!!i.matcap,P=!!x,re=!!i.aoMap,ie=!!i.lightMap,ae=!!i.bumpMap,oe=!!i.normalMap,se=!!i.displacementMap,F=!!i.emissiveMap,ce=!!i.metalnessMap,le=!!i.roughnessMap,ue=i.anisotropy>0,I=i.clearcoat>0,de=i.dispersion>0,fe=i.iridescence>0,pe=i.sheen>0,me=i.transmission>0,he=ue&&!!i.anisotropyMap,L=I&&!!i.clearcoatMap,ge=I&&!!i.clearcoatNormalMap,R=I&&!!i.clearcoatRoughnessMap,_e=fe&&!!i.iridescenceMap,ve=fe&&!!i.iridescenceThicknessMap,ye=pe&&!!i.sheenColorMap,z=pe&&!!i.sheenRoughnessMap,be=!!i.specularMap,B=!!i.specularColorMap,xe=!!i.specularIntensityMap,Se=me&&!!i.transmissionMap,Ce=me&&!!i.thicknessMap,we=!!i.gradientMap,Te=!!i.alphaMap,Ee=i.alphaTest>0,De=!!i.alphaHash,Oe=!!i.extensions,ke=0;i.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(ke=e.toneMapping);let Ae={shaderID:C,shaderType:i.type,shaderName:i.name,vertexShader:D,fragmentShader:O,defines:i.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:i.isRawShaderMaterial===!0,glslVersion:i.glslVersion,precision:f,batching:M,batchingColor:M&&h._colorsTexture!==null,instancing:te,instancingColor:te&&h.instanceColor!==null,instancingMorph:te&&h.morphTexture!==null,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:nr.workingColorSpace,alphaToCoverage:!!i.alphaToCoverage,map:ne,matcap:N,envMap:P,envMapMode:P&&x.mapping,envMapCubeUVHeight:S,aoMap:re,lightMap:ie,bumpMap:ae,normalMap:oe,displacementMap:se,emissiveMap:F,normalMapObjectSpace:oe&&i.normalMapType===1,normalMapTangentSpace:oe&&i.normalMapType===0,packedNormalMap:oe&&i.normalMapType===0&&bd(i.normalMap.format),metalnessMap:ce,roughnessMap:le,anisotropy:ue,anisotropyMap:he,clearcoat:I,clearcoatMap:L,clearcoatNormalMap:ge,clearcoatRoughnessMap:R,dispersion:de,iridescence:fe,iridescenceMap:_e,iridescenceThicknessMap:ve,sheen:pe,sheenColorMap:ye,sheenRoughnessMap:z,specularMap:be,specularColorMap:B,specularIntensityMap:xe,transmission:me,transmissionMap:Se,thicknessMap:Ce,gradientMap:we,opaque:i.transparent===!1&&i.blending===1&&i.alphaToCoverage===!1,alphaMap:Te,alphaTest:Ee,alphaHash:De,combine:i.combine,mapUv:ne&&m(i.map.channel),aoMapUv:re&&m(i.aoMap.channel),lightMapUv:ie&&m(i.lightMap.channel),bumpMapUv:ae&&m(i.bumpMap.channel),normalMapUv:oe&&m(i.normalMap.channel),displacementMapUv:se&&m(i.displacementMap.channel),emissiveMapUv:F&&m(i.emissiveMap.channel),metalnessMapUv:ce&&m(i.metalnessMap.channel),roughnessMapUv:le&&m(i.roughnessMap.channel),anisotropyMapUv:he&&m(i.anisotropyMap.channel),clearcoatMapUv:L&&m(i.clearcoatMap.channel),clearcoatNormalMapUv:ge&&m(i.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:R&&m(i.clearcoatRoughnessMap.channel),iridescenceMapUv:_e&&m(i.iridescenceMap.channel),iridescenceThicknessMapUv:ve&&m(i.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&m(i.sheenColorMap.channel),sheenRoughnessMapUv:z&&m(i.sheenRoughnessMap.channel),specularMapUv:be&&m(i.specularMap.channel),specularColorMapUv:B&&m(i.specularColorMap.channel),specularIntensityMapUv:xe&&m(i.specularIntensityMap.channel),transmissionMapUv:Se&&m(i.transmissionMap.channel),thicknessMapUv:Ce&&m(i.thicknessMap.channel),alphaMapUv:Te&&m(i.alphaMap.channel),vertexTangents:!!v.attributes.tangent&&(oe||ue),vertexNormals:!!v.attributes.normal,vertexColors:i.vertexColors,vertexAlphas:i.vertexColors===!0&&!!v.attributes.color&&v.attributes.color.itemSize===4,pointsUvs:h.isPoints===!0&&!!v.attributes.uv&&(ne||Te),fog:!!_,useFog:i.fog===!0,fogExp2:!!_&&_.isFogExp2,flatShading:i.wireframe===!1&&(i.flatShading===!0||v.attributes.normal===void 0&&oe===!1&&(i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshPhysicalMaterial)),sizeAttenuation:i.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:ee,skinning:h.isSkinnedMesh===!0,morphTargets:v.morphAttributes.position!==void 0,morphNormals:v.morphAttributes.normal!==void 0,morphColors:v.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numLightProbeGrids:g.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&l.length>0,shadowMapType:e.shadowMap.type,toneMapping:ke,decodeVideoTexture:ne&&i.map.isVideoTexture===!0&&nr.getTransfer(i.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:F&&i.emissiveMap.isVideoTexture===!0&&nr.getTransfer(i.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:i.premultipliedAlpha,doubleSided:i.side===2,flipSided:i.side===1,useDepthPacking:i.depthPacking>=0,depthPacking:i.depthPacking||0,index0AttributeName:i.index0AttributeName,extensionClipCullDistance:Oe&&i.extensions.clipCullDistance===!0&&n.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(Oe&&i.extensions.multiDraw===!0||M)&&n.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:n.has(`KHR_parallel_shader_compile`),customProgramCacheKey:i.customProgramCacheKey()};return Ae.vertexUv1s=c.has(1),Ae.vertexUv2s=c.has(2),Ae.vertexUv3s=c.has(3),c.clear(),Ae}function g(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(_(n,t),v(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}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)}function v(e,t){o.disableAll(),t.instancing&&o.enable(0),t.instancingColor&&o.enable(1),t.instancingMorph&&o.enable(2),t.matcap&&o.enable(3),t.envMap&&o.enable(4),t.normalMapObjectSpace&&o.enable(5),t.normalMapTangentSpace&&o.enable(6),t.clearcoat&&o.enable(7),t.iridescence&&o.enable(8),t.alphaTest&&o.enable(9),t.vertexColors&&o.enable(10),t.vertexAlphas&&o.enable(11),t.vertexUv1s&&o.enable(12),t.vertexUv2s&&o.enable(13),t.vertexUv3s&&o.enable(14),t.vertexTangents&&o.enable(15),t.anisotropy&&o.enable(16),t.alphaHash&&o.enable(17),t.batching&&o.enable(18),t.dispersion&&o.enable(19),t.batchingColor&&o.enable(20),t.gradientMap&&o.enable(21),t.packedNormalMap&&o.enable(22),t.vertexNormals&&o.enable(23),e.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.reversedDepthBuffer&&o.enable(4),t.skinning&&o.enable(5),t.morphTargets&&o.enable(6),t.morphNormals&&o.enable(7),t.morphColors&&o.enable(8),t.premultipliedAlpha&&o.enable(9),t.shadowMapEnabled&&o.enable(10),t.doubleSided&&o.enable(11),t.flipSided&&o.enable(12),t.useDepthPacking&&o.enable(13),t.dithering&&o.enable(14),t.transmission&&o.enable(15),t.sheen&&o.enable(16),t.opaque&&o.enable(17),t.pointsUvs&&o.enable(18),t.decodeVideoTexture&&o.enable(19),t.decodeVideoTextureEmissive&&o.enable(20),t.alphaToCoverage&&o.enable(21),t.numLightProbeGrids>0&&o.enable(22),e.push(o.mask)}function y(e){let t=p[e.type],n;if(t){let e=Uc[t];n=ds.clone(e.uniforms)}else n=e.uniforms;return n}function b(t,n){let r=u.get(n);return r===void 0?(r=new gd(e,n,t,i),l.push(r),u.set(n,r)):++r.usedTimes,r}function x(e){if(--e.usedTimes===0){let t=l.indexOf(e);l[t]=l[l.length-1],l.pop(),u.delete(e.cacheKey),e.destroy()}}function S(e){s.remove(e)}function C(){s.dispose()}return{getParameters:h,getProgramCacheKey:g,getUniforms:y,acquireProgram:b,releaseProgram:x,releaseShaderCache:S,programs:l,dispose:C}}function Sd(){let e=new WeakMap;function t(t){return e.has(t)}function n(t){let n=e.get(t);return n===void 0&&(n={},e.set(t,n)),n}function r(t){e.delete(t)}function i(t,n,r){e.get(t)[n]=r}function a(){e=new WeakMap}return{has:t,get:n,remove:r,update:i,dispose:a}}function Cd(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.material.id===t.material.id?e.materialVariant===t.materialVariant?e.z===t.z?e.id-t.id:e.z-t.z:e.materialVariant-t.materialVariant:e.material.id-t.material.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function wd(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function Td(){let e=[],t=0,n=[],r=[],i=[];function a(){t=0,n.length=0,r.length=0,i.length=0}function o(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function s(n,r,i,a,s,c){let l=e[t];return l===void 0?(l={id:n.id,object:n,geometry:r,material:i,materialVariant:o(n),groupOrder:a,renderOrder:n.renderOrder,z:s,group:c},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=i,l.materialVariant=o(n),l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}function c(e,t,a,o,c,l){let u=s(e,t,a,o,c,l);a.transmission>0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function l(e,t,a,o,c,l){let u=s(e,t,a,o,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function u(e,t){n.length>1&&n.sort(e||Cd),r.length>1&&r.sort(t||wd),i.length>1&&i.sort(t||wd)}function d(){for(let n=t,r=e.length;n<r;n++){let t=e[n];if(t.id===null)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}}return{opaque:n,transmissive:r,transparent:i,init:a,push:c,unshift:l,finish:d,sort:u}}function Ed(){let e=new WeakMap;function t(t,n){let r=e.get(t),i;return r===void 0?(i=new Td,e.set(t,[i])):n>=r.length?(i=new Td,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function Dd(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new W,color:new $r};break;case`SpotLight`:n={position:new W,direction:new W,color:new $r,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new W,color:new $r,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new W,skyColor:new $r,groundColor:new $r};break;case`RectAreaLight`:n={color:new $r,position:new W,halfWidth:new W,halfHeight:new W};break}return e[t.id]=n,n}}}function Od(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new U};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new U};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new U,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var kd=0;function Ad(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function jd(e){let t=new Dd,n=Od(),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 e=0;e<9;e++)r.probe.push(new W);let i=new W,a=new vr,o=new vr;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort(Ad);for(let e=0,y=i.length;e<y;e++){let y=i[e],b=y.color,x=y.intensity,S=y.distance,C=null;if(y.shadow&&y.shadow.map&&(C=y.shadow.map.texture.format===1030?y.shadow.map.texture:y.shadow.map.depthTexture||y.shadow.map.texture),y.isAmbientLight)a+=b.r*x,o+=b.g*x,s+=b.b*x;else if(y.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(y.sh.coefficients[e],x);v++}else if(y.isDirectionalLight){let e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){let e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.n
vendor: 4,608 bytes, lines 4061-4066
4061ormalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[c]=t,r.directionalShadowMap[c]=C,r.directionalShadowMatrix[c]=y.shadow.matrix,p++}r.directional[c]=e,c++}else if(y.isSpotLight){let e=t.get(y);e.position.setFromMatrixPosition(y.matrixWorld),e.color.copy(b).multiplyScalar(x),e.distance=S,e.coneCos=Math.cos(y.angle),e.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),e.decay=y.decay,r.spot[u]=e;let i=y.shadow;if(y.map&&(r.spotLightMap[g]=y.map,g++,i.updateMatrices(y),y.castShadow&&_++),r.spotLightMatrix[u]=i.matrix,y.castShadow){let e=n.get(y);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]=C,h++}u++}else if(y.isRectAreaLight){let e=t.get(y);e.color.copy(b).multiplyScalar(x),e.halfWidth.set(y.width*.5,0,0),e.halfHeight.set(0,y.height*.5,0),r.rectArea[d]=e,d++}else if(y.isPointLight){let e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),e.distance=y.distance,e.decay=y.decay,y.castShadow){let e=y.shadow,t=n.get(y);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[l]=t,r.pointShadowMap[l]=C,r.pointShadowMatrix[l]=y.shadow.matrix,m++}r.point[l]=e,l++}else if(y.isHemisphereLight){let e=t.get(y);e.skyColor.copy(y.color).multiplyScalar(x),e.groundColor.copy(y.groundColor).multiplyScalar(x),r.hemi[f]=e,f++}}d>0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=Y.LTC_FLOAT_1,r.rectAreaLTC2=Y.LTC_FLOAT_2):(r.rectAreaLTC1=Y.LTC_HALF_1,r.rectAreaLTC2=Y.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=kd++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t<f;t++){let f=e[t];if(f.isDirectionalLight){let e=r.directional[n];e.direction.setFromMatrixPosition(f.matrixWorld),i.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(d),n++}else if(f.isSpotLight){let e=r.spot[c];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(f.matrixWorld),i.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(d),c++}else if(f.isRectAreaLight){let e=r.rectArea[l];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(d),o.identity(),a.copy(f.matrixWorld),a.premultiply(d),o.extractRotation(a),e.halfWidth.set(f.width*.5,0,0),e.halfHeight.set(0,f.height*.5,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),l++}else if(f.isPointLight){let e=r.point[s];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(d),s++}else if(f.isHemisphereLight){let e=r.hemi[u];e.direction.setFromMatrixPosition(f.matrixWorld),e.direction.transformDirection(d),u++}}}return{setup:s,setupView:c,state:r}}function Md(e){let t=new jd(e),n=[],r=[],i=[];function a(e){d.camera=e,n.length=0,r.length=0,i.length=0}function o(e){n.push(e)}function s(e){r.push(e)}function c(e){i.push(e)}function l(){t.setup(n)}function u(e){t.setupView(n,e)}let d={lightsArray:n,shadowsArray:r,lightProbeGridArray:i,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:a,state:d,setupLights:l,setupLightsView:u,pushLight:o,pushShadow:s,pushLightProbeGrid:c}}function Nd(e){let t=new WeakMap;function n(n,r=0){let i=t.get(n),a;return i===void 0?(a=new Md(e),t.set(n,[a])):r>=i.length?(a=new Md(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var Pd=`void main() { 4062 gl_Position = vec4( position, 1.0 ); 4063}`,Fd=`uniform sampler2D shadow_pass; 4064uniform vec2 resolution; 4065uniform float radius; 4066void main() {
4067 const float samples = float( VSM_SAMPLES ); 4068 float mean = 0.0; 4069 float squared_mean = 0.0; 4070 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 4071 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 4072 for ( float i = 0.0; i < samples; i ++ ) { 4073 float uvOffset = uvStart + i * uvStride; 4074 #ifdef HORIZONTAL_PASS 4075 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 4076 mean += distribution.x; 4077 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 4078 #else 4079 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 4080 mean += depth; 4081 squared_mean += depth * depth; 4082 #endif 4083 } 4084 mean = mean / samples; 4085 squared_mean = squared_mean / samples; 4086 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 4087 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 4088}`,Id=[new W(1,0,0),new W(-1,0,0),new W(0,1,0),new W(0,-1,0),new W(0,0,1),new W(0,0,-1)],Ld=[new W(0,-1,0),new W(0,-1,0),new W(0,0,1),new W(0,0,-1),new W(0,-1,0),new W(0,-1,0)],Rd=new vr,zd=new W,Bd=new W;function Vd(e,t,n){let r=new Ja,i=new U,a=new U,o=new pr,s=new vs,c=new ys,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new ms({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new U},radius:{value:4}},vertexShader:Pd,fragmentShader:Fd}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new Yi;m.setAttribute(`position`,new Pi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new La(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;this.type===2&&(H(`WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead.`),this.type=1);let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.depth.getReversed()===!0?f.buffers.color.setClear(0,0,0,0):f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==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 c=0,l=t.length;c<l;c++){let l=t[c],d=l.shadow;if(d===void 0){H(`WebGLShadowMap:`,l,`has no shadow.`);continue}if(d.autoUpdate===!1&&d.needsUpdate===!1)continue;i.copy(d.mapSize);let m=d.getFrameExtents();i.multiply(m),a.copy(d.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/m.x),i.x=a.x*m.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/m.y),i.y=a.y*m.y,d.mapSize.y=a.y));let h=e.state.buffers.depth.getReversed();if(d.camera._reversedDepth=h,d.map===null||p===!0){if(d.map!==null&&(d.map.depthTexture!==null&&(d.map.depthTexture.dispose(),d.map.depthTexture=null),d.map.dispose()),this.type===3){if(l.isPointLight){H(`WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.`);continue}d.map=new hr(i.x,i.y,{format:st,type:Je,minFilter:ze,magFilter:ze,generateMipmaps:!1}),d.map.texture.name=l.name+`.shadowMap`,d.map.depthTexture=new vo(i.x,i.y,qe),d.map.depthTexture.name=l.name+`.shadowMapDepth`,d.map.depthTexture.format=rt,d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=Ie,d.map.depthTexture.magFilter=Ie}else l.isPointLight?(d.map=new vl(i.x),d.map.depthTexture=new yo(i.x,Ke)):(d.map=new hr(i.x,i.y),d.map.depthTexture=new vo(i.x,i.y,Ke)),d.map.depthTexture.name=l.name+`.shadowMap`,d.map.depthTexture.format=rt,this.type===1?(d.map.depthTexture.compareFunction=h?518:515,d.map.depthTexture.minFilter=ze,d.map.depthTexture.magFilter=ze):(d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=Ie,d.map.depthTexture.magFilter=Ie);d.camera.updateProjectionMatrix()}let g=d.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t<g;t++){if(d.map.isWebGLCubeRenderTarget)e.setRenderTarget(d.map,t),e.clear();else{t===0&&(e.setRenderTarget(d.map),e.clear());let n=d.getViewport(t);o.set(a.x*n.x,a.y*n.y,a.x*n.z,a.y*n.w),f.viewport(o)}if(l.isPointLight){let e=d.camera,n=d.matrix,r=l.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),zd.setFromMatrixPosition(l.matrixWorld),e.position.copy(zd),Bd.copy(e.position),Bd.add(Id[t]),e.up.copy(Ld[t]),e.lookAt(Bd),e.updateMatrixWorld(),n.makeTranslation(-zd.x,-zd.y,-zd.z),Rd.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),d._frustum.setFromProjectionMatrix(Rd,e.coordinateSystem,e.reversedDepth)}else d.updateMatrices(l);r=d.getFrustum(),b(n,s,d.camera,l,this.type)}d.isPointLightShadow!==!0&&this.type===3&&v(d,s),d.needsUpdate=!1}
vendor: 14,486 bytes, line 4088
4088_=this.type,g.needsUpdate=!1,e.setRenderTarget(c,l,d)};function v(n,r){let a=t.update(h);f.defines.VSM_SAMPLES!==n.blurSamples&&(f.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),n.mapPass===null&&(n.mapPass=new hr(i.x,i.y,{format:st,type:Je})),f.uniforms.shadow_pass.value=n.map.depthTexture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,f,h,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,a,p,h,null)}function y(t,n,r,i){let a=null,o=r.isPointLight===!0?t.customDistanceMaterial:t.customDepthMaterial;if(o!==void 0)a=o;else if(a=r.isPointLight===!0?c:s,e.localClippingEnabled&&n.clipShadows===!0&&Array.isArray(n.clippingPlanes)&&n.clippingPlanes.length!==0||n.displacementMap&&n.displacementScale!==0||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l<u;l++){let u=t[l],d=c[u.materialIndex];if(d&&d.visible){let t=y(n,d,o,s);n.onBeforeShadow(e,n,i,a,r,t,u),e.renderBufferDirect(a,null,r,t,n,u),n.onAfterShadow(e,n,i,a,r,t,u)}}}else if(c.visible){let t=y(n,c,o,s);n.onBeforeShadow(e,n,i,a,r,t,null),e.renderBufferDirect(a,null,r,t,n,null),n.onAfterShadow(e,n,i,a,r,t,null)}}let c=n.children;for(let e=0,t=c.length;e<t;e++)b(c[e],i,a,o,s)}function x(e){e.target.removeEventListener(`dispose`,x);for(let t in l){let n=l[t],r=e.target.uuid;r in n&&(n[r].dispose(),delete n[r])}}}function Hd(e,t){function n(){let t=!1,n=new pr,r=null,i=new pr(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,a,o,s){s===!0&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),i.equals(n)===!1&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}}function r(){let n=!1,r=!1,i=null,a=null,o=null;return{setReversed:function(e){if(r!==e){let 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;let i=o;o=null,this.setClear(i)}},getReversed:function(){return r},setTest:function(t){t?ce(e.DEPTH_TEST):le(e.DEPTH_TEST)},setMask:function(t){i!==t&&!n&&(e.depthMask(t),i=t)},setFunc:function(t){if(r&&(t=yn[t]),a!==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: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);break;default:e.depthFunc(e.LEQUAL)}a=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(o=t,r&&(t=1-t),e.clearDepth(t))},reset:function(){n=!1,i=null,a=null,o=null,r=!1}}}function i(){let t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(n){t||(n?ce(e.STENCIL_TEST):le(e.STENCIL_TEST))},setMask:function(r){n!==r&&!t&&(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||i!==n||a!==o)&&(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){(o!==t||s!==n||c!==r)&&(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}}let a=new n,o=new r,s=new i,c=new WeakMap,l=new WeakMap,u={},d={},f={},p=new WeakMap,m=[],h=null,g=!1,_=null,v=null,y=null,b=null,x=null,S=null,C=null,w=new $r(0,0,0),T=0,E=!1,D=null,O=null,k=null,A=null,j=null,ee=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),te=!1,M=0,ne=e.getParameter(e.VERSION);ne.indexOf(`WebGL`)===-1?ne.indexOf(`OpenGL ES`)!==-1&&(M=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),te=M>=2):(M=parseFloat(/^WebGL (\d)/.exec(ne)[1]),te=M>=1);let N=null,P={},re=e.getParameter(e.SCISSOR_BOX),ie=e.getParameter(e.VIEWPORT),ae=new pr().fromArray(re),oe=new pr().fromArray(ie);function se(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<r;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return o}let F={};F[e.TEXTURE_2D]=se(e.TEXTURE_2D,e.TEXTURE_2D,1),F[e.TEXTURE_CUBE_MAP]=se(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),F[e.TEXTURE_2D_ARRAY]=se(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),F[e.TEXTURE_3D]=se(e.TEXTURE_3D,e.TEXTURE_3D,1,1),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),ce(e.DEPTH_TEST),o.setFunc(3),L(!1),ge(1),ce(e.CULL_FACE),me(0);function ce(t){u[t]!==!0&&(e.enable(t),u[t]=!0)}function le(t){u[t]!==!1&&(e.disable(t),u[t]=!1)}function ue(t,n){return f[t]===n?!1:(e.bindFramebuffer(t,n),f[t]=n,t===e.DRAW_FRAMEBUFFER&&(f[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(f[e.DRAW_FRAMEBUFFER]=n),!0)}function I(t,n){let r=m,i=!1;if(t){r=p.get(n),r===void 0&&(r=[],p.set(n,r));let a=t.textures;if(r.length!==a.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=a.length,i=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,i=!0);i&&e.drawBuffers(r)}function de(t){return h===t?!1:(e.useProgram(t),h=t,!0)}let fe={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};fe[103]=e.MIN,fe[104]=e.MAX;let pe={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function me(t,n,r,i,a,o,s,c,l,u){if(t===0){g===!0&&(le(e.BLEND),g=!1);return}if(g===!1&&(ce(e.BLEND),g=!0),t!==5){if(t!==_||u!==E){if((v!==100||x!==100)&&(e.blendEquation(e.FUNC_ADD),v=100,x=100),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:gn(`WebGLState: Invalid blending: `,t);break}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:gn(`WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true`);break;case 4:gn(`WebGLState: MultiplyBlending requires material.premultipliedAlpha = true`);break;default:gn(`WebGLState: Invalid blending: `,t);break}y=null,b=null,S=null,C=null,w.set(0,0,0),T=0,_=t,E=u}return}a||=n,o||=r,s||=i,(n!==v||a!==x)&&(e.blendEquationSeparate(fe[n],fe[a]),v=n,x=a),(r!==y||i!==b||o!==S||s!==C)&&(e.blendFuncSeparate(pe[r],pe[i],pe[o],pe[s]),y=r,b=i,S=o,C=s),(c.equals(w)===!1||l!==T)&&(e.blendColor(c.r,c.g,c.b,l),w.copy(c),T=l),_=t,E=!1}function he(t,n){t.side===2?le(e.CULL_FACE):ce(e.CULL_FACE);let r=t.side===1;n&&(r=!r),L(r),t.blending===1&&t.transparent===!1?me(0):me(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),a.setMask(t.colorWrite);let i=t.stencilWrite;s.setTest(i),i&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),_e(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),t.alphaToCoverage===!0?ce(e.SAMPLE_ALPHA_TO_COVERAGE):le(e.SAMPLE_ALPHA_TO_COVERAGE)}function L(t){D!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),D=t)}function ge(t){t===0?le(e.CULL_FACE):(ce(e.CULL_FACE),t!==O&&(t===1?e.cullFace(e.BACK):t===2?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))),O=t}function R(t){t!==k&&(te&&e.lineWidth(t),k=t)}function _e(t,n,r){t?(ce(e.POLYGON_OFFSET_FILL),(A!==n||j!==r)&&(A=n,j=r,o.getReversed()&&(n=-n),e.polygonOffset(n,r))):le(e.POLYGON_OFFSET_FILL)}function ve(t){t?ce(e.SCISSOR_TEST):le(e.SCISSOR_TEST)}function ye(t){t===void 0&&(t=e.TEXTURE0+ee-1),N!==t&&(e.activeTexture(t),N=t)}function z(t,n,r){r===void 0&&(r=N===null?e.TEXTURE0+ee-1:N);let i=P[r];i===void 0&&(i={type:void 0,texture:void 0},P[r]=i),(i.type!==t||i.texture!==n)&&(N!==r&&(e.activeTexture(r),N=r),e.bindTexture(t,n||F[t]),i.type=t,i.texture=n)}function be(){let t=P[N];t!==void 0&&t.type!==void 0&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)}function B(){try{e.compressedTexImage2D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function xe(){try{e.compressedTexImage3D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function Se(){try{e.texSubImage2D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function Ce(){try{e.texSubImage3D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function we(){try{e.compressedTexSubImage2D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function Te(){try{e.compressedTexSubImage3D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function Ee(){try{e.texStorage2D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function De(){try{e.texStorage3D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function Oe(){try{e.texImage2D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function ke(){try{e.texImage3D(...arguments)}catch(e){gn(`WebGLState:`,e)}}function Ae(t){return d[t]===void 0?e.getParameter(t):d[t]}function je(t,n){d[t]!==n&&(e.pixelStorei(t,n),d[t]=n)}function Me(t){ae.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),ae.copy(t))}function Ne(t){oe.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),oe.copy(t))}function Pe(t,n){let r=l.get(n);r===void 0&&(r=new WeakMap,l.set(n,r));let i=r.get(t);i===void 0&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))}function Fe(t,n){let r=l.get(n).get(t);c.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),c.set(n,r))}function Ie(){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),o.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),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),u={},d={},N=null,P={},f={},p=new WeakMap,m=[],h=null,g=!1,_=null,v=null,y=null,b=null,x=null,S=null,C=null,w=new $r(0,0,0),T=0,E=!1,D=null,O=null,k=null,A=null,j=null,ae.set(0,0,e.canvas.width,e.canvas.height),oe.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),s.reset()}return{buffers:{color:a,depth:o,stencil:s},enable:ce,disable:le,bindFramebuffer:ue,drawBuffers:I,useProgram:de,setBlending:me,setMaterial:he,setFlipSided:L,setCullFace:ge,setLineWidth:R,setPolygonOffset:_e,setScissorTest:ve,activeTexture:ye,bindTexture:z,unbindTexture:be,compressedTexImage2D:B,compressedTexImage3D:xe,texImage2D:Oe,texImage3D:ke,pixelStorei:je,getParameter:Ae,updateUBOMapping:Pe,uniformBlockBinding:Fe,texStorage2D:Ee,texStorage3D:De,texSubImage2D:Se,texSubImage3D:Ce,compressedTexSubImage2D:we,compressedTexSubImage3D:Te,scissor:Me,viewport:Ne,reset:Ie}}function Ud(e,t,n,r,i,a,o){let s=t.has(`WEBGL_multisampled_render_to_texture`)?t.get(`WEBGL_multisampled_render_to_texture`):null,c=typeof navigator>`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new U,u=new WeakMap,d=new Set,f,p=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function h(e,t){return m?new OffscreenCanvas(e,t):un(`canvas`)}function g(e,t,n){let r=1,i=B(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);f===void 0&&(f=h(n,a));let o=t?h(n,a):f;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),H(`WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}else return`data`in e&&H(`WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e;return e}function _(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}
4088function 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,a,o,s=!1){if(n!==null){if(e[n]!==void 0)return e[n];H(`WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let c;a&&(c=t.get(`EXT_texture_norm16`),c||H(`WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension`));let l=r;if(r===e.RED&&(i===e.FLOAT&&(l=e.R32F),i===e.HALF_FLOAT&&(l=e.R16F),i===e.UNSIGNED_BYTE&&(l=e.R8),i===e.UNSIGNED_SHORT&&c&&(l=c.R16_EXT),i===e.SHORT&&c&&(l=c.R16_SNORM_EXT)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.R8UI),i===e.UNSIGNED_SHORT&&(l=e.R16UI),i===e.UNSIGNED_INT&&(l=e.R32UI),i===e.BYTE&&(l=e.R8I),i===e.SHORT&&(l=e.R16I),i===e.INT&&(l=e.R32I)),r===e.RG&&(i===e.FLOAT&&(l=e.RG32F),i===e.HALF_FLOAT&&(l=e.RG16F),i===e.UNSIGNED_BYTE&&(l=e.RG8),i===e.UNSIGNED_SHORT&&c&&(l=c.RG16_EXT),i===e.SHORT&&c&&(l=c.RG16_SNORM_EXT)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RG8UI),i===e.UNSIGNED_SHORT&&(l=e.RG16UI),i===e.UNSIGNED_INT&&(l=e.RG32UI),i===e.BYTE&&(l=e.RG8I),i===e.SHORT&&(l=e.RG16I),i===e.INT&&(l=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RGB8UI),i===e.UNSIGNED_SHORT&&(l=e.RGB16UI),i===e.UNSIGNED_INT&&(l=e.RGB32UI),i===e.BYTE&&(l=e.RGB8I),i===e.SHORT&&(l=e.RGB16I),i===e.INT&&(l=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(l=e.RGBA16UI),i===e.UNSIGNED_INT&&(l=e.RGBA32UI),i===e.BYTE&&(l=e.RGBA8I),i===e.SHORT&&(l=e.RGBA16I),i===e.INT&&(l=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_SHORT&&c&&(l=c.RGB16_EXT),i===e.SHORT&&c&&(l=c.RGB16_SNORM_EXT),i===e.UNSIGNED_INT_5_9_9_9_REV&&(l=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(l=e.R11F_G11F_B10F)),r===e.RGBA){let t=s?nn:nr.getTransfer(o);i===e.FLOAT&&(l=e.RGBA32F),i===e.HALF_FLOAT&&(l=e.RGBA16F),i===e.UNSIGNED_BYTE&&(l=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT&&c&&(l=c.RGBA16_EXT),i===e.SHORT&&c&&(l=c.RGBA16_SNORM_EXT),i===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)}return(l===e.R16F||l===e.R32F||l===e.RG16F||l===e.RG32F||l===e.RGBA16F||l===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),l}function x(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,H(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function S(e,t){return _(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),T(t),t.isVideoTexture&&u.delete(t),t.isHTMLTexture&&d.delete(t)}function w(e){let t=e.target;t.removeEventListener(`dispose`,w),D(t)}function T(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=p.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&E(e),Object.keys(i).length===0&&p.delete(n)}r.remove(e)}function E(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=p.get(i);delete a[n.__cacheKey],o.memory.textures--}function D(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r<n.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(n.__webglFramebuffer[t][r]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}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.__webglColorRen
vendor: 4,099 bytes, line 4088
4088derbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}let i=t.textures;for(let t=0,n=i.length;t<n;t++){let n=r.get(i[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),r.remove(i[t])}r.remove(t)}let O=0;function k(){O=0}function A(){return O}function j(e){O=e}function ee(){let e=O;return e>=i.maxTextures&&H(`WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),O+=1,e}function te(e){let 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()}function M(t,i){let a=r.get(t);if(t.isVideoTexture&&z(t),t.isRenderTargetTexture===!1&&t.isExternalTexture!==!0&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)H(`WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)H(`WebGLRenderer: Texture marked for update but image is incomplete`);else{le(a,t,i);return}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function ne(t,i){let a=r.get(t);if(t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){le(a,t,i);return}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function N(t,i){let a=r.get(t);if(t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){le(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function P(t,i){let a=r.get(t);if(t.isCubeDepthTexture!==!0&&t.version>0&&a.__version!==t.version){ue(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let re={[Ne]:e.REPEAT,[Pe]:e.CLAMP_TO_EDGE,[Fe]:e.MIRRORED_REPEAT},ie={[Ie]:e.NEAREST,[Le]:e.NEAREST_MIPMAP_NEAREST,[Re]:e.NEAREST_MIPMAP_LINEAR,[ze]:e.LINEAR,[V]:e.LINEAR_MIPMAP_NEAREST,[Be]:e.LINEAR_MIPMAP_LINEAR},ae={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function oe(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&H(`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,re[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,re[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,re[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,ie[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,ie[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,ae[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function se(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,C));let i=n.source,a=p.get(i);a===void 0&&(a={},p.set(i,a));let s=te(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&E(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function F(e,t,n){return Math.floor(Math.floor(e/n)/t)}
4088function ce(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e<o.length;e++){let t=o[s],n=o[e],i=t.start+t.count,a=F(n.start,r.width,4),c=F(t.start,r.width,4);n.start<=i+1&&a===c&&F(n.start+n.count-1,r.width,4)===a?t.count=Math.max(t.count,n.start+n.count-t.start):(++s,o[s]=n)}o.length=s+1;let c=n.getParameter(e.UNPACK_ROW_LENGTH),l=n.getParameter(e.UNPACK_SKIP_PIXELS),u=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let t=0,s=o.length;t<s;t++){let s=o[t],c=Math.floor(s.start/4),l=Math.ceil(s.count/4),u=c%r.width,d=Math.floor(c/r.width),f=l;n.pixelStorei(e.UNPACK_SKIP_PIXELS,u),n.pixelStorei(e.UNPACK_SKIP_ROWS,d),n.texSubImage2D(e.TEXTURE_2D,0,u,d,f,1,i,a,r.data)}t.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,c),n.pixelStorei(e.UNPACK_SKIP_PIXELS,l),n.pixelStorei(e.UNPACK_SKIP_ROWS,u)}}function le(t,o,s){let c=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(c=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(c=e.TEXTURE_3D);let l=se(t,o),u=o.source;n.bindTexture(c,t.__webglTexture,e.TEXTURE0+s);let f=r.get(u);if(u.version!==f.__version||l===!0){if(n.activeTexture(e.TEXTURE0+s),!(typeof ImageBitmap<`u`&&o.image instanceof ImageBitmap)){let t=nr.getPrimaries(nr.workingColorSpace),r=o.colorSpace
vendor: 4,888 bytes, line 4088
4088===``?null:nr.getPrimaries(o.colorSpace),i=o.colorSpace===``||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,i)}n.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment);let t=g(o.image,!1,i.maxTextureSize);t=be(o,t);let r=a.convert(o.format,o.colorSpace),p=a.convert(o.type),m=b(o.internalFormat,r,p,o.normalized,o.colorSpace,o.isVideoTexture);oe(c,o);let h,y=o.mipmaps,C=o.isVideoTexture!==!0,w=f.__version===void 0||l===!0,T=u.dataReady,E=S(o,t);if(o.isDepthTexture)m=x(o.format===it,o.type),w&&(C?n.texStorage2D(e.TEXTURE_2D,1,m,t.width,t.height):n.texImage2D(e.TEXTURE_2D,0,m,t.width,t.height,0,r,p,null));else if(o.isDataTexture)if(y.length>0){C&&w&&n.texStorage2D(e.TEXTURE_2D,E,m,y[0].width,y[0].height);for(let t=0,i=y.length;t<i;t++)h=y[t],C?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,h.width,h.height,r,p,h.data):n.texImage2D(e.TEXTURE_2D,t,m,h.width,h.height,0,r,p,h.data);o.generateMipmaps=!1}else C?(w&&n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height),T&&ce(o,t,r,p)):n.texImage2D(e.TEXTURE_2D,0,m,t.width,t.height,0,r,p,t.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){C&&w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,E,m,y[0].width,y[0].height,t.depth);for(let i=0,a=y.length;i<a;i++)if(h=y[i],o.format!==1023)if(r!==null)if(C){if(T)if(o.layerUpdates.size>0){let t=J(h.width,h.height,o.format,o.type);for(let a of o.layerUpdates){let o=h.data.subarray(a*t/h.data.BYTES_PER_ELEMENT,(a+1)*t/h.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,a,h.width,h.height,1,r,o)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,h.width,h.height,t.depth,r,h.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,i,m,h.width,h.height,t.depth,0,h.data,0,0);else H(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else C?T&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,h.width,h.height,t.depth,r,p,h.data):n.texImage3D(e.TEXTURE_2D_ARRAY,i,m,h.width,h.height,t.depth,0,r,p,h.data)}else{C&&w&&n.texStorage2D(e.TEXTURE_2D,E,m,y[0].width,y[0].height);for(let t=0,i=y.length;t<i;t++)h=y[t],o.format===1023?C?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,h.width,h.height,r,p,h.data):n.texImage2D(e.TEXTURE_2D,t,m,h.width,h.height,0,r,p,h.data):r===null?H(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`):C?T&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,h.width,h.height,r,h.data):n.compressedTexImage2D(e.TEXTURE_2D,t,m,h.width,h.height,0,h.data)}else if(o.isDataArrayTexture)if(C){if(w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,E,m,t.width,t.height,t.depth),T)if(o.layerUpdates.size>0){let i=J(t.width,t.height,o.format,o.type);for(let a of o.layerUpdates){let o=t.data.subarray(a*i/t.data.BYTES_PER_ELEMENT,(a+1)*i/t.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,a,t.width,t.height,1,r,p,o)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,m,t.width,t.height,t.depth,0,r,p,t.data);else if(o.isData3DTexture)C?(w&&n.texStorage3D(e.TEXTURE_3D,E,m,t.width,t.height,t.depth),T&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)):n.texImage3D(e.TEXTURE_3D,0,m,t.width,t.height,t.depth,0,r,p,t.data);else if(o.isFramebufferTexture){if(w)if(C)n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height);else{let i=t.width,a=t.height;for(let t=0;t<E;t++)n.texImage2D(e.TEXTURE_2D,t,m,i,a,0,r,p,null),i>>=1,a>>=1}}else if(o.isHTMLTexture){if(`texElementImage2D`in e){let n=e.canvas;if(n.hasAttribute(`layoutsubtree`)||n.setAttribute(`layoutsubtree`,`true`),t.parentNode!==n){n.appendChild(t),d.add(o),n.onpaint=e=>{let t=e.changedElements;for(let e of d)t.includes(e.image)&&(e.needsUpdate=!0)},n.requestPaint();return}let r=e.RGBA,i=e.RGBA,a=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,0,r,i,a,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(y.length>0){if(C&&w){let t=B(y[0]);n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height)}for(let t=0,i=y.length;t<i;t++)h=y[t],C?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,r,p,h):n.texImage2D(e.TEXTURE_2D,t,m,r,p,h);o.generateMipmaps=!1}else if(C){if(w){let r=B(t);n.texStorage2D(e.TEXTURE_2D,E,m,r.width,r.height)}T&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,r,p,t)}else n.texImage2D(e.TEXTURE_2D,0,m,r,p,t);_(o)&&v(c),f.__version=u.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function ue(t,o,s){if(o.image.length!==6)return;let c=se(t,o),l=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);let u=r.get(l);if(l.version!==u.__version||c===!0){n.activeTexture(e.TEXTURE0+s);
vendor: 5,538 bytes, line 4088
4088let t=nr.getPrimaries(nr.workingColorSpace),r=o.colorSpace===``?null:nr.getPrimaries(o.colorSpace),d=o.colorSpace===``||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let f=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,m=[];for(let e=0;e<6;e++)!f&&!p?m[e]=g(o.image[e],!0,i.maxCubemapSize):m[e]=p?o.image[e].image:o.image[e],m[e]=be(o,m[e]);let h=m[0],y=a.convert(o.format,o.colorSpace),x=a.convert(o.type),C=b(o.internalFormat,y,x,o.normalized,o.colorSpace),w=o.isVideoTexture!==!0,T=u.__version===void 0||c===!0,E=l.dataReady,D=S(o,h);oe(e.TEXTURE_CUBE_MAP,o);let O;if(f){w&&T&&n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,h.width,h.height);for(let t=0;t<6;t++){O=m[t].mipmaps;for(let r=0;r<O.length;r++){let i=O[r];o.format===1023?w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,y,x,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,C,i.width,i.height,0,y,x,i.data):y===null?H(`WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()`):w?E&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,y,i.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,C,i.width,i.height,0,i.data)}}}else{if(O=o.mipmaps,w&&T){O.length>0&&D++;let t=B(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,y,x,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,y,x,m[t].data);for(let r=0;r<O.length;r++){let i=O[r].image[t].image;w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,i.width,i.height,y,x,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,C,i.width,i.height,0,y,x,i.data)}}else{w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,y,x,m[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,y,x,m[t]);for(let r=0;r<O.length;r++){let i=O[r];w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,y,x,i.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,C,y,x,i.image[t])}}}_(o)&&v(e.TEXTURE_CUBE_MAP),u.__version=l.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function I(t,i,o,c,l,u){let d=a.convert(o.format,o.colorSpace),f=a.convert(o.type),p=b(o.internalFormat,d,f,o.normalized,o.colorSpace),m=r.get(i),h=r.get(o);if(h.__renderTarget=i,!m.__hasExternalTextures){let t=Math.max(1,i.width>>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),ye(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,ve(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function de(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=x(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;ye(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ve(n),o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,ve(n),o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i<t.length;i++){let o=t[i],c=a.convert(o.format,o.colorSpace),l=a.convert(o.type),u=b(o.internalFormat,c,l,o.normalized,o.colorSpace);ye(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ve(n),u,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,ve(n),u,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,u,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function fe(t,i,o){let c=i.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(e.FRAMEBUFFER,t),!(i.depthTexture&&i.depthTexture.isDepthTexture))throw Error(`renderTarget.depthTexture must be an instance of THREE.DepthTexture`);let l=r.get(i.depthTexture);if(l.__renderTarget=i,(!l.__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),c){if(l.__webglInit===void 0&&(l.__webglInit=!0,i.depthTexture.addEventListener(`dispose`,C)),l.__webglTexture===void 0){l.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),oe(e.TEXTURE_CUBE_MAP,i.depthTexture);let t=a.convert(i.depthTexture.format),r=a.convert(i.depthTexture.type),o;i.depthTexture.format===1026?o=e.DEPTH_COMPONENT24:i.depthTexture.format===1027&&(o=e.DEPTH24_STENCIL8);for(let n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o,i.width,i.height,0,t,r,null)}}else M(i.depthTexture,0);let u=l.__webglTexture,d=ve(i),f=c?e.TEXTURE_CUBE_MAP_POSITIVE_X+o:e.TEXTURE_2D,p=i.depthTexture.format===1027?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(i.depthTexture.format===1026)ye(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,u,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,u,0);else if(i.depthTexture.format===1027)ye(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,u,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,u,0);else throw Error(`Unknown depthTexture format`)}
vendor: 5,622 bytes, line 4088
4088function pe(t){let i=r.get(t),a=t.isWebGLCubeRenderTarget===!0;if(i.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(i.__depthDisposeCallback&&i.__depthDisposeCallback(),e){let 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(a)for(let e=0;e<6;e++)fe(i.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?fe(i.__webglFramebuffer[0],t,0):fe(i.__webglFramebuffer,t,0)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),de(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),de(i.__webglDepthbuffer,t,!1);else{let 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)}function me(t,n,i){let a=r.get(t);n!==void 0&&I(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&pe(t)}function he(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,w);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.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=l.length;t<n;t++){let n=r.get(l[t]);n.__webglTexture===void 0&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&ye(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n<l.length;n++){let r=l[n];s.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s.__webglColorRenderbuffer[n]);let i=a.convert(r.format,r.colorSpace),o=a.convert(r.type),c=b(r.internalFormat,i,o,r.normalized,r.colorSpace,t.isXRRenderTarget===!0),u=ve(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,u,c,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(),de(s.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(u){n.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),oe(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++)I(s.__webglFramebuffer[n][r],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r);else I(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);_(i)&&v(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let i=0,a=l.length;i<a;i++){let a=l[i],o=r.get(a),c=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(c=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(c,o.__webglTexture),oe(c,a),I(s.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+i,c,0),_(a)&&v(c)}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,c.__webglTexture),oe(r,i),i.mipmaps&&i.mipmaps.length>0)for(let n=0;n<i.mipmaps.length;n++)I(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,r,n);else I(s.__webglFramebuffer,t,i,e.COLOR_ATTACHMENT0,r,0);_(i)&&v(r),n.unbindTexture()}t.depthBuffer&&pe(t)}function L(e){let t=e.textures;for(let i=0,a=t.length;i<a;i++){let a=t[i];if(_(a)){let t=y(e),i=r.get(a).__webglTexture;n.bindTexture(t,i),v(t),n.unbindTexture()}}}let ge=[],R=[];function _e(t){if(t.samples>0){if(ye(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=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);let f=t.texture.mipmaps;f&&f.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.__webglColorRen
vendor: 25,402 bytes, lines 4088-4112
4088derbuffer[n]);let t=r.get(i[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),c===!0&&(ge.length=0,R.length=0,ge.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&t.resolveDepthBuffer===!1&&(ge.push(l),R.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,R)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,ge))}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]);let a=r.get(i[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&t.resolveDepthBuffer===!1&&c){let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}}}function ve(e){return Math.min(i.maxSamples,e.samples)}function ye(e){let n=r.get(e);return e.samples>0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function z(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function be(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(nr.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&H(`WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):gn(`WebGLTextures: Unsupported texture color space:`,n)),t}function B(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=ee,this.resetTextureUnits=k,this.getTextureUnits=A,this.setTextureUnits=j,this.setTexture2D=M,this.setTexture2DArray=ne,this.setTexture3D=N,this.setTextureCube=P,this.rebindTextures=me,this.setupRenderTarget=he,this.updateRenderTargetMipmap=L,this.updateMultisampleRenderTarget=_e,this.setupDepthRenderbuffer=pe,this.setupFrameBufferTexture=I,this.useMultisampledRTT=ye,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function Wd(e,t){function n(n,r=``){let i,a=nr.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===35899)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===`srgb`)if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496||n===37488||n===37489||n===37490||n===37491)if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC;if(n===37488)return i.COMPRESSED_R11_EAC;if(n===37489)return i.COMPRESSED_SIGNED_R11_EAC;if(n===37490)return i.COMPRESSED_RG11_EAC;if(n===37491)return i.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36283)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var Gd=` 4089void main() { 4090 4091 gl_Position = vec4( position, 1.0 ); 4092 4093}`,Kd=` 4094uniform sampler2DArray depthColor; 4095uniform float depthWidth; 4096uniform float depthHeight; 4097 4098void main() { 4099 4100 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 4101 4102 if ( coord.x >= 1.0 ) { 4103 4104 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 4105 4106 } else { 4107 4108 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 4109 4110 } 4111 4112}`,qd=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new bo(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new ms({vertexShader:Gd,fragmentShader:Kd,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new La(new es(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Jd=class extends bn{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new qd,g={},_=t.getContextAttributes(),v=null,y=null,b=[],x=[],S=new U,C=null,w=new rc;w.viewport=new pr;let T=new rc;T.viewport=new pr;let E=[w,T],D=new dc,O=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return t===void 0&&(t=new Jr,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return t===void 0&&(t=new Jr,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return t===void 0&&(t=new Jr,b[e]=t),t.getHandSpace()};function A(e){let t=x.indexOf(e.inputSource);if(t===-1)return;let n=b[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function j(){r.removeEventListener(`select`,A),r.removeEventListener(`selectstart`,A),r.removeEventListener(`selectend`,A),r.removeEventListener(`squeeze`,A),r.removeEventListener(`squeezestart`,A),r.removeEventListener(`squeezeend`,A),r.removeEventListener(`end`,j),r.removeEventListener(`inputsourceschange`,ee);for(let e=0;e<b.length;e++){let t=x[e];t!==null&&(x[e]=null,b[e].disconnect(t))}O=null,k=null,h.reset();for(let e in g)delete g[e];e.setRenderTarget(v),f=null,d=null,u=null,r=null,y=null,ae.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:`sessionend`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&H(`WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&H(`WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return d===null?f:d},this.getBinding=function(){return u===null&&m&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,r!==null){if(v=e.getRenderTarget(),r.addEventListener(`select`,A),r.addEventListener(`selectstart`,A),r.addEventListener(`selectend`,A),r.addEventListener(`squeeze`,A),r.addEventListener(`squeezestart`,A),r.addEventListener(`squeezeend`,A),r.addEventListener(`end`,j),r.addEventListener(`inputsourceschange`,ee),_.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(S),m&&`createProjectionLayer`in XRWebGLBinding.prototype){let n=null,a=null,o=null;_.depth&&(o=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=_.stencil?it:rt,a=_.stencil?Ze:Ke);let s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:i};u=this.getBinding(),d=u.createProjectionLayer(s),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new hr(d.textureWidth,d.textureHeight,{format:nt,type:Ve,depthTexture:new vo(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let n={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:i};f=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new hr(f.framebufferWidth,f.framebufferHeight,{format:nt,type:Ve,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(s),c=null,a=await r.requestReferenceSpace(o),ae.setContext(r),ae.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};function ee(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=x.indexOf(n);r>=0&&(x[r]=null,b[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=x.indexOf(n);if(r===-1){for(let e=0;e<b.length;e++)if(e>=x.length){x.push(n),r=e;break}else if(x[e]===null){x[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let te=new W,M=new W;function ne(e,t,n){te.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=te.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function N(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),D.near=T.near=w.near=t,D.far=T.far=w.far=n,(O!==D.near||k!==D.far)&&(r.updateRenderState({depthNear:D.near,depthFar:D.far}),O=D.near,k=D.far),D.layers.mask=e.layers.mask|6,w.layers.mask=D.layers.mask&-5,T.layers.mask=D.layers.mask&-3;let i=e.parent,a=D.cameras;N(D,i);for(let e=0;e<a.length;e++)N(a[e],i);a.length===2?ne(D,w,T):D.projectionMatrix.copy(w.projectionMatrix),P(e,D,i)};function P(e,t,n){n===null?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=wn*2*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}this.getCamera=function(){return D},this.getFoveation=function(){if(!(d===null&&f===null))return s},this.setFoveation=function(e){s=e,d!==null&&(d.fixedFoveation=e),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return h.texture!==null},this.getDepthSensingMesh=function(){return h.getMesh(D)},this.getCameraTexture=function(e){return g[e]};let re=null;function ie(t,i){if(l=i.getViewerPose(c||a),p=i,l!==null){let t=l.views;f!==null&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let i=!1;t.length!==D.cameras.length&&(D.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(f!==null)a=f.getViewport(r);else{let t=u.getViewSubImage(d,r);a=t.viewport,n===0&&(e.setRenderTargetTextures(y,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(y))}let o=E[n];o===void 0&&(o=new rc,o.layers.enable(n),o.viewport=new pr,E[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),n===0&&(D.matrix.copy(o.matrix),D.matrix.decompose(D.position,D.quaternion,D.scale)),i===!0&&D.cameras.push(o)}let a=r.enabledFeatures;if(a&&a.includes(`depth-sensing`)&&r.depthUsage==`gpu-optimized`&&m){u=n.getBinding();let e=u.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&h.init(e,r.renderState)}if(a&&a.includes(`camera-access`)&&m){e.state.unbindTexture(),u=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new bo,g[n]=e);let t=u.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<b.length;e++){let t=x[e],n=b[e];t!==null&&n!==void 0&&n.update(t,i,c||a)}re&&re(t,i),i.detectedPlanes&&n.dispatchEvent({type:`planesdetected`,data:i}),p=null}let ae=new Bc;ae.setAnimationLoop(ie),this.setAnimationLoop=function(e){re=e},this.dispose=function(){}}},Yd=new vr,Xd=new Zn;Xd.set(-1,0,0,0,1,0,0,0,1);function Zd(e,t){function n(e,t){e.matrixAutoUpdate===!0&&e.updateMatrix(),t.value.copy(e.matrix)}function r(t,n){n.color.getRGB(t.fogColor.value,us(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)}function i(e,t,n,r,i){t.isNodeMaterial?t.uniformsNeedUpdate=!1:t.isMeshBasicMaterial?a(e,t):t.isMeshLambertMaterial?(a(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshToonMaterial?(a(e,t),d(e,t)):t.isMeshPhongMaterial?(a(e,t),u(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshStandardMaterial?(a(e,t),f(e,t),t.isMeshPhysicalMaterial&&p(e,t,i)):t.isMeshMatcapMaterial?(a(e,t),m(e,t)):t.isMeshDepthMaterial?a(e,t):t.isMeshDistanceMaterial?(a(e,t),h(e,t)):t.isMeshNormalMaterial?a(e,t):t.isLineBasicMaterial?(o(e,t),t.isLineDashedMaterial&&s(e,t)):t.isPointsMaterial?c(e,t,n,r):t.isSpriteMaterial?l(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function a(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,r.side===1&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===1&&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);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(Yd.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&a.isRenderTargetTexture===!1&&e.envMapRotation.value.premultiply(Xd),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))}function o(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))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,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)}function l(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)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(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)}function p(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),t.side===1&&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))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let 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}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function Qd(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e<s;e++)if(o.indexOf(e)===-1)return o.push(e),e;return gn(`WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.`),0}function f(t){let n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=r.length;t<n;t++){let n=Array.isArray(r[t])?r[t]:[r[t]];for(let r=0,i=n.length;r<i;r++){let i=n[r];if(p(i,t,r,a)===!0){let t=i.__offset,n=Array.isArray(i.value)?i.value:[i.value],r=0;for(let a=0;a<n.length;a++){let o=n[a],s=h(o);typeof o==`number`||typeof o==`boolean`?(i.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+r,i.__data)):o.isMatrix3?(i.__data[0]=o.elements[0],i.__data[1]=o.elements[1],i.__data[2]=o.elements[2],i.__data[3]=0,i.__data[4]=o.elements[3],i.__data[5]=o.elements[4],i.__data[6]=o.elements[5],i.__data[7]=0,i.__data[8]=o.elements[6],i.__data[9]=o.elements[7],i.__data[10]=o.elements[8],i.__data[11]=0):ArrayBuffer.isView(o)?i.__data.set(new o.constructor(o.buffer,o.byteOffset,i.__data.length)):(o.toArray(i.__data,r),r+=s.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,i.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(e,t,n,r){let i=e.value,a=t+`_`+n;if(r[a]===void 0)return typeof i==`number`||typeof i==`boolean`?r[a]=i:ArrayBuffer.isView(i)?r[a]=i.slice():r[a]=i.clone(),!0;{let e=r[a];if(typeof i==`number`||typeof i==`boolean`){if(e!==i)return r[a]=i,!0}else if(ArrayBuffer.isView(i))return!0;else if(e.equals(i)===!1)return e.copy(i),!0}return!1}function m(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=i[e],a=h(r),o=n%16,s=o%a.boundary,c=o+s;
4112n+=s,c!==0&&16-c<a.storage&&(n+=16-c),t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=a.storage}}}let r=n%16;return r>0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(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?H(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):H(`WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var $d=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,
vendor: 17,224 bytes, line 4112
411214942,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]),ef=null;function tf(){return ef===null&&(ef=new Ba($d,16,16,st,Je),ef.name=`DFG_LUT`,ef.minFilter=ze,ef.magFilter=ze,ef.wrapS=Pe,ef.wrapT=Pe,ef.generateMipmaps=!1,ef.needsUpdate=!0),ef}var nf=class{constructor(e={}){let{canvas:t=dn(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=Ve}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);p=n.getContextAttributes().alpha}else p=a;let m=f,h=new Set([lt,ct,ot]),g=new Set([Ve,Ke,We,Ze,Ye,Xe]),_=new Uint32Array(4),v=new Int32Array(4),y=new W,b=null,x=null,S=[],C=[],w=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;let T=this,E=!1,D=null;this._outputColorSpace=en;let O=0,k=0,A=null,j=-1,ee=null,te=new pr,M=new pr,ne=null,N=new $r(0),P=0,re=t.width,ie=t.height,ae=1,oe=null,se=null,F=new pr(0,0,re,ie),ce=new pr(0,0,re,ie),le=!1,ue=new Ja,I=!1,de=!1,fe=new vr,pe=new W,me=new pr,he={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},L=!1;function ge(){return A===null?ae:1}let R=n;function _e(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r184`),t.addEventListener(`webglcontextlost`,He,!1),t.addEventListener(`webglcontextrestored`,Ue,!1),t.addEventListener(`webglcontextcreationerror`,Ge,!1),R===null){let t=`webgl2`;if(R=_e(t,e),R===null)throw _e(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw gn(`WebGLRenderer: `+e.message),e}let ve,ye,z,be,B,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re;function ze(){ve=new bl(R),ve.init(),Ie=new Wd(R,ve),ye=new Xc(R,ve,e,Ie),z=new Hd(R,ve),ye.reversedDepthBuffer&&d&&z.buffers.depth.setReversed(!0),be=new Cl(R),B=new Sd,xe=new Ud(R,ve,z,B,ye,Ie,be),Se=new yl(T),Ce=new Vc(R),Le=new Jc(R,Ce),we=new xl(R,Ce,be,Le),Te=new Tl(R,we,Ce,Le,be),Ne=new wl(R,ye,xe),Ae=new Zc(B),Ee=new xd(T,Se,ve,ye,Le,Ae),De=new Zd(T,B),Oe=new Ed,ke=new Nd(ve),Me=new qc(T,Se,z,Te,p,s),je=new Vd(T,Te,ye),Re=new Qd(R,be,ye,z),Pe=new Yc(R,ve,be),Fe=new Sl(R,ve,be),be.programs=Ee.programs,T.capabilities=ye,T.extensions=ve,T.properties=B,T.renderLists=Oe,T.shadowMap=je,T.state=z,T.info=be}ze(),m!==1009&&(w=new Dl(m,t.width,t.height,r,i));let V=new Jd(T,R);this.xr=V,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){let e=ve.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=ve.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return ae},this.setPixelRatio=function(e){e!==void 0&&(ae=e,this.setSize(re,ie,!1))},this.getSize=function(e){return e.set(re,ie)},this.setSize=function(e,n,r=!0){if(V.isPresenting){H(`WebGLRenderer: Can't change size while VR device is presenting.`);return}re=e,ie=n,t.width=Math.floor(e*ae),t.height=Math.floor(n*ae),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(re*ae,ie*ae).floor()},this.setDrawingBufferSize=function(e,n,r){re=e,ie=n,ae=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(m===1009){gn(`THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);return}if(e){for(let t=0;t<e.length;t++)if(e[t].isOutputPass===!0){H(`THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.`);break}}w.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(te)},this.getViewport=function(e){return e.copy(F)},this.setViewport=function(e,t,n,r){e.isVector4?F.set(e.x,e.y,e.z,e.w):F.set(e,t,n,r),z.viewport(te.copy(F).multiplyScalar(ae).round())},this.getScissor=function(e){return e.copy(ce)},this.setScissor=function(e,t,n,r){e.isVector4?ce.set(e.x,e.y,e.z,e.w):ce.set(e,t,n,r),z.scissor(M.copy(ce).multiplyScalar(ae).round())},this.getScissorTest=function(){return le},this.setScissorTest=function(e){z.setScissorTest(le=e)},this.setOpaqueSort=function(e){oe=e},this.setTransparentSort=function(e){se=e},this.getClearColor=function(e){return e.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor(...arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(A!==null){let t=A.texture.format;e=h.has(t)}if(e){let e=A.texture.type,t=g.has(e),n=Me.getClearColor(),r=Me.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(_[0]=i,_[1]=a,_[2]=o,_[3]=r,R.clearBufferuiv(R.COLOR,0,_)):(v[0]=i,v[1]=a,v[2]=o,v[3]=r,R.clearBufferiv(R.COLOR,0,v))}else r|=R.COLOR_BUFFER_BIT}t&&(r|=R.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),n&&(r|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),r!==0&&R.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.setNodesHandler=function(e){e.setRenderer(this),D=e},this.dispose=function(){t.removeEventListener(`webglcontextlost`,He,!1),t.removeEventListener(`webglcontextrestored`,Ue,!1),t.removeEventListener(`webglcontextcreationerror`,Ge,!1),Me.dispose(),Oe.dispose(),ke.dispose(),B.dispose(),Se.dispose(),Te.dispose(),Le.dispose(),Re.dispose(),Ee.dispose(),V.dispose(),V.removeEventListener(`sessionstart`,rt),V.removeEventListener(`sessionend`,it),at.stop()};function He(e){e.preventDefault(),mn(`WebGLRenderer: Context Lost.`),E=!0}function Ue(){mn(`WebGLRenderer: Context Restored.`),E=!1;let e=be.autoReset,t=je.enabled,n=je.autoUpdate,r=je.needsUpdate,i=je.type;ze(),be.autoReset=e,je.enabled=t,je.autoUpdate=n,je.needsUpdate=r,je.type=i}function Ge(e){gn(`WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function qe(e){let t=e.target;t.removeEventListener(`dispose`,qe),Qe(t)}function Qe(e){$e(e),B.remove(e)}function $e(e){let t=B.get(e).programs;t!==void 0&&(t.forEach(function(e){Ee.releaseProgram(e)}),e.isShaderMaterial&&Ee.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=he);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=vt(e,t,n,r,i);z.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=we.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Le.setup(i,r,s,n,c);let h,g=Pe;if(c!==null&&(h=Ce.get(c),g=Fe,g.setIndex(h)),i.isMesh)r.wireframe===!0?(z.setLineWidth(r.wireframeLinewidth*ge()),g.setMode(R.LINES)):g.setMode(R.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),z.setLineWidth(e*ge()),i.isLineSegments?g.setMode(R.LINES):i.isLineLoop?g.setMode(R.LINE_LOOP):g.setMode(R.LINE_STRIP)}else i.isPoints?g.setMode(R.POINTS):i.isSprite&&g.setMode(R.TRIANGLES);if(i.isBatchedMesh)if(ve.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?Ce.get(c).bytesPerElement:1,o=B.get(r).currentProgram.getUniforms();for(let r=0;r<n;r++)o.setValue(R,`_gl_DrawID`,r),g.render(e[r]/a,t[r])}else if(i.isInstancedMesh)g.renderInstances(f,m,i.count);else if(n.isInstancedBufferGeometry){let e=n._maxInstanceCount===void 0?1/0:n._maxInstanceCount,t=Math.min(n.instanceCount,e);g.renderInstances(f,m,t)}else g.render(f,m)};function et(e,t,n){e.transparent===!0&&e.side===2&&e.forceSinglePass===!1?(e.side=1,e.needsUpdate=!0,mt(e,t,n),e.side=0,e.needsUpdate=!0,mt(e,t,n),e.side=2):mt(e,t,n)}this.compile=function(e,t,n=null){n===null&&(n=e),x=ke.get(n),x.init(t),C.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();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let i=0;i<t.length;i++){let a=t[i];et(a,n,e),r.add(a)}else et(t,n,e),r.add(t)}),x=C.pop(),r},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){if(r.forEach(function(e){B.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}ve.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let tt=null;function nt(e){tt&&tt(e)}function rt(){at.stop()}function it(){at.start()}let at=new Bc;at.setAnimationLoop(nt),typeof self<`u`&&at.setContext(self),this.setAnimationLoop=function(e){tt=e,V.setAnimationLoop(e),e===null?at.stop():at.start()},V.addEventListener(`sessionstart`,rt),V.addEventListener(`sessionend`,it),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){gn(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(E===!0)return;D!==null&&D.renderStart(e,t);let n=V.enabled===!0&&V.isPresenting===!0,r=w!==null&&(A===null||n)&&w.begin(T,A);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),V.enabled===!0&&V.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(V.cameraAutoUpdate===!0&&V.updateCamera(t),t=V.getCamera()),e.isScene===!0&&e.onBeforeRender(T,e,t,A),x=ke.get(e,C.length),x.init(t),x.state.textureUnits=xe.getTextureUnits(),C.push(x),fe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ue.setFromProjectionMatrix(fe,sn,t.reversedDepth),de=this.localClippingEnabled,I=Ae.init(this.clippingPlanes,de),b=Oe.get(e,S.length),b.init(),S.push(b),V.enabled===!0&&V.isPresenting===!0){let e=T.xr.getDepthSensingMesh();e!==null&&st(e,t,-1/0,T.sortObjects)}st(e,t,0,T.sortObjects),b.finish(),T.sortObjects===!0&&b.sort(oe,se),L=V.enabled===!1||V.isPresenting===!1||V.hasDepthSensing()===!1,L&&Me.addToRenderList(b,e),this.info.render.frame++,I===!0&&Ae.beginShadows();let i=x.state.shadowsArray;if(je.render(i,e,t),I===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset(),(r&&w.hasRenderPass())===!1){let n=b.opaque,r=b.transmissive;if(x.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];dt(n,r,e,a)}L&&Me.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];ut(b,e,n,n.viewport)}}else r.length>0&&dt(n,r,e,t),L&&Me.render(e),ut(b,e,t)}A!==null&&k===0&&(xe.updateMultisampleRenderTarget(A),xe.updateRenderTargetMipmap(A)),r&&w.end(T),e.isScene===!0&&e.onAfterRender(T,e,t),Le.resetDefaultState(),j=-1,ee=null,C.pop(),C.length>0?(x=C[C.length-1],xe.setTextureUnits(x.state.textureUnits),I===!0&&Ae.setGlobalState(T.clippingPlanes,x.state.camera)):x=null,S.pop(),b=S.length>0?S[S.length-1]:null,D!==null&&D.renderEnd()};function st(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLightProbeGrid)x.pushLightProbeGrid(e);else if(e.isLight)x.pushLight(e),e.castShadow&&x.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ue.intersectsSprite(e)){r&&me.setFromMatrixPosition(e.matrixWorld).applyMatrix4(fe);let t=Te.update(e),i=e.material;i.visible&&b.push(e,t,i,n,me.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ue.intersectsObject(e))){let t=Te.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),me.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),me.copy(e.boundingSphere.center)),me.applyMatrix4(e.matrixWorld).applyMatrix4(fe)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a<o;a++){let o=r[a],s=i[o.materialIndex];s&&s.visible&&b.push(e,t,s,n,me.z,o)}}else i.visible&&b.push(e,t,i,n,me.z,null)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)st(i[e],t,n,r)}function ut(e,t,n,r){let{opaque:i,transmissive:a,transparent:o}=e;x.setupLightsView(n),I===!0&&Ae.setGlobalState(T.clippingPlanes,n),r&&z.viewport(te.copy(r)),i.length>0&&ft(i,t,n),a.length>0&&ft(a,t,n),o.length>0&&ft(o,t,n),z.buffers.depth.setTest(!0),z.buffers.depth.setMask(!0),z.buffers.color.setMask(!0),z.setPolygonOffset(!1)}function dt(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(x.state.transmissionRenderTarget[r.id]===void 0){let e=ve.has(`EXT_color_buffer_half_float`)||ve.has(`EXT_color_buffer_float`);x.state.transmissionRenderTarget[r.id]=new hr(1,1,{generateMipmaps:!0,type:e?Je:Ve,minFilter:Be,samples:Math.max(4,ye.samples),stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:nr.workingColorSpace})}let a=x.state.transmissionRenderTarget[r.id],o=r.viewport||te;a.setSize(o.z*T.transmissionResolutionScale,o.w*T.transmissionResolutionScale);let s=T.getRenderTarget(),c=T.getActiveCubeFace(),l=T.getActiveMipmapLevel();T.setRenderTarget(a),T.getClearColor(N),P=T.getClearAlpha(),P<1&&T.setClearColor(16777215,.5),T.clear(),L&&Me.render(n);let u=T.toneMapping;T.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),x.setupLightsView(r),I===!0&&Ae.setGlobalState(T.clippingPlanes,r),ft(e,n,r),xe.updateMultisampleRenderTarget(a),xe.updateRenderTargetMipmap(a),ve.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i<a;i++){let{object:a,geometry:o,material:s,group:c}=t[i];if(s.side===2&&a.layers.test(r.layers)){let t=s.side;s.side=1,s.needsUpdate=!0,pt(a,n,r,o,s,c),s.side=t,s.needsUpdate=!0,e=!0}}e===!0&&(xe.updateMultisampleRenderTarget(a),xe.updateRenderTargetMipmap(a))}T.setRenderTarget(s,c,l),T.setClearColor(N,P),d!==void 0&&(r.viewport=d),T.toneMapping=u}function ft(e,t,n){let r=t.isScene===!0?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],{object:o,geometry:s,group:c}=a,l=a.material;l.allowOverride===!0&&r!==null&&(l=r),o.layers.test(n.layers)&&pt(o,t,n,s,l,c)}}function pt(e,t,n,r,i,a){e.onBeforeRender(T,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(T,t,n,r,e,a),i.transparent===!0&&i.side===2&&i.forceSinglePass===!1?(i.side=1,i.needsUpdate=!0,T.renderBufferDirect(n,t,r,i,e,a),i.side=0,i.needsUpdate=!0,T.renderBufferDirect(n,t,r,i,e,a),i.side=2):T.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(T,t,n,r,i,a)}function mt(e,t,n){t.isScene!==!0&&(t=he);let r=B.get(e),i=x.state.lights,a=x.state.shadowsArray,o=i.state.ver
4112sion,s=Ee.getParameters(e,i.state,a,t,n,x.state.lightProbeGridArray),c=Ee.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,r.fog=t.fog;let u=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;r.envMap=Se.get(e.envMap||r.environment,u),r.envMapRotation=r.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation,l===void 0&&(e.addEventListener(`dispose`,qe),l=new Map,r.programs=l);let d=l.get(c);if(d!==void 0){if(r.currentProgram===d&&r.lightsStateVersion===o)return gt(e,s),d}else s.uniforms=Ee.getUniforms(e),D!==null&&e.isNodeMaterial&&D.build(e,n,s),e.onBeforeCompile(s,T),d=Ee.acquireProgram(s,c),l.set(c,d),r.uniforms=s.uniforms;let f=r.uniforms;return(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(f.clippingPlanes=Ae.uniform),gt(e,s),r.needsLights=bt(e),r.lightsStateVersion=o,r.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.ltc_1.value=i.state.rectAreaLTC1,f.ltc_2.value=i.state.rectAreaLTC2,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotLightMatrix.value=i.state.spotLightMatrix,f.spotLightMap.value=i.state.spotLightMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix),r.lightProbeGrid=x.state.lightProbeGridArray.length>0,r.currentProgram=d,r.uniformsList=null,d}function ht(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=Pu.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function gt(e,t){let n=B.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}function _t(e,t){if(e.length===0)return null;if(e.length===1)return e[0].texture===null?null:e[0];y.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n.texture!==null&&n.boundingBox.containsPoint(y))return n}return null}function vt(e,t,n,r,i){t.isScene!==!0&&(t=he),xe.resetTextureUnits();let a=t.fog,o=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?t.environment:null,s=A===null?T.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:nr.workingColorSpace,c=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,l=Se.get(r.envMap||o,c),u=r.vertexColors===!0&&!!n.attributes.color&&n.attributes.color.itemSize===4,d=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=0;r.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(h=T.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=B.get(r),y=x.state.lights;if(I===!0&&(de===!0||e!==ee)){let t=e===ee&&r.id===j;Ae.setState(r,e,t)}let b=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?b=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?b=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Ae.numPlanes||v.numIntersection!==Ae.numIntersection)?b=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h&&v.morphTargetsCount===_?!!v.lightProbeGrid!=x.state.lightProbeGridArray.length>0&&(b=!0):b=!0:b=!0:b=!0:(b=!0,v.__version=r.version);let S=v.currentProgram;b===!0&&(S=mt(r,t,i),D&&r.isNodeMaterial&&D.onUpdateProgram(r,S,v));let C=!1,w=!1,E=!1,O=S.getUniforms(),k=v.uniforms;
vendor: 4,917 bytes, line 4112
4112if(z.useProgram(S.program)&&(C=!0,w=!0,E=!0),r.id!==j&&(j=r.id,w=!0),v.needsLights){let e=_t(x.state.lightProbeGridArray,i);v.lightProbeGrid!==e&&(v.lightProbeGrid=e,w=!0)}if(C||ee!==e){z.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(R,`projectionMatrix`,e.projectionMatrix),O.setValue(R,`viewMatrix`,e.matrixWorldInverse);let t=O.map.cameraPosition;t!==void 0&&t.setValue(R,pe.setFromMatrixPosition(e.matrixWorld)),ye.logarithmicDepthBuffer&&O.setValue(R,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&O.setValue(R,`isOrthographic`,e.isOrthographicCamera===!0),ee!==e&&(ee=e,w=!0,E=!0)}if(v.needsLights&&(y.state.directionalShadowMap.length>0&&O.setValue(R,`directionalShadowMap`,y.state.directionalShadowMap,xe),y.state.spotShadowMap.length>0&&O.setValue(R,`spotShadowMap`,y.state.spotShadowMap,xe),y.state.pointShadowMap.length>0&&O.setValue(R,`pointShadowMap`,y.state.pointShadowMap,xe)),i.isSkinnedMesh){O.setOptional(R,i,`bindMatrix`),O.setOptional(R,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),O.setValue(R,`boneTexture`,e.boneTexture,xe))}i.isBatchedMesh&&(O.setOptional(R,i,`batchingTexture`),O.setValue(R,`batchingTexture`,i._matricesTexture,xe),O.setOptional(R,i,`batchingIdTexture`),O.setValue(R,`batchingIdTexture`,i._indirectTexture,xe),O.setOptional(R,i,`batchingColorTexture`),i._colorsTexture!==null&&O.setValue(R,`batchingColorTexture`,i._colorsTexture,xe));let te=n.morphAttributes;if((te.position!==void 0||te.normal!==void 0||te.color!==void 0)&&Ne.update(i,n,S),(w||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,O.setValue(R,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(k.envMapIntensity.value=t.environmentIntensity),k.dfgLUT!==void 0&&(k.dfgLUT.value=tf()),w){if(O.setValue(R,`toneMappingExposure`,T.toneMappingExposure),v.needsLights&&yt(k,E),a&&r.fog===!0&&De.refreshFogUniforms(k,a),De.refreshMaterialUniforms(k,r,ae,ie,x.state.transmissionRenderTarget[e.id]),v.needsLights&&v.lightProbeGrid){let e=v.lightProbeGrid;k.probesSH.value=e.texture,k.probesMin.value.copy(e.boundingBox.min),k.probesMax.value.copy(e.boundingBox.max),k.probesResolution.value.copy(e.resolution)}Pu.upload(R,ht(v),k,xe)}if(r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(Pu.upload(R,ht(v),k,xe),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&O.setValue(R,`center`,i.center),O.setValue(R,`modelViewMatrix`,i.modelViewMatrix),O.setValue(R,`normalMatrix`,i.normalMatrix),O.setValue(R,`modelMatrix`,i.matrixWorld),r.uniformsGroups!==void 0){let e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];Re.update(n,S),Re.bind(n,S)}}return S}function yt(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function bt(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.getActiveCubeFace=function(){return O},this.getActiveMipmapLevel=function(){return k},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(e,t,n){let r=B.get(e);r.__autoAllocateDepthBuffer=e.resolveDepthBuffer===!1,r.__autoAllocateDepthBuffer===!1&&(r.__useRenderToTexture=!1),B.get(e.texture).__webglTexture=t,B.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=B.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=t===void 0};let xt=R.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){A=e,O=t,k=n;let r=null,i=!1,a=!1;if(e){let o=B.get(e);if(o.__useDefaultFramebuffer!==void 0){z.bindFramebuffer(R.FRAMEBUFFER,o.__webglFramebuffer),te.copy(e.viewport),M.copy(e.scissor),ne=e.scissorTest,z.viewport(te),z.scissor(M),z.setScissorTest(ne),j=-1;return}else if(o.__webglFramebuffer===void 0)xe.setupRenderTarget(e);else if(o.__hasExternalTextures)xe.rebindTextures(e,B.get(e.texture).__webglTexture,B.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(o.__boundDepthTexture!==t){if(t!==null&&B.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error(`WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.`);xe.setupDepthRenderbuffer(e)}}let s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(a=!0);let c=B.get(e).__webglFramebuffer;
vendor: 4,470 bytes, line 4112
4112e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],i=!0):r=e.samples>0&&xe.useMultisampledRTT(e)===!1?B.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,te.copy(e.viewport),M.copy(e.scissor),ne=e.scissorTest}else te.copy(F).multiplyScalar(ae).floor(),M.copy(ce).multiplyScalar(ae).floor(),ne=le;if(n!==0&&(r=xt),z.bindFramebuffer(R.FRAMEBUFFER,r)&&z.drawBuffers(e,r),z.viewport(te),z.scissor(M),z.setScissorTest(ne),i){let r=B.get(e.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t<e.textures.length;t++){let i=B.get(e.textures[t]);R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0+t,i.__webglTexture,n,r)}}else if(e!==null&&n!==0){let t=B.get(e.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,t.__webglTexture,n)}j=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){gn(`WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=B.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){z.bindFramebuffer(R.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(e.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+s),!ye.textureFormatReadable(c)){gn(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!ye.textureTypeReadable(l)){gn(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&R.readPixels(t,n,r,i,Ie.convert(c),Ie.convert(l),a)}finally{let e=A===null?null:B.get(A).__webglFramebuffer;z.bindFramebuffer(R.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=B.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){z.bindFramebuffer(R.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(e.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+s),!ye.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!ye.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,d),R.bufferData(R.PIXEL_PACK_BUFFER,a.byteLength,R.STREAM_READ),R.readPixels(t,n,r,i,Ie.convert(l),Ie.convert(u),0);let f=A===null?null:B.get(A).__webglFramebuffer;z.bindFramebuffer(R.FRAMEBUFFER,f);let p=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await vn(R,p,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,d),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,a),R.deleteBuffer(d),R.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;xe.setTexture2D(e,0),R.copyTexSubImage2D(R.TEXTURE_2D,n,0,0,o,s,i,a),z.unbindTexture()};let St=R.createFramebuffer(),Ct=R.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ie.convert(t.format),_=Ie.convert(t.type),v;t.isData3DTexture?(xe.setTexture3D(t,0),v=R.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(xe.setTexture2DArray(t,0),v=R.TEXTURE_2D_ARRAY):(xe.setTexture2D(t,0),v=R.TEXTURE_2D),z.activeTexture(R.TEXTURE0),z.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,t.flipY),z.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),z.pixelStorei(R.UNPACK_ALIGNMENT,t.unpackAlignment);let y=z.getParameter(R.UNPACK_ROW_LENGTH),b=z.getParameter(R.UNPACK_IMAGE_HEIGHT),x=z.getParameter(R.UNPACK_SKIP_PIXELS),S=z.getParameter(R.UNPACK_SKIP_ROWS),
4112C=z.getParameter(R.UNPACK_SKIP_IMAGES);z.pixelStorei(R.UNPACK_ROW_LENGTH,h.width),z.pixelStorei(R.UNPACK_IMAGE_HEIGHT,h.height),z.pixelStorei(R.UNPACK_SKIP_PIXELS,l),z.pixelStorei(R.UNPACK_SKIP_ROWS,u),z.pixelStorei(R.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=B.get(e),r=B.get(t),h=B.get(n.__renderTarget),g=B.get(r.__renderTarget);z.bindFramebuffer(R.READ_FRAMEBUFFER,h.__webglFramebuffer),z.bindFramebuffer(R.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<c;n++)w&&(R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,B.get(e).__webglTexture,i,d+n),R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,B.get(t).__webglTexture,a,m+n)),R.blitFramebuffer(l,u,o,s,f,p,o,s,R.DEPTH_BUFFER_BIT,R.NEAREST);z.bindFramebuffer(R.READ_FRAMEBUFFER,null),z.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else if(i!==0||e.isRenderTargetTexture||B.has(e)){let n=B.get(e),r=B.get(t);z.bindFramebuffer(R.READ_FRAMEBUFFER,St),z.bindFramebuffer(R.DRAW_FRAMEBUFFER,Ct);for(let e=0;e<c;e++)w?R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,n.__webglTexture,i,d+e):R.framebufferTexture2D(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,n.__webglTexture,i),T?R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,r.__webglTexture,a,m+e):R.framebufferTexture2D(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,r.__webglTexture,a),i===0?T?R.copyTexSubImage3D(v,a,f,p,m+e,l,u,o,s):R.copyTexSubImage2D(v,a,f,p,l,u,o,s):R.blitFramebuffer(l,u,o,s,f,p,o,s,R.COLOR_BUFFER_BIT,R.NEAREST);z.bindFramebuffer(R.READ_FRAMEBUFFER,null),z.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?R.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h.data):t.isCompressedArrayTexture?R.compressedTexSubImage3D(v,a,f,p,m,o,s,c,g,h.data):R.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h):e.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,a,f,p,o,s,g,_,h.data):e.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,a,f,p,h.width,h.height,g,h.data):R.texSubImage2D(R.TEXTURE_2D,a,f,p,o,s,g,_,h);z.pixelStorei(R.UNPACK_ROW_LENGTH,y),z.pixelStorei(R.UNPACK_IMAGE_HEIGHT,b),z.pixelStorei(R.UNPACK_SKIP_PIXELS,x),z.pixelStorei(R.UNPACK_SKIP_ROWS,S),z.pixelStorei(R.UNPACK_SKIP_IMAGES,C),a===0&&t.generateMipmaps&&R.generateMipmap(v),z.unbindTexture()},this.initRenderTarget=function(e){B.get(e).__webglFramebuffer===void 0&&xe.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?xe.setTextureCube(e,0):e.isData3DTexture?xe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?xe.setTexture2DArray(e,0):xe.setTexture2D(e,0),z.unbindTexture()},this.resetState=function(){O=0,k=0,A=null,z.reset(),Le.reset()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}get coordinateSystem(){return sn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=nr._getDrawingBufferColorSpace(e),t.unpackColorSpace=nr._getUnpackColorSpace()}},rf=0,af=1,of=new W,sf=new Ic,cf=new Wa,lf=new W,uf=new hi,df=class{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new hf,this.unassigned=new hf,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.vertices.push(new mf(e[t]));this._compute()}return this}setFromObject(e){let t=[];return e.updateMatrixWorld(!0),e.traverse(function(e){let n=e.geometry;if(n!==void 0){let r=n.attributes.position;if(r!==void 0)for(let n=0,i=r.count;n<i;n++){let i=new W;i.fromBufferAttribute(r,n).applyMatrix4(e.matrixWorld),t.push(i)}}}),this.setFromPoints(t)}containsPoint(e){let t=this.faces;for(let n=0,r=t.length;n<r;n++)if(t[n].distanceToPoint(e)>this.tolerance)return!1;return!0}intersectRay(e,t){let n=this.faces,r=-1/0,i=1/0;for(let t=0,a=n.length;t<a;t++){let a=n[t],o=a.distanceToPoint(e.origin),s=a.normal.dot(e.direction);if(o>0&&s>=0)return null;let c=s===0?0:-o/s;if(!(c<=0)&&(s>0?i=Math.min(c,i):r=Math.max(c,r),r>i))return null}return r===-1/0?e.at(i,t):e.at(r,t),t}intersectsRay(e){return this.intersectRay(e,of)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}_addVertexToFace(e,t){return e.face=t,t.outside===null?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}_removeVertexFromFace(e,t){return e===t.outside&&(e.next!==null&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}_removeAllVerticesFromFace(e){if(e.outside!==null){let t=e.outside,n=e.outside;for(;n.next!==null&&n.next.face===e;)n=n.next;return this.assigned.removeSubList(t,n),t.prev=n.next=null,e.outside=null,t}}_deleteFaceVertices(e,t){let n=this._removeAllVerticesFromFace(e);if(n!==void 0)if(t===void 0)this.unassigned.appendChain(n);else{let e=n;do{let n=e.next;t.distanceToPoint(e.point)>this.tolerance?this._addVertexToFace(e,t):this.unassigned.append(e),e=n}while(e!==null)}return this}_resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{let n=t.next,r=this.tolerance,i=null;for(let n=0;n<e.length;n++){let a=e[n];if(a.mark===rf){let e=a.distanceToPoint(t.point);if(e>r&&(r=e,i=a),r>1e3*this.tolerance)break}}i!==null&&this._addVertexToFace(t,i),t=n}while(t!==null)}return this}_computeExtremes(){let e=new W,t=new W,n=[],r=[];for(let e=0;e<3;e++)n[e]=r[e]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let i=0,a=this.vertices.length;i<a;i++){let a=this.vertices[i],o=a.point;for(let t=0;t<3;t++)o.getComponent(t)<e.getComponent(t)&&(e.setComponent(t,o.getComponent(t)),n[t]=a);for(let e=0;e<3;e++)o.getComponent(e)>t.getComponent(e)&&(t.setComponent(e,o.getComponent(e)),r[e]=a)}return this.tolerance=3*2**-52*(Math.max(Math.abs(e.x),Math.abs(t.x))+Math.max(Math.abs(e.y),Math.abs(t.y))+Math.max(Math.abs(e.z),Math.abs(t.z))),{min:n,max:r}}_computeInitialHull(){let e=this.vertices,t=this._computeExtremes(),n=t.min,r=t.max,i=0,a=0;for(let e=0;e<3;e++){let t=r[e].point.getComponent(e)-n[e].point.getComponent(e);t>i&&(i=t,a=e)}let o=n[a],s=r[a],c,l;i=0,sf.set(o.point,s.point);for(let t=0,n=this.vertices.length;t<n;t++){let n=e[t];if(n!==o&&n!==s){sf.closestPointToPoint(n.point,!0,lf);let e=lf.distanceToSquared(n.point);e>i&&(i=e,c=n)}}i=-1,cf.setFromCoplanarPoints(o.point,s.point,c.point);for(let t=0,n=this.vertices.length;t<n;t++){let n=e[t];if(n!==o&&n!==s&&n!==c){let e=Math.abs(cf.distanceToPoint(n.point));e>i&&(i=e,l=n)}}let u=[];
4112if(cf.distanceToPoint(l.point)<0){u.push(ff.create(o,s,c),ff.create(l,s,o),ff.create(l,c,s),ff.create(l,o,c));for(let e=0;e<3;e++){let t=(e+1)%3;u[e+1].getEdge(2).setTwin(u[0].getEdge(t)),u[e+1].getEdge(1).setTwin(u[t+1].getEdge(0))}}else{u.push(ff.create(o,c,s),ff.create(l,o,s),ff.create(l,s,c),ff.create(l,c,o));for(let e=0;e<3;e++){let t=(e+1)%3;u[e+1].getEdge(2).setTwin(u[0].getEdge((3-e)%3)),u[e+1].getEdge(0).setTwin(u[t+1].getEdge(1))}}for(let e=0;e<4;e++)this.faces.push(u[e]);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n!==o&&n!==s&&n!==c&&n!==l){i=this.tolerance;let e=null;for(let t=0;t<4;t++){let r=this.faces[t].distanceToPoint(n.point);r>i&&(i=r,e=this.faces[t])}e!==null&&this._addVertexToFace(n,e)}}return this}_reindexFaces(){let e=[];for(let t=0;t<this.faces.length;t++){let n=this.faces[t];n.mark===rf&&e.push(n)}return this.faces=e,this}_nextVertexToAdd(){if(this.assigned.isEmpty()===!1){let e,t=0,n=this.assigned.first().face,r=n.outside;do{let i=n.distanceToPoint(r.point);i>t&&(t=i,e=r),r=r.next}while(r!==null&&r.face===n);return e}}_computeHorizon(e,t,n,r){this._deleteFaceVertices(n),n.mark=af;let i;i=t===null?t=n.getEdge(0):t.next;do{let t=i.twin,n=t.face;n.mark===rf&&(n.distanceToPoint(e)>this.tolerance?this._computeHorizon(e,t,n,r):r.push(i)),i=i.next}while(i!==t);return this}_addAdjoiningFace(e,t){let n=ff.create(e,t.tail(),t.head());return this.faces.push(n),n.getEdge(-1).setTwin(t.twin),n.getEdge(0)}_addNewFaces(e,t){this.newFaces=[];let n=null,r=null;for(let i=0;i<t.length;i++){let a=t[i],o=this._addAdjoiningFace(e,a);n===null?n=o:o.next.setTwin(r),this.newFaces.push(o.face),r=o}return n.next.setTwin(r),this}_addVertexToHull(e){let t=[];return this.unassigned.clear(),this._removeVertexFromFace(e,e.face),this._computeHorizon(e.point,null,e.face,t),this._addNewFaces(e,t),this._resolveUnassignedPoints(this.newFaces),this}_cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}_compute(){let e;for(this._computeInitialHull();(e=this._nextVertexToAdd())!==void 0;)this._addVertexToHull(e);return this._reindexFaces(),this._cleanup(),this}},ff=class e{constructor(){this.normal=new W,this.midpoint=new W,this.area=0,this.constant=0,this.outside=null,this.mark=rf,this.edge=null}static create(t,n,r){let i=new e,a=new pf(t,i),o=new pf(n,i),s=new pf(r,i);return a.next=s.prev=o,o.next=a.prev=s,s.next=o.prev=a,i.edge=a,i.compute()}getEdge(e){let t=this.edge;for(;e>0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t}compute(){let e=this.edge.tail(),t=this.edge.head(),n=this.edge.next.head();return uf.set(e.point,t.point,n.point),uf.getNormal(this.normal),uf.getMidpoint(this.midpoint),this.area=uf.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}},pf=class{constructor(e,t){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=t}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){let e=this.head(),t=this.tail();return t===null?-1:t.point.distanceTo(e.point)}lengthSquared(){let e=this.head(),t=this.tail();return t===null?-1:t.point.distanceToSquared(e.point)}setTwin(e){return this.twin=e,e.twin=this,this}},mf=class{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}},hf=class{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,t){return t.prev=e.prev,t.next=e,t.prev===null?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,t.next===null?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return e.prev===null?this.head=t.next:e.prev.next=t.next,t.next===null?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return this.head===null}},gf=class extends Yi{constructor(e=[]){super();let t=[],n=[],r=new df().setFromPoints(e).faces;for(let e=0;e<r.length;e++){let i=r[e],a=i.edge;do{let e=a.head().point;t.push(e.x,e.y,e.z),n.push(i.normal.x,i.normal.y,i.normal.z),a=a.next}while(a!==i.edge)}this.setAttribute(`position`,new Li(t,3)),this.setAttribute(`normal`,new Li(n,3))}};function _f(e,t=10){return Math.max(2,Math.min(100,Math.round(Number.isFinite(e)?e:t)))}function vf(e){return!e.macPherson&&(e.configuration===`Pushrod`||e.configuration===`Pullrod`)}function yf(e){return vf(e)?e.mainSpring:!0}function bf(e){return yf(e.suspension)}function xf(e){return{x:e.x,y:-e.y,z:e.z}}function Sf(e){return{chassis:{topFront:xf(e.chassis.topFront),top
4112Rear:xf(e.chassis.topRear),bottomFront:xf(e.chassis.bottomFront),bottomRear:xf(e.chassis.bottomRear),tieRod:xf(e.chassis.tieRod),pushRod:xf(e.chassis.pushRod),spring:xf(e.chassis.spring)},wheel:{topFront:xf(e.wheel.topFront),topRear:xf(e.wheel.topRear),bottomFront:xf(e.wheel.bottomFront),bottomRear:xf(e.wheel.bottomRear),tieRod:xf(e.wheel.tieRod),pushRod:xf(e.wheel.pushRod),spring:xf(e.wheel.spring)},rocker:{axisStart:xf(e.rocker.axisStart),axisEnd:xf(e.rocker.axisEnd)},wheelCenter:xf(e.wheelCenter)}}function Cf(e,t){let n=Math.max(0,Math.min(Math.abs(e.bumpMax),Math.abs(e.reboundMax))),r=Math.atan(n/Math.max(Math.abs(t),1e-9))*(180/Math.PI);return!Number.isFinite(r)||r<=1e-9?{min:0,max:0}:{min:-r,max:r}}function wf(e){return _f(e.bumpSteps)}function Tf(e){return Number.isFinite(e)?e.toLocaleString(`en-US`,{useGrouping:!1,maximumFractionDigits:2,minimumFractionDigits:Number.isInteger(e)?0:2}):`0`}var Ef=Math.PI/180,Df=1e-5;function Of(e,t){let n=e[t];if(n===void 0)return null;let r=Number(n.trim().replace(`,`,`.`));return Number.isFinite(r)?r:null}function kf(e){return e.geometry.left.wheelCenter.y>=e.geometry.right.wheelCenter.y?`left`:`right`}function Af(e){return(e.fields[`SemiAxis Fixed Joint`]?.trim().toLowerCase()??`chassis`)===`wheel`?`Wheel`:`Chassis`}function jf(e,t,n){let r=e.vehicle.camber*Ef,i=e.vehicle.toe*Ef;return t===`left`?[r,i,0,n.x,n.y,n.z]:[-r,-i,0,n.x,n.y,n.z]}function Mf(e,t){let[n,r,i,a,o,s]=e,c=Math.cos(n),l=Math.sin(n),u=Math.cos(r),d=Math.sin(r),f=Math.cos(i),p=Math.sin(i);return{x:u*f*t.x-d*t.y+u*p*t.z+a,y:(c*d*f+l*p)*t.x+c*u*t.y+(c*d*p-l*f)*t.z+o,z:(l*d*f-c*p)*t.x+l*u*t.y+(l*d*p+c*f)*t.z+s}}function Nf(e,t){let n=Of(e.fields,`Distance SemiAxis`);if(n===null)return null;let r=Math.abs(n);return t===kf(e)?r:-r}function Pf(e,t){let n=Of(e.fields,`WheelCenterX`),r=Of(e.fields,`WheelCenterY`),i=Of(e.fields,`WheelCenterZ`);if(n===null||r===null||i===null)return null;let a={x:n,y:r,z:i};return t===kf(e)?a:xf(a)}function Ff(e,t){let n=Nf(e,t);if(n===null)return null;let r=Pf(e,t);return r?Mf(jf(e,t,r),{x:0,y:-n+Df,z:0}):null}function If(e,t){let n=zf(e,t),r=Ff(e,t);return!n||!r?null:Math.hypot(r.x-n.x,r.y-n.y,r.z-n.z)}function Lf(e,t,n){let r=t.x-e.x,i=t.z-e.z,a=n*n-r*r-i*i;if(a<0)return a>-1e-6?{x:e.x,y:t.y,z:e.z}:e;let o=Math.sqrt(a),s=[t.y+o,t.y-o],c=s.reduce((t,n)=>Math.abs(n-e.y)<Math.abs(t-e.y)?n:t,s[0]);return{x:e.x,y:c,z:e.z}}function Rf(e,t,n,r){let i={x:t.x-e.x,y:t.y-e.y,z:t.z-e.z},a=Math.hypot(i.x,i.y,i.z);if(a<=1e-9)return null;let o={x:i.x/a,y:i.y/a,z:i.z/a},s={x:e.x-n.x,y:e.y-n.y,z:e.z-n.z},c=s.x*o.x+s.y*o.y+s.z*o.z,l=s.x*s.x+s.y*s.y+s.z*s.z-r*r,u=c*c-l;if(u<-1e-6)return null;let d=Math.sqrt(Math.max(u,0)),f=[-c+d,-c-d],p=(t.x-e.x)*o.x+(t.y-e.y)*o.y+(t.z-e.z)*o.z,m=f.reduce((e,t)=>Math.abs(t-p)<Math.abs(e-p)?t:e,f[0]);return{x:e.x+o.x*m,y:e.y+o.y*m,z:e.z+o.z*m}}function zf(e,t){let n=Of(e.fields,`X SemiAxis`),r=Of(e.fields,`Y SemiAxis`),i=Of(e.fields,`Z SemiAxis`);if(n===null||r===null||i===null)return null;let a={x:n,y:r,z:i};return t===kf(e)?a:xf(a)}function Bf(e,t,n){let r=Nf(e,t);if(r===null)return null;let i=Mf(e.motion?.wheelPoses?.[t]??jf(e,t,n.wheelCenter),{x:0,y:-r+Df,z:0});if(Af(e)!==`Chassis`)return i;let a=If(e,t);return a===null?i:Rf(n.wheelCenter,i,zf(e,t)??i,a)??i}function Vf(e,t,n,r){let i=Nf(e,t);if(i===null)return null;if(Af(e)!==`Chassis`){let i=zf(e,t),a=Hf(r?{...e,motion:{...e.motion,wheelPoses:{...e.motion?.wheelPoses??{},[t]:r}}}:e,t,n);return!i||!a?null:a.y-i.y}let a=r??e.motion?.wheelPoses?.[t]??jf(e,t,n.wheelCenter),o=Bf(r?{...e,motion:{...e.motion,wheelPoses:{...e.motion?.wheelPoses??{},[t]:r}}}:e,t,n);if(!o)return null;let s={x:a[3],y:a[4],z:a[5]},c=Mf(a,{x:0,y:1,z:0}),l={x:c.x-s.x,y:c.y-s.y,z:c.z-s.z},u=Math.hypot(l.x,l.y,l.z);if(u<=1e-9)return Math.abs(i);let d={x:o.x-s.x,y:o.y-s.y,z:o.z-s.z},f=(d.x*l.x+d.y*l.y+d.z*l.z)/u;return Math.abs(f)}function Hf(e,t,n){let r=zf(e,t);if(!r)return null;if(Af(e)!==`Wheel`)return r;let i=Ff(e,t),a=Bf(e,t,n);if(!i||!a)return r;let o=If(e,t);return o===null?r:Lf(r,a,o)}function Uf(e,t){return{x:(e.x+t.x)*.5,y:(e.y+t.y)*.5,z:(e.z+t.z)*.5}}function Wf(e,t,n,r){let i=t.y-e.y,a=t.z-e.z;return Math.abs(i)>=Math.abs(a)&&Math.abs(i)>1e-9?(n-e.y)/i:Math.abs(a)>1e-9?(r-e.z)/a:null}function Gf(e,t,n,r){let i=Wf(e,t,n,r);return{x:i===null?(e.x+t.x)*.5:e.x+(t.x-e.x)*i,y:n,z:r}}function Kf(e,t,n,r){let i=e.y,a=e.z,o=t.y,s=t.z,c=n.y,l=n.z,u=r.y,d=r.z,f=(i-o)*(l-d)-(a-s)*(c-u);if(Math.abs(f)<1e-9)return null;let p=((i*s-a*o)*(c-u)-(i-o)*(c*d-l*u))/f,m=((i*s-a*o)*(l-d)-(a-s)*(c*d-l*u))/f,h=Gf(e,t,p,m),g=Gf(n,r,p,m);return{x:(h.x+g.x)*.5,y:p,z:m}}function qf(e,t,n=!1){return n?Uf(e,t):e}function Jf(e,t){let n=e.chassis.pushRod,r=e.wheel.pushRod,i=Uf(e.chassis.bottomFront,e.chassis.bottomRear),a=qf(e.wheel.bottomFront,e.wheel.bottomRear,t.useBottomRearWheelPoint),o=n.y-r.y,s=n.z-r.z;return Math.hypot(o,s)<=1e-9?null:Kf(n,{x:n.x,y:n.y-s,z:n.z+o},i,a)}function Yf(e,t={}){if(t.macPherson){let n=Jf(e,t);if(n)return n}return Kf(Uf(e.chassis.topFront,e.chassis.topRear),qf(e.wheel.to
4112pFront,e.wheel.topRear,t.useTopRearWheelPoint),Uf(e.chassis.bottomFront,e.chassis.bottomRear),qf(e.wheel.bottomFront,e.wheel.bottomRear,t.useBottomRearWheelPoint))}function Xf(e,t,n){let r=t.y-e.y;if(Math.abs(r)<=1e-9)return(e.z+t.z)*.5;let i=(n-e.y)/r;return e.z+(t.z-e.z)*i}function Zf(e,t,n,r,i={}){let a=Yf(e,i),o=Yf(t,i);if(!a||!o)return null;let s=Kf(n,a,r,o);if(!s)return null;let c={...s,x:i.centerX??s.x};return{center:c,leftContact:r,rightContact:n,leftInstantCenter:o,rightInstantCenter:a,groundZAtCenter:Xf(r,n,c.y)}}var Qf=`HP_DSW`,$f=`HP_PIN`,ep=30;function tp(e){return e===Qf||e===$f}var np={upper:`#e85555`,lower:`#4c8df5`,tie:`#7dd3fc`,push:`#f59e0b`,spring:`#8bd450`,heave:`#f8d857`,roll:`#c084fc`,arb:`#f97316`,arbLink:`#fbbf24`,rocker:`#f6c543`,upright:`#7ee787`,semiAxis:`#9ca3af`,reference:`#9fe870`,steeringAxis:`#ffffff`,groundLine:`#d1d5db`,steeringLine:`#7dd3fc`,steeringWheel:`#4b5563`,point:`#d9e2ea`,wheel:`#6b7280`},rp=Math.PI/180;function ip(e){return e.x!==0||e.y!==0||e.z!==0}function ap(e,t,n){let r={x:t.x-e.x,y:t.y-e.y,z:t.z-e.z},i={x:n.x-e.x,y:n.y-e.y,z:n.z-e.z},a={x:r.y*i.z-r.z*i.y,y:r.z*i.x-r.x*i.z,z:r.x*i.y-r.y*i.x},o=a.x*a.x+a.y*a.y+a.z*a.z;return Number.isFinite(o)&&o>1e-8}function op(e){let t=Math.abs(e.vehicle.rimWidth)*25.4;if(t>1e-6)return t;let n=Math.abs(e.vehicle.tyreWidth);return n>1e-6?n:e.vehicle.wheelRadius*.8}function sp(e){return e.vehicle.rimDiameter>0?e.vehicle.rimDiameter*25.4/2:e.vehicle.wheelRadius*.55}function cp(e,t){let n=Number.isFinite(e.vehicle.rimOffset)?e.vehicle.rimOffset:0;return t===Yp(e)?n:-n}function lp(e,t,n){let r=e.vehicle.camber*rp,i=e.vehicle.toe*rp;return t===`left`?[r,i,0,n.x,n.y,n.z]:[-r,-i,0,n.x,n.y,n.z]}function up(e,t,n){return e.motion?.wheelPoses?.[t]??lp(e,t,n)}function dp(e,t){return[e[0],e[1],t,e[3],e[4],e[5]]}function fp([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function pp(e,t){let n=fp(e);return{x:n[0][0]*t.x+n[0][1]*t.y+n[0][2]*t.z+e[3],y:n[1][0]*t.x+n[1][1]*t.y+n[1][2]*t.z+e[4],z:n[2][0]*t.x+n[2][1]*t.y+n[2][2]*t.z+e[5]}}function mp(e,t){let n=dp(e,0),r=fp(n),i=r[2][0],a=r[2][2],o=Math.hypot(i,a)||1;return pp(n,{x:-t*i/o,y:0,z:-t*a/o})}function hp(e,t,n){let r=e.motion?.elements;return t===`right`&&r?.contactPatchRight?r.contactPatchRight:t===`left`&&r?.contactPatchLeft?r.contactPatchLeft:mp(up(e,t,n.wheelCenter),e.vehicle.wheelRadius)}function gp(e){return e?Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z):!1}function _p(e,t,n){let r=n.y-t.y;if(Math.abs(r)<=1e-9)return(t.z+n.z)*.5;let i=Math.max(0,Math.min(1,(e-t.y)/r));return t.z+(n.z-t.z)*i}function vp(e){let t=e.motion?.centerOfGravity;if(gp(t))return{...t};if(gp(e.centerOfGravityReference))return{...e.centerOfGravityReference};let n=hp(e,`right`,e.geometry.right),r=hp(e,`left`,e.geometry.left);return!gp(n)||!gp(r)||!Number.isFinite(e.vehicle.cgHeight)?null:{x:(e.geometry.right.wheelCenter.x+e.geometry.left.wheelCenter.x)*.5,y:0,z:_p(0,n,r)+e.vehicle.cgHeight}}function yp(e,t,n=0){let r=e.fields[t];if(r===void 0)return n;let i=Number(r.trim().replace(`,`,`.`));return Number.isFinite(i)?i:n}function bp(e){let t=e.motion?.elements;if(t?.steeringRackLeft&&t.steeringRackRight&&t.steeringRackCenter&&t.steeringPinion&&t.steeringJoint1&&t.steeringJoint2&&t.steeringWheel)return{rackLeftPoint:t.steeringRackLeft,rackRightPoint:t.steeringRackRight,rackCenterPoint:t.steeringRackCenter,pinionPoint:t.steeringPinion,joint1Point:t.steeringJoint1,joint2Point:t.steeringJoint2,steeringWheelPoint:t.steeringWheel};let n=e.geometry.left.chassis.tieRod,r=e.geometry.right.chassis.tieRod,i={x:(n.x+r.x)*.5,y:0,z:(n.z+r.z)*.5},a=(e.fields[`Pinion Position`]?.trim().toLowerCase()??`rear`)===`front`?`front`:`rear`,o=yp(e,`Y Pinion`,0),s=yp(e,`Pinion Offset`,0),c=yp(e,`Rack Angle`,0)*rp,l=yp(e,`L Pinion`,0),u=yp(e,`Pinion Angle`,0)*rp,d={x:i.x,y:o,z:i.z},f={x:a===`front`?i.x+s*Math.cos(c):i.x-s*Math.cos(c),y:o,z:i.z+s*Math.sin(c)};return{rackLeftPoint:n,rackRightPoint:r,rackCenterPoint:d,pinionPoint:f,joint1Point:{x:a===`front`?f.x-l*Math.cos(-c+Math.PI/2):f.x-l*Math.cos(c+Math.PI/2),y:o+l*Math.sin(u),z:a===`front`?f.z+l*Math.sin(-c+Math.PI/2):f.z+l*Math.sin(c+Math.PI/2)},joint2Point:{x:yp(e,`Joint2 X`,0),y:yp(e,`Joint2 Y`,0),z:yp(e,`Joint2 Z`,0)},steeringWheelPoint:{x:yp(e,`Steering Wheel Position X`,0),y:yp(e,`Steering Wheel Position Y`,0),z:yp(e,`Steering Wheel Position Z`,0)}}}function xp(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}
4112function Sp(e,t,n){return{x:e.x+t.x*n,y:e.y+t.y*n,z:e.z+t.z*n}}function Cp(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function wp(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function Tp(e,t){let n=Math.hypot(e.x,e.y,e.z);return!Number.isFinite(n)||n<=1e-9?t:{x:e.x/n,y:e.y/n,z:e.z/n}}function Ep(e,t,n){let r=Tp(t,{x:1,y:0,z:0}),i=Math.cos(n),a=Math.sin(n),o=Cp(r,e),s=wp(r,e);return{x:e.x*i+o.x*a+r.x*s*(1-i),y:e.y*i+o.y*a+r.y*s*(1-i),z:e.z*i+o.z*a+r.z*s*(1-i)}}function Dp(e){return!!(e&&Number.isFinite(e.axisY.x)&&Number.isFinite(e.axisY.y)&&Number.isFinite(e.axisY.z)&&Number.isFinite(e.axisZ.x)&&Number.isFinite(e.axisZ.y)&&Number.isFinite(e.axisZ.z)&&Math.hypot(e.axisY.x,e.axisY.y,e.axisY.z)>1e-9&&Math.hypot(e.axisZ.x,e.axisZ.y,e.axisZ.z)>1e-9)}function Op(e,t,n){let r=-(e.motion?.steerInputDeg??0)*rp,i=Tp(xp(t,n),{x:1,y:0,z:0}),a=Tp(Cp(Math.abs(i.z)<.96?{x:0,y:0,z:1}:{x:0,y:1,z:0},i),{x:0,y:1,z:0}),o=Tp(Cp(i,a),{x:0,y:0,z:1});return a=Ep(a,i,r),o=Ep(o,i,r),{axisY:a,axisZ:o}}function kp(e,t,n,r){let i=ep,a=Math.max(Math.abs(e.graphics.steeringWheelDiameter)*.5,1),o=Math.max(a-i*.5,i*.5),s=Dp(e.motion?.steeringWheelFrame)?e.motion.steeringWheelFrame:Op(e,n,r),c=s.axisY,l=s.axisZ,u=e=>Sp(Sp(n,c,Math.cos(e)*o),l,Math.sin(e)*o);for(let e=0;e<52;e+=1){let n=e/52*Math.PI*2,r=(e+1)/52*Math.PI*2;nm(t,`reference`,`Steering wheel rim ${e+1}`,u(n),u(r),`#4b5563`,void 0,i)}[0,Math.PI,-Math.PI/2].forEach((e,r)=>{nm(t,`reference`,`Steering wheel spoke ${r+1}`,n,u(e),`#4b5563`,void 0,i)})}function Ap(e,t,n){if(!e.graphics.drawSteering)return;let r=Math.max(Math.abs(e.graphics.armDiameter),1),i=bp(e);nm(t,`reference`,`Steering rack`,i.rackLeftPoint,i.rackRightPoint,np.semiAxis,void 0,r);let a=nm(t,`reference`,`Steering line pinion`,i.rackCenterPoint,i.pinionPoint,np.steeringLine);a&&(a.pinionRotationDeg=e.motion?.steeringPinionAngleDeg??e.motion?.steerInputDeg??0),nm(t,`reference`,`Steering line link 1`,i.pinionPoint,i.joint1Point,np.steeringLine),nm(t,`reference`,`Steering line link 2`,i.joint1Point,i.joint2Point,np.steeringLine),nm(t,`reference`,`Steering line link 3`,i.joint2Point,i.steeringWheelPoint,np.steeringLine),kp(e,t,i.steeringWheelPoint,i.joint2Point),n.push({label:$f,point:i.joint1Point,color:`#7dd3fc`})}function jp(e,t){return t.map(t=>{let n=e.geometry[t];return{side:t,center:n.wheelCenter,radius:e.vehicle.wheelRadius,width:op(e),rimRadius:sp(e),rimOffset:cp(e,t),pose:up(e,t,n.wheelCenter),color:np.wheel}})}var Mp=`#9ca3af`,Np=`#22c55e`;function Pp(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function Fp(e,t,n){let r=Pp(e.center,t);return{...e,center:r,pose:[e.pose[0],e.pose[1],e.pose[2],r.x,r.y,r.z],color:n}}function Ip(e,t,n,r){let i=jp(e,r);return!t||!n?i:[...i,...jp(t,r).map(e=>Fp(e,n,Mp))]}function Lp(e){return{x:e.x,y:-e.y,z:e.z}}function Rp(e){return!e.suspension.macPherson&&(e.suspension.configuration===`Pushrod`||e.suspension.configuration===`Pullrod`)}function zp(e){return e.suspension.macPherson||e.suspension.configuration===`Outboard Spring`}function Bp(e){return e.suspension.suspensionType===`Multilink`}function Vp(e){return e.suspension.suspensionType===`Double Wishbone`}function Hp(e){return e.suspension.suspensionType===`Top WB - Bottom ML`}function Up(e){return e.suspension.suspensionType===`Top ML - Bottom WB`}function Wp(e){return e.suspension.mountingPoint.trim().toLowerCase()===`upright`}function Gp(e){return e.suspension.mountingPoint.trim().toLowerCase()}function Kp(e){let t=(e.fields[`CBar Mounting`]??``).trim().toLowerCase();return t.includes(`rocker`)?`rocker`:t.includes(`top link front`)?`top link front`:t.includes(`top link rear`)?`top link rear`:t.includes(`bottom link front`)?`bottom link front`:t.includes(`bottom link rear`)?`bottom link rear`:t.includes(`top wishbone`)?`top wishbone`:t.includes(`bottom wishbone`)?`bottom wishbone`:`upright`}function qp(e){return e===`rocker`?np.rocker:e===`upright`?np.upright:e===`top wishbone`||e===`top link front`||e===`top link rear`?np.upper:np.lower}function Jp(e,t,n,r){let i=e.geometry[t],a=Kp(e),o=qp(a),s=(e,i)=>{nm(r,`reference`,`C-bar link guide ${t} ${i}`,n,e,o,t,void 0,!0)},c=(e,t,n)=>{s(e,`${n} 1`),s(t,`${n} 2`)},l=(e,t,n,r)=>{s(e,`${r} 1`),s(t,`${r} 2`),s(n,`${r} 3`)};if(a===`rocker`){if(!e.graphics.drawRocker)return;c(i.rocker.axisStart,i.rocker.axisEnd,`rocker pivots`);return}if(a===`upright`){s(i.wheelCenter,`upright`);return}
4112if(a===`top wishbone`){l(i.chassis.topFront,i.chassis.topRear,i.wheel.topFront,`top wishbone`);return}if(a===`bottom wishbone`){l(i.chassis.bottomFront,i.chassis.bottomRear,i.wheel.bottomFront,`bottom wishbone`);return}if(a===`top link front`){c(i.chassis.topFront,i.wheel.topFront,`top link front`);return}if(a===`top link rear`){c(i.chassis.topRear,i.wheel.topRear,`top link rear`);return}if(a===`bottom link front`){c(i.chassis.bottomFront,i.wheel.bottomFront,`bottom link front`);return}c(i.chassis.bottomRear,i.wheel.bottomRear,`bottom link rear`)}function Yp(e){return e.geometry.left.wheelCenter.y>=e.geometry.right.wheelCenter.y?`left`:`right`}function Xp(e,t,n,r,i){if(!e.graphics.drawSemiAxis)return;let a=Hf(e,t,n),o=Bf(e,t,n);!a||!o||(nm(r,`semiAxis`,`Driveshaft`,o,a,np.semiAxis,t,Math.max(Math.abs(e.graphics.semiAxisDiameter),1)),i.push({side:t,label:Qf,point:o,color:`#7dd3fc`}))}function Zp(e,t){return e.suspension.macPherson?[]:Bp(e)||Up(e)?[t.wheel.topFront,t.wheel.topRear]:[t.wheel.topFront]}function Qp(e,t){return Bp(e)||Hp(e)?[t.wheel.bottomFront,t.wheel.bottomRear]:[t.wheel.bottomFront]}function $p(e,t){let n=zp(e)?t.wheel.pushRod:t.wheel.spring,r=zp(e)?t.chassis.pushRod:t.chassis.spring;if(!ip(n)||!ip(r))return null;let i={x:r.x-n.x,y:r.y-n.y,z:r.z-n.z},a=Math.hypot(i.x,i.y,i.z);if(a<=1e-6)return{...n};let o=a*.2,s={x:i.x/a,y:i.y/a,z:i.z/a};return{x:n.x+s.x*o,y:n.y+s.y*o,z:n.z+s.z*o}}function em(e,t,n=1e-6){return Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n}function tm(e){let t=[];return e.forEach(e=>{t.some(t=>em(t,e))||t.push(e)}),t}function nm(e,t,n,r,i,a,o,s,c=!1){if(!ip(r)&&!ip(i))return null;let l={side:o,kind:t,label:n,from:r,to:i,color:a,radiusMm:s,dashed:c};return e.push(l),l}function rm(e,t,n,r,i,a,o=.72){!ip(r)&&!ip(i)&&!ip(a)||!ap(r,i,a)||e.push({side:t,kind:`rocker`,label:n,points:[r,i,a],color:np.rocker,opacity:o})}function im(e,t,n){if(!e.graphics.drawRocker||zp(e))return;let r=e.geometry[t],i=r.chassis.pushRod,a=r.rocker.axisStart,o=r.rocker.axisEnd,s=1e-6,c=Math.abs(r.wheelCenter.y)>s?Math.sign(r.wheelCenter.y):t===`left`?1:-1,l=e=>e.y*c,u=e=>l(e)>=-s,d=(e,n)=>{let r=t===`left`?e:n,i=t===`left`?n:e;return u(r)?r:u(i)?i:l(r)>=l(i)?r:i},f=[a,o].filter(e=>u(e)),p=f[0]??a,m=f[1]??(p===a?o:a),h=(e,r,i,a,o=.34)=>{rm(n,t,e,r,i,a,o)},g=[],_=e.motion?.elements,v=_?.heaveLeft??e.elements.heaveLeft,y=_?.heaveRight??e.elements.heaveRight,b=_?.rollLeft??e.elements.rollLeft,x=_?.rollRight??e.elements.rollRight;bf(e)&&g.push({label:`Main rocker`,point:r.wheel.spring}),e.elements.heaveSpring&&g.push({label:`Heave rocker`,point:d(v,y)}),e.elements.rollSpring&&g.push({label:`Roll rocker`,point:d(b,x)}),g.forEach(({label:t,point:n})=>{h(`${t} A`,n,i,p),h(`${t} B`,n,i,m),h(`${t} C`,n,p,m),h(`${t} D`,i,p,m),e.suspension.monoShock&&h(`${t} mono`,n,i,{x:i.x,y:0,z:i.z},.42)})}function am(e,t,n){if(!e.graphics.drawUpright)return;let r=e.geometry[t],i=.38,a=r.wheelCenter,o=e.suspension.macPherson?$p(e,r):null,s=tm([...Zp(e,r),...Qp(e,r),r.wheel.tieRod,...o?[o]:[],...Wp(e)?[r.wheel.pushRod]:[]].filter(e=>ip(e)));if(s.length<2)return;let c=[...s].sort((e,t)=>Math.atan2(e.z-a.z,e.y-a.y)-Math.atan2(t.z-a.z,t.y-a.y));c.forEach((e,r)=>{let o=c[(r+1)%c.length];o&&n.push({side:t,kind:`upright`,label:`Upright shell ${r+1}`,points:[a,e,o],color:np.upright,opacity:i})});for(let e=1;e<c.length-1;e+=1)n.push({side:t,kind:`upright`,label:`Upright cap ${e}`,points:[c[0],c[e],c[e+1]],color:np.upright,opacity:i})}function om(e){if(e.suspension.macPherson){let t=[`wheel-center`,`blf-w`,...Bp(e)||Hp(e)?[`blr-w`]:[],`tr-w`,...zp(e)?[`pr-w`]:[`s-w`],...Wp(e)?[`pr-w`]:[]];return Array.from(new Set(t))}let t=[`wheel-center`,`tlf-w`,...Bp(e)||Up(e)?[`tlr-w`]:[],`blf-w`,...Bp(e)||Hp(e)?[`blr-w`]:[],`tr-w`,...Wp(e)?[`pr-w`]:[]];return Array.from(new Set(t))}function sm(e,t,n,r){let i=e.geometry[t],a=e.graphics.armDiameter,o=e.graphics.springDiameter*.18,s=(e,r,i,a,o,s)=>{nm(n,`reference`,`${o} 1`,e,r,s,t,void 0,!0),nm(n,`reference`,`${o} 2`,e,i,s,t,void 0,!0),nm(n,`reference`,`${o} 3`,e,a,s,t,void 0,!0)};if(Rp(e)&&nm(n,`pushRod`,`Push/Pull rod`,i.chassis.pushRod,i.wheel.pushRod,np.push,t,a),nm(n,`tieRod`,`Tie rod`,i.chassis.tieRod,i.wheel.tieRod,np.tie,t,a),Xp(e,t,i,n,r),e.suspension.macPherson||((Bp(e)||Up(e))&&(nm(n,`upperArm`,`TLF`,i.chassis.topFront,i.wheel.to
4112pFront,np.upper,t,a),nm(n,`upperArm`,`TLR`,i.chassis.topRear,i.wheel.topRear,np.upper,t,a)),(Vp(e)||Hp(e))&&(nm(n,`upperArm`,`TLF`,i.chassis.topFront,i.wheel.topFront,np.upper,t,a),nm(n,`upperArm`,`TLR`,i.chassis.topRear,i.wheel.topFront,np.upper,t,a))),(Bp(e)||Hp(e))&&(nm(n,`lowerArm`,`BLF`,i.chassis.bottomFront,i.wheel.bottomFront,np.lower,t,a),nm(n,`lowerArm`,`BLR`,i.chassis.bottomRear,i.wheel.bottomRear,np.lower,t,a)),(Vp(e)||Up(e))&&(nm(n,`lowerArm`,`BLF`,i.chassis.bottomFront,i.wheel.bottomFront,np.lower,t,a),nm(n,`lowerArm`,`BLR`,i.chassis.bottomRear,i.wheel.bottomFront,np.lower,t,a)),e.suspension.integralLink&&(Hp(e)?s(i.chassis.bottomRear,i.chassis.topFront,i.chassis.topRear,i.wheel.topFront,`Integral link to top wishbone`,np.upper):Up(e)&&s(i.chassis.topRear,i.chassis.bottomFront,i.chassis.bottomRear,i.wheel.bottomFront,`Integral link to bottom wishbone`,np.lower)),nm(n,`reference`,`Wheel center to tie rod`,i.wheelCenter,i.wheel.tieRod,np.reference,t,void 0,!0),e.graphics.drawMainSpring&&bf(e)&&(Rp(e)&&(ip(i.chassis.spring)||ip(i.wheel.spring))&&nm(n,`mainSpring`,`Main spring`,i.wheel.spring,i.chassis.spring,np.spring,t,o),zp(e)&&(ip(i.chassis.pushRod)||ip(i.wheel.pushRod))&&nm(n,`mainSpring`,`Outboard spring`,i.wheel.pushRod,i.chassis.pushRod,np.spring,t,o)),e.graphics.drawPushSpringLink){let r=Gp(e),a=(e,r,a,o,s)=>{nm(n,`reference`,`${o} 1`,i.wheel.pushRod,e,s,t,void 0,!0),nm(n,`reference`,`${o} 2`,i.wheel.pushRod,r,s,t,void 0,!0),nm(n,`reference`,`${o} 3`,i.wheel.pushRod,a,s,t,void 0,!0)},o=(e,r,a,o)=>{nm(n,`reference`,`${a} 1`,i.wheel.pushRod,e,o,t,void 0,!0),nm(n,`reference`,`${a} 2`,i.wheel.pushRod,r,o,t,void 0,!0)};r===`top wishbone`?a(i.chassis.topFront,i.chassis.topRear,i.wheel.topFront,`Mounting to top wishbone`,np.upper):r===`bottom wishbone`?a(i.chassis.bottomFront,i.chassis.bottomRear,i.wheel.bottomFront,`Mounting to bottom wishbone`,np.lower):r===`top link front`?o(i.chassis.topFront,i.wheel.topFront,`Mounting to top link front`,np.upper):r===`top link rear`?o(i.chassis.topRear,i.wheel.topRear,`Mounting to top link rear`,np.upper):r===`bottom link front`?o(i.chassis.bottomFront,i.wheel.bottomFront,`Mounting to bottom link front`,np.lower):r===`bottom link rear`&&o(i.chassis.bottomRear,i.wheel.bottomRear,`Mounting to bottom link rear`,np.lower)}e.graphics.drawRocker&&!zp(e)&&nm(n,`rockerAxis`,`Rocker axis`,i.rocker.axisStart,i.rocker.axisEnd,`#67e8f9`,t,5)}function cm(e,t){let n=e.motion?.elements,r=n?.heaveLeft??e.elements.heaveLeft,i=n?.heaveRight??e.elements.heaveRight,a=n?.rollLeft??e.elements.rollLeft,o=n?.rollRight??e.elements.rollRight,s=n?.cLinkRight??e.elements.cLink,c=n?.cLinkLeft??Lp(s),l=n?.cArbRight??e.elements.cArb,u=n?.cArbLeft??Lp(l),d=n?.cPivotRight??e.elements.cPivot,f=n?.cPivotLeft??Lp(d),p=n?.tLinkRight??e.elements.tLink,m=n?.tLinkLeft??Lp(p),h=n?.tArbRight??e.elements.tArb,g=n?.tArbLeft??Lp(h),_=n?.thirdElementArb??e.elements.thirdElementArb;if(e.elements.heaveSpring&&e.graphics.drawHeaveSpring&&nm(t,`heaveSpring`,`Heave spring`,i,r,np.heave,void 0,e.graphics.springDiameter*.18),e.elements.rollSpring&&e.graphics.drawRollSpring&&nm(t,`rollSpring`,`Roll spring`,o,a,np.roll,void 0,e.graphics.springDiameter*.18),e.elements.antirollCBar&&e.graphics.drawCBar&&(nm(t,`antirollBar`,`C-bar left arm`,u,f,np.arb,`left`,6),nm(t,`antirollBar`,`C-bar right arm`,l,d,np.arb,`right`,6),nm(t,`antirollBar`,`C-bar cross`,f,d,np.arb,void 0,6),nm(t,`antirollLink`,`C-bar link left`,u,c,np.arbLink,`left`,5),nm(t,`antirollLink`,`C-bar link right`,l,s,np.arbLink,`right`,5),Jp(e,`left`,c,t),Jp(e,`right`,s,t)),e.elements.antirollTBar&&e.graphics.drawTBar&&(nm(t,`antirollBar`,`T-bar cross`,g,h,np.arb,void 0,6),nm(t,`antirollBar`,`T-bar pivot`,{x:(g.x+h.x)*.5,y:(g.y+h.y)*.5,z:(g.z+h.z)*.5},e.elements.tPivot,np.arb,void 0,6),nm(t,`antirollLink`,`T-bar link left`,g,m,np.arbLink,`left`,5),nm(t,`antirollLink`,`T-bar link right`,h,p,np.arbLink,`right`,5)),e.elements.antirollTBar&&e.elements.thirdElement&&e.graphics.drawThirdElement&&(nm(t,`mainSpring`,`Third element`,_,e.elements.thirdElementChassis,np.spring,void 0,e.graphics.springDiameter*.18),nm(t,`reference`,`Third element ARB to T-bar`,_,{x:(g.x+h.x)
4112*.5,y:(g.y+h.y)*.5,z:(g.z+h.z)*.5},np.arbLink,void 0,void 0,!0)),e.elements.antirollTBar&&e.graphics.drawTBar&&e.graphics.drawRocker&&!zp(e)){let n=e.geometry.right,r=e.geometry.left;nm(t,`reference`,`T-bar rocker guide right pivot 1`,p,n.rocker.axisStart,np.arbLink,`right`,void 0,!0),nm(t,`reference`,`T-bar rocker guide right pivot 2`,p,n.rocker.axisEnd,np.arbLink,`right`,void 0,!0),nm(t,`reference`,`T-bar rocker guide left pivot 1`,m,r.rocker.axisStart,np.arbLink,`left`,void 0,!0),nm(t,`reference`,`T-bar rocker guide left pivot 2`,m,r.rocker.axisEnd,np.arbLink,`left`,void 0,!0)}}function lm(e,t){return{x:(e.x+t.x)*.5,y:(e.y+t.y)*.5,z:(e.z+t.z)*.5}}function um(e,t,n){let r=t.z-e.z;if(Math.abs(r)<1e-9)return null;let i=(n-e.z)/r;return{x:e.x+(t.x-e.x)*i,y:e.y+(t.y-e.y)*i,z:n}}function dm(e,t){let n=e.geometry[t],r=zp(e)?n.chassis.pushRod:n.chassis.spring,i=e.suspension.macPherson&&ip(r)?r:lm(n.wheel.topFront,n.wheel.topRear),a=e.suspension.macPherson&&!ip(n.wheel.bottomRear)?n.wheel.bottomFront:lm(n.wheel.bottomFront,n.wheel.bottomRear),o=hp(e,t,n
4112),s=o.z-e.vehicle.wheelRadius*.5,c=o.z+e.vehicle.wheelRadius*2.5;return{start:um(i,a,s)??i,end:um(i,a,c)??a,contact:um(i,a,o.z)??o}}function fm(e,t){let n=e.motion?.elements;return t===`right`&&n?.steeringAxisRightStart&&n.steeringAxisRightEnd&&n.steeringAxisRightContact?{start:n.steeringAxisRightStart,end:n.steeringAxisRightEnd,contact:n.steeringAxisRightContact}:t===`left`&&n?.steeringAxisLeftStart&&n.steeringAxisLeftEnd&&n.steeringAxisLeftContact?{start:n.steeringAxisLeftStart,end:n.steeringAxisLeftEnd,contact:n.steeringAxisLeftContact}:dm(e,t)}function pm(e,t,n,r){let i=e.geometry[t],a=hp(e,t,i);if(r.push({side:t,label:`CP`,point:a,color:`#9ca3af`}),!(e.graphics.drawSteeringAxis||e.graphics.virtualPointsLines))return;let o=fm(e,t),s=um(o.start,o.end,i.wheelCenter.z)??{x:i.wheelCenter.x,y:i.wheelCenter.y,z:i.wheelCenter.z};e.graphics.drawSteeringAxis&&nm(n,`steeringAxis`,`Steering axis`,o.start,o.end,np.steeringAxis,t,void 0,!0),r.push({side:t,label:`SA`,point:o.contact,color:`#ffffff`}),r.push({side:t,label:`SAWC`,point:s,color:`#ffffff`})}function mm(e,t){let n=e.geometry[t];return hp(e,t,n)}function hm(e){let t=e.motion?.rollCenter;if(t)return{center:{...t.center},leftContact:{...t.leftContact},rightContact:{...t.rightContact},leftInstantCenter:{...t.leftInstantCenter},rightInstantCenter:{...t.rightInstantCenter},groundZAtCenter:t.groundZAtCenter};let n=mm(e,`right`),r=mm(e,`left`);return Zf(e.geometry.right,e.geometry.left,n,r,{macPherson:e.suspension.macPherson,centerX:(e.geometry.right.wheelCenter.x+e.geometry.left.wheelCenter.x)*.5,useTopRearWheelPoint:Bp(e)||Up(e),useBottomRearWheelPoint:Bp(e)||Hp(e)})}function gm(e,t,n){!e.graphics.drawGroundLine||!t.includes(`left`)||!t.includes(`right`)||nm(n,`groundLine`,`Ground line`,mm(e,`left`),mm(e,`right`),np.groundLine,void 0,void 0,!0)}function _m(e,t,n={}){let r=[],i=[],a=[],o=[],s=jp(e,t);t.forEach(t=>{sm(e,t,r,o),pm(e,t,r,o),im(e,t,i);let c=n.uprightWheelOverrides?.[t];am(c?{...e,geometry:{...e.geometry,[t]:{...e.geometry[t],wheel:{...e.geometry[t].wheel,...c}}}}:e,t,i);let l=e.geometry[t];if(e.graphics.drawWheels){let e=s.find(e=>e.side===t);e&&a.push(e)}[[`TLF`,l.chassis.topFront],[`TLR`,l.chassis.topRear],[`BLF`,l.chassis.bottomFront],[`BLR`,l.chassis.bottomRear],[`TR`,l.chassis.tieRod],[`PR`,l.chassis.pushRod],[`S`,e.suspension.macPherson?l.chassis.pushRod:l.chassis.spring],[`WC`,l.wheelCenter]].forEach(([e,n])=>{o.push({side:t,label:String(e),point:n,color:np.point})})}),cm(e,r),Ap(e,r,o),gm(e,t,r);let c=e.graphics.drawRollCenter?hm(e):null,l=e.graphics.drawCenterOfGravity?vp(e):null;return c&&(nm(r,`rollCenter`,`Roll center left`,c.leftContact,c.center,np.steeringAxis,`left`,void 0,!0),nm(r,`rollCenter`,`Roll center right`,c.rightContact,c.center,np.steeringAxis,`right`,void 0,!0),o.push({label:`RC`,point:c.center,color:`#ffffff`})),{segments:r,faces:i,wheels:a,points:o,rollCenter:c,centerOfGravity:l}}function vm(e,t,n,r,i={}){let a=_m(e,r,i);if(!t||!n)return a;let o=_m(t,r),s=o.rollCenter?{center:Pp(o.rollCenter.center,n),leftContact:Pp(o.rollCenter.leftContact,n),rightContact:Pp(o.rollCenter.rightContact,n),leftInstantCenter:Pp(o.rollCenter.leftInstantCenter,n),rightInstantCenter:Pp(o.rollCenter.rightInstantCenter,n),groundZAtCenter:o.rollCenter.groundZAtCenter+n.z}:null,c=a.rollCenter&&s?[{kind:`rollAxis`,label:`Dynamic roll axis`,from:a.rollCenter.center,to:s.center,color:Np}]:[];return{segments:[...o.segments.map(e=>({...e,from:Pp(e.from,n),to:Pp(e.to,n),color:Mp,selectable:!1})),...a.segments,...c],faces:[...o.faces.map(e=>({...e,points:e.points.map(e=>Pp(e,n)),color:Mp,selectable:!1})),...a.faces],wheels:[...o.wheels.map(e=>Fp(e,n,Mp)),...a.wheels],points:[...a.points,...o.points.map(e=>({...e,point:Pp(e.point,n),color:Mp}))],rollCenter:a.rollCenter,centerOfGravity:a.centerOfGravity}}function ym(e,t={}){let n=t.includeRollCenter??!0,r=t.includeCenterOfGravity??!0,i=t.includeSteeringColumnAndWheel??!0,a=e=>e.label.startsWith(`Steering line `)||e.label.startsWith(`Steering wheel `);return[...e.points.filter(e=>(n||e.label!==`RC`)&&(i||e.label!==$f)).map(e=>e.point),...e.segments.filter(e=>(n||e.kind!==`rollCenter`&&e.kind!==`rollAxis`)&&(i||!a(e))).flatMap(e=>[e.from,e.to]),...e.faces.flatMap(e=>e.points),...e.wheels.flatMap(e=>[e.center,{x:e.center.x+e.radius,y:e.center.y+e.width*.5,z:e.center.z+e.radiu
4112s},{x:e.center.x-e.radius,y:e.center.y-e.width*.5,z:e.center.z-e.radius}]),...n&&e.rollCenter?[e.rollCenter.center,e.rollCenter.leftContact,e.rollCenter.rightContact]:[],...r&&e.centerOfGravity?[e.centerOfGravity]:[]]}function bm(e,t,n,r={}){let i=r.tolerance??1e-6,a=r.maxIterations??100,o=r.derivativeStep??1e-5,s=e,c=t(s);for(let e=0;e<a;e+=1){if(c=t(s),Math.abs(c)<i)return{root:s,iterations:e,converged:!0,residual:c};let r=n?.(s)??(t(s+o)-t(s-o))/(2*o);if(!Number.isFinite(r)||Math.abs(r)<2**-52||(s-=c/r,!Number.isFinite(s)))break}return c=t(s),{root:s,iterations:a,converged:Math.abs(c)<i,residual:c}}function xm(e,t){return Math.sqrt(e.reduce((e,n,r)=>e+(n-t[r])**2,0))}function Sm(e,t){let n=t.length,r=e.map((e,n)=>[...e,t[n]]);for(let e=0;e<n;e+=1){let t=e;for(let i=e+1;i<n;i+=1)Math.abs(r[i][e])>Math.abs(r[t][e])&&(t=i);if(Math.abs(r[t][e])<2**-52)return null;t!==e&&([r[e],r[t]]=[r[t],r[e]]);let i=r[e][e];for(let t=e;t<=n;t+=1)r[e][t]/=i;for(let t=0;t<n;t+=1){if(t===e)continue;let i=r[t][e];for(let a=e;a<=n;a+=1)r[t][a]-=i*r[e][a]}}return r.map(e=>e[n])}function Cm(e,t,n,r={}){let i=r.tolerance??1e-12,a=r.maxIterations??20,o=r.derivativeStep??1e-5,s=[...e],c=t(s),l=xm(c,n),u=[{iteration:0,residual:l,values:c}];for(let e=1;e<=a;e+=1){if(l<=i)return{solution:s,iterations:e-1,converged:!0,residual:l,history:u};let r=c.map((e,t)=>e-n[t]),a=c.map(()=>Array(s.length).fill(0));for(let e=0;e<s.length;e+=1){let n=[...s];n[e]+=o;let r=t(n);for(let t=0;t<c.length;t+=1)a[t][e]=(r[t]-c[t])/o}let d=Sm(a,r);if(!d||(s=s.map((e,t)=>e-d[t]),s.some(e=>!Number.isFinite(e))))break;c=t(s),l=xm(c,n),u.push({iteration:e,residual:l,values:c})}return{solution:s,iterations:u.length-1,converged:l<=i,residual:l,history:u}}var wm=Math.PI,Tm=Math.PI*2,Em=Math.PI/180,Dm=180/Math.PI,Om=1e-12;function km(e,t,n=0){let r=e[t];if(r===void 0)return n;let i=Number(r.trim().replace(`,`,`.`));return Number.isFinite(i)?i:n}function Am(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function jm(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}function Mm(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}function Nm(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function Pm(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function Fm(e){return Math.hypot(e.x,e.y,e.z)}function Im(e){let t=Fm(e);return t<Om?{ok:!1,value:{x:0,y:0,z:0}}:{ok:!0,value:{x:e.x/t,y:e.y/t,z:e.z/t}}}function Lm(e){return e>1?1:e<-1?-1:e}function Rm(e,t){let n=Im(e),r=Im(t);return!n.ok||!r.ok?0:Math.acos(Lm(Nm(n.value,r.value)))*Dm}function zm(e,t){let n=Im(t);return n.ok?Im(jm(e,Mm(n.value,Nm(e,n.value)))):{ok:!1,value:{x:0,y:0,z:0}}}function Bm(e,t,n){let r=Im(t);if(!r.ok)return{ok:!1,value:{x:0,y:0,z:0}};let i=Math.cos(n),a=Math.sin(n);return{ok:!0,value:Am(Am(Mm(e,i),Mm(Pm(r.value,e),a)),Mm(r.value,Nm(r.value,e)*(1-i)))}}function Vm(e,t,n){let r=Im(e),i=Im(t),a=Im(n);if(!r.ok||!i.ok||!a.ok)return null;let o=Nm(r.value,Pm(i.value,a.value)),s=Nm(i.value,a.value);return Math.atan2(o,s)}function Hm(e,t,n){let r=Math.atan2(t*Math.sin(e),Math.cos(e));return n?r+Tm*Math.floor((e-r+wm)/Tm):r}function Um(e){let t=e-360*Math.floor((e+180)/360);return t>180?t-=360:t<=-180&&(t+=360),t}function Wm(e){let{fields:t}=e,n=e.geometry.right.chassis.tieRod,r=(t[`Pinion Position`]?.trim().toLowerCase()??`rear`)===`front`?`Front`:`Rear`,i=km(t,`Y Pinion`),a=km(t,`Pinion Offset`),o=km(t,`Rack Angle`)*Em,s=km(t,`L Pinion`),c=km(t,`Pinion Angle`)*Em,l={x:km(t,`Joint2 X`),y:km(t,`Joint2 Y`),z:km(t,`Joint2 Z`)},u={x:km(t,`Steering Wheel Position X`),y:km(t,`Steering Wheel Position Y`),z:km(t,`Steering Wheel Position Z`)},d={x:r===`Front`?n.x+a*Math.cos(o):n.x-a*Math.cos(o),y:i,z:n.z+a*Math.sin(o)};return{pinionPosition:r,pinionPoint:d,joint1Point:{x:r===`Front`?d.x-s*Math.cos(-o+Math.PI/2):d.x-s*Math.cos(o+Math.PI/2),y:i+s*Math.sin(c),z:r===`Front`?d.z+s*Math.sin(-o+Math.PI/2):d.z+s*Math.sin(o+Math.PI/2)},joint2Point:l,steeringWheelPoint:u}}function Gm(e){let t=Wm(e),n=jm(t.joint2Point,t.steeringWheelPoint),r=jm(t.joint1Point,t.joint2Point),i=jm(t.pinionPoint,t.joint1Point);return{pinionPoint:t.pinionPoint,joint1Point:t.joint1Point,joint2Point:t.
4112joint2Point,steeringWheelPoint:t.steeringWheelPoint,upperShaftAxis:Im(n).value,intermediateShaftAxis:Im(r).value,pinionShaftAxis:Im(i).value,alpha1Deg:Rm(r,i),alpha2Deg:Rm(n,r)}}function Km(e,t){let n=Gm(e),r=km(e.fields,`U-joint 2 index angle`)*Em,i=km(e.fields,`Gamma Angle`)*Em,a=Lm(Nm(n.upperShaftAxis,n.intermediateShaftAxis)),o=Lm(Nm(n.intermediateShaftAxis,n.pinionShaftAxis)),s=zm(n.intermediateShaftAxis,n.upperShaftAxis),c=zm({x:0,y:0,z:1},n.upperShaftAxis);if(!s.ok||!c.ok)return null;let l=Bm(c.value,n.upperShaftAxis,r);if(!l.ok)return null;let u=Im(l.value);if(!u.ok)return null;let d=Vm(n.upperShaftAxis,s.value,u.value);if(d===null)return null;let f=Hm(t*Em+d,a,!0),p=zm(n.upperShaftAxis,n.intermediateShaftAxis),m=zm(n.pinionShaftAxis,n.intermediateShaftAxis);if(!p.ok||!m.ok)return null;let h=Vm(n.intermediateShaftAxis,p.value,m.value);return h===null?null:Hm(f+i-h,o,!0)*Dm}function qm(e,t){let n=Km(e,t);return n===null?null:n-(Km(e,0)??0)}function Jm(e,t){return{bump:0,steer:e,roll:0,camber:0,toe:0,rockerAngle:0,springLength:0,converged:!0,steeringWheelAngle:e,pinionAngle:t,pinionMinusSteeringWheelAngle:t-e}}function Ym(e){let t=Math.max(0,e.run.steeringWheelAngleMax),n=_f(e.run.steerSteps,10),r=n*2;return Array.from({length:r+1},(e,r)=>(r/n-1)*t).map(t=>Jm(t,qm(e,t)??0))}function Xm(e){let t=Ym(e).map(e=>e.pinionMinusSteeringWheelAngle).filter(e=>typeof e==`number`&&Number.isFinite(e));return t.length===0?null:Math.max(...t)-Math.min(...t)}function Zm(e,t,n){return{...e,fields:{...e.fields,"U-joint 2 index angle":String(t),"Gamma Angle":String(n)}}}function Qm(e){let t=(t,n)=>{let r=Um(t),i=Um(n),a=Xm(Zm(e,r,i));return a===null||!Number.isFinite(a)?null:{indexAngleDeg:r,gammaAngleDeg:i,nonUniformity:a}},n=null;for(let e=-180;e<=180;e+=15)for(let r=-180;r<=180;r+=15){let i=t(e,r);i&&(n===null||i.nonUniformity<n.nonUniformity-1e-9||Math.abs(i.nonUniformity-n.nonUniformity)<=1e-9&&Math.abs(i.indexAngleDeg)+Math.abs(i.gammaAngleDeg)<Math.abs(n.indexAngleDeg)+Math.abs(n.gammaAngleDeg))&&(n=i)}if(n===null)return null;for(let e of[5,2,1,.5,.25]){let r=!0;for(;r;){r=!1;for(let i of[-e,0,e])for(let a of[-e,0,e]){if(i===0&&a===0)continue;let e=t(n.indexAngleDeg+i,n.gammaAngleDeg+a);e&&(e.nonUniformity<n.nonUniformity-1e-9||Math.abs(e.nonUniformity-n.nonUniformity)<=1e-9&&Math.abs(e.indexAngleDeg)+Math.abs(e.gammaAngleDeg)<Math.abs(n.indexAngleDeg)+Math.abs(n.gammaAngleDeg))&&(n=e,r=!0)}}}return n}var $m=5e3;function eh(e,t,n){let r=n-t,i=Math.tan(r*ih);return!Number.isFinite(i)||Math.abs(i)<1e-9?$m:Math.abs(e/i/1e3)}function th(e,t,n){let r=e-n,i=t-n;return{outerDelta:Math.max(r,i,0),innerDelta:Math.max(-r,-i,0)}}function nh(e,t,n,r){let i=Math.abs(e)*ih,a=Math.tan(i);if(!Number.isFinite(a)||Math.abs(a)<1e-12||!Number.isFinite(t)||Math.abs(t)<1e-9||!Number.isFinite(n))return 0;let o=r*Math.abs(n/t);return(Math.atan2(a,1-o*a)-i)*fh}function rh(e,t,n,r){let i=Math.abs(e)*ih,a=Math.abs(t)*ih,o=Math.sin(i)*Math.sin(a),s=Nh(Math.abs(r),Math.abs(n));return!Number.isFinite(o)||Math.abs(o)<1e-12||!Number.isFinite(s)||s<1e-12?NaN:Math.sin(i-a)/o/s*100}var ih=Math.PI/180,ah=1e-7,oh=35,sh=30,ch=20,lh=20,uh=.05,dh=5e-4,fh=180/Math.PI,ph=1e7,mh=1e-9,hh=.01,gh=.001,_h=[gh],vh=.01,yh=1e-9,bh=.1;function xh(e,t,n=0){let r=Number((e.fields[t]??``).trim().replace(`,`,`.`));return Number.isFinite(r)?r:n}function Sh(e,t,n=``){let r=e.fields[t]?.trim();return r&&r.length>0?r:n}function Ch(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2+(e.z-t.z)**2)}function X(e){return{x:e.x,y:e.y,z:e.z}}function wh(e){return{x:e.x,y:-e.y,z:e.z}}function Th(e){return[-e[0],-e[1],e[2],e[3],-e[4],e[5]]}function Eh(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function Dh(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}function Oh(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}function kh(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function Ah(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function jh(e){let t=Math.hypot(e.x,e.y,e.z)||1;return{x:e.x/t,y:e.y/t,z:e.z/t}}function Mh(e){return Math.hypot(e.x,e.y,e.z)}function Nh(e,t){return Math.abs(t)>1e-9?e/t:0}
4112function Ph([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function Fh(e,t,n){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function Ih(e){return[[1,0,0],[0,Math.cos(e),-Math.sin(e)],[0,Math.sin(e),Math.cos(e)]]}function Lh(e){return[[Math.cos(e),0,Math.sin(e)],[0,1,0],[-Math.sin(e),0,Math.cos(e)]]}function Rh(e,t,n,r){return[[Math.cos(n)*Math.cos(t),-Math.sin(t)*Math.cos(r)+Math.cos(t)*Math.sin(n)*Math.sin(r),Math.sin(t)*Math.sin(r)+Math.cos(t)*Math.sin(n)*Math.cos(r)],[Math.cos(n)*Math.cos(e)*Math.sin(t)+Math.sin(n)*Math.sin(e),Math.cos(e)*Math.cos(t)*Math.cos(r)+(Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.cos(n)*Math.sin(e))*Math.sin(r),-Math.cos(e)*Math.cos(t)*Math.sin(r)+(Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.cos(n)*Math.sin(e))*Math.cos(r)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t)*Math.cos(r)+(Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(n)*Math.cos(e))*Math.sin(r),-Math.sin(e)*Math.cos(t)*Math.sin(r)+(Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(n)*Math.cos(e))*Math.cos(r)]]}function zh(e,t){let n=Array.from({length:3},()=>[0,0,0]);for(let r=0;r<3;r+=1)for(let i=0;i<3;i+=1)for(let a=0;a<3;a+=1)n[r][i]+=e[r][a]*t[a][i];return n}function Bh(e,t){return[[e[0][0],e[0][1],e[0][2],t.x],[e[1][0],e[1][1],e[1][2],t.y],[e[2][0],e[2][1],e[2][2],t.z],[0,0,0,1]]}function Vh(e){return[[Math.cos(e[1])*Math.cos(e[2]),-Math.sin(e[1]),Math.cos(e[1])*Math.sin(e[2]),e[3]],[Math.cos(e[0])*Math.sin(e[1])*Math.cos(e[2])+Math.sin(e[0])*Math.sin(e[2]),Math.cos(e[0])*Math.cos(e[1]),Math.cos(e[0])*Math.sin(e[1])*Math.sin(e[2])-Math.sin(e[0])*Math.cos(e[2]),e[4]],[Math.sin(e[0])*Math.sin(e[1])*Math.cos(e[2])-Math.cos(e[0])*Math.sin(e[2]),Math.sin(e[0])*Math.cos(e[1]),Math.sin(e[0])*Math.sin(e[1])*Math.sin(e[2])+Math.cos(e[0])*Math.cos(e[2]),e[5]],[0,0,0,1]]}function Hh(e){let t=e[0][0],n=e[0][1],r=e[0][2],i=e[1][0],a=e[1][1],o=e[1][2],s=e[2][0],c=e[2][1],l=e[2][2],u=e[0][3],d=e[1][3],f=e[2][3];return[[t,i,s,-(t*u+i*d+s*f)],[n,a,c,-(n*u+a*d+c*f)],[r,o,l,-(r*u+o*d+l*f)],[0,0,0,1]]}function Uh(e,t){let n=Array.from({length:4},()=>[0,0,0,0]);for(let r=0;r<4;r+=1)for(let i=0;i<4;i+=1)for(let a=0;a<4;a+=1)n[r][i]+=e[r][a]*t[a][i];return n}function Wh(e,t){return{x:e[0][0]*t.x+e[0][1]*t.y+e[0][2]*t.z+e[0][3],y:e[1][0]*t.x+e[1][1]*t.y+e[1][2]*t.z+e[1][3],z:e[2][0]*t.x+e[2][1]*t.y+e[2][2]*t.z+e[2][3]}}function Gh(e,t,n){let r=jh(Dh(t,e)),i=Dh(n,e),a=jh(Dh(i,Oh(r,kh(i,r)))),o=jh(Ah(r,a));return Math.hypot(o.x,o.y,o.z)<1e-8&&(o={x:1,y:0,z:0}),[[o.x,r.x,a.x,e.x],[o.y,r.y,a.y,e.y],[o.z,r.z,a.z,e.z],[0,0,0,1]]}function Kh(e,t){return[e[0],e[1],t,e[3],e[4],e[5]]}function qh(e,t){let n=Ph(e);return{x:n[0][0]*t.x+n[0][1]*t.y+n[0][2]*t.z+e[3],y:n[1][0]*t.x+n[1][1]*t.y+n[1][2]*t.z+e[4],z:n[2][0]*t.x+n[2][1]*t.y+n[2][2]*t.z+e[5]}}function Jh(e,t){let n=Ph(e),r={x:t.x-e[3],y:t.y-e[4],z:t.z-e[5]};return{x:n[0][0]*r.x+n[1][0]*r.y+n[2][0]*r.z,y:n[0][1]*r.x+n[1][1]*r.y+n[2][1]*r.z,z:n[0][2]*r.x+n[1][2]*r.y+n[2][2]*r.z}}function Yh(e,t){let n=Kh(e,0),r=Ph(n),i=r[2][0],a=r[2][2],o=Math.hypot(i,a)||1;return qh(n,{x:-t*i/o,y:0,z:-t*a/o})}function Xh(e,t){return Yh(t,e.vehicle.wheelRadius)}function Zh(e,t){let n=t.center.z-t.groundZAtCenter;return{hcrAbsolute:t.center.z,hcrRelative:n,rollCenterHeightGround:n,rollCenterDistanceToCg:e.vehicle.cgHeight-n,rollCenterY:t.center.y}}function Qh(){return{hcrAbsolute:0,hcrRelative:0,rollCenterHeightGround:0,rollCenterDistanceToCg:0,rollCenterY:0}}function $h(e,t,n){let r=Yh(n,e.vehicle.wheelRadius),i=wh(r),a=Zf(t,Sf(t),r,i,{macPherson:e.suspension.macPherson,centerX:n[3],useTopRearWheelPoint:Ag(e)||Mg(e),useBottomRearWheelPoint:Ag(e)||jg(e)});return a?Zh(e,a):Qh()}function eg(e,t,n){let r=n.y-t.y;if(Math.abs(r)<1e-9)return(t.z+n.z)*.5;let i=(e-t.y)/r;return t.z+(n.z-t.z)*i}function tg(e,t){let n=t.x-e.x,r=t.z-e.z;
4112return Math.hypot(n,r)<yh?null:[{x:e.x,z:e.z},{x:e.x-r,z:e.z+n}]}function ng(e,t,n,r){let i=tg(e,t),a=tg(n,r);if(!i||!a)return null;let o=e=>({a:e[0].z-e[1].z,b:e[1].x-e[0].x,c:e[0].x*e[1].z-e[1].x*e[0].z}),s=o(i),c=o(a),l={x:s.b*c.c-s.c*c.b,z:s.c*c.a-s.a*c.c,w:s.a*c.b-s.b*c.a},u=Math.max(Math.abs(l.x),Math.abs(l.z),Math.abs(l.w));return!Number.isFinite(u)||u<=2**-52?null:{x:l.x/u,z:l.z/u,w:l.w/u}}function rg(e,t){let n=t.y-e.y,r=t.z-e.z;return!Number.isFinite(n)||!Number.isFinite(r)||Math.abs(r)<yh?null:[e,{x:e.x,y:e.y-r,z:e.z+n}]}function ig(e,t,n,r,i){let a=rg(e,t),o=rg(n,r);if(!a||!o)return null;let s=Kf(a[0],a[1],o[0],o[1]);if(!s||!Number.isFinite(s.y)||!Number.isFinite(s.z))return null;let c={...s,x:i};return{center:c,leftContact:n,rightContact:e,leftInstantCenter:o[1],rightInstantCenter:a[1],groundZAtCenter:eg(c.y,e,n)}}function ag(e,t,n,r){let i=sg(n,r);if(!i)return null;let a=Yh(t.pose,e.vehicle.wheelRadius),o=Yh(i.pose,e.vehicle.wheelRadius),s=ig(a,o,wh(a),wh(o),t.rightCorner.wheelCenter.x);return s?Zh(e,s):null}function og(e){return e.converged&&b_(e)}function sg(e,t){return og(e)?e:og(t)?t:v_(e)?e:v_(t)?t:null}function cg(e,t,n){let r=n=>f_(e,t.bump+n,t.steer,{useSteeringModel:t.useSteeringModel??Math.abs(t.steer)>1e-9,initialPose:t.pose,solveTolerance:ah,mainMaxIterations:oh,rockerMaxIterations:sh,cBarMaxIterations:ch,tBarMaxIterations:lh,includeBumpDerivativeMetrics:!1});return{positive:r(n),negative:r(-n)}}function lg(e,t){return cg(e,t,vh)}function ug(e,t){return cg(e,t,gh)}function dg(e,t,n){let r=lg(e,t),i=lg(e,n),a=sg(r.positive,r.negative),o=sg(i.positive,i.negative);if(!a||!o)return null;let s=Yh(t.pose,e.vehicle.wheelRadius),c=wh(Yh(n.pose,e.vehicle.wheelRadius));return ig(s,Yh(a.pose,e.vehicle.wheelRadius),c,wh(Yh(o.pose,e.vehicle.wheelRadius)),(t.rightCorner.wheelCenter.x+n.rightCorner.wheelCenter.x)*.5)}function fg(e){return{center:X(e.center),leftContact:X(e.leftContact),rightContact:X(e.rightContact),leftInstantCenter:X(e.leftInstantCenter),rightInstantCenter:X(e.rightInstantCenter),groundZAtCenter:e.groundZAtCenter}}function pg(e,t,n){let r=dg(e,t,n);return r?Zh(e,r):null}function mg(e,t){return t?{...e,outputs:{...e.outputs,...t}}:e}function hg(e){return[-e.vehicle.camber*ih,-e.vehicle.toe*ih,0,e.geometry.right.wheelCenter.x,e.geometry.right.wheelCenter.y,e.geometry.right.wheelCenter.z]}function gg(e){return 2*Math.abs(Yh(hg(e),e.vehicle.wheelRadius).y)}function _g(e,t){return e.outputs.trackDelta+t.outputs.trackDelta}function vg(e){let t=e.centerOfGravityReference;if(t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.z))return{...t};if(!Number.isFinite(e.vehicle.cgHeight))return;let n=Yh(hg(e),e.vehicle.wheelRadius),r=wh(n);return{x:(e.geometry.right.wheelCenter.x+e.geometry.left.wheelCenter.x)*.5,y:0,z:eg(0,n,r)+e.vehicle.cgHeight}}function yg(e,t){return Yh(hg(e),e.vehicle.wheelRadius).z+e.vehicle.cgHeight-t.z}function bg(e){let t=(e.fields.Wheeldrive??``).trim().toLowerCase();return t===`front`||t===`rear`||t===`4wd`?t:`rear`}function xg(e,t,n){let r=[{x:0,y:0,z:0},{x:0,y:0,z:n}].map(n=>({start:qh(e,n),end:qh(t,n)})),i=r[0],a=r[1];return Math.hypot(i.end.x-i.start.x,i.end.z-i.start.z)<yh||Math.hypot(a.end.x-a.start.x,a.end.z-a.start.z)<yh?null:ng(i.start,i.end,a.start,a.end)}function Sg(e,t){let n=e.z-t.z*e.w,r=e.x-t.x*e.w;return!Number.isFinite(n)||!Number.isFinite(r)?NaN:r===0?n===0?NaN:Math.sign(n)*(1/0):n/r}function Cg(){return{antiDive:NaN,antiDiveAngle:NaN,antiLift:NaN,antiLiftAngle:NaN,antiSquat:NaN,antiSquatAngle:NaN}}function wg(e,t,n,r,i=!1){let a=yg(e,r);if(!t||Math.abs(a)<1e-9)return Cg();let o=Sh(e,`Brakes Position`,`Outboard`).trim().toLowerCase()===`outboard`?r:n,s=Sg(t,n),c=Sg(t,o),l=(e,t=!1)=>(t?-Math.atan(e):Math.atan(e))*fh,u=(t,n,r=!1)=>{let i=Nh(e.vehicle.wheelbase*t*n,a);return r?-i:i},d=e.suspension.axlePosition.trim().toLowerCase()===`rear`?`rear`:`front`,f=bg(e),p=e.vehicle.brakeBalance,m=f===`front`?100:f===`4wd`?i?100:e.vehicle.driveRatio:0,h=f===`rear`?100:f===`4wd`?i?100:100-e.vehicle.driveRatio:0;return d===`front`?{antiDive:u(p,c,!0),antiDiveAngle:l(c,!0),antiLift:m>0?u(m,s):0,antiLiftAngle:m>0?l(s):0,antiSquat:0,antiSquatAngle:0}:{antiDive:0,antiDiveAngle:0,antiLift:u(100-p,c),antiLiftAngle:l(c),antiSquat:h>0?u(h,s):0,antiSquatAngle:h>0?l(s):0}}function Tg(e,t,n,r,i=!1){let a=xg(t,n,e.vehicle.wheelRadius),o=Yh(t,e.vehicle.wheelRadius);return wg(e,a,{x:t[3],z:t[5]},{x:o.x,z:o.z},i)}function Eg(e,t,n,r){let i,a,o=t.bump<-mh;if(o&&v_(r))i=t.pose,a=r.pose;else if(!o&&v_(n))i=t.pose,a=n.pose;else if(v_(n))i=t.pose,a=n.pose;else if(v_(r))i=t.pose,a=r.pose;else return null;let s=xg(i,a,e.vehicle.wheelRadius);if(!s)return Cg();let c=Yh(t.pose,e.vehicle.wheelRadius);return wg(e,s,{x:t.pose[3],z:t.pose[5]},{x:c.x,z:c.z},!1)}function Dg(e,t,n,r){let i=e.vehicle.toe,a=e.vehicle.wheelbase,o=gg(e),s=t-n,{innerDelta:c,outerDelta:l}=th(t,n,i),u=Math.abs(r)<1e-9||Math.abs(s)<1e-9?NaN:2*Math.abs(r)/Math.abs(s),d=nh(l,a,o,1),f=c-l,p=rh(c,l,a,o),m=eh(a,i,t),h=eh(a,i,n);return{steeringRatio:u,ackermann:p,meanRadius:Number.isFinite(m)&&Number.isFinite(h)?(m+h)*.5:$m,ackermannDelta:f,ackermannIdealDelta:d,ackermannOuterDelta:l,roadWheelDifference:s}}function Og(e,t,n,r){return{...Dg(e,t.outputs.toe,n.outputs.toe,0),steeringRatio:r.steeringRatio,ackermann:r.ackermann}}function kg(e,t,n){let r=Yh(t.pose,e.vehicle.wheelRadius),i=Yh(n.pose,e.vehicle.wheelRadius);return Math.atan2(r.z-i.z,r.y+i.y)*fh}function Ag(e){return e.suspension.suspensionType===`Multilink`}function jg(e){return e.suspension.suspensionType===`Top WB - Bottom ML`}function Mg(e){return e.suspension.suspensionType===`Top ML - Bottom WB`}function Ng(e){return e.suspension.configuration===`Outboard Spring`}function Pg(e){return e.suspension.configuration===`Pushrod`||e.suspension.configuration===`Pullrod`}function Fg(e){let t=e.trim().toLowerCase();return t.includes(`rocker`)?`rocker`:t.includes(`top link front`)?`top link front`:t.includes(`top link rear`)?`top link rear`:t.includes(`bottom link front`)?`bottom link front`:t.includes(`bottom link rear`)?`bottom link rear`:t.includes(`bottom`)?`bottom wishbone`:t.includes(`top`)?`top wishbone`:`upright`}function Ig(e){let t=e.trim().toLowerCase();return t.includes(`top link front`)?`topLinkFront`:t.includes(`top link rear`)?`topLinkRear`:t.includes(`bottom link front`)?`bottomLinkFront`:t.includes(`bottom link rear`)?`bottomLinkRear`:t.includes(`top wishbone`)?`topWishbone`:t.includes(`bottom wishbone`)?`bottomWishbone`:`upright`}function Lg(e){return(e?.trim().toLowerCase()??``).includes(`spring`)?`constantSpringLength`:`constantTyrePatchZ`}
4112function Rg(e,t){return{topRear:Ag(e)||Mg(e)?t.wheel.topRear:t.wheel.topFront,bottomRear:Ag(e)||jg(e)?t.wheel.bottomRear:t.wheel.bottomFront}}function zg(e,t){if(!e.suspension.integralLink)return null;if(jg(e)){let e=Wh(Hh(Vg(t.chassis.topFront,t.chassis.topRear,t.wheel.topFront)),t.chassis.bottomRear);return{label:`BLR`,chassis:X(t.chassis.bottomRear),chassisForPose:(n,r)=>{let i=r.get(`TLF`)??t.wheel.topFront;return Wh(Vg(t.chassis.topFront,t.chassis.topRear,i),e)}}}if(Mg(e)){let e=Wh(Hh(Vg(t.chassis.bottomFront,t.chassis.bottomRear,t.wheel.bottomFront)),t.chassis.topRear);return{label:`TLR`,chassis:X(t.chassis.topRear),chassisForPose:(n,r)=>{let i=r.get(`BLF`)??t.wheel.bottomFront;return Wh(Vg(t.chassis.bottomFront,t.chassis.bottomRear,i),e)}}}return null}function Bg(e,t,n){let{topRear:r,bottomRear:i}=Rg(e,n);return X(t===`upright`?n.wheel.pushRod:t===`topWishbone`||t===`topLinkFront`?n.wheel.topFront:t===`topLinkRear`?r:t===`bottomWishbone`||t===`bottomLinkFront`?n.wheel.bottomFront:i)}function Vg(e,t,n,r=0){let i=e.x-t.x,a=e.y-t.y,o=e.z-t.z,s=Math.hypot(i,a)||2**-52,c=Wh(Hh(Bh(Fh(0,Math.atan2(a,i),-Math.atan2(o,s)),e)),n),l=Math.atan2(c.z,c.y||2**-52)+r;return Bh(Rh(0,Math.atan2(a,i),-Math.atan2(o,s),l),e)}function Hg(e,t,n=0){let r=e.x-t.x,i=e.y-t.y,a=e.z-t.z,o=Math.hypot(r,i)||2**-52,s=Wh(Hh(Bh(Fh(0,Math.atan2(r,i),-Math.atan2(-a,o)),e)),t),c=Math.atan2(s.z,s.y||2**-52)+n;return Bh(Rh(0,Math.atan2(i,r),-Math.atan2(a,o),c),e)}function Ug(e,t,n){let r=Dh(t,e),i=Dh(n,e),a=jh(r),o=Ah(a,i);if(Mh(o)<=1e-9)return Hg(e,t);let s=jh(o),c=jh(Ah(s,a));return Bh([[a.x,c.x,s.x],[a.y,c.y,s.y],[a.z,c.z,s.z]],e)}function Wg(e,t,n,r,i=0,a){if(t===`upright`)return Vh(n);let{topRear:o,bottomRear:s}=Rg(e,r);return t===`topWishbone`?Vg(r.chassis.topFront,r.chassis.topRear,r.wheel.topFront,i):t===`bottomWishbone`?Vg(r.chassis.bottomFront,r.chassis.bottomRear,r.wheel.bottomFront,i):t===`topLinkFront`?a?Ug(r.chassis.topFront,r.wheel.topFront,a):Hg(r.chassis.topFront,r.wheel.topFront,i):t===`topLinkRear`?a?Ug(r.chassis.topRear,o,a):Hg(r.chassis.topRear,o,i):t===`bottomLinkFront`?a?Ug(r.chassis.bottomFront,r.wheel.bottomFront,a):Hg(r.chassis.bottomFront,r.wheel.bottomFront,i):a?Ug(r.chassis.bottomRear,s,a):Hg(r.chassis.bottomRear,s,i)}function Gg(e,t){return t===`topLinkFront`||t===`topLinkRear`?Ag(e)||Mg(e):t===`bottomLinkFront`||t===`bottomLinkRear`?Ag(e)||jg(e):!1}function Kg(e,t,n){let{topRear:r,bottomRear:i}=Rg(e,n);return t===`topLinkFront`?{chassis:n.chassis.topFront,wheel:n.wheel.topFront}:t===`topLinkRear`?{chassis:n.chassis.topRear,wheel:r}:t===`bottomLinkFront`?{chassis:n.chassis.bottomFront,wheel:n.wheel.bottomFront}:t===`bottomLinkRear`?{chassis:n.chassis.bottomRear,wheel:i}:null}function qg(e,t){return t===`top link front`||t===`top link rear`?Ag(e)||Mg(e):t===`bottom link front`||t===`bottom link rear`?Ag(e)||jg(e):!1}function Jg(e,t,n){let{topRear:r,bottomRear:i}=Rg(e,n);return t===`top link front`?{chassis:n.chassis.topFront,wheel:n.wheel.topFront}:t===`top link rear`?{chassis:n.chassis.topRear,wheel:r}:t===`bottom link front`?{chassis:n.chassis.bottomFront,wheel:n.wheel.bottomFront}:t===`bottom link rear`?{chassis:n.chassis.bottomRear,wheel:i}:null}function Yg(e,t,n,r,i){let a=(t.y-e.y)*(n.z-e.z)-(n.y-e.y)*(t.z-e.z),o=(n.x-e.x)*(t.z-e.z)-(t.x-e.x)*(n.z-e.z),s=(t.x-e.x)*(n.y-e.y)-(n.x-e.x)*(t.y-e.y),c=-(a*e.x+o*e.y+s*e.z);return Math.abs(a)<1e-9?null:-(o*r+s*i+c)/a}function Xg(e,t,n,r){let i=Yg(t,n,r,e.y,e.z);return i===null?e:{...e,x:i}}function Zg(e,t,n,r,i){let{topRear:a,bottomRear:o}=Rg(e,r);return t===`top wishbone`?Gh(r.chassis.topFront,r.chassis.topRear,r.wheel.topFront):t===`bottom wishbone`?Gh(r.chassis.bottomFront,r.chassis.bottomRear,r.wheel.bottomFront):t===`top link front`?i?Ug(r.chassis.topFront,r.wheel.topFront,i):Hg(r.chassis.topFront,r.wheel.topFront):t===`top link rear`?i?Ug(r.chassis.topRear,a,i):Hg(r.chassis.topRear,a):t===`bottom link front`?i?Ug(r.chassis.bottomFront,r.wheel.bottomFront,i):Hg(r.chassis.bottomFront,r.wheel.bottomFront):t===`bottom link rear`?i?Ug(r.chassis.bottomRear,o,i):Hg(r.chassis.bottomRear,o):Vh(n)}function Qg(e){return{x:0,y:e.elements.cPivot.y<0?-1:1,z:0}}function $g(e){let t=e.elements.tPivot,n=e.elements.tArb,r=Math.atan2(100,0),i=-Math.atan2(0,100),a=Wh(Hh(Bh(Fh(0,r,i),t)),{x:n.x,y:0,z:n.z}),o=Rh(0,r,i,Math.atan2(a.z,a.y||2**-52)),s=Hh(Bh(o,t)),c={x:n.x,y:n.y,z:n.z},l={x:n.x,y:-n.y,z:n.z},u=X(e.elements.tLink),d={x:e.elements.tLink.x,y:-e.elements.tLink.y,z:e.elements.tLink.z};return{tBarBase:o,tBarLocalLeft:Wh(s,c),tBarLocalRight:Wh(s,l),tBarLocalThird:Wh(s,e.elements.thirdElementArb),tBarTargetLengthLeft:Ch(u,c),tBarTargetLengthRight:Ch(d,l)}}function e_(e,t,n){let r=zg(e,t),i=(e,t)=>r?.label===e?r.chassis??X(t):X(t),a=e=>r?.label===e?r.chassisForPose:void 0;if(e.suspension.macPherson){let r=X(t.chassis.pushRod),i=Jh(n,t.wheel.pushRod),a=e=>{let t=jh(Dh(qh(e,i),r)),n={x:0,y:-t.z,z:t.y};
4112Mh(n)<=1e-9&&(n={x:-t.z,y:0,z:t.x});let a=jh(n),o=jh(Ah(t,a));return[Eh(r,Oh(a,ph)),Eh(r,Oh(o,ph))]},o=e=>a(e)[0],s=e=>a(e)[1],{bottomRear:c}=Rg(e,t);return[{label:`MacPherson virtual strut 1`,chassis:o(n,new Map),wheel:r,chassisForPose:o},{label:`MacPherson virtual strut 2`,chassis:s(n,new Map),wheel:r,chassisForPose:s},{label:`BLF`,chassis:X(t.chassis.bottomFront),wheel:X(t.wheel.bottomFront)},{label:`BLR`,chassis:X(t.chassis.bottomRear),wheel:X(c)},{label:`TR`,chassis:X(t.chassis.tieRod),wheel:X(t.wheel.tieRod)}]}let o=Ag(e)||Mg(e)?t.wheel.topRear:t.wheel.topFront,s=Ag(e)||jg(e)?t.wheel.bottomRear:t.wheel.bottomFront;return[{label:`TLF`,chassis:X(t.chassis.topFront),wheel:X(t.wheel.topFront)},{label:`TLR`,chassis:i(`TLR`,t.chassis.topRear),wheel:X(o),chassisForPose:a(`TLR`)},{label:`BLF`,chassis:X(t.chassis.bottomFront),wheel:X(t.wheel.bottomFront)},{label:`BLR`,chassis:i(`BLR`,t.chassis.bottomRear),wheel:X(s),chassisForPose:a(`BLR`)},{label:`TR`,chassis:X(t.chassis.tieRod),wheel:X(t.wheel.tieRod)}]}function t_(e){let t=e.geometry.right,n=[-e.vehicle.camber*ih,-e.vehicle.toe*ih,0,t.wheelCenter.x,t.wheelCenter.y,t.wheelCenter.z],r=e_(e,t,n).map(e=>({...e,local:Jh(n,e.wheel),targetLength:Ch(e.chassis,e.wheel)})),i=Ig(e.suspension.mountingPoint||Sh(e,`Mounting Point`,`Upright`)),a=Gg(e,i)?Kg(e,i,t):null,o=a?Xg(t.wheel.pushRod,t.chassis.pushRod,a.chassis,a.wheel):t.wheel.pushRod,s=Bg(e,i,t),c={label:`Steering spring`,chassis:X(t.chassis.pushRod),wheel:s,local:Jh(n,s),targetLength:Ch(t.chassis.pushRod,s)},l=Yh(n,e.vehicle.wheelRadius),u={label:`Virtual bump`,chassis:{x:l.x,y:l.y,z:ph},wheel:l,local:Jh(n,l),targetLength:Ch({x:l.x,y:l.y,z:ph},l),lockGamma:!0},d=Wh(Hh(Wg(e,i,n,t,0,a?t.chassis.pushRod:void 0)),o),f=Fg(Sh(e,`CBar Mounting`,`Upright`)),p=qg(e,f)?Jg(e,f,t):null,m=p?Xg(e.elements.cLink,e.elements.cArb,p.chassis,p.wheel):e.elements.cLink,h;e.elements.antirollCBar&&f!==`rocker`&&(h=Wh(Hh(Zg(e,f,n,t,p?e.elements.cArb:void 0)),m));let g=$g(e);return{initialPose:n,baseConstraints:r,springSteerConstraint:c,virtualBumpConstraint:u,extras:{wheelCenter:Jh(n,t.wheelCenter),pushRod:d,spring:Jh(n,t.wheel.spring)},staticCorner:t,pushMountMode:i,targetPushRodLength:Ch(t.chassis.pushRod,o),cBarMountMode:f,cBarLocal:h,cBarTargetLength:Ch(m,e.elements.cArb),...g,cBarAxisDirection:Qg(e)}}function n_(e,t){let n=t.map(t=>r_(e,t)),r=new Map;return t.forEach((e,t)=>{let i=n[t];i&&r.set(e.label,i)}),t.map((t,i)=>Ch(t.chassisForPose?.(e,r)??t.chassis,n[i]??qh(t.lockGamma?Kh(e,0):e,t.local)))}function r_(e,t){return qh(t.lockGamma?Kh(e,0):e,t.local)}function i_(e,t,n,r){let i=jh(Dh(n,t)),a=Dh(e,t),o=Math.cos(r),s=Math.sin(r);return Eh(t,Eh(Eh(Oh(a,o),Oh(Ah(i,a),s)),Oh(i,kh(i,a)*(1-o))))}function a_(e,t,n,r){let i=e.geometry[t].rocker;return i_(n,i.axisStart,i.axisEnd,r)}function o_(e,t,n,r,i){if(Ng(e)||!Pg(e))return{pushRodChassis:X(t.staticCorner.chassis.pushRod),wheelPushRod:X(n),springWheel:X(n),angle:0,converged:!0,residual:0};let{axisStart:a,axisEnd:o}=t.staticCorner.rocker,s=0,c=0,l=!1,u=r.solveTolerance??1e-7,d=r.rockerMaxIterations??20,f=r.derivativeStep??1e-5,p=e=>i?i(e):n,m=e=>i_(t.staticCorner.chassis.pushRod,a,o,e),h=e=>{let t=m(e);return Ch(t,p(t))};for(let e=0;e<d;e+=1){let e=h(s);if(c=e-t.targetPushRodLength,Math.abs(c)<u){l=!0;break}let n=(h(s+f)-e)/f;if(!Number.isFinite(n)||Math.abs(n)<2**-52)break;s-=c/n}c=h(s)-t.targetPushRodLength,l||=Math.abs(c)<u;let g=m(s);return{pushRodChassis:g,wheelPushRod:p(g),springWheel:i_(t.staticCorner.wheel.spring,a,o,s),angle:s,converged:l,residual:c}}function s_(e,t,n,r,i){if(!e.elements.antirollCBar)return{cLink:X(n),cArb:X(e.elements.cArb),angle:0,residual:0,converged:!0};let a=e.elements.cPivot,o=Eh(a,t.cBarAxisDirection),s=t=>i_(e.elements.cArb,a,o,t),c=e=>{let t=s(e);return i?i(t):n},l=e=>Ch(c(e),s(e)),u=0,d=r.solveTolerance??1e-7,f=r.cBarMaxIterations??12,p=r.derivativeStep??1e-5,m=l(u)-t.cBarTargetLength,h=Math.abs(m)<d;for(let e=0;e<f&&!h;e+=1){let e=l(u),n=(l(u+p)-e)/p;if(!Number.isFinite(n)||Math.abs(n)<2**-52)break;u-=(e-t.cBarTargetLength)/n,m=l(u)-t.cBarTargetLength,h=Math.abs(m)<d}let g=s(u);return{cLink:c(u),cArb:g,angle:u,residual:m,converged:h}}function c_(e,t,n,r){let i=Bh(zh(zh(e.tBarBase,Ih(n)),Lh(r)),t);return{left:Wh(i,e.tBarLocalLeft),right:Wh(i,e.tBarLocalRight),third:Wh(i,e.tBarLocalThird)}}function l_(e,t,n,r,i){if(!e.elements.antirollTBar)return{left:{x:e.elements.tArb.x,y:e.elements.tArb.y,z:e.elements.tArb.z},right:{x:e.elements.tArb.x,y:-e.elements.tArb.y,z:e.elements.tArb.z},third:X(e.elements.thirdElementArb),angleX:0,angleY:0,residual:0,converged:!0};let a=e.elements.tPivot,o=i.solveTolerance??1e-7,s=i.tBarMaxIterations??12,c=i.derivativeStep??1e-5,l=Cm([0,0],e=>{let i=c_(t,a,e[0],e[1]);return[Ch(n,i.left),Ch(r,i.right)]},[t.tBarTargetLengthLeft,t.tBarTargetLengthRight],{tolerance:o,maxIterations:s,derivativeStep:c}),u=c_(t,a,l.solution[0],l.solution[1]);return{left:u.left,right:u.right,third:u.third,angleX:l.solution[0],angleY:l.solution[1],residual:l.residual,converged:l.converged}}function u_(e,t,n,r,i){let a=Hh(Vh(r)),o=Lg(Sh(e,`Steering Model`,e.run.steeringModel))===`constantSpringLength`?(()=>{let e=X(t.springSteerConstraint.local),n=qh(r,e),a=X(i.chassis.pushRod);return{...t.springSteerConstraint,chassis:a,wheel:n,local:e,targetLength:Ch(a,n)}})():n[5],s=[...n.slice(0,5),o].map(e=>({...e,chassis:X(e.chassis),wheel:X(e.wheel),local:X(e.local)}));s[4].chassis.y-=hh;let c=Cm(r,e=>n_(e,s),s.map(e=>e.targetLength),{tolerance:1e-7,maxIterations:16,derivativeStep:1e-5}).solution,l=Uh(Vh(c),a),u=(l[0][0]+l[1][1]+l[2][2]-1)/2,d=Math.sqrt((l[2][1]-l[1][2])**2+(l[0][2]-l[2][0])**2+(l[1][0]-l[0][1])**2)/2,f=Yh(r,e.vehicle.wheelRadius),p={start:r_(r,n[0]),end:r_(r,n[2]),contact:f};if(!Number.isFinite(d)||Math.abs(d)<1e-9||Math.abs(1-u)<1e-9)return{caster:0,kingpin:0,btt:0,btl:0,btcr:0,blcr:0,probePose:c,...p};let m=(l[2][1]-l[1][2])/(2*d),h=(l[0][2]-l[2][0])/(2*d),g=(l[1][0]-l[0][1])/(2*d);if(Math.abs(g)<1e-9)return{caster:0,kingpin:0,btt:0,btl:0,btcr:0,blcr:0,probePose:c,...p};let _=-e.vehicle.wheelRadius/2+f.z,v=2.5*e.vehicle.wheelRadius+f.z,y=f.z,b=r[5],x=((1-l[0][0])*l[0][3]-l[1][0]*l[1][3]-l[2][0]*l[2][3])/(2*(1-u)),S=(-l[0][1]*l[0][3]+(1-l[1][1])*l[1][3]-l[2][1]*l[2][3])/(2*(1-u)),C=(-l[0][2]*l[0][3]-l[1][2]*l[1][3]+(1-l[2][2])*l[2][3])/(2*(1-u)),w=e=>{let t=(e-C)/g;return{x:x+t*m,y:S+t*h,z:e}},T=w(_),E=w(v),D=w(y),O=w(b),k=-Math.atan((E.x-T.x)/(E.z-T.z||2**-52))*fh,A=-Math.atan((E.y-T.y)/(E.z-T.z||2**-52))*fh,j=Math.hypot(f.x-D.x,f.y-D.y),ee=Math.hypot(r[3]-O.x,r[4]-O.y),te=Math.atan2(-(D.x-f.x),D.y-f.y),M=Math.atan2(-(O.x-r[3]),O.y-r[4]);return{caster:k,kingpin:A,btt:-j*Math.cos(te-r[1]),btl:-j*Math.sin(te-r[1]),btcr:-ee*Math.cos(M-r[1]),blcr:-ee*Math.sin(M-r[1]),start:T,end:E,contact:D,probePose:c}}function d_(e,t,n,r,i,a,o,s,c,l){let u=n.map(e=>r_(r,e)),d=new Map;
4112n.forEach((e,t)=>{let n=u[t];n&&d.set(e.label,n)});let f=n.map(e=>e.chassisForPose?.(r,d)??e.chassis),p=n.map((e,t)=>{let n=Ch(f[t]??e.chassis,u[t]);return{label:e.label,error:Math.abs(n-e.targetLength)}}),m=n.slice(0,5).reduce((e,t,n)=>Math.max(e,p[n]?.error??0),0),h=qh(r,t.extras.wheelCenter),g=e.suspension.macPherson?X(t.staticCorner.chassis.topRear):X(f[1]??t.staticCorner.chassis.topRear),_=e.suspension.macPherson?X(t.staticCorner.wheel.topFront):u[0],v=e.suspension.macPherson?X(t.staticCorner.wheel.topRear):u[1],y={...t.staticCorner,chassis:{...t.staticCorner.chassis,topRear:g,bottomRear:X(f[3]??t.staticCorner.chassis.bottomRear),tieRod:X(f[4]??n[4].chassis)},wheel:{...t.staticCorner.wheel,topFront:_,topRear:v,bottomFront:u[2],bottomRear:u[3],tieRod:u[4]},wheelCenter:h},b=Gg(e,t.pushMountMode)?Kg(e,t.pushMountMode,y):null,x=n=>Wh(Wg(e,t.pushMountMode,r,y,0,b?n:void 0),t.extras.pushRod),S=o_(e,t,x(t.staticCorner.chassis.pushRod),l,b&&Pg(e)&&!Ng(e)?x:void 0),C=S.wheelPushRod,w=Ng(e)?qh(r,t.extras.spring):S.springWheel,T={...t.staticCorner,chassis:{...t.staticCorner.chassis,topRear:g,bottomRear:X(f[3]??t.staticCorner.chassis.bottomRear),tieRod:X(f[4]??n[4].chassis),pushRod:S.pushRodChassis},wheel:{topFront:_,topRear:v,bottomFront:u[2],bottomRear:u[3],tieRod:u[4],pushRod:C,spring:w},wheelCenter:h},E=Ng(e)?Ch(T.chassis.pushRod,T.wheel.pushRod):Ch(T.chassis.spring,T.wheel.spring),D=(Ng(e)?Ch(t.staticCorner.chassis.pushRod,t.staticCorner.wheel.pushRod):Ch(t.staticCorner.chassis.spring,t.staticCorner.wheel.spring))-E,O=Ch(T.chassis.pushRod,T.wheel.pushRod),k=h.z-t.staticCorner.wheelCenter.z,A=Yh(t.initialPose,e.vehicle.wheelRadius),j=Yh(r,e.vehicle.wheelRadius),ee=j.y-A.y,te=e.suspension.axlePosition.trim().toLowerCase()===`rear`?-1:1,M=ee*(Math.abs(a)<=1e-9?2:1),ne=A.z-j.z,N=t=>a_(e,`right`,t,S.angle),P=t=>a_(e,`left`,t,-S.angle),re=e.elements.heaveSpring?N(e.elements.heaveLeft):X(e.elements.heaveLeft),ie=e.elements.heaveSpring?P(e.elements.heaveRight):X(e.elements.heaveRight),ae=e.elements.rollSpring?N(e.elements.rollLeft):X(e.elements.rollLeft),oe=e.elements.rollSpring?P(e.elements.rollRight):X(e.elements.rollRight),se=t.cBarMountMode,F=qg(e,se)&&Jg(e,se,T)&&t.cBarLocal?n=>Wh(Zg(e,se,r,T,n),t.cBarLocal):void 0,ce=s_(e,t,se===`rocker`?N(e.elements.cLink):F?F(e.elements.cArb):t.cBarLocal?Wh(Zg(e,se,r,T),t.cBarLocal):X(e.elements.cLink),l,F),le=e.elements.antirollTBar?N(e.elements.tLink):X(e.elements.tLink),ue=l_(e,t,le,{x:le.x,y:-le.y,z:le.z},l),I={heaveLeft:re,heaveRight:ie,rollLeft:ae,rollRight:oe,cLink:ce.cLink,cArb:ce.cArb,tLink:le,tArbLeft:ue.left,tArbRight:ue.right,thirdElementArb:ue.third,cBarAngle:ce.angle,tBarAngleX:ue.angleX,tBarAngleY:ue.angleY},de=$h(e,T,r),fe=e.elements.heaveSpring?Ch(I.heaveLeft,I.heaveRight):0,pe=e.elements.rollSpring?Ch(I.rollLeft,I.rollRight):0,me=e.elements.thirdElement&&e.elements.antirollTBar?Ch(I.thirdElementArb,e.elements.thirdElementChassis):0,he=-r[1]*fh-e.vehicle.toe,L=u_(e,t,n,r,T);return{pose:r,steeringAxisProbePose:[...L.probePose],bump:i,steer:a,useSteeringModel:l.useSteeringModel??Math.abs(a)>1e-9,converged:o&&S.converged&&ce.converged&&ue.converged,residual:Math.max(s,Math.abs(S.residual),Math.abs(ce.residual),Math.abs(ue.residual)),iterations:c,rightCorner:T,constraintErrors:p,elementState:I,steeringAxis:{start:X(L.start),end:X(L.end),contact:X(L.contact)},outputs:{camber:-r[0]*fh,toe:-r[1]*fh,rockerAngle:-S.angle*fh,caster:L.caster,kingpin:L.kingpin,btt:L.btt,btl:L.btl,btcr:L.btcr,blcr:L.blcr,hcrRelative:de.hcrRelative,hcrAbsolute:de.hcrAbsolute,rollCenterHeightGround:de.rollCenterHeightGround,rollCenterDistanceToCg:de.rollCenterDistanceToCg,rollCenterY:de.rollCenterY,springLength:E,motionRatio:Nh(k,D),trackDelta:M,wheelbaseDelta:(j.x-A.x)*te,camberGradient:Nh(-r[0]*fh-e.vehicle.camber,i),toeGradient:Nh(-r[1]*fh-e.vehicle.toe,i),heaveSpring:fe,rollSpring:pe,cBarRotation:-ce.angle*fh,tBarTorsion:-ue.angleY*fh,tBarInclination:-ue.angleX*fh,thirdElement:me,thirdElementMotionRatio:0,rockerMotionRatio:Nh(k,-S.angle*fh),heaveSpringMotionRatio:Nh(k,fe),rollSpringMotionRatio:Nh(k,pe),steeringRatio:Nh(a,he),ackermann:0,meanRadius:Nh(e.vehicle.wheelbase,Math.tan(Math.abs(he)*ih))/1e3,rollAngle:0,relativeCamber:-r[0]*fh,heightDelta:ne,pushRodLength:O,wheelCenterX:h.x,wheelCenterY:h.y,wheelCenterZ:h.z,armLengthError:m,antiDive:0,antiDiveAngle:0,antiLift:0,antiLiftAngle:0,antiSquat:0,antiSquatAngle:0}}}function f_(e,t,n,r={}){let i=t_(e),a=xh(e,`C Factor`,0),o=Sh(e,`Pinion Position`,`Rear`),s=Lg(Sh(e,`Steering Model`,e.run.steeringModel)),c=(r.useSteeringModel??Math.abs(n)>1e-9)&&s===`constantSpringLength`,l=r.solveTolerance??1e-7,u=r.mainMaxIterations??24,d=r.derivativeStep??1e-5,f=null;if(c){let e=[...i.baseConstraints,i.virtualBumpConstraint].map(e=>({...e,chassis:X(e.chassis),wheel:X(e.wheel),local:X(e.local)}));e[5].targetLength-=t;let n=Cm(r.initialPose??i.initialPose,t=>n_(t,e),e.map(e=>e.targetLength),{tolerance:l,maxIterations:u,derivativeStep:d}).solution;f=Ch(i.springSteerConstraint.chassis,r_(n,i.springSteerConstraint))}let p=c?i.springSteerConstraint:i.virtualBumpConstraint,m=n*a/360,h=[...i.baseConstraints,p].map(e=>({...e,chassis:X(e.chassis),wheel:X(e.wheel),local:X(e.local)}));h[4].chassis.y+=o===`Rear`?-m:m,h[5].targetLength=f??h[5].targetLength-t;let g=Cm(r.initialPose??i.initialPose,e=>n_(e,h),h.map(e=>e.targetLength),{tolerance:l,maxIterations:u,derivativeStep:d});return d_(e,i,h,g.solution,t,n,g.converged,g.residual,g.iterations,r)}function p_(e){return{motionRatio:e.outputs.motionRatio,camberGradient:e.outputs.camberGradient,toeGradient:e.outputs.toeGradient,thirdElementMotionRatio:e.outputs.thirdElementMotionRatio,rockerMotionRatio:e.outputs.rockerMotionRatio,heaveSpringMotionRatio:e.outputs.heaveSpringMotionRatio,rollSpringMotionRatio:e.outputs.rollSpringMotionRatio,antiDive:e.outputs.antiDive,antiDiveAngle:e.outputs.antiDiveAngle,antiLift:e.outputs.antiLift,antiLiftAngle:e.outputs.antiLiftAngle,antiSquat:e.outputs.antiSquat,antiSquatAngle:e.outputs.antiSquatAngle}}function m_(e){let t=[...e].sort((e,t)=>
4112e-t),n=Math.floor(t.length/2);return t.length%2==0?(t[n-1]+t[n])*.5:t[n]}function h_(e,t,n,r){let i=r/10,a=xg(t.pose,n.pose,e.vehicle.wheelRadius),o=Yh(t.pose,e.vehicle.wheelRadius),s=wg(e,a,{x:t.pose[3],z:t.pose[5]},{x:o.x,z:o.z},!1);return{motionRatio:Nh(r,t.outputs.springLength-n.outputs.springLength),camberGradient:Nh(n.outputs.camber-t.outputs.camber,i),toeGradient:Nh(n.outputs.toe-t.outputs.toe,i),thirdElementMotionRatio:Nh(r,t.outputs.thirdElement-n.outputs.thirdElement),rockerMotionRatio:Math.abs(Nh(r,n.outputs.rockerAngle-t.outputs.rockerAngle)),heaveSpringMotionRatio:Nh(r,t.outputs.heaveSpring-n.outputs.heaveSpring),rollSpringMotionRatio:Nh(r,t.outputs.rollSpring-n.outputs.rollSpring),antiDive:s.antiDive,antiDiveAngle:s.antiDiveAngle,antiLift:s.antiLift,antiLiftAngle:s.antiLiftAngle,antiSquat:s.antiSquat,antiSquatAngle:s.antiSquatAngle}}function g_(e,t,n,r,i){let a=2*i,o=a/10,s=xg(n.pose,r.pose,e.vehicle.wheelRadius),c=Yh(t.pose,e.vehicle.wheelRadius),l=wg(e,s,{x:t.pose[3],z:t.pose[5]},{x:c.x,z:c.z},!1);return{motionRatio:Nh(a,n.outputs.springLength-r.outputs.springLength),camberGradient:Nh(r.outputs.camber-n.outputs.camber,o),toeGradient:Nh(r.outputs.toe-n.outputs.toe,o),thirdElementMotionRatio:Nh(a,n.outputs.thirdElement-r.outputs.thirdElement),rockerMotionRatio:Math.abs(Nh(a,r.outputs.rockerAngle-n.outputs.rockerAngle)),heaveSpringMotionRatio:Nh(a,n.outputs.heaveSpring-r.outputs.heaveSpring),rollSpringMotionRatio:Nh(a,n.outputs.rollSpring-r.outputs.rollSpring),antiDive:l.antiDive,antiDiveAngle:l.antiDiveAngle,antiLift:l.antiLift,antiLiftAngle:l.antiLiftAngle,antiSquat:l.antiSquat,antiSquatAngle:l.antiSquatAngle}}function __(e,t){let n=p_(e);if(t.length===0)return n;let r=(e,n)=>{let r=t.map(e).filter(e=>Number.isFinite(e));return r.length>0?m_(r):n};return{motionRatio:r(e=>e.motionRatio,n.motionRatio),camberGradient:r(e=>e.camberGradient,n.camberGradient),toeGradient:r(e=>e.toeGradient,n.toeGradient),thirdElementMotionRatio:r(e=>e.thirdElementMotionRatio,n.thirdElementMotionRatio),rockerMotionRatio:r(e=>e.rockerMotionRatio,n.rockerMotionRatio),heaveSpringMotionRatio:r(e=>e.heaveSpringMotionRatio,n.heaveSpringMotionRatio),rollSpringMotionRatio:r(e=>e.rollSpringMotionRatio,n.rollSpringMotionRatio),antiDive:r(e=>e.antiDive,n.antiDive),antiDiveAngle:r(e=>e.antiDiveAngle,n.antiDiveAngle),antiLift:r(e=>e.antiLift,n.antiLift),antiLiftAngle:r(e=>e.antiLiftAngle,n.antiLiftAngle),antiSquat:r(e=>e.antiSquat,n.antiSquat),antiSquatAngle:r(e=>e.antiSquatAngle,n.antiSquatAngle)}}function v_(e){return b_(e)}function y_(e,t,n,r={}){let i=f_(e,t,n,r),a=r.useSteeringModel??Math.abs(n)>1e-9;if(r.includeBumpDerivativeMetrics===!1||a)return i;let o=(e.suspension.macPherson?_h:[gh]).flatMap(a=>{let o=f_(e,t+a,n,{...r,initialPose:i.pose,includeBumpDerivativeMetrics:!1}),s=f_(e,t-a,n,{...r,initialPose:i.pose,includeBumpDerivativeMetrics:!1}),c=v_(o),l=v_(s);if(c&&l)return[g_(e,i,s,o,a)];let u=[];return c&&u.push(h_(e,i,o,a)),l&&u.push(h_(e,i,s,-a)),u}),s=lg(e,i),c=ag(e,i,s.positive,s.negative),l=ug(e,i),u=Eg(e,i,l.positive,l.negative);return o.length===0&&!c&&!u?i:{...i,outputs:{...i.outputs,...c??{},...o.length>0?__(i,o):{},...u??{}}}}function b_(e){let t=Math.abs(e.residual),n=e.outputs.armLengthError;return Number.isFinite(t)&&t<=.05&&Number.isFinite(n)&&n<=5e-4}function x_(e){return!b_(e)}function S_(e,t,n,r={}){return y_(e,t,n,{...r,solveTolerance:r.solveTolerance??ah,mainMaxIterations:r.mainMaxIterations??oh,rockerMaxIterations:r.rockerMaxIterations??sh,cBarMaxIterations:r.cBarMaxIterations??ch,tBarMaxIterations:r.tBarMaxIterations??lh})}function C_(e,t,n,r={}){return{bump:t,steer:n,roll:0,...e.outputs,converged:e.converged,...r}}function w_(e){let t=Math.max(2,Math.round(e));return t%2==0?t:t+1}function T_(e,t){let n=Math.max(0,e);return n<=0?0:n/Math.max(1,w_(t)/2)}function E_(e,t,n){if(e<=0||t<=0)return[0];let r=[0],i=0;for(;i<e-mh;)i+=t,r.push(k_(n*i));return r}function D_(e,t,n,r,i,a={}){let o=a.useSteeringModel??Math.abs(i)>1e-9,s=S_(e,0,i,{...a,useSteeringModel:o}),c=[];if(x_(s))return[C_(s,0,i)];c.push(C_(s,0,i));let l=T_(t,n);if(l<=0)return c;let u=s.pose,d=0;for(;d<t-mh;){d+=l;
4112let t=k_(r*d),n=S_(e,t,i,{...a,useSteeringModel:o,initialPose:u});if(c.push(C_(n,t,i)),x_(n))break;u=n.pose}return c}function O_(e,t,n){let r=new Map;return e.forEach(e=>r.set(Number(e[n].toFixed(9)),e)),t.forEach(e=>r.set(Number(e[n].toFixed(9)),e)),Array.from(r.values()).sort((e,t)=>e[n]-t[n])}function k_(e){return Math.abs(e)<1e-9?0:Number(e.toFixed(9))}function A_(e,t,n={}){let r=Math.abs(e.geometry.right.wheelCenter.y),i=Math.tan(t.roll*ih)*r,a=n.useSteeringModel??Math.abs(t.steer)>1e-9;return j_(e,t,y_(e,t.bump+i,t.steer,{useSteeringModel:a}),y_(e,t.bump-i,-t.steer,{useSteeringModel:a}))}function j_(e,t,n,r){let i=n.elementState,a=r.elementState,o=e.elements.antirollTBar&&i&&a?l_(e,$g(e),i.tLink,wh(a.tLink),{solveTolerance:ah,tBarMaxIterations:lh}):null,s=e.elements.antirollCBar&&i&&a?-(i.cBarAngle-a.cBarAngle)*fh:0,c=o?-o.angleY*fh:0,l=o?-o.angleX*fh:0,u=o&&e.elements.thirdElement?Ch(o.third,e.elements.thirdElementChassis):0,d=e=>({...e,converged:e.converged&&(o?.converged??!0),residual:Math.max(e.residual,Math.abs(o?.residual??0)),outputs:{...e.outputs,cBarRotation:s,tBarTorsion:c,tBarInclination:l,thirdElement:u}}),f=d(n),p=d(r),m=dg(e,n,r),h=m?Zh(e,m):null,g=mg(f,h),_=mg(p,h),v=Sf(r.rightCorner),y=m?fg(m):void 0,b=i&&a?{heaveLeft:X(i.heaveLeft),heaveRight:wh(a.heaveLeft),rollLeft:X(i.rollLeft),rollRight:X(a.rollRight),cLinkRight:X(i.cLink),cLinkLeft:wh(a.cLink),cArbRight:X(i.cArb),cArbLeft:wh(a.cArb),cPivotRight:X(e.elements.cPivot),cPivotLeft:wh(e.elements.cPivot),tLinkRight:X(i.tLink),tLinkLeft:wh(a.tLink),tArbRight:X(o?.left??i.tArbLeft),tArbLeft:X(o?.right??wh(a.tArbLeft)),thirdElementArb:X(o?.third??i.thirdElementArb),steeringAxisRightStart:n.steeringAxis?X(n.steeringAxis.start):void 0,steeringAxisRightEnd:n.steeringAxis?X(n.steeringAxis.end):void 0,steeringAxisRightContact:n.steeringAxis?X(n.steeringAxis.contact):void 0,steeringAxisLeftStart:r.steeringAxis?wh(r.steeringAxis.start):void 0,steeringAxisLeftEnd:r.steeringAxis?wh(r.steeringAxis.end):void 0,steeringAxisLeftContact:r.steeringAxis?wh(r.steeringAxis.contact):void 0}:void 0;return{document:{...e,geometry:{right:n.rightCorner,left:v},motion:{wheelPoses:{right:n.pose,left:Th(r.pose)},steerInputDeg:t.steer,steeringPinionAngleDeg:qm(e,t.steer)??t.steer,elements:b,rollCenter:y,centerOfGravity:vg(e)}},rightFrame:g,leftFrame:_}}function M_(e){let t=_f(e.run.bumpSteps,12),n=D_(e,e.run.bumpMax,t,1,0);return O_(D_(e,e.run.reboundMax,t,-1,0),n,`bump`)}function N_(e){let t=_f(e.run.steerSteps,12),n=xh(e,`C Factor`,0),r=Array.from({length:t+1},(n,r)=>e.run.steeringWheelAngleMax*r/t),i=Array.from({length:t+1},(n,r)=>-e.run.steeringWheelAngleMax*r/t),a=[],o;for(let t of r){let n=y_(e,0,t,{useSteeringModel:!0,initialPose:o});if(a.push({steer:t,frame:n}),x_(n))break;o=n.pose}let s=[],c;for(let t of i){let n=y_(e,0,t,{useSteeringModel:!0,initialPose:c});if(s.push({steer:t,frame:n}),x_(n))break;c=n.pose}let l=y_(e,0,bh,{useSteeringModel:!0}),u=y_(e,0,-bh,{useSteeringModel:!0}),d=Dg(e,l.outputs.toe,u.outputs.toe,bh),f=a.map(({steer:t,frame:r},i)=>{let a=s[i]?.frame,o=i===0||!a?a?Og(e,r,a,d):d:Dg(e,r.outputs.toe,a.outputs.toe,Math.abs(t)),c=i===0||!a?0:kg(e,r,a),l=a?pg(e,r,a):null,u=a?(r.outputs.heightDelta+a.outputs.heightDelta)*.5:r.outputs.heightDelta,f=a?_g(r,a):NaN;return{bump:0,steer:t,steeringWheelAngle:t,rackTravel:t*n/360,roll:0,...r.outputs,...l,rollAngle:c,steeringRatio:o.steeringRatio,ackermann:o.ackermann,meanRadius:o.meanRadius,ackermannDelta:o.ackermannDelta,ackermannIdealDelta:o.ackermannIdealDelta,ackermannOuterDelta:o.ackermannOuterDelta,heightDelta:r.outputs.heightDelta,meanHeightDelta:u,axleTrackDelta:f,roadWheelDifference:o.roadWheelDifference,converged:r.converged&&(a?.converged??!0)}});return O_(s.map(({steer:t,frame:r},i)=>{let o=a[i]?.frame,s=i===0||!o?o?Og(e,o,r,d):d:Dg(e,o.outputs.toe,r.outputs.toe,Math.abs(t)),c=i===0||!o?0:kg(e,r,o),l=o?pg(e,r,o):null,u=o?(r.outputs.heightDelta+o.outputs.heightDelta)*.5:r.outputs.heightDelta,f=o?_g(r,o):NaN;return{bump:0,steer:t,steeringWheelAngle:t,rackTravel:t*n/360,roll:0,...r.outputs,...l,rollAngle:c,steeringRatio:s.steeringRatio,ackermann:s.ackermann,meanRadius:s.meanRadius,ackermannDelta:s.ackermannDelta,ackermannIdealDelta:s.ackermannIdealDelta,ackermannOuterDelta:s.ackermannOuterDelta,heightDelta:r.outputs.heightDelta,meanHeightDelta:u,axleTrackDelta:f,roadWheelDifference:s.roadWheelDifference,converged:r.converged&&(o?.converged??!0)}}),f,`steer`)}function P_(e){let t=wf(e.run),{min:n,max:r}=Cf(e.run,Math.abs(e.geometry.right.wheelCenter.y)),i=.1,a=e.geometry.left.wheelCenter.y>=e.geometry.right.wheelCenter.y?`left`:`right`,o=t=>{let n=t.motion?.elements;return{heaveSpringLength:e.elements.heaveSpring&&n?Ch(n.heaveLeft??e.elements.heaveLeft,n.heaveRight??e.elements.heaveRight):0,rollSpringLength:e.elements.rollSpring&&n?Ch(n.rollLeft??e.elements.rollLeft,n.rollRight??e.elements.rollRight):0}};return Array.from({length:t+1},(s,c)=>{let l=n+(r-n)*c/t,u=A_(e,{bump:0,steer:0,roll:l}),d=A_(e,{bump:0,steer:0,roll:l+i}),f=a===`left`?u.leftFrame:u.rightFrame,p=a===`left`?d.leftFrame:d.rightFrame,m=pg(e,u.rightFrame,u.leftFrame),{heaveSpringLength:h,rollSpringLength:g}=o(u.document),_=o(d.document),v=Nh(_.heaveSpringLength-h,i),y=Nh(_.rollSpringLength-g,i);return{bump:0,steer:0,roll:l,...f.outputs,...m,heaveSpring:h,rollSpring:g,heaveSpringMotionRatio:v,rollSpringMotionRatio:y,rollAngle:l,relativeCamber:f.outputs.camber-l,cBarTorsion:f.outputs.cBarRotation,tBarTorsion:f.outputs.tBarTorsion,tBarInclination:f.outputs.tBarInclination,converged:!!(f.converged&&p.converged)}})}function F_(e){let t=wf(e.run),{min:n,max:r}=Cf(e.run,Math.abs(e.geometry.right.wheelCenter.y)),i=Math.abs(e.geometry.right.wheelCenter.y),a=.1,o=[],s=[];for(let c=0;c<=t;c+=1){let l=n+(r-n)*c/t,u=Math.tan(l*ih)*i,d=A_(e,{bump:0,steer:0,roll:l}),f=A_(e,{bump:0,steer:0,roll:l+a}),p=d.rightFrame,m=d.leftFrame,h=f.leftFrame,g=pg(e,p,m),_=Nh(h.outputs.heaveSpring-m.outputs.heaveSpring,a),v=Nh(h.outputs.rollSpring-m.outputs.rollSpring,a);o.push({bump:-u,steer:0,roll:l,...m.outputs,...g,heaveSpringMotionRatio:_,rollSpringMotionRatio:v,rollAngle:l,relativeCamber:m.outputs.camber-l,cBarTorsion:m.outputs.cBarRotation,tBarTorsion:m.outputs.tBarTorsion,tBarInclination:m.outputs.tBarInclination,converged:m.converged}),s.push({bump:u,steer:0,roll:l,...p.outputs,...g,heaveSpringMotionRatio:_,rollSpringMotionRatio:v,rollAngle:l,relativeCamber:p.outputs.camber+l,cBarTorsion:p.outputs.cBarRotation,tBarTorsion:p.outputs.tBarTorsion,tBarInclination:p.outputs.tBarInclination,converged:p.converged})}return{leftSeries:o,rightSeries:s}}function I_(e){let t=_f(e.run.bumpSteps,12),n=(n,r)=>{let i=E_(n,T_(n,t),r),a=e.run.bumpSteerAngle,o=D_(e,n,t,r,0,{useSteeringModel:!0}),s=new Map(o.map(e=>[Number(e.bump.toFixed(9)),e])),c=S_(e,0,a,{useSteeringModel:!0}),l=S_(e,0,-a,{useSteeringModel:!0}),u=kg(e,c,l),d=pg(e,c,l);if(x_(c)||x_(l)){let e=s.get(0);return e?[{...c.outputs,...d,bump:0,steer:a,roll:0,camberNoSteer:e.camber,toeNoSteer:e.toe,camberRightSteer:c.outputs.camber,toeRightSteer:c.outputs.toe,relativeCamberRightSteer:c.outputs.camber+u,camberLeftSteer:l.outputs.camber,toeLeftSteer:l.outputs.toe,relativeCamberLeftSteer:l.outputs.camber+u,bumpSteerRollAngle:u,rockerRightSteer:c.outputs.rockerAngle,rockerLeftSteer:l.outputs.rockerAngle,converged:!!(e.converged&&c.converged&&l.converged)}]:[]}let f=c.pose,p=l.pose,m=[];for(let t of i){let n=Number(t.toFixed(9)),r=s.get(n);if(!r)continue;
4112let i=S_(e,t,a,{useSteeringModel:!0,initialPose:f}),o=S_(e,t,-a,{useSteeringModel:!0,initialPose:p}),c=pg(e,i,o);if(m.push({...i.outputs,...c,bump:t,steer:a,roll:0,camberNoSteer:r.camber,toeNoSteer:r.toe,camberRightSteer:i.outputs.camber,toeRightSteer:i.outputs.toe,relativeCamberRightSteer:i.outputs.camber+u,camberLeftSteer:o.outputs.camber,toeLeftSteer:o.outputs.toe,relativeCamberLeftSteer:o.outputs.camber+u,bumpSteerRollAngle:u,rockerRightSteer:i.outputs.rockerAngle,rockerLeftSteer:o.outputs.rockerAngle,converged:!!(r.converged&&i.converged&&o.converged)}),x_(i)||x_(o))break;f=i.pose,p=o.pose}return m};return O_(n(e.run.reboundMax,-1),n(e.run.bumpMax,1),`bump`)}var L_=11,R_=11,z_=48;function B_(e){return e.replace(/'/g,`''`)}function V_(e){if(!Number.isFinite(e))return`0.`;let t=Number(e.toFixed(6));return Number.isInteger(t)?`${t}.`:String(t)}function H_(e){return e.replace(/\.[^.]+$/i,``).trim()||`Suspension`}function U_(e){if(!e)return null;let t=e.trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(t)?{r:Number.parseInt(t.slice(1,3),16)/255,g:Number.parseInt(t.slice(3,5),16)/255,b:Number.parseInt(t.slice(5,7),16)/255}:null}function W_(e){return`${H_(e)}_wheel_envelope.step`}function G_(e){return e.vehicle.tyreWidth||e.vehicle.rimWidth*25.4||e.vehicle.wheelRadius*.8}function K_([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function q_(e,t){let n=K_(e);return{x:n[0][0]*t.x+n[0][1]*t.y+n[0][2]*t.z+e[3],y:n[1][0]*t.x+n[1][1]*t.y+n[1][2]*t.z+e[4],z:n[2][0]*t.x+n[2][1]*t.y+n[2][2]*t.z+e[5]}}function J_(e){return[-e[0],-e[1],e[2],e[3],-e[4],e[5]]}function Y_(e){return Math.abs(e)<1e-9?0:Number(e.toFixed(9))}function X_(e,t){let n=Math.max(0,e);if(n<=0)return[];let r=Math.max(1,Math.floor(Math.max(3,Math.round(t))/2));return Array.from({length:r},(e,t)=>Y_(n*(1-(1-(t+1)/r)**2.4)))}function Z_(e,t,n){let r=Math.max(0,Math.min(e,t)),i=Math.max(0,Math.max(e,t));return i-r<=1e-6||n<=0?[]:Array.from({length:n},(e,t)=>{let a=1-(1-(t+1)/(n+1))**2.4;return Y_(r+(i-r)*a)}).filter((e,t,n)=>e>r+1e-6&&e<i-1e-6&&(t===0||Math.abs(e-n[t-1])>1e-6))}function Q_(e,t,n,r,i){let a=J_(t);if(i&&i.fullProfile.length>=2&&i){i.fullProfile.forEach(t=>{let r=Math.max(n-t.z,.5);for(let n=0;n<z_;n+=1){let i=n/z_*Math.PI*2,o=q_(a,{x:Math.sin(i)*r,y:t.y,z:-Math.cos(i)*r});e.push(new W(o.x,o.y,o.z))}});return}let o=r*.5;[-o,o].forEach(t=>{for(let r=0;r<z_;r+=1){let i=r/z_*Math.PI*2,o=q_(a,{x:Math.cos(i)*n,y:t,z:Math.sin(i)*n});e.push(new W(o.x,o.y,o.z))}})}function $_(e,t){return e.frameCount+=1,t.converged||(e.nonConvergedFrames+=1),t.converged&&b_(t)}function ev(e,t,n,r){e.samples.push({bump:t,steer:n,frame:r})}function tv(e,t,n,r,i){let a=t,o=0;for(let t of e){let e=r(t,a);if($_(n,e)){a=e.pose,o=t,i(e,t);continue}for(let e of Z_(o,t,4)){let t=r(e,a);$_(n,t)&&(a=t.pose,o=e,i(t,e))}break}}function nv(e,t,n,r,i,a,o,s,c){r.length!==0&&tv(r,i,a,(r,i)=>S_(e,t,-Y_(n*r),{initialPose:i,useSteeringModel:!0}),(e,r)=>{ev(a,t,-Y_(n*r),e),Q_(a.points,e.pose,o,s,c)})}function rv(e,t,n,r,i,a,o,s){ev(i,t,0,n),Q_(i.points,n.pose,a,o,s),nv(e,t,-1,r,n.pose,i,a,o,s),nv(e,t,1,r,n.pose,i,a,o,s)}function iv(e,t,n,r,i,a,o,s,c){n.length!==0&&tv(n,r,a,(n,r)=>S_(e,Y_(t*n),0,{initialPose:r,useSteeringModel:!1}),(n,r)=>{rv(e,Y_(t*r),n,i,a,o,s,c)})}function av(e,t){let n=e.vehicle.wheelRadius,r=G_(e),i=!!(t&&t.fullProfile.length>=2);if(!Number.isFinite(n)||n<=0||!i&&(!Number.isFinite(r)||r<=0))throw Error(`Wheel envelope requires positive wheel radius and width.`);let a=e.run.calculateBump,o=e.run.calculateSteer,s=a?X_(Math.max(0,Math.abs(e.run.reboundMax)),L_):[],c=a?X_(Math.max(0,Math.abs(e.run.bumpMax)),L_):[],l=o?X_(Math.max(0,Math.abs(e.run.steeringWheelAngleMax)),R_):[],u={points:[],samples:[],frameCount:0,nonConvergedFrames:0},d=S_(e,0,0,{useSteeringModel:!1});if(!$_(u,d))throw Error(`Wheel envelope requires a valid static wheel pose within the current run limits.`);return rv(e,0,d,l,u,n,r,t),iv(e,-1,s,d.pose,l,u,n,r,t),iv(e,1,c,d.pose,l,u,n,r,t),u}function ov(e,t){let n=av(e,t);return{samples:n.samples,frameCount:n.frameCount,nonConvergedFrames:n.nonConvergedFrames}}function sv(e,t){let n=av(e,t);return{points:n.points,frameCount:n.frameCount,nonConvergedFrames:n.nonConvergedFrames}}function cv(e,t){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}}function lv(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function uv(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function dv(e,t){let n=Math.hypot(e.x,e.y,e.z);return n<=1e-9?t:{x:e.x/n,y:e.y/n,z:e.z/n}}function fv(e){if(e.length<4)throw Error(`Not enough points to build wheel envelope.`);let t=new gf(e),n=t.getAttribute(`position`),r=[],i=[],a=new Map,o=e=>{let t=`${e.x.toFixed(5)}|${e.y.toFixed(5)}|${e.z.toFixed(5)}`,n=a.get(t);if(n!==void 0)return n;r.push(e);let i=r.length;return a.set(t,i),i};for(let e=0;e<n.count;e+=3){let t={x:n.getX(e),y:n.getY(e),z:n.getZ(e)},r={x:n.getX(e+1),y:n.getY(e+1),z:n.getZ(e+1)},a={x:n.getX(e+2),y:n.getY(e+2),z:n.getZ(e+2)},s=[o(t),o(r),o(a)];new Set(s).size===3&&i.push(s)}if(t.dispose(),i.length===0)throw Error(`Wheel envelope is degenerate; check wheel dimensions and suspension travel.`);return{vertices:r,faces:i}}function pv(e,t){let{points:n,frameCount:r,nonConvergedFrames:i}=sv(e,t);return{mesh:fv(n),frameCount:r,nonConvergedFrames:i}}function mv(e){return{vertices:e.vertices.map(e=>({...e,y:-e.y})),faces:e.faces.map(([e,t,n])=>[e,n,t])}}function hv(e){return e.vertices.reduce((e,t)=>
4112e+t.y,0)/Math.max(e.vertices.length,1)>=0?e:mv(e)}function gv(e,t,n,r,i){let a=1,o=[],s=e=>{let t=a;return a+=1,o.push(`#${t}=${e};`),t},c=s(`APPLICATION_CONTEXT('configuration controlled 3d designs of mechanical parts and assemblies')`),l=s(`PRODUCT_DEFINITION('design','',#${s(`PRODUCT_DEFINITION_FORMATION('','',#${s(`PRODUCT('WHEEL_ENVELOPE','WHEEL_ENVELOPE','3DSusp wheel envelope',(#${s(`PRODUCT_CONTEXT('',#${c},'mechanical')`)}))`)})`)},#${s(`PRODUCT_DEFINITION_CONTEXT('part definition',#${c},'design')`)})`),u=s(`(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.))`),d=s(`(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#${s(`UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-6),#${u},'distance_accuracy_value','')`)}))GLOBAL_UNIT_ASSIGNED_CONTEXT((#${u},#${s(`(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.))`)},#${s(`(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT())`)}))REPRESENTATION_CONTEXT('',''))`),f=e.map(({mesh:e,name:t,colorHex:n})=>{let r=e.vertices.map(e=>s(`CARTESIAN_POINT('',(${V_(e.x)},${V_(e.y)},${V_(e.z)}))`)),i=r.map(e=>s(`VERTEX_POINT('',#${e})`)),a=new Map,o=(t,n)=>{let o=Math.min(t,n),c=Math.max(t,n),l=`${o}|${c}`,u=a.get(l);if(u)return u;let d=e.vertices[o-1],f=e.vertices[c-1],p=dv(cv(d,f),{x:1,y:0,z:0}),m=s(`VECTOR('',#${s(`DIRECTION('',(${V_(p.x)},${V_(p.y)},${V_(p.z)}))`)},1.)`),h=s(`LINE('',#${r[o-1]},#${m}
4112)`),g={id:s(`EDGE_CURVE('',#${i[o-1]},#${i[c-1]},#${h},.T.)`),start:o,end:c};return a.set(l,g),g},c=s(`CLOSED_SHELL('',(${e.faces.map(([t,n,i])=>{let a=s(`FACE_OUTER_BOUND('',#${s(`EDGE_LOOP('',(${[[t,n],[n,i],[i,t]].map(([e,t])=>{let n=o(e,t),r=e===n.start&&t===n.end?`.T.`:`.F.`;return s(`ORIENTED_EDGE('',*,*,#${n.id},${r})`)}).map(e=>`#${e}`).join(`,`)}))`)},.T.)`),c=e.vertices[t-1],l=e.vertices[n-1],u=e.vertices[i-1],d=cv(c,l),f=cv(c,u),p=dv(uv(d,f),{x:0,y:0,z:1}),m=dv(d,{x:1,y:0,z:0});Math.abs(lv(m,p))>.999&&(m=dv(f,Math.abs(p.x)<.9?{x:1,y:0,z:0}:{x:0,y:1,z:0}));let h=s(`DIRECTION('',(${V_(p.x)},${V_(p.y)},${V_(p.z)}))`),g=s(`DIRECTION('',(${V_(m.x)},${V_(m.y)},${V_(m.z)}))`);return s(`ADVANCED_FACE('',(#${a}),#${s(`PLANE('',#${s(`AXIS2_PLACEMENT_3D('',#${r[t-1]},#${h},#${g})`)})`)},.T.)`)}).map(e=>`#${e}`).join(`,`)}))`);return{brepId:s(`MANIFOLD_SOLID_BREP('${B_(t)}',#${c})`),color:U_(n)}}),p=s(`SHAPE_REPRESENTATION('WHEEL_ENVELOPE',(${f.map(e=>e.brepId).map(e=>`#${e}`).join(`,`)}),#${d})`);s(`SHAPE_DEFINITION_REPRESENTATION(#${s(`PRODUCT_DEFINITION_SHAPE('','',#${l})`)},#${p})`);let m=f.flatMap(e=>e.color?[s(`STYLED_ITEM('color',(#${s(`PRESENTATION_STYLE_ASSIGNMENT((#${s(`SURFACE_STYLE_USAGE(.BOTH.,#${s(`SURFACE_SIDE_STYLE('',(#${s(`SURFACE_STYLE_FILL_AREA(#${s(`FILL_AREA_STYLE('',(#${s(`FILL_AREA_STYLE_COLOUR('',#${s(`COLOUR_RGB('',${V_(e.color.r)},${V_(e.color.g)},${V_(e.color.b)})`)})`)}))`)})`)}))`)})`)}))`)}),#${e.brepId})`)]:[]);m.length>0&&s(`MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',(${m.map(e=>`#${e}`).join(`,`)}),#${d})`);let h=new Date().toISOString(),g=`3DSusp Web wheel envelope; source=${t}; sides=positive_y_only; geometry=advanced_face; frames=${n}; non_converged=${r}`,_=i?.description??g;return[`ISO-10303-21;`,`HEADER;`,`FILE_DESCRIPTION(('3DSusp Web wheel envelope'),'2;1');`,`FILE_NAME('${B_(i?.fileName??W_(t))}','${h}',('3DSusp Web'),('BSpoke Automotive'),'3DSusp Web','3DSusp Web','${B_(_)}');`,`FILE_SCHEMA(('CONFIG_CONTROL_DESIGN'));`,`ENDSEC;`,`DATA;`,...o,`ENDSEC;`,`END-ISO-10303-21;`,``].join(` 4113`)}function _v(e,t){let{mesh:n,frameCount:r,nonConvergedFrames:i}=pv(e,t),a=[{name:`wheel envelope Y positive`,mesh:hv(n)}];return{fileName:W_(e.sourceName),stepText:gv(a,e.sourceName,r,i),frameCount:r,faceCount:a.reduce((e,t)=>e+t.mesh.faces.length,0),nonConvergedFrames:i}}var vv=48,yv=.1,bv=.25,xv=96,Sv=.5,Cv=1.2,wv=20,Tv=.65;function Ev(e){return{x:e.x,y:e.y,z:e.z}}function Dv(e){return e?Ev(e):void 0}function Ov(e){return e?xf(e):void 0}function kv(e){return[-e[0],-e[1],e[2],e[3],-e[4],e[5]]}function Av(e,t){let n=t.elementState;if(!n)return;let r=Ev(n.heaveLeft),i=Ev(n.heaveRight),a=Ev(n.rollLeft),o=Ev(n.rollRight),s=Ev(n.cLink),c=Ev(n.cArb),l=Ev(n.tLink),u=Ev(n.tArbLeft),d=Ev(n.tArbRight);return{heaveLeft:r,heaveRight:i,rollLeft:a,rollRight:o,cLinkRight:s,cLinkLeft:xf(s),cArbRight:c,cArbLeft:xf(c),cPivotRight:Ev(e.elements.cPivot),cPivotLeft:xf(e.elements.cPivot),tLinkRight:l,tLinkLeft:xf(l),tArbRight:d,tArbLeft:u,thirdElementArb:{x:n.thirdElementArb.x,y:0,z:n.thirdElementArb.z},steeringAxisRightStart:Dv(t.steeringAxis?.start),steeringAxisRightEnd:Dv(t.steeringAxis?.end),steeringAxisRightContact:Dv(t.steeringAxis?.contact),steeringAxisLeftStart:Ov(t.steeringAxis?.start),steeringAxisLeftEnd:Ov(t.steeringAxis?.end),steeringAxisLeftContact:Ov(t.steeringAxis?.contact)}}function jv(e,t){return{...e,geometry:{...e.geometry,right:t.frame.rightCorner,left:Sf(t.frame.rightCorner)},motion:{...e.motion,wheelPoses:{...e.motion?.wheelPoses,right:t.frame.pose,left:kv(t.frame.pose)},steerInputDeg:t.steer,elements:Av(e,t.frame)}}}function Mv(e,t){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}}function Nv(e){return Math.hypot(e.x,e.y,e.z)}function Pv(e,t){let n=Nv(e);return!Number.isFinite(n)||n<=1e-9?t:{x:e.x/n,y:e.y/n,z:e.z/n}}function Fv(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function Iv(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function Lv(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}function Rv(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function zv(e,t,n){return Math.min(Math.max(e,t),n)}function Bv(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}
4113function Vv([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function Hv(e,t){let n=Vv(e.pose);return{x:n[0][0]*t.x+n[0][1]*t.y+n[0][2]*t.z+e.center.x,y:n[1][0]*t.x+n[1][1]*t.y+n[1][2]*t.z+e.center.y,z:n[2][0]*t.x+n[2][1]*t.y+n[2][2]*t.z+e.center.z}}function Uv(e,t){let n=Vv(e.pose),r=Bv(t,e.center);return{x:n[0][0]*r.x+n[1][0]*r.y+n[2][0]*r.z,y:n[0][1]*r.x+n[1][1]*r.y+n[2][1]*r.z,z:n[0][2]*r.x+n[1][2]*r.y+n[2][2]*r.z}}function Wv(e){let t=Math.max(Math.abs(e.radius),1),n=Math.max(Math.min(Math.abs(e.rimRadius),t-1),t*.45),r=Math.max(Math.abs(e.width),1),i=Number.isFinite(e.rimOffset)?e.rimOffset:0,a=Math.min(r*.25,n*.08),o=Math.max(r-2*a,r*.62)*.5;return{id:`wheel:${e.side}`,label:`Wheel ${e.side}`,radius:n,rimCenterY:i,halfCoreWidth:o}}function Gv(e,t,n,r){let i=Bv(t,e),a=Bv(r,n),o=Bv(e,n),s=Rv(i,i),c=Rv(i,a),l=Rv(a,a),u=Rv(i,o),d=Rv(a,o),f=s*l-c*c,p,m=f,h,g=f;f<=1e-9?(p=0,m=1,h=d,g=l):(p=c*d-l*u,h=s*d-c*u,p<0?(p=0,h=d,g=l):p>m&&(p=m,h=d+c,g=l)),h<0?(h=0,-u<0?p=0:-u>s?p=m:(p=-u,m=s)):h>g&&(h=g,-u+c<0?p=0:-u+c>s?p=m:(p=-u+c,m=s));let _=Math.abs(p)<=1e-9?0:p/m,v=Math.abs(h)<=1e-9?0:h/g,y=Iv(e,Lv(i,_)),b=Iv(n,Lv(a,v));return{pointA:y,pointB:b,distance:Nv(Bv(b,y))}}function Kv(e){return e.kind===`upperArm`||e.kind===`lowerArm`||e.kind===`pushRod`||e.kind===`tieRod`||e.kind===`semiAxis`||e.kind===`mainSpring`||e.kind===`heaveSpring`||e.kind===`rollSpring`}function qv(e,t){let n=Mv(e.from,e.to),r=Nv(n);if(!Number.isFinite(r)||r<=1e-6)return null;let i=Ty(e),a=Math.min(Math.max(i,0),.49),o=r*(1-a*2);return!Number.isFinite(o)||o<=1e-6?null:{from:Iv(e.from,Lv(n,a)),to:Iv(e.to,Lv(n,-a)),radius:Math.max(vy(t,e)*.5,.5)}}function Jv(e){return{x:e.x,y:e.y,z:e.z}}function Yv(e,t){let[n,r,i]=e.points;return Pv(Fv(Mv(n,r),Mv(n,i)),t)}function Xv(e,t){let[n,r,i]=t.points;return Jv(new hi(new W(n.x,n.y,n.z),new W(r.x,r.y,r.z),new W(i.x,i.y,i.z)).closestPointToPoint(new W(e.x,e.y,e.z),new W))}function Zv(e,t,n){let[r,i,a]=n.points;return Qv(e,t,r,i,a)}function Qv(e,t,n,r,i){let a=Mv(e,t),o=Nv(a);if(o<=1e-9)return null;let s=new wa(new W(e.x,e.y,e.z),new W(a.x/o,a.y/o,a.z/o)).intersectTriangle(new W(n.x,n.y,n.z),new W(r.x,r.y,r.z),new W(i.x,i.y,i.z),!1,new W);return!s||s.distanceTo(new W(e.x,e.y,e.z))>o+1e-7?null:Jv(s)}function $v(e,t,n,r,i,a){return!!(Qv(e,t,r,i,a)||Qv(t,n,r,i,a)||Qv(n,e,r,i,a)||Qv(r,i,e,t,n)||Qv(i,a,e,t,n)||Qv(a,r,e,t,n))}function ey(e,t,n,r,i,a){let o=[Qv(e,t,r,i,a),Qv(t,n,r,i,a),Qv(n,e,r,i,a),Qv(r,i,e,t,n),Qv(i,a,e,t,n),Qv(a,r,e,t,n)].filter(e=>e!==null),s=o.filter((e,t)=>o.slice(0,t).every(t=>Nv(Bv(e,t))>1e-5));if(s.length<2)return null;let c=null,l=0;for(let e=0;e<s.length;e+=1)for(let t=e+1;t<s.length;t+=1){let n=s[e],r=s[t];if(!n||!r)continue;let i=Nv(Bv(r,n));i>l&&(c={from:n,to:r},l=i)}return c}function ty(e,t){let n=Zv(e.from,e.to,t);if(n)return{segmentPoint:n,trianglePoint:n,distance:0};let r=[{segmentPoint:e.from,trianglePoint:Xv(e.from,t),distance:0},{segmentPoint:e.to,trianglePoint:Xv(e.to,t),distance:0}];r.forEach(e=>{e.distance=Nv(Bv(e.trianglePoint,e.segmentPoint))});let[i,a,o]=t.points;return[[i,a],[a,o],[o,i]].forEach(([t,n])=>{let i=Gv(e.from,e.to,t,n);r.push({segmentPoint:i.pointA,trianglePoint:i.pointB,distance:i.distance})}),r.reduce((e,t)=>t.distance<e.distance?t:e)}function ny(e){return`Rocker ${e.side}`}function ry(e,t){let n=qv(e,t);if(!n||e.kind===`mainSpring`||e.kind===`heaveSpring`||e.kind===`rollSpring`)return n;let r=Mv(n.from,n.to),i=Nv(r),a=Math.min(wv,i*.49);if(a<=1e-9)return n;let o=a/i;return{from:Iv(n.from,Lv(r,o)),to:Iv(n.to,Lv(r,-o)),radius:n.radius}}function iy(e,t,n){let r=Mv(t.from,t.to),i=Nv(r);if(i<=1e-9)return!1;let a=Lv(r,1/i),o=Rv(Mv(t.from,e),a);return o<-1e-7||o>i+1e-7?!1:Nv(Bv(e,Iv(t.from,Lv(a,o))))<=n+1e-7}function ay(e,t){let n=t.radius+bv,r=e.points.some(e=>iy(e,t,n)),i=xy(t.from,t.to,n*2);if(!i)return{collides:r,segments:[]};let[a,o,s]=e.points,c=[],l=!1;
4113return i.faces.forEach(([e,t,n])=>{let r=i.vertices[e-1],u=i.vertices[t-1],d=i.vertices[n-1];if(!r||!u||!d||!$v(a,o,s,r,u,d))return;l=!0;let f=ey(a,o,s,r,u,d);f&&c.push(f)}),{collides:r||l,segments:c}}function oy(e){return`${e.x.toFixed(4)}|${e.y.toFixed(4)}|${e.z.toFixed(4)}`}function sy(e,t,n){let r=Pv(Mv(t.from,t.to),{x:0,y:0,z:0});if(Nv(r)<=1e-9)return!1;let i=Yv(n,ly(r)),a=Pv(Fv(r,i),ly(r)),o=oy(t.from),s=oy(t.to),c=o<s?`${o}|${s}`:`${s}|${o}`;if(e.segmentKeys.has(c))return!1;e.segmentKeys.add(c);let l=Lv(i,.12),u=Lv(a,Tv),d=e.vertices.length+1;return e.vertices.push(Iv(Iv(t.from,l),u),Iv(Iv(t.from,l),Lv(u,-1)),Iv(Iv(t.to,l),Lv(u,-1)),Iv(Iv(t.to,l),u)),e.faces.push([d,d+1,d+2],[d,d+2,d+3]),!0}function cy(e,t,n,r){let i=ry(t,r);if(!i)return!1;let a=ty(i,n);if(a.distance>i.radius+bv)return!1;let o=ay(n,i);if(!o.collides)return!1;let s=!1;if(o.segments.forEach(t=>{s=sy(e,t,n)||s}),!s){let t=Yv(n,{x:0,y:0,z:1}),r=Pv(Mv(n.points[0],n.points[1]),ly(t));s=sy(e,{from:Iv(a.trianglePoint,Lv(r,-.8)),to:Iv(a.trianglePoint,Lv(r,.8))},n)}return s}function ly(e){return Pv(Fv(e,Math.abs(e.y)<.92?{x:0,y:1,z:0}:{x:1,y:0,z:0}),{x:0,y:0,z:1})}function uy(e,t,n,r,i,a,o,s){let c=Lv(n,r),l=Lv(n,-r),u=Lv(i,a),d=Lv(i,-a),f=Lv(o,s),p=Lv(o,-s);[Iv(Iv(Iv(t,c),u),f),Iv(Iv(Iv(t,c),u),p),Iv(Iv(Iv(t,c),d),f),Iv(Iv(Iv(t,c),d),p),Iv(Iv(Iv(t,l),u),f),Iv(Iv(Iv(t,l),u),p),Iv(Iv(Iv(t,l),d),f),Iv(Iv(Iv(t,l),d),p)].forEach(t=>e.push(new W(t.x,t.y,t.z)))}function dy(e,t,n,r){let i=Gv(t.from,t.to,n.from,n.to),a=qv(t,r),o=qv(n,r);if(!a||!o)return!1;let s=a.radius,c=o.radius;if(i.distance>s+c+bv)return!1;let l=Pv(Mv(a.from,a.to),{x:1,y:0,z:0}),u=Pv(Mv(o.from,o.to),{x:0,y:1,z:0}),d=Pv(Bv(i.pointB,i.pointA),{x:0,y:0,z:0});Nv(d)<=1e-9&&(d=ly(l));let f=Pv(Fv(l,d),{x:0,y:0,z:0});Nv(f)<=1e-9&&(f=ly(l));let p=Pv(Fv(u,d),{x:0,y:0,z:0});Nv(p)<=1e-9&&(p=ly(u));let m=Iv(i.pointA,Lv(d,s)),h=Iv(i.pointB,Lv(d,-c));return uy(e,m,l,Math.max(s*.9,3),f,Math.max(s*.55,2),d,Cv*.5),uy(e,h,u,Math.max(c*.9,3),p,Math.max(c*.55,2),d,Cv*.5),!0}function fy(e,t){let n=Wv(t),r=Pv(Bv(Hv(t,{x:0,y:n.rimCenterY+1,z:0}),Hv(t,{x:0,y:n.rimCenterY,z:0})),{x:0,y:1,z:0}),i=null;for(let a=0;a<=xv;a+=1){let o=a/xv,s=Iv(e.from,Lv(Mv(e.from,e.to),o)),c=Uv(t,s),l=zv(c.y,n.rimCenterY-n.halfCoreWidth,n.rimCenterY+n.halfCoreWidth),u=Math.hypot(c.x,c.z),d=u>1e-9?{x:c.x/u,y:0,z:c.z/u}:{x:1,y:0,z:0}
4113,f=Hv(t,{x:d.x*n.radius,y:l,z:d.z*n.radius}),p=Nv(Bv(f,s));if(!i||p<i.distance){let e=Pv(Bv(f,s),ly(r));i={pointWorld:s,wheelBoundaryWorld:f,wheelAxisWorld:r,wheelTangentWorld:Pv(Bv(Hv(t,{x:-d.z,y:0,z:d.x}),Hv(t,{x:0,y:0,z:0})),ly(r)),normalWorld:e,distance:p}}}return i}function py(e,t,n,r){let i=fy(t,n);if(!i)return!1;let a=qv(t,r);if(!a)return!1;let o=a.radius;if(i.distance>o+bv)return!1;let s=Pv(Mv(a.from,a.to),{x:1,y:0,z:0}),c=Pv(Fv(s,i.normalWorld),{x:0,y:0,z:0});return Nv(c)<=1e-9&&(c=ly(s)),uy(e,Iv(i.pointWorld,Lv(i.normalWorld,o)),s,Math.max(o*.9,3),c,Math.max(o*.55,2),i.normalWorld,Cv*.5),uy(e,i.wheelBoundaryWorld,i.wheelAxisWorld,Math.max(o*1.1,4),i.wheelTangentWorld,Math.max(o*1.1,4),i.normalWorld,Cv*.5),!0}function my(e,t,n=Sv){return Nv(Bv(e,t))<=n}function hy(e,t){return e.side!==t.side||!(e.kind===`upperArm`&&t.kind===`upperArm`||e.kind===`lowerArm`&&t.kind===`lowerArm`)?!1:my(e.to,t.to,2)}function gy(e){return e}function _y(e){return e.kind===`upperArm`||e.kind===`lowerArm`||e.kind===`pushRod`||e.kind===`tieRod`||e.kind===`semiAxis`?`link`:e.kind===`mainSpring`||e.kind===`heaveSpring`||e.kind===`rollSpring`?`spring`:null}function vy(e,t){return t.kind===`mainSpring`||t.kind===`heaveSpring`||t.kind===`rollSpring`?Math.max(Math.abs(e.graphics.springDiameter),1):Math.max(Math.abs(t.radiusMm??e.graphics.armDiameter),1)}function yy(e){return`segment:${e.side??`shared`}:${e.kind}:${e.label}`}function by(e){return`rocker:${e.side}`}function xy(e,t,n,r=0){let i=Mv(e,t),a=Nv(i);if(!Number.isFinite(a)||a<=1e-6)return null;let o=Pv(i,{x:1,y:0,z:0}),s=Math.min(Math.max(r,0),.49),c=a*(1-s*2);if(!Number.isFinite(c)||c<=1e-6)return null;let l=Iv(e,Lv(i,s)),u=Iv(t,Lv(i,-s)),d=Math.max(n*.5,.5),f=Pv(Fv(o,Math.abs(o.y)<.92?{x:0,y:1,z:0}:{x:1,y:0,z:0}),{x:0,y:0,z:1}),p=Pv(Fv(o,f),{x:0,y:1,z:0}),m=[Ev(l),Ev(u)],h=[];for(let e=0;e<vv;e+=1){let t=e/vv*Math.PI*2,n=Iv(Lv(f,Math.cos(t)*d),Lv(p,Math.sin(t)*d));m.push(Iv(l,n)),m.push(Iv(u,n))}for(let e=0;e<vv;e+=1){let t=(e+1)%vv,n=3+e*2,r=n+1,i=3+t*2,a=i+1;h.push([n,r,i]),h.push([r,a,i]),h.push([1,i,n]),h.push([2,r,a])}return{vertices:m,faces:h}}function Sy(e){if(e.length===0)return null;let t=[],n=new Map,r=[],i=e=>{let r=`${e.x.toFixed(6)}|${e.y.toFixed(6)}|${e.z.toFixed(6)}`,i=n.get(r);if(i!==void 0)return i;t.push(Ev(e));let a=t.length;return n.set(r,a),a};return e.forEach(e=>{let[t,n,a]=e.points;r.push([i(t),i(n),i(a)])}),t.length>0&&r.length>0?{vertices:t,faces:r}:null}function Cy(e){return e.color}function wy(e){return e[0]?.color??`#67e8f9`}function Ty(e){return e.kind===`mainSpring`||e.kind===`heaveSpring`||e.kind===`rollSpring`?yv:0}function Ey(e){let t=gy(e),n=_m(t,[`left`,`right`]),r=jp(t,[`left`,`right`]),i=[];n.segments.forEach(e=>{let n=_y(e);if(!n)return;let r=xy(e.from,e.to,vy(t,e),Ty(e));r&&i.push({id:yy(e),label:e.label,kind:n,colorHex:Cy(e),mesh:r})});let a=new Map;return n.faces.forEach(e=>{if(e.kind!==`rocker`)return;let t=by(e),n=a.get(t);n?n.push(e):a.set(t,[e])}),a.forEach((e,t)=>{let n=Sy(e);n&&i.push({id:t,label:e[0]?.label??t,kind:`rocker`,colorHex:wy(e),mesh:n})}),{renderDocument:t,model:n,wheels:r,components:i}}function Dy(e,t){t.vertices.forEach(t=>{e.push(new W(t.x,t.y,t.z))})}function Oy(e){if(e.length<4)throw Error(`At least four 3D points are required to build a convex envelope.`);let t=new gf(e),n=t.getAttribute(`position`),r=[],i=[],a=new Map,o=e=>{let t=`${e.x.toFixed(5)}|${e.y.toFixed(5)}|${e.z.toFixed(5)}`,n=a.get(t);if(n!==void 0)return n;r.push(e);let i=r.length;return a.set(t,i),i};for(let e=0;e<n.count;e+=3){let t={x:n.getX(e),y:n.getY(e),z:n.getZ(e)},r={x:n.getX(e+1),y:n.getY(e+1),z:n.getZ(e+1)},a={x:n.getX(e+2),y:n.getY(e+2),z:n.getZ(e+2)};i.push([o(t),o(r),o(a)])}return t.dispose(),{vertices:r,faces:i}}function ky(e,t,n={}){let r=ov(e,t),i=n.includeWheelClashes===!0,a=new Map,o=new Map,s=new Map;r.samples.forEach(t=>{let n=Ey(jv(e,t));n.components.forEach(e=>{let t=a.get(e.id);if(t){Dy(t.points,e.mesh);return}let n={label:e.label,kind:e.kind,colorHex:e.colorHex,points:[]};Dy(n.points,e.mesh),a.set(e.id,n)});let r=n.model.segments.filter(e=>Kv(e)),c=(e,t)=>{let n=o.get(e);if(n)return n;let r={id:e,label:t,points:[]};return o.set(e,r),r},l=(e,t)=>
4113{let n=s.get(e);if(n)return n;let r={id:e,label:t,vertices:[],faces:[],segmentKeys:new Set};return s.set(e,r),r};for(let e=0;e<r.length;e+=1){let t=r[e];if(t)for(let i=e+1;i<r.length;i+=1){let e=r[i];e&&(hy(t,e)||dy(c(`patch:${[yy(t),yy(e)].sort().join(`|link|`)}`,`${t.label} vs ${e.label}`).points,t,e,n.renderDocument))}}n.model.faces.filter(e=>e.kind===`rocker`).forEach(e=>{r.forEach(t=>{cy(l(`curve:${[yy(t),by(e)].sort().join(`|rocker|`)}`,`${t.label} vs ${ny(e)}`),t,e,n.renderDocument)})}),i&&n.renderDocument.graphics.drawWheels&&r.forEach(e=>{n.wheels.forEach(t=>{py(c(`patch:${yy(e)}|wheel:${t.side}`,`${e.label} vs Wheel ${t.side}`).points,e,t,n.renderDocument)})})});let c=Array.from(a.entries()).map(([e,t])=>({id:e,label:t.label,kind:t.kind,colorHex:t.colorHex,mesh:Oy(t.points)}));return c.sort((e,t)=>e.label.localeCompare(t.label)),{meshes:c.map(({id:e,label:t,colorHex:n,mesh:r})=>({id:e,label:t,colorHex:n,mesh:r})),clashMeshes:[...Array.from(o.values()).filter(e=>e.points.length>=4).map(e=>({id:e.id,label:e.label,mesh:Oy(e.points)})),...Array.from(s.values()).filter(e=>e.faces.length>0).map(e=>({id:e.id,label:e.label,mesh:{vertices:e.vertices,faces:e.faces}}))],frameCount:r.frameCount,nonConvergedFrames:r.nonConvergedFrames}}var Ay=[{index:0,key:`bump`,label:`Bump`,unit:`mm`},{index:1,key:`camber`,label:`Camber`,unit:`deg`},{index:2,key:`toe`,label:`Toe`,unit:`deg`},{index:3,key:`rockerAngle`,label:`Rocker angle`,unit:`deg`},{index:4,key:`caster`,label:`Caster`,unit:`deg`},{index:5,key:`kingpin`,label:`Kingpin`,unit:`deg`},{index:6,key:`btt`,label:`Kingpin offset`,unit:`mm`},{index:7,key:`btl`,label:`Caster trail`,unit:`mm`},{index:8,key:`btcr`,label:`Kingpin Offset @WC`,unit:`mm`},{index:9,key:`blcr`,label:`Caster Trail @WC`,unit:`mm`},{index:10,key:`rollCenterDistanceToCg`,label:`RC distance to CG`,unit:`mm`},{index:11,key:`rollCenterHeightGround`,label:`RC height to Ground`,unit:`mm`},{index:32,key:`rollCenterY`,label:`RC Y`,unit:`mm`},{index:12,key:`springLength`,label:`Spring length`,unit:`mm`},{index:13,key:`motionRatio`,label:`Spring motion ratio`,unit:`mm/mm`},{index:14,key:`trackDelta`,label:`Track variation`,unit:`mm`},{index:15,key:`wheelbaseDelta`,label:`Wheelbase variation`,unit:`mm`},{index:16,key:`camberGradient`,label:`Camber gradient`,unit:`deg/10mm`},{index:17,key:`toeGradient`,label:`Toe gradient`,unit:`deg/10mm`},{index:18,key:`heaveSpring`,label:`Heave spring length`,unit:`mm`},{index:19,key:`rollSpring`,label:`Roll spring length`,unit:`mm`},{index:20,key:`cBarRotation`,label:`C-bar rotation`,unit:`deg`},{index:21,key:`tBarTorsion`,label:`T-bar torsion`,unit:`deg`},{index:22,key:`tBarInclination`,label:`T-bar inclination`,unit:`deg`},{index:23,key:`thirdElement`,label:`Third element length`,unit:`mm`},{index:24,key:`thirdElementMotionRatio`,label:`Third element motion ratio`,unit:`mm/mm`},{index:25,key:`rockerMotionRatio`,label:`Rocker motion ratio`,unit:`mm/deg`},{index:26,key:`heaveSpringMotionRatio`,label:`Heave spring motion ratio`,unit:`mm/mm`},{index:27,key:`rollSpringMotionRatio`,label:`Roll spring motion ratio`,unit:`mm/mm`}],jy=[{index:0,key:`bump`,label:`Bump`,unit:`mm`},{index:26,key:`antiDive`,label:`AntiDive`,unit:`%`},{index:27,key:`antiLift`,label:`AntiLift`,unit:`%`},{index:28,key:`antiSquat`,label:`AntiSquat`,unit:`%`},{index:29,key:`antiDiveAngle`,label:`AntiDive angle`,unit:`deg`},{index:30,key:`antiLiftAngle`,label:`AntiLift angle`,unit:`deg`},{index:31,key:`antiSquatAngle`,label:`AntiSquat angle`,unit:`deg`}],My=[{index:0,key:`steeringWheelAngle`,label:`Steering wheel angle`,unit:`deg`},{index:1,key:`camber`,label:`Camber`,unit:`deg`},{index:2,key:`toe`,label:`Toe`,unit:`deg`},{index:3,key:`steeringRatio`,label:`Steering ratio`,unit:`deg/deg`},{index:4,key:`ackermann`,label:`Ackermann`,unit:`%`},{index:5,key:`meanRadius`,label:`Avg Cornering radius`,unit:`m`,chartMin:10,chartMax:200},{index:6,key:`caster`,label:`Caster`,unit:`deg`},{index:7,key:`kingpin`,label:`Kingpin`,unit:`deg`},{index:8,key:`btt`,label:`Kingpin offset`,unit:`mm`},{index:9,key:`btl`,label:`Caster trail`,unit:`mm`},{index:10,key:`btcr`,label:`Kingpin offset @WC`,unit:`mm`},{index:11,key:`blcr`,label:`Caster trail @WC`,unit:`mm`},{index:12,key:`rollAngle`,label:`Roll angle`,unit:`deg`},{index:13,key:`relativeCamber`,label:`Relative camber`,unit:`deg`},{index:14,key:`trackDelta`,label:`SemiTrack variation, LH CP`,unit:`mm`},{index:25,key:`axleTrackDelta`,label:`Axle track variation`,unit:`mm`},{index:15,key:`wheelbaseDelta`,label:`Wheelbase variation`,unit:`mm`},{index:16,key:`heightDelta`,label:`Ride height delta, LH CP`,unit:`mm`},{index:24,key:`meanHeightDelta`,label:`Ride height delta, mean CP`,unit:`mm`},{index:17,key:`springLength`,label:`Spring length`,unit:`mm`},{index:18,key:`rockerAngle`,label:`Rocker angle`,unit:`deg`},{index:19,key:`heaveSpring`,label:`Heave spring length`,unit:`mm`},{index:20,key:`rollSpring`,label:`Roll spring length`,unit:`mm`},{index:21,key:`rollCenterDistanceToCg`,label:`RC distance to CG`,unit:`mm`},{index:22,key:`rollCenterHeightGround`,label:`RC height to Ground`,unit:`mm`},{index:23,key:`rollCenterY`,label:`RC Y`,unit:`mm`}],Ny=[{index:0,key:`steeringWheelAngle`,label:`Steering wheel angle`,unit:`deg`}
4113,{index:1,key:`pinionAngle`,label:`Pinion angle`,unit:`deg`},{index:2,key:`pinionMinusSteeringWheelAngle`,label:`Pinion angle - steering wheel angle`,unit:`deg`}],Py=[{index:0,key:`roll`,label:`Roll angle`,unit:`deg`},{index:1,key:`camber`,label:`Camber`,unit:`deg`},{index:2,key:`relativeCamber`,label:`Relative camber`,unit:`deg`},{index:3,key:`toe`,label:`Toe`,unit:`deg`},{index:4,key:`rockerAngle`,label:`Rocker angle`,unit:`deg`},{index:5,key:`heaveSpring`,label:`Heave spring length`,unit:`mm`},{index:6,key:`rollSpring`,label:`Roll spring length`,unit:`mm`},{index:7,key:`cBarTorsion`,label:`C-bar torsion`,unit:`deg`},{index:8,key:`tBarTorsion`,label:`T-bar torsion`,unit:`deg`},{index:9,key:`tBarInclination`,label:`T-bar inclination`,unit:`deg`},{index:21,key:`rollCenterDistanceToCg`,label:`RC distance to CG`,unit:`mm`},{index:22,key:`rollCenterHeightGround`,label:`RC height to Ground`,unit:`mm`},{index:23,key:`rollCenterY`,label:`RC Y`,unit:`mm`},{index:25,key:`heaveSpringMotionRatio`,label:`Heave spring motion ratio`,unit:`mm/deg`},{index:26,key:`rollSpringMotionRatio`,label:`Roll spring motion ratio`,unit:`mm/deg`}],Fy=[{index:0,key:`bump`,label:`Bump`,unit:`mm`},{index:1,key:`camberNoSteer`,label:`Camber, no steer`,unit:`deg`},{index:2,key:`toeNoSteer`,label:`Toe, no steer`,unit:`deg`},{index:3,key:`camberRightSteer`,label:`Camber, LH wheel`,unit:`deg`},{index:4,key:`toeRightSteer`,label:`Toe, LH wheel`,unit:`deg`},{index:5,key:`relativeCamberRightSteer`,label:`Relative camber, LH wheel`,unit:`deg`},{index:6,key:`camberLeftSteer`,label:`Camber, RH wheel`,unit:`deg`},{index:7,key:`toeLeftSteer`,label:`Toe, RH wheel`,unit:`deg`},{index:8,key:`relativeCamberLeftSteer`,label:`Relative camber, RH wheel`,unit:`deg`},{index:9,key:`rockerRightSteer`,label:`Rocker, LH wheel`,unit:`deg`},{index:10,key:`rockerLeftSteer`,label:`Rocker, RH wheel`,unit:`deg`},{index:11,key:`rollCenterDistanceToCg`,label:`RC distance to CG`,unit:`mm`},{index:12,key:`rollCenterHeightGround`,label:`RC height to Ground`,unit:`mm`},{index:13,key:`rollCenterY`,label:`RC Y`,unit:`mm`}],Iy=[{index:0,key:`bump`,label:`Bump`,unit:`mm`},{index:32,key:`axialShift`,label:`Axial shift`,unit:`mm`}],Ly=[{index:0,key:`bump`,label:`Bump`,unit:`mm`},{index:5,key:`loadRightPushrod`,label:`RH pushrod`,unit:`N`},{index:6,key:`loadLeftPushrod`,label:`LH pushrod`,unit:`N`},{index:7,key:`loadRightSpring`,label:`RH spring`,unit:`N`},{index:8,key:`loadLeftSpring`,label:`LH spring`,unit:`N`},{index:9,key:`loadRightRockerTorque`,label:`RH rocker torque`,unit:`Nmm`},{index:10,key:`loadLeftRockerTorque`,label:`LH rocker torque`,unit:`Nmm`},{index:11,key:`loadCBarForce`,label:`C-bar link force`,unit:`N`},{index:12,key:`loadTBarForce`,label:`T-bar link force`,unit:`N`},{index:13,key:`loadThirdElementForce`,label:`Third element force`,unit:`N`}],Ry=[`Build relative wheel-point coordinates from the static setup.`,`Solve the six wheel pose variables with Newton iterations.`,`Recompute absolute points for drawing and animation frames.`,`Run rocker, C-bar and T-bar solvers after each wheel pose update.`,`Fill bump, rebound, steer, roll and bump-steer result channels.`];function zy(e,t){return{x:(e.x+t.x)*.5,y:(e.y+t.y)*.5,z:(e.z+t.z)*.5}}function By(e,t,n){let r=n.y-t.y;if(Math.abs(r)<=1e-9)return(t.z+n.z)*.5;let i=(e-t.y)/r;return t.z+(n.z-t.z)*i}function Vy([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function Hy(e){let t=Math.asin(Math.max(-1,Math.min(1,-e[0][1])));return Math.abs(Math.cos(t))<1e-8?[0,t,Math.atan2(-e[1][2],e[1][0])]:[Math.atan2(e[2][1],e[1][1]),t,Math.atan2(e[0][2],e[0][0])]}function Uy(e,t){let n=Math.cos(t),r=Math.sin(t);return{x:e.x,y:n*e.y-r*e.z,z:r*e.y+n*e.z}}function Wy(e,t){return{axisY:Uy(e.axisY,t),axisZ:Uy(e.axisZ,t)}}function Gy(e,t,n,r){let i=zy(e,t),a=zy(n,r),o=Math.atan2(t.z-e.z,t.y-e.y),s=Math.atan2(r.z-n.z,r.y-n.y)-o,c=Math.cos(s),l=Math.sin(s),u=e=>{let t=e.y-i.y,n=e.z-i.z;return{x:e.x+a.x-i.x,y:a.y+c*t-l*n,z:a.z+l*t+c*n}};return{angleRad:s,origin:i,target:a,point:u,pose:e=>{if(!e)return;let t=Vy(e),[n,r,i]=Hy([t[0],[c*t[1][0]-l*t[2][0],c*t[1][1]-l*t[2][1],c*t[1][2]-l*t[2][2]],[l*t[1][0]+c*t[2][0],l*t[1][1]+c*t[2][1],l*t[1][2]+c*t[2][2]]]),a=u({x:e[3],y:e[4],z:e[5]});return[n,r,i,a.x,a.y,a.z]}}}function Ky(e,t,n){if(Math.abs(n.steer)>1e-9&&Math.abs(n.bump)<=1e-9&&Math.abs(n.roll)<=1e-9){let e={x:0,y:0,z:0};return{angleRad:0,origin:e,target:e,point:e=>({...e}),pose:e=>e?[...e]:void 0}}return Gy(mm(e,`right`),mm(e,`left`),mm(t,`right`),mm(t,`left`))}function qy(e,t){return{chassis:{topFront:t(e.chassis.topFront),top
4113Rear:t(e.chassis.topRear),bottomFront:t(e.chassis.bottomFront),bottomRear:t(e.chassis.bottomRear),tieRod:t(e.chassis.tieRod),pushRod:t(e.chassis.pushRod),spring:t(e.chassis.spring)},wheel:{topFront:t(e.wheel.topFront),topRear:t(e.wheel.topRear),bottomFront:t(e.wheel.bottomFront),bottomRear:t(e.wheel.bottomRear),tieRod:t(e.wheel.tieRod),pushRod:t(e.wheel.pushRod),spring:t(e.wheel.spring)},rocker:{axisStart:t(e.rocker.axisStart),axisEnd:t(e.rocker.axisEnd)},wheelCenter:t(e.wheelCenter)}}function Jy(e,t,n){mm(t,`right`),mm(t,`left`);let r=mm(e,`right`),i=mm(e,`left`),a=Ky(e,t,n),o=a.point,s=e.motion?.elements,c=e.motion?.rollCenter,l=bp(e),u=Wy(Op(e,l.steeringWheelPoint,l.joint2Point),a.angleRad),d=e=>e?o(e):void 0,f=o(r),p=o(i),m=c?(()=>{let e=o(c.center);return{center:e,rightContact:f,leftContact:p,rightInstantCenter:o(c.rightInstantCenter),leftInstantCenter:o(c.leftInstantCenter),groundZAtCenter:By(e.y,f,p)}})():void 0;return{...e,centerOfGravityReference:d(e.centerOfGravityReference),elements:{...e.elements,heaveLeft:o(e.elements.heaveLeft),heaveRight:o(e.elements.heaveRight),rollLeft:o(e.elements.rollLeft),rollRight:o(e.elements.rollRight),cLink:o(e.elements.cLink),cArb:o(e.elements.cArb),cPivot:o(e.elements.cPivot),tLink:o(e.elements.tLink),tArb:o(e.elements.tArb),tPivot:o(e.elements.tPivot),thirdElementArb:o(e.elements.thirdElementArb),thirdElementChassis:o(e.elements.thirdElementChassis)},geometry:{right:qy(e.geometry.right,o),left:qy(e.geometry.left,o)},motion:e.motion?{...e.motion,steeringWheelFrame:u,wheelPoses:{right:a.pose(e.motion.wheelPoses?.right),left:a.pose(e.motion.wheelPoses?.left)},rollCenter:m,centerOfGravity:d(e.motion.centerOfGravity),elements:{heaveLeft:d(s?.heaveLeft),heaveRight:d(s?.heaveRight),rollLeft:d(s?.rollLeft),rollRight:d(s?.rollRight),cLinkLeft:d(s?.cLinkLeft),cLinkRight:d(s?.cLinkRight),cArbLeft:d(s?.cArbLeft),cArbRight:d(s?.cArbRight),cPivotLeft:d(s?.cPivotLeft),cPivotRight:d(s?.cPivotRight),tLinkLeft:d(s?.tLinkLeft),tLinkRight:d(s?.tLinkRight),tArbLeft:d(s?.tArbLeft),tArbRight:d(s?.tArbRight),thirdElementArb:d(s?.thirdElementArb),steeringAxisRightStart:d(s?.steeringAxisRightStart),steeringAxisRightEnd:d(s?.steeringAxisRightEnd),steeringAxisRightContact:d(s?.steeringAxisRightContact),contactPatchRight:f,steeringAxisLeftStart:d(s?.steeringAxisLeftStart),steeringAxisLeftEnd:d(s?.steeringAxisLeftEnd),steeringAxisLeftContact:d(s?.steeringAxisLeftContact),contactPatchLeft:p,steeringRackLeft:o(s?.steeringRackLeft??l.rackLeftPoint),steeringRackRight:o(s?.steeringRackRight??l.rackRightPoint),steeringRackCenter:o(s?.steeringRackCenter??l.rackCenterPoint),steeringPinion:o(s?.steeringPinion??l.pinionPoint),steeringJoint1:o(s?.steeringJoint1??l.joint1Point),steeringJoint2:o(s?.steeringJoint2??l.joint2Point),steeringWheel:o(s?.steeringWheel??l.steeringWheelPoint)}}:void 0}}var Yy=1e3,Xy=1e-9,Zy=.5,Qy=`#f59e0b`,$y=`#3b82f6`,eb=`#22c55e`,tb=`#f8d857`,nb=`#a855f7`,rb=`#c084fc`,ib=[`x`,`y`,`z`];function ab(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`value`}function ob(e){return e===`right`?`RH`:e===`left`?`LH`:`CTR`}function sb(e,t){return`loadNode_${ab(e)}_${t}`}function cb(e){return`loadNodeMoment_${ab(e)}`}function lb(e){return`loadAxial_${ab(e)}`}function ub(e){return{x:e.x,y:e.y,z:e.z}}function db(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function fb(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}function pb(e,t){return{x:(e.x+t.x)*.5,y:(e.y+t.y)*.5,z:(e.z+t.z)*.5}}function mb(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}function hb(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function gb(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function _b(e){return Math.hypot(e.x,e.y,e.z)}function vb(e){let t=_b(e);return!Number.isFinite(t)||t<=Xy?{x:1,y:0,z:0}:mb(e,1/t)}function yb(e){return{x:-e.x,y:-e.y,z:-e.z}}function bb(e){return _b(e)<=Xy}function xb(e,t){let n=Number((e[t]??``).trim().replace(`,`,`.`));return Number.isFinite(n)?n:0}function Sb(e,t){let n=e[t]?.trim();return!!(n&&n!==`0`)}function Cb(e,t){return{fx:xb(e,`${t} Fx`),fy:xb(e,`${t} Fy`),fz:xb(e,`${t} Fz`),mx:xb(e,`${t} Mx`),my:xb(e,`${t} My`),mz:xb(e,`${t} Mz`)}}function wb(e){return{fx:e.fx,fy:-e.fy,fz:e.fz,mx:-e.mx,my:e.my,mz:-e.mz}}function Tb(e,t){return e===`x`?{x:t,y:0,z:0}:e===`y`?{x:0,y:t,z:0}:{x:0,y:0,z:t}}function Eb(e){return e===`x`?Qy:e===`y`?$y:eb}function Db(e){let t=Math.abs(e.x),n=Math.abs(e.y),r=Math.abs(e.z);return t>=n&&t>=r?`x`:n>=t&&n>=r?`y`:`z`}function Ob(e,t){return e[t]}function kb(e,t){if(!Number.isFinite(t)||t<=Xy)return 0;let n=Number.isFinite(e.graphics.loadArrowScale)&&e.graphics.loadArrowScale>0?e.graphics.loadArrowScale:100;return t/1e3*n}function Ab(e){return!Number.isFinite(e)||e<=Xy?0:Math.min(190,Math.max(64,Math.sqrt(e)*9.5))}function jb(e){let t=e.fields,n={contactPatch:Cb(t,`Load R CP`),wheelCenter:Cb(t,`Load R WC`)},r=Sb(t,`Load Asymmetric`),i=r?{contactPatch:Cb(t,`Load L CP`),wheelCenter:Cb(t,`Load L WC`)}
4113:{contactPatch:wb(n.contactPatch),wheelCenter:wb(n.wheelCenter)};return{asymmetric:r,followWheelToe:Sb(t,`Load Follow Wheel Toe`),right:n,left:i,heaveForce:e.elements.heaveSpring?xb(t,`Load Heave Force`):0,rollForce:e.elements.rollSpring?xb(t,`Load Roll Force`):0,cBarTorque:e.elements.antirollCBar?xb(t,`Load CBar Torque`):0,tBarTorque:e.elements.antirollTBar?xb(t,`Load TBar Torque`):0,thirdElementForce:e.elements.antirollTBar&&e.elements.thirdElement?xb(t,`Load Third Element Force`):0}}function Mb(e,t,n){let r=e.motion?.wheelPoses?.[t];if(r)return r;let i=e.vehicle.camber*(Math.PI/180),a=e.vehicle.toe*(Math.PI/180);return t===`left`?[i,a,0,n.x,n.y,n.z]:[-i,-a,0,n.x,n.y,n.z]}function Nb([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function Pb(e,t){let n=Nb(e);return{x:n[0][0]*t.x+n[0][1]*t.y+n[0][2]*t.z+e[3],y:n[1][0]*t.x+n[1][1]*t.y+n[1][2]*t.z+e[4],z:n[2][0]*t.x+n[2][1]*t.y+n[2][2]*t.z+e[5]}}function Fb(e,t){let n=e.motion?.elements;if(t===`right`&&n?.contactPatchRight)return n.contactPatchRight;if(t===`left`&&n?.contactPatchLeft)return n.contactPatchLeft;let r=e.geometry[t],i=Mb(e,t,r.wheelCenter),a=[i[0],i[1],0,i[3],i[4],i[5]],o=Nb(a),s=o[2][0],c=o[2][2],l=Math.hypot(s,c)||1;return Pb(a,{x:-e.vehicle.wheelRadius*s/l,y:0,z:-e.vehicle.wheelRadius*c/l})}function Ib(e,t,n){let r=Mb(e,t,e.geometry[t].wheelCenter)[1],i=Math.cos(r),a=Math.sin(r),o={x:i,y:a,z:0},s={x:-a,y:i,z:0},c={x:0,y:0,z:1},l=mb(o,n.fx),u=mb(s,n.fy),d=mb(c,n.fz);return{force:db(db(l,u),d),forceComponents:[{axis:`x`,label:`FX`,vector:l,magnitude:Math.abs(n.fx)},{axis:`y`,label:`FY`,vector:u,magnitude:Math.abs(n.fy)},{axis:`z`,label:`FZ`,vector:d,magnitude:Math.abs(n.fz)}]}}function Lb(e){return{force:{x:e.fx,y:e.fy,z:e.fz},forceComponents:ib.map(t=>({axis:t,label:`F${t.toUpperCase()}`,vector:Tb(t,Ob({x:e.fx,y:e.fy,z:e.fz},t)),magnitude:Math.abs(Ob({x:e.fx,y:e.fy,z:e.fz},t))}))}}function Rb(e,t,n,r,i,a){let o=a?Ib(e,t,i):Lb(i);return{id:`${t}-${n}-input`,label:`${t.toUpperCase()} ${n} input`,point:r,force:o.force,forceComponents:o.forceComponents,moment:{x:i.mx*Yy,y:i.my*Yy,z:i.mz*Yy},side:t,kind:`input`,color:tb}}function zb(e,t){let n=db(gb(fb(e.point,t),e.force),e.moment??{x:0,y:0,z:0});return[e.force.x,e.force.y,e.force.z,n.x,n.y,n.z]}function Bb(e,t,n){let r=gb(fb(e,n),t);return[t.x,t.y,t.z,r.x,r.y,r.z]}function Vb(e,t){return e.map(e=>e.reduce((e,n,r)=>e+n*(t[r]??0),0))}function Hb(e,t,n){let r=Vb(e,t);return Math.hypot(...r.map((e,t)=>e-(n[t]??0)))}function Ub(e){return Math.max(1e-4,Math.hypot(...e)*1e-6)}function Wb(e){if(e===0)return`0`;let t=Math.abs(e);return t>=1e4||t<.001?e.toExponential(3):e.toFixed(4)}function Gb(e,t){let n=t>0?e/t:1/0;return`Equilibrium residual ${Wb(e)} exceeds tolerance ${Wb(t)} (${Wb(n)}x).`}function Kb(e,t){let n=e.reduce((e,t)=>Math.max(e,...t.map(e=>Math.abs(e))),0),r=t.reduce((e,t)=>Math.max(e,Math.abs(t)),0);return Math.max(1e-9,Math.max(n,r,1)*1e-10)}function qb(e,t){let n=e.length,r=e[0]?.length??0;if(n===0||r===0)return{solution:null,warning:`No load-path columns were available for this body.`};let i=Kb(e,t),a=e.map((e,n)=>[...e.map(e=>e),t[n]??0]),o=[],s=0;for(let e=0;e<r&&s<n;e+=1){let t=s;for(let r=s+1;r<n;r+=1)Math.abs(a[r][e])>Math.abs(a[t][e])&&(t=r);if(Math.abs(a[t][e])<=i)continue;t!==s&&([a[s],a[t]]=[a[t],a[s]]);let c=a[s][e];for(let t=e;t<=r;t+=1)a[s][t]/=c;for(let t=0;t<n;t+=1){if(t===s)continue;let n=a[t][e];if(!(Math.abs(n)<=i))for(let i=e;i<=r;i+=1)a[t][i]-=n*a[s][i]}o.push(e),s+=1}for(let e=0;e<n;e+=1)if(!a[e].slice(0,r).some(e=>Math.abs(e)>i)&&Math.abs(a[e][r])>i)return{solution:null,warning:`The load equations are inconsistent for this geometry/input set.`};if(o.length<r)return{solution:null,warning:`The load path is underdetermined; add a physical spring, torsion bar, or load-path definition.`};let c=Array.from({length:r},()=>0);return o.forEach((e,t)=>{c[e]=a[t][r]??0}),{solution:c,warning:null}}function Jb(e,t){if(e.length===0)return{solution:[],residual:Math.hypot(...t),warning:`No load-path columns were available for this body.`};let n=t.map((t,n)=>e.map(e=>e[n]??0)),r=n.map((e,n)=>{let r=e.reduce((e,t)=>
4113Math.max(e,Math.abs(t)),0);return 1/Math.max(r,Math.abs(t[n]??0),1)}),i=qb(n.map((e,t)=>e.map(e=>e*r[t])),t.map((e,t)=>e*r[t])),a=i.solution;if(!a)return{solution:e.map(()=>0),residual:Math.hypot(...t),warning:i.warning??`The load matrix is singular for this configuration.`};let o=Hb(n,a,t),s=Ub(t);return{solution:a,residual:o,warning:o>s?Gb(o,s):null}}function Yb(e,t){return{topRear:e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top ML - Bottom WB`?t.wheel.topRear:t.wheel.topFront,bottomRear:e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top WB - Bottom ML`?t.wheel.bottomRear:t.wheel.bottomFront}}function Xb(e){let t=e.suspension.mountingPoint.trim().toLowerCase();return t.includes(`top link front`)?`topLinkFront`:t.includes(`top link rear`)?`topLinkRear`:t.includes(`bottom link front`)?`bottomLinkFront`:t.includes(`bottom link rear`)?`bottomLinkRear`:t.includes(`top wishbone`)?`topWishbone`:t.includes(`bottom wishbone`)?`bottomWishbone`:`upright`}function Zb(e){let t=(e.fields[`CBar Mounting`]??``).trim().toLowerCase();return t.includes(`rocker`)?`rocker`:t.includes(`top link front`)?`topLinkFront`:t.includes(`top link rear`)?`topLinkRear`:t.includes(`bottom link front`)?`bottomLinkFront`:t.includes(`bottom link rear`)?`bottomLinkRear`:t.includes(`top wishbone`)?`topWishbone`:t.includes(`bottom wishbone`)?`bottomWishbone`:`upright`}function Qb(e,t,n){let r=e.geometry[t],{topRear:i,bottomRear:a}=Yb(e,r);switch(n){case`topWishbone`:case`topLinkFront`:return r.wheel.topFront;case`topLinkRear`:return i;case`bottomWishbone`:case`bottomLinkFront`:return r.wheel.bottomFront;case`bottomLinkRear`:return a;default:return r.wheel.pushRod}}function $b(e,t,n){let r=e.geometry[t];return n===`topWishbone`?{front:r.chassis.topFront,rear:r.chassis.topRear,wheel:r.wheel.topFront}:n===`bottomWishbone`?{front:r.chassis.bottomFront,rear:r.chassis.bottomRear,wheel:r.wheel.bottomFront}:null}function ex(e,t,n){let r=e.geometry[t],{topRear:i,bottomRear:a}=Yb(e,r);switch(n){case`topLinkFront`:return{chassis:r.chassis.topFront,wheel:r.wheel.topFront,label:`TLF`};case`topLinkRear`:return{chassis:r.chassis.topRear,wheel:i,label:`TLR`};case`bottomLinkFront`:return{chassis:r.chassis.bottomFront,wheel:r.wheel.bottomFront,label:`BLF`};case`bottomLinkRear`:return{chassis:r.chassis.bottomRear,wheel:a,label:`BLR`};default:return null}}function tx(){return .5}function nx(e,t,n){return[`x`,`y`,`z`].map(r=>({id:`${e}-${t}-${r}`,label:t,type:`pointForce`,side:e,point:n,axis:r}))}function rx(e,t,n,r,i){return{id:`${e}-${t}-${i}`,label:t,type:`directionalForce`,side:e,point:n,direction:vb(r)}}function ix(e){let t=vb(e);return vb(gb(t,Math.abs(hb(t,{x:0,y:0,z:1}))<.86?{x:0,y:0,z:1}:{x:0,y:1,z:0}))}function ax(e,t,n,r,i){let a=vb(r),o=gb(a,i),s=_b(o)>Xy?vb(gb(o,a)):ix(a);return[rx(e,t,n,a,`plane-u`),rx(e,t,n,s,`plane-v`)]}function ox(e){return e===`x`?{x:1,y:0,z:0}:e===`y`?{x:0,y:1,z:0}:{x:0,y:0,z:1}}function sx(e,t,n,r){return{id:`${e}-${t}`,label:t,type:`axial`,side:e,chassisPoint:n,wheelPoint:r,direction:vb(fb(n,r))}}function cx(e,t,n,r){return{id:`${e??`center`}-${t}`,label:t,type:`axisMoment`,side:e,point:n,axis:vb(r)}}function lx(e){let t=vb(e),n=vb(gb(Math.abs(hb(t,{x:0,y:0,z:1}))<.86?{x:0,y:0,z:1}:{x:0,y:1,z:0},t));return{localY:n,localZ:vb(gb(t,n))}}function ux(e,t,n){let{localY:r,localZ:i}=lx(n);return[cx(e,`Rocker pivot My`,t,r),cx(e,`Rocker pivot Mz`,t,i)]}function dx(e){let t=gS(e,`right`),n=gS(e,`left`),r=ub(e.elements.tPivot);return vb(fb(pb(n.arb,t.arb),r))}function fx(e,t,n){let{localY:r,localZ:i}=lx(n);return[cx(void 0,`${e} pivot My`,t,r),cx(void 0,`${e} pivot Mz`,t,i)]}function px(e){return e.suspension.configuration===`Pushrod`||e.suspension.configuration===`Pullrod`}function mx(e){return e.suspension.configuration===`Outboard Spring`}function hx(e){return bf(e)}function gx(e){return px(e)||mx(e)&&hx(e)}function _x(e){return mx(e)?`Spring`:`PR`}function vx(e,t,n){return new Set(n.filter(e=>e.side===t&&!bb(e.force)).filter(n=>ex(e,t,n.target)!==null).map(e=>e.target))}function yx(e,t,n,r){let i=r.filter(e=>e.side===t&&e.target===n&&!bb(e.force)).map(e=>e.force);
4113if(Xb(e)===n&&gx(e)){let n=e.geometry[t];i.push(fb(n.chassis.pushRod,n.wheel.pushRod))}let a=i.reduce((e,t)=>db(e,t),{x:0,y:0,z:0});return bb(a)?{x:0,y:0,z:1}:a}function bx(e,t,n){return Array.from(vx(e,t,n)).flatMap(r=>{let i=ex(e,t,r);if(!i)return[];let a=n.filter(e=>e.side===t&&e.target===r&&!bb(e.force)),o=a[0]?.force;if(!o)return[];let s=gb(fb(i.wheel,i.chassis),o);if(_b(s)<=Xy)return[];let c=vb(s),l=a.reduce((e,t)=>e+hb(c,gb(fb(t.point,i.chassis),t.force)),0);return[{label:`${i.label} body`,wheelPoint:i.wheel,chassisPoint:i.chassis,planeNormal:c,appliedMoment:l}]})}function xx(e,t){return t.type!==`directionalForce`||t.label!==e.label||!Ix(t.point,e.wheelPoint)?0:-hb(e.planeNormal,gb(fb(e.wheelPoint,e.chassisPoint),t.direction))}function Sx(e,t,n){return n.filter(e=>e.side===t).filter(n=>n.target===`carrier`||ex(e,t,n.target)!==null).map(e=>({id:e.id,label:e.label,point:e.point,force:e.force,side:t,kind:`element`,color:rb}))}function Cx(e,t,n=[]){let r=e.geometry[t],i=Xb(e),{topRear:a,bottomRear:o}=Yb(e,r);if(e.suspension.macPherson)return{unknowns:[sx(t,`BLF`,r.chassis.bottomFront,r.wheel.bottomFront),sx(t,`BLR`,r.chassis.bottomRear,o),sx(t,`TR`,r.chassis.tieRod,r.wheel.tieRod),...nx(t,`Strut`,r.wheel.pushRod)],singleLinkClosures:[]};let s=[sx(t,`TLF`,r.chassis.topFront,r.wheel.topFront),sx(t,`TLR`,r.chassis.topRear,a),sx(t,`BLF`,r.chassis.bottomFront,r.wheel.bottomFront),sx(t,`BLR`,r.chassis.bottomRear,o),sx(t,`TR`,r.chassis.tieRod,r.wheel.tieRod)],c=vx(e,t,n),l=bx(e,t,n),u=i===`upright`?null:ex(e,t,i);gx(e)&&u&&i!==`upright`&&c.add(i);let d={TLF:`topLinkFront`,TLR:`topLinkRear`,BLF:`bottomLinkFront`,BLR:`bottomLinkRear`},f=s.flatMap(r=>{let i=d[r.label];return!i||!c.has(i)?[r]:ax(t,`${r.label} body`,r.wheelPoint,fb(r.chassisPoint,r.wheelPoint),yx(e,t,i,n))});if(i===`upright`||!gx(e))return gx(e)&&f.push(sx(t,_x(e),r.chassis.pushRod,r.wheel.pushRod)),{unknowns:f,singleLinkClosures:l};let p=Qb(e,t,i);if(i===`topWishbone`)return{mountedTarget:`topWishbone`,singleLinkClosures:l,unknowns:[...nx(t,`Top wishbone`,p),...f.filter(e=>![`TLF`,`TLR`].includes(e.label))]};if(i===`bottomWishbone`)return{mountedTarget:`bottomWishbone`,singleLinkClosures:l,unknowns:[...f.filter(e=>![`BLF`,`BLR`].includes(e.label)),...nx(t,`Bottom wishbone`,p)]};let m={topLinkFront:`TLF`,topLinkRear:`TLR`,bottomLinkFront:`BLF`,bottomLinkRear:`BLR`}[i],h=ex(e,t,i),g=h?ax(t,`${m??h.label} body`,p,fb(h.chassis,h.wheel),fb(r.chassis.pushRod,r.wheel.pushRod)):nx(t,`${m??`link`} body`,p);return{mountedTarget:i,singleLinkClosures:l,unknowns:[...f.filter(e=>e.label!==m),...c.has(i)?[]:g]}}function wx(e,t,n,r){let i=e.geometry[t],{unknowns:a,mountedTarget:o,singleLinkClosures:s}=Cx(e,t,r),c=[...[...n,...Sx(e,t,r)].reduce((e,t)=>{let n=zb(t,i.wheelCenter);return e.map((e,t)=>e+(n[t]??0))},[0,0,0,0,0,0]).map(e=>-e),...s.map(e=>-e.appliedMoment)],l=Jb(a.map(e=>[...Fx(e,i.wheelCenter),...s.map(t=>xx(t,e))]),c),u=a.map((e,t)=>({...e,value:l.solution[t]??0})),d;if(o){let n=Qb(e,t,o);d={target:o,side:t,point:n,forceOnCarrier:u.filter(Zx).filter(e=>_b(fb(e.point,n))<=1e-6).reduce((e,t)=>db(e,Qx(t)),{x:0,y:0,z:0})}}return{unknowns:u,residual:l.residual,rankWarning:l.warning,singleLinkClosures:s,mountedReaction:d}}function Tx(e){if(!mx(e)||!hx(e)||e.suspension.macPherson||e.suspension.integralLink)return null;let t=Xb(e);return t!==`upright`&&ex(e,`right`,t)?t:null}function Ex(e,t,n,r){let i=Tx(e);if(!i)return null;let a=e.geometry[t],{topRear:o,bottomRear:s}=Yb(e,a),c=sx(t,`Spring`,a.chassis.pushRod,a.wheel.pushRod),l=[{target:`topLinkFront`,label:`TLF`,unknown:sx(t,`TLF`,a.chassis.topFront,a.wheel.topFront)},{target:`topLinkRear`,label:`TLR`,unknown:sx(t,`TLR`,a.chassis.topRear,o)},{target:`bottomLinkFront`,label:`BLF`,unknown:sx(t,`BLF`,a.chassis.bottomFront,a.wheel.bottomFront)},{target:`bottomLinkRear`,label:`BLR`,unknown:sx(t,`BLR`,a.chassis.bottomRear,s)},{target:`carrier`,label:`TR`,unknown:sx(t,`TR`,a.chassis.tieRod,a.wheel.tieRod)}],u=new Set([i,...r.filter(e=>e.side===t&&!bb(e.force)).filter(n=>ex(e,t,n.target)!==null).map(e=>e.target)]),d=Array.from(u).flatMap(n=>{let a=ex(e,t,n);if(!a)return[];let o=r.filter(e=>e.side===t&&e.target===n&&!bb(e.force)),s=n===i?c:void 0,l=s?s.direction:o.reduce((e,t)=>
4113db(e,t.force),{x:0,y:0,z:0}),u=gb(fb(a.wheel,a.chassis),l);return _b(u)<=Xy?[]:[{target:n,label:`${a.label} body`,link:a,planeNormal:vb(u),applications:o,springUnknown:s}]});if(d.length===0)return null;let f=new Map(d.map(e=>[e.target,e])),p=[...l.flatMap(e=>{let n=f.get(e.target);return n?ax(t,n.label,n.link.wheel,fb(n.link.chassis,n.link.wheel),n.springUnknown?.direction??n.applications.reduce((e,t)=>db(e,t.force),{x:0,y:0,z:0})):[e.unknown]}).map(e=>({kind:`carrier`,unknown:e})),{kind:`spring`,unknown:c}],m=a.wheelCenter,h=n,g=d.map(e=>e.applications.reduce((t,n)=>t+hb(e.planeNormal,gb(fb(n.point,e.link.chassis),n.force)),0)),_=[...Nx(h,m),...g.map(e=>-e)],v=Jb(p.map(e=>{let t=e.kind===`carrier`?Fx(e.unknown,m):Px(6),n=d.map(t=>{if(e.kind===`spring`&&t.springUnknown){let e=fb(t.springUnknown.wheelPoint,t.link.chassis);return hb(t.planeNormal,gb(e,t.springUnknown.direction))}if(e.kind===`carrier`&&e.unknown.type===`directionalForce`&&e.unknown.label===t.label&&Ix(e.unknown.point,t.link.wheel)){let n=fb(t.link.wheel,t.link.chassis);return-hb(t.planeNormal,gb(n,e.unknown.direction))}return 0});return[...t,...n]}),_),y=p.map((e,t)=>({...e,unknown:{...e.unknown,value:v.solution[t]??0}})),b=y.filter(e=>e.kind===`carrier`).map(e=>e.unknown),x=y.find(e=>e.kind===`spring`)?.unknown,S=d.map(e=>{let n=b.filter(e=>e.type===`directionalForce`).filter(t=>t.label===e.label&&Ix(t.point,e.link.wheel)).reduce((e,t)=>db(e,Xx(t)),{x:0,y:0,z:0}),r=e.applications.reduce((e,t)=>db(e,t.force),{x:0,y:0,z:0}),i=e.springUnknown&&x?.type===`axial`?mb(e.springUnknown.direction,x.value):{x:0,y:0,z:0};return{side:t,label:`${e.link.label} chassis`,point:e.link.chassis,force:db(yb(n),db(r,i))}});return{carrierUnknowns:b,armUnknowns:x?[x]:[],residual:v.residual,warning:Ax(v.warning,v.residual,_),loadedLinkChassisLoads:S}}function Dx(e,t,n){let r=$b(e,t.side,t.target);if(!r)return null;let i=e.geometry[t.side],a=i.wheel.pushRod,o=i.chassis.pushRod,s=_x(e),c=vb(fb(r.rear,r.front)),l=tx(),u=[...[{id:`${t.side}-${t.target}-carrier-transfer`,label:`${t.target} carrier transfer`,point:t.point,force:yb(t.forceOnCarrier),side:t.side},...n.filter(e=>e.side===t.side&&e.target===t.target).map(e=>({id:e.id,label:e.label,point:e.point,force:e.force,side:e.side,kind:`element`,color:rb}))].reduce((e,t)=>{let n=zb(t,r.wheel);return e.map((e,t)=>e+(n[t]??0))},[0,0,0,0,0,0]).map(e=>-e),0],d=[sx(t.side,s,o,a),...nx(t.side,`${t.target} front`,r.front),...nx(t.side,`${t.target} rear`,r.rear)],f=Jb(d.map((e,t)=>{let n=Fx(e,r.wheel);if(t===0||e.type!==`pointForce`)return[...n,0];let i=ox(e.axis),a=e.label.endsWith(`front`)?2*(1-l):0,o=e.label.endsWith(`rear`)?-2*l:0;return[...n,hb(i,c)*(a+o)]}),u);return{unknowns:d.map((e,t)=>({...e,value:f.solution[t]??0})),residual:f.residual,warning:f.warning}}function Ox(e,t,n){let r=ex(e,t.side,t.target);if(!r)return null;let i=e.geometry[t.side],a=_x(e),o=Nx([{id:`${t.side}-${t.target}-carrier-transfer`,label:`${t.target} carrier transfer`,point:t.point,force:yb(t.forceOnCarrier),side:t.side},...n.filter(e=>e.side===t.side&&e.target===t.target).map(e=>({id:e.id,label:e.label,point:e.point,force:e.force,side:e.side,kind:`element`,color:rb}))],r.chassis),s=[sx(t.side,a,i.chassis.pushRod,i.wheel.pushRod),...nx(t.side,`${t.target} chassis`,r.chassis)],c=Jb(s.map(e=>Fx(e,r.chassis)),o);return{unknowns:s.map((e,t)=>({...e,value:c.solution[t]??0})),residual:c.residual,warning:Ax(c.warning,c.residual,o)}}function kx(e,t){return e.filter(e=>e.side===t&&e.target===`rocker`).map(e=>({id:e.id,label:e.label,point:e.point,force:e.force,side:t,kind:`element`,color:rb}))}function Ax(e,t,n){if(!e)return null;let r=Ub(n);return t>r?Gb(t,r):null}function jx(e,t,n){return e.filter(e=>e.side===t&&e.target===n).map(e=>({id:e.id,label:e.label,point:e.point,force:e.force,side:t,kind:`element`,color:rb}))}function Mx(e,t){return e.reduce((e,n)=>{let r=zb(n,t);return e.map((e,t)=>e+(r[t]??0))},[0,0,0,0,0,0])}function Nx(e,t){return Mx(e,t).map(e=>-e)}function Px(e){return Array.from({length:e},()=>0)}function Fx(e,t,n=1){return e.type===`axial`?Bb(e.wheelPoint,mb(e.direction,n),t):e.type===`directionalForce`?Bb(e.point,mb(e.direction,n),t):e.type===`axisMoment`?[0,0,0,e.axis.x*n,e.axis.y*n,e.axis.z*n]:Bb(e.point,mb(ox(e.axis),n),t)}function Ix(e,t){return _b(fb(e,t))<=1e-6}function Lx(e,t,n){if(e.type!==`pointForce`)return 0;let r=ox(e.axis),i=e.label.endsWith(`front`)?2*(1-n):0,a=e.label.endsWith(`rear`)?-2*n:0;return hb(r,t)*(i+a)}function Rx(e,t,n,r){if(!px(e)||mx(e)||e.suspension.macPherson||Xb(e)!==`upright`)return null;let i=e.geometry[t],a=Cx(e,t,r),o=a.singleLinkClosures,s=a.unknowns.filter(e=>!(e.type===`axial`&&e.label===`PR`)),c=sx(t,`PR`,i.chassis.pushRod,i.wheel.pushRod),l=hx(e)?sx(t,`Main spring`,i.chassis.spring,i.wheel.spring):null,u=vb(fb(i.rocker.axisEnd,i.rocker.axisStart)),d=pb(i.rocker.axisStart,i.rocker.axisEnd),f=hx(e)?null:cx(t,`Rocker torsion bar`,d,u),p=nx(t,`Rocker pivot`,d),m=ux(t,d,u),h=[...s.map(e=>({kind:`carrier`,unknown:e})),{kind:`pr`,unknown:c},...l?[{kind:`spring`,unknown:l}]:[],...f?[{kind:`rockerTorsion`,unknown:f}]:[],...p.map(e=>({kind:`rockerPivot`,unknown:e})),...m.map(e=>({kind:`rockerPivot`,unknown:e}
4113))],g=[...n,...Sx(e,t,r)],_=kx(r,t),v=i.wheelCenter,y=i.rocker.axisStart,b=[...Nx(g,v),...o.map(e=>-e.appliedMoment),...Nx(_,y)],x=Jb(h.map(e=>{let t=e.kind===`carrier`||e.kind===`pr`?Fx(e.unknown,v):Px(6),n=e.kind===`pr`&&e.unknown.type===`axial`?Bb(e.unknown.chassisPoint,yb(e.unknown.direction),y):e.kind===`spring`||e.kind===`rockerPivot`||e.kind===`rockerTorsion`?Fx(e.unknown,y):Px(6);return[...t,...o.map(t=>xx(t,e.unknown)),...n]}),b);return{carrierUnknowns:h.map((e,t)=>({...e,unknown:{...e.unknown,value:x.solution[t]??0}})).filter(e=>e.kind===`carrier`||e.kind===`pr`).map(e=>e.unknown),armUnknowns:[],residual:x.residual,warning:Ax(x.warning,x.residual,b)}}function zx(e,t,n,r,i){if(!px(e)||mx(e)||n!==`topWishbone`&&n!==`bottomWishbone`||Xb(e)!==n)return null;let a=$b(e,t,n);if(!a)return null;let o=e.geometry[t],s=Cx(e,t,i),c=s.singleLinkClosures,l=Qb(e,t,n),u=s.unknowns.filter(e=>e.type===`pointForce`&&Ix(e.point,l));if(u.length!==3)return null;let d=s.unknowns.filter(e=>!u.includes(e)),f=sx(t,`PR`,o.chassis.pushRod,o.wheel.pushRod),p=[...nx(t,`${n} front`,a.front),...nx(t,`${n} rear`,a.rear)],m=hx(e)?sx(t,`Main spring`,o.chassis.spring,o.wheel.spring):null,h=vb(fb(o.rocker.axisEnd,o.rocker.axisStart)),g=pb(o.rocker.axisStart,o.rocker.axisEnd),_=hx(e)?null:cx(t,`Rocker torsion bar`,g,h),v=nx(t,`Rocker pivot`,g),y=ux(t,g,h),b=[...d.map(e=>({kind:`carrier`,unknown:e})),...u.map(e=>({kind:`carrierJoint`,unknown:e})),{kind:`pr`,unknown:f},...p.map(e=>({kind:`armPivot`,unknown:e})),...m?[{kind:`spring`,unknown:m}]:[],..._?[{kind:`rockerTorsion`,unknown:_}]:[],...v.map(e=>({kind:`rockerPivot`,unknown:e})),...y.map(e=>({kind:`rockerPivot`,unknown:e}))],x=[...r,...Sx(e,t,i)],S=jx(i,t,n),C=kx(i,t),w=o.wheelCenter,T=a.wheel,E=o.rocker.axisStart,D=vb(fb(a.rear,a.front)),O=tx(),k=[...Nx(x,w),...c.map(e=>-e.appliedMoment),...Nx(S,T),0,...Nx(C,E)],A=Jb(b.map(e=>{let t=e.kind===`carrier`||e.kind===`carrierJoint`?Fx(e.unknown,w):Px(6),n=e.kind===`carrierJoint`?Fx(e.unknown,T,-1):e.kind===`pr`||e.kind===`armPivot`?Fx(e.unknown,T):Px(6),r=e.kind===`armPivot`?Lx(e.unknown,D,O):0,i=e.kind===`pr`&&e.unknown.type===`axial`?Bb(e.unknown.chassisPoint,yb(e.unknown.direction),E):e.kind===`spring`||e.kind===`rockerPivot`||e.kind===`rockerTorsion`?Fx(e.unknown,E):Px(6);return[...t,...c.map(t=>xx(t,e.unknown)),...n,r,...i]}),k),j=b.map((e,t)=>({...e,unknown:{...e.unknown,value:A.solution[t]??0}}));return{carrierUnknowns:j.filter(e=>e.kind===`carrier`||e.kind===`carrierJoint`).map(e=>e.unknown),armUnknowns:j.filter(e=>e.kind===`pr`||e.kind===`armPivot`).map(e=>e.unknown),residual:A.residual,warning:Ax(A.warning,A.residual,k),solvedWishboneTarget:n}}function Bx(e){return e.suspension.suspensionType===`Double Wishbone`&&!e.suspension.macPherson}function Vx(e,t,n,r){let i=Xb(e);if(!Bx(e)||!px(e)||mx(e)||i!==`upright`&&i!==`topWishbone`&&i!==`bottomWishbone`)return null;let a=e.geometry[t],o=$b(e,t,`topWishbone`),s=$b(e,t,`bottomWishbone`);if(!o||!s)return null;let c=[...n,...Sx(e,t,r)],l=jx(r,t,`topWishbone`),u=jx(r,t,`bottomWishbone`),d=kx(r,t),f=i===`topWishbone`||l.length>0,p=i===`bottomWishbone`||u.length>0,m=f?nx(t,`Top wishbone`,o.wheel):[],h=p?nx(t,`Bottom wishbone`,s.wheel):[],g=f?[]:[sx(t,`TLF`,a.chassis.topFront,a.wheel.topFront),sx(t,`TLR`,a.chassis.topRear,o.wheel)],_=p?[]:[sx(t,`BLF`,a.chassis.bottomFront,a.wheel.bottomFront),sx(t,`BLR`,a.chassis.bottomRear,s.wheel)],v=sx(t,`TR`,a.chassis.tieRod,a.wheel.tieRod),y=sx(t,`PR`,a.chassis.pushRod,a.wheel.pushRod),b=f?[...nx(t,`topWishbone front`,o.front),...nx(t,`topWishbone rear`,o.rear)]:[],x=p?[...nx(t,`bottomWishbone front`,s.front),...nx(t,`bottomWishbone rear`,s.rear)]:[],S=hx(e)?sx(t,`Main spring`,a.chassis.spring,a.wheel.spring):null,C=vb(fb(a.rocker.axisEnd,a.rocker.axisStart)),w=pb(a.rocker.axisStart,a.rocker.axisEnd),T=hx(e)?null:cx(t,`Rocker torsion bar`,w,C),E=nx(t,`Rocker pivot`,w),D=ux(t,w,C),O=[...m.map(e=>({kind:`topJoint`,unknown:e})),...h.map(e=>({kind:`bottomJoint`,unknown:e})),...g.map(e=>({kind:`topAxial`,unknown:e})),..._.map(e=>({kind:`bottomAxial`,unknown:e})),{kind:`tieRod`,unknown:v},{kind:`pr`,unknown:y},...b.map(e=>({kind:`topPivot`,unknown:e})),...x.map(e=>({kind:`bottomPivot`,unknown:e})),...S?[{kind:`spring`,unknown:S}]:[],...T?[{kind:`rockerTorsion`,unknown:T}]:[],...E.map(e=>({kind:`rockerPivot`,unknown:e})),...D.map(e=>({kind:`rockerPivot`,unknown:e}))],k=a.wheelCenter,A=o.wheel,j=s.wheel,ee=a.rocker.axisStart,te=vb(fb(o.rear,o.front)),M=vb(fb(s.rear,s.front)),ne=tx(),N=[...Nx(c,k),...f?[...Nx(l,A),0]:[],...p?[...Nx(u,j),0]:[],...Nx(d,ee)],P=Jb(O.map(e=>{let t=e.kind===`topJoint`||e.kind===`bottomJoint`||e.kind===`topAxial`||e.kind===`bottomAxial`||e.kind===`tieRod`||e.kind===`pr`&&i===`upright`?Fx(e.unknown,k):Px(6),n=f?e.kind===`topJoint`?Fx(e.unknown,A,-1):e.kind===`topPivot`||e.kind===`pr`&&i===`topWishbone`?Fx(e.unknown,A):Px(6):[],r=f&&e.kind===`topPivot`?[Lx(e.unknown,te,ne)]:f?[0]:[],a=p?e.kind===`bottomJoint`?Fx(e.unknown,j,-1):e.kind===`bottomPivot`||e.kind===`pr`&&i===`bottomWishbone`?Fx(e.unknown,j):Px(6):[],o=p&&e.kind===`bottomPivot`?[Lx(e.unknown,M,ne)]:p?[0]:[],s=e.kind===`pr`&&e.unknown.type===`axial`?Bb(e.unknown.chassisPoint,yb(e.unknown.direction),ee):e.kind===`spring`||e.kind===`rockerPivot`||e.kind===`rockerTorsion`?Fx(e.unknown,ee):Px(6);return[...t,...n,...r,...a,...o,...s]}),N),re=O.map((e,t)=>({...e,unknown:{...e.unknown,value:P.solution[t]??0}})),ie=i===`upright`?`carrier`:`arm`;return{carrierUnknowns:re.filter(e=>e.kind===`topJoint`||e.kind===`bottomJoint`||e.kind===`topAxial`||e.kind===`bottomAxial`||e.kind===`tieRod`||e.kind===`pr`&&ie===`carrier`).map(e=>e.unknown),armUnknowns:re.filter(e=>e.kind===`topPivot`||e.kind===`bottomPivot`||e.kind===`pr`&&ie===`arm`).map(e=>e.unknown),residual:P.residual,warning:Ax(P.warning,P.residual,N),solvedWishboneTargets:[...f?[`topWishbone`]:[],...p?[`bottomWishbone`]:[]]}}function Hx(e,t,n,r){let i=Xb(e);if(!Bx(e)||!mx(e)||!hx(e)||i!==`topWishbone`&&i!==`bottomWishbone`)return null;let a=e.geometry[t],o=$b(e,t,`topWishbone`),s=$b(e,t,`bottomWishbone`);if(!o||!s)return null;
4113let c=[...n,...jx(r,t,`carrier`)],l=jx(r,t,`topWishbone`),u=jx(r,t,`bottomWishbone`),d=i===`topWishbone`||l.length>0,f=i===`bottomWishbone`||u.length>0,p=d?nx(t,`Top wishbone`,o.wheel):[],m=f?nx(t,`Bottom wishbone`,s.wheel):[],h=d?[]:[sx(t,`TLF`,a.chassis.topFront,a.wheel.topFront),sx(t,`TLR`,a.chassis.topRear,o.wheel)],g=f?[]:[sx(t,`BLF`,a.chassis.bottomFront,a.wheel.bottomFront),sx(t,`BLR`,a.chassis.bottomRear,s.wheel)],_=sx(t,`TR`,a.chassis.tieRod,a.wheel.tieRod),v=sx(t,`Spring`,a.chassis.pushRod,a.wheel.pushRod),y=d?[...nx(t,`topWishbone front`,o.front),...nx(t,`topWishbone rear`,o.rear)]:[],b=f?[...nx(t,`bottomWishbone front`,s.front),...nx(t,`bottomWishbone rear`,s.rear)]:[],x=[...p.map(e=>({kind:`topJoint`,unknown:e})),...m.map(e=>({kind:`bottomJoint`,unknown:e})),...h.map(e=>({kind:`topAxial`,unknown:e})),...g.map(e=>({kind:`bottomAxial`,unknown:e})),{kind:`tieRod`,unknown:_},{kind:`spring`,unknown:v},...y.map(e=>({kind:`topPivot`,unknown:e})),...b.map(e=>({kind:`bottomPivot`,unknown:e}))],S=a.wheelCenter,C=o.wheel,w=s.wheel,T=vb(fb(o.rear,o.front)),E=vb(fb(s.rear,s.front)),D=tx(),O=[...Nx(c,S),...d?[...Nx(l,C),0]:[],...f?[...Nx(u,w),0]:[]],k=Jb(x.map(e=>{let t=e.kind===`topJoint`||e.kind===`bottomJoint`||e.kind===`topAxial`||e.kind===`bottomAxial`||e.kind===`tieRod`?Fx(e.unknown,S):Px(6),n=d?e.kind===`topJoint`?Fx(e.unknown,C,-1):e.kind===`topPivot`||e.kind===`spring`&&i===`topWishbone`?Fx(e.unknown,C):Px(6):[],r=d&&e.kind===`topPivot`?[Lx(e.unknown,T,D)]:d?[0]:[],a=f?e.kind===`bottomJoint`?Fx(e.unknown,w,-1):e.kind===`bottomPivot`||e.kind===`spring`&&i===`bottomWishbone`?Fx(e.unknown,w):Px(6):[],o=f&&e.kind===`bottomPivot`?[Lx(e.unknown,E,D)]:f?[0]:[];return[...t,...n,...r,...a,...o]}),O),A=x.map((e,t)=>({...e,unknown:{...e.unknown,value:k.solution[t]??0}}));return{carrierUnknowns:A.filter(e=>e.kind===`topJoint`||e.kind===`bottomJoint`||e.kind===`topAxial`||e.kind===`bottomAxial`||e.kind===`tieRod`).map(e=>e.unknown),armUnknowns:A.filter(e=>e.kind===`topPivot`||e.kind===`bottomPivot`||e.kind===`spring`).map(e=>e.unknown),residual:k.residual,warning:Ax(k.warning,k.residual,O),solvedWishboneTargets:[...d?[`topWishbone`]:[],...f?[`bottomWishbone`]:[]]}}function Ux(e){return!e.suspension.integralLink||!mx(e)?null:e.suspension.suspensionType===`Top WB - Bottom ML`?`topWishbone`:e.suspension.suspensionType===`Top ML - Bottom WB`?`bottomWishbone`:null}function Wx(e,t,n,r){let i=Ux(e);if(!i)return null;let a=$b(e,t,i);if(!a)return null;let o=e.geometry[t],{topRear:s,bottomRear:c}=Yb(e,o),l=i===`topWishbone`?`BLR`:`TLR`,u=i===`topWishbone`?sx(t,l,o.chassis.bottomRear,c):sx(t,l,o.chassis.topRear,s),d=i===`topWishbone`?[sx(t,`BLF`,o.chassis.bottomFront,o.wheel.bottomFront),u,sx(t,`TR`,o.chassis.tieRod,o.wheel.tieRod),sx(t,`Spring`,o.chassis.pushRod,o.wheel.pushRod)]:[sx(t,`TLF`,o.chassis.topFront,o.wheel.topFront),u,sx(t,`TR`,o.chassis.tieRod,o.wheel.tieRod),sx(t,`Spring`,o.chassis.pushRod,o.wheel.pushRod)],f=nx(t,i===`topWishbone`?`Top wishbone`:`Bottom wishbone`,a.wheel),p=[...nx(t,`${i} front`,a.front),...nx(t,`${i} rear`,a.rear)],m=[...d.map(e=>({kind:e===u?`integralLink`:`carrier`,unknown:e})),...f.map(e=>({kind:`carrierJoint`,unknown:e})),...p.map(e=>({kind:`armPivot`,unknown:e}))],h=o.wheelCenter,g=a.wheel,_=vb(fb(a.rear,a.front)),v=tx(),y=[...n,...jx(r,t,`carrier`)],b=jx(r,t,i),x=[...Nx(y,h),...Nx(b,g),0],S=Jb(m.map(e=>{let t=e.kind===`carrier`||e.kind===`integralLink`||e.kind===`carrierJoint`?Fx(e.unknown,h):Px(6),n=e.kind===`carrierJoint`?Fx(e.unknown,g,-1):e.kind===`integralLink`&&e.unknown.type===`axial`?Bb(e.unknown.chassisPoint,yb(e.unknown.direction),g):e.kind===`armPivot`?Fx(e.unknown,g):Px(6),r=e.kind===`armPivot`?Lx(e.unknown,_,v):0;return[...t,...n,r]}),x),C=m.map((e,t)=>({...e,unknown:{...e.unknown,value:S.solution[t]??0}}));return{carrierUnknowns:C.filter(e=>e.kind===`carrier`||e.kind===`integralLink`||e.kind===`carrierJoint`).map(e=>e.unknown),armUnknowns:C.filter(e=>e.kind===`armPivot`).map(e=>e.unknown),residual:S.residual,warning:Ax(S.warning,S.residual,x),solvedWishboneTarget:i}}function Gx(e,t,n,r){if(!e.suspension.macPherson||e.suspension.suspensionType!==`Double Wishbone`)return null;let i=`bottomWishbone`,a=jx(r,t,i);if(a.length===0)return null;let o=$b(e,t,i);if(!o)return null;let s=e.geometry[t],c=nx(t,`Bottom wishbone`,o.wheel),l=[sx(t,`TR`,s.chassis.tieRod,s.wheel.tieRod),...nx(t,`Strut`,s.wheel.pushRod)],u=[...nx(t,`bottomWishbone front`,o.front),...nx(t,`bottomWishbone rear`,o.rear)],d=[...l.map(e=>({kind:`carrier`,unknown:e})),...c.map(e=>({kind:`carrierJoint`,unknown:e})),...u.map(e=>({kind:`armPivot`,unknown:e}
4113))],f=s.wheelCenter,p=o.wheel,m=vb(fb(o.rear,o.front)),h=tx(),g=[...Nx([...n,...jx(r,t,`carrier`)],f),...Nx(a,p),0],_=Jb(d.map(e=>{let t=e.kind===`carrier`||e.kind===`carrierJoint`?Fx(e.unknown,f):Px(6),n=e.kind===`carrierJoint`?Fx(e.unknown,p,-1):e.kind===`armPivot`?Fx(e.unknown,p):Px(6),r=e.kind===`armPivot`?Lx(e.unknown,m,h):0;return[...t,...n,r]}),g),v=d.map((e,t)=>({...e,unknown:{...e.unknown,value:_.solution[t]??0}}));return{carrierUnknowns:v.filter(e=>e.kind===`carrier`||e.kind===`carrierJoint`).map(e=>e.unknown),armUnknowns:v.filter(e=>e.kind===`armPivot`).map(e=>e.unknown),residual:_.residual,warning:Ax(_.warning,_.residual,g),solvedWishboneTarget:i}}function Kx(e,t,n,r){let i=Vx(e,t,n,r);if(i)return i;let a=Xb(e);return a===`upright`?Rx(e,t,n,r):a===`topWishbone`||a===`bottomWishbone`?zx(e,t,a,n,r):null}function qx(e,t,n,r){let i=$b(e,t,n);if(!i||r.length===0)return null;let a=vb(fb(i.rear,i.front)),o=tx(),s=[...r.reduce((e,t)=>{let n=zb(t,i.wheel);return e.map((e,t)=>e+(n[t]??0))},[0,0,0,0,0,0]).map(e=>-e),0],c=[...nx(t,`${n} front`,i.front),...nx(t,`${n} rear`,i.rear)],l=Jb(c.map(e=>{let t=ox(e.axis),n=Bb(e.point,t,i.wheel),r=e.label.endsWith(`front`)?2*(1-o):0,s=e.label.endsWith(`rear`)?-2*o:0;return[...n,hb(t,a)*(r+s)]}),s);return{unknowns:c.map((e,t)=>({...e,value:l.solution[t]??0})),residual:l.residual,warning:Ax(l.warning,l.residual,s)}}function Jx(e){return mb(ox(e.axis),e.value)}function Yx(e){return e.type===`pointForce`}function Xx(e){return mb(e.direction,e.value)}function Zx(e){return e.type===`pointForce`||e.type===`directionalForce`}function Qx(e){return e.type===`pointForce`?Jx(e):Xx(e)}function $x(e){return Math.abs(e)<=1e-6?`neutral`:e>0?`tension`:`compression`}function eS(e,t,n){return`${e??`center`}-${t}-${n.x.toFixed(6)}-${n.y.toFixed(6)}-${n.z.toFixed(6)}`}function tS(e,t,n,r){return`${e}-${t??`center`}-${n}-${ab(r)}`}function nS(e){return e===`rocker`?`rocker`:e===`arm`||e===`element`?`element`:`wheel`}function rS(e,t){return t===`PR`?`rocker`:`chassis`}function iS(e,t){return e===`carrier`?{nodeType:`element`,force:yb(t)}:e===`arm`||e===`rocker`?{nodeType:`chassis`,force:yb(t)}:{nodeType:`element`,force:t}}function aS(e,t){let n=t===`wheel`?`wheel`:t===`rocker`?`rocker`:t===`element`?`element`:`chassis`;return e.size===1?`${Array.from(e)[0]} ${n}`:e.has(`TLF`)&&e.has(`TLR`)&&Array.from(e).every(e=>e===`TLF`||e===`TLR`)?`Top wishbone ${n}`:e.has(`BLF`)&&e.has(`BLR`)&&Array.from(e).every(e=>e===`BLF`||e===`BLR`)?`Bottom wishbone ${n}`:`${Array.from(e).join(` + `)} ${n}`}function oS(e,t){return kb(e,Math.abs(t.value))}function sS(e){return e===`carrier`?`wheel`:e===`arm`?`arm`:e===`rocker`?`rocker`:`element`}function cS(e,t){return e===`carrier`&&t.label===`PR`?`rocker`:`frame`}function lS(e,t,n){let r=Math.abs(n.value);if(r<=Xy)return[];let i=oS(e,n),a=n.value>0,o=mb(n.direction,a?-r:r),s=mb(n.direction,a?r:-r),c=$x(n.value);return[{id:`${t}-${n.id}-axial-near`,side:n.side,kind:`axial`,label:`${n.label} axial ${c} ${sS(t)} side`,from:ub(n.wheelPoint),vector:o,color:nb,magnitude:r,unit:`N`,visualLengthMm:i},{id:`${t}-${n.id}-axial-far`,side:n.side,kind:`axial`,label:`${n.label} axial ${c} ${cS(t,n)} side`,from:ub(n.chassisPoint),vector:s,color:nb,magnitude:r,unit:`N`,visualLengthMm:i}]}function uS(e,t){let n=t.value/Yy,r=Math.abs(n);return r<Zy?[]:[{id:`${e}-${t.id}-moment`,side:t.side,kind:e===`rocker`?`reaction`:`element`,visualStyle:`moment`,label:t.label,from:t.point,vector:mb(t.axis,n),color:Eb(Db(t.axis)),magnitude:r,unit:`Nm`,visualLengthMm:Ab(r)}]}function dS(e,t,n,r){let i=new Map,a=new Map;t.forEach(t=>{if(t.type===`axial`){let i=mb(t.direction,t.value),o=yb(i),s=nS(r),c=rS(r,t.label);n.axialLoads.push({id:`${r}-${t.id}`,side:t.side,label:t.label,from:t.wheelPoint,to:t.chassisPoint,force:t.value,state:$x(t.value)});let l=eS(t.side,s,t.wheelPoint),u=a.get(l)??{side:t.side,nodeType:s,labels:new Set,point:t.wheelPoint,force:{x:0,y:0,z:0}};u.labels.add(t.label),u.force=db(u.force,i),a.set(l,u),n.nodeReactions.push({id:`${r}-${t.id}-${c}`,side:t.side,nodeType:c,label:`${t.label} ${c===`rocker`?`rocker`:`chassis`}`,point:t.chassisPoint,force:o,magnitude:_b(o)}),n.vectors.push(...lS(e,r,t));return}if(t.type===`axisMoment`){if(t.label===`Rocker torsion bar`){n.vectors.push(...uS(`element`,t));return}if(t.label===`Rocker pivot My`||t.label===`Rocker pivot Mz`){let e=yb(mb(t.axis,t.value));n.nodeReactions.push({id:tS(r,t.side,`chassis`,t.label),side:t.side,nodeType:`chassis`,label:t.label,point:t.point,force:{x:0,y:0,z:0},magnitude:0,moment:e,momentValue:-t.value,momentMagnitude:Math.abs(t.value)})}return}let o=iS(r,Qx(t)),s=`${t.side??`center`}-${o.nodeType}-${t.label}-${t.point.x.toFixed(6)}-${t.point.y.toFixed(6)}-${t.point.z.toFixed(6)}`,c=i.get(s)??{side:t.side,label:t.label,point:t.point,nodeType:o.nodeType,force:{x:0,y:0,z:0}};c.force=db(c.force,o.force),i.set(s,c)}
4113),i.forEach((e,t)=>{n.nodeReactions.push({id:tS(r,e.side,e.nodeType,e.label),side:e.side,nodeType:e.nodeType,label:e.label,point:e.point,force:e.force,magnitude:_b(e.force)})}),a.forEach((e,t)=>{let i=aS(e.labels,e.nodeType);n.nodeReactions.push({id:tS(r,e.side,e.nodeType,i),side:e.side,nodeType:e.nodeType,label:i,point:e.point,force:e.force,magnitude:_b(e.force)})})}function fS(e,t,n){e.suspension.macPherson&&[`right`,`left`].forEach(r=>{let i=t.filter(e=>e.type===`pointForce`&&e.side===r&&e.label===`Strut`).reduce((e,t)=>db(e,Jx(t)),{x:0,y:0,z:0});bb(i)||n.nodeReactions.push({id:`macpherson-${r}-strut-chassis`,side:r,nodeType:`chassis`,label:`Strut chassis`,point:e.geometry[r].chassis.pushRod,force:yb(i),magnitude:_b(i)})})}function pS(e,t,n){t.forEach(t=>{if(!t.barKind||!t.barPoint||t.scalarForce===void 0||Math.abs(t.scalarForce)<=Xy)return;let r=t.barPoint,i=t.point,a=vb(fb(i,r)),o={id:`${t.id}-axial`,label:t.label,type:`axial`,side:t.side,wheelPoint:r,chassisPoint:i,direction:a,value:t.scalarForce};n.axialLoads.push({id:`element-${t.id}-axial`,side:t.side,label:t.label,from:r,to:i,force:t.scalarForce,state:$x(t.scalarForce)}),n.vectors.push(...lS(e,`element`,o))})}function mS(e,t,n,r){let i=e.motion?.elements?.[n];return ub(i||r)}function hS(e,t){return t===`right`?{link:mS(e,`right`,`cLinkRight`,e.elements.cLink),arb:mS(e,`right`,`cArbRight`,e.elements.cArb),pivot:mS(e,`right`,`cPivotRight`,e.elements.cPivot)}:{link:mS(e,`left`,`cLinkLeft`,xf(e.elements.cLink)),arb:mS(e,`left`,`cArbLeft`,xf(e.elements.cArb)),pivot:mS(e,`left`,`cPivotLeft`,xf(e.elements.cPivot))}}function gS(e,t){return t===`right`?{link:mS(e,`right`,`tLinkRight`,e.elements.tLink),arb:mS(e,`right`,`tArbRight`,e.elements.tArb)}:{link:mS(e,`left`,`tLinkLeft`,xf(e.elements.tLink)),arb:mS(e,`left`,`tArbLeft`,xf(e.elements.tArb))}}function _S(e){return{barPoint:mS(e,`right`,`thirdElementArb`,e.elements.thirdElementArb),chassisPoint:ub(e.elements.thirdElementChassis)}}function vS(e,t){if(!e.elements.antirollTBar||!e.elements.thirdElement||Math.abs(t)<=Xy)return null;let n=_S(e),r=vb(fb(n.chassisPoint,n.barPoint));return{id:`third-element-input`,label:`Third element`,point:n.barPoint,force:mb(r,t),kind:`element`,color:rb}}function yS(e,t){if(!e.elements.antirollTBar||!e.elements.thirdElement||Math.abs(t)<=Xy)return null;let n=_S(e);return{id:`third-element-input`,label:`Third element`,type:`axial`,wheelPoint:n.barPoint,chassisPoint:n.chassisPoint,direction:vb(fb(n.chassisPoint,n.barPoint)),value:t}}function bS(e,t,n,r,i,a,o,s,c,l){if(Math.abs(r)<=Xy)return null;let u=vb(fb(a,i)),d=vb(fb(s,o)),f=hb(u,gb(fb(o,i),d));if(Math.abs(f)<=1e-9)return null;let p=r*Yy/f;return{id:e,label:t,side:n,target:l,point:s,force:mb(d,-p),barKind:c,barPoint:o,scalarForce:p,scalarTorque:r}}function xS(e,t,n){if(!e.elements.antirollTBar)return[];let r=gS(e,`right`),i=gS(e,`left`),a=ub(e.elements.tPivot),o=dx(e),s=vS(e,t.thirdElementForce),c=[...Math.abs(t.tBarTorque)>Xy?[{id:`tbar-torque`,label:`T-bar link`,moment:mb(o,t.tBarTorque*Yy),scalarTorque:t.tBarTorque}]:[],...s?[{id:`third-element-tbar`,label:`T-bar link (third element)`,moment:gb(fb(s.point,a),s.force)}]:[]].filter(e=>_b(e.moment)>Xy);if(c.length===0)return[];let l=[{side:`right`,points:r},{side:`left`,points:i}].map(e=>{let t=vb(fb(e.points.link,e.points.arb)),n=gb(fb(e.points.arb,a),t);return{side:e.side,linkPoint:e.points.link,barPoint:e.points.arb,direction:t,momentArm:n,torsionalArm:hb(o,n)}});return c.flatMap(e=>{if(l.length!==2||l.some(e=>Math.abs(e.torsionalArm)<=Xy))return n.push(`${e.label}: the T-bar links do not define both torsional and symmetric bending transfer modes.`),[];let[t,r]=l,i=db(mb(t.momentArm,r.torsionalArm),mb(r.momentArm,-t.torsionalArm));if(_b(i)<=Xy)return n.push(`${e.label}: the T-bar links have no independent symmetric bending transfer mode.`),[];let a=vb(i),s=t.torsionalArm,c=r.torsionalArm,u=hb(a,t.momentArm),d=hb(a,r.momentArm),f=-hb(o,e.moment),p=-hb(a,e.moment),m=s*d-c*u;if(Math.abs(m)<=Xy)return n.push(`${e.label}: the T-bar link transfer modes are singular for this geometry.`),[];let h=[(f*d-c*p)/m,(s*p-f*u)/m];return l.flatMap((t,n)=>{let r=h[n]??0;return Math.abs(r)<=Xy?[]:[{id:`${e.id}-${t.side}`,label:e.label,side:t.side,target:`rocker`,point:t.linkPoint,force:mb(t.direction,-r),barKind:`tbar`,barPoint:t.barPoint,scalarForce:r,scalarTorque:e.scalarTorque}]})})}function SS(e,t,n){let r=[],i=Zb(e);
4113if(e.elements.antirollCBar&&i!==`upright`&&Math.abs(t.cBarTorque)>Xy){let a=hS(e,`right`),o=hS(e,`left`),s=o.pivot,c=a.pivot;[`right`,`left`].forEach(e=>{let l=e===`right`?a:o,u=e===`right`?t.cBarTorque:-t.cBarTorque,d=bS(`cbar-${e}`,`C-bar link`,e,u,s,c,l.arb,l.link,`cbar`,i===`rocker`?`rocker`:i);d?r.push(d):n.push(`C-bar torque on ${e} side could not be converted to link force because the effective arm is singular.`)})}else if(e.elements.antirollCBar&&i===`upright`&&Math.abs(t.cBarTorque)>Xy){let n=hS(e,`right`),i=hS(e,`left`),a=i.pivot,o=n.pivot;[`right`,`left`].forEach(e=>{let s=e===`right`?n:i,c=e===`right`?t.cBarTorque:-t.cBarTorque,l=bS(`cbar-${e}`,`C-bar link`,e,c,a,o,s.arb,s.link,`cbar`,`carrier`);l&&r.push(l)})}r.push(...xS(e,t,n));let a=(e,t,n,i,a)=>{if(Math.abs(n)<=Xy)return;let o=vb(fb(a,i));r.push({id:`${e}-right`,label:t,side:`right`,target:`rocker`,point:i,force:mb(o,n),scalarForce:n}),r.push({id:`${e}-left`,label:t,side:`left`,target:`rocker`,point:a,force:mb(o,-n),scalarForce:n})};if(e.elements.heaveSpring){let n=mS(e,`right`,`heaveLeft`,e.elements.heaveLeft),r=mS(e,`left`,`heaveRight`,e.elements.heaveRight);a(`heave`,`Heave element`,t.heaveForce,n,r)}if(e.elements.rollSpring){let n=mS(e,`right`,`rollLeft`,e.elements.rollLeft),r=mS(e,`left`,`rollRight`,e.elements.rollRight);a(`roll`,`Roll element`,t.rollForce,n,r)}return r}function CS(e){return[`x`,`y`,`z`].map(t=>({id:`${e.id}-${t}`,label:e.label,type:`pointForce`,side:e.side,point:e.point,axis:t}))}function wS(e){return{id:e.id,label:e.label,type:`axial`,side:e.side,chassisPoint:e.chassisPoint,wheelPoint:e.barPoint,direction:vb(fb(e.chassisPoint,e.barPoint))}}function TS(e,t){e.nodeReactions.push(...t.nodeReactions),e.axialLoads.push(...t.axialLoads),e.vectors.push(...t.vectors),e.residuals.push(...t.residuals)}function ES(e,t,n,r,i,a,o=[],s=[]){let c={nodeReactions:[],axialLoads:[],vectors:[],residuals:[]},l=[...i.flatMap(e=>CS(e)),...a.map(e=>wS(e)),...o];if(n.length===0||l.length===0)return{...c,warning:null};let u=[...n.reduce((e,t)=>{let n=zb(t,r);return e.map((e,t)=>e+(n[t]??0))},[0,0,0,0,0,0]).map(e=>-e),...s.map(e=>e.rhs)],d=Jb(l.map(e=>[...Fx(e,r),...s.map(t=>t.coefficient(e))]),u),f=l.map((e,t)=>({...e,value:d.solution[t]??0})),p=new Map;f.forEach(n=>{if(n.type===`axial`){let r=mb(n.direction,n.value),i=yb(r);c.axialLoads.push({id:`element-${t}-${n.id}`,side:n.side,label:n.label,from:n.wheelPoint,to:n.chassisPoint,force:n.value,state:$x(n.value)}),c.nodeReactions.push({id:`element-${t}-${n.id}-bar`,side:n.side,nodeType:`element`,label:`${n.label} bar`,point:n.wheelPoint,force:r,magnitude:_b(r)}),c.nodeReactions.push({id:`element-${t}-${n.id}-chassis`,side:n.side,nodeType:`chassis`,label:`${n.label} chassis`,point:n.chassisPoint,force:i,magnitude:_b(i)}),c.vectors.push(...lS(e,`element`,n));return}if(n.type===`axisMoment`){let e=yb(mb(n.axis,n.value));c.nodeReactions.push({id:tS(`element-${t}`,n.side,`chassis`,n.label),side:n.side,nodeType:`chassis`,label:n.label,point:n.point,force:{x:0,y:0,z:0},magnitude:0,moment:e,momentValue:-n.value,momentMagnitude:Math.abs(n.value)});return}let r=`${n.side??`center`}-${n.label}-${n.point.x.toFixed(6)}-${n.point.y.toFixed(6)}-${n.point.z.toFixed(6)}`,i=p.get(r)??{side:n.side,label:n.label,point:n.point,forceOnBar:{x:0,y:0,z:0}};i.forceOnBar=db(i.forceOnBar,Qx(n)),p.set(r,i)}),p.forEach((e,n)=>{let r=yb(e.forceOnBar);c.nodeReactions.push({id:tS(`element-${t}`,e.side,`chassis`,e.label),side:e.side,nodeType:`chassis`,label:e.label,point:e.point,force:r,magnitude:_b(r)})}),c.residuals.push(d.residual);let m=Math.hypot(...u),h=Math.max(1e-4,m*1e-6),g=d.warning&&d.residual>h?d.warning:null;return{...c,warning:g}}function DS(e,t){return e.filter(e=>e.barKind===t&&e.barPoint&&!bb(e.force)).map(e=>({id:`${e.id}-bar-reaction`,label:`${e.label} on ${t===`cbar`?`C-bar`:`T-bar`}`,point:e.barPoint??e.point,force:yb(e.force),side:e.side,kind:`element`,color:rb}))}function OS(e,t,n,r){let i={nodeReactions:[],axialLoads:[],vectors:[],residuals:[]},a=DS(n,`cbar`);if(e.elements.antirollCBar&&a.length>
41130){let t=hS(e,`right`),n=hS(e,`left`),o=pb(n.pivot,t.pivot),s=vb(fb(t.pivot,n.pivot)),c=ES(e,`cbar`,a,o,[{id:`left-pivot`,label:`C-bar pivot`,point:n.pivot,side:`left`},{id:`right-pivot`,label:`C-bar pivot`,point:t.pivot,side:`right`}],[],[],[{rhs:0,coefficient:e=>{if(e.type!==`pointForce`)return 0;let r=hb(ox(e.axis),s);return Ix(e.point,n.pivot)?r:Ix(e.point,t.pivot)?-r:0}}]);TS(i,c),c.warning&&r.push(`C-bar attachments: ${c.warning}`)}let o=DS(n,`tbar`),s=ub(e.elements.tPivot);e.elements.antirollTBar&&Math.abs(t.tBarTorque)>Xy&&o.push({id:`tbar-input-torque`,label:`T-bar torque`,point:s,force:{x:0,y:0,z:0},moment:mb(dx(e),t.tBarTorque*Yy),kind:`element`,color:rb});let c=vS(e,t.thirdElementForce);if(c&&o.push(c),e.elements.antirollTBar&&o.length>0){let t=dx(e),n=ES(e,`tbar`,o,s,[{id:`t-pivot`,label:`T-bar pivot`,point:s}],[],fx(`T-bar`,s,t));TS(i,n),n.warning&&r.push(`T-bar pivot: ${n.warning}`)}let l=yS(e,t.thirdElementForce);return l&&dS(e,[l],i,`element`),i}function kS(e,t,n,r){if(!px(e)||mx(e))return{rocker:null,unknowns:[],warning:null};let i=e.geometry[t],a=n.filter(e=>e.side===t&&e.label===`PR`).reduce((e,t)=>e+t.force,0);if(Math.abs(a)<=Xy&&kx(r,t).length===0)return{rocker:null,unknowns:[],warning:null};let o=i.rocker.axisStart,s=i.rocker.axisEnd,c=vb(fb(s,o)),l=mb(vb(fb(i.chassis.pushRod,i.wheel.pushRod)),-a),u=kx(r,t),d=[{id:`${t}-rocker-pushrod`,label:`Pushrod on rocker`,point:i.chassis.pushRod,force:l,side:t},...u],f=d.reduce((e,t)=>{let n=zb(t,o);return e.map((e,t)=>e+(n[t]??0))},[0,0,0,0,0,0]).map(e=>-e),p=vb(fb(i.chassis.spring,i.wheel.spring)),m=hx(e)?sx(t,`Main spring`,i.chassis.spring,i.wheel.spring):null,h=pb(o,s),g=hx(e)?null:cx(t,`Rocker torsion bar`,h,c),_=[...m?[m]:[],...g?[g]:[],...nx(t,`Rocker pivot`,h),...ux(t,h,c)],v=Jb(_.map(e=>Fx(e,o)),f),y=_.map((e,t)=>({...e,value:v.solution[t]??0})),b=y.find(e=>e.type===`axial`&&e.label===`Main spring`)?.value??0,x=y.find(e=>e.type===`axisMoment`&&e.label===`Rocker torsion bar`)?.value??0,S=(e,t)=>hb(c,gb(fb(e,o),t)),C=S(i.chassis.pushRod,l),w=hx(e)?S(i.wheel.spring,mb(p,b)):0,T=u.reduce((e,t)=>e+S(t.point,t.force),0),E=C+w+x+T,D=y.filter(Yx).filter(e=>e.label===`Rocker pivot`).reduce((e,t)=>db(e,Jx(t)),{x:0,y:0,z:0}),O=d.reduce((e,t)=>e+hb(c,gb(fb(t.point,o),t.force)),0);return{unknowns:y,warning:v.warning,rocker:{id:`${t}-rocker`,side:t,springForce:b,axisTorque:w+x,pushrodTorque:C,springTorque:w,torsionTorque:x,elementTorque:T,balanceTorque:E,residual:v.residual,pivotReaction:D,knownTorque:O}}}function AS(e,t){return t.flatMap(t=>{if((t.kind??`input`)!==`input`)return bb(t.force)?[]:[{id:t.id,side:t.side,kind:t.kind??`input`,label:t.label,from:t.point,vector:t.force,color:t.color??tb,magnitude:_b(t.force),unit:`N`,visualLengthMm:kb(e,_b(t.force))}];let n=(t.forceComponents??ib.map(e=>({axis:e,label:`F${e.toUpperCase()}`,vector:Tb(e,Ob(t.force,e)),magnitude:Math.abs(Ob(t.force,e))}))).filter(e=>e.magnitude>Xy).map(n=>({id:`${t.id}-f${n.axis}`,side:t.side,kind:`input`,visualStyle:`linear`,label:`${t.label} ${n.label}`,from:t.point,vector:n.vector,color:Eb(n.axis),magnitude:n.magnitude,unit:`N`,visualLengthMm:kb(e,n.magnitude)})),r=t.moment??{x:0,y:0,z:0},i=ib.map(e=>({axis:e,valueNmm:Ob(r,e)})).filter(e=>Math.abs(e.valueNmm)/Yy>=Zy).map(e=>{let n=e.valueNmm/Yy;return{id:`${t.id}-m${e.axis}`,side:t.side,kind:`input`,visualStyle:`moment`,label:`${t.label} M${e.axis.toUpperCase()}`,from:t.point,vector:Tb(e.axis,n),color:Eb(e.axis),magnitude:Math.abs(n),unit:`Nm`,visualLengthMm:Ab(Math.abs(n))}});return[...n,...i]})}function jS(e,t){return t.flatMap(t=>{let n=[{axis:`x`,value:t.force.x},{axis:`y`,value:t.force.y},{axis:`z`,value:t.force.z}].filter(e=>Math.abs(e.value)>Xy).map(n=>({id:`${t.id}-r${n.axis}`,side:t.side,kind:`reaction`,label:`${t.label} R${n.axis.toUpperCase()}`,from:t.point,vector:Tb(n.axis,n.value),color:Eb(n.axis),magnitude:Math.abs(n.value),unit:`N`,visualLengthMm:kb(e,Math.abs(n.value))})),r=(t.momentMagnitude??_b(t.moment??{x:0,y:0,z:0}))/Yy,i=t.moment&&r>=Zy?[{id:`${t.id}-moment`,side:t.side,kind:`reaction`,visualStyle:`moment`,label:t.label,from:t.point,vector:mb(t.moment,1/Yy),color:Eb(Db(t.moment)),magnitude:r,unit:`Nm`,visualLengthMm:Ab(r)}]:[];return[...n,...i]})}function MS(e,t,n,r){if(!e.suspension.monoShock)return;let i=n.filter(e=>e.label===`Main spring`);if(i.length<2)return;let a=i[0];if(!i.every(e=>Ix(e.from,a.from)&&Ix(e.to,a.to)))return;let o=i.reduce((e,t)=>
4113e+t.force,0),s=new Set(i.map(e=>e.id)),c=i.map(e=>`${e.id}-axial`);for(let e=n.length-1;e>=0;--e)s.has(n[e].id)&&n.splice(e,1);for(let e=r.length-1;e>=0;--e)c.some(t=>r[e].id.startsWith(t))&&r.splice(e,1);for(let e=t.length-1;e>=0;--e){let n=t[e];(n.label===`Main spring rocker`||n.label===`Main spring chassis`)&&(Ix(n.point,a.from)||Ix(n.point,a.to))&&t.splice(e,1)}let l=vb(fb(a.to,a.from)),u={id:`monoshock-main-spring`,label:`Main spring`,type:`axial`,wheelPoint:a.from,chassisPoint:a.to,direction:l,value:o};n.push({id:`rocker-monoshock-main-spring`,label:`Main spring`,from:a.from,to:a.to,force:o,state:$x(o)});let d=mb(l,o);t.push({id:`rocker-monoshock-main-spring-rocker`,nodeType:`rocker`,label:`Main spring rocker`,point:a.from,force:d,magnitude:_b(d)});let f=yb(d);t.push({id:`rocker-monoshock-main-spring-chassis`,nodeType:`chassis`,label:`Main spring chassis`,point:a.to,force:f,magnitude:_b(f)}),r.push(...lS(e,`rocker`,u))}function NS(e){return{maxReaction:e.nodeReactions.filter(e=>e.nodeType!==`wheel`).reduce((e,t)=>Math.max(e,t.magnitude),0),maxTension:e.axialLoads.reduce((e,t)=>Math.max(e,t.force),0),maxCompression:e.axialLoads.reduce((e,t)=>Math.max(e,-t.force),0),maxRockerTorque:e.rockerLoads.reduce((e,t)=>Math.max(e,Math.abs(t.axisTorque)),0),equilibriumResidual:Math.max(0,...e.rockerLoads.map(e=>e.residual),...e.warnings.map(()=>0))}}function PS(e,t=jb(e)){let n=[],r=SS(e,t,n),i=vS(e,t.thirdElementForce),a=[...r.map(e=>({id:e.id,label:e.label,side:e.side,force:e.scalarForce,forceVector:e.force,torque:e.scalarTorque,point:e.point,direction:vb(e.force),target:e.target})),...i?[{id:i.id,label:i.label,force:t.thirdElementForce,forceVector:i.force,point:i.point,direction:vb(i.force),target:`tbar`}]:[]],o={right:[Rb(e,`right`,`CP`,Fb(e,`right`),t.right.contactPatch,t.followWheelToe),Rb(e,`right`,`WC`,e.geometry.right.wheelCenter,t.right.wheelCenter,t.followWheelToe)],left:[Rb(e,`left`,`CP`,Fb(e,`left`),t.left.contactPatch,t.followWheelToe),Rb(e,`left`,`WC`,e.geometry.left.wheelCenter,t.left.wheelCenter,t.followWheelToe)]},s=[],c=[],l=[],u=[...AS(e,[...o.right,...o.left]),...r.map(t=>({id:t.id,side:t.side,kind:`element`,label:t.label,from:t.point,vector:t.force,color:rb,magnitude:_b(t.force),unit:`N`,visualLengthMm:kb(e,_b(t.force))})),...i?[{id:i.id,kind:`element`,label:i.label,from:i.point,vector:i.force,color:rb,magnitude:_b(i.force),unit:`N`,visualLengthMm:kb(e,_b(i.force))}]:[]],d=[],f=new Set;[`right`,`left`].forEach(t=>{let i=Gx(e,t,o[t],r)??Hx(e,t,o[t],r)??Ex(e,t,o[t],r)??Wx(e,t,o[t],r)??Kx(e,t,o[t],r);if(i){d.push(i.residual),i.warning&&n.push(`${t} coupled carrier/rocker: ${i.warning}`),dS(e,i.carrierUnknowns,{nodeReactions:s,axialLoads:c,vectors:u},`carrier`),fS(e,i.carrierUnknowns,{nodeReactions:s}),i.armUnknowns.length>0&&dS(e,i.armUnknowns,{nodeReactions:s,axialLoads:c,vectors:u},`arm`),i.loadedLinkChassisLoads?.forEach(e=>{s.push({id:tS(`loaded-link`,e.side,`chassis`,e.label),side:e.side,nodeType:`chassis`,label:e.label,point:e.point,force:e.force,magnitude:_b(e.force)})}),i.solvedWishboneTarget&&f.add(`${t}-${i.solvedWishboneTarget}`),i.solvedWishboneTargets?.forEach(e=>{f.add(`${t}-${e}`)});return}let a=Xb(e);px(e)&&!mx(e)&&kx(r,t).length>0&&a!==`upright`&&a!==`topWishbone`&&a!==`bottomWishbone`&&ex(e,t,a)===null&&n.push(`${t} rocker coupled loads on ${a}: mounted-link pushrod propagation is not solved yet.`);let l=wx(e,t,o[t],r);if(d.push(l.residual),l.rankWarning&&n.push(`${t} carrier: ${l.rankWarning}`),dS(e,l.unknowns,{nodeReactions:s,axialLoads:c,vectors:u},`carrier`),fS(e,l.unknowns,{nodeReactions:s}),l.mountedReaction){let i=Dx(e,l.mountedReaction,r),a=i??Ox(e,l.mountedReaction,r);a?(i&&f.add(`${t}-${l.mountedReaction.target}`),d.push(a.residual),a.warning&&n.push(`${t} ${l.mountedReaction.target}: ${a.warning}`),dS(e,a.unknowns,{nodeReactions:s,axialLoads:c,vectors:u},`arm`)):l.mountedReaction.target!==`topWishbone`&&l.mountedReaction.target!==`bottomWishbone`&&n.push(`${t} ${l.mountedReaction.target}: mounted-link body loads are reported as joint reactions only in this version.`)}}),[`right`,`left`].forEach(t=>{[`topWishbone`,`bottomWishbone`].forEach(i=>
4113{if(f.has(`${t}-${i}`))return;let a=r.filter(e=>e.side===t&&e.target===i);if(a.length===0)return;let o=qx(e,t,i,a.map(e=>({id:e.id,label:e.label,point:e.point,force:e.force,side:t,kind:`element`,color:rb})));o&&(d.push(o.residual),o.warning&&n.push(`${t} ${i} element transfer: ${o.warning}`),dS(e,o.unknowns,{nodeReactions:s,axialLoads:c,vectors:u},`arm`))})}),[`right`,`left`].forEach(t=>{let i=kS(e,t,c,r);i.warning&&n.push(`${t} rocker: ${i.warning}`),i.rocker&&(l.push(i.rocker),d.push(i.rocker.residual),dS(e,i.unknowns,{nodeReactions:s,axialLoads:c,vectors:u},`rocker`))});let p=OS(e,t,r,n);s.push(...p.nodeReactions),c.push(...p.axialLoads),u.push(...p.vectors),d.push(...p.residuals),pS(e,r,{axialLoads:c,vectors:u}),MS(e,s,c,u),u.push(...jS(e,s));let m={nodeReactions:s,axialLoads:c,rockerLoads:l,elementLoads:a,vectors:u,warnings:n};return{...m,summary:{...NS(m),equilibriumResidual:Math.max(0,...d)}}}function FS(e){return[...Object.values(e.right.contactPatch),...Object.values(e.right.wheelCenter),...Object.values(e.left.contactPatch),...Object.values(e.left.wheelCenter),e.heaveForce,e.rollForce,e.cBarTorque,e.tBarTorque,e.thirdElementForce].some(e=>Math.abs(e)>Xy)}function IS(e,t){return t===`steer`?N_(e):t===`roll`?P_(e):t===`bumpSteer`?I_(e):M_(e)}function LS(e,t,n){return t===`steer`?{bump:0,steer:RS(n,`steeringWheelAngle`,n.steer),roll:0}:t===`roll`?{bump:0,steer:0,roll:RS(n,`roll`,0)}:t===`bumpSteer`?{bump:RS(n,`bump`,0),steer:e.run.bumpSteerAngle,roll:0}:{bump:RS(n,`bump`,0),steer:0,roll:0}}function RS(e,t,n=0){let r=e[t];return typeof r==`number`&&Number.isFinite(r)?r:n}function zS(e,t,n){return e.axialLoads.filter(e=>e.side===t&&n.includes(e.label)).reduce((e,t)=>e+t.force,0)}function BS(e,t){return e.axialLoads.filter(e=>e.label===t).reduce((e,t)=>e+t.force,0)}function VS(e,t){return e.rockerLoads.find(e=>e.side===t)?.axisTorque??0}function HS(e,t){let n=Array.isArray(t)?t:[t],r=e.elementLoads.filter(e=>e.side===`right`&&n.includes(e.label)&&typeof e.force==`number`).reduce((e,t)=>e+(t.force??0),0);return Math.abs(r)>Xy?r:e.elementLoads.filter(e=>n.includes(e.label)&&typeof e.force==`number`).reduce((e,t)=>e+(t.force??0),0)}function US(e){let t=[],n=new Set,r=e=>{n.has(e.key)||(n.add(e.key),t.push(e))};return e.nodeReactions.forEach(e=>{e.magnitude>Xy&&[`x`,`y`,`z`].forEach(t=>{r({key:sb(e.id,t),label:`${ob(e.side)} ${e.label} F${t.toUpperCase()}`,unit:`N`})}),(e.momentMagnitude??0)>Xy&&r({key:cb(e.id),label:`${ob(e.side)} ${e.label}`,unit:`Nm`})}),e.axialLoads.forEach(e=>{r({key:lb(e.id),label:`${ob(e.side)} ${e.label} axial`,unit:`N`})}),t}function WS(e,t){let n={...e,loadMaxReaction:t.summary.maxReaction,loadMaxTension:t.summary.maxTension,loadMaxCompression:t.summary.maxCompression,loadEquilibriumResidual:t.summary.equilibriumResidual,loadRightPushrod:zS(t,`right`,[`PR`]),loadLeftPushrod:zS(t,`left`,[`PR`]),loadRightSpring:zS(t,`right`,[`Main spring`,`Spring`]),loadLeftSpring:zS(t,`left`,[`Main spring`,`Spring`]),loadRightRockerTorque:VS(t,`right`),loadLeftRockerTorque:VS(t,`left`),loadCBarForce:HS(t,`C-bar link`),loadTBarForce:HS(t,[`T-bar link`,`T-bar link (third element)`]),loadThirdElementForce:BS(t,`Third element`),converged:!!e.converged};return t.nodeReactions.forEach(e=>{e.magnitude>Xy&&(n[sb(e.id,`x`)]=e.force.x,n[sb(e.id,`y`)]=e.force.y,n[sb(e.id,`z`)]=e.force.z),(e.momentMagnitude??0)>Xy&&(n[cb(e.id)]=(e.momentValue??0)/Yy)}),t.axialLoads.forEach(e=>{n[lb(e.id)]=e.force}),n}function GS(e,t=`bump`,n=jb(e)){return IS(e,t).map(r=>WS(r,PS(A_(e,LS(e,t,r)).document,n)))}function KS(e,t=0){if(e===void 0)return t;let n=e.trim().replace(`,`,`.`);if(n.length===0)return t;let r=Number(n);return Number.isFinite(r)?r:t}function qS(e){return KS(e)!==0}function JS(e,t,n=``){let r=e[t]?.trim();return r&&r.length>0?r:n}var YS={"U-joint 2 index angle":`0`,"Virtual Line Thickness":`1`},XS=`3D Joint size`,ZS=`3D Point Size`,QS=new Set([`TPivotY`,`T3EARBY`,`T3ECY`]);function $S(e,t,n,r){return{x:KS(e[t]),y:QS.has(n)?0:KS(e[n]),z:KS(e[r])}}function eC(e,t=`Double_Wishbone.spm`){let n={},r={},i=[],a=`ROOT`;n[a]={}
4113,e.split(/\r?\n/).forEach((e,t)=>{let o=e.trim();if(o.length===0)return;let s=o.indexOf(`:`);if(s===-1){a=o,n[a]=n[a]??{};return}let c=o.slice(0,s).trim(),l=o.slice(s+1).trim();r[c]=l,n[a][c]=l,i.push({section:a,key:c,value:l,line:t+1})});let o=[`Draw Steering Axis`,`Steering axis envelope`,`Steering offsets`,`Virtual Points/Lines`,`Ground line`,`Roll centre`,`Draw CG`,`Wheel circle`].every(e=>r[e]===void 0);o&&Object.assign(r,{"Draw Steering Axis":`1`,"Ground line":`1`,"Roll centre":`1`,"Draw CG":`1`}),r[`Steering offsets`]===void 0&&r[`Virtual Points/Lines`]!==void 0&&(r[`Steering offsets`]=r[`Virtual Points/Lines`]),r[`Virtual Points/Lines`]===void 0&&r[`Steering offsets`]!==void 0&&(r[`Virtual Points/Lines`]=r[`Steering offsets`]),r[XS]===void 0&&r[ZS]!==void 0&&(r[XS]=r[ZS]),Object.entries(YS).forEach(([e,t])=>{(r[e]?.trim()??``)===``&&(r[e]=t)});let s={chassis:{topFront:$S(r,`TLFXc`,`TLFYc`,`TLFZc`),topRear:$S(r,`TLRXc`,`TLRYc`,`TLRZc`),bottomFront:$S(r,`BLFXc`,`BLFYc`,`BLFZc`),bottomRear:$S(r,`BLRXc`,`BLRYc`,`BLRZc`),tieRod:$S(r,`TRXc`,`TRYc`,`TRZc`),pushRod:$S(r,`PRXc`,`PRYc`,`PRZc`),spring:$S(r,`SXc`,`SYc`,`SZc`)},wheel:{topFront:$S(r,`TLFXw`,`TLFYw`,`TLFZw`),topRear:$S(r,`TLRXw`,`TLRYw`,`TLRZw`),bottomFront:$S(r,`BLFXw`,`BLFYw`,`BLFZw`),bottomRear:$S(r,`BLRXw`,`BLRYw`,`BLRZw`),tieRod:$S(r,`TRXw`,`TRYw`,`TRZw`),pushRod:$S(r,`PRXw`,`PRYw`,`PRZw`),spring:$S(r,`SXw`,`SYw`,`SZw`)},rocker:{axisStart:$S(r,`P1X`,`P1Y`,`P1Z`),axisEnd:$S(r,`P2X`,`P2Y`,`P2Z`)},wheelCenter:$S(r,`WheelCenterX`,`WheelCenterY`,`WheelCenterZ`)},c={axlePosition:JS(r,`Axle Position`,`Front`),suspensionType:JS(r,`Suspension Type`,`Double Wishbone`),configuration:JS(r,`Configuration`,`Pushrod`),mountingPoint:JS(r,`Mounting Point`,`Upright`),macPherson:qS(r.MacPherson),monoShock:qS(r.MonoShock),integralLink:qS(r[`Integral Link`]),mainSpring:r[`Main Spring`]===void 0?!0:qS(r[`Main Spring`])};return{sourceName:t,sections:n,fields:r,entries:i,suspension:{...c,mainSpring:yf(c)},vehicle:{wheelDefinition:JS(r,`Wheel Definition`,`Nominal Radius`),wheelRadius:KS(r[`Wheel Radius`]),rimDiameter:KS(r[`Rim Diameter`]),rimWidth:KS(r[`Rim Width`]),rimOffset:KS(r[`Rim Offset`]),tyreWidth:KS(r[`Tyre Width`]),aspectRatio:KS(r[`Aspect Ratio`]),camber:KS(r.Camber),toe:KS(r.Toe),wheelbase:KS(r.Wheelbase),cgHeight:KS(r[`Centre of Gravity Height`]),brakeBalance:KS(r[`Front Brake Balance`]),driveRatio:KS(r[`Front Drive Ratio`])},run:{calculateBump:qS(r[`Calculate Bump`]),calculateRoll:qS(r[`Calculate Roll`]),bumpMax:KS(r[`Bump Max`]),reboundMax:KS(r[`Rebound Max`]),bumpSteps:_f(KS(r[`N of Steps Bump`],10)),calculateSteer:qS(r[`Calculate Steer`]),steeringWheelAngleMax:KS(r[`Steering Wheel Angle Max`]),steerSteps:_f(KS(r[`N of Steps Steer`],10)),calculateSteeringColumn:qS(r[`Calculate Steering Column`]),calculateBumpSteer:qS(r[`Calculate BumpSteer`]),bumpSteerAngle:KS(r[`BumpSteer Angle`]),steeringModel:JS(r,`Steering Model`,`Costant Z`)},graphics:{drawWheels:qS(r[`Draw Wheels`]),drawWheelCircle:qS(r[`Wheel circle`]),ghostWireframe:qS(r[`Ghost wireframe`]),drawStepGeometry:qS(r[`Step geometry`]),solid2dWheels:qS(r[`Solid 2D wheels`]),drawRollCenter:r[`Roll centre`]===void 0?o:qS(r[`Roll centre`]),drawCenterOfGravity:r[`Draw CG`]===void 0?o:qS(r[`Draw CG`]),drawUpright:qS(r[`Draw Upright`]),drawRocker:qS(r[`Draw Rocker`]),drawOffsetRim:qS(r[`Draw Offset Rim`]),drawSprings:qS(r[`Draw Springs`]),drawArms3D:qS(r[`Draw 3D Arm`]),drawSteering:qS(r[`Draw Steering`]),drawSteeringAxis:r[`Draw Steering Axis`]===void 0?o:qS(r[`Draw Steering Axis`]),drawGroundLine:r[`Ground line`]===void 0?o:qS(r[`Ground line`]),virtualPointsLines:r[`Steering offsets`]===void 0?qS(r[`Virtual Points/Lines`]):qS(r[`Steering offsets`]),steeringAxisEnvelope:qS(r[`Steering axis envelope`]),drawTyreProfile:qS(r[`Tyre profile`]),drawChassis:qS(r[`Draw Chassis`]),drawArrow:qS(r[`Draw Arrow`]),drawOrigin:qS(r[`Draw Origin`]),drawMediumRadius:qS(r[`Draw Medium R`]),drawPushSpringLink:qS(r[`Draw Push/Spring Link`]),drawSemiAxis:qS(r[`Draw SemiAxis`]),drawOppositeAxle:qS(r[`Draw Opposite Axle`]),drawMainSpring:qS(r[`Draw MainSpring`]),drawCBar:r[`Draw CBar`]===void 0?!0:qS(r[`Draw CBar`]),drawTBar:r[`Draw TBar`]===void 0?!0:qS(r[`Draw TBar`]),drawThirdElement:r[`Draw Third Element`]===void 0?!0:qS(r[`Draw Third Element`]),drawHeaveSpring:r[`Draw Heave Spring`]===void 0?!0:qS(r[`Draw Heave Spring`]),drawRollSpring:r[`Draw Roll Spring`]===void 0?!0:qS(r[`Draw Roll Spring`]),drawLoadArrows:r[`Draw Load Arrows`]===void 0?!0:qS(r[`Draw Load Arrows`]),drawLoadInputs:r[`Draw Load Inputs`]===void 0?!0:qS(r[`Draw Load Inputs`]),drawLoadReactions:r[`Draw Load Reactions`]===void 0?!0:qS(r[`Draw Load Reactions`]),drawLoadAxials:r[`Draw Load Axials`]===void 0?!0:qS(r[`Draw Load Axials`]),drawLoadLabels:r[`Draw Load Labels`]===void 0?!0:qS(r[`Draw Load Labels`]),loadArrowScale:KS(r[`Load Arrow Scale`],100),springDiameter:KS(r[`Spring Diameter`],50),springTurns:KS(r[`N of Spire in a Spring`],6),armDiameter:KS(r[`3D Arm Diameter`],14),semiAxisDiameter:KS(r[`SemiAxis Diameter`],20),steeringWheelDiameter:KS(r[`Steering Wheel Diameter`],180),linkWidth2D:KS(r[`2D Link Width`],KS(r[`Line Width`],2)),virtualLineWidth:KS(r[`Virtual Line Thickness`],KS(r[`Line Width`],1)),lineWidth:KS(r[`Line Width`],1),pointSize:KS(r[`Point Size`],4),pointSize3D:KS(r[XS],4),wheelOpacityPercent:KS(r[`Wheel Opacity`],50),chassisOpacity:KS(r[`Chassis Opacity`],1),show2d:qS(r[`2D Vie
4113w`]),show3d:qS(r[`3D View`]),view:JS(r,`View`,`Two Wheels`)},elements:{heaveSpring:qS(r[`Heave Spring`]),heaveSymmetric:qS(r[`Heave Symm`]),rollSpring:qS(r[`Roll Spring`]),antirollCBar:qS(r[`Antiroll CBar`]),antirollTBar:qS(r[`Antiroll TBar`]),thirdElement:qS(r[`Third Element`]),heaveLeft:$S(r,`HSleftX`,`HSleftY`,`HSleftZ`),heaveRight:$S(r,`HSrightX`,`HSrightY`,`HSrightZ`),rollLeft:$S(r,`RSleftX`,`RSleftY`,`RSleftZ`),rollRight:$S(r,`RSrightX`,`RSrightY`,`RSrightZ`),cLink:$S(r,`CLinkX`,`CLinkY`,`CLinkZ`),cArb:$S(r,`CARBX`,`CARBY`,`CARBZ`),cPivot:$S(r,`CPivotX`,`CPivotY`,`CPivotZ`),tLink:$S(r,`TLinkX`,`TLinkY`,`TLinkZ`),tArb:$S(r,`TARBX`,`TARBY`,`TARBZ`),tPivot:$S(r,`TPivotX`,`TPivotY`,`TPivotZ`),thirdElementArb:$S(r,`T3EARBX`,`T3EARBY`,`T3EARBZ`),thirdElementChassis:$S(r,`T3ECX`,`T3ECY`,`T3ECZ`)},geometry:{right:s,left:Sf(s)}}}function tC(e,t,n){let r=e.split(/\r?\n/),i=`${t}:`,a=r.findIndex(e=>e.trimStart().startsWith(i));if(a===-1){let i=r.findIndex(e=>e.trimStart().startsWith(`NOTES`));return i===-1?`${e.trimEnd()}\n${t}: ${n}\n`:(r.splice(i,0,`${t}: ${n}`),r.join(` 4114`))}return r[a]=`${r[a].match(/^\s*/)?.[0]??``}${t}: ${n}`,r.join(` 4115`)}var nC=Math.PI/180,rC=180/Math.PI,iC=1e7,aC=1e-7,oC=[`TLF`,`TLR`,`BLF`,`BLR`,`TR`,`Spring`,`PR`,`SplitRocker`],sC=[`TLF`,`TLR`,`BLF`,`BLR`,`TR`,`PRC`],cC=[`TLF`,`TLR`,`BLF`,`BLR`,`TR`,`PR`],lC={x:0,y:1,z:0};function uC(){return{spring:0,pushrod:0,splitRocker:0}}var dC={TLF:`Top front`,TLR:`Top rear`,BLF:`Bottom front`,BLR:`Bottom rear`,TR:`Track rod`,PRC:`Pushrod / strut`},fC={TLF:`Top front`,TLR:`Top rear`,BLF:`Bottom front`,BLR:`Bottom rear`,TR:`Track rod`,PR:`Pushrod`},pC={lengthDeltas:Object.fromEntries(oC.map(e=>[e,0])),chassisOffsets:Object.fromEntries(sC.map(e=>[e,{x:0,y:0,z:0}])),shimAmounts:Object.fromEntries(cC.map(e=>[e,0])),shimNormals:Object.fromEntries(cC.map(e=>[e,{...lC}])),rideHeightDelta:0,adjustmentMode:`spring`,rideHeightAdjustments:uC()};function mC(e,t){let n=e.suspension.configuration===`Outboard Spring`,r=e.suspension.macPherson,i=bf(e),a=!i,o=n||!i,s=n,c=s?`spring`:`pushrod`,l={...pC.shimAmounts,...t.shimAmounts},u=t.shimNormal??lC,d=t.shimNormals??{},f=Object.fromEntries(cC.map(e=>[e,_C(d[e]??u)]));KC(e).forEach(e=>{l[e]=0});let p=Object.fromEntries(sC.map(e=>[e,r&&(e===`TLF`||e===`TLR`)?{x:0,y:0,z:0}:_C(t.chassisOffsets[e])])),m=t.adjustmentMode===`spring`&&a||t.adjustmentMode===`pushrod`&&s||t.adjustmentMode===`splitRocker`&&o?c:t.adjustmentMode;return{...t,lengthDeltas:{...t.lengthDeltas,...a?{Spring:0}:{},...s?{PR:0}:{},...o?{SplitRocker:0}:{},...r?{TLF:0,TLR:0,PR:0,SplitRocker:0}:{}},chassisOffsets:p,shimAmounts:l,shimNormals:f,shimNormal:void 0,adjustmentMode:m,rideHeightAdjustments:{...t.rideHeightAdjustments??uC(),...a?{spring:0}:{},...s?{pushrod:0}:{},...o?{splitRocker:0}:{}}}}function hC(e,t){return Math.hypot(e.x-t.x,e.y-t.y,e.z-t.z)}function gC(e){return Number.isFinite(e)?Math.max(-1,Math.min(1,e)):1}function _C(e){return{x:e.x,y:e.y,z:e.z}}function vC(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function yC(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}function bC(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}function xC(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function SC(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function CC(e){let t=Math.hypot(e.x,e.y,e.z);return t<1e-9?{x:0,y:1,z:0}:{x:e.x/t,y:e.y/t,z:e.z/t}}function wC(e,t,n,r){let i=CC(yC(n,t)),a=yC(e,t),o=Math.cos(r),s=Math.sin(r);return vC(t,vC(vC(bC(a,o),bC(SC(i,a),s)),bC(i,xC(i,a)*(1-o))))}function TC(e,t,n){let r=QC(t,`SplitRocker`);if(!$C(e)||Math.abs(r)<=1e-9)return{pushRod:_C(n.chassis.pushRod),springWheel:_C(n.wheel.spring)};let i=n.rocker.axisStart,a=n.rocker.axisEnd,o=CC(yC(a,i)),s=yC(n.chassis.pushRod,i),c=yC(n.wheel.spring,i),l=xC(s,o),u=xC(c,o),d=yC(s,bC(o,l)),f=yC(c,bC(o,u)),p=Math.hypot(d.x,d.y,d.z),m=Math.hypot(f.x,f.y,f.z);if(p<=1e-9||m<=1e-9)return{pushRod:_C(n.chassis.pushRod),springWheel:_C(n.wheel.spring)};let h=hC(n.chassis.pushRod,n.wheel.spring),g=Math.max(.1,h+r),_=l-u,v=Math.sqrt(_*_+(p-m)*(p-m)),y=Math.sqrt(_*_+(p+m)*(p+m)),b=Math.max(v,Math.min(y,g)),x=Math.acos(gC(xC(d,f)/(p*m))),S=(_*_+p*p+m*m-b*b)/(2*p*m),C=Math.acos(gC(S))-x;
4115return{pushRod:wC(n.chassis.pushRod,i,a,C),springWheel:_C(n.wheel.spring)}}function EC([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function DC(e,t,n){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function OC(e){return[[1,0,0],[0,Math.cos(e),-Math.sin(e)],[0,Math.sin(e),Math.cos(e)]]}function kC(e){return[[Math.cos(e),0,Math.sin(e)],[0,1,0],[-Math.sin(e),0,Math.cos(e)]]}function AC(e,t,n,r){return[[Math.cos(n)*Math.cos(t),-Math.sin(t)*Math.cos(r)+Math.cos(t)*Math.sin(n)*Math.sin(r),Math.sin(t)*Math.sin(r)+Math.cos(t)*Math.sin(n)*Math.cos(r)],[Math.cos(n)*Math.cos(e)*Math.sin(t)+Math.sin(n)*Math.sin(e),Math.cos(e)*Math.cos(t)*Math.cos(r)+(Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.cos(n)*Math.sin(e))*Math.sin(r),-Math.cos(e)*Math.cos(t)*Math.sin(r)+(Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.cos(n)*Math.sin(e))*Math.cos(r)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t)*Math.cos(r)+(Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(n)*Math.cos(e))*Math.sin(r),-Math.sin(e)*Math.cos(t)*Math.sin(r)+(Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(n)*Math.cos(e))*Math.cos(r)]]}function jC(e,t){let n=Array.from({length:3},()=>[0,0,0]);for(let r=0;r<3;r+=1)for(let i=0;i<3;i+=1)for(let a=0;a<3;a+=1)n[r][i]+=e[r][a]*t[a][i];return n}function MC(e,t){return[[e[0][0],e[0][1],e[0][2],t.x],[e[1][0],e[1][1],e[1][2],t.y],[e[2][0],e[2][1],e[2][2],t.z],[0,0,0,1]]}function NC(e){let t=e[0][0],n=e[0][1],r=e[0][2],i=e[1][0],a=e[1][1],o=e[1][2],s=e[2][0],c=e[2][1],l=e[2][2],u=e[0][3],d=e[1][3],f=e[2][3];return[[t,i,s,-(t*u+i*d+s*f)],[n,a,c,-(n*u+a*d+c*f)],[r,o,l,-(r*u+o*d+l*f)],[0,0,0,1]]}function PC(e,t){return{x:e[0][0]*t.x+e[0][1]*t.y+e[0][2]*t.z+e[0][3],y:e[1][0]*t.x+e[1][1]*t.y+e[1][2]*t.z+e[1][3],z:e[2][0]*t.x+e[2][1]*t.y+e[2][2]*t.z+e[2][3]}}function FC(e,t,n,r=0){let i=e.x-t.x,a=e.y-t.y,o=e.z-t.z,s=Math.hypot(i,a)||2**-52,c=PC(NC(MC(DC(0,Math.atan2(a,i),-Math.atan2(o,s)),e)),n),l=Math.atan2(c.z,c.y||2**-52)+r;return MC(AC(0,Math.atan2(a,i),-Math.atan2(o,s),l),e)}function IC(e,t){return[e[0],e[1],t,e[3],e[4],e[5]]}function LC(e,t){let n=EC(e);return{x:n[0][0]*t.x+n[0][1]*t.y+n[0][2]*t.z+e[3],y:n[1][0]*t.x+n[1][1]*t.y+n[1][2]*t.z+e[4],z:n[2][0]*t.x+n[2][1]*t.y+n[2][2]*t.z+e[5]}}function RC(e,t){let n=EC(e),r={x:t.x-e[3],y:t.y-e[4],z:t.z-e[5]};return{x:n[0][0]*r.x+n[1][0]*r.y+n[2][0]*r.z,y:n[0][1]*r.x+n[1][1]*r.y+n[2][1]*r.z,z:n[0][2]*r.x+n[1][2]*r.y+n[2][2]*r.z}}function zC(e,t){let n=IC(e,0),r=EC(n),i=r[2][0],a=r[2][2],o=Math.hypot(i,a)||1;return LC(n,{x:-t*i/o,y:0,z:-t*a/o})}function BC(e){let t=e.geometry.right;return[-e.vehicle.camber*nC,-e.vehicle.toe*nC,0,t.wheelCenter.x,t.wheelCenter.y,t.wheelCenter.z]}function VC(e){return e.suspension.suspensionType===`Multilink`}function HC(e){return e.suspension.suspensionType===`Top WB - Bottom ML`}function UC(e){return e.suspension.suspensionType===`Top ML - Bottom WB`}function WC(e){return VC(e)||UC(e)}function GC(e){return VC(e)||HC(e)}function KC(e){let t=[];return e.suspension.macPherson&&t.push(`TLF`,`TLR`,`BLR`,`PR`),WC(e)||t.push(`TLR`),GC(e)||t.push(`BLR`),e.suspension.integralLink&&UC(e)&&t.push(`TLR`),e.suspension.integralLink&&HC(e)&&t.push(`BLR`),e.suspension.configuration===`Outboard Spring`&&t.push(`PR`),Array.from(new Set(t))}function qC(e){return e.suspension.configuration===`Pushrod`||e.suspension.configuration===`Pullrod`}function JC(e,t){return{topRear:VC(e)||UC(e)?t.wheel.topRear:t.wheel.topFront,bottomRear:VC(e)||HC(e)?t.wheel.bottomRear:t.wheel.bottomFront}}function YC(e,t,n){if(!e.suspension.integralLink)return null;if(HC(e)){let e=vC(t.chassis.topFront,n?.chassisOffsets.TLF??{x:0,y:0,z:0}),r=vC(t.chassis.topRear,n?.chassisOffsets.TLR??{x:0,y:0,z:0}),i=vC(t.chassis.bottomRear,n?.chassisOffsets.BLR??{x:0,y:0,z:0}
4115),a=PC(NC(FC(e,r,t.wheel.topFront)),i);return{label:`BLR`,chassis:i,chassisForPose:(n,i)=>PC(FC(e,r,i.get(`TLF`)??t.wheel.topFront),a)}}if(UC(e)){let e=vC(t.chassis.bottomFront,n?.chassisOffsets.BLF??{x:0,y:0,z:0}),r=vC(t.chassis.bottomRear,n?.chassisOffsets.BLR??{x:0,y:0,z:0}),i=vC(t.chassis.topRear,n?.chassisOffsets.TLR??{x:0,y:0,z:0}),a=PC(NC(FC(e,r,t.wheel.bottomFront)),i);return{label:`TLR`,chassis:i,chassisForPose:(n,i)=>PC(FC(e,r,i.get(`BLF`)??t.wheel.bottomFront),a)}}return null}function XC(e){let t=e.rideHeightAdjustments??uC();return Math.abs(e.rideHeightDelta)>1e-9||Object.values(t).some(e=>Math.abs(e)>1e-9)||Object.values(e.lengthDeltas).some(e=>Math.abs(e)>1e-9)||Object.values(e.shimAmounts).some(e=>Math.abs(e)>1e-9)||Object.values(e.chassisOffsets).some(e=>Math.abs(e.x)>1e-9||Math.abs(e.y)>1e-9||Math.abs(e.z)>1e-9)}function ZC(e){return XC(e)}function QC(e,t){let n=e.rideHeightAdjustments??uC();return t===`Spring`?e.lengthDeltas.Spring+(e.adjustmentMode===`spring`?n.spring:0):t===`PR`?e.lengthDeltas.PR+(e.adjustmentMode===`pushrod`?n.pushrod:0):t===`SplitRocker`?e.lengthDeltas.SplitRocker+(e.adjustmentMode===`splitRocker`?n.splitRocker:0):e.lengthDeltas[t]}function $C(e){return bf(e)&&e.suspension.configuration!==`Outboard Spring`&&qC(e)}function ew(e,t,n){let r=e.geometry.right.rocker;return wC(t,r.axisStart,r.axisEnd,n)}function tw(e){return e.elements.antirollCBar&&(e.fields[`CBar Mounting`]?.trim().toLowerCase()??``)===`rocker`}function nw(e){return e.chassisOffsets.PRC}function rw(e,t){return e.suspension.configuration===`Outboard Spring`?t.chassisOffsets.PRC:{x:0,y:0,z:0}}function iw(e){let t=DC(0,Math.atan2(e.elements.cPivot.y,0),0),n=CC({x:t[0][0],y:t[1][0],z:t[2][0]}),r=e.elements.tPivot,i=e.elements.tArb,a=Math.atan2(100,0),o=-Math.atan2(0,100),s=PC(NC(MC(DC(0,a,o),r)),{x:i.x,y:0,z:i.z}),c=AC(0,a,o,Math.atan2(s.z,s.y||2**-52)),l=NC(MC(c,r)),u={x:i.x,y:i.y,z:i.z},d={x:i.x,y:-i.y,z:i.z},f=_C(e.elements.tLink),p={x:e.elements.tLink.x,y:-e.elements.tLink.y,z:e.elements.tLink.z};return{cBarAxisDirection:n,cBarTargetLength:hC(e.elements.cLink,e.elements.cArb),tBarBase:c,tBarLocalLeft:PC(l,u),tBarLocalRight:PC(l,d),tBarLocalThird:PC(l,e.elements.thirdElementArb),tBarTargetLengthLeft:hC(f,u),tBarTargetLengthRight:hC(p,d)}}function aw(e,t){return e.suspension.configuration===`Outboard Spring`?hC(t.chassis.pushRod,t.wheel.pushRod):hC(t.chassis.spring,t.wheel.spring)}function ow(e,t){let n=e.geometry.right,r=n.rocker.axisStart,i=n.rocker.axisEnd,a=TC(e,t,n),o=vC(n.chassis.spring,rw(e,t)),s=QC(t,`Spring`);QC(t,`SplitRocker`);let c=Math.max(.1,aw(e,n)+s),l=bm(0,e=>hC(o,wC(a.springWheel,r,i,e))-c,void 0,{tolerance:aC,maxIterations:40,derivativeStep:1e-5}),u=Number.isFinite(l.root)?l.root:0;return{pushRodChassis:vC(wC(a.pushRod,r,i,u),nw(t)),springWheel:wC(a.springWheel,r,i,u),angle:u}}function sw(e,t,n){if(!e.elements.antirollCBar)return _C(e.elements.cArb);let r=e.elements.cPivot,i=vC(r,t.cBarAxisDirection),a=bm(0,a=>hC(n,wC(e.elements.cArb,r,i,a))-t.cBarTargetLength,void 0,{tolerance:aC,maxIterations:24,derivativeStep:1e-5}),o=Number.isFinite(a.root)?a.root:0;return wC(e.elements.cArb,r,i,o)}function cw(e,t,n,r){let i=MC(jC(jC(e.tBarBase,OC(n)),kC(r)),t);return{left:PC(i,e.tBarLocalLeft),right:PC(i,e.tBarLocalRight),third:PC(i,e.tBarLocalThird)}}function lw(e,t,n,r){if(!e.elements.antirollTBar)return{left:{x:e.elements.tArb.x,y:e.elements.tArb.y,z:e.elements.tArb.z},right:{x:e.elements.tArb.x,y:-e.elements.tArb.y,z:e.elements.tArb.z},third:_C(e.elements.thirdElementArb)};let i=e.elements.tPivot,a=Cm([0,0],e=>{let a=cw(t,i,e[0],e[1]);return[hC(n,a.left),hC(r,a.right)]},[t.tBarTargetLengthLeft,t.tBarTargetLengthRight],{tolerance:aC,maxIterations:24,derivativeStep:1e-5});return cw(t,i,a.solution[0],a.solution[1])}function uw(e,t,n,r){let{topRear:i,bottomRear:a}=JC(e,r);if(e.suspension.macPherson){let e=vC(r.chassis.pushRod,nw(t)),i=RC(n,r.wheel.pushRod),o=t=>{let n=CC(yC(LC(t,i),e)),r={x:0,y:-n.z,z:n.y};Math.hypot(r.x,r.y,r.z)<=1e-9&&(r={x:-n.z,y:0,z:n.x});let a=CC(r),o=CC(SC(n,a));return[vC(e,bC(a,iC)),vC(e,bC(o,iC))]},s=o(n),c=_C(r.chassis.pushRod);return[{label:`TLF`,chassis:s[0],wheel:c,targetLength:hC(s[0],e),chassisForPose:e=>o(e)[0]},{label:`TLR`,chassis:s[1],wheel:c,targetLength:hC(s[1],e),chassisForPose:e=>o(e)[1]},{label:`BLF`,chassis:_C(r.chassis.bottomFront),wheel:_C(r.wheel.bottomFront)},{label:`BLR`,chassis:_C(r.chassis.bottomRear),wheel:_C(a)},{label:`TR`,chassis:_C(r.chassis.tieRod),wheel:_C(r.wheel.tieRod)}]}return[{label:`TLF`,chassis:_C(r.chassis.topFront),wheel:_C(r.wheel.to
4115pFront)},{label:`TLR`,chassis:_C(r.chassis.topRear),wheel:_C(i)},{label:`BLF`,chassis:_C(r.chassis.bottomFront),wheel:_C(r.wheel.bottomFront)},{label:`BLR`,chassis:_C(r.chassis.bottomRear),wheel:_C(a)},{label:`TR`,chassis:_C(r.chassis.tieRod),wheel:_C(r.wheel.tieRod)}]}function dw(e,t){return t===`PR`||t===`Spring`||t===`SplitRocker`?e.chassisOffsets.PRC:e.chassisOffsets[t]}function fw(e,t,n){let r=pw(e,n);return r?t.shimAmounts[r]:0}function pw(e,t){return t===`TLR`&&!WC(e)?`TLF`:t===`BLR`&&!GC(e)?`BLF`:t in pC.shimAmounts?t:null}function mw(e,t,n){let r=pw(e,n);return r?t.shimNormals[r]:lC}function hw(e,t,n,r,i){return yC(RC(e,t),bC(CC(mw(r,n,i)),fw(r,n,i)))}function gw(e,t){let n=t.map(t=>_w(e,t)),r=new Map;return t.forEach((e,t)=>{let i=n[t];i&&r.set(e.label,i)}),t.map((t,i)=>hC(t.chassisForPose?.(e,r)??t.chassis,n[i]??LC(t.lockGamma?IC(e,0):e,t.local)))}function _w(e,t){return LC(t.lockGamma?IC(e,0):e,t.local)}function vw(e,t){return-zC(t,e.vehicle.wheelRadius).z}function yw(e){if(e.centerOfGravityReference)return _C(e.centerOfGravityReference);if(!Number.isFinite(e.vehicle.cgHeight))return;let t=zC(BC(e),e.vehicle.wheelRadius);return{x:(e.geometry.right.wheelCenter.x+e.geometry.left.wheelCenter.x)*.5,y:0,z:t.z+e.vehicle.cgHeight}}function bw(e,t){let n=yw(e);if(!n)return NaN;let r=zC(t,e.vehicle.wheelRadius).z;return n.z-r}function xw(e,t,n,r){let i=QC(t,`Spring`),a=QC(t,`PR`),o=QC(t,`SplitRocker`),s=$C(e)&&(Math.abs(i)>1e-9||Math.abs(o)>1e-9);if(e.suspension.macPherson)return{label:`Spring`,chassis:vC(r.chassis.pushRod,nw(t)),local:RC(n,r.wheel.pushRod),targetLength:Math.max(.1,hC(r.chassis.pushRod,r.wheel.pushRod)+i)};if(s){let i=ow(e,t),o=r.wheel.pushRod,s=hw(n,o,t,e,`PR`);return{label:`PR`,chassis:i.pushRodChassis,local:s,targetLength:Math.max(.1,hC(r.chassis.pushRod,r.wheel.pushRod)+a)}}if(Math.abs(i)>1e-9)return e.suspension.configuration===`Outboard Spring`?{label:`Spring`,chassis:vC(r.chassis.pushRod,rw(e,t)),local:RC(n,r.wheel.pushRod),targetLength:Math.max(.1,hC(r.chassis.pushRod,r.wheel.pushRod)+i)}:{label:`Spring`,chassis:vC(r.chassis.spring,rw(e,t)),local:RC(n,r.wheel.spring),targetLength:Math.max(.1,hC(r.chassis.spring,r.wheel.spring)+i)};let c=r.wheel.pushRod;return{label:`PR`,chassis:vC(r.chassis.pushRod,nw(t)),local:hw(n,c,t,e,`PR`),targetLength:Math.max(.1,hC(r.chassis.pushRod,c)+a)}}function Sw(e,t,n){let r=e.geometry.right,i=YC(e,r,t);return[...uw(e,t,n,r).map(r=>{let a=i?.label===r.label?i.chassis:vC(r.chassis,dw(t,r.label));return{label:r.label,chassis:a,local:hw(n,r.wheel,t,e,r.label),targetLength:Math.max(.1,(r.targetLength??hC(r.chassis,r.wheel))+t.lengthDeltas[r.label]),chassisForPose:i?.label===r.label?i.chassisForPose:r.chassisForPose}}),xw(e,t,n,r)]}function Cw(e,t,n,r,i){let a=tC(e,t,ww(i.x));return a=tC(a,n,ww(i.y)),a=tC(a,r,ww(i.z)),a}function ww(e){return Number.isFinite(e)?e.toFixed(3).replace(/\.?0+$/,``):`0`}function Tw(e,t,n,r,i){let a=t.geometry.right,o=t.suspension.macPherson,s=bf(t),c=QC(i,`Spring`),l=QC(i,`SplitRocker`),u=!o&&t.suspension.configuration===`Outboard Spring`&&Math.abs(c)>1e-9,d=(Math.abs(c)>1e-9||Math.abs(l)>1e-9)&&$C(t)?ow(t,i):null,f=r.map(e=>_w(n,e)),p=new Map;r.forEach((e,t)=>{let n=f[t];n&&p.set(e.label,n)});let m=new Map;r.slice(0,5).forEach(e=>{(e.label===`TLF`||e.label===`TLR`||e.label===`BLF`||e.label===`BLR`||e.label===`TR`)&&m.set(e.label,e.chassisForPose?.(n,p)??e.chassis)});let h=new Map;r.slice(0,5).forEach((e,t)=>{(e.label===`TLF`||e.label===`TLR`||e.label===`BLF`||e.label===`BLR`||e.label===`TR`)&&h.set(e.label,f[t])});let g=(e,t)=>h.get(e)??_C(t),_=(e,t)=>m.get(e)??_C(t),v=hw(BC(t),a.wheel.pushRod,i,t,`PR`),y=RC(BC(t),a.wheel.spring),b=RC(BC(t),a.wheelCenter),x=o||!s||u?_C(a.wheel.spring):$C(t)?d?d.springWheel:_C(a.wheel.spring):LC(n,y),S={...a,chassis:{topFront:o?_C(a.chassis.topFront):_(`TLF`,vC(a.chassis.topFront,i.chassisOffsets.TLF)),topRear:o?_C(a.chassis.topRear):_(`TLR`,vC(a.chassis.topRear,i.chassisOffsets.TLR)),bottomFront:_(`BLF`,vC(a.chassis.bottomFront,i.chassisOffsets.BLF)),bottomRear:_(`BLR`,vC(a.chassis.bottomRear,i.chassisOffsets.BLR)),tieRod:_(`TR`,vC(a.chassis.tieRod,i.chassisOffsets.TR)),pushRod:d?d.pushRodChassis:vC(a.chassis.pushRod,nw(i)),spring:o||!s?_C(a.chassis.spring):vC(a.chassis.spring,rw(t,i))}
4115,wheel:{topFront:o?_C(a.wheel.topFront):g(`TLF`,a.wheel.topFront),topRear:o?_C(a.wheel.topRear):g(`TLR`,a.wheel.topRear),bottomFront:g(`BLF`,a.wheel.bottomFront),bottomRear:g(`BLR`,a.wheel.bottomRear),tieRod:g(`TR`,a.wheel.tieRod),pushRod:o||u?f[5]:LC(n,v),spring:x},wheelCenter:LC(n,b)},C=e=>d?ew(t,e,d.angle):_C(e),w={heaveLeft:t.elements.heaveSpring?C(t.elements.heaveLeft):_C(t.elements.heaveLeft),rollLeft:t.elements.rollSpring?C(t.elements.rollLeft):_C(t.elements.rollLeft),cLink:tw(t)?C(t.elements.cLink):_C(t.elements.cLink),tLink:t.elements.antirollTBar?C(t.elements.tLink):_C(t.elements.tLink)},T=iw(t),E=sw(t,T,w.cLink),D=lw(t,T,w.tLink,{x:w.tLink.x,y:-w.tLink.y,z:w.tLink.z}),O=bw(t,n),k=e;return k=Cw(k,`WheelCenterX`,`WheelCenterY`,`WheelCenterZ`,S.wheelCenter),k=Cw(k,`TLFXc`,`TLFYc`,`TLFZc`,S.chassis.topFront),k=Cw(k,`TLRXc`,`TLRYc`,`TLRZc`,S.chassis.topRear),k=Cw(k,`BLFXc`,`BLFYc`,`BLFZc`,S.chassis.bottomFront),k=Cw(k,`BLRXc`,`BLRYc`,`BLRZc`,S.chassis.bottomRear),k=Cw(k,`TRXc`,`TRYc`,`TRZc`,S.chassis.tieRod),k=Cw(k,`PRXc`,`PRYc`,`PRZc`,S.chassis.pushRod),s&&(k=Cw(k,`SXc`,`SYc`,`SZc`,S.chassis.spring)),k=Cw(k,`TLFXw`,`TLFYw`,`TLFZw`,S.wheel.topFront),k=Cw(k,`TLRXw`,`TLRYw`,`TLRZw`,S.wheel.topRear),k=Cw(k,`BLFXw`,`BLFYw`,`BLFZw`,S.wheel.bottomFront),k=Cw(k,`BLRXw`,`BLRYw`,`BLRZw`,S.wheel.bottomRear),k=Cw(k,`TRXw`,`TRYw`,`TRZw`,S.wheel.tieRod),k=Cw(k,`PRXw`,`PRYw`,`PRZw`,S.wheel.pushRod),s&&(k=Cw(k,`SXw`,`SYw`,`SZw`,S.wheel.spring)),k=Cw(k,`HSleftX`,`HSleftY`,`HSleftZ`,w.heaveLeft),k=Cw(k,`RSleftX`,`RSleftY`,`RSleftZ`,w.rollLeft),k=Cw(k,`CLinkX`,`CLinkY`,`CLinkZ`,w.cLink),k=Cw(k,`CARBX`,`CARBY`,`CARBZ`,E),k=Cw(k,`TLinkX`,`TLinkY`,`TLinkZ`,w.tLink),k=Cw(k,`TARBX`,`TARBY`,`TARBZ`,D.left),k=Cw(k,`T3EARBX`,`T3EARBY`,`T3EARBZ`,D.third),k=tC(k,`Camber`,ww(-n[0]*rC)),k=tC(k,`Toe`,ww(-n[1]*rC)),Number.isFinite(O)&&(k=tC(k,`Centre of Gravity Height`,ww(O))),k}function Ew(e){return e.suspension.macPherson?`Strut`:e.suspension.configuration===`Pullrod`?`Pullrod`:`Pushrod`}function Dw(e,t,n){let r=e.geometry.right,i=t.geometry.right,a=bf(e),o=hC(r.chassis.pushRod,r.wheel.pushRod),s=hC(i.chassis.pushRod,i.wheel.pushRod),c=Ew(e);return[[`camber`,`Camber`,`deg`,e.vehicle.camber,t.vehicle.camber],[`toe`,`Toe`,`deg`,e.vehicle.toe,t.vehicle.toe],[`wc-x`,`Wheel center X`,`mm`,r.wheelCenter.x,i.wheelCenter.x],[`wc-y`,`Wheel center Y`,`mm`,r.wheelCenter.y,i.wheelCenter.y],[`wc-z`,`Wheel center Z`,`mm`,r.wheelCenter.z,i.wheelCenter.z],[`cg-height`,`CG height`,`mm`,e.vehicle.cgHeight,t.vehicle.cgHeight],[`pushrod`,`${c} length`,`mm`,o,s],...a?[[`spring`,`Spring length`,`mm`,aw(e,r),aw(t,i)]]:[],[`residual`,`Setup residual`,`mm`,0,n]].map(([e,t,n,r,i])=>({key:e,label:t,unit:n,design:r,setup:i,delta:i-r}))}function Ow(e,t,n,r){return{document:e,spmText:t,pose:BC(e),converged:!1,residual:NaN,iterations:0,constraintErrors:[],comparisonRows:[],rideHeightAdjustments:r,warning:n}}function kw(e,t,n,r,i,a,o,s){let c=new Map,l=s=>{let l=Number(s.toFixed(9)),u=c.get(l);if(u)return u;let d=Aw(e,t,{...r,adjustmentMode:a,rideHeightAdjustments:{...i,[a]:s}},n),f=vw(n,d.pose)-o,p={residual:f,valid:Number.isFinite(f)&&d.converged&&Number.isFinite(d.residual)&&Math.abs(d.residual)<=.05};return c.set(l,p),p},u=1e-4,d=s,f=bm(d,e=>{let t=l(e);return t.valid?t.residual:NaN},void 0,{tolerance:u,maxIterations:16,derivativeStep:1e-4}),p=l(f.root);if(p.valid&&Math.abs(p.residual)<=u)return f.root;if(a!==`splitRocker`)return p.valid?f.root:0;let m=Math.max(1,Math.abs(s)),h=Array.from(new Set([0,d,-8*m,-4*m,-2*m,-m,-.5*m,-.25*m,.25*m,.5*m,m,2*m,4*m,8*m].map(e=>Number(e.toFixed(9))))).sort((e,t)=>e-t).map(e=>({candidate:e,...l(e)})).filter(e=>e.valid);if(h.length===0)return 0;let g=h[0];for(let e of h)Math.abs(e.residual)<Math.abs(g.residual)&&(g=e);if(Math.abs(g.residual)<=u)return g.candidate;for(let e=1;e<h.length;e+=1){let t=h[e-1],n=h[e];if(t.residual===0)return t.candidate;if(n.residual===0)return n.candidate;if(Math.sign(t.residual)===Math.sign(n.residual))continue;let r=t.candidate,i=n.candidate,a=t.residual,o=n.residual,s=Math.abs(a)<Math.abs(o)?r:i,c=Math.min(Math.abs(a),Math.abs(o));for(let e=0;e<32;e+=1){let e=(r+i)*.5,t=l(e);if(!t.valid)break;let n=t.residual;if(Math.abs(n)<c&&(c=Math.abs(n),s=e),Math.abs(n)<=u)return e;Math.sign(n)===Math.sign(a)?(r=e,a=n):(i=e,o=n)}return s}return g.candidate}function Aw(e,t,n,r){try{let i=mC(r,n),a=i.rideHeightAdjustments??uC();if(!XC(i))return{document:r,spmText:e,pose:BC(r),converged:!0,residual:0,iterations:0,constraintErrors:[],comparisonRows:Dw(r,r,0),rideHeightAdjustments:a,warning:null};let o=BC(r),s=Sw(r,i,o),c=Cm(o,e=>gw(e,s),s.map(e=>e.targetLength),{tolerance:aC,maxIterations:40,derivativeStep:1e-5}),l=c.solution;if(l.some(e=>!Number.isFinite(e)))return Ow(r,e,`Setup solver produced an invali
4115d spring configuration.`,a);let u=s.map(e=>_w(l,e)),d=new Map;s.forEach((e,t)=>{let n=u[t];n&&d.set(e.label,n)});let f=s.map((e,t)=>{let n=e.chassisForPose?.(l,d)??e.chassis;return{label:e.label,error:Math.abs(hC(n,u[t]??_w(l,e))-e.targetLength)}}),p=Tw(e,r,l,s,i),m=eC(p,t.replace(/(\.spm)?$/i,`_setup.spm`)),h=yw(r),g=c.converged&&c.residual<=.05?null:`Setup solver residual ${ww(c.residual)} mm`;return{document:{...m,centerOfGravityReference:h,geometry:{right:m.geometry.right,left:Sf(m.geometry.right)}},spmText:p,pose:l,converged:c.converged,residual:c.residual,iterations:c.iterations,constraintErrors:f,comparisonRows:Dw(r,m,c.residual),rideHeightAdjustments:a,warning:g}}catch(t){return Ow(r,e,t instanceof Error?`Setup solver error: ${t.message}`:`Setup solver error.`,n.rideHeightAdjustments??uC())}}function jw(e,t,n,r){let i=uC(),a=r.rideHeightDelta;if(Math.abs(a)<=1e-9)return i;let o=mC(n,{...r,rideHeightDelta:0,rideHeightAdjustments:i}),s=vw(n,Aw(e,t,o,n).pose)+a,c=[`spring`,`pushrod`,`splitRocker`],l=bf(n);return c.forEach(r=>{r===`spring`&&!l||r===`pushrod`&&n.suspension.configuration===`Outboard Spring`||r===`splitRocker`&&(!l||n.suspension.configuration===`Outboard Spring`)||(i[r]=kw(e,t,n,o,i,r,s,a))}),mC(n,{...r,rideHeightAdjustments:i}).rideHeightAdjustments??i}function Mw(e,t,n){let r=eC(e,t),i=jw(e,t,r,n);return Aw(e,t,{...n,rideHeightAdjustments:i},r)}var Nw=`SUSPENSION SETTINGS 4116 4117Axle Position: Front 4118MacPherson: 0 4119MonoShock: 0 4120Integral Link: 0 4121Main Spring: 1 4122Suspension Type: Double Wishbone 4123Configuration: Pushrod 4124Mounting Point: Upright 4125 4126VEHICLE SETTINGS 4127 4128Wheel Definition: Nominal Radius 4129Wheel Radius: 228.60 4130Rim Diameter: 10.00 4131Rim Width: 7.50 4132Rim Offset: 20.00 4133Tyre Width: 4134Aspect Ratio: 4135Brakes Position: Outboard 4136Wheeldrive: Rear 4137Camber: 0 4138Toe: 0 4139Wheelbase: 1620.00 4140Centre of Gravity Height: 300 4141Front Brake Balance: 70 4142Front Drive Ratio: 0 4143X SemiAxis: 0 4144Y SemiAxis: 0 4145Z SemiAxis: 0 4146Distance SemiAxis: 0 4147SemiAxis Fixed Joint: Chassis 4148 4149SUSPENSION GEOMETRY 4150 4151WheelCenterX: 0 4152WheelCenterY: 600 4153WheelCenterZ: 228.60 4154 4155Chassis Side 4156 4157TLFXc: 179.00 4158TLFYc: 251.00 4159TLFZc: 330.00 4160TLRXc: -190.00 4161TLRYc: 251.00 4162TLRZc: 305.00 4163BLFXc: 248.00 4164BLFYc: 70.00 4165BLFZc: 125.00 4166BLRXc: -245.00 4167BLRYc: 70.00 4168BLRZc: 129.00 4169TRXc: 81.00 4170TRYc: 180.00 4171TRZc: 157.00 4172PRXc: -4 4173PRYc: 223.5 4174PRZc: 542.00 4175SXc: 208 4176SYc: 178.28 4177SZc: 595.43 4178 4179Wheel Side 4180 4181TLFXw: -10 4182TLFYw: 500 4183TLFZw: 325 4184TLRXw: -10 4185TLRYw: 500 4186TLRZw: 325 4187BLFXw: 3 4188BLFYw: 545 4189BLFZw: 139 4190BLRXw: 3 4191BLRYw: 545 4192BLRZw: 139 4193TRXw: 57 4194TRYw: 518 4195TRZw: 168 4196PRXw: 1.29 4197PRYw: 537.5 4198PRZw: 171 4199SXw: 33.00 4200SYw: 178.28 4201SZw: 595.43 4202 4203Rocker 4204 4205P1X: 45.00 4206P1Y: 199.38 4207P1Z: 531.80 4208P2X: 45.00 4209P2Y: 237.54 4210P2Z: 564.10 4211 4212SUSPENSION ELEMENTS 4213 4214Heave Spring: 0 4215Heave Symm: 1 4216HSleftX: 0 4217HSleftY: 0 4218HSleftZ: 0 4219HSrightX: 0 4220HSrightY: 0 4221HSrightZ: 0 4222Roll Spring: 0 4223RSleftX: 0 4224RSleftY: 0 4225RSleftZ: 0 4226RSrightX: 0 4227RSrightY: 0 4228RSrightZ: 0 4229Antiroll CBar: 0 4230CLinkX: 0 4231CLinkY: 0 4232CLinkZ: 0 4233CARBX: 0 4234CARBY: 0 4235CARBZ: 0 4236CPivotX: 0 4237CPivotY: 0 4238CPivotZ: 0 4239CBar Mounting: Upright 4240Antiroll TBar: 0 4241TLinkX: 0 4242TLinkY: 0 4243TLinkZ: 0 4244TARBX: 0 4245TARBY: 0 4246TARBZ: 0 4247TPivotX: 0 4248TPivotY: 0 4249TPivotZ: 0 4250Third Element: 0 4251T3EARBX: 0 4252T3EARBY: 0 4253T3EARBZ: 0 4254T3ECX: 0 4255T3ECY: 0 4256T3ECZ: 0 4257 4258STEERING SETTINGS 4259 4260C Factor: 64.5 4261Pinion Position: Rear 4262Steering Wheel Position X: -280 4263Steering Wheel Position Y: 0 4264Steering Wheel Position Z: 535 4265Joint2 X: -180 4266Joint2 Y: 0 4267Joint2 Z: 520 4268Y Pinion: 0 4269Pinion Offset: 20 4270Rack Angle: 15 4271L Pinion: 150 4272Pinion Angle: 0 4273Gamma Angle: 90 4274 4275RUN PARAMETERS 4276 4277Calculate Bump: 1 4278Bump Max: 25 4279Rebound Max: 25 4280N of Steps Bump: 10 4281Calculate Steer: 1 4282Steering Wheel Angle Max: 100 4283N of Steps Steer: 10 4284Calculate Steering Column: 1 4285Calculate BumpSteer: 1 4286BumpSteer Angle: 100 4287Steering Model: Costant Z 4288 4289LOAD CASE 4290 4291Load Asymmetric: 0 4292Load Follow Wheel Toe: 0 4293Load R CP Fx: 0 4294Load R CP Fy: 0 4295Load R CP Fz: 0 4296Load R CP Mx: 0 4297Load R CP My: 0 4298Load R CP Mz: 0 4299Load R WC Fx: 0 4300Load R WC Fy: 0 4301Load R WC Fz: 0 4302Load R WC Mx: 0 4303Load R WC My: 0 4304Load R WC Mz: 0 4305Load L CP Fx: 0 4306Load L CP Fy: 0 4307Load L CP Fz: 0 4308Load L CP Mx: 0 4309Load L CP My: 0 4310Load L CP Mz: 0 4311Load L WC Fx: 0 4312Load L WC Fy: 0 4313Load L WC Fz: 0 4314Load L WC Mx: 0 4315Load L WC My: 0 4316Load L WC Mz: 0 4317Load CBar Torque: 0 4318Load TBar Torque: 0 4319Load Third Element Force: 0 4320Load Heave Force: 0 4321Load Roll Force: 0 4322 4323GRAPHIC SETTINGS 4324 4325Draw Wheels: 1 4326Wheel circle: 0 4327Step geometry: 0 4328Solid 2D wheels: 0 4329Roll centre: 0 4330Draw Upright: 1 4331Draw Rocker: 1 4332Draw Offset Rim: 0 4333Draw Springs: 1 4334Draw 3D Arm: 1 4335Draw Steering: 0 4336Draw Steering Axis: 0 4337Steering offsets: 0 4338Virtual Points/Lines: 0 4339Steering axis envelope: 0 4340Draw Chassis: 0 4341Draw Arrow: 1 4342Draw Origin: 1 4343Draw Medium R: 1 4344Draw Push/Spring Link: 1 4345Draw SemiAxis: 0 4346Draw Opposite Axle: 0 4347Draw MainSpring: 1 4348Draw Load Arrows: 1 4349Draw Load Inputs: 1 4350Draw Load Reactions: 1 4351Draw Load Axials: 1 4352Draw Load Labels: 1 4353Load Arrow Scale: 100 4354Spring Diameter: 50 4355N of Spire in a Spring: 6 43563D Arm Diameter: 14 4357SemiAxis Diameter: 20 4358Steering Wheel Diameter: 180 4359Line Width: 1 43602D Link Width: 2 4361Virtual Line Thickness: 1 4362Point Size: 4 43633D Joint size: 4 4364Chassis Opacity: 1 43652D View: 1 43663D View: 1 4367View: Two Wheels 4368 4369NOTES : 4370 234.464884125867`;function Pw(e,t){let n=e.fields[t];return n!==void 0&&n.trim()!==``&&n.trim()!==`0`}function Fw(e,t){let n=Pw(e,`Calculate Bump`);
4370switch(t){case`bump`:return n;case`steer`:return Pw(e,`Calculate Steer`);case`roll`:return n&&Pw(e,`Calculate Roll`);case`bumpSteer`:return n&&Pw(e,`Calculate BumpSteer`);case`steeringColumn`:return Pw(e,`Calculate Steer`)&&Pw(e,`Calculate Steering Column`)}}var Iw=2,Lw=.5,Rw=1e-6,zw=30,Bw=6;function Vw(e){let t=e.trim().replace(`,`,`.`);if(t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}function Hw(e){let t=[`,`,`;`,` `],n=t[0],r=-1;return t.forEach(t=>{let i=e.split(t).length-1;i>r&&(n=t,r=i)}),n}function Uw(e){return e.trim().toLowerCase().replace(/[^a-z0-9]/g,``)}function Ww(e){if(e.length===0)return[];let t=Math.abs(e[0].y)<=Rw;return[...e.slice(+!!t).slice().reverse().map(e=>({y:-Math.abs(e.y),z:e.z})),...e.map(e=>({y:Math.abs(e.y),z:e.z}))]}function Gw([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function Kw(e,t){let n=Gw(e);return{x:n[0][0]*t.x+n[0][1]*t.y+n[0][2]*t.z+e[3],y:n[1][0]*t.x+n[1][1]*t.y+n[1][2]*t.z+e[4],z:n[2][0]*t.x+n[2][1]*t.y+n[2][2]*t.z+e[5]}}function qw(e,t,n){let r=Math.max(t-e.z,Lw);return{x:Math.sin(n)*r,y:e.y,z:-Math.cos(n)*r}}function Jw(e){let t=e?.trim().toLowerCase();return t===`tyre profile`||t===`tyre profile (.csv)`}function Yw(e,t){let n=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0);if(n.length<Iw+1)throw Error(`The selected tyre profile file does not contain enough rows.`);let r=Hw(n[0]),i=n.map(e=>e.split(r).map(e=>e.trim())),a=i[0],o=a.map(Uw),s=o.some(e=>/[a-z]/.test(e)),c=+(a.length>=3),l=a.length>=3?2:1,u=o.findIndex(e=>e===`ymm`||e===`y`),d=o.findIndex(e=>e===`zmm`||e===`z`),f=u>=0?u:c,p=d>=0?d:l,m=i.slice(+!!s).reduce((e,t)=>{if(f>=t.length||p>=t.length)return e;let n=Vw(t[f]),r=Vw(t[p]);return n===null||r===null||e.push({y:Math.abs(n),z:r}),e},[]);if(m.length<Iw)throw Error(`The selected tyre profile file does not contain valid Y/Z coordinate rows.`);let h=Ww(m),g=m.reduce((e,t)=>Math.max(e,Math.abs(t.y)),0),_=m.reduce((e,t)=>Math.min(e,t.z),1/0),v=m.reduce((e,t)=>Math.max(e,t.z),-1/0),y=g*2,b=v-_;return{fileName:t,sourceText:e,halfProfile:m,fullProfile:h,halfWidth:g,minHeight:_,maxHeight:v,overallWidth:y,profileHeight:b,profileAspectRatio:y>0?b/y*100:0}}function Xw(e,t,n){let r=t.length,i=n,a=Array.from({length:r},()=>[]),o=Array.from({length:r},()=>[]);for(let n=0;n<r;n+=1)for(let r=0;r<i;r+=1){let s=r/i*Math.PI*2,c=qw(t[n],e.radius,s);a[n].push(c),o[n].push(Kw(e.pose,c))}let s=[],c=[];for(let e=0;e<r-1;e+=1)for(let t=0;t<i;t+=1){let n=(t+1)%i;c.push([a[e][t],a[e][n],a[e+1][n],a[e+1][t]]),s.push([o[e][t],o[e][n],o[e+1][n],o[e+1][t]])}let l=[],u=[],d=a[0],f=a[r-1],p=o[0],m=o[r-1];for(let e=0;e<i;e+=1){let t=(e+1)%i;u.push([f[e],f[t],d[t],d[e]]),l.push([m[e],m[t],p[t],p[e]])}let h=t.map(t=>Kw(e.pose,qw(t,e.radius,0)));return{wheel:e,quads:s,localQuads:c,innerQuads:l,localInnerQuads:u,geometryKey:[e.radius.toFixed(4),i,...t.flatMap(e=>[e.y.toFixed(4),e.z.toFixed(4)])].join(`:`),fitPoints:o.flat(),profileCurve:h}}function Zw(e){let t=Math.max(e.width*.5,Lw),n=Math.min(zw,t*.65,Math.max(e.radius*.2,Lw)),r=Math.max(t-n,t*.35),i=[{y:0,z:0},{y:r*.62,z:0},{y:r,z:0}];for(let e=1;e<=Bw;e+=1){let t=e/Bw*(Math.PI/2);i.push({y:r+n*Math.sin(t),z:n*(1-Math.cos(t))})}let a=Math.min(Math.max(e.rimRadius,Lw),e.radius),o=Math.max(n,e.radius-a);return o>n+Rw&&i.push({y:t,z:o}),Ww(i)}function Qw(e,t,n=24){if(!t||n<3)return[];let r=t.fullProfile;return r.length<Iw?[]:e.map(e=>Xw(e,r,n))}function $w(e,t=24){return t<3?[]:e.map(e=>Xw(e,Zw(e),t))}var eT={key:`bump`,label:`Bump`,headerAliases:[`bump`,`wheel bump`,`wheel travel`,`jounce rebound`]},tT={key:`steeringWheelAngle`,label:`Steering Wheel angle`,headerAliases:[`steering wheel angle`,`steering angle`,`steer`,`sw angle`]};function nT(e,t,n,r){let i=t.flatMap(e=>{let t=e[n],i=e[r];return typeof t==`number`&&Number.isFinite(t)&&typeof i==`number`&&Number.isFinite(i)?[{input:t,value:i}]:[]}).sort((e,t)=>
4370e.input-t.input);if(i.length<2)return null;let a=e=>{let t=i[0],n=i[i.length-1],r=Math.max(1,Math.abs(t.input),Math.abs(n.input))*1e-9;if(e<t.input-r||e>n.input+r)return null;for(let t=0;t<i.length;t+=1){let n=i[t];if(Math.abs(n.input-e)<=r)return n.value;if(t===0||n.input<e)continue;let a=i[t-1],o=n.input-a.input;if(Math.abs(o)<=r)return n.value;let s=(e-a.input)/o;return a.value+(n.value-a.value)*s}return Math.abs(n.input-e)<=r?n.value:null},o=e.flatMap(e=>{let t=a(e.input);return t===null||!Number.isFinite(e.value)?[]:[{observed:e.value,predicted:t}]});if(o.length<2)return null;let s=o.reduce((e,t)=>e+t.observed,0)/o.length,c=o.reduce((e,t)=>e+(t.observed-t.predicted)**2,0),l=o.reduce((e,t)=>e+(t.observed-s)**2,0),u=Math.max(1,...o.map(e=>Math.abs(e.observed))),d=o.length*u*u*1e-12;if(l<=d)return c<=d?100:0;let f=1-c/l;return Math.max(0,Math.min(100,f*100))}function rT(e,t,n){return nT(e,t,eT.key,n)}function iT(e,t,n){return nT(e,t,tT.key,n)}var aT=1e-9;function oT(e){return{x:e.x,y:-e.y,z:e.z}}function sT(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}function cT(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function lT(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function uT(e){return Math.hypot(e.x,e.y,e.z)}function dT(e){let t=uT(e);return t<aT?null:{x:e.x/t,y:e.y/t,z:e.z/t}}function fT(e){let t=null,n=0;return e.forEach(e=>{let r=uT(e);r>n&&(t=e,n=r)}),n<aT||t===null?null:t}function pT(e,t,n,r){let i=sT(t,e),a=sT(r,n);return dT(fT([lT(i,sT(n,e)),lT(i,sT(r,e)),lT(a,sT(e,n)),lT(a,sT(t,n)),lT(i,a)])??{x:0,y:0,z:0})}function mT(e,t,n,r,i){let a=pT(t,n,r,i),o=-e.y;if(a===null)return{x:e.x,y:o,z:e.z};let s=cT(sT(e,t),a),c=o-e.y,l=a.x*a.x+a.z*a.z;if(l<aT)return{x:e.x,y:o,z:e.z};let u=(-2*s-a.y*c)/l;return{x:e.x+u*a.x,y:o,z:e.z+u*a.z}}function hT(e,t,n){return mT(e,t,n,oT(t),oT(n))}var gT=[{id:`wheel-center`,label:`Wheel Center`,group:`Reference`,xKey:`WheelCenterX`,yKey:`WheelCenterY`,zKey:`WheelCenterZ`},{id:`tlf-c`,label:`TLF Chassis`,group:`Chassis Side`,xKey:`TLFXc`,yKey:`TLFYc`,zKey:`TLFZc`},{id:`tlr-c`,label:`TLR Chassis`,group:`Chassis Side`,xKey:`TLRXc`,yKey:`TLRYc`,zKey:`TLRZc`},{id:`blf-c`,label:`BLF Chassis`,group:`Chassis Side`,xKey:`BLFXc`,yKey:`BLFYc`,zKey:`BLFZc`},{id:`blr-c`,label:`BLR Chassis`,group:`Chassis Side`,xKey:`BLRXc`,yKey:`BLRYc`,zKey:`BLRZc`},{id:`tr-c`,label:`TR Chassis`,group:`Chassis Side`,xKey:`TRXc`,yKey:`TRYc`,zKey:`TRZc`},{id:`pr-c`,label:`PR Chassis`,group:`Chassis Side`,xKey:`PRXc`,yKey:`PRYc`,zKey:`PRZc`},{id:`s-c`,label:`Spring Chassis`,group:`Chassis Side`,xKey:`SXc`,yKey:`SYc`,zKey:`SZc`},{id:`tlf-w`,label:`TLF Wheel`,group:`Wheel Side`,xKey:`TLFXw`,yKey:`TLFYw`,zKey:`TLFZw`},{id:`tlr-w`,label:`TLR Wheel`,group:`Wheel Side`,xKey:`TLRXw`,yKey:`TLRYw`,zKey:`TLRZw`},{id:`blf-w`,label:`BLF Wheel`,group:`Wheel Side`,xKey:`BLFXw`,yKey:`BLFYw`,zKey:`BLFZw`},{id:`blr-w`,label:`BLR Wheel`,group:`Wheel Side`,xKey:`BLRXw`,yKey:`BLRYw`,zKey:`BLRZw`},{id:`tr-w`,label:`TR Wheel`,group:`Wheel Side`,xKey:`TRXw`,yKey:`TRYw`,zKey:`TRZw`},{id:`pr-w`,label:`PR Wheel`,group:`Wheel Side`,xKey:`PRXw`,yKey:`PRYw`,zKey:`PRZw`},{id:`s-w`,label:`Spring Wheel`,group:`Wheel Side`,xKey:`SXw`,yKey:`SYw`,zKey:`SZw`},{id:`p1`,label:`Rocker P1`,group:`Rocker`,xKey:`P1X`,yKey:`P1Y`,zKey:`P1Z`},{id:`p2`,label:`Rocker P2`,group:`Rocker`,xKey:`P2X`,yKey:`P2Y`,zKey:`P2Z`},{id:`hs-left`,label:`Heave Spring Left`,group:`Suspension Elements`,xKey:`HSleftX`,yKey:`HSleftY`,zKey:`HSleftZ`},{id:`hs-right`,label:`Heave Spring Right`,group:`Suspension Elements`,xKey:`HSrightX`,yKey:`HSrightY`,zKey:`HSrightZ`},{id:`rs-left`,label:`Roll Spring Left`,group:`Suspension Elements`,xKey:`RSleftX`,yKey:`RSleftY`,zKey:`RSleftZ`},{id:`rs-right`,label:`Roll Spring Right`,group:`Suspension Elements`,xKey:`RSrightX`,yKey:`RSrightY`,zKey:`RSrightZ`},{id:`c-link`,label:`C-Bar Link`,group:`Suspension Elements`,xKey:`CLinkX`,yKey:`CLinkY`,zKey:`CLinkZ`},{id:`c-arb`,label:`C-Bar Arm`,group:`Suspension Elements`,xKey:`CARBX`,yKey:`CARBY`,zKey:`CARBZ`},{id:`c-pivot`,label:`C-Bar Pivot`,group:`Suspension Elements`,xKey:`CPivotX`,yKey:`CPivotY`,zKey:`CPivotZ`},{id:`t-link`,label:`T-Bar Link`,group:`Suspension Elements`,xKey:`TLinkX`,yKey:`TLinkY`,zKey:`TLinkZ`},{id:`t-arb`,label:`T-Bar Arm`,group:`Suspension Elements`,xKey:`TARBX`,yKey:`TARBY`,zKey:`TARBZ`},{id:`t-pivot`,label:`T-Bar Pivot`,group:`Suspension Elements`,xKey:`TPivotX`,yKey:`TPivotY`,zKey:`TPivotZ`},{id:`third-arb`,label:`Third Element ARB`,group:`Suspension Elements`,xKey:`T3EARBX`,yKey:`T3EARBY`,zKey:`T3EARBZ`},{id:`third-chassis`,label:`Third Element Chassis`,group:`Suspension Elements`,xKey:`T3ECX`,yKey:`T3ECY`,zKey:`T3ECZ`},{id:`steering-wheel`,label:`Steering Wheel`,group:`Steering`,xKey:`Steering Wheel Position X`,yKey:`Steering Wheel Position Y`,zKey:`Steering Wheel Position Z`},{id:`joint-2`,label:`Steering Joint 2`,group:`Steering`,xKey:`Joint2 X`,yKey:`Joint2 Y`,zKey:`Joint2 Z`},{id:`semi-axis`,label:`Semi Axis`,group:`Driveline`,xKey:`X SemiAxis`,yKey:`Y SemiAxis`,zKey:`Z SemiAxis`}];function _T(e,t){let n=Number((e.fields[t]??`0`).trim().replace(`,`,`.`));return Number.isFinite(n)?n:0}var vT=new Set([`TPivotY`,`T3EARBY`,`T3ECY`]);function yT(e){return gT.map(t=>
4370({...t,point:{x:_T(e,t.xKey),y:vT.has(t.yKey)?0:_T(e,t.yKey),z:_T(e,t.zKey)}}))}function bT(e,t){return t===`x`?e.xKey:t===`y`?e.yKey:e.zKey}Math.PI/180;function xT(e){return e.replace(/'/g,`''`)}function ST(e){return e.replace(/\.[^.]+$/i,``).trim()||`Suspension`}function CT(e){if(!Number.isFinite(e))return`0.`;let t=Number(e.toFixed(6));return Number.isInteger(t)?`${t}.`:String(t)}function wT(e){if(!e)return null;let t=e.trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(t)?{r:Number.parseInt(t.slice(1,3),16)/255,g:Number.parseInt(t.slice(3,5),16)/255,b:Number.parseInt(t.slice(5,7),16)/255}:null}function TT(e,t=48){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t).join(`,`));return`(${n.join(`, 4371`)})`}function ET(e){let t=new Map,n=[],r=r=>{let i=t.get(r);if(i!==void 0)return i;let a=e.vertices[r-1];if(!a||!Number.isFinite(a.x)||!Number.isFinite(a.y)||!Number.isFinite(a.z))return null;n.push({x:a.x,y:a.y,z:a.z});let o=n.length;return t.set(r,o),o},i=[];return e.faces.forEach(([e,t,n])=>{let a=r(e),o=r(t),s=r(n);a===null||o===null||s===null||a===o||o===s||a===s||i.push([a,o,s])}),n.length>0&&i.length>0?{vertices:n,faces:i}:null}function DT(e,t,n,r){let i=e.map(e=>{let t=ET(e.mesh);return t?{...e,mesh:t}:null}).filter(e=>e!==null);if(i.length===0)throw Error(`Cannot export STEP geometry: no valid mesh faces found.`);let a=1,o=[],s=e=>{let t=a;return a+=1,o.push(`#${t}=${e};`),t},c=s(`APPLICATION_CONTEXT('managed model based 3d engineering')`);s(`APPLICATION_PROTOCOL_DEFINITION('international standard','ap242_managed_model_based_3d_engineering',2014,#${c})`);let l=s(`PRODUCT_DEFINITION_SHAPE('','',#${s(`PRODUCT_DEFINITION('design','',#${s(`PRODUCT_DEFINITION_FORMATION('','',#${s(`PRODUCT('IMPORTED_STEP_GEOMETRY','IMPORTED_STEP_GEOMETRY','3DSusp imported STEP geometry',(#${s(`PRODUCT_CONTEXT('',#${c},'mechanical')`)}))`)})`)},#${s(`PRODUCT_DEFINITION_CONTEXT('part definition',#${c},'design')`)})`)})`),u=s(`(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#${s(`(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.))`)},#${s(`(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.))`)},#${s(`(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT())`)}))REPRESENTATION_CONTEXT('',''))`),d=i.map(({name:e,mesh:t,colorHex:n})=>{let r=xT(e||`Imported STEP mesh`),i=t.vertices.map(e=>`(${CT(e.x)},${CT(e.y)},${CT(e.z)})`),a=s(`COORDINATES_LIST('${r}',${t.vertices.length},${TT(i)})`),o=t.faces.map(([e,t,n])=>`(${e},${t},${n})`);return{surface:s(`TRIANGULATED_SURFACE_SET('${r}',#${a},${t.vertices.length},(),(),${TT(o)})`),color:wT(n)}});s(`SHAPE_DEFINITION_REPRESENTATION(#${l},#${s(`TESSELLATED_SHAPE_REPRESENTATION('3DSusp imported STEP geometry',(${d.map(e=>`#${e.surface}`).join(`,`)}),#${u})`)})`);let f=d.flatMap(e=>e.color?[s(`STYLED_ITEM('3DSusp mesh color',(#${s(`PRESENTATION_STYLE_ASSIGNMENT((#${s(`SURFACE_STYLE_USAGE(.BOTH.,#${s(`SURFACE_SIDE_STYLE('',(#${s(`SURFACE_STYLE_FILL_AREA(#${s(`FILL_AREA_STYLE('',(#${s(`FILL_AREA_STYLE_COLOUR('',#${s(`COLOUR_RGB('',${CT(e.color.r)},${CT(e.color.g)},${CT(e.color.b)})`)})`)}))`)})`)}))`)})`)}))`)}),#${e.surface})`)]:[]);f.length>0&&s(`MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',(${f.map(e=>`#${e}`).join(`,`)}),#${u})`);let p=n.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,`_`)||`imported_step_geometry`,m=`${ST(t)}_${p}.step`,h=new Date().toISOString();return{fileName:m,stepText:[`ISO-10303-21;`,`HEADER;`,`FILE_DESCRIPTION(('${xT(r)}'),'2;1');`,`FILE_NAME('${xT(m)}','${h}',('3DSusp Web'),('BSpoke Automotive'),'3DSusp Web','3DSusp Web','');`,`FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF { 1 0 10303 442 1 1 4 }'));`,`ENDSEC;`,`DATA;`,...o,`ENDSEC;`,`END-ISO-10303-21;`,``].join(` 4372`),faceCount:i.reduce((e,t)=>e+t.mesh.faces.length,0)}}var OT={CRTPNT:`CARTESIAN_POINT`,DRCTN:`DIRECTION`,A2PL3D:`AXIS2_PLACEMENT_3D`,ADVFC:`ADVANCED_FACE`,FCBND:`FACE_BOUND`,FCOTBN:`FACE_OUTER_BOUND`,CYLSRF:`CYLINDRICAL_SURFACE`,SH
4372DFRP:`SHAPE_DEFINITION_REPRESENTATION`,SHPRPR:`SHAPE_REPRESENTATION`,ABSR:`ADVANCED_BREP_SHAPE_REPRESENTATION`,CLRRGB:`COLOUR_RGB`,MNSLBR:`MANIFOLD_SOLID_BREP`,CLSSHL:`CLOSED_SHELL`,OPNSHL:`OPEN_SHELL`,SHBSM:`SHELL_BASED_SURFACE_MODEL`};function kT(e){let t=e.toUpperCase();return OT[t]??t}function AT(e){if(!Number.isFinite(e))return`0.`;let t=Number(e.toFixed(6));return Number.isInteger(t)?`${t}.`:String(t)}function jT(e){if(!e)return null;let t=e.trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(t)?{r:Number.parseInt(t.slice(1,3),16)/255,g:Number.parseInt(t.slice(3,5),16)/255,b:Number.parseInt(t.slice(5,7),16)/255}:null}function MT(e,t){let n=jT(t);if(!n)return e;let r=`[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?`,i=RegExp(`(COLOUR_RGB|CLRRGB)\\s*\\(\\s*('(?:[^']|'')*'|\\$)\\s*,\\s*${r}\\s*,\\s*${r}\\s*,\\s*${r}\\s*\\)`,`gi`),a=`${AT(n.r)},${AT(n.g)},${AT(n.b)}`;return e.replace(i,(e,t,n)=>`${t}(${n},${a})`)}function NT(e){let t=[],n=0,r=!1,i=0;for(let a=0;a<e.length;a+=1){let o=e[a];if(o===`'`){if(r&&e[a+1]===`'`){a+=1;continue}r=!r;continue}if(!r){if(o===`(`){n+=1;continue}if(o===`)`){n=Math.max(0,n-1);continue}o===`,`&&n===0&&(t.push(e.slice(i,a).trim()),i=a+1)}}let a=e.slice(i).trim();return a.length>0&&t.push(a),t}function PT(e){let t=[],n=/#(\d+)\s*=\s*([A-Z0-9_]+)\s*\(/gi,r=n.exec(e);for(;r;){let i=n.lastIndex,a=1,o=!1;for(;i<e.length&&a>0;){let t=e[i];if(t===`'`){if(o&&e[i+1]===`'`){i+=2;continue}o=!o,i+=1;continue}o||(t===`(`?a+=1:t===`)`&&--a),i+=1}let s=i;for(;s<e.length&&/\s/.test(e[s]);)s+=1;e[s]===`;`&&(s+=1,t.push({id:Number.parseInt(r[1],10),type:r[2].toUpperCase(),body:e.slice(n.lastIndex,i-1),start:r.index,end:s})),n.lastIndex=Math.max(s,n.lastIndex),r=n.exec(e)}return t}function FT(e){let t=0,n=/#(\d+)\s*=/g,r=n.exec(e);for(;r;){let i=Number.parseInt(r[1],10);Number.isFinite(i)&&i>t&&(t=i),r=n.exec(e)}return t}function IT(e){let t=PT(e),n=new Map;t.forEach(e=>{n.set(e.id,e.type)});let r=new Set,i=null;t.forEach(e=>{if(!e.type.endsWith(`SHAPE_REPRESENTATION`))return;let t=NT(e.body);if(t.length<3)return;(t[1].match(/#\d+/g)??[]).forEach(e=>r.add(Number.parseInt(e.slice(1),10)));let n=t[t.length-1].match(/#\d+/g)??[];n.length>0&&(i=Number.parseInt(n[n.length-1].slice(1),10))});let a=new Set([`MANIFOLD_SOLID_BREP`,`BREP_WITH_VOIDS`,`FACETED_BREP`,`SHELL_BASED_SURFACE_MODEL`,`CONNECTED_FACE_SET`,`CLOSED_SHELL`,`OPEN_SHELL`,`ADVANCED_FACE`,`MAPPED_ITEM`,`GEOMETRIC_SET`]),o=Array.from(r).filter(e=>{let t=n.get(e);return Number.isFinite(e)&&!!(t&&a.has(kT(t)))}),s=t.filter(e=>{let t=kT(e.type);return a.has(t)&&t!==`MAPPED_ITEM`}).map(e=>e.id);return{itemIds:Array.from(new Set(o.length>0?o:s)),contextId:i}}function LT(e,t,n){let r=jT(n);if(!r)return``;let{itemIds:i,contextId:a}=IT(t);if(i.length===0||!a)return``;let o=FT(e)+1,s=[],c=e=>{let t=o;return o+=1,s.push(`#${t}=${e};`),t},l=c(`PRESENTATION_STYLE_ASSIGNMENT((#${c(`SURFACE_STYLE_USAGE(.BOTH.,#${c(`SURFACE_SIDE_STYLE('',(#${c(`SURFACE_STYLE_FILL_AREA(#${c(`FILL_AREA_STYLE('',(#${c(`FILL_AREA_STYLE_COLOUR('',#${c(`COLOUR_RGB('',${AT(r.r)},${AT(r.g)},${AT(r.b)})`)})`)}))`)})`)}))`)})`)}))`);return c(`MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',(${i.map(e=>c(`STYLED_ITEM('3DSusp selected color',(#${l}),#${e})`)).map(e=>`#${e}`).join(`,`)}),#${a})`),`\n${s.join(` 4373`)}\n`}var RT={SHDFRP:`SHAPE_DEFINITION_REPRESENTATION`,PRDFSH:`PRODUCT_DEFINITION_SHAPE`,SHPRPR:`SHAPE_REPRESENTATION`,ABSR:`ADVANCED_BREP_SHAPE_REPRESENTATION`,A2PL3D:`AXIS2_PLACEMENT_3D`};function zT(e){let t=e.toUpperCase();return RT[t]??t}function BT(e){return e.replace(/'/g,`''`)}function VT(e){return e.replace(/\.[^.]+$/i,``).trim()||`Suspension`}function HT(e){if(!Number.isFinite(e)||Math.abs(e)<1e-12)return`0.`;let t=Number(e.toFixed(12));return Number.isInteger(t)?`${t}.`:String(t)}function UT(e){return`(${HT(e.x)},${HT(e.y)},${HT(e.z)})`}function WT(e){let t=[],n=0,r=!1,i=0;for(let a=0;a<e.length;a+=1){let o=e[a];if(o===`'`){if(r&&e[a+1]===`'`){a+=1;continue}r=!r;continue}if(!r){if(o===`(`){n+=1;continue}if(o===`)`){n=Math.max(0,n-1);continue}o===`,`&&n===0&&(t.push(e.slice(i,a).trim()),i=a+1)}}let a=e.slice(i).trim();return a.length>0&&t.push(a),t}function GT(e){let t=[],n=/#(\d+)\s*=\s*([A-Z0-9_]+)\s*\(/gi,r=n.exec(e);for(;r;){let i=n.lastIndex,a=1,o=!1;for(;i<e.length&&a>0;){let t=e[i];if(t===`'`){if(o&&e[i+1]===`'`){i+=2;continue}o=!o,i+=1;continue}o||(t===`(`?a+=1:t===`)`&&--a),i+=1}let s=i;for(;s<e.length&&/\s/.test(e[s]);)s+=1;e[s]===`;`&&(s+=1,t.push({id:Number.parseInt(r[1],10),type:r[2].toUpperCase(),body:e.slice(n.lastIndex,i-1),start:r.index,end:s})),n.lastIndex=Math.max(s,n.lastIndex),r=n.exec(e)}return t}function KT(e){let t=0,n=/#(\d+)\s*=/g,r=n.exec(e);for(;r;){let i=Number.parseInt(r[1],10);Number.isFinite(i)&&i>t&&(t=i),r=n.exec(e)}return t}function qT(e,t,n){return`${e.slice(0,t.start)}#${t.id}=${t.type}(${n});
4373${e.slice(t.end)}`}function JT(e){let t=e.toUpperCase(),n=t.indexOf(`DATA;`),r=n>=0?t.indexOf(`ENDSEC;`,n+5):-1;return n<0||r<=n?null:e.slice(n+5,r)}function YT(e){let t=e.match(/FILE_SCHEMA\s*\(\s*\(([\s\S]*?)\)\s*\)\s*;/i);return t?Array.from(t[1].matchAll(/'([^']+)'/g),e=>e[1]).filter(Boolean):[]}function XT(e){let t=e.toUpperCase();return t.includes(`TRIANGULATED_SURFACE_SET`)||t.includes(`TESSELLATED_SHAPE_REPRESENTATION`)||t.includes(`COORDINATES_LIST`)}function ZT(e){let t=1e-9;return Math.abs(e.scale-1)<=t&&Math.abs(e.scaleY-1)<=t&&Math.abs(e.scaleZ-1)<=t}function QT(e){let t=GT(e),n=new Map(t.map(e=>[e.id,e]));for(let e of t){if(zT(e.type)!==`SHAPE_DEFINITION_REPRESENTATION`)continue;let t=e.body.match(/#\d+/g)??[],r=t[0],i=t[1];if(!r||!i)continue;let a=n.get(Number.parseInt(r.slice(1),10)),o=n.get(Number.parseInt(i.slice(1),10));if(!a||zT(a.type)!==`PRODUCT_DEFINITION_SHAPE`||!o||!zT(o.type).endsWith(`SHAPE_REPRESENTATION`)||WT(o.body).length<3)continue;let s=a.body.match(/#\d+/g)??[],c=s[s.length-1];if(c)return{sdr:e,representation:o,productDefinitionId:Number.parseInt(c.slice(1),10)}}return null}function $T(e){return e.length>0&&e.every(e=>{if(e.sourceStepText.trim().length===0||XT(e.sourceStepText)||!ZT(e.transform))return!1;let t=JT(e.sourceStepText);return!!(t&&QT(t))})}function eE(e){let t=JT(e.sourceStepText);if(!t)throw Error(`Cannot preserve ${e.name}: STEP DATA section not found.`);let n=/\b(?:COLOUR_RGB|CLRRGB)\s*\(/i.test(t),r=MT(t,e.colorHex);n||(r+=LT(e.sourceStepText,r,e.colorHex));let i=QT(r);if(!i)throw Error(`Cannot preserve ${e.name}: primary STEP shape representation not found.`);let a=WT(i.representation.body);if(a.length<3)throw Error(`Cannot preserve ${e.name}: invalid STEP shape representation.`);let o=KT(r)+1,s=[],c=e=>{let t=o;return o+=1,s.push(`#${t}=${e};`),t},l=c(`AXIS2_PLACEMENT_3D('',#${c(`CARTESIAN_POINT('',(0.,0.,0.))`)},#${c(`DIRECTION('',(0.,0.,1.))`)},#${c(`DIRECTION('',(1.,0.,0.))`)})`),u=a[1].trim(),d=u.startsWith(`(`)&&u.endsWith(`)`)?u.slice(1,-1).trim():``;return a[1]=`(#${l}${d?`,${d}`:``})`,r=qT(r,i.representation,a.join(`,`)),r=`${r.trimEnd()}\n${s.join(` 4374`)}\n`,{data:r,maxEntityId:o-1,representationId:i.representation.id,productDefinitionId:i.productDefinitionId,sourcePlacementId:l,schemaNames:YT(e.sourceStepText)}}function tE(e,t){if(t===0)return e;let n=``,r=!1,i=0;for(;i<e.length;){let a=e[i];if(a===`'`){if(n+=a,r&&e[i+1]===`'`){n+=`'`,i+=2;continue}r=!r,i+=1;continue}if(!r&&a===`#`&&/\d/.test(e[i+1]??``)){let r=i+1;for(;/\d/.test(e[r]??``);)r+=1;n+=`#${Number.parseInt(e.slice(i+1,r),10)+t}`,i=r;continue}n+=a,i+=1}return n}function nE(e,t){let n=t.x*Math.PI/180,r=t.y*Math.PI/180,i=t.z*Math.PI/180,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i),d={x:e.x,y:e.y*a-e.z*o,z:e.y*o+e.z*a},f={x:d.x*s+d.z*c,y:d.y,z:-d.x*c+d.z*s};return{x:f.x*l-f.y*u,y:f.x*u+f.y*l,z:f.z}}function rE(e,t,n,r){if(!$T(e))throw Error(`Source-preserving STEP export is not available for tessellated or scaled geometry.`);let i=0,a=[],o=[],s=[];e.forEach(e=>{let t=eE(e),n=i;a.push(tE(t.data,n)),o.push({name:e.name,transform:e.transform,representationId:t.representationId+n,productDefinitionId:t.productDefinitionId+n,sourcePlacementId:t.sourcePlacementId+n}),s.push(...t.schemaNames),i=n+t.maxEntityId});let c=i+1,l=[],u=e=>{let t=c;return c+=1,l.push(`#${t}=${e};`),t},d=u(`APPLICATION_CONTEXT('automotive design')`);u(`APPLICATION_PROTOCOL_DEFINITION('international standard','automotive_design',2000,#${d})`);let f=u(`PRODUCT_DEFINITION('design','',#${u(`PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE('','',#${u(`PRODUCT('3DSUSP_IMPORTED_STEP_ASSEMBLY','3DSUSP_IMPORTED_STEP_ASSEMBLY','3DSusp imported STEP assembly',(#${u(`PRODUCT_CONTEXT('',#${d},'mechanical')`)}))`)},.NOT_KNOWN.)`)},#${u(`PRODUCT_DEFINITION_CONTEXT('part definition',#${d},'design')`)})`),p=u(`PRODUCT_DEFINITION_SHAPE('','',#${f})`),m=u(`(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#${u(`(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.))`)},#${u(`(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.))`)},#${u(`(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT())`)}
4374))REPRESENTATION_CONTEXT('3DSusp assembly','3D'))`),h=o.map(e=>{let t=u(`CARTESIAN_POINT('',${UT(e.transform.translate)})`),n=nE({x:0,y:0,z:1},e.transform.rotateDeg),r=nE({x:1,y:0,z:0},e.transform.rotateDeg);return u(`AXIS2_PLACEMENT_3D('',#${t},#${u(`DIRECTION('',${UT(n)})`)},#${u(`DIRECTION('',${UT(r)})`)})`)}),g=u(`SHAPE_REPRESENTATION('3DSusp imported STEP assembly',(${h.map(e=>`#${e}`).join(`,`)}),#${m})`);u(`SHAPE_DEFINITION_REPRESENTATION(#${p},#${g})`),o.forEach((e,t)=>{let n=u(`ITEM_DEFINED_TRANSFORMATION('','',#${e.sourcePlacementId},#${h[t]})`);u(`CONTEXT_DEPENDENT_SHAPE_REPRESENTATION(#${u(`(REPRESENTATION_RELATIONSHIP('','',#${e.representationId},#${g})REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION(#${n})SHAPE_REPRESENTATION_RELATIONSHIP())`)},#${u(`PRODUCT_DEFINITION_SHAPE('Placement','Placement of an item',#${u(`NEXT_ASSEMBLY_USAGE_OCCURRENCE('${t+1}','${BT(e.name)}','',#${f},#${e.productDefinitionId},$)`)})`)})`)});let _=Array.from(new Set(s));_.length===0&&_.push(`AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 1 }`);let v=n.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,`_`)||`imported_step_geometry`,y=`${VT(t)}_${v}.step`,b=new Date().toISOString();return{fileName:y,stepText:[`ISO-10303-21;`,`HEADER;`,`FILE_DESCRIPTION(('${BT(r)}'),'2;1');`,`FILE_NAME('${BT(y)}','${b}',('3DSusp Web'),('BSpoke Automotive'),'3DSusp Web','3DSusp Web','');`,`FILE_SCHEMA((${_.map(e=>`'${BT(e)}'`).join(`,`)}));`,`ENDSEC;`,`DATA;`,...a,...l,`ENDSEC;`,`END-ISO-10303-21;`,``].join(` 4375`),sourceCount:e.length,faceCount:0}}var iE={type:`change`},aE={type:`start`},oE={type:`end`},sE=new wa,cE=new Wa,lE=Math.cos(70*qn.DEG2RAD),uE=new W,dE=2*Math.PI,fE={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},pE=1e-6,mE=class extends Rc{constructor(e,t=null){super(e,t),this.state=fE.NONE,this.target=new W,this.cursor=new W,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,BOTTOM:`ArrowDown`},this.mouseButtons={LEFT:je.ROTATE,MIDDLE:je.DOLLY,RIGHT:je.PAN},this.touches={ONE:Me.ROTATE,TWO:Me.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle=`auto`,this._domElementKeyEvents=null,this._lastPosition=new W,this._lastQuaternion=new Jn,this._lastTargetPosition=new W,this._quat=new Jn().setFromUnitVectors(e.up,new W(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Oc,this._sphericalDelta=new Oc,this._scale=1,this._panOffset=new W,this._rotateStart=new U,this._rotateEnd=new U,this._rotateDelta=new U,this._panStart=new U,this._panEnd=new U,this._panDelta=new U,this._dollyStart=new U,this._dollyEnd=new U,this._dollyDelta=new U,this._dollyDirection=new W,this._mouse=new U,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=gE.bind(this),this._onPointerDown=hE.bind(this),this._onPointerUp=_E.bind(this),this._onContextMenu=wE.bind(this),this._onMouseWheel=bE.bind(this),this._onKeyDown=xE.bind(this),this._onTouchStart=SE.bind(this),this._onTouchMove=CE.bind(this),this._onMouseDown=vE.bind(this),this._onMouseMove=yE.bind(this),this._interceptControlDown=TE.bind(this),this._interceptControlUp=EE.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e===`grab`?this.domElement.style.cursor=`grab`:this.domElement.style.cursor=`auto`}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener(`pointerdown`,this._onPointerDown),this.domElement.addEventListener(`pointercancel`,this._onPointerUp),this.domElement.addEventListener(`contextmenu`,this._onContextMenu),this.domElement.addEventListener(`wheel`,this._onMouseWheel,{passive:!1}
vendor: 16,695 bytes, line 4375
4375),this.domElement.getRootNode().addEventListener(`keydown`,this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction=`none`}disconnect(){this.domElement.removeEventListener(`pointerdown`,this._onPointerDown),this.domElement.ownerDocument.removeEventListener(`pointermove`,this._onPointerMove),this.domElement.ownerDocument.removeEventListener(`pointerup`,this._onPointerUp),this.domElement.removeEventListener(`pointercancel`,this._onPointerUp),this.domElement.removeEventListener(`wheel`,this._onMouseWheel),this.domElement.removeEventListener(`contextmenu`,this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener(`keydown`,this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=``}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener(`keydown`,this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener(`keydown`,this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(iE),this.update(),this.state=fE.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;uE.copy(t).sub(this.target),uE.applyQuaternion(this._quat),this._spherical.setFromVector3(uE),this.autoRotate&&this.state===fE.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=dE:n>Math.PI&&(n-=dE),r<-Math.PI?r+=dE:r>Math.PI&&(r-=dE),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(uE.setFromSpherical(this._spherical),uE.applyQuaternion(this._quatInverse),t.copy(this.target).add(uE),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=uE.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new W(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new W(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=uE.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(sE.origin.copy(this.object.position),sE.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(sE.direction))<lE?this.object.lookAt(this.target):(cE.setFromNormalAndCoplanarPoint(this.object.up,this.target),sE.intersectPlane(cE,this.target))))}else if(this.object.isOrthographicCamera){let e=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),e!==this.object.zoom&&(this.object.updateProjectionMatrix(),i=!0)}return this._scale=1,this._performCursorZoom=!1,i||this._lastPosition.distanceToSquared(this.object.position)>pE||8*(1-this._lastQuaternion.dot(this.object.quaternion))>pE||this._lastTargetPosition.distanceToSquared(this.target)>pE?(this.dispatchEvent(iE),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?dE/60/60*this.autoRotateSpeed:dE/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){uE.setFromMatrixColumn(t,0),uE.multiplyScalar(-e),this._panOffset.add(uE)}_panUp(e,t){this.screenSpacePanning===!0?uE.setFromMatrixColumn(t,1):(uE.setFromMatrixColumn(t,0),uE.crossVectors(this.object.up,uE)),uE.multiplyScalar(e),this._panOffset.add(uE)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;uE.copy(r).sub(this.target);let i=uE.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(dE*this._rotateDelta.x/t.clientHeight),this._rotateUp(dE*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(dE*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-dE*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(dE*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-dE*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(dE*this._rotateDelta.x/t.clientHeight),this._rotateUp(dE*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new U,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function hE(e){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(e.pointerId),this.domElement.ownerDocument.addEventListener(`pointermove`,this._onPointerMove),this.domElement.ownerDocument.addEventListener(`pointerup`,this._onPointerUp)),!this._isTrackingPointer(e)&&(this._addPointer(e),e.pointerType===`touch`?this._onTouchStart(e):this._onMouseDown(e),this._cursorStyle===`grab`&&(this.domElement.style.cursor=`grabbing`)))}function gE(e){this.enabled!==!1&&(e.pointerType===`touch`?this._onTouchMove(e):this._onMouseMove(e))}function _E(e){switch(this._removePointer(e),this._pointers.length){case 0:this.domElement.releasePointerCapture(e.pointerId),this.domElement.ownerDocument.removeEventListener(`pointermove`,this._onPointerMove),this.domElement.ownerDocument.removeEventListener(`pointerup`,this._onPointerUp),this.dispatchEvent(oE),this.state=fE.NONE,this._cursorStyle===`grab`&&(this.domElement.style.cursor=`grab`);break;case 1:let t=this._pointers[0],n=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:n.x,pageY:n.y});break}}function vE(e){let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case je.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(e),this.state=fE.DOLLY;break;case je.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=fE.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=fE.ROTATE}break;case je.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(e),this.state=fE.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(e),this.state=fE.PAN}break;default:this.state=fE.NONE}this.state!==fE.NONE&&this.dispatchEvent(aE)}function yE(e){switch(this.state){case fE.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(e);break;case fE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(e);break;case fE.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(e);break}}function bE(e){this.enabled===!1||this.enableZoom===!1||this.state!==fE.NONE||(e.preventDefault(),this.dispatchEvent(aE),this._handleMouseWheel(this._customWheelEvent(e)),this.dispatchEvent(oE))}function xE(e){this.enabled!==!1&&this._handleKeyDown(e)}function SE(e){switch(this._trackPointer(e),this._pointers.length){case 1:switch(this.touches.ONE){case Me.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(e),this.state=fE.TOUCH_ROTATE;break;case Me.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(e),this.state=fE.TOUCH_PAN;break;default:this.state=fE.NONE}break;case 2:switch(this.touches.TWO){case Me.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(e),this.state=fE.TOUCH_DOLLY_PAN;break;case Me.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(e),this.state=fE.TOUCH_DOLLY_ROTATE;break;default:this.state=fE.NONE}break;default:this.state=fE.NONE}this.state!==fE.NONE&&this.dispatchEvent(aE)}function CE(e){switch(this._trackPointer(e),this.state){case fE.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(e),this.update();break;case fE.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(e),this.update();break;case fE.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(e),this.update();break;case fE.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(e),this.update();break;default:this.state=fE.NONE}}function wE(e){this.enabled!==!1&&e.preventDefault()}function TE(e){e.key===`Control`&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener(`ke
4375yup`,this._interceptControlUp,{passive:!0,capture:!0}))}function EE(e){e.key===`Control`&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener(`keyup`,this._interceptControlUp,{passive:!0,capture:!0}))}var DE=class extends Ls{constructor(e){super(e)}load(e,t,n,r){let i=this,a=this.path===``?sc.extractUrlBase(e):this.path,o=new Bs(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){let n=e.split(` 4376`),r={},i=/\s+/,a={};for(let e=0;e<n.length;e++){let t=n[e];if(t=t.trim(),t.length===0||t.charAt(0)===`#`)continue;let o=t.indexOf(` `),s=o>=0?t.substring(0,o):t;s=s.toLowerCase();let c=o>=0?t.substring(o+1):``;if(c=c.trim(),s===`newmtl`)r={name:c},a[c]=r;else if(s===`ka`||s===`kd`||s===`ks`||s===`ke`){let e=c.split(i,3);r[s]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else r[s]=c}let o=new OE(this.resourcePath||t,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(a),o}},OE=class{constructor(e=``,t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin=`anonymous`,this.side=this.options.side===void 0?0:this.options.side,this.wrap=this.options.wrap===void 0?Ne:this.options.wrap}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;let t={};for(let n in e){let r=e[n],i={};t[n]=i;for(let e in r){let t=!0,n=r[e],a=e.toLowerCase();switch(a){case`kd`:case`ka`:case`ks`:this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&n[0]===0&&n[1]===0&&n[2]===0&&(t=!1);break;default:break}t&&(i[a]=n)}}return t}preload(){for(let e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(let t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return this.materials[e]===void 0&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){let t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function i(e,t){return typeof t!=`string`||t===``?``:/^https?:\/\//i.test(t)?t:e+t}function a(e,n){if(r[e])return;let a=t.getTextureParams(n,r),o=t.loadTexture(i(t.baseUrl,a.url));o.repeat.copy(a.scale),o.offset.copy(a.offset),o.wrapS=t.wrap,o.wrapT=t.wrap,(e===`map`||e===`emissiveMap`)&&(o.colorSpace
4376=en),r[e]=o}for(let e in n){let t=n[e],i;if(t!==``)switch(e.toLowerCase()){case`kd`:r.color=nr.colorSpaceToWorking(new $r().fromArray(t),en);break;case`ks`:r.specular=nr.colorSpaceToWorking(new $r().fromArray(t),en);break;case`ke`:r.emissive=nr.colorSpaceToWorking(new $r().fromArray(t),en);break;case`map_kd`:a(`map`,t);break;case`map_ks`:a(`specularMap`,t);break;case`map_ke`:a(`emissiveMap`,t);break;case`norm`:a(`normalMap`,t);break;case`map_bump`:case`bump`:a(`bumpMap`,t);break;case`disp`:a(`displacementMap`,t);break;case`map_d`:a(`alphaMap`,t),r.transparent=!0;break;case`ns`:r.shininess=parseFloat(t);break;case`d`:i=parseFloat(t),i<1&&(r.opacity=i,r.transparent=!0);break;case`tr`:i=parseFloat(t),this.options&&this.options.invertTrProperty&&(i=1-i),i>0&&(r.opacity=1-i,r.transparent=!0);break;default:break}}return this.materials[e]=new _s(r),this.materials[e]}getTextureParams(e,t){let n={scale:new U(1,1),offset:new U(0,0)},r=e.split(/\s+/),i;return i=r.indexOf(`-bm`),i>=0&&(t.bumpScale=parseFloat(r[i+1]),r.splice(i,2)),i=r.indexOf(`-mm`),i>=0&&(t.displacementBias=parseFloat(r[i+1]),t.displacementScale=parseFloat(r[i+2]),r.splice(i,3)),i=r.indexOf(`-s`),i>=0&&(n.scale.set(parseFloat(r[i+1]),parseFloat(r[i+2])),r.splice(i,4)),i=r.indexOf(`-o`),i>=0&&(n.offset.set(parseFloat(r[i+1]),parseFloat(r[i+2])),r.splice(i,4)),n.url=r.join(` `).trim(),n}loadTexture(e,t,n,r,i){let a=this.manager===void 0?Is:this.manager,o=a.getHandler(e);o===null&&(o=new Us(a)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);let s=o.load(e,n,r,i);return t!==void 0&&(s.mapping=t),s}},kE=/^[og]\s*(.+)?/,AE=/^mtllib /,jE=/^usemtl /,ME=/^usemap /,NE=/\s+/,PE=new W,FE=new W,IE=new W,LE=new W,RE=new W,zE=new $r;function BE(){let e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let n=this.object&&typeof this.object.currentMaterial==`function`?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0),this.object={name:e||``,fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){let n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);let r={index:this.materials.length,name:e||``,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:``,smooth:n===void 0?this.smooth:n.smooth,groupStart:n===void 0?0:n.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),t}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;PE.fromArray(r,e),FE.fromArray(r,t),IE.fromArray(r,n),RE.subVectors(IE,FE),LE.subVectors(PE,FE),RE.cross(LE),RE.normalize(),i.push(RE.x,RE.y,RE.z),i.push(RE.x,RE.y,RE.z),i.push(RE.x,RE.y,RE.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;r[e]!==void 0&&i.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&i.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,o,s,c){let l=this.vertices.length,u=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),f=this.parseVertexIndex(n,l);
4376if(this.addVertex(u,d,f),this.addColor(u,d,f),o!==void 0&&o!==``){let e=this.normals.length;u=this.parseNormalIndex(o,e),d=this.parseNormalIndex(s,e),f=this.parseNormalIndex(c,e),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==``){let e=this.uvs.length;u=this.parseUVIndex(r,e),d=this.parseUVIndex(i,e),f=this.parseUVIndex(a,e),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type=`Points`;let t=this.vertices.length;for(let n=0,r=e.length;n<r;n++){let r=this.parseVertexIndex(e[n],t);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(e,t){this.object.geometry.type=`Line`;let n=this.vertices.length,r=this.uvs.length;for(let t=0,r=e.length;t<r;t++)this.addVertexLine(this.parseVertexIndex(e[t],n));for(let e=0,n=t.length;e<n;e++)this.addUVLine(this.parseUVIndex(t[e],r))}};return e.startObject(``,!1),e}var VE=class extends Ls{constructor(e){super(e),this.materials=null}load(e,t,n,r){let i=this,a=new Bs(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}setMaterials(e){return this.materials=e,this}parse(e){let t=new BE;e.indexOf(`\r 4377`)!==-1&&(e=e.replace(/\r\n/g,` 4378`)),e.indexOf(`\\ 4379`)!==-1&&(e=e.replace(/\\\n/g,``));let n=e.split(` 4380`),r=[];for(let e=0,i=n.length;e<i;e++){let i=n[e].trimStart();if(i.length===0)continue;let a=i.charAt(0);if(a!==`#`)if(a===`v`){let e=i.split(NE);switch(e[0]){case`v`:t.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?(zE.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),en),t.colors.push(zE.r,zE.g,zE.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(NE),n=[];for(let t=0,r=e.length;t<r;t++){let r=e[t];if(r.length>0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e<i;e++){let i=n[e],a=n[e+1];t.addFace(r[0],i[0],a[0],r[1],i[1],a[1],r[2],i[2],a[2])}}else if(a===`l`){let e=i.substring(1).trim().split(` `),n=[],r=[];if(i.indexOf(`/`)===-1)n=e;else for(let t=0,i=e.length;t<i;t++){let i=e[t].split(`/`);i[0]!==``&&n.push(i[0]),i[1]!==``&&r.push(i[1])}t.addLineGeometry(n,r)}else if(a===`p`){let e=i.slice(1).trim().split(` `);t.addPointGeometry(e)}else if((r=kE.exec(i))!==null){let e=(` `+r[0].slice(1).trim()).slice(1);t.startObject(e)}else if(jE.test(i))t.object.startMaterial(i.substring(7).trim(),t.materialLibraries);else if(AE.test(i))t.materialLibraries.push(i.substring(7).trim());else if(ME.test(i))console.warn(`THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.`);else if(a===`s`){if(r=i.split(` `),r.length>1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}t.finalize();let i=new Kr;if(i.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0))for(let e=0,n=t.objects.length;e<n;e++){let n=t.objects[e],r=n.geometry,a=n.materials,o=r.type===`Line`,s=r.type===`Points`,c=!1;if(r.vertices.length===0)continue;let l=new Yi;l.setAttribute(`position`,new Li(r.vertices,3)),r.normals.length>0&&l.setAttribute(`normal`,new Li(r.normals,3)),r.colors.length>0&&(c=!0,l.setAttribute(`color`,new Li(r.colors,3))),r.hasUVIndices===!0&&l.setAttribute(`uv`,new Li(r.uvs,2));let u=[];for(let e=0,n=a.length;e<n;e++){let n=a[e],r=n.name+`_`+n.smooth+`_`+c,i=t.materials[r];if(this.materials!==null){if(i=this.materials.create(n.name),o&&i&&!(i instanceof Ya)){let e=new Ya;ea.prototype.copy.call(e,i),e.color.copy(i.color),i=e}else if(s&&i&&!(i instanceof co)){let e=new co({size:10,sizeAttenuation:!1});ea.prototype.copy.call(e,i),e.color.copy(i.color),e.map=i.map,i=e}}i===void 0&&(i=o?new Ya:s?new co({size:1,sizeAttenuation:!1}):new _s,i.name=n.name,i.flatShading=!n.smooth,i.vertexColors=c,t.materials[r]=i),u.push(i)}let d;if(u.length>1){for(let e=0,t=a.length;e<t;e++){let t=a[e];l.addGroup(t.groupStart,t.groupCount,e)}
4380d=o?new so(l,u):s?new mo(l,u):new La(l,u)}else d=o?new so(l,u[0]):s?new mo(l,u[0]):new La(l,u[0]);d.name=n.name,i.add(d)}else if(t.vertices.length>0){let e=new co({size:1,sizeAttenuation:!1}),n=new Yi;n.setAttribute(`position`,new Li(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(n.setAttribute(`color`,new Li(t.colors,3)),e.vertexColors=!0);let r=new mo(n,e);i.add(r)}return i}},HE=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Z=e(((e,t)=>{t.exports=HE()}))(),UE=new Set([`tlf-c`,`tlr-c`,`tlf-w`,`tlr-w`]),WE=.5,GE=30,KE=1800,qE=.18,JE=1800,YE=Math.PI/180,XE=.003,ZE=GE*XE,QE=8,$E=6,eD=Math.PI/180,tD=16771661,nD=`#ef4444`,rD=new Set([`hs-right`,`rs-right`]),iD=`#9ca3af`,aD=`#f8d857`,oD=38,sD=.1,cD=20,lD=new Set([`upperArm`,`lowerArm`,`tieRod`,`pushRod`,`antirollLink`,`semiAxis`]),uD=new Jn().setFromEuler(new Or(-Math.PI/2,0,0)),dD=uD.clone().invert(),fD=new W(0,1,0),pD=`./models/steering-wheel/SparcoWheelEdit.mtl`,mD=`./models/steering-wheel/SparcoWheelEdit.obj`,hD=new $r(`#3f454d`),gD=new W(.0101666667,-8.22316675,13.234);function _D(e){return 2*Math.max(e,.01)*Math.tan(oD*YE/2)}function vD(e,t,n,r){let i=t/Math.max(n,1);if(e instanceof rc){e.aspect=i,e.updateProjectionMatrix();return}let a=_D(r?e.position.distanceTo(r):3)*.5;e.left=-a*i,e.right=a*i,e.top=a,e.bottom=-a,e.updateProjectionMatrix()}var yD=2800,bD=22e4,xD=.05,SD=5,CD=24e3,wD=65e4,TD=.0125,ED=.2,DD=.86,OD=.0105,kD=.18,AD=1,jD=.325,MD=.0275,ND=jD/XE*2,PD=`#f59e0b`,FD=`#3b82f6`,ID=`#22c55e`,LD=`700 58px Arial`,RD=.12,zD=.26,BD=`#c7ced8`,VD=`#22c55e`,HD=.45,UD=1.12,WD=1.55,GD=.25;function KD(e){return e===`light`?{background:16054267,gridMajor:9347765,gridMinor:13096159,hemisphereGround:12832988}:{background:1120288,gridMajor:3884626,gridMinor:2108214,hemisphereGround:1581098}}function qD(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e/100)):.25}function JD(e,t){return e===t||!e&&!t}function YD(e,t){let n=e.x-t.x,r=e.y-t.y,i=e.z-t.z;return n*n+r*r+i*i}function XD(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function ZD(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}function QD(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function $D(e,t,n=qE){return YD(e,t)<=n*n}function eO(e,t){return $D(e.from,t.from)&&$D(e.to,t.to)}function tO(e){return Array.from(new Set(e))}function nO(e,t){let n=WE*WE,r=[];return e.forEach(e=>{t.forEach(t=>{YD(e,t.point)<=n&&r.push(t.id)})}),tO(r)}function rO(e,t){let n=new Map;return e.forEach(e=>{nO([e.from,e.to],t).forEach(t=>{n.has(t)||n.set(t,e.color)})}),n}function iO(e,t,n){for(let n of e){let e=t.get(n);if(e)return e}return n}function aO(e,t){return e!==`upperArm`&&e!==`lowerArm`?[]:tO(t.flatMap(e=>{let t=e.label.trim().toLowerCase();return t?[`${t}-c`,`${t}-w`]:[]}))}function oO(e,t){if(t.kind!==`upperArm`&&t.kind!==`lowerArm`)return!1;let n=e.suspension.suspensionType;return n===`Double Wishbone`||t.kind===`upperArm`&&n===`Top WB - Bottom ML`?!0:t.kind===`lowerArm`&&n===`Top ML - Bottom WB`}function sO(e,t){let n=e.label.trim().toLowerCase();return n?[`${n}-c`,`${n}-w`].filter(e=>t.has(e)):[]}function cO(e){return(e.fields[`CBar Mounting`]??``).trim().toLowerCase().includes(`rocker`)}function lO(e){return e.geometry.left.wheelCenter.y>=e.geometry.right.wheelCenter.y?`left`:`right`}function uO(e,t,n){let r=[`p1`,`p2`,`pr-c`,`s-w`];return e.elements.heaveSpring&&r.push(n===void 0||n===lO(e)?`hs-left`:`hs-right`),e.elements.rollSpring&&r.push(n===void 0||n===lO(e)?`rs-left`:`rs-right`),e.elements.antirollCBar&&cO(e)&&r.push(`c-link`),e.elements.antirollTBar&&r.push(`t-link`),tO(r.filter(e=>t.has(e)))}function dO(e,t,n,r){if(t.kind===`upperArm`||t.kind===`lowerArm`)return oO(e,t)?aO(t.kind,n.filter(e=>e.kind===t.kind&&JD(e.side,t.side))).filter(e=>r.has(e)):sO(t,r);if(t.kind===`tieRod`)return[`tr-c`,`tr-w`].filter(e=>r.has(e));if(t.kind===`pushRod`)return[`pr-c`,`pr-w`].filter(e=>r.has(e));if(t.kind===`rockerAxis`)return uO(e,r,t.side);if(t.kind===`mainSpring`)return t.label===`Third element`?[`third-arb`,`third-chassis`].filter(e=>r.has(e)):t.label===`Outboard spring`?[`pr-c`,`pr-w`].filter(e=>r.has(e)):[`s-c`,`s-w`].filter(e=>r.has(e));if(t.kind===`antirollBar`){if(t.label===`T-bar cross`)return[`t-arb`].filter(e=>r.has(e));if(t.label===`T-bar pivot`)return[`t-arb`,`t-pivot`,`third-arb`].filter(e=>r.has(e))}return[]}function fO(e,t,n){return oO(e,t)?n.filter(e=>e.kind===t.kind&&JD(e.side,t.side)).flatMap(e=>[e.from,e.to]):[t.from,t.to]}function pO(e,t){return t.filter(t=>t.kind===e.kind&&t.side===e.side).flatMap(e=>e.points)}function mO(e,t,n){return t.kind===`rocker`?uO(e,n,t.side):t.kind===`upright`?om(e).filter(e=>n.has(e)):[]}function hO(e,t,n,r,i){return tO([...dO(e,t,n,i),...nO(fO(e,t,n),r)])}function gO(e,t,n,r,i){return tO([...mO(e,t,i),...nO(pO(t,n),r)])}function _O(e){return new W(e.x*XE,e.z*XE,-e.y*XE)}function vO(e,t){let n=new Kr,r=t.kind===`sphere`,i=new Ta({color:16727887,transparent:!0,opacity:r?.055:.11,depthWrite:!1,side:2}),a=new Ya({color:16733025,transparent:!0,opacity:r?.34:.72}),o;if(t.kind===`box`){let e={x:Math.min(t.min.x,t.max.x),y:Math.min(t.min.y,t.max.y),z:Math.min(t.min.z,t.max.z)},r={x:Math.max(t.min.x,t.max.x),y:Math.max(t.min.y,t.max.y),z:Math.max(t.min.z,t.max.z)};o=new xo(Math.max((r.x-e.x)*XE,1e-5),Math.max((r.z-e.z)*XE,1e-5),Math.max((r.y-e.y)*XE,1e-5)),n.position.copy(_O({x:(e.x+r.x)/2,y:(e.y+r.y)/2,z:(e.z+r.z)/2}))}else o=new ts(Math.max(t.radius*XE,1e-5),12,8),n.position.copy(_O(t.center));let s=new La(o,i);s.renderOrder=2,n.add(s);let c=new so(t.kind===`box`?new Oo(o):new is(o),a);c.renderOrder=3,n.add(c),n.userData.boundaryId=t.id,e.add(n)}function yO(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function bO(e){return e.kind===`heaveSpring`||e.kind===`rollSpring`||e.kind===`antirollBar`||e.kind===`antirollLink`||e.label.startsWith(`C-bar `)||e.label.startsWith(`T-bar `)||e.label.startsWith(`Third element`)}function xO(e){return e.label.startsWith(`Heave rocker`)||e.label.startsWith(`Roll rocker`)}
4380function SO(e,t={}){let n=t.includeCenterOfGravity??!0,r=t.optimizerKinematicsOnly??!1;return[...e.segments.filter(e=>e.kind!==`reference`&&e.kind!==`steeringAxis`&&e.kind!==`rollCenter`).filter(e=>!r||!bO(e)).flatMap(e=>[e.from,e.to]),...e.faces.filter(e=>!r||!xO(e)).flatMap(e=>e.points),...e.wheels.flatMap(e=>[e.center,{x:e.center.x+e.radius,y:e.center.y+e.width*.5,z:e.center.z+e.radius},{x:e.center.x-e.radius,y:e.center.y-e.width*.5,z:e.center.z-e.radius}]),...n&&e.centerOfGravity?[e.centerOfGravity]:[]].filter(yO)}function CO(e){return new W(e.x,e.z,-e.y).normalize()}function wO(e){e.updateMatrixWorld(!0);let t=new gi().setFromObject(e),n=t.getSize(new W),r=Math.max(n.x,n.y);!Number.isFinite(r)||r<=1e-6||(e.userData.steeringWheelBoundsCenter=t.getCenter(new W).toArray(),e.userData.steeringWheelPivot=gD.toArray(),e.userData.steeringWheelSourceDiameter=r,e.traverse(e=>{e instanceof La&&(e.castShadow=!0,e.receiveShadow=!0,(Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{`color`in e&&e.color instanceof $r&&(e.color.copy(hD),e.needsUpdate=!0)}))}))}function TO(e,t,n,r){let i=t.userData.steeringWheelPivot??t.userData.steeringWheelBoundsCenter,a=t.userData.steeringWheelSourceDiameter;if(!Array.isArray(i)||i.length!==3||typeof a!=`number`||a<=1e-6)return!1;let o=n.motion?.steeringWheelFrame,s,c,l,u;if(o){if(c=CO(o.axisY),l=CO(o.axisZ),s=new W().crossVectors(c,l),c.lengthSq()<=1e-12||l.lengthSq()<=1e-12||s.lengthSq()<=1e-12)return!1;c.normalize(),l.normalize(),s.normalize(),u=new Jn().setFromRotationMatrix(new vr().makeBasis(c,l,s))}else{if(s=new W().subVectors(_O(r.to),_O(r.from)),s.lengthSq()<=1e-12)return!1;s.normalize();let e=Math.abs(s.y)<.96?fD:new W(0,0,-1);c=new W().crossVectors(e,s).normalize(),l=new W().crossVectors(s,c).normalize(),u=new Jn().setFromRotationMatrix(new vr().makeBasis(c,l,s)),u.multiply(new Jn().setFromAxisAngle(new W(0,0,1),-(n.motion?.steerInputDeg??0)*YE))}let d=Math.max(Math.abs(n.graphics.steeringWheelDiameter),1)*XE,f=t.clone(!0);f.position.set(-i[0],-i[1],-i[2]),f.traverse(e=>{e instanceof La&&UO(e)});let p=new Kr;return p.position.copy(_O(r.to)),p.quaternion.copy(u),p.scale.setScalar(d/a),p.add(f),e.add(p),!0}function EO(e,t,n,r){let i=new ro(new Yi().setFromPoints([t,n]),new bs({color:r,dashSize:.085,gapSize:.05,transparent:!0,opacity:.95}));i.computeLineDistances(),e.add(i)}function DO(e,t,n=.19){let r=document.createElement(`canvas`);r.width=160,r.height=160;let i=r.getContext(`2d`);if(!i)throw Error(`Unable to create axis label canvas`);i.clearRect(0,0,r.width,r.height),i.font=LD,i.textAlign=`center`,i.textBaseline=`middle`,i.fillStyle=t,i.fillText(e,r.width/2,r.height/2);let a=new _o(r);a.needsUpdate=!0;let o=new ha(new ta({map:a,transparent:!0,depthWrite:!1}));return o.scale.set(n,n,1),o}function OO(e,t,n,r,i){let a=DO(t,n,i);a.position.copy(r),e.add(a)}function kO(e,t,n,r,i,a){e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}function AO(e,t){let n=document.createElement(`canvas`).getContext(`2d`);if(!n)return null;let r=`700 42px Arial`;n.font=r;let i=Math.min(520,Math.max(170,Math.ceil(n.measureText(e).width+52))),a=document.createElement(`canvas`);a.width=i,a.height=94;let o=a.getContext(`2d`);if(!o)return null;o.clearRect(0,0,i,94),kO(o,5,12,i-10,70,18),o.fillStyle=`rgba(7, 16, 24, 0.72)`,o.fill(),o.strokeStyle=`rgba(148, 163, 184, 0.38)`,o.lineWidth=2,o.stroke(),o.font=r,o.textAlign=`center`,o.textBaseline=`middle`,o.fillStyle=t,o.fillText(e,i/2,48);let s=new _o(a);s.needsUpdate=!0;let c=new ha(new ta({map:s,transparent:!0,depthTest:!1,depthWrite:!1})),l=.00108;return c.scale.set(i*l,94*l,1),c.renderOrder=96,c}function jO(e){let t=new W(0,0,0);[{to:new W(jD,0,0),color:PD,label:`X`,labelOffset:new W(MD,MD,0)},{to:new W(0,0,-jD),color:FD,label:`Y`,labelOffset:new W(MD,MD,-MD)},{to:new W(0,jD,0),color:ID,label:`Z`,labelOffset:new W(MD,MD,0)}].forEach(n=>{e.add(new ro(new Yi().setFromPoints([t,n.to]),new Ya({color:IO(n.color),transparent:!0,opacity:.95}))),OO(e,n.label,n.color,n.to.clone().add(n.labelOffset))})}function MO(e,t){let n=_O(t.origin);[{axis:t.xAxis,color:PD,label:`xR`,length:jD},{axis:t.yAxis,color:FD,label:`yR`,length:Math.max((t.yAxisReferenceDistanceMm??0)*XE,jD)},{axis:t.zAxis,color:ID,label:`zR`,length:jD}
4380].forEach(t=>{let r=CO(t.axis).multiplyScalar(t.length),i=n.clone().add(r);EO(e,n,i,IO(t.color)),OO(e,t.label,t.color,i.clone().add(r.clone().normalize().multiplyScalar(MD)))})}function NO(e,t,n){let r=new ts(.025,18,18),i=new Ta({color:16777215,transparent:!0,opacity:AD,depthTest:!1,depthWrite:!1}),a=new La(r,i);a.position.copy(_O(t)),a.renderOrder=111,e.add(a),n.push(i)}function PO(e,t,n){NO(e,t.origin,n)}function FO(e,t,n){t.referencePoint&&NO(e,t.referencePoint,n)}function IO(e){return Number.parseInt(e.slice(1),16)}function LO(e,t,n){let r=e.get(t);if(r)return r;let i=n();return e.set(t,i),i}function RO(e,t,n){let r=e.get(t);if(r)return r;let i=n();return e.set(t,i),i}function zO(e){return Number.isFinite(e)?e.toFixed(5):`0`}function BO(e){return Number.isFinite(e)?e.toFixed(3):`1`}function VO(e,t){let n=new Yi,r=[];return e.faces.forEach(([n,i,a])=>{(t?[n,a,i]:[n,i,a]).forEach(n=>{let i=e.vertices[n-1];if(!i)return;let a=_O(t?{x:i.x,y:-i.y,z:i.z}:i);r.push(a.x,a.y,a.z)})}),r.length<9?(n.dispose(),null):(n.setAttribute(`position`,new Li(r,3)),n.computeVertexNormals(),{surfaceGeometry:n,edgeGeometry:new Oo(n,28)})}function HO(e,t,n){let r=e.get(t);r||(r={},e.set(t,r));let i=n?`mirroredY`:`base`,a=r[i];if(a)return a;let o=VO(t,n);return o?(r[i]=o,o):null}function UO(e){e.userData.sharedGeometry=!0,e.userData.sharedMaterial=!0}function WO(e){e.userData.sharedMaterial=!0}function GO(e){let t=new Jn().setFromAxisAngle(new W(1,0,0),e.x*YE),n=new Jn().setFromAxisAngle(new W(0,1,0),e.y*YE),r=new Jn().setFromAxisAngle(new W(0,0,1),e.z*YE).multiply(n).multiply(t);return uD.clone().multiply(r).multiply(dD)}function KO(e,t){let n=Number.isFinite(t.transform.scale)?Math.max(.001,t.transform.scale):1,r=Number.isFinite(t.transform.scaleY)?Math.max(.001,t.transform.scaleY):n,i=Number.isFinite(t.transform.scaleZ)?Math.max(.001,t.transform.scaleZ):n;e.position.copy(_O(t.transform.translate)),e.quaternion.copy(GO(t.transform.rotateDeg)),e.scale.set(n,i,r)}function qO(e){return Number.isFinite(e)?Math.max(Math.abs(e),.5):1}function JO(e){return Math.max((Number.isFinite(e)?Math.abs(e):0)*.003/2,.01)}function YO(e){let t=Number.isFinite(e.vehicle.wheelbase)?Math.abs(e.vehicle.wheelbase):0;return t<=1e-6?0:e.suspension.axlePosition.trim().toLowerCase()===`rear`?t:-t}function XO(e,t){if(t.length===0)return[];let n=YO(e);return Math.abs(n)<=1e-6?[]:t.map(e=>{let t={...e.center,x:e.center.x+n};return{...e,center:t,pose:[0,0,0,t.x,t.y,t.z]}})}function ZO(e,t,n){if(!e.graphics.drawOppositeAxle)return t;let r=XO(e,n);return r.length===0?t:[...t,...r]}function QO(e,t,n=!1){let r=4.8;if(!e.graphics.drawOppositeAxle&&!n||t.length===0)return{size:r,divisions:16,centerX:0};let i=YO(e);if(Math.abs(i)<=1e-6)return{size:r,divisions:16,centerX:0};let a=t.map(e=>e.center.x),o=a.map(e=>e+i),s=Math.min(...a,...o),c=Math.max(...a,...o);r/.003;let l=Math.max(140,Math.abs(i)*.08),u=Math.max(1600,c-s+l*2)*.003;return{size:u,divisions:Math.max(16,Math.round(u/.3)),centerX:(s+c)*.5*.003}}function $O(e){let t=mm(e,`right`),n=mm(e,`left`),r=yO(t),i=yO(n);if(r&&i){let e=(t.y+n.y)*.5,r=(t.z+n.z)*.5,i=n.y-t.y,a=Math.abs(i)>1e-9?(n.z-t.z)/i:0;return{sceneY:r*XE,sceneZ:-e*XE,rotationX:Math.atan(a)}}let a=r?t:i?n:{x:0,y:0,z:0};return{sceneY:a.z*XE,sceneZ:-a.y*XE,rotationX:0}}function ek(e,t,n){e.position.set(t.centerX,n.sceneY,n.sceneZ),e.rotation.set(n.rotationX,0,0)}function tk(e){return e.motion?{...e,motion:void 0}:e}function nk(e){if(!e)return new vr;let t=_O(e.origin),n=_O(e.target);return new vr().makeTranslation(n.x,n.y,n.z).multiply(new vr().makeRotationX(e.angleRad)).multiply(new vr().makeTranslation(-t.x,-t.y,-t.z))}function rk(e,t){e&&(e.matrixAutoUpdate=!1,e.matrix.copy(t),e.matrixWorldNeedsUpdate=!0)}function ik(e,t){return{...tk(e),graphics:{...e.graphics,drawWheels:!1,drawWheelCircle:!1,drawOffsetRim:!1,drawArrow:!1,drawSteering:t.graphics.drawSteering,drawMainSpring:!0,drawSteeringAxis:!1,drawGroundLine:!1,steeringAxisEnvelope:!1,virtualPointsLines:!1,drawRollCenter:!1,drawUpright:!0,drawRocker:!0}}}function ak(e,t){let n=e=>`${e.x.toFixed(5)}|${e.y.toFixed(5)}|${e.z.toFixed(5)}`,r=n(e),i=n(t);return r<i?`${r}->${i}`:`${i}->${r}`}function ok(e){return`${e.x.toFixed(5)}|${e.y.toFixed(5)}|${e.z.toFixed(5)}`}function sk(e,t){return e.suspension.macPherson&&(t===`TLF`||t===`TLR`)?!1:t===`S`?!(e.suspension.macPherson||e.suspension.configuration===`Outboard Spring`):!0}function ck(e,t,n,r=BD,i,a,o,s=!1,c=null){let l=t.segments.filter(e=>!c||c.has(e.kind));l.forEach(t=>{t.kind===`steeringAxis`||t.kind===`rollCenter`||s&&bO(t)||Xk(a,o,t)||xk(e,t.from,t.to,r,n,!1,.86)});let u=new Set,d=c?[]:t.faces;d.forEach(t=>{s&&xO(t)||[[t.points[0],t.points[1]],[t.points[1],t.points[2]],[t.points[2],t.points[0]]].forEac
4380h(([t,i])=>{let a=ak(t,i);u.has(a)||(u.add(a),xk(e,t,i,r,n,!1,.86))})});let f=new Set;[...c?[]:t.points.filter(e=>sk(i,e.label)).map(e=>e.point),...l.filter(e=>e.kind!==`steeringAxis`&&e.kind!==`rollCenter`).filter(e=>!s||!bO(e)).filter(e=>!e.label.startsWith(`Steering wheel `)).flatMap(e=>[e.from,e.to]),...d.filter(e=>!s||!xO(e)).flatMap(e=>e.points)].forEach(t=>{let n=ok(t);f.has(n)||(f.add(n),Qk(e,t,r,.012))})}function lk(e){return e.flatMap(e=>[e.center,{x:e.center.x+e.radius,y:e.center.y+e.width*.5,z:e.center.z+e.radius},{x:e.center.x-e.radius,y:e.center.y-e.width*.5,z:e.center.z-e.radius}])}function uk(e){if(e.length===0)return null;let t=e.map(e=>e.x),n=Math.min(...t),r=Math.max(...t),i=Math.max(r-n,220),a=ND,o=Math.max(i*.2,140),s=a+o,c=Math.min(58,Math.max(34,o*.28)),l=Math.min(34,Math.max(16,c*.48));return{start:{x:a,y:0,z:0},tip:{x:s,y:0,z:0},headA:{x:s-c,y:0+l,z:0},headB:{x:s-c,y:0-l,z:0}}}function dk([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function fk(e){let t=dk(e),n=CO({x:t[0][0],y:t[1][0],z:t[2][0]}),r=CO({x:t[0][1],y:t[1][1],z:t[2][1]}),i=CO({x:t[0][2],y:t[1][2],z:t[2][2]}),a=new vr().makeBasis(n,r,i);return new Jn().setFromRotationMatrix(a)}function pk(e){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function mk(e){let t=dk(pk(e.pose)),n={x:t[0][1],y:t[1][1],z:0},r=Math.hypot(n.x,n.y);if(r>1e-9)return{x:n.x/r,y:n.y/r,z:0};let i=e.pose[1];return{x:-Math.sin(i),y:Math.cos(i),z:0}}function hk(e,t,n,r,i,a,o){let s=t.z,c={x:t.x,y:t.y,z:s},l={x:n.x,y:n.y,z:s},u=mk(r),d={x:u.y,y:-u.x,z:0},f={x:l.x-c.x,y:l.y-c.y,z:0},p=QD(f,u),m=QD(f,d),h=[c,XD(c,ZD(u,p)),l,XD(c,ZD(d,m))];xk(e,h[0],h[1],i,a,!0,1,o),xk(e,h[1],h[2],i,a,!0,1,o),xk(e,h[2],h[3],i,a,!0,1,o),xk(e,h[3],h[0],i,a,!0,1,o)}function gk(e,t,n,r,i=!1,a){let o=new ro(new Yi().setFromPoints([_O(t),_O(n)]),a?LO(a.materials,i?`dynamic-line-dashed:${r}`:`dynamic-line:${r}`,()=>i?new bs({color:IO(r),dashSize:.03,gapSize:.024,linewidth:1}):new Ya({color:IO(r),linewidth:2})):i?new bs({color:IO(r),dashSize:.03,gapSize:.024,linewidth:1}):new Ya({color:IO(r),linewidth:2}));a&&WO(o),i&&o.computeLineDistances(),e.add(o)}function _k(e){return Number.isFinite(e)?Math.max(Math.abs(e),HD):1}function vk(e){return Math.max(_k(e)*.0015,7e-4)}function yk(e){return _k(e)}function bk(e,t,n,r,i,a=1,o=!0,s=0,c){let l=new W().subVectors(n,t),u=l.length();if(u<1e-6)return null;let d=new La(c?RO(c.geometries,`dynamic-cylinder-unit:10`,()=>new So(1,1,1,10,1)):new So(i,i,u,10,1),c?LO(c.materials,`dynamic-cylinder:${r}:${BO(a)}:${+!!o}`,()=>new Ta({color:IO(r),transparent:a<1,opacity:a,depthTest:o,depthWrite:o&&a>=1})):new Ta({color:IO(r),transparent:a<1,opacity:a,depthTest:o,depthWrite:o&&a>=1}));return c&&(d.scale.set(i,u,i),UO(d)),d.position.copy(t).add(n).multiplyScalar(.5),d.quaternion.setFromUnitVectors(fD,l.normalize()),d.renderOrder=s,e.add(d),d}function xk(e,t,n,r,i,a=!1,o=1,s){let c=_O(t),l=_O(n),u=new W().subVectors(l,c),d=u.length();if(d<1e-6)return;let f=u.clone().normalize(),p=vk(i);if(!a){bk(e,c,l,r,p,o,!0,0,s);return}let m=.03;m+.024;for(let t=0;t<d;t+=.054){let n=Math.min(m,d-t);if(n<=1e-6)continue;let i=c.clone().addScaledVector(f,t);bk(e,i,i.clone().addScaledVector(f,n),r,p,o,!0,0,s)}}function Sk(e,t){let n=dk(pk(e.pose));return CO({x:n[0][t],y:n[1][t],z:n[2][t]})}function Ck(e){let t=e.radius*XE*.32;return Math.min(Math.max(t,RD),zD)}function wk(e,t,n,r){let i=Math.max(vk(n)*1.05,.0035);t.forEach(t=>{let n=_O(t.center),a=Ck(t),o=[{index:0,color:PD,label:`x`},{index:1,color:FD,label:`y`},{index:2,color:ID,label:`z`}],s=Math.max(i*1.75,.008),c=new La(r?RO(r.geometries,`dynamic-sphere-basic:${zO(s)}:16`,()=>new ts(s,16,16)):new ts(s,16,16),r?LO(r.materials,`dynamic-upright-axis-origin`,()=>new Ta({color:IO(aD),transparent:!0,opacity:.95,depthTest:!1,depthWrite:!1})):new Ta({color:IO(aD),transparent:!0,opacity:.95,depthTest:!1,depthWrite:!1}));r&&UO(c),c.position.copy(n),c.renderOrder=106,e.add(c),o.forEach(o=>{let s=Sk(t,o.index),c=n.clone().add(s.clone().multiplyScalar(a));bk(e,n,c,o.color,i,.96,!1,105,r),OO(e,o.label,o.color,c.clone().add(s.clone().multiplyScalar(.025)),.075)})})}function Tk(e){return!Number.isFinite(e)||e<=1e-9?0:e*.1}function Ek(e){let t=Math.hypot(e.vector.x,e.vector.y,e.vector.z);
4380return t<=1e-9?e.from:XD(e.from,ZD(e.vector,(e.visualLengthMm??Tk(e.magnitude))/t))}function Dk(e){return!Number.isFinite(e)||Math.abs(e)<=1e-9?`0`:String(Math.round(e))}function Ok(e){return`${Dk(e.magnitude)} ${e.unit??`N`}`}function kk(e){return e.kind===`input`||e.kind===`reaction`||e.kind===`axial`}function Ak(e){return e.kind===`input`?.88:e.kind===`axial`?.56:e.kind===`reaction`?.7:.82}function jk(e,t){let n=e.kind===`input`?2.7:e.kind===`axial`?1.35:1.85,r=e.kind===`input`?.0048:.0024;return Math.max(vk(t)*n,r)}function Mk(e,t,n,r,i,a,o=1,s){let c=Math.min(Math.max(a*.15*o,.03*o),.095*o),l=c*.3,u=new La(s?RO(s.geometries,`dynamic-cone-unit:20`,()=>new Co(1,1,20,1)):new Co(l,c,20,1),s?LO(s.materials,`dynamic-load-cone:${r}:${BO(i)}`,()=>new Ta({color:IO(r),transparent:!0,opacity:i,depthTest:!1,depthWrite:!1})):new Ta({color:IO(r),transparent:!0,opacity:i,depthTest:!1,depthWrite:!1}));s&&(u.scale.set(l,c,l),UO(u));let d=n.clone().normalize();u.position.copy(t).addScaledVector(d,-c*.5),u.quaternion.setFromUnitVectors(fD,d),u.renderOrder=92,e.add(u)}function Nk(e,t,n,r){let i=Pk(t);if(i.length<2)return;let a=Ak(t),o=jk(t,n);for(let n=1;n<i.length;n+=1)bk(e,i[n-1],i[n],t.color,o,a,!1,91,r);let s=i[i.length-1],c=i[i.length-2],l=new W().subVectors(s,c);l.lengthSq()>1e-9&&Mk(e,s,l,t.color,a,s.distanceTo(c)*i.length,1.08,r)}function Pk(e){let t=Rk(e.vector);if(!t)return[];let n=Math.max((e.visualLengthMm??80)*XE,.08),r=_O(e.from),i=Math.abs(t.dot(fD))<.86?fD:new W(1,0,0),a=new W().crossVectors(i,t).normalize(),o=new W().crossVectors(t,a).normalize(),s=-Math.PI*.7,c=Math.PI*.85;return Array.from({length:33},(e,t)=>{let i=t/32,l=s+(c-s)*i;return r.clone().addScaledVector(a,Math.cos(l)*n).addScaledVector(o,Math.sin(l)*n)})}function Fk(e){if(e.visualStyle===`moment`){let t=Pk(e),n=t[t.length-1],r=t[t.length-2];if(n&&r)return n.clone().add(new W().subVectors(n,r).normalize().multiplyScalar(.045))}let t=_O(Ek(e)),n=_O(e.from),r=new W().subVectors(t,n);return r.lengthSq()>1e-9?t.clone().add(r.normalize().multiplyScalar(.05)):t}function Ik(e,t){if(!kk(t))return;let n=AO(Ok(t),t.color);n&&(n.position.copy(Fk(t)),e.add(n))}function Lk(e,t,n,r){if(t.magnitude<=1e-9)return;
4380if(t.visualStyle===`moment`){Nk(e,t,n,r);return}let i=t.from,a=Ek(t),o=_O(i),s=_O(a),c=new W().subVectors(s,o),l=c.length();if(l<=1e-6)return;let u=Ak(t),d=jk(t,n);bk(e,o,s,t.color,d,u,!1,91,r),Mk(e,s,c,t.color,u,l,t.kind===`input`?1.18:1,r)}function Rk(e){let t=new W(e.x,e.z,-e.y);return t.lengthSq()<=1e-12?null:t.normalize()}function zk(e,t){let n=_O(t.from),r=_O(t.to),i=new W().subVectors(r,n),a=i.length();if(a<=1e-5)return;let o=Math.max(.055,Math.min(.12,Math.sqrt(a)*.12)),s=new xo(a,o,o),c=t.amount>=0,l=new La(s,new gs({color:c?2278750:15680580,emissive:c?339478:3869194,opacity:.42,transparent:!0,roughness:.5,metalness:.08,depthWrite:!1}));l.position.copy(n).add(r).multiplyScalar(.5),l.quaternion.setFromUnitVectors(new W(1,0,0),i.normalize()),l.renderOrder=35,e.add(l)}function Bk(e,t,n){if(t.blocks.forEach(t=>zk(e,t)),!t.selected)return;let r=_O(t.selected.origin),i=.18,a=Math.max(vk(n)*1.35,.004);[{label:`x`,color:PD,direction:Rk(t.selected.xAxis),length:i},{label:`y`,color:FD,direction:Rk(t.selected.yAxis),length:i},{label:`z`,color:ID,direction:Rk(t.selected.zAxis),length:i}].forEach(t=>{if(!t.direction)return;let n=r.clone().add(t.direction.clone().multiplyScalar(t.length));bk(e,r,n,t.color,a,.92),OO(e,t.label,t.color,n.clone().add(t.direction.clone().multiplyScalar(.035)))});let o=Rk(t.selected.normal);if(!o)return;let s=`#f8d857`,c=r.clone().add(o.clone().multiplyScalar(.34));bk(e,r,c,s,a*1.45,.96);let l=.075,u=new La(new Co(.028,l,18,1),new Ta({color:IO(s),transparent:!0,opacity:.96}));u.position.copy(c).addScaledVector(o,-l*.5),u.quaternion.setFromUnitVectors(fD,o),e.add(u),OO(e,`n`,s,c.clone().add(o.clone().multiplyScalar(.045)))}function Vk(e,t,n,r,i){xk(e,t,n,`#7dd3fc`,r,!1,.32,i)}function Hk(e,t,n,r,i){xk(e,t,n,`#9ca3af`,r,!1,.55,i)}function Uk(e){return lD.has(e.kind)?cD:0}function Wk(e,t,n=0,r){let i=_O(t.from),a=_O(t.to),o=new W().subVectors(a,i),s=o.length();if(s<1e-4)return;let c=o.normalize(),l=Math.max(0,n*XE),u=l>0&&s>l*2+1e-4?s-l*2:s,d=l>0&&u<s?i.clone().addScaledVector(c,l+u*.5):i.clone().add(a).multiplyScalar(.5),f=t.radiusMm??4,p=Math.max(f*.003/2,.006),m=t.kind===`upperArm`||t.kind===`lowerArm`?.34:.12,h=new La(r?RO(r.geometries,`dynamic-tube-unit:20`,()=>new So(1,1,1,20,1)):new So(p,p,u,20,1),r?LO(r.materials,`dynamic-tube:${t.color}:${BO(m)}`,()=>new gs({color:IO(t.color),roughness:.48,metalness:m})):new gs({color:IO(t.color),roughness:.48,metalness:m}));r&&(h.scale.set(p,u,p),UO(h)),h.position.copy(d),h.quaternion.setFromUnitVectors(fD,c),e.add(h)}function Gk(e,t,n,r){if(!n)return;let i=_O(t.to),a=new W().subVectors(_O(n.to),_O(n.from));if(a.length()<1e-6)return;let o=a.normalize(),s=Math.hypot(n.to.x-n.from.x,n.to.y-n.from.y,n.to.z-n.from.z),c=Math.max(s*.5*.003,1e-6),l=i.clone().addScaledVector(o,c),u=Math.hypot(t.to.x-t.from.x,t.to.y-t.from.y,t.to.z-t.from.z),d=Math.max(u*.003,.006),f=new La(r?RO(r.geometries,`dynamic-tube-unit:20`,()=>new So(1,1,1,20,1)):new So(d,d,c,20,1),r?LO(r.materials,`dynamic-pinion:${t.color}`,()=>new gs({color:IO(t.color),roughness:.48,metalness:.12})):new gs({color:IO(t.color),roughness:.48,metalness:.12}));r&&(f.scale.set(d,c,d),UO(f)),f.position.copy(i).add(l).multiplyScalar(.5),f.quaternion.setFromUnitVectors(fD,o),e.add(f),Kk(e,i,o,c,d,t.pinionRotationDeg??0,r)}function Kk(e,t,n,r,i,a,o){if(r<=1e-6||i<=1e-6)return;let s=Math.abs(n.y)<.92?fD:new W(1,0,0),c=new W().crossVectors(n,s);if(c.lengthSq()<=1e-12&&(c=new W().crossVectors(n,new W(0,0,1))),c.lengthSq()<=1e-12)return;c.normalize();let l=new W().crossVectors(n,c).normalize(),u=-(Number.isFinite(a)?a:0)*YE,d=Math.max(i*1.026,i+.001),f=Math.min(r*.08,.012),p=f,m=Math.max(p+1e-5,r-f),h=[],g=[],_=[],v=Math.PI*2/QE,y=v-eD;for(let e=0;e<QE;e+=1){let r=e%2==0?g:_,i=h.length/3;for(let a=0;a<=$E;a+=1){let o=a/$E,s=u+e*v+eD*.5+o*y,f=c.clone().multiplyScalar(Math.cos(s)).addScaledVector(l,Math.sin(s)),g=t.clone().addScaledVector(n,p).addScaledVector(f,d),_=t.clone().addScaledVector(n,m).addScaledVector(f,d);if(h.push(g.x,g.y,g.z,_.x,_.y,_.z),a<$E){let e=i+a*2;r.push(e,e+1,e+3,e,e+3,e+2)}}}let b=new Yi;b.setAttribute(`position`,new Li(h,3)),b.setIndex([...g,..._]),b.addGroup(0,g.length,0),b.addGroup(g.length,_.length,1),b.computeVertexNormals();let x=new La(b,[o?LO(o.materials,`dynamic-pinion-rotation-blue`,()=>new gs({color:1668818,roughness:.5,metalness:.16,side:2})):new gs({color:1668818,roughness:.5,metalness:.16,side:2}),o?LO(o.materials,`dynamic-pinion-rotation-black`,()=>new gs({color:328965,roughness:.5,metalness:.16,side:2})):new gs({color:328965,roughness:.5,metalness:.16,side:2})]);o&&WO(x),x.renderOrder=4,e.add(x)}function qk(e,t,n,r,i,a,o){let s=_O(t.from),c=_O(t.to),l=new W().subVectors(c,s);if(l.length()<1e-4)return;let u=l.clone().normalize(),d=Math.abs(u.y)<.92?new W(0,1,0):new W(1,0,0),f=new W().crossVectors(u,d).normalize(),p=new W().crossVectors(u,f).normalize(),m=JO(r),h=qO(n),g=Math.max(72,Math.round(h*20)),_=l.clone().multiplyScalar(1-sD*2),v=s.clone().addScaledVector(l,sD),y=c.clone().addScaledVector(l,-sD),b=[];for(let e=0;e<=g;e+=1){let t=e/g,n=t*h*Math.PI*2,r=v.clone().addScaledVector(_,t),i=f.clone().multiplyScalar(Math.cos(n)*m).addScaledVector(p,Math.sin(n)*m);b.push(r.add(i))}let x=new rs(new Ro(b,!1,`centripetal`),g,vk(i),6,!1),S=o?LO(o.materials,`dynamic-spring:${t.color}`,()=>new Ta({color:IO(t.color)})):new Ta({color:IO(t.color)}),C=new La(x,S),w=vk(i),T=()=>new ns(m,w,6,36),E=new Jn().setFromUnitVectors(new W(0,0,1),u),D=new La(T(),S),O=new La(T(),S);D.position.copy(v),O.position.copy(y),D.quaternion.copy(E),O.quaternion.copy(E),o&&(WO(C),WO(D),WO(O)),e.add(C,D,O),xk(e,t.from,t.to,t.color,a,!0,.86,o)}function Jk(e){return e.kind===`mainSpring`&&(e.label===`Main spring`||e.label===`Outboard spring`)}function Yk(e){return e.kind===`antirollLink`||e.label.startsWith(`T-bar rocker guide`)||e.label.startsWith(`C-bar link guide`)||e.label.startsWith(`Mounting to `)||e.label.startsWith(`Integral link to `)||e.label===`Wheel center to tie rod`}function Xk(e,t,n){return e||!Yk(n)?!1:t?n.side!==t:!0}function Zk(e,t){let n=e.suspension.macPherson||e.suspension.configuration===`Outboard Spring`;return e.suspension.macPherson&&(t===`TLF`||t===`TLR`)?!1:t===`S`?n?!1:e.graphics.drawMainSpring:!(t===`PR`&&n&&!e.graphics.drawMainSpring)}function Qk(e,t,n,r=.024,i){let a=new La(i?RO(i.geometries,`dynamic-sphere-marker:${zO(r)}:16`,()=>new ts(r,16,16)):new ts(r,16,16),i?LO(i.materials,`dynamic-marker:${n}`,()=>new gs({color:IO(n),roughness:.52,metalness:.08})):new gs({color:IO(n),roughness:.52,metalness:.08}));i&&UO(a),a.position.copy(_O(t)),e.add(a)}function $k(e,t=1){let n=Number.isFinite(e.graphics.pointSize3D)?Math.abs(e.graphics.pointSize3D):4;return Math.max(.004,Math.min(.06,n*.003*t))}function eA(){let e=document.createElement(`canvas`);e.width=160,e.height=160;let t=e.getContext(`2d`);if(!t)return null;
4380let n=e.width/2,r=(e,r,i)=>{t.beginPath(),t.moveTo(n,n),t.arc(n,n,61,e,r),t.closePath(),t.fillStyle=i,t.fill()};t.clearRect(0,0,e.width,e.height),t.beginPath(),t.arc(n,n,61,0,Math.PI*2),t.fillStyle=`#f8fafc`,t.fill(),r(0,Math.PI/2,`#0d131a`),r(Math.PI,Math.PI*1.5,`#0d131a`),t.strokeStyle=`#d1d5db`,t.lineWidth=5,t.beginPath(),t.moveTo(n-61,n),t.lineTo(n+61,n),t.moveTo(n,n-61),t.lineTo(n,n+61),t.stroke(),t.beginPath(),t.arc(n,n,61,0,Math.PI*2),t.strokeStyle=`#d1d5db`,t.lineWidth=7,t.stroke();let i=new _o(e);i.needsUpdate=!0;let a=new ha(new ta({map:i,transparent:!0,depthTest:!1,depthWrite:!1}));return a.renderOrder=1400,a}function tA(e,t,n){let r=eA();if(!r)return;let i=Math.max($k(n,4.8)*2,.09);r.position.copy(_O(t)),r.scale.set(i,i,1),e.add(r)}function nA(e,t,n,r,i){let a=(e,t)=>t?Qw(e,t,i):$w(e,i);return t===0?a(e,n):[...a(e.slice(0,t),r),...a(e.slice(t),n)]}function rA(e,t,n,r){let i=document.createElement(`canvas`).getContext(`2d`);if(!i)return;let a=`700 58px Arial`;i.font=a;let o=Math.max(180,Math.ceil(i.measureText(t).width+44)),s=document.createElement(`canvas`);s.width=o,s.height=96;let c=s.getContext(`2d`);if(!c)return;c.font=a,c.textAlign=`center`,c.textBaseline=`middle`,c.lineJoin=`round`,c.lineWidth=8,c.strokeStyle=`rgba(5, 10, 14, 0.9)`,c.strokeText(t,o/2,49),c.fillStyle=`#ffea4d`,c.fillText(t,o/2,49);let l=new _o(s);l.needsUpdate=!0;let u=new ha(new ta({map:l,transparent:!0,depthTest:!1,depthWrite:!1})),d=7e-4;u.scale.set(o*d,96*d,1),u.position.copy(_O(n)).add(new W(r*2.5,r*2.5,r*2.5)),u.renderOrder=1300,e.add(u)}function iA(e,t,n,r,i,a,o,s,c,l=!1,u=!0,d){let f=r===`steering-wheel`,p=o?$k(t,1.5):f?$k(t,1.15):$k(t),m=new La(d?RO(d.geometries,`dynamic-sphere-hardpoint:${zO(p)}:20`,()=>new ts(p,20,20)):new ts(p,20,20),d?LO(d.materials,`dynamic-hardpoint:${o?`selected`:n}:${+!!f}`,()=>new gs({color:o?tD:IO(n),emissive:o?4866578:0,roughness:.44,metalness:.08,depthTest:!f,depthWrite:!f})):new gs({color:o?tD:IO(n),emissive:o?4866578:0,roughness:.44,metalness:.08,depthTest:!f,depthWrite:!f}));if(d&&UO(m),m.position.copy(_O(a)),f&&(m.renderOrder=1200),m.userData.hardpointId=r,e.add(m),o&&rA(e,i,a,p),!u)return null;let h=new La(new ts(ZE,14,14),new Ta({transparent:!0,opacity:0,depthWrite:!1,depthTest:!f}));return h.position.copy(_O(a)),f&&(h.renderOrder=1201),h.userData.hardpointId=r,e.add(h),h}function aA(e,t){let n=e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top ML - Bottom WB`,r=e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top WB - Bottom ML`;return(t===`tlf-w`||t===`tlr-w`)&&!n?[`tlf-w`,`tlr-w`]:(t===`blf-w`||t===`blr-w`)&&!r?[`blf-w`,`blr-w`]:[t]}function oA(e,t,n){return aA(e,t).some(e=>n.has(e))}function sA(){return new Ta({color:16777215,transparent:!0,opacity:0,depthWrite:!1,depthTest:!1,side:2})}function cA(e,t,n){if(n.length===0)return null;let r=_O(t.from),i=_O(t.to),a=new W().subVectors(i,r),o=a.length();if(o<1e-4)return null;let s=t.radiusMm??18,c=Math.max(s*.003/2,.035),l=new La(new So(c,c,o,10,1),sA());return l.position.copy(r).add(i).multiplyScalar(.5),l.quaternion.setFromUnitVectors(fD,a.normalize()),l.userData.hardpointIds=n,e.add(l),l}function lA(e,t,n){if(n.length===0)return null;let r=new Yi().setFromPoints(t.map(_O));r.setIndex([0,1,2]),r.computeVertexNormals();let i=new La(r,sA());return i.userData.hardpointIds=n,e.add(i),i}function uA(e,t,n,r){if(!(t.length<2))for(let i=1;i<t.length;i+=1)xk(e,t[i-1],t[i],`#ffffff`,n,!0,1,r)}function dA(e,t,n=50,r){let i=()=>{let e=[],n=[],r=new Map,i=t=>{let n=r.get(t);if(n!==void 0)return n;let i=new W(t.x*XE,t.y*XE,t.z*XE),a=e.length/3;return e.push(i.x,i.y,i.z),r.set(t,a),a};t.localQuads.forEach(([e,t,r,a])=>{let o=i(e),s=i(t),c=i(r),l=i(a);n.push(o,c,s,o,l,c)});let a=new Yi;return a.setAttribute(`position`,new Li(e,3)),a.setIndex(n),a.computeVertexNormals(),a},a=r?RO(r.geometries,`dynamic-tyre-profile-geometry:${t.geometryKey}`,i):i(),o=Math.max(0,Math.min(100,n))/100,s=o*.48,c=r?LO(r.materials,`dynamic-tyre-profile:${t.wheel.color}:${BO(o)}`,()=>new gs({color:IO(t.wheel.color),opacity:o,transparent:!0,roughness:.5,metalness:.06,side:0,depthWrite:!1})):new gs({color:IO(t.wheel.color),opacity:o,transparent:!0,roughness:.5,metalness:.06,side:0,depthWrite:!1}),l=new La(a,r?LO(r.materials,`dynamic-tyre-profile-inner:${t.wheel.color}:${BO(s)}`,()=>new gs({color:new $r(IO(t.wheel.color)).multiplyScalar(.22),opacity:s,transparent:!0,roughness:.78,metalness:0,side:1,depthWrite:!1})):new gs({color:new $r(IO(t.wheel.color)).multiplyScalar(.22),opacity:s,transparent:!0,roughness:.78,metalness:0,side:1,depthWrite:!1}));l.renderOrder=1;let u=new La(a,c);u.renderOrder=2;let d=new Kr;d.position.copy(_O(t.wheel.center)),d.quaternion.copy(fk(pk(t.wheel.pose))),r?(UO(l),UO(u)):l.userData.sharedGeometry=!0,d.add(l,u),e.add(d)}function fA(e,t,n,r){let i=Math.max(t.radius*.003,.03),a=vk(n),o=new Kr;o.position.copy(_O(t.center)),o.quaternion.copy(fk(pk(t.pose)));for(let e=0;e<54;e+=1){let t=e/54*Math.PI*2,n=Math.PI*2/54*.58,s=new La(r?RO(r.geometries,`dynamic-wheel-circle:${zO(i)}:${zO(a)}:${zO(n)}`,()=>new ns(i,a,6,10,n)):new ns(i,a,6,10,n),r?LO(r.materials,`dynamic-wheel-circle`,()=>new Ta({color:16777215,transparent:!0,opacity:.94})):new Ta({color:16777215,transparent:!0,opacity:.94}));r&&UO(s),s.rotation.z=t,s.rotation.x=Math.PI/2,o.add(s)}e.add(o)}function pA(e,t,n,r){let i=.003,a=Math.min(Math.max(t.rimRadius*i,Math.max(t.radius*i*.36,.02)),t.radiu
4380s*i*.82),o=t.rimOffset*i,s=Math.max(vk(n)*2,.0016),c=.24,l=new La(r?RO(r.geometries,`dynamic-rim-offset:${zO(a)}:${zO(s)}`,()=>new So(a,a,s,56,1,!1)):new So(a,a,s,56,1,!1),r?LO(r.materials,`dynamic-rim-offset`,()=>new gs({color:10995711,transparent:!0,opacity:c,roughness:.32,metalness:.12,side:2,depthWrite:!1})):new gs({color:10995711,transparent:!0,opacity:c,roughness:.32,metalness:.12,side:2,depthWrite:!1}));r&&UO(l),l.position.y=o,l.renderOrder=2;let u=new Kr;u.position.copy(_O(t.center)),u.quaternion.copy(fk(pk(t.pose))),u.add(l),e.add(u)}function mA(e,t,n,r,i=!1){let a=HO(n,t,i);if(!a)return;let o=LO(r,`wheel-envelope-surface`,()=>new gs({color:8246268,opacity:.24,transparent:!0,roughness:.42,metalness:.08,side:2,depthWrite:!1})),s=new La(a.surfaceGeometry,o);UO(s),s.renderOrder=2,e.add(s);let c=LO(r,`wheel-envelope-edge`,()=>new Ya({color:8246268,transparent:!0,opacity:.36})),l=new so(a.edgeGeometry,c);UO(l),l.renderOrder=3,e.add(l)}function hA(e,t,n,r,i){let a=HO(r,t,!1);if(!a)return;let o=LO(i,`extreme-pose-surface:${n}`,()=>new gs({color:IO(n),opacity:.16,transparent:!0,roughness:.42,metalness:.06,side:2,depthWrite:!1})),s=new La(a.surfaceGeometry,o);UO(s),s.renderOrder=1.5,e.add(s);let c=LO(i,`extreme-pose-edge:${n}`,()=>new Ya({color:IO(n),transparent:!0,opacity:.18})),l=new so(a.edgeGeometry,c);UO(l),l.renderOrder=1.6,e.add(l)}function gA(e,t,n,r,i){let a=HO(n,t,!1);if(!a)return;let o=LO(r,`extreme-pose-clash-surface`,()=>new Ta({color:16726832,transparent:!0,opacity:DD,side:2,depthWrite:!1}));o instanceof Ta&&!i.includes(o)&&i.push(o);let s=new La(a.surfaceGeometry,o);UO(s),s.renderOrder=7.5,e.add(s)}function _A(e,t){let n=t.x*YE,r=t.y*YE,i=t.z*YE,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i),d=e.y*a-e.z*o,f=e.y*o+e.z*a,p=e.x,m=p*s+f*c,h=-p*c+f*s,g=d;return{x:m*l-g*u,y:m*u+g*l,z:h}}function vA(e,t){let n=Number.isFinite(t.transform.scale)?Math.max(.001,t.transform.scale):1,r=Number.isFinite(t.transform.scaleY)?Math.max(.001,t.transform.scaleY):n,i=Number.isFinite(t.transform.scaleZ)?Math.max(.001,t.transform.scaleZ):n,a=_A(e,t.transform.rotateDeg),o={x:a.x*n,y:a.y*r,z:a.z*i};return{x:o.x+t.transform.translate.x,y:o.y+t.transform.translate.y,z:o.z+t.transform.translate.z}}function yA(e){return{vertices:e.vertices.map(e=>({x:e.x,y:-e.y,z:e.z})),faces:e.faces.map(([e,t,n])=>[e,t,n])}}function bA(e,t){if(!t)return e;let n={scale:1,scaleY:1,scaleZ:1,translate:{x:0,y:0,z:0},rotateDeg:{x:0,y:0,z:0}};return[...e,{id:`wheel-envelope-left`,mesh:t,colorHex:`#7dd3fc`,opacityPercent:25,transform:n},{id:`wheel-envelope-right`,mesh:yA(t),colorHex:`#7dd3fc`,opacityPercent:25,transform:n}]}function xA(e,t,n=xD){return!(e.maxX<t.minX-n||e.minX>t.maxX+n||e.maxY<t.minY-n||e.minY>t.maxY+n||e.maxZ<t.minZ-n||e.minZ>t.maxZ+n)}function SA(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h=xD){let g=r-e,_=i-t,v=a-n,y=l-o,b=u-s,x=d-c,S=f-o,C=p-s,w=m-c,T=_*w-v*C,E=v*S-g*w,D=g*C-_*S,O=y*T+b*E+x*D;if(Math.abs(O)<=h)return!1;let k=1/O,A=e-o,j=t-s,ee=n-c,te=(A*T+j*E+ee*D)*k;if(te<-h||te>1+h)return!1;let M=j*x-ee*b,ne=ee*y-A*x,N=A*b-j*y,P=(g*M+_*ne+v*N)*k;if(P<-h||te+P>1+h)return!1;let re=(S*M+C*ne+w*N)*k;return re>=-h&&re<=1+h}function CA(e,t,n,r,i,a,o,s,c,l,u,d,f=xD){let p=o-r,m=s-i,h=c-a,g=l-r,_=u-i,v=d-a,y=m*v-h*_,b=h*g-p*v,x=p*_-m*g,S=Math.hypot(y,b,x);if(S<=1e-12)return!1;let C=1/S,w=y*C,T=b*C,E=x*C,D=e-r,O=t-i,k=n-a,A=D*w+O*T+k*E;if(Math.abs(A)>f)return!1;let j=e-w*A,ee=t-T*A,te=n-E*A,M=l-r,ne=u-i,N=d-a,P=o-r,re=s-i,ie=c-a,ae=j-r,oe=ee-i,se=te-a,F=M*M+ne*ne+N*N,ce=M*P+ne*re+N*ie,le=M*ae+ne*oe+N*se,ue=P*P+re*re+ie*ie,I=P*ae+re*oe+ie*se,de=F*ue-ce*ce;if(Math.abs(de)<=1e-12)return!1;let fe=1/de,pe=(ue*le-ce*I)*fe,me=(F*I-ce*le)*fe;return pe>=-f&&me>=-f&&pe+me<=1+f}function wA(e,t){return xA(e,t)?SA(e.ax,e.ay,e.az,e.bx,e.by,e.bz,t.ax,t.ay,t.az,t.bx,t.by,t.bz,t.cx,t.cy,t.cz)||SA(e.bx,e.by,e.bz,e.cx,e.cy,e.cz,t.ax,t.ay,t.az,t.bx,t.by,t.bz,t.cx,t.cy,t.cz)||SA(e.cx,e.cy,e.cz,e.ax,e.ay,e.az,t.ax,t.ay,t.az,t.bx,t.by,t.bz,t.cx,t.cy,t.cz)||SA(t.ax,t.ay,t.az,t.bx,t.by,t.bz,e.ax,e.ay,e.az,e.bx,e.by,e.bz,e.cx,e.cy,e.cz)||SA(t.bx,t.by,t.bz,t.cx,t.cy,t.cz,e.ax,e.ay,e.az,e.bx,e.by,e.bz,e.cx,e.cy,e.cz)||SA(t.cx,t.cy,t.cz,t.ax,t.ay,t.az,e.ax,e.ay,e.az,e.bx,e.by,e.bz,e.cx,e.cy,e.cz)||CA(e.ax,e.ay,e.az,t.ax,t.ay,t.az,t.bx,t.by,t.bz,t.cx,t.cy,t.cz)?!0:CA(t.ax,t.ay,t.az,e.ax,e.ay,e.az,e.bx,e.by,e.bz,e.cx,e.cy,e.cz):!1}function TA(e,t=null,n=yD){let r=[],i=e.mesh.faces,a=t?1:Math.max(1,Math.ceil(i.length/Math.max(1,n))),o=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,d=-1/0;for(let n=0;n<i.length;n+=a){let[a,f,p]=i[n],m=e.mesh.vertices[a-1],h=e.mesh.vertices[f-1],g=e.mesh.vertices[p-1];if(!m||!h||!g)continue;let _=vA(m,e),v=vA(h,e),y=vA(g,e),b=Math.min(_.x,v.x,y.x),x=Math.min(_.y,v.y,y.y),S=Math.min(_.z,v.z,y.z),C=Math.max(_.x,v.x,y.x),w=Math.max(_.y,v.y,y.y),T=Math.max(_.z,v.z,y.z),E={minX:b,minY:x,minZ:S,maxX:C,maxY:w,maxZ:T};t&&!t.some(e=>xA(E,e,0))||(o=Math.min(o,b),s=Math.min(s,x),c=Math.min(c,S),l=Math.max(l,C),u=Math.max(u,w),d=Math.max(d,T),r.push({meshId:e.id,faceIndex:n,ax:_.x,ay:_.y,az:_.z,bx:v.x,by:v.y,bz:v.z,cx:y.x,cy:y.y,cz:y.z,minX:b,minY:x,minZ:S,maxX:C,maxY:w,maxZ:T}))}if(r.length>n){let e=Math.ceil(r.length/n);
4380r=r.filter((t,n)=>n%e===0)}return r.length===0?{meshId:e.id,faces:r,minX:0,minY:0,minZ:0,maxX:0,maxY:0,maxZ:0}:{meshId:e.id,faces:r,minX:o,minY:s,minZ:c,maxX:l,maxY:u,maxZ:d}}function EA(e,t,n){return`${e}|${t}|${n}`}function DA(e,t){let n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.max(e.minZ,t.minZ),a=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY),s=Math.min(e.maxZ,t.maxZ),c=Math.max(0,a-n),l=Math.max(0,o-r),u=Math.max(0,s-i),d=Math.max(c,l,u,xD*12);return Math.max(d/18,xD*8)}function OA(e,t){let n=new Map;return e.forEach((e,r)=>{let i=Math.floor(e.minX/t),a=Math.floor(e.minY/t),o=Math.floor(e.minZ/t),s=Math.floor(e.maxX/t),c=Math.floor(e.maxY/t),l=Math.floor(e.maxZ/t);for(let e=i;e<=s;e+=1)for(let t=a;t<=c;t+=1)for(let i=o;i<=l;i+=1){let a=EA(e,t,i),o=n.get(a);o?o.push(r):n.set(a,[r])}}),n}function kA(e,t,n,r){let i=`${r.meshId}:${r.faceIndex}`;if(n.has(i))return;n.add(i);let a=e.get(r.meshId)??[],o=_O({x:r.ax,y:r.ay,z:r.az}),s=_O({x:r.bx,y:r.by,z:r.bz}),c=_O({x:r.cx,y:r.cy,z:r.cz});a.push(o.x,o.y,o.z,s.x,s.y,s.z,c.x,c.y,c.z),e.set(r.meshId,a);let l=t.get(r.meshId)??[];l.push(r),t.set(r.meshId,l)}function AA(e){let t=new Map;return e.forEach((e,n)=>{if(e.length===0)return;let r=e.reduce((e,t)=>({minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),minZ:Math.min(e.minZ,t.minZ),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY),maxZ:Math.max(e.maxZ,t.maxZ)}),{minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0});t.set(n,[{minX:r.minX-SD,minY:r.minY-SD,minZ:r.minZ-SD,maxX:r.maxX+SD,maxY:r.maxY+SD,maxZ:r.maxZ+SD}])}),t}function jA(e,t=null){let n=new Map;if(e.length<2)return n;let r=(t?e.filter(e=>t.has(e.id)):e).map(e=>TA(e,t?.get(e.id)??null,t?CD:yD)).filter(e=>e.faces.length>0);if(r.length<2)return n;let i=new Set,a=new Map,o=0,s=!1;for(let e=0;e<r.length&&!s;e+=1)for(let c=e+1;c<r.length&&!s;c+=1){let l=r[e],u=r[c];if(!xA(l,u))continue;let d=l.faces.length>=u.faces.length,f=d?l:u,p=d?u:l,m=DA(f,p),h=OA(f.faces,m),g=Array(f.faces.length).fill(0),_=1;for(let e of p.faces){if(s)break;let r=Math.floor(e.minX/m),c=Math.floor(e.minY/m),l=Math.floor(e.minZ/m),u=Math.floor(e.maxX/m),d=Math.floor(e.maxY/m),p=Math.floor(e.maxZ/m);_>=2**53-1-2&&(g.fill(0),_=1),_+=1;for(let m=r;m<=u;m+=1){for(let r=c;r<=d;r+=1){for(let c=l;c<=p;c+=1){let l=h.get(EA(m,r,c));if(l){for(let r of l){if(g[r]===_)continue;g[r]=_;let c=f.faces[r];if(xA(e,c)){if(o+=1,o>(t?wD:bD)){s=!0;break}wA(e,c)&&(kA(n,a,i,e),kA(n,a,i,c))}}if(s)break}}if(s)break}if(s)break}}}if(!t&&a.size>=2){let t=jA(e,AA(a));if(t.size>0)return t}return n}function MA(e,t,n,r){if(t.length<9)return;let i=new Yi;i.setAttribute(`position`,new Li(t,3)),i.computeVertexNormals();let a=LO(r,`step-clash-overlay`,()=>new Ta({color:16726832,transparent:!0,opacity:DD,side:2,depthWrite:!1})),o=new La(i,a);o.renderOrder=8,n.includes(a)||n.push(a),e.add(o)}function NA(e,t,n,r){let i=HO(n,t.mesh,!1);if(!i)return;let a=new Kr;KO(a,t);let o=qD(t.opacityPercent),s=LO(r,`step-surface:${t.colorHex}:${BO(o)}`,()=>new gs({color:IO(t.colorHex),roughness:.42,metalness:.08,side:2,opacity:o,transparent:o<1,depthWrite:!1})),c=new La(i.surfaceGeometry,s);UO(c),c.renderOrder=2,a.add(c);let l=LO(r,`step-edge:${t.colorHex}`,()=>new Ya({color:IO(t.colorHex),transparent:!0,opacity:.36})),u=new so(i.edgeGeometry,l);UO(u),u.renderOrder=3,a.add(u),e.add(a)}function PA(e,t,n,r){xk(e,t.from,t.to,n,Math.max(r,1),!0,.82),Qk(e,t.from,n,.017),Qk(e,t.to,n,.017)}function FA(e,t,n,r,i){let a=new Yi().setFromPoints(t.map(_O));a.setIndex([0,1,2]),a.computeVertexNormals();let o=new La(a,i?LO(i.materials,`dynamic-face:${n}:${BO(r)}`,()=>new gs({color:IO(n),opacity:r,transparent:r<1,roughness:.56,metalness:.08,side:2})):new gs({color:IO(n),opacity:r,transparent:r<1,roughness:.56,metalness:.08,side:2}));i&&WO(o),e.add(o)}function IA(e){if(e.length===0)return new W(0,0,0);let t=new gi;return e.forEach(e=>t.expandByPoint(_O(e))),t.getCenter(new W)}function LA(e,t){return Math.max(.8,...e.map(e=>_O(e).distanceTo(t)))}function RA(e){let t=Math.max(e,.01)/Math.tan(oD*YE/2);return Math.max(WD,t*UD)}function zA(e,t){let n=e.clone().normalize(),r=t.clone().projectOnPlane(n);return r.lengthSq()<1e-9&&r.copy(Math.abs(n.y)<.92?fD:new W(1,0,0)).projectOnPlane(n),r.normalize(),{view:n,up:r,right:new W().crossVectors(r,n).normalize()}}function BA(e,t,n,r,i){if(e.length===0)return RA(.8);let a=zA(n,r),o=Math.max(i,.2),s=0,c=0,l=0;
4380e.forEach(e=>{let n=_O(e).sub(t);s=Math.max(s,Math.abs(n.dot(a.right))),c=Math.max(c,Math.abs(n.dot(a.up))),l=Math.max(l,Math.abs(n.dot(a.view)))});let u=Math.max(c,s/o)*UD;return Math.max(WD,u/Math.tan(oD*YE/2)+l*GD)}function VA(e,t){return e===`planYX`?new W(0,t,0):e===`lateralXZ`?new W(0,0,-t):new W(-t,0,0)}function HA(e){return e===`rearYZ`?new W(0,1,0):e===`planYX`?new W(1,0,0):new W(0,1,0)}function UA(e,t){return CO(e.zAxis).multiplyScalar(t)}function WA(e){let t=CO({x:-e.yAxis.x,y:-e.yAxis.y,z:-e.yAxis.z}),n=e.displayRotationRad??0;return Math.abs(n)<=1e-12?t:t.applyAxisAngle(CO(e.zAxis),-n)}function GA(){return new W(0,1,0)}function KA(e,t=!1){e.traverse(e=>{if(e instanceof La||e instanceof ro){(!t||e.userData.sharedGeometry!==!0)&&e.geometry.dispose();let n=e.material;Array.isArray(n)?n.forEach(n=>{(!t||e.userData.sharedMaterial!==!0)&&n.dispose()}):(!t||e.userData.sharedMaterial!==!0)&&n.dispose();return}if(e instanceof ha){let n=e.material;(!t||e.userData.sharedMaterial!==!0)&&(n.map?.dispose(),n.dispose())}})}function qA({document:e,auxiliaryDocument:t=null,auxiliaryOffset:n=null,auxiliaryTyreProfile:r=null,fullVehicleMode:i=!1,loadVectors:a=[],referenceDocument:o,tyreProfile:s=null,tyreProfileOverlay:c=null,ghostWireframeDocument:l=null,ghostWireframeColor:u=BD,ghostWireframeLineWidth:d,ghostWireframeSegmentKinds:f=null,extremePoseMeshes:p=[],extremePoseClashMeshes:m=[],referenceGhostWireframeDocument:g=null,customProjection:_=null,sideMode:v=`auto`,themeMode:y=`dark`,lightThemeActive:b=!1,showLeft:x,showPoints:S,hardpoints:C=[],hardpointsLeft:w=[],rockerOperationalHardpointIds:T=[],selectedHardpointIds:E=[],hardpointBoundaries:D=[],monochromeColor:O,optimizerKinematicsOnly:k=!1,uprightHighlightEnabled:A=!1,onHardpointSelect:j,onHardpointGroupSelect:ee,wheelEnvelopeMesh:te=null,stepGeometries:M=[],stepGeometryChassisTransform:ne=null,stepClashDetectionEnabled:N=!1,stepWheelbaseGuides:P=null,stepWheelbaseDebugGuides:re=[],setupShimOverlay:ie=null,setupUprightWheelOverrides:ae=null,traceSteeringAxisEnvelope:oe=!1,isAnimating:se=!1,resetViewToken:F=0,resetViewPreset:ce=`rearYZ`,captureView:le=null,onViewInteraction:ue,onViewParametersChange:I,orthographic:de=!1}){let[fe,pe]=(0,h.useState)(0),[me,he]=(0,h.useState)(0),L=(0,h.useRef)(null),ge=(0,h.useRef)(null),R=(0,h.useRef)(null),_e=(0,h.useRef)(null),ve=(0,h.useRef)(null),ye=(0,h.useRef)(null),z=(0,h.useRef)(null),be=(0,h.useRef)(null),B=(0,h.useRef)(null),xe=(0,h.useRef)(se),Se=(0,h.useRef)(null),Ce=(0,h.useRef)(null),we=(0,h.useRef)(null),Te=(0,h.useRef)(new vr),Ee=(0,h.useRef)(null),De=(0,h.useRef)([]),Oe=(0,h.useRef)(j),ke=(0,h.useRef)(ee),Ae=(0,h.useRef)(ue),Me=(0,h.useRef)(I),Ne=(0,h.useRef)(null),Pe=(0,h.useRef)(new W(0,0,0)),Fe=(0,h.useRef)(2.2),Ie=(0,h.useRef)([]),Le=(0,h.useRef)(0),Re=(0,h.useRef)([]),ze=(0,h.useRef)({left:[],right:[]}),V=(0,h.useRef)([]),Be=(0,h.useRef)([]),Ve=(0,h.useRef)(null),He=(0,h.useRef)(new Map),Ue=(0,h.useRef)(new Map),We=(0,h.useRef)(new Map),Ge=(0,h.useRef)(null),Ke=(0,h.useMemo)(()=>x?[`left`,`right`]:[`right`],[x]),qe=(0,h.useMemo)(()=>v===`left-only`?[`left`]:v===`right-only`?[`right`]:v===`both`?[`left`,`right`]:Ke,[Ke,v]),Je=!x&&qe.length===1?qe[0]:null,Ye=(0,h.useMemo)(()=>vm(e,t,n,qe,{uprightWheelOverrides:ae??void 0}),[t,n,e,ae,qe]),Xe=o??e,Ze=(0,h.useMemo)(()=>l?_m(ik(l,e),qe):null,[e,l,qe]),Qe=(0,h.useMemo)(()=>g?_m(ik(g,e),qe):null,[e,g,qe]),$e=(0,h.useMemo)(()=>_m(tk(Xe),qe),[Xe,qe]),et=(0,h.useMemo)(()=>jp(tk(Xe),qe),[Xe,qe]),tt=(0,h.useMemo)(()=>QO(e,et,i),[e.graphics.drawOppositeAxle,e.suspension.axlePosition,e.vehicle.wheelbase,i,et]),nt=(0,h.useMemo)(()=>$O(e),[e]),rt=(0,h.useMemo)(()=>nk(ne),[ne]);(0,h.useMemo)(()=>ym($e,{includeCenterOfGravity:!_}),[_,$e]);let it=(0,h.useMemo)(()=>Ip(e,t,n,qe),[t,n,e,qe]),at=(0,h.useMemo)(()=>a.filter(e=>!e.side||qe.includes(e.side)),[a,qe]),ot=(0,h.useMemo)(()=>at.flatMap(e=>[e.from,Ek(e)]),[at]),st=(0,h.useMemo)(()=>{let t=ZO(e,Ye.wheels,$e.wheels);return O?t.map(e=>({...e,color:O})):t},[e,Ye.wheels,O,$e.wheels]),ct=t&&n?qe.length:0,lt=(0,h.useMemo)(()=>e.graphics.drawWheels?nA(st,ct,s,r,40):[],[r,ct,e.graphics.drawWheels,st,s]),ut=(0,h.useMemo)(()=>new Map(lt.map(e=>[e.wheel,e])),[lt]),dt=(0,h.useMemo)(()=>e.graphics.drawWheels?nA(Ye.wheels,ct,s,r,40):[],[r,ct,e.graphics.drawWheels,Ye.wheels,s]),ft=(0,h.useMemo)(()=>ZO(e,it,et),[it,e,et]),pt=(0,h.useMemo)(()=>
4380{if(!e.graphics.drawTyreProfile)return[];if(ct===0)return Qw(ft,c,3);let t=ft.length-ct;return[...Qw(ft.slice(0,t),c,3),...Qw(ft.slice(t),r,3)]},[r,ct,e.graphics.drawTyreProfile,c,ft]),mt=(0,h.useMemo)(()=>{if(!e.graphics.drawTyreProfile)return[];if(ct===0)return Qw(it,c,3);let t=it.length-ct;return[...Qw(it.slice(0,t),c,3),...Qw(it.slice(t),r,3)]},[r,ct,it,e.graphics.drawTyreProfile,c]),ht=(0,h.useMemo)(()=>ZO(e,it,et),[it,e,et]),gt=(0,h.useMemo)(()=>{let t=[],n=e.suspension.macPherson?C.filter(e=>!UE.has(e.id)):C,r=e.suspension.macPherson?w.filter(e=>!UE.has(e.id)):w;return n.forEach(e=>{t.push({id:e.id,label:e.label,point:e.point,key:`${e.id}-right`})}),x&&(r.length>0?r.forEach(e=>{t.push({id:e.id,label:e.label,point:e.point,key:`${e.id}-left`})}):n.forEach(e=>{Math.abs(e.point.y)>1e-8&&t.push({id:e.id,label:e.label,point:{...e.point,y:-e.point.y},key:`${e.id}-left`})})),t},[e.suspension.macPherson,C,w,x]),_t=(0,h.useMemo)(()=>rO(Ye.segments,gt),[gt,Ye.segments]),vt=(0,h.useMemo)(()=>A?new Set(om(e)):new Set,[e,A]),yt=(0,h.useMemo)(()=>new Set(T),[T]),bt=!!_&&yt.size>0;(0,h.useEffect)(()=>{let e=!0,t=e=>KA(e),n=()=>{};return new DE().load(pD,r=>{r.preload(),new VE().setMaterials(r).load(mD,n=>{if(!e){t(n);return}wO(n),Ge.current=n,he(e=>e+1)},void 0,n)},void 0,n),()=>{e=!1;let n=Ge.current;Ge.current=null,n&&t(n)}},[]);let xt=(e,t)=>{if(ge.current){ge.current.cameraPosition.copy(e.position),ge.current.target.copy(t.target);return}ge.current={cameraPosition:e.position.clone(),target:t.target.clone()}};return(0,h.useEffect)(()=>{Oe.current=j},[j]),(0,h.useEffect)(()=>{ke.current=ee},[ee]),(0,h.useEffect)(()=>{Ae.current=ue},[ue]),(0,h.useEffect)(()=>{Me.current=I},[I]),(0,h.useEffect)(()=>{xe.current=se,B.current?.(),be.current?.()},[se]),(0,h.useEffect)(()=>{Te.current.copy(rt),rk(we.current,rt),be.current?.()},[rt]),(0,h.useEffect)(()=>{let t=L.current;if(!t)return;let n=KD(y),r=new ti;r.background=new $r(n.background);let i=Math.max(t.clientWidth,1),a=Math.max(t.clientHeight,1),o=de?new ic(-1,1,1,-1,.01,120):new rc(oD,i/a,.01,120),s=_O({x:0,y:0,z:e.vehicle.wheelRadius});o.position.set(s.x+2.2,s.y+1.4,s.z+2.4),o.lookAt(s),vD(o,i,a,s);let c=new nf({antialias:!0,powerPreference:`high-performance`});c.setSize(i,a,!1),c.setPixelRatio(Math.min(window.devicePixelRatio,1.5)),c.domElement.style.width=`100%`,c.domElement.style.height=`100%`,c.domElement.style.display=`block`,t.replaceChildren(c.domElement);let l=new mE(o,c.domElement);l.enableDamping=!0,l.dampingFactor=.08,l.enablePan=!0,l.mouseButtons={LEFT:je.ROTATE,MIDDLE:je.DOLLY,RIGHT:je.PAN},l.target.copy(s),ge.current&&(o.position.copy(ge.current.cameraPosition),l.target.copy(ge.current.target),o.lookAt(ge.current.target),o instanceof ic&&(o.zoom=1),vD(o,i,a,l.target),l.update()),r.add(new Gs(15923195,n.hemisphereGround,1.35));let u=new oc(16777215,1.75);u.position.set(2,5,3),r.add(u);let d=new Lc(tt.size,tt.divisions,n.gridMajor,n.gridMinor);ek(d,tt,nt),r.add(d),Ee.current=d;let f=new Kr;jO(f),r.add(f);let p=new Kr;r.add(p);let m=new Kr;r.add(m),R.current=r,_e.current=o,ve.current=c,ye.current=l,Se.current=p,Ce.current=m,pe(e=>e+1);let h=new Tc,g=new U,_=null,v=e=>{_={x:e.clientX,y:e.clientY}},b=e=>{if(!_||Math.hypot(e.clientX-_.x,e.clientY-_.y)>5)return;let t=c.domElement.getBoundingClientRect();g.x=(e.clientX-t.left)/Math.max(t.width,1)*2-1,g.y=-((e.clientY-t.top)/Math.max(t.height,1)*2-1),h.setFromCamera(g,o);let[n]=h.intersectObjects(De.current,!1),r=n?.object.userData.hardpointId,i=n?.object.userData.hardpointIds;if(r){Oe.current?.(r,e.ctrlKey||e.metaKey);return}if(i&&i.length>0){ke.current?.(i,e.ctrlKey||e.metaKey);return}ke.current?.([],!1)},x=()=>{let n=_O({x:0,y:0,z:e.vehicle.wheelRadius}),r=Ne.current??{cameraPosition:n.clone().add(new W(2.2,1.4,2.4)),target:n};o.up.copy(GA()),o instanceof ic&&(o.zoom=1),o.position.copy(r.cameraPosition),l.target.copy(r.target),vD(o,Math.max(t.clientWidth,1),Math.max(t.clientHeight,1),l.target),o.lookAt(r.target),l.update(),xt(o,l),E()},S=()=>{let e=Me.current;if(!e)return;let t=o.position.clone(),n=l.target.clone(),r=o.up.clone(),i=Ve.current;i&&i.cameraPosition.distanceToSquared(t)<1e-8&&i.target.distanceToSquared(n)<1e-8&&i.up.distanceToSquared(r)<1e-10||(Ve.current={cameraPosition:t,target:n,up:r},e({cameraPosition:{x:t.x,y:t.y,z:t.z},target:{x:n.x,y:n.y,z:n.z},up:{x:r.x,y:r.y,z:r.z},distance:t.distanceTo(n)}))},C=()=>V.current.length>0||Be.current.length>0,w=e=>{if(V.current.length>0){let t=(Math.sin(e*TD)+1)*.5,n=ED+(DD-ED)*t;
4380V.current.forEach(e=>{e.opacity=n})}if(Be.current.length>0){let t=(Math.sin(e*OD)+1)*.5,n=kD+(AD-kD)*t;Be.current.forEach(e=>{e.opacity=n})}},T=e=>{z.current=null;let t=l.update();w(e),xt(o,l),S(),c.render(r,o),(t||xe.current||C())&&E()},E=()=>{z.current===null&&(z.current=window.requestAnimationFrame(T))};be.current=E,B.current=()=>{(xe.current||C())&&E()};let D=!1,O=()=>{D=!0},k=()=>{D&&Ae.current?.(),E()},A=()=>{D=!1};c.domElement.addEventListener(`pointerdown`,v),c.domElement.addEventListener(`click`,b),c.domElement.addEventListener(`dblclick`,x),l.addEventListener(`start`,O),l.addEventListener(`change`,k),l.addEventListener(`end`,A);let j=new ResizeObserver(()=>{let e=Math.max(t.clientWidth,1),n=Math.max(t.clientHeight,1);vD(o,e,n,l.target),c.setSize(e,n,!1),E()});return j.observe(t),E(),()=>{c.domElement.removeEventListener(`pointerdown`,v),c.domElement.removeEventListener(`click`,b),c.domElement.removeEventListener(`dblclick`,x),l.removeEventListener(`start`,O),l.removeEventListener(`change`,k),l.removeEventListener(`end`,A),j.disconnect(),z.current!==null&&(window.cancelAnimationFrame(z.current),z.current=null),be.current=null,B.current=null,l.dispose(),c.dispose(),KA(m,!0),m.clear(),KA(p,!0),p.clear(),Ue.current.forEach(e=>e.dispose()),Ue.current.clear(),We.current.forEach(e=>e.dispose()),We.current.clear(),He.current.forEach(e=>{[e.base,e.mirroredY].forEach(e=>{e&&(e.edgeGeometry.dispose(),e.surfaceGeometry.dispose())})}),He.current.clear(),KA(r),t.replaceChildren(),R.current=null,_e.current=null,ve.current=null,ye.current=null,Se.current=null,Ce.current=null,we.current=null,Ee.current=null,De.current=[],Ie.current=[],Re.current=[],ze.current={left:[],right:[]},V.current=[],Be.current=[],Ve.current=null,Ne.current=null}},[e.vehicle.wheelRadius,de,y]),(0,h.useEffect)(()=>{let e=R.current,t=Ee.current;if(!e||!t)return;let n=KD(y),r=new Lc(tt.size,tt.divisions,n.gridMajor,n.gridMinor);ek(r,tt,nt),e.background=new $r(n.background),e.remove(t),t.geometry.dispose();let i=t.material;Array.isArray(i)?i.forEach(e=>e.dispose()):i.dispose(),e.add(r),Ee.current=r,be.current?.()},[tt,y]),(0,h.useEffect)(()=>{let e=Ee.current;e&&(ek(e,tt,nt),be.current?.())},[tt,nt]),(0,h.useEffect)(()=>{let t=Se.current;if(!t)return;KA(t,!0),t.clear(),we.current=null,V.current=[],Be.current=[];let n=()=>{let e=we.current;return e||(e=new Kr,rk(e,Te.current),t.add(e),we.current=e),e};if(Ze){let n=f?new Set(f):null;ck(t,Ze,d??e.graphics.lineWidth,u,e,x,Je,k,n)}if(p.length>0&&p.forEach(e=>{hA(t,e.mesh,e.colorHex??`#7dd3fc`,He.current,We.current)}),m.length>0&&m.forEach(e=>{gA(t,e.mesh,He.current,We.current,V.current)}),Qe&&ck(t,Qe,e.graphics.lineWidth,VD,e,x,Je,k),_&&(MO(t,_),PO(t,_,Be.current),FO(t,_,Be.current)),e.graphics.drawArrow){let e=uk(ym($e,{includeCenterOfGravity:!1}));e&&(gk(t,e.start,e.tip,`#ff3b30`),gk(t,e.headA,e.tip,`#ff3b30`),gk(t,e.headB,e.tip,`#ff3b30`))}if(te&&(mA(t,te,He.current,We.current),mA(t,te,He.current,We.current,!0)),M.length>0){let e=n();M.forEach(t=>{NA(e,t,He.current,We.current)})}if(N){let e=jA(bA(M,te));if(e.size>0){let r=new Set(M.map(e=>e.id));e.forEach((e,i)=>{MA(r.has(i)?n():t,e,V.current,We.current)})}}if(P){let t=n();PA(t,P.frontAxis,`#f8d857`,e.graphics.lineWidth),PA(t,P.rearAxis,`#67e8f9`,e.graphics.lineWidth)}B.current?.(),be.current?.()},[e.graphics.drawArrow,e.graphics.lineWidth,Ze,u,d,f,k,p,m,Qe,_,$e,fe,N,M,re,P,te]),(0,h.useEffect)(()=>{let t=Ce.current,n=R.current,r=_e.current,i=ye.current;if(!t||!n||!r||!i||!ve.current)return;let a=se?{geometries:Ue.current,materials:We.current}:void 0;KA(t,!0),t.clear(),D.forEach(e=>vO(t,e)),De.current=[];let o=!se&&!!(j||ee),s=new Set(gt.map(e=>e.id)),c=[],l=Ye.segments.filter(e=>e.kind===`steeringAxis`),u=Ye.points.filter(e=>e.label===`CP`&&(e.side===`left`||e.side===`right`));!oe||!se?Re.current=[]:(l.forEach(e=>{let t={from:e.from,to:e.to},n=Re.current[Re.current.length-1];(!n||!eO(n,t))&&Re.current.push(t)}),Re.current.length>KE&&Re.current.splice(0,Re.current.length-KE)),Re.current.forEach(n=>{Vk(t,n.from,n.to,e.graphics.virtualLineWidth,a)}
4380),!e.graphics.virtualPointsLines||!se?ze.current={left:[],right:[]}:u.forEach(e=>{let t=e.side,n=ze.current[t],r=n[n.length-1];(!r||!$D(r,e.point))&&n.push(e.point),n.length>JE&&n.splice(0,n.length-JE)}),[`left`,`right`].forEach(n=>{let r=ze.current[n];for(let n=1;n<r.length;n+=1)Hk(t,r[n-1],r[n],e.graphics.virtualLineWidth,a)}),Ye.faces.forEach(n=>{if(k&&xO(n))return;let r=(o||bt)&&n.selectable!==!1?gO(e,n,Ye.faces,gt,s):[],i=bt&&r.length>0&&!r.some(t=>oA(e,t,yt)),l=A&&n.kind===`upright`,u=O??(i?iD:l?aD:n.color);if(FA(t,n.points,u,l?Math.max(n.opacity,.56):n.opacity,a),o){let e=lA(t,n.points,r);e&&c.push(e)}});let d=Ye.segments.find(e=>e.kind===`reference`&&e.label===`Steering line link 1`)??null,f=Ye.segments.find(e=>e.kind===`reference`&&e.label===`Steering line link 3`)??null,p=f&&Ge.current?TO(t,Ge.current,e,f):!1;if(Ye.segments.forEach(n=>{if(k&&bO(n)||Xk(x,Je,n))return;let r=Jk(n),i=r||n.kind===`heaveSpring`||n.kind===`rollSpring`||n.kind===`mainSpring`,l=n.kind===`reference`&&n.label===`Steering rack`,u=n.kind===`reference`&&n.label.startsWith(`Steering wheel`),f=n.kind===`reference`&&(n.label===`Steering line pinion`||n.label.startsWith(`Steering line link`)),m=(o||bt)&&n.selectable!==!1?hO(e,n,Ye.segments,gt,s):[],h=bt&&m.length>0&&!m.some(t=>oA(e,t,yt)),g=O??(h?iD:n.color);if(!(u&&p))if(i)!(r||n.kind===`heaveSpring`||n.kind===`rollSpring`)||e.graphics.drawSprings?qk(t,{...n,color:g},e.graphics.springTurns,e.graphics.springDiameter,e.graphics.linkWidth2D,e.graphics.virtualLineWidth,a):xk(t,n.from,n.to,g,e.graphics.virtualLineWidth,!0,.86,a);else if(n.kind===`steeringAxis`||n.kind===`rollCenter`||n.kind===`rollAxis`||n.kind===`groundLine`||u){let r=n.kind===`groundLine`?yk(e.graphics.virtualLineWidth):n.label.startsWith(`Steering wheel`)&&Number.isFinite(n.radiusMm)&&(n.radiusMm??0)>0?Math.max(n.radiusMm??0,1):n.dashed?yk(e.graphics.virtualLineWidth):e.graphics.virtualLineWidth;xk(t,n.from,n.to,g,r,!!n.dashed,n.kind===`groundLine`?.38:1,a)}else f?(gk(t,n.from,n.to,g,!1,a),n.label===`Steering line pinion`&&Gk(t,{...n,color:g},d,a)):l?Wk(t,{...n,color:g},0,a):n.dashed||!e.graphics.drawArms3D?gk(t,n.from,n.to,g,!!n.dashed,a):(gk(t,n.from,n.to,g,!1,a),Wk(t,{...n,color:g},Uk(n),a));if(o){let e=cA(t,n,m);e&&c.push(e)}}),at.forEach(n=>{Lk(t,n,e.graphics.lineWidth,a),e.graphics.drawLoadLabels&&Ik(t,n)}),e.graphics.virtualPointsLines){let n=O??Ye.segments.find(e=>e.kind===`steeringAxis`)?.color??`#d1d5db`;(x?[`left`,`right`]:[`right`]).forEach(r=>{let i=ft.find(e=>e.side===r),o=Ye.points.find(e=>e.side===r&&e.label===`SA`)?.point,s=Ye.points.find(e=>e.side===r&&e.label===`SAWC`)?.point,c=Ye.points.find(e=>e.side===r&&e.label===`CP`)?.point;if(!i||!o||!s||!c)return;let l=yk(e.graphics.virtualLineWidth);hk(t,c,o,i,n,l,a),hk(t,i.center,s,i,n,l,a)})}e.graphics.drawWheels&&st.forEach(n=>{let r=ut.get(n);r&&dA(t,r,e.graphics.wheelOpacityPercent,a)}),e.graphics.drawTyreProfile&&pt.forEach(n=>{uA(t,n.profileCurve,e.graphics.virtualLineWidth,a)}),e.graphics.drawOffsetRim&&ht.forEach(n=>{pA(t,n,e.graphics.virtualLineWidth,a)}),e.graphics.drawWheelCircle&&ft.forEach(n=>{fA(t,n,e.graphics.virtualLineWidth,a)}),A&&wk(t,it,e.graphics.lineWidth,a),!_&&Ye.centerOfGravity&&tA(t,Ye.centerOfGravity,e);let m=e.graphics.drawSteeringAxis||e.graphics.virtualPointsLines,h=e.graphics.drawRollCenter;Ye.points.filter(e=>e.label===`RC`?h:e.label===`SA`||e.label===`SAWC`?m:!1).forEach(n=>{Qk(t,n.point,O??n.color,$k(e,1.1),a)}),S&&Ye.points.filter(e=>e.label!==`SA`&&e.label!==`SAWC`&&e.label!==`RC`).filter(t=>Zk(e,t.label)).forEach(n=>{if(n.label===`CP`){Qk(t,n.point,nD,$k(e,1.1),a);return}let r=nO([n.point],gt),i=bt&&r.length>0&&!r.some(t=>oA(e,t,yt)),o=r.some(e=>vt.has(e)),s=O??(i?iD:o?aD:iO(r,_t,n.color));if(tp(n.label)){Qk(t,n.point,s,$k(e,1.05),a);return}Qk(t,n.point,s,$k(e),a)}),ie&&Bk(t,ie,e.graphics.lineWidth);let g=S?gt.map(n=>{let r=bt&&!oA(e,n.id,yt),i=vt.has(n.id);return iA(t,e,O??(r?iD:i?aD:_t.get(n.id)??`#d9e2ea`),n.id,n.label,n.point,aA(e,n.id).some(e=>E.includes(e)),!bt||oA(e,n.id,yt),rD.has(n.id),bt,o,a)}).filter(e=>e!==null):[];if(De.current=o?[...g,...c]:[],se&&ge.current){be.current?.();return}let v=e.graphics.drawWheelCircle?lk(ft):lk(st),y=lt.flatMap(e=>e.fitPoints),b=pt.flatMap(e=>e.fitPoints),C=[...SO(Ye,{includeCenterOfGravity:!_,optimizerKinematicsOnly:k}),...v,...y,...b,...ot].filter(yO);if(C.length===0){be.current?.();return}let w=e.graphics.drawWheelCircle?lk(it):lk(Ye.wheels),T=dt.flatMap(e=>e.fitPoints),te=mt.flatMap(e=>e.fitPoints),M=[...SO(Ye,{includeCenterOfGravity:!_,optimizerKinematicsOnly:k}),...w,...T,...te,...ot].filter(yO),ne=IA(M.length>0?M:C),N=LA(C,ne),P=Math.max(L.current?.clientWidth??1,1),re=Math.max(L.current?.clientHeight??1,1),ae=P/Math.max(re,1);r.far=Math.max(80,N*12),vD(r,P,re,i.target);let F=ne.clone();Ie.current=C,Pe.current=F.clone(),Fe.current=N;let ce=new W(-8.07,6.454,-8.441).clone().normalize(),le=BA(M.length>0?M:C,F,ce,GA(),ae);if(Ne.current={cameraPosition:F.clone().add(ce.multiplyScalar(le)),target:F.clone()},!ge.current){r instanceof ic&&(r.zoom=1),r.position.copy(Ne.current.cameraPosition),i.target.copy(Ne.current.target),vD(r,P,re,i.target),r.lookAt(Ne.current.target),xt(r,i),be.current?.();return}be.current?.()},[e,gt,se,fe,me,Ye,st,it,lt,ut,pt,ft,ht,_t,D,O,k,A,vt,E,x,S,_,b,ie,oe,at,ot,j,ee]),(0,h.useEffect)(()=>
4380{if(F===Le.current||(Le.current=F,F<=0))return;let e=_e.current,t=ye.current;if(!e||!t)return;if(ce===`default3D`&&Ne.current){e.up.set(0,1,0),e instanceof ic&&(e.zoom=1),e.position.copy(Ne.current.cameraPosition),t.target.copy(Ne.current.target),vD(e,Math.max(L.current?.clientWidth??1,1),Math.max(L.current?.clientHeight??1,1),t.target),e.lookAt(Ne.current.target),t.update(),xt(e,t),be.current?.();return}let n=ce===`rocker2D`&&_?_O(_.origin):Pe.current.clone(),r=ce===`rocker2D`&&_?UA(_,1):VA(ce,1),i=ce===`rocker2D`&&_?WA(_):HA(ce),a=BA(Ie.current,n,r,i,Math.max(L.current?.clientWidth??1,1)/Math.max(L.current?.clientHeight??1,1));e.up.copy(i),e instanceof ic&&(e.zoom=1),e.position.copy(n).add(r.normalize().multiplyScalar(a)),t.target.copy(n),vD(e,Math.max(L.current?.clientWidth??1,1),Math.max(L.current?.clientHeight??1,1),t.target),e.lookAt(n),t.update(),xt(e,t),be.current?.()},[_,ce,F]),(0,h.useEffect)(()=>{if(!le)return;let e=_e.current,t=ye.current;if(!e||!t)return;let n=_O(le.target),r=_O(le.cameraPosition),i=le.up?new W(le.up.x,le.up.z,-le.up.y).normalize():new W(0,1,0);e.up.copy(i),e instanceof ic&&(e.zoom=le.orthographicZoom??1),e.position.copy(r),t.target.copy(n),vD(e,Math.max(L.current?.clientWidth??1,1),Math.max(L.current?.clientHeight??1,1),t.target),e.lookAt(n),t.update(),xt(e,t),be.current?.()},[le,fe]),(0,Z.jsx)(`div`,{className:`viewport`,ref:L})}function JA(e,t){return e.document===t.document&&e.auxiliaryDocument===t.auxiliaryDocument&&e.auxiliaryOffset===t.auxiliaryOffset&&e.auxiliaryTyreProfile===t.auxiliaryTyreProfile&&e.fullVehicleMode===t.fullVehicleMode&&e.loadVectors===t.loadVectors&&e.referenceDocument===t.referenceDocument&&e.tyreProfile===t.tyreProfile&&e.tyreProfileOverlay===t.tyreProfileOverlay&&e.ghostWireframeDocument===t.ghostWireframeDocument&&e.ghostWireframeColor===t.ghostWireframeColor&&e.ghostWireframeLineWidth===t.ghostWireframeLineWidth&&e.ghostWireframeSegmentKinds===t.ghostWireframeSegmentKinds&&e.extremePoseMeshes===t.extremePoseMeshes&&e.extremePoseClashMeshes===t.extremePoseClashMeshes&&e.referenceGhostWireframeDocument===t.referenceGhostWireframeDocument&&e.customProjection===t.customProjection&&e.sideMode===t.sideMode&&e.themeMode===t.themeMode&&e.lightThemeActive===t.lightThemeActive&&e.showLeft===t.showLeft&&e.showPoints===t.showPoints&&e.hardpoints===t.hardpoints&&e.hardpointsLeft===t.hardpointsLeft&&e.selectedHardpointIds===t.selectedHardpointIds&&e.hardpointBoundaries===t.hardpointBoundaries&&e.monochromeColor===t.monochromeColor&&e.optimizerKinematicsOnly===t.optimizerKinematicsOnly&&e.uprightHighlightEnabled===t.uprightHighlightEnabled&&e.onHardpointSelect===t.onHardpointSelect&&e.onHardpointGroupSelect===t.onHardpointGroupSelect&&e.wheelEnvelopeMesh===t.wheelEnvelopeMesh&&e.stepGeometries===t.stepGeometries&&e.stepGeometryChassisTransform===t.stepGeometryChassisTransform&&e.stepClashDetectionEnabled===t.stepClashDetectionEnabled&&e.stepWheelbaseGuides===t.stepWheelbaseGuides&&e.stepWheelbaseDebugGuides===t.stepWheelbaseDebugGuides&&e.setupShimOverlay===t.setupShimOverlay&&e.setupUprightWheelOverrides===t.setupUprightWheelOverrides&&e.traceSteeringAxisEnvelope===t.traceSteeringAxisEnvelope&&e.isAnimating===t.isAnimating&&e.orthographic===t.orthographic&&e.resetViewToken===t.resetViewToken&&e.resetViewPreset===t.resetViewPreset&&e.captureView===t.captureView&&e.onViewInteraction===t.onViewInteraction&&e.onViewParametersChange===t.onViewParametersChange}var YA=(0,h.memo)(qA,JA),XA=2,ZA=800,QA=100,$A=`2.6 2.4`,ej=`1.2 2.8`,tj=.5,nj=.1,rj=new Set([`hs-right`,`rs-right`]),ij=new Set([`tlf-c`,`tlr-c`,`tlf-w`,`tlr-w`]),aj=`#9ca3af`,oj=`#ffea4d`,sj=`#f8d857`,cj=`#ef4444`,lj=`#f59e0b`,uj=`#3b82f6`,dj=`#22c55e`,fj=.325/.003,pj=11,mj=fj*2,hj=30,gj=.055,_j=18,vj=.18,yj=2.4,bj=1e5;function xj(e,t){return t===`XZ`?{x:-e.x,y:e.z}:t===`YX`?{x:-e.y,y:e.x}:{x:-e.y,y:e.z}}function Sj(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function Cj(e,t=0){if(Math.abs(t)<=1e-12)return e;let n=Math.cos(t),r=Math.sin(t);return{x:e.x*n-e.y*r,y:e.x*r+e.y*n}}function wj(e,t,n){if(!n)return xj(e,t);let r={x:e.x-n.origin.x,y:e.y-n.origin.y,z:e.z-n.origin.z},i=Sj(r,n.xAxis),a=Sj(r,n.yAxis);return Cj({x:-i,y:-a},n.displayRotationRad)}function Tj(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)&&Math.max(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z))<=bj}function Ej(e,t,n=0,r=null,i=null,a=null){let o=e.filter(Tj),s=(o.length>0?o:[{x:0,y:0,z:0}]).map(e=>wj(e,t,a)),c=s.map(e=>e.x),l=s.map(e=>e.y);if(a){let e=Math.max(...c.map(e=>Math.abs(e)),120),t=Math.max(...l.map(e=>Math.abs(e)),120),r=Math.max(e,t),i=Math.max(r*gj+n,_j),a=Math.max((r+i)*2,240);return`${-a*.5} ${-a*.5} ${a} ${a}`}let u=Math.min(...c,-100),d=Math.max(...c,100),f=Math.min(...l,-100),p=Math.max(...l,100);t===`YX`&&r===`left`&&(d=Math.min(d,0),u=Math.min(u,d-240)),t===`YX`&&r===`right`&&(u=Math.max(u,0),d=Math.max(d,u+240)),t===`YZ`&&i&&(d=Math.min(d,0),u=Math.min(u,d-240));let m=Math.max(d-u,240),h=Math.max(p-f,240),g=Math.max(Math.max(m,h)*gj+n,_j);return`${u-g} ${-(p+g)} ${m+g*2} ${h+g*2}`}function Dj(e){let[t,n,r,i]=e.split(` `).map(Number);return{x:t,y:n,width:r,height:i}}function Oj(e){return`${e.x} ${e.y}
4380 ${e.width} ${e.height}`}function kj(e,t,n){return Math.min(n,Math.max(t,e))}function Aj(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function jj(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}function Mj(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function Nj(e){let t=Math.hypot(e.x,e.y,e.z);return t<=1e-9?{x:1,y:0,z:0}:{x:e.x/t,y:e.y/t,z:e.z/t}}function Pj(e){return Number.isFinite(e)?Math.max(Math.abs(e),.5):1}function Fj(e){return Math.max((Number.isFinite(e)?Math.abs(e):0)/2,1)}function Ij(e){return e.kind===`mainSpring`&&(e.label===`Main spring`||e.label===`Outboard spring`)}function Lj(e){return!Number.isFinite(e)||e<=1e-9?0:e*.1}function Rj(e){return Aj(e.from,jj(Nj(e.vector),e.visualLengthMm??Lj(e.magnitude)))}function zj(e){let t=Nj(e.vector),n=Nj(Mj(Math.abs(t.z)<.86?{x:0,y:0,z:1}:{x:0,y:1,z:0},t)),r=Nj(Mj(t,n)),i=Math.max(e.visualLengthMm??80,42),a=-Math.PI*.7,o=Math.PI*.85;return Array.from({length:37},(t,s)=>{let c=s/36,l=a+(o-a)*c;return Aj(e.from,Aj(jj(n,Math.cos(l)*i),jj(r,Math.sin(l)*i)))})}function Bj(e){return e.visualStyle===`moment`?[e.from,...zj(e)]:[e.from,Rj(e)]}function Vj(e){return!Number.isFinite(e)||Math.abs(e)<=1e-9?`0`:String(Math.round(e))}function Hj(e){return`${e.label}: ${Vj(e.magnitude)} ${e.unit??`N`}`}function Uj(e){return`${Vj(e.magnitude)} ${e.unit??`N`}`}function Wj(e){return e.kind===`input`||e.kind===`reaction`||e.kind===`axial`}function Gj(e){if(e.visualStyle===`moment`){let t=zj(e);return t[t.length-1]??e.from}return Rj(e)}function Kj(e){return Number.isFinite(e)?Math.max(Math.abs(e),1):1}function qj(e){return Number.isFinite(e)?Math.max(Math.abs(e),tj):tj}function Jj(e){return qj(e)}function Yj(e){return Math.max(e*2.25,7)}function Xj(e,t,n,r,i){let a=e+Math.cos(r)*n,o=t+Math.sin(r)*n,s=e+Math.cos(i)*n,c=t+Math.sin(i)*n;return`M ${e} ${t} L ${a} ${o} A ${n} ${n} 0 ${+(Math.abs(i-r)>Math.PI)} 1 ${s} ${c} Z`}function Zj(e,t,n){let r=t.x-e.x,i=t.y-e.y;if(Math.hypot(r,i)<=1e-6)return null;let a=Math.max(n.width,n.height)*.5;if(Math.abs(r)>=Math.abs(i)&&Math.abs(r)>1e-9){let t=n.x-a,o=n.x+n.width+a,s=i/r;return{from:{x:t,y:e.y+(t-e.x)*s},to:{x:o,y:e.y+(o-e.x)*s}}}if(Math.abs(i)<=1e-9)return null;let o=n.y-a,s=n.y+n.height+a,c=r/i;return{from:{x:e.x+(o-e.y)*c,y:o},to:{x:e.x+(s-e.y)*c,y:s}}}function Qj(e){return e.kind===`antirollLink`||e.label.startsWith(`T-bar rocker guide`)||e.label.startsWith(`C-bar link guide`)||e.label.startsWith(`Mounting to `)||e.label.startsWith(`Integral link to `)||e.label===`Wheel center to tie rod`}function $j(e,t,n){return e||!Qj(n)?!1:t?n.side!==t:!0}function eM(e){return e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top ML - Bottom WB`}function tM(e){return e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top WB - Bottom ML`}function nM(e,t){return(t===`tlf-w`||t===`tlr-w`)&&!eM(e)?[`tlf-w`,`tlr-w`]:(t===`blf-w`||t===`blr-w`)&&!tM(e)?[`blf-w`,`blr-w`]:[t]}function rM(e,t,n){return nM(e,t).some(e=>n.includes(e))}function iM(e,t){let n=e.x-t.x,r=e.y-t.y,i=e.z-t.z;return n*n+r*r+i*i}function aM(e,t){let n=[];return e.forEach(e=>{t.forEach(t=>{iM(e,t.point)<=.25&&n.push(t.id)})}),Array.from(new Set(n))}function oM(e,t){let n=new Map;return e.forEach(e=>{aM([e.from,e.to],t).forEach(t=>{n.has(t)||n.set(t,e.color)})}),n}function sM(e,t,n){for(let n of e){let e=t.get(n);if(e)return e}return n}function cM(e,t,n){return nM(e,t).some(e=>n.has(e))}function lM(e,t){let n=e.suspension.macPherson||e.suspension.configuration===`Outboard Spring`;return e.suspension.macPherson&&(t===`TLF`||t===`TLR`)?!1:t===`S`?n?!1:e.graphics.drawMainSpring:!(t===`PR`&&n&&!e.graphics.drawMainSpring)}function uM(e,t,n){let r=Dj(e),i=r.width/t,a=r.height/t;return Oj({x:r.x+(r.width-i)*.5+n.x,y:r.y+(r.height-a)*.5+n.y,width:i,height:a})}function dM(e,t,n){if(t!==`YZ`&&t!==`YX`||!(n.includes(`left`)&&n.includes(`right`)))return e;let r=Dj(e),i=r.x,a=r.x+r.width,o=Math.max(Math.abs(i),Math.abs(a));if(!Number.isFinite(o)||o>=ZA)return e;let s=Math.min(ZA,o+QA*XA);return Oj({x:-s,y:r.y,width:s*2,height:r.height})}function fM(e){return[e[0],e[1],e[2],e[3],e[4],e[5]]}
4380function pM([e,t,n]){return[[Math.cos(t)*Math.cos(n),-Math.sin(t),Math.cos(t)*Math.sin(n)],[Math.cos(e)*Math.sin(t)*Math.cos(n)+Math.sin(e)*Math.sin(n),Math.cos(e)*Math.cos(t),Math.cos(e)*Math.sin(t)*Math.sin(n)-Math.sin(e)*Math.cos(n)],[Math.sin(e)*Math.sin(t)*Math.cos(n)-Math.cos(e)*Math.sin(n),Math.sin(e)*Math.cos(t),Math.sin(e)*Math.sin(t)*Math.sin(n)+Math.cos(e)*Math.cos(n)]]}function mM(e,t,n,r){let i=Nj(Mj(t,Math.abs(t.z)<.92?{x:0,y:0,z:1}:{x:1,y:0,z:0})),a=Nj(Mj(t,i)),o=[];for(let t=0;t<r;t+=1){let s=t/r*Math.PI*2,c=jj(i,Math.cos(s)*n),l=jj(a,Math.sin(s)*n);o.push(Aj(e,Aj(c,l)))}return o}function hM(e){let t=pM(fM(e.pose)),n=Nj({x:t[0][1],y:t[1][1],z:t[2][1]});return mM(e.center,n,e.radius,72)}function gM(e){let t=pM(fM(e.pose)),n=Nj({x:t[0][1],y:t[1][1],z:t[2][1]}),r=Math.min(Math.max(e.rimRadius,e.radius*.36),e.radius*.82);return mM(Aj(e.center,jj(n,e.rimOffset)),n,r,72)}function _M(e,t){let n=pM(fM(e));return Nj({x:n[0][t],y:n[1][t],z:n[2][t]})}function vM(e){return Math.min(Math.max(e*.34,58),120)}function yM(e){return e.map(e=>`${e.x},${-e.y}`).join(` `)}function bM(e,t){let n=pM(fM(e.pose)),r=Nj({x:n[0][1],y:n[1][1],z:n[2][1]}),i=e.width*.5,a=Aj(e.center,jj(r,i)),o=Aj(e.center,jj(r,-i)),s=a,c=o,l=Math.min(e.rimRadius,e.radius*.82),u=Math.min(e.width*.16,e.radius*.09),d=Math.min(e.width*.12,l*.08),f=Math.min(e.radius*.08,u*.75),p=Math.min(l*.08,d*.75),m=Math.min(e.radius*.95,l+p),h=Aj(s,jj(r,-u)),g=Aj(c,jj(r,u)),_=Aj(s,jj(r,-d)),v=Aj(c,jj(r,d)),y=mM(s,r,e.radius-f,36),b=mM(c,r,e.radius-f,36),x=mM(h,r,e.radius,36),S=mM(g,r,e.radius,36),C=mM(s,r,m,36),w=mM(c,r,m,36),T=mM(_,r,l,36),E=mM(v,r,l,36);return{frontTyreCap:y.map(e=>xj(e,t)),backTyreCap:b.map(e=>xj(e,t)),frontTyreShoulder:x.map(e=>xj(e,t)),backTyreShoulder:S.map(e=>xj(e,t)),frontRimCap:C.map(e=>xj(e,t)),backRimCap:w.map(e=>xj(e,t)),frontRimShoulder:T.map(e=>xj(e,t)),backRimShoulder:E.map(e=>xj(e,t)),frontCenter:xj(h,t),backCenter:xj(g,t)}}function xM(e,t,n){if(!n)return bM(e,t);let r=pM(fM(e.pose)),i=Nj({x:r[0][1],y:r[1][1],z:r[2][1]}),a=e.width*.5,o=Aj(e.center,jj(i,a)),s=Aj(e.center,jj(i,-a)),c=o,l=s,u=Math.min(e.rimRadius,e.radius*.82),d=Math.min(e.width*.16,e.radius*.09),f=Math.min(e.width*.12,u*.08),p=Math.min(e.radius*.08,d*.75),m=Math.min(u*.08,f*.75),h=Math.min(e.radius*.95,u+m),g=Aj(c,jj(i,-d)),_=Aj(l,jj(i,d)),v=Aj(c,jj(i,-f)),y=Aj(l,jj(i,f)),b=mM(c,i,e.radius-p,36),x=mM(l,i,e.radius-p,36),S=mM(g,i,e.radius,36),C=mM(_,i,e.radius,36),w=mM(c,i,h,36),T=mM(l,i,h,36),E=mM(v,i,u,36),D=mM(y,i,u,36);return{frontTyreCap:b.map(e=>wj(e,t,n)),backTyreCap:x.map(e=>wj(e,t,n)),frontTyreShoulder:S.map(e=>wj(e,t,n)),backTyreShoulder:C.map(e=>wj(e,t,n)),frontRimCap:w.map(e=>wj(e,t,n)),backRimCap:T.map(e=>wj(e,t,n)),frontRimShoulder:E.map(e=>wj(e,t,n)),backRimShoulder:D.map(e=>wj(e,t,n)),frontCenter:wj(g,t,n),backCenter:wj(_,t,n)}}function SM(e,t,n){let r=wj(e,t,n);return`${r.x},${-r.y}`}function CM(e,t,n=!1){return e.length===0?``:(n?[...e,e[0]]:e).map(e=>{let n=xj(e,t);return`${n.x},${-n.y}`}).join(` `)}function wM(e,t,n,r=!1){return n?e.length===0?``:(r?[...e,e[0]]:e).map(e=>{let r=wj(e,t,n);return`${r.x},${-r.y}`}).join(` `):CM(e,t,r)}function TM(e,t,n,r){let i={x:t.x-e.x,y:t.y-e.y,z:t.z-e.z};if(Math.hypot(i.x,i.y,i.z)<1e-6)return null;let a=Nj(i),o=Nj(Mj(a,Math.abs(a.z)<.92?{x:0,y:0,z:1}:{x:1,y:0,z:0})),s=Nj(Mj(a,o)),c=Pj(n),l=Math.max(72,Math.round(c*20)),u=Fj(r),d=jj(i,1-nj*2),f=Aj(e,jj(i,nj)),p=Aj(t,jj(i,-nj)),m=[];for(let e=0;e<=l;e+=1){let t=e/l,n=t*c*Math.PI*2,r=Aj(f,jj(d,t)),i=Aj(jj(o,Math.cos(n)*u),jj(s,Math.sin(n)*u));m.push(Aj(r,i))}return{body:m,startCap:mM(f,a,u,36),endCap:mM(p,a,u,36)}}function EM(e,t,n,r,i,a){let o=TM(e,t,r,i);if(!o){let r=wj(e,n,a),i=wj(t,n,a);return{body:`${r.x},${-r.y} ${i.x},${-i.y}`,startCap:``,endCap:``}}return{body:wM(o.body,n,a),startCap:wM(o.startCap,n,a,!0),endCap:wM(o.endCap,n,a,!0)}}function DM(e){if(e.length===0)return null;let t=e.map(e=>e.x),n=Math.min(...t),r=Math.max(...t),i=Math.max(r-n,220),a=mj,o=Math.max(i*.2,140),s=a+o,c=Math.min(58,Math.max(34,o*.28)),l=Math.min(34,Math.max(16,c*.48));return{start:{x:a,y:0,z:0},tip:{x:s,y:0,z:0},headA:{x:s-c,y:0+l,z:0},headB:{x:s-c,y:0-l,z:0}}}function OM(e){return[{x:e.center.x+e.radius,y:e.center.y+e.width*.5,z:e.center.z+e.radiu
4380s},{x:e.center.x+e.radius,y:e.center.y-e.width*.5,z:e.center.z-e.radius},{x:e.center.x-e.radius,y:e.center.y+e.width*.5,z:e.center.z+e.radius},{x:e.center.x-e.radius,y:e.center.y-e.width*.5,z:e.center.z-e.radius},e.center]}function kM(e,t){let n=Dj(e),r=Math.max(Math.min(n.width,n.height)*.18,48),i=Math.max(t.yAxisReferenceDistanceMm??r,r),a={x:0,y:0},o=Math.max(r*.08,7),s=t.displayRotationRad??0,c=Math.max(r*.08,10);return{xAxis:{from:{x:0,y:0},to:Cj({x:-r,y:0},s)},yAxis:{from:{x:0,y:0},to:Cj({x:0,y:-i},s)},zIndicatorCenter:a,zIndicatorRadius:o,xLabel:Cj({x:-r-c,y:r*.06},s),yLabel:Cj({x:r*.05,y:-i-c},s),zLabel:{x:a.x+o+10,y:a.y+o+8}}}var AM={YZ:{title:`YZ Plane`,subtitle:`Rear view`},YX:{title:`YX Plane`,subtitle:`Plan view`},XZ:{title:`XZ Plane`,subtitle:`Side view`}};function jM({document:e,auxiliaryDocument:t=null,auxiliaryOffset:n=null,auxiliaryTyreProfile:r=null,loadVectors:i=[],referenceDocument:a,tyreProfile:o=null,plane:s,customProjection:c=null,showLeft:l,showPoints:u,hardpoints:d=[],hardpointsLeft:f=[],rockerOperationalHardpointIds:p=[],selectedHardpointIds:m=[],uprightHighlightEnabled:g=!1,onHardpointSelect:_,onHardpointGroupSelect:v,zoom:y,baseZoom:b=1,onZoomChange:x,resetToken:S,isAnimating:C=!1,sharedPanY:w,onSharedPanYChange:T,sharedSpan:E,sideMode:D=`auto`,showTools:O=!0,panelClassName:k,onPanelDoubleClick:A}){let j=!c&&s===`YX`,ee=a??e,te=ee.geometry.left.wheelCenter.y>=ee.geometry.right.wheelCenter.y?`left`:`right`,M=Number.isFinite(b)&&b>0?b:1,[ne,N]=(0,h.useState)(M),[P,re]=(0,h.useState)({x:0,y:0}),ie=(0,h.useRef)(null),ae=(0,h.useId)(),oe=(0,h.useRef)(null),se=y??ne,F=Math.round(se/M*100),ce=x??N,le=(0,h.useMemo)(()=>`load-arrow-${ae.replace(/[^a-zA-Z0-9_-]/g,``)}`,[ae]),ue=(0,h.useMemo)(()=>`reference-axis-arrow-${ae.replace(/[^a-zA-Z0-9_-]/g,``)}`,[ae]),I=(s===`YX`||s===`YZ`)&&w!==void 0&&T!==void 0,de=(0,h.useMemo)(()=>({x:I?w:P.x,y:P.y}),[P.x,P.y,w,I]),fe=(0,h.useMemo)(()=>j?[te]:l?[`left`,`right`]:[`right`],[l,j,te]),pe=(0,h.useMemo)(()=>D===`left-only`?[`left`]:D===`right-only`?[`right`]:D===`both`?[`left`,`right`]:fe,[fe,D]),me=!l&&pe.length===1?pe[0]:null,he=(0,h.useMemo)(()=>_m(e,pe),[e,pe]),L=(0,h.useMemo)(()=>vm(e,t,n,pe),[t,n,e,pe]),ge=e.graphics.solid2dWheels,R=Math.max(0,Math.min(100,e.graphics.wheelOpacityPercent))/100,_e=(0,h.useMemo)(()=>_m(ee,pe),[ee,pe]),ve=(0,h.useMemo)(()=>jp(ee,pe),[ee,pe]),ye=(0,h.useMemo)(()=>Ip(e,t,n,pe),[t,n,e,pe]),z=(0,h.useMemo)(()=>Ip(e,t,n,pe),[t,n,e,pe]),be=(0,h.useMemo)(()=>{if(!e.graphics.drawWheels)return[];let i=(e,t)=>t?Qw(e,t,36):ge?$w(e,36):[],a=t&&n?pe.length:0;return a===0?i(L.wheels,o):[...i(L.wheels.slice(0,a),r),...i(L.wheels.slice(a),o)]},[t,n,r,e.graphics.drawWheels,L.wheels,pe.length,ge,o]),B=(0,h.useMemo)(()=>e.graphics.drawWheels?Qw(he.wheels,o,36):[],[e.graphics.drawWheels,he.wheels,o]),xe=(0,h.useMemo)(()=>new Map(be.map(e=>[e.wheel,e])),[be]),Se=(0,h.useMemo)(()=>e.graphics.drawWheels?Qw(ve,o,36):[],[e.graphics.drawWheels,ve,o]),Ce=(0,h.useMemo)(()=>c?[]:[{x:fj,y:0,z:0},{x:0,y:fj,z:0},{x:0,y:0,z:fj}],[c]),we=(0,h.useMemo)(()=>[...ym(he,{includeRollCenter:!1,includeCenterOfGravity:!1,includeSteeringColumnAndWheel:!1}),...ym(_e,{includeRollCenter:!1,includeCenterOfGravity:!1,includeSteeringColumnAndWheel:!1}),...B.flatMap(e=>e.fitPoints),...Se.flatMap(e=>e.fitPoints),...Ce],[Ce,he,B,_e,Se]),Te=(0,h.useMemo)(()=>i.filter(e=>!e.side||pe.includes(e.side)),[i,pe]),Ee=(0,h.useMemo)(()=>Te.flatMap(Bj),[Te]),De=(0,h.useMemo)(()=>e.graphics.drawArrow?DM(we):null,[e.graphics.drawArrow,we]),Oe=(0,h.useMemo)(()=>{if(!De||s!==`XZ`)return De;let e=Math.abs(De.headA.y-De.start.y);return{...De,headA:{...De.headA,y:0,z:e},headB:{...De.headB,y:0,z:-e}}},[De,s]),ke=(0,h.useMemo)(()=>Oe?[Oe.start,Oe.tip,Oe.headA,Oe.headB]:[],[Oe]),Ae=(0,h.useMemo)(()=>new Set(p),[p]),je=c&&Ae.size>0,Me=(0,h.useMemo)(()=>{let t=pe.includes(`left`),n=pe.includes(`right`),r=t=>e.suspension.macPherson?t.filter(e=>!ij.has(e.id)):t;if(!c&&s===`YX`){let e=[];return n&&r(d.length>0?d:f.map(e=>({...e,point:{...e.point,y:-e.point.y}}))).forEach(t=>{e.push({id:t.id,label:t.label,point:t.point,key:`${t.id}-right`,nonSelectable:rj.has(t.id)})}),t&&r(f.length>0?f:d.map(e=>({...e,point:{...e.point,y:-e.point.y}}
4380))).forEach(t=>{e.push({id:t.id,label:t.label,point:t.point,key:`${t.id}-left`,nonSelectable:rj.has(t.id)})}),e}let i=[];return n&&r(d).forEach(e=>{i.push({id:e.id,label:e.label,point:e.point,key:`${e.id}-right`,nonSelectable:rj.has(e.id)})}),t&&(f.length>0?r(f).forEach(e=>{i.push({id:e.id,label:e.label,point:e.point,key:`${e.id}-left`,nonSelectable:rj.has(e.id)})}):r(d).forEach(e=>{Math.abs(e.point.y)>1e-8&&i.push({id:e.id,label:e.label,point:{...e.point,y:-e.point.y},key:`${e.id}-left`,nonSelectable:rj.has(e.id)})})),i},[e.suspension.macPherson,d,f,s,pe]),Ne=(0,h.useMemo)(()=>oM(L.segments,Me),[Me,L.segments]),Pe=(0,h.useMemo)(()=>g?new Set(om(e)):new Set,[e,g]),Fe=(0,h.useCallback)(t=>!je||t.length===0?!1:!t.some(t=>cM(e,t,Ae)),[e,je,Ae]),Ie=(0,h.useMemo)(()=>{if(!c)return we;let e=[...d,...f].map(e=>e.point),t=ve.flatMap(e=>OM(e));return[...e,...t,...we]},[c,d,f,we,ve]),Le=c?[...Ie,...Ee]:[...we,...ke],Re=!c&&s===`YX`&&pe.length===1?D===`auto`?`left`:pe[0]:null,ze=!c&&s===`YZ`&&(D===`left-only`||D===`right-only`)?pe[0]:null,V=(0,h.useMemo)(()=>{if(s!==`YZ`||!ze)return 0;let e=pe[0];return(ve.find(t=>t.side===e)?.center.y??we.find(e=>Math.abs(e.y)>1e-8)?.y??1)>=0?1:-1},[s,we,ve,pe,ze]),Be=(0,h.useMemo)(()=>{if(c||s!==`YZ`||!ze||V===0)return Le;let e=Le.filter(e=>V>0?e.y>=-1e-6:e.y<=1e-6);return e.length>0?e:Le},[c,s,Le,ze,V]),Ve=(0,h.useMemo)(()=>Ej(Be,s,ee.vehicle.wheelRadius*vj,Re,ze,c),[c,s,Be,ee,Re,ze]),He=(0,h.useMemo)(()=>{if(c||pe.length!==2||s!==`YZ`&&s!==`YX`)return Ve;let e=Be.filter(Tj);if(e.length===0)return Ve;let t=t=>({min:Math.min(...e.map(e=>e[t]),-100),max:Math.max(...e.map(e=>e[t]),100)}),n=t(`x`),r=t(`y`),i=t(`z`),a=Math.max(n.max-n.min,240),o=Math.max(r.max-r.min,240),l=Math.max(i.max-i.min,240),u=Math.max(Math.max(a,o,l)*gj+ee.vehicle.wheelRadius*vj,_j),d=Dj(Ve),f=Math.max(a,l)+u*2;return Oj({x:-r.max-u,y:d.y+d.height*.5-f*.5,width:o+u*2,height:f})},[Ve,c,s,pe.length,Be,ee.vehicle.wheelRadius]),Ue=(0,h.useMemo)(()=>{if(!E||!Number.isFinite(E)||E<=0)return He;let e=Dj(He),t=Math.max(E,e.width,e.height,220),n=e.y+e.height*.5;return Oj({x:e.x+e.width*.5-t*.5,y:n-t*.5,width:t,height:t})},[E,He]),We=(0,h.useMemo)(()=>c?Ue:dM(Ue,s,pe),[c,s,Ue,pe]);C?ie.current??=We:ie.current=null;let Ge=ie.current??We,Ke=(0,h.useMemo)(()=>uM(Ge,se,de),[de,Ge,se]),qe=(0,h.useMemo)(()=>Dj(Ke),[Ke]),Je=(0,h.useMemo)(()=>{let e=qe.width*2,t=qe.height*2;return{horizontal:{x1:qe.x-e,y1:0,x2:qe.x+qe.width+e,y2:0},vertical:{x1:0,y1:-(qe.y-t),x2:0,y2:-(qe.y+qe.height+t)}}},[qe]),Ye=(0,h.useMemo)(()=>{if(c)return[];let e=xj({x:0,y:0,z:0},s);return[{label:`X`,color:lj,endpoint:{x:fj,y:0,z:0}},{label:`Y`,color:uj,endpoint:{x:0,y:fj,z:0}},{label:`Z`,color:dj,endpoint:{x:0,y:0,z:fj}}].flatMap(({label:t,color:n,endpoint:r})=>{let i=xj(r,s),a={x:e.x,y:-e.y},o={x:i.x,y:-i.y},c=o.x-a.x,l=o.y-a.y,u=Math.hypot(c,l);return u<=1e-6?[]:[{label:t,color:n,from:a,to:o,labelPosition:{x:o.x+c/u*pj,y:o.y+l/u*pj}}]})},[c,s]),{title:Xe,subtitle:Ze}=c??AM[s],Qe=(0,h.useMemo)(()=>c?kM(Ke,c):null,[c,Ke]),$e=(0,h.useMemo)(()=>{if(!e.graphics.drawGroundLine||c||s!==`YZ`)return null;let t=L.points.filter(e=>e.label===`CP`&&(e.side===`left`||e.side===`right`));if(t.length<2)return null;let n=t.find(e=>e.side===`left`)?.point,r=t.find(e=>e.side===`right`)?.point;if(!n||!r)return null;let i=xj(n,s),a=xj(r,s);return Zj({x:i.x,y:-i.y},{x:a.x,y:-a.y},qe)},[qe,c,e.graphics.drawGroundLine,L.points,s]);(0,h.useEffect)(()=>{y===void 0&&N(M)},[s,y,M]),(0,h.useEffect)(()=>{re({x:0,y:0}),I&&T(0),oe.current=null},[c,T,s,l,D,I]),(0,h.useEffect)(()=>{re({x:0,y:0}),I&&T(0),oe.current=null,ce(M)},[T,S,ce,I,M]);function et(e){e.preventDefault(),ce(t=>kj(t*(e.deltaY<0?1.14:.88),.45,6))}function tt(){typeof window<`u`&&window.getSelection?.()?.removeAllRanges(),A?.()}function nt(e){e.button===2&&(e.preventDefault(),oe.current={x:e.clientX,y:e.clientY})}function rt(e){if(!oe.current)return;e.preventDefault();let t=e.currentTarget.getBoundingClientRect(),n=Dj(Ke),r=e.clientX-oe.current.x,i=e.clientY-oe.current.y;oe.current={x:e.clientX,y:e.clientY};let a=r*n.width/Math.max(t.width,1),o=i*n.height/Math.max(t.height,1);re(e=>({x:I?e.x:e.x-a,y:e.y-o})),I&&T(e=>e-a)}function it(e){e.button===2&&(oe.current=null)}function at(){oe.current=null}function ot(e,t){e.stopPropagation();let n=e.currentTarget.ownerSVGElement,r=n?.getScreenCTM(),i=t;if(n&&r){let a=n.createSVGPoint();a.x=e.clientX,a.y=e.clientY;let o=a.matrixTransform(r.inverse()),l=hj*hj;
4380Me.forEach(e=>{let n=wj(e.point,s,c),r=o.x-n.x,a=o.y+n.y,u=r*r+a*a,d=e.key===t.key;(u<l-1e-6||Math.abs(u-l)<=1e-6&&d)&&(l=u,i=e)})}_?.(i.id,e.ctrlKey||e.metaKey)}return(0,Z.jsxs)(`section`,{className:`projection-panel${k?` ${k}`:``}`,onDoubleClick:tt,children:[(0,Z.jsxs)(`div`,{className:`projection-title`,children:[(0,Z.jsx)(`strong`,{children:Xe}),(0,Z.jsx)(`span`,{children:Ze})]}),O?(0,Z.jsxs)(`div`,{className:`projection-tools`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>ce(e=>kj(e*1.2,.45,6)),children:`+`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>ce(e=>kj(e/1.2,.45,6)),children:`-`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{ce(M),re({x:0,y:0}),I&&T(0)},children:`1:1`}),(0,Z.jsxs)(`span`,{children:[F,`%`]})]}):null,(0,Z.jsxs)(`svg`,{viewBox:Ke,role:`img`,"aria-label":`${Xe}`,preserveAspectRatio:`xMidYMid meet`,onWheel:et,onMouseDown:nt,onMouseMove:rt,onMouseUp:it,onMouseLeave:at,onClick:e=>{e.target===e.currentTarget&&v?.([],!1)},onContextMenu:e=>e.preventDefault(),children:[(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)(`marker`,{id:le,viewBox:`0 0 10 10`,refX:`8.6`,refY:`5`,markerWidth:`4.8`,markerHeight:`4.8`,orient:`auto-start-reverse`,markerUnits:`strokeWidth`,children:(0,Z.jsx)(`path`,{d:`M 0 1.3 L 9 5 L 0 8.7 z`,fill:`context-stroke`,opacity:`0.86`})}),(0,Z.jsx)(`marker`,{id:ue,viewBox:`0 0 10 10`,refX:`8.5`,refY:`5`,markerWidth:`5.4`,markerHeight:`5.4`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,Z.jsx)(`path`,{d:`M 0 1.2 L 9 5 L 0 8.8 z`,fill:`context-stroke`})})]}),(0,Z.jsxs)(`g`,{"aria-hidden":`true`,className:`projection-origin-axes`,children:[(0,Z.jsx)(`line`,{x1:Je.horizontal.x1,y1:Je.horizontal.y1,x2:Je.horizontal.x2,y2:Je.horizontal.y2,stroke:`#566273`,strokeWidth:.55,strokeDasharray:$A,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`line`,{x1:Je.vertical.x1,y1:Je.vertical.y1,x2:Je.vertical.x2,y2:Je.vertical.y2,stroke:`#566273`,strokeWidth:.55,strokeDasharray:$A,vectorEffect:`non-scaling-stroke`})]}),Ye.length>0?(0,Z.jsx)(`g`,{"aria-hidden":`true`,className:`absolute-reference-axes-2d`,children:Ye.map(e=>(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`line`,{x1:e.from.x,y1:e.from.y,x2:e.to.x,y2:e.to.y,stroke:e.color,strokeWidth:1.35,strokeLinecap:`round`,markerEnd:`url(#${ue})`,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`text`,{x:e.labelPosition.x,y:e.labelPosition.y,fill:e.color,stroke:`var(--color-bg)`,strokeWidth:2.5,paintOrder:`stroke`,fontSize:12,fontWeight:800,textAnchor:`middle`,dominantBaseline:`middle`,children:e.label})]},`${s}-${e.label}`))}):null,Qe?(0,Z.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,Z.jsx)(`line`,{x1:Qe.xAxis.from.x,y1:-Qe.xAxis.from.y,x2:Qe.xAxis.to.x,y2:-Qe.xAxis.to.y,stroke:`#f59e0b`,strokeWidth:.65,strokeDasharray:$A,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`line`,{x1:Qe.yAxis.from.x,y1:-Qe.yAxis.from.y,x2:Qe.yAxis.to.x,y2:-Qe.yAxis.to.y,stroke:`#3b82f6`,strokeWidth:.65,strokeDasharray:$A,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`circle`,{cx:Qe.zIndicatorCenter.x,cy:-Qe.zIndicatorCenter.y,r:Qe.zIndicatorRadius,fill:`none`,stroke:`#22c55e`,strokeWidth:.8,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`circle`,{cx:Qe.zIndicatorCenter.x,cy:-Qe.zIndicatorCenter.y,r:Math.max(Qe.zIndicatorRadius*.28,2.2),fill:`#22c55e`}),(0,Z.jsx)(`text`,{x:Qe.xLabel.x,y:-Qe.xLabel.y,fill:`#f59e0b`,fontSize:`25`,fontWeight:`700`,textAnchor:`middle`,dominantBaseline:`middle`,children:`xR`}),(0,Z.jsx)(`text`,{x:Qe.yLabel.x,y:-Qe.yLabel.y,fill:`#3b82f6`,fontSize:`25`,fontWeight:`700`,textAnchor:`middle`,dominantBaseline:`middle`,children:`yR`}),(0,Z.jsx)(`text`,{x:Qe.zLabel.x,y:-Qe.zLabel.y,fill:`#22c55e`,fontSize:`25`,fontWeight:`700`,textAnchor:`middle`,dominantBaseline:`middle`,children:`zR`})]}):null,!c&&(s===`YX`||s===`XZ`)&&Oe?(0,Z.jsxs)(`g`,{className:`travel-arrow-2d`,children:[(0,Z.jsx)(`line`,{x1:xj(Oe.start,s).x,y1:-xj(Oe.start,s).y,x2:xj(Oe.tip,s).x,y2:-xj(Oe.tip,s).y}),(0,Z.jsx)(`line`,{x1:xj(Oe.headA,s).x,y1:-xj(Oe.headA,s).y,x2:xj(Oe.tip,s).x,y2:-xj(Oe.tip,s).y}),(0,Z.jsx)(`line`,{x1:xj(Oe.headB,s).x,y1:-xj(Oe.headB,s).y,x2:xj(Oe.tip,s).x,y2:-xj(Oe.tip,s).y})]}):null,$e?(0,Z.jsx)(`g`,{"aria-hidden":`true`,className:`ground-line-2d`,children:(0,Z.jsx)(`line`,{x1:$e.from.x,y1:$e.from.y,x2:$e.to.x,y2:$e.to.y,stroke:`#aab4c2`,strokeWidth:Jj(e.graphics.virtualLineWidth),strokeDasharray:ej,strokeLinecap:`butt`,opacity:.42,vectorEffect:`non-scaling-stroke`})}):null,(0,Z.jsx)(`g`,{children:L.wheels.map((e,t)=>{if(s===`YX`||s===`YZ`||s===`XZ`){let n=ge?`wheel-layer-2d wheel-layer-2d-solid`:`wheel-layer-2d wheel-layer-2d-wire`,r=xe.get(e);if(r)return(0,Z.jsxs)(`g`,{className:n,children:[r.quads.map((t,n)=>(0,Z.jsx)(`polygon`,{points:yM(t.map(e=>wj(e,s,c))),className:`wheel-shell-2d`,style:ge?{fill:e.color,fillOpacity:R,stroke:`none`}:void 0},`${s}-${e.side}-tyre-profile-${n}`)),ge?r.innerQuads.map((t,n)=>(0,Z.jsx)(`polygon`,{points:yM(t.map(e=>wj(e,s,c))),className:`wheel-shell-2d`,style:{fill:`#2e3741`,fillOpacity:R*.72,stroke:`none`}},`${s}-${e.side}-tyre-inner-${n}`)):null,!ge&&s===`YZ`?(0,Z.jsx)(`polyline`,{points:yM(r.profileCurve.map(e=>wj(e,s,c))),className:`wheel-centerline-2d`}):null]},`${s}-${e.side}-wheel-${t}`);let i=xM({center:e.center,width:e.width,radius:e.radius,rimRadius:e.rimRadius,pose:e.pose}
4380,s,c),a=i.frontTyreShoulder.length,o=[0,Math.floor(a*.25),Math.floor(a*.5),Math.floor(a*.75)],l=i.frontTyreShoulder.map((t,n)=>{let r=(n+1)%i.frontTyreShoulder.length;return(0,Z.jsx)(`polygon`,{points:yM([i.frontTyreShoulder[n],i.frontTyreShoulder[r],i.backTyreShoulder[r],i.backTyreShoulder[n]]),className:`wheel-shell-2d`},`${s}-${e.side}-tyre-shell-${n}`)}),u=i.frontRimShoulder.map((t,n)=>{let r=(n+1)%i.frontRimShoulder.length;return(0,Z.jsx)(`polygon`,{points:yM([i.frontRimShoulder[n],i.frontRimShoulder[r],i.backRimShoulder[r],i.backRimShoulder[n]]),className:`wheel-rim-shell-2d`},`${s}-${e.side}-rim-shell-${n}`)}),d=i.frontTyreCap.map((t,n)=>{let r=(n+1)%i.frontTyreCap.length;return(0,Z.jsx)(`polygon`,{points:yM([i.frontTyreCap[n],i.frontTyreCap[r],i.frontTyreShoulder[r],i.frontTyreShoulder[n]]),className:`wheel-shell-2d`},`${s}-${e.side}-tyre-front-bevel-${n}`)}),f=i.backTyreCap.map((t,n)=>{let r=(n+1)%i.backTyreCap.length;return(0,Z.jsx)(`polygon`,{points:yM([i.backTyreCap[n],i.backTyreCap[r],i.backTyreShoulder[r],i.backTyreShoulder[n]]),className:`wheel-shell-2d`},`${s}-${e.side}-tyre-back-bevel-${n}`)}),p=i.frontRimCap.map((t,n)=>{let r=(n+1)%i.frontRimCap.length;return(0,Z.jsx)(`polygon`,{points:yM([i.frontRimCap[n],i.frontRimCap[r],i.frontRimShoulder[r],i.frontRimShoulder[n]]),className:`wheel-rim-shell-2d`},`${s}-${e.side}-rim-front-bevel-${n}`)});return(0,Z.jsxs)(`g`,{className:n,children:[f,i.backRimCap.map((t,n)=>{let r=(n+1)%i.backRimCap.length;return(0,Z.jsx)(`polygon`,{points:yM([i.backRimCap[n],i.backRimCap[r],i.backRimShoulder[r],i.backRimShoulder[n]]),className:`wheel-rim-shell-2d`},`${s}-${e.side}-rim-back-bevel-${n}`)}),l,u,d,p,(0,Z.jsx)(`polygon`,{points:yM(i.backTyreCap),className:`wheel-2d wheel-section-2d wheel-cap-back-2d`}),(0,Z.jsx)(`polygon`,{points:yM(i.backRimCap),className:`wheel-rim-2d wheel-section-2d wheel-cap-back-2d`}),(0,Z.jsx)(`polygon`,{points:yM(i.frontTyreCap),className:`wheel-2d wheel-section-2d`}),(0,Z.jsx)(`polygon`,{points:yM(i.frontRimCap),className:`wheel-rim-2d wheel-section-2d`}),ge?null:o.map(t=>(0,Z.jsx)(`line`,{x1:i.frontTyreShoulder[t].x,y1:-i.frontTyreShoulder[t].y,x2:i.backTyreShoulder[t].x,y2:-i.backTyreShoulder[t].y,className:`wheel-centerline-2d`},`${s}-${e.side}-connector-${t}`)),ge?null:(0,Z.jsx)(`line`,{x1:i.frontCenter.x,y1:-i.frontCenter.y,x2:i.backCenter.x,y2:-i.backCenter.y,className:`wheel-centerline-2d`})]},`${s}-${e.side}-wheel-${t}`)}return null})}),e.graphics.drawWheelCircle?(0,Z.jsx)(`g`,{className:`wheel-circle-layer-2d`,children:z.map((t,n)=>{let r=hM({center:t.center,radius:t.radius,pose:t.pose});if(r.length===0)return null;let i=r.map(e=>wj(e,s,c)),a=i[0];return a?(0,Z.jsx)(`polyline`,{points:yM([...i,a]),className:`wheel-circle-2d`,strokeWidth:qj(e.graphics.virtualLineWidth)},`${s}-${t.side}-wheel-circle-${n}`):null})}):null,e.graphics.drawOffsetRim?(0,Z.jsx)(`g`,{className:`rim-offset-layer-2d`,children:ye.map((t,n)=>{let r=gM({center:t.center,radius:t.radius,rimRadius:t.rimRadius,rimOffset:t.rimOffset,pose:t.pose});if(r.length===0)return null;let i=r.map(e=>wj(e,s,c)),a=i[0];return a?(0,Z.jsx)(`polyline`,{points:yM([...i,a]),className:`rim-offset-circle-2d`,strokeWidth:qj(e.graphics.virtualLineWidth)},`${s}-${t.side}-rim-offset-${n}`):null})}):null,(0,Z.jsx)(`g`,{children:L.faces.map((e,t)=>{let n=e.selectable===!1?[]:aM(e.points,Me),r=Fe(n),i=g&&e.kind===`upright`,a=r?aj:i?sj:e.color;return(0,Z.jsx)(`polygon`,{points:e.points.map(e=>SM(e,s,c)).join(` `),fill:a,opacity:i?.54:Math.min(e.opacity,.42),stroke:a,strokeWidth:3,vectorEffect:`non-scaling-stroke`,onClick:e=>{n.length!==0&&(e.stopPropagation(),v?.(n,e.ctrlKey||e.metaKey))}},`${s}-${e.side}-${e.label}-${t}`)})}),(0,Z.jsx)(`g`,{children:L.segments.map((t,n)=>{if($j(l,me,t)||t.kind===`groundLine`||s!==`YZ`&&t.kind===`rollCenter`)return null;let r=Ij(t),i=r||t.kind===`heaveSpring`||t.kind===`rollSpring`||t.kind===`mainSpring`,a=t.selectable===!1?[]:aM([t.from,t.to],Me),o=Fe(a),u=o?aj:t.color,d=o?aj:u===`#9ca3af`?u:`#8bd450`;if(i){if(!(r||t.kind===`heaveSpring`||t.kind===`rollSpring`)||e.graphics.drawSprings){let r=EM(t.from,t.to,s,e.graphics.springTurns,e.graphics.springDiameter,c);return(0,Z.jsxs)(`g`,{onClick:e=>{a.length!==0&&(e.stopPropagation(),v?.(a,e.ctrlKey||e.metaKey))},children:[(0,Z.jsx)(`polyline`,{points:r.body,stroke:u,strokeWidth:Kj(e.graphics.linkWidth2D),fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`}),r.startCap?(0,Z.jsx)(`polyline`,{points:r.startCap,stroke:u,strokeWidth:Kj(e.graphics.linkWidth2D),fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`}):null,r.endCap?(0,Z.jsx)(`polyline`,{points:r.endCap,stroke:u,strokeWidth:Kj(e.graphics.linkWidth2D),fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`}):null,(0,Z.jsx)(`line`,{x1:wj(t.from,s,c).x,y1:-wj(t.from,s,c).y,x2:wj(t.to,s,c).x,y2:-wj(t.to,s,c).y,stroke:d,strokeWidth:qj(e.graphics.virtualLineWidth),strokeDasharray:$A,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`})]},`${s}-${t.label}-${n}`)}return(0,Z.jsx)(`line`,{x1:wj(t.from,s,c).x,y1:-wj(t.from,s,c).y,x2:wj(t.to,s,c).x,y2:-wj(t.to,s,c).y,stroke:d,strokeWidth:qj(e.graphics.virtualLineWidth),strokeDasharray:$A,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`},`${s}-${t.label}-${n}`)}return(0,Z.jsx)(`line`,{x1:wj(t.from,s,c).x,y1:-wj(t.from,s,c).y,x2:wj(t.to,s,c).x,y2:-wj(t.to,s,c).y,stroke:u,strokeWidth:t.dashed||t.kind===`rollAxis`?qj(e.graphics.virtualLineWidth):Kj(e.graphics.linkWidth2D),strokeDasharray:t.dashed?$A:void 0,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`,onClick:e=>{a.length!==0&&(e.stopPropagation(),v?.(a,e.ctrlKey||e.metaKey))}},`${s}-${t.label}-${n}`)})}),g?(0,Z.jsx)(`g`,{className:`upright-relative-axis-layer-2d`,"aria-label":`Upright relative reference axes`,pointerEvents:`none`,children:z.map((e,t)=>{let n=wj(e.center,s,c),r=vM(e.radius),i=[{key:`x`,label:`x`,color:lj,vector:_M(e.pose,0)},{key:`y`,label:`y`,color:uj,vector:_M(e.pose,1)},{key:`z`,label:`z`,color:dj,vector:_M(e.pose,2)}];return(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`circle`,{cx:n.x,cy:-n.y,r:3.2,fill:`#111820`,stroke:sj,strokeWidth:.9,vectorEffect:`non-scaling-stroke`}),i.map(t=>{let i=wj(Aj(e.center,jj(t.vector,r)),s,c),a=n.x,o=-n.y,l=i.x,u=-i.y,d=l-a,f=u-o,p=Math.hypot(d,f);if(p<yj)return null;let m=l+d/p*9,h=u+f/p*9;return(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`line`,{x1:a,y1:o,x2:l,y2:u,stroke:t.color,strokeWidth:1.45,strokeLinecap:`round`,opacity:.96,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`text`,{x:m,y:h,fill:t.color,stroke:`#071018`,strokeWidth:2.2,paintOrder:`stroke`,fontSize:11.5,fontWeight:800,textAnchor:`middle`,dominantBaseline:`middle`,children:t.label})]},t.key)})]},`${s}-${e.side}-upright-relative-axes-${t}`)})}):null,Te.length>
43800?(0,Z.jsx)(`g`,{className:`load-vector-layer-2d`,"aria-label":`Load vectors`,children:Te.map(e=>{let t=e.kind===`input`?.88:e.kind===`axial`?.6:e.kind===`reaction`?.72:.84,n=e.kind===`input`?2.35:e.kind===`axial`?1.45:e.kind===`reaction`?1.85:2.05;if(e.visualStyle===`moment`)return(0,Z.jsx)(`path`,{d:zj(e).map(e=>wj(e,s,c)).map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${-e.y}`).join(` `),fill:`none`,stroke:e.color,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,markerEnd:`url(#${le})`,opacity:t,vectorEffect:`non-scaling-stroke`,children:(0,Z.jsx)(`title`,{children:Hj(e)})},`${s}-${e.id}`);let r=wj(e.from,s,c),i=wj(Rj(e),s,c);return(0,Z.jsx)(`line`,{x1:r.x,y1:-r.y,x2:i.x,y2:-i.y,stroke:e.color,strokeWidth:n,strokeLinecap:`round`,markerEnd:`url(#${le})`,opacity:t,vectorEffect:`non-scaling-stroke`,children:(0,Z.jsx)(`title`,{children:Hj(e)})},`${s}-${e.id}`)})}):null,e.graphics.drawLoadLabels&&Te.some(Wj)?(0,Z.jsx)(`g`,{className:`load-value-label-layer-2d`,"aria-label":`Load values`,children:Te.filter(Wj).map(e=>{let t=wj(Gj(e),s,c);return(0,Z.jsx)(`text`,{x:t.x,y:-t.y,dx:7,dy:-7,fill:e.color,stroke:`#071018`,strokeWidth:3,paintOrder:`stroke`,fontSize:12.5,fontWeight:800,opacity:.92,children:Uj(e)},`${s}-${e.id}-value`)})}):null,!c&&L.centerOfGravity?(()=>{let t=wj(L.centerOfGravity,s,c),n=t.x,r=-t.y,i=Yj(e.graphics.pointSize);return(0,Z.jsxs)(`g`,{className:`center-of-gravity-2d`,"aria-label":`Center of gravity`,children:[(0,Z.jsx)(`title`,{children:`Center of gravity`}),(0,Z.jsx)(`circle`,{cx:n,cy:r,r:i,className:`center-of-gravity-2d-base`,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`path`,{d:Xj(n,r,i,0,Math.PI/2),className:`center-of-gravity-2d-dark`}),(0,Z.jsx)(`path`,{d:Xj(n,r,i,Math.PI,Math.PI*1.5),className:`center-of-gravity-2d-dark`}),(0,Z.jsx)(`line`,{x1:n-i,y1:r,x2:n+i,y2:r,className:`center-of-gravity-2d-divider`,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`line`,{x1:n,y1:r-i,x2:n,y2:r+i,className:`center-of-gravity-2d-divider`,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`circle`,{cx:n,cy:r,r:i,className:`center-of-gravity-2d-ring`,vectorEffect:`non-scaling-stroke`})]})})():null,(0,Z.jsxs)(`g`,{children:[L.points.filter(t=>t.label===`RC`?s===`YZ`&&e.graphics.drawRollCenter:t.label===`SA`||t.label===`SAWC`?e.graphics.drawSteeringAxis||e.graphics.virtualPointsLines:!1).map((t,n)=>{let r=wj(t.point,s,c);return(0,Z.jsx)(`circle`,{cx:r.x,cy:-r.y,r:e.graphics.pointSize*1.35,className:`point-2d-virtual`,fill:t.color,vectorEffect:`non-scaling-stroke`},`${s}-virtual-${t.side}-${t.label}-${n}`)}),u?L.points.filter(e=>e.label!==`SA`&&e.label!==`SAWC`&&e.label!==`RC`).filter(t=>lM(e,t.label)).map((t,n)=>{let r=wj(t.point,s,c),i=t.label===`CP`,a=tp(t.label),o=aM([t.point],Me),l=Fe(o),u=o.some(e=>Pe.has(e)),d=i?cj:l?aj:u?sj:sM(o,Ne,t.color);return(0,Z.jsx)(`circle`,{cx:r.x,cy:-r.y,r:e.graphics.pointSize*(i||a?1.35:1),className:i?`point-2d-cp`:a?`point-2d-hardpoint-black`:`point-2d`,style:{color:d},vectorEffect:`non-scaling-stroke`},`${s}-visible-${t.side}-${t.label}-${n}`)}):null,u&&_?Me.map(t=>{let n=wj(t.point,s,c),r=rM(e,t.id,m),i=je&&!cM(e,t.id,Ae),a=je&&t.id===`pr-w`&&!Ae.has(`pr-w`),o=Pe.has(t.id),l=i?aj:o?sj:Ne.get(t.id)??`var(--color-text-strong)`,u=r?oj:a?`#0d131a`:l,d=e.graphics.pointSize*1.35*(r?1.5:1);return(0,Z.jsxs)(`g`,{"data-hardpoint-marker":`true`,className:r?`hardpoint-marker selected`:t.nonSelectable?`hardpoint-marker non-selectable`:`hardpoint-marker`,style:{color:u},onClick:e=>ot(e,t),children:[(0,Z.jsx)(`circle`,{cx:n.x,cy:-n.y,r:hj,style:{fill:`transparent`,stroke:`none`},pointerEvents:`all`}),(0,Z.jsx)(`circle`,{cx:n.x,cy:-n.y,r:d}),r?(0,Z.jsx)(`text`,{x:n.x+e.graphics.pointSize*2.4,y:-n.y-e.graphics.pointSize*1.8,style:{color:oj},children:t.label}):null]},`${s}-${t.key}`)}):null]})]})]})}var MM=``+new URL(`logo-sd-DkJLB8nt.png`,import.meta.url).href,NM=` 4381 4382GENERAL TERMS AND CONDITIONS FOR THE USE OF THE WEB APP BSpoke 3DSusp Web 43830. This is a beta version of the web app. It may contain bugs, inaccuracies, interruptions or other defects. It is provided solely for evaluation and testing purposes and must not be used for any commercial purpose. Users can report bugs or suggestions to [email protected]. 43841. These Terms and Conditions (âT&Csâ) form an integral part of the licence agreement and, as such, govern access to and use of the web app developed by the personnel of BSpoke Automotive Srl and protected in all its parts by international copyright laws. This protection a
4384pplies to, but is not limited to, the source code, machine code, layouts, schemes, diagrams, logic, workflows, APIs, images, logos, and any combination thereof. 43852. BSpoke Automotive Srl holds intellectual property rights on the web app and its underlying software, and nothing in these T&Cs shall be interpreted or construed as transferring or assigning, either totally or partially, ownership of the web app or the underlying software. 43863. Under these T&Cs the User has no right or power to assign, transfer, license or sublicense the use of the web app to any third party, unless authorised in writing by BSpoke Automotive Srl. 43874. BSpoke Automotive Srl reserves the right to change from time to time the T&Cs concerning the web app. Such changes will be notified to any User and will become binding and enforceable after 30 days from such notification unless the User terminates in writing the relationship with BSpoke Automotive Srl. 43885. BSpoke Automotive Srl may, from time to time, and without need of any previous notice, issue minor or major releases of the web app. For the duration of the agreement, any modifications carried out within normal maintenance and development activities will be delivered to the User as a new release, which shall be deemed to be included in the web app under the present T&Cs. 43896. Access to the web app under these T&Cs does not include customisation services by BSpoke Automotive Srl, which could be provided only under a separate agreement and at a cost to be agreed with any interested party. 43907. The web app is provided âas isâ without any warranties, whether express, implied, or statutory, including, but not limited to, the implied warranties of merchantability, fitness for a particular purpose, and noninfringement. The developers and distributors of the web app shall not be held liable for any direct, indirect, incidental, or consequential damage arising from the use or inability to use the web app, including but not limited to damage related to vehicle performance, safety, or regulatory compliance. 43918. The web app is not meant to replace engineering expertise or established best practice. Users are solely responsible for verifying and validating the correctness and safety of all results produced by the web app before applying them to any physical system or vehicle. Any application or modification to vehicle suspension systems based on web app output must be carried out by qualified professionals and in accordance with all applicable laws, regulations, and manufacturer specifications. 43929. Use of this web app implies acceptance of these Terms and Conditions. 439310. The User agrees to assume any risk that is associated with the use and application of the web app. The User releases BSpoke Automotive Srl from any and all claims of damage and loss related to the use and application of the web app. The release is without limitation and includes the personal injury fees, attorneyâs fees and any other losses that might occur to the User. 439411. The User agrees that this liability waiver shall remain in full force effect without change for the duration of this agreement and as long as the related results are in use. 439512. This T&Cs agreement is construed in accordance with the laws of Italy. Should a dispute arise between the Parties in connection with the validity, interpretation, performance, non-performance or termination of this T&Cs, the claimant party shall notify its claim to the other party by registered letter or PEC. The parties shall try to reach an amicable settlement to such dispute, promptly and in good faith. In case such amicable settlement is not reached within thirty (30) days after the above notification, the dispute shall be submitted to the exclusive jurisdiction of the court of Brescia, Italy. 4396`,PM=`2026-07-20-v2`;function FM(){return(0,Z.jsxs)(`article`,{className:`privacy-policy`,children:[(0,Z.jsx)(`p`,{className:`privacy-policy-meta`,children:`Version 1.0 · Effective 20 July 2026`}),(0,Z.jsx)(`p`,{className:`privacy-policy-intro`,children:`This Privacy Policy explains how BSpoke Automotive Srl collects and uses personal data when you create an account or use 3DSusp Web. We use personal data only to provide and secure the service, manage user accounts, communicate essential information, and comply with legal obligations. We do not sell personal data, use it for advertising, or send marketing messages through this service.`}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`1. Who is responsible for your data`}),(0,Z.jsxs)(`p`,{children:[`The data controller is `,(0,Z.jsx)(`strong`,{children:`BSpoke Automotive Srl`}
4396),`, Via Branze 38, 25123 Brescia, Italy, Italian tax code and VAT number 04556490987. You can contact us about privacy at`,` `,(0,Z.jsx)(`a`,{href:`mailto:[email protected]`,children:`[email protected]`}),` or by certified email at`,` `,(0,Z.jsx)(`a`,{href:`mailto:[email protected]`,children:`[email protected]`}),`.`]})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`2. Personal data we collect`}),(0,Z.jsx)(`p`,{children:`When you register, we collect the information entered in the registration form, such as your first and last name, email address, university or company, username, and password. Passwords are not stored in readable form; they are stored as a protected hash. We also keep account dates, email-verification status, and a record of the legal notices presented during registration.`}),(0,Z.jsx)(`p`,{children:`When you use the service, we may process technical and security information such as IP address, browser user-agent, session information, login and last-activity dates, the most recent application route, and limited request counters.`}),(0,Z.jsx)(`p`,{children:`If you contact us, we process the information contained in your message. We also use your email address to send account verification, password reset, security, and other essential service messages.`})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`3. Why we use personal data`}),(0,Z.jsx)(`p`,{children:`We process account data because it is necessary to create and manage your account and provide the service you request. The legal basis is the performance of our agreement with you and the steps taken at your request before entering into that agreement, under Article 6(1)(b) of the GDPR.`}),(0,Z.jsx)(`p`,{children:`We process limited technical and security information to prevent abuse, protect accounts, diagnose problems, and maintain a reliable service. The legal basis is our legitimate interest in operating and protecting 3DSusp Web, under Article 6(1)(f) of the GDPR. We may also process information when necessary to comply with a legal obligation or to establish, exercise, or defend legal claims.`}),(0,Z.jsx)(`p`,{children:`We do not rely on consent for processing that is necessary to provide and secure the service. If we introduce optional marketing or another purpose that requires consent, we will ask for it separately and you will be free to refuse or withdraw it.`})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`4. When information is required`}),(0,Z.jsx)(`p`,{children:`Required registration fields are necessary to create and manage an account. If you do not provide them, we cannot provide an account.`})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`5. Who may receive personal data`}),(0,Z.jsx)(`p`,{children:`Personal data may be accessed only where necessary by authorised BSpoke Automotive personnel and by service providers supporting the application, hosting, backup, security, and account-email functions. Resend (Plus Five Five, Inc.) delivers account emails. Cloudflare, Inc. provides Turnstile protection against automated registrations and processes limited browser and network security signals. Data may also be disclosed to professional advisers or public authorities when required by law or necessary to protect legal rights.`}),(0,Z.jsx)(`p`,{children:`Some providers are based in the United States or may process data outside the European Economic Area. Where required, these transfers are covered by appropriate safeguards, including contractual data-protection terms and the European Commission's Standard Contractual Clauses. Further information about applicable safeguards may be requested from us.`})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`6. How long we keep personal data`}),(0,Z.jsx)(`p`,{children:`Account data are normally kept while your account remains active. When an account is closed, the data are deleted or anonymised within a reasonable period, except where limited information must be retained to comply with law, resolve a dispute, prevent abuse, or protect legal r
4396ights. Sessions, verification links, password-reset links, technical logs, and backup copies are kept only for the limited periods needed for their purpose and normal security or recovery cycles.`})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`7. Browser storage, cookies, and security tools`}),(0,Z.jsx)(`p`,{children:`3DSusp Web uses browser local storage and session storage for technical functions such as keeping interface preferences, recent local work, report layouts, cached engineering data, and temporary recovery information. This information remains on your device. You can remove it by clearing the site data in your browser.`}),(0,Z.jsx)(`p`,{children:`The service does not currently use advertising, marketing, or profiling cookies. Cloudflare Turnstile is used on the registration page to protect the service from automated traffic. Because the current browser storage and security tools are used only for technical purposes, no optional-cookie consent banner is displayed. If non-essential analytics, advertising, or profiling technologies are introduced, they will not be activated until the required choice has been offered.`})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`8. How we protect personal data`}),(0,Z.jsx)(`p`,{children:`We use technical and organisational safeguards appropriate to the nature of the service and the risks involved. These include protected password storage, authenticated access, and restricted administrative functions. No online service can guarantee absolute security, so you should use a unique password and contact us promptly if you suspect misuse of your account.`})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`9. Your rights`}),(0,Z.jsxs)(`p`,{children:[`Subject to the conditions of the GDPR, you may request access to your personal data, correction, deletion, restriction of processing, or data portability. You may also object to processing based on legitimate interests. Where information is necessary to provide your account, deletion may require the account to be closed. Requests may be sent to`,` `,(0,Z.jsx)(`a`,{href:`mailto:[email protected]`,children:`[email protected]`}),`, and we may ask for information needed to verify your identity.`]}),(0,Z.jsxs)(`p`,{children:[`You may lodge a complaint with the Italian Data Protection Authority, the Garante per la protezione dei dati personali, through `,(0,Z.jsx)(`a`,{href:`https://www.garanteprivacy.it/`,target:`_blank`,rel:`noopener noreferrer`,children:`www.garanteprivacy.it`}),`.`]})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{children:`10. Automated decisions and changes to this policy`}),(0,Z.jsx)(`p`,{children:`We do not use personal data to make automated decisions that produce legal or similarly significant effects. Turnstile may automatically reject traffic identified as automated solely to protect registration. We may update this policy when the service or legal requirements change. The current version and effective date will remain available in the application, and material changes will be communicated where required.`})]}),(0,Z.jsxs)(`section`,{className:`privacy-policy-provider-links`,children:[(0,Z.jsx)(`h3`,{children:`Further information`}),(0,Z.jsxs)(`p`,{children:[`You can also read the `,(0,Z.jsx)(`a`,{href:`https://resend.com/legal/privacy-policy`,target:`_blank`,rel:`noopener noreferrer`,children:`Resend Privacy Policy`}),` `,`and the `,(0,Z.jsx)(`a`,{href:`https://www.cloudflare.com/turnstile-privacy-policy/`,target:`_blank`,rel:`noopener noreferrer`,children:`Cloudflare Turnstile Privacy Addendum`}),`.`]})]})]})}var IM=`https://www.bspokeautomotive.it/3DSuspWebLogin.php`,LM=/\.php(?:\?|$)/i.test(IM);function RM(e){if(LM){let t=e.startsWith(`/`)?e:`/${e}`;return`${IM}${IM.includes(`?`)?`&`:`?`}route=${encodeURIComponent(t)}`}return`${IM}${e}`}async function zM(e,t={}){let n;try{n=await fetch(RM(e),{...t,cache:`no-store`,headers:{"Content-Type":`application/json`,...t.headers??{}}})}catch{throw Error(`Workspace server is not reachable. Check API URL and backend status.`)}if(!n.ok){let e=`Request failed with status ${n.status}`;try{e=(await n.json()).error??e}catch{}throw Error(e)}return await n.json()}function BM(e){return{Authorization:`Bearer ${e}`}}
4396async function VM(e){return zM(`/auth/signup`,{method:`POST`,body:JSON.stringify(e)})}async function HM(e){return zM(`/auth/email-verification/confirm`,{method:`POST`,body:JSON.stringify({token:e})})}async function UM(e){return zM(`/auth/email-verification/resend`,{method:`POST`,body:JSON.stringify({identifier:e})})}async function WM(e,t){return zM(`/auth/login`,{method:`POST`,body:JSON.stringify({username:e,password:t})})}async function GM(e){return zM(`/auth/password-reset/request`,{method:`POST`,body:JSON.stringify({email:e})})}async function KM(e,t){return zM(`/auth/password-reset/confirm`,{method:`POST`,body:JSON.stringify({token:e,newPassword:t})})}async function qM(e,t,n,r=!1){await zM(`/auth/activity`,{method:`POST`,headers:BM(e),body:JSON.stringify({active:t,activitySessionId:n}),keepalive:r})}async function JM(e){return zM(`/user/product-tutorial`,{headers:BM(e)})}async function YM(e){await zM(`/user/product-tutorial`,{method:`POST`,headers:BM(e)})}async function XM(e){await zM(`/auth/logout`,{method:`POST`,headers:BM(e)})}function ZM(e){return/^[a-f0-9]{64}$/.test(e)}function QM(){return window.crypto.randomUUID().replaceAll(`-`,``)}async function $M(e){let t=await window.crypto.subtle.digest(`SHA-256`,e);return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}function eN(e){let t=window.atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n.buffer}async function tN(e,t,n,r){let i=n.trim().toLowerCase();if(!ZM(i))throw Error(`Optimizer requestHash must be a SHA-256 hex digest.`);return zM(`/auth/optimizer-grant`,{method:`POST`,headers:BM(e),body:JSON.stringify({operation:t,requestHash:i,nonce:r})})}async function nN(e,t,n){let r=await tN(e,`solve`,t,n),i=await zM(`/optimizer/solve-authorize`,{method:`POST`,headers:BM(e),body:JSON.stringify({grant:r.grant,requestHash:r.requestHash,nonce:r.nonce})});if(i.requestHash!==r.requestHash||i.nonce!==r.nonce)throw Error(`Optimizer authorization binding mismatch.`);return i}async function rN(e,t){await zM(`/optimizer/solve-complete`,{method:`POST`,headers:BM(e),body:JSON.stringify({authorizationId:t})})}async function iN(e){let t=await zM(`/optimizer/wasm-manifest`,{headers:BM(e)});if(!ZM(t.requestHash)||!Number.isSafeInteger(t.size)||t.size<1)throw Error(`Browser optimizer manifest is invalid.`);return t}async function aN(e){let t=await iN(e),n=QM(),r=await tN(e,`wasm-download`,t.requestHash,n),i;try{i=await fetch(RM(`/optimizer/wasm`),{method:`POST`,cache:`no-store`,headers:{"Content-Type":`application/json`,...BM(e)},body:JSON.stringify({grant:r.grant,requestHash:r.requestHash,nonce:r.nonce})})}catch{throw Error(`Workspace server is not reachable. Check API URL and backend status.`)}if(!i.ok){let e=`Request failed with status ${i.status}`;try{e=(await i.json()).error??e}catch{}throw Error(e)}let a;try{a=await i.json()}catch{throw Error(`Browser optimizer download returned an invalid response.`)}if(typeof a.wasmBase64!=`string`||!ZM(a.requestHash)||!Number.isSafeInteger(a.size))throw Error(`Browser optimizer download returned an invalid payload.`);let o=eN(a.wasmBase64),s=await $M(o);if(o.byteLength!==t.size||s!==t.requestHash||a.size!==t.size||a.requestHash!==t.requestHash)throw Error(`Browser optimizer download failed its SHA-256 integrity check.`);return{...t,bytes:o,nonce:n}}async function oN(e){return zM(`/workspace`,{headers:BM(e)})}var sN=new URL(`3dsusp-web-optimizer-BSGli3jC.mjs`,import.meta.url).href,cN=1347372083,lN=24,uN=112,dN=32,fN=32,pN=96,mN={bump:0,steer:1,roll:2,bumpSteer:3},hN={state:0,axisProbe:1},gN={point:0,line:1,curve:2},_N={box:0,sphere:1,cube:2},vN={doubleWishbone:0,multilink:1,topWishboneBottomMultilink:2,topMultilinkBottomWishbone:3,macPhersonWishbone:4,macPhersonMultilink:5},yN={pushrod:0,pullrod:1,outboardSpring:2},bN={upright:0,topWishbone:1,bottomWishbone:2,topLinkFront:3,topLinkRear:4,bottomLinkFront:5,bottomLinkRear:6},xN={constantTyrePatchZ:0,constantSpringLength:1},SN={motionRatio:0,camberVariation:1,toeVariation:2,rockerAngle:3,springLength:4,trackDelta:5,wheelbaseDelta:6,camberGradient:7,toeGradient:8,rockerMotionRatio:9,caster:10,kingpin:11,btt:12,btl:13,btcr:14,blcr:15,steeringRatio:16,ackermann:17,meanRadius:18,rollAngle:19,relativeCamber:20,heightDelta:21,camber:22,toe:23,rollCenterDistanceToCg:24,rollCenterHeightGround:25,rollCenterY:26,camberNoSteer:27,toeNoSteer:28,camberRightSteer:29,toeRightSteer:30,relativeCamberRightSteer:31,camberLeftSteer:32,toeLeftSteer:33,relativeCamberLeftSteer:34,rockerRightSteer:35,rockerLeftSteer:36,meanHeightDelta:37,axleTrackDelta:38},CN=[`wheel-center`,`tlf-c`,`tlr-c`,`blf-c`,`blr-c`,`tr-c`,`pr-c`,`s-c`,`tlf
4396-w`,`tlr-w`,`blf-w`,`blr-w`,`tr-w`,`pr-w`,`s-w`,`p1`,`p2`],wN={"wheel-center":[`WheelCenterX`,`WheelCenterY`,`WheelCenterZ`],"tlf-c":[`TLFXc`,`TLFYc`,`TLFZc`],"tlr-c":[`TLRXc`,`TLRYc`,`TLRZc`],"blf-c":[`BLFXc`,`BLFYc`,`BLFZc`],"blr-c":[`BLRXc`,`BLRYc`,`BLRZc`],"tr-c":[`TRXc`,`TRYc`,`TRZc`],"pr-c":[`PRXc`,`PRYc`,`PRZc`],"s-c":[`SXc`,`SYc`,`SZc`],"tlf-w":[`TLFXw`,`TLFYw`,`TLFZw`],"tlr-w":[`TLRXw`,`TLRYw`,`TLRZw`],"blf-w":[`BLFXw`,`BLFYw`,`BLFZw`],"blr-w":[`BLRXw`,`BLRYw`,`BLRZw`],"tr-w":[`TRXw`,`TRYw`,`TRZw`],"pr-w":[`PRXw`,`PRYw`,`PRZw`],"s-w":[`SXw`,`SYw`,`SZw`],p1:[`P1X`,`P1Y`,`P1Z`],p2:[`P2X`,`P2Y`,`P2Z`]},TN={bump:new Set([`motionRatio`,`camberVariation`,`toeVariation`,`rockerAngle`,`springLength`,`trackDelta`,`wheelbaseDelta`,`camberGradient`,`toeGradient`,`rockerMotionRatio`,`caster`,`kingpin`,`btt`,`btl`,`btcr`,`blcr`,`rollCenterDistanceToCg`,`rollCenterHeightGround`,`rollCenterY`]),steer:new Set([`camberVariation`,`toeVariation`,`rockerAngle`,`springLength`,`trackDelta`,`wheelbaseDelta`,`caster`,`kingpin`,`btt`,`btl`,`btcr`,`blcr`,`steeringRatio`,`ackermann`,`meanRadius`,`rollAngle`,`relativeCamber`,`heightDelta`,`meanHeightDelta`,`axleTrackDelta`,`rollCenterDistanceToCg`,`rollCenterHeightGround`,`rollCenterY`]),roll:new Set([`camber`,`toe`,`rockerAngle`,`relativeCamber`,`rollCenterDistanceToCg`,`rollCenterHeightGround`,`rollCenterY`]),bumpSteer:new Set([`camberNoSteer`,`toeNoSteer`,`camberRightSteer`,`toeRightSteer`,`relativeCamberRightSteer`,`camberLeftSteer`,`toeLeftSteer`,`relativeCamberLeftSteer`,`rockerRightSteer`,`rockerLeftSteer`,`rollCenterDistanceToCg`,`rollCenterHeightGround`,`rollCenterY`])},EN=1,DN=2,ON=4,kN=8,AN=16,jN=32,MN=64,NN=128,PN=Math.PI/180;function FN(e){return e+7&-8}function IN(e,t){let n=Number(e);if(!Number.isFinite(n))throw Error(`${t} must be finite.`);return n}function LN(e,t,n){let r=Object.entries(e).find(([,e])=>e===t);if(!r)throw Error(`Unknown ${n} enum value ${t}.`);return r[0]}function RN(e){let t={};for(let n of e.split(/\r?\n/)){let e=n.trim(),r=e.indexOf(`:`);!e||r<0||(t[e.slice(0,r).trim()]=e.slice(r+1).trim())}return t}function zN(e,t,n=0){let r=(e[t]??``).trim().replace(`,`,`.`);if(!r)return n;let i=Number(r);return Number.isFinite(i)?i:n}function BN(e){let t=e.trim().toLowerCase();return t.includes(`top link front`)?bN.topLinkFront:t.includes(`top link rear`)?bN.topLinkRear:t.includes(`bottom link front`)?bN.bottomLinkFront:t.includes(`bottom link rear`)?bN.bottomLinkRear:t.includes(`top`)&&t.includes(`wishbone`)?bN.topWishbone:t.includes(`bottom`)&&t.includes(`wishbone`)?bN.bottomWishbone:bN.upright}function VN(e){if(e===`Pushrod`)return yN.pushrod;if(e===`Pullrod`)return yN.pullrod;if(e===`Outboard Spring`)return yN.outboardSpring;throw Error(`Unsupported configuration: ${e||`unknown`}.`)}function HN(e,t){if(t){if(e===`Double Wishbone`)return vN.macPhersonWishbone;if(e===`Multilink`)return vN.macPhersonMultilink;throw Error(`MacPherson is supported with wishbone or multilink lower links only.`)}if(e===`Double Wishbone`)return vN.doubleWishbone;if(e===`Multilink`)return vN.multilink;if(e===`Top WB - Bottom ML`)return vN.topWishboneBottomMultilink;if(e===`Top ML - Bottom WB`)return vN.topMultilinkBottomWishbone;throw Error(`Unsupported suspension topology: ${e||`unknown`}.`)}function UN(e){return{macPherson:e===vN.macPhersonWishbone||e===vN.macPhersonMultilink,topMultilink:e===vN.multilink||e===vN.topMultilinkBottomWishbone||e===vN.macPhersonMultilink,bottomMultilink:e===vN.multilink||e===vN.topWishboneBottomMultilink||e===vN.macPhersonMultilink}}function WN(e){let t=bN;return e===vN.macPhersonWishbone||e===vN.macPhersonMultilink?new Set([t.upright]):e===vN.doubleWishbone?new Set([t.upright,t.topWishbone,t.bottomWishbone]):e===vN.multilink?new Set([t.upright,t.topLinkFront,t.topLinkRear,t.bottomLinkFront,t.bottomLinkRear]):e===vN.topWishboneBottomMultilink?new Set([t.upright,t.topWishbone,t.bottomLinkFront,t.bottomLinkRear]):new Set([t.upright,t.topLinkFront,t.topLinkRear,t.bottomWishbone])}function GN(e,t){let{macPherson:n,topMultilink:r,bottomMultilink:i}=UN(e),a=new Set([`blf-c`,`blr-c`,`tr-c`,`blf-w`,`tr-w`,`pr-c`,`pr-w`]);return i&&a.add(`blr-w`),n||([`tlf-c`,`tlr-c`,`tlf-w`].forEach(e
4396=>a.add(e)),r&&a.add(`tlr-w`)),t!==yN.outboardSpring&&!n&&[`s-c`,`s-w`,`p1`,`p2`].forEach(e=>a.add(e)),a}function KN(e){if(e.version!==1)throw Error(`Unsupported OptimizerRequest version ${e.version}.`);let t=RN(e.spmText),n=(t[`Suspension Type`]??`Double Wishbone`).trim(),r=zN(t,`MacPherson`)!==0,i=zN(t,`Integral Link`)!==0,a=HN(n,r),o=UN(a),s=VN((t.Configuration??`Pushrod`).trim()),c=BN(t[`Mounting Point`]??`Upright`),l=(t[`Steering Model`]??`Costant Z`).trim().toLowerCase().includes(`spring`)?xN.constantSpringLength:xN.constantTyrePatchZ;if(o.macPherson&&s!==yN.outboardSpring)throw Error(`MacPherson requires the Outboard Spring configuration.`);if(!WN(a).has(c))throw Error(`Mounting ${LN(bN,c,`mounting`)} is not present in the selected topology.`);let u=[vN.topWishboneBottomMultilink,vN.topMultilinkBottomWishbone];if(i&&!u.includes(a))throw Error(`Integral Link requires a hybrid wishbone/multilink topology.`);if(i&&s!==yN.outboardSpring)throw Error(`Integral Link is only selectable with Outboard Spring in 3DSusp Web.`);let d=CN.map(e=>wN[e].map(e=>zN(t,e))),f=d[0],p=zN(t,`Camber`),m=zN(t,`Toe`),h=[-p*PN,-m*PN,0,...f],g=(t[`Pinion Position`]??`Rear`).trim().toLowerCase()===`rear`,_=(t[`Axle Position`]??`Front`).trim().toLowerCase()===`rear`,v=0;return o.macPherson&&(v|=EN),i&&(v|=DN),g&&(v|=ON),(s===yN.pushrod||s===yN.pullrod)&&(v|=kN),s===yN.outboardSpring&&(v|=AN),o.topMultilink&&(v|=jN),o.bottomMultilink&&(v|=MN),_&&(v|=NN),{topology:a,configuration:s,mounting:c,steeringModel:l,flags:v,hardpoints:d,staticPose:h,wheelRadius:zN(t,`Wheel Radius`),wheelbase:zN(t,`Wheelbase`),halfTrack:Math.abs(f[1]),staticCamberDeg:p,staticToeDeg:m,cgHeight:zN(t,`Centre of Gravity Height`),cFactor:zN(t,`C Factor`),bumpSteerAngle:zN(t,`BumpSteer Angle`),allowedDesignHardpointIds:GN(a,s)}}function qN(e,t,n){let r=e.hardpointId,i=CN.indexOf(r);if(i<0)throw Error(`Unknown hardpoint id: ${e.hardpointId}.`);if(!t.allowedDesignHardpointIds.has(r))throw Error(`Hardpoint ${r} is not an independent point in the current topology.`);let a=t.hardpoints[i],o=_N[e.bounds.kind],s,c,l;if(e.bounds.kind===`box`){let t=[IN(e.bounds.min.x,`${r} box min x`),IN(e.bounds.min.y,`${r} box min y`),IN(e.bounds.min.z,`${r} box min z`)],n=[IN(e.bounds.max.x,`${r} box max x`),IN(e.bounds.max.y,`${r} box max y`),IN(e.bounds.max.z,`${r} box max z`)];for(let e=0;e<3;e+=1){if(n[e]<t[e])throw Error(`Invalid box limits for ${r}.`);if(a[e]<t[e]-1e-9||a[e]>n[e]+1e-9)throw Error(`The current ${r} position is outside its box limits.`)}s=a.map((e,r)=>Math.max(n[r]-e,e-t[r],.001)),c=a.map((e,n)=>(t[n]-e)/s[n]),l=a.map((e,t)=>(n[t]-e)/s[t])}else if(e.bounds.kind===`sphere`){let t=IN(e.bounds.radius,`${r} sphere radius`);if(t<=0)throw Error(`Invalid sphere radius for ${r}.`);s=[t,t,t],c=[-1,-1,-1],l=[1,1,1]}else{let t=IN(e.bounds.side,`${r} cube side`);if(t<=0)throw Error(`Invalid cube side for ${r}.`);s=[t/2,t/2,t/2],c=[-1,-1,-1],l=[1,1,1]}return{id:r,hpIndex:i,kind:o,sourceIndex:n,initial:[...a],scale:s,lower:c,upper:l}}function JN(e){if(e.targets.length===0)throw Error(`At least one target curve is required.`);let t=[];return{records:e.targets.map((e,n)=>{if(!TN[e.mode]?.has(e.channel))throw Error(`${e.channel} is not available in ${e.mode} mode.`);if(![e.x,e.target,e.pointWeights,e.initial].every(e=>e.length===5))throw Error(`Target ${e.id||`(unnamed)`} must contain exactly five points.`);let r=t.length;for(let n=0;n<5;n+=1){let r=IN(e.pointWeights[n],`${e.id} pointWeights[${n}]`),i=e.initial[n];if(i===null&&r>0)throw Error(`Target ${e.id||`(unnamed)`}, point ${n+1}, is not defined in the initial 3DSusp result.`);t.push({x:IN(e.x[n],`${e.id} x[${n}]`),target:IN(e.target[n],`${e.id} target[${n}]`),pointWeight:r,initial:i===null?NaN:IN(i,`${e.id} initial[${n}]`)})}return{mode:mN[e.mode],channel:SN[e.channel],kind:gN[e.kind],firstSample:r,sampleCount:5,outputIndex:n,weight:IN(e.weight,`${e.id} weight`)}}),samples:t}}function YN(e){return e.initialStates.map((e,t)=>{if(e.pose.length!==6)throw Error(`Initial state ${t} must have a six-value pose.`);let n=IN(e.x,`initial state ${t} x`),r,i,a;if(e.bump!==void 0||e.steer!==void 0)r=IN(e.bump??0,`initial state ${t} bump`),i=IN(e.steer??0,`initial state ${t} steer`),a=e.useSteeringModel??Math.abs(i)>1e-9;else if(e.mode===`bump`)r=n,i=0,a=!1;else if(e.mode===`steer`)r=0,i=n,a=!0;else throw Error(`Initial state ${t} for ${e.mode} needs explicit bump and steer.`);return{kind:e.kind===`axisProbe`?hN.axisProbe:hN.state,mode:mN[e.mode],useSteeringModel:a,x:n,bump:r,steer:i,pose:e.pose.map((e,n)=>IN(e,`initial state ${t} pose[${n}]`)),rockerAngle:e.rockerAngle===void 0?NaN:IN(e.rockerAngle,`initial state ${t} rockerAngle`)}})}
4396function XN(e){let t=KN(e),n=e.hardpoints.filter(e=>e.enabled!==!1);if(n.length===0)throw Error(`Select at least one hardpoint to optimize.`);let r=new Set,i=n.map((e,n)=>{if(r.has(e.hardpointId))throw Error(`Hardpoint selected twice: ${e.hardpointId}.`);return r.add(e.hardpointId),qN(e,t,n)}),a=JN(e),o=YN(e),s=Math.max(1,Math.trunc(IN(e.options.maxIterations,`maxIterations`))),c=Math.max(1e-12,IN(e.options.tolerance,`tolerance`)),l=Math.max(0,IN(e.options.geometryRegularization,`geometryRegularization`)),u=FN(256+lN*CN.length),d=FN(u+uN*i.length),f=FN(d+dN*a.records.length),p=FN(f+fN*a.samples.length),m=FN(p+pN*o.length),h=new ArrayBuffer(m),g=new DataView(h);return g.setUint32(0,cN,!0),g.setUint16(4,1,!0),g.setUint16(6,256,!0),g.setUint32(8,m,!0),g.setUint32(12,t.flags,!0),g.setUint32(16,t.topology,!0),g.setUint32(20,t.configuration,!0),g.setUint32(24,t.mounting,!0),g.setUint32(28,t.steeringModel,!0),g.setUint32(32,CN.length,!0),g.setUint32(36,i.length,!0),g.setUint32(40,a.records.length,!0),g.setUint32(44,a.samples.length,!0),g.setUint32(48,o.length,!0),g.setUint32(52,s,!0),g.setFloat64(64,c,!0),g.setFloat64(72,l,!0),[t.wheelRadius,t.wheelbase,t.halfTrack,t.staticCamberDeg,t.staticToeDeg,t.cgHeight,t.cFactor,t.bumpSteerAngle].forEach((e,t)=>g.setFloat64(80+t*8,e,!0)),t.staticPose.forEach((e,t)=>g.setFloat64(144+t*8,e,!0)),[256,u,d,f,p,m].forEach((e,t)=>{g.setUint32(192+t*4,e,!0)}),t.hardpoints.forEach((e,t)=>{e.forEach((e,n)=>g.setFloat64(256+t*lN+n*8,e,!0))}
4396),i.forEach((e,t)=>{let n=u+t*uN;g.setUint32(n,e.hpIndex,!0),g.setUint32(n+4,e.kind,!0),g.setUint32(n+8,e.sourceIndex,!0),[e.initial,e.scale,e.lower,e.upper].forEach((e,t)=>{e.forEach((e,r)=>g.setFloat64(n+16+t*24+r*8,e,!0))})}),a.records.forEach((e,t)=>{let n=d+t*dN;[e.mode,e.channel,e.kind,e.firstSample,e.sampleCount,e.outputIndex].forEach((e,t)=>{g.setUint32(n+t*4,e,!0)}),g.setFloat64(n+24,e.weight,!0)}),a.samples.forEach((e,t)=>{let n=f+t*fN;[e.x,e.target,e.pointWeight,e.initial].forEach((e,t)=>{g.setFloat64(n+t*8,e,!0)})}),o.forEach((e,t)=>{let n=p+t*pN;g.setUint32(n,e.kind,!0),g.setUint32(n+4,e.mode,!0),g.setUint32(n+8,+!!e.useSteeringModel,!0),g.setFloat64(n+16,e.x,!0),g.setFloat64(n+24,e.bump,!0),g.setFloat64(n+32,e.steer,!0),e.pose.forEach((e,t)=>g.setFloat64(n+40+t*8,e,!0)),g.setFloat64(n+88,e.rockerAngle,!0)}),{packet:h,sidecar:{abiVersion:1,sourceName:e.sourceName,targetIds:e.targets.map(e=>e.id),designHardpointIds:i.map(e=>e.id)}}}async function ZN(e){let t=await globalThis.crypto.subtle.digest(`SHA-256`,e);return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}async function QN(e){let t=XN(e);return{packet:t.packet,sidecar:{...t.sidecar,requestHash:await ZN(t.packet)}}}function $N(e){return e instanceof Error?e.message:String(e??`Unknown optimizer error`)}function eP(e){let t=$N(e);return/memory64|wasm64|webassembly|compileerror|i64|bigint|invalid value type|memory index type/i.test(t)?`L'ottimizzatore nel browser richiede WebAssembly Memory64. Aggiorna Chrome o Edge all'ultima versione e riprova.`:/abi|packet|magic|section offset|size mismatch/i.test(t)?`I dati dell'ottimizzatore non sono compatibili con questa versione dell'app. Ricarica la pagina e riprova.`:/optimization did not converge|ipopt did not converge/i.test(t)?t:`L'ottimizzatore nel browser non è riuscito a completare il calcolo. Riprova con Chrome o Edge aggiornato.`}function tP(){return new Worker(new URL(``+new URL(`browserEngine.worker-C4jwJ6Ye.js`,import.meta.url).href,``+import.meta.url),{type:`module`})}function nP(){return globalThis.crypto.randomUUID?.()??`browser-optimizer-${Date.now()}-${Math.random().toString(36).slice(2)}`}function rP(){return new DOMException(`Optimization cancelled.`,`AbortError`)}function iP(e,t){return Error(eP(e))}var aP=class{loaderModuleUrl;runtimeBytes;workerFactory;worker=null;readyPromise=null;resolveReady=null;rejectReady=null;activeJob=null;disposed=!1;constructor(e){if(!e.loaderModuleUrl.trim())throw Error(`Optimizer Emscripten loader module is not configured.`);if(e.wasmBinary.byteLength===0)throw Error(`Optimizer runtime is empty.`);this.loaderModuleUrl=e.loaderModuleUrl,this.runtimeBytes=e.wasmBinary.slice(0),this.workerFactory=e.workerFactory??tP}get runtimeByteLength(){return this.runtimeBytes.byteLength}get isSolving(){return this.activeJob!==null}clearActiveJob(){let e=this.activeJob;return e?.signal&&e.abortListener&&e.signal.removeEventListener(`abort`,e.abortListener),this.activeJob=null,e}destroyWorker(e){let t=this.worker;this.worker=null,t&&(t.onmessage=null,t.onerror=null,t.terminate()),e&&this.rejectReady?.(e),this.readyPromise=null,this.resolveReady=null,this.rejectReady=null}handleMessage(e,t){if(e!==this.worker||this.disposed)return;let n=t.data;if(n){if(n.type===`ready`){if(n.abiVersion!==1){let e=Error(`Optimizer Worker ABI ${n.abiVersion} does not match app ABI 1.`);this.destroyWorker(iP(e,`Browser optimizer ABI mismatch`));return}this.resolveReady?.(),this.resolveReady=null,this.rejectReady=null;return}if(n.type===`iteration`){this.activeJob?.jobId===n.jobId&&this.activeJob.onIteration?.({iteration:n.iteration,objective:n.objective,elapsedMs:n.elapsedMs});return}if(n.type===`completed`){if(this.activeJob?.jobId!==n.jobId)return;this.clearActiveJob()?.resolve(n.result);return}if(n.type===`error`){if(n.jobId&&this.activeJob?.jobId!==n.jobId)return;let e=Error(n.message);n.jobId?this.clearActiveJob()?.reject(e):this.destroyWorker(e);return}}}spawnWorker(){if(this.disposed)return Promise.reject(Error(`Optimizer client is disposed.`));if(this.readyPromise)return this.readyPromise;let e=this.workerFactory();this.worker=e;let t=new Promise((e,t)=>
4396{this.resolveReady=e,this.rejectReady=t});this.readyPromise=t,e.onmessage=t=>this.handleMessage(e,t),e.onerror=t=>{if(e!==this.worker)return;let n=iP(t.error??t.message,`Browser optimizer Worker crashed`);this.clearActiveJob()?.reject(n),this.destroyWorker(n)};let n=this.runtimeBytes.slice(0),r={type:`init`,loaderModuleUrl:this.loaderModuleUrl,wasmBinary:n};try{e.postMessage(r,[n])}catch(e){this.destroyWorker(iP(e,`Cannot transfer browser optimizer runtime to Worker`))}return t}async initialize(){await this.spawnWorker()}async solve(e,t={}){let n=await QN(e);return this.solvePacked(n,t)}async solvePacked(e,t={}){if(this.disposed)throw Error(`Optimizer client is disposed.`);if(this.activeJob)throw Error(`An optimization is already running.`);if(t.signal?.aborted||(await this.spawnWorker(),t.signal?.aborted))throw rP();let n=this.worker;if(!n)throw Error(`Optimizer Worker is unavailable.`);let r=nP();return new Promise((i,a)=>{let o={jobId:r,resolve:i,reject:a,onIteration:t.onIteration,signal:t.signal};t.signal&&(o.abortListener=()=>this.cancel(),t.signal.addEventListener(`abort`,o.abortListener,{once:!0})),this.activeJob=o;let s=e.packet,c={type:`solve`,jobId:r,packet:s,sidecar:e.sidecar};try{n.postMessage(c,[s])}catch(e){this.clearActiveJob()?.reject(iP(e,`Cannot transfer browser optimizer request to Worker`))}})}cancel(){if(this.disposed)return;let e=rP();this.clearActiveJob()?.reject(e),this.destroyWorker(e),this.spawnWorker().catch(e=>{})}dispose(){if(!this.disposed){if(this.disposed=!0,this.clearActiveJob()?.reject(Error(`Optimizer client was disposed.`)),this.worker){let e={type:`dispose`};try{this.worker.postMessage(e)}catch{}}this.destroyWorker()}}},oP=`3dsusp-optimizer-auth-request`,sP=`3dsusp-optimizer-auth-response`,cP=`3dsusp-optimizer-solve-completed`;function lP(e){let t=window.opener;if(!t||t.closed||!/^[a-f0-9]{32}$/i.test(e))return;let n={type:cP,authorizationId:e};t.postMessage(n,window.location.origin)}function uP(e,t){let n=window.opener;return!n||n.closed?Promise.reject(Error(`Reopen Optimizer from the authenticated 3DSusp Web window.`)):new Promise((r,i)=>{let a=window.setTimeout(()=>{window.removeEventListener(`message`,o),i(Error(`3DSusp Web did not authorize the optimizer. Reopen it from the main window.`))},t),o=t=>{t.origin!==window.location.origin||t.source!==n||t.data?.type!==`3dsusp-optimizer-auth-response`||t.data.requestId!==e.requestId||(window.clearTimeout(a),window.removeEventListener(`message`,o),t.data.error?i(Error(t.data.error)):r(t.data))};window.addEventListener(`message`,o),n.postMessage(e,window.location.origin)})}async function dP(e){let t=await $M(e),n=QM(),r=await uP({type:oP,requestId:window.crypto.randomUUID(),operation:`solve`,requestHash:t,nonce:n},2e4);if(!r.authorization||r.authorization.requestHash!==t||r.authorization.nonce!==n)throw Error(`Optimizer solve authorization binding mismatch.`);return r.authorization}async function fP(){let e=await uP({type:oP,requestId:window.crypto.randomUUID(),operation:`wasm-download`},6e4);if(!e.wasm)throw Error(`Browser optimizer download was denied.`);if(await $M(e.wasm.bytes)!==e.wasm.requestHash||e.wasm.bytes.byteLength!==e.wasm.size)throw Error(`Browser optimizer download failed its integrity check.`);return e.wasm}function pP(e){return e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top ML - Bottom WB`}function mP(e){return e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top WB - Bottom ML`}function hP(e){let t=e.suspension.macPherson,n=pP(e),r=mP(e),i=[],a=(e,t={})=>i.push({id:e,...t});t||(a(`tlf-c`),a(`tlr-c`,e.suspension.integralLink&&e.suspension.suspensionType===`Top ML - Bottom WB`?{label:`TLR on bottom wishbone`,group:`Moving arm mount`,note:`Integral-link attachment carried by the bottom wishbone`}:{})),a(`blf-c`),a(`blr-c`,e.suspension.integralLink&&e.suspension.suspensionType===`Top WB - Bottom ML`?{label:`BLR on top wishbone`,group:`Moving arm mount`,note:`Integral-link attachment carried by the top wishbone`}:{}),a(`tr-c`),a(`pr-c`,t?{label:`Strut top`,group:`MacPherson strut`,note:`Fixed strut/body attachment`}:{}),e.suspension.configuration!==`Outboard Spring`&&!t&&a(`s-c`),t||(a(`tlf-w`,n?{label:`TLF wheel joint`,note:`Independent top-front link joint`}:{label:`Top wishbone upright`,note:`Shared by TLF and TLR; both wishbone legs move together`}),n&&a(`tlr-w`,{label:`TLR wheel joint`,note:`Independent top-rear link joint`})),a(`blf-w`,r?{label:`BLF wheel joint`,note:`Independent bottom-front link joint`}:{label:`Bottom wishbone upright`,note:`Shared by BLF and BLR; both wishbone legs move together`}),r&&a(`blr-w`,{label:`BLR wheel joint`,note:`Independent bottom-rear link joint`}),a(`tr-w`),a(`pr-w`,t?{label:`Strut upright`,group:`MacPherson strut`,note:`Moving strut/upright attachment`}:{}),e.suspension.configuration!==`Outboard Spring`&&!t&&(a(`s-w`),a(`p1`),a(`p2`));let o={};return!t&&!n&&(o[`tlf-w`]=[`tlr-w`]),r||(o[`blf-w`]=[`blr-w`]),{label:t?e.suspension.suspensionType===`Multilink`?`MacPherson Multilink`:`MacPherson`:e.suspension.suspensionType,hardp
4396oints:i,sharedWheelAliases:o}}var gP=.1,_P=.01,vP=Math.PI/180,yP=new Set([`caster`,`kingpin`,`btt`,`btl`,`btcr`,`blcr`]),bP=new Set([`steeringRatio`,`ackermann`,`meanRadius`,`rollAngle`]),xP=new Set([`motionRatio`,`camberGradient`,`toeGradient`,`rockerMotionRatio`]),SP=new Set([`rollCenterDistanceToCg`,`rollCenterHeightGround`,`rollCenterY`]),CP=new WeakMap;function wP(e,t){let n=Math.max(0,Number.isFinite(e)?e:0);return!Number.isFinite(t)||t<0||n<=t?n:Math.max(0,Math.round(t*.9))}function TP(e,t){if(!t)return e;let n=wP(e.run.bumpMax,t.bumpMax),r=wP(e.run.reboundMax,t.reboundMax),i=wP(e.run.steeringWheelAngleMax,t.steerMax),a=wP(Math.abs(e.run.bumpSteerAngle),t.steerMax),o=Math.sign(e.run.bumpSteerAngle||1)*a;return n===e.run.bumpMax&&r===e.run.reboundMax&&i===e.run.steeringWheelAngleMax&&o===e.run.bumpSteerAngle?e:{...e,fields:{...e.fields,"Bump Max":String(n),"Rebound Max":String(r),"Steering Wheel Angle Max":String(i),"BumpSteer Angle":String(o)},run:{...e.run,bumpMax:n,reboundMax:r,steeringWheelAngleMax:i,bumpSteerAngle:o}}}function EP(e,t){if(t===`bump`||t===`bumpSteer`)return[-Math.max(0,e.run.reboundMax),-Math.max(0,e.run.reboundMax)*.5,0,Math.max(0,e.run.bumpMax)*.5,Math.max(0,e.run.bumpMax)];if(t===`roll`){let{min:t,max:n}=Cf(e.run,Math.abs(e.geometry.right.wheelCenter.y));return[t,t*.5,0,n*.5,n]}let n=Math.max(0,e.run.steeringWheelAngleMax);return[-n,-n*.5,0,n*.5,n]}function DP(e){return Number.isFinite(e)?e:null}function OP(e,t,n){let r=CP.get(e);r||(r=new Map,CP.set(e,r));let i=`${t}:${Math.abs(n)<1e-9?0:Number(n.toFixed(9))}`,a=r.get(i);if(a)return a;let o;if(t===`bump`)o={primary:y_(e,n,0,{useSteeringModel:!1})};else if(t===`steer`){let t=A_(e,{bump:0,steer:n,roll:0},{useSteeringModel:!0});o={primary:t.rightFrame,right:t.rightFrame,left:t.leftFrame}}else if(t===`roll`){let t=A_(e,{bump:0,steer:0,roll:n});o={primary:e.geometry.left.wheelCenter.y>=e.geometry.right.wheelCenter.y?t.leftFrame:t.rightFrame,right:t.rightFrame,left:t.leftFrame}}else{let t=e.run.bumpSteerAngle,r=A_(e,{bump:n,steer:t,roll:0},{useSteeringModel:!0}),i=y_(e,n,0,{useSteeringModel:!0,includeBumpDerivativeMetrics:!1}),a=A_(e,{bump:0,steer:t,roll:0},{useSteeringModel:!0});o={primary:r.rightFrame,right:r.rightFrame,left:r.leftFrame,noSteer:i,steerRollAngle:kg(e,a.rightFrame,a.leftFrame)}}return r.set(i,o),o}function kP(e,t,n,r){let i=OP(e,t,r),a=i.primary;if(n===`camberVariation`)return DP(a.outputs.camber-e.vehicle.camber);if(n===`toeVariation`)return DP(a.outputs.toe-e.vehicle.toe);if(n===`meanRadius`&&Math.abs(r)<=1e-9)return null;if(bP.has(n)){if(t!==`steer`)return null;let i=Math.abs(r)>1e-9?Math.abs(r):gP,a=y_(e,0,i,{useSteeringModel:!0}),o=y_(e,0,-i,{useSteeringModel:!0});if(n===`rollAngle`)return DP(Math.abs(r)<=1e-9?0:kg(e,r<0?o:a,r<0?a:o));let s=Dg(e,a.outputs.toe,o.outputs.toe,i);return DP(n===`steeringRatio`?s.steeringRatio:n===`ackermann`?s.ackermann:s.meanRadius)}if(t===`roll`&&n===`relativeCamber`)return DP(a.outputs.camber-r);if(t===`steer`&&n===`meanHeightDelta`)return!i.right||!i.left?null:DP((i.right.outputs.heightDelta+i.left.outputs.heightDelta)*.5);if(t===`steer`&&n===`axleTrackDelta`)return!i.right||!i.left?null:DP(_g(i.right,i.left));if(t===`bumpSteer`){let e=i.right,t=i.left,r=i.noSteer;if(!e||!t||!r)return null;let a=i.steerRollAngle??0,o={camberNoSteer:r.outputs.camber,toeNoSteer:r.outputs.toe,camberRightSteer:e.outputs.camber,toeRightSteer:e.outputs.toe,relativeCamberRightSteer:e.outputs.camber+a,camberLeftSteer:t.outputs.camber,toeLeftSteer:t.outputs.toe,relativeCamberLeftSteer:t.outputs.camber+a,rockerRightSteer:e.outputs.rockerAngle,rockerLeftSteer:t.outputs.rockerAngle};if(n in o)return DP(o[n])}return DP(a.outputs[n])}function AP(e,t){return t.x.map(n=>kP(e,t.mode,t.channel,n))}function jP(e,t){let n=new Map,r=new Map,i=e=>Math.abs(e)<1e-9?0:Number(e.toFixed(9)),a=(t,a,o,s,c,l=!1)=>{let u=i(a),d=i(o),f=i(s),p=`${d}:${f}:${+!!c}`,m=r.get(p);m||(m=y_(e,d,f,{useSteeringModel:c,includeBumpDerivativeMetrics:!1}),r.set(p,m),n.set(`state:${p}`,{kind:`state`,mode:t,x:u,bump:d,steer:f,useSteeringModel:c,pose:m.pose,rockerAngle:-m.outputs.rockerAngle*Math.PI/180})),l&&m.steeringAxisProbePose&&n.set(`axisProbe:${p}`,{kind:`axisProbe`,mode:t,x:u,bump:d,steer:f,useSteeringModel:c,pose:m.steeringAxisProbePose})},o=t=>Math.tan(t*vP)*Math.abs(e.geometry.right.wheelCenter.y),s=(t,n,r=!1)=>
4396{if(t===`bump`)a(t,n,n,0,!1,r);else if(t===`steer`)a(t,n,0,n,!0,r);else if(t===`roll`){let e=o(n);a(t,n,e,0,!1),a(t,n,-e,0,!1)}else a(t,n,n,0,!0),a(t,n,n,e.run.bumpSteerAngle,!0),a(t,n,n,-e.run.bumpSteerAngle,!0)},c=(t,n)=>{let r=(e,r,i)=>{a(t,n,e,r,i),a(t,n,e-_P,r,i),a(t,n,e+_P,r,i)};if(t===`bump`)r(n,0,!1);else if(t===`steer`)r(0,n,!0),r(0,-n,!0);else if(t===`roll`){let e=o(n);r(e,0,!1),r(-e,0,!1)}else r(n,e.run.bumpSteerAngle,!0),r(n,-e.run.bumpSteerAngle,!0)};return t.forEach(e=>{let t=yP.has(e.channel);e.x.forEach(n=>s(e.mode,n,t)),bP.has(e.channel)&&e.x.forEach(e=>{let t=Math.abs(e)>1e-9?Math.abs(e):gP;a(`steer`,e,0,t,!0),a(`steer`,e,0,-t,!0)}),xP.has(e.channel)&&e.x.forEach(e=>{a(`bump`,e,e-.001,0,!1),a(`bump`,e,e+.001,0,!1)}),SP.has(e.channel)&&e.x.forEach(t=>c(e.mode,t))}),Array.from(n.values())}function MP(e){let t=new Set(hP(e).hardpoints.map(e=>e.id));return gT.filter(e=>t.has(e.id)).map(e=>({hardpointId:e.id,enabled:!1,bounds:{kind:`cube`,side:50}}))}function NP(e,t,n){let r=hP(n).sharedWheelAliases;return Object.entries(t).reduce((e,[t,n])=>[t,...r[t]??[]].reduce((e,t)=>{let r=gT.find(e=>e.id===t);if(!r)return e;let i=tC(e,r.xKey,String(n.x));return i=tC(i,r.yKey,String(n.y)),i=tC(i,r.zKey,String(n.z)),i},e),e)}var PP=`3dsusp-web-optimizer-state`,FP=`3dsusp-web-optimizer-state`,IP=`3dsusp-web-optimizer-apply`,LP=`3dsusp-web-optimizer-configuration-v1`;function RP(e){return`${LP}:${e.trim().toLocaleLowerCase()}`}function zP(e){try{let t=window.localStorage.getItem(RP(e));if(!t)return null;let n=JSON.parse(t);return n.version!==1||n.sourceName!==e||!Array.isArray(n.constraints)||!Array.isArray(n.targets)?null:{version:1,sourceName:e,constraints:n.constraints,targets:n.targets,savedAt:typeof n.savedAt==`number`?n.savedAt:Date.now()}}catch{return null}}function BP(e){try{window.localStorage.setItem(RP(e.sourceName),JSON.stringify(e))}catch{}}function VP(){return new URLSearchParams(window.location.search).get(`optimizer`)===`1`}function HP(){let e=window.location.pathname;return`${!(window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`)&&e.endsWith(`/`)?`${e}index.php`:e}?optimizer=1`}function UP(){try{let e=window.localStorage.getItem(PP);if(!e)return null;let t=JSON.parse(e);if(t.version!==1||typeof t.spmText!=`string`||typeof t.sourceName!=`string`)return null;let n=t.verifiedKinematicLimits,r=n&&Number.isFinite(n.bumpMax)&&Number.isFinite(n.reboundMax)&&Number.isFinite(n.steerMax)&&n.bumpMax>=0&&n.reboundMax>=0&&n.steerMax>=0?{bumpMax:n.bumpMax,reboundMax:n.reboundMax,steerMax:n.steerMax}:void 0;return{version:1,spmText:t.spmText,sourceName:t.sourceName,openedAt:typeof t.openedAt==`number`?t.openedAt:Date.now(),...r?{verifiedKinematicLimits:r}:{}}}catch{return null}}function WP(e){window.localStorage.setItem(PP,JSON.stringify(e));try{let t=new BroadcastChannel(FP);t.postMessage(e),t.close()}catch{}}function GP(e){let t=null,n=t=>{if(t.key!==PP||!t.newValue)return;let n=UP();n&&e(n)};window.addEventListener(`storage`,n);try{t=new BroadcastChannel(FP),t.addEventListener(`message`,t=>e(t.data))}catch{t=null}return()=>{window.removeEventListener(`storage`,n),t?.close()}}function KP(e){let t=new BroadcastChannel(IP);t.postMessage(e),t.close()}function qP(e){let t=null;try{t=new BroadcastChannel(IP),t.addEventListener(`message`,t=>{t.data?.type===`apply-optimized-spm`&&t.data.version===1&&e(t.data)})}catch{t=null}return()=>t?.close()}var JP=[{key:`motionRatio`,label:`Spring motion ratio`,unit:`mm/mm`,modes:[`bump`]},{key:`camberVariation`,label:`Camber variation`,unit:`deg`,modes:[`bump`,`steer`]},{key:`toeVariation`,label:`Toe variation`,unit:`deg`,modes:[`bump`,`steer`]},{key:`rockerAngle`,label:`Rocker angle`,unit:`deg`,modes:[`bump`,`steer`,`roll`]},{key:`springLength`,label:`Spring length`,unit:`mm`,modes:[`bump`,`steer`]},{key:`trackDelta`,label:`Track variation`,unit:`mm`,modes:[`bump`]},{key:`trackDelta`,label:`SemiTrack variation, LH CP`,unit:`mm`,modes:[`steer`]},{key:`axleTrackDelta`,label:`Axle track variation`,unit:`mm`,modes:[`steer`]},{key:`wheelbaseDelta`,label:`Wheelbase variation`,unit:`mm`,modes:[`bump`,`steer`]},{key:`camberGradient`,label:`Camber gradient`,unit:`deg/10mm`,modes:[`bump`]},{key:`toeGradient`,label:`Toe gradient`,unit:`deg/10mm`,modes:[`bump`]},{key:`rockerMotionRatio`,label:`Rocker motion ratio`,unit:`mm/deg`,modes:[`bump`]},{key:`caster`,label:`Caster`,unit:`deg`,modes:[`bump`,`steer`]},{key:`kingpin`,label:`Kingpin`,unit:`deg`,modes:[`bump`,`steer`]},{key:`btt`,label:`Kingpin offset`,unit:`mm`,modes:[`bump`,`steer`]},{key:`btl`,label:`Caster trail`,unit:`mm`,modes:[`bump`,`steer`]},{key:`btcr`,label:`Kingpin offset @WC`,unit:`mm`,modes:[`bump`,`steer`]},{key:`blcr`,label:`Caster trail @WC`,unit:`mm`,modes:[`bump`,`steer`]},{key:`steeringRatio`,label:`Steering ratio`,unit:`deg/deg`,modes:[`steer`],unavailableAtZero:!0},{key:`ackermann`,label:`Ackermann`,unit:`%`,modes:[`steer`],unavailableAtZero:!0},{key:`meanRadius`,label:`Average cornering radius`,unit:`m`,modes:[`steer`],unavailableAtZero:!0},{key:`rollAngle`,label:`Steer-induced roll angle`,unit:`deg`,modes:[`steer`]},{key:`relativeCamber`,label:`Relative camber`,unit:`deg`,modes:[`steer`,`roll`]},{key:`heightDelta`,label:`Ride height delta, LH CP`,unit:`mm`,modes:[`steer`]},{key:`meanHeightDelta`,label:`Ride height delta, mean CP`,unit:`mm`,modes:[`steer`]},{key:`rollCenterDistanceToCg`,label:`RC distance to CG`,unit:`mm`,modes:[`bump`,`steer`,`roll`,`bumpSteer`]},{key:`rollCenterHeightGround`,label:`RC height to ground`,unit:`mm`,modes:[`bump`,`steer`,`roll`,`bumpSteer`]},{key:`rollCenterY`,label:`RC lateral position`,unit:`mm`,modes:[`bump`,`steer`,`roll`,`bumpSteer`]},{key:`camber`,label:`Camber`,unit:`deg`,modes:[`roll`]},{key:`toe`,label:`Toe`,unit:`deg`,modes:[`roll`]},{key:`camberNoSteer`,label:`Camber, no steer`,unit:`deg`,modes:[`bumpSteer`]},{key:`toeNoSteer`,label:`Toe, no steer`,unit:`deg`,modes:[`bumpSteer`]},{key:`camberRightSteer`,label:`Camber, LH wheel`,unit:`deg`,modes:[`bumpSteer`]},{key:`toeRightSteer`,label:`Toe, LH wheel`,unit:`deg`,modes:[`bumpSteer`]},{key:`relativeCamberRightSteer`,label:`Relative camber, LH wheel`,unit:`deg`,modes:[`bumpSteer`]},{key:`camberLeftSteer`,label:`Camber, RH wheel`,unit:`deg`,modes:[`bumpSteer`]},{key:`toeLeftSteer`,label:`Toe, RH wheel`,unit:`deg`,modes:[`bumpSteer`]},{key:`relativeCamberLeftSteer`,label:`Relative camber, RH wheel`,unit:`deg`,modes:[`bumpSteer`]},{key:`rockerRightSteer`,label:`Rocker, LH wheel`,unit:`deg`,modes:[`bumpSteer`]},{key:`rockerLeftSteer`,label:`Rocker, RH wheel`,unit:`deg`,modes:[`bumpSteer`]}],YP=`3DSusp Optimizer Configuration`;function XP(e,t){let n=typeof e==`number`?e:Number(e);if(!Number.isFinite(n))throw Error(`${t} must be a finite number.`);return n}function ZP(e,t){if(!e||typeof e!=`object`)throw Error(`${t} is missing.`);let n=e;return{x:XP(n.x,`${t}.x`),y:XP(n.y,`${t}.y`),z:XP(n.z,`${t}.z`)}
4396}function QP(e,t){if(!e||typeof e!=`object`)return t;let n=e;if(!n.bounds||typeof n.bounds!=`object`)throw Error(`Boundary for ${t.hardpointId} is missing.`);let r=n.enabled===!0;if(n.bounds.kind===`sphere`){let e=XP(n.bounds.radius,`${t.hardpointId} sphere radius`);if(e<=0)throw Error(`${t.hardpointId} sphere radius must be greater than zero.`);return{...t,enabled:r,bounds:{kind:`sphere`,radius:e}}}if(n.bounds.kind===`cube`){let e=XP(n.bounds.side,`${t.hardpointId} cube side`);if(e<=0)throw Error(`${t.hardpointId} cube side must be greater than zero.`);return{...t,enabled:r,bounds:{kind:`cube`,side:e}}}if(n.bounds.kind===`box`){let e=ZP(n.bounds.min,`${t.hardpointId} minimum`),i=ZP(n.bounds.max,`${t.hardpointId} maximum`);if(i.x<e.x||i.y<e.y||i.z<e.z)throw Error(`${t.hardpointId} contains inverted XYZ box limits.`);return{...t,enabled:r,bounds:{kind:`box`,min:e,max:i}}}throw Error(`Unknown boundary type for ${t.hardpointId}.`)}function $P(e,t){if(!Array.isArray(e)||e.length!==5)throw Error(`${t} must contain exactly five points.`);return e.map((e,n)=>XP(e,`${t}[${n+1}]`))}function eF(e,t){if(!e||typeof e!=`object`)throw Error(`Target ${t+1} is invalid.`);let n=e,r=n.mode===`bump`||n.mode===`steer`||n.mode===`roll`||n.mode===`bumpSteer`?n.mode:null,i=JP.find(e=>e.key===n.channel&&r&&e.modes.includes(r));if(!r||!i)throw Error(`Target ${t+1} uses an unsupported analysis/output combination.`);let a=n.kind===`point`||n.kind===`line`||n.kind===`curve`?n.kind:`curve`,o=$P(n.pointWeights,`Target ${t+1} weights`).map(e=>Math.max(0,Math.min(100,e)));return{id:typeof n.id==`string`&&n.id.trim()?n.id:`imported-target-${t+1}`,mode:r,channel:i.key,kind:a,weight:Math.max(1,Math.min(100,XP(n.weight,`Target ${t+1} curve weight`))),x:$P(n.x,`Target ${t+1} axis`),target:$P(n.target,`Target ${t+1} values`),pointWeights:o}}function tF(e){let t={format:YP,version:1,...e,savedAt:Date.now()};return`${JSON.stringify(t,null,2)}\n`}function nF(e,t,n){let r;try{r=JSON.parse(e)}catch{throw Error(`The selected file is not a valid 3DSusp .opt configuration.`)}if(!r||typeof r!=`object`)throw Error(`The selected .opt configuration is empty.`);let i=r;if(i.format!==YP||i.version!==1)throw Error(`Unsupported .opt format or version.`);if(i.topology!==n)throw Error(`This configuration is for ${i.topology||`an unknown topology`}; the current suspension is ${n}.`);if(!Array.isArray(i.constraints)||!Array.isArray(i.targets)||i.targets.length===0)throw Error(`The .opt file must contain boundaries and at least one target.`);let a=i.constraints.map(e=>e?.hardpointId).filter(e=>typeof e==`string`);if(new Set(a).size!==a.length)throw Error(`The .opt file contains the same hardpoint boundary more than once.`);let o=new Map(i.constraints.map(e=>[e?.hardpointId,e])),s=t.map(e=>QP(o.get(e.hardpointId),e)),c=i.targets.map(eF),l=c.map(e=>e.id);if(new Set(l).size!==l.length)throw Error(`The .opt file contains duplicate target identifiers.`);return{sourceName:typeof i.sourceName==`string`?i.sourceName:``,constraints:s,targets:c}}var rF=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:5}),iF=`3dsusp.optimizer.sidebarWidth`,aF=`3dsusp-web-theme-mode`;function oF(){let e=new URLSearchParams(window.location.search).get(`optimizerTab`);return e===`targets`||e===`results`?e:`hardpoints`}function sF(){return!1}function cF(){return!1}function lF(){return!1}function uF(){let e=window.localStorage.getItem(aF);return e===`dark`||e===`light`?e:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function dF(e,t,n){return Math.max(t,Math.min(n,e))}function fF(e,t=4){return Number.isFinite(e)?Math.abs(e)<1e-12?`0`:Number(e.toPrecision(t)).toString():``}function pF(e,t){if(!Number.isFinite(e))return`--`;if(Math.abs(e)<1e-14)return`0`;let n=Math.floor(Math.log10(Math.abs(e))),r=dF(n-(Number.isFinite(t)&&Math.abs(t)>0?Math.floor(Math.log10(Math.abs(t))):n)+2,4,8),i=Number(e.toPrecision(r)),a=Math.abs(i);return a>=1e7||a<1e-6?i.toExponential(Math.max(1,r-1)).replace(`e+`,`e`):i.toString()}function mF({value:e,ariaLabel:t,className:n,disabled:r=!1,normalizeValue:i,onValueChange:a}){let[o,s]=(0,h.useState)(()=>fF(e)),c=(0,h.useRef)(!1);return(0,h.useEffect)(()=>{c.current||s(fF(e))},[e]),(0,Z.jsx)(`input`,{"aria-label":t,className:n,disabled:r,type:`text`,inputMode:`decimal`,value:o,onFocus:e=>{c.current=!0,e.currentTarget.select()},onChange:e=>s(e.target.value),onBlur:()=>{c.current=!1;let t=Number(o.replace(`,`,`.`));if(Number.isFinite(t)){let e=i?i(t):t;a(e),s(fF(e))}else s(fF(e))},onKeyDown:t=>{t.key===`Enter`&&t.currentTarget.blur(),t.key===`Escape`&&(s(fF(e)),t.currentTarget.blur())}})}function hF(e,t){return JP.find(n=>n.key===e&&(!t||n.modes.includes(t)))??JP[0]}function gF(e){return e===`bump`?`Bump`:e===`steer`?`Steering wheel angle`:e===`roll`?`Roll`:`Bump steer`}function _F(e){return e===`bump`||e===`bumpSteer`?`Bump [mm]`:`${e===`roll`?`Roll`:`Steer`} [deg]`}function vF(e){return e===`bump`||e===`bumpSteer`?`mm`:`deg`}function yF(){return`target-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function bF(e){return e===`point`?[0,0,5,0,0]:[1,1,5,1,1]}function xF(e,t,n){let r=e.reduce((t,n,r)=>Math.abs(n)<Math.abs(e[t]??1/0)?r:t,0),i=t.map((e,t)=>e!==null&&Number.isFinite(e)?t:-1).filter(e=>e>=0),a=i[0]??r,o=i.at(-1)??r,s=t[a]??0,c=t[o]??s,l=(e[o]??0)-(e[a]??0),u=Math.abs(l)>1e-12?(c-s)/l:0,d=n?0:t[r]??0,f=e[r]??0;return e.map(e=>d+u*(e-f))}function SF(e){return e===`camberVariation`||e===`toeVariation`||e===`trackDelta`||e===`axleTrackDelta`||e===`wheelbaseDelta`||e===`heightDelta`||e===`meanHeightDelta`}function CF(e,t){return SF(e.channel)&&Math.abs(e.x[t]??1/0)<1e-9}function wF(e){if(!SF(e.channel))return e;let t=!1,n=e.target.map((n,r)=>!CF(e,r)||n===0?n:(t=!0,0));return t?{...e,target:n}:e}function TF(e,t=`bump`,n=`camberVariation`){let r=EP(e,t),i={id:yF(),mode:t,channel:n,kind:`line`,weight:50,x:r,target:[0,0,0,0,0],pointWeights:bF(`line`)}
4396,a=AP(e,i);return wF({...i,target:xF(r,a,SF(n))})}function EF(e){return[`bump`,`steer`,`roll`,`bumpSteer`].filter(t=>Fw(e,t))}function DF(e,t,n){let r=e.map((e,n)=>({x:e,y:t[n]??0})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y)).sort((e,t)=>e.x-t.x);return r.length===0?n.map(()=>0):r.length===1?n.map(()=>r[0].y):n.map(e=>{if(e<=r[0].x)return r[0].y;if(e>=r.at(-1).x)return r.at(-1).y;let t=r.findIndex(t=>t.x>=e),n=r[Math.max(0,t-1)],i=r[Math.max(1,t)],a=i.x-n.x;if(Math.abs(a)<1e-12)return n.y;let o=(e-n.x)/a;return n.y+(i.y-n.y)*o})}function OF(e,t){let n=EP(e,t.mode);if(n.length===t.x.length&&n.every((e,n)=>Math.abs(e-(t.x[n]??NaN))<1e-9))return wF(t);let r;if(t.kind===`line`){let e=t.x.reduce((e,n,r)=>Math.abs(n)<Math.abs(t.x[e]??1/0)?r:e,0),i=Math.max(0,t.x.length-1),a=(t.x[i]??0)-(t.x[0]??0),o=Math.abs(a)>1e-12?((t.target[i]??0)-(t.target[0]??0))/a:0,s=SF(t.channel)?0:t.target[e]??0,c=t.x[e]??0;r=n.map(e=>s+o*(e-c))}else r=DF(t.x,t.target,n);return wF({...t,x:n,target:r})}function kF(e,t,n=EF(e)){let r=n[0];return r?t.map(t=>n.includes(t.mode)?OF(e,t):TF(e,r)):[]}function AF(e){let t=e.flatMap(e=>e.filter(e=>e!==null&&Number.isFinite(e)));if(t.length===0)return{min:-1,max:1};let n=Math.min(...t),r=Math.max(...t),i=Math.max(1e-6,r-n);return{min:n-i*.18,max:r+i*.18}}function jF(e,t,n){return e.map((e,r)=>e===null||!Number.isFinite(e)?null:`${n(r)},${t(e)}`).filter(e=>e!==null).join(` `)}function MF(e){if(!Number.isFinite(e))return`--`;if(e===0)return`0`;let t=Math.abs(e);return t<.001||t>=1e4?e.toExponential(4):Number(e.toPrecision(5)).toString()}function NF({history:e,label:t,metricClass:n,valueFor:r,running:i}){let a={left:70,right:18,top:18,bottom:38},o=560-a.left-a.right,s=225-a.top-a.bottom,c=1e-16,l=e.map(e=>Math.log10(Math.max(Math.abs(r(e)),c))),u=l.length?Math.floor(Math.min(...l)):-8,d=l.length?Math.ceil(Math.max(...l)):0;d<=u&&(--u,d+=1);let f=e[0]?.iteration??0,p=e.at(-1)?.iteration??Math.max(1,f+1),m=e=>a.left+(e-f)/Math.max(1,p-f)*o,h=e=>a.top+(d-Math.log10(Math.max(Math.abs(e),c)))/(d-u)*s,g=e.map(e=>`${m(e.iteration)},${h(r(e))}`).join(` `),_=Array.from({length:5},(e,t)=>d-(d-u)*t/4);return(0,Z.jsxs)(`div`,{className:`optimizer-convergence-chart`,children:[(0,Z.jsxs)(`header`,{children:[(0,Z.jsx)(`strong`,{children:t}),(0,Z.jsx)(`span`,{children:`Logarithmic scale`})]}),e.length?(0,Z.jsxs)(`svg`,{viewBox:`0 0 560 225`,role:`img`,"aria-label":`${t} by iteration on a logarithmic scale`,children:[_.map((e,t)=>{let r=a.top+s*t/4;return(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`line`,{x1:a.left,x2:560-a.right,y1:r,y2:r,className:`optimizer-convergence-grid`}),(0,Z.jsx)(`text`,{x:a.left-10,y:r+4,textAnchor:`end`,children:MF(10**e)})]},`${n}-y-${t}`)}),(0,Z.jsx)(`line`,{x1:a.left,x2:a.left,y1:a.top,y2:225-a.bottom,className:`optimizer-convergence-axis`}),(0,Z.jsx)(`line`,{x1:a.left,x2:560-a.right,y1:225-a.bottom,y2:225-a.bottom,className:`optimizer-convergence-axis`}),(0,Z.jsx)(`polyline`,{points:g,className:`optimizer-convergence-line ${n}`}),e.map(e=>(0,Z.jsx)(`circle`,{cx:m(e.iteration),cy:h(r(e)),r:2.15,className:`optimizer-convergence-point ${n}`},`${n}-point-${e.iteration}`)),(0,Z.jsx)(`text`,{x:a.left,y:213,textAnchor:`middle`,children:f}),(0,Z.jsx)(`text`,{x:560-a.right,y:213,textAnchor:`middle`,children:p}),(0,Z.jsx)(`text`,{x:560/2,y:215,textAnchor:`middle`,className:`optimizer-convergence-axis-title`,children:`Iteration`})]}):(0,Z.jsxs)(`div`,{className:`optimizer-convergence-wait`,children:[(0,Z.jsx)(b,{className:i?`optimizer-spin`:``,size:22}),(0,Z.jsx)(`span`,{children:`Waiting for iteration data...`})]})]})}function PF({history:e,running:t,result:n}){let r=e.at(-1),i=[...e].reverse().slice(0,80),a=n?.diagnostics?.maxConstraintViolation,o=n?.solverError??(typeof a==`number`?a:void 0),s=!!(n&&!n.ok);return(0,Z.jsxs)(`section`,{className:`optimizer-solver-monitor${s?` failed`:``}`,children:[(0,Z.jsxs)(`header`,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`optimizer-eyebrow`,children:`SOLVER CONVERGENCE`}),(0,Z.jsx)(`strong`,{children:t?`Optimization in progress`:s?`Optimization not solved`:n?`Optimization completed`:`Preparing optimization`})]}),(0,Z.jsxs)(`span`,{className:`optimizer-live-badge ${t?`running`:s?`failed`:`complete`}`,children:[(0,Z.jsx)(`i`,{}),t?`Live`:s?`Not solved`:`Complete`]})]}),(0,Z.jsxs)(`div`,{className:`optimizer-live-metrics`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{children:`Iteration`}),(0,Z.jsx)(`strong`,{children:r?.iteration??0})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{children:`Objective`}),(0,Z.jsx)(`strong`,{children:r?MF(r.objective):`--`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{children:`Final solver error`}),(0,Z.jsx)(`strong`,{children:o===void 0?t?`Pending`:`--`:MF(o)})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{children:`Elapsed`}),(0,Z.jsx)(`strong`,{children:r?`${(r.elapsedMs/1e3).toFixed(2)} s`:`--`})]})]}),(0,Z.jsxs)(`div`,{className:`optimizer-convergence-layout`,children:[(0,Z.jsx)(`div`,{className:`optimizer-convergence-charts`,children:(0,Z.jsx)(NF,{history:e,label:`Objective function`,metricClass:`objective`,valueFor:e=>e.objective,running:t})}),(0,Z.jsxs)(`div`,{className:`optimizer-iteration-log`,role:`log`,"aria-live":`polite`,children:[(0,Z.jsxs)(`div`,{className:`optimizer-iteration-log-head`,children:[(0,Z.jsx)(`strong`,{children:`Iteration log`}),(0,Z.jsxs)(`span`,{children:[e.length,` samples`]})]}),(0,Z.jsxs)(`div`,{className:`optimizer-iteration-log-columns`,children:[(0,Z.jsx)(`span`,{children:`Iter.`}),(0,Z.jsx)(`span`,{children:`Objective`}),(0,Z.jsx)(`span`,{children:`Time`})]}),(0,Z.jsx)(`div`,{className:`optimizer-iteration-log-body`,children:i.length?i.map(e=>(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`strong`,{children:e.iteration}),(0,Z.jsx)(`span`,{children:MF(e.objective)}),(0,Z.jsxs)(`span`,{children:[(e.elapsedMs/1e3).toFixed(2),`s`]})]},`iteration-${e.iteration}`)):(0,Z.jsx)(`p`,{children:`Iteration data will appear here in real time.`})})]})]})]})}function FF({target:e,current:t,optimized:n,editable:r,zoomable:i=!1,onTargetChange:a}){let o=i?{left:72,right:20,top:18,bottom:42}:{left:58,right:18,top:18,bottom:40},s=AF([t,e.target.map((t,n)=>e.pointWeights[n]>0?t:null),n??[]]),c=(0,h.useRef)(null),l=(0,h.useRef)(null),u=(0,h.useRef)(null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),[g,_]=(0,h.useState)(null),v=(0,h.useRef)(null),y=p?{min:p.yMin,max:p.yMax}:d!==null&&u.current?u.current:s,b=p?.xMin??Math.min(...e.x),x=p?.xMax??Math.max(...e.x),S=Math.max(1e-9,x-b),C=Math.max(1e-9,y.max-y.min),w=e=>o.left+(e-b)/S*(680-o.left-o.right),T=t=>w(e.x[t]??0),E=e=>o.top+(y.max-e)/C*(310-o.top-o.bottom),D=(0,h.useId)().replace(/:/g,``),O=`${D}-plot-clip`,k=Math.max(1e-9,...e.pointWeights.filter(e=>e>0)),A=.25+.75*Math.sqrt(dF(e.weight,0,100)/100),j=e=>e<=0?.015:A*(.18+.82*Math.sqrt(dF(e/k,0,1))),ee=e.target.slice(0,-1).flatMap((t,n)=>{let r=e.pointWeights[n]??0,i=e.pointWeights[n+1]??0;if(r<=0||i<=0)return[];let a={x:T(n),y:E(t)},o=e.target[n+1]??t,s={x:T(n+1),y:E(o)};return[{index:n,x1:a.x,y1:a.y,x2:s.x,y2:s.y,opacity1:j(r),opacity2:j(i)}]}),te=e=>{if(c.current===null||!a)return;e.preventDefault();let t=e.currentTarget.getBoundingClientRect(),n=dF((e.clientY-t.top)/Math.max(1,t.height)*310,o.top,310-o.bottom),r=y.max-(n-o.top)/(310-o.top-o.bottom)*C;a(c.current,r)},M=e=>{let t=l.current;e&&t!==null&&e.currentTarget.hasPointerCapture(t)&&e.currentTarget.releasePointerCapture(t),c.current=null,l.current=null,u.current=null,f(null)},ne=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:dF((e.clientX-t.left)/Math.max(1,t.width)*680,o.left,680-o.right),y:dF((e.clientY-t.top)/Math.max(1,t.height)*310,o.top,310-o.bottom)}},N=(e,t)=>{let n=v.current;if(!n||n.pointerId!==e.pointerId)return;e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),v.current=null,_
4396(null);let r=Math.abs(n.currentX-n.startX),i=Math.abs(n.currentY-n.startY);if(!t||r<6||i<6)return;let a=Math.min(n.startX,n.currentX),s=Math.max(n.startX,n.currentX),c=Math.min(n.startY,n.currentY),l=Math.max(n.startY,n.currentY),u=680-o.left-o.right,d=310-o.top-o.bottom;m({xMin:b+(a-o.left)/u*S,xMax:b+(s-o.left)/u*S,yMin:y.max-(l-o.top)/d*C,yMax:y.max-(c-o.top)/d*C})},P=Array.from({length:5},(e,t)=>y.min+C*t/4).reverse(),re=p?Array.from({length:5},(e,t)=>b+S*t/4):e.x;return(0,Z.jsxs)(`div`,{className:`optimizer-chart-shell`,children:[(0,Z.jsxs)(`svg`,{className:`optimizer-curve-chart${i?` zoomable`:``}${g?` selecting`:``}`,viewBox:`0 0 680 310`,role:`img`,"aria-label":`${hF(e.channel,e.mode).label} target curve`,onPointerDown:e=>{if(!i||e.button!==0)return;e.preventDefault();let t=ne(e),n={pointerId:e.pointerId,startX:t.x,startY:t.y,currentX:t.x,currentY:t.y};v.current=n,_(n),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{if(v.current?.pointerId===e.pointerId){let t=ne(e),n={...v.current,currentX:t.x,currentY:t.y};v.current=n,_(n);return}te(e)},onPointerUp:e=>{if(v.current?.pointerId===e.pointerId){let t=ne(e),n={...v.current,currentX:t.x,currentY:t.y},r=Math.abs(n.currentX-n.startX),i=Math.abs(n.currentY-n.startY);if(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),v.current=null,_(null),r>=6&&i>=6){let e=Math.min(n.startX,n.currentX),t=Math.max(n.startX,n.currentX),r=Math.min(n.startY,n.currentY),i=Math.max(n.startY,n.currentY),a=680-o.left-o.right,s=310-o.top-o.bottom;m({xMin:b+(e-o.left)/a*S,xMax:b+(t-o.left)/a*S,yMin:y.max-(i-o.top)/s*C,yMax:y.max-(r-o.top)/s*C})}return}te(e),M(e)},onPointerCancel:e=>{if(v.current?.pointerId===e.pointerId){N(e,!1);return}M(e)},onLostPointerCapture:()=>{v.current?(v.current=null,_(null)):M()},onDoubleClick:e=>{i&&(e.preventDefault(),v.current=null,_(null),m(null))},onDragStart:e=>e.preventDefault(),children:[P.map(e=>(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`line`,{x1:o.left,x2:680-o.right,y1:E(e),y2:E(e),className:`optimizer-chart-grid`}),(0,Z.jsx)(`text`,{x:o.left-9,y:E(e)+4,textAnchor:`end`,className:`optimizer-chart-tick`,children:i?pF(e,C/4):rF.format(e)})]},e)),re.map((e,t)=>(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`line`,{x1:w(e),x2:w(e),y1:o.top,y2:310-o.bottom,className:`optimizer-chart-grid vertical`}),(0,Z.jsx)(`text`,{x:w(e),y:297,textAnchor:`middle`,className:`optimizer-chart-tick`,children:i?pF(e,S/4):rF.format(e)})]},`${e}-${t}`)),(0,Z.jsx)(`line`,{x1:o.left,x2:680-o.right,y1:310-o.bottom,y2:310-o.bottom,className:`optimizer-chart-axis`}),(0,Z.jsxs)(`defs`,{children:[(0,Z.jsx)(`clipPath`,{id:O,children:(0,Z.jsx)(`rect`,{x:o.left,y:o.top,width:680-o.left-o.right,height:310-o.top-o.bottom})}),ee.map(e=>(0,Z.jsxs)(`linearGradient`,{id:`${D}-target-gradient-${e.index}`,gradientUnits:`userSpaceOnUse`,x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,children:[(0,Z.jsx)(`stop`,{offset:`0%`,stopColor:`#ff5d68`,stopOpacity:e.opacity1}),(0,Z.jsx)(`stop`,{offset:`100%`,stopColor:`#ff5d68`,stopOpacity:e.opacity2})]},`${D}-target-gradient-${e.index}`))]}),(0,Z.jsxs)(`g`,{clipPath:`url(#${O})`,children:[(0,Z.jsx)(`polyline`,{points:jF(t,E,T),className:`optimizer-chart-line current`}),n?(0,Z.jsx)(`polyline`,{points:jF(n,E,T),className:`optimizer-chart-line optimized`}):null,ee.map(t=>(0,Z.jsx)(`line`,{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,className:`optimizer-chart-line target`,style:{stroke:`url(#${D}-target-gradient-${t.index})`}},`${e.id}-target-segment-${t.index}`)),e.target.map((t,n)=>{let i=r&&!CF(e,n)&&(e.kind!==`point`||(e.pointWeights[n]??0)>0);return(0,Z.jsxs)(`g`,{children:[i?(0,Z.jsx)(`circle`,{cx:T(n),cy:E(t),r:15,className:`optimizer-target-node-hit`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation();let t=e.currentTarget.ownerSVGElement;c.current=n,l.current=e.pointerId,u.current={...s},f(n),t?.setPointerCapture(e.pointerId)}}):null,(0,Z.jsx)(`circle`,{cx:T(n),cy:E(t),r:i?6.5:5,className:`optimizer-target-node${e.pointWeights[n]>0?` active`:` muted`}${i?` draggable`:``}${d===n?` dragging`:``}`,style:{opacity:j(e.pointWeights[n]??0)},pointerEvents:`none`})]},`${e.id}-${n}`)})]}),g?(0,Z.jsx)(`rect`,{x:Math.min(g.startX,g.currentX),y:Math.min(g.startY,g.currentY),width:Math.abs(g.currentX-g.startX),height:Math.abs(g.currentY-g.startY),className:`optimizer-chart-zoom-selection`}):null]}),(0,Z.jsxs)(`div`,{className:`optimizer-chart-legend`,"aria-label":`Chart legend`,children:[i?(0,Z.jsx)(`span`,{className:`optimizer-chart-zoom-hint`,children:`Drag to zoom · Double-click to reset`}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`i`,{className:`current`}),i?`Baseline`:`Current`]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`i`,{className:`target`}),`Target`]}),n?(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`i`,{className:`optimized`}),`Optimized`]}):null]})]})}function IF({document:e,target:t,current:n,optimized:r,availableModes:i,onChange:a,onRemove:o}){let s=hF(t.channel,t.mode),c=JP.filter(e=>e.modes.includes(t.mode)),l=t.x.reduce((e,n,r)=>Math.abs(n)<Math.abs(t.x[e]??1/0)?r:e,0),u=t.target[l]??0,d=t.x[4]===t.x[0]?0:((t.target[4]??0)-(t.target[0]??0))/(t.x[4]-t.x[0]),f=SF(t.channel),p=(n,r,i=t.kind)=>{let o=EP(e,n),s={...t,mode:n,channel:r,kind:i,x:o},c=AP(e,s),l=bF(i).map((e,t)=>c[t]===null?0:e),u=i===`line`?xF(o,c,SF(r)):c.map(e=>e??0);a({...s,target:u,pointWeights:l})}
4396,m=(e,n)=>{let r=t.x[l]??0,i=f?0:e;a({...t,target:t.x.map(e=>i+n*(e-r))})};return(0,Z.jsxs)(`article`,{className:`optimizer-target-card`,children:[(0,Z.jsxs)(`header`,{className:`optimizer-target-card-head`,children:[(0,Z.jsx)(`span`,{className:`optimizer-drag-handle`,"aria-hidden":`true`,children:(0,Z.jsx)(se,{size:18})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`strong`,{children:s.label}),(0,Z.jsxs)(`span`,{children:[`vs `,gF(t.mode),` · `,s.unit]})]}),(0,Z.jsxs)(`label`,{className:`optimizer-curve-weight`,children:[(0,Z.jsx)(`span`,{children:`Curve weight`}),(0,Z.jsx)(mF,{ariaLabel:`Curve weight`,value:t.weight,normalizeValue:e=>dF(Math.round(e),1,100),onValueChange:e=>a({...t,weight:e})})]}),(0,Z.jsx)(`button`,{type:`button`,className:`optimizer-icon-button danger`,"aria-label":`Remove target`,onClick:o,children:(0,Z.jsx)(we,{size:17})})]}),(0,Z.jsxs)(`div`,{className:`optimizer-target-controls`,children:[(0,Z.jsxs)(`div`,{className:`optimizer-target-control-row primary`,children:[(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Analysis`}),(0,Z.jsx)(`select`,{value:t.mode,onChange:e=>{let t=e.target.value;p(t,JP.find(e=>e.modes.includes(t))?.key??`camberVariation`)},children:i.map(e=>(0,Z.jsx)(`option`,{value:e,children:gF(e)},e))})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Output`}),(0,Z.jsx)(`select`,{value:t.channel,onChange:e=>p(t.mode,e.target.value),children:c.map(e=>(0,Z.jsx)(`option`,{value:e.key,children:e.label},e.key))})]})]}),(0,Z.jsxs)(`div`,{className:`optimizer-target-control-row secondary kind-${t.kind}`,children:[(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Target definition`}),(0,Z.jsxs)(`select`,{value:t.kind,onChange:e=>{let n=e.target.value,r=n===`point`?t.x.map((e,t)=>t===l?5:0):bF(n),i=n===`line`?xF(t.x,t.target,SF(t.channel)):t.target;a({...t,kind:n,target:i,pointWeights:r})},children:[(0,Z.jsx)(`option`,{value:`point`,children:`Single point @ zero`}),(0,Z.jsx)(`option`,{value:`line`,children:`Line through a point`}),(0,Z.jsx)(`option`,{value:`curve`,children:`Five-point curve`})]})]}),t.kind===`point`?(0,Z.jsxs)(`label`,{className:`optimizer-compact-number-control`,children:[(0,Z.jsx)(`span`,{children:`Value`}),(0,Z.jsx)(mF,{ariaLabel:`Single point value at zero`,value:f?0:u,disabled:f,onValueChange:e=>{let n=[...t.target];n[l]=f?0:e,a({...t,target:n,pointWeights:t.x.map((e,t)=>t===l?5:0)})}})]}):null,t.kind===`line`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`label`,{className:`optimizer-compact-number-control`,children:[(0,Z.jsx)(`span`,{children:`Value at zero`}),(0,Z.jsx)(mF,{ariaLabel:`Value at zero`,value:f?0:u,disabled:f,onValueChange:e=>m(e,d)})]}),(0,Z.jsxs)(`label`,{className:`optimizer-compact-number-control`,children:[(0,Z.jsxs)(`span`,{children:[`Gradient (`,s.unit,`/`,vF(t.mode),`)`]}),(0,Z.jsx)(mF,{ariaLabel:`Gradient (${s.unit}/${vF(t.mode)})`,value:d,onValueChange:e=>m(u,e)})]})]}):null]})]}),(0,Z.jsx)(FF,{target:t,current:n,optimized:r,editable:t.kind===`curve`||t.kind===`point`,onTargetChange:(e,n)=>{if(CF(t,e))return;let r=[...t.target];r[e]=n,a({...t,target:r})}}),(0,Z.jsxs)(`div`,{className:`optimizer-point-matrix`,role:`group`,"aria-label":`Target points and weights`,children:[(0,Z.jsxs)(`div`,{className:`optimizer-point-matrix-row header`,children:[(0,Z.jsx)(`strong`,{children:`Point`}),t.x.map((e,n)=>(0,Z.jsxs)(`span`,{className:t.pointWeights[n]>0?`active`:``,children:[`P`,n+1]},`${t.id}-point-label-${n}`))]}),(0,Z.jsxs)(`div`,{className:`optimizer-point-matrix-row`,children:[(0,Z.jsx)(`strong`,{children:_F(t.mode)}),t.x.map((e,n)=>(0,Z.jsx)(`input`,{"aria-label":`Point ${n+1} axis value`,value:rF.format(e),disabled:!0},`${t.id}-x-${n}`))]}),(0,Z.jsxs)(`div`,{className:`optimizer-point-matrix-row target-values`,children:[(0,Z.jsx)(`strong`,{children:`Target`}),t.target.map((e,n)=>(0,Z.jsx)(mF,{ariaLabel:`Point ${n+1} target`,value:e,disabled:CF(t,n),onValueChange:e=>{if(CF(t,n))return;let r=[...t.target];r[n]=e,a({...t,target:r})}},`${t.id}-target-${n}`))]}),(0,Z.jsxs)(`div`,{className:`optimizer-point-matrix-row weight-values`,children:[(0,Z.jsx)(`strong`,{children:`Weight`}),t.pointWeights.map((e,n)=>(0,Z.jsx)(mF,{className:e>0?`active`:``,ariaLabel:`Point ${n+1} weight`,value:e,normalizeValue:e=>dF(Math.round(e),0,100),onValueChange:e=>{let r=[...t.pointWeights];r[n]=e,a({...t,pointWeights:r})}},`${t.id}-weight-${n}`))]})]})]})}function LF(e,t,n,r){if(e.bounds.kind!==`box`)return null;let i=e.bounds,a=i[n][t];return(0,Z.jsx)(mF,{ariaLabel:`${t.toUpperCase()} ${n}`,value:a,onValueChange:a=>r({...e,bounds:{...i,[n]:{...i[n],[t]:a}}})})}function RF({document:e,constraints:t,onChange:n}){let r=new Map(yT(e).map(e=>[e.id,e])),i=hP(e),a=new Map(i.hardpoints.map(e=>[e.id,e])),o=(e,r)=>{let i=[...t];i[e]=r,n(i)},s=t.filter(e=>e.enabled).length,c=e=>e.hardpointId.endsWith(`-c`)||e.hardpointId===`p1`||e.hardpointId===`p2`,l=t.map((e,t)=>({constraint:e,index:t})),u=l.filter(({constraint:e})=>c(e)),d=l.filter(({constraint:e})=>!c(e)),f=({constraint:e,index:t})=>{let n=gT.find(t=>
4396t.id===e.hardpointId),i=a.get(e.hardpointId),s=r.get(e.hardpointId)?.point??{x:0,y:0,z:0},c=i?.label??n?.label??e.hardpointId;return(0,Z.jsxs)(`div`,{className:`optimizer-hardpoint-card${e.enabled?` active`:``}`,role:`row`,children:[(0,Z.jsxs)(`label`,{className:`optimizer-switch`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:n=>o(t,{...e,enabled:n.target.checked})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`})]}),(0,Z.jsxs)(`div`,{className:`optimizer-hardpoint-name`,children:[(0,Z.jsx)(`strong`,{children:c}),(0,Z.jsx)(`span`,{children:i?.group??n?.group}),(0,Z.jsxs)(`code`,{children:[rF.format(s.x),` / `,rF.format(s.y),` / `,rF.format(s.z)]})]}),(0,Z.jsxs)(`select`,{"aria-label":`Boundary for ${c}`,value:e.bounds.kind,disabled:!e.enabled,onChange:n=>{n.target.value===`sphere`?o(t,{...e,bounds:{kind:`sphere`,radius:50}}):n.target.value===`cube`?o(t,{...e,bounds:{kind:`cube`,side:50}}):o(t,{...e,bounds:{kind:`box`,min:{x:s.x-10,y:s.y-10,z:s.z-10},max:{x:s.x+10,y:s.y+10,z:s.z+10}}})},children:[(0,Z.jsx)(`option`,{value:`box`,children:`XYZ box`}),(0,Z.jsx)(`option`,{value:`cube`,children:`Cube`}),(0,Z.jsx)(`option`,{value:`sphere`,children:`Sphere`})]}),e.bounds.kind===`box`?(0,Z.jsx)(`div`,{className:`optimizer-box-limits optimizer-hardpoint-card-limits`,children:[`x`,`y`,`z`].map(n=>(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:n.toUpperCase()}),LF(e,n,`min`,e=>o(t,e)),(0,Z.jsx)(`i`,{children:`â`}),LF(e,n,`max`,e=>o(t,e))]},n))}):(0,Z.jsxs)(`label`,{className:`optimizer-radius-input optimizer-hardpoint-card-size`,children:[(0,Z.jsx)(`span`,{children:e.bounds.kind===`sphere`?`Radius`:`Side`}),(0,Z.jsx)(mF,{ariaLabel:`${e.bounds.kind===`sphere`?`Radius`:`Side`} for ${c}`,disabled:!e.enabled,value:e.bounds.kind===`sphere`?e.bounds.radius:e.bounds.side,normalizeValue:e=>Math.max(.001,e),onValueChange:n=>{e.bounds.kind===`sphere`?o(t,{...e,bounds:{kind:`sphere`,radius:n}}):e.bounds.kind===`cube`&&o(t,{...e,bounds:{kind:`cube`,side:n}})}}),(0,Z.jsx)(`em`,{children:`mm`})]})]},e.hardpointId)},p=(e,t)=>(0,Z.jsxs)(`section`,{className:`optimizer-hardpoint-column`,"aria-label":`${e} hardpoints`,children:[(0,Z.jsxs)(`header`,{className:`optimizer-hardpoint-column-heading`,children:[(0,Z.jsx)(`strong`,{children:e}),(0,Z.jsxs)(`span`,{children:[t.filter(({constraint:e})=>e.enabled).length,` / `,t.length,` active`]})]}),(0,Z.jsxs)(`div`,{className:`optimizer-hardpoint-compact-header`,"aria-hidden":`true`,children:[(0,Z.jsx)(`span`,{children:`Use`}),(0,Z.jsx)(`span`,{children:`Hardpoint · Current X / Y / Z`}),(0,Z.jsx)(`span`,{children:`Boundary`}),(0,Z.jsx)(`span`,{children:`Size`})]}),(0,Z.jsx)(`div`,{role:`table`,"aria-label":`${e} optimization constraints`,children:t.map(f)})]});return(0,Z.jsxs)(`section`,{className:`optimizer-tab-panel`,children:[(0,Z.jsxs)(`div`,{className:`optimizer-section-heading`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`optimizer-eyebrow`,children:`DESIGN VARIABLES`}),(0,Z.jsx)(`h2`,{children:`Hardpoint constraints`})]}),(0,Z.jsxs)(`div`,{className:`optimizer-heading-stat`,children:[(0,Z.jsx)(`strong`,{children:s}),(0,Z.jsx)(`span`,{children:`active hardpoints`})]})]}),(0,Z.jsx)(`div`,{className:`optimizer-topology-banner`,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(C,{size:16}),(0,Z.jsx)(`span`,{children:`Detected topology`}),(0,Z.jsx)(`strong`,{children:i.label})]})}),(0,Z.jsxs)(`div`,{className:`optimizer-hardpoint-columns`,children:[p(`Chassis side`,u),p(`Wheel side`,d)]})]})}async function zF(e,t,n,r,i){let a=window.showSaveFilePicker;if(a){let o=await(await a({suggestedName:e,types:[{description:n,accept:{[i]:[r]}}]})).createWritable();await o.write(t),await o.close();return}let o=new Blob([t],{type:`${i};charset=utf-8`}),s=URL.createObjectURL(o),c=document.createElement(`a`);c.href=s,c.download=e,c.click(),URL.revokeObjectURL(s)}async function BF(e,t){return zF(e.replace(/\.spm$/i,``)+`_optimized.spm`,t,`3DSusp suspension`,`.spm`,`text/plain`)}function VF(){let e=sF(),t=cF(),[n,r]=(0,h.useState)(uF),[i,a]=(0,h.useState)(()=>UP()),[o,s]=(0,h.useState)(oF),[c,l]=(0,h.useState)([]),[u,d]=(0,h.useState)([]),[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(null),[_,v]=(0,h.useState)(null),[y,S]=(0,h.useState)([]),[C,w]=(0,h.useState)(null),[T,D]=(0,h.useState)(!1),[O,k]=(0,h.useState)(null),[A,ee]=(0,h.useState)(!1),[te,ne]=(0,h.useState)(1),[N,P]=(0,h.useState)(()=>
4396{if(typeof window>`u`)return 344;let e=Number(window.localStorage.getItem(iF));return Number.isFinite(e)?dF(e,280,720):344}),[ie,oe]=(0,h.useState)(null);(0,h.useEffect)(()=>{let e=window.matchMedia?.(`(prefers-color-scheme: dark)`),t=()=>r(uF()),n=e=>{e.key===aF&&t()};return window.addEventListener(`storage`,n),e?.addEventListener(`change`,t),()=>{window.removeEventListener(`storage`,n),e?.removeEventListener(`change`,t)}},[]);let se=(0,h.useRef)(null),F=(0,h.useRef)(null),ce=(0,h.useRef)(null),le=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=window.document.title;return window.document.title=`3DSusp Web Optimizer`,()=>{window.document.title=e}},[]),(0,h.useEffect)(()=>{if(!A)return;let e=e=>{e.key===`Escape`&&ee(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[A]);let ue=(0,h.useMemo)(()=>i?eC(i.spmText,i.sourceName):null,[i]),I=(0,h.useMemo)(()=>ue?TP(ue,i?.verifiedKinematicLimits):null,[ue,i?.verifiedKinematicLimits]),de=(0,h.useMemo)(()=>C&&i?TP(eC(C,i.sourceName),i.verifiedKinematicLimits):null,[C,i]),fe=(0,h.useMemo)(()=>I?EF(I):[],[I]);(0,h.useEffect)(()=>GP(a),[]),(0,h.useEffect)(()=>{let e=()=>{window.scrollTo(0,0),window.document.documentElement.scrollTop=0,window.document.documentElement.scrollLeft=0,window.document.body.scrollTop=0,window.document.body.scrollLeft=0};e();let t=window.requestAnimationFrame(e);return()=>window.cancelAnimationFrame(t)},[]),(0,h.useEffect)(()=>{if(!I)return;let e=MP(I),t=zP(i?.sourceName??``),n=new Map(t?.constraints.map(e=>[e.hardpointId,e]));l(e.map(e=>n.get(e.hardpointId)??e)),d(t?kF(I,t.targets):kF(I,[TF(I,EF(I)[0]??`bump`)])),v(null),S([]),w(null),ee(!1),k(null),oe(i?.sourceName??null)},[i?.openedAt]),(0,h.useEffect)(()=>{},[e,t,null,I,i]),(0,h.useEffect)(()=>{ie&&BP({version:1,sourceName:ie,constraints:c,targets:u,savedAt:Date.now()})},[ie,c,u]);let me=()=>{if(F.current)return Promise.resolve(F.current);if(ce.current)return ce.current;let e=(async()=>{p(null),g(null);try{let e=new aP({loaderModuleUrl:sN,wasmBinary:(await fP()).bytes});return await e.initialize(),F.current?.dispose(),F.current=e,p(!0),g(null),e}catch(e){return F.current?.dispose(),F.current=null,p(!1),g(e instanceof Error&&e.message?e.message:`The optimizer could not be prepared. Reopen it from 3DSusp Web and try again.`),null}finally{ce.current=null}})();return ce.current=e,e};(0,h.useEffect)(()=>{if(!lF())return me(),()=>{F.current?.dispose(),F.current=null}},[]),(0,h.useEffect)(()=>{window.localStorage.setItem(iF,String(N))},[N]);let he=e=>{e.preventDefault();let t=e.currentTarget.parentElement?.getBoundingClientRect().left??0,n=window.document.body.style.cursor,r=window.document.body.style.userSelect;window.document.body.style.cursor=`col-resize`,window.document.body.style.userSelect=`none`;let i=e=>{let n=Math.max(320,Math.min(720,window.innerWidth-440));P(dF(e.clientX-t,280,n))},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a),window.document.body.style.cursor=n,window.document.body.style.userSelect=r};window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,a)},_e=u.map(e=>`${e.id}:${e.mode}:${e.channel}:${e.x.join(`,`)}`).join(`|`),ye=(0,h.useMemo)(()=>I?new Map(u.map(e=>[e.id,AP(I,e)])):new Map,[I,_e]),z=(0,h.useMemo)(()=>de?new Map(u.map(e=>[e.id,AP(de,e)])):new Map,[de,_e]),xe=(0,h.useMemo)(()=>I?{...I,graphics:{...I.graphics,lineWidth:Math.max(I.graphics.lineWidth*1.35,2.4),drawWheels:!0,drawUpright:!0,drawRocker:!0,drawSprings:!0,drawHeaveSpring:!1,drawRollSpring:!1,drawCBar:!1,drawTBar:!1,drawThirdElement:!1,drawArms3D:!1,drawSteering:!1,drawSteeringAxis:!1,drawGroundLine:!1,virtualPointsLines:!1,drawArrow:!1,drawOrigin:!1,drawCenterOfGravity:!1,drawOppositeAxle:!1}}:null,[I]),Se=(0,h.useMemo)(()=>{if(!xe)return[];let e=new Set(hP(xe).hardpoints.map(e=>e.id));return yT(xe).filter(t=>e.has(t.id))},[xe]),we=(0,h.useMemo)(()=>{if(!I)return[];let e=new Map(yT(I).map(e=>[e.id,e.point]));return c.flatMap(t=>{if(!t.enabled)return[];
4396if(t.bounds.kind===`box`)return[{id:t.hardpointId,kind:`box`,min:t.bounds.min,max:t.bounds.max}];let n=e.get(t.hardpointId);if(!n)return[];if(t.bounds.kind===`cube`){let e=t.bounds.side*.5;return[{id:t.hardpointId,kind:`box`,min:{x:n.x-e,y:n.y-e,z:n.z-e},max:{x:n.x+e,y:n.y+e,z:n.z+e}}]}return[{id:t.hardpointId,kind:`sphere`,center:n,radius:t.bounds.radius}]})},[c,I]);if(!i||!I)return(0,Z.jsxs)(`main`,{className:`optimizer-empty-page`,children:[(0,Z.jsx)(`img`,{src:MM,alt:`3DSusp`}),(0,Z.jsx)(`h1`,{children:`No suspension has been sent to the optimizer`}),(0,Z.jsx)(`p`,{children:`Open a suspension in 3DSusp and choose Optimizer from the main toolbar.`})]});let Ee=c.filter(e=>e.enabled),De=u.reduce((e,t)=>e+t.pointWeights.filter(e=>e>0).length,0),ke=fe.length>0&&Ee.length>0&&De>0&&!T,Ae=async()=>{try{let e=hP(I).label,t=tF({sourceName:i.sourceName,topology:e,constraints:c,targets:u});await zF(`${i.sourceName.replace(/\.[^.]+$/i,``)||`3dsusp`}.opt`,t,`3DSusp optimizer configuration`,`.opt`,`application/json`)}catch(e){e instanceof DOMException&&e.name===`AbortError`||k(e instanceof Error?e.message:`Unable to save the .opt configuration.`)}},je=async e=>{try{let t=nF(await e.text(),MP(I),hP(I).label);l(t.constraints),d(kF(I,t.targets)),v(null),S([]),w(null),k(null)}catch(e){k(e instanceof Error?e.message:`Unable to load the .opt configuration.`)}},Me=e=>{Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)},Ne=e=>{let t=Array.from(e.dataTransfer.files);if(t.length===0)return;if(e.preventDefault(),t.length!==1||!/\.opt$/i.test(t[0].name)){k(`Drop one .opt optimizer configuration file.`);return}let[n]=t;je(n)},Pe=(e,t)=>{d(n=>n.map(n=>n.id===e?wF(t):n)),v(null),S([]),w(null)},Fe=async()=>{if(!ke)return;s(`results`),D(!0),k(null),v(null),S([]),w(null),ee(!1);let e=new AbortController;se.current=e;try{let t=F.current??await me();if(!t)throw Error(`The optimizer could not be prepared. Reopen it from 3DSusp Web and try again.`);let n=await QN({version:1,spmText:i.spmText,sourceName:i.sourceName,hardpoints:Ee,targets:u.map(e=>{let t=wF(e);return{...t,initial:ye.get(e.id)??t.target.map(()=>null)}}),initialStates:jP(I,u),options:{maxIterations:350,tolerance:1e-8,geometryRegularization:1e-7}}),r=await dP(n.packet),a=await t.solvePacked(n,{signal:e.signal,onIteration:e=>{S(t=>t.at(-1)?.iteration===e.iteration?[...t.slice(0,-1),e]:[...t,e])}});v(a),S(a.history??[]),p(!0),a.ok?(w(NP(i.spmText,a.hardpoints,I)),lP(r.authorizationId)):w(null)}catch(e){if(!(e instanceof DOMException&&e.name===`AbortError`)){let t=e instanceof Error?e.message:`Optimization failed.`;k(/authoriz|session|401|403/i.test(t)?`The optimizer request could not be started. Reopen it from 3DSusp Web and try again.`:t)}}finally{D(!1),se.current=null}};return(0,Z.jsxs)(`div`,{className:`optimizer-page theme-${n}`,onDragOver:Me,onDrop:Ne,children:[(0,Z.jsxs)(`header`,{className:`optimizer-topbar`,children:[(0,Z.jsxs)(`div`,{className:`optimizer-brand`,children:[(0,Z.jsx)(`img`,{src:MM,alt:``}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`strong`,{children:`3DSusp Web Optimizer`}),(0,Z.jsx)(`span`,{children:`Kinematic target matching`})]})]}),(0,Z.jsxs)(`div`,{className:`optimizer-source-chip`,children:[(0,Z.jsx)(re,{size:15}),(0,Z.jsx)(`span`,{children:i.sourceName})]}),(0,Z.jsxs)(`div`,{className:`optimizer-config-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>le.current?.click(),children:[(0,Z.jsx)(Te,{size:15}),`Load .opt`]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>void Ae(),children:[(0,Z.jsx)(ve,{size:15}),`Save .opt`]}),(0,Z.jsx)(`input`,{ref:le,type:`file`,accept:`.opt,application/json`,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&je(t),e.currentTarget.value=``}})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`optimizer-run-button`,disabled:!ke,title:`Run optimization`,onClick:()=>void Fe(),children:[T?(0,Z.jsx)(b,{className:`optimizer-spin`,size:17}):(0,Z.jsx)(L,{size:17}),(0,Z.jsx)(`span`,{children:T?`Optimizingâ¦`:`Optimize`})]}),T?(0,Z.jsxs)(`button`,{type:`button`,className:`optimizer-cancel-button`,onClick:()=>se.current?.abort(),children:[(0,Z.jsx)(Oe,{size:16}),`Cancel`]}):null]}),(0,Z.jsxs)(`div`,{className:`optimizer-layout`,style:{"--optimizer-sidebar-width":`${N}px`},children:[(0,Z.jsxs)(`aside`,{className:`optimizer-sidebar`,children:[(0,Z.jsxs)(`nav`,{"aria-label":`Optimizer workflow`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:o===`hardpoints`?`active`:``,onClick:()=>s(`hardpoints`),children:[(0,Z.jsx)(`span`,{className:`optimizer-step-number`,children:`1`}),(0,Z.jsx)(be,{size:18}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`strong`,{children:`Constraints`}),(0,Z.jsxs)(`small`,{children:[Ee.length,` design variables`]})]})]}),(0,Z.jsxs)(`button`,{type:`button`,className:o===`targets`?`active`:``,onClick:()=>s(`targets`),children:[(0,Z.jsx)(`span`,{className:`optimizer-step-number`,children:`2`}),(0,Z.jsx)(Ce,{size:18}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`strong`,{children:`Target curves`}),(0,Z.jsxs)(`small`,{children:[u.length,` curves · `,De,` points`]})]})]}),(0,Z.jsxs)(`button`,{type:`button`,className:o===`results`?`active`:``,onClick:()=>s(`results`),children:[(0,Z.jsx)(`span`,{className:`optimizer-step-number`,children:`3`}),(0,Z.jsx)(ae,{size:18}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`strong`,{children:`Results`}),(0,Z.jsx)(`small`,{children:T?`Iteration ${y.at(-1)?.iteration??0}`:_?_.ok?`Solution available`:`Not solved`:`Waiting for solve`})]})]})]}),(0,Z.jsxs)(`section`,{className:`optimizer-viewport-panel optimizer-sidebar-viewport`,children:[(0,Z.jsxs)(`header`,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`optimizer-eyebrow`,children:`LIVE G
4396EOMETRY`}),(0,Z.jsx)(`strong`,{children:de?`Baseline + optimized`:`Baseline suspension`})]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Reset 3D view`,onClick:()=>ne(e=>e+1),children:(0,Z.jsx)(R,{size:15})})]}),(0,Z.jsxs)(`div`,{className:`optimizer-viewport-legend`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`i`,{className:`suspension`}),`Baseline`]}),de?(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`i`,{className:`optimized`}),`Optimized`]}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`i`,{className:`boundary`}),`Bounds (`,we.length,`)`]})]}),(0,Z.jsx)(`div`,{className:`optimizer-viewport-canvas`,children:xe?(0,Z.jsx)(YA,{document:xe,referenceDocument:I,ghostWireframeDocument:de,ghostWireframeColor:n===`light`?`#0e9ed8`:`#54c7f4`,ghostWireframeLineWidth:Math.max(I.graphics.lineWidth*1.8,3),sideMode:`right-only`,themeMode:n,lightThemeActive:n===`light`,showLeft:!1,showPoints:!0,hardpoints:Se,hardpointBoundaries:we,monochromeColor:n===`light`?`#667085`:`#8f9baa`,optimizerKinematicsOnly:!0,resetViewToken:te,resetViewPreset:`default3D`}):null}),(0,Z.jsx)(`footer`,{children:`Orbit, pan and zoom as in the main view`})]})]}),(0,Z.jsx)(`button`,{type:`button`,className:`optimizer-sidebar-splitter`,"aria-label":`Resize 3D panel`,title:`Drag to resize the 3D panel`,onPointerDown:he}),(0,Z.jsx)(`div`,{className:`optimizer-workspace`,children:(0,Z.jsxs)(`main`,{className:`optimizer-content`,children:[f===!1&&m?(0,Z.jsxs)(`div`,{className:`optimizer-error-banner`,children:[(0,Z.jsx)(pe,{size:18}),(0,Z.jsx)(`span`,{children:m})]}):null,O?(0,Z.jsxs)(`div`,{className:`optimizer-error-banner`,children:[(0,Z.jsx)(pe,{size:18}),(0,Z.jsx)(`span`,{children:O}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>k(null),children:(0,Z.jsx)(Oe,{size:15})})]}):null,o===`hardpoints`?(0,Z.jsx)(RF,{document:I,constraints:c,onChange:e=>{l(e),v(null),S([]),w(null)}}):null,o===`targets`?(0,Z.jsxs)(`section`,{className:`optimizer-tab-panel`,children:[(0,Z.jsxs)(`div`,{className:`optimizer-section-heading`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`optimizer-eyebrow`,children:`OBJECTIVE FUNCTION`}),(0,Z.jsx)(`h2`,{children:`Target curves`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`optimizer-add-target`,disabled:fe.length===0,onClick:()=>{let e=fe[0];e&&d(t=>[...t,TF(I,e)])},children:[(0,Z.jsx)(ge,{size:16}),`Add target`]})]}),(0,Z.jsxs)(`div`,{className:`optimizer-target-list`,children:[u.map(e=>(0,Z.jsx)(IF,{document:I,target:e,current:ye.get(e.id)??[],optimized:z.get(e.id),availableModes:fe,onChange:t=>Pe(e.id,t),onRemove:()=>d(t=>t.filter(t=>t.id!==e.id))},e.id)),(0,Z.jsxs)(`button`,{type:`button`,className:`optimizer-add-target-card`,disabled:fe.length===0,onClick:()=>{let e=fe[0];e&&d(t=>[...t,TF(I,e)])},children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(ge,{size:20})}),(0,Z.jsx)(`strong`,{children:`Add target`}),(0,Z.jsx)(`small`,{children:`Add another curve to the objective function`})]})]})]}):null,o===`results`?(0,Z.jsxs)(`section`,{className:`optimizer-tab-panel`,children:[(0,Z.jsxs)(`div`,{className:`optimizer-section-heading`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`optimizer-eyebrow`,children:`SOLUTION REVIEW`}),(0,Z.jsx)(`h2`,{children:_&&!_.ok?`Optimization not solved`:`Optimized suspension`})]}),_?.ok&&C?(0,Z.jsxs)(`div`,{className:`optimizer-result-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`secondary`,onClick:()=>void BF(i.sourceName,C),children:[(0,Z.jsx)(M,{size:16}),`Export optimized .spm`]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>ee(!0),children:[(0,Z.jsx)(E,{size:16}),`Apply to 3DSusp`]})]}):null]}),T||y.length>0?(0,Z.jsx)(PF,{history:y,running:T,result:_}):null,!T&&_?(0,Z.jsxs)(`div`,{className:`optimizer-result-metrics${_.ok?``:` failed`}`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{children:`Status`}),(0,Z.jsx)(`strong`,{children:_.ok?`Solved`:`Not solved`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{children:`Objective`}),(0,Z.jsx)(`strong`,{children:rF.format(_.objective)})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{children:`Solver error`}),(0,Z.jsx)(`strong`,{children:MF(_.solverError??(typeof _.diagnostics?.maxConstraintViolation==`number`?_.diagnostics.maxConstraintViolation:NaN))})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{children:`Iterations`}),(0,Z.jsx)(`strong`,{children:_.iterations})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{children:`Solve time`}),(0,Z.jsxs)(`strong`,{children:[rF.format(_.solveTimeMs/1e3),` s`]})]})]}):null,T?null:_&&!_.ok?(0,Z.jsxs)(`div`,{className:`optimizer-empty-results optimizer-unsolved-results`,children:[(0,Z.jsx)(pe,{size:34}),(0,Z.jsx)(`h3`,{children:`No usable optimized suspension`}),(0,Z.jsx)(`p`,{children:`The optimization was not solved. No optimized geometry was created, and nothing can be exported or applied to 3DSusp.`})]}):!_||!de?(0,Z.jsxs)(`div`,{className:`optimizer-empty-results`,children:[(0,Z.jsx)(B,{size:34}),(0,Z.jsx)(`h3`,{children:`No optimized geometry yet`}),(0,Z.jsx)(`p`,{children:`Configure at least one hardpoint and one weighted target point, then run the optimizer.`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>s(`hardpoints`),children:[(0,Z.jsx)(x,{size:16}),`Start configuration`]})]}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(`div`,{className:`optimizer-result-curves`,children:u.map(e=>(0,Z.jsxs)(`article`,{className:`optimizer-result-curve-card`,children:[(0,Z.jsxs)(`header`,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`strong`,{children:hF(e.channel,e.mode).label}),(0,Z.jsxs)(`span`,{children:[gF(e.mode),` · weight `,e.weight]})]}),(0,Z.jsx)(j,{size:10})]}),(0,Z.jsx)(FF,{target:e,current:ye.get(e.id)??[],optimized:z.get(e.id),editable:!1,zoomable:!0})]},`result-${e.id}`))})})]}):null]})})]}),A?(0,Z.jsx)(`div`,{className:`optimizer-confirm-overlay`,role:`presentation`,onPointerDown:e=>{e.target===e.currentTarget&&ee(!1)},children:(0,Z.jsxs)(`section`,{className:`optimizer-confirm-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`optimizer-apply-confirm-title`,children:[(0,Z.jsx)(`div`,{className:`optimizer-confirm-icon`,children:(0,Z.jsx)(pe,{size:22})}),(0,Z.jsxs)(`div`,{className:`optimizer-confirm-copy`,children:[(0,Z.jsx)(`span`,{className:`optimizer-eyebrow`,children:`CONFIRM APPLICATION`}),(0,Z.jsx)(`h2`,{id:`optimizer-apply-confirm-title`,children:`Overwrite the current suspension?`}),(0,Z.jsx)(`p`,{children:`Applying the optimized result will over
4396write the suspension currently open in 3DSusp with this optimized geometry.`})]}),(0,Z.jsxs)(`div`,{className:`optimizer-confirm-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,autoFocus:!0,onClick:()=>ee(!1),children:`Cancel`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{C&&(KP({type:`apply-optimized-spm`,version:1,sourceSpmText:i.spmText,optimizedSpmText:C,sourceName:i.sourceName}),ee(!1))},children:[(0,Z.jsx)(E,{size:16}),`Apply and overwrite`]})]})]})}):null]})}var HF=`0x4AAAAAADPKHBCAnrGIk0cy`?.trim()??``,UF=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,WF=`https://www.bspokeautomotive.it/3DSuspWebBeta/3DSuspWeb_UserGuide.pdf`,GF=`3DSuspWeb_UserGuide.pdf`,KF=`./assets/bspoke-automotive-logo.svg`,qF=`models/F1_Full.step`,JF=`models/285_40.csv`,YF=!1,XF=`Not available in this beta version.`,ZF=100,QF=25,$F=new Set([`hs-right`,`rs-right`]);function eI(e){return!$F.has(e)}var tI=[{id:`suspensionSettings`,label:`Suspension Settings`},{id:`vehicleSettings`,label:`Vehicle Settings`},{id:`suspensionGeometry`,label:`Suspension Geometry`},{id:`suspensionElements`,label:`Suspension Elements`},{id:`steeringSettings`,label:`Steering Settings`},{id:`run`,label:`Run Parameters`},{id:`loadCase`,label:`Load Case`},{id:`graphics`,label:`Graphic Settings`},{id:`stepGeometry`,label:`Step Geometry`}],nI={id:`setup`,label:`Setup mode`},rI={id:`rocker`,label:`Rocker mode`},iI={id:`fullVehicle`,label:`Full vehicle mode`},aI=new Set([`setup`,`graphics`]),oI=new Set([`rocker`,`graphics`]),sI=new Set([`fullVehicle`,`graphics`]),cI=[`TLF`,`TLR`,`BLF`,`BLR`,`TR`,`Spring`,`PR`,`SplitRocker`],lI=[`TLF`,`TLR`,`BLF`,`BLR`,`TR`,`PRC`],uI=[`TLF`,`TLR`,`BLF`,`BLR`,`TR`,`PR`],dI=`#f59e0b`,fI={suspensionSettings:{title:`Suspension Settings`,description:`Define the suspension architecture before you edit geometry, setup, or analysis parameters.`,sections:[{heading:`Use this tab to`,items:[`Choose axle position, suspension type, configuration, and mounting point.`,`Enable model options such as Integral Link where they are supported. MonoShock is unavailable during the beta.`]},{heading:`Good practice`,items:[`Set these options first because they drive which points, elements, and tabs are available elsewhere.`,`If an option becomes unavailable after a change, review the updated model limits before continuing.`]}]},vehicleSettings:{title:`Vehicle Settings`,description:`Enter the wheel, tyre, alignment, and vehicle reference data used by the kinematic model.`,sections:[{heading:`Use this tab to`,items:[`Define wheel and tyre data, static camber and toe, wheelbase, CG height, and anti-effect references.`,`Configure driveshaft and CV-joint inputs when the selected driveline layout requires them.`]},{heading:`Good practice`,items:[`Match wheel definition, brake position, wheel drive, and fixed joint position to the real vehicle layout.`,`Check the read-only driveshaft length after edits to confirm the geometry remains sensible.`]}]},suspensionGeometry:{title:`Suspension Geometry`,description:`Edit the main hardpoint coordinates and inspect the derived link lengths and rocker angles.`,sections:[{heading:`Use this tab to`,items:[`Edit chassis-side and wheel-side coordinates directly in the tables.`,`Select points from the table to highlight them in the views and keep the 2D/3D workspace in sync.`]},{heading:`Extra tools`,items:[`Open Tabular input & transformations to paste full coordinate tables, export CSV, flip axes, or apply offsets.`,`Use the read-only link and rocker outputs to validate the edited geometry as you work.`]}]},suspensionElements:{title:`Suspension Elements`,description:`Control optional suspension elements and set the points that define their packaging and kinematics.`,sections:[{heading:`Use this tab to`,items:[`Enable or disable anti-roll bars, third element, heave spring, and roll spring.`,`Edit each enabled element geometry and review the associated lengths, 3D angles, and moment arms.`]},{heading:`Good practice`,items:[`Turn on only the elements that exist in the current architecture so the model stays consistent.`,`Read the calculated outputs after every edit to confirm the rocker and spring layout behaves as intended.`]}]},steeringSettings:{title:`Steering Settings`,description:`Set the rack-and-pinion inputs, steering column definition, and steering model behaviour.`,sections:[{heading:`Use this tab to`,items:[`Enter C-factor, pinion offsets, shaft lengths, steering wheel size, and steering column coordinates.`,`Choose pinion position and steering model, then review the derived steering geometry summary.`]},{heading:`Extra tools`,items:[`Use the optimisation command when available to reduce steering-column non-uniformity.`,`Watch the warning message if the steering direction becomes opposite to the expected road-wheel response.`]}]}
4396,run:{title:`Run Parameters`,description:`Choose which analyses to solve, define the travel limits, and verify whether the requested range is feasible.`,sections:[{heading:`Use this tab to`,items:[`Enable bump, roll, steer, steering-column, and bump-steer calculations.`,`Set maxima and step counts for bump, rebound, steer, and bump-steer angle inputs.`]},{heading:`Checks`,items:[`Run Verify limits before a full solve to compare your requested range with the verified kinematic limits.`,`Use Run Calculations once the indicators and output message show that the input range is acceptable.`]}]},loadCase:{title:`Load Case`,description:`Apply external wheel loads to the current pose and review how they resolve into suspension reactions and axial forces.`,sections:[{heading:`Use this tab to`,items:[`Enter contact-patch and wheel-centre forces/moments for the right side, with optional independent left-side values.`,`Add internal coupled actions from C/T bars, heave element, and roll element as imposed force or torque inputs.`]},{heading:`Good practice`,items:[`Keep spring and pushrod loads as outputs unless you are modelling an internal coupled element explicitly.`,`Check equilibrium residual and warnings after changing mounting point, rocker layout, or linked elements.`]}]},graphics:{title:`Graphic Settings`,description:`Adjust the visual scale and decide which physical and virtual features are shown in the 2D and 3D views.`,sections:[{heading:`Use this tab to`,items:[`Change visual sizes such as line width, point size, spring diameter, and opacity-related settings.`,`Show or hide components, hardpoints, steering helpers, roll-centre tools, tyre profile, and ghost references.`]},{heading:`Good practice`,items:[`Use Toggle all to clear the view quickly when you need to isolate one subsystem.`,`Keep Ghost reference for comparisons and Ghost baseline for saved-state overlays distinct when reviewing changes.`]}]},stepGeometry:{title:`Step Geometry`,description:`Manage imported STEP meshes and control how reference CAD is displayed and transformed.`,sections:[{heading:`Use this tab to`,items:[`Set import resolution, display resolution, and surface opacity for STEP meshes.`,`Select a mesh, change its colour and visibility, and edit its scale, rotation, and translation.`]},{heading:`Good practice`,items:[`Use Reset transform on a selected mesh if alignment work goes off track.`,`Enable mesh clash detection only when needed because it is a visual aid, not a full clearance study.`]}]},log:{title:`Log`,description:`Review the application event history and the latest actions recorded during editing, solving, import, and export.`,sections:[{heading:`Use this tab to`,items:[`Track geometry edits, mode changes, file operations, verification runs, and calculation completion messages.`,`Confirm what happened most recently when a result, import, or export does not look as expected.`]},{heading:`Good practice`,items:[`Read the newest entries first because the list is shown in reverse chronological order.`,`Use the log together with the Monitor and output tabs when checking cause and effect after a change.`]}]},setup:{title:`Setup Mode`,description:`Apply setup-style adjustments on top of the frozen design suspension without overwriting the baseline geometry.`,sections:[{heading:`Use this tab to`,items:[`Adjust link lengths, ride height strategy, chassis offsets, and shim values while comparing current setup against baseline.`,`Review the built-in monitor rows to see how setup changes affect ride height, alignment, spring data, and motion ratios. Press F7 to open the Monitor.`]},{heading:`Important behaviour`,items:[`When Setup mode is active, the design suspension is frozen and only Setup mode and Graphic Settings remain editable.`,`Use Reset to clear setup adjustments, or Export to write a setup-specific SPM once the result is confirmed.`]}]},rocker:{title:`Rocker Mode`,description:`Edit rocker-plane-related coordinates in a dedicated local reference frame for pushrod and pullrod suspensions.`,sections:[{heading:`Use this tab to`,items:[`Inspect reference hardpoints, edit rocker-linked coordinates in local rocker axes, and review derived rocker geometry metrics.`,`Work directly in the auxiliary rocker plane while the rest of the design remains protected from unrelated edits.`]},{heading:`Reference mode toggle`,items:[`Link-based mode uses the suspension-link reference point associated with the current mounting point and is intended for link-driven rocker layouts.`,`Rod-based mode uses the pushrod or pullrod wheel-side point as the reference and is the fallback when a link-based reference is not available.`]},{heading:`Important behaviour`,items:[`Rocker mode is available only for Pushrod and Pullrod configurations.`,`When you leave the mode, choose whether to apply or discard the coordinate changes made in the rocker plane.`]}]},fullVehicle:{title:`Full vehicle mode`,description:`Combine the primary suspension with an auxiliary axle and inspect the complete vehicle during bump and roll.`,sections:[{heading:`Use this tab to`,items:[`Open the auxiliary axle SPM. It is placed on the opposite end of the vehicle at the primary wheelbase.`,`The auxiliary contact patches are aligned to the primary Z level and the complete auxiliary geometry is shown in grey.`]},{heading:`Dynamic behaviour`,items:[`Bump, roll, Ground fixed and the active graphic toggles are shared with the primary axle.`,`When Roll centre is visible, the dynamic roll axis connects the roll centres of the two axles.`]},{heading:`File link`,items:[`The auxiliary file name is stored in the primary SPM. The last loaded file is also cached locally as a browser fallback.`,`If the linked file is not in the local cache, reopen it from this tab to restore the full vehicle.`]}]}},pI=[{keys:[`Ctrl / Cmd + S`],description:`Save the current .spm file. Opens Save As when the file has no writable local handle.`},{keys:[`Ctrl / Cmd + O`],description:`Open a local .spm file.`},{keys:[`Ctrl / Cmd + N`],description:`Create a new .spm document.`},{keys:[`F11`],description:`Toggle browser fullscreen.`},{keys:[`F4`],description:`Toggle the kinematics essentials view: hardpoints, 3D links, steering axis, ground line, roll centre, CG and wheel circles.`},{keys:[`F9`],description:`Toggle the 2D-only view. The Animation panel becomes a movable floating window.`},{keys:[`F10`],description:`Toggle the 3D-only view. The Animation panel becomes a movable floating window.`},{keys:[`F8`],description:`Fit the control deck to the active tab content; press again to restore the previous height. Hold for 1.5 seconds to collapse the deck to the tab labels only.`},{keys:[`F6`],description:`Detach or restore the control deck in its own window.`},{keys:[`F7`],description:`Open or close the Monitor.`},{keys:[`Ctrl / Cmd + M`],description:`Open or close the Monitor.`},{keys:[`Ctrl / Cmd + R`],description:`Set or remove the current suspension as the reference geometry.`},{keys:[`+`],description:`Increase the coordinate step. Hold the key to restore the preferred default step.`},{keys:[`â`],description:`Decrease the coordinate step. Hold the key to restore the preferred default step.`},{keys:[`Arrow keys`],description:`Move the selected hardpoints along the X and Y axes by the current coordinate step.`},{keys:[`Page Up / Down`],description:`Move the selected hardpoints along the Z axis by the current coordinate step.`},{keys:[`Ctrl / Cmd + click`],description:`Add or remove hardpoints from the selection; the Arrow and Page keys then move all selected hardpoints together.`},{keys:[`Ctrl / Cmd + Z`],description:`Undo the last hardpoint keyboard move.`},{keys:[`Esc`],description:`Leave view-only layouts, reset animation and viewport, clear a hardpoint selection, or close the active dialog/menu.`}
4396],mI=[{id:`open`,title:`Open a suspension`,description:`You start in Design Mode, the standard workspace for creating and editing a suspension. Use File to open a local .spm; Save, Save As and the import tools are in the same menu.`,target:`[data-product-tour="file"]`,openFileMenu:!0},{id:`templates`,title:`Start from a ready-made template`,description:`You can also start from one of the ready-made suspension templates. Choose the layout closest to your project, then edit and save it as your own .spm.`,target:`[data-product-tour="templates"]`,openFileMenu:!0,openTemplateSubmenu:!0},{id:`geometry`,title:`Open the geometry editor`,description:`Suspension Geometry contains the hardpoint coordinates and component layout. The tour has opened it for you.`,target:`[data-product-tour="geometry-tab"]`,workTab:`suspensionGeometry`},{id:`points`,title:`Select and move a hardpoint`,description:`Click a visible point or a full component in the 2D or 3D view, then use the arrow keys for X/Y and Page Up or Down for Z. Hold Ctrl/Cmd to select more than one point or component.`,target:`[data-product-tour="suspension-views"]`,workTab:`suspensionGeometry`,showPoints:!0},{id:`coordinate-step`,title:`Set the coordinate step`,description:`Coordinate step controls the increment used when moving selected points. Click it to set the preferred default and hold duration; use + or - to change the current step, or hold either key to restore the default.`,target:`[data-product-tour="coordinate-step"]`},{id:`monitor`,title:`Check the live Monitor`,description:`Monitor gives a compact live overview of key values such as camber, toe, ride height and motion ratios while you edit or animate the suspension. Press F7 to open the Monitor.`,target:`[data-product-tour="monitor-dialog"]`,openMonitor:!0},{id:`output`,title:`Read the outputs`,description:`Open Output to inspect the result pages and graphs. Start with Bump, Steer and Loads, then use Selection or Custom for your own layouts.`,target:`[data-product-tour="output"]`,openOutputMenu:!0},{id:`shortcuts`,title:`Use the view shortcuts`,description:`Use F4 for kinematics essentials, F6 to detach the control deck, F7 for Monitor, F8 to fit the control deck to the active tab, hold F8 for 1.5 seconds to collapse it to the tab labels only, F9 for 2D view, F10 for 3D view, and F11 for browser fullscreen. Click the ? button in the top bar, then choose Keyboard shortcuts for the complete list.`},{id:`modes`,title:`Try the working modes`,description:`Try Setup Mode, Rocker Mode, Full Vehicle Mode and Optimization Mode when they suit the task. Each one changes the workspace for its dedicated task; Exit Mode returns to Design Mode for normal editing.`,target:`[data-product-tour="modes"]`,openModeMenu:!0},{id:`help`,title:`Help is always here`,description:`Use the ? button at any time to restart the Quick Tour or open the User Guide for more detailed help.`,target:`[data-product-tour="support"]`}],hI=[{id:`bump`,label:`Bump`},{id:`anti`,label:`Anti`},{id:`steer`,label:`Steer`},{id:`steeringColumn`,label:`Steering Column`},{id:`roll`,label:`Roll`},{id:`bumpSteer`,label:`BumpSteer`},{id:`driveshaft`,label:`Driveshaft`},{id:`loads`,label:`Loads`}],gI=[{id:`bump`,label:`Bump`},{id:`steer`,label:`Steer`},{id:`roll`,label:`Roll`},{id:`bumpSteer`,label:`BumpSteer`}],_I=0,vI=100,yI=40,bI=200,xI=720,SI=10,CI=[...hI,{id:`selection`,label:`Selection`},{id:`fullVehicleSelection`,label:`Full vehicle selection`},{id:`custom`,label:`Custom`}],wI=`26.02.0003`,TI=1e3;function EI(e){switch(e){case`bump`:return(0,Z.jsx)(fe,{size:14,"aria-hidden":`true`});case`anti`:return(0,Z.jsx)(S,{size:14,"aria-hidden":`true`});case`steer`:case`steeringColumn`:return(0,Z.jsx)(pz,{size:14,"aria-hidden":`true`});case`roll`:return(0,Z.jsx)(R,{size:14,"aria-hidden":`true`});case`bumpSteer`:return(0,Z.jsx)(pz,{size:14,"aria-hidden":`true`});case`driveshaft`:return(0,Z.jsx)(De,{size:14,"aria-hidden":`true`});case`loads`:return(0,Z.jsx)(ae,{size:14,"aria-hidden":`true`});case`selection`:case`fullVehicleSelection`:return(0,Z.jsx)(oe,{size:14,"aria-hidden":`true`});case`custom`:return(0,Z.jsx)(be,{size:14,"aria-hidden":`true`});default:return(0,Z.jsx)(T,{size:14,"aria-hidden":`true`})}}function DI({size:e=15}){return(0,Z.jsx)(`span`,{className:`brand-mono-icon`,style:{display:`inline-block`,width:`${e}px`,height:`${e}px`,flex:`0 0 auto`,backgroundColor:`currentColor`,WebkitMaskImage:`url(${MM})`,maskImage:`url(${MM})`,WebkitMaskRepeat:`no-repeat`,maskRepeat:`no-repeat`,WebkitMaskPosition:`center`,maskPosition:`center`,WebkitMaskSize:`contain`,maskSize:`contain`},"aria-hidden":`true`})}var OI=[{description:`File SPM`,accept:{"text/plain":[`.spm`,`.txt`]}}],kI=[{description:`STEP file`,accept:{"model/step":[`.step`,`.stp`],"application/step":[`.step`,`.stp`],"text/plain":[`.step`,`.stp`]}}],AI=[{description:`Tyre profile CSV`,accept:{"text/csv":[`.csv`],"text/plain":[`.csv`]}}],jI=`3D Joint size`,MI=`Wheel Opacity`,NI=`3D Point Size`,PI={"U-joint 2 index angle":`0`,[jI]:`4`,[MI]:`50`,"Main Spring":`1`,"Load Asymmetric":`0`,"Load Follow Wheel Toe":`0`,"Load R CP Fx":`0`,"Load R CP Fy":`0`,"Load R CP Fz":`0`,"Load R CP Mx":`0`,"Load R CP My":`0`,"Load R CP Mz":`0`,"Load R WC Fx":`0`,"Load R WC Fy":`0`,"Load R WC Fz":`0`,"Load R WC Mx":`0`,"Load R WC My":`0`,"Load R WC Mz":`0`,"Load L CP Fx":`0`,"Load L CP Fy":`0`,"Load L CP Fz":`0`,"Load L CP Mx":`0`,"Load L CP My":`0`,"Load L CP Mz":`0`,"Load L WC Fx":`0`,"Load L WC Fy":`0`,"Load L WC Fz":`0`,"Load L WC Mx":`0`,"Load L WC My":`0`,"Load L WC Mz":`0`,"Load Heave Force":`0`,"Load Roll Force":`0`,"Load CBar Torque":`0`,"Load TBar Torque":`0`,"Load Third Element Force":`0`,"Draw Load Arrows":`1`,"Draw Load Inputs":`1`,"Draw Load Reactions":`1`,"Draw Load Axials":`1`,"Draw Load Labels":`1`,"Load Arrow Scale":`100`,"Draw CG":`0`};
4396function FI(e,t,n){let r=e.split(/\r?\n/),i=r.findIndex(e=>e.trimStart().toUpperCase().startsWith(`NOTES`)),a=i===-1?r:r.slice(0,i),o=`${t}:`,s=`${n}:`,c=a.findIndex(e=>e.trimStart().startsWith(o));if(c===-1)return e;let l=a.findIndex(e=>e.trimStart().startsWith(s)),u=r[c].slice(r[c].indexOf(`:`)+1).trim();return l===-1?(r[c]=`${r[c].match(/^\s*/)?.[0]??``}${n}: ${u}`,r.join(` 4397`)):(r[l].slice(r[l].indexOf(`:`)+1).trim().length===0&&u.length>0&&(r[l]=`${r[l].match(/^\s*/)?.[0]??``}${n}: ${u}`),r.splice(c,1),r.join(` 4398`))}function II(e,t=`Double_Wishbone.spm`){let n=FI(e,NI,jI),r=eC(n,t).fields,i=Object.entries(PI).reduce((e,[t,n])=>(r[t]?.trim()??``)===``?tC(e,t,n):e,n);return(r[`2D Link Width`]?.trim()??``)===``&&(i=tC(i,`2D Link Width`,r[`Line Width`]?.trim()||`2`)),i}function LI(e){let t=!1;return e.split(/\r?\n/).map(e=>{if(t)return e;let n=e.indexOf(`:`);if(n===-1)return e;let r=e.slice(0,n).trim();return r.toUpperCase()===`NOTES`?(t=!0,e):r.length===0||e.slice(n+1).trim().length>0?e:`${e.match(/^\s*/)?.[0]??``}${r}: 0`}).join(` 4399`)}var RI={"Axle Position":`Front`,"Suspension Type":`Double Wishbone`,Configuration:`Pushrod`,"Mounting Point":`Upright`,"Main Spring":`1`,"Wheel Definition":`Tyre Rolling Radius`,"Brakes Position":`Outboard`,Wheeldrive:`Rear`,"SemiAxis Fixed Joint":`Chassis`,"Heave Symm":`1`,"CBar Mounting":`Upright`,"Pinion Position":`Rear`,"C Factor":`50`,"Y Pinion":`0`,"Pinion Offset":`0`,"Rack Angle":`0`,"L Pinion":`0`,"Pinion Angle":`0`,"Gamma Angle":`90`,"Steering Wheel Position X":`0`,"Steering Wheel Position Y":`0`,"Steering Wheel Position Z":`0`,"Joint2 X":`0`,"Joint2 Y":`0`,"Joint2 Z":`0`,"U-joint 2 index angle":`0`,"Calculate Bump":`1`,"Calculate Roll":`1`,"N of Steps Bump":`10`,"Calculate Steer":`1`,"N of Steps Steer":`10`,"Calculate Steering Column":`1`,"Calculate BumpSteer":`1`,"Steering Model":`Costant Z`,"Draw Wheels":`1`,"Wheel circle":`0`,"Step geometry":`0`,"Solid 2D wheels":`0`,"Roll centre":`0`,"Draw CG":`0`,"Draw Upright":`1`,"Draw Rocker":`1`,"Draw Offset Rim":`0`,"Draw Springs":`1`,"Draw 3D Arm":`1`,"Draw Steering":`0`,"Draw CBar":`1`,"Draw TBar":`1`,"Draw Third Element":`1`,"Draw Heave Spring":`1`,"Draw Roll Spring":`1`,"Draw Steering Axis":`0`,"Ground line":`0`,"Steering offsets":`0`,"Virtual Points/Lines":`0`,"Steering axis envelope":`0`,"Tyre profile":`0`,"Ghost wireframe":`0`,"Draw Chassis":`0`,"Draw Arrow":`1`,"Draw Origin":`1`,"Draw Medium R":`1`,"Draw Push/Spring Link":`1`,"Draw SemiAxis":`0`,"Draw Opposite Axle":`0`,"Draw MainSpring":`1`,"Spring Diameter":`50`,"N of Spire in a Spring":`6`,"3D Arm Diameter":`14`,"SemiAxis Diameter":`20`,"Steering Wheel Diameter":`180`,"Line Width":`1`,"2D Link Width":`2`,"Point Size":`4`,[jI]:`4`,[MI]:`50`,"Chassis Opacity":`1`,"2D View":`1`,"3D View":`1`,View:`Two Wheels`},zI=`Template/template-index.json`,BI=[`Default.spm`,`Defaut.spm`],VI=`3dsusp-web-report-state`,HI=`3dsusp-web-report`,UI=`3dsusp-web-report-display-preferences`,WI=`3dsusp-web-recent-document`,GI=`3dsusp-web-theme-mode`,KI=`3dsusp-web-animation-speed`,qI=`3dsusp-web-coordinate-step-preferences`,JI=`3dsusp-web-motion-ratio-mode`,YI=`3dsusp-web-rocker-reference-mode`,XI=`3dsusp-web-output-open-mode`,ZI=`3dsusp-web-pinned-output-chart-request`,QI=`3dsusp-web-pinned-output-chart`,$I=`3dsusp-web-pinned-output-chart-state`,eL=`3dsusp-web-pinned-output-chart-state`,tL=`3dsusp-custom-graph-layout`,nL=`.cgr`,rL=`Custom Graph Layout`,iL=`Auxiliary Axle`,aL=[`Auxiliary Axle File`,`Auxiliary Axle Filename`],oL=`3dsusp-web-full-vehicle-auxiliary`,sL=2,cL=`3dsusp-web-custom-graph-layout-workspace-request`,lL=`3dsusp-web-custom-graph-layout-workspace-request`,uL=`3dsusp-web-custom-graph-layout-workspace-response`,dL=`3dsusp-web-custom-graph-layout-workspace-response`,fL=`wheelOverComponent`,pL=`linkBased`,mL=`tab`,hL=`3dsusp-output-window`,gL=`popup=yes,width=1600,height=960,resizable=yes,scrollbars=yes`,_L=`3dsusp-control-deck-window`,vL=`popup=yes,width=1560,height=960,resizable=yes,scrollbars=yes`,yL=[`wheelOverComponent`,`componentOverWheel`],bL={wheelOverComponent:`Wheel motion / Component motion (MR1, Default)`,componentOverWheel:`Component motion / Wheel motion (MR2)`},xL={linkBased:`yR axis through Wishbone/Link outer end`,rodBased:`yR axis through Pushrod/Pullrod outer end`},SL=[`motionRatio`,`thirdElementMotionRatio`,`rockerMotionRatio`,`heaveSpringMotionRatio`,`rollSpringMotionRatio`],CL=[`p1`,`p2`,`pr-c`,`pr-w`,`s-c`,`s-w`,`c-link`,`c-arb`,`t-link`,`t-arb`,`hs-left`,`rs-left`],wL=new Set(SL);function TL(e){let t=Array.isArray(e)?e:e&&typeof e==`object`&&Array.isArray(e.files)?e.files:[],n=new Set;
4399return t.forEach(e=>{if(typeof e!=`string`)return;let t=e.trim();t!==``&&/\.spm$/i.test(t)&&n.add(t)}),Array.from(n).sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`,numeric:!0}))}function EL(e){return e.trim().replace(/\\/g,`/`).split(`/`).pop()?.toLowerCase()??``}function DL(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.name==`string`&&typeof t.text==`string`&&(t.tyreProfile===void 0||t.tyreProfile===null||_q(t.tyreProfile))}function OL(){if(typeof window>`u`||!window.localStorage)return[];try{let e=window.localStorage.getItem(oL);if(!e)return[];let t=JSON.parse(e);return t.version===sL&&Array.isArray(t.entries)?t.entries.filter(DL):t.version===1&&DL({name:t.name,text:t.text,tyreProfile:t.tyreProfile})?[{name:t.name,text:t.text}]:[]}catch{return[]}}function kL(e){let t=OL();if(!e)return t[0]??null;let n=EL(e);return t.find(e=>EL(e.name)===n)??null}function AL(e){if(!(typeof window>`u`||!window.localStorage))try{let t=EL(e.name),n=[e,...OL().filter(e=>EL(e.name)!==t)].slice(0,12);window.localStorage.setItem(oL,JSON.stringify({version:sL,entries:n}))}catch{}}function jL(e){let t=[iL,...aL];for(let n of t){let t=e.fields[n]?.trim();if(t)return t}return``}function ML(e){return e.suspension.axlePosition.trim().toLowerCase()===`rear`?`Front`:`Rear`}function NL(e){return(e.geometry.right.wheelCenter.x+e.geometry.left.wheelCenter.x)*.5}function PL(e,t){let n=NL(e),r=NL(t),i=Number.isFinite(e.vehicle.wheelbase)?Math.abs(e.vehicle.wheelbase):0,a=e.suspension.axlePosition.trim().toLowerCase()===`rear`?1:-1,o=(mm(e,`right`).z+mm(e,`left`).z)*.5,s=(mm(t,`right`).z+mm(t,`left`).z)*.5;return{x:n+a*i-r,y:0,z:o-s}}function FL(e,t,n){return Math.abs(NL(t)+n.x-NL(e))}function IL(e,t){let n=ML(t),r=tC(II(e.text,e.name),`Axle Position`,n);return n===`Rear`&&(r=tC(r,`Draw Steering`,`0`)),hV(r,e.name)}function LL(e){return e===`dark`||e===`light`||e===`auto`}function RL(){if(typeof window>`u`||!window.localStorage)return`dark`;try{let e=window.localStorage.getItem(GI);return LL(e)?e:`dark`}catch{return`dark`}}function zL(e){let t=Number(e);return Number.isFinite(t)?Math.max(_I,Math.min(vI,Math.round(t))):yI}function BL(){if(typeof window>`u`||!window.localStorage)return yI;try{let e=window.localStorage.getItem(KI);return e===null?yI:zL(e)}catch{return yI}}function VL(){return{defaultStep:cz,holdToDefaultSeconds:lz}}function HL(e){let t=Number(e);return sz.find(e=>Math.abs(e-t)<1e-6)??cz}function UL(e){let t=Number(typeof e==`string`?e.trim():e);return Number.isFinite(t)?Math.max(.1,Math.round(t*10)/10):lz}function WL(){if(typeof window>`u`||!window.localStorage)return VL();try{let e=window.localStorage.getItem(qI);if(!e)return VL();let t=JSON.parse(e);return{defaultStep:HL(t.defaultStep),holdToDefaultSeconds:UL(t.holdToDefaultSeconds)}}catch{return VL()}}function GL(e){return{defaultStep:String(e.defaultStep),holdToDefaultSeconds:String(e.holdToDefaultSeconds)}}function KL(e){return{defaultStep:HL(e.defaultStep),holdToDefaultSeconds:UL(e.holdToDefaultSeconds)}}function qL(e){return e===`wheelOverComponent`||e===`componentOverWheel`}function JL(){if(typeof window>`u`||!window.localStorage)return fL;try{let e=window.localStorage.getItem(JI);return qL(e)?e:fL}catch{return fL}}function YL(e){return e===`linkBased`||e===`rodBased`}function XL(){if(typeof window>`u`||!window.localStorage)return pL;try{let e=window.localStorage.getItem(YI);return YL(e)?e:pL}catch{return pL}}function ZL(e){return e===`tab`||e===`window`}function QL(){if(typeof window>`u`||!window.localStorage)return mL;try{let e=window.localStorage.getItem(XI);return ZL(e)?e:mL}catch{return mL}}function $L(e){return{mode:e}}function eR(e){return qL(e.mode)?e.mode:fL}function tR(e){return wL.has(e)}function nR(e){return e===`componentOverWheel`?`MR2`:`MR1`}function rR(e,t){let n=nR(t);return e.replace(/MotionRatio/g,n).replace(/motion ratios/gi,n).replace(/motion ratio/gi,n)}function iR(e){return Number.isFinite(e)&&Math.abs(e)>1e-9?1/e:0}function aR(e,t){return t===`componentOverWheel`?iR(e):e}function oR(e,t){return typeof e!=`number`||!Number.isFinite(e)?e:aR(e,t)}function sR(e,t){if(t===fL)return e;let n={...e};return SL.forEach(r=>{let i=e[r];typeof i==`number`&&Number.isFinite(i)&&(n[r]=aR(i,t))}),n}function cR(e,t){return t===fL?e:e.map(e=>sR(e,t))}function lR(e,t){return t===fL?e:{bump:cR(e.bump,t),anti:cR(e.anti,t),steer:cR(e.steer,t),steeringColumn:cR(e.steeringColumn,t),roll:cR(e.roll,t),bumpSteer:cR(e.bumpSteer,t),driveshaft:cR(e.driveshaft,t),loads:cR(e.loads,t)}}function uR(e,t,n){if(n!==`componentOverWheel`||!t||!tR(e))return t;let[r,i,...a]=t.split(`/`);return!r||!i||a.length>0?t:`${i}/${r}`}function dR(e,t){return tR(e.key)?{...e,label:rR(e.label,t),unit:uR(e.key,e.unit,t)}:e}function fR(e,t,n,r){let i=uR(t,n,r),a=rR(e,r);return i?`${a} [${i}]`:a}var pR=320;function mR(){return{columns:3,chartSize:pR,showPrevious:!0,showReference:!0,bumpAxisOrientation:`x`,steerAxisMode:`steeringWheelAngle`,steerChartSideMode:`bothSides`,fullVehicleSelectionCharts:[],chartOrderByMode:{},selectionCharts:[]}}function hR(e){return e===`x`||e===`y`}function gR(e){return e===`steeringWheelAngle`||e===`rackTravel`}function _R(e){return e===`bothSides`||e===`rightHandChartOnly`}function vR(e){return hI.some(t=>t.id===e)}function yR(e){if(!e||typeof e!=`object`)return{};let t=Object.entries(e).filter(([e,t])=>vR(e)&&Array.isArray(t)).map(([e,t])=>[e,t.filter(e=>typeof e==`string`)]);return Object.fromEntries(t)}function bR(e){return`${e.mode}:${e.chartKey}`}function xR(e){if(!Array.isArray(e))return[];let t=[],n=new Set;
4399return e.forEach(e=>{if(!e||typeof e!=`object`)return;let r=e.mode,i=e.chartKey;if(!vR(r)||typeof i!=`string`||i===``)return;let a={mode:r,chartKey:i},o=bR(a);n.has(o)||(n.add(o),t.push(a))}),t}function SR(e){if(!(typeof window>`u`||!window.localStorage))try{let t=CR();window.localStorage.setItem(UI,JSON.stringify({...t,...e,showPrevious:e.showPrevious??t.showPrevious,showReference:e.showReference??t.showReference,fullVehicleSelectionCharts:e.fullVehicleSelectionCharts??t.fullVehicleSelectionCharts,chartOrderByMode:e.chartOrderByMode??t.chartOrderByMode,selectionCharts:e.selectionCharts??t.selectionCharts}))}catch{}}function CR(){if(typeof window>`u`||!window.localStorage)return mR();try{let e=window.localStorage.getItem(UI);if(!e)return mR();let t=JSON.parse(e),n=[1,2,3,4].includes(t.columns??NaN)?t.columns:3,r=typeof t.chartSize==`number`&&Number.isFinite(t.chartSize)&&t.chartSize>=pR?t.chartSize:pR,i=typeof t.showPrevious==`boolean`?t.showPrevious:!0,a=typeof t.showReference==`boolean`?t.showReference:!0,o=hR(t.bumpAxisOrientation)?t.bumpAxisOrientation:`x`,s=gR(t.steerAxisMode)?t.steerAxisMode:`steeringWheelAngle`,c=_R(t.steerChartSideMode)?t.steerChartSideMode:`bothSides`,l=t.fullVehicleSelectionCharts===void 0?xR(t.selectionCharts):xR(t.fullVehicleSelectionCharts);return{columns:n,chartSize:r,showPrevious:i,showReference:a,bumpAxisOrientation:o,steerAxisMode:s,steerChartSideMode:c,chartOrderByMode:yR(t.chartOrderByMode),selectionCharts:xR(t.selectionCharts),fullVehicleSelectionCharts:l}}catch{return mR()}}function wR(e,t){let n=e.label.split(`-`)[0]?.trim()??e.label.trim(),r=n.toLowerCase(),i=r===`current geometry`?`current`:r===`previous geometry`?`previous`:r===`reference geometry`?`reference`:r===`secondary axle`?`secondary`:null;return i?t===`short`?i===`current`?`Curr`:i===`previous`?`Prev`:i===`reference`?`Ref`:`Sec`:t===`full`?i===`current`?`Current geometry`:i===`previous`?`Previous geometry`:i===`reference`?`Reference geometry`:`Secondary axle`:i===`current`?`Current`:i===`previous`?`Previous`:i===`reference`?`Reference`:`Secondary`:t===`full`?n:n.replace(/\s+Geometry$/i,``)}function TR(e){return e.key.startsWith(`current-`)?`current`:e.key.startsWith(`previous-`)?`previous`:e.key.startsWith(`reference-`)?`reference`:e.key.startsWith(`secondary-`)?`secondary`:null}function ER(e){return e===`current`?`Current`:e===`previous`?`Previous`:e===`reference`?`Reference`:`Secondary`}function DR(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function OR(e){return e.map(({document:e,series:t,...n})=>({...n,series:t.map(e=>({...e}))}))}function kR(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.requestId!=`string`||typeof t.id!=`string`||typeof t.title!=`string`||!t.x||typeof t.x!=`object`||!t.y||typeof t.y!=`object`||!Array.isArray(t.seriesSet)||t.action!==void 0&&t.action!==`pin`&&t.action!==`refresh`?null:t}function AR(e,t=`pin`){if(typeof window>`u`)return;let n={...e,seriesSet:OR(e.seriesSet),requestId:DR(),action:t};try{let e=new BroadcastChannel(QI);e.postMessage(n),e.close()}catch{}try{window.localStorage.setItem(ZI,JSON.stringify(n))}catch{}}function jR(e){let t=[];if(Array.isArray(e))t=e;else if(e&&typeof e==`object`){let n=e.pinnedIds;t=Array.isArray(n)?n:[]}return new Set(t.filter(e=>typeof e==`string`&&e.length>0))}function MR(){if(typeof window>`u`||!window.localStorage)return new Set;try{let e=window.localStorage.getItem($I);return e?jR(JSON.parse(e)):new Set}catch{return new Set}}function NR(e){if(typeof window>`u`)return;let t={pinnedIds:Array.from(new Set(e.filter(e=>e.length>0))),sentAt:Date.now()};try{window.localStorage.setItem($I,JSON.stringify(t))}catch{}try{let e=new BroadcastChannel(eL);e.postMessage(t),e.close()}catch{window.dispatchEvent(new StorageEvent(`storage`,{key:$I,newValue:JSON.stringify(t)}))}}var PR=[{key:`Axle Position`,label:`Axle position`},{key:`Suspension Type`,label:`Suspension type`},{key:`Configuration`,label:`Configuration`},{key:`Mounting Point`,label:`Mounting point`}],FR=[`Front`,`Rear`],IR=[`Double Wishbone`,`Multilink`,`Top WB - Bottom ML`,`Top ML - Bottom WB`],LR=`MacPherson`,RR=`MacPherson Multilink`,zR=[`Pushrod`,`Pullrod`,`Outboard Spring`],BR=[`Upright`,`Top Wishbone`,`Bottom Wishbone`,`Top Link Front`,`Top Link Rear`,`Bottom Link Front`,`Bottom Link Rear`],VR={Upright:`To Upright`,"Top Wishbone":`To Top Wishbone`,"Bottom Wishbone":`To Bottom Wishbone`,"Top Link Front":`To Top Link Front`,"Top Link Rear":`To Top Link Rear`,"Bottom Link Front":`To Bottom Link Front`,"Bottom Link Rear":`To Bottom Link Rear`},HR=[`Rocker`,`Upright`,`Top Wishbone`,`Bottom Wishbone`,`Top Link Front`,`Top Link Rear`,`Bottom Link Front`,`Bottom Link Rear`],UR={Rocker:`To Rocker`,Upright:`To Upright`,"Top Wishbone":`To Top Wishbone`,"Bottom Wishbone":`To Bottom Wishbone`,"Top Link Front":`To Top Link Front`,"Top Link Rear":`To Top Link Rear`,"Bottom Link Front":`To Bottom Link Front`,"Bottom Link Rear":`To Bottom Link Rear`},WR=[{key:`Main Spring`,label:`Main spring`},{key:`MonoShock`,label:`Monoshock`},{key:`Integral Link`,label:`Integral link`}],GR=[`Warning - the Integral link option requires the following settings.`,`Suspension type: Top Multilink - Bottom WishBone or Top WishBone - Bottom Multilink.`,`C
4399onfiguration: Outboard Spring`],KR=[{key:`Wheel Radius`,label:`Wheel radius`,unit:`mm`},{key:`Rim Diameter`,label:`Rim diameter`,unit:`in`},{key:`Rim Width`,label:`Rim width`,unit:`in`},{key:`Rim Offset`,label:`Rim offset`,unit:`mm`},{key:`Tyre Width`,label:`Tyre width`,unit:`mm`},{key:`Aspect Ratio`,label:`Aspect ratio`,unit:`%`}],qR=[{key:`Camber`,label:`Static camber`,unit:`deg`},{key:`Toe`,label:`Static toe`,unit:`deg`}],JR=[{key:`Wheelbase`,label:`Wheelbase`,unit:`mm`},{key:`Centre of Gravity Height`,label:`CG height`,unit:`mm`},{key:`Front Drive Ratio`,label:`Front drive ratio`,unit:`%`},{key:`Front Brake Balance`,label:`Front brake balance`,unit:`%`}],YR=[{key:`X SemiAxis`,label:`Chassis X`,unit:`mm`},{key:`Y SemiAxis`,label:`Chassis Y`,unit:`mm`},{key:`Z SemiAxis`,label:`Chassis Z`,unit:`mm`},{key:`Distance SemiAxis`,label:`Outer CVJ, axial distance from wheel centre`,unit:`mm`}],XR=[`Tyre Rolling Radius`,`Tyre Width & Aspect Ratio`,`Tyre profile`],ZR={"Tyre profile":`Tyre profile (.csv)`},QR=[`Inboard`,`Outboard`],$R=[`Front`,`Rear`,`4WD`],ez=[`Chassis`,`Wheel`],tz={Chassis:`Inner CVJ, chassis side`,Wheel:`Outer CVJ, wheel side`},nz=.66,rz=.5,iz=.2,az=1500,oz=1,sz=[.1,.5,1,2,5,10,20,50,100],cz=10,lz=1.5,uz=220,dz=[`X`,`Y`,`Z`];function fz({size:e=17,...t}){return(0,Z.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.85`,strokeLinecap:`round`,strokeLinejoin:`round`,...t,children:[(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`}),(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3.1`}),(0,Z.jsx)(`path`,{d:`M12 3.5V8.6M12 15.4V20.5M3.5 12H8.6M15.4 12H20.5`}),(0,Z.jsx)(`path`,{d:`M6.5 6.5L9.3 9.3M14.7 14.7L17.5 17.5M17.5 6.5L14.7 9.3M9.3 14.7L6.5 17.5`})]})}function pz({size:e=17,...t}){return(0,Z.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.85`,strokeLinecap:`round`,strokeLinejoin:`round`,...t,children:(0,Z.jsxs)(`g`,{transform:`rotate(180 12 12)`,children:[(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`}),(0,Z.jsx)(`circle`,{cx:`12`,cy:`11.8`,r:`2.3`}),(0,Z.jsx)(`path`,{d:`M12 4.3V9.5M9.7 13.3L6.4 17.2M14.3 13.3L17.6 17.2M4.5 15.6H9.4M14.6 15.6H19.5`})]})})}function mz({size:e=18,...t}){return(0,Z.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.1`,strokeLinecap:`butt`,strokeLinejoin:`miter`,...t,children:[(0,Z.jsx)(`path`,{d:`M4 7.2 12 4.2 20 7.2 12 12.2Z`}),(0,Z.jsx)(`path`,{d:`M4 7.2V15.2L12 22`}),(0,Z.jsx)(`path`,{d:`M20 7.2V15.2L12 22`}),(0,Z.jsx)(`line`,{x1:`12`,y1:`12.2`,x2:`12`,y2:`22`})]})}var hz=[{key:`3D Arm Diameter`,label:`3D link diameter`,unit:`mm`},{key:`SemiAxis Diameter`,label:`Driveshaft diameter`,unit:`mm`},{key:`2D Link Width`,label:`2D link thickness`,integer:!0},{key:`Virtual Line Thickness`,label:`Virtual line thickness`},{key:`Spring Diameter`,label:`Spring coil diameter`,unit:`mm`},{key:`N of Spire in a Spring`,label:`Spring coil turns`,integer:!0},{key:`Point Size`,label:`2D point size`,integer:!0},{key:jI,label:`3D joint size`,unit:`mm`}],gz=[{key:`Draw Wheels`,label:`Wheels`},{key:`Draw Offset Rim`,label:`Rim offset`},{key:`Draw Opposite Axle`,label:`Opposite axle`},{key:`Draw Upright`,label:`Upright`},{key:`Draw Rocker`,label:`Rocker`},{key:`Draw Springs`,label:`Spring coils`},{key:`Draw MainSpring`,label:`Complete springs`},{key:`Draw CBar`,label:`C-bar`},{key:`Draw TBar`,label:`T-bar`},{key:`Draw Third Element`,label:`Third element`},{key:`Draw Heave Spring`,label:`Heave spring`},{key:`Draw Roll Spring`,label:`Roll spring`},{key:`Draw SemiAxis`,label:`Driveshaft`},{key:`Draw 3D Arm`,label:`3D links`},{key:`Draw Steering`,label:`Steering line`}],_z=[{key:`Draw Steering Axis`,label:`Steering axis`},{key:`Steering axis envelope`,label:`Steering axis envelope`},{key:`Steering offsets`,label:`Steering offsets`},{key:`Ground line`,label:`Ground line`},{key:`Roll centre`,label:`Roll centre`},{key:`Draw CG`,label:`CG`},{key:`Wheel circle`,label:`Wheel circle`},{key:`Solid 2D wheels`,label:`2D solid wheels`},{key:`Tyre profile`,label:`Tyre profile (.csv)`}],vz={key:`Ghost wireframe`,label:`Ghost baseline`},yz={"Draw Wheels":`0`,"Draw Offset Rim":`0`,"Draw Opposite Axle":`0`,"Draw Upright":`0`,"Draw Rocker":`0`,"Draw Springs":`0`,"Draw CBar":`0`,"Draw TBar":`0`,"Draw Third Element":`0`,"Draw SemiAxis":`0`,"Draw 3D Arm":`1`,"Draw Steering":`0`,"Draw Steering Axis":`1`,"Steering axis envelope":`0`,"Steering offsets":`0`,"Ground line":`1`,"Roll centre":`1`,"Draw CG":`1`,"Wheel circle":`1`,"Solid 2D wheels":`0`,"Tyre profile":`0`,"Ghost wireframe":`0`,"Virtual Points/Lines":`0`,"Draw Chassis":`0`,"Draw Arrow":`0`,"Draw Origin":`0`,"Draw Medium R":`0`,"Draw Push/Spring Link":`0`,"Draw Load Arrows":`0`},bz=Object.keys(yz),xz={key:`Draw Load Arrows`,label:`Draw Load Arrows`},Sz=[{key:`Load Arrow Scale`,label:`Arrow scale`,unit:`mm/kN`,unitOutside:!0}],Cz=[{key:`Draw Load Inputs`,label:`Inputs`},{key:`Draw Load Reactions`,label:`Reactions XYZ`},{key:`Draw Load Axials`,label:`Axials`},{key:`Draw Load Labels`,label:`Values`}],wz=[{key:`Antiroll CBar`,label:`Antiroll C-bar`},{key:`Antiroll TBar`,label:`Antiroll T-bar`},{key:`Third Element`,label:`Third element`},{key:`Heave Spring`,label:`Heave spring`},{key:`Roll Spring`,label:`Roll spring`}],Tz={key:`Load Asymmetric`,label:`Symmetric loads`},Ez={key:`Load Follow Wheel Toe`,label:`Fx/Fy follow toe`},Dz=[{suffix:`Fx`,label:`Fx`,unit:`N`},{suffix:`Fy`,label:`Fy`,unit:`N`},{suffix:`Fz`,label:`Fz`,unit:`N`},{suffix:`Mx`,label:`Mx`,unit:`Nm`},{suffix:`My`,label:`My`,unit:`Nm`},{suffix:`Mz`,label:`Mz`,unit:`Nm`}],Oz=[{key:`Load CBar Torque`,label:`C-bar torque`,unit:`Nm`},{key:`Load TBar Torque`,label:`T-bar torque`,unit:`Nm`},{key:`Load Third Element Force`,label:`Third element force`,unit:`N`},{key:`Load Heave Force`,label:`Heave element force`,unit:`N`},{key:`Load Roll Force`,label:`Roll element force`,unit:`N`}],kz=[...[`Load R CP`,`Load R WC`,`Load L CP`,`Load L WC`].flatMap(e=>Dz.map(t=>`${e} ${t.suffix}`))],Az=Oz.map(e=>e.key),jz=[{id:`c-link`,label:`Rocker Link`,keys:[`CLinkX`,`CLinkY`,`CLinkZ`]},{id:`c-arb`,label:`ARB Link`,keys:[`CARBX`,`CARBY`,`CARBZ`]},{id:`c-pivot`,label:`Chassis Pivot`,keys:[`CPivotX`,`CPivotY`,`CPivotZ`]}],Mz=[{id:`t-link`,label:`Rocker Link`,keys:[`TLinkX`,`TLinkY`,`TLinkZ`]},{id:`t-arb`,label:`ARB Link`,keys:[`TARBX`,`TARBY`,`TARBZ`]},{id:`t-pivot`,label:`Chassis Pivot`,keys:[`TPivotX`,`TPivotY`,`TPivotZ`]}],Nz=[{id:`third-arb`,label:`ARB Side`,keys:[`T3EARBX`,`T3EARBY`,`T3EARBZ`]},{id:`third-chassis`,label:`Chassis Side`,keys:[`T3ECX`,`T3ECY`,`T3ECZ`]}],Pz=[{id:`hs-left`,side:`left`,label:`Left Rocker`,keys:[`HSleftX`,`HSleftY`,`HSleftZ`]},{id:`hs-right`,side:`right`,label:`Right Rocker`,keys:[`HSrightX`,`HSrightY`,`HSrightZ`]}],Fz=[{id:`rs-left`,label:`Left Rocker`,keys:[`RSleftX`,`RSleftY`,`RSleftZ`]},{id:`rs-right`,label:`Right Rocker`,keys:[`RSrightX`,`RSrightY`,`RSrightZ`]}],Iz=[{key:`wheel-center`,component:`Wheel Centre`,position:`Wheel side`,wheelId:`wheel-center`},{key:`top-front`,component:`Top Wishbone/Link`,position:`Front`,chassisId:`tlf-c`,wheelId:`tlf-w`},{key:`top-rear`,component:`Top Wishbone/Link/Integral Link`,position:`Rear`,chassisId:`tlr-c`,wheelId:`tlr-w`},{key:`bottom-front`,component:`Bottom Wishbone/Link`,position:`Front`,chassisId:`blf-c`,wheelId:`blf-w`},{key:`bottom-rear`,component:`Bottom Wishbone/Link/Integral Link`,position:`Rear`,chassisId:`blr-c`,wheelId:`blr-w`},{key:`track-rod`,component:`Track Rod`,position:``,chassisId:`tr-c`,wheelId:`tr-w`},{key:`rod`,component:`Pushrod/Pullrod`,position:``,chassisId:`pr-c`,wheelId:`pr-w`},{key:`spring`,component:`Spring`,position:``,chassisId:`s-c`,wheelId:`s-w`},{key:`rocker-p1`,component:`Rocker`,position:`Pivot 1`,chassisId:`p1`},{key:`rocker-p2`,component:`Rocker`,position:`Pivot 2`,chassisId:`p2`},{key:`c-link`,component:`Antiroll C-Bar`,position:`Rocker/Wheel Link`,chassisId:`c-link`},{key:`c-arb`,component:`Antiroll C-Bar`,position:`ARB Link`,chassisId:`c-arb`},{key:`c-pivot`,component:`Antiroll C-Bar`,position:`Chassis Pivot`,chassisId:`c-pivot`},{key:`t-link`,component:`Antiroll T-Bar`,position:`Rocker Link`,chassisId:`t-link`},{key:`t-arb`,component:`Antiroll T-Bar`,position:`ARB Link`,chassisId:`t-arb`},{key:`t-pivot`,component:`Antiroll T-Bar`,position:`Chassis Pivot`,chassisId:`t-pivot`},{key:`third-arb`,component:`Third Element`,position:`ARB Side`,chassisId:`third-arb`},{key:`third-chassis`,component:`Third Element`,position:`Chassis Side`,chassisId:`third-chassis`},{key:`hs-left`,component:`Heave Spring`,position:`Left Rocker`,chassisId:`hs-left`},{key:`rs-left`,component:`Roll Spring`,position:`Left Rocker`,chassisId:`rs-left`},{key:`steering-wheel`,component:`Steering Column`,position:`Steering Wheel centre`,chassisId:`steering-wheel`},{key:`joint-2`,component:`Steering Column`,position:`U-joint 2 (upper, SW side)`,chassisId:`joint-2`},{key:`semi-axis`,component:`Driveshaft`,position:`Inner CVJ`,chassisId:`semi-axis`}],Lz=new Set([`TPivotY`,`T3EARBY`,`T3ECY`]);function Rz(e){return Lz.has(e)}var zz={"Antiroll CBar":[`c-link`,`c-arb`,`c-pivot`],"Antiroll TBar":[`t-link`,`t-arb`,`t-pivot`],"Third Element":[`third-arb`,`third-chassis`],"Heave Spring":[`hs-left`,`hs-right`],"Roll Spring":[`rs-left`,`rs-right`]},Bz={"Draw Springs":[],"Draw MainSpring":[`s-c`,`s-w`],"Draw CBar":[`c-link`,`c-arb`,`c-pivot`],"Draw TBar":[`t-link`,`t-arb`,`t-pivot`],"Draw Third Element":[`third-arb`,`third-chassis`],"Draw Heave Spring":[`hs-left`,`hs-right`],"Draw Roll Spring":[`rs-left`,`rs-right`],"Draw Steering":[`steering-wheel`,`joint-2`],"Draw SemiAxis":[`semi-axis`]}
4399,Vz=new Set([`Axle Position`,`Suspension Type`,`Configuration`,`Mounting Point`,`MacPherson`,`MonoShock`,`Integral Link`,`Main Spring`,`Antiroll TBar`,`Third Element`]),Hz=new Set([`CBar Mounting`,`CLinkY`,`CLinkZ`,`CARBX`,`CARBY`,`CARBZ`]);function Uz(e,t,n){return{"Draw Rocker":(e.Configuration?.trim()||``)===`Outboard Spring`,"Draw MainSpring":!wB(e),"Draw SemiAxis":t?!t.driveshaftEnabled:!1,"Draw CBar":(n?.toggleDisabled[`Antiroll CBar`]??!1)||(e[`Antiroll CBar`]?.trim()||`0`)===`0`,"Draw TBar":(n?.toggleDisabled[`Antiroll TBar`]??!1)||(e[`Antiroll TBar`]?.trim()||`0`)===`0`,"Draw Third Element":(n?.toggleDisabled[`Third Element`]??!1)||(e[`Third Element`]?.trim()||`0`)===`0`,"Draw Heave Spring":(n?.toggleDisabled[`Heave Spring`]??!1)||(e[`Heave Spring`]?.trim()||`0`)===`0`,"Draw Roll Spring":(n?.toggleDisabled[`Roll Spring`]??!1)||(e[`Roll Spring`]?.trim()||`0`)===`0`}}var Wz=new Set([`Wheel Definition`,`Wheel Radius`,`Rim Diameter`,`Rim Width`,`Tyre Width`,`Aspect Ratio`,`Wheeldrive`,`Front Drive Ratio`,`Brakes Position`,`SemiAxis Fixed Joint`,`Axle Position`]),Gz=new Set([`Calculate Bump`,`Calculate Roll`,`Calculate BumpSteer`]);function Kz(e){return(e?.trim().toLowerCase()??``).includes(`spring`)?`Costant Spring`:`Costant Z`}function qz(e){let t=[];(e[`Calculate Bump`]?.trim()||`0`)===`0`&&((e[`Calculate Roll`]?.trim()||`0`)!==`0`&&t.push([`Calculate Roll`,`0`]),(e[`Calculate BumpSteer`]?.trim()||`0`)!==`0`&&t.push([`Calculate BumpSteer`,`0`]));let n=Kz(e[`Steering Model`]);return(e[`Steering Model`]?.trim()||``)!==n&&t.push([`Steering Model`,n]),t}function Jz(e){if(e===void 0)return null;let t=Number(e.trim().replace(`,`,`.`));return Number.isFinite(t)?t:null}function Yz(e){return String(_f(Jz(e)??10))}function Xz({value:e,ariaLabel:t,disabled:n=!1,readOnly:r=!1,className:i,inputMode:a=`decimal`,onCommit:o,onFocus:s,onClick:c}){let[l,u]=(0,h.useState)(e),d=(0,h.useRef)(!1);(0,h.useEffect)(()=>{d.current||u(e)},[e]);let f=(0,h.useCallback)(()=>{d.current=!1;let t=Jz(l);if(t===null){u(e);return}o(t),u($(t))},[l,o,e]);return(0,Z.jsx)(`input`,{type:`text`,inputMode:a,"aria-label":t,disabled:n,readOnly:r,className:i,value:l,onFocus:e=>{d.current=!0,s?.(e)},onClick:c,onChange:e=>u(e.target.value),onBlur:f,onKeyDown:t=>{if(t.key===`Enter`){t.preventDefault(),f(),t.currentTarget.blur();return}t.key===`Escape`&&(t.preventDefault(),u(e),t.currentTarget.blur())}})}var Zz=Math.PI/180,Qz=180/Math.PI;function $z(e){return Number.isFinite(e)?Math.max(-1,Math.min(1,e)):1}function eB(e,t){return Math.hypot(e.x-t.x,e.y-t.y,e.z-t.z)}function tB(e,t,n=0){let r=Jz(e[t]);return r===null?n:r}function nB(e,t){return!Number.isFinite(t)||t<=1e-9?0:Math.acos($z(e/t))*Qz}function rB(e){let t=e.fields,n=Gm(e),r=(t[`Pinion Position`]?.trim().toLowerCase()??`rear`)===`front`?`Front`:`Rear`,i=tB(t,`Gamma Angle`),a=eB(n.joint1Point,n.joint2Point),o=eB(n.steeringWheelPoint,n.joint2Point),s=nB(Math.abs(n.steeringWheelPoint.x-n.joint2Point.x),o);return{pinionPosition:r,pinionPoint:n.pinionPoint,joint1Point:n.joint1Point,joint2Point:n.joint2Point,steeringWheelPoint:n.steeringWheelPoint,gammaAngleDeg:i,alpha1Deg:n.alpha1Deg,alpha2Deg:n.alpha2Deg,steeringShaftAngleDeg:Math.abs(s),link12Mm:a,link2SwMm:o}}function iB(e){return Number.isFinite(e)?e.toFixed(2).replace(/\.?0+$/,``):`0`}function aB(e){let t=Jz(e);return t===null?e:$(-t)}function oB(e){let t=e.HSleftX??`0`,n=e.HSleftY??`0`,r=e.HSleftZ??`0`;return[[`Heave Symm`,`1`],[`HSrightX`,t],[`HSrightY`,aB(n)],[`HSrightZ`,r]].filter(([t,n])=>(e[t]?.trim()??``)!==n)}function sB(e,t,n,r){let i=Jz(e[t]),a=Jz(e[n]),o=Jz(e[r]);return i===null||a===null||o===null?null:{x:i,y:a,z:o}}function cB(e){let t=sB(e,`RSleftX`,`RSleftY`,`RSleftZ`),n=sB(e,`P1X`,`P1Y`,`P1Z`),r=sB(e,`P2X`,`P2Y`,`P2Z`);if(t===null||n===null||r===null)return[];let i=hT(t,n,r);return[[`RSrightX`,$(i.x)],[`RSrightY`,$(i.y)],[`RSrightZ`,$(i.z)]].filter(([t,n])=>(e[t]?.trim()??``)!==n)}function lB(e){return e.toFixed(2)}function uB(e){return[-e[0],-e[1],e[2],e[3],-e[4],e[5]]}function dB(e,t){let[n,r,i,a,o,s]=e,c=Math.cos(n),l=Math.sin(n),u=Math.cos(r),d=Math.sin(r),f=Math.cos(i),p=Math.sin(i);return{x:u*f*t.x-d*t.y+u*p*t.z+a,y:(c*d*f+l*p)*t.x+c*u*t.y+(c*d*p-l*f)*t.z+o,z:(l*d*f-c*p)*t.x+l*u*t.y+(l*d*p+c*f)*t.z+s}}function fB(e,t){let[n,r,i,a,o,s]=e,c=Math.cos(n),l=Math.sin(n),u=Math.cos(r),d=Math.sin(r),f=Math.cos(i),p=Math.sin(i),m={x:t.x-a,y:t.y-o,z:t.z-s},h=u*f,g=-d,_=u*p,v=c*d*f+l*p,y=c*u,b=c*d*p-l*f,x=l*d*f-c*p,S=l*u,C=l*d*p+c*f;return{x:h*m.x+v*m.y+x*m.z,y:g*m.x+y*m.y+S*m.z,z:_*m.x+b*m.y+C*m.z}}function pB(e,t){return dB([e[0],e[1],e[2],0,0,0],t)}function mB(e){let t=e.geometry.right;return[-e.vehicle.camber*Zz,-e.vehicle.toe*Zz,0,t.wheelCenter.x,t.wheelCenter.y,t.wheelCenter.z]}function hB(e,t){return fB(e,t)}function gB(e,t){return dB(e,t)}function _B(e){let t=e?.trim().toLowerCase()??``;return t===`tyre width & aspect ratio`||t===`tyre width and aspect ratio`||t===`width and ar`||t===`width & ar`?`Tyre Width & Aspect Ratio`:t===`tyre rolling radius`||t===`nominal radius`?`Tyre Rolling Radius`:t===`tyre profile`||t===`tyre profile (.csv)`?`Tyre profile`:`Tyre Rolling Radius`}function vB(e){let t=e?.trim().toLowerCase()??``;return t===`front`?`Front`:t===`4wd`||t===`awd`?`4WD`:`Rear`}function yB(e){let t=_B(e[`Wheel Definition`]),n=vB(e.Wheeldrive),r=(e[`Axle Position`]?.trim().toLowerCase()??`front`)===`rear`?`rear`:`front`;return{wheelDefinition:t,wheelRadiusDisabled:t===`Tyre Width & Aspect Ratio`,rimWidthDisabled:t===`Tyre Width & Aspect Ratio`||t===`Tyre profile`,tyreWidthDisabled:t===`Tyre Rolling Radius`||t===`Tyre profile`,aspectRatioDisabled:t===`Tyre Rolling Radius`||t===`Tyre profile`,driveRatioDisabled:n!==`4WD`,driveshaftEnabled:r===`front`&&(n===`Front`||n===`4WD`)||r===`rear`&&(n===`Rear`||n===`4WD`)}}function bB(e,t=[]){let n=_B(e[`Wheel Definition`]),r=vB(e.Wheeldrive),i=t.includes(`Wheeldrive`),a=[];if((e[`Wheel Definition`]?.trim()||``)!==n&&a.push([`Wheel Definition`,n]),(e.Wheeldrive?.trim()||``)!==r&&a.push([`Wheeldrive`,r]),r===`Front`&&(e[`Front Drive Ratio`]?.trim()||``)!==`100`&&a.push([`Front Drive Ratio`,`100`]),r===`Rear`&&(e[`Front Drive Ratio`]?.trim()||``)!==`0`&&a.push([`Front Drive Ratio`,`0`]),r===`4WD`&&i){let t=e[`Front Drive Ratio`]?.trim()||``;(t===``||t===`0`||t===`100`)&&a.push([`Front Drive Ratio`,`50`])}if(n===`Tyre Width & Aspect Ratio`){let t=Jz(e[`Tyre Width`]),n=Jz(e[`Aspect Ratio`]),r=Jz(e[`Rim Diameter`]);if(t!==null){let n=lB(t/25.4);(e[`Rim Width`]?.trim()||``)!==n&&a.push([`Rim Width`,n])}if(t!==null&&n!==null&&r!==null&&n>0&&n<100){let i=$(r*25.4/2+n/100*t);(e[`Wheel Radius`]?.trim()||``)!==i&&a.push([`Wheel Radius`,i])}}return!yB(e).driveshaftEnabled&&(e[`Draw SemiAxis`]?.trim()||`0`)!==`0`&&a.push([`Draw SemiAxis`,`0`]),(e.Configuration?.trim()||``)===`Outboard Spring`&&(e[`Draw Rocker`]?.trim()||`0`)!==`0`&&a.push([`Draw Rocker`,`0`]),a}function xB(e){return e!==void 0&&e.trim()!==``&&e.trim()!==`0`}function SB(e,t){switch(e){case`bump`:case`anti`:return Fw(t,`bump`);case`steer`:return Fw(t,`steer`);case`steeringColumn`:return Fw(t,`steeringColumn`);case`roll`:return Fw(t,`roll`);case`bumpSteer`:return Fw(t,`bumpSteer`);case`driveshaft`:return Fw(t,`bump`)||Fw(t,`steer`);default:return!0}}function CB(e){return vf({configuration:e.Configuration?.trim()||`Pushrod`,macPherson:xB(e.MacPherson)})}function wB(e){return yf({configuration:e.Configuration?.trim()||`Pushrod`,macPherson:xB(e.MacPherson),mainSpring:e[`Main Spring`]===void 0?!0:xB(e[`Main Spring`])})}function TB(e){let t=e?.trim();return t===`Outboard Spring`?`Spring mounting point`:t===`Pullrod`?`Pullrod mounting point`:`Pushrod mounting point`}function EB(e){let t=e?.trim()??``;return IR.includes(t)?t:`Double Wishbone`}function DB(e){return e===`Top WB - Bottom ML`?`Multilink`:e===`Top ML - Bottom WB`?`Double Wishbone`:e}function OB(e,t){return(t?.trim()||`Pushrod`)===`Outboard Spring`&&(e===`Top WB - Bottom ML`||e===`Top ML - Bottom WB`)}function kB(e){return OB(EB(e[`Suspension Type`]),e.Configuration)}function AB(e,t){let n=[...e];if(!t)return n;let r=n.indexOf(`Multilink`);return r>=0?n.splice(r+1,0,LR,RR):n.push(LR,RR),n}function jB(e){let t=e?.trim().toLowerCase()??``;return t.includes(`rocker`)?`Rocker`:t.includes(`top link front`)?`Top Link Front`:t.includes(`top link rear`)?`Top Link Rear`:t.includes(`bottom link front`)?`Bottom Link Front`:t.includes(`bottom link rear`)?`Bottom Link Rear`:t.includes(`top wishbone`)?`Top Wishbone`:t.includes(`bottom wishbone`)?`Bottom Wishbone`:`Upright`}function MB(e){return xB(e.MacPherson)||(e.Configuration?.trim()||``)===`Outboard Spring`}function NB(e){let t=xB(e.MacPherson),n=EB(e[`Suspension Type`]),r=MB(e),i=Object.fromEntries(HR.map(e=>[e,!0]));return i.Rocker=r,i.Upright=!1,t?(n===`Multilink`?(i[`Bottom Link Front`]=!1,i[`Bottom Link Rear`]=!1):i[`Bottom Wishbone`]=!1,i):(n===`Double Wishbone`?(i[`Top Wishbone`]=!1,i[`Bottom Wishbone`]=!1):n===`Multilink`?(i[`Top Link Front`]=!1,i[`Top Link Rear`]=!1,i[`Bottom Link Front`]=!1,i[`Bottom Link Rear`]=!1):n===`Top WB - Bottom ML`?(i[`Top Wishbone`]=!1,i[`Bottom Link Front`]=!1,i[`Bottom Link Rear`]=!1):n===`Top ML - Bottom WB`&&(i[`Top Link Front`]=!1,i[`Top Link Rear`]=!1,i[`Bottom Wishbone`]=!1),i)}function PB(e){let t=NB(e);return t[jB(e[`CBar Mounting`])]?[[`CBar Mounting`,HR.find(e=>!t[e])??`Upright`]]:[]}function FB(e){let t=xB(e.MacPherson),n=xB(e.MonoShock),r=xB(e[`Integral Link`]);e.Configuration?.trim();let i=EB(e[`Suspension Type`]),a=OB(i,e.Configuration),o=AB(r?IR:t?[`Double Wishbone`,`Multilink`]:IR,!n||t),s=t?i===`Multilink`?RR:LR:i,c=r?zR:t?[`Outboard Spring`]:n?[`Pushrod`,`Pullrod`]:zR,l=CB(e),u=Object.fromEntries(o.map(e=>[e,!1])),d=Object.fromEntries(c.map(e=>[e,!1]));
4399r&&(o.forEach(e=>{u[e]=e!==`Top WB - Bottom ML`&&e!==`Top ML - Bottom WB`}),c.forEach(e=>{d[e]=e!==`Outboard Spring`}));let f=Object.fromEntries(BR.map(e=>[e,!0]));return f.Upright=!1,t||(i===`Multilink`?(f[`Top Link Front`]=!1,f[`Top Link Rear`]=!1,f[`Bottom Link Front`]=!1,f[`Bottom Link Rear`]=!1):i===`Double Wishbone`?(f[`Top Wishbone`]=!1,f[`Bottom Wishbone`]=!1):i===`Top WB - Bottom ML`?(f[`Top Wishbone`]=!1,f[`Bottom Link Front`]=!1,f[`Bottom Link Rear`]=!1):i===`Top ML - Bottom WB`&&(f[`Top Link Front`]=!1,f[`Top Link Rear`]=!1,f[`Bottom Wishbone`]=!1)),BR.filter(e=>!f[e]),{selectOptions:{"Axle Position":FR,"Suspension Type":o,Configuration:c,"Mounting Point":BR},selectOptionDisabled:{"Suspension Type":u,Configuration:d,"Mounting Point":f},selectDisabled:{"Axle Position":!1,"Suspension Type":!1,Configuration:t,"Mounting Point":!1},toggleDisabled:{"Main Spring":!l,MonoShock:!0,"Integral Link":!a},mountingPointOptionDisabled:f,suspensionTypeValue:s}}function IB(e){let t=xB(e.MacPherson),n=xB(e.MonoShock),r=(e.Configuration?.trim()||`Pushrod`)===`Pushrod`,i=!n&&!t&&r,a=(e[`Antiroll TBar`]?.trim()||`0`)!==`0`;return{toggleDisabled:{"Antiroll CBar":n,"Antiroll TBar":!i,"Third Element":!i||!a,"Heave Spring":!i,"Roll Spring":!i}}}function LB(e){let t=e.suspension.suspensionType,n=e.suspension.configuration===`Outboard Spring`,r=bf(e),i=e.suspension.configuration===`Pullrod`,a=e.suspension.macPherson,o=rH(e),s=iH(e),c=t===`Multilink`,l=t===`Top WB - Bottom ML`,u=t===`Top ML - Bottom WB`,d=a?`Strut front`:c||u?`Top link front`:`Top wishbone front`,f=a?`Strut rear`:o?`Integral link rear`:c||u?`Top link rear`:`Top wishbone rear`,p=c||l?`Bottom link front`:`Bottom wishbone front`,m=s?`Integral link rear`:c||l?`Bottom link rear`:`Bottom wishbone rear`,h=i?`Pullrod`:`Pushrod`,g=a?`Strut top mount`:n?`Spring top mount`:`${h} rocker mount`;return{linkVisible:{TLF:!a,TLR:!a,BLF:!0,BLR:!0,TR:!0,PR:!a,Spring:r,SplitRocker:r&&!a},linkDisabled:{TLF:a,TLR:a,BLF:!1,BLR:!1,TR:!1,PR:n||a,Spring:!r,SplitRocker:n||!r||a},chassisDisabled:{TLF:a,TLR:a||o,BLF:!1,BLR:s,TR:!1,PRC:!1},shimVisible:{TLF:!a,TLR:!a&&(c||u),BLF:!0,BLR:!a&&(c||l),TR:!0,PR:!a},shimDisabled:{TLF:a,TLR:a||o,BLF:!1,BLR:a||s,TR:!1,PR:n||a},adjustmentModeDisabled:{spring:!r,pushrod:n||a,splitRocker:n||!r||a},linkLabels:{TLF:d,TLR:f,BLF:p,BLR:m,TR:`Track rod`,Spring:a?`Strut / spring`:`Spring`,PR:h,SplitRocker:`Split rocker`},chassisLabels:{TLF:dC.TLF,TLR:o?`Integral rear`:dC.TLR,BLF:dC.BLF,BLR:s?`Integral rear`:dC.BLR,TR:dC.TR,PRC:g},shimLabels:{TLF:a?`Strut`:c||u?fC.TLF:`Top`,TLR:o?`Integral rear`:fC.TLR,BLF:c||l?fC.BLF:`Bottom`,BLR:s?`Integral rear`:fC.BLR,TR:fC.TR,PR:h}}}function RB(e,t){let n=e.geometry.right.wheel;return t===`TLF`||t===`TLR`?t===`TLR`?n.topRear:n.topFront:t===`BLF`||t===`BLR`?t===`BLR`?n.bottomRear:n.bottomFront:t===`TR`?n.tieRod:n.pushRod}function zB(e){return e===`TLF`?`topFront`:e===`TLR`?`topRear`:e===`BLF`?`bottomFront`:e===`BLR`?`bottomRear`:e===`TR`?`tieRod`:`pushRod`}function BB(e,t,n,r,i){if(!r)return null;let a=pB(n,{x:0,y:1,z:0}),o={};uI.forEach(r=>{if(!i[r])return;let s=t.shimAmounts[r]??0;if(Math.abs(s)<=1e-9)return;let c=YH(pB(n,t.shimNormals[r]))??a,l=RB(e,r);o[zB(r)]=UH(l,JH(c,s))});let s=Object.entries(o);return s.length===0?null:{right:o,left:Object.fromEntries(s.map(([e,t])=>[e,SU(t)]))}}function VB(e,t,n,r,i,a){if(!i)return null;let o=pB(n,{x:1,y:0,z:0}),s=pB(n,{x:0,y:1,z:0}),c=pB(n,{x:0,y:0,z:1}),l=e=>YH(pB(n,t.shimNormals[e]))??s,u=uI.flatMap(n=>{if(!a[n])return[];let r=t.shimAmounts[n]??0;if(Math.abs(r)<=1e-9)return[];let i=RB(e,n);return[{from:UH(i,JH(l(n),r)),to:i,amount:r}]}),d=r&&a[r]?{origin:RB(e,r),normal:l(r),xAxis:o,yAxis:s,zAxis:c}:void 0;return d||u.length>0?{selected:d,blocks:u}:null}function HB(e){let t=EB(e[`Suspension Type`]),n=e.Configuration?.trim()||`Pushrod`,r=e[`Mounting Point`]?.trim()||`Upright`,i=xB(e.MacPherson),a=xB(e.MonoShock),o=xB(e[`Integral Link`]),s=e[`Main Spring`]===void 0?!0:xB(e[`Main Spring`]);a&&(i=!1,n===`Outboard Spring`&&(n=`Pushrod`)),i&&(n=`Outboard Spring`,r=`Upright`,t=DB(t),o=!1),s=yf({configuration:n,macPherson:i,mainSpring:s}),o&&!OB(t,n)&&(o=!1);let c=FB({...e,"Suspension Type":t,Configuration:n,"Mounting Point":r,MacPherson:i?`1`:`0`,MonoShock:a?`1`:`0`,"Integral Link":o?`1`:`0`,"Main Spring":s?`1`:`0`}),l=c.selectOptions[`Suspension Type`].filter(e=>e!==LR&&e!==RR);l.includes(t)||(t=l[0]??`Double Wishbone`),c.selectOptions.Configuration.includes(n)||(n=c.selectOptions.Configuration[0]??`Pushrod`),s=yf({configuration:n,macPherson:i,mainSpring:s}),(!c.selectOptions[`Mounting Point`].includes(r)||c.mountingPointOptionDisabled[r])&&(r=c.selectOptions[`Mounting Point`].find(e=>!c.mountingPointOptionDisabled[e])??`Upright`);let u=[];(e[`Suspension Type`]?.trim()||``)!==t&&u.push([`Suspension Type`,t]),(e.Configuration?.trim()||``)!==n&&u.push([`Configuration`,n]),(e[`Mounting Point`]?.trim()||``)!==r&&u.push([`Mounting Point`,r]),n===`Outboard Spring`&&(e[`Draw Rocker`]?.trim()||`0`)!==`0`&&u.push([`Draw Rocker`,`0`]);let d=i?`1`:`0`;(e.MacPherson?.trim()||`0`)!==d&&u.push([`MacPherson`,d]);let f=a?`1`:`0`;(e.MonoShock?.trim()||`0`)!==f&&u.push([`MonoShock`,f]);let p=o?`1`:`0`;(e[`Integral Link`]?.trim()||`0`)!==p&&u.push([`Integral Link`,p]);let m=s?`1`:`0`;return(e[`Main Spring`]?.trim()||`1`)!==m&&u.push([`Main Spring`,m]),u.push(...cH({...e,"Suspension Type":t,Configuration:n,"Mounting Point":r,MacPherson:i?`1`:`0`,MonoShock:a?`1`:`0`,"Integral Link":o?`1`:`0`,"Main Spring":s?`1`:`0`})),u}function UB(e){let t=[];return Lz.forEach(n=>{(e[n]?.trim()||`0`)!==`0`&&t.push([n,`0`])}),t}function WB(e){let t=IB(e),n=[...UB(e),...oB(e),...cB(e),...PB(e)];return[`Antiroll CBar`,`Antiroll TBar`,`Third Element`,`Heave Spring`,`Roll Spring`].forEach(r=>
4399{t.toggleDisabled[r]&&(e[r]?.trim()||`0`)!==`0`&&n.push([r,`0`])}),(e[`Antiroll TBar`]?.trim()||`0`)===`0`&&(e[`Third Element`]?.trim()||`0`)!==`0`&&n.push([`Third Element`,`0`]),(e[`Antiroll CBar`]?.trim()||`0`)!==`0`&&n.push([`Draw CBar`,`1`]),(e[`Antiroll TBar`]?.trim()||`0`)!==`0`&&n.push([`Draw TBar`,`1`]),(e[`Third Element`]?.trim()||`0`)!==`0`&&n.push([`Draw Third Element`,`1`]),(e[`Heave Spring`]?.trim()||`0`)!==`0`&&n.push([`Draw Heave Spring`,`1`]),(e[`Roll Spring`]?.trim()||`0`)!==`0`&&n.push([`Draw Roll Spring`,`1`]),n}function GB({document:e,field:t,disabled:n=!1,onChange:r}){let i=e.fields[t.key]??``,[a,o]=(0,h.useState)(i),s=t.key===`Rim Width`?2:null;(0,h.useEffect)(()=>{t.integer&&o(i)},[t.integer,i]);let c=(0,h.useCallback)(()=>{let e=Jz(a),n=String(Math.max(1,Math.round(e??1)));o(n),n!==i&&r(t.key,n)},[t.key,a,r,i]),l=(0,Z.jsxs)(`span`,{className:`field-input`,children:[t.integer?(0,Z.jsx)(`input`,{type:`text`,inputMode:`numeric`,value:a,disabled:n,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault(),c(),e.currentTarget.blur();return}e.key===`Escape`&&(e.preventDefault(),o(i),e.currentTarget.blur())},onBlur:c}):(0,Z.jsx)(Xz,{value:i,disabled:n,onCommit:e=>{let n=s===null?$(e):e.toFixed(s);n!==i&&r(t.key,n)}}),t.unit&&!t.unitOutside?(0,Z.jsx)(`small`,{children:t.unit}):null]});return(0,Z.jsxs)(`label`,{className:`field-row`,children:[(0,Z.jsx)(`span`,{children:t.label}),t.unitOutside?(0,Z.jsxs)(`span`,{className:`field-value-with-unit`,children:[l,(0,Z.jsx)(`small`,{children:t.unit})]}):l]})}function KB({label:e,value:t,options:n,disabled:r=!1,optionDisabled:i={},optionLabels:a={},onChange:o}){return(0,Z.jsxs)(`label`,{className:`select-row`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`select`,{value:t,onChange:e=>o(e.target.value),disabled:r,children:n.map(e=>(0,Z.jsx)(`option`,{value:e,disabled:!!i[e],children:a[e]??e},e))})]})}function qB({document:e,field:t,checkedOverride:n,disabled:r=!1,tooltip:i,onChange:a,onDisabledClick:o}){let s=n??(e.fields[t.key]??`0`)!==`0`;return(0,Z.jsxs)(`label`,{className:`toggle-row${r&&o?` is-clickable-disabled`:``}`,"data-ui-tooltip":i,onClick:e=>{!r||!o||(e.preventDefault(),o(t.key))},children:[(0,Z.jsx)(`span`,{children:t.label}),(0,Z.jsx)(`input`,{type:`checkbox`,checked:s,disabled:r,onChange:e=>a(t.key,e.target.checked?`1`:`0`)})]})}function JB({title:e,contactPatchPrefix:t,wheelCenterPrefix:n,document:r,disabled:i=!1,onChange:a}){let o=[{title:`Contact patch`,prefix:t},{title:`Wheel centre`,prefix:n}];return(0,Z.jsxs)(`section`,{className:`load-side-card`,"aria-label":e,children:[(0,Z.jsx)(`div`,{className:`load-side-title`,children:e}),(0,Z.jsxs)(`div`,{className:`load-force-table`,role:`table`,"aria-label":`${e} load inputs`,children:[(0,Z.jsx)(`div`,{className:`load-force-table-head load-force-row-head`,role:`columnheader`,children:`Point`}),Dz.map(t=>(0,Z.jsxs)(`div`,{className:`load-force-table-head load-force-component-head`,role:`columnheader`,children:[(0,Z.jsx)(`span`,{children:t.label}),(0,Z.jsx)(`small`,{children:t.unit})]},`${e}-${t.suffix}-head`)),o.flatMap(t=>[(0,Z.jsx)(`div`,{className:`load-force-row-cell`,role:`rowheader`,children:t.title},`${e}-${t.prefix}-row`),...Dz.map(n=>{let o=`${t.prefix} ${n.suffix}`;return(0,Z.jsx)(`label`,{className:`load-force-value-cell`,children:(0,Z.jsx)(Xz,{value:r.fields[o]??``,disabled:i,"aria-label":`${e} ${t.title} ${n.label}`,onCommit:e=>a(o,$(e))})},`${e}-${o}`)})])]})]})}function YB(e,t){return t===`Load CBar Torque`?e.elements.antirollCBar:t===`Load TBar Torque`?e.elements.antirollTBar:t===`Load Third Element Force`?e.elements.antirollTBar&&e.elements.thirdElement:t===`Load Heave Force`?e.elements.heaveSpring:t===`Load Roll Force`?e.elements.rollSpring:!0}function XB({document:e,result:t,onChange:n,onClearWheelLoads:r,onClearCoupledLoads:i}){let a=(e.fields[`Load Asymmetric`]??`0`)!==`0`,o=!a;return(0,Z.jsxs)(`div`,{className:`tab-grid three load-case-grid`,children:[(0,Z.jsxs)(`div`,{className:`control-column compact-panel load-case-panel load-case-input-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title load-case-title-row`,children:[(0,Z.jsxs)(`div`,{className:`load-case-title-label`,children:[(0,Z.jsx)(ae,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Wheel Loads`})]}),(0,Z.jsxs)(`div`,{className:`load-case-title-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`icon-button load-case-clear-button`,onClick:r,title:`Clear wheel loads`,"aria-label":`Clear wheel loads`,children:[(0,Z.jsx)(we,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Clear`})]}),(0,Z.jsx)(qB,{document:e,field:Ez,onChange:n}),(0,Z.jsxs)(`label`,{className:`toggle-row load-case-symmetric-toggle`,children:[(0,Z.jsx)(`span`,{children:Tz.label}),(0,Z.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>
4399n(Tz.key,e.target.checked?`0`:`1`)})]})]})]}),(0,Z.jsxs)(`div`,{className:`load-side-stack`,children:[(0,Z.jsx)(JB,{title:`Left side / reference`,contactPatchPrefix:`Load R CP`,wheelCenterPrefix:`Load R WC`,document:e,onChange:n}),a?(0,Z.jsx)(JB,{title:`Right side`,contactPatchPrefix:`Load L CP`,wheelCenterPrefix:`Load L WC`,document:e,onChange:n}):(0,Z.jsx)(`div`,{className:`load-case-note`,children:`Right side is symmetric from the left side: Fx/Fz stay equal, Fy changes sign; wheel moments follow the mirrored moment convention.`})]})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel load-case-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title load-case-coupled-title-row`,children:[(0,Z.jsx)(De,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Coupled Elements`}),(0,Z.jsxs)(`button`,{type:`button`,className:`icon-button load-case-clear-button`,onClick:i,title:`Clear coupled-element loads`,"aria-label":`Clear coupled-element loads`,children:[(0,Z.jsx)(we,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Clear`})]})]}),(0,Z.jsx)(`div`,{className:`field-grid load-internal-grid`,children:Oz.map(t=>(0,Z.jsx)(GB,{document:e,field:t,disabled:!YB(e,t.key),onChange:n},t.key))}),t.warnings.length>0?(0,Z.jsx)(`div`,{className:`setup-warning setup-warning-multiline load-warning`,role:`alert`,children:t.warnings.slice(0,4).map(e=>(0,Z.jsx)(`span`,{children:e},e))}):null]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel load-case-panel load-graphics-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(ye,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Load Graphics Settings`})]}),(0,Z.jsx)(`div`,{className:`field-grid load-graphics-settings-grid`,children:Sz.map(t=>(0,Z.jsx)(GB,{document:e,field:t,onChange:n},t.key))}),(0,Z.jsxs)(`div`,{className:`load-visual-toggle-group`,children:[(0,Z.jsx)(qB,{document:e,field:xz,onChange:n}),(0,Z.jsx)(`div`,{className:`load-visual-subtoggles`,children:Cz.map(t=>(0,Z.jsx)(qB,{document:e,field:t,onChange:n},t.key))})]})]})]})}function ZB({value:e,onChange:t,ariaLabel:n,disabled:r=!1}){let[i,a]=(0,h.useState)(()=>$(e));return(0,h.useEffect)(()=>{a($(e))},[e]),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,"aria-label":n,disabled:r,value:i,onChange:e=>a(e.target.value),onBlur:()=>{let n=Jz(i);if(n===null){a($(e));return}t(n),a($(n))},onKeyDown:t=>{t.key===`Enter`&&t.currentTarget.blur(),t.key===`Escape`&&(a($(e)),t.currentTarget.blur())}})}function QB(e){return`${$(e.x)} ${$(e.y)} ${$(e.z)}`}function $B(e){let t=e.trim().split(/[\s,;]+/).filter(Boolean);if(t.length!==3)return null;let n=t.map(e=>Jz(e));return n.some(e=>e===null)?null:{x:n[0]??0,y:n[1]??0,z:n[2]??0}}function eV({value:e,onChange:t,ariaLabel:n,disabled:r=!1}){let[i,a]=(0,h.useState)(()=>QB(e));return(0,h.useEffect)(()=>{a(QB(e))},[e]),(0,Z.jsx)(`input`,{type:`text`,inputMode:`text`,"aria-label":n,disabled:r,value:i,onChange:e=>a(e.target.value),onBlur:()=>{let n=$B(i);if(n){t(n),a(QB(n));return}a(QB(e))},onKeyDown:t=>{t.key===`Enter`&&t.currentTarget.blur(),t.key===`Escape`&&(a(QB(e)),t.currentTarget.blur())}})}function tV({state:e,referenceMode:t,linkBasedDisabled:n,document:r,selectedHardpointIds:i,referenceRows:a,editableRows:o,rodMetrics:s,springMetrics:c,heaveMetrics:l,rollMetrics:u,onReferenceModeChange:d,onHardpointSelect:f,onCoordinateChange:p}){let m=e=>e===`Rocker`?`Rckr`:e===`LH Rocker`?`LH Rckr`:e===`Chassis`?`Chss`:e,h=(e,t,n)=>{let r=e.editableAxes[t];return(0,Z.jsx)(`label`,{className:`excel-cell${n?` selected`:``}`,children:(0,Z.jsx)(Xz,{value:$(e.values[t]),readOnly:!r,className:[r?``:`element-point-input-readonly`,n?`selected`:``].filter(Boolean).join(` `)||void 0,onCommit:r?n=>p(e.id,t,String(n)):()=>{},onFocus:()=>f(e.id,!1),onClick:e=>e.stopPropagation()})},`${e.id}-${t}`)},g=(e,t)=>{let n=e.point.editableAxes[e.axis];return(0,Z.jsx)(`label`,{className:`excel-cell${t?` selected`:``}`,children:(0,Z.jsx)(Xz,{value:$(e.point.values[e.axis]),readOnly:!n,className:[n?``:`element-point-input-readonly`,t?`selected`:``].filter(Boolean).join(` `)||void 0,onCommit:n?t=>p(e.point.id,e.axis,String(t)):()=>{},onFocus:()=>f(e.point.id,!1),onClick:e=>e.stopPropagation()})},e.key)},_=({rows:e,ariaLabel:t,sharedHeader:n=!1,groupLabel:a})=>(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(`div`,{className:`geometry-excel-table-wrap rocker-subpanel-table-wrap`,role:`table`,"aria-label":t,children:(0,Z.jsxs)(`div`,{className:`geometry-excel-table rocker-editable-table`,children:[n&&e[0]?(0,Z.jsxs)(`div`,{className:`excel-row excel-head rocker-subpanel-head rocker-subpanel-head-${e[0].cells.length}`,children:[(0,Z.jsx)(`span`,{children:`Component`}),Array.from(new Set(e[0].cells.map(e=>e.label))).flatMap(t=>[`x`,`y`,`z`].map(n=>(0,Z.jsx)(`span`,{children:`${m(t)} ${n}R`},`${e[0].key}-${t}-${n}`)))]}):null,e.map((e,t)=>{let a=new Set(e.cells.filter(e=>kU(r,e.point.id,i)).map(e=>e.point.id)),o=a.size>0,s=e.cells[0]?.point.id,c=Array.from(new Set(e.cells.map(e=>e.label))),l=e.cells.length;return(0,Z.jsxs)(`div`,{className:`rocker-section-block${t>0?` rocker-section-block-secondary`:``}`,children:[n?null:(0,Z.jsxs)(`div`,{className:`excel-row excel-head rocker-subpanel-head rocker-subpanel-head-${l}`,children:[(0,Z.jsx)(`span`,{children:`Component`}),c.flatMap(t=>[`x`,`y`,`z`].map(n=>(0,Z.jsx)(`span`,{children:`${m(t)} ${n}R`},`${e.key}-${t}-${n}`)))]}),(0,Z.jsxs)(`div`,{className:`excel-row rocker-subpanel-row rocker-subpanel-row-${l}${o?` selected`:``}`,role:`row`,onClick:e=>{s&&f(s,e.ctrlKey||e.metaKey)},children:[(0,Z.jsx)(`span`,{className:`component-cell${o?` selected`:``}`,children:e.component}),e.cells.map(e=>g(e,a.has(e.point.id)))]})]},e.key)})]})})}),v=o.find(e=>e.key===`rod`),y=o.find(e=>e.key===`spring`),b=o.filter(e=>e.key===`c-bar`||e.key===`t-bar`),x=o.filter(e=>e.key===`hs-left`||e.key===`rs-left`),S=[...s,...c,...l,...u];return(0,Z.jsxs)(`div`,{className:`tab-grid three rocker-mode-grid`,children:[(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(k,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`REFERENCE HARDPOINTS`})]}),(0,Z.jsx)(`div`,{className:`toggle-grid compact-toggle-grid`,children:[`linkBased`,`rodBased`].map(e=>(0,Z.jsxs)(`label`,{className:`toggle-row`,children:[(0,Z.jsx)(`span`,{style:{fontWeight:t===e?700:400},children:xL[e]}),(0,Z.jsx)(`input`,{type:`radio`,name:`rocker-reference-mode`,checked:t===e,disabled:e===`linkBased`&&n,onChange:()=>d(e)})]},e))}),(0,Z.jsx)(`div`,{className:`geometry-excel-table-wrap`,role:`table`,"aria-label":`Rocker reference hardpoints`,children:(0,Z.jsxs)(`div`,{className:`geometry-excel-table rocker-reference-table`,children:[(0,Z.jsxs)(`div`,{className:`excel-row excel-head`,children:[(0,Z.jsx)(`span`,{children:`Reference hardpoint`}),(0,Z.jsx)(`span`,{children:`xR`}),(0,Z.jsx)(`span`,{children:`yR`}),(0,Z.jsx)(`span`,{children:`zR`})]}),a.map(e=>{let t=kU(r,e.point.id,i);return(0,Z.jsxs)(`div`,{className:`excel-row${t?` selected`:``}`,role:`row`,onClick:t=>f(e.point.id,t.ctrlKey||t.metaKey),children:[(0,Z.jsx)(`span`,{className:`component-cell${t?` selected`:``}`,children:e.label}),[`x`,`y`,`z`].map(n=>h(e.point,n,t))]},e.key)})]})})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel rocker-editable-main-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(F,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`EDITABLE COMPONENTS`})]}),(0,Z.jsxs)(`div`,{className:`rocker-editable-main-stack`,children:[v?_({rows:[v],ariaLabel:`${v.component} rocker editable coordinates`}):null,y?_({rows:[y],ariaLabel:`Spring rocker editable coordinates`}):null,x.length>0?_({rows:x,ariaLabel:`Heave and roll spring rocker editable coordinates`,sharedHeader:!0,groupLabel:`LH Rocker`}):null,b.length>0?_({rows:b,ariaLabel:`Antiroll bars rocker editable coordinates`,sharedHeader:!0}):null]})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel geometry-rocker-angle-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(Se,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`ROCKER 3D GEOMETRY`})]}),(0,Z.jsx)(`div`,{className:`suspension-rocker-angle-grid`,children:S.map(e=>(0,Z.jsxs)(`div`,{className:`suspension-rocker-angle-row`,children:[(0,Z.jsx)(`span`,{className:`suspension-rocker-metric-title`,children:e.label}),(0,Z.jsxs)(`span`,{className:`field-input suspension-rocker-angle-value`,children:[(0,Z.jsx)(`input`,{type:`text`,value:e.value,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:e.unit})]})]},e.key))})]})]})}function nV({state:e,uiState:t,result:n,baselineDocument:r,motion:i,animationMode:a,motionRatioMode:o,selectedShimKey:s,onLengthDeltaChange:c,onRideHeightDeltaChange:l,onCh
4399assisOffsetChange:u,onShimChange:d,onShimNormalChange:f,onShimSelect:p,onAdjustmentModeChange:m,onReset:g,onExport:_}){let v=ZC(e),y=n?.document??null;r?.elements.rollSpring&&r&&bf(r)&&(Math.abs(e.lengthDeltas.Spring)>1e-9||e.adjustmentMode===`spring`&&Math.abs(e.rideHeightDelta));let x=(0,h.useMemo)(()=>y?A_(y,i,{useSteeringModel:a===`steer`?!0:void 0}):null,[a,i,y]),S=(0,h.useMemo)(()=>r?A_(r,i,{useSteeringModel:a===`steer`?!0:void 0}):null,[a,r,i]),C=(0,h.useMemo)(()=>y?A_(y,{bump:0,steer:0,roll:0}).rightFrame:null,[y]),w=(0,h.useMemo)(()=>r?A_(r,{bump:0,steer:0,roll:0}).rightFrame:null,[r]),T=(0,h.useMemo)(()=>y?A_(y,{bump:EK,steer:0,roll:0}).rightFrame:null,[y]),E=(0,h.useMemo)(()=>r?A_(r,{bump:EK,steer:0,roll:0}).rightFrame:null,[r]),D=(0,h.useMemo)(()=>!y||!x||!C||!T?null:XK(y,x.rightFrame,x.leftFrame,C,T,i,a,o).sections,[a,i,o,T,y,x,C]),O=(0,h.useMemo)(()=>!r||!S||!w||!E?null:XK(r,S.rightFrame,S.leftFrame,w,E,i,a,o).sections,[a,r,E,S,w,i,o]),k=FK(i,a),A=k===`static`?C:x?.rightFrame??null,j=k===`static`?w:S?.rightFrame??null,ee=uI.filter(e=>t.shimVisible[e]),te=r?bf(r):!0,M=[{key:`spring`,label:`Spring`,value:n?.rideHeightAdjustments.spring??0,disabled:t.adjustmentModeDisabled.spring},{key:`pushrod`,label:t.linkLabels.PR,value:n?.rideHeightAdjustments.pushrod??0,disabled:t.adjustmentModeDisabled.pushrod},{key:`splitRocker`,label:`Split rocker`,value:n?.rideHeightAdjustments.splitRocker??0,disabled:t.adjustmentModeDisabled.splitRocker}],ne=(0,h.useMemo)(()=>{let e=A?zK(A,`right`):null,n=j?zK(j,`right`):null,i=A?LK(A,`right`):null,a=j?LK(j,`right`):null,s=A?RK(A,`right`):null,c=j?RK(j,`right`):null,l=e?HH(e.chassis.pushRod,e.wheel.pushRod):NaN,u=n?HH(n.chassis.pushRod,n.wheel.pushRod):NaN,d=e?HH(e.chassis.pushRod,e.wheel.spring):NaN,f=n?HH(n.chassis.pushRod,n.wheel.spring):NaN,p=x?.document??y,m=S?.document??r,h=p?lU(p)??NaN:NaN,g=m?lU(m)??NaN:NaN,_=y&&s?BK(y,s):NaN,v=r&&c?BK(r,c):NaN,b=fR(`Spring MotionRatio`,`motionRatio`,`mm/mm`,o),C=fR(`Heave s. Motion Ratio, bump`,`heaveSpringMotionRatio`,`mm/mm`,o),w=fR(`Roll s. Motion Ratio, bump`,`rollSpringMotionRatio`,`mm/mm`,o),T=fR(`Heave s. Motion Ratio, roll`,`heaveSpringMotionRatio`,`mm/deg`,o),E=fR(`Roll s. Motion Ratio, roll`,`rollSpringMotionRatio`,`mm/deg`,o),k=PK(D,`monitor-secondary`,b),ee=PK(O,`monitor-secondary`,b),M=PK(D,`monitor-secondary`,C),ne=PK(O,`monitor-secondary`,C),N=PK(D,`monitor-secondary`,w),P=PK(O,`monitor-secondary`,w),re=PK(D,`monitor-secondary`,T),ie=PK(O,`monitor-secondary`,T),ae=PK(D,`monitor-secondary`,E),oe=PK(O,`monitor-secondary`,E);return[{key:`ride-height`,label:`Ride Height [mm]`,current:_,baseline:v,precision:1,disabled:!1},{key:`camber`,label:`Camber [deg]`,current:i?.camber??``,baseline:a?.camber??``,precision:2,disabled:!1},{key:`toe`,label:`Toe [deg]`,current:i?.toe??``,baseline:a?.toe??``,precision:2,disabled:!1},{key:`caster`,label:`Caster [deg]`,current:i?.caster??``,baseline:a?.caster??``,precision:1,disabled:!1},{key:`spring-length`,label:`Spring length [mm]`,current:i?.springLength??``,baseline:a?.springLength??``,precision:1,disabled:!te},{key:`pushrod-length`,label:`${t.linkLabels.PR} length [mm]`,current:l,baseline:u,precision:1,disabled:t.adjustmentModeDisabled.pushrod},{key:`split-rocker-length`,label:`Split rocker length [mm]`,current:d,baseline:f,precision:1,disabled:t.adjustmentModeDisabled.splitRocker},{key:`split-rocker-angle`,label:`Split rocker angle [deg]`,current:h,baseline:g,precision:1,disabled:t.adjustmentModeDisabled.splitRocker},{key:`motion-ratio`,label:b,current:k?.value??``,baseline:ee?.value??``,precision:k?.precision??2,disabled:!te},{key:`heave-spring-motion-ratio-bump`,label:C,current:M?.value??``,baseline:ne?.value??``,precision:M?.precision??2,disabled:!1},{key:`roll-spring-motion-ratio-bump`,label:w,current:N?.value??``,baseline:P?.value??``,precision:N?.precision??2,disabled:!1},{key:`heave-spring-motion-ratio-roll`,label:T,current:re?.value??``,baseline:ie?.value??``,precision:re?.precision??2,disabled:!1},{key:`roll-spring-motion-ratio-roll`,label:E,current:ae?.value??``,baseline:oe?.value??``,precision:ae?.precision??2,disabled:!1}]},[a,r,j,O,S,D,i,o,y,A,x,te,t.adjustmentModeDisabled.spring,t.adjustmentModeDisabled.pushrod,t.adjustmentModeDisabled.splitRocker,t.linkLabels.PR]);return(0,Z.jsxs)(`div`,{className:`setup-mode-grid`,children:[(0,Z.jsxs)(`section`,{className:`compact-panel setup-mode-panel setup-mode-length-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(_e,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Link Length Adjustment`})]}),(0,Z.jsxs)(`div`,{className:`setup-length-grid`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`Delta [mm]`}),cI.filter(e=>t.linkVisible[e]).map(n=>{let r=t.linkDisabled[n];return(0,Z.jsxs)(`label`,{className:`setup-number-row`,children:[(0,Z.jsx)(`span`,{children:t.linkLabels[n]}),(0,Z.jsx)(ZB,{value:e.lengthDeltas[n],disabled:r,ariaLabel:`${t.linkLabels[n]} length delta`,onChange:e=>c(n,e)})]},n)})]})]}),(0,Z.jsxs)(`section`,{className:`compact-panel setup-mode-panel setup-mode-ride-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(De,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Ride Height Adjustment`})]}),(0,Z.jsxs)(`div`,{className:`setup-length-grid`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`Delta [mm]`}),(0,Z.jsxs)(`label`,{className:`setup-number-row`,children:[(0,Z.jsx)(`span`,{children:`Target Ride height variation`}),(0,Z.jsx)(ZB,{value:e.rideHeightDelta,ariaLabel:`Target ride height variation delta`,onChange:l})]})]}),(0,Z.jsx)(`div`,{className:`setup-ride-mode-grid`,role:`radiogroup`,"aria-label":`Ride height adjustment mode`,children:M.map(t=>(0,Z.jsxs)(`label`,{className:`setup-ride-mode-row${t.disabled?` is-disabled`:``}`,children:[(0,Z.jsx)(`input`,{type:`radio`,name:`setup-ride-height-mode`,checked:e.adjustmentMode===t.key,disabled:t.disabled,onChange:()=>m(t.key)}),(0,Z.jsx)(`span`,{children:t.label}),(0,Z.jsx)(`input`,{type:`text`,value:$(t.value),readOnly:!0,"aria-readonly":`true`,disabled:t.disabled})]},t.key))})]}),(0,Z.jsxs)(`section`,{className:`compact-panel setup-mode-panel setup-mode-chassis-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(be,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Chassis Side Adjustment`})]}),(0,Z.jsxs)(`div`,{className:`setup-vector-table setup-chassis-table`,role:`table`,"aria-label":`Chassis side setup offsets`,children:[(0,Z.jsxs)(`div`,{className:`setup-vector-row setup-vector-head`,role:`row`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`X`}),(0,Z.jsx)(`span`,{children:`Y`}),(0,Z.jsx)(`span`,{children:`Z`})]}),lI.map(n=>{let r=t.chassisDisabled[n];return(0,Z.jsxs)(`div`,{className:`setup-vector-row${r?` is-disabled`:``}`,role:`row`,"aria-disabled":r,children:[(0,Z.jsx)(`span`,{children:t.chassisLabels[n]}),[`x`,`y`,`z`].map(i=>(0,Z.jsx)(ZB,{value:e.chassisOffsets[n][i],disabled:r,ariaLabel:`${t.chassisLabels[n]} ${i.toUpperCase()} chassis offset`,onChange:e=>u(n,i,e)},i))]},n)})]})]}),(0,Z.jsxs)(`section`,{className:`compact-panel setup-mode-panel setup-mode-shim-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(ye,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Wheel Side Camber Adjustment`})]}
4399),(0,Z.jsxs)(`div`,{className:`setup-shim-grid setup-shim-vector-grid`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`Shim [mm]`}),(0,Z.jsx)(`span`,{children:`Normal Vector`}),ee.map(n=>{let r=t.shimDisabled[n];return(0,Z.jsxs)(`label`,{className:`setup-number-row${r?` is-disabled`:``}${s===n?` is-selected`:``}`,"aria-disabled":r,onClick:()=>p(n),onFocus:()=>p(n),children:[(0,Z.jsx)(`span`,{children:t.shimLabels[n]}),(0,Z.jsx)(ZB,{value:e.shimAmounts[n],disabled:r,ariaLabel:`${t.shimLabels[n]} shim`,onChange:e=>d(n,e)}),(0,Z.jsx)(eV,{value:e.shimNormals[n],disabled:r,ariaLabel:`${t.shimLabels[n]} shim normal vector`,onChange:e=>f(n,e)})]},n)})]})]}),(0,Z.jsxs)(`section`,{className:`compact-panel setup-mode-panel setup-mode-monitor-panel`,"aria-label":`Setup Monitor`,children:[(0,Z.jsxs)(`div`,{className:`section-title setup-monitor-title`,children:[(0,Z.jsx)(b,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Setup Monitor`}),(0,Z.jsxs)(`div`,{className:`setup-monitor-title-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`section-title-action setup-monitor-action-button${v?` setup-monitor-reset-button`:``}`,onClick:g,disabled:!v,children:[(0,Z.jsx)(R,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Reset`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`section-title-action setup-export-button setup-monitor-action-button`,onClick:_,disabled:!n,children:[(0,Z.jsx)(ve,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Export to .spm`})]})]})]}),(0,Z.jsxs)(`div`,{className:`monitor-table setup-monitor-table`,role:`table`,children:[(0,Z.jsxs)(`div`,{className:`monitor-row monitor-row-header`,role:`row`,style:{gridTemplateColumns:AK(!0)},children:[(0,Z.jsx)(`span`,{children:`Channel`}),(0,Z.jsx)(`span`,{className:`monitor-row-header-current-setup`,children:`Current`}),(0,Z.jsx)(`span`,{className:`monitor-row-header-reference`,children:`Baseline`}),(0,Z.jsx)(`span`,{className:`monitor-row-header-delta`,children:`Delta`})]}),ne.map(e=>{let t=NK(e.current,e.baseline);return(0,Z.jsxs)(`div`,{className:`monitor-row${e.disabled?` is-disabled`:``}`,role:`row`,style:{gridTemplateColumns:AK(!0)},children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsx)(`span`,{className:`monitor-row-value`,children:MK(e.current,e.precision)}),(0,Z.jsx)(`span`,{className:`monitor-row-value`,children:MK(e.baseline,e.precision)}),(0,Z.jsx)(`span`,{className:`monitor-row-value`,children:MK(t,e.precision)})]},e.key)})]})]})]})}function rV({label:e,value:t,min:n,max:r,unit:i,invertSign:a=!1,step:o,displayValue:s,showZeroReference:c=!1,disabled:l=!1,onInteractionStart:u,onChange:d}){let f=a?-t:t,p=c&&n<=0&&r>=0&&r-n>1e-9?(-n/(r-n)*100).toFixed(4):null;return(0,Z.jsxs)(`label`,{className:`motion-slider${l?` is-disabled`:``}`,children:[(0,Z.jsxs)(`span`,{children:[e,(0,Z.jsx)(`strong`,{children:s??`${Tf(t)}${i?` ${i}`:``}`})]}),(0,Z.jsxs)(`div`,{className:`motion-slider-control`,children:[p===null?null:(0,Z.jsx)(`span`,{className:`motion-slider-zero-track`,"aria-hidden":`true`,children:(0,Z.jsx)(`span`,{className:`motion-slider-zero-marker`,style:{left:`${p}%`}})}),(0,Z.jsx)(`input`,{type:`range`,disabled:l,min:n,max:r,step:o??(i===`deg`?1:.5),value:f,onPointerDown:u,onKeyDown:u,onChange:e=>{let t=Number(e.target.value);d(a?-t:t)}})]})]})}function iV(e){return e===`steer`?{key:`steer`,label:`Steering wheel angle`,unit:`deg`}:e===`steeringColumn`?{key:`steeringWheelAngle`,label:`Steering wheel angle`,unit:`deg`}:e===`roll`?{key:`roll`,label:`Roll angle`,unit:`deg`}:{key:`bump`,label:`Bump`,unit:`mm`}}function aV(e){return e===`steer`?{index:-301,key:`steeringWheelAngle`,label:`Steering wheel angle`,unit:`deg`}:e===`roll`?{index:-302,key:`roll`,label:`Roll angle`,unit:`deg`}:{index:-300,key:`bump`,label:e===`bumpSteer`?`Bump @ steer`:`Bump`,unit:`mm`}}var oV=new Set([`springLength`,`motionRatio`,`loadRightSpring`,`loadLeftSpring`]);
4399function sV(e,t=fL,n){let r=e===`anti`?jy:e===`steer`?My:e===`steeringColumn`?Ny:e===`roll`?Py:e===`bumpSteer`?Fy:e===`driveshaft`?Iy:e===`loads`?Ly:Ay;return(n&&!bf(n)?r.filter(e=>!oV.has(e.key)):r).map(e=>dR(e,t))}function cV(e,t){if(!t)return e;let n=new Set(e.map(e=>e.key)),r=US(t).filter(e=>!n.has(e.key)).map((e,t)=>({index:1e3+t,key:e.key,label:e.label,unit:e.unit}));return[...e,...r]}function lV(e,t=fL,n=null,r){let i=sV(e,t,r);return e===`loads`?cV(i,n):i}function uV(e,t,n=fL){let r=ZU(e,n);return t.filter(e=>e.key!==r.key)}function Q(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:0}function dV(e){if(!Number.isFinite(e))return``;let t=Math.round(e);return Math.abs(e-t)<1e-9?String(t):e.toFixed(1)}function fV(e){return Number.isFinite(e)?e.toFixed(3):``}function pV(e,t=window){if(!t.document)return!1;let n=t.document.createElement(`textarea`);n.value=e,n.setAttribute(`readonly`,``),n.style.position=`fixed`,n.style.top=`-9999px`,n.style.left=`-9999px`,t.document.body.appendChild(n),n.select(),n.setSelectionRange(0,n.value.length);let r=t.document.execCommand,i=r?r.call(t.document,`copy`):!1;return n.remove(),i}function $(e){return e.toFixed(3).replace(/\.?0+$/,``)}function mV(e){return{x:$(e.x),y:$(e.y),z:$(e.z)}}function hV(e,t){return{spmText:e,sourceName:t,capturedAt:Date.now()}}function gV(e){let t=e.trim()||`Suspension.spm`;return/\.[a-z0-9]+$/i.test(t)?t:`${t}.spm`}function _V(e){let t=e.trim()||`wheel_envelope.step`;return/\.(step|stp)$/i.test(t)?t:`${t}.step`}function vV(e){return(e.trim().replace(/\.[a-z0-9]+$/i,``)||`Suspension`).replace(/[\\/:*?"<>|]/g,`_`).trim()||`Suspension`}function yV(){return`step-${Date.now()}-${Math.round(Math.random()*1e6)}`}function bV(e){return Number.isFinite(e)?Math.max(.001,e):1}function xV(e){let t=CV(e);return{x:t.scale,y:t.scaleY,z:t.scaleZ}}function SV(e){if(!e)return{overall:`1`,y:`1`,z:`1`};let t=CV(e);return{overall:$(t.scale),y:$(t.scaleY),z:$(t.scaleZ)}}function CV(e){let t=bV(e.scale);return{...e,scale:t,scaleY:Number.isFinite(e.scaleY)?bV(e.scaleY):t,scaleZ:Number.isFinite(e.scaleZ)?bV(e.scaleZ):t}}function wV(e){return Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e))):25}function TV(e){let t=e.trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(t)?t:`#7dd3fc`}function EV(e){let t=`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)`,n=RegExp(`(?:COLOUR_RGB|CLRRGB)\\s*\\(\\s*(?:'(?:[^']|'')*'|\\$)\\s*,\\s*${t}\\s*,\\s*${t}\\s*,\\s*${t}\\s*\\)`,`gi`),r=Array.from(e.matchAll(n)),i=r.length>0?r[r.length-1]:void 0;if(!i)return null;let a=e=>{let t=Number.parseFloat(e);if(!Number.isFinite(t))return`00`;let n=t>1?t/255:t;return Math.round(Math.max(0,Math.min(1,n))*255).toString(16).padStart(2,`0`)};return`#${a(i[1])}${a(i[2])}${a(i[3])}`}function DV(e,t){let n=t.x*Math.PI/180,r=t.y*Math.PI/180,i=t.z*Math.PI/180,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i),d=e.y*a-e.z*o,f=e.y*o+e.z*a,p=e.x,m=p*s+f*c,h=-p*c+f*s,g=d;return{x:m*l-g*u,y:m*u+g*l,z:h}}function OV(e,t,n={x:1,y:1,z:1}){let r=1/0,i=1/0,a=1/0,o=-1/0,s=-1/0,c=-1/0;return e.vertices.forEach(e=>{let l=DV({x:e.x*n.x,y:e.y*n.y,z:e.z*n.z},t);l.x<r&&(r=l.x),l.y<i&&(i=l.y),l.z<a&&(a=l.z),l.x>o&&(o=l.x),l.y>s&&(s=l.y),l.z>c&&(c=l.z)}),!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(c)?{x:0,y:0,z:0}:{x:Math.max(0,o-r),y:Math.max(0,s-i),z:Math.max(0,c-a)}}function kV(e){let t=(Math.round(e)%360+360)%360;return t===270?-90:t}function AV(e,t){if(e.vertices.length===0)return null;let n=OV(e,{x:0,y:0,z:0},t),r=[n.x,n.y,n.z].sort((e,t)=>e-t),i=r[0]??0,a=r[1]??0,o=r[2]??0,s=[0,90,180,270],c=null;for(let n of s)for(let r of s)for(let l of s){let s={x:n,y:r,z:l},u=OV(e,s,t),d=Math.abs(u.x-o)+Math.abs(u.z-i)+Math.abs(u.y-a),f=Math.abs(kV(s.x))+Math.abs(kV(s.y))+Math.abs(kV(s.z));(!c||d<c.score-1e-9||Math.abs(d-c.score)<=1e-9&&f<c.effort)&&(c={score:d,effort:f,rotate:s})}return c?{x:kV(c.rotate.x),y:kV(c.rotate.y),z:kV(c.rotate.z)}:null}function jV(e,t){if(e.vertices.length===0)return null;let n=xV(t),r=OV(e,{x:0,y:0,z:0},n),i=Math.max(r.x,r.y,r.z),a=Math.max(1e-9,i*1e-9);return r.x>=i-a?{x:0,y:0,z:0}:AV(e,n)}function MV(e,t){let n=xV(t),r=DV({x:e.x*n.x,y:e.y*n.y,z:e.z*n.z},t.rotateDeg);return{x:r.x+t.translate.x,y:r.y+t.translate.y,z:r.z+t.translate.z}}function NV(e,t){if(e.vertices.length===0)return{x:0,y:0,z:0};let n=1/0,r=1/0,i=1/0,a=-1/0,o=-1/0,s=-1/0;
4399return e.vertices.forEach(e=>{let c=MV(e,t);c.x<n&&(n=c.x),c.y<r&&(r=c.y),c.z<i&&(i=c.z),c.x>a&&(a=c.x),c.y>o&&(o=c.y),c.z>s&&(s=c.z)}),!Number.isFinite(n)||!Number.isFinite(a)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(s)?{x:0,y:0,z:0}:{x:Math.max(0,a-n),y:Math.max(0,o-r),z:Math.max(0,s-i)}}function PV(e,t){if(e.vertices.length===0)return 0;let n=1/0;return e.vertices.forEach(e=>{let r=MV(e,t);r.z<n&&(n=r.z)}),Number.isFinite(n)?n:0}function FV(e,t){let n=xV(t);return{vertices:e.vertices.map(e=>{let r=DV({x:e.x*n.x,y:e.y*n.y,z:e.z*n.z},t.rotateDeg);return{x:r.x+t.translate.x,y:r.y+t.translate.y,z:r.z+t.translate.z}}),faces:e.faces.map(([e,t,n])=>[e,t,n])}}function IV(e){return Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e))):0}var LV=`STEP import canceled.`;function RV(){return Error(LV)}function zV(e){return e instanceof DOMException&&e.name===`AbortError`?!0:e instanceof Error&&e.message===LV}function BV(e,t,n){return new Promise((r,i)=>{let a=new FileReader,o=!1;function s(){if(a.readyState===FileReader.LOADING){a.abort();return}u(RV())}let c=()=>{n&&n.removeEventListener(`abort`,s)},l=e=>{o||(o=!0,c(),r(e))},u=e=>{o||(o=!0,c(),i(e))};if(n?.aborted){u(RV());return}n?.addEventListener(`abort`,s),a.onprogress=e=>{!e.lengthComputable||e.total<=0||t(e.loaded/e.total*100)},a.onerror=()=>{u(a.error??Error(`Cannot read selected file.`))},a.onabort=()=>{u(RV())},a.onload=()=>{let e=a.result;if(!(e instanceof ArrayBuffer)){u(Error(`Cannot read selected file.`));return}l(new Uint8Array(e))},a.readAsArrayBuffer(e)})}function VV(e,t,n){return new Promise((r,i)=>{let a=new Worker(new URL(``+new URL(`stepImport.worker-CNnftpfD.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),o=!1;function s(){u(RV())}let c=()=>{n&&n.removeEventListener(`abort`,s),a.onmessage=null,a.onerror=null,a.terminate()},l=e=>{o||(o=!0,c(),r(e))},u=e=>{o||(o=!0,c(),i(e))};if(n?.aborted){u(RV());return}n?.addEventListener(`abort`,s),a.onmessage=e=>{let t=e.data;if(!t||typeof t!=`object`){u(Error(`Cannot import STEP geometry.`));return}if(t.type===`success`){l(t.mesh);return}u(Error(t.message||`Cannot import STEP geometry.`))},a.onerror=e=>{u(Error(e.message||`Cannot import STEP geometry.`))};let d={type:`import`,buffer:e.buffer,resolutionPercent:t};a.postMessage(d,[e.buffer])})}function HV(e){return e instanceof DOMException&&e.name===`AbortError`}function UV(e,t,n=`text/plain;charset=utf-8`,r=window){let i=URL.createObjectURL(new Blob([t],{type:n})),a=r.document.createElement(`a`);a.href=i,a.download=e,r.document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}function WV(e,t,n=window){UV(gV(e),t,`text/plain;charset=utf-8`,n)}var GV=[{description:`3DSusp custom graph layout`,accept:{"application/json":[nL],"text/plain":[nL]}}];function KV(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(typeof r.result==`string`?r.result:``),r.onerror=()=>n(r.error??Error(`Cannot read selected file.`)),r.readAsText(e)})}async function qV(e,t,n){let r=vW(n)??gW(e),i=SW(r,t),a=window.showSaveFilePicker;if(!a)return UV(r,i,`application/json;charset=utf-8`),{name:r,handle:null};let o=await a({suggestedName:r,types:GV}),s=await o.createWritable?.();if(!s)throw Error(`This browser cannot write to the selected file.`);return await s.write(i),await s.close(),{name:o.name??r,handle:o}}function JV(){return new Promise(e=>{let t=window.document.createElement(`input`),n=!1;t.type=`file`,t.accept=`${nL},application/json,text/plain`,t.style.display=`none`;let r=()=>{window.removeEventListener(`focus`,a),t.remove()},i=t=>{n||(n=!0,r(),e(t))},a=()=>{window.setTimeout(()=>{!n&&!t.files?.length&&i(null)},600)};t.addEventListener(`change`,()=>{let e=t.files?.[0];if(!e){i(null);return}KV(e).then(t=>i({fileName:e.name,text:t})).catch(()=>i(null))}),window.addEventListener(`focus`,a),window.document.body.appendChild(t),t.click()})}async function YV(){let e=window.showOpenFilePicker;try{if(e){let t=(await e({multiple:!1,types:GV}))[0],n=await t?.getFile?.();return n?{fileName:n.name,layout:CW(await KV(n)),handle:t}:null}let t=await JV();return t?{fileName:t.fileName,layout:CW(t.text),handle:null}:null}catch(e){if(HV(e))return null;throw e}}function XV(){let e=[],t=!1;
4399return Nw.split(/\r?\n/).forEach(n=>{if(t)return;let r=n.indexOf(`:`);if(r===-1){e.push(n);return}let i=n.slice(0,r).trim();if(i===`NOTES`){t=!0,e.push(`NOTES :`);return}e.push(`${i}: ${RI[i]??`0`}`)}),II(`${e.join(` 4400`).trimEnd()}\n`)}function ZV(e,t){return e.find(e=>e.id===t)?.point??{x:0,y:0,z:0}}function QV(e){return e.replace(/\s*-\s*(Chassis side|Wheel side|Rocker side)$/i,``).trim()}function $V(e){return/\sFront$/i.test(e)?{component:e.replace(/\sFront$/i,``).trim(),position:`Front`}:/\sRear$/i.test(e)?{component:e.replace(/\sRear$/i,``).trim(),position:`Rear`}:/\sPivot\s*1$/i.test(e)?{component:e.replace(/\sPivot\s*1$/i,``).trim(),position:`Pivot 1`}:/\sPivot\s*2$/i.test(e)?{component:e.replace(/\sPivot\s*2$/i,``).trim(),position:`Pivot 2`}:{component:e,position:``}}function eH(e,t,n){return $V(QV(e.get(t)??n))}function tH(e){return e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top ML - Bottom WB`}function nH(e){return e.suspension.suspensionType===`Multilink`||e.suspension.suspensionType===`Top WB - Bottom ML`}function rH(e){return e.suspension.integralLink&&e.suspension.suspensionType===`Top ML - Bottom WB`}function iH(e){return e.suspension.integralLink&&e.suspension.suspensionType===`Top WB - Bottom ML`}function aH(e){return e.suspension.configuration===`Outboard Spring`?`Spring`:e.suspension.configuration===`Pullrod`?`Pullrod`:`Pushrod`}var oH=new Set([`tlf-w`,`tlr-w`,`blf-w`,`blr-w`,`tr-w`,`pr-w`]);function sH(e){return oH.has(e)}function cH(e){return xB(e.MonoShock)?[[`P2X`,e.P1X??`0`],[`P2Y`,`0`],[`P2Z`,e.P1Z??`0`],[`SYc`,`0`],[`SYw`,`0`]].filter(([t,n])=>(e[t]?.trim()??``)!==n):[]}function lH(e){let t=e?.trim().toLowerCase()??``;return t.includes(`top link front`)?`top link front`:t.includes(`top link rear`)?`top link rear`:t.includes(`bottom link front`)?`bottom link front`:t.includes(`bottom link rear`)?`bottom link rear`:t.includes(`top wishbone`)?`top wishbone`:t.includes(`bottom wishbone`)?`bottom wishbone`:`upright`}function uH(e){return jB(e).trim().toLowerCase()}function dH(e){switch(e){case`top link front`:return{chassis:[`TLFXc`,`TLFYc`,`TLFZc`],wheel:[`TLFXw`,`TLFYw`,`TLFZw`]};case`top link rear`:return{chassis:[`TLRXc`,`TLRYc`,`TLRZc`],wheel:[`TLRXw`,`TLRYw`,`TLRZw`]};case`bottom link front`:return{chassis:[`BLFXc`,`BLFYc`,`BLFZc`],wheel:[`BLFXw`,`BLFYw`,`BLFZw`]};case`bottom link rear`:return{chassis:[`BLRXc`,`BLRYc`,`BLRZc`],wheel:[`BLRXw`,`BLRYw`,`BLRZw`]};default:return null}}function fH(e){let t=EB(e[`Suspension Type`]);return t!==`Multilink`&&t!==`Top WB - Bottom ML`&&t!==`Top ML - Bottom WB`?!1:dH(lH(e[`Mounting Point`]))!==null}function pH(e){let t=EB(e[`Suspension Type`]);return t!==`Multilink`&&t!==`Top WB - Bottom ML`&&t!==`Top ML - Bottom WB`?!1:dH(uH(e[`CBar Mounting`]))!==null}function mH(e,t,n,r,i){let a=(t.y-e.y)*(n.z-e.z)-(n.y-e.y)*(t.z-e.z),o=(n.x-e.x)*(t.z-e.z)-(t.x-e.x)*(n.z-e.z),s=(t.x-e.x)*(n.y-e.y)-(n.x-e.x)*(t.y-e.y),c=-(a*e.x+o*e.y+s*e.z);return Math.abs(a)<1e-9?null:-(o*r+s*i+c)/a}function hH(e){if(!fH(e))return[];let t=dH(lH(e[`Mounting Point`]));if(!t)return[];let n=sB(e,`PRXc`,`PRYc`,`PRZc`),r=sB(e,t.chassis[0],t.chassis[1],t.chassis[2]),i=sB(e,t.wheel[0],t.wheel[1],t.wheel[2]),a=Jz(e.PRYw),o=Jz(e.PRZw);if(!n||!r||!i||a===null||o===null)return[];let s=mH(n,r,i,a,o);if(s===null)return[];let c=$(s);return(e.PRXw?.trim()??``)===c?[]:[[`PRXw`,c]]}function gH(e){if(!pH(e))return[];let t=dH(uH(e[`CBar Mounting`]));if(!t)return[];let n=sB(e,`CARBX`,`CARBY`,`CARBZ`),r=sB(e,t.chassis[0],t.chassis[1],t.chassis[2]),i=sB(e,t.wheel[0],t.wheel[1],t.wheel[2]),a=Jz(e.CLinkY),o=Jz(e.CLinkZ);if(!n||!r||!i||a===null||o===null)return[];let s=mH(n,r,i,a,o);if(s===null)return[];let c=$(s);return(e.CLinkX?.trim()??``)===c?[]:[[`CLinkX`,c]]}function _H(e){return!fH(e.fields)}function vH(e){return!pH(e.fields)}function yH(e){let t={"top-rear":tH(e),"bottom-rear":nH(e)},n={},r={};return _H(e)||(r.rod={x:!1,y:!0,z:!0}),e.suspension.monoShock&&(n[`rocker-p2`]={x:!1,y:!1,z:!1},n.spring={x:!0,y:!1,z:!0},r.spring={x:!0,y:!1,z:!0}),{rowWheelEditable:t,rowChassisAxisEditable:n,rowWheelAxisEditable:r}}function bH(e,t,n){let r=[],i=tH(e)?`tlr-w`:`tlf-w`,a=nH(e)?`blr-w`:`blf-w`,o=(e,i,a)=>{let o=n.has(i.chassisId)||n.has(i.wheelId),s=n.has(a.chassisId)||n.has(a.wheelId);if(o){let a=eH(t,n.has(i.chassisId)?i.chassisId:i.wheelId,i.fallback);
4400r.push({key:`${e}-front`,component:a.component,position:a.position||`Front`,chassisId:n.has(i.chassisId)?i.chassisId:void 0,wheelId:n.has(i.wheelId)?i.wheelId:void 0})}if(s){let i=eH(t,n.has(a.chassisId)?a.chassisId:a.wheelId,a.fallback);r.push({key:`${e}-rear`,component:i.component,position:i.position||`Rear`,chassisId:n.has(a.chassisId)?a.chassisId:void 0,wheelId:n.has(a.wheelId)?a.wheelId:void 0})}},s=(e,i)=>{let a=i.chassisId?n.has(i.chassisId):!1,o=i.wheelId?n.has(i.wheelId):!1;if(!a&&!o)return;let s=eH(t,(a?i.chassisId:i.wheelId)??e,i.fallback);r.push({key:e,component:s.component,position:i.position??s.position,chassisId:a?i.chassisId:void 0,wheelId:o?i.wheelId:void 0})};return s(`wheel-center`,{wheelId:`wheel-center`,fallback:`Wheel Center`,position:`Wheel side`}),o(`top`,{chassisId:`tlf-c`,wheelId:`tlf-w`,fallback:`Top Wishbone Front`},{chassisId:`tlr-c`,wheelId:i,fallback:`Top Wishbone Rear`}),o(`bottom`,{chassisId:`blf-c`,wheelId:`blf-w`,fallback:`Bottom Wishbone Front`},{chassisId:`blr-c`,wheelId:a,fallback:`Bottom Wishbone Rear`}),s(`track-rod`,{chassisId:`tr-c`,wheelId:`tr-w`,fallback:`Track Rod`}),s(`rod`,{chassisId:`pr-c`,wheelId:`pr-w`,fallback:aH(e)}),e.suspension.configuration!==`Outboard Spring`&&(bf(e)&&s(`spring`,{chassisId:`s-c`,wheelId:`s-w`,fallback:`Spring`}),s(`rocker-p1`,{chassisId:`p1`,fallback:`Rocker Pivot 1`,position:`Pivot 1`}),s(`rocker-p2`,{chassisId:`p2`,fallback:`Rocker Pivot 2`,position:`Pivot 2`})),r}function xH(e,t,n){let r=yB(e.fields),i=e.suspension.configuration===`Outboard Spring`,a=(t,n)=>(n===`s-c`||n===`s-w`)&&!bf(e)?!1:t===`spring`&&i&&(n===`pr-c`||n===`pr-w`)?!0:!((n===`tlf-c`||n===`tlf-w`||n===`tlr-c`||n===`tlr-w`)&&e.suspension.macPherson||n===`tlr-w`&&!tH(e)||n===`blr-w`&&!nH(e)||(n===`pr-c`||n===`pr-w`||n===`p1`||n===`p2`)&&i||(n===`c-link`||n===`c-arb`||n===`c-pivot`)&&!xB(e.fields[`Antiroll CBar`])||(n===`t-link`||n===`t-arb`||n===`t-pivot`)&&!xB(e.fields[`Antiroll TBar`])||(n===`third-arb`||n===`third-chassis`)&&!(xB(e.fields[`Antiroll TBar`])&&xB(e.fields[`Third Element`]))||n===`hs-left`&&!xB(e.fields[`Heave Spring`])||n===`rs-left`&&!xB(e.fields[`Roll Spring`])||(n===`steering-wheel`||n===`joint-2`)&&!xB(e.fields[`Calculate Steering Column`])||n===`semi-axis`&&!r.driveshaftEnabled),o=(e,t,n)=>`__tabular:${e}:${t}:${n}`,s=(e,t)=>e.key===`spring`&&i?t===`chassis`?`pr-c`:`pr-w`:t===`chassis`?e.chassisId:e.wheelId,c=(r,i,c)=>{let l=s(r,i);if(!l)return{fieldKey:o(r.key,i,c),commitFieldKey:null,hardpointId:`${r.key}-${i}`,axis:c,editable:!0,committable:!1,value:``};let u=t.get(l),d=n.get(l);if(!u||!d||!a(r.key,l))return{fieldKey:o(r.key,i,c),commitFieldKey:null,hardpointId:l,axis:c,editable:!0,committable:!1,value:``};let f=bT(d,c),p=!(c===`y`&&Rz(f))&&!(l===`pr-w`&&c===`x`&&!_H(e))&&!(l===`c-link`&&c===`x`&&!vH(e));return{fieldKey:p?f:o(r.key,i,c),commitFieldKey:p?f:null,hardpointId:l,axis:c,editable:!0,committable:p,value:$(u.point[c])}};return(bf(e)?Iz:Iz.filter(e=>e.key!==`spring`)).map((e,t)=>({key:e.key,index:t+1,component:e.component,position:e.position,chassis:{x:c(e,`chassis`,`x`),y:c(e,`chassis`,`y`),z:c(e,`chassis`,`z`)},wheel:{x:c(e,`wheel`,`x`),y:c(e,`wheel`,`y`),z:c(e,`wheel`,`z`)}}))}function SH(e){let t={};return e.forEach(e=>{[`chassis`,`wheel`].forEach(n=>{[`x`,`y`,`z`].forEach(r=>{let i=e[n][r];i&&(t[i.fieldKey]=i.value)})})}),t}function CH(e,t){return e?t[e.fieldKey]??e.value:``}function wH(e){let t=e.trim().replace(`,`,`.`);if(!t)return null;let n=Number(t);return Number.isFinite(n)?$(n):null}function TH(e){return wH(e)??e.trim()}function EH(e){return e.trim()||`(blank)`}function DH(e,t,n){return e.some(e=>[`chassis`,`wheel`].some(r=>[`x`,`y`,`z`].some(i=>{let a=e[r][i];return a?TH(CH(a,t))!==TH(n[a.fieldKey]??a.value):!1})))}function OH(e,t,n){let r=[],i=[],a=new Set;return e.forEach(e=>{[`chassis`,`wheel`].forEach(o=>{[`x`,`y`,`z`].forEach(s=>{let c=e[o][s];if(!c)return;let l=CH(c,t),u=TH(l),d=TH(n[c.fieldKey]??c.value);if(!c.committable){u!==d&&i.push(`#${e.index} ${e.component} ${e.position} ${o===`chassis`?`Chassis`:`Wheel`} ${s.toUpperCase()} = ${EH(l)}`.trim());return}let f=c.commitFieldKey;if(!f||a.has(f))return;a.add(f);let p=wH(l),m=n[f]??c.value,h=wH(m)??m.trim();if(!(p===null&&h===``)){if(p===null){i.push(`#${e.index} ${e.component} ${e.position} ${o===`chassis`?`Chassis`:`Wheel`} ${s.toUpperCase()} = ${EH(l)}`.trim());return}p!==h&&r.push([f,p])}})})}
4400),{updates:r,invalidValues:i}}function kH(e,t){let n=new Set;for(let r of e)for(let e of[`chassis`,`wheel`]){let i=r[e].y;if(!i||!i.committable||n.has(i.fieldKey))continue;n.add(i.fieldKey);let a=wH(CH(i,t));if(a===null)continue;let o=Number(a);if(Number.isFinite(o)&&o<0)return!0}return!1}function AH(e,t){let n=new Set;for(let r of e)for(let e of[`chassis`,`wheel`])for(let i of[`x`,`y`,`z`]){let a=r[e][i];if(!(!a||!a.committable||n.has(a.fieldKey))&&(n.add(a.fieldKey),CH(a,t).trim()!==``))return!1}return!0}function jH(e){let t=[],n=new Set;for(let r of e)for(let e of[`chassis`,`wheel`])for(let i of[`x`,`y`,`z`]){let a=r[e][i];!a||!a.committable||!a.commitFieldKey||n.has(a.commitFieldKey)||(n.add(a.commitFieldKey),t.push([a.commitFieldKey,$(0)]))}return t}function MH(e,t){return[[`#`,`Component`,`Position`,`Chassis X`,`Chassis Y`,`Chassis Z`,`Wheel X`,`Wheel Y`,`Wheel Z`],...e.map(e=>[String(e.index),e.component,e.position,...[`x`,`y`,`z`].map(n=>CH(e.chassis[n],t)),...[`x`,`y`,`z`].map(n=>CH(e.wheel[n],t))])].map(e=>e.join(` `)).join(` 4401`)}function NH(e,t){let n=e=>{let t=e.replace(/"/g,`""`);return/[",\n]/.test(t)?`"${t}"`:t};return[[`#`,`Component`,`Position`,`Chassis X`,`Chassis Y`,`Chassis Z`,`Wheel X`,`Wheel Y`,`Wheel Z`],...e.map(e=>[String(e.index),e.component,e.position,...[`x`,`y`,`z`].map(n=>CH(e.chassis[n],t)),...[`x`,`y`,`z`].map(n=>CH(e.wheel[n],t))])].map(e=>e.map(n).join(`,`)).join(`\r 4402`)}var PH=[{side:`chassis`,axis:`x`},{side:`chassis`,axis:`y`},{side:`chassis`,axis:`z`},{side:`wheel`,axis:`x`},{side:`wheel`,axis:`y`},{side:`wheel`,axis:`z`}];function FH(e){return e.replace(/\r\n/g,` 4403`).split(` 4404`).map(e=>e.replace(/\r/g,``)).filter(e=>e.length>0).map(e=>e.split(` `).map(e=>e.trim()))}function IH(e,t){let n=FH(e);if(n.length===0)return{};let r=n[0]?.map(e=>e.trim().toLowerCase())??[],i=r.includes(`component`)||r.includes(`chassis x`)||r.includes(`wheel z`)||r.includes(`#`)?n.slice(1):n,a={};return i.forEach((e,n)=>{let r=Number(e[0]),i=Number.isInteger(r)&&r>=1&&r<=t.length?t[r-1]:t[n];if(!i)return;let o=e.length>=6?e.length-6:-1;o<0||PH.forEach((t,n)=>{let r=i[t.side][t.axis],s=e[o+n]??``;!r||!r.editable||(a[r.fieldKey]=s)})}),a}function LH(e,t,n,r){let i=FH(e);if(i.length===0)return{};let a={};return i.forEach((e,i)=>{let o=t[n+i];o&&e.forEach((e,t)=>{let n=PH[r+t];
4404if(!n)return;let i=o[n.side][n.axis];!i||!i.editable||(a[i.fieldKey]=e)})}),a}function RH(e,t,n){if(!(e.includes(` 4405`)||e.includes(` `)))return{};let r=e.toLowerCase();return r.includes(`component`)||r.includes(`chassis x`)||r.includes(`wheel z`)||r.includes(`#`)?IH(e,t):LH(e,t,n?.rowIndex??0,n?.slotIndex??0)}function zH(e,t){return e===`chassis`?t===`x`?0:t===`y`?1:2:t===`x`?3:t===`y`?4:5}function BH(){return{x:``,y:``,z:``}}function VH(e,t,n,r){let i={...t},a=new Set;return e.forEach(e=>{[`chassis`,`wheel`].forEach(o=>{let s=e[o][n];if(!s||!s.committable||a.has(s.fieldKey))return;a.add(s.fieldKey);let c=wH(CH(s,t));if(c===null)return;let l=Number(c);Number.isFinite(l)&&(i[s.fieldKey]=$(r(l)))})}),i}function HH(e,t){return Math.hypot(e.x-t.x,e.y-t.y,e.z-t.z)}function UH(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function WH(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}function GH(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}function KH(e,t){return{x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x}}function qH(e){return Math.hypot(e.x,e.y,e.z)}function JH(e,t){return{x:e.x*t,y:e.y*t,z:e.z*t}}function YH(e){let t=qH(e);return t<=1e-9?null:JH(e,1/t)}function XH(e,t){let n=GH(t,t);return n<=1e-12?null:WH(e,JH(t,GH(e,t)/n))}function ZH(e,t){let n=WH(t,e.origin);return{x:GH(n,e.xAxis),y:GH(n,e.yAxis),z:GH(n,e.zAxis)}}function QH(e,t){return UH(e.origin,UH(JH(e.xAxis,t.x),UH(JH(e.yAxis,t.y),JH(e.zAxis,t.z))))}function $H(e,t){let n={};return CL.forEach(r=>{let i=t.get(r);i&&[`x`,`y`,`z`].forEach(t=>{let r=bT(i,t);n[r]=e.fields[r]??`0`})}),n}function eU(e,t){return e?Object.entries(e).some(([e,n])=>(t[e]??`0`)!==n):!1}function tU(e){let t={};return gT.forEach(n=>{[`x`,`y`,`z`].forEach(r=>{let i=bT(n,r);t[i]=e.fields[i]??`0`})}),t}function nU(e,t){return e?Object.entries(e).some(([e,n])=>(t[e]??`0`)!==n):!1}function rU(e,t){let n=e.suspension.configuration;if(n!==`Pushrod`&&n!==`Pullrod`)return null;let r=uU(e.geometry),i=e.geometry[r],a=n===`Pullrod`?{id:`pr-w`,label:`Pullrod Wheel`,point:i.wheel.pushRod}:{id:`pr-w`,label:`Pushrod Wheel`,point:i.wheel.pushRod};if(t===`rodBased`)return a;let o=lH(e.fields[`Mounting Point`]);if(o===`upright`)return a;let s=dH(o),c=(()=>{if(!s)return null;switch(s.wheel[0]){case`TLFXw`:return{id:`tlf-w`,label:`TLF Wheel`,point:i.wheel.topFront};case`TLRXw`:return{id:`tlr-w`,label:`TLR Wheel`,point:i.wheel.topRear};case`BLFXw`:return{id:`blf-w`,label:`BLF Wheel`,point:i.wheel.bottomFront};case`BLRXw`:return{id:`blr-w`,label:`BLR Wheel`,point:i.wheel.bottomRear};default:return null}})();return n===`Pushrod`?e.suspension.suspensionType===`Double Wishbone`||e.suspension.suspensionType===`Top ML - Bottom WB`?{id:`blf-w`,label:`BLF Wheel`,point:i.wheel.bottomFront}:c??a:e.suspension.suspensionType===`Double Wishbone`||e.suspension.suspensionType===`Top WB - Bottom ML`?{id:`tlf-w`,label:`TLF Wheel`,point:i.wheel.topFront}:c??a}function iU(e){let t=e.suspension.configuration;return t!==`Pushrod`&&t!==`Pullrod`?!1:lH(e.fields[`Mounting Point`])!==`upright`}function aU(e){return rU(e,`linkBased`)}function oU(e,t){let n=e.suspension.configuration;if(n!==`Pushrod`&&n!==`Pullrod`)return null;let r=uU(e.geometry),i=e.geometry[r].rocker.axisStart,a=e.geometry[r].rocker.axisEnd,o=rU(e,t),s=YH(WH(a,i));if(!o||!s)return null;let c=UH(i,JH(s,GH(WH(o.point,i),s))),l=XH(WH(o.point,c),s),u=l?YH(l):null;if(!u)return null;let d=Math.abs(i.x-a.x),f=Math.abs(i.y-a.y),p=Math.abs(i.z-a.z),m=Math.max(d,f,p),h=f>=m-1e-9||p>=m-1e-9?`A`:`B`,g=JH(s,h===`B`?s.x<=0?1:-1:s.z>1e-9||s.y>1e-9||Math.abs(s.z)<=1e-9&&Math.abs(s.y)<=1e-9?1:-1),_=YH(KH(h===`B`?JH(u,u.z<=0?1:-1):JH(u,GH(u,WH(o.point,c))>=0?1:-1),g));if(!_)return null;let v=YH(KH(g,_));if(!v)return null;let y=(()=>{let t=-Math.PI/2;if(h!==`B`||!e.elements.heaveSpring)return t;let n=WH(e.elements.heaveRight,e.elements.heaveLeft),r=GH(n,_),i=GH(n,v);return Math.hypot(r,i)<=1e-9?t:t-Math.atan2(-i,-r)})(),b=Math.max(0,GH(WH(o.point,c),v));return{configuration:n,suspensionType:e.suspension.suspensionType,mountingPoint:e.fields[`Mounting Point`]??``,referenceMode:t,referenceHardpointId:o.id,referenceHardpointLabel:o.label,orientationMode:h,origin:c,pivot1:i,pivot2:a,projection:{origin:c,xAxis:_,yAxis:v,zAxis:g,displayRotationRad:y,referencePoint:o.point,yAxisReferenceDistanceMm:b,title:`Rocker Plane`,subtitle:`Mode ${h} | Left rocker`}}}function sU(e){return e?e.orientationMode===`B`?{...e.projection,displayRotationRad:(e.projection.displayRotationRad??0)+Math.PI/2}:e.projection:null}function cU(e,t,n,r){let i=WH(t,e),a=XH(WH(n,e),i),o=XH(WH(r,n),i);if(!a||!o)return null;let s=qH(a),c=qH(o);
4405return s<=1e-9||c<=1e-9?null:180-Math.acos($z(GH(a,o)/(s*c)))*Qz}function lU(e){let t=e.suspension.configuration;if(t!==`Pushrod`&&t!==`Pullrod`)return null;let n=uU(e.geometry),r=e.geometry[n],i=WH(r.rocker.axisEnd,r.rocker.axisStart),a=XH(WH(r.wheel.spring,r.rocker.axisStart),i),o=XH(WH(r.chassis.pushRod,r.rocker.axisStart),i);if(!a||!o)return null;let s=qH(a),c=qH(o);return s<=1e-9||c<=1e-9?null:Math.acos($z(GH(a,o)/(s*c)))*Qz}function uU(e){return e.left.wheelCenter.y>=e.right.wheelCenter.y?`left`:`right`}function dU(e){if(!e.elements.heaveSpring)return null;let t=e.motion?.elements,n=t?.heaveLeft??e.elements.heaveLeft,r=t?.heaveRight??e.elements.heaveRight,i=e.geometry[uU(e.geometry)].rocker;return cU(i.axisStart,i.axisEnd,n,r)}function fU(e){if(!e.elements.heaveSpring)return null;let t=e.motion?.elements,n=t?.heaveLeft??e.elements.heaveLeft,r=t?.heaveRight??e.elements.heaveRight,i=e.geometry[uU(e.geometry)].rocker;return _U(i.axisStart,i.axisEnd,n,r)}function pU(e){if(!e.elements.rollSpring)return null;let t=e.motion?.elements,n=t?.rollLeft??e.elements.rollLeft,r=t?.rollRight??e.elements.rollRight,i=e.geometry[uU(e.geometry)].rocker;return cU(i.axisStart,i.axisEnd,n,r)}function mU(e){if(!e.elements.rollSpring)return null;let t=e.motion?.elements,n=t?.rollLeft??e.elements.rollLeft,r=t?.rollRight??e.elements.rollRight,i=e.geometry[uU(e.geometry)].rocker;return _U(i.axisStart,i.axisEnd,n,r)}function hU(e){let t=e.suspension.configuration;if(t!==`Pushrod`&&t!==`Pullrod`)return null;let n=uU(e.geometry),r=e.geometry[n];return cU(r.rocker.axisStart,r.rocker.axisEnd,r.wheel.spring,r.chassis.spring)}function gU(e){let t=e.suspension.configuration;if(t!==`Pushrod`&&t!==`Pullrod`)return null;let n=uU(e.geometry),r=e.geometry[n];return cU(r.rocker.axisStart,r.rocker.axisEnd,r.chassis.pushRod,r.wheel.pushRod)}function _U(e,t,n,r){let i=1e-9,a=WH(t,e),o=WH(r,n),s=qH(a),c=qH(o);if(s<=i||c<=i)return null;let l=WH(n,e),u=KH(a,o),d=qH(u);return d>i?Math.abs(GH(l,u))/d:qH(KH(l,a))/s}function vU(e){let t=e.suspension.configuration;if(t!==`Pushrod`&&t!==`Pullrod`)return null;let n=uU(e.geometry),r=e.geometry[n];return _U(r.rocker.axisStart,r.rocker.axisEnd,r.wheel.spring,r.chassis.spring)}function yU(e){let t=e.suspension.configuration;if(t!==`Pushrod`&&t!==`Pullrod`)return null;let n=uU(e.geometry),r=e.geometry[n];return _U(r.rocker.axisStart,r.rocker.axisEnd,r.wheel.pushRod,r.chassis.pushRod)}function bU(e,t){let n=e.suspension.suspensionType,r=e.suspension.macPherson,i=e.suspension.configuration===`Outboard Spring`,a=bf(e),o=e.suspension.configuration===`Pullrod`,s=n===`Multilink`,c=n===`Top WB - Bottom ML`,l=n===`Top ML - Bottom WB`,u=s||l?`Top Link Front`:`Top Wishbone Front`,d=rH(e)?`Integral Link Rear`:s||l?`Top Link Rear`:`Top Wishbone Rear`,f=s||c?`Bottom Link Front`:`Bottom Wishbone Front`,p=iH(e)?`Integral Link Rear`:s||c?`Bottom Link Rear`:`Bottom Wishbone Rear`,m=i?`Spring`:o?`Pullrod`:`Pushrod`,h=`Spring`,g=s||l,_=s||c;return[{key:`wheel-center`,name:`Wheel Center`,point:ZV(t,`wheel-center`)},{key:`tlf-c`,name:`${u} - Chassis side`,point:ZV(t,`tlf-c`),visible:!r},{key:`tlr-c`,name:`${d} - Chassis side`,point:ZV(t,`tlr-c`),visible:!r},{key:`blf-c`,name:`${f} - Chassis side`,point:ZV(t,`blf-c`)},{key:`blr-c`,name:`${p} - Chassis side`,point:ZV(t,`blr-c`)},{key:`tr-c`,name:`Track Rod - Chassis side`,point:ZV(t,`tr-c`)},{key:`pr-c`,name:`${m} - Chassis side`,point:ZV(t,`pr-c`)},{key:`s-c`,name:`${h} - Chassis side`,point:ZV(t,`s-c`),visible:!i&&a},{key:`tlf-w`,name:`${u} - Wheel side`,point:ZV(t,`tlf-w`),visible:!r},{key:`tlr-w`,name:`${d} - Wheel side`,point:ZV(t,`tlr-w`),visible:!r&&g},{key:`blf-w`,name:`${f} - Wheel side`,point:ZV(t,`blf-w`)},{key:`blr-w`,name:`${p} - Wheel side`,point:ZV(t,`blr-w`),visible:_},{key:`tr-w`,name:`Track Rod - Wheel side`,point:ZV(t,`tr-w`)},{key:`pr-w`,name:`${m} - Wheel side`,point:ZV(t,`pr-w`)},{key:`s-w`,name:`${h} - Rocker side`,point:ZV(t,`s-w`),visible:!i&&a},{key:`p1`,name:`Rocker Pivot 1`,point:ZV(t,`p1`),visible:!i},{key:`p2`,name:`Rocker Pivot 2`,point:ZV(t,`p2`),visible:!i}].filter(e=>e.visible??!0).map(e=>({key:e.key,name:e.name,point:e.point}))}function xU(e){return{x:e.x,y:e.y,z:e.z}}function SU(e){return{x:e.x,y:-e.y,z:e.z}}function CU(e,t){return e.suspension.macPherson?t.chassis.pushRod:t.chassis.spring}function wU(e,t,n,r){let i=new Map([[`wheel-center`,n.wheelCenter],[`tlf-c`,n.chassis.topFront],[`tlr-c`,n.chassis.topRear],[`blf-c`,n.chassis.bottomFront],[`blr-c`,n.chassis.bottomRear],[`tr-c`,n.chassis.tieRod],[`pr-c`,n.chassis.pushRod],[`s-c`,CU(e,n)],[`tlf-w`,n.wheel.to
4405pFront],[`tlr-w`,n.wheel.topRear],[`blf-w`,n.wheel.bottomFront],[`blr-w`,n.wheel.bottomRear],[`tr-w`,n.wheel.tieRod],[`pr-w`,n.wheel.pushRod],[`s-w`,n.wheel.spring],[`p1`,n.rocker.axisStart],[`p2`,n.rocker.axisEnd]]);return r.forEach((e,t)=>i.set(t,e)),t.map(e=>({...e,point:xU(i.get(e.id)??e.point)}))}function TU(e,t){t.forEach(t=>e.delete(t))}function EU(e){let t=new Set(gT.map(e=>e.id)),n=t=>(e.fields[t]?.trim()||`0`)!==`0`,r=e.suspension.macPherson,i=r||e.suspension.configuration===`Outboard Spring`,a=bf(e);return i&&TU(t,[`p1`,`p2`,`s-c`,`s-w`]),a||TU(t,[`s-c`,`s-w`]),r&&TU(t,[`tlf-c`,`tlr-c`]),e.elements.antirollCBar||TU(t,zz[`Antiroll CBar`]??[]),e.elements.antirollTBar||TU(t,zz[`Antiroll TBar`]??[]),(!e.elements.thirdElement||!e.elements.antirollTBar)&&TU(t,zz[`Third Element`]??[]),e.elements.heaveSpring||TU(t,zz[`Heave Spring`]??[]),e.elements.rollSpring||TU(t,zz[`Roll Spring`]??[]),n(`Draw Springs`)||TU(t,Bz[`Draw Springs`]??[]),n(`Draw MainSpring`)||(TU(t,Bz[`Draw MainSpring`]??[]),e.elements.heaveSpring&&TU(t,[`s-c`,`s-w`]),e.elements.rollSpring&&TU(t,[`s-c`,`s-w`]),i&&TU(t,[`pr-c`])),n(`Draw Steering`)||TU(t,Bz[`Draw Steering`]??[]),n(`Draw CBar`)||TU(t,Bz[`Draw CBar`]??[]),n(`Draw TBar`)||TU(t,Bz[`Draw TBar`]??[]),n(`Draw Third Element`)||TU(t,Bz[`Draw Third Element`]??[]),n(`Draw Heave Spring`)||TU(t,Bz[`Draw Heave Spring`]??[]),n(`Draw Roll Spring`)||TU(t,Bz[`Draw Roll Spring`]??[]),n(`Draw SemiAxis`)||TU(t,Bz[`Draw SemiAxis`]??[]),t}function DU(e,t){return e.filter(e=>t.has(e.id))}function OU(e,t){return(t===`tlf-w`||t===`tlr-w`)&&!tH(e)?[`tlf-w`,`tlr-w`]:(t===`blf-w`||t===`blr-w`)&&!nH(e)?[`blf-w`,`blr-w`]:[t]}function kU(e,t,n){return OU(e,t).some(e=>n.includes(e))}function AU(e,t,n){return OU(e,t).some(e=>n.has(e))}function jU(e,t){return e.map(e=>({...e,label:t.get(e.id)??e.label}))}var MU=1e-7,NU=35,PU=30,FU=20,IU=20,LU=2e3,RU=1440,zU=1.45,BU=120,VU=18,HU=220;function UU(e,t){if(t===null||!Number.isFinite(t)||t<=0)return`unknown`;let n=Jz(e);return n===null||n<0?`fail`:n<=t?`ok`:`fail`}function WU(e){return Math.sqrt(e.constraintErrors.reduce((e,t)=>e+t.error**2,0))}function GU(e){let t=e.constraintErrors.filter(e=>e.label!==`Steering spring`&&e.label!==`Virtual bump`);if(t.length===0)return[];let n=[...t].sort((e,t)=>t.error-e.error),r=Math.max(...t.map(e=>e.error));if(!Number.isFinite(r)||r<=1e-12)return[n[0].label];let i=r*.8,a=n.filter(e=>e.error>=i).map(e=>e.label);return a.length>0?a:[n[0].label]}function KU(e,t,n){let r=y_(e,t.bump,t.steer,{useSteeringModel:t.useSteeringModel,initialPose:n,solveTolerance:MU,mainMaxIterations:NU,rockerMaxIterations:PU,cBarMaxIterations:FU,tBarMaxIterations:IU}),i=WU(r),a=Math.abs(r.residual),o=!Number.isFinite(a)||a>.05;return{failed:o||i>5e-4,reason:o?`residual`:`armError`,residual:a,armLengthError:i,frame:r}}function qU(e,t){let n=Math.max(t.minResolution,t.safetyCap),r=0,i=0,a,o=Math.min(Math.max(t.initialStep,t.minResolution),t.maxAdaptiveStep);for(let s=0;s<BU;s+=1){if(n-i<=t.minResolution*.5)return{verifiedMax:r,failureCommand:null,failureReason:null,failureResidual:0,failureArmLengthError:0,limitingLinks:[],reachedSafetyCap:!0,safetyCap:n};let s=Math.min(n,i+o),c=t.direction*s,l=KU(e,t.buildInputs(c),a);if(!l.failed){i=s,r=s,a=l.frame.pose,o=Math.min(o*zU,t.maxAdaptiveStep,n-i);continue}let u=i,d=s,f=a,p=l.reason,m=l.residual,h=l.armLengthError,g=GU(l.frame);for(let n=0;n<VU&&!(d-u<=t.minResolution);n+=1){let n=(u+d)*.5,i=t.direction*n,a=KU(e,t.buildInputs(i),f);a.failed?(d=n,p=a.reason,m=a.residual,h=a.armLengthError,g=GU(a.frame)):(u=n,r=n,f=a.frame.pose)}return{verifiedMax:u,failureCommand:t.direction*d,failureReason:p,failureResidual:m,failureArmLengthError:h,limitingLinks:g,reachedSafetyCap:!1,safetyCap:n}}return{verifiedMax:r,failureCommand:null,failureReason:null,failureResidual:0,failureArmLengthError:0,limitingLinks:[],reachedSafetyCap:r>=n-t.minResolution,safetyCap:n}}function JU(e,t,n){if(!n.failureReason&&n.reachedSafetyCap)return`${e}: no physical limit detected up to ${Tf(n.safetyCap)} ${t} (internal safety cap).`;if(!n.failureReason)return`${e}: convergence verified up to ${Tf(n.verifiedMax)} ${t}.`;let r=n.failureReason===`residual`?`solver residual above threshold (${Tf(uh)} mm)`:`link length error above threshold (${dh.toExponential(0)} mm)`,i=Math.abs(n.failureCommand??n.verifiedMax),a=n.limitingLinks.length>0?` Limiting links: ${n.limitingLinks.join(`, `)}.`:``;return`${e}: limit at ${Tf(n.verifiedMax)} ${t} (stop at ${Tf(i)} ${t}), ${r}. Residual ${n.failureResidual.toExponential(2)}, link error ${n.failureArmLengthError.toExponential(2)} mm.${a}`}function YU(e){let t=_f(e.run.bumpSteps,20),n=_f(e.run.steerSteps,20),r=Math.max(2,120/t),i=Math.max(.5,120/n),a=qU(e,{direction:1,initialStep:r,minResolution:.1,maxAdaptiveStep:120,safetyCap:LU,buildInputs:e=>({bump:e,steer:0})}),o=qU(e,{direction:-1,initialStep:r,minResolution:.1,maxAdaptiveStep:120,safetyCap:LU,buildInputs:e=>({bump:e,steer:0})}),s=qU(e,{direction:1,initialStep:i,minResolution:.1,maxAdaptiveStep:120,safetyCap:RU,buildInputs:e=>({bump:0,steer:e,useSteeringModel:!0})}),c=qU(e,{direction:-1,initialStep:i,minResolution:.1,maxAdaptiveStep:120,safetyCap:RU,buildInputs:e=>({bump:0,steer:e,useSteeringModel:!0})}),l=Math.min(s.verifiedMax,c.verifiedMax),u=[JU(`Bump`,`mm`,a),JU(`Rebound`,`mm`,o),JU(`Steer +`,`deg`,s),JU(`Steer -`,`deg`,c)].join(` 4406`);return{bumpMax:a.verifiedMax,reboundMax:o.verifiedMax,steerMax:l,outputMessage:u}}function XU(e,t=`bump`){let n=xB(e.fields[`Calculate Bump`]),r=n&&xB(e.fields[`Calculate Roll`]),i=xB(e.fields[`Calculate Steer`]),a=xB(e.fields[`Calculate Steering Column`]),o=n&&xB(e.fields[`Calculate BumpSteer`]),s=n?M_(e):[],c=n?WW(e,s):[],l=jb(e),u=FS(l)?GS(e,t,l):[];return{bump:s,anti:s,steer:i?N_(e):[],steeringColumn:a?Ym(e):[],roll:r?P_(e):[],bumpSteer:o?I_(e):[],driveshaft:c,loads:u}}function ZU(e,t=fL){return sV(e,t)[0]}function QU(e,t=fL){let n=ZU(e,t);return sV(e,t).filter(e=>e.key!==n.key)}function $U(e,t,n=fL){return sV(e,n).find(e=>e.key===t)??ZU(e,n)}function eW(e,t,n,r=fL){return n.find(e=>e.key===t)??$U(e,t,r)}function tW(e){let t=ZU(e),n=QU(e)[0]??t;return t.key===`bump`?{mode:e,xKey:n.key,yKey:t.key}:{mode:e,xKey:t.key,yKey:n.key}}function nW(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.key!=`string`||t.key.trim()===``||typeof t.label!=`string`)return null;let n={index:typeof t.index==`number`&&Number.isFinite(t.index)?t.index:-1,key:t.key,label:t.label};return typeof t.unit==`string`&&t.unit.trim()!==``&&(n.unit=t.unit),typeof t.chartMin==`number`&&Number.isFinite(t.chartMin)&&(n.chartMin=t.chartMin),typeof t.chartMax==`number`&&Number.isFinite(t.chartMax)&&(n.chartMax=t.chartMax),n}function rW(e){if(!Array.isArray(e))return;let t=[],n=new Set;
4406return e.forEach(e=>{let r=nW(e);!r||n.has(r.key)||(n.add(r.key),t.push(r))}),t.length>0?t:void 0}function iW(e){if(!e||typeof e!=`object`)return null;let t=e;if(!vR(t.mode)||typeof t.xKey!=`string`||typeof t.yKey!=`string`)return null;let n=rW(t.extraChannels);return{mode:t.mode,xKey:t.xKey,yKey:t.yKey,...n?{extraChannels:n}:{}}}function aW(e){return Array.isArray(e)?e.map(e=>iW(e)).filter(e=>!!e):[]}function oW(e){return`${e.mode}:${e.xKey}:${e.yKey}`}function sW(e){return JSON.stringify(aW(e))}function cW(e,t){return sW(e)===sW(t)}function lW(e,t){if(!t||t.length===0)return e;let n=new Set(e.map(e=>e.key)),r=[...e];return t.forEach(e=>{n.has(e.key)||(n.add(e.key),r.push(e))}),r}function uW(e,t){let n=new Set(sV(e).map(e=>e.key)),r=t.filter(e=>!n.has(e.key));return r.length>0?r:void 0}function dW(e,t,n){let r=uW(e,[t,n]);return{mode:e,xKey:t.key,yKey:n.key,...r?{extraChannels:r}:{}}}function fW(e,t){let n=aW(e),r=iW(t)??t,i=oW(r);return n.some(e=>oW(e)===i)?n.map(e=>oW(e)===i?{...e,...r}:e):[...n,r]}function pW(e,t,n){let r=eW(e.mode,e.xKey,t,n),i=eW(e.mode,e.yKey,t,n);return i.key===`bump`?`${r.label} vs ${i.label}`:`${i.label} vs ${r.label}`}function mW(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.requestId!=`string`||t.action!==`save`&&t.action!==`import`||typeof t.sourceName!=`string`||!Array.isArray(t.graphs)?null:{requestId:t.requestId,action:t.action,sourceName:t.sourceName,fileName:_W(t.fileName??gW(t.sourceName)),graphs:aW(t.graphs)}}function hW(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.requestId!=`string`||typeof t.ok!=`boolean`||typeof t.message!=`string`?null:{requestId:t.requestId,ok:t.ok,message:t.message,fileName:vW(t.fileName)??void 0,layout:t.layout&&Array.isArray(t.layout.graphs)?{...t.layout,kind:tL,version:1,name:vW(t.layout.name)??void 0,graphs:aW(t.layout.graphs)}:void 0}}function gW(e){return`${(e.trim().replace(/\.[a-z0-9]+$/i,``)||`Suspension`).replace(/[\\/:*?"<>|]/g,`_`).trim()||`Suspension`}${nL}`}function _W(e){let t=e.trim().replace(/[\\/:*?"<>|]/g,`_`).replace(/[.\s]+$/g,``)||`CustomGraphs${nL}`;return t.toLowerCase().endsWith(nL)?t:`${t.replace(/\.[^.]+$/i,``)}${nL}`}function vW(e){return typeof e==`string`&&e.trim()?_W(e):null}function yW(e){return e===`local`||e===`workspace`}function bW(e,t){let n=vW(t);if(n)return tC(e,rL,n);let r=e.split(/\r?\n/),i=r.findIndex(e=>RegExp(`^\\s*${rL}\\s*:`).test(e));return i===-1?e:(r.splice(i,1),r.join(` 4407`))}function xW(e){return e.toLowerCase().endsWith(nL)}function SW(e,t){let n={kind:tL,version:1,name:e,updatedAt:new Date().toISOString(),graphs:aW(t)};return`${JSON.stringify(n,null,2)}\n`}function CW(e){let t=JSON.parse(e),n=Array.isArray(t)?t:t.graphs;if(!Array.isArray(n)||n.length===0)throw Error(`The selected .cgr file does not contain a valid custom chart layout.`);let r=n.map(e=>iW(e)).filter(e=>!!e);if(r.length===0)throw Error(`The selected .cgr file does not contain a valid custom chart layout.`);return{kind:tL,version:1,name:Array.isArray(t)?void 0:t.name,createdAt:Array.isArray(t)?void 0:t.createdAt,updatedAt:Array.isArray(t)?void 0:t.updatedAt,graphs:r}}function wW(e,t,n=`y`,r){let i=r??ZU(e);return i.key===`bump`?n===`x`?{x:i,y:t}:{x:t,y:i}:{x:i,y:t}}function TW(e,t=`y`,n=fL,r){let i=r?eW(e.mode,e.xKey,r,n):$U(e.mode,e.xKey,n),a=r?eW(e.mode,e.yKey,r,n):$U(e.mode,e.yKey,n);return i.key===`bump`&&a.key!==`bump`?t===`x`?{x:i,y:a}:{x:a,y:i}:a.key===`bump`&&i.key!==`bump`&&t===`x`?{x:a,y:i}:{x:i,y:a}}var EW={index:-100,key:`steeringWheelAngle`,label:`Steering wheel angle`,unit:`deg`},DW={index:-102,key:`rackTravel`,label:`Rack travel`,unit:`mm`},OW={index:-108,key:`axialShift`,label:`Axial shift`,unit:`mm`},kW={index:-104,key:`steeringWheelAngle`,label:`Steering wheel angle to RHS`,unit:`deg`,chartMin:0},AW={index:-105,key:`rackTravel`,label:`Rack travel to RHS`,unit:`mm`,chartMin:0},jW={index:-101,key:`ackermannDelta`,label:`RH-LH steer delta`,unit:`deg`},MW={index:-106,key:`meanRadius`,label:`Cornering radius`,unit:`m`,chartMin:0,chartMax:100},NW={index:-107,key:`meanRadius`,label:`Cornering radius`,unit:`m`,chartMin:0,chartMax:200},PW=`6 4`,FW=`8 4`,IW=`2 4`,LW=[{key:`relativeToe`,title:`Relative Toe vs Bump`,channel:{index:-201,key:`bumpSteerRelativeToe`,label:`Relative Toe`,unit:`deg`},branchProperty:{noSteer:`bumpSteerRelativeToeNoSteer`,leftSteer:`bumpSteerRelativeToeLeftSteer`,rightSteer:`bumpSteerRelativeToeRightSteer`}},{key:`relativeCamber`,title:`Relative Camber vs Bump`,channel:{index:-202,key:`bumpSteerRelativeCamber`,label:`Relative Camber`,unit:`deg`},branchProperty:{noSteer:`camberNoSteer`,leftSteer:`relativeCamberLeftSteer`,rightSteer:`relativeCamberRightSteer`}},{key:`camber`,title:`Camber vs Bump`,channel:{index:-203,key:`bumpSteerCamber`,label:`Camber`,unit:`deg`},branchProperty:{noSteer:`camberNoSteer`,leftSteer:`camberLeftSteer`,rightSteer:`camberRightSteer`}},{key:`toe`,title:`Toe vs Bump`,channel:{index:-204,key:`bumpSteerToe`,label:`Toe`,unit:`deg`},branchProperty:{noSteer:`toeNoSteer`,leftSteer:`toeLeftSteer`,rightSteer:`toeRightSteer`}}];function RW(e){return e.find(e=>Math.abs(Q(e,`bump`))<1e-9)??e.reduce((e,t)=>
4407e?Math.abs(Q(t,`bump`))<Math.abs(Q(e,`bump`))?t:e:t,null)}function zW(e){let t=RW(e),n=t?Q(t,`toeNoSteer`):0,r=t?Q(t,`toeLeftSteer`):0,i=t?Q(t,`toeRightSteer`):0,a=t?Q(t,`camberNoSteer`):0;return e.map(e=>({...e,bumpSteerRelativeToeNoSteer:Q(e,`toeNoSteer`)-n,bumpSteerRelativeToeLeftSteer:Q(e,`toeLeftSteer`)-r,bumpSteerRelativeToeRightSteer:Q(e,`toeRightSteer`)-i,bumpSteerRelativeCamberNoSteer:Q(e,`camberNoSteer`)-a,bumpSteerRelativeCamberLeftSteer:Q(e,`relativeCamberLeftSteer`),bumpSteerRelativeCamberRightSteer:Q(e,`relativeCamberRightSteer`),bumpSteerCamber:Q(e,`camberNoSteer`)}))}function BW(e,t,n){return e.flatMap(e=>{let r=zW(e.series);return[{key:`${e.key}-no-steer`,label:`${e.label} - No steer`,color:e.color,dasharray:IW,series:r.map(e=>({...e,[t.key]:Q(e,n.noSteer)}))},{key:`${e.key}-left-steer`,label:`${e.label} - LH wheel`,color:e.color,series:r.map(e=>({...e,[t.key]:Q(e,n.leftSteer)}))},{key:`${e.key}-right-steer`,label:`${e.label} - RH wheel`,color:e.color,dasharray:FW,series:r.map(e=>({...e,[t.key]:Q(e,n.rightSteer)}))}]})}var VW=Math.PI/180,HW=`OUT <--- Toe [deg] ---> IN`,UW=`Steering wheel angle vs Rack travel`;function WW(e,t){return(t??M_(e)).map(t=>{let n=A_(e,{bump:Q(t,`bump`),steer:0,roll:0}),r=Vf(n.document,`left`,n.document.geometry.left)??NaN;return{...t,axialShift:r,converged:!!(t.converged&&n.leftFrame.converged&&n.rightFrame.converged)}})}function GW(e,t){return(t??N_(e)).map(t=>{let n=Q(t,`steeringWheelAngle`),r=y_(e,0,n,{useSteeringModel:!0}),i=y_(e,0,-n,{useSteeringModel:!0}),a=Sf(i.rightCorner),o=Vf({...e,geometry:{...e.geometry,right:r.rightCorner,left:a},motion:{...e.motion??{},wheelPoses:{right:r.pose,left:oG(i.pose)},steerInputDeg:n}},`left`,a)??NaN;return{...t,axialShift:o,converged:!!(t.converged&&i.converged&&r.converged)}})}function KW(e,t){return e===`steer`&&t.key===`steeringRatio`?`Avg steering ratio`:t.label}function qW(e,t,n,r){let i={};if((e===`bump`||e===`steer`)&&t.key===`toe`&&(n.key===`toe`&&(i.xAxisLabelOverride=HW),r.key===`toe`&&(i.yAxisLabelOverride=HW)),e===`steer`&&t.key===`steeringRatio`){let e=`Avg steering ratio [deg/deg]`;n.key===`steeringRatio`&&(i.xAxisLabelOverride=e),r.key===`steeringRatio`&&(i.yAxisLabelOverride=e)}return e===`steeringColumn`&&t.key===`pinionMinusSteeringWheelAngle`&&r.key===`pinionMinusSteeringWheelAngle`&&(i.yAxisLabelOverride=`P angle - SW angle [deg]`),i}function JW(e,t){return e===`rackTravel`?t?kW:EW:t?AW:DW}function YW(e,t,n,r,i){let a=JW(n,r);return{key:`steer-control-map`,title:UW,x:t,y:a,xAxisLabelOverride:i,analysisChannel:a,analysisAxisChannel:t,analysisZeroLabel:t.key===`rackTravel`?`Rack travel = 0`:`SW angle = 0`,seriesSet:e}}var XW=5e3;function ZW(e,t){let n=t-e.vehicle.toe,r=Math.tan(n*VW);return!Number.isFinite(r)||Math.abs(r)<1e-9?XW:Math.abs(e.vehicle.wheelbase/r/1e3)}function QW(e){let t=_f(e.run.steerSteps,12),n=Jz(e.fields[`C Factor`])??0,r=.1,i=Array.from({length:t+1},(n,r)=>
4407e.run.steeringWheelAngleMax*r/t),a=[],o=[],s=y_(e,0,r,{useSteeringModel:!0}),c=y_(e,0,-r,{useSteeringModel:!0}),l=Dg(e,s.outputs.toe,c.outputs.toe,r),u,d;for(let t of i){let r=y_(e,0,t,{useSteeringModel:!0,initialPose:u}),i=y_(e,0,-t,{useSteeringModel:!0,initialPose:d}),f=r.outputs,p=i.outputs,m=RK(i,`left`),h=t<=1e-9?l:Dg(e,p.toe,f.toe,Math.abs(t)),g=Xh(e,r.pose),_=Xh(e,m),v=t<=1e-9?0:Math.atan2(_.z-g.z,g.y-_.y)/VW,y={bump:0,steer:t,steeringWheelAngle:t,rackTravel:t*n/360,roll:0,rollAngle:v,ackermann:h.ackermann,ackermannDelta:h.ackermannDelta,ackermannIdealDelta:h.ackermannIdealDelta,ackermannOuterDelta:h.ackermannOuterDelta,heightDelta:f.heightDelta,meanHeightDelta:(f.heightDelta+p.heightDelta)*.5,axleTrackDelta:_g(r,i),roadWheelDifference:h.roadWheelDifference,converged:r.converged&&i.converged};if(o.push({...f,...y,steeringRatio:t<=1e-9?s.outputs.steeringRatio:f.steeringRatio,meanRadius:ZW(e,f.toe)}),a.push({...p,...y,steeringRatio:t<=1e-9?c.outputs.steeringRatio:p.steeringRatio,meanRadius:ZW(e,p.toe)}),!b_(r)||!b_(i))break;u=r.pose,d=i.pose}return{rightSeries:a,leftSeries:o}}function $W(e){let t=78-e*.22;return`hsl(205 18% ${Math.max(44,t).toFixed(1)}%)`}function eG(e,t,n=EW){let r=(t[0]?.series??[]).filter(e=>typeof e.steer==`number`&&typeof e.ackermannDelta==`number`);if(r.length===0)return null;let i=gg(e),a=[];for(let t of[20,40,60,80,100])a.push({key:`ackermann-ref-${t}`,label:`Ack ${t}%`,color:$W(t),dasharray:`5 4`,opacity:.9,series:r.map(n=>({bump:typeof n.bump==`number`?n.bump:0,steer:typeof n.steer==`number`?n.steer:0,steeringWheelAngle:typeof n.steeringWheelAngle==`number`?n.steeringWheelAngle:typeof n.steer==`number`?n.steer:0,rackTravel:typeof n.rackTravel==`number`?n.rackTravel:0,roll:typeof n.roll==`number`?n.roll:0,camber:typeof n.camber==`number`?n.camber:0,toe:typeof n.toe==`number`?n.toe:0,rockerAngle:typeof n.rockerAngle==`number`?n.rockerAngle:0,springLength:typeof n.springLength==`number`?n.springLength:0,converged:!!n.converged,ackermannDelta:nh(typeof n.ackermannOuterDelta==`number`?n.ackermannOuterDelta:0,e.vehicle.wheelbase,i,t/100)}))});return{key:`ackermann-delta-chart`,title:`RH-LH steer delta vs ${n.label}`,x:n,y:jW,seriesSet:[...t,...a],analysisSeriesKeys:t.map(e=>e.key),legendSeriesKeys:a.map(e=>e.key),forceLegend:!0,hideAnalysisRows:!0}}function tG(e,t){if(!t||t.length===0)return e;let n=new Map(e.map(e=>[e.key,e])),r=[];return t.forEach(e=>{let t=n.get(e);t&&(r.push(t),n.delete(e))}),e.forEach(e=>{n.has(e.key)&&r.push(e)}),r}function nG(e,t,n=`y`,r,i,a=fL,o){if(e===`bumpSteer`){let r=i??ZU(e,a);return LW.map(i=>{let{x:a,y:o}=wW(e,i.channel,n,r);return{key:i.key,title:i.title,x:a,y:o,analysisChannel:i.channel,analysisAxisChannel:r,analysisZeroLabel:`Bump = 0`,seriesSet:BW(t,i.channel,i.branchProperty),analysisRoleRows:!0}})}let s=i??ZU(e,a);return(o?uV(e,o,a):QU(e,a)).flatMap(i=>{let a=e===`steer`&&i.key===`meanRadius`?MW:i,{x:o,y:c}=wW(e,a,n,s),l=s.key===`bump`?`Bump = 0`:e===`steer`?s.key===`rackTravel`?`Rack travel = 0`:`SW angle = 0`:e===`roll`?`Roll angle = 0`:e===`steeringColumn`?`SW angle = 0`:null,u=l?s:null,d=l?a:null,f=KW(e,i),p=qW(e,i,o,c),m=e===`steeringColumn`&&i.key===`pinionMinusSteeringWheelAngle`?`(Pinion angle - Steering wheel angle) vs Steering wheel angle`:`${f} vs ${s.label}`,h=[{key:i.key,title:m,x:o,y:c,xAxisLabelOverride:p.xAxisLabelOverride,yAxisLabelOverride:p.yAxisLabelOverride,analysisChannel:d,analysisAxisChannel:u,analysisZeroLabel:l,seriesSet:t,analysisSummaryMode:e===`steeringColumn`&&i.key===`pinionMinusSteeringWheelAngle`?`static-gradient-nonuniformity`:`static-gradient`,replaceGradientWithAverage:e===`steer`&&(i.key===`steeringRatio`||i.key===`ackermann`)}];return e===`steer`&&i.key===`ackermann`&&r&&h.push({key:r.key,title:r.title,x:r.x,y:r.y,analysisChannel:r.y,analysisAxisChannel:r.x,analysisZeroLabel:s.key===`rackTravel`?`Rack travel = 0`:`SW angle = 0`,seriesSet:r.seriesSet,analysisSeriesKeys:r.analysisSeriesKeys,legendSeriesKeys:r.legendSeriesKeys,forceLegend:r.forceLegend,hideAnalysisRows:r.hideAnalysisRows}),h})}function rG(e,t,n,r,i=fL,a){let o=a?uV(`steer`,a,i):QU(`steer`,i),s=new Set(o.map(e=>e.key).filter(e=>e!==`ackermann`)),c=t.key===`rackTravel`?`Rack travel = 0`:`SW angle = 0`;return o.flatMap(i=>{let a=i.key===`meanRadius`?NW:i,o=e.flatMap(e=>{let t={key:`${e.key}-${i.key}-left`,label:`${e.label} - LH wheel (outer)`,color:e.color,series:e.leftSeries,document:e.document,mode:`steer`},n={key:`${e.key}-${i.key}-right`,label:`${e.label} - RH wheel (inner)`,color:e.color,series:e.rightSeries,document:e.document,mode:`steer`,dasharray:PW,includeInAnalysis:!1};return s.has(i.key)?i.key===`steeringRatio`?[{key:`${e.key}-${i.key}-outer`,label:`${e.label} - LH wheel (outer)`,color:e.color,series:e.leftSeries,document:e.document,mode:`steer`},{key:`${e.key}-${i.key}-inner`,label:`${e.label} - RH wheel (inner)`,color:e.color,series:e.rightSeries,document:e.document,mode:`steer`,dasharray:PW,includeInAnalysis:!1}]:i.key===`meanRadius`?[{key:`${e.key}-${i.key}-outer`,label:`${e.label} - LH wheel (outer)`,color:e.color,series:e.leftSeries.map(t=>({...t,meanRadius:typeof t.toe==`number`?Math.abs(ZW(e.document,t.toe)):t.meanRadius})),document:e.document,mode:`steer`},{key:`${e.key}-${i.key}-inner`,label:`${e.label} - RH wheel (inner)`,color:e.color,series:e.rightSeries.map(t=>({...t,meanRadius:typeof t.toe==`number`?Math.abs(ZW(e.document,t.toe)):t.meanRadius})),document:e.document,mode:`steer`,dasharray:PW,includeInAnalysis:!1}]:[t,n]:[{...t,label:e.label}]}),l=i.key===`steeringRatio`?`Steering ratio`:i.key===`meanRadius`?`Cornering radius`:KW(`steer`,i),u=qW(`steer`,i,t,a),d=i.key===`steeringRatio`?`Steering ratio [deg/deg]`:i.key===`meanRadius`?`Cornering radius [m]`:u.yAxisLabelOverride,f=[{key:i.key,title:`${l} vs ${t.label}`,x:t,y:a,xAxisLabelOverride:n,yAxisLabelOverride:d,analysisChannel:a,analysisAxisChannel:t,analysisZeroLabel:c,seriesSet:o,replaceGradientWithAverage:i.key===`steeringRatio`||i.key===`ackermann`}];return i.key===`ackermann`&&r&&f.push({key:r.key,title:r.title,x:r.x,y:r.y,xAxisLabelOverride:n,analysisChannel:r.y,analysisAxisChannel:r.x,analysisZeroLabel:c,seriesSet:r.seriesSet,analysisSeriesKeys:r.analysisSeriesKeys,legendSeriesKeys:r.legendSeriesKeys,forceLegend:r.forceLegend,hideAnalysisRows:r.hideAnalysisRows}),f})}function iG(e,t){let n=new Set([`camber`,`relativeCamber`,`toe`]);return e.map(e=>{if(!n.has(e.key))return e;let r=t.flatMap(t=>[{key:`${t.key}-${e.key}-left`,label:`${t.label} - LH wheel (outer)`,color:t.color,series:t.leftSeries,document:t.document,mode:`roll`},{key:`${t.key}-${e.key}-right`,label:`${t.label} - RH wheel (inner)`,color:t.color,series:t.rightSeries,document:t.document,mode:`roll`,dasharray:PW,includeInAnalysis:!1}]);return{...e,seriesSet:r,analysisSeriesKeys:t.map(t=>`${t.key}-${e.key}-left`)}})}function aG(e,t){return!!(e&&Math.abs(e.bump-t.bump)<=1e-9&&Math.abs(e.steer-t.steer)<=1e-9&&Math.abs(e.roll-t.roll)<=1e-9)}function oG(e){return[-e[0],-e[1],e[2],e[3],-e[4],e[5]]}function sG(e,t,n,r,i,a){let o=j_(e,{bump:t,steer:n,roll:r},i,a);return{bump:t,steer:n,roll:r,rightFrame:o.rightFrame,leftFrame:o.leftFrame,document:o.document}}function cG(e,t,n){if(e.length===0)return null;let r=e[0],i=1/0;
4407return e.forEach(e=>{let a=0;a=Math.abs(n===`steer`?e.steer-t.steer:n===`roll`?e.roll-t.roll:e.bump-t.bump),a<i&&(r=e,i=a)}),r}function lG(e,t,n){return e+(t-e)*n}function uG(e,t,n){return{x:lG(e.x,t.x,n),y:lG(e.y,t.y,n),z:lG(e.z,t.z,n)}}function dG(e){return{center:xU(e.center),leftContact:xU(e.leftContact),rightContact:xU(e.rightContact),leftInstantCenter:xU(e.leftInstantCenter),rightInstantCenter:xU(e.rightInstantCenter),groundZAtCenter:e.groundZAtCenter}}function fG(e,t,n){if(!e||!t){let r=n<.5?e:t;return r?dG(r):void 0}return{center:uG(e.center,t.center,n),leftContact:uG(e.leftContact,t.leftContact,n),rightContact:uG(e.rightContact,t.rightContact,n),leftInstantCenter:uG(e.leftInstantCenter,t.leftInstantCenter,n),rightInstantCenter:uG(e.rightInstantCenter,t.rightInstantCenter,n),groundZAtCenter:lG(e.groundZAtCenter,t.groundZAtCenter,n)}}function pG(e,t,n){return[lG(e[0],t[0],n),lG(e[1],t[1],n),lG(e[2],t[2],n),lG(e[3],t[3],n),lG(e[4],t[4],n),lG(e[5],t[5],n)]}function mG(e,t,n){return{chassis:{topFront:uG(e.chassis.topFront,t.chassis.topFront,n),topRear:uG(e.chassis.topRear,t.chassis.topRear,n),bottomFront:uG(e.chassis.bottomFront,t.chassis.bottomFront,n),bottomRear:uG(e.chassis.bottomRear,t.chassis.bottomRear,n),tieRod:uG(e.chassis.tieRod,t.chassis.tieRod,n),pushRod:uG(e.chassis.pushRod,t.chassis.pushRod,n),spring:uG(e.chassis.spring,t.chassis.spring,n)},wheel:{topFront:uG(e.wheel.topFront,t.wheel.topFront,n),topRear:uG(e.wheel.topRear,t.wheel.topRear,n),bottomFront:uG(e.wheel.bottomFront,t.wheel.bottomFront,n),bottomRear:uG(e.wheel.bottomRear,t.wheel.bottomRear,n),tieRod:uG(e.wheel.tieRod,t.wheel.tieRod,n),pushRod:uG(e.wheel.pushRod,t.wheel.pushRod,n),spring:uG(e.wheel.spring,t.wheel.spring,n)},rocker:{axisStart:uG(e.rocker.axisStart,t.rocker.axisStart,n),axisEnd:uG(e.rocker.axisEnd,t.rocker.axisEnd,n)},wheelCenter:uG(e.wheelCenter,t.wheelCenter,n)}}function hG(e,t,n){return!e||!t?n<.5?e:t:{heaveLeft:uG(e.heaveLeft,t.heaveLeft,n),heaveRight:uG(e.heaveRight,t.heaveRight,n),rollLeft:uG(e.rollLeft,t.rollLeft,n),rollRight:uG(e.rollRight,t.rollRight,n),cLink:uG(e.cLink,t.cLink,n),cArb:uG(e.cArb,t.cArb,n),tLink:uG(e.tLink,t.tLink,n),tArbLeft:uG(e.tArbLeft,t.tArbLeft,n),tArbRight:uG(e.tArbRight,t.tArbRight,n),thirdElementArb:uG(e.thirdElementArb,t.thirdElementArb,n),cBarAngle:lG(e.cBarAngle,t.cBarAngle,n),tBarAngleX:lG(e.tBarAngleX,t.tBarAngleX,n),tBarAngleY:lG(e.tBarAngleY,t.tBarAngleY,n)}}function gG(e,t,n){return!e||!t?n<.5?e:t:{start:uG(e.start,t.start,n),end:uG(e.end,t.end,n),contact:uG(e.contact,t.contact,n)}}function _G(e,t,n){let r={...e};return Object.keys(r).forEach(i=>{r[i]=lG(e[i],t[i],n)}),r}function vG(e,t,n){return{pose:pG(e.pose,t.pose,n),bump:lG(e.bump,t.bump,n),steer:lG(e.steer,t.steer,n),useSteeringModel:e.useSteeringModel||t.useSteeringModel||void 0,converged:e.converged&&t.converged,residual:lG(e.residual,t.residual,n),iterations:Math.round(lG(e.iterations,t.iterations,n)),rightCorner:mG(e.rightCorner,t.rightCorner,n),constraintErrors:n<.5?e.constraintErrors:t.constraintErrors,elementState:hG(e.elementState,t.elementState,n),steeringAxis:gG(e.steeringAxis,t.steeringAxis,n),outputs:_G(e.outputs,t.outputs,n)}}function yG(e,t,n,r){let i=vG(t.rightFrame,n.rightFrame,r),a=vG(t.leftFrame,n.leftFrame,r),o=sG(e,lG(t.bump,n.bump,r),lG(t.steer,n.steer,r),lG(t.roll,n.roll,r),i,a),s=fG(t.document.motion?.rollCenter,n.document.motion?.rollCenter,r);if(!s||!o.document.motion)return o;let c=(e,t)=>({...e,outputs:{...e.outputs,hcrRelative:t.outputs.hcrRelative,hcrAbsolute:t.outputs.hcrAbsolute,rollCenterHeightGround:t.outputs.rollCenterHeightGround,rollCenterDistanceToCg:t.outputs.rollCenterDistanceToCg,rollCenterY:t.outputs.rollCenterY}});return{...o,document:{...o.document,motion:{...o.document.motion,rollCenter:s}},rightFrame:c(o.rightFrame,i),leftFrame:c(o.leftFrame,a)}}function bG(e,t,n,r){if(t.length===0)return null;let i=TG(n,r),a=t[0],o=t[t.length-1],s=wG(a,r),c=wG(o,r),l=Math.sign(c-s);if(t.length===1||l===0)return cG(t,n,r)??a;if(l>0&&i<=s||l<0&&i>=s)return a;if(l>0&&i>=c||l<0&&i<=c)return o;for(let n=1;n<t.length;n+=1){let a=t[n-1],o=t[n],s=wG(a,r),c=wG(o,r),u=c-s;if(!(Math.abs(u)<=1e-9)&&(l>0?i>=s&&i<=c:i<=s&&i>=c))return yG(e,a,o,EG((i-s)/u))}return cG(t,n,r)??a}function xG(e,t,n){let r=Math.abs(t.bump-e.bump);if(r>1e-9)return r;let i=Math.abs(t.steer-e.steer);if(i>1e-9)return n.vehicle.wheelRadius*i*(Math.PI/180);let a=Math.abs(n.geometry.right.wheelCenter.y);return Math.abs(t.roll-e.roll)*(Math.PI/180)*Math.max(a,n.vehicle.wheelRadius)}function SG(e,t,n){let r=mm(e.document,`right`),i=mm(e.document,`left`),a=mm(t.document,`right`),o=mm(t.document,`left`),s=(mK(e.document.geometry.right.wheelCenter,t.document.geometry.right.wheelCenter)+mK(e.document.geometry.left.wheelCenter,t.document.geometry.left.wheelCenter)+mK(r,a)+mK(i,o))*.25;return s>1e-6?s:xG(e,t,n)}function CG(e,t){if(e.length===0)return[];let n=0,r=[{...e[0],distanceMm:0}];for(let i=1;i<e.length;i+=1){let a=SG(e[i-1],e[i],t);a<=1e-6||(n+=a,r.push({...e[i],distanceMm:n}))}return r}
4407function wG(e,t){return t===`steer`?e.steer:t===`roll`?e.roll:e.bump}function TG(e,t){return t===`steer`?e.steer:t===`roll`?e.roll:e.bump}function EG(e){return Math.max(0,Math.min(1,e))}function DG(e,t,n,r={bump:0,steer:0,roll:0}){return t===`steer`?{bump:r.bump,steer:n,roll:r.roll}:t===`roll`?{bump:r.bump,steer:r.steer,roll:n}:t===`bumpSteer`?{bump:n,steer:e.run.bumpSteerAngle,roll:r.roll}:{bump:n,steer:r.steer,roll:r.roll}}function OG(e,t){return t===`steer`?{min:-e.run.steeringWheelAngleMax,max:e.run.steeringWheelAngleMax}:t===`roll`?Cf(e.run,Math.abs(e.geometry.right.wheelCenter.y)):{min:-e.run.reboundMax,max:e.run.bumpMax}}function kG(e,t){let{min:n,max:r}=OG(e,t);return Math.max(n,Math.min(r,0))}function AG(e,t,n){return t===`steer`?n.steer:t===`roll`?n.roll:n.bump}function jG(e,t,n){let r=zL(n)/100;return t===`steer`?xI*r:t===`roll`?SI*r:bI*r}function MG(e,t,n,r,i){if(i-r<=1e-9)return{value:r,direction:1};let a=e+t*n,o=t;for(;a>i||a<r;){if(a>i){a=i-(a-i),o=-1;continue}a=r+(r-a),o=1}return a>=i&&o>0?{value:i,direction:-1}:a<=r&&o<0?{value:r,direction:1}:{value:a,direction:o}}function NG(e,t,n,r){return n===`chassisFixed`?e:Jy(e,t,r)}var PG=420,FG=248,IG=48,LG=8,RG=8,zG=38;function BG(e,t){let n=Math.max(240,Math.round(Number.isFinite(e)&&e>0?e:PG)),r=Number.isFinite(t)&&(t??0)>0?Math.max(150,Math.round(t??0)):Math.max(150,Math.round(n*FG/PG));return{width:n,height:r,plotLeft:IG,plotRight:Math.max(IG+80,n-LG),plotTop:RG,plotBottom:Math.max(RG+80,r-zG)}}var VG=BG(PG);function HG(){return{x:{auto:!0,min:``,max:``},y:{auto:!0,min:``,max:``}}}function UG(e){return Math.abs(e)<1e-9?0:Number(e.toFixed(9))}function WG(e){let t=Number(e.trim().replace(`,`,`.`));return Number.isFinite(t)?t:void 0}function GG(e){return{x:{auto:e.x.auto,min:e.x.auto?void 0:WG(e.x.min),max:e.x.auto?void 0:WG(e.x.max)},y:{auto:e.y.auto,min:e.y.auto?void 0:WG(e.y.min),max:e.y.auto?void 0:WG(e.y.max)}}}function KG(e){return!Number.isFinite(e)||e<=0||e>=1?0:e>=.1?1:e>=.01?2:e>=.001?3:e>=1e-4?4:5}function qG(e){let t=UG(e);for(let e=0;e<=6;e+=1)if(Math.abs(t-Number(t.toFixed(e)))<=1e-9)return e;return 6}function JG(e,t=1){if(!Number.isFinite(e))return`0`;let n=UG(e),r=KG(Math.abs(t)),i=qG(n),a=Math.min(6,Math.max(r,Math.min(i,Math.max(r,2))));return n.toLocaleString(`en-US`,{useGrouping:!1,minimumFractionDigits:0,maximumFractionDigits:a})}function YG(e,t=8){if(!Number.isFinite(e)||e<=1e-9)return 1;let n=e/Math.max(1,t),r=10**Math.floor(Math.log10(n)),i=n/r;return i<=1?r:i<=2?2*r:i<=5?5*r:10*r}
4407function XG(e,t,n=8){if(Math.abs(t-e)<1e-9)return[UG(e)];let r=YG(t-e,n),i=[],a=Math.ceil(e/r),o=Math.floor(t/r);for(let n=a;n<=o;n+=1){let a=UG(n*r);a<e-1e-9||a>t+1e-9||i.push(a)}return i.length===0&&i.push(UG(e),UG(t)),Array.from(new Set(i))}function ZG(e,t,n){return UG(t===`min`?Math.floor(e/n)*n:Math.ceil(e/n)*n)}function QG(e,t){let n=Math.abs(t-e);return n>1e-9?n*.075:Math.max(Math.abs(t)*.08,1)}function $G(e,t){let n=(e+t)/2,r=Math.abs(t-e),i=Math.max(Math.abs(n)*.02,.02);return r>=i*.25?{min:e,max:t}:{min:n-i/2,max:n+i/2}}function eK(e,t,n){if(!n||n.auto)return{min:e,max:t};let r=n.min??e,i=n.max??t;return!Number.isFinite(r)||!Number.isFinite(i)||r>=i?{min:e,max:t}:{min:r,max:i}}function tK(e){return!!(e&&Number.isFinite(e.xMin)&&Number.isFinite(e.xMax)&&Number.isFinite(e.yMin)&&Number.isFinite(e.yMax)&&e.xMin<e.xMax&&e.yMin<e.yMax)}function nK(e,t){let n=(t-e.plotLeft)/Math.max(e.plotRight-e.plotLeft,1e-9);return e.xMin+n*(e.xMax-e.xMin)}function rK(e,t){let n=(e.plotBottom-t)/Math.max(e.plotBottom-e.plotTop,1e-9);return e.yMin+n*(e.yMax-e.yMin)}function iK(e,t,n,r,i=VG,a){let o=e.flatMap(e=>e.map(e=>Q(e,t.key))).filter(Number.isFinite),s=e.flatMap(e=>e.map(e=>Q(e,n.key))).filter(Number.isFinite),c=o.length>0?Math.min(...o):-1,l=o.length>0?Math.max(...o):1,u=s.length>0?Math.min(...s):-1,d=s.length>0?Math.max(...s):1,f=$G(c,l),p=$G(u,d),m=QG(f.min,f.max),h=QG(p.min,p.max),g=YG(f.max-f.min+m*2),_=YG(p.max-p.min+h*2),v=ZG(f.min-m,`min`,g),y=ZG(f.max+m,`max`,g),b=ZG(p.min-h,`min`,_),x=ZG(p.max+h,`max`,_);typeof t.chartMin==`number`&&(v=t.chartMin),typeof t.chartMax==`number`&&(y=t.chartMax),typeof n.chartMin==`number`&&(b=n.chartMin),typeof n.chartMax==`number`&&(x=n.chartMax);let S=eK(v,y,r?.x),C=eK(b,x,r?.y);v=S.min,y=S.max,b=C.min,x=C.max,tK(a)&&(v=a.xMin,y=a.xMax,b=a.yMin,x=a.yMax);let w=i.plotLeft,T=i.plotRight,E=i.plotTop,D=i.plotBottom;return{xMin:v,xMax:y,yMin:b,yMax:x,plotLeft:w,plotRight:T,plotTop:E,plotBottom:D,sx:e=>w+(e-v)/Math.max(y-v,1e-9)*(T-w),sy:e=>D-(e-b)/Math.max(x-b,1e-9)*(D-E)}}function aK(e,t,n,r){return e.length===0?``:e.map((e,i)=>`${i===0?`M`:`L`} ${r.sx(Q(e,t.key))} ${r.sy(Q(e,n.key))}`).join(` `)}function oK(e){return e.unit?`${e.label} [${e.unit}]`:e.label}function sK(e,t){return e.unit&&t.unit?`${t.unit}/${e.unit}`:t.unit?`${t.unit}/unit`:e.unit?`1/${e.unit}`:``}function cK(e,t){let n=t.axis-e.axis;if(Math.abs(n)<=1e-9)return null;let r=-e.axis/n;return e.plotted+(t.plotted-e.plotted)*r}function lK(e,t,n){let r=e.map(e=>({axis:Q(e,t.key),value:Q(e,n.key)})).filter(e=>Number.isFinite(e.axis)&&Number.isFinite(e.value)).sort((e,t)=>e.axis-t.axis);if(r.length===0)return null;let i=r.find(e=>Math.abs(e.axis)<1e-9);if(i)return i.value;for(let e=1;e<r.length;e+=1){let t=r[e-1],n=r[e];if(t.axis<0&&n.axis>0||t.axis>0&&n.axis<0)return cK({axis:t.axis,plotted:t.value},{axis:n.axis,plotted:n.value})}return null}var uK=.001,dK=.1,fK=.1;function pK(e,t,n=0){let r=Number((e.fields[t]??``).trim().replace(`,`,`.`));return Number.isFinite(r)?r:n}function mK(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2+(e.z-t.z)**2)}function hK(e,t){let n=S_(e,t,0);return b_(n)?{bump:t,steer:0,roll:0,...n.outputs,converged:n.converged}:null}function gK(e,t,n){let r=Xh(e,t.pose),i=Xh(e,n.pose);return Math.atan2(r.z-i.z,r.y+i.y)*180/Math.PI}function _K(e,t){let n=Math.abs(t);if(n<1e-9)return null;let r=y_(e,0,t,{useSteeringModel:!0}),i=y_(e,0,-t,{useSteeringModel:!0});if(!b_(r)||!b_(i))return null;let a=pK(e,`C Factor`,0);if(t>=0){let o=Dg(e,r.outputs.toe,i.outputs.toe,n);return{bump:0,steer:t,steeringWheelAngle:t,rackTravel:t*a/360,roll:0,...r.outputs,rollAngle:gK(e,r,i),steeringRatio:o.steeringRatio,ackermann:o.ackermann,meanRadius:o.meanRadius,ackermannDelta:o.ackermannDelta,ackermannIdealDelta:o.ackermannIdealDelta,ackermannOuterDelta:o.ackermannOuterDelta,heightDelta:r.outputs.heightDelta,meanHeightDelta:(r.outputs.heightDelta+i.outputs.heightDelta)*.5,axleTrackDelta:_g(r,i),roadWheelDifference:o.roadWheelDifference,converged:r.converged&&i.converged}}let o=Dg(e,i.outputs.toe,r.outputs.toe,n);return{bump:0,steer:t,steeringWheelAngle:t,rackTravel:t*a/360,roll:0,...r.outputs,rollAngle:-gK(e,i,r),steeringRatio:o.steeringRatio,ackermann:o.ackermann,meanRadius:o.meanRadius,ackermannDelta:o.ackermannDelta,ackermannIdealDelta:o.ackermannIdealDelta,ackermannOuterDelta:o.ackermannOuterDelta,heightDelta:r.outputs.heightDelta,meanHeightDelta:(r.outputs.heightDelta+i.outputs.heightDelta)*.5,axleTrackDelta:_g(r,i),roadWheelDifference:o.roadWheelDifference,converged:r.converged&&i.converged}}function vK(e,t){let n=A_(e,{bump:0,steer:0,roll:t}),r=(e.geometry.left.wheelCenter.y>=e.geometry.right.wheelCenter.y?`left`:`right`)==`left`?n.leftFrame:n.rightFrame;if(!b_(r))return null;let i=n.document.motion?.elements,a=e.elements.heaveSpring&&i?mK(i.heaveLeft??e.elements.heaveLeft,i.heaveRight??e.elements.heaveRight):0,o=e.elements.rollSpring&&i?mK(i.rollLeft??e.elements.rollLeft,i.rollRight??e.elements.rollRight):0;return{bump:0,steer:0,roll:t,...r.outputs,heaveSpring:a,rollSpring:o,rollAngle:t,relativeCamber:r.outputs.camber-t,cBarTorsion:r.outputs.cBarRotation,tBarTorsion:r.outputs.tBarTorsion,tBarInclination:r.outputs.tBarInclination,converged:r.converged}}function yK(e,t){let n=A_(e,{bump:t,steer:0,roll:0}),r=Vf(n.document,`left`,n.document.geometry.left);return r===null||!Number.isFinite(r)?null:{bump:t,steer:0,roll:0,camber:0,toe:0,rockerAngle:0,springLength:0,axialShift:r,converged:n.leftFrame.converged}}function bK(e,t,n,r){if(!e||!t)return null;let i=Q(e,n),a=Q(t,n),o=Q(e,r),s=Q(t,r),c=a-i;return!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(o)||!Number.isFinite(s)||Math.abs(c)<=1e-9?null:(s-o)/c}function xK(e,t,n){if(!e.document||!e.mode||!t||!n)return null;switch(e.mode){case`bump`:case`anti`:return t.key===`bump`?bK(hK(e.document,-uK),hK(e.document,uK),t.key,n.key):null;case`steer`:return t.key!==`steeringWheelAngle`&&t.key!==`rackTravel`?null:bK(_K(e.document,-dK),_K(e.document,dK),t.key,n.key);case`roll`:return t.key===`roll`?bK(vK(e.document,-fK),vK(e.document,fK),t.key,n.key):null;case`driveshaft`:return t.key===`bump`?bK(yK(e.document,-uK),yK(e.document,uK),t.key,n.key):null;default:return null}}function SK(e,t,n){if(!t||!n)return null;let r=e.map(e=>({axis:Q(e,t.key),value:Q(e,n.key)})).filter(e=>Number.isFinite(e.axis)&&Number.isFinite(e.value)).sort((e,t)=>
4407e.axis-t.axis);if(r.length<2)return null;let i=r.findIndex(e=>Math.abs(e.axis)<1e-9);if(i>=0){let e=r[i],t=i>0?r[i-1]:null,n=i<r.length-1?r[i+1]:null;if(t&&n){let e=n.axis-t.axis;if(Math.abs(e)>1e-9)return(n.value-t.value)/e}if(t){let n=e.axis-t.axis;if(Math.abs(n)>1e-9)return(e.value-t.value)/n}if(n){let t=n.axis-e.axis;if(Math.abs(t)>1e-9)return(n.value-e.value)/t}return null}for(let e=1;e<r.length;e+=1){let t=r[e-1],n=r[e];if(!(t.axis<0&&n.axis>0||t.axis>0&&n.axis<0))continue;let i=n.axis-t.axis;return Math.abs(i)<=1e-9?null:(n.value-t.value)/i}return null}function CK(e,t){if(!t)return null;let n=e.map(e=>Q(e,t.key)).filter(e=>Number.isFinite(e));return n.length===0?null:n.reduce((e,t)=>e+t,0)/n.length}function wK(e,t){if(!t)return{min:null,max:null};let n=e.map(e=>Q(e,t.key)).filter(e=>Number.isFinite(e));return n.length===0?{min:null,max:null}:{min:Math.min(...n),max:Math.max(...n)}}function TK({seriesSet:e,title:t,chartIndex:n,chartKey:r,x:i,y:a,xAxisLabelOverride:o,yAxisLabelOverride:s,analysisChannel:c,analysisAxisChannel:l,analysisZeroLabel:u,analysisSeriesKeys:d,analysisSeriesLabelVariant:f=`default`,legendSeriesKeys:p,forceLegend:m=!1,hideAnalysisRows:g=!1,analysisSummaryMode:_=`static-gradient`,replaceGradientWithAverage:v=!1,analysisRoleRows:y=!1,showLegend:b=!0,expanded:x=!1,onToggleExpand:S,chartPinKey:C,pinActive:w=!1,onPinChart:T,onRefreshPinnedChart:E,customGraph:D,customActive:O=!1,onAddToCustom:k,onRemoveChart:A}){let j=e.filter(e=>e.series.length>0),ee=d&&d.length>0?j.filter(e=>d.includes(e.key)):j.filter(e=>e.includeInAnalysis!==!1),te=ee.length>0?ee:j,M=p&&p.length>0?j.filter(e=>p.includes(e.key)):j,ne=`chart-clip-${(0,h.useId)().replace(/[^a-zA-Z0-9_-]/g,``)}`,N=(0,h.useRef)(null),[P,re]=(0,h.useState)(()=>VG),[ie,ae]=(0,h.useState)(null),[oe,se]=(0,h.useState)(()=>HG()),[F,ce]=(0,h.useState)(null),[le,ue]=(0,h.useState)(null),[I,de]=(0,h.useState)(null),fe=j.map(e=>{let t=e.series[0],n=e.series[e.series.length-1];return[e.key,e.series.length,e.series.map(e=>`${Q(e,i.key)},${Q(e,a.key)}`).join(`;`),t?Q(t,i.key):``,t?Q(t,a.key):``,n?Q(n,i.key):``,n?Q(n,a.key):``].join(`:`)}).join(`|`),pe=[t,i.key,i.label,i.unit??``,a.key,a.label,a.unit??``,j.map(e=>[e.key,e.label,e.color,e.opacity??1,e.series.map(e=>`${Q(e,i.key)},${Q(e,a.key)}`).join(`;`)].join(`:`)).join(`|`)].join(`|`),me=(0,h.useRef)(null),L=iK(j.map(e=>e.series),i,a,GG(oe),P,le),R=Math.max(x?10:7,Math.floor((L.plotRight-L.plotLeft)/72)),_e=Math.max(x?8:6,Math.floor((L.plotBottom-L.plotTop)/42)),ve=XG(L.xMin,L.xMax,R),z=XG(L.yMin,L.yMax,_e),be=ve.length>1?Math.abs(ve[1]-ve[0]):Math.abs(L.xMax-L.xMin),B=z.length>1?Math.abs(z[1]-z[0]):Math.abs(L.yMax-L.yMin),xe=L.xMin<=0&&L.xMax>=0?L.sx(0):null,Se=L.yMin<=0&&L.yMax>=0?L.sy(0):null,Ce=i.key===`bump`?i:a.key===`bump`?a:null,Te=i.key===`bump`&&a.key!==`bump`?a:a.key===`bump`&&i.key!==`bump`?i:null,Ee=l??Ce,De=c??Te,Oe=u??(Ee?.key===`bump`?`Bump = 0`:null),ke=`Static value${Oe?` @ ${Oe}`:``}${De?.unit?` [${De.unit}]`:``}`,Ae=Ee&&De?sK(Ee,De):``,je=v?`Average value${De?.unit?` [${De.unit}]`:``}`:`Gradient${Oe?` @ ${Oe}`:``}${Ae?` [${Ae}]`:``}`,Me=te.map(e=>({...e,staticValue:Ee&&De?lK(e.series,Ee,De):null})),Ne=te.map(e=>({...e,gradient:v?CK(e.series,De):xK(e,Ee,De)??SK(e.series,Ee,De)})),Pe=y?[`current`,`previous`,`reference`,`secondary`].map(e=>({role:e,staticEntries:Me.filter(t=>TR(t)===e),gradientEntries:Ne.filter(t=>TR(t)===e)})).filter(e=>e.staticEntries.length>0||e.gradientEntries.length>0):[],Fe=De?.unit?` [${De.unit}]`:``,Ie=te.map(e=>{let t=wK(e.series,De);return{...e,maxValue:t.max}}),Le=te.map(e=>{let t=wK(e.series,De);return{...e,minValue:t.min}}),Re=te.map(e=>{let t=wK(e.series,De);return{...e,nonUniformity:t.max===null||t.min===null?null:t.max-t.min}}),ze=L.plotBottom+15,V=P.height-5,Be=L.plotLeft-8,Ve={"--analysis-series-count":y&&Pe.length>0?Math.max(...Pe.map(e=>Math.max(e.staticEntries.length,e.gradientEntries.length,1)),1):_===`range-extrema`?Math.max(Ie.length,Le.length,Re.length,1):Math.max(Me.length,Ne.length,1)},He=i.unit?`X [${i.unit}]`:`X`,Ue=a.unit?`Y [${a.unit}]`:`Y`,We=j.flatMap(e=>e.series.reduce((t,n,r)=>{let o=Q(n,i.key),s=Q(n,a.key);return!Number.isFinite(o)||!Number.isFinite(s)||t.push({key:`${e.key}-${r}-${o}-${s}`,seriesLabel:e.label,xValue:o,yValue:s,cx:L.sx(o),cy:L.sy(s),color:e.color,opacity:e.opacity}),t},[])),Ge=ie?.color??`#f8fbfd`,Ke=ie?.opacity??1,qe=ie?JG(ie.xValue,Math.max(be/5,1e-9)):``,Je=ie?JG(ie.yValue,Math.max(B/5,1e-9)):``,Ye=I?{x:Math.min(I.startX,I.currentX),y:Math.min(I.startY,I.currentY),width:Math.abs(I.currentX-I.startX),height:Math.abs(I.currentY-I.startY)}:null,Xe=(0,h.useMemo)(()=>({id:C??r??t,title:t,chartKey:r,x:i,y:a,xAxisLabelOverride:o,yAxisLabelOverride:s,analysisChannel:c,analysisAxisChannel:l,analysisZeroLabel:u,analysisSeriesKeys:d,analysisSeriesLabelVariant:f,legendSeriesKeys:p,forceLegend:m,hideAnalysisRows:g,analysisSummaryMo
4407de:_,replaceGradientWithAverage:v,analysisRoleRows:y,showLegend:b,seriesSet:e}),[l,c,y,d,f,_,u,r,C,m,g,p,v,e,b,t,i,o,a,s]);(0,h.useEffect)(()=>{let e=N.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect();re(e=>{let n=BG(t.width,t.height);return e.width===n.width&&e.height===n.height?e:n})};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,h.useEffect)(()=>{ue(null),de(null),ae(null)},[r,fe,i.key,a.key]),(0,h.useEffect)(()=>{if(!w||!E){me.current=null;return}me.current!==pe&&(me.current=pe,E(Xe))},[E,w,Xe,pe]),(0,h.useEffect)(()=>{if(!F)return;let e=()=>ce(null),t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`pointerdown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`pointerdown`,e),window.removeEventListener(`keydown`,t)}},[F]);function Ze(e){let t=e.currentTarget.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;let n=(e.clientX-t.left)/t.width*P.width,r=(e.clientY-t.top)/t.height*P.height,i=n>=L.plotLeft&&n<=L.plotRight&&r>=L.plotTop&&r<=L.plotBottom;return{cx:Math.min(L.plotRight,Math.max(L.plotLeft,n)),cy:Math.min(L.plotBottom,Math.max(L.plotTop,r)),insidePlot:i}}function Qe(e,t){e.hasPointerCapture(t)&&e.releasePointerCapture(t)}function $e(e,t){let n=null,r=1/0;return j.forEach(o=>{let s=o.series.reduce((e,t,n)=>{let r=Q(t,i.key),s=Q(t,a.key);return!Number.isFinite(r)||!Number.isFinite(s)||e.push({key:`${o.key}-${n}-${r}-${s}`,seriesLabel:o.label,xValue:r,yValue:s,cx:L.sx(r),cy:L.sy(s),color:o.color,opacity:o.opacity}),e},[]);if(s.length===1){let i=s[0],a=Math.hypot(i.cx-e,i.cy-t);a<r&&(r=a,n=i);return}for(let i=1;i<s.length;i+=1){let a=s[i-1],c=s[i],l=c.cx-a.cx,u=c.cy-a.cy,d=l*l+u*u,f=d<=1e-9?0:Math.max(0,Math.min(1,((e-a.cx)*l+(t-a.cy)*u)/d)),p=a.cx+l*f,m=a.cy+u*f,h=Math.hypot(p-e,m-t);h>=r||(r=h,n={key:`${a.key}-${c.key}-${f.toFixed(4)}`,seriesLabel:o.label,xValue:a.xValue+(c.xValue-a.xValue)*f,yValue:a.yValue+(c.yValue-a.yValue)*f,cx:p,cy:m,color:o.color,opacity:o.opacity})}}),r<=Math.max(L.plotRight-L.plotLeft,L.plotBottom-L.plotTop)?n:null}function et(){ae(null)}function tt(e){if(e.button!==0)return;let t=Ze(e);t?.insidePlot&&(e.preventDefault(),ce(null),e.currentTarget.setPointerCapture(e.pointerId),de({pointerId:e.pointerId,startX:t.cx,startY:t.cy,currentX:t.cx,currentY:t.cy}),ae($e(t.cx,t.cy)))}function nt(e){let t=Ze(e);if(t){if(I?.pointerId===e.pointerId&&de({...I,currentX:t.cx,currentY:t.cy}),!t.insidePlot){ae(null);return}ae($e(t.cx,t.cy))}}function rt(e){if(!I||I.pointerId!==e.pointerId)return;e.preventDefault(),Qe(e.currentTarget,e.pointerId);let t=Ze(e),n=t?.cx??I.currentX,r=t?.cy??I.currentY,i=Math.min(I.startX,n),a=Math.max(I.startX,n),o=Math.min(I.startY,r),s=Math.max(I.startY,r);if(de(null),a-i<8||s-o<8)return;let c={xMin:Math.min(nK(L,i),nK(L,a)),xMax:Math.max(nK(L,i),nK(L,a)),yMin:Math.min(rK(L,s),rK(L,o)),yMax:Math.max(rK(L,s),rK(L,o))};tK(c)&&ue(c)}function it(e){I?.pointerId===e.pointerId&&(Qe(e.currentTarget,e.pointerId),de(null))}function at(e){e.preventDefault(),e.stopPropagation(),de(null);let t=N.current?.getBoundingClientRect();if(!t){ce({x:8,y:8});return}ce({x:Math.min(Math.max(6,t.width-260-6),Math.max(6,e.clientX-t.left)),y:Math.min(Math.max(6,t.height-278-6),Math.max(6,e.clientY-t.top))})}function ot(e,t){ue(null),se(n=>({...n,[e]:{...n[e],...t}}))}function st(e,t){let n=e===`x`?L.xMin:L.yMin,r=e===`x`?L.xMax:L.yMax,i=e===`x`?be:B;ue(null),se(a=>({...a,[e]:t?{...a[e],auto:t}:{auto:t,min:a[e].min||JG(n,i),max:a[e].max||JG(r,i)}}))}function ct(){ue(null),se(HG()),ce(null)}function lt(e,t,n,r,i){let a=oe[e];return(0,Z.jsxs)(`div`,{className:`chart-settings-axis`,children:[(0,Z.jsxs)(`label`,{className:`chart-settings-auto`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:a.auto,onChange:t=>st(e,t.target.checked)}),(0,Z.jsx)(`span`,{children:`${t} autoscale`})]}),(0,Z.jsxs)(`div`,{className:`chart-settings-limits`,children:[(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Min`}),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,disabled:a.auto,value:a.min,placeholder:JG(n,i),onChange:t=>ot(e,{min:t.target.value})})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Max`}),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,disabled:a.auto,value:a.max,placeholder:JG(r,i),onChange:t=>ot(e,{max:t.target.value})})]})]})]})}function ut(e,t,n,r){let i=n===null?`--`:Tf(n),a=`${wR(e,f)} | ${r}: ${i}`;return(0,Z.jsxs)(`span`,{className:`chart-gradient-chip chart-value-chip`,title:a,"aria-label":a,children:[(0,Z.jsx)(`i`,{style:{backgroundColor:e.color,opacity:e.opacity}}),(0,Z.jsx)(`span`,{children:i})]},t)}function dt(e){e.preventDefault(),e.stopPropagation(),T&&T(Xe)}function ft(e){e.preventDefault(),e.stopPropagation(),!(!D||!k)&&k(D)}function pt(e){e.preventDefault(),e.stopPropagation(),A?.()}function mt(){!r||!S||S(r)}function ht(e){e.preventDefault(),e.stopPropagation(),le&&(de(null),ue(null))}return(0,Z.jsxs)(`article`,{className:`output-chart-card${x?` output-chart-card-expanded`:``}`,onDoubleClick:mt,children:[(0,Z.jsxs)(`div`,{className:`chart-card-head`,children:[(0,Z.jsxs)(`h3`,{children:[n?(0,Z.jsxs)(`span`,{className:`chart-title-index`,children:[n,`.`]}):null,(0,Z.jsx)(`span`,{children:t})]}),(0,Z.jsxs)(`div`,{className:`chart-card-actions`,children:[A?(0,Z.jsx)(`button`,{type:`button`,className:`chart-mini-button chart-remove-button`,onClick:pt,"aria-label":`Remove ${t}`,title:`Remove chart`,children:(0,Z.jsx)(we,{size:13,"aria-hidden":`true`})}):null,D&&k?(0,Z.jsxs)(`button`,{type:`button`,className:`chart-mini-button chart-custom-button${O?` is-active`:``}`,onClick:ft,"aria-label":`${O?`Already in custom charts`:`Add to custom charts`}: ${t}`,title:O?`Already in custom charts`:`Add to custom charts`,children:[(0,Z.jsx)(ge,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:O?`Added`:`Custom`})]}):null,T?(0,Z.jsxs)(`button`,{type:`button`,className:`chart-mini-button chart-pin-button${w?` is-active`:``}`,onClick:dt,"aria-label":`${w?`Pinned chart`:`Pin chart`}: ${t}`,title:w?`Pinned`:`Pin chart`,children:[(0,Z.jsx)(he,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:w?`Pinned`:`Pin`})]}):null]})]}),(0,Z.jsxs)(`div`,{className:`single-chart-shell`,ref:N,children:[(0,Z.jsxs)(`svg`,{className:`single-chart`,viewBox:`0 0 ${P.width} ${P.height}`,role:`img`,"aria-label":`${t} chart`,onPointerDown:tt,onPointerMove:nt,onPointerUp:rt,onPointerCancel:it,onPointerLeave:et,onDoubleClick:ht,onContextMenu:at,children:[(0,Z.jsx)(`defs`,{children:(0,Z.jsx)(`clipPath`,{id:ne,children:(0,Z.jsx)(`rect`,{x:L.plotLeft,y:L.plotTop,width:L.plotRight-L.plotLeft,height:L.plotBottom-L.plotTop})})}),(0,Z.jsxs)(`g`,{className:`chart-grid-lines`,children:[ve.map(e=>{let t=L.sx(e);return(0,Z.jsx)(`line`,{x1:t,y1:L.plotTop,x2:t,y2:L.plotBottom,vectorEffect:`non-scaling-stroke`},`x-${e}`)}),z.map(e=>{let t=L.sy(e);return(0,Z.jsx)(`line`,{x1:L.plotLeft,y1:t,x2:L.plotRight,y2:t,vectorEffect:`non-scaling-stroke`},`y-${e}`)})]}),Se===null?null:(0,Z.jsx)(`line`,{className:`chart-axis-main`,x1:L.plotLeft,y1:Se,x2:L.plotRight,y2:Se,vectorEffect:`non-scaling-stroke`}),xe===null?null:(0,Z.jsx)(`line`,{className:`chart-axis-main`,x1:xe,y1:L.plotTop,x2:
4407xe,y2:L.plotBottom,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`line`,{className:`chart-axis-frame`,x1:L.plotLeft,y1:L.plotBottom,x2:L.plotRight,y2:L.plotBottom,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`line`,{className:`chart-axis-frame`,x1:L.plotLeft,y1:L.plotTop,x2:L.plotLeft,y2:L.plotBottom,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`g`,{clipPath:`url(#${ne})`,children:j.map(e=>(0,Z.jsx)(`path`,{d:aK(e.series,i,a,L),style:{stroke:e.color,strokeDasharray:e.dasharray,strokeWidth:e.lineWidth,opacity:e.opacity},vectorEffect:`non-scaling-stroke`},e.key))}),We.map(e=>(0,Z.jsx)(`circle`,{className:`chart-point-hitbox`,cx:e.cx,cy:e.cy,r:6},`hover-${e.key}`)),ie?(0,Z.jsxs)(`g`,{className:`chart-cursor`,pointerEvents:`none`,children:[(0,Z.jsx)(`line`,{className:`chart-cursor-line`,x1:ie.cx,y1:L.plotTop,x2:ie.cx,y2:L.plotBottom,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`line`,{className:`chart-cursor-line`,x1:L.plotLeft,y1:ie.cy,x2:L.plotRight,y2:ie.cy,vectorEffect:`non-scaling-stroke`})]}):null,ie?(0,Z.jsxs)(`g`,{className:`chart-active-point`,pointerEvents:`none`,children:[(0,Z.jsx)(`circle`,{cx:ie.cx,cy:ie.cy,r:4.6,fill:`#0d131a`,stroke:`#f8fbfd`,strokeWidth:1.2,vectorEffect:`non-scaling-stroke`}),(0,Z.jsx)(`circle`,{cx:ie.cx,cy:ie.cy,r:2.9,fill:ie.color,fillOpacity:ie.opacity??1,vectorEffect:`non-scaling-stroke`})]}):null,Ye&&Ye.width>0&&Ye.height>0?(0,Z.jsx)(`rect`,{className:`chart-zoom-selection`,x:Ye.x,y:Ye.y,width:Ye.width,height:Ye.height,vectorEffect:`non-scaling-stroke`,pointerEvents:`none`}):null,ve.map((e,t)=>(0,Z.jsx)(`text`,{className:`chart-tick-label`,x:L.sx(e),y:ze,textAnchor:t===0?`start`:t===ve.length-1?`end`:`middle`,children:JG(e,be)},`x-label-${e}`)),z.map(e=>(0,Z.jsx)(`text`,{className:`chart-tick-label`,x:Be,y:L.sy(e)+3,textAnchor:`end`,children:JG(e,B)},`y-label-${e}`)),(0,Z.jsx)(`text`,{className:`chart-axis-label`,x:(L.plotLeft+L.plotRight)/2,y:V,textAnchor:`middle`,children:o??oK(i)}),(0,Z.jsx)(`text`,{className:`chart-axis-label`,x:13,y:(L.plotTop+L.plotBottom)/2,textAnchor:`middle`,transform:`rotate(-90 13 ${(L.plotTop+L.plotBottom)/2})`,children:s??oK(a)})]}),F?(0,Z.jsxs)(`div`,{className:`chart-settings-popover`,style:{left:F.x,top:F.y},role:`dialog`,"aria-label":`Chart scale settings`,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`chart-settings-head`,children:[(0,Z.jsx)(ye,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`strong`,{children:`Chart scale`})]}),lt(`x`,`X axis`,L.xMin,L.xMax,be),lt(`y`,`Y axis`,L.yMin,L.yMax,B),(0,Z.jsx)(`button`,{type:`button`,className:`chart-settings-reset`,onClick:ct,children:`Reset autoscale`})]}):null]}),b||m?(0,Z.jsx)(`div`,{className:m?`legend legend-chart-separate`:`legend`,children:M.map(e=>(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`i`,{style:{backgroundColor:e.color,opacity:e.opacity}}),e.label]},`legend-${e.key}`))}):null,g?null:(0,Z.jsx)(`div`,{className:`chart-analysis-grid`,style:Ve,children:_===`range-extrema`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`chart-gradient-label`,children:`Max${Fe}`}),Ie.map(e=>ut(e,`max-${e.key}`,e.maxValue,`Max${Fe}`)),(0,Z.jsx)(`span`,{className:`chart-gradient-label`,children:`Min${Fe}`}),Le.map(e=>ut(e,`min-${e.key}`,e.minValue,`Min${Fe}`)),(0,Z.jsx)(`span`,{className:`chart-gradient-label`,children:`Non_Uniformity${Fe}`}),Re.map(e=>ut(e,`non-uniformity-${e.key}`,e.nonUniformity,`Non_Uniformity${Fe}`))]}):(0,Z.jsxs)(Z.Fragment,{children:[y&&Pe.length>0?Pe.flatMap(e=>[(0,Z.jsx)(`span`,{className:`chart-gradient-label`,children:`${ke} - ${ER(e.role)}`},`static-label-${e.role}`),...e.staticEntries.map(t=>ut(t,`static-${e.role}-${t.key}`,t.staticValue,`${ke} - ${ER(e.role)}`)),(0,Z.jsx)(`span`,{className:`chart-gradient-label`,children:`${je} - ${ER(e.role)}`},`gradient-label-${e.role}`),...e.gradientEntries.map(t=>ut(t,`gradient-${e.role}-${t.key}`,t.gradient,`${je} - ${ER(e.role)}`))]):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`chart-gradient-label`,children:ke}),Me.map(e=>ut(e,`static-${e.key}`,e.staticValue,ke)),(0,Z.jsx)(`span`,{className:`chart-gradient-label`,children:je}),Ne.map(e=>ut(e,`gradient-${e.key}`,e.gradient,je))]}),_===`static-gradient-nonuniformity`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`chart-gradient-label`,children:`Non-Uniformity (Max - Min) [deg]`}),Re.map(e=>ut(e,`non-uniformity-${e.key}`,e.nonUniformity,`Non-Uniformity (Max - Min) [deg]`))]}):null]})}),ie?(0,Z.jsxs)(`div`,{className:`chart-cursor-readout`,"aria-label":`${ie.seriesLabel} | ${He}: ${qe} | ${Ue}: ${Je}`,title:ie.seriesLabel,children:[(0,Z.jsx)(`i`,{style:{backgroundColor:Ge,opacity:Ke}}),(0,Z.jsx)(`span`,{children:`X`}),(0,Z.jsx)(`strong`,{children:qe}),(0,Z.jsx)(`span`,{children:`Y`}),(0,Z.jsx)(`strong`,{children:Je})]}):null]})}var EK=.01,DK=.1,OK=374,kK=8;function AK(e){return`minmax(0, 1fr) minmax(66px, auto)${e?` minmax(66px, auto) minmax(66px, auto)`:``}`}function jK(){return typeof window>`u`?{x:18,y:88}:{x:Math.max(kK,window.innerWidth-OK-18),y:88}}function MK(e,t=1){return e==null||e===``?``:typeof e==`string`?e:Number.isFinite(e)?e.toFixed(t).replace(/\.?0+$/,``):``}function NK(e,t){if(typeof e!=`number`||typeof t!=`number`||!Number.isFinite(e)||!Number.isFinite(t))return``;let n=e-t;return Math.abs(n)<1e-9?``:n}function PK(e,t,n){return(e?.find(e=>e.id===t)??null)?.rows.find(e=>e.label===n)??null}function FK(e,t){let n=Math.abs(e.bump)>1e-6,r=Math.abs(e.steer)>1e-6,i=Math.abs(e.roll)>1e-6;return!n&&!r&&!i?`static`:t===`bumpSteer`&&(n||r)?`bumpSteer`:t===`roll`&&i?`roll`:t===`steer`&&r?`steer`:n?`bump`:i?`roll`:`steer`}function IK(e,t){let n=e.geometry.right.wheelCenter.x,r=t.outputs.wheelCenterX;return e.suspension.axlePosition.trim().toLowerCase()===`front`?e.vehicle.wheelbase-n+r:e.vehicle.wheelbase+n-r}function LK(e,t){return t===`right`?e.outputs:{...e.outputs,camber:-e.outputs.camber,toe:-e.outputs.toe,camberGradient:-e.outputs.camberGradient,toeGradient:-e.outputs.toeGradient,relativeCamber:-e.outputs.relativeCamber,wheelCenterY:-e.outputs.wheelCenterY}}function RK(e,t){return t===`left`?oG(e.pose):e.pose}function zK(e,t){return t===`left`?Sf(e.rightCorner):e.rightCorner}function BK(e,t){return 0-Xh(e,t).z}function VK(e,t,n,r){return Vf(e,t,n,r)}function HK(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||Math.abs(t)<1e-9?``:e/t}function UK(e,t,n){let r=t.elementState,i=n.elementState,a=r?.heaveLeft??e.elements.heaveLeft,o=i?SU(i.heaveLeft):r?.heaveRight??e.elements.heaveRight,
4407s=r?.rollLeft??e.elements.rollLeft,c=i?.rollRight??r?.rollRight??e.elements.rollRight;return{heaveSpring:e.elements.heaveSpring?HH(a,o):``,rollSpring:e.elements.rollSpring?HH(s,c):``}}function WK(e,t,n,r){let i=UK(e,t,n),a=A_(e,{bump:r.bump+EK,steer:r.steer,roll:r.roll}),o=UK(e,a.rightFrame,a.leftFrame),s=A_(e,{bump:r.bump,steer:r.steer,roll:r.roll+DK}),c=UK(e,s.rightFrame,s.leftFrame);return{heaveSpringMotionRatioBump:typeof i.heaveSpring==`number`&&typeof o.heaveSpring==`number`?HK(EK,i.heaveSpring-o.heaveSpring):``,rollSpringMotionRatioBump:typeof i.rollSpring==`number`&&typeof o.rollSpring==`number`?HK(EK,i.rollSpring-o.rollSpring):``,heaveSpringMotionRatioRoll:typeof i.heaveSpring==`number`&&typeof c.heaveSpring==`number`?HK(c.heaveSpring-i.heaveSpring,DK):``,rollSpringMotionRatioRoll:typeof i.rollSpring==`number`&&typeof c.rollSpring==`number`?HK(c.rollSpring-i.rollSpring,DK):``}}function GK(e,t,n,r){let i=Dg(e,t.outputs.toe,n.outputs.toe,r);return{steeringRatio:Number.isFinite(i.steeringRatio)?i.steeringRatio:``,ackermann:Number.isFinite(i.ackermann)?i.ackermann:``,meanRadius:Number.isFinite(i.meanRadius)?i.meanRadius:``}}function KK(e,t,n,r,i,a,o){return a===`static`?GK(e,r,i,.1):a===`steer`?GK(e,t,n,Math.abs(o.steer)):{steeringRatio:``,ackermann:``,meanRadius:``}}function qK(e,t,n,r){if(!r)return{antiDive:t.outputs.antiDive,antiLift:t.outputs.antiLift,antiSquat:t.outputs.antiSquat};let i=Tg(e,t.pose,n.pose,0,!0);return{antiDive:i.antiDive,antiLift:i.antiLift,antiSquat:i.antiSquat}}function JK(e,t,n,r,i,a,o,s){let c=`right`,l=LK(t,c),u=RK(t,c),d=zK(t,c),f=RK(n,c),p=zK(n,c),m=a===`roll`,h=a===`steer`,g=a===`bumpSteer`,_=a===`static`,v=BK(e,u),y=m?l.camber-o.roll:l.relativeCamber,b=m?``:VK(e,c,d,u),x=VK(e,c,p,f),S=_?x:b,C=m||h||g?{antiDive:``,antiLift:``,antiSquat:``}:qK(e,t,r,_),w=g?y_(e,0,Math.abs(o.steer),{useSteeringModel:!0}):null,T=w?LK(w,c).toe:null,E=bf(e);return[{label:`Camber [deg]`,value:l.camber,precision:2},{label:`Toe [deg]`,value:l.toe,precision:2},{label:`Caster [deg]`,value:m?``:l.caster},{label:`Kingpin [deg]`,value:m||g?``:l.kingpin},{label:`Kingpin Offset [mm]`,value:m||g?``:l.btt},{label:`Caster Trail [mm]`,value:m||g?``:l.btl},{label:`Kingpin Offset @WC [mm]`,value:m||g?``:l.btcr},{label:`Caster Trail @WC [mm]`,value:m||g?``:l.blcr},...E?[{label:`Spring length [mm]`,value:m||g?``:l.springLength}]:[],{label:`Rocker Angle [deg]`,value:m||g?``:l.rockerAngle},{label:`Heave spring length [mm]`,value:s.heaveSpring},{label:`Roll spring length [mm]`,value:s.rollSpring},{label:`RC Height to Ground [mm]`,value:m||h||g?``:l.rollCenterHeightGround},{label:`RC Distance to CG [mm]`,value:m||h||g?``:l.rollCenterDistanceToCg},{label:`RC Y [mm]`,value:m||h||g?``:l.rollCenterY},{label:`AntiDive [%]`,value:C.antiDive},{label:`AntiLift [%]`,value:C.antiLift},{label:`AntiSquat [%]`,value:C.antiSquat},{label:`SemiTrack [mm]`,value:Math.abs(l.wheelCenterY)},{label:`Wheelbase [mm]`,value:IK(e,t)},{label:`RideHeight [mm]`,value:v},{label:`Driveshaft Axial Shift [mm]`,value:S},{label:`Ackermann [%]`,value:i.ackermann},{label:`Avg Cornering Radius [m]`,value:h?i.meanRadius:``},{label:`CamberRel [deg]`,value:y},{label:`DeltaToe [deg]`,value:g&&T!==null?l.toe-T:``}]}function YK(e,t,n,r,i,a,o){let s=LK(t,`right`),c=bf(e),l=t,u=r===`static`||r===`bump`&&Math.abs(i.bump)>1e-6,d=i.bump<0?`Rebound`:`Bump`,f=a.heaveSpringMotionRatioBump===``?Number.isFinite(l.outputs.heaveSpringMotionRatio)&&r!==`roll`?l.outputs.heaveSpringMotionRatio:``:a.heaveSpringMotionRatioBump,p=a.rollSpringMotionRatioBump===``?Number.isFinite(l.outputs.rollSpringMotionRatio)&&r!==`roll`?l.outputs.rollSpringMotionRatio:``:a.rollSpringMotionRatioBump;return[...c?[{label:fR(`Spring MotionRatio`,`motionRatio`,`mm/mm`,o),value:oR(u?l.outputs.motionRatio:``,o),precision:2}]:[],{label:fR(`Rocker Angle MotionRatio`,`rockerMotionRatio`,`mm/deg`,o),value:oR(u?l.outputs.rockerMotionRatio:``,o),precision:2},{label:fR(`Heave s. Motion Ratio, bump`,`heaveSpringMotionRatio`,`mm/mm`,o),value:oR(f,o),precision:2},{label:fR(`Roll s. Motion Ratio, bump`,`rollSpringMotionRatio`,`mm/mm`,o),value:oR(p,o),precision:2},{label:fR(`Heave s. Motion Ratio, roll`,`heaveSpringMotionRatio`,`mm/deg`,o),value:oR(a.heaveSpringMotionRatioRoll,o),precision:2},{label:fR(`Roll s. Motion Ratio, roll`,`rollSpringMotionRatio`,`mm/deg`,o),value:oR(a.rollSpringMotionRatioRoll,o),precision:2},{label:`Steering ratio [SA/WA]`,value:n.steeringRatio},{label:`dCamber/d${d} [deg/10mm]`,value:u?s.camberGradient:``,precision:2},{label:`dToe/d${d} [deg/10mm]`,value:u?s.toeGradient:``,precision:2}]}function XK(e,t,n,r,i,a,o,s){let c=FK(a,o),l=c===`static`?r:t,u=KK(e,t,n,y_(e,0,.1,{useSteeringModel:!0}),y_(e,0,-.1,{useSteeringModel:!0}),c,a),d=UK(e,t,n),f=WK(e,t,n,a);return{modeLabel:c===`static`?`Static`:c===`bumpSteer`?`Bump steer`:hI.find(e=>
4407e.id===c)?.label??`Monitor`,sections:[{id:`monitor-primary`,title:``,rows:JK(e,l,r,i,u,c,a,d)},{id:`monitor-secondary`,title:`Gradients`,rows:YK(e,l,u,c,a,f,s)}]}}function ZK({modeLabel:e,sections:t,referenceSections:n,currentValueLabel:r=`Current value`,referenceValueLabel:i=`Reference`,highlightCurrentValueHeader:a=!1,useNeutralReferenceHeaders:o=!1,reverseDelta:s=!1,fullVehicleMode:c=!1,setupMode:l=!1,rockerMode:u=!1,motion:d,onClose:f,onDragPointerDown:p,onDragPointerMove:m,onDragPointerEnd:h}){return(0,Z.jsxs)(`div`,{className:`monitor-panel`,children:[(0,Z.jsxs)(`div`,{className:`output-toolbar monitor-toolbar${c?` monitor-toolbar-full-vehicle`:l?` monitor-toolbar-setup-mode`:u?` monitor-toolbar-rocker-mode`:``}`,onPointerDown:p,onPointerMove:m,onPointerUp:h,onPointerCancel:h,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(b,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Monitor`})]}),(0,Z.jsxs)(`div`,{className:`monitor-status`,"aria-label":`Current monitor motion`,children:[(0,Z.jsxs)(`span`,{children:[`Bump `,MK(d.bump),` mm`]}),(0,Z.jsxs)(`span`,{children:[`Steer `,MK(d.steer),` deg`]}),(0,Z.jsxs)(`span`,{children:[`Roll `,MK(d.roll),` deg`]})]}),f?(0,Z.jsx)(`button`,{type:`button`,className:`monitor-close-button`,"aria-label":`Close Monitor`,onClick:f,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})}):null]}),(0,Z.jsx)(`div`,{className:`monitor-grid`,children:t.map(e=>(0,Z.jsxs)(`section`,{className:`monitor-card compact-panel`,"aria-label":e.title,children:[e.title?(0,Z.jsx)(`div`,{className:`monitor-card-title`,children:e.title}):null,(0,Z.jsxs)(`div`,{className:`monitor-table`,role:`table`,children:[(0,Z.jsxs)(`div`,{className:`monitor-row monitor-row-header`,role:`row`,style:{gridTemplateColumns:AK(!!n)},children:[(0,Z.jsx)(`span`,{className:o?`monitor-row-header-neutral`:void 0,children:`Channel - LH wheel`}),(0,Z.jsx)(`span`,{className:a?`monitor-row-header-current-setup`:void 0,children:r}),n?(0,Z.jsx)(`span`,{className:u?`monitor-row-header-rocker-mode monitor-row-header-reference`:o?`monitor-row-header-neutral monitor-row-header-reference`:`monitor-row-header-reference`,children:i}):null,n?(0,Z.jsx)(`span`,{className:o?`monitor-row-header-neutral monitor-row-header-delta`:`monitor-row-header-delta`,children:`Delta`}):null]}),e.rows.map(t=>{let r=(n?.find(t=>t.id===e.id)??null)?.rows.find(e=>e.label===t.label)??null,i=n?s?NK(r?.value,t.value):NK(t.value,r?.value):``;return(0,Z.jsxs)(`div`,{className:`monitor-row`,role:`row`,style:{gridTemplateColumns:AK(!!n)},children:[(0,Z.jsx)(`span`,{children:t.label}),(0,Z.jsx)(`span`,{className:`monitor-row-value`,children:MK(t.value,t.precision)}),n?(0,Z.jsx)(`span`,{className:`monitor-row-value`,children:MK(r?.value,r?.precision??t.precision)}):null,n?(0,Z.jsx)(`span`,{className:`monitor-row-value`,children:MK(i,t.precision)}):null]},t.label)})]})]},e.id))})]})}
4407function QK({seriesSet:e,mode:t,extraChart:n,bumpAxisOrientation:r=`y`,axisOverride:i,descriptors:a,chartOrder:o,analysisSeriesLabelVariant:s=`default`,showLegend:c=!0,expandedChartKey:l=null,onToggleChartExpand:u,pinKeyPrefix:d,pinnedChartIds:f,onPinChart:p,onRefreshPinnedChart:m,customGraphKeys:h,onAddToCustom:g}){let _=tG(a??nG(t,e,r,n,i),o),v=l?_.filter(e=>e.key===l):_;return(0,Z.jsx)(`div`,{className:`output-chart-grid${l?` output-chart-grid-expanded`:``}`,children:v.map((e,n)=>{let r=`${d??t}-${e.key}`,i=dW(t,e.x,e.y);return(0,Z.jsx)(TK,{chartKey:e.key,seriesSet:e.seriesSet,title:e.title,chartIndex:n+1,x:e.x,y:e.y,xAxisLabelOverride:e.xAxisLabelOverride,yAxisLabelOverride:e.yAxisLabelOverride,analysisChannel:e.analysisChannel,analysisAxisChannel:e.analysisAxisChannel,analysisZeroLabel:e.analysisZeroLabel,analysisSeriesKeys:e.analysisSeriesKeys,analysisSeriesLabelVariant:s,legendSeriesKeys:e.legendSeriesKeys,forceLegend:e.forceLegend,hideAnalysisRows:e.hideAnalysisRows,analysisSummaryMode:e.analysisSummaryMode,replaceGradientWithAverage:e.replaceGradientWithAverage,analysisRoleRows:e.analysisRoleRows,showLegend:c,expanded:e.key===l,onToggleExpand:u,chartPinKey:r,pinActive:f?.has(r)??!1,onPinChart:p,onRefreshPinnedChart:m,customGraph:i,customActive:h?.has(oW(i))??!1,onAddToCustom:g},e.key)})})}function $K({graphs:e,layoutName:t,onGraphsChange:n,seriesSetForMode:r,channelsForMode:i=(e,t=fL)=>sV(e,t),bumpAxisOrientation:a=`y`,motionRatioMode:o=fL,analysisSeriesLabelVariant:s=`default`,showLegend:c=!0,expandedChartKey:l=null,onToggleChartExpand:u,pinKeyPrefix:d,pinnedChartIds:f,onPinChart:p,onRefreshPinnedChart:m,onSaveLayout:g,canSaveLayout:_=!1,onExportLayoutLocal:v,onImportLayoutLocal:y,onExportLayoutWorkspace:b,onExportLayoutWorkspaceAsNew:x,onImportLayoutWorkspace:S,onArrangeGraphs:C}){let w=aW(e),E=vW(t),[D,O]=(0,h.useState)(()=>tW(`bump`)),k=lW(i(D.mode,o),D.extraChannels),A=l?w.map((e,t)=>({graph:e,index:t,chartKey:`custom-chart-${t}`})).filter(e=>e.chartKey===l):w.map((e,t)=>({graph:e,index:t,chartKey:`custom-chart-${t}`}));
4407function j(e){n(w.filter((t,n)=>n!==e))}function te(e){O(tW(e))}function M(){n(fW(w,D))}return(0,Z.jsxs)(`div`,{className:`custom-output`,children:[l?null:(0,Z.jsxs)(`div`,{className:`custom-output-toolbar`,children:[(0,Z.jsxs)(`div`,{className:`custom-output-toolbar-title`,children:[(0,Z.jsx)(T,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Custom layout`}),(0,Z.jsx)(`span`,{className:`custom-output-layout-name`,title:E??`Unsaved layout`,children:E??`Unsaved layout`})]}),(0,Z.jsxs)(`div`,{className:`custom-output-toolbar-actions`,children:[C?(0,Z.jsxs)(`button`,{type:`button`,onClick:C,disabled:w.length<2,children:[(0,Z.jsx)(be,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Arrange`})]}):null,g?(0,Z.jsxs)(`button`,{type:`button`,onClick:g,disabled:!_,children:[(0,Z.jsx)(ve,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Save`})]}):null,v?(0,Z.jsxs)(`button`,{type:`button`,onClick:v,disabled:w.length===0,children:[(0,Z.jsx)(ve,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Export .cgr`})]}):null,y?(0,Z.jsxs)(`button`,{type:`button`,onClick:y,children:[(0,Z.jsx)(ie,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Import .cgr`})]}):null,b?(0,Z.jsx)(`span`,{className:`beta-unavailable-control`,"data-ui-tooltip":XF,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:b,disabled:!0,children:[(0,Z.jsx)(ee,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Cloud save`})]})}):null,x?(0,Z.jsx)(`span`,{className:`beta-unavailable-control`,"data-ui-tooltip":XF,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:x,disabled:!0,children:[(0,Z.jsx)(P,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Cloud save as new`})]})}):null,S?(0,Z.jsx)(`span`,{className:`beta-unavailable-control`,"data-ui-tooltip":XF,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:S,disabled:!0,children:[(0,Z.jsx)(ie,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Cloud import`})]})}):null]})]}),l?null:(0,Z.jsxs)(`div`,{className:`custom-graph-composer`,children:[(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Source`}),(0,Z.jsx)(`select`,{value:D.mode,onChange:e=>te(e.target.value),children:hI.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`X axis`}),(0,Z.jsx)(`select`,{value:D.xKey,onChange:e=>O(t=>({...t,xKey:e.target.value})),children:k.map(e=>(0,Z.jsx)(`option`,{value:e.key,children:e.label},e.key))})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Y axis`}),(0,Z.jsx)(`select`,{value:D.yKey,onChange:e=>O(t=>({...t,yKey:e.target.value})),children:k.map(e=>(0,Z.jsx)(`option`,{value:e.key,children:e.label},e.key))})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`custom-graph-add-button`,onClick:M,children:[(0,Z.jsx)(ge,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Add`})]})]}),!l&&w.length===0?(0,Z.jsxs)(`div`,{className:`custom-output-empty`,children:[(0,Z.jsx)(`strong`,{children:`No custom charts yet`}),(0,Z.jsx)(`span`,{children:`Select source, X and Y, then press Add.`})]}):null,(0,Z.jsx)(`div`,{className:`output-chart-grid${l?` output-chart-grid-expanded`:``}`,children:A.map(({graph:e,index:t,chartKey:n})=>{let h=lW(i(e.mode,o),e.extraChannels),{x:g,y:_}=TW(e,a,o,h),v=eW(e.mode,e.xKey,h,o),y=eW(e.mode,e.yKey,h,o),b=pW(e,h,o),x=`${d??`custom`}-${n}-${e.mode}-${g.key}-${_.key}`;return(0,Z.jsx)(TK,{chartKey:n,seriesSet:r(e.mode),title:b,chartIndex:t+1,x:g,y:_,analysisChannel:v.key===`bump`&&y.key!==`bump`?y:y.key===`bump`&&v.key!==`bump`?v:null,analysisSeriesLabelVariant:s,showLegend:c,expanded:n===l,onToggleExpand:u,chartPinKey:x,pinActive:f?.has(x)??!1,onPinChart:p,onRefreshPinnedChart:m,onRemoveChart:()=>j(t)},n)})})]})}var eq=760,tq=640,nq=8;function rq(){if(typeof window>`u`)return{x:18,y:72};let e=Math.min(eq,window.innerWidth-nq*2);return{x:Math.max(nq,window.innerWidth-e-18),y:Math.max(nq,Math.min(72,window.innerHeight-nq))}}function iq({modeLabel:e,items:t,draftOrder:n,onDraftOrderChange:r,onClose:i,onApply:a,onReset:o}){let[s,c]=(0,h.useState)(null),l=(0,h.useMemo)(()=>new Map(t.map(e=>[e.key,e])),[t]),u=(0,h.useMemo)(()=>n.map(e=>l.get(e)).filter(e=>!!e),[n,l]),d=(0,h.useCallback)((e,t)=>{let i=n.indexOf(e),a=i+t;if(i<0||a<0||a>=n.length)return;let o=[...n];[o[i],o[a]]=[o[a],o[i]],r(o)},[n,r]),f=(0,h.useCallback)((e,t)=>{let i=n.indexOf(e);if(i<0||t<0||t>=n.length||i===t)return;let a=[...n];a.splice(i,1),a.splice(t,0,e),r(a)},[n,r]);return(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};
4407return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,Z.jsx)(`div`,{className:`report-table-overlay`,role:`presentation`,onClick:e=>e.target===e.currentTarget&&i(),children:(0,Z.jsxs)(`section`,{className:`report-table-dialog chart-arrange-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`chart-arrange-title`,children:[(0,Z.jsxs)(`header`,{className:`report-table-dialog-head`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`chart-arrange-title`,children:`Arrange charts`}),(0,Z.jsxs)(`p`,{children:[e,` analysis chart order.`]})]}),(0,Z.jsxs)(`div`,{className:`report-table-dialog-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:o,children:[(0,Z.jsx)(R,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Reset default`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:a,children:[(0,Z.jsx)(E,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Apply`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-close-button`,"aria-label":`Close arrange charts`,onClick:i,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]})]}),(0,Z.jsx)(`div`,{className:`chart-arrange-list`,role:`list`,"aria-label":`${e} chart order`,children:u.map((e,t)=>(0,Z.jsxs)(`div`,{className:`chart-arrange-row${s===e.key?` is-dragging`:``}`,role:`listitem`,draggable:!0,onDragStart:()=>c(e.key),onDragEnd:()=>c(null),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),s&&f(s,t),c(null)},children:[(0,Z.jsxs)(`div`,{className:`chart-arrange-row-main`,children:[(0,Z.jsx)(`span`,{className:`chart-arrange-drag`,"aria-hidden":`true`,children:(0,Z.jsx)(se,{size:14})}),(0,Z.jsxs)(`strong`,{children:[t+1,`.`]}),(0,Z.jsx)(`span`,{children:e.title})]}),(0,Z.jsxs)(`div`,{className:`chart-arrange-row-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>
4407d(e.key,-1),disabled:t===0,children:`Up`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>d(e.key,1),disabled:t===u.length-1,children:`Down`})]})]},e.key))})]})})}function aq({frame:e,viewportLogEntries:t}){let n=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let e=n.current;e&&(e.scrollTop=0)},[t]),(0,Z.jsxs)(`div`,{className:`solver-status`,children:[(0,Z.jsxs)(`div`,{className:`solver-summary`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(w,{size:16,"aria-hidden":`true`}),`Newton 6D core`]}),(0,Z.jsx)(`strong`,{children:e.converged?`Solved`:`Check residual`})]}),(0,Z.jsx)(`div`,{className:`live-output`,"aria-label":`Current solved values`,children:(0,Z.jsxs)(`span`,{children:[`Residual`,(0,Z.jsx)(`strong`,{children:e.residual.toExponential(1)})]})}),(0,Z.jsxs)(`div`,{className:`channel-grid`,"aria-label":`Mapped output channels`,children:[(0,Z.jsxs)(`span`,{children:[`Bump `,Ay.length]}),(0,Z.jsxs)(`span`,{children:[`Anti `,jy.length]}),(0,Z.jsxs)(`span`,{children:[`Steer `,My.length]}),(0,Z.jsxs)(`span`,{children:[`Roll `,Py.length]}),(0,Z.jsxs)(`span`,{children:[`Bump steer `,Fy.length]})]}),(0,Z.jsx)(`ol`,{className:`solver-steps`,children:Ry.map(e=>(0,Z.jsx)(`li`,{children:e},e))}),(0,Z.jsxs)(`div`,{className:`run-verify-output`,children:[(0,Z.jsx)(`div`,{className:`run-verify-output-title`,children:`Application log`}),t.length>0?(0,Z.jsx)(`ol`,{className:`solver-steps app-log-list`,ref:n,reversed:!0,start:t.length,children:[...t].reverse().map((e,t)=>(0,Z.jsx)(`li`,{children:e},`${e}-${t}`))}):(0,Z.jsx)(`p`,{children:`No log entries yet.`})]})]})}function oq({rows:e,draft:t,activeCell:n,onCellActivate:r,onCellChange:i}){return(0,Z.jsxs)(`div`,{className:`tabular-geometry-sheet`,role:`grid`,"aria-label":`Tabular geometry input`,children:[(0,Z.jsxs)(`div`,{className:`tabular-geometry-sheet-row tabular-geometry-sheet-header`,role:`row`,children:[(0,Z.jsx)(`span`,{role:`columnheader`,children:`#`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Component`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Position`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Chassis X`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Chassis Y`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Chassis Z`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Wheel X`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Wheel Y`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Wheel Z`})]}),e.map((e,a)=>(0,Z.jsxs)(`div`,{className:`tabular-geometry-sheet-row`,role:`row`,children:[(0,Z.jsx)(`span`,{className:`tabular-geometry-sheet-index`,role:`rowheader`,children:e.index}),(0,Z.jsx)(`span`,{className:`tabular-geometry-sheet-label`,title:e.component,children:e.component}),(0,Z.jsx)(`span`,{className:`tabular-geometry-sheet-position`,title:e.position,children:e.position}),[`x`,`y`,`z`].map(o=>{let s=e.chassis[o],c=zH(`chassis`,o),l=n?.rowIndex===a&&n?.slotIndex===c;return(0,Z.jsx)(`span`,{className:`tabular-geometry-sheet-cell`,role:`gridcell`,children:s?(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,className:`tabular-geometry-sheet-input${l?` is-active`:``}${s.committable?``:` is-disabled`}`,value:CH(s,t),onFocus:()=>r(a,c),onClick:()=>r(a,c),onChange:e=>i(s.fieldKey,e.target.value)}):(0,Z.jsx)(`span`,{className:`tabular-geometry-sheet-empty`,"aria-hidden":`true`})},`${e.key}-chassis-${o}`)}),[`x`,`y`,`z`].map(o=>{let s=e.wheel[o],c=zH(`wheel`,o),l=n?.rowIndex===a&&n?.slotIndex===c;return(0,Z.jsx)(`span`,{className:`tabular-geometry-sheet-cell`,role:`gridcell`,children:s?(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,className:`tabular-geometry-sheet-input${l?` is-active`:``}${s.committable?``:` is-disabled`}`,value:CH(s,t),onFocus:()=>r(a,c),onClick:()=>r(a,c),onChange:e=>i(s.fieldKey,e.target.value)}):(0,Z.jsx)(`span`,{className:`tabular-geometry-sheet-empty`,"aria-hidden":`true`})},`${e.key}-wheel-${o}`)})]},`sheet-row-${e.key}`))]})}function sq({draftSelection:e,availableItemsByMode:t,onDraftSelectionChange:n,onClose:r,onContinue:i,onReset:a}){let[o,s]=(0,h.useState)(e[0]?.mode??hI[0].id),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(e[0]?bR(e[0]):null),[f,p]=(0,h.useState)(!1),m=(0,h.useMemo)(()=>new Map(hI.flatMap(e=>t[e.id].map(e=>[e.key,e]))),[t]),g=(0,h.useMemo)(()=>e.map(e=>m.get(bR(e))).filter(e=>!!e),[e,m]),_=(0,h.useMemo)(()=>new Set(e.map(e=>bR(e))),[e]),v=(0,h.useMemo)(()=>t[o].filter(e=>!_.has(e.key)),[t,_,o]),y=(0,h.useCallback)(t=>{let r=bR(t);e.some(e=>bR(e)===r)||(n([...e,t]),d(r),l(null))},[e,n]),b=(0,h.useCallback)(t=>{n(e.filter(e=>bR(e)!==t)),d(e=>e===t?null:e)},[e,n]),x=(0,h.useCallback)(()=>
4407{if(!c)return;let e=m.get(c);e&&y({mode:e.mode,chartKey:e.chartKey})},[c,y,m]),S=(0,h.useCallback)(()=>{u&&b(u)},[u,b]),C=(0,h.useCallback)(t=>{if(!u)return;let r=e.findIndex(e=>bR(e)===u),i=r+t;if(r<0||i<0||i>=e.length)return;let a=[...e];[a[r],a[i]]=[a[i],a[r]],n(a)},[u,e,n]);return(0,h.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(f){p(!1);return}r()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,f]),(0,Z.jsx)(`div`,{className:`report-table-overlay`,role:`presentation`,onClick:e=>e.target===e.currentTarget&&r(),children:(0,Z.jsxs)(`section`,{className:`report-table-dialog chart-arrange-dialog chart-select-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`chart-select-title`,children:[(0,Z.jsxs)(`header`,{className:`report-table-dialog-head`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`chart-select-title`,children:`Select charts`}),(0,Z.jsx)(`p`,{children:`Build the Selection output by picking charts from the other analysis tabs.`})]}),(0,Z.jsx)(`div`,{className:`report-table-dialog-actions`,children:(0,Z.jsx)(`button`,{type:`button`,className:`report-table-close-button`,"aria-label":`Close select charts`,onClick:r,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})})]}),(0,Z.jsxs)(`div`,{className:`chart-select-layout`,children:[(0,Z.jsxs)(`div`,{className:`chart-select-column`,children:[(0,Z.jsxs)(`label`,{className:`chart-select-source`,children:[(0,Z.jsx)(`span`,{children:`Source tab`}),(0,Z.jsx)(`select`,{value:o,onChange:e=>s(e.target.value),children:hI.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,Z.jsx)(`div`,{className:`chart-select-pane`,role:`list`,"aria-label":`${o} charts available for selection`,children:v.length>0?v.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:`chart-select-row${c===e.key?` is-active`:``}`,"aria-pressed":c===e.key,onClick:()=>l(e.key),onDoubleClick:()=>y({mode:e.mode,chartKey:e.chartKey}),children:(0,Z.jsx)(`span`,{children:e.title})},e.key)):(0,Z.jsx)(`div`,{className:`chart-select-empty`,children:`No more charts available in this tab.`})})]}),(0,Z.jsxs)(`div`,{className:`chart-select-transfer-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:x,disabled:!c,children:(0,Z.jsx)(`span`,{children:`Add >`})}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:S,disabled:!u,children:(0,Z.jsx)(`span`,{children:`Remove <`})})]}),(0,Z.jsxs)(`div`,{className:`chart-select-column`,children:[(0,Z.jsx)(`div`,{className:`chart-select-pane chart-select-pane-selected`,role:`list`,"aria-label":`Selected charts`,children:g.length>0?g.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`chart-select-row${u===e.key?` is-active`:``}`,"aria-pressed":u===e.key,onClick:()=>
4407d(e.key),onDoubleClick:()=>b(e.key),children:[(0,Z.jsx)(`strong`,{children:e.modeLabel}),(0,Z.jsx)(`span`,{children:e.title})]},e.key)):(0,Z.jsx)(`div`,{className:`chart-select-empty`,children:`No charts selected yet.`})}),(0,Z.jsxs)(`div`,{className:`chart-select-order-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:()=>C(-1),disabled:!u,children:(0,Z.jsx)(`span`,{children:`Move up`})}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:()=>C(1),disabled:!u,children:(0,Z.jsx)(`span`,{children:`Move down`})})]})]})]}),(0,Z.jsxs)(`div`,{className:`chart-select-footer`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:()=>p(!0),children:[(0,Z.jsx)(R,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Reset`})]}),(0,Z.jsxs)(`div`,{className:`chart-select-footer-primary`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:r,children:(0,Z.jsx)(`span`,{children:`Cancel`})}),(0,Z.jsxs)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:i,children:[(0,Z.jsx)(E,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Continue`})]})]})]}),f?(0,Z.jsx)(`div`,{className:`chart-select-warning-backdrop`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`chart-select-warning`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`chart-select-reset-title`,children:[(0,Z.jsx)(`h3`,{id:`chart-select-reset-title`,children:`Reset Selection?`}),(0,Z.jsx)(`p`,{children:`This will remove all selected charts from the Selection tab.`}),(0,Z.jsxs)(`div`,{className:`chart-select-warning-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:()=>p(!1),children:(0,Z.jsx)(`span`,{children:`Cancel`})}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:()=>{a(),l(null),d(null),p(!1)},children:(0,Z.jsx)(`span`,{children:`Reset`})})]})]})}):null]})})}function cq({offsetDraft:e,onOffsetDraftChange:t,onFlipAxis:n,onApplyOffset:r}){return(0,Z.jsxs)(`div`,{className:`geometry-tabular-input-toolbar`,"aria-label":`Tabular geometry bulk operations`,children:[(0,Z.jsx)(`p`,{className:`geometry-tabular-input-toolbar-note`,children:`Cumulative transformations on the current draft, applied to all hardpoints separately for X, Y and Z.`}),(0,Z.jsx)(`div`,{className:`geometry-tabular-input-toolbar-grid`,children:[`x`,`y`,`z`].map(i=>(0,Z.jsxs)(`div`,{className:`geometry-tabular-axis-tools`,children:[(0,Z.jsx)(`span`,{className:`geometry-tabular-axis-label`,children:i.toUpperCase()}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:()=>n(i),children:(0,Z.jsx)(`span`,{children:`Flip sign`})}),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,className:`geometry-tabular-axis-offset-input`,value:e[i],placeholder:`Offset`,"aria-label":`${i.toUpperCase()} offset`,onChange:e=>t(i,e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),r(i))}}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:()=>r(i),children:(0,Z.jsx)(`span`,{children:`Apply`})})]},`tabular-axis-tools-${i}`))})]})}function lq({document:e,motion:t,animationSpeedPercent:n,groundFixed:r,animationMode:i,isPlaying:a,onActivateMode:o,onAnimationSpeedChange:s,onGroundFixedChange:c,onPrepareMotionCache:l,onMotionChange:u,onResetMotion:d,steerDisabled:f=!1,disabledModes:p=new Set,floating:m=!1,onDragPointerDown:h,onDragPointerMove:g,onDragPointerEnd:_}){let v=Cf(e.run,Math.abs(e.geometry.right.wheelCenter.y)),y=wf(e.run),x=Math.abs(v.max-v.min)>1e-9?(v.max-v.min)/y:void 0,S=a||Math.abs(t.bump)>1e-9||Math.abs(t.steer)>1e-9||Math.abs(t.roll)>1e-9;return(0,Z.jsxs)(`aside`,{className:`animation-sidebar${m?` animation-sidebar-floating`:``}`,"data-product-tour":m?void 0:`animation`,children:[(0,Z.jsxs)(`div`,{className:`motion-header`,children:[(0,Z.jsxs)(`div`,{className:`section-title${m?` animation-floating-drag-handle`:``}`,onPointerDown:h,onPointerMove:g,onPointerUp:_,onPointerCancel:_,children:[(0,Z.jsx)(b,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Animation`})]}),(0,Z.jsxs)(`div`,{className:`motion-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`round-button animation-reset-button${S?` is-needed`:``}`,"aria-label":`Reset sliders`,"aria-pressed":S,onClick:d,children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Reset`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`animation-reference-toggle${r?` active`:``}`,"aria-pressed":r,onClick:()=>c(!r),children:`Ground fixed`})]})]}),(0,Z.jsx)(`div`,{className:`mode-buttons`,role:`radiogroup`,"aria-label":`Animation mode`,children:gI.map(e=>{let t=i===e.id,n=t&&a,r=p.has(e.id)||f&&(e.id===`steer`||e.id===`bumpSteer`),s=p.has(e.id)?`${e.label} animation is disabled in Run Parameters.`:`${e.label}
4407 animation is disabled when the Full vehicle primary axle is rear.`;return(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":t,"aria-label":r?s:`${n?`Stop`:`Play`} ${e.label}`,title:r?s:void 0,disabled:r,onClick:()=>{o(e.id)},children:[n?(0,Z.jsx)(xe,{size:10,"aria-hidden":`true`}):(0,Z.jsx)(L,{size:11,"aria-hidden":`true`}),e.label]},e.id)})}),(0,Z.jsxs)(`div`,{className:`motion-grid`,children:[(0,Z.jsx)(rV,{label:`Bump`,value:t.bump,disabled:p.has(`bump`),min:-e.run.reboundMax,max:e.run.bumpMax,unit:`mm`,showZeroReference:!0,onInteractionStart:()=>l(`bump`),onChange:e=>u({bump:e})}),(0,Z.jsx)(rV,{label:`Steer`,value:t.steer,disabled:f||p.has(`steer`),min:-e.run.steeringWheelAngleMax,max:e.run.steeringWheelAngleMax,unit:`deg`,showZeroReference:!0,onInteractionStart:()=>l(`steer`),onChange:e=>u({steer:e})}),(0,Z.jsx)(rV,{label:`Roll`,value:t.roll,disabled:p.has(`roll`),min:v.min,max:v.max,step:x,unit:`deg`,showZeroReference:!0,onInteractionStart:()=>l(`roll`),onChange:e=>u({roll:e})})]}),(0,Z.jsx)(rV,{label:`Animation speed`,value:n,min:_I,max:vI,step:1,unit:`%`,displayValue:`${Math.round(n)}%`,onChange:s})]})}function uq(){let e=new URLSearchParams(window.location.search).get(`report`);return CI.some(t=>t.id===e)?e:null}function dq(){return`shim`}function fq(e){return`none`}function pq(e){let t=window.location.pathname;return`${!(window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`)&&t.endsWith(`/`)?`${t}index.php`:t}?report=${e}`}function mq(e,t){t.querySelectorAll(`style, link[rel='stylesheet']`).forEach(e=>e.remove()),e.querySelectorAll(`style, link[rel='stylesheet']`).forEach(e=>{t.head.appendChild(e.cloneNode(!0))})}function hq({ariaLabel:e,value:t,options:n,onChange:r}){return(0,Z.jsx)(`div`,{className:`segmented report-topbar-segmented`,role:`group`,"aria-label":e,children:n.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:`report-topbar-segmented-button`,"aria-pressed":t===e.value,onClick:()=>r(e.value),children:(0,Z.jsx)(`span`,{children:e.label})},e.value))})}function gq(e){return e===`template`||e===`local`||e===`workspace`||e===`new`}function _q(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.fileName==`string`&&typeof t.text==`string`}function vq(){try{let e=window.localStorage.getItem(VI);if(e){let t=JSON.parse(e),n=aW(t.customGraphs??(t.customGraph?[t.customGraph]:void 0)),r=vW(t.customGraphLayoutName);return{spmText:t.spmText??Nw,sourceName:t.sourceName??`Double_Wishbone.spm`,customGraphLayoutName:r,customGraphLayoutSource:yW(t.customGraphLayoutSource)?t.customGraphLayoutSource:null,customGraphLayoutSavedSignature:typeof t.customGraphLayoutSavedSignature==`string`?t.customGraphLayoutSavedSignature:r?sW(n):null,customGraphs:n,previousGeometry:t.previousGeometry??null,referenceGeometry:t.referenceGeometry??null,secondaryGeometry:t.secondaryGeometry??null}}}catch{}return{spmText:Nw,sourceName:`Double_Wishbone.spm`,customGraphLayoutName:null,customGraphLayoutSource:null,customGraphLayoutSavedSignature:null,customGraphs:[],previousGeometry:null,referenceGeometry:null,secondaryGeometry:null}}function yq(e){window.localStorage.setItem(VI,JSON.stringify(e));try{let t=new BroadcastChannel(HI);t.postMessage(e),t.close()}catch{window.dispatchEvent(new StorageEvent(`storage`,{key:VI,newValue:JSON.stringify(e)}))}}function bq(){try{let e=window.localStorage.getItem(WI);if(!e)return null;let t=JSON.parse(e);if(typeof t.spmText!=`string`||typeof t.sourceName!=`string`)return null;let n=t.lastSavedSpmText;if(n!==null&&typeof n!=`string`)return null;let r=gq(t.sourceKind)?t.sourceKind:void 0,i=_q(t.tyreProfile)?t.tyreProfile:null;return{spmText:t.spmText,sourceName:t.sourceName,lastSavedSpmText:n,sourceKind:r,tyreProfile:i}}catch{return null}}function xq(e){try{window.localStorage.setItem(WI,JSON.stringify(e))}catch{}}function Sq({view:e}){let t=e===`fullVehicleSelection`,n=e===`selection`||t,[r,i]=(0,h.useState)(()=>vq()),[a]=(0,h.useState)(()=>CR()),[o,s]=(0,h.useState)(a.columns),[c,l]=(0,h.useState)(a.chartSize),[u,d]=(0,h.useState)(a.showPrevious),[f,p]=(0,h.useState)(t?!0:a.showReference),[m,g]=(0,h.useState)(a.bumpAxisOrientation),[_,v]=(0,h.useState)(a.steerAxisMode),[y,b]=(0,h.useState)(a.steerChartSideMode),[x,S]=(0,h.useState)(`bump`),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(!1),[D,O]=(0,h.useState)(a.chartOrderByMode),[k,A]=(0,h.useState)([]),[j,ee]=(0,h.useState)([]),[M,ne]=(0,h.useState)(t?a.fullVehicleSelectionCharts:a.selectionCharts
4407),[N,P]=(0,h.useState)(!1),[re,ie]=(0,h.useState)([]),[ae,oe]=(0,h.useState)(!1),[se,F]=(0,h.useState)(`normal`),[ce,le]=(0,h.useState)(`idle`),[ue,I]=(0,h.useState)(null),[de,fe]=(0,h.useState)(()=>MR()),[pe,me]=(0,h.useState)(()=>RL()),[he,L]=(0,h.useState)(()=>JL()),[ge,R]=(0,h.useState)(!1),[_e,ve]=(0,h.useState)(!1),[ye,z]=(0,h.useState)(!1),[B,xe]=(0,h.useState)(!1),[Ce,we]=(0,h.useState)(null),[Te,Ee]=(0,h.useState)(null),[De,ke]=(0,h.useState)(()=>rq()),Ae=(0,h.useRef)(0),je=(0,h.useRef)(null),Me=(0,h.useRef)(null),Ne=(0,h.useRef)(new Set),Pe=(0,h.useRef)(null),[Fe,Ie]=(0,h.useState)(()=>typeof window<`u`&&window.matchMedia?window.matchMedia(`(prefers-color-scheme: dark)`).matches:!0),Le=(0,h.useMemo)(()=>eC(r.spmText,r.sourceName),[r.sourceName,r.spmText]),Re=(0,h.useMemo)(()=>r.previousGeometry?eC(r.previousGeometry.spmText,r.previousGeometry.sourceName):null,[r.previousGeometry]),ze=t?r.secondaryGeometry:r.referenceGeometry,V=(0,h.useMemo)(()=>ze?eC(ze.spmText,ze.sourceName):null,[ze]),Be=(0,h.useMemo)(()=>XU(Le,x),[x,Le]),Ve=(0,h.useMemo)(()=>Re?XU(Re,x):null,[x,Re]),He=(0,h.useMemo)(()=>V?XU(V,x):null,[x,V]),Ue=(0,h.useMemo)(()=>lR(Be,he),[he,Be]),We=(0,h.useMemo)(()=>Ve?lR(Ve,he):null,[he,Ve]),Ge=(0,h.useMemo)(()=>He?lR(He,he):null,[he,He]),Ke=(0,h.useMemo)(()=>QW(Le),[Le]),qe=(0,h.useMemo)(()=>Re?QW(Re):null,[Re]),Je=(0,h.useMemo)(()=>V?QW(V):null,[V]),Ye=(0,h.useMemo)(()=>xB(Le.fields[`Calculate Steer`])?GW(Le):[],[Le]),Xe=(0,h.useMemo)(()=>Re&&xB(Re.fields[`Calculate Steer`])?GW(Re):null,[Re]),Ze=(0,h.useMemo)(()=>V&&xB(V.fields[`Calculate Steer`])?GW(V):null,[V]),Qe=(0,h.useMemo)(()=>Fw(Le,`roll`)?F_(Le):{leftSeries:[],rightSeries:[]},[Le]),$e=(0,h.useMemo)(()=>Re&&Fw(Re,`roll`)?F_(Re):null,[Re]),et=(0,h.useMemo)(()=>V&&Fw(V,`roll`)?F_(V):null,[V]),tt=aW(r.customGraphs),nt=vW(r.customGraphLayoutName),rt=r.customGraphLayoutSource,it=r.customGraphLayoutSavedSignature,at=!!nt&&sW(tt)!==it,ot=(0,h.useMemo)(()=>new Set(tt.map(e=>oW(e))),[tt]),st=e===`custom`?tt[0]?.mode??`bump`:vR(e)?e:`bump`,ct=Ue[st],lt=CI.find(t=>t.id===e)?.label??`Output`,ut=!!r.previousGeometry,dt=!!ze,ft=t?`secondary`:`reference`,pt=t?`Secondary Axle`:`Reference Geometry`,mt=pe===`auto`?Fe?`dark`:`light`:pe,ht=(0,h.useCallback)((e,t=je.current?.offsetWidth??eq,n=je.current?.offsetHeight??tq)=>{if(typeof window>`u`)return e;let r=Math.max(nq,window.innerWidth-t-nq),i=Math.max(nq,window.innerHeight-n-nq);return{x:Math.max(nq,Math.min(e.x,r)),y:Math.max(nq,Math.min(e.y,i))}},[]);(0,h.useCallback)(e=>{if(e.button!==0||e.target instanceof Element&&e.target.closest(`button`))return;let t=je.current?.getBoundingClientRect();t&&(Me.current={offsetX:e.clientX-t.left,offsetY:e.clientY-t.top,width:t.width,height:t.height},e.currentTarget.setPointerCapture(e.pointerId))},[]),(0,h.useCallback)(e=>{let t=Me.current;t&&(e.preventDefault(),ke(ht({x:e.clientX-t.offsetX,y:e.clientY-t.offsetY},t.width,t.height)))},[ht]),(0,h.useCallback)(e=>{Me.current&&(Me.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),(0,h.useCallback)(()=>{R(!0),ve(!0)},[]),(0,h.useCallback)(()=>{Me.current=null,ve(!1)},[]),(0,h.useCallback)(()=>{Ae.current+=1,Me.current=null,R(!1),ve(!1),z(!1),xe(!1),we(null),Ee(null)},[]),(0,h.useCallback)(async e=>{},[e]),(0,h.useMemo)(()=>{let t=new Map;return Te?.matches.forEach(n=>{t.set(n.channelKey,e===`steer`?iT(n.points,Ue.steer,n.channelKey):rT(n.points,Ue.bump,n.channelKey))}),t},[Te,Ue.bump,Ue.steer,e]),(0,h.useEffect)(()=>{if(!_e)return;let e=()=>ke(e=>ht(e)),t=window.requestAnimationFrame(e);return window.addEventListener(`resize`,e),()=>{window.cancelAnimationFrame(t),window.removeEventListener(`resize`,e)}},[_e,ht]),(0,h.useEffect)(()=>{let e=window.document.documentElement;return e.classList.remove(`theme-dark`,`theme-light`),e.classList.add(`theme-${mt}`),()=>e.classList.remove(`theme-dark`,`theme-light`)},[mt]);let gt=`${lt} analysis`,_t=e===`driveshaft`,vt=e===`loads`,yt=(0,h.useMemo)(()=>aV(x),[x]),bt=(0,h.useMemo)(()=>jb(Le),[Le]),xt=(0,h.useMemo)(()=>FS(bt)?PS(Le,bt):null,[Le,bt]),St=(0,h.useCallback)((e,t=he)=>lV(e,t,e===`loads`?xt:null,Le),[xt,he,Le]),Ct=n||iV(st).key===`bump`||vt&&yt.key===`bump`,wt=n||e===`steer`||e===`driveshaft`,Tt=n||e===`steer`,Et=y===`rightHandChartOnly`,Dt=_===`rackTravel`?`LH Steer <--- Rack travel [mm] ---> RH Steer`:`LHS <--- Steering wheel angle [deg] ---> RHS`,Ot=_===`rackTravel`?`Rack travel, RH Steer [mm]`:`Steering wheel angle to RHS [deg]`,kt=_===`rackTravel`?Et?AW:DW:Et?kW:EW,At=_===`rackTravel`?DW:EW,
4407jt=JW(_,!1),Mt=_===`rackTravel`?DW:EW,Nt=Et?`Rack travel positive for RH Steering, Static / Gradient values referred to LH wheel (outer)`:`Rack travel positive for RH Steering`,Pt=o>=4?`short`:o>=3?`default`:`full`,Ft=vR(e)?D[e]??[]:[],It=e===`steer`?At:vt?yt:ZU(st,he),Lt=(0,h.useMemo)(()=>e===`bumpSteer`?zW(ct):[],[ct,e]),Rt=(0,h.useMemo)(()=>{if(e===`bumpSteer`)return[{index:-211,key:`bumpSteerRelativeToeNoSteer`,label:`Relative Toe - No steer`,unit:`deg`},{index:-212,key:`bumpSteerRelativeToeLeftSteer`,label:`Relative Toe - LH wheel`,unit:`deg`},{index:-213,key:`bumpSteerRelativeToeRightSteer`,label:`Relative Toe - RH wheel`,unit:`deg`},{index:-214,key:`camberNoSteer`,label:`Relative Camber - No steer`,unit:`deg`},{index:-215,key:`bumpSteerRelativeCamberLeftSteer`,label:`Relative Camber - LH wheel`,unit:`deg`},{index:-216,key:`bumpSteerRelativeCamberRightSteer`,label:`Relative Camber - RH wheel`,unit:`deg`},{index:-217,key:`camberNoSteer`,label:`Camber - No steer`,unit:`deg`},{index:-218,key:`camberLeftSteer`,label:`Camber - LH wheel`,unit:`deg`},{index:-219,key:`camberRightSteer`,label:`Camber - RH wheel`,unit:`deg`},{index:-220,key:`toeNoSteer`,label:`Toe - No steer`,unit:`deg`},{index:-221,key:`toeLeftSteer`,label:`Toe - LH wheel`,unit:`deg`},{index:-222,key:`toeRightSteer`,label:`Toe - RH wheel`,unit:`deg`}];let t=tG(e===`steer`?uV(`steer`,St(`steer`),he).map(e=>e.key===`meanRadius`?MW:e):uV(st,St(st),he),Ft);return e===`steer`?[jt,...t]:t},[Ft,st,he,St,jt,e]),zt=Et&&e===`steer`?Ke.leftSeries:ct,Bt=(0,h.useMemo)(()=>[...e===`bumpSteer`?Lt:zt].sort((e,t)=>Q(t,It.key)-Q(e,It.key)),[Lt,zt,It.key,e]),Vt=(0,h.useMemo)(()=>[...Ue.driveshaft].sort((e,t)=>Q(t,`bump`)-Q(e,`bump`)),[Ue.driveshaft]),Ht=(0,h.useMemo)(()=>[...Ye].sort((e,t)=>Q(t,Mt.key)-Q(e,Mt.key)),[Mt.key,Ye]),Ut=(0,h.useMemo)(()=>[`Bump [mm]`,`Axial shift [mm]`,Mt.unit?`${Mt.label} [${Mt.unit}]`:Mt.label,`Axial shift [mm]`],[Mt.label,Mt.unit]),Wt=(0,h.useMemo)(()=>{let e=Math.max(Vt.length,Ht.length);return Array.from({length:e},(e,t)=>{let n=Vt[t],r=Ht[t];return[n?dV(Q(n,`bump`)):``,n?fV(Q(n,`axialShift`)):``,r?dV(Q(r,Mt.key)):``,r?fV(Q(r,`axialShift`)):``]})},[Vt,Mt.key,Ht]),Gt=(0,h.useMemo)(()=>{if(e!==`roll`)return[];let t=It.key===`bump`?`Bump / Rebound [mm]`:It.unit?`${It.label} [${It.unit}]`:It.label,n=new Set([`camber`,`relativeCamber`,`toe`]);return[t,...Rt.flatMap(e=>{let t=KW(`roll`,e),r=e.unit?`${t} [${e.unit}]`:t;return n.has(e.key)?[`${r} - LH wheel`,`${r} - RH wheel`]:[r]})]},[It.key,It.label,It.unit,Rt,e]),Kt=(0,h.useMemo)(()=>{if(e!==`roll`)return[];let t=new Set([`camber`,`relativeCamber`,`toe`]),n=cR(Qe.leftSeries,he).sort((e,t)=>Q(t,It.key)-Q(e,It.key)),r=cR(Qe.rightSeries,he).sort((e,t)=>Q(t,It.key)-Q(e,It.key)),i=Math.max(n.length,r.length);return Array.from({length:i},(e,i)=>{let a=n[i],o=r[i],s=a??o;return[s?dV(Q(s,It.key)):``,...Rt.flatMap(e=>t.has(e.key)?[a?fV(Q(a,e.key)):``,o?fV(Q(o,e.key)):``]:a?[fV(Q(a,e.key))]:[``])]})},[he,Qe.leftSeries,Qe.rightSeries,It.key,Rt,e]),qt=(0,h.useMemo)(()=>vt?yt.unit?`${yt.label} [${yt.unit}]`:yt.label:It.key===`bump`?`Bump / Rebound [mm]`:It.unit?`${It.label} [${It.unit}]`:It.label,[yt.label,yt.unit,vt,It.key,It.label,It.unit]),Jt=(0,h.useMemo)(()=>_t?`LH wheel driveshaft axial shift for bump and steering inputs.`:vt?`Load results ordered from highest to lowest ${yt.label.toLowerCase()}.`:It.key===`bump`?`Current geometry values ordered from full bump to zero to full rebound.`:e===`steer`?`Current geometry values @LH wheel, ordered from highest to lowest ${_===`rackTravel`?`Rack travel`:`Steering Wheel angle`}, positive to RHS`:e===`roll`?`Current geometry values ordered from highest to lowest roll angle, with wheel-specific columns split between LH wheel (outer) and RH wheel (inner).`:e===`bumpSteer`?`Current geometry bump-steer main outputs ordered from full bump to zero to full rebound.`:`Current geometry values ordered from highest to lowest ${It.label.toLowerCase()}.`,[_t,yt.label,vt,_,It.key,It.label,e]),Yt=(0,h.useMemo)(()=>_t?[Ut,...Wt].map(e=>e.join(` `)).join(` 4408`):e===`roll`?[Gt,...Kt].map(e=>e.join(` `)).join(` 4409`):[[qt,...Rt.map(e=>{let t=KW(st,e);return e.unit?`${t} [${e.unit}]`:t})],...Bt.map(e=>[dV(Q(e,It.key)),...Rt.map(t=>fV(Q(e,t.key)))])].map(e=>e.join(` `)).join(` 4410`),[Ut,Wt,_t,st,Gt,Kt,It.key,qt,Rt,Bt,e]),Xt=(0,h.useMemo)(()=>{let e={};return t=>{let n=e[t];if(n)return n;let r=[{key:`current`,label:`Current Geometry`,color:`#4ea5ff`,series:Ue[t],document:Le,mode:t}];return u&&ut&&We&&Re&&r.push({key:`previous`,label:`Previous Geometry`,color:`#ef4444`,series:We[t],document:Re,mode:t}),f&&dt&&Ge&&V&&r.push({key:ft,label:pt,color:`#22c55e`,series:Ge[t],document:V,mode:t}),e[t]=r,r}},[We,Ge,Ue,ut,dt,ft,pt,u,f]),Zt=(0,h.useMemo)(()=>{let e=[{key:`current`,label:`Current Geometry`,color:`#4ea5ff`,document:Le,rightSeries:Ke.rightSeries,leftSeries:Ke.leftSeries}];return u&&ut&&Re&&qe&&e.push({key:`previous`,label:`Previous Geometry`,color:`#ef4444`,document:Re,rightSeries:qe.rightSeries,leftSeries:qe.leftSeries}),f&&dt&&V&&Je&&e.push({key:ft,label:pt,color:`#22c55e`,document:V,rightSeries:Je.rightSeries,leftSeries:Je.leftSeries}),e},[ut,dt,ft,pt,u,f,Ke.leftSeries,Ke.rightSeries,qe,Je]),Qt=(0,h.useMemo)(()=>{let e=[{key:`current`,label:`Current Geometry`,color:`#4ea5ff`,document:Le,leftSeries:cR(Qe.leftSeries,he),rightSeries:cR(Qe.rightSeries,he)}];return u&&ut&&Re&&$e&&e.push({key:`previous`,label:`Previous Geometry`,color:`#ef4444`,document:Re,leftSeries:cR($e.leftSeries,he),rightSeries:cR($e.rightSeries,he)}),f&&dt&&V&&et&&e.push({key:ft,label:pt,color:`#22c55e`,document:V,leftSeries:cR(et.leftSeries,he),rightSeries:cR(et.rightSeries,he)}),e},[ut,Re,dt,V,ft,pt,he,Qe.leftSeries,Qe.rightSeries,$e,et,u,f]),$t=(0,h.useMemo)(()=>Et?Zt.map(e=>({key:`${e.key}-left`,label:e.label,color:e.color,series:e.leftSeries,document:e.document,mode:`steer`})):Xt(`steer`),[Xt,Et,Zt]),en=(0,h.useMemo)(()=>
4410{if(_t)return[{key:`current`,label:`Current Geometry`,color:`#4ea5ff`,series:Ue.driveshaft,document:Le,mode:`driveshaft`}];if(e===`steer`&&Et)return $t;let t=[{key:`current`,label:`Current Geometry`,color:`#4ea5ff`,series:ct,document:Le,mode:st}];return u&&ut&&We&&Re&&t.push({key:`previous`,label:`Previous Geometry`,color:`#ef4444`,series:We[st],document:Re,mode:st}),f&&dt&&Ge&&V&&t.push({key:ft,label:pt,color:`#22c55e`,series:Ge[st],document:V,mode:st}),t},[ct,We,Ge,Ue.driveshaft,_t,st,ut,dt,ft,pt,u,f,$t,Et,e]),tn=(0,h.useMemo)(()=>{let e=[{key:`current`,label:`Current Geometry`,color:`#4ea5ff`,series:Ue.driveshaft,document:Le,mode:`driveshaft`}];return u&&ut&&We&&Re&&e.push({key:`previous`,label:`Previous Geometry`,color:`#ef4444`,series:We.driveshaft,document:Re,mode:`driveshaft`}),f&&dt&&Ge&&V&&e.push({key:ft,label:pt,color:`#22c55e`,series:Ge.driveshaft,document:V,mode:`driveshaft`}),e},[We,Ge,Ue.driveshaft,ut,dt,ft,pt,u,f]),nn=(0,h.useMemo)(()=>{let e=[{key:`current`,label:`Current Geometry`,color:`#4ea5ff`,series:Ye,document:Le,mode:`driveshaft`}];return u&&ut&&Xe&&Re&&e.push({key:`previous`,label:`Previous Geometry`,color:`#ef4444`,series:Xe,document:Re,mode:`driveshaft`}),f&&dt&&Ze&&V&&e.push({key:ft,label:pt,color:`#22c55e`,series:Ze,document:V,mode:`driveshaft`}),e},[Ye,Xe,Ze,ut,dt,ft,pt,u,f]),rn=(0,h.useMemo)(()=>{if(!_t)return[];let e=wW(`bump`,OW,m);return[{key:`driveshaft-bump`,title:`Axial shift vs Bump`,x:e.x,y:e.y,analysisChannel:OW,analysisAxisChannel:ZU(`bump`),analysisZeroLabel:`Bump = 0`,seriesSet:tn},{key:`driveshaft-steer`,title:`Axial shift vs ${Mt.label}`,x:Mt,y:OW,xAxisLabelOverride:Mt.key===`rackTravel`?`Rack travel, RH Steer [mm]`:`Steering wheel angle to RHS [deg]`,analysisChannel:OW,analysisAxisChannel:Mt,analysisZeroLabel:Mt.key===`rackTravel`?`Rack travel = 0`:`SW angle = 0`,seriesSet:nn}]},[m,tn,Mt,nn,_t]),an=(0,h.useMemo)(()=>eG(Le,$t,kt),[Le,kt,$t]),on=(0,h.useMemo)(()=>YW($t,kt,_,Et,Et?Ot:Dt),[kt,_,Dt,$t,Et,Ot]),sn=(0,h.useMemo)(()=>{let e=e=>{if(e===`driveshaft`)return rn;if(e===`steer`&&Et)return[...rG(Zt,kt,Ot,an,he,St(`steer`)),on];let t=nG(e,Xt(e),m,e===`steer`?an:null,e===`steer`?kt:e===`loads`?yt:void 0,he,St(e)),n=e===`roll`?iG(t,Qt):t,r=e===`steer`?n.map(e=>({...e,xAxisLabelOverride:e.x.key===`toe`?e.xAxisLabelOverride:Dt})):n;return e===`steer`?[...r,on]:r};return{bump:e(`bump`),anti:e(`anti`),steer:e(`steer`),steeringColumn:e(`steeringColumn`),roll:e(`roll`),bumpSteer:e(`bumpSteer`),driveshaft:e(`driveshaft`),loads:e(`loads`)}},[m,Xt,rn,yt,he,St,kt,Qt,an,Dt,on,Et,Zt,Ot]),cn=(0,h.useMemo)(()=>vR(e)?sn[e]:[],[sn,e]),ln=(0,h.useMemo)(()=>cn,[cn,ge,Te,ye,Ue.steer,e]);(0,h.useMemo)(()=>{if(!Te)return null;let t=new Map(Te.matches.map(e=>[e.channelKey,e])),n=e===`steer`?new Set([`steeringWheelAngle`,`rackTravel`]):new Set([`bump`]),r=tG(ln,e===`steer`?D.steer:D.bump).flatMap(e=>{let r=n.has(e.x.key)?e.y.key:n.has(e.y.key)?e.x.key:null,i=r?t.get(r):null;return i?(t.delete(i.channelKey),[i]):[]});return Te.matches.forEach(e=>{t.has(e.channelKey)&&r.push(e)}),{...Te,matches:r}},[Te,D.bump,D.steer,ln,e]);let un=(0,h.useMemo)(()=>ln.map(e=>({key:e.key,title:e.title})),[ln]),dn=(0,h.useMemo)(()=>tt.map((e,t)=>
4410{let n=lW(St(e.mode),e.extraChannels);return{key:`custom-chart-${t}`,title:pW(e,n,he)}}),[tt,he,St]),fn=(0,h.useMemo)(()=>Object.fromEntries(hI.map(e=>[e.id,sn[e.id].map(t=>{let n={mode:e.id,chartKey:t.key};return{...n,key:bR(n),title:t.title,modeLabel:e.label}})])),[sn]),pn=(0,h.useMemo)(()=>M.map(e=>{let t=sn[e.mode].find(t=>t.key===e.chartKey);if(!t)return null;let n=hI.find(t=>t.id===e.mode)?.label??e.mode;return{key:bR(e),mode:e.mode,modeLabel:n,descriptor:t}}).filter(e=>!!e),[sn,M]),mn=n&&pn.length===0,hn=(0,h.useMemo)(()=>{if(!n)return[];let e=[];return hI.forEach(t=>{let n=pn.filter(e=>e.mode===t.id);if(n.length===0)return;if(t.id===`driveshaft`){let r=n.some(e=>e.descriptor.key===`driveshaft-bump`),i=n.some(e=>e.descriptor.key===`driveshaft-steer`),a=[],o=[];r&&(a.push(`Bump [mm]`,`Axial shift [mm]`),o.push(Vt.map(e=>dV(Q(e,`bump`))),Vt.map(e=>fV(Q(e,`axialShift`))))),i&&(a.push(Mt.unit?`${Mt.label} [${Mt.unit}]`:Mt.label,`Axial shift [mm]`),o.push(Ht.map(e=>dV(Q(e,Mt.key))),Ht.map(e=>fV(Q(e,`axialShift`)))));let s=o.reduce((e,t)=>Math.max(e,t.length),0);e.push({key:t.id,label:t.label,headers:a,rows:Array.from({length:s},(e,t)=>o.map(e=>e[t]??``))});return}let r=new Map;n.forEach(e=>{let t=e.descriptor.analysisChannel??e.descriptor.y;r.has(t.key)||r.set(t.key,t)});let i=Array.from(r.values());if(i.length===0)return;let a,o;t.id===`steer`?(a=At,o=[...Et?Ke.leftSeries:Ue.steer].sort((e,t)=>Q(t,a.key)-Q(e,a.key))):t.id===`loads`?(a=yt,o=[...Ue.loads].sort((e,t)=>Q(t,a.key)-Q(e,a.key))):t.id===`bumpSteer`?(a=ZU(`bumpSteer`,he),o=[...zW(Ue.bumpSteer)].sort((e,t)=>Q(t,a.key)-Q(e,a.key))):(a=ZU(t.id,he),o=[...Ue[t.id]].sort((e,t)=>Q(t,a.key)-Q(e,a.key)));let s=a.key===`bump`?`Bump / Rebound [mm]`:a.unit?`${a.label} [${a.unit}]`:a.label;e.push({key:t.id,label:t.label,headers:[s,...i.map(e=>{let n=KW(t.id,e);return e.unit?`${n} [${e.unit}]`:n})],rows:o.map(e=>[dV(Q(e,a.key)),...i.map(t=>fV(Q(e,t.key)))])})}),e},[Ue,Vt,Mt.key,Mt.label,Mt.unit,Ht,yt,he,pn,n,Et,Ke.leftSeries,At]),H=(0,h.useMemo)(()=>hn.reduce((e,t)=>Math.max(e,t.rows.length),0),[hn]),gn=(0,h.useMemo)(()=>hn.length===0?`No selected charts available for tabular output.`:`Selected chart outputs grouped by analysis tab, ordered from Bump to Anti to Steer and the other active sources.`,[hn.length]),_n=(0,h.useMemo)(()=>hn.length===0?``:[hn.flatMap(e=>[e.label,...Array.from({length:e.headers.length-1},()=>``)]),hn.flatMap(e=>e.headers),...Array.from({length:H},(e,t)=>hn.flatMap(e=>e.rows[t]??Array.from({length:e.headers.length},()=>``)))].map(e=>e.join(` `)).join(` 4411`),[hn,H]),vn=(0,h.useMemo)(()=>{if(!n)return[];let e=[],t=new Set;return pn.forEach(n=>{if(!t.has(n.mode)){if(t.add(n.mode),n.mode===`steer`){e.push({key:`${n.mode}-legend`,label:n.modeLabel,ariaLabel:`Steer chart line legend`,items:y===`bothSides`?[{label:`Left-Hand Side wheel`,lineClassName:`report-steer-mode-line report-steer-mode-line-solid`},{label:Nt}]:[{label:`LH wheel (outer)`,lineClassName:`report-steer-mode-line report-steer-mode-line-solid`},{label:`RH wheel (inner)`,lineClassName:`report-steer-mode-line report-steer-mode-line-dashed`},{label:Nt}]});return}if(n.mode===`roll`){e.push({key:`${n.mode}-legend`,label:n.modeLabel,ariaLabel:`Roll chart sign convention`,items:[{label:`LH wheel (outer)`,lineClassName:`report-steer-mode-line report-steer-mode-line-solid`},{label:`RH wheel (inner)`,lineClassName:`report-steer-mode-line report-steer-mode-line-dashed`},{label:`Roll angle positive for RH Cornering`},{label:`Static / Gradient values referred to LH wheel (outer)`}]});return}if(n.mode===`driveshaft`){e.push({key:`${n.mode}-legend`,label:n.modeLabel,ariaLabel:`Driveshaft chart scope`,items:[{label:`LH wheel (outer), Rack travel positive for RH Steering, Static / Gradient values referred to LH wheel`}]});return}n.mode===`bumpSteer`&&e.push({key:`${n.mode}-legend`,label:n.modeLabel,ariaLabel:`Bump steer chart line legend`,items:[{label:`No steer`,lineClassName:`report-steer-mode-line report-steer-mode-line-dotted`},{label:`LH wheel`,lineClassName:`report-steer-mode-line`},{label:`RH wheel`,lineClassName:`report-steer-mode-line report-steer-mode-line-dashed`}]})}}),e}
4411,[Nt,pn,n,y]),yn=e===`steer`||e===`roll`||_t||e===`bumpSteer`||vn.length>0,bn={"--columns":o,"--chart-height":`${c}px`},xn=t=>{t===`fullVehicleSelection`&&!r.secondaryGeometry||SB(t,Le)&&t!==e&&window.location.assign(pq(t))},Sn=(0,h.useCallback)(e=>{AR(e)},[]),Cn=(0,h.useCallback)(e=>{AR(e,`refresh`)},[]),wn=(0,h.useCallback)(e=>{i(t=>{let n=e(t);return yq(n),n})},[]),Tn=(0,h.useCallback)(e=>{wn(t=>({...t,customGraphs:fW(t.customGraphs,e)}))},[wn]),En=(0,h.useCallback)(()=>{qV(r.sourceName,tt,nt).then(({name:e,handle:t})=>{Pe.current=t,wn(t=>({...t,customGraphLayoutName:e,customGraphLayoutSource:`local`,customGraphLayoutSavedSignature:sW(tt)}))}).catch(e=>{HV(e)||window.alert(e instanceof Error?e.message:`Cannot export custom graph layout.`)})},[wn,nt,tt,r.sourceName]),Dn=(0,h.useCallback)(()=>{YV().then(e=>{e&&(Pe.current=e.handle,wn(t=>({...t,customGraphLayoutName:e.fileName,customGraphLayoutSource:`local`,customGraphLayoutSavedSignature:sW(e.layout.graphs),customGraphs:e.layout.graphs})))}).catch(e=>{window.alert(e instanceof Error?e.message:`Cannot import
4411custom graph layout.`)})},[wn]),On=(0,h.useCallback)(()=>{!nt||!at||rt===`workspace`||(async()=>{let e=Pe.current;if(e?.createWritable){let t=await e.createWritable();return await t.write(SW(nt,tt)),await t.close(),{name:e.name??nt,handle:e}}return qV(r.sourceName,tt,nt)})().then(({name:e,handle:t})=>{Pe.current=t,wn(t=>({...t,customGraphLayoutName:e,customGraphLayoutSource:`local`,customGraphLayoutSavedSignature:sW(tt)}))}).catch(e=>{HV(e)||window.alert(e instanceof Error?e.message:`Cannot save custom graph layout.`)})},[wn,at,nt,rt,tt,r.sourceName]),kn=(0,h.useCallback)(()=>{},[nt,tt,r.sourceName]),An=(0,h.useCallback)(()=>{},[nt,tt,r.sourceName]),jn=(0,h.useCallback)(()=>{},[tt,r.sourceName]),Mn=(0,h.useCallback)(()=>{F(`normal`),oe(!0)},[]),Nn=(0,h.useCallback)(()=>{oe(!1),F(`normal`)},[]),Pn=(0,h.useCallback)(()=>{F(e=>e===`maximized`?`normal`:`maximized`)},[]),Fn=(0,h.useCallback)(async()=>{let e=n?_n:Yt;if(e)try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else if(!pV(e))throw Error(`Clipboard unavailable`);le(`copied`)}catch{le(pV(e)?`copied`:`error`)}},[_n,n,Yt]),In=(0,h.useCallback)(()=>{if(n){ie(M),P(!0);return}if(e===`custom`){ee(dn.map(e=>e.key)),E(!0);return}if(!vR(e))return;let t=un.map(e=>e.key);A(tG(un,Ft).map(e=>e.key)||t),w(!0)},[un,Ft,dn,M,n,e]),Ln=(0,h.useCallback)(()=>{if(!vR(e))return;let t={...D,[e]:k};O(t),SR({chartOrderByMode:t}),w(!1)},[k,D,e]),Rn=(0,h.useCallback)(()=>{A(un.map(e=>e.key))},[un]),zn=(0,h.useCallback)(()=>{let e=new Map(tt.map((e,t)=>[`custom-chart-${t}`,e])),t=j.map(t=>e.get(t)).filter(e=>!!e);t.length===tt.length&&wn(e=>({...e,customGraphs:t})),E(!1)},[wn,j,tt]),Bn=(0,h.useCallback)(()=>{ee(tt.map((e,t)=>`custom-chart-${t}`))},[tt]),Vn=(0,h.useCallback)(()=>{let e=xR(re);ne(e),SR(t?{fullVehicleSelectionCharts:e}:{selectionCharts:e}),P(!1)},[t,re]),Hn=(0,h.useCallback)(()=>{ie([])},[]);(0,h.useEffect)(()=>{if(e!==`custom`||!at)return;let t=e=>{e.preventDefault(),e.returnValue=`Custom graph layout has unsaved changes.`};return window.addEventListener(`beforeunload`,t),()=>window.removeEventListener(`beforeunload`,t)},[at,e]),(0,h.useEffect)(()=>{let e=e=>i(e),n=e=>{if(!(!e||!Ne.current.has(e.requestId))){if(Ne.current.delete(e.requestId),!e.ok){window.alert(e.message);return}if(e.layout){wn(t=>({...t,customGraphLayoutName:e.fileName??vW(e.layout?.name)??t.customGraphLayoutName,customGraphLayoutSource:`workspace`,customGraphLayoutSavedSignature:sW(e.layout?.graphs??t.customGraphs),customGraphs:e.layout?.graphs??t.customGraphs}));return}e.fileName&&wn(t=>({...t,customGraphLayoutName:e.fileName??t.customGraphLayoutName,customGraphLayoutSource:`workspace`,customGraphLayoutSavedSignature:sW(t.customGraphs)}))}},r=r=>{if(r.key===VI&&e(vq()),r.key===GI&&me(RL()),r.key===JI&&L(JL()),r.key===UI){let e=CR();s(e.columns),l(e.chartSize),d(e.showPrevious),t||p(e.showReference),g(e.bumpAxisOrientation),v(e.steerAxisMode),b(e.steerChartSideMode),O(e.chartOrderByMode),ne(t?e.fullVehicleSelectionCharts:e.selectionCharts)}if(r.key===$I&&r.newValue)try{fe(jR(JSON.parse(r.newValue)))}catch{fe(new Set)}if(r.key===uL&&r.newValue)try{n(hW(JSON.parse(r.newValue)))}catch{}},a=null,o=null,c=null;try{a=new BroadcastChannel(HI),a.onmessage=t=>e(t.data)}catch{a=null}try{o=new BroadcastChannel(eL),o.onmessage=e=>fe(jR(e.data))}catch{o=null}try{c=new BroadcastChannel(dL),c.onmessage=e=>n(hW(e.data))}catch{c=null}return window.addEventListener(`storage`,r),()=>{window.removeEventListener(`storage`,r),a?.close(),o?.close(),c?.close()}},[wn,t]),(0,h.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=e=>Ie(e);t(e.matches);let n=e=>t(e.matches);return e.addEventListener?(e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)):(e.addListener(n),()=>e.removeListener(n))},[]),(0,h.useEffect)(()=>{if(!ae||se===`minimized`){le(`idle`);return}let e=e=>{e.key===`Escape`&&Nn()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Nn,ae,se]),(0,h.useEffect)(()=>{I(null)},[e]),(0,h.useEffect)(()=>
4411{if(!ue)return;let e=e=>{e.key===`Escape`&&I(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ue]);let Un=(0,h.useCallback)(e=>{I(t=>t===e?null:e)},[]);return(0,h.useEffect)(()=>{if(!(typeof window>`u`||!window.localStorage))try{SR({columns:o,chartSize:c,showPrevious:u,bumpAxisOrientation:m,steerAxisMode:_,steerChartSideMode:y,...t?{}:{showReference:f}})}catch{}},[m,c,o,t,u,f,_,y]),(0,h.useEffect)(()=>{document.title=`3DSusp Web - ${gt}`},[gt]),(0,Z.jsxs)(`div`,{className:`app report-app${t?` report-app-full-vehicle-selection`:``} theme-${mt}`,style:bn,children:[(0,Z.jsxs)(`header`,{className:`topbar report-topbar${t?` report-topbar-full-vehicle-selection`:``}`,children:[(0,Z.jsxs)(`div`,{className:`brand`,children:[(0,Z.jsx)(`a`,{className:`brand-mark brand-mark-logo`,href:`https://www.bspokeautomotive.it/`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open BSpoke Automotive website`,"data-ui-tooltip":`Open BSpoke Automotive website.`,children:(0,Z.jsx)(`img`,{src:MM,alt:``,"aria-hidden":`true`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{children:`3DSusp Web`}),(0,Z.jsx)(`p`,{children:r.sourceName})]})]}),(0,Z.jsxs)(`div`,{className:`report-topbar-center${yn?` has-steer-legend`:``}`,"aria-label":`Output view status`,children:[(0,Z.jsxs)(`div`,{className:`report-topbar-row report-topbar-row-primary`,children:[(0,Z.jsx)(`label`,{className:`report-view-switcher`,children:(0,Z.jsx)(`select`,{value:e,onChange:e=>xn(e.target.value),"aria-label":`Select report`,children:CI.map(e=>(0,Z.jsx)(`option`,{value:e.id,disabled:e.id===`fullVehicleSelection`&&!r.secondaryGeometry||!SB(e.id,Le),children:e.label},e.id))})}),(0,Z.jsxs)(`span`,{className:`report-series-item`,children:[(0,Z.jsx)(`i`,{className:`report-series-dot is-current`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t?`Current primary axle`:`Current geometry`})]}),(0,Z.jsxs)(`label`,{className:`report-series-toggle${ut?``:` is-disabled`}`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:ut&&u,disabled:!ut,onChange:e=>d(e.target.checked)}),(0,Z.jsxs)(`span`,{className:`report-series-toggle-label`,children:[(0,Z.jsx)(`i`,{className:`report-series-dot is-previous`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t?`Previous primary axle`:`Previous geometry`})]})]}),(0,Z.jsxs)(`label`,{className:`report-series-toggle${dt?``:` is-disabled`}`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:dt&&f,disabled:!dt,onChange:e=>p(e.target.checked)}),(0,Z.jsxs)(`span`,{className:`report-series-toggle-label`,children:[(0,Z.jsx)(`i`,{className:`report-series-dot is-reference`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t?`Secondary axle`:`Reference geometry`})]})]}),Ct?(0,Z.jsx)(hq,{ariaLabel:`Bump axis orientation`,value:m,options:[{value:`x`,label:`Bump on X`},{value:`y`,label:`Bump on Y`}],onChange:e=>g(e)}):null,wt?(0,Z.jsx)(hq,{ariaLabel:`Steer axis mode`,value:_,options:[{value:`steeringWheelAngle`,label:`SW angle`},{value:`rackTravel`,label:`Rack travel`}],onChange:e=>v(e)}):null,Tt?(0,Z.jsx)(`div`,{className:`report-steer-mode-stack`,children:(0,Z.jsx)(hq,{ariaLabel:`Steer chart mode`,value:y,options:[{value:`bothSides`,label:`LH wheel only`},{value:`rightHandChartOnly`,label:`Both wheels`}],onChange:e=>b(e)})}):null,vt?(0,Z.jsx)(hq,{ariaLabel:`Load sweep mode`,value:x,options:[{value:`bump`,label:`Bump`},{value:`steer`,label:`Steer`},{value:`roll`,label:`Roll`},{value:`bumpSteer`,label:`BumpSteer`}],onChange:e=>S(e)}):null,n||vR(e)?(0,Z.jsxs)(`button`,{type:`button`,className:`report-topbar-button`,onClick:Mn,disabled:n?hn.length===0||H===0:_t?Wt.length===0:e===`roll`?Kt.length===0:Bt.length===0,children:[(0,Z.jsx)(Se,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Tabular output`})]}):null,n||e===`custom`||vR(e)&&!_t?(0,Z.jsxs)(`button`,{type:`button`,className:`report-topbar-button${mn?` report-topbar-button-attention`:``}`,onClick:In,disabled:e===`custom`&&tt.length<2,children:[(0,Z.jsx)(be,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:n?`Select charts`:`Arrange charts`})]}):null,null]}),e===`steer`?(0,Z.jsxs)(`div`,{className:`report-topbar-row report-topbar-row-secondary report-steer-mode-legend-row`,children:[(0,Z.jsx)(`span`,{className:`report-view-switcher-spacer`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`report-steer-mode-legend`,"aria-label":`Steer chart line legend`,children:[y===`bothSides`?(0,Z.jsxs)(`span`,{className:`report-steer-mode-legend-item`,children:[(0,Z.jsx)(`span`,{children:`Left-Hand Side wheel`}),(0,Z.jsx)(`i`,{className:`report-steer-mode-line report-steer-mode-line-solid`,"aria-hidden":`true`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`report-steer-mode-legend-item`,children:[(0,Z.jsx)(`span`,{children:`LH wheel (outer)`}),(0,Z.jsx)(`i`,{className:`report-steer-mode-line report-steer-mode-line-solid`,"aria-hidden":`true`})]}),(0,Z.jsxs)(`span`,{className:`report-steer-mode-legend-item`,children:[(0,Z.jsx)(`span`,{children:`RH wheel (inner)`}),(0,Z.jsx)(`i`,{className:`report-steer-mode-line report-steer-mode-line-dashed`,"aria-hidden":`true`})]})]}),(0,Z.jsx)(`span`,{className:`report-steer-mode-legend-item`,children:Nt})]})]}):e===`roll`?(0,Z.jsxs)(`div`,{className:`report-topbar-row report-topbar-row-secondary report-steer-mode-legend-row`,children:[(0,Z.jsx)(`span`,{className:`report-view-switcher-spacer`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`report-steer-mode-legend`,"aria-label":`Roll chart sign convention`,children:[(0,Z.jsxs)(`span`,{className:`report-steer-mode-legend-item`,children:[(0,Z.jsx)(`span`,{children:`LH wheel (outer)`}),(0,Z.jsx)(`i`,{className:`report-steer-mode-line report-steer-mode-line-solid`,"aria-hidden":`true`})]}),(0,Z.jsxs)(`span`,{className:`report-steer-mode-legend-item`,children:[(0,Z.jsx)(`span`,{children:`RH wheel (inner)`}),(0,Z.jsx)(`i`,{className:`report-steer-mode-line report-steer-mode-line-dashed`,"aria-hidden":`true`})]}),(0,Z.jsx)(`span`,{className:`report-steer-mode-legend-item`,children:`Roll angle positive for RH Cornering`}),(0,Z.jsx)(`span`,{className:`report-steer-mode-legend-item`,children:`Static / Gradient values referred to LH wheel (outer)`})]})]}):_t?(0,Z.jsxs)(`div`,{className:`report-topbar-row report-topbar-row-secondary report-steer-mode-legend-row`,children:[(0,Z.jsx)(`span`,{className:`report-view-switcher-spacer`,"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:`report-steer-mode-legend`,"aria-label":`Driveshaft chart scope`,children:(0,Z.jsx)(`span`,{className:`report-steer-mode-legend-item`,children:`LH wheel (outer), Rack travel positive for RH Steering, Static / Gradient values referred to LH wheel`})})]}):e===`bumpSteer`?(0,Z.jsxs)(`div`,{className:`report-topbar-row report-topbar-row-secondary report-steer-mode-legend-row`,children:[(0,Z.jsx)(`span`,{className:`report-view-switcher-spacer`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`report-steer-mode-legend`,"aria-label":`Bump steer chart line legend`,children:[(0,Z.jsxs)(`span`,{className:`report-steer-mode-legend-item`,children:[(0,Z.jsx)(`span`,{children:`No steer`}),(0,Z.jsx)(`i`,{className:`report-steer-mode-line report-steer-mode-line-dotted`,"aria-hidden":`true`})]}),(0,Z.jsxs)(`span`,{className:`report-steer-mode-legend-item`,children:[(0,Z.jsx)(`span`,{children:`LH wheel`}),(0,Z.jsx)(`i`,{className:`report-steer-mode-line`,"aria-hidden":`true`})]}),(0,Z.jsxs)(`span`,{className:`report-steer-mode-legend-item`,children:[(0,Z.jsx)(`span`,{children:`RH wheel`}),(0,Z.jsx)(`i`,{className:`report-steer-mode-line report-steer-mode-line-dashed`,"aria-hidden":`true`})]})]})]}):n?vn.map(e=>(0,Z.jsxs)(`div`,{className:`report-topbar-row report-topbar-row-secondary report-steer-mode-legend-row`,children:[(0,Z.jsx)(`span`,{className:`report-view-chip report-view-chip-muted`,children:e.label}),(0,Z.jsx)(`div`,{className:`report-steer-mode-legend`,"aria-label":e.ariaLabel,children:e.items.map(t=>(0,Z.jsxs)(`span`,{className:`report-steer-mode-legend-item`,children:[(0,Z.jsx)(`span`,{children:t.label}),t.lineClassName?(0,Z.jsx)(`i`,{className:t.lineClassName,"aria-hidden":`true`}):null]},`${e.key}-${t.label}`))})]},e.key)):null]}
4411),(0,Z.jsx)(`div`,{className:`toolbar report-controls report-toolbar`,children:(0,Z.jsx)(`div`,{className:`report-control-group`,children:[1,2,3,4].map(e=>(0,Z.jsx)(`button`,{type:`button`,className:o===e?`active`:void 0,onClick:()=>s(e),children:e===1?`1 |`:e===2?`2 ||`:e===3?`3 |||`:`4 ||||`},e))})})]}),(0,Z.jsx)(`main`,{className:`report-main${ue?` report-main-chart-expanded`:``}`,children:e===`custom`?(0,Z.jsx)($K,{graphs:tt,layoutName:nt,onGraphsChange:e=>wn(t=>({...t,customGraphs:e})),seriesSetForMode:Xt,channelsForMode:St,bumpAxisOrientation:m,motionRatioMode:he,analysisSeriesLabelVariant:Pt,showLegend:!1,expandedChartKey:ue,onToggleChartExpand:Un,pinKeyPrefix:`report-${e}`,pinnedChartIds:de,onPinChart:Sn,onRefreshPinnedChart:Cn,onSaveLayout:On,canSaveLayout:at&&(rt!==`workspace`||YF),onExportLayoutLocal:En,onImportLayoutLocal:Dn,onExportLayoutWorkspace:kn,onExportLayoutWorkspaceAsNew:An,onImportLayoutWorkspace:jn,onArrangeGraphs:In}):n?pn.length>0?(0,Z.jsx)(`div`,{className:`output-chart-grid${ue?` output-chart-grid-expanded`:``}`,children:pn.filter(e=>!ue||e.key===ue).map((e,t)=>{let n=dW(e.mode,e.descriptor.x,e.descriptor.y),r=`report-selection-${e.key}`;return(0,Z.jsx)(TK,{chartKey:e.key,seriesSet:e.descriptor.seriesSet,title:e.descriptor.title,chartIndex:t+1,x:e.descriptor.x,y:e.descriptor.y,xAxisLabelOverride:e.descriptor.xAxisLabelOverride,yAxisLabelOverride:e.descriptor.yAxisLabelOverride,analysisChannel:e.descriptor.analysisChannel,analysisAxisChannel:e.descriptor.analysisAxisChannel,analysisZeroLabel:e.descriptor.analysisZeroLabel,analysisSeriesKeys:e.descriptor.analysisSeriesKeys,analysisSeriesLabelVariant:Pt,legendSeriesKeys:e.descriptor.legendSeriesKeys,forceLegend:e.descriptor.forceLegend,hideAnalysisRows:e.descriptor.hideAnalysisRows,analysisSummaryMode:e.descriptor.analysisSummaryMode,replaceGradientWithAverage:e.descriptor.replaceGradientWithAverage,analysisRoleRows:e.descriptor.analysisRoleRows,showLegend:!1,expanded:e.key===ue,onToggleExpand:Un,chartPinKey:r,pinActive:de.has(r),onPinChart:Sn,onRefreshPinnedChart:Cn,customGraph:n,customActive:ot.has(oW(n)),onAddToCustom:Tn},e.key)})}):(0,Z.jsxs)(`div`,{className:`selection-empty-state`,children:[(0,Z.jsx)(`strong`,{children:`No charts selected`}),(0,Z.jsx)(`span`,{children:`Use Select charts to compose this output tab from the other analysis views.`})]}):(0,Z.jsx)(QK,{seriesSet:en,mode:e,extraChart:e===`steer`?an:null,bumpAxisOrientation:m,axisOverride:e===`steer`?kt:e===`loads`?yt:void 0,descriptors:ln,chartOrder:vR(e)?D[e]:void 0,analysisSeriesLabelVariant:Pt,showLegend:!1,expandedChartKey:ue,onToggleChartExpand:Un,pinKeyPrefix:`report-${e}`,pinnedChartIds:de,onPinChart:Sn,onRefreshPinnedChart:Cn,customGraphKeys:ot,onAddToCustom:Tn})}),null,(n||vR(e))&&ae&&se!==`minimized`?(0,Z.jsx)(`div`,{className:`report-table-overlay`,role:`presentation`,onClick:e=>e.target===e.currentTarget&&Nn(),children:(0,Z.jsxs)(`section`,{className:`report-table-dialog${se===`maximized`?` is-maximized`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tabular-output-title`,children:[(0,Z.jsxs)(`header`,{className:`report-table-dialog-head`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`tabular-output-title`,children:`Tabular output`}),(0,Z.jsx)(`p`,{children:n?gn:Jt})]}),(0,Z.jsxs)(`div`,{className:`report-table-dialog-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:()=>void Fn(),children:[(0,Z.jsx)(te,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:ce===`copied`?`Copied`:ce===`error`?`Copy failed`:`Copy to clipboard`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-window-button`,"aria-label":`Minimize tabular output`,title:`Riduci a icona`,onClick:()=>F(`minimized`),children:(0,Z.jsx)(`span`,{className:`window-control-glyph is-minimize`,"aria-hidden":`true`})}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-window-button`,"aria-label":se===`maximized`?`Restore tabular output`:`Maximize tabular output`,title:se===`maximized`?`Ripristina in basso`:`Ingrandisci`,onClick:Pn,children:(0,Z.jsx)(`span`,{className:`window-control-glyph${se===`maximized`?` is-restore`:` is-maximize`}`,"aria-hidden":`true`})}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-close-button`,"aria-label":`Close tabular output`,onClick:Nn,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]})]}),(0,Z.jsx)(`div`,{className:`report-table-scroll`,children:(0,Z.jsxs)(`table`,{className:`report-table-output`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsx)(`tr`,{children:n?hn.flatMap(e=>e.headers.map((t,n)=>(0,Z.jsxs)(`th`,{scope:`col`,children:[t,n===0?(0,Z.jsx)(`small`,{children:e.label}):null]},`${e.key}-header-${n}`))):_t?Ut.map((e,t)=>(0,Z.jsx)(`th`,{scope:`col`,children:e},`driveshaft-header-${t}`)):e===`roll`?Gt.map((e,t)=>(0,Z.jsx)(`th`,{scope:`col`,children:e},`roll-header-${t}`)):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{scope:`col`,children:qt}),Rt.map(e=>(0,Z.jsxs)(`th`,{scope:`col`,children:[KW(st,e),e.unit?(0,Z.jsx)(`small`,{children:e.unit}):null]},e.key))]})})}),(0,Z.jsx)(`tbody`,{children:n?Array.from({length:H},(e,t)=>(0,Z.jsx)(`tr`,{children:hn.flatMap(e=>(e.rows[t]??Array.from({length:e.headers.length},()=>``)).map((n,r)=>(0,Z.jsx)(`td`,{children:n},`selection-tabular-output-${e.key}-${t}-${r}`)))},`selection-tabular-output-${t}`)):_t?Wt.map((e,t)=>(0,Z.jsx)(`tr`,{children:e.map((e,n)=>(0,Z.jsx)(`td`,{children:e},`driveshaft-tabular-output-${t}-${n}`))},`driveshaft-tabular-output-${t}`)):e===`roll`?Kt.map((e,t)=>(0,Z.jsx)(`tr`,{children:e.map((e,n)=>(0,Z.jsx)(`td`,{children:e},`roll-tabular-output-${t}-${n}`))},`roll-tabular-output-${t}`)):Bt.map((e,t)=>(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`td`,{children:dV(Q(e,It.key))}),Rt.map(t=>(0,Z.jsx)(`td`,{children:fV(Q(e,t.key))},t.key))]},`tabular-output-${t}-${Q(e,It.key)}`))})]})})]})}):null,(n||vR(e))&&ae&&se===`minimized`?(0,Z.jsxs)(`div`,{className:`report-table-minimized-bar`,role:`dialog`,"aria-modal":`false`,"aria-label":`Tabular output minimized`,children:[(0,Z.jsx)(`span`,{children:`Tabular output`}),(0,Z.jsxs)(`div`,{className:`report-table-minimized-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`report-table-window-button`,"aria-label":`Restore tabular output`,title:`Ripristina in basso`,onClick:()=>F(`normal`),children:(0,Z.jsx)(`span`,{className:`window-control-glyph is-restore`,"aria-hidden":`true`})}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-close-button`,"aria-label":`Close tabular output`,onClick:Nn,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]})]}):null,N?(0,Z.jsx)(sq,{draftSelection:re,availableItemsByMode:fn,onDraftSelectionChange:ie,onClose:()=>P(!1),onContinue:Vn,onReset:Hn}):null,C&&vR(e)?(0,Z.jsx)(iq,{modeLabel:hI.find(t=>
4411t.id===e)?.label??`Output`,items:un,draftOrder:k,onDraftOrderChange:A,onClose:()=>w(!1),onApply:Ln,onReset:Rn}):null,T?(0,Z.jsx)(iq,{modeLabel:`Custom`,items:dn,draftOrder:j,onDraftOrderChange:ee,onClose:()=>E(!1),onApply:zn,onReset:Bn}):null]})}function Cq({onAuthenticated:e}){let[t,n]=(0,h.useState)(`login`),[r,i]=(0,h.useState)({firstName:``,lastName:``,email:``,company:``,username:``,password:``,confirmPassword:``,resetToken:``}),[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(``),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(!1),[p,m]=(0,h.useState)(!1),[g,_]=(0,h.useState)(!1),[v,y]=(0,h.useState)(``),[b,x]=(0,h.useState)(!1),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(!1),E=(0,h.useRef)(null),D=(0,h.useRef)(null),O=(0,h.useRef)(null),k=(0,h.useRef)(!1),A=(e,t)=>{i(n=>({...n,[e]:t}))},j=e=>{n(e),c(``),u(``),C(``)},ee=()=>{k.current=!0,f(!1),O.current?.requestSubmit()},te=()=>{_(!1),f(!1)};(0,h.useEffect)(()=>{if(!p)return;let e=e=>{e.key===`Escape`&&m(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]);let M=async()=>{if(v){o(!0),c(``);try{u((await UM(v)).message)}catch(e){c(e instanceof Error?e.message:`Could not resend the verification email`)}finally{o(!1)}}};(0,h.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=e.get(`verifyToken`);if(t){n(`verify`),o(!0),u(`Verifying your email...`),HM(t).then(e=>{u(e.message),n(`login`),window.history.replaceState({},document.title,window.location.pathname)}).catch(e=>{c(e instanceof Error?e.message:`Email verification failed`)}).finally(()=>o(!1));return}let r=e.get(`resetToken`);r&&(n(`reset`),i(e=>({...e,resetToken:r})),u(`Reset token loaded. Set your new password.`))},[]),(0,h.useEffect)(()=>{if(!HF||t!==`signup`)return;if(window.turnstile){T(!0);return}let e=document.querySelector(`script[data-turnstile-script="true"]`);if(e){let t=()=>T(!0);return e.addEventListener(`load`,t),()=>{e.removeEventListener(`load`,t)}}let n=document.createElement(`script`);n.src=UF,n.async=!0,n.defer=!0,n.dataset.turnstileScript=`true`,n.addEventListener(`load`,()=>T(!0),{once:!0}),document.head.appendChild(n)},[t]),(0,h.useEffect)(()=>{if(!HF||t!==`signup`||!w||!E.current||!window.turnstile)return;let e=E.current;e.innerHTML=``,C(``),D.current=window.turnstile.render(e,{sitekey:HF,callback:e=>{C(typeof e==`string`?e:``)},"expired-callback":()=>{C(``)},"error-callback":()=>{C(``),c(`Captcha validation failed. Please retry.`)}})},[t,w]);async function P(a){a.preventDefault();let s=new FormData(a.currentTarget),l={firstName:String(s.get(`firstName`)??r.firstName),lastName:String(s.get(`lastName`)??r.lastName),email:String(s.get(`email`)??r.email),company:String(s.get(`company`)??r.company),username:String(s.get(`username`)??r.username),password:String(s.get(`password`)??r.password),confirmPassword:String(s.get(`confirmPassword`)??r.confirmPassword),resetToken:String(s.get(`resetToken`)??r.resetToken)};if(t===`signup`&&!k.current){if(l.password.length<10){c(`Use at least 10 characters for the password.`);return}if(l.password!==l.confirmPassword){c(`Password and confirmation do not match.`);return}if(HF&&!S){c(`Captcha is required.`);return}c(``),u(``),_(!1),f(!0);return}let d=k.current;k.current=!1,o(!0),c(``),u(``);try{if(t===`signup`){if(l.password.length<10)throw Error(`Use at least 10 characters for the password.`);if(l.password!==l.confirmPassword)throw Error(`Password and confirmation do not match.`);if(HF&&!S)throw Error(`Captcha is required.`);let e=await VM({firstName:l.firstName.trim(),lastName:l.lastName.trim(),email:l.email.trim(),company:l.company.trim(),username:l.username.trim(),password:l.password,termsAccepted:d,privacyNoticeVersion:PM,captchaToken:S||void 0});u(e.message),y(e.emailVerificationRequired?l.email.trim():``),n(`login`),i(e=>({...e,password:``,confirmPassword:``}));return}if(t===`forgot`){let e=l.email.trim();if(!e)throw Error(`Enter your email address.`);u(`${(await GM(e)).message} Copy the token from the email below.`),n(`reset`);return}if(t===`reset`){if(!l.resetToken.trim())throw Error(`Reset token is required.`);if(l.password.length<10)throw Error(`Use at least 10 characters for the password.`);if(l.password!==l.confirmPassword)throw Error(`Password and confirmation do n
4411ot match.`);u((await KM(l.resetToken.trim(),l.password)).message),n(`login`),i(e=>({...e,password:``,confirmPassword:``,resetToken:``}));return}let r=await WM(l.username.trim(),l.password);e({token:r.token,user:r.user})}catch(e){c(e instanceof Error?e.message:`Authentication failed`),t===`login`&&e instanceof Error&&e.message===`Verify your email before logging in.`&&y(l.username.trim()),t===`signup`&&HF&&window.turnstile&&D.current!==null&&(window.turnstile.reset(D.current),C(``))}finally{o(!1)}}return(0,Z.jsxs)(`main`,{className:`auth-page`,children:[(0,Z.jsxs)(`section`,{className:`auth-card`,children:[(0,Z.jsxs)(`header`,{className:`auth-brand`,children:[(0,Z.jsxs)(`div`,{className:`auth-brand-copy`,children:[(0,Z.jsx)(`div`,{className:`auth-brand-kicker`,children:(0,Z.jsx)(`strong`,{children:`Beta`})}),(0,Z.jsx)(`h1`,{children:`3DSusp Web`})]}),(0,Z.jsx)(`a`,{className:`auth-bspoke-logo`,href:`https://www.bspokeautomotive.it/`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open Bspoke Automotive website`,"data-ui-tooltip":`Open Bspoke Automotive website.`,children:(0,Z.jsx)(`img`,{src:KF,alt:`Bspoke Automotive`})})]}),(0,Z.jsxs)(`div`,{className:`auth-mode`,children:[(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":t===`login`,onClick:()=>j(`login`),children:`Login`}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":t===`signup`,onClick:()=>j(`signup`),children:`Sign up`}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":t===`forgot`||t===`reset`,onClick:()=>j(`forgot`),children:`Reset password`})]}),(0,Z.jsxs)(`form`,{ref:O,className:`auth-form`,onSubmit:P,children:[t===`signup`?(0,Z.jsxs)(`div`,{className:`auth-grid`,children:[(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`First name`}),(0,Z.jsx)(`input`,{name:`firstName`,value:r.firstName,onChange:e=>A(`firstName`,e.target.value),required:!0})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Last name`}),(0,Z.jsx)(`input`,{name:`lastName`,value:r.lastName,onChange:e=>A(`lastName`,e.target.value),required:!0})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Email`}),(0,Z.jsx)(`input`,{name:`email`,type:`email`,value:r.email,onChange:e=>A(`email`,e.target.value),required:!0})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`University / Company`}),(0,Z.jsx)(`input`,{name:`company`,autoComplete:`organization`,value:r.company,onChange:e=>A(`company`,e.target.value),required:!0})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Username`}),(0,Z.jsx)(`input`,{name:`username`,autoComplete:`username`,value:r.username,onChange:e=>A(`username`,e.target.value),required:!0})]})]}):null,t===`forgot`?(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Email`}),(0,Z.jsx)(`input`,{name:`email`,type:`email`,autoComplete:`email`,value:r.email,onChange:e=>A(`email`,e.target.value),required:!0})]}):t===`login`?(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Username`}),(0,Z.jsx)(`input`,{name:`username`,autoComplete:`username`,value:r.username,onChange:e=>A(`username`,e.target.value),required:!0})]}):null,t===`reset`?(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Reset token`}),(0,Z.jsx)(`input`,{name:`resetToken`,value:r.resetToken,onChange:e=>A(`resetToken`,e.target.value),required:!0})]}):null,t===`login`||t===`signup`||t===`reset`?(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Password`}),(0,Z.jsxs)(`div`,{className:`auth-password-input`,children:[(0,Z.jsx)(`input`,{name:`password`,autoComplete:t===`login`?`current-password`:`new-password`,type:b?`text`:`password`,value:r.password,onChange:e=>A(`password`,e.target.value),required:!0}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>x(e=>!e),"aria-label":b?`Hide password`:`Show password`,title:b?`Hide password`:`Show password`,children:b?(0,Z.jsx)(ne,{size:16,"aria-hidden":`true`}):(0,Z.jsx)(N,{size:16,"aria-hidden":`true`})})]})]}):null,t===`signup`||t===`reset`?(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Confirm password`}),(0,Z.jsxs)(`div`,{className:`auth-password-input`,children:[(0,Z.jsx)(`input`,{name:`confirmPassword`,autoComplete:`new-password`,type:b?`text`:`password`,value:r.confirmPassword,onChange:e=>A(`confirmPassword`,e.target.value),required:!0}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>x(e=>!e),"aria-label":b?`Hide password`:`Show password`,title:b?`Hide password`:`Show password`,children:b?(0,Z.jsx)(ne,{size:16,"aria-hidden":`true`}):(0,Z.jsx)(N,{size:16,"aria-hidden":`true`})})]})]}):null,t===`signup`&&HF?(0,Z.jsx)(`div`,{className:`auth-captcha`,ref:E}):null,t===`signup`?(0,Z.jsxs)(`p`,{className:`auth-privacy-note`,children:[`We use your details only to create and secure your account and send essential service emails.`,` `,(0,Z.jsx)(`button`,{type:`button`,onClick:()=>m(!0),children:`Read the Privacy Policy`})]}
4411):null,s?(0,Z.jsx)(`div`,{className:`auth-error`,role:`alert`,children:s}):null,l?(0,Z.jsx)(`div`,{className:`auth-success`,role:`status`,children:l}):null,t===`login`&&v?(0,Z.jsx)(`button`,{type:`button`,className:`auth-resend-verification`,onClick:()=>void M(),disabled:a,children:a?`Sending...`:`Resend verification email`}):null,t===`verify`?null:(0,Z.jsxs)(`button`,{type:`submit`,className:`auth-submit`,disabled:a,autoFocus:t===`login`,children:[(0,Z.jsx)(le,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:a?`Working...`:t===`signup`?`Create account`:t===`forgot`?`Send reset instructions`:t===`reset`?`Set new password`:`Login`})]})]}),t===`login`?(0,Z.jsxs)(`aside`,{className:`auth-beta-notice`,"aria-label":`Beta version notice`,children:[(0,Z.jsx)(`strong`,{children:`Beta version`}),(0,Z.jsxs)(`span`,{children:[`This version must not be used for commercial purposes. If you would like to report a bug or share a suggestion, please write to `,(0,Z.jsx)(`a`,{href:`mailto:[email protected]`,children:`[email protected]`}),`.`]})]}):null]}),d?(0,Z.jsx)(`div`,{className:`auth-terms-backdrop`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`auth-terms-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`signup-terms-title`,children:[(0,Z.jsxs)(`header`,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{children:`Before creating your account`}),(0,Z.jsx)(`h2`,{id:`signup-terms-title`,children:`Terms & Conditions`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`icon-only`,onClick:te,"aria-label":`Close terms`,children:`x`})]}),(0,Z.jsx)(`pre`,{className:`auth-terms-text`,children:NM}),(0,Z.jsxs)(`label`,{className:`auth-terms-check`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked)}),(0,Z.jsx)(`span`,{children:`I have read and accept these Terms & Conditions, including the beta and non-commercial-use terms.`})]}),(0,Z.jsxs)(`footer`,{children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:te,children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,className:`auth-submit`,disabled:!g,onClick:ee,children:`Accept and create account`})]})]})}):null,p?(0,Z.jsx)(`div`,{className:`auth-terms-backdrop`,role:`presentation`,onClick:e=>{e.target===e.currentTarget&&m(!1)},children:(0,Z.jsxs)(`section`,{className:`auth-terms-dialog auth-privacy-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`auth-privacy-title`,children:[(0,Z.jsxs)(`header`,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{children:`Data protection`}),(0,Z.jsx)(`h2`,{id:`auth-privacy-title`,children:`Privacy Policy`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`icon-only`,onClick:()=>m(!1),"aria-label":`Close privacy policy`,children:`x`})]}),(0,Z.jsx)(`div`,{className:`auth-privacy-body`,children:(0,Z.jsx)(FM,{})}),(0,Z.jsx)(`footer`,{children:(0,Z.jsx)(`button`,{type:`button`,className:`auth-submit`,onClick:()=>m(!1),children:`Close`})})]})}):null]})}function wq({profile:e,onApply:t,onClose:n}){let[r,i]=(0,h.useState)(()=>e.halfProfile.map(e=>({y:String(e.y),z:String(e.z)}))),[a,o]=(0,h.useState)(null),s=(0,h.useMemo)(()=>[`Y [mm],Z [mm]`,...r.map(e=>`${e.y.trim()},${e.z.trim()}`)].join(` 4412`),[r]);(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);function c(e,t,n){i(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r)),o(null)}async function l(){try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(s);else if(!pV(s))throw Error(`Clipboard unavailable`);o(`CSV copied.`)}catch{o(pV(s)?`CSV copied.`:`Clipboard unavailable.`)}}function u(){try{Yw(s,e.fileName),t(s)}catch(e){o(e instanceof Error?e.message:`The tyre profile could not be applied.`)}}return(0,Z.jsx)(`div`,{className:`app-warning-overlay tyre-profile-editor-overlay`,role:`presentation`,onClick:e=>e.target===e.currentTarget&&n(),children:(0,Z.jsxs)(`section`,{className:`tyre-profile-editor-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tyre-profile-editor-title`,children:[(0,Z.jsxs)(`header`,{className:`tyre-profile-editor-header`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`tyre-profile-editor-title`,children:`Edit tyre profile CSV`}),(0,Z.jsx)(`p`,{children:`Change the half-profile coordinates in millimetres. Copy the CSV to use it outside 3DSusp Web.`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-close-button`,"aria-label":`Close tyre profile editor`,onClick:n,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{className:`tyre-profile-editor-table`,role:`table`,"aria-label":`Tyre profile Y and Z coordinates`,children:[(0,Z.jsxs)(`div`,{className:`tyre-profile-editor-row tyre-profile-editor-head`,role:`row`,children:[(0,Z.jsx)(`span`,{role:`columnheader`,children:`#`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Y [mm]`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Z [mm]`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`})]}),r.map((e,t)=>(0,Z.jsxs)(`div`,{className:`tyre-profile-editor-row`,role:`row`,children:[(0,Z.jsx)(`span`,{className:`tyre-profile-editor-index`,role:`cell`,children:t+1}),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:e.y,"aria-label":`Row ${t+1}
4412 Y coordinate in millimetres`,onChange:e=>c(t,`y`,e.target.value)}),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:e.z,"aria-label":`Row ${t+1} Z coordinate in millimetres`,onChange:e=>c(t,`z`,e.target.value)}),(0,Z.jsx)(`button`,{type:`button`,className:`tyre-profile-editor-remove-row`,"aria-label":`Remove row ${t+1}`,"data-ui-tooltip":`Remove this CSV row.`,disabled:r.length<=2,onClick:()=>i(e=>e.filter((e,n)=>n!==t)),children:(0,Z.jsx)(we,{size:13,"aria-hidden":`true`})})]},t))]}),(0,Z.jsxs)(`footer`,{className:`tyre-profile-editor-footer`,children:[(0,Z.jsx)(`div`,{className:`tyre-profile-editor-status`,role:`status`,children:a}),(0,Z.jsxs)(`button`,{type:`button`,className:`secondary`,onClick:()=>i(e=>[...e,{y:``,z:``}]),children:[(0,Z.jsx)(ge,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Add row`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`secondary`,onClick:()=>void l(),children:[(0,Z.jsx)(te,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Copy CSV`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:n,children:`Cancel`}),(0,Z.jsxs)(`button`,{type:`button`,className:`tyre-profile-editor-apply`,onClick:u,children:[(0,Z.jsx)(E,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Apply`})]})]})]})})}var Tq={"Core Settings":`Selects the suspension architecture and its main configuration.`,"Model Options":`Enables optional suspension-model features.`,"Vehicle Settings":`Defines wheel, tyre, axle and vehicle reference dimensions.`,"Suspension Geometry":`Edits chassis-side and wheel-side hardpoint coordinates.`,"Link Lengths":`Shows the calculated lengths of the suspension links.`,"Suspension Elements":`Configures springs, anti-roll bars and the third element.`,"Steering Settings":`Defines rack, pinion and steering-column geometry.`,"Run Parameters":`Sets the ranges and resolution used for the analysis.`,"Graphic Settings":`Sets the size and visual style of displayed geometry.`,"Display Toggles A":`Shows or hides physical suspension components.`,"Display Toggles B":`Shows or hides reference geometry and analysis overlays.`,"Imported STEP Meshes":`Lists imported STEP meshes and controls the selected mesh appearance.`,Transform:`Moves, rotates and scales the selected STEP mesh.`,"Charts and Results":`Selects analysis charts and numerical results.`,"Setup Monitor":`Summarises the current setup changes and solved values.`,Animation:`Controls bump, steer and roll animation playback.`,Monitor:`Shows the current kinematic values and gradients.`,Optimizer:`Defines and evaluates the suspension optimization study.`};function Eq(e){return(e??``).replace(/\s+/g,` `).trim()}function Dq(e){return Eq(e.getAttribute(`aria-label`))||Eq(e.closest(`label`)?.textContent)||Eq(e.textContent)}function Oq(e){let t=Eq(e.getAttribute(`aria-label`)),n=Eq(e.querySelector(`h2, h3`)?.textContent)||t;return!n||n.length>96?null:Tq[n]??`Controls and information for ${n}.`}function kq(e){let t=Dq(e);return!t||t.length>96?null:e.tagName===`INPUT`&&e.type===`checkbox`?`Shows or hides ${t}.`:e.tagName===`INPUT`&&e.type===`range`?`Adjusts ${t}.`:e.tagName===`SELECT`?`Selects ${t}.`:e.tagName===`BUTTON`&&Eq(e.textContent)===``?/^(close|minimize|maximize|restore)\b/i.test(t)?null:`${t}.`:null}function Aq(e){return e.dataset.uiTooltip?.trim()||e.getAttribute(`title`)?.trim()||(kq(e)??Oq(e))}function jq(e){return e.disabled||e.readOnly?!1:e.type===`number`||e.inputMode===`decimal`||e.inputMode===`numeric`||e.dataset.numericInput===`true`}function Mq(e){window.requestAnimationFrame(()=>{!e.isConnected||document.activeElement!==e||!jq(e)||e.select()})}function Nq({stepIndex:e,onPrevious:t,onNext:n,onFinish:r}){let i=mI[e]??mI[0],[a,o]=(0,h.useState)(null),[s,c]=(0,h.useState)(null),l=(0,h.useRef)(null),u=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=window.requestAnimationFrame(()=>u.current?.focus());return()=>window.cancelAnimationFrame(e)},[e]),(0,h.useLayoutEffect)(()=>{let e=()=>{let e=i.target?document.querySelector(i.target):null;if(!e){o(null);return}let t=e.getBoundingClientRect();o({top:Math.max(4,t.top-6),left:Math.max(4,t.left-6),width:Math.max(0,Math.min(window.innerWidth-Math.max(4,t.left-6)-4,t.width+12)),height:Math.max(0,Math.min(window.innerHeight-Math.max(4,t.top-6)-4,t.height+12))})};e();let t=window.setTimeout(e,80),n=window.setInterval(e,220);return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.clearTimeout(t),window.clearInterval(n),window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[i.target]),(0,h.useEffect)(()=>
4412{if(!a){c(null);return}let e=l.current?.getBoundingClientRect(),t=e?.width??468,n=e?.height??280,r=a.left+a.width,i=a.top+a.height,o=(e,t,n)=>Math.max(t,Math.min(n,e)),s=window.innerWidth-r,u=a.left,d=window.innerHeight-i,f=a.top,p,m;s>=t+18?(p=r+18,m=o(a.top+a.height/2-n/2,14,window.innerHeight-n-14)):u>=t+18?(p=a.left-t-18,m=o(a.top+a.height/2-n/2,14,window.innerHeight-n-14)):d>=n+18?(p=o(a.left+a.width/2-t/2,14,window.innerWidth-t-14),m=i+18):f>=n+18?(p=o(a.left+a.width/2-t/2,14,window.innerWidth-t-14),m=a.top-n-18):(p=Math.max(14,window.innerWidth-t-14),m=Math.max(14,window.innerHeight-n-14)),c({top:m,left:p})},[e,a]);let d=e===0,f=e===mI.length-1;return(0,Z.jsxs)(`div`,{className:`product-tutorial`,role:`presentation`,children:[a?(0,Z.jsx)(`div`,{className:`product-tutorial-highlight${d?` product-tutorial-highlight-instant`:``}`,"aria-hidden":`true`,style:a}):(0,Z.jsx)(`div`,{className:`product-tutorial-shade`,"aria-hidden":`true`}),(0,Z.jsxs)(`section`,{ref:l,className:`product-tutorial-card${s?` product-tutorial-card-anchored`:``}`,style:s??void 0,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`product-tutorial-title`,children:[(0,Z.jsxs)(`header`,{children:[(0,Z.jsx)(`span`,{children:`Getting started · ${e+1}/${mI.length}`}),(0,Z.jsx)(`button`,{type:`button`,className:`product-tutorial-skip`,onClick:r,children:`Skip tour`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`product-tutorial-title`,children:i.title}),(0,Z.jsx)(`p`,{children:i.description})]}),(0,Z.jsxs)(`footer`,{children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:t,disabled:d,children:`Back`}),(0,Z.jsx)(`button`,{ref:u,type:`button`,onClick:f?r:n,children:f?`Finish`:`Next`})]})]})]})}function Pq({session:e,onLogout:t}){let n=dq(),r=(0,h.useRef)(window.crypto.randomUUID());(0,h.useEffect)(()=>{let t=(t,n=!1)=>{qM(e.token,t,r.current,n).catch(()=>void 0)},n=()=>{window.document.visibilityState===`visible`&&t(!0)},i=()=>{let e=window.document.visibilityState===`visible`;t(e,!e)},a=()=>{t(!1,!0)};n();let o=window.setInterval(n,3e4);return window.document.addEventListener(`visibilitychange`,i),window.addEventListener(`pagehide`,a),()=>{window.clearInterval(o),window.document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`pagehide`,a)}},[null,e.token]);let[i]=(0,h.useState)(()=>bq()),a=i?.spmText??Nw,o=i?.sourceName??`Double_Wishbone.spm`,[s]=(0,h.useState)(()=>{let e=i?.tyreProfile;if(!e)return null;try{return Yw(e.text,e.fileName)}catch{return null}}),c=(0,h.useMemo)(()=>WL(),[]),l=(0,h.useMemo)(()=>JL(),[]),u=(0,h.useMemo)(()=>XL(),[]),[d,f]=(0,h.useState)(()=>a),[p,m]=(0,h.useState)(()=>i?.lastSavedSpmText??Nw),[g,_]=(0,h.useState)(()=>o),[v,y]=(0,h.useState)(!1),[x,S]=(0,h.useState)(!1),[j,M]=(0,h.useState)(!1),[ne,N]=(0,h.useState)(()=>{let e=jL(eC(a,o)),t=kL(e);return e&&t&&EL(e)===EL(t.name)?t:null}),[se,le]=(0,h.useState)(null),[fe,pe]=(0,h.useState)(null),[B,xe]=(0,h.useState)(()=>null),[Ce,Te]=(0,h.useState)(null),[Ae,je]=(0,h.useState)(null),[Me,Ne]=(0,h.useState)(()=>pC),[Pe,Fe]=(0,h.useState)(null),[Ie,Le]=(0,h.useState)(!0),[Re,ze]=(0,h.useState)(!0),[V,Be]=(0,h.useState)(null),[Ve,He]=(0,h.useState)(!1),[Ue,We]=(0,h.useState)(`suspensionSettings`),[Ge,Ke]=(0,h.useState)(!1),[qe,Je]=(0,h.useState)(()=>jK()),[Ye,Xe]=(0,h.useState)([]),[Ze,Qe]=(0,h.useState)(!1),[$e,et]=(0,h.useState)(`normal`),[tt,nt]=(0,h.useState)(null),[rt,it]=(0,h.useState)({}),[at,ot]=(0,h.useState)({}),[st,ct]=(0,h.useState)(()=>BH()),[lt,ut]=(0,h.useState)(`idle`),[dt,ft]=(0,h.useState)(null),[pt,mt]=(0,h.useState)(!1),[ht,gt]=(0,h.useState)(`bump`),[_t,vt]=(0,h.useState)(`bump`),[yt,bt]=(0,h.useState)(null),[xt,St]=(0,h.useState)(null),[Ct,wt]=(0,h.useState)(0),Tt=(0,h.useRef)(!1),[Et,Dt]=(0,h.useState)({bump:0,steer:0,roll:0}),[Ot,kt]=(0,h.useState)({bump:0,steer:0,roll:0}),[At,jt]=(0,h.useState)(!1),[Mt,Nt]=(0,h.useState)({status:`idle`,requestId:0,samples:[]}),Pt=(0,h.useRef)(0),Ft=(0,h.useRef)(1),[It,Lt]=(0,h.useState)(()=>BL()),[Rt,zt]=(0,h.useState)(`chassisFixed`),[Bt,Vt]=(0,h.useState)(null),[Ht,Ut]=(0,h.useState)([]),[Wt,Gt]=(0,h.useState)(()=>s),[Kt,qt]=(0,h.useState)(!1),[Jt,Yt]=(0,h.useState)(null),[Xt,Zt]=(0,h.useState)(null),[Qt,$t]=(0,h.useState)(!1),[en,tn]=(0,h.useState)(!1),[nn,rn]=(0,h.useState)(!1),[an,on]=(0,h.useState)(null),[sn,cn]=(0,h.useState)(()=>SV(null)),[ln,un]=(0,h.useState)(()=>mV({x:0,y:0,z:0})),[dn,fn]=(0,h.useState)(null),[pn,mn]=(0,h.useState)(null),[hn,H]=(0,h.useState)(!1),[gn,_n]=(0,h.useState)(!1),[vn,yn]=(0,h.useState)(!1),[bn,xn]=(0,h.useState)(!1),[Sn,Cn]=(0,h.useState)(!1),[wn,Tn]=(0,h.useState)(null),[En,Dn]=(0,h.useState)(!1),[On,kn]=(0,h.useState)(!1),[An,jn]=(0,h.useState)(!1),[Mn,Nn]=(0,h.useState)({suspensionName:`Susp_Name`,kSpring:`200`,springPreload:`0`,cDamper:`10`}),[Pn,Fn]=(0,h.useState)(!1),[In,Ln]=(0,h.useState)({folderName:vV(g),parentFolderLabel:``,statusMessage:``}),[Rn,zn]=(0,h.useState)(null),[Bn,Vn]=(0,h.useState)(null),[Hn,Un]=(0,h.useState)([]),[Wn,Gn]=(0,h.useState)(null),[Kn,qn]=(0,h.useState)(null),[U,Jn]=(0,h.useState)(null),[W,Yn]=(0,h.useState)([]),[Xn,Zn]=(0,h.useState)(!1),[Qn,$n]=(0,h.useState)(c),[er,tr]=(0,h.useState)(!1),[nr,rr]=(0,h.useState)(()=>GL(c)),[ir,ar]=(0,h.useState)(c.defaultStep),[or,sr]=(0,h.useState)(l),[cr,lr]=(0,h.useState)(u),[ur,dr]=(0,h.useState)(!1),[fr,pr]=(0,h.useState)(()=>$L(l)),[mr,hr]=(0,h.useState)(!1),[gr,_r]=(0,h.useState)([]),vr=(0,h.useRef)(``),[yr,br]=(0,h.useState)(!1),[xr,Sr]=(0,h.useState)(!1),[Cr,wr]=(0,h.useState)(!1),[Tr,Er]=(0,h.useState)([]),[Dr,Or]=(0,h.useState)(!1),[kr,Ar]=(0,h.useState)(null),[jr,Mr]=(0,h.useState)(null),[Nr,Pr]=(0,h.useState)(()=>i?.sourceKind??`local`),[Fr,Ir]=(0,h.useState)(!1),[Lr,Rr]=(0,h.useState)(!1),[zr,Br]=(0,h.useState)(!1),[Vr,Hr]=(0,h.useState)(!1),[Ur,Wr]=(0,h.useState)(!1),[Gr,Kr]=(0,h.useState)(null),[qr,Jr]=(0,h.useState)(null),Yr=(0,h.useRef)(!1),[Xr,Zr]=(0,h.useState)(null),[Qr,$r]=(0,h.useState)(!1),[ei,ti]=(0,h.useState)(null),[ni,ri]=(0,h.useState)(null),[ii,ai]=(0,h.useState)(null),oi=(0,h.useRef)(null),si=(0,h.useRef)(null),ci=(0,h.useRef)(null),li=(0,h.useRef)(null),ui=(0,h.useRef)(null),di=(0,h.useRef)(null),fi=(0,h.useRef)(null),pi=(0,h.useRef)(null),mi=(0,h.useRef)(null),hi=(0,h.useRef)(null),gi=(0,h.useRef)(null),_i=(0,h.useRef)(null),vi=(0,h.useRef)(null),yi=(0,h.useRef)(null),bi=(0,h.useRef)(!1),xi=(0,h.useRef)(null),Si=(0,h.useRef)(null),Ci=(0,h.useRef)(null),wi=(0,h.useRef)(null),Ti=(0,h.useRef)(null),Ei=(0,h.useRef)(null),Di=(0,h.useRef)(null),Oi=(0,h.useRef)(null),ki=(0,h.useRef)(null),Ai=(0,h.useRef)(null),ji=(0,h.useRef)(!1),Mi=(0,h.useRef)(null),Ni=(0,h.useRef)(null),Pi=(0,h.useRef)(null),Fi=(0,h.useRef)(32),Ii=(0,h.useRef)(null),Li=(0,h.useRef)(new Set);(0,h.useRef)(new Set);let Ri=(0,h.useRef)(null),zi=(0,h.useRef)(null),Bi=(0,h.useRef)(null),Vi=(0,h.useRef)(!1),Hi=(0,h.useRef)(new Map),Ui=(0,h.useRef)(new Set),Wi=(0,h.useRef)(null),Gi=(0,h.useRef)(null),Ki=(0,h.useRef)(null),[qi,Ji]=(0,h.useState)(.42),[Yi,Xi]=(0,h.useState)(nz),[Zi,Qi]=(0,h.useState)(`manual`),$i=(0,h.useRef)(`manual`),ea=(0,h.useRef)(nz),ta=(0,h.useRef)(null),na=(0,h.useRef)(!1),[ra,ia]=(0,h.useState)(oz),[aa,oa]=(0,h.useState)(0),[sa,ca]=(0,h.useState)(null),[la,ua]=(0,h.useState)(fq(null)),[da,fa]=(0,h.useState)({x:24,y:24}),[pa,ma]=(0,h.useState)(!1),[ha,ga]=(0,h.useState)(!1),[_a,va]=(0,h.useState)(!1),ya=(0,h.useRef)(!1),[ba,xa]=(0,h.useState)(!1),[Sa,
4412Ca]=(0,h.useState)([]),[wa,Ta]=(0,h.useState)(!1),[Ea,Da]=(0,h.useState)(`Workspace ready`),[Oa,ka]=(0,h.useState)(null),[Aa,ja]=(0,h.useState)(null),[Ma,Na]=(0,h.useState)(null),[Pa,Fa]=(0,h.useState)(`Double_Wishbone.spm`),[Ia,La]=(0,h.useState)(``),[Ra,za]=(0,h.useState)(``),[Ba,Va]=(0,h.useState)(``),[Ha,Ua]=(0,h.useState)(null),[Wa,Ga]=(0,h.useState)(!1),[Ka,qa]=(0,h.useState)(()=>RL()),[Ja,Ya]=(0,h.useState)(()=>QL()),[Xa,Za]=(0,h.useState)(!1),[Qa,$a]=(0,h.useState)(0);function eo(){let e=Ri.current,t=e=>!!e.navigator.userActivation?.isActive;return e&&!e.closed&&t(e)?e:t(window)?window:e&&!e.closed&&e.document.hasFocus()?e:window}let[to,no]=(0,h.useState)(()=>typeof window<`u`&&window.matchMedia?window.matchMedia(`(prefers-color-scheme: dark)`).matches:!0),[ro,io]=(0,h.useState)(0),ao=(0,h.useRef)(0),oo=(0,h.useRef)(!0),so=(0,h.useRef)({key:``,atMs:0}),co=(0,h.useRef)(null),lo=(0,h.useRef)(null),uo=(0,h.useRef)(null),fo=(0,h.useRef)(null),po=(0,h.useRef)(null),mo=(0,h.useRef)([]),ho=(0,h.useRef)(null),go=(0,h.useRef)(d),_o=(0,h.useRef)(g),[vo,yo]=(0,h.useState)({token:0,preset:`default3D`});(0,h.useEffect)(()=>{let t=!1;return JM(e.token).then(e=>{!t&&!Yr.current&&e.showTutorial&&(Yr.current=!0,Jr(0))}).catch(()=>void 0),()=>{t=!0}},[null,e.token]),(0,h.useEffect)(()=>{if(qr===null)return;let e=mI[qr];e&&(ua(`none`),br(!!e.openFileMenu),Sr(!!e.openTemplateSubmenu),wr(!1),Hr(!1),Wr(!1),Rr(!!e.openModeMenu),e.workTab&&We(e.workTab),e.showPoints&&ze(!0),tr(!1),Ke(!!e.openMonitor),Ir(!!e.openOutputMenu))},[qr]),(0,h.useEffect)(()=>qP(e=>{mo.current.push({spmText:d,sourceName:g,summary:`Optimizer geometry apply`}),Zr(hV(e.sourceSpmText,e.sourceName)),$r(!0),f(e.optimizedSpmText),_(e.sourceName.replace(/\.spm$/i,``)+`_optimized.spm`),bt(XU(eC(e.optimizedSpmText,e.sourceName))),wt(e=>e+1),bo(`Optimizer result applied | Source geometry retained as reference overlay`)}),[g,d]),(0,h.useEffect)(()=>{let t=t=>{if(t.origin!==window.location.origin||t.source!==Wi.current)return;if(t.data?.type===`3dsusp-optimizer-solve-completed`){rN(e.token,t.data.authorizationId).catch(()=>void 0);return}if(t.data?.type!==`3dsusp-optimizer-auth-request`||!t.data.requestId)return;let n=t.source,r=t.data;(async()=>{let t,i=[];if(r.operation===`solve`&&/^[a-f0-9]{64}$/.test(r.requestHash)&&/^[A-Za-z0-9_-]{32,128}$/.test(r.nonce)){let n=await nN(e.token,r.requestHash,r.nonce);t={type:sP,requestId:r.requestId,authorization:n}}else if(r.operation===`wasm-download`){let n=Gi.current??await aN(e.token);Gi.current=n;let a={...n,bytes:n.bytes.slice(0)};t={type:sP,requestId:r.requestId,wasm:a},i=[a.bytes]}else throw Error(`Invalid optimizer authorization request.`);n.closed||n.postMessage(t,window.location.origin,i)})().catch(e=>{if(n.closed)return;let t={type:sP,requestId:r.requestId,error:e instanceof Error?e.message:`Optimizer authorization failed.`};n.postMessage(t,window.location.origin)})};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[e.token]),(0,h.useEffect)(()=>{let e=window.document,t=t=>{if(!(t.target instanceof HTMLInputElement)||!jq(t.target)){po.current=null;return}po.current=e.activeElement===t.target?null:t.target},n=e=>{e.target instanceof HTMLInputElement&&jq(e.target)&&po.current===e.target&&(Mq(e.target),po.current=null)};return e.addEventListener(`pointerdown`,t,!0),e.addEventListener(`focusin`,n),()=>{e.removeEventListener(`pointerdown`,t,!0),e.removeEventListener(`focusin`,n)}},[]);let bo=(0,h.useCallback)(e=>{let t=`${new Date().toLocaleTimeString(`en-GB`,{hour12:!1})} | ${e}`;_r(e=>{let n=[...e,t];return n.length>uz?n.slice(n.length-uz):n})},[]),xo=(0,h.useCallback)(e=>{let t=Fi.current+1;Fi.current=t,Xe(n=>n.map(n=>n.id===e?{...n,zIndex:t}:n))},[]),So=(0,h.useCallback)((e,t=`pin`)=>{let n=t===`refresh`,r=n?Fi.current:Fi.current+1;n||(Fi.current=r),Xe(t=>{if(t.find(t=>t.id===e.id))return t.map(t=>t.id===e.id?{...t,...e,seriesSet:OR(e.seriesSet),zIndex:n?t.zIndex:r}:t);if(n)return t;let i=t.length%5*24;return[...t,{...e,seriesSet:OR(e.seriesSet),left:22+i,top:48+i,width:440,height:320,zIndex:r}]}),n||bo(`Chart pinned | ${e.title}`)},[bo]),Co=(0,h.useCallback)(e=>{Xe(t=>t.filter(t=>t.id!==e))},[]),wo=(0,h.useCallback)(e=>{if(!e||Li.current.has(e.requestId))return;Li.current.add(e.requestId),Li.current.size>
441280&&(Li.current=new Set(Array.from(Li.current).slice(-40)));let{action:t=`pin`,requestId:n,...r}=e;So(r,t)},[So]),To=(0,h.useCallback)((e,t,n,r)=>{let i=Mi.current?.getBoundingClientRect(),a=Math.max(8,(i?.width??900)-n-8),o=Math.max(8,(i?.height??560)-r-8);return{left:Math.min(Math.max(8,e),a),top:Math.min(Math.max(8,t),o)}},[]);function Eo(e,t,n){if(n.button!==0||t===`move`&&n.target instanceof HTMLElement&&n.target.closest(`button`))return;let r=Ye.find(t=>t.id===e);r&&(n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),xo(e),Ii.current={id:e,kind:t,pointerId:n.pointerId,startX:n.clientX,startY:n.clientY,left:r.left,top:r.top,width:r.width,height:r.height})}function Do(e){let t=Ii.current;if(!t||t.pointerId!==e.pointerId)return;e.preventDefault();let n=e.clientX-t.startX,r=e.clientY-t.startY,i=Mi.current?.getBoundingClientRect(),a=Math.max(300,(i?.width??900)-t.left-8),o=Math.max(230,(i?.height??560)-t.top-8);Xe(e=>e.map(e=>{if(e.id!==t.id)return e;if(t.kind===`resize`)return{...e,width:Math.min(Math.max(300,t.width+n),a),height:Math.min(Math.max(230,t.height+r),o)};let i=To(t.left+n,t.top+r,t.width,t.height);return{...e,left:i.left,top:i.top}}))}function Oo(e){let t=Ii.current;!t||t.pointerId!==e.pointerId||(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),Ii.current=null)}(0,h.useEffect)(()=>{let e=e=>{if(!(e.key!==ZI||!e.newValue))try{wo(kR(JSON.parse(e.newValue)))}catch{}},t=null;try{t=new BroadcastChannel(QI),t.onmessage=e=>wo(kR(e.data))}catch{t=null}return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e),t?.close()}},[wo]),(0,h.useEffect)(()=>{NR(Ye.map(e=>e.id))},[Ye]),(0,h.useEffect)(()=>{let e=e=>{Un(t=>cW(t,e.customGraphs)?t:aW(e.customGraphs)),Gn(t=>{let n=vW(e.customGraphLayoutName);return t===n?t:n}),qn(e.customGraphLayoutSource),Jn(e.customGraphLayoutSavedSignature);let t=vW(e.customGraphLayoutName);f(e=>bW(e,t))},t=t=>{t.key===VI&&e(vq())},n=null;try{n=new BroadcastChannel(HI),n.onmessage=t=>e(t.data)}catch{n=null}return window.addEventListener(`storage`,t),()=>{window.removeEventListener(`storage`,t),n?.close()}},[]),(0,h.useEffect)(()=>{let e=e=>{if(!(e.key!==cL||!e.newValue))try{mW(JSON.parse(e.newValue))}catch{}},t=null;try{t=new BroadcastChannel(lL),t.onmessage=e=>(mW(e.data),void 0)}catch{t=null}return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e),t?.close()}},[Oa,Aa,e.token,Sa]);let ko=(0,h.useCallback)((e,t)=>{let n=Date.now(),r=`${e}:${t}`;so.current.key===r&&n-so.current.atMs<1200||(so.current={key:r,atMs:n},bo(`Geometry changed | ${e} | ${t}`))},[bo]),Ao=(0,h.useCallback)(e=>{if(!e)return;Ui.current.delete(e);let t=Hi.current.get(e);t&&(t(),Hi.current.delete(e))},[]),jo=(0,h.useCallback)(()=>{Array.from(Hi.current.keys()).forEach(e=>{e.closed&&Ao(e)})},[Ao]),Mo=(0,h.useCallback)(e=>{if(jo(),!e||e.closed||Hi.current.has(e))return;let t=()=>{window.setTimeout(()=>{e.closed&&Ao(e)},0)};e.addEventListener(`pagehide`,t),Hi.current.set(e,()=>{e.removeEventListener(`pagehide`,t)})},[jo,Ao]),No=(0,h.useCallback)(()=>{jo(),Array.from(Hi.current.keys()).forEach(e=>{Ao(e),e.closed||e.close()})},[jo,Ao]),Po=(0,h.useCallback)(()=>{jo();let e=new Set(Ui.current);Array.from(Hi.current.keys()).forEach(t=>{try{new URLSearchParams(t.location.search).get(`report`)===`fullVehicleSelection`&&e.add(t)}catch{}}),e.forEach(e=>{Ao(e),e.closed||e.close()}),Ui.current.clear()},[jo,Ao]),Fo=(0,h.useCallback)(()=>{li.current!==null&&(window.clearTimeout(li.current),li.current=null)},[]),Io=(0,h.useCallback)(()=>{Fo(),ui.current=null,di.current=null,ri(null),ai(null)},[Fo]),Lo=(0,h.useCallback)((e,t)=>{Fo(),ui.current=e,li.current=window.setTimeout(()=>{if(ui.current!==e||!e.isConnected)return;let t=Aq(e);t&&(di.current=e,ri({text:t,align:e.dataset.uiTooltipAlign===`end`?`end`:`center`}),ai(null),li.current=null)},t)},[Fo]);(0,h.useEffect)(()=>{let e=e=>{if(!e||typeof e!=`object`)return null;let t=e,n=t.nodeType===1?t:t.parentElement;if(!n||typeof n.closest!=`function`||n.closest(`.animation-sidebar`)||n.closest(`.control-deck .section-title, .control-deck .load-side-title, .control-deck h2, .control-deck h3`)&&!n.closest(`button, input, select, textarea, a`))return null;let r=n.closest(`[data-ui-tooltip]`);if(r&&`dataset`in r)return r;let i=n.closest(`label`)?.querySelector(`input[type='checkbox'], input[type='range'], select`);if(i&&`dataset`in i&&Aq(i))return i;let a=n.closest(`button, input, select, textarea, a`);if(a&&`dataset`in a)return Aq(a)?a:null;if(n.closest(`.control-deck`))return null;let o=n.closest(`section[aria-label], .compact-panel, .control-column, .scene-panel, .projection-panel, .motion-panel, .load-side-card`);return o&&`dataset`in o&&Aq(o)?o:null},t=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches,n=n=>{if(!t)return;let r=e(n.target);!r||ui.current===r||di.current===r||Lo(r,TI)},r=t=>{let n=ui.current??di.current;n&&e(t.target)===n&&(t.relatedTarget&&n.contains(t.relatedTarget)||Io())},i=()=>Io(),a=[window.document],o=Ri.current?.document;
4412return o&&o!==window.document&&a.push(o),a.forEach(e=>{e.addEventListener(`pointerover`,n),e.addEventListener(`pointerout`,r),e.addEventListener(`pointerdown`,i)}),()=>{a.forEach(e=>{e.removeEventListener(`pointerover`,n),e.removeEventListener(`pointerout`,r),e.removeEventListener(`pointerdown`,i)}),Fo()}},[Fo,Xa,Qa,Io,Lo]),(0,h.useEffect)(()=>{if(!ni)return;let e=()=>{let e=di.current,t=ci.current;if(!e||!t||!e.isConnected){Io();return}let n=e.ownerDocument.defaultView??window,r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=r.bottom+14,o=a+i.height+12>n.innerHeight&&r.top-14-i.height>=12,s=o?r.top-14-i.height:Math.min(a,n.innerHeight-i.height-12),c=ni.align===`end`?r.right-i.width:r.left+r.width*.5-i.width*.5,l=Math.min(Math.max(c,12),n.innerWidth-i.width-12),u=ni.align===`end`?r.right-18:r.left+r.width*.5;ai({left:l,top:s,anchorOffset:Math.min(Math.max(u-l,18),Math.max(i.width-18,18)),placement:o?`top`:`bottom`})},t=di.current?.ownerDocument.defaultView??window,n=t.document,r=t.requestAnimationFrame(e);return t.addEventListener(`resize`,e),n.addEventListener(`scroll`,e,!0),()=>{t.cancelAnimationFrame(r),t.removeEventListener(`resize`,e),n.removeEventListener(`scroll`,e,!0)}},[Io,ni]);let Ro=p===null||d!==p,zo=Nr===`template`&&Ro||!Ro,Bo=Ka===`auto`?to?`dark`:`light`:Ka;(0,h.useEffect)(()=>{let e=window.document.documentElement;return e.classList.remove(`theme-dark`,`theme-light`),e.classList.add(`theme-${Bo}`),()=>e.classList.remove(`theme-dark`,`theme-light`)},[Bo]);let Vo=ni?{left:`${ii?.left??0}px`,top:`${ii?.top??0}px`,visibility:ii?`visible`:`hidden`,"--ui-tooltip-anchor-x":`${ii?.anchorOffset??24}px`}:void 0,G=(0,h.useMemo)(()=>eC(d,g),[g,d]),Ho=(0,h.useMemo)(()=>jL(G),[G]),Uo=G.suspension.axlePosition.trim().toLowerCase()===`rear`,Wo=j&&Uo;(0,h.useEffect)(()=>{if(!Ho){N(null);return}N(e=>{if(e&&EL(e.name)===EL(Ho))return e;let t=kL(Ho);return t&&EL(t.name)===EL(Ho)?t:null})},[Ho]),(0,h.useEffect)(()=>{},[null,G,u,x]),(0,h.useEffect)(()=>{let e=Jl(II(d,g));e!==d&&f(e)},[g,d]);let Go=(0,h.useMemo)(()=>B?eC(B.spmText,B.sourceName):null,[B]),Ko=(0,h.useMemo)(()=>!v||!B?null:Mw(B.spmText,B.sourceName,Me),[B,v,Me]),K=(0,h.useMemo)(()=>Ko?{...Ko.document,graphics:G.graphics}:G,[G,Ko]),qo=(0,h.useMemo)(()=>new Set(gI.filter(e=>!Fw(K,e.id)).map(e=>e.id)),[K]),Jo=(0,h.useMemo)(()=>!G.graphics.ghostWireframe||!p?null:eC(p,g),[G.graphics.ghostWireframe,p,g]),Yo=(0,h.useMemo)(()=>Xr?eC(Xr.spmText,Xr.sourceName):null,[Xr]),Xo=(0,h.useMemo)(()=>fe?eC(fe.spmText,fe.sourceName):null,[fe]),Zo=(0,h.useMemo)(()=>Qr?Yo:null,[Qr,Yo]),Qo=(0,h.useMemo)(()=>FB(G.fields),[G.fields]),$o=(0,h.useMemo)(()=>IB(G.fields),[G.fields]),es=(0,h.useMemo)(()=>LB(G),[G]),ts=(0,h.useMemo)(()=>mC(G,Me),[G,Me]),ns=(0,h.useMemo)(()=>kB(G.fields),[G.fields]),rs=(0,h.useMemo)(()=>yB(G.fields),[G.fields]),is=Wt!==null&&Jw(G.fields[`Wheel Definition`]),as=is?Wt:null,os=(0,h.useMemo)(()=>nn?(an?.meshes??[]).map((e,t)=>({key:`clash-envelope:${t}:${e.id}`,mesh:e.mesh,colorHex:e.colorHex})):[],[nn,an]),ss=(0,h.useMemo)(()=>nn?(an?.clashMeshes??[]).map((e,t)=>({key:`clash-highlight:${t}:${e.id}`,mesh:e.mesh})):[],[nn,an]),cs=(0,h.useMemo)(()=>nn?an?an.clashMeshes.length>0?`clash`:`clear`:`pending`:`idle`,[nn,an]);(0,h.useEffect)(()=>{if(!Ve&&!At){Nt(e=>e.status===`idle`&&e.samples.length===0?e:{status:`idle`,requestId:e.requestId,samples:[]});return}let e=Pt.current+1;Pt.current=e;let t=_t,n={...Ot};Nt({status:`pending`,requestId:e,samples:[],mode:t,seedMotion:n});let r=new Worker(new URL(``+new URL(`animationCache.worker-CJrdGwQe.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),i=!1;return r.onmessage=e=>{if(!(i||e.data.requestId!==Pt.current)){if(e.data.type===`success`){Nt({status:`ready`,requestId:e.data.requestId,samples:e.data.samples,mode:t,seedMotion:n,durationMs:e.data.durationMs}),r.terminate();return}Nt({status:`error`,requestId:e.data.requestId,samples:[],mode:t,seedMotion:n,message:e.data.message}),r.terminate()}},r.onerror=a=>{i||e!==Pt.current||(Nt({status:`error`,requestId:e,samples:[],mode:t,seedMotion:n,message:a.message||`Cannot build animation cache.`}),r.terminate())},r.postMessage({type:`build`,requestId:e,document:K,mode:t,baseMotion:n}
4412),()=>{i=!0,r.terminate()}},[K,_t,At,Ot,Ve]);let ls=At&&Mt.status===`ready`&&Mt.mode===_t&&aG(Mt.seedMotion,Ot)?Mt.samples:[],us=(0,h.useMemo)(()=>ls.length>0?CG(ls,K):[],[K,ls]),ds=(At?_t:ht)===`steer`?!0:void 0,fs=(0,h.useMemo)(()=>{if(At&&us.length>0){let e=bG(K,us,Et,_t);if(e)return{document:e.document,rightFrame:e.rightFrame,leftFrame:e.leftFrame}}return A_(K,Et,{useSteeringModel:ds})},[K,ds,_t,At,us,Et]),ps=Et,ms=fs,hs=(0,h.useMemo)(()=>Ge?A_(K,{bump:0,steer:0,roll:0}).rightFrame:null,[K,Ge]),gs=(0,h.useMemo)(()=>Ge?A_(K,{bump:EK,steer:0,roll:0}).rightFrame:null,[K,Ge]),_s=(0,h.useMemo)(()=>!Ge||!hs||!gs?null:XK(K,ms.rightFrame,ms.leftFrame,hs,gs,ps,ht,or),[K,ht,gs,Ge,ms.leftFrame,ms.rightFrame,hs,or,ps]),vs=(0,h.useMemo)(()=>!Ge||!Yo?null:A_(Yo,ps,{useSteeringModel:ds}),[ds,Ge,ps,Yo]),ys=(0,h.useMemo)(()=>Ge&&Yo?A_(Yo,{bump:0,steer:0,roll:0}).rightFrame:null,[Ge,Yo]),bs=(0,h.useMemo)(()=>Ge&&Yo?A_(Yo,{bump:EK,steer:0,roll:0}).rightFrame:null,[Ge,Yo]),xs=(0,h.useMemo)(()=>!Ge||!Yo||!vs||!ys||!bs?null:XK(Yo,vs.rightFrame,vs.leftFrame,ys,bs,ps,ht,or),[ht,Ge,or,ps,Yo,bs,ys,vs]),Ss=(0,h.useMemo)(()=>{if(!Ge||!v||!Go)return null;let e=A_(Go,ps,{useSteeringModel:ds});return XK(Go,e.rightFrame,e.leftFrame,A_(Go,{bump:0,steer:0,roll:0}).rightFrame,A_(Go,{bump:EK,steer:0,roll:0}).rightFrame,ps,ht,or)},[ds,ht,Ge,or,ps,Go,v]),Cs=(0,h.useMemo)(()=>{if(!Ge||!x||!Xo)return null;let e=A_(Xo,ps,{useSteeringModel:ds});return XK(Xo,e.rightFrame,e.leftFrame,A_(Xo,{bump:0,steer:0,roll:0}).rightFrame,A_(Xo,{bump:EK,steer:0,roll:0}).rightFrame,ps,ht,or)},[ds,ht,Ge,or,ps,Xo,x]),ws=(0,h.useCallback)((e,t=Di.current?.offsetWidth??OK,n=Di.current?.offsetHeight??320)=>{if(typeof window>`u`)return e;let r=Math.max(kK,window.innerWidth-t-kK),i=Math.max(kK,window.innerHeight-n-kK);return{x:Math.max(kK,Math.min(e.x,r)),y:Math.max(kK,Math.min(e.y,i))}},[]),Ts=(0,h.useCallback)(e=>{if(e.button!==0||e.target instanceof Element&&e.target.closest(`button`))return;let t=Di.current?.getBoundingClientRect();t&&(Oi.current={offsetX:e.clientX-t.left,offsetY:e.clientY-t.top,width:t.width,height:t.height},e.currentTarget.setPointerCapture(e.pointerId))},[]),Es=(0,h.useCallback)(e=>{let t=Oi.current;t&&(e.preventDefault(),Je(ws({x:e.clientX-t.offsetX,y:e.clientY-t.offsetY},t.width,t.height)))},[ws]),Ds=(0,h.useCallback)(e=>{Oi.current&&(Oi.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),Os=(0,h.useCallback)((e,t=ki.current?.offsetWidth??332,n=ki.current?.offsetHeight??290)=>{let r=Mi.current?.getBoundingClientRect();if(!r)return e;let i=Math.max(10,r.width-t-10),a=Math.max(10,r.height-n-10);return{x:Math.max(10,Math.min(e.x,i)),y:Math.max(10,Math.min(e.y,a))}},[]),ks=(0,h.useCallback)(e=>{if(e.button!==0)return;let t=ki.current?.getBoundingClientRect();t&&(Ai.current={offsetX:e.clientX-t.left,offsetY:e.clientY-t.top,width:t.width,height:t.height},e.currentTarget.setPointerCapture(e.pointerId))},[]),As=(0,h.useCallback)(e=>{let t=Ai.current,n=Mi.current?.getBoundingClientRect();!t||!n||(e.preventDefault(),fa(Os({x:e.clientX-n.left-t.offsetX,y:e.clientY-n.top-t.offsetY},t.width,t.height)))},[Os]),js=(0,h.useCallback)(e=>{Ai.current&&(Ai.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]);(0,h.useEffect)(()=>{if(!(la===`views2d`||la===`views3d`)){Ai.current=null;return}let e=()=>{let e=Mi.current?.getBoundingClientRect(),t=ki.current?.offsetWidth??332,n=ki.current?.offsetHeight??290;if(e&&!ji.current){ji.current=!0,fa(Os({x:e.width-t-10,y:e.height-n-10},t,n));return}fa(e=>Os(e,t,n))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[Os,la]),(0,h.useEffect)(()=>{(ns||(G.fields[`Integral Link`]?.trim()||`0`)!==`0`)&&Cn(!1)},[G.fields,ns]),(0,h.useEffect)(()=>{if(!Ge)return;let e=()=>Je(e=>ws(e));return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[ws,Ge]);let q=(0,h.useMemo)(()=>NG(fs.document,K,Rt,ps),[K,Rt,ps,fs.document]),Ms=(0,h.useMemo)(()=>ne?IL(ne,G):null,[ne,G.suspension.axlePosition]),Ns=(0,h.useMemo)(()=>
4412{if(!j||!ne)return null;let e=eC(ne.text,ne.name),t=ML(K),n=t===`Rear`;return{...e,fields:{...e.fields,"Axle Position":t,...n?{"Draw Steering":`0`}:{}},suspension:{...e.suspension,axlePosition:t},graphics:{...q.graphics,drawSteering:n?!1:q.graphics.drawSteering,drawMainSpring:q.graphics.drawMainSpring&&e.graphics.drawMainSpring}}},[K,ne,q.graphics,j]),Ps=(0,h.useMemo)(()=>{let e=ne?.tyreProfile;if(!e||!Ns||!Jw(Ns.fields[`Wheel Definition`]))return null;try{return Yw(e.text,e.fileName)}catch{return null}},[ne,Ns]),Fs=(0,h.useMemo)(()=>({bump:ps.bump,roll:ps.roll,steer:0}),[ps.bump,ps.roll]),Is=(0,h.useMemo)(()=>Ns?A_(Ns,Fs):null,[Fs,Ns]),Ls=Is?.document??null,Rs=(0,h.useMemo)(()=>Ge&&Ns?A_(Ns,{bump:0,steer:0,roll:0}).rightFrame:null,[Ns,Ge]),zs=(0,h.useMemo)(()=>Ge&&Ns?A_(Ns,{bump:EK,steer:0,roll:0}).rightFrame:null,[Ns,Ge]),Bs=(0,h.useMemo)(()=>!Ge||!Ns||!Is||!Rs||!zs?null:XK(Ns,Is.rightFrame,Is.leftFrame,Rs,zs,Fs,ht,or),[ht,zs,Rs,Fs,Is,Ns,Ge,or]),Vs=(0,h.useMemo)(()=>Ls&&Ns?NG(Ls,Ns,Rt,Fs):null,[Rt,Fs,Ls,Ns]),Hs=(0,h.useMemo)(()=>Ns?PL(K,Ns):null,[K,Ns]),Us=(0,h.useMemo)(()=>Ns&&Hs?FL(K,Ns,Hs):null,[K,Hs,Ns]),Ws=(0,h.useMemo)(()=>Rt===`contactPatchFixed`?Ky(fs.document,K,ps):null,[K,Rt,ps,fs.document]),Gs=(0,h.useMemo)(()=>jb(K),[K]),Ks=(0,h.useMemo)(()=>Ue===`loadCase`?PS(fs.document,Gs):null,[Gs,fs.document,Ue]),qs=(0,h.useMemo)(()=>!fs.document.graphics.drawLoadArrows||!FS(Gs)?null:PS(fs.document,Gs),[Gs,fs.document]),Js=(0,h.useMemo)(()=>!q.graphics.drawLoadArrows||!FS(Gs)?null:Rt===`chassisFixed`?qs:PS(q,Gs),[Gs,Rt,q,qs]),Ys=(0,h.useMemo)(()=>!FS(Gs)||!q.graphics.drawLoadArrows||!Js?[]:Js.vectors.filter(e=>e.kind===`input`||e.kind===`element`?q.graphics.drawLoadInputs:e.kind===`reaction`?q.graphics.drawLoadReactions:e.kind===`axial`?q.graphics.drawLoadAxials:!0),[Gs,q.graphics.drawLoadArrows,q.graphics.drawLoadAxials,q.graphics.drawLoadInputs,q.graphics.drawLoadReactions,Js]),Xs=(0,h.useMemo)(()=>BB(q,ts,fs.rightFrame.pose,v,es.shimVisible),[q,ts,v,es.shimVisible,fs.rightFrame.pose]),Zs=(0,h.useMemo)(()=>VB(q,ts,fs.rightFrame.pose,Pe,v,es.shimVisible),[q,ts,Pe,v,es.shimVisible,fs.rightFrame.pose]),Qs=(0,h.useMemo)(()=>null,[null,n]),$s=(0,h.useMemo)(()=>iU(K),[K]),ec=$s?cr:`rodBased`,tc=(0,h.useMemo)(()=>oU(K,ec),[ec,K]),nc=(0,h.useMemo)(()=>sU(tc),[tc]),rc=tc!==null,ic=se??tc,ac=(0,h.useMemo)(()=>eU(Ce,G.fields),[G.fields,Ce]),oc=(0,h.useMemo)(()=>nU(Ae,G.fields),[G.fields,Ae]),sc=v||x||j,cc=q.suspension.configuration,lc=bf(q),uc=cc===`Pushrod`||cc===`Pullrod`,dc=uc&&lc?hU(q):null,fc=uc?gU(q):null,pc=uc&&lc?vU(q):null,mc=uc?yU(q):null,hc=cc===`Pullrod`?`Pullrod`:`Pushrod`,gc=uU(q.geometry),_c=q.geometry[gc],vc=uc?HH(_c.chassis.pushRod,_c.wheel.pushRod):null,yc=uc&&lc?HH(_c.chassis.spring,_c.wheel.spring):null,bc=cc===`Pullrod`?`3D angle - Pullrod to rocker`:`3D angle - Pushrod to rocker`,xc=cc===`Pullrod`?`Pullrod moment arm`:`Pushrod moment arm`,Sc=q.motion?.elements?.heaveLeft??fs.rightFrame.elementState?.heaveLeft??q.elements.heaveLeft,Cc=q.motion?.elements?.heaveRight??(fs.leftFrame.elementState?SU(fs.leftFrame.elementState.heaveLeft):void 0)??q.elements.heaveRight,wc=q.motion?.elements?.rollLeft??fs.rightFrame.elementState?.rollLeft??q.elements.rollLeft,Tc=q.motion?.elements?.rollRight??fs.leftFrame.elementState?.rollRight??q.elements.rollRight,Ec=q.elements.heaveSpring?HH(Sc,Cc):null,Dc=q.elements.rollSpring?HH(wc,Tc):null,Oc=q.elements.heaveSpring?dU(q):null,kc=q.elements.rollSpring?pU(q):null,Ac=q.elements.heaveSpring?fU(q):null,jc=q.elements.rollSpring?mU(q):null,Mc=[{key:`rod-length`,label:`${hc} length`,value:vc===null?`-`:$(vc),unit:`mm`},{key:`rod-angle`,label:bc,value:fc===null?`-`:$(fc),unit:`deg`},{key:`rod-moment`,label:xc,value:mc===null?`-`:$(mc),unit:`mm`}],Nc=lc?[{key:`spring-length`,label:`Spring length`,value:yc===null?`-`:$(yc),unit:`mm`},{key:`spring-angle`,label:`3D angle - Spring to rocker`,value:dc===null?`-`:$(dc),unit:`deg`},{key:`spring-moment`,label:`Spring moment arm`,value:pc===null?`-`:$(pc),unit:`mm`}]:[],Pc=[{key:`heave-length`,label:`Heave spring length`,value:Ec===null?`-`:$(Ec),unit:`mm`},{key:`heave-angle`,label:`3D angle - Heave spring to rocker`,value:Oc===null?`-`:$(Oc),unit:`deg`},{key:`heave-moment`,label:`Heave spring moment arm`,value:Ac===null?`-`:$(Ac),unit:`mm`}],Fc=[{key:`roll-length`,label:`Roll spring length`,value:Dc===null?`-`:$(Dc),unit:`mm`},{key:`roll-angle`,label:`3D angle - Roll spring to Left rocker`,value:kc===null?`-`:$(kc),unit:`deg`},{key:`roll-moment`,label:`Roll spring moment arm`,value:jc===null?`-`:$(jc),unit:`mm`}],Ic=G.geometry.left.wheelCenter.y>=G.geometry.right.wheelCenter.y?`left`:`right`,Lc=(0,h.useMemo)(()=>{let e=Jz(G.fields[`X SemiAxis`]),t=Jz(G.fields[`Y SemiAxis`]),n=Jz(G.fields[`Z SemiAxis`]),r=Math.abs(Jz(G.fields[`Distance SemiAxis`])??0);if(e===null||t===null||n===null)return null;try{let i=y_(G,0,0),a=dB(Ic===`left`?uB(i.pose):i.pose,{x:0,y:-r+1e-5,z:0});return Math.hypot(a.x-e,a.y-t,a.z-n)}catch{return null}},[G,Ic]),Rc=(0,h.useMemo)(()=>Sa.find(e=>e.id===Aa)??null,[Aa,Sa]),J=(0,h.useMemo)(()=>Ht.find(e=>e.id===Jt)??null,[Jt,Ht]),zc=(0,h.useMemo)(()=>Ht.some(e=>e.visible),[Ht]);(0,h.useEffect)(()=>{zc||($t(!1),tn(!1))},[zc]);let Bc=(0,h.useMemo)(()=>J?NV(J.mesh,{...J.transform,translate:{x:0,y:0,z:0}}):{x:0,y:0,z:0},[J?.id,J?.mesh,J?.transform.scale,J?.transform.scaleY,J?.transform.scaleZ,J?.transform.rotateDeg.x,J?.transform.rotateDeg.y,J?.transform.rotateDeg.z]),Vc=(0,h.useMemo)(()=>J?PV(J.mesh,J.transform):0,[J?.id,J?.mesh,J?.transform.scale,J?.transform.scaleY,J?.transform.scaleZ,J?.transform.rotateDeg.x,J?.transform.rotateDeg.y,J?.transform.rotateDeg.z,J?.transform.translate.x,J?.transform.translate.y,J?.transform.translate.z]),Hc=(0,h.useMemo)(()=>!Jt||!dn||dn.geometryId!==Jt?null:dn,[Jt,dn]),Y=(0,h.useMemo)(()=>[],[(0,h.useMemo)(()=>!Jt||!pn||pn.geometryId!==Jt?null:pn,[Jt,pn]),hn]);(0,h.useEffect)(()=>
4412{if(!J){cn(SV(null)),un(mV({x:0,y:0,z:0})),fn(null),mn(null);return}cn(SV(J.transform)),un(mV(J.transform.translate))},[J]);let Uc=(0,h.useMemo)(()=>Ht.filter(e=>e.visible!==!1).map(e=>({...e,transform:CV(e.transform)})),[Ht]),Wc=Ie?[`left`,`right`]:[`right`],Gc=(0,h.useMemo)(()=>_m(G,[...Wc]),[G,Wc]),Kc=(0,h.useMemo)(()=>{if(Ie)return;let e=ym(Gc,{includeRollCenter:!1,includeCenterOfGravity:!1,includeSteeringColumnAndWheel:!1});if(e.length===0)return 300;let t=e.map(e=>e.x),n=e.map(e=>e.y),r=e.map(e=>e.z),i=[Math.max(...t)-Math.min(...t),Math.max(...n)-Math.min(...n),Math.max(...r)-Math.min(...r)].sort((e,t)=>t-e),a=Math.max(i[0],240),o=a/Math.max(i[1]??0,1);return a/(.8*Math.min(1.75,Math.max(1,1+(o-1)*.95)))},[Gc,Ie]),qc=(0,h.useCallback)(e=>Ie?e===`YX`?`both`:`auto`:e===`YX`?`auto`:Ic===`left`?`left-only`:`right-only`,[Ic,Ie]),Jc=(0,h.useMemo)(()=>yT(G),[G]),Yc=(0,h.useMemo)(()=>mB(G),[G]),Xc=(0,h.useMemo)(()=>bU(G,Jc),[G,Jc]),Zc=(0,h.useMemo)(()=>new Map(Xc.map(e=>[e.key,e.name])),[Xc]),Qc=(0,h.useMemo)(()=>jU(Jc,Zc),[Jc,Zc]),$c=(0,h.useMemo)(()=>new Map(Qc.map(e=>[e.id,e])),[Qc]),el=(0,h.useMemo)(()=>new Map(gT.map(e=>[e.id,e])),[]),tl=(0,h.useMemo)(()=>{if(!ic)return[];let e=(e,t)=>{let n=$c.get(e)?.point;return n?{id:e,values:ZH(ic.projection,n),editableAxes:t}:null},t=aU(G),n=e(`p1`,{x:!1,y:!1,z:!0}),r=e(`p2`,{x:!1,y:!1,z:!0}),i=t?e(t.id,{x:!1,y:!1,z:!1}):null,a=[];return n&&a.push({key:`p1`,label:`Rocker Pivot 1`,point:n}),r&&a.push({key:`p2`,label:`Rocker Pivot 2`,point:r}),i&&a.push({key:t?.id??i.id,label:Zc.get(t?.id??i.id)??t?.label??i.id,point:i}),a},[ic,$c,G,Zc]),nl=(0,h.useMemo)(()=>{if(!ic)return[];let e={x:!0,y:!0,z:!0},t={x:!1,y:!1,z:!1},n=(e,t,n)=>t?[`x`,`y`,`z`].map(r=>({key:`${e}-${n}-${r}`,label:n,axis:r,point:t})):[],r=(e,t)=>{let n=$c.get(e)?.point;if(n)return{id:e,values:ZH(ic.projection,n),editableAxes:t}};return[{key:`rod`,component:ic.configuration===`Pullrod`?`Pullrod`:`Pushrod`,showHeaders:!0,cells:[...n(`rod-rocker`,r(`pr-c`,e),`Rocker`),...n(`rod-wheel`,r(`pr-w`,ec===`linkBased`?e:t),`Wheel`)]},{key:`spring`,component:`Spring`,showHeaders:!0,cells:[...n(`spring-rocker`,r(`s-w`,e),`Rocker`),...n(`spring-chassis`,r(`s-c`,e),`Chassis`)]},{key:`c-bar`,component:`Antiroll C-bar`,showHeaders:!0,cells:[...n(`c-bar-rocker`,r(`c-link`,e),`Rocker`),...n(`c-bar-arb`,r(`c-arb`,e),`ARB`)]},{key:`t-bar`,component:`Antiroll T-bar`,showHeaders:!1,cells:[...n(`t-bar-rocker`,r(`t-link`,e),`Rocker`),...n(`t-bar-arb`,r(`t-arb`,e),`ARB`)]},{key:`hs-left`,component:`Heave spring`,showHeaders:!0,cells:n(`hs-left`,r(`hs-left`,e),`LH Rocker`)},{key:`rs-left`,component:`Roll spring`,showHeaders:!1,cells:n(`rs-left`,r(`rs-left`,e),`LH Rocker`)}].filter(e=>e.key===`spring`&&!bf(G)||e.key===`c-bar`&&!G.elements.antirollCBar||e.key===`t-bar`&&!G.elements.antirollTBar||e.key===`hs-left`&&!G.elements.heaveSpring||e.key===`rs-left`&&!G.elements.rollSpring?!1:e.cells.length>0)},[ic,ec,$c,G]),rl=(0,h.useMemo)(()=>{let e=new Set,t=e=>e.x||e.y||e.z;return tl.forEach(n=>{t(n.point.editableAxes)&&e.add(n.point.id)}),nl.forEach(n=>{n.cells.forEach(n=>{t(n.point.editableAxes)&&e.add(n.point.id)})}),Array.from(e)},[nl,tl]),il=(0,h.useMemo)(()=>new Set(rl),[rl]),al=(0,h.useMemo)(()=>new Set(Xc.map(e=>e.key)),[Xc]),ol=(0,h.useMemo)(()=>bH(G,Zc,al),[G,Zc,al]),sl=(0,h.useMemo)(()=>{let e=[`top-front`,`top-rear`,`bottom-front`,`bottom-rear`,`track-rod`,`rod`],t=new Map(ol.map(e=>[e.key,e]));return e.map(e=>t.get(e)).filter(e=>!!e)},[ol]),cl=(0,h.useMemo)(()=>{let e=new Set([`wheel-center`,`top-front`,`top-rear`,`bottom-front`,`bottom-rear`,`track-rod`,`rod`]);return ol.filter(t=>!e.has(t.key))},[ol]),ll=(0,h.useMemo)(()=>$c.get(`wheel-center`),[$c]),ul=(0,h.useMemo)(()=>yH(G),[G]),dl=(0,h.useMemo)(()=>xH(G,$c,el),[$c,G,el]),fl=(0,h.useMemo)(()=>MH(dl,rt),[rt,dl]),pl=(0,h.useMemo)(()=>NH(dl,rt),[rt,dl]),ml=(0,h.useMemo)(()=>DH(dl,rt,at),[rt,at,dl]),hl=(0,h.useMemo)(()=>{let e=G.geometry.right,t=[],n=(e,n,r,i)=>{t.push({key:e,label:n,value:HH(r,i)})},r=(e,t)=>{let n=ol.find(t=>t.key===e);return n?[n.component,n.position].filter(Boolean).join(` `):t}
4412,i=tH(G)?e.wheel.topRear:e.wheel.topFront,a=nH(G)?e.wheel.bottomRear:e.wheel.bottomFront,o=r(`rod`,aH(G));return G.suspension.macPherson||(n(`top-front`,r(`top-front`,`Top Link Front`),e.chassis.topFront,e.wheel.topFront),n(`top-rear`,r(`top-rear`,`Top Link Rear`),e.chassis.topRear,i)),n(`bottom-front`,r(`bottom-front`,`Bottom Link Front`),e.chassis.bottomFront,e.wheel.bottomFront),n(`bottom-rear`,r(`bottom-rear`,`Bottom Link Rear`),e.chassis.bottomRear,a),n(`track-rod`,r(`track-rod`,`Track Rod`),e.chassis.tieRod,e.wheel.tieRod),n(`rod`,o,e.chassis.pushRod,e.wheel.pushRod),G.suspension.configuration!==`Outboard Spring`&&n(`spring`,r(`spring`,`Spring`),e.chassis.spring,e.wheel.spring),t},[G,ol]),gl=(0,h.useMemo)(()=>{let e=new Map,t=q.motion?.elements,n=fs.rightFrame.elementState,r=fs.leftFrame.elementState,i=(t,n)=>{n&&e.set(t,n)};return i(`hs-left`,t?.heaveLeft??n?.heaveLeft),i(`hs-right`,t?.heaveRight??(r?SU(r.heaveLeft):n?.heaveRight)),i(`rs-left`,t?.rollLeft??n?.rollLeft),i(`rs-right`,t?.rollRight??(r?r.rollRight:n?.rollRight)),i(`c-link`,t?.cLinkRight??n?.cLink),i(`c-arb`,t?.cArbRight??n?.cArb),i(`c-pivot`,t?.cPivotRight??G.elements.cPivot),i(`t-link`,t?.tLinkRight??n?.tLink),i(`t-arb`,t?.tArbRight??n?.tArbLeft),i(`t-pivot`,q.elements.tPivot),i(`third-arb`,t?.thirdElementArb??n?.thirdElementArb),i(`third-chassis`,q.elements.thirdElementChassis),i(`semi-axis`,Hf(q,`right`,q.geometry.right)??void 0),i(`joint-2`,t?.steeringJoint2),i(`steering-wheel`,t?.steeringWheel),e},[q.elements.tPivot,q.elements.thirdElementChassis,q.geometry,q.motion,G.elements.cPivot,G.fields,G.vehicle,fs.leftFrame.elementState,fs.rightFrame.elementState]),_l=(0,h.useMemo)(()=>{let e=new Map,t=q.motion?.elements,n=fs.leftFrame.elementState,r=fs.rightFrame.elementState,i=(t,n)=>{n&&e.set(t,n)};return i(`hs-left`,t?.heaveLeft??r?.heaveLeft),i(`hs-right`,t?.heaveRight??(n?SU(n.heaveLeft):r?.heaveRight)),i(`rs-left`,t?.rollLeft??r?.rollLeft),i(`rs-right`,t?.rollRight??(n?n.rollRight:r?.rollRight)),i(`c-link`,t?.cLinkLeft??(n?SU(n.cLink):void 0)),i(`c-arb`,t?.cArbLeft??(n?SU(n.cArb):void 0)),i(`c-pivot`,t?.cPivotLeft??SU(G.elements.cPivot)),i(`t-link`,t?.tLinkLeft??(n?SU(n.tLink):void 0)),i(`t-arb`,t?.tArbLeft??(n?SU(n.tArbLeft):void 0)),i(`t-pivot`,q.elements.tPivot),i(`third-arb`,t?.thirdElementArb??r?.thirdElementArb),i(`third-chassis`,q.elements.thirdElementChassis),i(`semi-axis`,Hf(q,`left`,q.geometry.left)??void 0),i(`joint-2`,t?.steeringJoint2),i(`steering-wheel`,t?.steeringWheel),e},[q.elements.tPivot,q.elements.thirdElementChassis,q.geometry,q.motion,G.elements.cPivot,G.fields,G.vehicle,fs.leftFrame.elementState,fs.rightFrame.elementState]),vl=(0,h.useMemo)(()=>wU(q,Jc,q.geometry.right,gl),[Jc,q,q.geometry.right,gl]),yl=(0,h.useMemo)(()=>wU(q,Jc,q.geometry.left,_l),[Jc,q,q.geometry.left,_l]),bl=(0,h.useMemo)(()=>EU(G),[G]),xl=(0,h.useMemo)(()=>DU(vl,bl),[vl,bl]),Sl=(0,h.useMemo)(()=>DU(yl,bl),[yl,bl]),Cl=(0,h.useMemo)(()=>jU(xl,Zc),[Zc,xl]),wl=(0,h.useMemo)(()=>jU(Sl,Zc),[Zc,Sl]),Tl=(0,h.useMemo)(()=>jU(Ic===`left`?Sl:xl,Zc),[Zc,Sl,xl,Ic]),El=Ic===`left`?`left-only`:`right-only`,Dl=(0,h.useCallback)(e=>`${el.get(e)?.label??e} (${e})`,[el]),Ol=(0,h.useCallback)((e,t)=>{let n=t.filter(t=>!e.includes(t)),r=e.filter(e=>!t.includes(e));n.length>0&&bo(`HP selected | ${n.map(e=>Dl(e)).join(`, `)}`),r.length>0&&bo(`HP deselected | ${r.map(e=>Dl(e)).join(`, `)}`)},[Dl,bo]),kl=(0,h.useCallback)(e=>{uo.current=e,fo.current!==null&&window.clearTimeout(fo.current),fo.current=window.setTimeout(()=>{let e=uo.current;uo.current=null,fo.current=null,e&&bo(e)},420)},[bo]);(0,h.useEffect)(()=>{let e=ho.current;if(e===`keyboard-move`||e===`hardpoint-undo`){ho.current=null,go.current=d,_o.current=g;return}(go.current!==d||_o.current!==g)&&(mo.current=[],go.current=d,_o.current=g)},[g,d]);let Al=(0,h.useMemo)(()=>gT.filter(e=>W.includes(e.id)),[W]);(0,h.useEffect)(()=>{Yn(e=>{let t=e.filter(e=>bl.has(e));return t.length===e.length?e:t})},[bl]),(0,h.useEffect)(()=>{if(!Ze){ut(`idle`),ft(null);return}if($e===`minimized`)return;let e=e=>{e.key!==`Escape`||dt!==null||ef()};
4412return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ef,Ze,$e,dt]);let jl=(0,h.useMemo)(()=>({"--projection-width":`${(qi*100).toFixed(2)}%`,"--top-stage-ratio":Yi.toFixed(4)}),[qi,Yi]),Ml=(0,h.useCallback)(e=>{let t=Math.min(.72,Math.max(.2,360/Math.max(e,1)));return{dynamicMin:t,dynamicMax:Math.max(t,Math.min(.8,1-920/Math.max(e,1)))}},[]),Nl=(0,h.useCallback)(async()=>{Ta(!0);try{Ca((await oN(e.token)).items),Da(`Workspace synced`)}catch(e){Da(e instanceof Error?e.message:`Workspace sync failed`)}finally{Ta(!1)}},[e.token]),Pl=(0,h.useCallback)(e=>{let t=Ki.current;if(!t)return;let n=t.getBoundingClientRect();if(n.width<=1)return;let r=(e-n.left)/n.width,{dynamicMin:i,dynamicMax:a}=Ml(n.width);Ji(Math.min(a,Math.max(i,r)))},[Ml]),Fl=(0,h.useCallback)(()=>{if(Xa||la===`views2d`||la===`views3d`)return!1;let e=Mi.current,t=Pi.current;if(!e||!t)return!1;let n=t.querySelector(`.tab-strip`),r=t.querySelector(`.tab-panel`),i=r?.querySelector(`.tab-panel-fieldset`)??r?.firstElementChild??null,a=t.querySelector(`.animation-sidebar:not(.animation-sidebar-floating)`);if(!(n instanceof HTMLElement)||!(r instanceof HTMLElement))return!1;let o=e.getBoundingClientRect().height-8;if(o<=1)return!1;let s=window.getComputedStyle(t),c=Number.parseFloat(s.paddingTop)||0,l=Number.parseFloat(s.paddingBottom)||0,u=Number.parseFloat(s.borderTopWidth)||0,d=Number.parseFloat(s.borderBottomWidth)||0,f=Number.parseFloat(s.rowGap||s.gap)||0,p=i instanceof HTMLElement?i.scrollHeight:r.scrollHeight,m=n.offsetHeight+f+p,h=a instanceof HTMLElement?a.scrollHeight:0,g=1-(c+l+u+d+Math.max(m,h))/o,_=Math.min(1,Math.max(iz,g));return Xi(e=>Math.abs(e-_)<=5e-4?e:_),!0},[Xa,la]),Il=(0,h.useCallback)(()=>{if(Xa||la===`views2d`||la===`views3d`)return!1;let e=Mi.current,t=Pi.current;if(!e||!t)return!1;let n=t.querySelector(`.tab-strip`);if(!(n instanceof HTMLElement))return!1;let r=e.getBoundingClientRect().height-8;if(r<=1)return!1;let i=window.getComputedStyle(t),a=Number.parseFloat(i.paddingTop)||0,o=Number.parseFloat(i.paddingBottom)||0,s=Number.parseFloat(i.borderTopWidth)||0,c=Number.parseFloat(i.borderBottomWidth)||0,l=a+o+s+c+n.offsetHeight,u=Math.min(1,Math.max(0,1-l/r));return Xi(e=>Math.abs(e-u)<=5e-4?e:u),!0},[Xa,la]),Ll=(0,h.useCallback)(e=>{let t=Mi.current;if(!t)return;let n=t.getBoundingClientRect(),r=n.height-8;if(r<=1)return;let i=(e-n.top-8/2)/r;Xi(Math.min(1,Math.max(rz,i)))},[]),Rl=(0,h.useCallback)(()=>{if(window.document.fullscreenElement){Ga(!0);return}let e=window.fullScreen;if(e===!0){Ga(!0);return}e===!1&&Ga(!1)},[]),zl=(0,h.useCallback)((e,t)=>{$i.current=e,e===`manual`&&typeof t==`number`&&(ea.current=t),Qi(`fit`)},[]),Bl=(0,h.useCallback)(()=>{if($i.current===`tabsOnly`){Qi(`tabsOnly`);return}Qi(`manual`),Xi(ea.current)},[]),Vl=(0,h.useCallback)(()=>{ua(e=>e===`setup`?`none`:e),Qi(`tabsOnly`)},[]);(0,h.useEffect)(()=>{Zi===`manual`&&($i.current=`manual`,ea.current=Yi)},[Zi,Yi]),(0,h.useLayoutEffect)(()=>{if(Zi!==`fit`&&Zi!==`tabsOnly`||Xa||la===`views2d`||la===`views3d`)return;let e=()=>{if(Zi===`tabsOnly`){Il();return}Fl()};e();let t=0,n=()=>{t!==0&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{t=0,e()})};return window.addEventListener(`resize`,n),()=>{t!==0&&cancelAnimationFrame(t),window.removeEventListener(`resize`,n)}},[Fl,Il,Xa,Zi,la,Ue]),(0,h.useEffect)(()=>{},[null,Nl]),(0,h.useEffect)(()=>{if(i||ya.current)return;ya.current=!0;let e=!1;return(async()=>{for(let t of BI)try{let n=new URL(`Template/${encodeURIComponent(t)}`,window.location.href),r=await fetch(n,{cache:`no-store`});if(!r.ok)continue;let i=await r.text();if(e)return;let a=Kl(i);f(a),m(a),_(t),Fa(t),Na(null),Mr(null),Pr(`template`),Ef(),Yn([]),Zr(null),$r(!1),ti(null),bt(null);return}catch{}})(),()=>{e=!0}},[i]),(0,h.useEffect)(()=>{St(null)},[d]),(0,h.useEffect)(()=>{if(!Tt.current){Tt.current=!0;return}let e=window.setTimeout(()=>{St(YU(K))},HU);return()=>window.clearTimeout(e)},[K,[K.fields[`Bump Max`]??``,K.fields[`Rebound Max`]??``,K.fields[`N of Steps Bump`]??``,K.fields[`Steering Wheel Angle Max`]??``,K.fields[`N of Steps Steer`]??``,Ko?.spmText??``].join(`|`)]),(0,h.useEffect)(()=>{let e=e=>{Ro&&(e.preventDefault(),e.returnValue=`Exit without saving?`)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[Ro]),(0,h.useEffect)(()=>{let e=e=>{e.persisted||No()};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),No()}},[No]),(0,h.useEffect)(()=>()=>
4412{lo.current!==null&&(window.clearTimeout(lo.current),lo.current=null),fo.current!==null&&(window.clearTimeout(fo.current),fo.current=null)},[]),(0,h.useEffect)(()=>{if(!yr){Sr(!1);return}id()},[yr]),(0,h.useEffect)(()=>{if(!yr)return;let e=e=>{e.target instanceof Node&&xi.current?.contains(e.target)||br(!1)},t=e=>{e.key===`Escape`&&br(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[yr]),(0,h.useEffect)(()=>{if(!Cr)return;let e=e=>{e.target instanceof Node&&Si.current?.contains(e.target)||wr(!1)},t=e=>{e.key===`Escape`&&wr(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[Cr]),(0,h.useEffect)(()=>{if(!Vr)return;let e=e=>{e.target instanceof Node&&Ti.current?.contains(e.target)||Hr(!1)},t=e=>{e.key===`Escape`&&Hr(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[Vr]),(0,h.useEffect)(()=>{if(!Ur)return;let e=e=>{e.target instanceof Node&&Ei.current?.contains(e.target)||Wr(!1)},t=e=>{e.key===`Escape`&&Wr(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[Ur]),(0,h.useEffect)(()=>{if(!Gr)return;let e=e=>{e.key===`Escape`&&Kr(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Gr]),(0,h.useEffect)(()=>{if(!er)return;let e=e=>{e.key===`Escape`&&tr(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[er]),(0,h.useEffect)(()=>{if(!ur)return;let e=e=>{e.key===`Escape`&&dr(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ur]),(0,h.useEffect)(()=>{if(!Fr)return;let e=e=>{e.target instanceof Node&&Ci.current?.contains(e.target)||Ir(!1)},t=e=>{e.key===`Escape`&&Ir(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[Fr]),(0,h.useEffect)(()=>{if(!Lr)return;let e=e=>{e.target instanceof Node&&wi.current?.contains(e.target)||Rr(!1)},t=e=>{e.key===`Escape`&&Rr(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[Lr]),(0,h.useEffect)(()=>{if(!zr)return;let e=window.setInterval(()=>{(!Wi.current||Wi.current.closed)&&(Wi.current=null,Br(!1))},400);return()=>window.clearInterval(e)},[zr]),(0,h.useEffect)(()=>{Fa(g)},[g]),(0,h.useEffect)(()=>{xq({spmText:d,sourceName:g,lastSavedSpmText:p,sourceKind:Nr,tyreProfile:Wt?{fileName:Wt.fileName,text:Wt.sourceText}:null})},[Nr,Wt,p,g,d]),(0,h.useEffect)(()=>{Oa&&!Sa.some(e=>e.id===Oa&&e.type===`folder`)&&ka(null),Aa&&!Sa.some(e=>e.id===Aa)&&ja(null),Ma&&!Sa.some(e=>e.id===Ma&&e.type===`file`)&&Na(null)},[Ma,Oa,Aa,Sa]),(0,h.useEffect)(()=>{za(Rc?.name??``),Va(Rc?.notes??``)},[Rc]),(0,h.useEffect)(()=>{if(Ht.length===0){Jt!==null&&Yt(null);return}(!Jt||!Ht.some(e=>e.id===Jt))&&Yt(Ht[Ht.length-1].id)},[Jt,Ht]);function Hl(){ti(hV(d,g))}(0,h.useEffect)(()=>{if(!Ve)return;let{min:e,max:t}=OG(K,ht);if(t-e<=1e-9)return;let n=0,r=0,i=jG(K,ht,zL(It)),a=o=>{if(window.document.visibilityState!==`visible`){r=o,n=requestAnimationFrame(a);return}if(r===0){r=o,n=requestAnimationFrame(a);return}let s=Math.min(.1,Math.max(0,o-r)/1e3);r=o,Dt(n=>{let r=MG(AG(K,ht,n),Ft.current,i*s,e,t);return Ft.current=r.direction,DG(K,ht,r.value,Ot)}),n=requestAnimationFrame(a)};return n=requestAnimationFrame(a),()=>cancelAnimationFrame(n)},[K,Ot,ht,It,Ve]),(0,h.useEffect)(()=>{Ft.current=1},[ht]),(0,h.useEffect)(()=>{if(!(!Fw(K,ht)||Wo&&(ht===`steer`||ht===`bumpSteer`)))return;let e=gI.find(e=>Fw(K,e.id)&&!(Wo&&(e.id===`steer`||e.id===`bumpSteer`)));He(!1),gt(e?.id??`bump`),vt(e?.id??`bump`),jt(!1),kt({bump:0,steer:0,roll:0}),Dt({bump:0,steer:0,roll:0}),Ft.current=1},[K,ht,Wo]),(0,h.useEffect)(()=>
4412{if(!ha)return;let e=e=>{Pl(e.clientX)},t=()=>{ga(!1)};return window.document.body.style.cursor=`col-resize`,window.document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.document.body.style.cursor=``,window.document.body.style.userSelect=``,window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[ha,Pl]),(0,h.useEffect)(()=>{if(!_a)return;let e=e=>{Ll(e.clientY)},t=()=>{va(!1)};return window.document.body.style.cursor=`row-resize`,window.document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.document.body.style.cursor=``,window.document.body.style.userSelect=``,window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[_a,Ll]),(0,h.useEffect)(()=>{let e=()=>{let e=Ki.current;if(!e)return;let t=e.getBoundingClientRect().width,{dynamicMin:n,dynamicMax:r}=Ml(t);Ji(e=>Math.min(r,Math.max(n,e)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[Ml]),(0,h.useEffect)(()=>{let e=e=>{e.key===`F11`&&(Ga(e=>!e),window.setTimeout(Rl,40),window.setTimeout(Rl,220))};return Rl(),window.document.addEventListener(`fullscreenchange`,Rl),window.addEventListener(`resize`,Rl),window.addEventListener(`keydown`,e),()=>{window.document.removeEventListener(`fullscreenchange`,Rl),window.removeEventListener(`resize`,Rl),window.removeEventListener(`keydown`,e)}},[Rl]),(0,h.useEffect)(()=>{let e=e=>{if(!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`F9`){if(e.repeat)return;e.preventDefault(),ua(e=>e===`views2d`?`none`:`views2d`);return}if(e.key===`F10`){if(e.repeat)return;e.preventDefault(),ua(e=>e===`views3d`?`none`:`views3d`);return}if(e.key===`F8`){if(e.repeat||ta.current!==null)return;e.preventDefault(),na.current=!1,ta.current=window.setTimeout(()=>{ta.current=null,na.current=!0,Vl()},az);return}e.key===`Escape`&&ua(e=>e===`none`?e:`none`)}},t=e=>{if(!(e.altKey||e.ctrlKey||e.metaKey||e.key!==`F8`)){if(ta.current!==null&&(window.clearTimeout(ta.current),ta.current=null),na.current){na.current=!1,e.preventDefault();return}if(e.preventDefault(),ua(e=>e===`setup`?`none`:e),Zi===`tabsOnly`){zl(`tabsOnly`);return}if(Zi===`fit`){Bl();return}zl(`manual`,Yi)}};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t),ta.current!==null&&(window.clearTimeout(ta.current),ta.current=null)}},[Vl,Zi,zl,Bl,Yi]),(0,h.useEffect)(()=>{if(!Xa){wf(!0);return}let e=Ri.current,t=zi.current;if(!e||e.closed||!t){Za(!1);return}mq(window.document,e.document),e.document.title=`3DSusp Web - Control Deck`,e.document.body.style.margin=`0`,e.document.body.style.overflow=`hidden`;let n=e.document.getElementById(`control-deck-window-root`);n&&(n.className=`app theme-${Bo} control-deck-detached-app`),e.focus()},[Xa,Bo]),(0,h.useEffect)(()=>()=>wf(!0),[]),(0,h.useEffect)(()=>{let e=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable,t=t=>{if(!(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||t.key!==`F6`||t.repeat)&&!e(t.target)){if(t.preventDefault(),ua(`none`),Xa){Za(!1);return}Cf()&&Za(!0)}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[Xa,Bo]),(0,h.useEffect)(()=>{let e=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable,t=t=>{t.key!==`F4`||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||t.repeat||e(t.target)||(t.preventDefault(),su())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[V,Re,d]),(0,h.useEffect)(()=>{let e=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable,t=t=>{if(t.key!==`Escape`||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||e(t.target))return;let n=Ve||Math.abs(ps.bump)>1e-9||Math.abs(ps.steer)>1e-9||Math.abs(ps.roll)>1e-9,r=W.length>0;n&&Ef(),!(n||r)&&kf()};
4412return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[Ve,ps.bump,ps.roll,ps.steer,x,W.length]),(0,h.useEffect)(()=>{let e=e=>{let t=e.target,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable,r=(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`m`,i=!e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey&&e.key===`F7`;n||!r&&!i||(e.preventDefault(),br(!1),Ir(!1),wr(!1),Hr(!1),Ke(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,h.useEffect)(()=>{if(uq()!==null)return;let e=e=>{let t=e.target;if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable||e.altKey||e.shiftKey||!(e.ctrlKey||e.metaKey)||e.key.toLowerCase()!==`r`)&&(e.preventDefault(),!(j||x))){if(br(!1),Ir(!1),wr(!1),Hr(!1),Xr){Zr(null),$r(!1);return}Zr(hV(d,g)),$r(!0)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[j,Xr,x,g,d]),(0,h.useEffect)(()=>{let e=e=>{if(e.altKey||e.shiftKey||!(e.ctrlKey||e.metaKey)||e.repeat)return;let t=e.key.toLowerCase();t!==`s`&&t!==`o`&&t!==`n`||sc||(e.preventDefault(),t===`s`?cd():t===`o`?Ou():Du())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Du,Ou,cd,sc]),(0,h.useEffect)(()=>{if(!(typeof window>`u`||!window.localStorage))try{window.localStorage.setItem(GI,Ka)}catch{}},[Ka]),(0,h.useEffect)(()=>{if(!(typeof window>`u`||!window.localStorage))try{window.localStorage.setItem(KI,String(It))}catch{}},[It]),(0,h.useEffect)(()=>{if(!(typeof window>`u`||!window.localStorage))try{window.localStorage.setItem(qI,JSON.stringify(Qn))}catch{}},[Qn]),(0,h.useEffect)(()=>{if(!(typeof window>`u`||!window.localStorage))try{window.localStorage.setItem(JI,or)}catch{}},[or]),(0,h.useEffect)(()=>{if(!(typeof window>`u`||!window.localStorage))try{window.localStorage.setItem(YI,cr)}catch{}},[cr]),(0,h.useEffect)(()=>{if(!(typeof window>`u`||!window.localStorage))try{window.localStorage.setItem(XI,Ja)}catch{}},[Ja]),(0,h.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=e=>no(e);t(e.matches);let n=e=>t(e.matches);return e.addEventListener?(e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)):(e.addListener(n),()=>e.removeListener(n))},[]),(0,h.useEffect)(()=>{let e=!1;async function t(){try{let t=await fetch(`./build-meta.json?t=${Date.now()}`,{cache:`no-store`});if(!t.ok)return;let n=await t.json(),r=Number(n.buildCount);if(!Number.isFinite(r)||r<0)return;e||io(Math.floor(r))}catch{}}t();let n=window.setInterval(()=>{t()},5e3),r=()=>{t()};return window.addEventListener(`focus`,r),()=>{e=!0,window.clearInterval(n),window.removeEventListener(`focus`,r)}},[]),(0,h.useEffect)(()=>{let e=1e-6,t=sz[0],n=sz[sz.length-1],r=Qn.defaultStep,i=Qn.holdToDefaultSeconds*1e3,a=e=>e.key===`+`||e.code===`NumpadAdd`?`+`:e.key===`-`||e.code===`NumpadSubtract`?`-`:null,o=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable,s=null,c=null,l=!1,u=()=>{c!==null&&(window.clearTimeout(c),c=null)},d=e=>{l&&s===e||s===e&&c!==null||(u(),s=e,l=!1,c=window.setTimeout(()=>{ar(r),l=!0,c=null},i))},f=r=>{if(r.ctrlKey||r.metaKey||r.altKey||o(r.target))return;let i=a(r);i&&(r.preventDefault(),!(l&&s===i)&&(d(i),!(l&&s===i)&&ar(r=>{if(i===`+`)return sz.find(t=>t>r+e)??n;for(let t=sz.length-1;t>=0;--t)if(sz[t]<r-e)return sz[t];return t})))},p=e=>{let t=a(e);t&&t===s&&(s=null,l=!1,u())},m=()=>{s=null,l=!1,u()};return window.addEventListener(`keydown`,f),window.addEventListener(`keyup`,p),window.addEventListener(`blur`,m),()=>{window.removeEventListener(`keydown`,f),window.removeEventListener(`keyup`,p),window.removeEventListener(`blur`,m),s=null,l=!1,u()}},[Qn.defaultStep,Qn.holdToDefaultSeconds]),(0,h.useEffect)(()=>{if(Al.length===0)return;let e=e=>{let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable)return;if(e.key===`Escape`){e.preventDefault(),Yn(e=>(e.length>0&&Ol(e,[]),[]));return}let n={ArrowUp:{axis:`x`,delta:ir},ArrowDown:{axis:`x`,delta:-ir},ArrowRight:{axis:`y`,delta:-ir},ArrowLeft:{axis:`y`,delta:ir},PageUp:{axis:`z`,delta:ir},PageDown:{axis:`z`,delta:-ir}},r=n[Object.prototype.hasOwnProperty.call(n,e.code)?e.code:e.key];if(!r||Al.length===0)return;if(v){e.preventDefault();return}if(x&&r.axis!==`z`&&Al.some(e=>e.id===`p1`||e.id===`p2`)){e.preventDefault();return}e.preventDefault();let i=!x&&Xn&&Al.some(e=>sH(e.id)),a=Al.map(e=>Dl(e.id)).join(`, `),o=r.delta>=0?`+`:``,s=`${a} | ${x?`${r.axis.toUpperCase()}R`:i?`${r.axis.toUpperCase()}U`:r.axis.toUpperCase()} ${o}${$(r.delta)} mm`;mo.current.push({spmText:d,sourceName:g,summary:s}),mo.current.length>100&&mo.current.shift(),ho.current=`keyboard-move`,Hl(),f(e=>{let t=eC(e,g),n=x?Al.filter(e=>AU(t,e.id,il)):Al,i=new Map(yT(t).map(e=>[e.id,e.point])),a=Xn?mB(t):null;return Xl(Jl(n.reduce((e,n)=>{if(x&&ic){let t=i.get(n.id);if(!t)return e;let a=ZH(ic.projection,t),o={...a,[r.axis]:a[r.axis]+r.delta},s=QH(ic.projection,o),c=e;return c=tC(c,n.xKey,$(s.x)),c=tC(c,n.yKey,$(s.y)),c=tC(c,n.zKey,$(s.z)),c}if(a&&sH(n.id)){let t=i.get(n.id);if(!t)return e;let o=hB(a,t),s=gB(a,{...o,[r.axis]:o[r.axis]+r.delta}),c=e;return c=tC(c,n.xKey,$(s.x)),c=tC(c,n.yKey,$(s.y)),c=tC(c,n.zKey,$(s.z)),c}let o=bT(n,r.axis);if(Rz(o))return tC(e,o,`0`);let s=Number((t.fields[o]??`0`).trim().replace(`,`,`.`));return tC(e,o,$((Number.isFinite(s)?s:0)+r.delta))},e)))}),kl(`HP moved | ${s}`)};
4412return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[ir,Dl,Ol,kl,x,il,Al,v,g,d,ic,Xn]),(0,h.useEffect)(()=>{let e=e=>{let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable||e.altKey||e.shiftKey||!(e.ctrlKey||e.metaKey)||e.key.toLowerCase()!==`z`||v)return;let n=mo.current.pop();n&&(e.preventDefault(),uo.current=null,fo.current!==null&&(window.clearTimeout(fo.current),fo.current=null),ho.current=`hardpoint-undo`,Hl(),f(n.spmText),bo(`Undo HP move | ${n.summary}`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[bo,v,g,d]),(0,h.useEffect)(()=>{yq({spmText:Ko?.spmText??d,sourceName:Ko?.document.sourceName??g,customGraphLayoutName:Wn,customGraphLayoutSource:Kn,customGraphLayoutSavedSignature:U,customGraphs:aW(Hn),previousGeometry:ei,referenceGeometry:Xr,secondaryGeometry:Ms})},[Ms,Wn,U,Kn,Hn,ei,Xr,Ko,g,d]),(0,h.useEffect)(()=>{let e=window.setTimeout(()=>{bt(XU(K))},0);return()=>window.clearTimeout(e)},[K]),(0,h.useEffect)(()=>{if(Bt)try{Vt(pv(K,as).mesh)}catch(e){Vt(null),window.alert(e instanceof Error?e.message:`Cannot generate wheel envelope.`)}},[K]),(0,h.useEffect)(()=>{if(!nn){on(null);return}let e=!1,t=window.setTimeout(()=>{try{let t=ky(K,as,{includeWheelClashes:!!Bt});e||on(t)}catch(t){if(e)return;on(null),window.alert(t instanceof Error?t.message:`Cannot generate suspension clash envelopes.`)}},0);return()=>{e=!0,window.clearTimeout(t)}},[K,as,nn,Bt]);function Ul(e,t,n){let r=tC(e,t,n);return t===`Steering offsets`&&(r=tC(r,`Virtual Points/Lines`,n)),r}function Wl(e,t,n=null){let r=vW(e);Gn(r),qn(r?n:null),Jn(r?sW(t??Hn):null),t&&Un(aW(t)),f(e=>bW(e,r))}function Gl(){return Kl(bW(d,Wn))}function Kl(e){return LI(Jl(II(e,g)))}function ql(e){let t=eC(e,g).fields,n=[];return(t[`Antiroll CBar`]?.trim()||`0`)!==`0`&&n.push([`Draw CBar`,`1`]),(t[`Antiroll TBar`]?.trim()||`0`)!==`0`&&n.push([`Draw TBar`,`1`]),(t[`Third Element`]?.trim()||`0`)!==`0`&&n.push([`Draw Third Element`,`1`]),(t[`Heave Spring`]?.trim()||`0`)!==`0`&&n.push([`Draw Heave Spring`,`1`]),(t[`Roll Spring`]?.trim()||`0`)!==`0`&&n.push([`Draw Roll Spring`,`1`]),n.length===0?e:n.reduce((e,[t,n])=>Ul(e,t,n),e)}function Jl(e){let t=eC(e,g).fields,n=[...UB(t),...oB(t),...cB(t),...PB(t)];return n.length===0?e:n.reduce((e,[t,n])=>Ul(e,t,n),e)}function Yl(e){let t=e,n=eC(t,g).fields,r=HB(n);r.length>0&&(t=r.reduce((e,[t,n])=>Ul(e,t,n),t));let i=eC(t,g).fields,a=WB(i);return a.length>0&&(t=a.reduce((e,[t,n])=>Ul(e,t,n),t)),t=Xl(t),t}function Xl(e){let t=eC(e,g).fields,n=[...cH(t),...hH(t),...gH(t),...oB(t),...cB(t)];return n.length===0?e:n.reduce((e,[t,n])=>Ul(e,t,n),e)}function Zl(e,t=[]){let n=eC(e,g).fields,r=bB(n,t);return r.length===0?e:r.reduce((e,[t,n])=>Ul(e,t,n),e)}function Ql(e){let t=eC(e,g).fields,n=qz(t);return n.length===0?e:n.reduce((e,[t,n])=>Ul(e,t,n),e)}function $l(e,t){let n=(t.trim().toLowerCase()===`rear`?`rear`:`front`)==`rear`?`0`:`1`;return[`Draw Steering`,`Calculate Steer`,`Calculate Steering Column`,`Calculate BumpSteer`].reduce((e,t)=>Ul(e,t,n),e)}function eu(e,t){j&&e===`Draw Opposite Axle`&&t!==`0`||(Hl(),f(n=>{let r=Rz(e)?`0`:t,i=Ul(n,e,r);return e===`Axle Position`&&(i=$l(i,r)),Vz.has(e)&&(i=Yl(i)),Wz.has(e)&&(i=Zl(i,[e])),(Gz.has(e)||e===`Steering Model`)&&(i=Ql(i)),i=Jl(i),Hz.has(e)&&(i=Xl(i)),i}),Vz.has(e)?ko(`Suspension`,e):Wz.has(e)?ko(`Vehicle`,e):(Gz.has(e)||e===`Steering Model`)&&ko(`Run`,e))}function tu(e){Hl(),f(t=>{eC(t,g).fields;let n=e===LR,r=e===RR,i=Ul(t,`Suspension Type`,n?`Double Wishbone`:r?`Multilink`:EB(e));return i=Ul(i,`MacPherson`,n||r?`1`:`0`),i=Yl(i),i=Jl(i),i}),ko(`Suspension`,`Suspension Type`)}function nu(e,t){e===`Integral Link`&&Cn(!1),eu(e,t)}function ru(e){e===`Integral Link`&&Cn(!0)}function iu(e,t,n=!0){n&&Hl(),f(n=>{let r=e.reduce((e,n)=>Ul(e,n,Rz(n)?`0`:t),n);return e.some(e=>Vz.has(e))&&(r=Yl(r)),e.some(e=>Wz.has(e))&&(r=Zl(r,e)),e.some(e=>Gz.has(e)||e===`Steering Model`)&&(r=Ql(r)),r=Jl(r),r}),e.some(e=>Vz.has(e))?ko(`Suspension`,`${e.length} fields`):e.some(e=>Wz.has(e))?ko(`Vehicle`,`${e.length} fields`):e.some(e=>
4412Gz.has(e)||e===`Steering Model`)&&ko(`Run`,`${e.length} fields`)}function au(e,t){e.startsWith(`HSleft`)&&eu(e,t)}function ou(){let e=Uz(G.fields,rs,$o),t=gz.filter(t=>!e[t.key]&&!(j&&t.key===`Draw Opposite Axle`)),n=Re&&t.every(e=>(G.fields[e.key]??`0`)!==`0`)?`0`:`1`;ze(n===`1`),iu(t.map(e=>e.key),n)}function su(){if(V){ze(V.showPoints),f(e=>{let t=Object.entries(V.fieldValues).reduce((e,[t,n])=>Ul(e,t,n),e);return j?Ul(t,`Draw Opposite Axle`,`0`):t}),Be(null),bo(`Kinematics essentials view restored`);return}Be({showPoints:Re,fieldValues:Object.fromEntries(bz.map(e=>[e,G.fields[e]??`0`]))}),ze(!0),f(e=>Object.entries(yz).reduce((e,[t,n])=>Ul(e,t,n),e)),bo(`Kinematics essentials view enabled`)}function cu(){let e=[..._z,vz].filter(e=>!(v&&e.key===`Ghost wireframe`||e.key===`Tyre profile`&&!is)),t=e.every(e=>(G.fields[e.key]??`0`)!==`0`)?`0`:`1`;iu(e.map(e=>e.key),t)}function lu(){return new Promise(e=>{_i.current=e,_n(!0)})}function uu(){return new Promise(e=>{vi.current=e,yn(!0)})}function du(){return new Promise(e=>{yi.current=e,xn(!0)})}function fu(e){e.length!==0&&(Hl(),f(t=>{let n=e.reduce((e,[t,n])=>Ul(e,t,n),t);return n=Ql(n),n}),ko(`Run`,`${e.length} steering column fields`))}function pu(){pt||(mt(!0),window.setTimeout(()=>{try{let e=Qm(K);if(!e){window.alert(`Cannot optimize steering column non-uniformity with the current geometry.`);return}fu([[`U-joint 2 index angle`,$(e.indexAngleDeg)],[`Gamma Angle`,$(e.gammaAngleDeg)]]),bo(`Steering column optimized | Index ${$(e.indexAngleDeg)} deg | Phase ${$(e.gammaAngleDeg)} deg | Non_Uniformity ${$(e.nonUniformity)} deg`)}finally{mt(!1)}},0))}function mu(e){_n(!1);let t=_i.current;_i.current=null,t?.(e),e&&bo(`Unsaved changes warning accepted | Exit without saving`)}function hu(e){yn(!1);let t=vi.current;vi.current=null,t?.(e)}function gu(e){xn(!1);let t=yi.current;yi.current=null,t?.(e)}function _u(e){Hl(),f(t=>{let n=t;return Object.entries(e).forEach(([e,t])=>{n=tC(n,e,t)}),n=Jl(n),n=Xl(n),n})}function vu(e){Hl(),f(t=>{let n=t;return Object.entries(e).forEach(([e,t])=>{n=tC(n,e,t)}),n=Jl(n),n=Xl(n),n})}async function yu(){if(!x)return!0;if(vi.current)return!1;let e=`apply`;if(ac){if(e=await uu(),e===`cancel`)return!1;e===`discard`&&Ce&&_u(Ce)}S(!1),Te(null),pe(null),le(null);let t=oi.current;oi.current=null;let n=[t?.drawSteering?`Draw Steering`:null,t?.drawOppositeAxle?`Draw Opposite Axle`:null].filter(e=>e!==null);return n.length>0&&iu(n,`1`),t?.referenceGeometry&&(Zr(t.referenceGeometry),$r(t.ghostReference)),Le(!0),Ue===`rocker`&&We(`suspensionSettings`),bo(e===`discard`?`Rocker mode disabled | Changes discarded | Both sides restored`:ac?`Rocker mode disabled | Changes applied | Both sides restored`:`Rocker mode disabled | Both sides restored`),!0}async function bu(){return Ro?_i.current?!1:lu():!0}function xu(e,t,n=null,r=!0,i=`local`){let a=p??d;g.trim()&&a.trim()&&AL({name:g,text:II(a,g),tyreProfile:Wt?{fileName:Wt.fileName,text:Wt.sourceText}:null});let o=Kl(e);if(eC(o,t).suspension.monoShock){window.alert(`"${t}" uses MonoShock, which is not available in 3DSusp Web Beta.`);return}let s=i===`new`?o:ql(o),c=kL(t),l=null;if(c?.tyreProfile)try{l=Yw(c.tyreProfile.text,c.tyreProfile.fileName)}catch{l=null}Gt(l),AL({name:t,text:s,tyreProfile:c?.tyreProfile??null}),f(s),m(r?s:null),_(t),Fa(t),Na(null),Mr(n),Pr(i),Ef(),ca(null),ia(oz),oa(0),yo(e=>({...e,token:e.token+1})),Be(null),Yn([]),ti(null),Un([]),Gn(null),qn(null),Jn(null),bo(`File opened | ${t} | Source: ${i===`template`?`template`:i===`workspace`?`workspace`:i===`new`?`new document`:`local file`}`)}async function Su(e,t=null,n=!0){n&&!await bu()||xu(await e.text(),e.name,t,!0,`local`)}async function Cu(e){let t=e.name?.trim()||`Auxiliary_Axle.spm`;if(!/\.(spm|txt)$/i.test(t))throw Error(`Select an SPM suspension file.`);let n=II(await e.text(),t);if(eC(n,t).suspension.monoShock)throw Error(`"${t}" uses MonoShock, which is not available in 3DSusp Web Beta.`);let r={name:t,text:n,tyreProfile:kL(t)?.tyreProfile??null};N(r),AL(r),f(e=>tC(e,iL,t)),We(`fullVehicle`),bo(`Full vehicle | Auxiliary axle loaded | ${t} | Positioned as ${ML(G)}`)}async function wu(){let e=eo(),t=e.showOpenFilePicker;if(!t){pi.current?.click();return}try{let[n]=await t.call(e,{multiple:!1,types:OI}),r=await n?.getFile?.();r&&await Cu(r)}catch(t){HV(t)||e.alert(t instanceof Error?t.message:`Cannot open the auxiliary axle SPM.`)}}function Tu(e){Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function Eu(e){let t=Array.from(e.dataTransfer.files);if(t.length===0)return;if(e.preventDefault(),v||x||j){window.alert(`Exit the active mode before opening a dropped file.`);return}if(t.length!==1){window.alert(`Drop one .spm suspension file or one .cgr custom graph layout.`);return}let[n]=t;if(/\.spm$/i.test(n.name)){let e=Ro?`Any unsaved changes in the current suspension will be lost.`:`The current suspension will be replaced.`;if(!window.confirm(`Open \"${n.name}\"?\n\n${e}`))return;Su(n,null,!1).catch(e=>{window.alert(e instanceof Error?e.message:`Cannot open the dropped .spm file.`)});return}if(!xW(n.name)){window.alert(`Drop one .spm suspension file or one .cgr custom graph layout.`);return}let r=mf();n.text().then(e=>{let t=CW(e);Wl(n.name,t.graphs,`local`),hf(r,t.graphs,n.name,void 0,`local`),bo(`Custom layout imported | ${n.name} | Source: drag and drop`)}).catch(e=>{r&&!r.closed&&r.close(),window.alert(e instanceof Error?e.message:`Cannot open the dropped .cgr custom graph layout.`)})}
4412async function Du(){br(!1),await bu()&&(xu(XV(),`Untitled.spm`,null,!1,`new`),bt(null),ti(null),bo(`New document | Untitled.spm`))}async function Ou(){if(br(!1),!await bu())return;let e=window.showOpenFilePicker;if(!e){bi.current=!0,fi.current?.click();return}try{let[t]=await e({multiple:!1,types:OI}),n=await t?.getFile?.();n&&await Su(n,t,!1)}catch(e){HV(e)||window.alert(e instanceof Error?e.message:`Cannot open local file.`)}}async function ku(e){gi.current?.abort();let t=new AbortController;gi.current=t;let n=t.signal,r=e.name?.trim()||`step_${Ht.length+1}.step`;Zt({fileName:r,progress:0});let i=0,a=()=>{i>0&&(window.clearInterval(i),i=0)},o=()=>{a(),i=window.setInterval(()=>{Zt(e=>!e||e.fileName!==r||e.progress>=95?e:{...e,progress:Math.min(95,e.progress+1)})},140)};try{let t=await BV(e,e=>{let t=IV(e*.68);Zt(e=>e&&{...e,progress:t})},n),i=new TextDecoder().decode(t);Zt({fileName:r,progress:72}),o();let s=await VV(t,ZF,n);if(a(),n.aborted)throw RV();Zt({fileName:r,progress:97});let c=s,l=yV(),u={id:l,name:r,sourceStepText:i,mesh:c,colorHex:EV(i)??`#7dd3fc`,opacityPercent:QF,visible:!0,transform:{scale:1,scaleY:1,scaleZ:1,translate:{x:0,y:0,z:0},rotateDeg:{x:0,y:0,z:0}}};Ut(e=>[...e,u]),Yt(l),eu(`Step geometry`,`1`),We(`stepGeometry`),bo(`Import STEP completed | ${r} | Resolution ${ZF}%`),Zt({fileName:r,progress:100}),window.setTimeout(()=>{Zt(e=>e&&e.fileName===r?null:e)},220)}catch(e){throw a(),Zt(null),e}finally{gi.current===t&&(gi.current=null)}}async function Au(e){if(e.length===0)return;let t=[];for(let n of e)try{await ku(n)}catch(e){if(zV(e))return;t.push(n.name||`Unnamed STEP file`),bo(`Import STEP failed | ${n.name||`Unnamed STEP file`}`)}t.length>0&&window.alert(`Unable to import ${t.length===1?t[0]:`${t.length} STEP files`}. The remaining selected files were still processed.`)}function ju(){gi.current?.abort(),gi.current=null,Zt(null)}async function Mu(){let e=eo();br(!1),fn(null),mn(null);let t=e.showOpenFilePicker;if(!t){if(e===window)mi.current?.click();else{let t=e.document.createElement(`input`);t.type=`file`,t.accept=`.step,.stp`,t.multiple=!0,t.style.display=`none`,t.addEventListener(`change`,()=>{let e=Array.from(t.files??[]);t.remove(),e.length>0&&Au(e)},{once:!0}),e.document.body.appendChild(t),t.click()}return}try{let n=await t.call(e,{multiple:!0,types:kI}),r=(await Promise.all(n.map(e=>e.getFile?.()))).filter(e=>!!e);r.length>0&&await Au(r)}catch(t){HV(t)||e.alert(t instanceof Error?t.message:`Cannot import STEP geometry.`)}}async function Nu(){fn(null),mn(null);try{let e=await fetch(qF);if(!e.ok)throw Error(`The bundled STEP example could not be loaded.`);await ku(new File([await e.blob()],`F1_Full.step`,{type:`model/step`}))}catch(e){zV(e)||window.alert(e instanceof Error?e.message:`Cannot import the bundled STEP example.`)}}function Pu(e,t){let n=Yw(e,t);Gt(n);let r=d;return Jw(G.fields[`Wheel Definition`])||(r=tC(r,`Wheel Definition`,`Tyre profile`),eu(`Wheel Definition`,`Tyre profile`)),r=tC(r,`Tyre profile`,`1`),eu(`Tyre profile`,`1`),AL({name:g,text:r,tyreProfile:{fileName:n.fileName,text:e}}),n}async function Fu(e){let t=Pu(await e.text(),e.name);bo(`Import tyre profile completed | ${t.fileName} | ${t.halfProfile.length} rows`)}async function Iu(){br(!1);let e=window.showOpenFilePicker;if(!e){hi.current?.click();return}try{let[t]=await e({multiple:!1,types:AI}),n=await t?.getFile?.();n&&await Fu(n)}catch(e){HV(e)||window.alert(e instanceof Error?e.message:`Cannot import tyre profile.`)}}async function Lu(){try{let e=await fetch(JF);if(!e.ok)throw Error(`The bundled CSV example could not be loaded.`);await Fu(new File([await e.text()],`285_40.csv`,{type:`text/csv`}))}catch(e){window.alert(e instanceof Error?e.message:`Cannot import the bundled CSV example.`)}}function Ru(e){if(!Wt)return;let t=Pu(e,Wt.fileName);bo(`Tyre profile updated | ${t.fileName} | ${t.halfProfile.length} rows`),qt(!1)}function zu(e){Jt&&(fn(null),mn(null),Ut(t=>t.map(t=>{if(t.id!==Jt)return t;let n=CV(t.transform);return{...t,transform:CV(e(n))}})))}function Bu(e){let t=e.trim().replace(`,`,`.`);if(t===``||t===`-`||t===`+`||t===`.`||t===`-.`||t===`+.`)return null;let n=Number(t);return Number.isFinite(n)?bV(n):null}function Vu(e){return e===`overall`?`scale`:e===`y`?`scaleY`:`scaleZ`}function Hu(e,t){cn(n=>({...n,[e]:t}))}function Uu(e){if(!J)return;let t=Bu(sn[e]);if(t===null){cn(SV(J.transform));return}if(e===`overall`){let e=CV(J.transform),n=bV(e.scale),r=n>1e-12?t/n:t,i=bV(e.scaleY*r),a=bV(e.scaleZ*r);zu(e=>({...e,scale:t,scaleY:i,scaleZ:a})),cn({overall:$(t),y:$(i),z:$(a)});return}let n=Vu(e);zu(e=>({...e,[n]:t})),cn(n=>({...n,[e]:$(t)}))}function Wu(e,t){if(t.key===`Enter`){t.preventDefault(),Uu(e),t.currentTarget.blur();return}t.key===`Escape`&&(t.preventDefault(),J&&cn(SV(J.transform)),t.currentTarget.blur())}function Gu(e){if(!Jt)return;let t=wV(Number(e));Ut(e=>e.map(e=>e.id===Jt?{...e,opacityPercent:t}:e))}function Ku(e){let t=e.trim().replace(`,`,`.`);if(t===``||t===`-`||t===`+`)return null;let n=Number(t);return Number.isFinite(n)?n:null}function qu(e,t){un(n=>({...n,[e]:t}))}function Ju(e){if(!J)return;let t=Ku(ln[e]);if(t===null){un(mV(J.transform.translate));return}zu(n=>({...n,translate:{...n.translate,[e]:t}})),un(n=>({...n,[e]:$(t)}))}function Yu(e,t){if(t.key===`Enter`){t.preventDefault(),Ju(e),t.currentTarget.blur();return}t.key===`Escape`&&(t.preventDefault(),J&&un(mV(J.transform.translate)),t.currentTarget.blur())}function Xu(e){Mq(e.currentTarget)}function Zu(e,t){let n=Jz(t);n!==null&&zu(t=>({...t,rotateDeg:{...t.rotateDeg,[e]:n}}))}function Qu(){if(!J)return;let e=jV(J.mesh,J.transform);if(!e){window.alert(`Cannot identify selected STEP rotations.`);return}zu(t=>({...t,rotateDeg:e}))}function $u(){zu(()=>({scale:1,scaleY:1,scaleZ:1,translate:{x:0,y:0,z:0},rotateDeg:{x:0,y:0,z:0}}))}function ed(){Jt&&(fn(null),mn(null),Ut(e=>e.filter(e=>e.id!==Jt)))}function td(e){let t=TV(e);Ut(e=>e.map(e=>e.id===Jt?{...e,colorHex:t}:e))}
4412function nd(e,t){Ut(n=>n.map(n=>n.id===e?{...n,visible:t}:n))}function rd(){Ut(e=>{if(e.length===0)return e;let t=!e.every(e=>e.visible!==!1);return e.map(e=>({...e,visible:t}))})}async function id(){Or(!0),Ar(null);try{let e=new URL(zI,window.location.href);e.searchParams.set(`_`,String(Date.now()));let t=await fetch(e,{cache:`no-store`});if(!t.ok)throw Error(`Cannot read template index (${t.status}).`);let n=TL(await t.json());Er(n),n.length===0&&Ar(`No template .spm files found.`)}catch{Er([]),Ar(`Cannot read Template folder.`)}finally{Or(!1)}}async function ad(e){if(br(!1),await bu())try{let t=new URL(`Template/${encodeURIComponent(e)}`,window.location.href),n=await fetch(t);if(!n.ok)throw Error(`Cannot open template ${e}`);xu(await n.text(),e,null,!0,`template`)}catch(e){window.alert(e instanceof Error?e.message:`Cannot open template file.`)}}async function od(e,t){let n=await e.createWritable?.();if(!n)throw Error(`This browser cannot write to the selected file.`);await n.write(t),await n.close()}async function sd(){br(!1);let e=gV(g),t=Gl(),n=window.showSaveFilePicker;if(!n){WV(e,t),f(t),_(e),Fa(e),Na(null),Mr(null),Pr(`local`),m(t),bo(`File saved as | ${e}`);return}try{let r=await n({suggestedName:e,types:OI});await od(r,t),f(t);let i=r.name??e;_(i),Fa(i),Na(null),Mr(r),Pr(`local`),m(t),bo(`File saved as | ${i}`)}catch(e){HV(e)||window.alert(e instanceof Error?e.message:`Cannot save local file.`)}}async function cd(){if(br(!1),!jr?.createWritable){await sd();return}try{let e=Gl();await od(jr,e),f(e);let t=jr.name??g;_(t),Fa(t),Na(null),Pr(`local`),m(e),bo(`File saved | ${t}`)}catch(e){HV(e)||window.alert(e instanceof Error?e.message:`Cannot save local file.`)}}function ld(e){On||(Dn(!1),Tn(e),bo(`Convergence warning | ${e}`))}function ud(){En&&kn(!0),Tn(null)}async function dd(){let e=eo();if(br(!1),Ht.length===0){e.alert(`Import at least one STEP geometry before exporting.`);return}try{let t=Ht.map(e=>({name:e.name||`Imported STEP geometry`,sourceStepText:e.sourceStepText,transform:CV(e.transform),colorHex:e.colorHex})),n=$T(t),r=n?`3DSusp Web imported STEP assembly; source=${G.sourceName}; imported_steps=${Ht.length}; geometry=original_brep; transforms=assembly_placements; units=mm; rotation_reference=suspension_xyz; colors_applied=true`:`3DSusp Web imported STEP geometry export; source=${G.sourceName}; imported_meshes=${Ht.length}; geometry=ap242_triangulated_surface_set; transforms_baked_in_suspension_cs=true; rotation_reference=suspension_xyz; colors_applied=true; resolution=100`,i=n?rE(t,G.sourceName,`imported_step_geometry`,r):DT(Ht.map(e=>({name:e.name||`Imported STEP geometry`,mesh:FV(e.mesh,CV(e.transform)),colorHex:e.colorHex})),G.sourceName,`imported_step_geometry`,r),a=_V(i.fileName),o=e.showSaveFilePicker;if(!o){UV(a,i.stepText,`model/step;charset=utf-8`,e),bo(`Export STEP completed | ${a} | STEP parts: ${Ht.length} | Mode: ${n?`source B-Rep assembly`:`tessellated fallback`} | Faces: ${i.faceCount} | Units: mm`);return}await od(await o.call(e,{suggestedName:a,types:kI}),i.stepText),bo(`Export STEP completed | ${a} | STEP parts: ${Ht.length} | Mode: ${n?`source B-Rep assembly`:`tessellated fallback`} | Faces: ${i.faceCount} | Units: mm`)}catch(t){HV(t)||e.alert(t instanceof Error?t.message:`Cannot export imported STEP geometry.`)}}async function fd(){br(!1);try{let e=_v(K,as),t=_V(e.fileName),n=window.showSaveFilePicker;n?await od(await n({suggestedName:t,types:kI}),e.stepText):UV(t,e.stepText,`model/step;charset=utf-8`),bo(`Export wheel envelope (.step) completed | ${t} | Units: mm | Both sides`),e.nonConvergedFrames>0&&ld(`Wheel envelope exported. ${e.nonConvergedFrames} of ${e.frameCount} sampled positions did not fully converge.`)}catch(e){HV(e)||window.alert(e instanceof Error?e.message:`Cannot export wheel envelope.`)}}function pd(e){Ln(t=>({...t,folderName:e,statusMessage:t.parentFolderLabel?`Folder name updated. Create the folder again to confirm the export target.`:``})),Vn(null)}async function md(){let e=window.showDirectoryPicker;if(!e)return window.alert(`This browser cannot pick a destination folder.`),null;try{let t=await e({mode:`readwrite`});return zn(t),Vn(null),Ln(e=>({...e,parentFolderLabel:t.name?.trim()||`Selected folder`,statusMessage:`Parent folder selected. Create the export folder to continue.`})),t}catch(e){return HV(e)||window.alert(e instanceof Error?e.message:`Cannot select the parent folder.`),null}}async function hd(){let e=vV(In.folderName),t=Rn??await md();if(!t)return null;try{if(!t.getDirectoryHandle)return Vn(t),Ln(n=>({...n,folderName:e,parentFolderLabel:t.name?.trim()||n.parentFolderLabel,statusMessage:`Subfolder creation is not available here. Export will use the selected folder directly.`})),t;let n=await t.getDirectoryHandle(e,{create:!0});return Vn(n),Ln(n=>({...n,folderName:e,parentFolderLabel:t.name?.trim()||n.parentFolderLabel,statusMessage:`Export folder ready: ${e}`})),n}catch(e){return HV(e)||window.alert(e instanceof Error?e.message:`Cannot create the export folder.`),null}}async function gd(e){e?.preventDefault()}function _d(e){$n(e),ar(e.defaultStep)}function vd(){br(!1),Ir(!1),wr(!1),Hr(!1),Wr(!1),rr(GL(Qn)),tr(!0)}function yd(){tr(!1)}function bd(e){e?.preventDefault(),_d(KL(nr)),tr(!1)}function xd(){let e=VL();_d(e),rr(GL(e)),tr(!1)}function Sd(e){sr(e)}function Cd(){br(!1),Ir(!1),wr(!1),Hr(!1),Wr(!1),pr($L(or)),dr(!0)}function wd(){dr(!1)}function Td(e){e?.preventDefault();let t=eR(fr);
4412if(t!==or){dr(!1),hr(!0);return}Sd(t),dr(!1)}function Ed(){hr(!1)}function Dd(){Sd(eR(fr)),hr(!1)}function Od(e,t){Nn(n=>({...n,[e]:t}))}async function kd(e){e?.preventDefault()}function Ad(){if(Bt)return Vt(null),bo(`Wheel envelope view removed`),!0;try{let e=pv(K,as);return Vt(e.mesh),bo(`Wheel envelope view generated and displayed`),e.nonConvergedFrames>0&&ld(`Wheel envelope generated. ${e.nonConvergedFrames} of ${e.frameCount} sampled positions did not fully converge.`),!0}catch(e){return window.alert(e instanceof Error?e.message:`Cannot generate wheel envelope.`),!1}}function jd(){rn(e=>{let t=!e;return t||on(null),t})}function Md(e){if(!e){$t(!1);return}if(Bt){$t(!0);return}tn(!0)}function Nd(){tn(!1),Ad()&&$t(!0)}function Pd(){tn(!1),$t(!1)}function Fd(){if(typeof window>`u`)return;let e=window.document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)&&e.blur(),Mi.current?.focus({preventScroll:!0})}function Id(e,t,n=!1){eI(e)&&(x&&!AU(G,e,il)||(n||Fd(),Yn(n=>{let r;return r=t?n.includes(e)?n.filter(t=>t!==e):[...n,e]:n.length===1&&n[0]===e?[]:[e],Ol(n,r),r})))}function Ld(e,t){if(e.length===0){Yn(e=>(e.length>0&&Ol(e,[]),[]));return}let n=Array.from(new Set(e.filter(e=>eI(e)).filter(e=>!x||AU(G,e,il))));n.length!==0&&(Fd(),Yn(e=>{let r;if(!t)r=e.length===n.length&&n.every(t=>e.includes(t))?[]:n;else{let t=new Set(e),i=n.every(e=>t.has(e));n.forEach(e=>{i?t.delete(e):t.add(e)}),r=Array.from(t)}return Ol(e,r),r}))}let Rd=(0,h.useCallback)(e=>{if(Ue!==`log`)return;let t=[$(e.cameraPosition.x),$(e.cameraPosition.y),$(e.cameraPosition.z),$(e.target.x),$(e.target.y),$(e.target.z),$(e.up.x),$(e.up.y),$(e.up.z),$(e.distance)].join(`|`),n=`Cam (${$(e.cameraPosition.x)}, ${$(e.cameraPosition.y)}, ${$(e.cameraPosition.z)}) | Tgt (${$(e.target.x)}, ${$(e.target.y)}, ${$(e.target.z)}) | Up (${$(e.up.x)}, ${$(e.up.y)}, ${$(e.up.z)}) | Dist ${$(e.distance)} mm`;t!==vr.current&&(co.current={key:t,message:n},lo.current!==null&&window.clearTimeout(lo.current),lo.current=window.setTimeout(()=>{let e=co.current;co.current=null,lo.current=null,!(!e||e.key===vr.current)&&(vr.current=e.key,bo(`3D view | ${e.message}`))},520))},[bo,Ue]),zd=(0,h.useCallback)(()=>{oo.current=!0,ao.current=0},[]),Bd=(0,h.useCallback)(async()=>{try{window.document.fullscreenElement?await window.document.exitFullscreen():window.document.documentElement.requestFullscreen?await window.document.documentElement.requestFullscreen():window.alert(`Fullscreen is not supported by this browser.`)}catch{window.alert(`Unable to change fullscreen mode in this browser.`)}finally{window.setTimeout(Rl,40)}},[Rl]);function Vd(e,t,n){if(v)return;let r=el.get(e);if(!r)return;let i=n.trim().replace(`,`,`.`),a=Number(i);if(!Number.isFinite(a))return;let o=bT(r,t);Hl(),f(e=>Xl(tC(e,o,$(a)))),ko(`Geometry`,o),kl(`HP moved | ${Dl(e)} | ${t.toUpperCase()} = ${$(a)} mm`)}function Hd(e,t,n){if(v||!sH(e))return;let r=el.get(e),i=$c.get(e)?.point;if(!r||!i)return;let a=n.trim().replace(`,`,`.`),o=Number(a);if(!Number.isFinite(o))return;let s=gB(Yc,{...hB(Yc,i),[t]:o});Hl(),f(e=>{let t=e;return t=tC(t,r.xKey,$(s.x)),t=tC(t,r.yKey,$(s.y)),t=tC(t,r.zKey,$(s.z)),t=Xl(Jl(t)),t}),ko(`Geometry`,`${r.label} (upright relative)`),kl(`HP moved | ${Dl(e)} | ${t.toUpperCase()}U = ${$(o)} mm`)}function Ud(e,t,n){if(v||!ic)return;let r=el.get(e),i=$c.get(e)?.point;if(!r||!i)return;let a=n.trim().replace(`,`,`.`),o=Number(a);if(!Number.isFinite(o))return;let s={...ZH(ic.projection,i),[t]:o},c=QH(ic.projection,s);Hl(),f(e=>{let t=e;return t=tC(t,r.xKey,$(c.x)),t=tC(t,r.yKey,$(c.y)),t=tC(t,r.zKey,$(c.z)),t=Jl(t),t=Xl(t),t}),ko(`Geometry`,`${r.label} (${t.toUpperCase()}R)`),kl(`HP moved | ${Dl(e)} | ${t.toUpperCase()}R = ${$(o)} mm`)}function Wd(){let e=SH(dl);it(e),ot(e),ct(BH()),ut(`idle`),ft(null),et(`normal`),nt({rowIndex:0,slotIndex:0}),Qe(!0)}function Gd(e,t){it(n=>({...n,[e]:t}))}function Kd(e,t){ct(n=>({...n,[e]:t}))}function qd(e){it(t=>VH(dl,t,e,e=>-e))}function Jd(e){let t=wH(st[e]);if(t===null)return;let n=Number(t);Number.isFinite(n)&&(it(t=>VH(dl,t,e,e=>e+n)),ct(n=>({...n,[e]:t})))}let Yd=(0,h.useCallback)(async()=>
4412{if(!fl)return;let e=eo();try{if(e.navigator.clipboard?.writeText)await e.navigator.clipboard.writeText(fl);else if(!pV(fl,e))throw Error(`Clipboard unavailable`);ut(`copied`)}catch{ut(pV(fl,e)?`copied`:`error`)}},[fl]),Xd=(0,h.useCallback)(()=>{let e=g.replace(/\.[^.]+$/,``)||`suspension-geometry`,t=eo();UV(`${e}-tabular-input.csv`,pl,`text/csv;charset=utf-8`,t)},[g,pl]),Zd=(0,h.useCallback)(()=>{it(e=>{let t={};return Object.keys(e).forEach(e=>{t[e]=``}),t})},[]);function Qd(){ft(null),ct(BH()),ut(`idle`),et(`normal`),nt(null),Qe(!1)}function $d(){et(e=>e===`maximized`?`normal`:`maximized`)}function ef(){if(ml){ft({kind:`confirm-close`});return}Qd()}function tf(){ft(null)}function nf(e){e.length>0&&(Hl(),f(t=>Xl(Jl(e.reduce((e,[t,n])=>Ul(e,t,n),t)))),ko(`Geometry`,`${e.length} fields`),bo(`Geometry table overwrite | ${e.length} fields updated`)),Qd()}function rf(){if(AH(dl,rt)){ft({kind:`empty-table`,updates:jH(dl)});return}let{updates:e,invalidValues:t}=OH(dl,rt,at);if(t.length>0){ft({kind:`invalid-values`,values:t});return}if(kH(dl,rt)){ft({kind:`negative-y-coordinates`,updates:e});return}nf(e)}function af(e){let t=RH(e.clipboardData.getData(`text/plain`),dl,tt);Object.keys(t).length!==0&&(e.preventDefault(),e.stopPropagation(),it(e=>({...e,...t})))}function of(){bo(`Run started | Modes: Bump, Steer, Roll, BumpSteer`);let e=performance.now();He(!1),Dt({bump:0,steer:0,roll:0}),Ft.current=1,bt(XU(K)),wt(e=>e+1),bo(`Run completed | Modes: Bump, Steer, Roll, BumpSteer | ${Math.round(performance.now()-e)} ms`)}function sf(){St(YU(K))}function cf(){Zr(hV(d,g)),$r(!0),Hr(!1)}function lf(){Zr(null),$r(!1),Hr(!1)}function uf(e=Hn,t=Wn,n,r=Kn,i=U){let a=n?.spmText??Ko?.spmText??d,o=n?.sourceName??Ko?.document.sourceName??g;bt(XU(n?eC(a,o):K)),yq({spmText:a,sourceName:o,customGraphLayoutName:t,customGraphLayoutSource:r,customGraphLayoutSavedSignature:i,customGraphs:aW(e),secondaryGeometry:Ms,previousGeometry:n?n.previousGeometry:ei,referenceGeometry:n?n.referenceGeometry:Xr}),Ir(!1)}function df(e){let t=Ja===`window`?hL:`3dsusp-output-${e}`,n=Ja===`window`?gL:void 0,r=window.open(pq(e),t,n);return e===`fullVehicleSelection`&&r&&Ui.current.add(r),Mo(r),r?.focus(),r}function ff(){if(v||x||j||zr)return;Rr(!1);let e=Ko?.spmText??d,t=Ko?.document.sourceName??g,n=YU(K);St(n),WP({version:1,spmText:e,sourceName:t,openedAt:Date.now(),verifiedKinematicLimits:{bumpMax:n.bumpMax,reboundMax:n.reboundMax,steerMax:n.steerMax}});let r=window.open(HP(),`3dsusp-optimizer`);Mo(r),r&&!r.closed&&(Wi.current=r,Br(!0)),r?.focus(),bo(`Optimizer opened | Current suspension sent to target editor`)}function pf(){Rr(!1);let e=Wi.current;Wi.current=null,Br(!1),Ao(e),e&&!e.closed&&e.close(),bo(`Optimization mode disabled | Optimizer closed`)}function mf(){return uf(),df(`custom`)}function hf(e,t,n,r,i=Kn){if(uf(t,n,r,i,sW(t)),e&&!e.closed){e.location.href=pq(`custom`),e.focus();return}df(`custom`)}function gf(e,t){if(e===`fullVehicleSelection`&&(!j||!Ms)){t?.preventDefault();return}if(!SB(e,K)){t?.preventDefault();return}if(uf(),Ja!==`window`){e===`fullVehicleSelection`&&(t?.preventDefault(),df(e));return}t?.preventDefault(),df(e)}function vf(e){la===`none`&&(e.preventDefault(),Pl(e.clientX),ga(!0))}function yf(e){la===`none`&&(Qi(`manual`),e.preventDefault(),Ll(e.clientY),va(!0))}function xf(e){if(la===`setup`||e.ctrlKey||(e.target&&typeof e.target==`object`&&`closest`in e.target?e.target:null)?.closest(`input, textarea, select, [contenteditable='true']`))return;let t=Math.sign(e.deltaY);t!==0&&(e.preventDefault(),Qi(`manual`),Xi(e=>Math.min(1,Math.max(rz,e-t*.02))))}function Sf(e){if(e.button!==0)return;let t=e.target&&typeof e.target==`object`&&`closest`in e.target?e.target:null;t&&(t.closest(`button, input, textarea, select, label, a, [role='tab'], [role='slider'], [contenteditable='true']`)||(la===`setup`&&ua(`none`),Qi(`manual`),Xi(nz)))}function Cf(){let e=Ri.current;if(e&&!e.closed&&zi.current)return Mo(e),mq(window.document,e.document),e.document.title=`3DSusp Web - Control Deck`,e.focus(),!0;let t=window.open(``,_L,vL);if(!t)return!1;Mo(t),mq(window.document,t.document),t.document.title=`3DSusp Web - Control Deck`,t.document.body.innerHTML=``,t.document.body.style.margin=`0`,t.document.body.style.overflow=`hidden`;let n=t.document.createElement(`div`);n.id=`control-deck-window-root`,n.className=`app theme-${Bo} control-deck-detached-app`;let r=t.document.createElement(`div`);r.className=`control-deck-detached-host`,n.appendChild(r),t.document.body.appendChild(n);let i=()=>
4412{Vi.current||(Ao(t),Bi.current=null,zi.current=null,Ri.current=null,$a(0),Za(!1))},a=e=>{if((e.target&&typeof e.target==`object`&&`closest`in e.target?e.target:null)?.closest(`input, textarea, select, [contenteditable='true']`)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;if(e.key===`Escape`){e.preventDefault(),Ef();return}if(e.key===`F6`&&!e.repeat){e.preventDefault(),Za(!1);return}let t=new KeyboardEvent(`keydown`,{key:e.key,code:e.code,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,repeat:e.repeat,bubbles:!0,cancelable:!0});window.dispatchEvent(t),t.defaultPrevented&&e.preventDefault()};return t.addEventListener(`beforeunload`,i),t.addEventListener(`keydown`,a),Ri.current=t,zi.current=r,Bi.current=()=>{t.removeEventListener(`beforeunload`,i),t.removeEventListener(`keydown`,a)},$a(e=>e+1),t.focus(),!0}function wf(e){Bi.current?.(),Bi.current=null;let t=Ri.current;zi.current=null,Ri.current=null,$a(0),Ao(t),e&&t&&!t.closed&&(Vi.current=!0,t.close(),Vi.current=!1)}function Ef(){He(!1),jt(!1),kt({bump:0,steer:0,roll:0}),Nt(e=>({status:`idle`,requestId:e.requestId,samples:[]})),Dt({bump:0,steer:0,roll:0}),Ft.current=1}function Df(e){if(!Fw(K,e))return;let t=DG(K,e,AG(K,e,Et),Et);Nt(n=>({status:`pending`,requestId:n.requestId,samples:[],mode:e,seedMotion:t})),vt(e),kt(t),jt(!0)}function Of(e){if(!Fw(K,e)||(e===`steer`||e===`bumpSteer`)&&Wo)return;if(e===ht&&Ve){He(!1),jt(!1);let t=e===`bumpSteer`?{...Et,bump:0,steer:0}:DG(K,e,0,Et);kt(t),Dt(t),Ft.current=1;return}let t=DG(K,e,kG(K,e),Et);Nt(n=>({status:`pending`,requestId:n.requestId,samples:[],mode:e,seedMotion:t})),gt(e),vt(e),kt(t),jt(!0),Dt(t),Ft.current=1,He(!0)}function kf(){let e=x?[`default3D`,`rearYZ`,`planYX`,`lateralXZ`,`rocker2D`]:[`default3D`,`rearYZ`,`planYX`,`lateralXZ`],t=oo.current?0:ao.current%e.length,n=e[t];ao.current=(t+1)%e.length,oo.current=!1,yo(e=>({token:e.token+1,preset:n})),bo(`View reset | ${n===`rearYZ`?`Rear view (YZ)`:n===`planYX`?`Plan view (YX)`:n===`lateralXZ`?`Side view (XZ)`:n===`rocker2D`?`Rocker plane view`:`Default 3D`}`)}function Af(e){let t=Math.sqrt(.5),n=sa!==e;ia(e=>{let r=n?e*t:oz;return Math.min(6,Math.max(.45,r))}),ca(t=>t===e?null:e)}function jf(){ca(null),ia(oz),Le(e=>!e)}async function Mf(){if(!j)return!0;if(yi.current)return!1;let e=`apply`;if(oc){if(e=await du(),e===`cancel`)return!1;e===`discard`&&Ae&&vu(Ae)}Po(),M(!1),je(null);let t=si.current;return si.current=null,t?.drawOppositeAxle&&iu([`Draw Opposite Axle`],`1`,!1),t?.referenceGeometry&&(Zr(t.referenceGeometry),$r(t.ghostReference)),Ue===`fullVehicle`&&We(`suspensionSettings`),Ef(),bo(e===`discard`?`Full vehicle mode disabled | Primary axle changes discarded`:oc?`Full vehicle mode disabled | Primary axle changes applied`:`Full vehicle mode disabled`),!0}async function Nf(){if(br(!1),Ir(!1),Rr(!1),wr(!1),Hr(!1),j){await Mf();return}if(v||x||zr)return;let e=V?(V.fieldValues[`Draw Opposite Axle`]??`0`)!==`0`:(G.fields[`Draw Opposite Axle`]??`0`)!==`0`,t=Xr;if(si.current={drawOppositeAxle:e,ghostReference:!!t&&Qr,referenceGeometry:t},e&&iu([`Draw Opposite Axle`],`0`,!1),t&&(Zr(null),$r(!1)),Ho){let e=kL(Ho);e&&EL(e.name)===EL(Ho)&&N(e)}Ef(),Yn([]),je(tU(G)),M(!0),We(`fullVehicle`),bo(Ho?`Full vehicle mode enabled | Linked auxiliary: ${Ho}`:`Full vehicle mode enabled | Select an auxiliary axle SPM`)}async function Pf(){if(br(!1),Ir(!1),Rr(!1),wr(!1),Hr(!1),!rc)return;if(x){await yu();return}if(v||j||zr)return;Ef(),ca(null),ia(oz),Le(!1);let e=(G.fields[`Draw Steering`]??`0`)!==`0`,t=(G.fields[`Draw Opposite Axle`]??`0`)!==`0`,n=Xr;
4412oi.current={drawSteering:e,drawOppositeAxle:t,ghostReference:!!n&&Qr,referenceGeometry:n};let r=[e?`Draw Steering`:null,t?`Draw Opposite Axle`:null].filter(e=>e!==null);r.length>0&&iu(r,`0`),n&&(Zr(null),$r(!1)),pe(hV(d,g)),Te($H(G,el)),le(tc),S(!0),We(`rocker`),bo(`Rocker mode enabled | Left auxiliary rocker plane active`)}function Ff(e){lr(e),x&&le(oU(K,e))}async function If(){if(br(!1),Ir(!1),Rr(!1),wr(!1),Hr(!1),v){y(!1),xe(null),Yn([]),Ef(),Le(!0),Ue===`setup`&&We(`suspensionSettings`),bo(`Setup mode disabled | Both sides restored`);return}x||j||zr||(Le(!0),xe(hV(d,g)),y(!0),Yn([]),Ef(),We(`setup`),bo(`Setup mode enabled | Design suspension frozen`))}function Lf(e,t){Ne(n=>({...n,lengthDeltas:{...n.lengthDeltas,[e]:t}}))}function Rf(e){Ne(t=>({...t,rideHeightDelta:e}))}function zf(e,t,n){Ne(r=>({...r,chassisOffsets:{...r.chassisOffsets,[e]:{...r.chassisOffsets[e],[t]:n}}}))}function Bf(e,t){Ne(n=>({...n,shimAmounts:{...n.shimAmounts,[e]:t}}))}function Vf(e,t){Ne(n=>({...n,shimNormals:{...pC.shimNormals,...n.shimN
4412ormals??{},[e]:t}}))}function Uf(e){Ne(t=>({...t,adjustmentMode:e}))}function Wf(){Ne(pC),bo(`Setup mode | Adjustments reset`)}async function Gf(){if(!Ko)return;let e=eo(),t=gV(g.replace(/(\.spm)?$/i,`_setup.spm`)),n=Kl(Ko.spmText),r=e.showSaveFilePicker;if(!r){WV(t,n,e),bo(`Setup export completed | ${t}`);return}try{let i=await r.call(e,{suggestedName:t,types:OI});await od(i,n),bo(`Setup export completed | ${i.name??t}`)}catch(t){HV(t)||e.alert(t instanceof Error?t.message:`Cannot export setup .spm.`)}}async function Kf(){if(await bu())try{await XM(e.token),t()}catch(e){window.alert(e instanceof Error?e.message:`Could not securely log out. Please try again.`)}}function qf(){Yr.current=!0,Wr(!1),Kr(null),Jr(0)}function Jf(){Jr(null),Ir(!1),YM(e.token).catch(()=>void 0)}let Yf=v?`setup`:x?`rocker`:j?`fullVehicle`:null,Xf=Yf===`setup`?aI:Yf===`rocker`?oI:Yf===`fullVehicle`?sI:null,Zf=Yf===`setup`?[...tI,nI]:Yf===`rocker`?[...tI,rI]:Yf===`fullVehicle`?[...tI,iI]:tI,Qf=Zf.some(e=>e.id===Ue),$f=Xf?!Xf.has(Ue):!1,ep=Yf!==null&&Ue!==`graphics`&&Ue!==Yf,tp=v?Go:Jo,np=x?Cs?.sections.filter(e=>e.id===`monitor-secondary`)??[]:_s?.sections??[],rp=Ge?j?Bs?.sections??null:v?Ss?.sections??null:x?_s?.sections.filter(e=>e.id===`monitor-secondary`)??null:xs?.sections??null:null,ip=x?`Current`:v?`Current setup`:`Current value`,ap=x?`Rocker Mode`:j?`Auxiliary`:v?`Baseline`:`Reference`,op=v,sp=op?[]:W,cp=op?void 0:Id,lp=op?void 0:Ld,up=!op&&Al.some(e=>!x||AU(G,e.id,il)),dp=(e,t=!1)=>{let n=[];return t&&n.push(`tab-utility-button`),e===`setup`&&n.push(`tab-setup-mode-button`),e===`rocker`&&n.push(`tab-rocker-mode-button`),e===`fullVehicle`&&n.push(`tab-full-vehicle-mode-button`),Yf&&e!==Yf&&e!==`graphics`&&n.push(`tab-setup-muted-button`),n.join(` `)},fp=fI[Ue],pp=Gr===`about`?`About 3DSusp Web`:Gr===`privacy`?`Privacy Policy`:Gr===`quickGuide`?`${fp.title} - Quick user guide`:Gr===`shortcuts`?`Keyboard shortcuts`:`Terms & Conditions`,mp=Gr===`about`?`Web build ${ro>0?ro:`-`} - Desktop lineage ${wI}`:Gr===`privacy`?`How BSpoke Automotive uses and protects personal data in 3DSusp Web.`:Gr===`quickGuide`?fp.description:Gr===`shortcuts`?`Keyboard controls available in the main 3DSusp Web workspace.`:`Current disclaimer and software use terms inherited from the desktop release.`,hp=Gr===`about`?`support-about-title`:Gr===`privacy`?`support-privacy-title`:Gr===`quickGuide`?`support-quick-guide-title`:Gr===`shortcuts`?`support-shortcuts-title`:`support-terms-title`,gp=(e=!1)=>(0,Z.jsx)(lq,{document:K,motion:ps,animationSpeedPercent:It,groundFixed:Rt===`contactPatchFixed`,animationMode:ht,isPlaying:Ve,onActivateMode:Of,steerDisabled:Wo,disabledModes:qo,onAnimationSpeedChange:e=>Lt(zL(e)),onGroundFixedChange:e=>zt(e?`contactPatchFixed`:`chassisFixed`),onPrepareMotionCache:Df,onMotionChange:e=>Dt(t=>({...t,...e})),onResetMotion:Ef,floating:e,onDragPointerDown:e?ks:void 0,onDragPointerMove:e?As:void 0,onDragPointerEnd:e?js:void 0}),_p=(e=!1)=>(0,Z.jsxs)(`section`,{ref:e?void 0:Pi,className:`control-deck${e?` control-deck-detached-window`:``}`,onWheel:xf,onDoubleClick:Sf,children:[(0,Z.jsxs)(`div`,{className:`tab-strip`,role:`tablist`,"aria-label":`Setup tabs`,children:[(0,Z.jsx)(`div`,{className:`tab-strip-group tab-strip-group-primary`,children:Zf.map(e=>(0,Z.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":Ue===e.id,"data-product-tour":e.id===`suspensionGeometry`?`geometry-tab`:void 0,className:dp(e.id),onClick:()=>{We(e.id),Zi===`tabsOnly`&&zl(`tabsOnly`)},children:e.label},e.id))}),(0,Z.jsx)(`div`,{className:`tab-strip-guide-slot`,children:(0,Z.jsx)(`button`,{type:`button`,className:`tab-strip-guide-button`,"aria-label":`Open quick guide for ${fp.title}`,"data-ui-tooltip":`Open quick guide for ${fp.title}.`,onClick:()=>Kr(`quickGuide`),children:(0,Z.jsx)(F,{size:28,strokeWidth:2.5,"aria-hidden":`true`})})})]}),(0,Z.jsx)(`div`,{className:`tab-panel${Qf?` tab-panel-setup`:``}${$f?` tab-panel-readonly`:``}`,children:(0,Z.jsxs)(`fieldset`,{className:`tab-panel-fieldset`,disabled:ep,children:[Ue===`setup`?(0,Z.jsx)(nV,{state:ts,uiState:es,result:Ko,baselineDocument:Go,motion:ps,animationMode:ht,motionRatioMode:or,selectedShimKey:Pe,onLengthDeltaChange:Lf,onRideHeightDeltaChange:Rf,onChassisOffsetChange:zf,onShimChange:Bf,onShimNormalChange:Vf,onShimSelect:Fe,onAdjustmentModeChange:Uf,onReset:Wf,onExport:()=>void Gf()}):null,Ue===`rocker`&&ic?(0,Z.jsx)(tV,{state:ic,referenceMode:ec,linkBasedDisabled:!$s,document:G,selectedHardpointIds:W,referenceRows:tl,editableRows:nl,rodMetrics:Mc,springMetrics:Nc,heaveMetrics:Pc,rollMetrics:Fc,onReferenceModeChange:Ff,onHardpointSelect:Id,onCoordinateChange:Ud}):null,Ue===`fullVehicle`?(0,Z.jsxs)(`div`,{className:`full-vehicle-mode-grid`,children:[(0,Z.jsxs)(`section`,{className:`control-column compact-panel full-vehicle-mode-panel`,"aria-label":`Full vehicle auxiliary axle`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(oe,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Auxiliary axle`})]}),(0,Z.jsxs)(`div`,{className:`full-vehicle-file-card`,children:[(0,Z.jsxs)(`div`,{className:`full-vehicle-file-row`,children:[(0,Z.jsx)(`span`,{children:`Front axle`}),(0,Z.jsx)(`strong`,{className:Uo?`full-vehicle-auxiliary-file-name`:void 0,children:Uo?(ne?.name??Ho)||`Not selected`:g}),(0,Z.jsx)(`small`,{children:Uo?`Auxiliary`:`Primary`})]}),(0,Z.jsxs)(`div`,{className:`full-vehicle-file-row`,children:[(0,Z.jsx)(`span`,{children:`Rear axle`}),(0,Z.jsx)(`strong`,{className:Uo?void 0:`full-vehicle-auxiliary-file-name`,children:Uo?g:(ne?.name??Ho)||`Not selected`}),(0,Z.jsx)(`small`,{children:Uo?`Primary`:`Auxiliary`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`full-vehicle-open-button`,onClick:()=>void wu(),children:[(0,Z.jsx)(ie,{size:16,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:ne?`Replace auxiliary axle SPM`:`Open auxiliary axle SPM`})]})]})]}),(0,Z.jsxs)(`section`,{className:`control-column compact-panel full-vehicle-mode-panel full-vehicle-placement-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(_e,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Automatic placement`})]}),(0,Z.jsxs)(`div`,{className:`full-vehicle-placement-grid`,children:[(0,Z.jsx)(`span`,{children:`Wheelbase from primary`}),(0,Z.jsxs)(`strong`,{children:[$(Math.abs(G.vehicle.wheelbase)),` mm`]}),(0,Z.jsx)(`span`,{children:`Auxiliary translation X`}),(0,Z.jsx)(`strong`,{children:Hs?`${$(Hs.x)} mm`:`?`}),(0,Z.jsx)(`span`,{children:`Wheel-centre distance X`}),(0,Z.jsx)(`strong`,{children:Us===null?`?`:`${$(Us)} mm`}),(0,Z.jsx)(`span`,{children:`Contact patch offset Z`}),(0,Z.jsx)(`strong`,{children:Hs?`${$(Hs.z)} mm`:`?`})]}),(0,Z.jsx)(`p`,{className:`full-vehicle-mode-note`,children:`The auxiliary axle is placed at the opposite end of the primary wheelbase and translated in Z until both contact patch levels match.`})]})]}):null,Ue===`suspensionSettings`?(0,Z.jsxs)(`div`,{className:`tab-grid settings-compact settings-with-vehicle`,children:[(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(ye,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Core Settings`})]}),(0,Z.jsx)(`div`,{className:`compact-field-grid core-settings-vert
4412ical`,children:PR.map(e=>(()=>{let t=e.key===`Suspension Type`,n=t?Qo.suspensionTypeValue:G.fields[e.key]??``,r=Qo.selectOptions[e.key],i=r.includes(n)||n===``?[...r]:[n,...r],a=e.key===`Mounting Point`;return(0,Z.jsx)(KB,{label:a?TB(G.fields.Configuration):e.label,value:n,options:i,disabled:Qo.selectDisabled[e.key],optionDisabled:Qo.selectOptionDisabled[e.key],optionLabels:a?VR:void 0,onChange:n=>t?tu(n):eu(e.key,n)},e.key)})())})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(be,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Model Options`})]}),(0,Z.jsx)(`div`,{className:`toggle-grid compact-toggle-grid`,children:WR.map(e=>(0,Z.jsx)(qB,{document:G,field:e,checkedOverride:e.key===`Main Spring`?bf(G):void 0,disabled:Qo.toggleDisabled[e.key],tooltip:e.key===`MonoShock`?XF:void 0,onChange:nu,onDisabledClick:e.key===`Integral Link`?ru:void 0},e.key))}),Sn?(0,Z.jsx)(`div`,{className:`setup-warning setup-warning-multiline suspension-settings-warning`,role:`alert`,children:GR.map(e=>(0,Z.jsx)(`span`,{children:e},e))}):null]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(fz,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Wheels`})]}),(0,Z.jsxs)(`div`,{className:`field-grid vehicle-wheel-classic`,children:[(()=>{let e=G.fields[`Wheel Definition`]?.trim()||rs.wheelDefinition;return(0,Z.jsx)(`div`,{className:`vehicle-wheel-definition-inline`,children:(0,Z.jsx)(KB,{label:`Wheel definition`,value:e,options:XR.includes(e)?[...XR]:[e,...XR],optionDisabled:{"Tyre profile":Wt===null},optionLabels:ZR,onChange:e=>eu(`Wheel Definition`,e)})})})(),KR.map(e=>(0,Z.jsx)(GB,{document:G,field:e,disabled:e.key===`Wheel Radius`&&rs.wheelRadiusDisabled||e.key===`Rim Width`&&rs.rimWidthDisabled||e.key===`Tyre Width`&&rs.tyreWidthDisabled||e.key===`Aspect Ratio`&&rs.aspectRatioDisabled,onChange:eu},e.key)),(0,Z.jsxs)(`div`,{className:`vehicle-tyre-profile-summary`,role:`group`,"aria-label":`CSV tyre profile`,children:[(0,Z.jsxs)(`div`,{className:`vehicle-tyre-profile-summary-title`,children:[(0,Z.jsx)(`span`,{children:`CSV tyre profile`}),(0,Z.jsxs)(`div`,{className:`vehicle-tyre-profile-title-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`vehicle-tyre-profile-action vehicle-tyre-profile-import-action`,"aria-label":`Import tyre profile CSV`,"data-ui-tooltip":`Import a tyre profile CSV file.`,onClick:()=>void Iu(),children:(0,Z.jsx)(ge,{size:13,"aria-hidden":`true`})}),(0,Z.jsx)(`button`,{type:`button`,className:`vehicle-tyre-profile-action`,"data-ui-tooltip":`L
4412oads the bundled 285/40 tyre profile CSV example.`,onClick:()=>void Lu(),children:(0,Z.jsx)(`span`,{children:`Example`})}),(0,Z.jsxs)(`button`,{type:`button`,className:`vehicle-tyre-profile-action`,"data-ui-tooltip":`Edit the imported tyre profile CSV coordinates.`,disabled:!Wt,onClick:()=>qt(!0),children:[(0,Z.jsx)(me,{size:12,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Edit`})]})]})]}),Wt?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`label`,{className:`field-row output-readonly-row vehicle-tyre-profile-row vehicle-tyre-profile-row-file`,children:[(0,Z.jsx)(`span`,{children:`File name`}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(`input`,{type:`text`,value:Wt.fileName.toLowerCase().endsWith(`.csv`)?Wt.fileName:`${Wt.fileName}.csv`,readOnly:!0,"aria-readonly":`true`})})]}),(0,Z.jsxs)(`label`,{className:`field-row output-readonly-row vehicle-tyre-profile-row`,children:[(0,Z.jsx)(`span`,{children:`Overall width`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:Wt.overallWidth.toFixed(1),readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]}),(0,Z.jsxs)(`label`,{className:`field-row output-readonly-row vehicle-tyre-profile-row`,children:[(0,Z.jsx)(`span`,{children:`Profile height`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:Wt.profileHeight.toFixed(1),readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]}),(0,Z.jsxs)(`label`,{className:`field-row output-readonly-row vehicle-tyre-profile-row`,children:[(0,Z.jsx)(`span`,{children:`Profile aspect ratio`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:Wt.profileAspectRatio.toFixed(1),readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`%`})]})]})]}):(0,Z.jsx)(`span`,{className:`vehicle-tyre-profile-empty`,children:`No CSV profile loaded.`})]})]})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(ae,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Camber / Toe`})]}),(0,Z.jsx)(`div`,{className:`field-grid camber-toe-classic`,children:qR.map(e=>(0,Z.jsx)(GB,{document:G,field:e,onChange:eu},e.key))})]})]}):null,Ue===`vehicleSettings`?(0,Z.jsxs)(`div`,{className:`tab-grid two vehicle-settings-layout`,children:[(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(be,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Vehicle Parameters FOR ANTI EFFECTS`})]}),(0,Z.jsxs)(`div`,{className:`field-grid vehicle-parameters-grid`,children:[JR.filter(e=>e.key===`Wheelbase`||e.key===`Centre of Gravity Height`).map(e=>(0,Z.jsx)(GB,{document:G,field:e,disabled:e.key===`Front Drive Ratio`&&rs.driveRatioDisabled,onChange:eu},e.key)),(()=>{let e=G.fields.Wheeldrive?.trim()||`Rear`;return(0,Z.jsx)(KB,{label:`Wheel drive`,value:e,options:$R.includes(e)?[...$R]:[e,...$R],onChange:e=>eu(`Wheeldrive`,e)})})(),JR.filter(e=>e.key===`Front Drive Ratio`).map(e=>(0,Z.jsx)(GB,{document:G,field:e,disabled:e.key===`Front Drive Ratio`&&rs.driveRatioDisabled,onChange:eu},e.key)),(()=>{let e=G.fields[`Brakes Position`]?.trim()||`Outboard`;return(0,Z.jsx)(KB,{label:`Brake position`,value:e,options:QR.includes(e)?[...QR]:[e,...QR],onChange:e=>eu(`Brakes Position`,e)})})(),JR.filter(e=>e.key===`Front Brake Balance`).map(e=>(0,Z.jsx)(GB,{document:G,field:e,disabled:e.key===`Front Drive Ratio`&&rs.driveRatioDisabled,onChange:eu},e.key))]})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(ye,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`DRIVESHAFTS & CV JOINTS`})]}),(0,Z.jsxs)(`div`,{className:`driveshaft-grid driveshaft-grid-compact`,children:[(0,Z.jsxs)(`section`,{className:`driveshaft-coordinates-card`,"aria-label":`Driveshaft chassis-side coordinates`,children:[(0,Z.jsxs)(`div`,{className:`driveshaft-coordinates-head`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`X`}),(0,Z.jsx)(`span`,{children:`Y`}),(0,Z.jsx)(`span`,{children:`Z`})]}),(0,Z.jsxs)(`div`,{className:`driveshaft-coordinates-row`,children:[(0,Z.jsx)(`span`,{children:`Inner CVJ`}),[`X SemiAxis`,`Y SemiAxis`,`Z SemiAxis`].map(e=>(0,Z.jsx)(`label`,{className:`driveshaft-coordinate-input`,children:(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:G.fields[e]??`0`,onChange:t=>eu(e,t.target.value),onFocus:Xu,disabled:!rs.driveshaftEnabled})},e))]})]}),YR.filter(e=>e.key===`Distance SemiAxis`).map(e=>(0,Z.jsx)(GB,{document:G,field:e,disabled:!rs.driveshaftEnabled,onChange:eu},e.key)),(()=>{let e=G.fields[`SemiAxis Fixed Joint`]?.trim()||`Chassis`;return(0,Z.jsx)(KB,{label:`Fixed joint position`,value:e,options:ez.includes(e)?[...ez]:[e,...ez],optionLabels:tz,disabled:!rs.driveshaftEnabled,onChange:e=>eu(`SemiAxis Fixed Joint`,e)})})(),(0,Z.jsxs)(`label`,{className:`field-row output-readonly-row`,children:[(0,Z.jsx)(`span`,{children:`Driveshaft length`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:Lc===null?`-`:$(Lc),readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]})]})]})]}):null,Ue===`suspensionGeometry`?(()=>{let e=e=>{let t=e.chassisId?$c.get(e.chassisId):void 0,n=e.wheelId?$c.get(e.wheelId):void 0,r=ul.rowWheelEditable[e.key]??!0,i=ul.rowChassisAxisEditable[e.key],a=ul.rowWheelAxisEditable[e.key],o=[e.component,e.position].filter(e=>!!e).join(` `),s=!!(t&&W.includes(t.id)),c=!!(n&&W.includes(n.id
4412)),l=!!(Xn&&n&&sH(n.id)),u=n&&l?hB(Yc,n.point):n?.point,d=s||c;return(0,Z.jsxs)(`div`,{className:`excel-row${d?` selected`:``}`,role:`row`,onClick:t=>{let n=e.chassisId??e.wheelId;n&&Id(n,t.ctrlKey||t.metaKey)},children:[(0,Z.jsx)(`span`,{className:`component-cell${d?` selected`:``}`,children:o}),[`x`,`y`,`z`].map(n=>t?(0,Z.jsx)(`label`,{className:`excel-cell${s?` selected`:``}`,children:(0,Z.jsx)(Xz,{className:s?`selected`:void 0,value:$(t.point[n]),disabled:i?!i[n]:!1,onCommit:e=>Vd(t.id,n,String(e)),onFocus:()=>Id(t.id,!1,!0),onClick:e=>e.stopPropagation()})},`${e.key}-chassis-${n}`):(0,Z.jsx)(`span`,{className:`empty-cell`,children:`-`},`${e.key}-chassis-${n}`)),[`x`,`y`,`z`].map(t=>n?(0,Z.jsx)(`label`,{className:`excel-cell${c?` selected`:``}${l?` upright-relative-cell`:``}`,children:(0,Z.jsx)(Xz,{className:c?`selected`:void 0,value:$((u??n.point)[t]),disabled:!r||(a?!a[t]:!1),onCommit:e=>l?Hd(n.id,t,String(e)):Vd(n.id,t,String(e)),onFocus:()=>Id(n.id,!1,!0),onClick:e=>e.stopPropagation()})},`${e.key}-wheel-${t}`):(0,Z.jsx)(`span`,{className:`empty-cell`,children:`-`},`${e.key}-wheel-${t}`))]},e.key)},t=!!(ll&&W.includes(ll.id)),n=G.fields[`Wheel Radius`]?.trim()??``,r=n===``?$(G.vehicle.wheelRadius):n,i=mm(G,Ic),a=Xn?[`Wheel Xr`,`Wheel Yr`,`Wheel Zr`]:[`Wheel X`,`Wheel Y`,`Wheel Z`];return(0,Z.jsxs)(`div`,{className:`geometry-vb-layout`,children:[(0,Z.jsxs)(`div`,{className:`geometry-vb-main${cl.length>0||uc?` has-secondary`:``}`,children:[(0,Z.jsxs)(`section`,{className:`geometry-excel-panel geometry-primary-panel geometry-merged-label-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(Se,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Suspension Geometry`}),(0,Z.jsxs)(`button`,{type:`button`,className:`report-topbar-button geometry-upright-relative-toggle`,"aria-pressed":Xn,"data-ui-tooltip":`Shows and edits wheel-side hardpoints in the static upright/wheel coordinate system. The stored SPM coordinates remain absolute.`,onClick:()=>Zn(e=>!e),children:[(0,Z.jsx)(k,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Upright Relative`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`report-topbar-button geometry-tabular-input-trigger`,onClick:Wd,disabled:dl.length===0,children:[(0,Z.jsx)(Se,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Tabular input & transformations`})]})]}),(0,Z.jsx)(`div`,{className:`geometry-excel-table-wrap geometry-excel-table-wrap-static`,role:`table`,"aria-label":`Suspension geometry links table`,children:(0,Z.jsxs)(`div`,{className:`geometry-excel-table`,children:[(0,Z.jsxs)(`div`,{className:`excel-row excel-head`,children:[(0,Z.jsx)(`span`,{children:`Component`}),(0,Z.jsx)(`span`,{children:`Chassis X`}),(0,Z.jsx)(`span`,{children:`Chassis Y`}),(0,Z.jsx)(`span`,{children:`Chassis Z`}),a.map(e=>(0,Z.jsx)(`span`,{className:Xn?`upright-relative-head`:void 0,children:e},e))]}),sl.map(t=>e(t))]})})]}),cl.length>0||uc?(0,Z.jsx)(`div`,{className:`geometry-secondary-stack`,children:(0,Z.jsxs)(`section`,{className:`geometry-excel-panel geometry-secondary-panel geometry-merged-label-panel geometry-rocker-angle-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(Se,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`ROCKER GEOMETRY`})]}),cl.length>0?(0,Z.jsx)(`div`,{className:`geometry-excel-table-wrap geometry-excel-table-wrap-static`,role:`table`,"aria-label":`Rocker geometry points table`,children:(0,Z.jsxs)(`div`,{className:`geometry-excel-table`,children:[(0,Z.jsxs)(`div`,{className:`excel-row excel-head`,children:[(0,Z.jsx)(`span`,{children:`Component`}),(0,Z.jsx)(`span`,{children:`Chassis X`}),(0,Z.jsx)(`span`,{children:`Chassis Y`}),(0,Z.jsx)(`span`,{children:`Chassis Z`}),(0,Z.jsx)(`span`,{children:`Wheel X`}),(0,Z.jsx)(`span`,{children:`Wheel Y`}),(0,Z.jsx)(`span`,{children:`Wheel Z`})]}),cl.map(t=>e(t))]})}):null,uc?(0,Z.jsxs)(`div`,{className:`suspension-rocker-angle-grid`,children:[(0,Z.jsxs)(`div`,{className:`suspension-rocker-angle-row`,children:[(0,Z.jsx)(`span`,{className:`suspension-rocker-metric-title`,children:`3D angle - Spring to rocker`}),(0,Z.jsxs)(`span`,{className:`field-input suspension-rocker-angle-value`,children:[(0,Z.jsx)(`input`,{type:`text`,value:dc===null?`-`:$(dc),readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`deg`})]})]}),(0,Z.jsxs)(`div`,{className:`suspension-rocker-angle-row`,children:[(0,Z.jsx)(`span`,{className:`suspension-rocker-metric-title`,children:`Spring moment arm`}),(0,Z.jsxs)(`span`,{className:`field-input suspension-rocker-angle-value`,children:[(0,Z.jsx)(`input`,{type:`text`,value:pc===null?`-`:$(pc),readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]}),(0,Z.jsxs)(`div`,{className:`suspension-rocker-angle-row`,children:[(0,Z.jsx)(`span`,{className:`suspension-rocker-metric-title`,children:bc}),(0,Z.jsxs)(`span`,{className:`field-input suspension-rocker-angle-value`,children:[(0,Z.jsx)(`input`,{type:`text`,value:fc===null?`-`:$(fc),readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`deg`})]})]}),(0,Z.jsxs)(`div`,{className:`suspension-rocker-angle-row`,children:[(0,Z.jsx)(`span`,{className:`suspension-rocker-metric-title`,children:xc}),(0,Z.jsxs)(`span`,{className:`field-input suspension-rocker-angle-value`,children:[(0,Z.jsx)(`input`,{type:`text`,value:mc===null?`-`:$(mc),readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]})]}):null]})}):null]}),(0,Z.jsxs)(`aside`,{className:`geometry-vb-side`,children:[(0,Z.jsxs)(`section`,{className:`geometry-mini-panel geometry-wheel-center-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title geometry-wheel-center-title`,children:[(0,Z.jsx)(fz,{size:16,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`WHEEL CENTRE`})]}),(0,Z.jsxs)(`div`,{className:`wheel-center-grid`,children:[(0,Z.jsxs)(`div`,{className:`wheel-center-axis-row`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`X`}),(0,Z.jsx)(`span`,{children:`Y`}),(0,Z.jsx)(`span`,{children:`Z`})]}),(0,Z.jsxs)(`div`,{className:`wheel-center-row${t?` selected`:``}`,onClick:e=>{ll&&Id(ll.id,e.ctrlKey||e.metaKey)},children:[(0,Z.jsx)(`span`,{children:`Wheel centre`}),[`x`,`y`,`z`].map(e=>ll?(0,Z.jsx)(`label`,{className:`wheel-center-cell${t?` selected`:``}`,children:(0,Z.jsx)(Xz,{className:t?`selected`:void 0,value:$(ll.point[e]),onCommit:t=>
4412Vd(ll.id,e,String(t)),onFocus:()=>Id(ll.id,!1,!0),onClick:e=>e.stopPropagation()})},`wheel-center-${e}`):(0,Z.jsx)(`span`,{className:`empty-cell`,children:`-`},`wheel-center-${e}`))]})]}),(0,Z.jsx)(`div`,{className:`wheel-center-grid wheel-center-readonly-grid`,children:(0,Z.jsxs)(`div`,{className:`wheel-center-row wheel-center-readonly-row`,children:[(0,Z.jsx)(`span`,{children:`Contact patch`}),[`x`,`y`,`z`].map(e=>(0,Z.jsx)(`label`,{className:`wheel-center-cell`,children:(0,Z.jsx)(`input`,{type:`text`,value:$(i[e]),readOnly:!0,"aria-readonly":`true`})},`contact-patch-${e}`))]})}),(0,Z.jsxs)(`label`,{className:`field-row output-readonly-row wheel-center-radius-row`,children:[(0,Z.jsx)(`span`,{children:`Wheel radius`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:r,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]})]}),(0,Z.jsxs)(`section`,{className:`geometry-mini-panel link-lengths-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(_e,{size:16,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`LINK LENGTHS`})]}),(0,Z.jsx)(`div`,{className:`link-length-list`,children:hl.map(e=>(0,Z.jsxs)(`label`,{className:`field-row output-readonly-row link-length-output-row`,children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:$(e.value),readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]},e.key))})]})]})]})})():null,Ue===`suspensionElements`?(()=>{let e=$o.toggleDisabled,t=(G.fields[`Antiroll CBar`]??`0`)!==`0`,n=(G.fields[`Antiroll TBar`]??`0`)!==`0`,r=n&&(G.fields[`Third Element`]??`0`)!==`0`,i=(G.fields[`Heave Spring`]??`0`)!==`0`,a=(G.fields[`Roll Spring`]??`0`)!==`0`,o=jB(G.fields[`CBar Mounting`]),s=NB(G.fields),c=o===`Rocker`?`Rocker Link`:`Wheel side link`,l=t&&!vH(G),u=G.fields.HSleftX??`0`,d=G.fields.HSleftY??`0`,f=G.fields.HSleftZ??`0`,p={x:u,y:aB(d),z:f},m=q.motion?.elements?.thirdElementArb??fs.rightFrame.elementState?.thirdElementArb??q.elements.thirdElementArb,h=r?HH(m,q.elements.thirdElementChassis):null,g=q.motion?.elements?.heaveLeft??fs.rightFrame.elementState?.heaveLeft??q.elements.heaveLeft,_=q.motion?.elements?.heaveRight??(fs.leftFrame.elementState?SU(fs.leftFrame.elementState.heaveLeft):void 0)??q.elements.heaveRight,v=i?HH(g,_):null,y=q.motion?.elements?.rollLeft??fs.rightFrame.elementState?.rollLeft??q.elements.rollLeft,b=q.motion?.elements?.rollRight??fs.leftFrame.elementState?.rollRight??q.elements.rollRight,x=a?HH(y,b):null,S=i?dU(q):null,C=a?pU(q):null,w=i?fU(q):null,T=a?mU(q):null;return(0,Z.jsxs)(`div`,{className:`tab-grid two suspension-elements-layout`,children:[(0,Z.jsxs)(`div`,{className:`control-column compact-panel suspension-elements-toggle-column`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(be,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Suspension Elements`})]}),(0,Z.jsx)(`div`,{className:`toggle-grid suspension-elements-toggle-row`,children:wz.map(t=>(0,Z.jsx)(qB,{document:G,field:t,disabled:!!e[t.key],onChange:eu},t.key))})]}),(0,Z.jsx)(`div`,{className:`control-column suspension-elements-config-column`,children:(0,Z.jsxs)(`div`,{className:`suspension-elements-panels-grid`,children:[(0,Z.jsxs)(`div`,{className:`compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(k,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`AntiRoll C-Bar`})]}),(0,Z.jsxs)(`div`,{className:`suspension-element-config-grid${t?``:` is-disabled`}`,children:[(0,Z.jsx)(KB,{label:`C-bar link mounting point`,value:o,options:[...HR],disabled:!t,optionDisabled:s,optionLabels:UR,onChange:e=>eu(`CBar Mounting`,e)}),(0,Z.jsxs)(`div`,{className:`element-point-grid`,children:[(0,Z.jsxs)(`div`,{className:`element-point-header`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`X`}),(0,Z.jsx)(`span`,{children:`Y`}),(0,Z.jsx)(`span`,{children:`Z`})]}),jz.map(e=>{let n=W.includes(e.id),r=e.id===`c-link`?c:e.label;return(0,Z.jsxs)(`div`,{className:`element-point-row${n?` selected`:``}`,children:[(0,Z.jsx)(`span`,{children:r}),e.keys.map(r=>{let i=e.id===`c-link`&&r===`CLinkX`&&l,a=i&&n;return(0,Z.jsx)(`input`,{className:[i?`element-point-input-readonly`:``,a?`element-point-input-static-readonly`:``,n&&!a?`selected`:``].filter(
4412Boolean).join(` `)||void 0,type:`text`,inputMode:`decimal`,value:G.fields[r]??`0`,disabled:!t,readOnly:i,"aria-readonly":i?`true`:void 0,onFocus:()=>Id(e.id,!1,!0),onClick:e=>e.stopPropagation(),onChange:e=>{i||eu(r,e.target.value)}},r)})]},`cbar-${e.id}`)})]})]})]}),(0,Z.jsxs)(`div`,{className:`compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(k,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`AntiRoll T-Bar`})]}),(0,Z.jsx)(`div`,{className:`suspension-element-config-grid${n?``:` is-disabled`}`,children:(0,Z.jsxs)(`div`,{className:`element-point-grid`,children:[(0,Z.jsxs)(`div`,{className:`element-point-header`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`X`}),(0,Z.jsx)(`span`,{children:`Y`}),(0,Z.jsx)(`span`,{children:`Z`})]}),Mz.map(e=>{let t=W.includes(e.id);return(0,Z.jsxs)(`div`,{className:`element-point-row${t?` selected`:``}`,children:[(0,Z.jsx)(`span`,{children:e.label}),e.keys.map(e=>{let r=Rz(e),i=[r?`element-point-input-readonly`:``,t?`selected`:``].filter(Boolean).join(` `);return(0,Z.jsx)(`input`,{type:r?`text`:`number`,step:r?void 0:`0.1`,inputMode:r?void 0:`decimal`,value:r?`0`:G.fields[e]??`0`,disabled:!n,readOnly:r,"aria-readonly":r?`true`:void 0,className:i||void 0,onChange:t=>{r||eu(e,t.target.value)}},e)})]},`tbar-${e.id}`)})]})})]}),(0,Z.jsxs)(`div`,{className:`compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(k,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Third Element`})]}),(0,Z.jsx)(`div`,{className:`suspension-element-config-grid${r?``:` is-disabled`}`,children:(0,Z.jsxs)(`div`,{className:`element-point-grid`,children:[(0,Z.jsxs)(`div`,{className:`element-point-header`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`X`}),(0,Z.jsx)(`span`,{children:`Y`}),(0,Z.jsx)(`span`,{children:`Z`})]}),Nz.map(e=>{let t=W.includes(e.id);return(0,Z.jsxs)(`div`,{className:`element-point-row${t?` selected`:``}`,children:[(0,Z.jsx)(`span`,{children:e.label}),e.keys.map(e=>{let n=Rz(e),i=[n?`element-point-input-readonly`:``,t?`selected`:``].filter(Boolean).join(` `);return(0,Z.jsx)(`input`,{type:n?`text`:`number`,step:n?void 0:`0.1`,inputMode:n?void 0:`decimal`,value:n?`0`:G.fields[e]??`0`,disabled:!r,readOnly:n,"aria-readonly":n?`true`:void 0,className:i||void 0,onChange:t=>{n||eu(e,t.target.value)}},e)})]},`third-${e.id}`)}),(0,Z.jsxs)(`div`,{className:`element-point-row element-angle-row`,children:[(0,Z.jsx)(`span`,{children:`Third element length`}),(0,Z.jsxs)(`span`,{className:`element-angle-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:h===null?`-`:$(h),disabled:!r,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]})]})})]}),(0,Z.jsxs)(`div`,{className:`compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(k,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Heave Spring`})]}),(0,Z.jsx)(`div`,{className:`suspension-element-config-grid${i?``:` is-disabled`}`,children:(0,Z.jsxs)(`div`,{className:`element-point-grid`,children:[(0,Z.jsxs)(`div`,{className:`element-point-header`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`X`}),(0,Z.jsx)(`span`,{children:`Y`}),(0,Z.jsx)(`span`,{children:`Z`})]}),Pz.map((e,t)=>{let n=W.includes(e.id);return(0,Z.jsxs)(`div`,{className:`element-point-row${n?` selected`:``}`,children:[(0,Z.jsx)(`span`,{children:e.label}),e.keys.map((e,r)=>{let a=t===1,o=a?r===0?p.x:r===1?p.y:p.z:G.fields[e]??`0`;return(0,Z.jsx)(`input`,{className:[n?`selected`:``].filter(Boolean).join(` `)||void 0,type:`text`,inputMode:`decimal`,value:o,disabled:!i,readOnly:a,"aria-readonly":a?`true`:void 0,onChange:t=>au(e,t.target.value)},e)})]},`heave-${e.id}`)}),(0,Z.jsxs)(`div`,{className:`element-point-row element-angle-row`,children:[(0,Z.jsx)(`span`,{children:`Heave spring length`}),(0,Z.jsxs)(`span`,{className:`element-angle-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:v===null?`-`:$(v),disabled:!i,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]}),(0,Z.jsxs)(`div`,{className:`element-point-row element-angle-row`,children:[(0,Z.jsx)(`span`,{children:`3D angle - Heave spring to rocker`}),(0,Z.jsxs)(`span`,{className:`element-angle-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:S===null?`-`:$(S),disabled:!i,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`deg`})]})]}),(0,Z.jsxs)(`div`,{className:`element-point-row element-angle-row`,children:[(0,Z.jsx)(`span`,{children:`Heave spring moment arm`}),(0,Z.jsxs)(`span`,{className:`element-angle-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:w===null?`-`:$(w),disabled:!i,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]})]})})]}),(0,Z.jsxs)(`div`,{className:`compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(k,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Roll Spring`})]}),(0,Z.jsx)(`div`,{className:`suspension-element-config-grid${a?``:` is-disabled`}`,children:(0,Z.jsxs)(`div`,{className:`element-point-grid`,children:[(0,Z.jsxs)(`div`,{className:`element-point-header`,children:[(0,Z.jsx)(`span`,{}),(0,Z.jsx)(`span`,{children:`X`}),(0,Z.jsx)(`span`,{children:`Y`}),(0,Z.jsx)(`span`,{children:`Z`})]}),Fz.map((e,t)=>{let n=W.includes(e.id);return(0,Z.jsxs)(`div`,{className:`element-point-row${n?` selected`:``}`,children:[(0,Z.jsx)(`span`,{children:e.label}),e.keys.map(e=>{let r=t===1;
4412return(0,Z.jsx)(`input`,{className:[n?`selected`:``].filter(Boolean).join(` `)||void 0,type:`text`,inputMode:`decimal`,value:G.fields[e]??`0`,disabled:!a,readOnly:r,"aria-readonly":r?`true`:void 0,onChange:t=>{r||eu(e,t.target.value)}},e)})]},`roll-${e.id}`)}),(0,Z.jsxs)(`div`,{className:`element-point-row element-angle-row`,children:[(0,Z.jsx)(`span`,{children:`Roll spring length`}),(0,Z.jsxs)(`span`,{className:`element-angle-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:x===null?`-`:$(x),disabled:!a,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]}),(0,Z.jsxs)(`div`,{className:`element-point-row element-angle-row`,children:[(0,Z.jsx)(`span`,{children:`3D angle - Roll spring to Left rocker`}),(0,Z.jsxs)(`span`,{className:`element-angle-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:C===null?`-`:$(C),disabled:!a,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`deg`})]})]}),(0,Z.jsxs)(`div`,{className:`element-point-row element-angle-row`,children:[(0,Z.jsx)(`span`,{children:`Roll spring moment arm`}),(0,Z.jsxs)(`span`,{className:`element-angle-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:T===null?`-`:$(T),disabled:!a,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]})]})})]})]})})]})})():null,Ue===`steeringSettings`?(()=>{let e=rB(G),t=Kz(G.fields[`Steering Model`]),n=.1,r=y_(G,0,n,{useSteeringModel:!0}),i=y_(G,0,-n,{useSteeringModel:!0}),a=r.converged&&i.converged?Dg(G,r.outputs.toe,i.outputs.toe,n):null,o=a!==null&&Number.isFinite(a.roadWheelDifference)&&a.roadWheelDifference<-1e-4,s=[{key:`C Factor`,label:`Rack&Pinion C-factor`,unit:`mm/360deg`},{key:`Y Pinion`,label:`Pinion lateral offset Y`,unit:`mm`},{key:`L Pinion`,label:`Pinion shaft length`,unit:`mm`},{key:`Pinion Angle`,label:`Pinion Offset angle, front view`,unit:`deg`},{key:`Rack Angle`,label:`Pinion Layback angle, side view`,unit:`deg`},{key:`Steering Wheel Diameter`,label:`Steering Wheel diameter`,unit:`mm`}],c=[{key:`alpha2`,label:`Alfa 1 (lower, Pinion side)`,value:iB(e.alpha1Deg),unit:`deg`},{key:`alpha1`,label:`Alfa 2 (upper, SW side)`,value:iB(e.alpha2Deg),unit:`deg`},{key:`shaft`,label:`Steering Wheel axis inclination`,value:iB(e.steeringShaftAngleDeg),unit:`deg`},{key:`l12`,label:`Shaft length 1 (intermediate)`,value:iB(e.link12Mm),unit:`mm`},{key:`l2sw`,label:`Shaft length 2 (SW side)`,value:iB(e.link2SwMm),unit:`mm`}],l=W.includes(`steering-wheel`),u=W.includes(`joint-2`);return(0,Z.jsx)(`div`,{className:`tab-grid two steering-settings-layout`,children:(0,Z.jsxs)(`div`,{className:`control-column compact-panel steering-settings-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(pz,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Steering Settings`})]}),(0,Z.jsxs)(`div`,{className:`steering-settings-content`,children:[(0,Z.jsx)(`div`,{className:`steering-settings-left`,children:s.map(e=>(0,Z.jsxs)(`label`,{className:`field-row steering-field-row${e.key===`C Factor`?` steering-field-row-cfactor`:``}`,children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:G.fields[e.key]??``,onChange:t=>eu(e.key,t.target.value)}),(0,Z.jsx)(`small`,{children:e.unit})]})]},e.key))}),(0,Z.jsxs)(`div`,{className:`steering-secondary-column`,children:[(0,Z.jsxs)(`fieldset`,{className:`steering-pinion-box`,children:[(0,Z.jsx)(`legend`,{children:`Pinion Position relative to Rack`}),(0,Z.jsxs)(`div`,{className:`steering-pinion-radios`,children:[(0,Z.jsxs)(`label`,{className:`steering-radio`,children:[(0,Z.jsx)(`input`,{type:`radio`,name:`steering-pinion-position`,checked:e.pinionPosition===`Front`,onChange:()=>eu(`Pinion Position`,`Front`)}),(0,Z.jsx)(`span`,{children:`Front`})]}),(0,Z.jsxs)(`label`,{className:`steering-radio`,children:[(0,Z.jsx)(`input`,{type:`radio`,name:`steering-pinion-position`,checked:e.pinionPosition===`Rear`,onChange:()=>eu(`Pinion Position`,`Rear`)}),(0,Z.jsx)(`span`,{children:`Rear`})]})]}),(0,Z.jsxs)(`label`,{className:`field-row steering-field-row`,children:[(0,Z.jsx)(`span`,{children:`Pinion to rack axis offset`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:G.fields[`Pinion Offset`]??``,onChange:e=>eu(`Pinion Offset`,e.target.value)}),(0,Z.jsx)(`small`,{children:`mm`})]})]})]}),(0,Z.jsxs)(`fieldset`,{className:`steering-model-box`,children:[(0,Z.jsx)(`legend`,{children:`Steering Model`}),(0,Z.jsxs)(`label`,{className:`steering-radio`,children:[(0,Z.jsx)(`input`,{type:`radio`,name:`steering-model`,checked:t===`Costant Spring`,onChange:()=>eu(`Steering Model`,`Costant Spring`)}),(0,Z.jsx)(`span`,{children:`Constant Spring Length`})]}),(0,Z.jsxs)(`label`,{className:`steering-radio`,children:[(0,Z.jsx)(`input`,{type:`radio`,name:`steering-model`,checked:t===`Costant Z`,onChange:()=>eu(`Steering Model`,`Costant Z`)}),(0,Z.jsx)(`span`,{children:`Constant Tyre Patch Z`})]})]}),o?(0,Z.jsxs)(`div`,{className:`setup-warning setup-warning-multiline suspension-settings-warning`,role:`alert`,children:[(0,Z.jsx)(`span`,{children:`Warning: steering wheel and road wheel directions are opposite.`}),(0,Z.jsx)(`span`,{children:`Turning the steering wheel left will steer the road wheels right, and vice versa.`})]}):null]}),(0,Z.jsxs)(`div`,{className:`steering-settings-coordinates`,children:[(0,Z.jsxs)(`div`,{className:`steering-coordinate-head`,children:[(0,Z.jsx)(`span`,{}),dz.map(e=>(0,Z.jsx)(`span`,{children:e},`head-${e}`))]}),(0,Z.jsxs)(`div`,{className:`steering-coordinate-row`,children:[(0,Z.jsx)(`span`,{children:`Pinion position`}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(`input`,{type:`text`,className:`steering-coordinate-readonly-left`,value:iB(e.pinionPoint.x),readOnly:!0,"aria-readonly":`true`})}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(`input`,{type:`text`,className:`steering-coordinate-readonly-left`,value:iB(e.pinionPoint.y),readOnly:!0,"aria-readonly":`true`})}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(`input`,{type:`text`,className:`steering-coordinate-readonly-left`,value:iB(e.pinionPoint.z),readOnly:!0,"aria-readonly":`true`})})]}),(0,Z.jsxs)(`div`,{className:`steering-coordinate-row`,children:[(0,Z.jsx)(`span`,{children:`U-Joint 1 (lower, Pinion side)`}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(`input`,{type:`text`,className:`steering-coordinate-readonly-left`,value:iB(e.j
4412oint1Point.x),readOnly:!0,"aria-readonly":`true`})}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(`input`,{type:`text`,className:`steering-coordinate-readonly-left`,value:iB(e.joint1Point.y),readOnly:!0,"aria-readonly":`true`})}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(`input`,{type:`text`,className:`steering-coordinate-readonly-left`,value:iB(e.joint1Point.z),readOnly:!0,"aria-readonly":`true`})})]}),(0,Z.jsxs)(`div`,{className:`steering-coordinate-row${u?` selected`:``}`,onClick:e=>Id(`joint-2`,e.ctrlKey||e.metaKey),children:[(0,Z.jsx)(`span`,{children:`U-joint 2 (upper, SW side)`}),(0,Z.jsx)(`span`,{className:`field-input${u?` selected`:``}`,children:(0,Z.jsx)(`input`,{className:u?`selected`:void 0,type:`text`,inputMode:`decimal`,value:G.fields[`Joint2 X`]??``,onChange:e=>eu(`Joint2 X`,e.target.value),onFocus:()=>Id(`joint-2`,!1,!0),onClick:e=>e.stopPropagation()})}),(0,Z.jsx)(`span`,{className:`field-input${u?` selected`:``}`,children:(0,Z.jsx)(`input`,{className:u?`selected`:void 0,type:`text`,inputMode:`decimal`,value:G.fields[`Joint2 Y`]??``,onChange:e=>eu(`Joint2 Y`,e.target.value),onFocus:()=>Id(`joint-2`,!1,!0),onClick:e=>e.stopPropagation()})}),(0,Z.jsx)(`span`,{className:`field-input${u?` selected`:``}`,children:(0,Z.jsx)(`input`,{className:u?`selected`:void 0,type:`text`,inputMode:`decimal`,value:G.fields[`Joint2 Z`]??``,onChange:e=>eu(`Joint2 Z`,e.target.value),onFocus:()=>Id(`joint-2`,!1,!0),onClick:e=>e.stopPropagation()})})]}),(0,Z.jsxs)(`div`,{className:`steering-coordinate-row${l?` selected`:``}`,onClick:e=>Id(`steering-wheel`,e.ctrlKey||e.metaKey),children:[(0,Z.jsx)(`span`,{children:`Steering Wheel centre`}),(0,Z.jsx)(`span`,{className:`field-input${l?` selected`:``}`,children:(0,Z.jsx)(`input`,{className:l?`selected`:void 0,type:`text`,inputMode:`decimal`,value:G.fields[`Steering Wheel Position X`]??``,onChange:e=>eu(`Steering Wheel Position X`,e.target.value),onFocus:()=>Id(`steering-wheel`,!1,!0),onClick:e=>e.stopPropagation()})}),(0,Z.jsx)(`span`,{className:`field-input${l?` selected`:``}`,children:(0,Z.jsx)(`input`,{className:l?`selected`:void 0,type:`text`,inputMode:`decimal`,value:G.fields[`Steering Wheel Position Y`]??``,onChange:e=>eu(`Steering Wheel Position Y`,e.target.value),onFocus:()=>Id(`steering-wheel`,!1,!0),onClick:e=>e.stopPropagation()})}),(0,Z.jsx)(`span`,{className:`field-input${l?` selected`:``}`,children:(0,Z.jsx)(`input`,{className:l?`selected`:void 0,type:`text`,inputMode:`decimal`,value:G.fields[`Steering Wheel Position Z`]??``,onChange:e=>eu(`Steering Wheel Position Z`,e.target.value),onFocus:()=>Id(`steering-wheel`,!1,!0),onClick:e=>e.stopPropagation()})})]}),(0,Z.jsxs)(`label`,{className:`field-row steering-field-row`,children:[(0,Z.jsx)(`span`,{children:`U-joint 2 index angle`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:G.fields[`U-joint 2 index angle`]??``,onChange:e=>eu(`U-joint 2 index angle`,e.target.value)}),(0,Z.jsx)(`small`,{children:`deg`})]})]}),(0,Z.jsxs)(`label`,{className:`field-row steering-field-row`,children:[(0,Z.jsx)(`span`,{children:`U-Joint phase angle (relative rotation)`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:G.fields[`Gamma Angle`]??``,onChange:e=>eu(`Gamma Angle`,e.target.value)}),(0,Z.jsx)(`small`,{children:`deg`})]})]})]}),(0,Z.jsxs)(`div`,{className:`steering-settings-right`,children:[c.map(e=>(0,Z.jsxs)(`label`,{className:`field-row steering-field-row`,children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:e.value,readOnly:!e.editable,"aria-readonly":!e.editable,onChange:e.editable?t=>eu(e.key,t.target.value):void 0}),(0,Z.jsx)(`small`,{children:e.unit})]})]},e.key)),(0,Z.jsx)(`div`,{className:`steering-optimize-row`,children:(0,Z.jsx)(`button`,{type:`button`,className:`steering-optimize-button`,onClick:pu,disabled:pt,children:pt?`Optimizing...`:`Reduce Non-Uniformity`})})]})]})]})})})():null,Ue===`run`?(()=>{let e=xB(G.fields[`Calculate Bump`]),t=xB(G.fields[`Calculate Roll`]),n=xB(G.fields[`Calculate Steer`]),r=xB(G.fields[`Calculate BumpSteer`]),i=xB(G.fields[`Calculate Steering Column`]);Jz(G.fields[`N of Steps Bump`]);let a=_f(Jz(G.fields[`N of Steps Steer`])??10)*2,o=(e,t)=>{let n=Yz(t);n!==(G.fields[e]??``)&&eu(e,n)},s=xt?Tf(xt.bumpMax):``,c=xt?Tf(xt.reboundMax):``,l=xt?Tf(xt.steerMax):``,u=UU(G.fields[`Bump Max`],xt?.bumpMax??null),d=UU(G.fields[`Rebound Max`],xt?.reboundMax??null),f=UU(G.fields[`Steering Wheel Angle Max`],xt?.steerMax??null),p=xt?.outputMessage??`Press Verify limits to check convergence and limiting links in bump, rebound, and steer.`;return(0,Z.jsxs)(`div`,{className:`tab-grid four run-parameters-gri
4412d`,children:[(0,Z.jsxs)(`div`,{className:`control-column compact-panel run-parameter-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(b,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Bump / Roll`})]}),(0,Z.jsxs)(`div`,{className:`run-check-pair`,children:[(0,Z.jsxs)(`label`,{className:`run-check`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>eu(`Calculate Bump`,e.target.checked?`1`:`0`)}),(0,Z.jsx)(`span`,{children:`Calculate Bump`})]}),(0,Z.jsxs)(`label`,{className:`run-check${e?``:` is-disabled`}`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e,onChange:e=>eu(`Calculate Roll`,e.target.checked?`1`:`0`)}),(0,Z.jsx)(`span`,{children:`Calculate Roll`})]})]}),(0,Z.jsxs)(`div`,{className:`run-field-grid`,children:[(0,Z.jsxs)(`div`,{className:`field-row run-field-row run-field-row-with-indicator`,children:[(0,Z.jsx)(`span`,{className:`run-field-label`,children:`Bump`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(Xz,{value:G.fields[`Bump Max`]??``,onCommit:e=>eu(`Bump Max`,$(e))}),(0,Z.jsx)(`small`,{children:`mm`})]}),(0,Z.jsx)(`span`,{className:`run-limit-indicator${u===`ok`?` is-ok`:``}${u===`fail`?` is-fail`:``}${u===`unknown`?` is-idle`:``}`,title:u===`ok`?`Value within the verified limit`:u===`fail`?`Value above the verified limit`:`Limits not verified yet`,"aria-hidden":`true`,children:u===`ok`?(0,Z.jsx)(E,{size:11}):u===`fail`?(0,Z.jsx)(Oe,{size:11}):(0,Z.jsx)(k,{size:10})})]}),(0,Z.jsxs)(`div`,{className:`field-row run-field-row run-field-row-with-indicator`,children:[(0,Z.jsx)(`span`,{className:`run-field-label`,children:`Rebound`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(Xz,{value:G.fields[`Rebound Max`]??``,onCommit:e=>eu(`Rebound Max`,$(e))}),(0,Z.jsx)(`small`,{children:`mm`})]}),(0,Z.jsx)(`span`,{className:`run-limit-indicator${d===`ok`?` is-ok`:``}${d===`fail`?` is-fail`:``}${d===`unknown`?` is-idle`:``}`,title:d===`ok`?`Value within the verified limit`:d===`fail`?`Value above the verified limit`:`Limits not verified yet`,"aria-hidden":`true`,children:d===`ok`?(0,Z.jsx)(E,{size:11}):d===`fail`?(0,Z.jsx)(Oe,{size:11}):(0,Z.jsx)(k,{size:10})})]}),(0,Z.jsxs)(`div`,{className:`field-row run-field-row run-field-row-with-indicator`,children:[(0,Z.jsx)(`span`,{className:`run-field-label`,children:`N of Steps`}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(Xz,{inputMode:`numeric`,value:G.fields[`N of Steps Bump`]??``,onCommit:e=>o(`N of Steps Bump`,String(e))})}),(0,Z.jsx)(`span`,{className:`run-limit-indicator run-limit-indicator-placeholder`,"aria-hidden":`true`})]})]})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel run-parameter-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(pz,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Steer`})]}),(0,Z.jsxs)(`label`,{className:`run-check run-check-single`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>eu(`Calculate Steer`,e.target.checked?`1`:`0`)}),(0,Z.jsx)(`span`,{children:`Calculate Steer`})]}),(0,Z.jsxs)(`div`,{className:`run-field-grid`,children:[(0,Z.jsxs)(`div`,{className:`field-row run-field-row run-field-row-with-indicator`,children:[(0,Z.jsx)(`span`,{className:`run-field-label`,children:`Steering Wheel Max Angle`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(Xz,{value:G.fields[`Steering Wheel Angle Max`]??``,onCommit:e=>eu(`Steering Wheel Angle Max`,$(e))}),(0,Z.jsx)(`small`,{children:`deg`})]}),(0,Z.jsx)(`span`,{className:`run-limit-indicator${f===`ok`?` is-ok`:``}${f===`fail`?` is-fail`:``}${f===`unknown`?` is-idle`:``}`,title:f===`ok`?`Value within the verified limit`:f===`fail`?`Value above the verified limit`:`Limits not verified yet`,"aria-hidden":`true`,children:f===`ok`?(0,Z.jsx)(E,{size:11}):f===`fail`?(0,Z.jsx)(Oe,{size:11}):(0,Z.jsx)(k,{size:10})})]}),(0,Z.jsxs)(`div`,{className:`field-row run-field-row run-field-row-with-indicator`,children:[(0,Z.jsx)(`span`,{className:`run-field-label`,children:`N of Steps`}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(Xz,{inputMode:`numeric`,value:G.fields[`N of Steps Steer`]??``,onCommit:e=>o(`N of Steps Steer`,String(e))})}),(0,Z.jsx)(`span`,{className:`run-limit-indicator run-limit-indicator-placeholder`,"aria-hidden":`true`})]})]}),(0,Z.jsxs)(`label`,{className:`run-check run-check-single run-check-steering-column`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>eu(`Calculate Steering Column`,e.target.checked?`1`:`0`)}),(0,Z.jsx)(`span`,{children:`Calculate Steering Column Kinematics (${a} steps)`})]})]}),(0,Z.jsx)(`div`,{className:`control-column run-bumpsteer-column`,children:(0,Z.jsxs)(`div`,{className:`control-column compact-panel run-parameter-panel${e?``:` is-disabled`}`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(pz,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`BumpSteer`})]}),(0,Z.jsxs)(`label`,{className:`run-check run-check-single`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:r,disabled:!e,onChange:e=>eu(`Calculate BumpSteer`,e.target.checked?`1`:`0`)}),(0,Z.jsx)(`span`,{children:`Calculate BumpSteer`})]}),(0,Z.jsx)(`div`,{className:`run-field-grid`,children:(0,Z.jsxs)(`label`,{className:`field-row run-field-row`,children:[(0,Z.jsx)(`span`,{children:`Steering Wheel Angle`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(Xz,{value:G.fields[`BumpSteer Angle`]??``,disabled:!e,onCommit:e=>eu(`BumpSteer Angle`,$(e))}),(0,Z.jsx)(`small`,{children:`deg`})]})]})})]})}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel run-parameter-panel run-verify-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(z,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Verify Kinematic Limits`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`run-button verify-limits-button`,onClick:sf,children:[(0,Z.jsx)(w,{size:16,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Verify limits`})]}),(0,Z.jsxs)(`div`,{className:`run-field-grid`,children:[(0,Z.jsxs)(`label`,{className:`field-row run-field-row output-readonly-row`,children:[(0,Z.jsx)(`span`,{children:`Max bump`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:s,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]}),(0,Z.jsxs)(`label`,{className:`field-row run-field-row output-readonly-row`,children:[(0,Z.jsx)(`span`,{children:`Max rebound`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:c,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]}),(0,Z.jsxs)(`label`,{className:`field-row run-field-row output-readonly-row`,children:[(0,Z.jsx)(`span`,{children:`Max steer`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:l,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`deg`})]})]})]}),(0,Z.jsxs)(`div`,{className:`run-verify-output`,children:[(0,Z.jsx)(`div`,{className:`run-verify-output-title`,children:`Output`}),(0,Z.jsx)(`p`,{children:p})]})]})]})})():null,Ue===`loadCase`&&Ks?(0,Z.jsx)(XB,{document:G,result:Ks,onChange:eu,onClearWheelLoads:()=>iu(kz,`0`),onClearCoupledLoads:()=>iu(Az,`0`)}
4412):null,Ue===`graphics`?(()=>{let e=Uz(G.fields,rs,$o);return(0,Z.jsxs)(`div`,{className:`tab-grid three graphics-settings-grid`,children:[(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(be,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Graphic Settings`})]}),(0,Z.jsxs)(`div`,{className:`field-grid graphics-field-stack`,children:[hz.map(e=>(0,Z.jsx)(GB,{document:G,field:e,onChange:eu},e.key)),(0,Z.jsxs)(`label`,{className:`motion-slider wheel-opacity-control`,children:[(0,Z.jsxs)(`span`,{children:[`Wheel opacity`,(0,Z.jsxs)(`strong`,{children:[Math.max(0,Math.min(100,Math.round(G.graphics.wheelOpacityPercent))),`%`]})]}),(0,Z.jsx)(`input`,{type:`range`,min:`0`,max:`100`,step:`1`,value:Math.max(0,Math.min(100,Math.round(G.graphics.wheelOpacityPercent))),onChange:e=>eu(MI,e.target.value)})]})]})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(ye,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Display toggles - components`}),(0,Z.jsx)(`button`,{type:`button`,className:`section-title-action`,onClick:ou,children:`Toggle all`})]}),(0,Z.jsxs)(`div`,{className:`toggle-grid graphics-toggle-grid`,children:[(0,Z.jsxs)(`label`,{className:`toggle-row`,children:[(0,Z.jsx)(`span`,{children:`Hardpoints`}),(0,Z.jsx)(`input`,{type:`checkbox`,checked:Re,onChange:e=>ze(e.target.checked)})]}),gz.map(t=>(0,Z.jsx)(qB,{document:G,field:t,disabled:!!e[t.key]||j&&t.key===`Draw Opposite Axle`,onChange:eu},t.key))]})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(ye,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Display toggles - virtual features`}),(0,Z.jsx)(`button`,{type:`button`,className:`section-title-action`,onClick:cu,children:`Toggle all`})]}),(0,Z.jsxs)(`div`,{className:`toggle-grid graphics-toggle-grid graphics-virtual-toggle-grid`,children:[_z.map(e=>(0,Z.jsx)(qB,{document:G,field:e,disabled:e.key===`Tyre profile`&&!is,onChange:eu},e.key)),(0,Z.jsxs)(`div`,{className:`graphics-ghost-toggle-group`,children:[(0,Z.jsx)(qB,{document:G,field:vz,disabled:v,onChange:eu}),(0,Z.jsxs)(`label`,{className:`toggle-row`,children:[(0,Z.jsx)(`span`,{children:`Ghost reference`}),(0,Z.jsx)(`input`,{type:`checkbox`,checked:!!Xr&&Qr,disabled:!Xr||j,onChange:e=>$r(e.target.checked)})]})]})]})]})]})})():null,Ue===`stepGeometry`?(0,Z.jsxs)(`div`,{className:`tab-grid two step-geometry-tab-grid`,children:[(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title step-geometry-panel-title`,children:[(0,Z.jsx)(C,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Imported STEP Meshes`}),(0,Z.jsx)(`span`,{className:`step-geometry-count`,children:Ht.length}),(0,Z.jsxs)(`div`,{className:`step-geometry-title-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`section-title-action step-import-action`,onClick:()=>void Mu(),children:[(0,Z.jsx)(ge,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Import STEP`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`section-title-action step-example-action`,"data-ui-tooltip":`L
4412oads the bundled F1 full vehicle STEP example.`,onClick:()=>void Nu(),children:(0,Z.jsx)(`span`,{children:`Example STEP`})}),(0,Z.jsxs)(`button`,{type:`button`,className:`section-title-action step-export-action`,onClick:()=>void dd(),disabled:Ht.length===0,children:[(0,Z.jsx)(re,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Export STEP`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`section-title-action`,onClick:rd,disabled:Ht.length===0,children:`Toggle all`})]})]}),(0,Z.jsx)(`div`,{className:`step-geometry-list`,children:Ht.length===0?(0,Z.jsx)(`div`,{className:`step-geometry-empty`,children:`No imported STEP geometry.`}):Ht.map(e=>(0,Z.jsxs)(`div`,{className:`step-geometry-item-row`,children:[(0,Z.jsx)(`span`,{className:`step-geometry-color-swatch`,style:{backgroundColor:e.colorHex,opacity:wV(e.opacityPercent)/100},"aria-hidden":`true`}),(0,Z.jsx)(`button`,{type:`button`,className:`step-geometry-item${Jt===e.id?` selected`:``}`,onClick:()=>Yt(e.id),children:e.name}),(0,Z.jsxs)(`label`,{className:`step-geometry-visibility-toggle`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:e.visible!==!1,onChange:t=>nd(e.id,t.target.checked)}),(0,Z.jsx)(`span`,{children:`Show`})]})]},e.id))}),(0,Z.jsxs)(`div`,{className:`step-selected-appearance`,children:[(0,Z.jsxs)(`label`,{className:`field-row step-color-row`,children:[(0,Z.jsx)(`span`,{children:`Selected color`}),(0,Z.jsx)(`span`,{className:`field-input`,children:(0,Z.jsx)(`input`,{type:`color`,value:J?J.colorHex:`#7dd3fc`,onChange:e=>td(e.target.value),disabled:!J})})]}),(0,Z.jsxs)(`label`,{className:`step-opacity-control`,children:[(0,Z.jsxs)(`span`,{children:[`Surface opacity`,(0,Z.jsxs)(`strong`,{children:[J?wV(J.opacityPercent):QF,`%`]})]}),(0,Z.jsx)(`input`,{type:`range`,min:`0`,max:`100`,step:`1`,value:J?wV(J.opacityPercent):QF,onChange:e=>Gu(e.target.value),disabled:!J})]})]}),(0,Z.jsxs)(`div`,{className:`step-geometry-bottom-row`,children:[(0,Z.jsxs)(`label`,{className:`step-geometry-visibility-toggle step-clash-toggle`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:Qt,onChange:e=>Md(e.target.checked),disabled:!zc}),(0,Z.jsx)(`span`,{children:`Mesh clash detection`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`step-geometry-remove-button`,onClick:ed,disabled:!J,children:[(0,Z.jsx)(we,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Remove selected`})]})]})]}),(0,Z.jsxs)(`div`,{className:`control-column compact-panel`,children:[(0,Z.jsxs)(`div`,{className:`section-title`,children:[(0,Z.jsx)(be,{size:17,"aria-hidden":`true`}),(0,Z.jsx)(`h2`,{children:`Transform selected STEP mesh`})]}),(0,Z.jsx)(`div`,{className:`step-transform-grid`,children:(0,Z.jsxs)(`div`,{className:`step-transform-columns`,children:[(0,Z.jsxs)(`div`,{className:`step-transform-section step-transform-section-scale`,children:[(0,Z.jsx)(`strong`,{children:`Scale`}),(0,Z.jsxs)(`div`,{className:`step-transform-list`,children:[(0,Z.jsxs)(`label`,{className:`step-transform-field`,children:[(0,Z.jsx)(`span`,{children:`Overall`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:J?sn.overall:`1`,onChange:e=>Hu(`overall`,e.target.value),onBlur:()=>Uu(`overall`),onKeyDown:e=>Wu(`overall`,e),onFocus:Xu,disabled:!J}),(0,Z.jsx)(`small`,{children:`x`})]})]}),(0,Z.jsxs)(`label`,{className:`step-transform-field`,children:[(0,Z.jsx)(`span`,{children:`Scale Y`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:J?sn.y:`1`,onChange:e=>Hu(`y`,e.target.value),onBlur:()=>Uu(`y`),onKeyDown:e=>Wu(`y`,e),onFocus:Xu,disabled:!J}),(0,Z.jsx)(`small`,{children:`x`})]})]}),(0,Z.jsxs)(`label`,{className:`step-transform-field`,children:[(0,Z.jsx)(`span`,{children:`Scale Z`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:J?sn.z:`1`,onChange:e=>Hu(`z`,e.target.value),onBlur:()=>Uu(`z`),onKeyDown:e=>Wu(`z`,e),onFocus:Xu,disabled:!J}),(0,Z.jsx)(`small`,{children:`x`})]})]}),(0,Z.jsx)(`div`,{className:`step-transform-z-reference-label`,children:`Z reference plane`})]})]}),(0,Z.jsxs)(`div`,{className:`step-transform-section`,children:[(0,Z.jsx)(`strong`,{children:`Current dimensions`}),(0,Z.jsxs)(`div`,{className:`step-transform-list`,children:[[`x`,`y`,`z`].map(e=>(0,Z.jsxs)(`label`,{className:`step-transform-field output-readonly-row`,children:[(0,Z.jsx)(`span`,{children:e.toUpperCase()}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:J?$(Bc[e]):``,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]},`step-d-${e}`)),(0,Z.jsxs)(`label`,{className:`step-transform-field output-readonly-row`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,value:J?$(Vc):``,readOnly:!0,"aria-readonly":`true`}),(0,Z.jsx)(`small`,{children:`mm`})]})]})]})]}),(0,Z.jsxs)(`div`,{className:`step-transform-section step-transform-section-action`,children:[(0,Z.jsx)(`strong`,{children:`Rotation`}),(0,Z.jsxs)(`div`,{className:`step-transform-list`,children:[[`x`,`y`,`z`].map(e=>(0,Z.jsxs)(`label`,{className:`step-transform-field`,children:[(0,Z.jsx)(`span`,{children:`R${e.toUpperCase()}`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(Xz,{value:J?$(J.transform.rotateDeg[e]):`0`,inputMode:`decimal`,onCommit:t=>Zu(e,String(t)),disabled:!J}),(0,Z.jsx)(`small`,{children:`deg`})]})]},`step-r-${e}`)),(0,Z.jsx)(`div`,{className:`step-transform-action-slot`,children:(0,Z.jsx)(`button`,{type:`button`,className:`step-transform-action-button step-identify-rotation-button`,onClick:Qu,disabled:!J,children:`Identify body rotation`})})]})]}),(0,Z.jsxs)(`div`,{className:`step-transform-section step-transform-section-action step-transform-section-translation`,children:[(0,Z.jsx)(`strong`,{children:`Translation`}),(0,Z.jsxs)(`div`,{className:`step-transform-list`,children:[[`x`,`y`,`z`].map(e=>(0,Z.jsxs)(`label`,{className:`step-transform-field`,children:[(0,Z.jsx)(`span`,{children:`T${e.toUpperCase()}`}),(0,Z.jsxs)(`span`,{className:`field-input`,children:[(0,Z.jsx)(`input`,{type:`text`,inputMode:`text`,"data-numeric-input":`true`,value:J?ln[e]:`0`,onCh
4412ange:t=>qu(e,t.target.value),onBlur:()=>Ju(e),onKeyDown:t=>Yu(e,t),onFocus:Xu,disabled:!J}),(0,Z.jsx)(`small`,{children:`mm`})]})]},`step-t-${e}`)),(0,Z.jsx)(`div`,{className:`step-transform-action-slot step-transform-reset-slot`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`step-transform-action-button`,onClick:$u,disabled:!J,children:[(0,Z.jsx)(R,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Reset transform`})]})})]})]})]})})]})]}):null,Ue===`log`?(0,Z.jsx)(`div`,{className:`tab-grid two`,children:(0,Z.jsx)(aq,{frame:fs.rightFrame,viewportLogEntries:gr})}):null]})}),gp()]}),vp=()=>(0,Z.jsx)(`section`,{className:`control-deck control-deck-docked-placeholder`,"aria-label":`Detached control deck placeholder`,children:(0,Z.jsxs)(`div`,{className:`control-deck-docked-pill`,children:[(0,Z.jsx)(`strong`,{children:`Control deck detached`}),(0,Z.jsx)(`span`,{children:`Press F6 to restore it here.`})]})}),yp=Xa&&Qa>0&&zi.current?(0,ke.createPortal)(_p(!0),zi.current):null,bp=Xa&&Qa>0?zi.current?.parentElement??Ri.current?.document.body??null:null,xp=e=>e&&bp?(0,ke.createPortal)(e,bp):e,Sp=di.current?.ownerDocument.getElementById(`control-deck-window-root`)??di.current?.ownerDocument.body??window.document.body;return(0,Z.jsxs)(`div`,{className:`app theme-${Bo}${v?` app-setup-mode`:x?` app-rocker-mode`:j?` app-full-vehicle-mode`:zr?` app-optimization-mode`:``}`,onDragOver:Tu,onDrop:Eu,children:[(0,Z.jsxs)(`header`,{className:`topbar${v?` topbar-setup-mode`:x?` topbar-rocker-mode`:j?` topbar-full-vehicle-mode`:zr?` topbar-optimization-mode`:``}`,children:[(0,Z.jsxs)(`div`,{className:`brand`,children:[(0,Z.jsx)(`a`,{className:`brand-mark brand-mark-logo`,href:`https://www.bspokeautomotive.it/`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open BSpoke Automotive website`,"data-ui-tooltip":`Open BSpoke Automotive website.`,children:(0,Z.jsx)(`img`,{src:MM,alt:``,"aria-hidden":`true`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{children:`3DSusp Web`}),(0,Z.jsx)(`p`,{children:`${g}${Ro?` *`:``}`})]})]}),(0,Z.jsx)(`nav`,{className:`menu-strip`,"aria-label":`Workspace sections`,children:(0,Z.jsxs)(`div`,{className:`menu-strip-primary`,children:[(0,Z.jsxs)(`div`,{className:`menu-dropdown`,ref:xi,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-product-tour":`file`,"aria-expanded":yr,disabled:sc,onClick:()=>{sc||(Ir(!1),wr(!1),Hr(!1),Wr(!1),br(e=>!e))},children:[(0,Z.jsx)(re,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`File`}),(0,Z.jsx)(D,{size:13,"aria-hidden":`true`})]}),yr?(0,Z.jsxs)(`div`,{className:`file-dropdown`,role:`menu`,children:[(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void Du(),children:[(0,Z.jsx)(P,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`New`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void Ou(),children:[(0,Z.jsx)(ie,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Open`})]}),(0,Z.jsx)(`div`,{className:`file-dropdown-separator`,role:`separator`}),(0,Z.jsxs)(`div`,{className:`file-submenu${xr?` file-submenu-open`:``}`,onPointerEnter:()=>Sr(!0),onPointerLeave:()=>Sr(!1),onFocusCapture:()=>Sr(!0),children:[(0,Z.jsxs)(`div`,{className:`file-submenu-trigger`,role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":xr,tabIndex:0,onClick:e=>{e.preventDefault(),Sr(e=>!e)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),Sr(e=>!e)),e.key===`Escape`&&Sr(!1)},children:[(0,Z.jsx)(ie,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Open Template`}),(0,Z.jsx)(O,{size:13,"aria-hidden":`true`})]}),(0,Z.jsxs)(`div`,{className:`file-submenu-panel`,role:`menu`,"aria-label":`Template files`,"data-product-tour":`templates`,children:[Dr?(0,Z.jsx)(`div`,{className:`file-template-status`,children:`Loading templates...`}):null,!Dr&&Tr.length>0?Tr.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:`file-template-item`,role:`menuitem`,onClick:()=>void ad(e),children:(0,Z.jsx)(`span`,{children:e})},e)):null,!Dr&&Tr.length===0?(0,Z.jsx)(`div`,{className:`file-template-status`,children:kr??`No template .spm files found.`}):null]})]}),(0,Z.jsx)(`div`,{className:`file-dropdown-separator`,role:`separator`}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void cd(),disabled:zo,children:[(0,Z.jsx)(ve,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Save`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void sd(),children:[(0,Z.jsx)(ve,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Save As`})]}),(0,Z.jsx)(`div`,{className:`file-dropdown-separator`,role:`separator`}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void Iu(),children:[(0,Z.jsx)(C,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Import tyre profile (.csv)`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void Mu(),children:[(0,Z.jsx)(C,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Import step geometry`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void dd(),disabled:Ht.length===0,children:[(0,Z.jsx)(C,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Export all imported step geometry`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>void fd(),children:[(0,Z.jsx)(C,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Export wheel envelope (.step)`})]}),(0,Z.jsx)(`div`,{className:`file-dropdown-separator`,role:`separator`}),(0,Z.jsx)(`span`,{className:`beta-unavailable-control beta-unavailable-menu-item`,"data-ui-tooltip":XF,children:(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:!0,children:[(0,Z.jsx)(C,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Export for SolidWorks®`})]})}),(0,Z.jsx)(`span`,{className:`beta-unavailable-control beta-unavailable-menu-item`,"data-ui-tooltip":XF,children:(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:!0,children:[(0,Z.jsx)(C,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Export for VI-SuspensionGen®`})]})})]}):null]}),(0,Z.jsxs)(`button`,{type:`button`,className:`menu-strip-action`,onClick:()=>void cd(),disabled:zo||sc,children:[(0,Z.jsx)(ve,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Save`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`menu-strip-action menu-strip-action-primary`,"data-product-tour":`run`,onClick:of,disabled:sc,children:[(0,Z.jsx)(L,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Run`})]}),(0,Z.jsxs)(`div`,{className:`menu-dropdown`,ref:Ti,children:[(0,Z.jsxs)(`button`,{type:`button`,className:Xr?`reference-geometry-trigger active`:`reference-geometry-trigger`,"aria-expanded":Vr,"aria-pressed":!!Xr,disabled:sc,onClick:()=>{sc||(br(!1),Ir(!1),wr(!1),Wr(!1),Hr(e=>!e))},children:[(0,Z.jsx)(_e,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Reference geometry`}),(0,Z.jsx)(D,{size:13,"aria-hidden":`true`})]}),Vr?(0,Z.jsxs)(`div`,{className:`file-dropdown`,role:`menu`,children:[(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:cf,children:[(0,Z.jsx)(_e,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Set current as reference`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:lf,disabled:!Xr,children:[(0,Z.jsx)(we,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Remove reference`})]})]}):null]}),(0,Z.jsxs)(`div`,{className:`menu-dropdown`,ref:Ci,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-product-tour":`output`,"aria-expanded":Fr,"aria-haspopup":`menu`,onClick:()=>{br(!1),wr(!1),Hr(!1),Wr(!1),Ir(e=>!e)},children:[(0,Z.jsx)(T,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Output`}),(0,Z.jsx)(D,{size:13,"aria-hidden":`true`})]}),Fr?(0,Z.jsx)(`div`,{className:`output-dropdown`,role:`menu`,children:CI.map(e=>{let t=!SB(e.id,K),n=e.id===`fullVehicleSelection`&&(!j||!Ms)||t,r=t?`Enable the corresponding calculation in Run Parameters first.`:`Available in Full vehicle mode after loading the auxiliary axle.`;return(0,Z.jsxs)(`a`,{href:pq(e.id),target:Ja===`window`?hL:`3dsusp-output-${e.id}`,role:`menuitem`,className:`${e.id===`fullVehicleSelection`?`output-full-vehicle-selection`:``}${n?` is-disabled`:``}`,"aria-disabled":n,tabIndex:n?-1:void 0,"data-ui-tooltip":n?r:void 0,onClick:t=>gf(e.id,t),children:[EI(e.id),e.label]},e.id)})}):null]}),(0,Z.jsx)(`div`,{className:`menu-dropdown`,ref:wi,children:v||x||j||zr?(0,Z.jsxs)(`button`,{type:`button`,className:`mode-exit-trigger${v?` mode-exit-trigger-setup`:x?` mode-exit-trigger-rocker`:j?` mode-exit-trigger-full-vehicle`:` mode-exit-trigger-optimization`}
4412`,"data-ui-tooltip":v?`Exits Setup Mode and restores normal editing.`:x?`Exits Rocker Mode and restores the standard 2D layout.`:j?`Exits Full vehicle mode and restores the primary axle workspace.`:`Closes the Optimizer and exits Optimization Mode.`,onClick:()=>{v?If():x?Pf():j?Mf():pf()},children:[(0,Z.jsx)(Oe,{size:21,strokeWidth:3,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Exit Mode`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"data-product-tour":`modes`,"aria-expanded":Lr,"aria-haspopup":`menu`,onClick:()=>{br(!1),Ir(!1),wr(!1),Hr(!1),Wr(!1),Rr(e=>!e)},children:[(0,Z.jsx)(De,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Mode`}),(0,Z.jsx)(D,{size:13,"aria-hidden":`true`})]}),Lr?(0,Z.jsxs)(`div`,{className:`file-dropdown mode-dropdown`,role:`menu`,"aria-label":`Workspace modes`,children:[(0,Z.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":v,className:`mode-menu-setup${v?` is-active`:``}`,onClick:()=>void If(),children:[(0,Z.jsx)(De,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:v?`Exit Setup Mode`:`Setup Mode`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":x,disabled:!rc,className:`mode-menu-rocker${x?` is-active`:``}`,onClick:()=>void Pf(),children:[(0,Z.jsx)(De,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:x?`Exit Rocker Mode`:`Rocker Mode`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":j,className:`mode-menu-full-vehicle${j?` is-active`:``}`,onClick:()=>void Nf(),children:[(0,Z.jsx)(oe,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:j?`Exit Full vehicle mode`:`Full vehicle mode`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":zr,disabled:sc,className:`mode-menu-optimization${zr?` is-active`:``}`,onClick:ff,children:[(0,Z.jsx)(ae,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Optimization Mode`})]})]}):null]})}),(0,Z.jsxs)(`button`,{type:`button`,className:`menu-strip-action`,"data-product-tour":`monitor`,onClick:()=>{br(!1),Ir(!1),wr(!1),Hr(!1),Wr(!1),Ke(!0)},children:[(0,Z.jsx)(b,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Monitor`})]}),(0,Z.jsxs)(`div`,{className:`menu-dropdown`,ref:Si,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":Cr,onClick:()=>{br(!1),Ir(!1),Hr(!1),Wr(!1),wr(e=>!e)},children:[(0,Z.jsx)(ye,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Preferences`}),(0,Z.jsx)(D,{size:13,"aria-hidden":`true`})]}),Cr?(0,Z.jsxs)(`div`,{className:`file-dropdown`,role:`menu`,children:[(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:vd,children:[(0,Z.jsx)(_e,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Coordinate step`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:Cd,children:[(0,Z.jsx)(w,{size:14,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{children:[`Motion Ratio (current: `,nR(or),`)`]})]}),(0,Z.jsxs)(`div`,{className:`file-submenu`,children:[(0,Z.jsxs)(`div`,{className:`file-submenu-trigger`,role:`menuitem`,"aria-haspopup":`menu`,children:[(0,Z.jsx)(T,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Output reports`}),(0,Z.jsx)(O,{size:13,"aria-hidden":`true`})]}),(0,Z.jsxs)(`div`,{className:`file-submenu-panel`,role:`menu`,"aria-label":`Output report opening mode`,children:[(0,Z.jsx)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":Ja===`tab`,onClick:()=>{Ya(`tab`),wr(!1)},children:(0,Z.jsx)(`span`,{children:`New browser tab`})}),(0,Z.jsx)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":Ja===`window`,onClick:()=>{Ya(`window`),wr(!1)},children:(0,Z.jsx)(`span`,{children:`Separate window`})})]})]}),(0,Z.jsx)(`div`,{className:`file-dropdown-separator`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`file-submenu`,children:[(0,Z.jsxs)(`div`,{className:`file-submenu-trigger`,role:`menuitem`,"aria-haspopup":`menu`,children:[(0,Z.jsx)(ye,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Theme`}),(0,Z.jsx)(O,{size:13,"aria-hidden":`true`})]}),(0,Z.jsxs)(`div`,{className:`file-submenu-panel`,role:`menu`,"aria-label":`Theme mode`,children:[(0,Z.jsx)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":Ka===`dark`,onClick:()=>{qa(`dark`),wr(!1)},children:(0,Z.jsx)(`span`,{children:`Dark`})}),(0,Z.jsx)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":Ka===`light`,onClick:()=>{qa(`light`),wr(!1)},children:(0,Z.jsx)(`span`,{children:`Light`})}),(0,Z.jsx)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":Ka===`auto`,onClick:()=>{qa(`auto`),wr(!1)},children:(0,Z.jsx)(`span`,{children:`Auto`})})]})]})]}):null]}),(0,Z.jsxs)(`div`,{className:`menu-dropdown`,ref:Ei,children:[(0,Z.jsx)(`button`,{type:`button`,className:`menu-support-trigger`,"data-
4412product-tour":`support`,"aria-label":`Open support menu`,"data-ui-tooltip":`Opens Quick tour, User Guide, Keyboard shortcuts, About, privacy, and terms information.`,"data-ui-tooltip-align":`end`,"aria-expanded":Ur,"aria-haspopup":`menu`,onClick:()=>{br(!1),Ir(!1),wr(!1),Hr(!1),Wr(e=>!e)},children:(0,Z.jsx)(A,{size:21,strokeWidth:2.5,"aria-hidden":`true`})}),Ur?(0,Z.jsxs)(`div`,{className:`file-dropdown support-menu-dropdown`,role:`menu`,children:[(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:qf,children:[(0,Z.jsx)(L,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Quick tour`})]}),(0,Z.jsxs)(`a`,{href:WF,download:GF,role:`menuitem`,onClick:()=>Wr(!1),children:[(0,Z.jsx)(A,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`User Guide`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{Wr(!1),Kr(`shortcuts`)},children:[(0,Z.jsx)(ce,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Shortcuts`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{Wr(!1),Kr(`about`)},children:[(0,Z.jsx)(F,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`About`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{Wr(!1),Kr(`privacy`)},children:[(0,Z.jsx)(re,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Privacy Policy`})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{Wr(!1),Kr(`terms`)},children:[(0,Z.jsx)(re,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Terms & Conditions`})]})]}):null]})]})}),(0,Z.jsxs)(`div`,{className:`toolbar`,role:`toolbar`,"aria-label":`File`,children:[(0,Z.jsx)(`div`,{className:`toolbar-group toolbar-group-mode`,children:(0,Z.jsx)(`span`,{className:`beta-unavailable-control`,"data-ui-tooltip":XF,children:(0,Z.jsxs)(`button`,{type:`button`,className:`workspace-lock-chip`,disabled:!0,onClick:()=>xa(!0),children:[(0,Z.jsx)(ee,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Cloud Workspace`})]})})}),(0,Z.jsx)(`div`,{className:`toolbar-group toolbar-group-utility`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`step-control${up?` is-move-ready`:``}`,"data-product-tour":`coordinate-step`,"data-ui-tooltip":`Opens coordinate step settings and shows the current increment used for hardpoint editing. 4413Use +/- keys to change the coordinate step quickly.`,"data-ui-tooltip-align":`end`,onClick:vd,children:[(0,Z.jsx)(`span`,{children:`Coordinate step`}),(0,Z.jsx)(`strong`,{children:`${$(ir)} mm`})]})}),(0,Z.jsxs)(`div`,{className:`toolbar-group toolbar-group-session`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`user-chip`,"data-ui-tooltip":`Shows the signed-in user and signs out of the current session.`,"data-ui-tooltip-align":`end`,onClick:()=>void Kf(),children:[(0,Z.jsx)(Ee,{size:15,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:e.user.username}),(0,Z.jsx)(ue,{size:14,"aria-hidden":`true`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`workspace-lock-chip fullscreen-toggle`,"aria-label":Wa?`Exit fullscreen`:`Enter fullscreen`,"aria-pressed":Wa,"data-ui-tooltip":`Fullscreen`,onClick:()=>void Bd(),children:Wa?(0,Z.jsx)(de,{size:16,"aria-hidden":`true`}):(0,Z.jsx)(I,{size:16,"aria-hidden":`true`})})]}),(0,Z.jsx)(`input`,{ref:fi,type:`file`,accept:`.spm,.txt`,onChange:e=>{let t=e.target.files?.[0];if(t){let e=!bi.current;bi.current=!1,Su(t,null,e)}else bi.current=!1;e.currentTarget.value=``}}),(0,Z.jsx)(`input`,{ref:pi,type:`file`,accept:`.spm,.txt`,onChange:e=>{let t=e.target.files?.[0];t&&Cu(t).catch(e=>{window.alert(e instanceof Error?e.message:`Cannot open the auxiliary axle SPM.`)}),e.currentTarget.value=``}}),(0,Z.jsx)(`input`,{ref:hi,type:`file`,accept:`.csv,text/csv`,onChange:e=>{let t=e.target.files?.[0];t&&Fu(t).catch(e=>{window.alert(e instanceof Error?e.message:`Cannot import tyre profile.`)}),e.currentTarget.value=``}}),(0,Z.jsx)(`input`,{ref:mi,type:`file`,accept:`.step,.stp`,multiple:!0,onChange:e=>{let t=Array.from(e.target.files??[]);t.length>0&&Au(t),e.currentTarget.value=``}})]})]}),ni?(0,ke.createPortal)((0,Z.jsx)(`div`,{className:`ui-tooltip-layer ui-tooltip-layer-${ii?.placement??`bottom`}`,style:Vo,role:`tooltip`,children:(0,Z.jsx)(`div`,{ref:ci,className:`ui-tooltip-card`,children:ni.text})}),Sp):null,xp(Xt?(0,Z.jsx)(`div`,{className:`step-import-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`step-import-modal`,role:`status`,"aria-live":`polite`,"aria-label":`STEP import progress`,children:[(0,Z.jsx)(`span`,{className:`step-import-title`,children:`Loading ${Xt.fileName}`}),(0,Z.jsx)(`div`,{className:`step-import-progress-track`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Xt.progress,"aria-label":`STEP import progress`,children:(0,Z.jsx)(`div`,{className:`step-import-progress-fill`,style:{width:`${Xt.progress}%`}})}),(0,Z.jsxs)(`div`,{className:`step-import-modal-footer`,children:[(0,Z.jsxs)(`strong`,{children:[Xt.progress,`%`]}),(0,Z.jsx)(`button`,{type:`button`,className:`step-import-cancel-button`,onClick:ju,children:`Cancel`})]})]})}):null),null,(0,Z.jsxs)(`main`,{className:`workspace${la===`none`?``:` workspace-view-fullscreen workspace-view-fullscreen-${la}`}${Xa?` workspace-control-deck-detached`:``}`,ref:Mi,tabIndex:-1,style:jl,children:[Ye.map(e=>(0,Z.jsxs)(`section`,{className:`pinned-output-chart-window`,style:{left:e.left,top:e.top,width:e.width,height:e.height,zIndex:e.zIndex},onPointerDown:()=>xo(e.id),children:[(0,Z.jsxs)(`header`,{className:`pinned-output-chart-head`,onPointerDown:t=>Eo(e.id,`move`,t),onPointerMove:Do,onPointerUp:Oo,onPointerCancel:Oo,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(he,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`strong`,{children:e.title})]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close ${e.title}`,title:`Close`,onPointerDown:e=>{e.stopPropagation(),Ii.current=null},onClick:t=>{t.preventDefault(),t.stopPropagation(),Ii.current=null,Co(e.id)},children:(0,Z.jsx)(Oe,{size:14,"aria-hidden":`true`})})]}),(0,Z.jsx)(`div`,{className:`pinned-output-chart-body`,children:(0,Z.jsx)(TK,{chartKey:`pinned-${e.id}`,seriesSet:e.seriesSet,title:e.title,x:e.x,y:e.y,xAxisLabelOverride:e.xAxisLabelOverride,yAxisLabelOverride:e.yAxisLabelOverride,analysisChannel:e.anal
4413ysisChannel,analysisAxisChannel:e.analysisAxisChannel,analysisZeroLabel:e.analysisZeroLabel,analysisSeriesKeys:e.analysisSeriesKeys,analysisSeriesLabelVariant:e.analysisSeriesLabelVariant,legendSeriesKeys:e.legendSeriesKeys,forceLegend:e.forceLegend,hideAnalysisRows:e.hideAnalysisRows,analysisSummaryMode:e.analysisSummaryMode,replaceGradientWithAverage:e.replaceGradientWithAverage,analysisRoleRows:e.analysisRoleRows,showLegend:e.showLegend??!1})}),(0,Z.jsx)(`div`,{className:`pinned-output-chart-resize`,role:`separator`,"aria-label":`Resize ${e.title}`,onPointerDown:t=>Eo(e.id,`resize`,t),onPointerMove:Do,onPointerUp:Oo,onPointerCancel:Oo})]},e.id)),la===`views2d`||la===`views3d`?(0,Z.jsx)(`section`,{ref:ki,className:`floating-animation-window`,style:{"--floating-animation-x":`${da.x}px`,"--floating-animation-y":`${da.y}px`},"aria-label":`Floating Animation panel`,children:gp(!0)}):null,(0,Z.jsxs)(`section`,{className:`top-stage`,ref:Ki,"data-product-tour":`suspension-views`,children:[(0,Z.jsx)(`section`,{className:`projection-layout projection-layout-unified`,children:(0,Z.jsxs)(`section`,{className:`projection-panel projection-panel-unified`,children:[(0,Z.jsxs)(`div`,{className:`projection-tools projection-tools-unified`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>ia(e=>Math.min(6,Math.max(.45,e*1.2))),children:`+`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>ia(e=>Math.min(6,Math.max(.45,e/1.2))),children:`-`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>ia(oz),children:`1:1`}),(0,Z.jsxs)(`span`,{children:[Math.round(ra/oz*100),`%`]})]}),(0,Z.jsx)(`div`,{className:`projection-unified-grid${x||sa?` projection-unified-grid-expanded`:``}${x||Ie?``:` projection-unified-grid-single-side`}`,children:x&&tc?(0,Z.jsx)(jM,{document:q,auxiliaryDocument:Vs,auxiliaryOffset:Hs,auxiliaryTyreProfile:Ps,loadVectors:Ys,referenceDocument:G,tyreProfile:as,plane:`XZ`,customProjection:nc,showLeft:Ic===`left`,showPoints:Re,hardpoints:Ic===`right`?Tl:[],hardpointsLeft:Ic===`left`?Tl:[],rockerOperationalHardpointIds:rl,selectedHardpointIds:sp,uprightHighlightEnabled:Xn,onHardpointSelect:cp,onHardpointGroupSelect:lp,zoom:ra,baseZoom:oz,onZoomChange:ia,resetToken:vo.token,isAnimating:Ve,sharedSpan:Kc,sideMode:El,showTools:!1,panelClassName:`projection-subview projection-subview-expanded`}):sa?(0,Z.jsx)(jM,{document:q,auxiliaryDocument:Vs,auxiliaryOffset:Hs,auxiliaryTyreProfile:Ps,loadVectors:Ys,referenceDocument:G,tyreProfile:is?Wt:null,plane:sa,showLeft:Ie,showPoints:Re,hardpoints:Cl,hardpointsLeft:wl,selectedHardpointIds:sp,uprightHighlightEnabled:Xn,onHardpointSelect:cp,onHardpointGroupSelect:lp,zoom:ra,baseZoom:oz,onZoomChange:ia,resetToken:vo.token,isAnimating:Ve,sharedPanY:sa===`YX`||sa===`YZ`?aa:void 0,onSharedPanYChange:sa===`YX`||sa===`YZ`?oa:void 0,sharedSpan:Kc,sideMode:qc(sa),showTools:!1,panelClassName:`projection-subview projection-subview-expanded`,onPanelDoubleClick:()=>Af(sa)}):Ie?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(jM,{document:q,auxiliaryDocument:Vs,auxiliaryOffset:Hs,auxiliaryTyreProfile:Ps,loadVectors:Ys,referenceDocument:G,tyreProfile:as,plane:`YZ`,showLeft:Ie,showPoints:Re,hardpoints:Cl,hardpointsLeft:wl,selectedHardpointIds:sp,uprightHighlightEnabled:Xn,onHardpointSelect:cp,onHardpointGroupSelect:lp,zoom:ra,baseZoom:oz,onZoomChange:ia,resetToken:vo.token,isAnimating:Ve,sharedPanY:aa,onSharedPanYChange:oa,sharedSpan:Kc,sideMode:qc(`YZ`),showTools:!1,panelClassName:`projection-subview`,onPanelDoubleClick:()=>Af(`YZ`)}),(0,Z.jsx)(jM,{document:q,auxiliaryDocument:Vs,auxiliaryOffset:Hs,auxiliaryTyreProfile:Ps,loadVectors:Ys,referenceDocument:G,tyreProfile:as,plane:`YX`,showLeft:Ie,showPoints:Re,hardpoints:Cl,hardpointsLeft:wl,selectedHardpointIds:sp,uprightHighlightEnabled:Xn,onHardpointSelect:cp,onHardpointGroupSelect:lp,zoom:ra,baseZoom:oz,onZoomChange:ia,resetToken:vo.token,isAnimating:Ve,sharedPanY:aa,onSharedPanYChange:oa,sharedSpan:Kc,sideMode:qc(`YX`),showTools:!1,panelClassName:`projection-subview projection-subview-wide`,onPanelDoubleClick:()=>Af(`YX`)})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(jM,{document:q,auxiliaryDocument:Vs,auxiliaryOffset:Hs,auxiliaryTyreProfile:Ps,loadVectors:Ys,referenceDocument:G,tyreProfile:as,plane:`YZ`,showLeft:Ie,showPoints:Re,hardp
4413oints:Cl,hardpointsLeft:wl,selectedHardpointIds:sp,uprightHighlightEnabled:Xn,onHardpointSelect:cp,onHardpointGroupSelect:lp,zoom:ra,baseZoom:oz,onZoomChange:ia,resetToken:vo.token,isAnimating:Ve,sharedPanY:aa,onSharedPanYChange:oa,sharedSpan:Kc,sideMode:qc(`YZ`),showTools:!1,panelClassName:`projection-subview`,onPanelDoubleClick:()=>Af(`YZ`)}),(0,Z.jsx)(jM,{document:q,auxiliaryDocument:Vs,auxiliaryOffset:Hs,auxiliaryTyreProfile:Ps,loadVectors:Ys,referenceDocument:G,tyreProfile:as,plane:`XZ`,showLeft:Ie,showPoints:Re,hardpoints:Cl,hardpointsLeft:wl,selectedHardpointIds:sp,uprightHighlightEnabled:Xn,onHardpointSelect:cp,onHardpointGroupSelect:lp,zoom:ra,baseZoom:oz,onZoomChange:ia,resetToken:vo.token,isAnimating:Ve,sharedSpan:Kc,sideMode:qc(`XZ`),showTools:!1,panelClassName:`projection-subview`,onPanelDoubleClick:()=>Af(`XZ`)}),(0,Z.jsx)(jM,{document:q,auxiliaryDocument:Vs,auxiliaryOffset:Hs,auxiliaryTyreProfile:Ps,loadVectors:Ys,referenceDocument:G,tyreProfile:as,plane:`YX`,showLeft:Ie,showPoints:Re,hardpoints:Cl,hardpointsLeft:wl,selectedHardpointIds:sp,uprightHighlightEnabled:Xn,onHardpointSelect:cp,onHardpointGroupSelect:lp,zoom:ra,baseZoom:oz,onZoomChange:ia,resetToken:vo.token,isAnimating:Ve,sharedPanY:aa,onSharedPanYChange:oa,sharedSpan:Kc,sideMode:qc(`YX`),showTools:!1,panelClassName:`projection-subview`,onPanelDoubleClick:()=>Af(`YX`)})]})})]})}),(0,Z.jsx)(`button`,{type:`button`,className:`splitter-vertical`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize 2D and 3D areas`,onPointerDown:vf}),(0,Z.jsxs)(`section`,{className:`scene-panel`,ref:Ni,children:[(0,Z.jsxs)(`div`,{className:`scene-bar`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`strong`,{children:G.suspension.suspensionType}),(0,Z.jsx)(`span`,{children:G.suspension.configuration})]}),(0,Z.jsxs)(`div`,{className:`segmented`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`scene-envelope-button`,"aria-pressed":nn,"data-ui-tooltip":`Builds convex envelopes for links, springs and rocker solids across all valid bump, rebound and steer poses up to the real endstops. 4414Clashes between supported suspension components are checked pose by pose. Component-to-wheel clashes are checked only while Wheel envelope is active. 4415This is a qualitative packaging check: component surfaces and displayed intersection ribbons are simplified, discretized approximations, not a tolerance-aware CAD clearance analysis. 4416Bars C/T are currently excluded in this first step. 4417You can keep using the standard Animation panel while the envelopes stay visible.`,onClick:jd,children:[(0,Z.jsx)(`span`,{className:`clash-check-status-light clash-check-status-light-${cs}`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Clash check`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`scene-envelope-button`,"aria-pressed":!!Bt,"data-ui-tooltip":`Builds and displays the wheel envelope from all valid bump, rebound and steer positions up to the real endstops. 4418Uses the selected wheel shape, including Tyre profile when active. 4419When active, it also enables component-to-wheel checks in Clash check. 4420Export the same envelope as a STEP file from the File menu.`,onClick:Ad,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Wheel envelope`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`scene-reset-button`,"data-ui-tooltip":`Restores the default 3D camera orientations and zoom.`,onClick:kf,children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Reset view`})]}),(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":Ie,"data-ui-tooltip":x?`Rocker mode always uses the left-side auxiliary plane.`:`Shows or hides the mirrored side in the 2D and 3D views.`,onClick:jf,disabled:x,children:[(0,Z.jsx)(oe,{size:16,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Both sides`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`scene-projection-button`,"aria-pressed":pa,"aria-label":pa?`Return to default perspective view`:`Switch to orthographic projection`,"data-ui-tooltip":pa?`Returns to the default perspective 3D view.`:`Switches the 3D view to orthographic projection.`,onClick:()=>ma(e=>!e),children:pa?(0,Z.jsx)(mz,{size:20,"aria-hidden":`true`}):(0,Z.jsx)(C,{size:18,"aria-hidden":`true`})})]})]}),(0,Z.jsx)(YA,{document:q,auxiliaryDocument:Vs,auxiliaryOffset:Hs,auxiliaryTyreProfile:Ps,loadVectors:Ys,referenceDocument:G,tyreProfile:is?Wt:null,fullVehicleMode:j,t
4420yreProfileOverlay:as,ghostWireframeDocument:tp,ghostWireframeColor:v?dI:void 0,ghostWireframeLineWidth:void 0,ghostWireframeSegmentKinds:void 0,extremePoseMeshes:os,extremePoseClashMeshes:ss,referenceGhostWireframeDocument:Zo,customProjection:x?tc?.projection??null:null,sideMode:x?El:`auto`,themeMode:Bo,lightThemeActive:Bo===`light`,showLeft:x?Ic===`left`:Ie,showPoints:Re,hardpoints:Cl,hardpointsLeft:wl,rockerOperationalHardpointIds:x?rl:[],selectedHardpointIds:sp,uprightHighlightEnabled:Xn,onHardpointSelect:cp,onHardpointGroupSelect:lp,wheelEnvelopeMesh:Bt,stepGeometries:Uc,stepGeometryChassisTransform:Ws,stepClashDetectionEnabled:Qt,stepWheelbaseGuides:Hc,stepWheelbaseDebugGuides:Y,setupShimOverlay:Zs,setupUprightWheelOverrides:Xs,traceSteeringAxisEnvelope:q.graphics.drawSteeringAxis&&q.graphics.steeringAxisEnvelope,isAnimating:Ve,orthographic:pa,resetViewToken:vo.token,resetViewPreset:vo.preset,captureView:Qs,onViewInteraction:zd,onViewParametersChange:Rd})]})]}),(0,Z.jsx)(`button`,{type:`button`,className:`splitter-horizontal`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize view and settings areas`,onPointerDown:yf}),Xa?vp():_p()]}),yp,xp(er?(0,Z.jsx)(`div`,{className:`app-warning-overlay vi-suspensiongen-overlay`,role:`presentation`,onClick:e=>{e.target===e.currentTarget&&yd()},children:(0,Z.jsxs)(`section`,{className:`vi-suspensiongen-dialog coordinate-step-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`coordinate-step-title`,children:[(0,Z.jsxs)(`header`,{className:`vi-suspensiongen-header`,children:[(0,Z.jsx)(`div`,{className:`vi-suspensiongen-title`,children:(0,Z.jsx)(`h2`,{id:`coordinate-step-title`,children:`Coordinate step`})}),(0,Z.jsx)(`button`,{type:`button`,className:`vi-suspensiongen-close`,"aria-label":`Close Coordinate step dialog`,onClick:yd,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]}),(0,Z.jsxs)(`form`,{className:`coordinate-step-dialog-body`,onSubmit:bd,children:[(0,Z.jsxs)(`label`,{className:`coordinate-step-field`,children:[(0,Z.jsx)(`span`,{children:`Default step`}),(0,Z.jsx)(`div`,{className:`coordinate-step-input-row`,children:(0,Z.jsx)(`select`,{value:nr.defaultStep,onChange:e=>rr(t=>({...t,defaultStep:e.target.value})),children:sz.map(e=>(0,Z.jsx)(`option`,{value:String(e),children:`${e} mm`},e))})})]}),(0,Z.jsxs)(`label`,{className:`coordinate-step-field`,children:[(0,Z.jsx)(`span`,{children:`+/- key press time to default`}),(0,Z.jsxs)(`div`,{className:`coordinate-step-input-row coordinate-step-input-row-seconds`,children:[(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:nr.holdToDefaultSeconds,onChange:e=>rr(t=>({...t,holdToDefaultSeconds:e.target.value}))}),(0,Z.jsx)(`small`,{children:`Sec`})]})]}),(0,Z.jsxs)(`div`,{className:`coordinate-step-dialog-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`coordinate-step-secondary`,onClick:xd,children:`Reset`}),(0,Z.jsxs)(`div`,{className:`coordinate-step-dialog-actions-primary`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`coordinate-step-secondary`,onClick:yd,children:`Cancel`}),(0,Z.jsx)(`button`,{type:`submit`,className:`vi-suspensiongen-export`,children:`OK`})]})]})]})]})}):null),xp(ur?(0,Z.jsx)(`div`,{className:`app-warning-overlay vi-suspensiongen-overlay`,role:`presentation`,onClick:e=>{e.target===e.currentTarget&&wd()},children:(0,Z.jsxs)(`section`,{className:`vi-suspensiongen-dialog coordinate-step-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`motion-ratio-title`,children:[(0,Z.jsxs)(`header`,{className:`vi-suspensiongen-header`,children:[(0,Z.jsx)(`div`,{className:`vi-suspensiongen-title`,children:(0,Z.jsx)(`h2`,{id:`motion-ratio-title`,children:`Motion Ratio`})}),(0,Z.jsx)(`button`,{type:`button`,className:`vi-suspensiongen-close`,"aria-label":`Close Motion Ratio dialog`,onClick:wd,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]}),(0,Z.jsxs)(`form`,{className:`coordinate-step-dialog-body`,onSubmit:Td,children:[(0,Z.jsxs)(`label`,{className:`coordinate-step-field`,children:[(0,Z.jsx)(`span`,{children:`Calculation mode`}
4420),(0,Z.jsx)(`div`,{className:`coordinate-step-input-row`,children:(0,Z.jsx)(`select`,{value:fr.mode,onChange:e=>pr({mode:qL(e.target.value)?e.target.value:fL}),children:yL.map(e=>(0,Z.jsx)(`option`,{value:e,children:bL[e]},e))})})]}),(0,Z.jsx)(`div`,{className:`coordinate-step-dialog-actions`,children:(0,Z.jsxs)(`div`,{className:`coordinate-step-dialog-actions-primary`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`coordinate-step-secondary`,onClick:wd,children:`Cancel`}),(0,Z.jsx)(`button`,{type:`submit`,className:`vi-suspensiongen-export`,children:`OK`})]})})]})]})}):null),xp(mr?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog motion-ratio-warning-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`motion-ratio-warning-title`,children:[(0,Z.jsx)(`h2`,{id:`motion-ratio-warning-title`,children:`Warning`}),(0,Z.jsx)(`p`,{children:`Changing the Motion Ratio setting will affect all results and charts related to the definition of the kinematic Motion Ratio. Continue anyway?`}),(0,Z.jsxs)(`div`,{className:`app-warning-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:Ed,children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,onClick:Dd,children:`OK`})]})]})}):null),xp(Kt&&Wt?(0,Z.jsx)(wq,{profile:Wt,onApply:Ru,onClose:()=>qt(!1)}):null),xp(Gr?(0,Z.jsx)(`div`,{className:`app-warning-overlay support-dialog-overlay`,role:`presentation`,onClick:e=>{e.target===e.currentTarget&&Kr(null)},children:(0,Z.jsxs)(`section`,{className:`support-dialog${Gr===`terms`?` support-dialog-terms`:Gr===`privacy`?` support-dialog-privacy`:Gr===`quickGuide`?` support-dialog-quick-guide`:Gr===`shortcuts`?` support-dialog-shortcuts`:` support-dialog-about`}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":hp,children:[(0,Z.jsxs)(`header`,{className:`support-dialog-header`,children:[(0,Z.jsxs)(`div`,{className:`support-dialog-header-copy`,children:[(0,Z.jsxs)(`div`,{className:`support-dialog-kicker`,children:[(0,Z.jsx)(DI,{size:15}),(0,Z.jsx)(`span`,{children:`BSpoke Automotive`})]}),(0,Z.jsx)(`h2`,{id:hp,children:pp}),(0,Z.jsx)(`p`,{children:mp})]}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-close-button`,"aria-label":`Close ${Gr===`about`?`about`:Gr===`privacy`?`privacy policy`:Gr===`quickGuide`?`quick guide`:Gr===`shortcuts`?`shortcuts`:`terms`} dialog`,onClick:()=>Kr(null),children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]}),Gr===`about`?(0,Z.jsxs)(`div`,{className:`support-about-layout`,children:[(0,Z.jsxs)(`div`,{className:`support-about-hero`,children:[(0,Z.jsx)(`img`,{src:MM,alt:``,"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:`support-about-brand`,children:(0,Z.jsx)(`strong`,{children:`3DSusp Web`})})]}),(0,Z.jsxs)(`div`,{className:`support-about-details`,children:[(0,Z.jsx)(`p`,{children:`This web application brings the original BSpoke 3DSusp desktop workflow into a modern browser-based environment, substantially improving accessibility, continuity of work, and day-to-day usability while preserving its engineering depth.`}),(0,Z.jsxs)(`p`,{children:[`(c) 2026 BSpoke Automotive Srl`,(0,Z.jsx)(`br`,{}),`Via Branze 38, 25123 Brescia, Italy`,(0,Z.jsx)(`br`,{}),`C.F. - P.IVA 04556490987`,(0,Z.jsx)(`br`,{}),(0,Z.jsx)(`a`,{href:`mailto:[email protected]`,children:`[email protected]`}),(0,Z.jsx)(`br`,{}),(0,Z.jsx)(`a`,{href:`https://www.bspokeautomotive.it/`,target:`_blank`,rel:`noopener noreferrer`,children:`www.bspokeautomotive.it`})]})]})]}):Gr===`quickGuide`?(0,Z.jsx)(`div`,{className:`support-quick-guide-body`,children:fp.sections.map(e=>(0,Z.jsxs)(`section`,{className:`support-quick-guide-section`,children:[(0,Z.jsx)(`h3`,{children:e.heading}),(0,Z.jsx)(`ul`,{children:e.items.map(e=>(0,Z.jsx)(`li`,{children:e},e))})]},e.heading))}):Gr===`shortcuts`?(0,Z.jsxs)(`div`,{className:`support-shortcuts-body`,role:`table`,"aria-label":`Keyboard shortcuts`,children:[(0,Z.jsxs)(`div`,{className:`support-shortcuts-row support-shortcuts-head`,role:`row`,children:[(0,Z.jsx)(`span`,{role:`columnheader`,children:`Shortcut`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Action`})]}),pI.map(e=>(0,Z.jsxs)(`div`,{className:`support-shortcuts-row`,role:`row`,children:[(0,Z.jsx)(`span`,{className:`support-shortcuts-keys`,role:`cell`,children:e.keys.map((e,t)=>(0,Z.jsx)(`kbd`,{children:e},`${e}-${t}`))}),(0,Z.jsx)(`span`,{role:`cell`,children:e.description})]},e.keys.join(`-`)))]}):Gr===`privacy`?(0,Z.jsx)(`div`,{className:`support-privacy-body`,children:(0,Z.jsx)(FM,{})}):(0,Z.jsx)(`div`,{className:`support-terms-body`,children:(0,Z.jsx)(`pre`,{className:`support-terms-text`,children:NM})})]})}):null),xp(Ze&&$e!==`minimized`?(0,Z.jsx)(`div`,{className:`report-table-overlay geometry-tabular-input-overlay`,role:`presentation`,onClick:e=>{e.target===e.currentTarget&&ef()},children:(0,Z.jsxs)(`section`,{className:`report-table-dialog geometry-tabular-input-dialog${$e===`maximized`?` is-maximized`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tabular-input-title`,onPasteCapture:af,children:[(0,Z.jsxs)(`header`,{className:`report-table-dialog-head`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{id:`tabular-input-title`,children:`Tabular input`}),(0,Z.jsx)(`p`,{children:`Copy the table, edit values manually, or paste a full hardpoint table from Excel.`})]}),(0,Z.jsxs)(`div`,{className:`report-table-dialog-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:()=>void Yd(),children:[(0,Z.jsx)(te,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:lt===`copied`?`Copied`:lt===`error`?`Copy failed`:`Copy to clipboard`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:Xd,children:[(0,Z.jsx)(re,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Export .csv`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:Zd,children:[(0,Z.jsx)(we,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Erase table`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`report-table-copy-button`,onClick:ef,children:[(0,Z.jsx)(Se,{size:14,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:`Apply`})]}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-window-button`,"aria-label":`Minimize tabular input`,title:`Riduci a icona`,onClick:()=>et(`minimized`),children:(0,Z.jsx)(`span`,{className:`window-control-glyph is-minimize`,"aria-hidden":`true`})}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-window-button`,"aria-label":$e===`maximized`?`Restore tabular input`:`Maximize tabular input`,title:$e===`maximized`?`Ripristina in basso`:`Ingrandisci`,onClick:$d,children:(0,Z.jsx)(`span`,{className:`window-control-glyph${$e===`maximized`?` is-restore`:` is-maximize`}`,"aria-hidden":`true`})}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-close-button`,"aria-label":`Close tabular input`,onClick:ef,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]})]}),(0,Z.jsx)(`div`,{className:`report-table-scroll geometry-tabular-input-scroll`,children:(0,Z.jsx)(oq,{rows:dl,draft:rt,activeCell:tt,onCellActivate:(e,t)=>
4420nt({rowIndex:e,slotIndex:t}),onCellChange:Gd})}),(0,Z.jsx)(cq,{offsetDraft:st,onOffsetDraftChange:Kd,onFlipAxis:qd,onApplyOffset:Jd})]})}):null),xp(Ze&&$e===`minimized`?(0,Z.jsxs)(`div`,{className:`report-table-minimized-bar report-table-minimized-bar-geometry`,role:`dialog`,"aria-modal":`false`,"aria-label":`Tabular input minimized`,children:[(0,Z.jsx)(`span`,{children:`Tabular input`}),(0,Z.jsxs)(`div`,{className:`report-table-minimized-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`report-table-window-button`,"aria-label":`Restore tabular input`,title:`Ripristina in basso`,onClick:()=>et(`normal`),children:(0,Z.jsx)(`span`,{className:`window-control-glyph is-restore`,"aria-hidden":`true`})}),(0,Z.jsx)(`button`,{type:`button`,className:`report-table-close-button`,"aria-label":`Close tabular input`,onClick:ef,children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]})]}):null),dt?.kind===`confirm-close`?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tabular-input-warning-title`,children:[(0,Z.jsx)(`h2`,{id:`tabular-input-warning-title`,children:`Warning`}),(0,Z.jsx)(`p`,{children:`Overwrite current geometry?`}),(0,Z.jsxs)(`div`,{className:`app-warning-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:tf,children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:Qd,children:`No`}),(0,Z.jsx)(`button`,{type:`button`,onClick:rf,children:`Yes`})]})]})}):null,dt?.kind===`negative-y-coordinates`?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog tabular-input-negative-y-warning`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tabular-input-negative-y-warning-title`,children:[(0,Z.jsx)(`h2`,{id:`tabular-input-negative-y-warning-title`,children:`Warning`}),(0,Z.jsx)(`p`,{children:`Check Y-coordinate signs against the right-hand rule before applying the tabular geometry changes.`}),(0,Z.jsxs)(`div`,{className:`app-warning-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:tf,children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>nf(dt.updates),children:`Continue`})]})]})}):null,dt?.kind===`empty-table`?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog tabular-input-negative-y-warning`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tabular-input-empty-warning-title`,children:[(0,Z.jsx)(`h2`,{id:`tabular-input-empty-warning-title`,children:`Warning: empty table`}),(0,Z.jsx)(`p`,{children:`The tabular input is empty. Continue will erase geometry.`}),(0,Z.jsxs)(`div`,{className:`app-warning-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:tf,children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>nf(dt.updates),children:`Continue`})]})]})}):null,Ge&&_s?(0,Z.jsx)(`section`,{ref:Di,className:`monitor-window`,"data-product-tour":`monitor-dialog`,style:{"--monitor-window-x":`${qe.x}px`,"--monitor-window-y":`${qe.y}px`},role:`dialog`,"aria-modal":`false`,"aria-label":`Monitor`,children:(0,Z.jsx)(ZK,{modeLabel:_s.modeLabel,sections:np,referenceSections:rp,currentValueLabel:ip,referenceValueLabel:ap,highlightCurrentValueHeader:v,useNeutralReferenceHeaders:v,reverseDelta:x,fullVehicleMode:j,motion:ps,setupMode:v,rockerMode:x,onClose:()=>{Oi.current=null,Ke(!1)},onDragPointerDown:Ts,onDragPointerMove:Es,onDragPointerEnd:Ds})}):null,Pn?(0,Z.jsx)(`div`,{className:`app-warning-overlay vi-suspensiongen-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`vi-suspensiongen-dialog solidworks-export-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`solidworks-export-title`,children:[(0,Z.jsxs)(`header`,{className:`vi-suspensiongen-header`,children:[(0,Z.jsx)(`div`,{className:`vi-suspensiongen-title`,children:(0,Z.jsx)(`h2`,{id:`solidworks-export-title`,children:`Export for SolidWorks®`})}),(0,Z.jsx)(`button`,{type:`button`,className:`vi-suspensiongen-close`,"aria-label":`Close Export for SolidWorks`,onClick:()=>Fn(!1),children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]}),(0,Z.jsxs)(`form`,{className:`vi-suspensiongen-body solidworks-export-body`,onSubmit:e=>
4420void gd(e),children:[(0,Z.jsxs)(`div`,{className:`solidworks-export-fields`,children:[(0,Z.jsxs)(`label`,{className:`vi-suspensiongen-name solidworks-export-name`,children:[(0,Z.jsx)(`span`,{children:`Export folder`}),(0,Z.jsx)(`input`,{type:`text`,value:In.folderName,onChange:e=>pd(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`solidworks-export-parent`,children:[(0,Z.jsx)(`span`,{children:`Parent folder`}),(0,Z.jsx)(`div`,{className:`solidworks-export-parent-value`,children:In.parentFolderLabel||`Not selected`})]}),(0,Z.jsx)(`div`,{className:`solidworks-export-status`,children:In.statusMessage||`Select a parent folder, then create the export folder.`})]}),(0,Z.jsxs)(`div`,{className:`solidworks-export-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`vi-suspensiongen-export solidworks-export-secondary`,onClick:()=>void md(),children:`Select parent folder`}),(0,Z.jsx)(`button`,{type:`button`,className:`vi-suspensiongen-export solidworks-export-secondary`,onClick:()=>void hd(),children:`Create new folder`}),(0,Z.jsx)(`button`,{type:`submit`,className:`vi-suspensiongen-export`,children:`Export`})]})]})]})}):null,dt?.kind===`invalid-values`?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tabular-input-invalid-warning-title`,children:[(0,Z.jsx)(`h2`,{id:`tabular-input-invalid-warning-title`,children:`Warning: invalid input values`}),(0,Z.jsx)(`p`,{children:`The following values cannot be applied to the current geometry:`}),(0,Z.jsx)(`ul`,{className:`app-warning-list`,children:dt.values.map((e,t)=>(0,Z.jsx)(`li`,{children:e},`${t}-${e}`))}),(0,Z.jsx)(`div`,{className:`app-warning-actions`,children:(0,Z.jsx)(`button`,{type:`button`,onClick:tf,children:`Back to table`})})]})}):null,An?(0,Z.jsx)(`div`,{className:`app-warning-overlay vi-suspensiongen-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`vi-suspensiongen-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`vi-suspensiongen-title`,children:[(0,Z.jsxs)(`header`,{className:`vi-suspensiongen-header`,children:[(0,Z.jsx)(`div`,{className:`vi-suspensiongen-title`,children:(0,Z.jsx)(`h2`,{id:`vi-suspensiongen-title`,children:`Export for VI-SuspensionGen®`})}),(0,Z.jsx)(`button`,{type:`button`,className:`vi-suspensiongen-close`,"aria-label":`Close Export for VI-SuspensionGen`,onClick:()=>jn(!1),children:(0,Z.jsx)(Oe,{size:16,"aria-hidden":`true`})})]}),(0,Z.jsxs)(`form`,{className:`vi-suspensiongen-body`,onSubmit:e=>void kd(e),children:[(0,Z.jsxs)(`fieldset`,{className:`vi-suspensiongen-data`,children:[(0,Z.jsx)(`legend`,{children:`Suspension Data`}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`K Spring [N/mm]`}),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:Mn.kSpring,onChange:e=>Od(`kSpring`,e.target.value)})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`Spring Preload [N]`}),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:Mn.springPreload,onChange:e=>Od(`springPreload`,e.target.value)})]}),(0,Z.jsxs)(`label`,{children:[(0,Z.jsx)(`span`,{children:`C Damper [Ns/mm]`}),(0,Z.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:Mn.cDamper,onChange:e=>Od(`cDamper`,e.target.value)})]})]}),(0,Z.jsxs)(`div`,{className:`vi-suspensiongen-side`,children:[(0,Z.jsxs)(`label`,{className:`vi-suspensiongen-name`,children:[(0,Z.jsx)(`span`,{children:`Suspension Name:`}),(0,Z.jsx)(`input`,{type:`text`,value:Mn.suspensionName,onChange:e=>Od(`suspensionName`,e.target.value)})]}),(0,Z.jsx)(`button`,{type:`submit`,className:`vi-suspensiongen-export`,children:`Export`})]})]})]})}):null,en?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`step-clash-wheel-envelope-title`,children:[(0,Z.jsx)(`h2`,{id:`step-clash-wheel-envelope-title`,children:`Wheel envelope required`}),(0,Z.jsx)(`p`,{children:`Mesh clash detection requires Wheel envelope. Activate it now?`}),(0,Z.jsxs)(`div`,{className:`app-warning-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:Pd,children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,onClick:Nd,children:`Ok`})]})]})}):null,wn?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`wheel-envelope-warning-title`,children:[(0,Z.jsx)(`h2`,{id:`wheel-envelope-warning-title`,children:`Warning`}),(0,Z.jsx)(`p`,{children:wn}),(0,Z.jsxs)(`label`,{className:`app-warning-check`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:En,onChange:e=>Dn(e.target.checked)}),(0,Z.jsx)(`span`,{children:`Don't show this message again`})]}),(0,Z.jsx)(`div`,{className:`app-warning-actions`,children:(0,Z.jsx)(`button`,{type:`button`,onClick:ud,children:`Ok`})})]})}):null,xp(vn?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`rocker-mode-exit-warning-title`,children:[(0,Z.jsx)(`h2`,{id:`rocker-mode-exit-warning-title`,children:`Warning`}),(0,Z.jsx)(`p`,{children:`Apply Rocker mode coordinate changes before exiting?`}),(0,Z.jsxs)(`div`,{className:`app-warning-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:()=>hu(`cancel`),children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:()=>hu(`discard`),children:`No`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>hu(`apply`),children:`Yes`})]})]})}):null),xp(bn?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`full-vehicle-mode-exit-warning-title`,children:[(0,Z.jsx)(`h2`,{id:`full-vehicle-mode-exit-warning-title`,children:`Warning`}),(0,Z.jsx)(`p`,{children:`Apply Full vehicle mode primary axle coordinate changes before exiting?`}),(0,Z.jsxs)(`div`,{className:`app-warning-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:()=>gu(`cancel`),children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:()=>gu(`discard`),children:`No`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>gu(`apply`),children:`Yes`})]})]})}):null),gn?(0,Z.jsx)(`div`,{className:`app-warning-overlay`,role:`presentation`,children:(0,Z.jsxs)(`section`,{className:`app-warning-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`unsaved-warning-title`,children:[(0,Z.jsx)(`h2`,{id:`unsaved-warning-title`,children:`Warning`}),(0,Z.jsx)(`p`,{children:`Exit without saving?`}),(0,Z.jsxs)(`div`,{className:`app-warning-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`secondary`,onClick:()=>mu(!1),children:`Cancel`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>mu(!0),children:`Yes`})]})]})}):null,qr===null?null:(0,Z.jsx)(Nq,{stepIndex:qr,onPrevious:()=>{let e=Math.max(0,qr-1);Ke(!!mI[e]?.openMonitor),Jr(e)},onNext:()=>{let e=Math.min(mI.length-1,qr+1);Ke(!!mI[e]?.openMonitor),Jr(e)},onFinish:Jf})]})}
4420function Fq(){let e=uq(),t=VP(),[n,r]=(0,h.useState)(null);return t?(0,Z.jsx)(VF,{}):e?(0,Z.jsx)(Sq,{view:e}):n?(0,Z.jsx)(Pq,{session:n,onLogout:()=>r(null)}):(0,Z.jsx)(Cq,{onAuthenticated:r})}var Iq=`3dsusp-web.asset-recovery`,Lq=/(?:failed to fetch dynamically imported module|importing a module script failed|loading chunk .* failed|loading css chunk .* failed|unable to preload css)/i;function Rq(){if(sessionStorage.getItem(Iq)===`1`)return;sessionStorage.setItem(Iq,`1`);let e=new URL(window.location.href);e.searchParams.set(`__asset_refresh`,Date.now().toString()),window.location.replace(e.toString())}window.addEventListener(`vite:preloadError`,e=>{e.preventDefault(),Rq()}),window.addEventListener(`error`,e=>{Lq.test(e.message)&&Rq()}),window.addEventListener(`unhandledrejection`,e=>{let t=e.reason instanceof Error?e.reason.message:String(e.reason??``);Lq.test(t)&&Rq()}),(0,Ae.createRoot)(document.getElementById(`root`)).render((0,Z.jsx)(h.StrictMode,{children:(0,Z.jsx)(Fq,{})}));var zq=()=>sessionStorage.removeItem(Iq);document.readyState===`complete`?zq():window.addEventListener(`load`,zq,{once:!0});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.