@fleox/agent3d 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/changelog.json +10 -0
- package/dist/agent/agent3d.mjs +30 -12
- package/dist/agent/chunks/{export-bJwh2SqG.mjs → export-CEX5DFLo.mjs} +79 -3
- package/dist/agent/chunks/{package-fMbw9UGh.mjs → package-DjRnLzcU.mjs} +2 -2
- package/dist/agent/chunks/{tools-Cm4BqDkO.mjs → tools-CZyIc4zw.mjs} +13 -3
- package/dist/runtime/agent3d-photo.js +31 -0
- package/dist/runtime/agent3d-runtime.js +41 -41
- package/dist/runtime/agent3d-runtime.single.js +251 -246
- package/dist/runtime/chunks/assets-kC2Z1Xy_.js +1 -0
- package/dist/runtime/chunks/game-CbQaEB4q.js +20 -0
- package/dist/runtime/chunks/materials-jwhXlLYl.js +107 -0
- package/dist/runtime/chunks/model-CG5T_jcB.js +1 -0
- package/dist/runtime/chunks/num-CQNAlL82.js +1 -0
- package/dist/runtime/chunks/{photo-DNf14X7B.js → photo-w6dwHX7j.js} +25 -20
- package/dist/runtime/chunks/physicsHost-BU-2V-CZ.js +1 -0
- package/dist/runtime/chunks/{postfx-Cbf_vvOr.js → postfx-DnIeKXAh.js} +1 -1
- package/dist/runtime/chunks/postfx-ylpcQcVK.js +1 -0
- package/dist/runtime/chunks/svg-fYjsY-rV.js +1 -0
- package/dist/runtime/chunks/{text-rSo_2Luk.js → text-CySfj5sH.js} +1 -1
- package/dist/runtime/chunks/util-BEflQURG.js +1 -0
- package/dist/studio/assets/assets--ehPZf8R.js +1 -0
- package/dist/studio/assets/camera-C0sxfRxy.js +2 -0
- package/dist/studio/assets/{editor-NkBUKsDB.js → editor-DzyukvQl.js} +1 -1
- package/dist/studio/assets/game-DNpTN_Ga.js +19 -0
- package/dist/studio/assets/{generators-BjIs-kHx.js → generators-BuVeRXnC.js} +5 -5
- package/dist/studio/assets/index-C2nMYSoW.js +479 -0
- package/dist/studio/assets/model-DQgOrTs4.js +2 -0
- package/dist/studio/assets/num-CQNAlL82.js +1 -0
- package/dist/studio/assets/{params-DhsDKSDs.js → params-D-Ul6GSt.js} +1 -1
- package/dist/studio/assets/{photo-DAHd1yNF.js → photo-Dx2IBJ11.js} +25 -20
- package/dist/studio/assets/physicsHost-z9qn_mpg.js +1 -0
- package/dist/studio/assets/{postfx-BGu30OJK.js → postfx-B3jDEaEK.js} +13 -13
- package/dist/studio/assets/runtime-rd9RW3WH.js +572 -0
- package/dist/studio/assets/{shaders-Dt6FGXH_.js → shaders-bFhELLmD.js} +1 -1
- package/dist/studio/assets/svg-BkV9LeqP.js +2 -0
- package/dist/studio/assets/{text-B-HM422i.js → text-Dp8gdjSA.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/agent3d-assets/SKILL.md +26 -26
- package/plugin/skills/agent3d-create/SKILL.md +26 -26
- package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
- package/plugin/skills/agent3d-create/references/recipes.md +6 -6
- package/plugin/skills/agent3d-edit/SKILL.md +22 -22
- package/plugin/skills/agent3d-edit/references/patch-ops.md +2 -2
- package/plugin/skills/agent3d-game/SKILL.md +7 -7
- package/plugin/skills/agent3d-publish/SKILL.md +24 -22
- package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
- package/dist/runtime/chunks/assets-qnxDnVkj.js +0 -1
- package/dist/runtime/chunks/game-BoEiyZrL.js +0 -20
- package/dist/runtime/chunks/materials-dC4vDNHh.js +0 -107
- package/dist/runtime/chunks/model-BCAl_NRl.js +0 -1
- package/dist/runtime/chunks/physicsHost-ChPgysMQ.js +0 -1
- package/dist/runtime/chunks/postfx-CFucYRev.js +0 -1
- package/dist/runtime/chunks/svg-CLUxY6Zy.js +0 -1
- package/dist/runtime/chunks/util-CyaW1fcW.js +0 -1
- package/dist/studio/assets/assets-BW5lQkYR.js +0 -1
- package/dist/studio/assets/camera-BgzPVnn-.js +0 -2
- package/dist/studio/assets/game-DARpu0ah.js +0 -19
- package/dist/studio/assets/index-L-N-e2KM.js +0 -479
- package/dist/studio/assets/model-CqI8j03Z.js +0 -2
- package/dist/studio/assets/physicsHost-tEUto2-_.js +0 -1
- package/dist/studio/assets/runtime-C_qkIpAK.js +0 -572
- package/dist/studio/assets/svg-ZZt5MdNf.js +0 -2
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./runtime-rd9RW3WH.js","./three.module-CnI50X0U.js","./camera-C0sxfRxy.js","./num-CQNAlL82.js","./assets--ehPZf8R.js","./params-D-Ul6GSt.js","./editor-DzyukvQl.js","./OrbitControls-MlE9XiCg.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{Kt as e,Ln as t,N as n,Vn as r,bt as i}from"./three.module-CnI50X0U.js";(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),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var a=r((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.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.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`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},ee=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 te(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ne=/\/+/g;function re(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function ie(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(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 ae(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,ae(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+re(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(ne,`$&/`)+`/`),ae(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ne,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+re(a,u),c+=ae(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+re(a,u++),c+=ae(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ae(ie(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 oe(e,t,n){if(e==null)return e;var r=[],i=0;return ae(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function se(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ce=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)};function le(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,ce)}catch(e){ce(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function ue(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else le(ue.bind(null,e))}var de={map:oe,forEach:function(e,t,n){oe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return oe(e,function(){t++}),t},toArray:function(e){return oe(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=de,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=ue,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=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ee.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)ee.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=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:se}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=le,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),o=r(((e,t)=>{t.exports=a()})),s=r((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,te());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function E(){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&&ee());){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&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(E)};else if(typeof MessageChannel<`u`){var D=new MessageChannel,O=D.port2;D.port1.onmessage=E,te=function(){O.postMessage(null)}}else te=function(){_(E,0)};function ne(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,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),c=r(((e,t)=>{t.exports=s()})),l=r((e=>{var t=o();function n(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 r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(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=i,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return l(e,t,null,r)},e.flushSync=function(e){var t=u.T,n=i.p;try{if(u.T=null,i.p=2,e)return e()}finally{u.T=t,i.p=n,i.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,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,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=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.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=d(n,t.crossOrigin);i.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=d(t.as,t.crossOrigin);i.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,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.1`})),u=r(((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=l()})),d=r((e=>{var t=c(),n=o(),r=u();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function l(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(s(e)!==e)throw Error(i(188))}function p(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return f(a),e;if(o===r)return f(a),t;o=o.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=o;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=o;break}if(l===r){c=!0,r=a,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=a;break}if(l===r){c=!0,r=o,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(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}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ee(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var E=Object.assign,te=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),ne=Symbol.for(`react.fragment`),re=Symbol.for(`react.strict_mode`),ie=Symbol.for(`react.profiler`),ae=Symbol.for(`react.consumer`),oe=Symbol.for(`react.context`),se=Symbol.for(`react.forward_ref`),ce=Symbol.for(`react.suspense`),le=Symbol.for(`react.suspense_list`),ue=Symbol.for(`react.memo`),de=Symbol.for(`react.lazy`),fe=Symbol.for(`react.activity`),pe=Symbol.for(`react.legacy_hidden`),me=Symbol.for(`react.memo_cache_sentinel`),he=Symbol.for(`react.view_transition`),ge=Symbol.for(`react.recoverable`),_e=Symbol.iterator;function ve(e){return typeof e!=`object`||!e?null:(e=_e&&e[_e]||e[`@@iterator`],typeof e==`function`?e:null)}var ye=Symbol.for(`react.client.reference`);function be(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ye?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ne:return`Fragment`;case ie:return`Profiler`;case re:return`StrictMode`;case ce:return`Suspense`;case le:return`SuspenseList`;case fe:return`Activity`;case he:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case oe:return e.displayName||`Context`;case ae:return(e._context.displayName||`Context`)+`.Consumer`;case se:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ue:return t=e.displayName||null,t===null?be(e.type)||`Memo`:t;case de:t=e._payload,e=e._init;try{return be(e(t))}catch{}}return null}var xe=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Se=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ce={pending:!1,data:null,method:null,action:null},we=[],Te=-1;function Ee(e){return{current:e}}function De(e){0>Te||(e.current=we[Te],we[Te]=null,Te--)}function Oe(e,t){Te++,we[Te]=e.current,e.current=t}var ke=Ee(null),Ae=Ee(null),je=Ee(null),Me=Ee(null);function Ne(e,t){switch(Oe(je,t),Oe(Ae,e),Oe(ke,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yp(t),e=bp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}De(ke),Oe(ke,e)}function Pe(){De(ke),De(Ae),De(je)}function Fe(e){var t=e.memoizedState;t!==null&&(hh._currentValue=t.memoizedState,Oe(Me,e)),t=ke.current;var n=bp(t,e.type);t!==n&&(Oe(Ae,e),Oe(ke,n))}function Ie(e){Ae.current===e&&(De(ke),De(Ae)),Me.current===e&&(De(Me),hh._currentValue=Ce)}var Le,Re;function ze(e){if(Le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Le=t&&t[1]||``,Re=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+Le+e+Re}var Be=!1;function Ve(e,t){if(!e||Be)return``;Be=!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}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}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(`
|
|
5
|
+
`),l=s.split(`
|
|
6
|
+
`);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=`
|
|
7
|
+
`+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{Be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ze(n):``}function He(e,t){switch(e.tag){case 26:case 27:case 5:return ze(e.type);case 16:return ze(`Lazy`);case 13:return e.child!==t&&t!==null?ze(`Suspense Fallback`):ze(`Suspense`);case 19:return ze(`SuspenseList`);case 0:case 15:return Ve(e.type,!1);case 11:return Ve(e.type.render,!1);case 1:return Ve(e.type,!0);case 31:return ze(`Activity`);case 30:return ze(`ViewTransition`);default:return``}}function Ue(e){try{var t=``,n=null;do t+=He(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var We=Object.prototype.hasOwnProperty,Ge=t.unstable_scheduleCallback,Ke=t.unstable_cancelCallback,qe=t.unstable_shouldYield,Je=t.unstable_requestPaint,Ye=t.unstable_now,Xe=t.unstable_getCurrentPriorityLevel,Ze=t.unstable_ImmediatePriority,Qe=t.unstable_UserBlockingPriority,$e=t.unstable_NormalPriority,et=t.unstable_LowPriority,tt=t.unstable_IdlePriority,nt=t.log,rt=t.unstable_setDisableYieldValue,it=null,at=null;function ot(e){if(typeof nt==`function`&&rt(e),at&&typeof at.setStrictMode==`function`)try{at.setStrictMode(it,e)}catch{}}var st=Math.clz32?Math.clz32:ut,ct=Math.log,lt=Math.LN2;function ut(e){return e>>>=0,e===0?32:31-(ct(e)/lt|0)|0}var dt=256,ft=262144,pt=4194304;function mt(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&-e;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 ht(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=mt(n))):i=mt(o):i=mt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=mt(n))):i=mt(o)):i=mt(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 gt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function _t(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-st(n),i=1<<r;t|=e[r],n&=~i}return t}function vt(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 yt(){var e=pt;return pt<<=1,!(pt&62914560)&&(pt=4194304),e}function bt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function xt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function St(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-st(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&&Ct(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ct(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-st(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function wt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-st(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Tt(e,t){var n=t&-t;return n=n&42?1:Et(n),(n&(e.suspendedLanes|t))===0?n:0}function Et(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 Dt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ot(){var e=Se.p;return e===0?(e=window.event,e===void 0?32:Oh(e.type)):e}function kt(e,t){var n=Se.p;try{return Se.p=e,t()}finally{Se.p=n}}var At=Math.random().toString(36).slice(2),jt=`__reactFiber$`+At,Mt=`__reactProps$`+At,Nt=`__reactContainer$`+At,Pt=`__reactEvents$`+At,Ft=`__reactListeners$`+At,It=`__reactHandles$`+At,Lt=`__reactResources$`+At,Rt=`__reactMarker$`+At,zt=`__reactLoad$`+At;function Bt(e){delete e[jt],delete e[Mt],delete e[Ft],delete e[It]}function Vt(e){var t;if(t=e[jt])return t;for(var n=e.parentNode;n;){if(t=n[Nt]||n[jt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bm(e);e!==null;){if(n=e[jt])return n;e=bm(e)}return t}e=n,n=e.parentNode}return null}function Ht(e){if(e=e[jt]||e[Nt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ut(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Wt(e){var t=e[Lt];return t||=e[Lt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Gt(e){e[Rt]=!0}function Kt(e){e[zt]=void 0}var qt=new Set,Jt={};function Yt(e,t){Xt(e,t),Xt(e+`Capture`,t)}function Xt(e,t){for(Jt[e]=t,e=0;e<t.length;e++)qt.add(t[e])}var Zt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Qt={},$t={};function en(e){return We.call($t,e)?!0:We.call(Qt,e)?!1:Zt.test(e)?$t[e]=!0:(Qt[e]=!0,!1)}var tn=!1;function nn(){var e=tn;return tn=!1,e}function rn(e,t,n){if(en(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 an(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 on(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 sn(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function cn(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ln(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 un(e){if(!e._valueTracker){var t=cn(e)?`checked`:`value`;e._valueTracker=ln(e,t,``+e[t])}}function dn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=cn(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var fn=/[\n"\\]/g;function pn(e){return e.replace(fn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function mn(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=``+sn(t)):e.value!==``+sn(t)&&(e.value=``+sn(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):gn(e,sn(n)):o===`number`&&e.value==t?gn(e,sn(e.value)):gn(e,sn(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=``+sn(s):e.removeAttribute(`name`)}function hn(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)){un(e);return}n=n==null?``:``+sn(n),t=t==null?n:``+sn(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),un(e)}function gn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function _n(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=``+sn(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 vn(e,t,n){t!=null&&(t=``+sn(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+sn(n)}function yn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(xe(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=sn(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),un(e)}function bn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xn=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 Sn(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||xn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Cn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(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]=``,tn=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(Sn(e,a,r),tn=!0)}else for(var o in t)t.hasOwnProperty(o)&&Sn(e,o,t[o])}function wn(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 Tn=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`],[`maskType`,`mask-type`],[`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`]]),En=/^[\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 Dn(e){return En.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function On(){}var kn=null;function An(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var jn=null,Mn=null;function Nn(e){var t=Ht(e);if(t&&(e=t.stateNode)){var n=e[Mt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(mn(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="`+pn(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[Mt]||null;if(!a)throw Error(i(90));mn(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&dn(r)}break a;case`textarea`:vn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&_n(e,!!n.multiple,t,!1)}}}var Pn=!1;function Fn(e,t,n){if(Pn)return e(t,n);Pn=!0;try{return e(t)}finally{if(Pn=!1,(jn!==null||Mn!==null)&&(Kd(),jn&&(t=jn,e=Mn,Mn=jn=null,Nn(t),e)))for(t=0;t<e.length;t++)Nn(e[t])}}function In(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Mt]||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(i(231,t,typeof n));return n}var Ln=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Rn=!1;if(Ln)try{var zn={};Object.defineProperty(zn,"passive",{get:function(){Rn=!0}}),window.addEventListener(`test`,zn,zn),window.removeEventListener(`test`,zn,zn)}catch{Rn=!1}var Bn=null,Vn=null,Hn=null;function Un(){if(Hn)return Hn;var e,t=Vn,n=t.length,r,i=`value`in Bn?Bn.value:Bn.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 Hn=i.slice(e,1<r?1-r:void 0)}function Wn(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 Gn(){return!0}function Kn(){return!1}function qn(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)?Gn:Kn,this.isPropagationStopped=Kn,this}return E(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=Gn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Gn)},persist:function(){},isPersistent:Gn}),t}var Jn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yn=qn(Jn),Xn=E({},Jn,{view:0,detail:0}),Zn=qn(Xn),Qn,$n,er,tr=E({},Xn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fr,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!==er&&(er&&e.type===`mousemove`?(Qn=e.screenX-er.screenX,$n=e.screenY-er.screenY):$n=Qn=0,er=e),Qn)},movementY:function(e){return`movementY`in e?e.movementY:$n}}),nr=qn(tr),rr=qn(E({},tr,{dataTransfer:0})),ir=qn(E({},Xn,{relatedTarget:0})),ar=qn(E({},Jn,{animationName:0,elapsedTime:0,pseudoElement:0})),or=qn(E({},Jn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),sr=qn(E({},Jn,{data:0})),cr={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},lr={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},ur={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function dr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ur[e])?!!t[e]:!1}function fr(){return dr}var pr=qn(E({},Xn,{key:function(e){if(e.key){var t=cr[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Wn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?lr[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fr,charCode:function(e){return e.type===`keypress`?Wn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Wn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),mr=qn(E({},tr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),hr=qn(E({},Jn,{submitter:0})),gr=qn(E({},Xn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fr})),_r=qn(E({},Jn,{propertyName:0,elapsedTime:0,pseudoElement:0})),vr=qn(E({},tr,{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})),yr=qn(E({},Jn,{newState:0,oldState:0,source:0})),br=[9,13,27,32],xr=Ln&&`CompositionEvent`in window,Sr=null;Ln&&`documentMode`in document&&(Sr=document.documentMode);var Cr=Ln&&`TextEvent`in window&&!Sr,wr=Ln&&(!xr||Sr&&8<Sr&&11>=Sr),Tr=` `,Er=!1;function Dr(e,t){switch(e){case`keyup`:return br.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Or(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var kr=!1;function Ar(e,t){switch(e){case`compositionend`:return Or(t);case`keypress`:return t.which===32?(Er=!0,Tr):null;case`textInput`:return e=t.data,e===Tr&&Er?null:e;default:return null}}function jr(e,t){if(kr)return e===`compositionend`||!xr&&Dr(e,t)?(e=Un(),Hn=Vn=Bn=null,kr=!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 wr&&t.locale!==`ko`?null:t.data;default:return null}}var Mr={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 Nr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Mr[e.type]:t===`textarea`}function Pr(e,t,n,r){jn?Mn?Mn.push(r):Mn=[r]:jn=r,t=np(t,`onChange`),0<t.length&&(n=new Yn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Fr=null,Ir=null;function Lr(e){Yf(e,0)}function Rr(e){if(dn(Ut(e)))return e}function zr(e,t){if(e===`change`)return t}var Br=!1;if(Ln){var Vr;if(Ln){var Hr=`oninput`in document;if(!Hr){var Ur=document.createElement(`div`);Ur.setAttribute(`oninput`,`return;`),Hr=typeof Ur.oninput==`function`}Vr=Hr}else Vr=!1;Br=Vr&&(!document.documentMode||9<document.documentMode)}function Wr(){Fr&&(Fr.detachEvent(`onpropertychange`,Gr),Ir=Fr=null)}function Gr(e){if(e.propertyName===`value`&&Rr(Ir)){var t=[];Pr(t,Ir,e,An(e)),Fn(Lr,t)}}function Kr(e,t,n){e===`focusin`?(Wr(),Fr=t,Ir=n,Fr.attachEvent(`onpropertychange`,Gr)):e===`focusout`&&Wr()}function qr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Rr(Ir)}function Jr(e,t){if(e===`click`)return Rr(t)}function Yr(e,t){if(e===`input`||e===`change`)return Rr(t)}function Xr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Zr=typeof Object.is==`function`?Object.is:Xr;function Qr(e,t){if(Zr(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(!We.call(t,i)||!Zr(e[i],t[i]))return!1}return!0}function $r(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function ei(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ti(e,t){var n=ei(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=ei(n)}}function ni(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ni(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ri(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=$r(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=$r(e.document)}return t}function ii(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 ai=Ln&&`documentMode`in document&&11>=document.documentMode,oi=null,si=null,ci=null,li=!1;function ui(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;li||oi==null||oi!==$r(r)||(r=oi,`selectionStart`in r&&ii(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ci&&Qr(ci,r)||(ci=r,r=np(si,`onSelect`),0<r.length&&(t=new Yn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=oi)))}function di(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var fi={animationend:di(`Animation`,`AnimationEnd`),animationiteration:di(`Animation`,`AnimationIteration`),animationstart:di(`Animation`,`AnimationStart`),transitionrun:di(`Transition`,`TransitionRun`),transitionstart:di(`Transition`,`TransitionStart`),transitioncancel:di(`Transition`,`TransitionCancel`),transitionend:di(`Transition`,`TransitionEnd`)},pi={},mi={};Ln&&(mi=document.createElement(`div`).style,`AnimationEvent`in window||(delete fi.animationend.animation,delete fi.animationiteration.animation,delete fi.animationstart.animation),`TransitionEvent`in window||delete fi.transitionend.transition);function hi(e){if(pi[e])return pi[e];if(!fi[e])return e;var t=fi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in mi)return pi[e]=t[n];return e}var gi=hi(`animationend`),_i=hi(`animationiteration`),vi=hi(`animationstart`),yi=hi(`transitionrun`),bi=hi(`transitionstart`),xi=hi(`transitioncancel`),Si=hi(`transitionend`),Ci=new Map,wi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(` `);wi.push(`scrollEnd`);function Ti(e,t){Ci.set(e,t),Yt(t,[e])}var Ei=0;function A(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=Dd.identifierPrefix;var n=Ei++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function Di(e){if(e==null||typeof e==`string`)return e;var t=null,n=Fd;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function Oi(e,t){return e=Di(e),t=Di(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var ki=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)},Ai=[],ji=0,Mi=0;function Ni(){for(var e=ji,t=Mi=ji=0;t<e;){var n=Ai[t];Ai[t++]=null;var r=Ai[t];Ai[t++]=null;var i=Ai[t];Ai[t++]=null;var a=Ai[t];if(Ai[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&&M(n,i,a)}}function Pi(e,t,n,r){Ai[ji++]=e,Ai[ji++]=t,Ai[ji++]=n,Ai[ji++]=r,Mi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Fi(e,t,n,r){return Pi(e,t,n,r),Ii(e)}function j(e,t){return Pi(e,null,null,t),Ii(e)}function M(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-st(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Ii(e){if(50<Id)throw Id=0,Ld=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Li={};function Ri(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 zi(e,t,n,r){return new Ri(e,t,n,r)}function Bi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vi(e,t){var n=e.alternate;return n===null?(n=zi(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&1206910976,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 Hi(e,t){e.flags&=1206910978;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 Ui(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Bi(r)&&(s=1);else if(typeof r==`string`)s=th(e,n,ke.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case fe:return e=zi(31,n,t,a),e.elementType=fe,e.lanes=o,e;case ne:return N(n.children,a,o,t);case re:s=8,a|=24;break;case ie:return e=zi(12,n,t,a|2),e.elementType=ie,e.lanes=o,e;case ce:return e=zi(13,n,t,a),e.elementType=ce,e.lanes=o,e;case le:return e=zi(19,n,t,a),e.elementType=le,e.lanes=o,e;case pe:case he:return e=a|32,e=zi(30,n,t,e),e.elementType=he,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case oe:s=10;break a;case ae:s=9;break a;case se:s=11;break a;case ue:s=14;break a;case de:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=zi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function N(e,t,n,r){return e=zi(7,e,r,t),e.lanes=n,e}function P(e,t,n){return e=zi(6,e,null,t),e.lanes=n,e}function F(e){var t=zi(18,null,null,0);return t.stateNode=e,t}function I(e,t,n){return t=zi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var L=new WeakMap;function Wi(e,t){if(typeof e==`object`&&e){var n=L.get(e);return n===void 0?(t={value:e,source:t,stack:Ue(t)},L.set(e,t),t):n}return{value:e,source:t,stack:Ue(t)}}var Gi=[],Ki=0,qi=null,Ji=0,Yi=[],Xi=0,Zi=null,Qi=1,$i=``;function ea(e,t){Gi[Ki++]=Ji,Gi[Ki++]=qi,qi=e,Ji=t}function ta(e,t,n){Yi[Xi++]=Qi,Yi[Xi++]=$i,Yi[Xi++]=Zi,Zi=e;var r=Qi;e=$i;var i=32-st(r)-1;r&=~(1<<i),n+=1;var a=32-st(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Qi=1<<32-st(t)+i|n<<i|r,$i=a+e}else Qi=1<<a|n<<i|r,$i=e}function na(e){e.return!==null&&(ea(e,1),ta(e,1,0))}function ra(e){for(;e===qi;)qi=Gi[--Ki],Gi[Ki]=null,Ji=Gi[--Ki],Gi[Ki]=null;for(;e===Zi;)Zi=Yi[--Xi],Yi[Xi]=null,$i=Yi[--Xi],Yi[Xi]=null,Qi=Yi[--Xi],Yi[Xi]=null}function ia(e,t){Yi[Xi++]=Qi,Yi[Xi++]=$i,Yi[Xi++]=Zi,Qi=t.id,$i=t.overflow,Zi=e}var aa=null,oa=null,R=!1,sa=null,ca=!1,la=Error(i(519));function ua(e){throw ga(Wi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),la}function da(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[jt]=e,t[Mt]=r,n){case`dialog`:W(`cancel`,t),W(`close`,t);break;case`iframe`:case`object`:case`embed`:W(`load`,t);break;case`video`:case`audio`:for(n=0;n<qf.length;n++)W(qf[n],t);break;case`source`:W(`error`,t);break;case`img`:case`image`:case`link`:W(`error`,t),W(`load`,t);break;case`details`:W(`toggle`,t);break;case`input`:W(`invalid`,t),hn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:W(`invalid`,t);break;case`textarea`:W(`invalid`,t),yn(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||cp(t.textContent,n)?(r.popover!=null&&(W(`beforetoggle`,t),W(`toggle`,t)),r.onScroll!=null&&W(`scroll`,t),r.onScrollEnd!=null&&W(`scrollend`,t),r.onClick!=null&&(t.onclick=On),t=!0):t=!1,t||ua(e,!0)}function fa(e){for(aa=e.return;aa;)switch(aa.tag){case 5:case 31:case 13:ca=!1;return;case 27:case 3:ca=!0;return;default:aa=aa.return}}function pa(e){if(e!==aa)return!1;if(!R)return fa(e),R=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Sp(e.type,e.memoizedProps)),n=!n),n&&oa&&ua(e),fa(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));oa=ym(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));oa=ym(e)}else t===27?(t=oa,jp(e.type)?(e=vm,vm=null,oa=e):oa=t):oa=aa?_m(e.stateNode.nextSibling):null;return!0}function ma(){oa=aa=null,R=!1}function ha(){var e=sa;return e!==null&&(yd===null?yd=e:yd.push.apply(yd,e),sa=null),e}function ga(e){sa===null?sa=[e]:sa.push(e)}var _a=Ee(null),va=null,ya=null;function ba(e,t,n){Oe(_a,t._currentValue),t._currentValue=n}function xa(e){e._currentValue=_a.current,De(_a)}function Sa(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 Ca(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Sa(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Sa(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),Sa(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function wa(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Zr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Me.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[hh]:e.push(hh))}a=a.return}return e!==null&&Ca(t,e,n,r),t.flags|=262144,e!==null}function Ta(e){for(e=e.firstContext;e!==null;){if(!Zr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ea(e){va=e,ya=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Da(e){return ka(va,e)}function Oa(e,t){return va===null&&Ea(e),ka(e,t)}function ka(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ya===null){if(e===null)throw Error(i(308));ya=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ya=ya.next=t;return n}var Aa=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()})}},ja=t.unstable_scheduleCallback,Ma=t.unstable_NormalPriority,Na={$$typeof:oe,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Pa(){return{controller:new Aa,data:new Map,refCount:0}}function Fa(e){e.refCount--,e.refCount===0&&ja(Ma,function(){e.controller.abort()})}function Ia(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var La=null;function Ra(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var za=null,Ba=0,Va=0,Ha=null;function Ua(e,t){if(za===null){var n=za=[];Ba=0,Va=Hf(),Ha={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ba++,t.then(Wa,Wa),t}function Wa(){if(--Ba===0&&(La=null,za!==null)){Ha!==null&&(Ha.status=`fulfilled`);var e=za;za=null,Va=0,Ha=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ga(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 Ka=k.S;k.S=function(e,t){if(Sd=Ye(),typeof t==`object`&&t&&typeof t.then==`function`&&Ua(e,t),La!==null)for(var n=Of;n!==null;)Ia(n,La),n=n.next;if(n=e.types,n!==null){for(var r=Of;r!==null;)Ia(r,n),r=r.next;if(Va!==0){r=La,r===null&&(r=La=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ka!==null&&Ka(e,t)};var qa=Ee(null);function Ja(){var e=qa.current;return e===null?ad.pooledCache:e}function Ya(e,t){t===null?Oe(qa,qa.current):Oe(qa,t.pool)}function Xa(){var e=Ja();return e===null?null:{parent:Na._currentValue,pool:e}}var Za=Error(i(460)),Qa=Error(i(474)),$a=Error(i(542)),eo={then:function(){}};function to(e){return e=e.status,e===`fulfilled`||e===`rejected`}function no(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(On,On),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,oo(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(On,On);else{if(e=ad,e!==null&&100<e.shellSuspendCounter)throw Error(i(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,oo(e),e}throw io=t,Za}}function ro(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(io=e,Za):e}}var io=null;function ao(){if(io===null)throw Error(i(459));var e=io;return io=null,e}function oo(e){if(e===Za||e===$a)throw Error(i(483))}var so=null,co=0;function lo(e){var t=co;return co+=1,so===null&&(so=[]),no(so,e,t)}function uo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function fo(e,t){throw t.$$typeof===te?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function po(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 a(e,t){return e=Vi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=P(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===ne?(e=d(e,t,n.props.children,r,n.key),uo(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===de&&ro(i)===t.type)?(t=a(t,n.props),uo(t,n),t.return=e,t):(t=Ui(n.type,n.key,n.props,null,e.mode,r),uo(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=I(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=N(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=P(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case D:return n=Ui(t.type,t.key,t.props,null,e.mode,n),uo(n,t),n.return=e,n;case O:return t=I(t,e.mode,n),t.return=e,t;case de:return t=ro(t),f(e,t,n)}if(xe(t)||ve(t))return t=N(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,lo(t),n);if(t.$$typeof===oe)return f(e,Oa(e,t),n);fo(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 D:return n.key===i?l(e,t,n,r):null;case O:return n.key===i?u(e,t,n,r):null;case de:return n=ro(n),p(e,t,n,r)}if(xe(n)||ve(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,lo(n),r);if(n.$$typeof===oe)return p(e,t,Oa(e,n),r);fo(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 D:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case O:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case de:return r=ro(r),m(e,t,n,r,i)}if(xe(r)||ve(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,lo(r),i);if(r.$$typeof===oe)return m(e,t,n,Oa(t,r),i);fo(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=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),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),R&&ea(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return R&&ea(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(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),R&&ea(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),R&&ea(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return R&&ea(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),R&&ea(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===ne&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case D:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===ne){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),uo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===de&&ro(l)===r.type){n(e,r.sibling),c=a(r,o.props),uo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===ne?(c=N(o.props.children,e.mode,c,o.key),uo(c,o),c.return=e,e=c):(c=Ui(o.type,o.key,o.props,null,e.mode,c),uo(c,o),c.return=e,e=c)}return s(e);case O:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=I(o,e.mode,c),c.return=e,e=c}return s(e);case de:return o=ro(o),_(e,r,o,c)}if(xe(o))return h(e,r,o,c);if(ve(o)){if(l=ve(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,lo(o),c);if(o.$$typeof===oe)return _(e,r,Oa(e,o),c);fo(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=P(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{co=0;var i=_(e,t,n,r);return so=null,i}catch(t){if(t===Za||t===$a)throw t;var a=zi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var mo=po(!0),ho=po(!1),go=!1;function _o(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vo(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 yo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function bo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,id&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Ii(e),M(e,null,n),t}return Pi(e,r,t,n),Ii(e)}function xo(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,wt(e,n)}}function So(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}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Co=!1;function wo(){if(Co){var e=Ha;if(e!==null)throw e}}function To(e,t,n,r){Co=!1;var i=e.updateQueue;go=!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?(U&f)===f:(r&f)===f){f!==0&&f===Va&&(Co=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=E({},d,f);break a;case 2:go=!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),pd|=o,e.lanes=o,e.memoizedState=d}}function Eo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Do(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Eo(n[e],t)}var Oo=Ee(null),ko=Ee(0);function Ao(e,t){e=dd,Oe(ko,e),Oe(Oo,t),dd=e|t.baseLanes}function jo(){Oe(ko,dd),Oe(Oo,Oo.current)}function Mo(){dd=ko.current,De(Oo),De(ko)}var No=Ee(null),Po=null;function Fo(e){var t=e.alternate;Oe(Bo,Bo.current&1),Oe(No,e),Po===null&&(t===null||Oo.current!==null||t.memoizedState!==null)&&(Po=e)}function Io(e){Oe(Bo,Bo.current),Oe(No,e),Po===null&&(Po=e)}function Lo(e){e.tag===22?(Oe(Bo,Bo.current),Oe(No,e),Po===null&&(Po=e)):Ro()}function Ro(){Oe(Bo,Bo.current),Oe(No,No.current)}function zo(e){De(No),Po===e&&(Po=null),De(Bo)}var Bo=Ee(0);function Vo(e,t){Oe(No,No.current),Oe(Bo,t)}function Ho(e){De(Bo),De(No),Po===e&&(Po=null)}function Uo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||mm(n)||hm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){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 Wo=0,z=null,Go=null,Ko=null,qo=!1,Jo=!1,Yo=!1,Xo=0,Zo=0,Qo=null,$o=0;function es(){throw Error(i(321))}function ts(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Zr(e[n],t[n]))return!1;return!0}function ns(e,t,n,r,i,a){return Wo=a,z=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?vc:yc,Yo=!1,a=n(r,i),Yo=!1,Jo&&(a=is(t,n,r,i)),rs(e),a}function rs(e){k.H=_c;var t=Go!==null&&Go.next!==null;if(Wo=0,Ko=Go=z=null,qo=!1,Zo=0,Qo=null,t)throw Error(i(300));e===null||Ic||(e=e.dependencies,e!==null&&Ta(e)&&(Ic=!0))}function is(e,t,n,r){z=e;var a=0;do{if(Jo&&(Qo=null),Zo=0,Jo=!1,25<=a)throw Error(i(301));if(a+=1,Ko=Go=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}k.H=bc,o=t(n,r)}while(Jo);return o}function as(){var e=k.H,t=e.useState()[0];return t=typeof t.then==`function`?fs(t):t,e=e.useState()[0],(Go===null?null:Go.memoizedState)!==e&&(z.flags|=1024),t}function os(){var e=Xo!==0;return Xo=0,e}function ss(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function cs(e){if(qo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}qo=!1}Wo=0,Ko=Go=z=null,Jo=!1,Zo=Xo=0,Qo=null}function ls(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ko===null?z.memoizedState=Ko=e:Ko=Ko.next=e,Ko}function us(){if(Go===null){var e=z.alternate;e=e===null?null:e.memoizedState}else e=Go.next;var t=Ko===null?z.memoizedState:Ko.next;if(t!==null)Ko=t,Go=e;else{if(e===null)throw z.alternate===null?Error(i(467)):Error(i(310));Go=e,e={memoizedState:Go.memoizedState,baseState:Go.baseState,baseQueue:Go.baseQueue,queue:Go.queue,next:null},Ko===null?z.memoizedState=Ko=e:Ko=Ko.next=e}return Ko}function ds(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fs(e){var t=Zo;return Zo+=1,Qo===null&&(Qo=[]),e=no(Qo,e,t),t=z,(Ko===null?t.memoizedState:Ko.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?vc:yc),e}function ps(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return fs(e);if(e.$$typeof===ge)return;if(e.$$typeof===oe)return Da(e)}throw Error(i(438,String(e)))}function ms(e){var t=null,n=z.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=z.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=ds(),z.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]=me;return t.index++,n}function hs(e,t){return typeof t==`function`?t(e):t}function gs(e){return _s(us(),Go,e)}function _s(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Wo&f)===f:(U&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===Va&&(d=!0);else if((Wo&p)===p){u=u.next,p===Va&&(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,s=o):l=l.next=f,z.lanes|=p,pd|=p;f=u.action,Yo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,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,s=o):l=l.next=p,z.lanes|=f,pd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Zr(o,e.memoizedState)&&(Ic=!0,d&&(n=Ha,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function vs(e){var t=us(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Zr(o,t.memoizedState)||(Ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ys(e,t,n){var r=z,a=us(),o=R;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Zr((Go||a).memoizedState,n);if(s&&(a.memoizedState=n,Ic=!0),a=a.queue,Us(Ss.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Ko!==null&&!!(Ko.memoizedState.tag&1),Rs(e?9:8,{destroy:void 0},xs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,ad===null)throw Error(i(349));o||Wo&127||bs(r,t,n)}return n}function bs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=z.updateQueue,t===null?(t=ds(),z.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function xs(e,t,n,r){t.value=n,t.getSnapshot=r,Cs(t)&&ws(e)}function Ss(e,t,n){return n(function(){Cs(t)&&ws(e)})}function Cs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Zr(e,n)}catch{return!0}}function ws(e){var t=j(e,2);t!==null&&Vd(t,e,2)}function B(e){var t=ls();if(typeof e==`function`){var n=e;if(e=n(),Yo){ot(!0);try{n()}finally{ot(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:e},t}function Ts(e,t,n,r){return e.baseState=n,_s(e,Go,typeof r==`function`?r:hs)}function Es(e,t,n,r,a){if(mc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};k.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ds(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ds(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=k.T,o={};o.types=a===null?null:a.types,k.T=o;try{var s=n(i,r),c=k.S;c!==null&&c(o,s),Os(e,t,s)}catch(n){As(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),k.T=a}}else try{a=n(i,r),Os(e,t,a)}catch(n){As(e,t,n)}}function Os(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ks(e,t,n)},function(n){return As(e,t,n)}):ks(e,t,n)}function ks(e,t,n){t.status=`fulfilled`,t.value=n,js(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ds(e,n)))}function As(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,js(t),t=t.next;while(t!==r)}e.action=null}function js(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ms(e,t){return t}function Ns(e,t){if(R){var n=ad.formState;if(n!==null){a:{var r=z;if(R){if(oa){b:{for(var i=oa,a=ca;i.nodeType!==8;)if(!a||(i=_m(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){oa=_m(i.nextSibling),r=i.data===`F!`;break a}}ua(r)}r=!1}r&&(t=n[0])}}return n=ls(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:t},n.queue=r,n=dc.bind(null,z,r),r.dispatch=n,r=B(!1),a=pc.bind(null,z,!1,r.queue),r=ls(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Es.bind(null,z,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ps(e){return Fs(us(),Go,e)}function Fs(e,t,n){if(t=_s(e,t,Ms)[0],e=gs(hs)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=fs(t)}catch(e){throw e===Za?$a:e}else r=t;t=us();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(z.flags|=2048,Rs(9,{destroy:void 0},Is.bind(null,i,n),null)),[r,a,e]}function Is(e,t){e.action=t}function Ls(e){var t=us(),n=Go;if(n!==null)return Fs(t,n,e);us(),t=t.memoizedState,n=us();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Rs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=z.updateQueue,t===null&&(t=ds(),z.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 zs(){return us().memoizedState}function Bs(e,t,n,r){var i=ls();z.flags|=e,i.memoizedState=Rs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Vs(e,t,n,r){var i=us();r=r===void 0?null:r;var a=i.memoizedState.inst;Go!==null&&r!==null&&ts(r,Go.memoizedState.deps)?i.memoizedState=Rs(t,a,n,r):(z.flags|=e,i.memoizedState=Rs(1|t,a,n,r))}function Hs(e,t){Bs(8390656,8,e,t)}function Us(e,t){Vs(2048,8,e,t)}function Ws(e){z.flags|=4;var t=z.updateQueue;if(t===null)t=ds(),z.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Gs(e){var t=us().memoizedState;return Ws({ref:t,nextImpl:e}),function(){if(id&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Ks(e,t){return Vs(4,2,e,t)}function qs(e,t){return Vs(4,4,e,t)}function Js(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 Ys(e,t,n){n=n==null?null:n.concat([e]),Vs(4,4,Js.bind(null,t,e),n)}function Xs(){}function Zs(e,t){var n=us();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&ts(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Qs(e,t){var n=us();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&ts(t,r[1]))return r[0];if(r=e(),Yo){ot(!0);try{e()}finally{ot(!1)}}return n.memoizedState=[r,t],r}function $s(e,t,n){return n===void 0||Wo&1073741824&&!(U&261930)?e.memoizedState=t:(e.memoizedState=n,e=zd(),z.lanes|=e,pd|=e,n)}function ec(e,t,n,r){return Zr(n,t)?n:Oo.current===null?!(Wo&106)||Wo&1073741824&&!(U&261930)?(Ic=!0,e.memoizedState=n):(e=zd(),z.lanes|=e,pd|=e,t):(e=$s(e,n,r),Zr(e,t)||(Ic=!0),e)}function tc(e,t,n,r,i){var a=Se.p;Se.p=a!==0&&8>a?a:8;var o=k.T,s={};s.types=o===null?null:o.types,k.T=s,pc(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?fc(e,t,Ga(c,r),Rd(e)):fc(e,t,r,Rd(e))}catch(n){fc(e,t,{then:function(){},status:`rejected`,reason:n},Rd())}finally{Se.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function nc(){}function rc(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ic(e).queue;tc(e,a,t,Ce,n===null?nc:function(){return ac(e),n(r)})}function ic(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ce,baseState:Ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:Ce},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ac(e){var t=ic(e);t.next===null&&(t=e.alternate.memoizedState),fc(e,t.next.queue,{},Rd())}function oc(){return Da(hh)}function sc(){return us().memoizedState}function cc(){return us().memoizedState}function lc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Rd();e=yo(n);var r=bo(t,e,n);r!==null&&(Vd(r,t,n),xo(r,t,n)),t={cache:Pa()},e.payload=t;return}t=t.return}}function uc(e,t,n){var r=Rd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},mc(e)?hc(t,n):(n=Fi(e,t,n,r),n!==null&&(Vd(n,e,r),gc(n,t,r)))}function dc(e,t,n){fc(e,t,n,Rd())}function fc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(mc(e))hc(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,Zr(s,o))return Pi(e,t,i,0),ad===null&&Ni(),!1}catch{}if(n=Fi(e,t,i,r),n!==null)return Vd(n,e,r),gc(n,t,r),!0}return!1}function pc(e,t,n,r){if(r={lane:2,revertLane:Hf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},mc(e)){if(t)throw Error(i(479))}else t=Fi(e,n,r,2),t!==null&&Vd(t,e,2)}function mc(e){var t=e.alternate;return e===z||t!==null&&t===z}function hc(e,t){Jo=qo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,wt(e,n)}}var _c={readContext:Da,use:ps,useCallback:es,useContext:es,useEffect:es,useImperativeHandle:es,useLayoutEffect:es,useInsertionEffect:es,useMemo:es,useReducer:es,useRef:es,useState:es,useDebugValue:es,useDeferredValue:es,useTransition:es,useSyncExternalStore:es,useId:es,useHostTransitionStatus:es,useFormState:es,useActionState:es,useOptimistic:es,useMemoCache:es,useCacheRefresh:es,useEffectEvent:es},vc={readContext:Da,use:ps,useCallback:function(e,t){return ls().memoizedState=[e,t===void 0?null:t],e},useContext:Da,useEffect:Hs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Bs(4194308,4,Js.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){Bs(4,2,e,t)},useMemo:function(e,t){var n=ls();t=t===void 0?null:t;var r=e();if(Yo){ot(!0);try{e()}finally{ot(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ls();if(n!==void 0){var i=n(t);if(Yo){ot(!0);try{n(t)}finally{ot(!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=uc.bind(null,z,e),[r.memoizedState,e]},useRef:function(e){var t=ls();return e={current:e},t.memoizedState=e},useState:function(e){e=B(e);var t=e.queue,n=dc.bind(null,z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Xs,useDeferredValue:function(e,t){return $s(ls(),e,t)},useTransition:function(){var e=B(!1);return e=tc.bind(null,z,e.queue,!0,!1),ls().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=z,a=ls();if(R){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),ad===null)throw Error(i(349));U&127||bs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Hs(Ss.bind(null,r,o,e),[e]),r.flags|=2048,Rs(9,{destroy:void 0},xs.bind(null,r,o,n,t),null),n},useId:function(){var e=ls(),t=ad.identifierPrefix;if(R){var n=$i,r=Qi;n=(r&~(1<<32-st(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Xo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=$o++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:oc,useFormState:Ns,useActionState:Ns,useOptimistic:function(e){var t=ls();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=pc.bind(null,z,!0,n),n.dispatch=t,[e,t]},useMemoCache:ms,useCacheRefresh:function(){return ls().memoizedState=lc.bind(null,z)},useEffectEvent:function(e){var t=ls(),n={impl:e};return t.memoizedState=n,function(){if(id&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},yc={readContext:Da,use:ps,useCallback:Zs,useContext:Da,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:gs,useRef:zs,useState:function(){return gs(hs)},useDebugValue:Xs,useDeferredValue:function(e,t){return ec(us(),Go.memoizedState,e,t)},useTransition:function(){var e=gs(hs)[0],t=us().memoizedState;return[typeof e==`boolean`?e:fs(e),t]},useSyncExternalStore:ys,useId:sc,useHostTransitionStatus:oc,useFormState:Ps,useActionState:Ps,useOptimistic:function(e,t){return Ts(us(),Go,e,t)},useMemoCache:ms,useCacheRefresh:cc,useEffectEvent:Gs},bc={readContext:Da,use:ps,useCallback:Zs,useContext:Da,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:vs,useRef:zs,useState:function(){return vs(hs)},useDebugValue:Xs,useDeferredValue:function(e,t){var n=us();return Go===null?$s(n,e,t):ec(n,Go.memoizedState,e,t)},useTransition:function(){var e=vs(hs)[0],t=us().memoizedState;return[typeof e==`boolean`?e:fs(e),t]},useSyncExternalStore:ys,useId:sc,useHostTransitionStatus:oc,useFormState:Ls,useActionState:Ls,useOptimistic:function(e,t){var n=us();return Go===null?(n.baseState=e,[e,n.queue.dispatch]):Ts(n,Go,e,t)},useMemoCache:ms,useCacheRefresh:cc,useEffectEvent:Gs};function xc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:E({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Sc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Rd(),i=yo(r);i.payload=t,n!=null&&(i.callback=n),t=bo(e,i,r),t!==null&&(Vd(t,e,r),xo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Rd(),i=yo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=bo(e,i,r),t!==null&&(Vd(t,e,r),xo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Rd(),r=yo(n);r.tag=2,t!=null&&(r.callback=t),t=bo(e,r,n),t!==null&&(Vd(t,e,n),xo(t,e,n))}};function Cc(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?!Qr(n,r)||!Qr(i,a):!0}function wc(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&&Sc.enqueueReplaceState(t,t.state,null)}function Tc(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=E({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ec(e){ki(e)}function Dc(e){console.error(e)}function Oc(e){ki(e)}function kc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ac(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 jc(e,t,n){return n=yo(n),n.tag=3,n.payload={element:null},n.callback=function(){kc(e,t)},n}function Mc(e){return e=yo(e),e.tag=3,e}function Nc(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(){Ac(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ac(t,n,r),typeof i!=`function`&&(Td===null?Td=new Set([this]):Td.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Pc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&wa(t,n,a,!0),n=No.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Po===null?$d():n.alternate===null&&fd===0&&(fd=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===eo?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Sf(e,r,a)),!1;case 22:return n.flags|=65536,r===eo?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)),Sf(e,r,a)),!1}throw Error(i(435,n.tag))}return Sf(e,r,a),$d(),!1}if(R)return t=No.current,t===null?(r!==la&&(t=Error(i(423),{cause:r}),ga(Wi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Wi(r,n),a=jc(e.stateNode,r,a),So(e,a),fd!==4&&(fd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==la&&(e=Error(i(422),{cause:r}),ga(Wi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Wi(o,n),vd===null?vd=[o]:vd.push(o),fd!==4&&(fd=2),t===null)return!0;r=Wi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=jc(n.stateNode,r,e),So(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Td===null||!Td.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Mc(a),Nc(a,e,n,r),So(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Fc=Error(i(461)),Ic=!1;function V(e,t,n,r){t.child=e===null?ho(t,null,n,r):mo(t,e.child,n,r)}function Lc(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 Ea(t),r=ns(e,t,n,o,a,i),s=os(),e!==null&&!Ic?(ss(e,t,i),dl(e,t,i)):(R&&s&&na(t),t.flags|=1,V(e,t,r,i),t.child)}function Rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Bi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,zc(e,t,a,r,i)):(e=Ui(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!fl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Qr:n,n(o,r)&&e.ref===t.ref)return dl(e,t,i)}return t.flags|=1,e=Vi(a,r),e.ref=t.ref,e.return=t,t.child=e}function zc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Qr(a,r)&&e.ref===t.ref){if(Ic=!1,t.pendingProps=r=a,fl(e,i))e.flags&131072&&(Ic=!0);else return t.lanes=e.lanes,dl(e,t,i)}}return qc(e,t,n,r,i)}function Bc(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 Hc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ya(t,a===null?null:a.cachePool),a===null?jo():Ao(t,a),Lo(t);else return r=t.lanes=536870912,Hc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ya(t,null),jo(),Ro()):(Ya(t,a.cachePool),Ao(t,a),Ro(),t.memoizedState=null);return V(e,t,i,n),t.child}function Vc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Hc(e,t,n,r,i){var a=Ja();return a=a===null?null:{parent:Na._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ya(t,null),jo(),Lo(t),e!==null&&wa(e,t,r,!0),t.childLanes=i,null}function Uc(e,t){return t=nl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Wc(e,t,n){return mo(t,e.child,null,n),e=Uc(t,t.pendingProps),e.flags|=2,zo(t),t.memoizedState=null,e}function Gc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(R){if(r.mode===`hidden`)return e=Uc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Vc(null,e);if(Io(t),(e=oa)?(e=pm(e,ca),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zi===null?null:{id:Qi,overflow:$i},retryLane:536870912,hydrationErrors:null},n=F(e),n.return=t,t.child=n,aa=t,oa=null)):e=null,e===null)throw ua(t);return t.lanes=536870912,null}return Uc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Io(t),a){if(t.flags&256)t.flags&=-257,t=Wc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Ic||wa(e,t,n,!1),a=(n&e.childLanes)!==0,Ic||a){if(Oo.current===null){if(r=ad,r!==null&&(s=Tt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,j(e,s),Vd(r,e,s),Fc;$d()}t=Wc(e,t,n)}else e=o.treeContext,oa=_m(s.nextSibling),aa=t,R=!0,sa=null,ca=!1,e!==null&&ia(t,e),t=Uc(t,r),t.flags|=134221824;return t}return e=Vi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Kc(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(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function qc(e,t,n,r,i){return Ea(t),n=ns(e,t,n,r,void 0,i),r=os(),e!==null&&!Ic?(ss(e,t,i),dl(e,t,i)):(R&&r&&na(t),t.flags|=1,V(e,t,n,i),t.child)}function Jc(e,t,n,r,i,a){return Ea(t),t.updateQueue=null,n=is(t,r,n,i),rs(e),r=os(),e!==null&&!Ic?(ss(e,t,a),dl(e,t,a)):(R&&r&&na(t),t.flags|=1,V(e,t,n,a),t.child)}function Yc(e,t,n,r,i){if(Ea(t),t.stateNode===null){var a=Li,o=n.contextType;typeof o==`object`&&o&&(a=Da(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Sc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},_o(t),o=n.contextType,a.context=typeof o==`object`&&o?Da(o):Li,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(xc(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&&Sc.enqueueReplaceState(a,a.state,null),To(t,r,a,i),wo(),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=Tc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Li,typeof u==`object`&&u&&(o=Da(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)&&wc(t,a,r,o),go=!1;var f=t.memoizedState;a.state=f,To(t,r,a,i),wo(),l=t.memoizedState,s||f!==l||go?(typeof d==`function`&&(xc(t,n,d,r),l=t.memoizedState),(c=go||Cc(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,vo(e,t),o=t.memoizedProps,u=Tc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Li,typeof l==`object`&&l&&(c=Da(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)&&wc(t,a,r,c),go=!1,f=t.memoizedState,a.state=f,To(t,r,a,i),wo();var p=t.memoizedState;o!==d||f!==p||go||e!==null&&e.dependencies!==null&&Ta(e.dependencies)?(typeof s==`function`&&(xc(t,n,s,r),p=t.memoizedState),(u=go||Cc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ta(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,Kc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=mo(t,e.child,null,i),t.child=mo(t,null,n,i)):V(e,t,n,i),t.memoizedState=a.state,e=t.child):e=dl(e,t,i),e}function Xc(e,t,n,r){return ma(),t.flags|=256,V(e,t,n,r),t.child}var Zc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qc(e){return{baseLanes:e,cachePool:Xa()}}function $c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=gd),e}function el(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Bo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(R){if(i?Fo(t):Ro(),(e=oa)?(e=pm(e,ca),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zi===null?null:{id:Qi,overflow:$i},retryLane:536870912,hydrationErrors:null},n=F(e),n.return=t,t.child=n,aa=t,oa=null)):e=null,e===null)throw ua(t);return t.lanes=hm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Ro(),i=t.mode,a=nl({mode:`hidden`,children:a},i),r=N(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Qc(n),r.childLanes=$c(e,o,n),t.memoizedState=Zc,Vc(null,r)):(Fo(t),tl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return il(e,t,a,o,r,c,s,n)}return i?(Ro(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Vi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=N(i,a,n,null),i.flags|=2):i=Vi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Vc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Qc(n):(a=i.cachePool,a===null?a=Xa():(s=Na._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=$c(e,o,n),t.memoizedState=Zc,Vc(e.child,r)):(Fo(t),n=e.child,e=n.sibling,n=Vi(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 tl(e,t){return t=nl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function nl(e,t){return e=zi(22,e,null,t),e.lanes=0,e}function rl(e,t,n){return mo(t,e.child,null,n),e=tl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function il(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Fo(t),t.flags&=-257,rl(e,t,c)):t.memoizedState===null?(Ro(),o=a.fallback,s=t.mode,a=nl({mode:`visible`,children:a.children},s),o=N(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,mo(t,e.child,null,c),a=t.child,a.memoizedState=Qc(c),a.childLanes=$c(e,r,c),t.memoizedState=Zc,Vc(null,a)):(Ro(),t.child=e.child,t.flags|=128,null);if(Fo(t),hm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,ga({value:a,source:null,stack:null})),rl(e,t,c)}if(Ic||wa(e,t,c,!1),r=(c&e.childLanes)!==0,Ic||r){if(Oo.current!==null)return rl(e,t,c);if(r=ad,r!==null&&(a=Tt(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,j(e,a),Vd(r,e,a),Fc;return mm(o)||$d(),rl(e,t,c)}return mm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,oa=_m(o.nextSibling),aa=t,R=!0,sa=null,ca=!1,e!==null&&ia(t,e),t=tl(t,a.children),t.flags|=134221824,t)}function al(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Sa(e.return,t,n)}function ol(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Uo(n)===null&&(t=e),e=e.sibling}return t}function sl(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 cl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function ll(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Bo.current;if(t.flags&128)return Vo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Vo(t,o),i===`backwards`&&e!==null?(cl(e),V(e,t,r,n),cl(e)):V(e,t,r,n),r=R?Ji:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&al(e,n,t);else if(e.tag===19)al(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`backwards`:n=ol(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,cl(t)),sl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Uo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}sl(t,!0,n,null,a,r);break;case`together`:sl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=ol(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),sl(t,!1,i,n,a,r)}return t.child}function ul(e,t,n){var r=t.pendingProps;return ba(t,t.type,r.value),V(e,t,r.children,n),t.child}function dl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),pd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(wa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Vi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Vi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function fl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ta(e)))}function pl(e,t,n){switch(t.tag){case 3:Ne(t,t.stateNode.containerInfo),ba(t,Na,e.memoizedState.cache),ma();break;case 27:case 5:Fe(t);break;case 4:Ne(t,t.stateNode.containerInfo);break;case 10:ba(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Io(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Fo(t),t.flags|=128,null;r=wa(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?el(e,t,n):(Fo(t),e=dl(e,t,n),e===null?null:e.sibling)}Fo(t);break;case 19:if(t.flags&128)return ll(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(wa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ll(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Vo(t,Bo.current),r)break;return null;case 22:return t.lanes=0,Bc(e,t,n,t.pendingProps);case 24:ba(t,Na,e.memoizedState.cache)}return dl(e,t,n)}function ml(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Ic=!0;else{if(!fl(e,n)&&!(t.flags&128))return Ic=!1,pl(e,t,n);Ic=!!(e.flags&131072)}}else Ic=!1,R&&t.flags&1048576&&ta(t,Ji,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ro(t.elementType),t.type=e,typeof e==`function`)Bi(e)?(r=Tc(e,r),t.tag=1,t=Yc(null,t,e,r,n)):(t.tag=0,t=qc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===se){t.tag=11,t=Lc(null,t,e,r,n);break a}if(a===ue){t.tag=14,t=Rc(null,t,e,r,n);break a}if(a===oe){t.tag=10,t.type=e,t=ul(null,t,n);break a}}throw t=be(e)||e,Error(i(306,t,``))}}return t;case 0:return qc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Tc(r,t.pendingProps),Yc(e,t,r,a,n);case 3:a:{if(Ne(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,vo(e,t),To(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ba(t,Na,r),r!==o.cache&&Ca(t,[Na],n,!0),wo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Xc(e,t,r,n);break a}if(r!==a){a=Wi(Error(i(424)),t),ga(a),t=Xc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(oa=_m(e.firstChild),aa=t,R=!0,sa=null,ca=!0,n=ho(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ma(),r===a){t=dl(e,t,n);break a}V(e,t,r,n)}t=t.child}return t;case 26:return Kc(e,t),e===null?(n=Vm(t.type,null,t.pendingProps,null))?t.memoizedState=n:R||(t.stateNode=xp(t.type,t.pendingProps,je.current,t)):t.memoizedState=Vm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Fe(t),e===null&&R&&(r=t.stateNode=Cm(t.type,t.pendingProps,je.current),aa=t,ca=!0,a=oa,jp(t.type)?(vm=a,oa=_m(r.firstChild)):oa=a),V(e,t,t.pendingProps.children,n),Kc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&R&&((a=r=oa)&&(r=dm(r,t.type,t.pendingProps,ca),r===null?a=!1:(t.stateNode=r,aa=t,oa=_m(r.firstChild),ca=!1,a=!0)),a||ua(t)),Fe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Sp(a,o)?r=null:s!==null&&Sp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ns(e,t,as,null,null,n),hh._currentValue=a),Kc(e,t),V(e,t,r,n),t.child;case 6:return e===null&&R&&((e=n=oa)&&(n=fm(n,t.pendingProps,ca),n===null?e=!1:(t.stateNode=n,aa=t,oa=null,e=!0)),e||ua(t)),null;case 13:return el(e,t,n);case 4:return Ne(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=mo(t,null,r,n):V(e,t,r,n),t.child;case 11:return Lc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Kc(e,t),V(e,t,r,n),t.child;case 8:return V(e,t,t.pendingProps.children,n),t.child;case 12:return V(e,t,t.pendingProps.children,n),t.child;case 10:return ul(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,Ea(t),a=Da(a),r=r(a),t.flags|=1,V(e,t,r,n),t.child;case 14:return Rc(e,t,t.type,t.pendingProps,n);case 15:return zc(e,t,t.type,t.pendingProps,n);case 19:return ll(e,t,n);case 31:return Gc(e,t,n);case 22:return Bc(e,t,n,t.pendingProps);case 24:return Ea(t),r=Da(Na),e===null?(a=Ja(),a===null&&(a=ad,o=Pa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},_o(t),ba(t,Na,a)):((e.lanes&n)!==0&&(vo(e,t),To(t,null,null,n),wo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,ba(t,Na,r),r!==a.cache&&Ca(t,[Na],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),ba(t,Na,r))),V(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:R&&na(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Kc(e,t),V(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function hl(e){e.flags|=4}function gl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?nh(t,r):nh(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Xd())e.flags|=8192;else throw io=eo,Qa}}else e.flags&=-16777217}function _l(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!rh(t)){if(Xd())e.flags|=8192;else throw io=eo,Qa}}function vl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:yt(),e.lanes|=t,_d|=t)}function yl(e,t){if(!R)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,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;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function bl(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&1206910976,r|=i.flags&1206910976,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 xl(e,t,n){var r=t.pendingProps;switch(ra(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bl(t),null;case 1:return bl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),xa(Na),Pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(pa(t)?hl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ha())),bl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(hl(t),o===null?(bl(t),gl(t,a,null,r,n)):(bl(t),_l(t,o))):o?o===e.memoizedState?(bl(t),t.flags&=-16777217):(hl(t),bl(t),_l(t,o)):(e=e.memoizedProps,e!==r&&hl(t),bl(t),gl(t,a,e,r,n)),null;case 27:if(Ie(t),n=je.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return bl(t),t.subtreeFlags&=-33554433,null}e=ke.current,pa(t)?da(t,e):(e=Cm(a,r,n),t.stateNode=e,hl(t))}return bl(t),t.subtreeFlags&=-33554433,null;case 5:if(Ie(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return bl(t),t.subtreeFlags&=-33554433,null}if(o=ke.current,pa(t))da(t,o);else{var s=vp(je.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[jt]=t,o[Mt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(dp(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&hl(t)}}return bl(t),t.subtreeFlags&=-33554433,gl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=je.current,pa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=aa,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[jt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||cp(e.nodeValue,n)),e||ua(t,!0)}else e=vp(e).createTextNode(r),e[jt]=t,t.stateNode=e}return bl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=pa(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[jt]=t}else ma(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bl(t),e=!1}else n=ha(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(zo(t),t):(zo(t),null);if(t.flags&128)throw Error(i(558))}return bl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=pa(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[jt]=t}else ma(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bl(t),a=!1}else a=ha(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(zo(t),t):(zo(t),null)}return zo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),vl(t,t.updateQueue),bl(t),null);case 4:return Pe(),e===null&&Qf(t.stateNode.containerInfo),t.flags|=67108864,bl(t),null;case 10:return xa(t.type),bl(t),null;case 19:if(Ho(t),r=t.memoizedState,r===null)return bl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)yl(r,!1);else{if(fd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Uo(e),o!==null){for(t.flags|=128,yl(r,!1),e=o.updateQueue,t.updateQueue=e,vl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Hi(n,e),n=n.sibling;return Vo(t,Bo.current&1|2),R&&ea(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ye()>Cd&&(t.flags|=128,a=!0,yl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Uo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,vl(t,e),yl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!R)return bl(t),null}else 2*Ye()-r.renderingStartTime>Cd&&n!==536870912&&(t.flags|=128,a=!0,yl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ye(),e.sibling=null,o=Bo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||R?Vo(t,o):(n=o,Oe(No,t),Oe(Bo,n),Po===null&&(Po=t)),R&&ea(t,r.treeForkCount),e}return bl(t),null;case 22:case 23:return zo(t),Mo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(bl(t),t.subtreeFlags&6&&(t.flags|=8192)):bl(t),n=t.updateQueue,n!==null&&vl(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&&De(qa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),xa(Na),bl(t),null;case 25:return null;case 30:return t.flags|=33554432,bl(t),null}throw Error(i(156,t.tag))}function Sl(e,t){switch(ra(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xa(Na),Pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ie(t),null;case 31:if(t.memoizedState!==null){if(zo(t),t.alternate===null)throw Error(i(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(zo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ho(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Pe(),null;case 10:return xa(t.type),null;case 22:case 23:return zo(t),Mo(),e!==null&&De(qa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return xa(Na),null;case 25:return null;default:return null}}function Cl(e,t){switch(ra(t),t.tag){case 3:xa(Na),Pe();break;case 26:case 27:case 5:Ie(t);break;case 4:Pe();break;case 31:t.memoizedState!==null&&zo(t);break;case 13:zo(t);break;case 19:Ho(t);break;case 10:xa(t.type);break;case 22:case 23:zo(t),Mo(),e!==null&&De(qa);break;case 24:xa(Na)}}function wl(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){xf(t,t.return,e)}}function Tl(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){xf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){xf(t,t.return,e)}}function El(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Do(t,n)}catch(t){xf(e,e.return,t)}}}function Dl(e,t,n){n.props=Tc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){xf(e,t,n)}}function Ol(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:var i=e.stateNode,a=A(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Up(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Wp(e);h(e.child,!1,om,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){xf(e,t,n)}}function kl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){xf(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){xf(e,t,n)}else n.current=null}}function Al(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)cm(e.stateNode,t[n])}function jl(e){for(var t=e.return;t!==null&&(Pl(t)&&cm(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Ml(e){for(var t=e.return;t!==null&&(Pl(t)&&lm(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Nl(e){return e.tag===5||e.tag===3||e.tag===27}function Pl(e){return e&&e.tag===7&&e.stateNode!==null}function Fl(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){xf(e,e.return,t)}}function Il(e,t,n){try{var r=e.stateNode;pp(r,e.type,n,t),r[Mt]=t}catch(t){xf(e,e.return,t)}}function Ll(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&jp(e.type)||e.tag===4}function Rl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ll(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&&jp(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 zl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=On)),Al(e,r),tn=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,jp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(zl(e,t,n,r),e=e.sibling;e!==null;)zl(e,t,n,r),e=e.sibling}function Bl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Al(e,r),tn=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,jp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Bl(e,t,n,r),e=e.sibling;e!==null;)Bl(e,t,n,r),e=e.sibling}function Vl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);dp(t,r,n),t[jt]=e,t[Mt]=n}catch(t){xf(e,e.return,t)}}var Hl=!1,Ul=null;function Wl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Hl=!0)}var Gl=null;function Kl(){var e=Gl;return Gl=null,e}var ql=0;function Jl(e,t,n,r,i){return ql=0,Yl(e.child,t,n,r,i)}function Yl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Lp(o);r.push(s),s.view&&(a=!0)}else a||Lp(o).view&&(a=!0);Hl=!0,Pp(o,ql===0?t:t+`_`+ql,n),ql++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Yl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function Xl(e,t){for(;e!==null;)e.tag===5?Fp(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||Xl(e.child,t),e=e.sibling}function Zl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Zl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=Oi(t.default,t.share),t!==`none`&&(Jl(e,n,t,null,!1)||Xl(e.child,!1))}e=e.sibling}}function Ql(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=A(r,n),a=Oi(r.default,n.paired?r.share:r.enter);a===`none`?Zl(e):Jl(e,i,a,null,!1)?(Zl(e),n.paired||t||Bd(e,r.onEnter)):Xl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ql(e,t),e=e.sibling;else Zl(e)}function $l(e){if(Ul!==null&&Ul.size!==0){var t=Ul;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=Oi(n.default,n.share);if(a!==`none`&&(Jl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Bd(e,n.onShare)):Xl(e.child,!1)),t.delete(r),t.size===0)break}}}$l(e)}e=e.sibling}}}function eu(e){if(e.tag===30){var t=e.memoizedProps,n=A(t,e.stateNode),r=Ul===null?void 0:Ul.get(n),i=Oi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Jl(e,n,i,null,!1)?r===void 0?Bd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Ul.delete(n),Bd(e,t.onShare)):Xl(e.child,!1)),Ul!==null&&$l(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)eu(e),e=e.sibling;else Ul!==null&&$l(e)}function tu(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=A(t,e.stateNode);t=Oi(t.default,t.update),e.flags&=-5,t!==`none`&&Jl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&tu(e);e=e.sibling}}function nu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Xl(e.child,!1))}nu(e)}e=e.sibling}}function ru(e){if(e.tag===30)e.stateNode.paired=null,Xl(e.child,!1),nu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ru(e),e=e.sibling;else nu(e)}function iu(e){for(e=e.child;e!==null;)e.tag===30?Xl(e.child,!1):e.subtreeFlags&33554432&&iu(e),e=e.sibling}function au(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&ql<a.length){var l=a[ql],u=Lp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Pp(c,ql===0?n:n+`_`+ql,i),s&&e.flags&4||(Gl===null&&(Gl=[]),Gl.push(c,ql===0?r:r+`_`+ql,t.memoizedProps)),ql++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:au(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function ou(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=A(n,r),a=Oi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Rp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;ql=0,i=au(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Bd(e,n.onUpdate))}else e.subtreeFlags&33554432&&ou(e,t);e=e.sibling}}var su=!1,cu=!1,lu=!1,uu=!1,du=typeof WeakSet==`function`?WeakSet:Set,fu=null,pu=!1,mu=!1,hu=!1,gu=!1;function _u(e,t,n){if(e=e.containerInfo,gp=Ch,e=ri(e),ii(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(_p={focusedElem:e,selectionRange:r},Ch=!1,n=(n&335544064)===n,fu=t,t=n?9270:1024;fu!==null;){if(e=fu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&eu(r[a]);if(e.alternate===null&&e.flags&2)n&&Wl(e),vu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&eu(r),vu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Wl(e),vu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,fu=r):(n&&tu(e),vu(n))}}Ul=null}function vu(e){for(;fu!==null;){var t=fu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=Tc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){xf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)um(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:um(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=A(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=Oi(a.default,a.update),a!==`none`&&Jl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,fu=r;break}fu=t.return}}function yu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:zu(e,n),r&4&&wl(5,n);break;case 1:if(zu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){xf(n,n.return,e)}else{var i=Tc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){xf(n,n.return,e)}}}r&64&&El(n),r&512&&Ol(n,n.return);break;case 3:if(zu(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{Do(e,t)}catch(e){xf(n,n.return,e)}}break;case 27:t===null&&r&4&&Vl(n);case 26:case 5:zu(e,n),t===null&&r&4&&Fl(n),r&512&&Ol(n,n.return);break;case 12:zu(e,n);break;case 31:zu(e,n),r&4&&Ou(e,n);break;case 13:zu(e,n),r&4&&ku(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Tf.bind(null,n),gm(e,n))));break;case 22:if(r=n.memoizedState!==null||su,!r){var a=t!==null&&t.memoizedState!==null||cu;t=su,i=cu,su=r,(cu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Vu(e,n,r)):zu(e,n),su=t,cu=i}break;case 30:zu(e,n),r&512&&Ol(n,n.return);break;case 7:r&512&&Ol(n,n.return);default:zu(e,n)}}function bu(e,t){for(e=e.child;e!==null;)xu(e,t),e=e.sibling}function xu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){xf(e,e.return,t)}Su(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,tn=!0}catch(t){xf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Np(s,!0):Np(e.stateNode,!1)}catch(t){xf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&bu(e,t);break;default:bu(e,t)}}function Su(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:xu(n,r);break a;case 22:n.memoizedState===null&&Su(n,r);break a;default:Su(n,r)}}e=e.sibling}}function Cu(e){var t=e.alternate;t!==null&&(e.alternate=null,Cu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Bt(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 wu=null,Tu=!1;function Eu(e,t,n){for(n=n.child;n!==null;)Du(e,t,n),n=n.sibling}function Du(e,t,n){if(at&&typeof at.onCommitFiberUnmount==`function`)try{at.onCommitFiberUnmount(it,n)}catch{}switch(n.tag){case 26:cu||kl(n,t),Eu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!cu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:cu||kl(n,t),Ml(n);var r=wu,i=Tu;jp(n.type)&&(wu=n.stateNode,Tu=!1),Eu(e,t,n),wm(n.stateNode,n.type,n.memoizedProps),wu=r,Tu=i;break;case 5:cu||kl(n,t),Ml(n);case 6:if(n.tag===6&&Ml(n),r=wu,i=Tu,wu=null,Eu(e,t,n),wu=r,Tu=i,wu!==null){if(Tu)try{(wu.nodeType===9?wu.body:wu.nodeName===`HTML`?wu.ownerDocument.body:wu).removeChild(n.stateNode),tn=!0}catch(e){xf(n,t,e)}else try{wu.removeChild(n.stateNode),tn=!0}catch(e){xf(n,t,e)}}break;case 18:wu!==null&&(Tu?(e=wu,Mp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Gh(e)):Mp(wu,n.stateNode));break;case 4:r=wu,i=Tu,wu=n.stateNode.containerInfo,Tu=!0,Eu(e,t,n),wu=r,Tu=i;break;case 0:case 11:case 14:case 15:Tl(2,n,t),cu||Tl(4,n,t),Eu(e,t,n);break;case 1:cu||(kl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Dl(n,t,r)),Eu(e,t,n);break;case 21:Eu(e,t,n);break;case 22:cu=(r=cu)||n.memoizedState!==null,Eu(e,t,n),cu=r;break;case 30:kl(n,t),Eu(e,t,n);break;case 7:cu||kl(n,t),Eu(e,t,n);break;default:Eu(e,t,n)}}function Ou(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Gh(e)}catch(e){xf(t,t.return,e)}}}function ku(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Gh(e)}catch(e){xf(t,t.return,e)}}function Au(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new du),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new du),t;default:throw Error(i(435,e.tag))}}function ju(e,t){var n=Au(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ef.bind(null,e,t);t.then(r,r)}})}function Mu(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(jp(l.type)){wu=l.stateNode,Tu=!1;break a}break;case 5:wu=l.stateNode,Tu=!1;break a;case 3:case 4:wu=l.stateNode.containerInfo,Tu=!0;break a}l=l.return}if(wu===null)throw Error(i(160));Du(s,c,o),wu=null,Tu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Pu(t,e,n),t=t.sibling}var Nu=null;function Pu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Mu(t,e,n),Fu(e),a&4&&(Tl(3,e,e.return),wl(3,e),Tl(5,e,e.return));break;case 1:Mu(t,e,n),Fu(e),a&512&&(cu||r===null||kl(r,r.return)),a&64&&su&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Nu,Mu(t,e,n),Fu(e),a&512&&(cu||r===null||kl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(su)e.stateNode=xp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[Rt]||r[jt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),dp(r,t,n),r[jt]=e,Gt(r),t=r;break a;case`link`:if(o=$m(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),dp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=$m(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),dp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[jt]=e,Gt(r),t=r}e.stateNode=t}}else su||eh(o,e.type,e.stateNode)}else e.stateNode=Jm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Il(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||cu||t.parentNode.removeChild(t)):a.count--,n===null?su||eh(o,e.type,e.stateNode):Jm(o,n,e.memoizedProps))}break;case 27:Mu(t,e,n),Fu(e),a&512&&(cu||r===null||kl(r,r.return)),r!==null&&a&4&&Il(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=lu,lu=!1,Mu(t,e,n),lu=o,Fu(e),a&512&&(cu||r===null||kl(r,r.return)),e.flags&32){t=e.stateNode;try{bn(t,``),tn=!0}catch(t){xf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Il(e,t,r===null?t:r.memoizedProps)),a&1024&&(uu=!0);break;case 6:if(Mu(t,e,n),Fu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,tn=!0}catch(t){xf(e,e.return,t)}}break;case 3:if(tn=!1,Qm=null,o=Nu,Nu=Om(t.containerInfo),Mu(t,e,n),Nu=o,Fu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Gh(t.containerInfo)}catch(t){xf(e,e.return,t)}uu&&(uu=!1,Iu(e)),tn=!1;break;case 4:a=lu,lu=su,r=nn(),o=Nu,Nu=Om(e.stateNode.containerInfo),Mu(t,e,n),Fu(e),Nu=o,tn&&mu&&(hu=!0),tn=r,lu=a;break;case 12:Mu(t,e,n),Fu(e);break;case 31:Mu(t,e,n),Fu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 13:Mu(t,e,n),Fu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(xd=Ye()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=su,l=cu,u=lu;su=c||o,lu=u||o,cu=l||s,Mu(t,e,n),cu=l,lu=u,su=c,Fu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||su||cu||(t=s||cu,n=su,r=cu,su=o||su,cu=t,Bu(e,2),su=n,cu=r),!o&&lu||bu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,ju(e,n))));break;case 19:Mu(t,e,n),Fu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 30:a&512&&(cu||r===null||kl(r,r.return)),a=nn(),o=mu,s=(n&335544064)===n,c=e.memoizedProps,mu=s&&Oi(c.default,c.update)!==`none`,Mu(t,e,n),Fu(e),s&&r!==null&&tn&&(e.flags|=4),mu=o,tn=a;break;case 21:break;case 7:a&512&&(cu||r===null||kl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Mu(t,e,n),Fu(e)}}function Fu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Ll(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Pl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Nl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Bl(e,Rl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(bn(l,``),n.flags&=-33),Bl(e,Rl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;zl(e,Rl(e),u,s);break;default:throw Error(i(161))}}catch(t){xf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Iu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Iu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Ch=!0,t.reset(),Ch=!1),e=e.sibling}}function Lu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Ru(t,e),t=t.sibling;else ou(t,!1)}function Ru(e,t){var n=e.alternate;if(n===null)Ql(e,!1);else switch(e.tag){case 3:if(gu=pu=!1,Kl(),Lu(t,e),!pu&&!hu){if(e=Gl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Fp(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),gu=!0}Gl=null;break;case 5:Lu(t,e);break;case 4:r=pu,pu=!1,Lu(t,e),pu&&(hu=!0),pu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Lu(t,e):Ql(e,!1));break;case 30:r=pu,i=Kl(),pu=!1,Lu(t,e),pu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=A(a,o),o=A(n.memoizedProps,o);var s=Oi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,ql=0,t=au(e,n,t,o,s,a,!0),ql!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Bd(e,e.memoizedProps.onUpdate),Gl=i):i!==null&&(i.push.apply(i,Gl),Gl=i),pu=e.flags&32?!0:r;break;default:Lu(t,e)}}function zu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)yu(e,t.alternate,t),t=t.sibling}function Bu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Tl(4,n,n.return),Bu(n,r);break;case 1:kl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Dl(n,n.return,i),Bu(n,r);break;case 27:r&2&&wm(n.stateNode,n.type,n.memoizedProps);case 5:kl(n,n.return),n.tag!==5&&n.tag!==27||Ml(n),Bu(n,r);break;case 6:Ml(n);break;case 26:kl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||cu||i.parentNode.removeChild(i),Bu(n,r);break;case 22:n.memoizedState===null&&Bu(n,r);break;case 30:kl(n,n.return),Bu(n,r);break;case 7:kl(n,n.return);default:Bu(n,r)}e=e.sibling}}function Vu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Vu(i,a,n),wl(4,a);break;case 1:if(Vu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){xf(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)Eo(l[i],c)}catch(e){xf(r,r.return,e)}}s&&o&64&&El(a),Ol(a,a.return);break;case 27:n&2&&Vl(a);case 5:a.tag!==5&&a.tag!==27||jl(a),Vu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 6:jl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||su||eh(Om(c.ownerDocument),a.type,c),Vu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 12:Vu(i,a,n);break;case 31:Vu(i,a,n),s&&o&4&&Ou(i,a);break;case 13:Vu(i,a,n),s&&o&4&&ku(i,a);break;case 22:a.memoizedState===null&&Vu(i,a,n),Ol(a,a.return);break;case 30:Vu(i,a,n),Ol(a,a.return);break;case 7:Ol(a,a.return);default:Vu(i,a,n)}t=t.sibling}}function Hu(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&&Fa(n))}function Uu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fa(e))}function Wu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Gu(e,t,n,r),t=t.sibling;else i&&iu(t)}function Gu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ru(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Wu(e,t,n,r),a&2048&&wl(9,t);break;case 1:Wu(e,t,n,r);break;case 3:Wu(e,t,n,r),i&&gu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Fa(a)));break;case 12:if(a&2048){Wu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){xf(t,t.return,e)}}else Wu(e,t,n,r);break;case 31:Wu(e,t,n,r);break;case 13:Wu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&ru(t),o._visibility&2?Wu(e,t,n,r):(o._visibility|=2,Ku(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ru(s),o._visibility&2?Wu(e,t,n,r):qu(e,t)),a&2048&&Hu(s,t);break;case 24:Wu(e,t,n,r),a&2048&&Uu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Xl(a.child,!0),Xl(t.child,!0))),Wu(e,t,n,r);break;default:Wu(e,t,n,r)}}function Ku(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!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:Ku(a,o,s,c,i),wl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ku(a,o,s,c,i)):u._visibility&2?Ku(a,o,s,c,i):qu(a,o),i&&l&2048&&Hu(o.alternate,o);break;case 24:Ku(a,o,s,c,i),i&&l&2048&&Uu(o.alternate,o);break;default:Ku(a,o,s,c,i)}t=t.sibling}}function qu(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:qu(n,r),i&2048&&Hu(r.alternate,r);break;case 24:qu(n,r),i&2048&&Uu(r.alternate,r);break;default:qu(n,r)}t=t.sibling}}var Ju=8192;function Yu(e,t,n){if(e.subtreeFlags&Ju)for(e=e.child;e!==null;)Xu(e,t,n),e=e.sibling}function Xu(e,t,n){switch(e.tag){case 26:Yu(e,t,n),e.flags&Ju&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&ah(n,e)):oh(n,Nu,e.memoizedState,e.memoizedProps));break;case 5:Yu(e,t,n),e.flags&Ju&&(e=e.stateNode,(t&335544128)===t&&ah(n,e));break;case 3:case 4:var r=Nu;Nu=Om(e.stateNode.containerInfo),Yu(e,t,n),Nu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ju,Ju=16777216,Yu(e,t,n),Ju=r):Yu(e,t,n));break;case 30:if((e.flags&Ju)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Ul===null&&(Ul=new Map),Ul.set(r,i)}Yu(e,t,n);break;default:Yu(e,t,n)}}function Zu(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 Qu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];fu=r,td(r,e)}Zu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$u(e),e=e.sibling}function $u(e){switch(e.tag){case 0:case 11:case 15:Qu(e),e.flags&2048&&Tl(9,e,e.return);break;case 3:Qu(e);break;case 12:Qu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ed(e)):Qu(e);break;default:Qu(e)}}function ed(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];fu=r,td(r,e)}Zu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Tl(8,t,t.return),ed(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,ed(t));break;default:ed(t)}e=e.sibling}}function td(e,t){for(;fu!==null;){var n=fu;switch(n.tag){case 0:case 11:case 15:Tl(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:Fa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,fu=r;else a:for(n=e;fu!==null;){r=fu;var i=r.sibling,a=r.return;if(Cu(r),r===n){fu=null;break a}if(i!==null){i.return=a,fu=i;break a}fu=a}}}var nd={getCacheForType:function(e){var t=Da(Na),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Da(Na).controller.signal}},rd=typeof WeakMap==`function`?WeakMap:Map,id=0,ad=null,H=null,U=0,od=0,sd=null,cd=!1,ld=!1,ud=!1,dd=0,fd=0,pd=0,md=0,hd=0,gd=0,_d=0,vd=null,yd=null,bd=!1,xd=0,Sd=0,Cd=1/0,wd=null,Td=null,Ed=0,Dd=null,Od=null,kd=0,Ad=0,jd=null,Md=null,Nd=null,Pd=null,Fd=null,Id=0,Ld=null;function Rd(){return id&2&&U!==0?U&-U:k.T===null?Ot():Hf()}function zd(){if(gd===0){if(!(U&536870912)||R){var e=ft;ft<<=1,!(ft&3932160)&&(ft=262144),gd=e}else gd=536870912}return e=No.current,e!==null&&(e.flags|=32),gd}function Bd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Up(A(e.memoizedProps,n))),Pd===null&&(Pd=[]),Pd.push(t.bind(null,r))}}function Vd(e,t,n){(e===ad&&(od===2||od===9)||e.cancelPendingCommit!==null)&&(Jd(e,0),Gd(e,U,gd,!1)),xt(e,n),id&2&&e===ad||(e===ad&&(!(id&2)&&(md|=n),fd===4&&Gd(e,U,gd,!1)),Pf(e))}function Hd(e,t,n){if(id&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||gt(e,t),a=r?nf(e,t):ef(e,t,!0),o=r;do{if(a===0){ld&&!r&&Gd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Wd(n))a=ef(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=vd;var l=c.current.memoizedState.isDehydrated;if(l&&(Jd(c,s).flags|=256),s=ef(c,s,!1),s!==2&&s!==6){if(ud&&!l){c.errorRecoveryDisabledLanes|=o,md|=o,a=4;break a}o=yd,yd=a,o!==null&&(yd===null?yd=o:yd.push.apply(yd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Jd(e,0),Gd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Gd(r,t,gd,!cd);break a;case 2:yd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=xd+300-Ye(),10<a)){if(Gd(r,t,gd,!cd),ht(r,0,!0)!==0)break a;kd=t,r.timeoutHandle=Tp(Ud.bind(null,r,n,yd,wd,bd,t,gd,md,_d,cd,o,`Throttled`,-0,0),a);break a}Ud(r,n,yd,wd,bd,t,gd,md,_d,cd,o,null,-0,0)}break}}while(1);Pf(e)}function Ud(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:On},Ul=null,Xu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=uh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?xd-Ye():(a&4194048)===a?Sd-Ye():0,m=ch(d,m),m!==null)?(kd=a,e.cancelPendingCommit=m(uf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Gd(e,a,o,!l)):uf(e,t,a,n,r,i,o,s,c,l,u,d)}function Wd(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(!Zr(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 Gd(e,t,n,r){t=_t(e,t),t&=~hd,t&=~md,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-st(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ct(e,n,t)}function Kd(){return id&6?!0:(Ff(0,!1),!1)}function qd(){if(H!==null){if(od===0)var e=H.return;else e=H,ya=va=null,cs(e),so=null,co=0,e=H;for(;e!==null;)Cl(e.alternate,e),e=e.return;H=null}}function Jd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Ep(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),kd=0,qd(),ad=e,H=n=Vi(e.current,null),U=t,od=0,sd=null,cd=!1,ld=gt(e,t),ud=!1,_d=gd=hd=md=pd=fd=0,yd=vd=null,bd=!1,dd=_t(e,t),Ni(),n}function Yd(e,t){z=null,k.H=_c,t===Za||t===$a?(t=ao(),od=3):t===Qa?(t=ao(),od=4):od=t===Fc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,sd=t,H===null&&(fd=1,kc(e,Wi(t,e.current)))}function Xd(){var e=No.current;return e===null?!0:(U&4194048)===U?Po===null:(U&62914560)===U||U&536870912?e===Po:!1}function Zd(){var e=k.H;return k.H=_c,e===null?_c:e}function Qd(){var e=k.A;return k.A=nd,e}function $d(){fd=4,cd||(U&4194048)!==U&&No.current!==null||(ld=!0),!(pd&134217727)&&!(md&134217727)||ad===null||Gd(ad,U,gd,!1)}function ef(e,t,n){var r=id;id|=2;var i=Zd(),a=Qd();(ad!==e||U!==t)&&(wd=null,Jd(e,t)),t=!1;var o=fd;a:do try{if(od!==0&&H!==null){var s=H,c=sd;switch(od){case 8:qd(),o=6;break a;case 3:case 2:case 9:case 6:No.current===null&&(t=!0);var l=od;if(od=0,sd=null,sf(e,s,c,l),n&&ld){o=0;break a}break;default:l=od,od=0,sd=null,sf(e,s,c,l)}}tf(),o=fd;break}catch(t){Yd(e,t)}while(1);return t&&e.shellSuspendCounter++,ya=va=null,id=r,k.H=i,k.A=a,H===null&&(ad=null,U=0,Ni()),o}function tf(){for(;H!==null;)af(H)}function nf(e,t){var n=id;id|=2;var r=Zd(),a=Qd();ad!==e||U!==t?(wd=null,Cd=Ye()+500,Jd(e,t)):ld=gt(e,t);a:do try{if(od!==0&&H!==null){t=H;var o=sd;b:switch(od){case 1:od=0,sd=null,sf(e,t,o,1);break;case 2:case 9:if(to(o)){od=0,sd=null,of(t);break}t=function(){od!==2&&od!==9||ad!==e||(od=7),Pf(e)},o.then(t,t);break a;case 3:od=7;break a;case 4:od=5;break a;case 7:to(o)?(od=0,sd=null,of(t)):(od=0,sd=null,sf(e,t,o,7));break;case 5:var s=null;switch(H.tag){case 26:s=H.memoizedState;case 5:case 27:var c=H;if(s?rh(s):c.stateNode.complete){od=0,sd=null;var l=c.sibling;if(l!==null)H=l;else{var u=c.return;u===null?H=null:(H=u,cf(u))}break b}}od=0,sd=null,sf(e,t,o,5);break;case 6:od=0,sd=null,sf(e,t,o,6);break;case 8:qd(),fd=6;break a;default:throw Error(i(462))}}rf();break}catch(t){Yd(e,t)}while(1);return ya=va=null,k.H=r,k.A=a,id=n,H===null?(ad=null,U=0,Ni(),fd):0}function rf(){for(;H!==null&&!qe();)af(H)}function af(e){var t=ml(e.alternate,e,dd);e.memoizedProps=e.pendingProps,t===null?cf(e):H=t}function of(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Jc(n,t,t.pendingProps,t.type,void 0,U);break;case 11:t=Jc(n,t,t.pendingProps,t.type.render,t.ref,U);break;case 5:cs(t);var r=t;r===aa&&(R?(fa(r),r.tag===5&&r.stateNode!=null&&(oa=r.stateNode)):(fa(r),R=!0));default:Cl(n,t),t=H=Hi(t,dd),t=ml(n,t,dd)}e.memoizedProps=e.pendingProps,t===null?cf(e):H=t}function sf(e,t,n,r){ya=va=null,cs(t),so=null,co=0;var i=t.return;try{if(Pc(e,i,t,n,U)){fd=1,kc(e,Wi(n,e.current)),H=null;return}}catch(t){if(i!==null)throw H=i,t;fd=1,kc(e,Wi(n,e.current)),H=null;return}t.flags&32768?(R||r===1?e=!0:ld||U&536870912?e=!1:(cd=e=!0,(r===2||r===9||r===3||r===6)&&(r=No.current,r!==null&&r.tag===13&&(r.flags|=16384))),lf(t,e)):cf(t)}function cf(e){var t=e;do{if(t.flags&32768){lf(t,cd);return}e=t.return;var n=xl(t.alternate,t,dd);if(n!==null){H=n;return}if(t=t.sibling,t!==null){H=t;return}H=t=e}while(t!==null);fd===0&&(fd=5)}function lf(e,t){do{var n=Sl(e.alternate,e);if(n!==null){n.flags&=32767,H=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){H=e;return}H=e=n}while(e!==null);fd=6,H=null}function uf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do vf();while(Ed!==0);if(id&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===ad&&(H=ad=null,U=0),Od=t,Dd=e,kd=n,jd=a,Md=r,df(e,t,n,s,c,l,f)}}function df(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Ad=s,s|=Mi,St(e,n,s,r,i,a),Pd=null,(n&335544064)===n?(Fd=Ra(e),r=10262):(Fd=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Df($e,function(){return yf(),null})):(e.callbackNode=null,e.callbackPriority=0),Hl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=k.T,k.T=null,i=Se.p,Se.p=2,a=id,id|=4;try{_u(e,t,n)}finally{id=a,Se.p=i,k.T=r}}Ed=1,Hl?Nd=Vp(o,e.containerInfo,Fd,mf,hf,pf,gf,yf,ff,null,null):(mf(),hf(),gf())}function ff(e){if(Ed!==0){var t=Dd.onRecoverableError;t(e,{componentStack:null})}}function pf(){Ed===3&&(Ed=0,Ru(Od,Dd),Ed=4)}function mf(){if(Ed===1){Ed=0;var e=Dd,t=Od,n=kd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=k.T,k.T=null;var i=Se.p;Se.p=2;var a=id;id|=4;try{mu=hu=!1,Pu(t,e,n),n=_p;var o=ri(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&ni(s.ownerDocument.documentElement,s)){if(c!==null&&ii(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 _=ti(s,h),v=ti(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}}Ch=!!gp,_p=gp=null}finally{id=a,Se.p=i,k.T=r}}e.current=t,Ed=2}}function hf(){if(Ed===2){Ed=0;var e=Dd,t=Od,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=k.T,k.T=null;var r=Se.p;Se.p=2;var i=id;id|=4;try{yu(e,t.alternate,t)}finally{id=i,Se.p=r,k.T=n}}Ed=3}}function gf(){if(Ed===4||Ed===3){Ed=0;var e=Nd;Nd=null,Je();var t=Dd,n=Od,r=kd,i=Md,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Ed=5:(Ed=0,Od=Dd=null,_f(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Td=null),Dt(r),n=n.stateNode,at&&typeof at.onCommitFiberRoot==`function`)try{at.onCommitFiberRoot(it,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=k.T,a=Se.p,Se.p=2,k.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{k.T=n,Se.p=a}}if(i=Pd,o=Fd,Fd=null,i!==null&&(Pd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);kd&3&&vf(),Pf(t),a=t.pendingLanes,r&261930&&a&42?t===Ld?Id++:(Id=0,Ld=t):(Id=0,Ld=null),Ff(0,!1)}}function _f(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Fa(t)))}function vf(){return Nd!==null&&(Nd.skipTransition(),Nd=null),mf(),hf(),gf(),yf()}function yf(){if(Ed!==5)return!1;var e=Dd,t=Ad;Ad=0;var n=Dt(kd),r=k.T,a=Se.p;try{Se.p=32>n?32:n,k.T=null,n=jd,jd=null;var o=Dd,s=kd;if(Ed=0,Od=Dd=null,kd=0,id&6)throw Error(i(331));var c=id;if(id|=4,$u(o.current),Gu(o,o.current,s,n),id=c,Ff(0,!1),at&&typeof at.onPostCommitFiberRoot==`function`)try{at.onPostCommitFiberRoot(it,o)}catch{}return!0}finally{Se.p=a,k.T=r,_f(e,t)}}function bf(e,t,n){t=Wi(n,t),t=jc(e.stateNode,t,2),e=bo(e,t,2),e!==null&&(xt(e,2),Pf(e))}function xf(e,t,n){if(e.tag===3)bf(e,e,n);else for(;t!==null;){if(t.tag===3){bf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Td===null||!Td.has(r))){e=Wi(n,e),n=Mc(2),r=bo(t,n,2),r!==null&&(Nc(n,r,t,e),xt(r,2),Pf(r));break}}t=t.return}}function Sf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new rd;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)||(ud=!0,i.add(n),e=Cf.bind(null,e,t,n),t.then(e,e))}function Cf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ad===e&&(U&n)===n&&(fd===4||fd===3&&(U&62914560)===U&&300>Ye()-xd?id&2?hd|=n:Jd(e,0):hd|=n,_d===U&&(_d=0)),Pf(e)}function wf(e,t){t===0&&(t=yt()),e=j(e,t),e!==null&&(xt(e,t),Pf(e))}function Tf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),wf(e,n)}function Ef(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),wf(e,n)}function Df(e,t){return Ge(e,t)}var Of=null,kf=null,Af=!1,jf=!1,Mf=!1,Nf=0;function Pf(e){e!==kf&&e.next===null&&(kf===null?Of=kf=e:kf=kf.next=e),jf=!0,Af||(Af=!0,Vf())}function Ff(e,t){if(!Mf&&jf){Mf=!0;do for(var n=!1,r=Of;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-st(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Bf(r,a))}else a=U,a=ht(r,r===ad?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||gt(r,a)||(n=!0,Bf(r,a))}r=r.next}while(n);Mf=!1}}function If(){Lf()}function Lf(){jf=Af=!1;var e=0;Nf!==0&&wp()&&(e=Nf);for(var t=Ye(),n=null,r=Of;r!==null;){var i=r.next,a=Rf(r,t);a===0?(r.next=null,n===null?Of=i:n.next=i,i===null&&(kf=n)):(n=r,(e!==0||a&3)&&(jf=!0)),r=i}Ed!==0&&Ed!==5||Ff(e,!1),Nf!==0&&(Nf=0)}function Rf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-st(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=vt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=ad,n=U,n=ht(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(od===2||od===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ke(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||gt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ke(r),Dt(n)){case 2:case 8:n=Qe;break;case 32:n=$e;break;case 268435456:n=tt;break;default:n=$e}return r=zf.bind(null,e),n=Ge(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ke(r),e.callbackPriority=2,e.callbackNode=null,2}function zf(e,t){if(Ed!==0&&Ed!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(vf()&&e.callbackNode!==n)return null;var r=U;return r=ht(e,e===ad?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Hd(e,r,t),Rf(e,Ye()),e.callbackNode!=null&&e.callbackNode===n?zf.bind(null,e):null)}function Bf(e,t){if(vf())return null;Hd(e,t,!0)}function Vf(){kp(function(){id&6?Ge(Ze,If):Lf()})}function Hf(){if(Nf===0){var e=Va;e===0&&(e=dt,dt<<=1,!(dt&261888)&&(dt=256)),Nf=e}return Nf}function Uf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Dn(e)}function Wf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Uf((i[Mt]||null).action),o=r.submitter;o&&(t=(t=o[Mt]||null)?Uf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Yn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Nf!==0){var e=new FormData(i,o);rc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),rc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Gf=0;Gf<wi.length;Gf++){var Kf=wi[Gf];Ti(Kf.toLowerCase(),`on`+(Kf[0].toUpperCase()+Kf.slice(1)))}Ti(gi,`onAnimationEnd`),Ti(_i,`onAnimationIteration`),Ti(vi,`onAnimationStart`),Ti(`dblclick`,`onDoubleClick`),Ti(`focusin`,`onFocus`),Ti(`focusout`,`onBlur`),Ti(yi,`onTransitionRun`),Ti(bi,`onTransitionStart`),Ti(xi,`onTransitionCancel`),Ti(Si,`onTransitionEnd`),Xt(`onMouseEnter`,[`mouseout`,`mouseover`]),Xt(`onMouseLeave`,[`mouseout`,`mouseover`]),Xt(`onPointerEnter`,[`pointerout`,`pointerover`]),Xt(`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 qf=`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(` `),Jf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(qf));function Yf(e,t){t=!!(t&4);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){ki(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){ki(e)}i.currentTarget=null,a=c}}}}function W(e,t){var n=t[Pt];n===void 0&&(n=t[Pt]=new Set);var r=e+`__bubble`;n.has(r)||($f(t,e,2,!1),n.add(r))}function Xf(e,t,n){var r=0;t&&(r|=4),$f(n,e,r,t)}var Zf=`_reactListening`+Math.random().toString(36).slice(2);function Qf(e){if(!e[Zf]){e[Zf]=!0,qt.forEach(function(t){t!==`selectionchange`&&(Jf.has(t)||Xf(t,!1,e),Xf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zf]||(t[Zf]=!0,Xf(`selectionchange`,!1,t))}}function $f(e,t,n,r){switch(Oh(t)){case 2:var i=q;break;case 8:i=wh;break;default:i=J}n=i.bind(null,t,n,e),i=void 0,!Rn||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 ep(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 c=r.stateNode.containerInfo;if(c===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;c!==null;){if(o=Vt(c),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}c=c.parentNode}}r=r.return}Fn(function(){var r=a,i=An(n),o=[];a:{var c=Ci.get(e);if(c!==void 0){var l=Yn,u=e;switch(e){case`keypress`:if(Wn(n)===0)break a;case`keydown`:case`keyup`:l=pr;break;case`focusin`:u=`focus`,l=ir;break;case`focusout`:u=`blur`,l=ir;break;case`beforeblur`:case`afterblur`:l=ir;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`:l=nr;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=rr;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=gr;break;case gi:case _i:case vi:l=ar;break;case Si:l=_r;break;case`scroll`:case`scrollend`:l=Zn;break;case`wheel`:l=vr;break;case`copy`:case`cut`:case`paste`:l=or;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=mr;break;case`submit`:l=hr;break;case`toggle`:case`beforetoggle`:l=yr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;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=In(m,p),g!=null&&d.push(tp(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),o.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==kn&&(u=n.relatedTarget||n.fromElement)&&(Vt(u)||u[Nt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Vt(l):null,l!==null&&(f=s(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=nr,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=mr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Ut(c),h=l==null?u:Ut(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Vt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?ee(c,l,rp):null,c!==null&&ip(o,u,c,d,!1),l!==null&&f!==null&&ip(o,f,l,d,!0)))}a:{if(c=r?Ut(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=zr;else if(Nr(c)){if(Br)_=Yr;else{_=qr;var v=Kr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&wn(r.elementType)&&(_=zr):_=Jr;if(_&&=_(e,r)){Pr(o,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Ut(r):window,e){case`focusin`:(Nr(v)||v.contentEditable===`true`)&&(oi=v,si=r,ci=null);break;case`focusout`:ci=si=oi=null;break;case`mousedown`:li=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:li=!1,ui(o,n,i);break;case`selectionchange`:if(ai)break;case`keydown`:case`keyup`:ui(o,n,i)}var y;if(xr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else kr?Dr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(wr&&n.locale!==`ko`&&(kr||b!==`onCompositionStart`?b===`onCompositionEnd`&&kr&&(y=Un()):(Bn=i,Vn=`value`in Bn?Bn.value:Bn.textContent,kr=!0)),v=np(r,b),0<v.length&&(b=new sr(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=Or(n),y!==null&&(b.data=y)))),(y=Cr?Ar(e,n):jr(e,n))&&(b=np(r,`onBeforeInput`),0<b.length&&(v=new sr(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),Wf(o,e,r,n,i)}Yf(o,t)})}function tp(e,t,n){return{instance:e,listener:t,currentTarget:n}}function np(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=In(e,n),i!=null&&r.unshift(tp(e,i,a)),i=In(e,t),i!=null&&r.push(tp(e,i,a))),e.tag===3)return r;e=e.return}return[]}function rp(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ip(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=In(n,a),l!=null&&o.unshift(tp(n,l,c))):i||(l=In(n,a),l!=null&&o.push(tp(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var ap=/\r\n?/g,op=/\u0000|\uFFFD/g;function sp(e){return(typeof e==`string`?e:``+e).replace(ap,`
|
|
10
|
+
`).replace(op,``)}function cp(e,t){return t=sp(t),sp(e)===t}function lp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||bn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&bn(e,``+r);else return;break;case`className`:an(e,`class`,r);break;case`tabIndex`:an(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:an(e,n,r);break;case`style`:Cn(e,r,o);return;case`data`:if(t!==`object`){an(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Dn(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}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&lp(e,t,`name`,a.name,a,null),lp(e,t,`formEncType`,a.formEncType,a,null),lp(e,t,`formMethod`,a.formMethod,a,null),lp(e,t,`formTarget`,a.formTarget,a,null)):(lp(e,t,`encType`,a.encType,a,null),lp(e,t,`method`,a.method,a,null),lp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Dn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=On);return;case`onScroll`:r!=null&&W(`scroll`,e);return;case`onScrollEnd`:r!=null&&W(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(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=Dn(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`credentialless`: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`:W(`beforetoggle`,e),W(`toggle`,e),rn(e,`popover`,r);break;case`xlinkActuate`:on(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:on(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:on(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:on(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:on(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:on(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:on(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:on(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:on(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:rn(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=Tn.get(n)||n,rn(e,n,r);else return}tn=!0}function up(e,t,n,r,a,o){switch(n){case`style`:Cn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)bn(e,r);else if(typeof r==`number`||typeof r==`bigint`)bn(e,``+r);else return;break;case`onScroll`:r!=null&&W(`scroll`,e);return;case`onScrollEnd`:r!=null&&W(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=On);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Jt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[Mt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}tn=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):rn(e,n,r)}return}tn=!0}function dp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:W(`error`,e),W(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:lp(e,t,o,s,n,null)}}a&&lp(e,t,`srcSet`,n.srcSet,n,null),r&&lp(e,t,`src`,n.src,n,null);return;case`input`:W(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:lp(e,t,r,d,n,null)}}hn(e,o,c,l,u,s,a,!1);return;case`select`:for(a in W(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:lp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&_n(e,!!r,n,!0):_n(e,!!r,t,!1);return;case`textarea`:for(s in W(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:lp(e,t,s,c,n,null)}yn(e,r,a,o);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:lp(e,t,l,r,n,null)}return;case`dialog`:W(`beforetoggle`,e),W(`toggle`,e),W(`cancel`,e),W(`close`,e);break;case`iframe`:case`object`:W(`load`,e);break;case`video`:case`audio`:for(r=0;r<qf.length;r++)W(qf[r],e);break;case`image`:W(`error`,e),W(`load`,e);break;case`details`:W(`toggle`,e);break;case`embed`:case`source`:case`link`:W(`error`,e),W(`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(i(137,t));default:lp(e,t,u,r,n,null)}return;default:if(wn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&up(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&lp(e,t,c,r,n,null))}var fp={};function pp(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 a=null,o=null,s=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)||lp(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`:m!==f&&(tn=!0),o=m;break;case`name`:m!==f&&(tn=!0),a=m;break;case`checked`:m!==f&&(tn=!0),u=m;break;case`defaultChecked`:m!==f&&(tn=!0),d=m;break;case`value`:m!==f&&(tn=!0),s=m;break;case`defaultValue`:m!==f&&(tn=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&lp(e,t,p,m,r,f)}}mn(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||lp(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(tn=!0),p=o;break;case`defaultValue`:o!==l&&(tn=!0),c=o;break;case`multiple`:o!==l&&(tn=!0),s=o;default:o!==l&&lp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?_n(e,!!n,n?[]:``,!1):_n(e,!!n,t,!0)):_n(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:lp(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(tn=!0),p=a;break;case`defaultValue`:a!==o&&(tn=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&lp(e,t,s,a,r,o)}vn(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:lp(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`:p!==m&&(tn=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:lp(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)&&lp(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(i(137,t));break;default:lp(e,t,u,p,r,m)}return;default:if(wn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&up(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||up(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&lp(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||lp(e,t,f,p,r,m)}function mp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function hp(){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&&mp(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&&mp(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 gp=null,_p=null;function vp(e){return e.nodeType===9?e:e.ownerDocument}function yp(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 bp(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 xp(e,t,n,r){return n=vp(n).createElement(e),n[jt]=r,n[Mt]=t,dp(n,e,t),Gt(n),n}function Sp(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 Cp=null;function wp(){var e=window.event;return e&&e.type===`popstate`?e!==Cp&&(Cp=e,!0):(Cp=null,!1)}var Tp=typeof setTimeout==`function`?setTimeout:void 0,Ep=typeof clearTimeout==`function`?clearTimeout:void 0,Dp=typeof Promise==`function`?Promise:void 0,Op=typeof requestAnimationFrame==`function`?requestAnimationFrame:Tp,kp=typeof queueMicrotask==`function`?queueMicrotask:Dp===void 0?Tp:function(e){return Dp.resolve(null).then(e).catch(Ap)};function Ap(e){setTimeout(function(){throw e})}function jp(e){return e===`head`}function Mp(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),Gh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Tm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Tm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Rt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Tm(e.ownerDocument.body)}n=i}while(n);Gh(t)}function Np(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 Pp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Fp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Ip(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Lp(e){return Ip(e.getBoundingClientRect(),getComputedStyle(e),e)}function Rp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Ip(t,n,e)}function zp(e){return e.documentElement.clientHeight}function Bp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Vp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(zp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=ih(f),u>sh){s.length=o;break}f=new Promise(Bp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Hp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Hp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:E({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Hp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Hp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Up(e){return{name:e,group:new Hp(`group`,e),imagePair:new Hp(`image-pair`,e),old:new Hp(`old`,e),new:new Hp(`new`,e)}}function Wp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Wp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Yp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=qp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Gp,e,s,r)}this._eventListeners=a}};function Gp(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Wp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Yp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=qp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Kp,e,n,i),r.splice(t,1),a!==null&&a()}};function Kp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function qp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Jp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Yp(e,t,n,r){if(e.length===0)return-1;r=Jp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Jp(a.optionsOrUseCapture)===r)return i}return-1}Wp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,qp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,qp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Wp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Xp,e,void 0,void 0)};function Xp(e,t){return e.tag!==6&&(e=b(e),xm(e,t))}Wp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Zp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Xp(t[n],e);n--);};function Zp(e,t){return t.push(e),!1}Wp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=vp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Qp,e,void 0,void 0))};function Qp(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Wp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,G,e,void 0,void 0)};function G(e,t){return e.tag===6||(e=b(e),t.observe(e)),!1}Wp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,$p,e,void 0,void 0);for(var n=t=0;n<em.length;n++){var r=em[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):em[t++]=r}em.length=t}};function $p(e,t){return e.tag===6||(e=b(e),t.unobserve(e)),!1}var em=[],tm=!1;function nm(e,t,n){em.push({fragmentInstance:e,observer:t,instance:n}),tm||(tm=!0,Sm(function(){tm=!1;var e=em;em=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Wp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,rm,e,void 0,void 0),e};function rm(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Wp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Wp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Zp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||im(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function im(e,t,n,r,i){var a=Vt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=ee(n,a,T),t===null?t=!1:(h(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=ee(r,a,T),t===null?t=!1:(h(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function am(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Wp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];h(this._fragmentFiber.child,!1,Zp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),am(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),am(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function om(e,t){return e=b(e),sm(e,t),!1}function sm(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function cm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,qp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<em.length;i++){var a=em[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(em[r++]=a)}em.length=r,n.observe(e)}),sm(e,t))}function lm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,qp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?nm(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function um(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`:um(n),Bt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function dm(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[Rt])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=_m(e.nextSibling),e===null)break}return null}function fm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=_m(e.nextSibling),e===null))return null;return e}function pm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=_m(e.nextSibling),e===null))return null;return e}function mm(e){return e.data===`$?`||e.data===`$~`}function hm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function gm(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 _m(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 vm=null;function ym(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return _m(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function bm(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 xm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function Sm(e){Op(function(){Op(function(t){return e(t)})})}function Cm(e,t,n){switch(t=vp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function wm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&lp(e,t,r,null,fp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===On&&(e.onclick=null),Bt(e)}function Tm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Bt(e)}var Em=new Map,Dm=new Set;function Om(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var km=Se.d;Se.d={f:Am,r:jm,D:Pm,C:Fm,L:Im,m:Lm,X:zm,S:Rm,M:Bm};function Am(){var e=km.f(),t=Kd();return e||t}function jm(e){var t=Ht(e);t!==null&&t.tag===5&&t.type===`form`?ac(t):km.r(e)}var Mm=typeof document>`u`?null:document;function Nm(e,t,n){var r=Mm;if(r&&typeof t==`string`&&t){var i=pn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Dm.has(i)||(Dm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),dp(t,`link`,e),Gt(t),r.head.appendChild(t)))}}function Pm(e){km.D(e),Nm(`dns-prefetch`,e,null)}function Fm(e,t){km.C(e,t),Nm(`preconnect`,e,t)}function Im(e,t,n){km.L(e,t,n);var r=Mm;if(r&&e&&t){var i=`link[rel="preload"][as="`+pn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+pn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+pn(n.imageSizes)+`"]`)):i+=`[href="`+pn(e)+`"]`;var a=i;switch(t){case`style`:a=Hm(e);break;case`script`:a=Km(e)}if(!(Em.has(a)||(e=E({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Em.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Um(a))||t===`script`&&r.querySelector(qm(a))))){var o=r.createElement(`link`);dp(o,`link`,e),t===`style`&&(o[zt]=!0,o.onload=o.onerror=function(){Kt(o)}),Gt(o),r.head.appendChild(o)}}}function Lm(e,t){km.m(e,t);var n=Mm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+pn(r)+`"][href="`+pn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Km(e)}if(!Em.has(a)&&(e=E({rel:`modulepreload`,href:e},t),Em.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(qm(a)))return}r=n.createElement(`link`),dp(r,`link`,e),Gt(r),n.head.appendChild(r)}}}function Rm(e,t,n){km.S(e,t,n);var r=Mm;if(r&&e){var i=Wt(r).hoistableStyles,a=Hm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Um(a)))s.loading=5;else{e=E({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Em.get(a))&&Xm(e,n);var c=o=r.createElement(`link`);Gt(c),dp(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,Ym(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function zm(e,t){km.X(e,t);var n=Mm;if(n&&e){var r=Wt(n).hoistableScripts,i=Km(e),a=r.get(i);a||(a=n.querySelector(qm(i)),a||(e=E({src:e,async:!0},t),(t=Em.get(i))&&Zm(e,t),a=n.createElement(`script`),Gt(a),dp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Bm(e,t){km.M(e,t);var n=Mm;if(n&&e){var r=Wt(n).hoistableScripts,i=Km(e),a=r.get(i);a||(a=n.querySelector(qm(i)),a||(e=E({src:e,async:!0,type:`module`},t),(t=Em.get(i))&&Zm(e,t),a=n.createElement(`script`),Gt(a),dp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vm(e,t,n,r){var a=(a=je.current)?Om(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Hm(n.href),t=Wt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,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=Hm(n.href);var o=Wt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Um(e)))?o._p||(s.instance=o,s.state.loading=5):(o=Em.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Em.set(e,o)),Gm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Km(n),t=Wt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Hm(e){return`href="`+pn(e)+`"`}function Um(e){return`link[rel="stylesheet"][`+e+`]`}function Wm(e){return E({},e,{"data-precedence":e.precedence,precedence:null})}function Gm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[zt]){r.loading=1;return}}else t=e.createElement(`link`),t[zt]=!0,t.onload=t.onerror=Kt.bind(null,t),dp(t,`link`,n),Gt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Km(e){return`[src="`+pn(e)+`"]`}function qm(e){return`script[async]`+e}function Jm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+pn(n.href)+`"]`);if(r)return t.instance=r,Gt(r),r;var a=E({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Gt(r),dp(r,`style`,a),Ym(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Hm(n.href);var o=e.querySelector(Um(a));if(o)return t.state.loading|=4,t.instance=o,Gt(o),o;r=Wm(n),(a=Em.get(a))&&Xm(r,a),o=(e.ownerDocument||e).createElement(`link`),Gt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),dp(o,`link`,r),t.state.loading|=4,Ym(o,n.precedence,e),t.instance=o;case`script`:return o=Km(n.src),(a=e.querySelector(qm(o)))?(t.instance=a,Gt(a),a):(r=n,(a=Em.get(o))&&(r=E({},n),Zm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Gt(a),dp(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Ym(r,n.precedence,e));return t.instance}function Ym(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 Xm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Zm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Qm=null;function $m(e,t,n){if(Qm===null){var r=new Map,i=Qm=new Map;i.set(n,r)}else i=Qm,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[Rt]||a[jt]||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 eh(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function th(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 nh(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function rh(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ih(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function ah(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=ih(t),e.suspenseyImages.push(t)),e=dh.bind(e),t.decode().then(e,e))}function oh(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=Hm(r.href),a=t.querySelector(Um(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=uh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Gt(a);return}a=t.ownerDocument||t,r=Wm(r),(i=Em.get(i))&&Xm(r,i),a=a.createElement(`link`),Gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),dp(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=uh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var sh=0;function ch(e,t){return e.stylesheets&&e.count===0&&ph(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ph(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&sh===0&&(sh=62500*hp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ph(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>sh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function lh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ph(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function uh(){this.count--,lh(this)}function dh(){this.imgCount--,lh(this)}var fh=null;function ph(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,fh=new Map,t.forEach(mh,e),fh=null,uh.call(e))}function mh(e,t){if(!(t.state.loading&4)){var n=fh.get(e);if(n)var r=n.get(null);else{n=new Map,fh.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=uh.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 hh={$$typeof:oe,Provider:null,Consumer:null,_currentValue:Ce,_currentValue2:Ce,_threadCount:0};function gh(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=bt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bt(0),this.hiddenUpdates=bt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function _h(e,t,n,r,i,a,o,s,c,l,u,d){return e=new gh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=zi(3,null,null,t),e.current=a,a.stateNode=e,t=Pa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},_o(a),e}function vh(e){return e?(e=Li,e):Li}function yh(e,t,n,r,i,a){i=vh(i),r.context===null?r.context=i:r.pendingContext=i,r=yo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=bo(e,r,t),n!==null&&(Vd(n,e,t),xo(n,e,t))}function bh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xh(e,t){bh(e,t),(e=e.alternate)&&bh(e,t)}function K(e){if(e.tag===13||e.tag===31){var t=j(e,67108864);t!==null&&Vd(t,e,67108864),xh(e,67108864)}}function Sh(e){if(e.tag===13||e.tag===31){var t=Rd();t=Et(t);var n=j(e,t);n!==null&&Vd(n,e,t),xh(e,t)}}var Ch=!0;function q(e,t,n,r){var i=k.T;k.T=null;var a=Se.p;try{Se.p=2,J(e,t,n,r)}finally{Se.p=a,k.T=i}}function wh(e,t,n,r){var i=k.T;k.T=null;var a=Se.p;try{Se.p=8,J(e,t,n,r)}finally{Se.p=a,k.T=i}}function J(e,t,n,r){if(Ch){var i=Th(r);if(i===null)ep(e,t,r,Eh,n),Fh(e,r);else if(Lh(i,e,t,n,r))r.stopPropagation();else if(Fh(e,r),t&4&&-1<Ph.indexOf(e)){for(;i!==null;){var a=Ht(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=mt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-st(o);s.entanglements[1]|=c,o&=~c}Pf(a),!(id&6)&&(Cd=Ye()+500,Ff(0,!1))}}break;case 31:case 13:s=j(a,2),s!==null&&Vd(s,a,2),Kd(),xh(a,2)}if(a=Th(r),a===null&&ep(e,t,r,Eh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ep(e,t,r,null,n)}}function Th(e){return e=An(e),Dh(e)}var Eh=null;function Dh(e){if(Eh=null,e=Vt(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=l(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 Eh=e,null}function Oh(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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Xe()){case Ze:return 2;case Qe:return 8;case $e:case et:return 32;case tt:return 268435456;default:return 32}default:return 32}}var kh=!1,Ah=null,jh=null,Mh=null,Y=new Map,Nh=new Map,X=[],Ph=`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 Fh(e,t){switch(e){case`focusin`:case`focusout`:Ah=null;break;case`dragenter`:case`dragleave`:jh=null;break;case`mouseover`:case`mouseout`:Mh=null;break;case`pointerover`:case`pointerout`:Y.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Nh.delete(t.pointerId)}}function Ih(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=Ht(t),t!==null&&K(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Lh(e,t,n,r,i){switch(t){case`focusin`:return Ah=Ih(Ah,e,t,n,r,i),!0;case`dragenter`:return jh=Ih(jh,e,t,n,r,i),!0;case`mouseover`:return Mh=Ih(Mh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Y.set(a,Ih(Y.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Nh.set(a,Ih(Nh.get(a)||null,e,t,n,r,i)),!0}return!1}function Rh(e){var t=Vt(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=l(n),t!==null){e.blockedOn=t,kt(e.priority,function(){Sh(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,kt(e.priority,function(){Sh(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 zh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Th(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);kn=r,n.target.dispatchEvent(r),kn=null}else return t=Ht(n),t!==null&&K(t),e.blockedOn=n,!1;t.shift()}return!0}function Bh(e,t,n){zh(e)&&n.delete(t)}function Vh(){kh=!1,Ah!==null&&zh(Ah)&&(Ah=null),jh!==null&&zh(jh)&&(jh=null),Mh!==null&&zh(Mh)&&(Mh=null),Y.forEach(Bh),Nh.forEach(Bh)}function Hh(e,n){e.blockedOn===n&&(e.blockedOn=null,kh||(kh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vh)))}var Uh=null;function Wh(e){Uh!==e&&(Uh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Uh===e&&(Uh=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(Dh(r||n)===null)continue;break}var a=Ht(n);a!==null&&(e.splice(t,3),t-=3,rc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Gh(e){function t(t){return Hh(t,e)}Ah!==null&&Hh(Ah,e),jh!==null&&Hh(jh,e),Mh!==null&&Hh(Mh,e),Y.forEach(t),Nh.forEach(t);for(var n=0;n<X.length;n++){var r=X[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<X.length&&(n=X[0],n.blockedOn===null);)Rh(n),n.blockedOn===null&&X.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[Mt]||null;if(typeof a==`function`)o||Wh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Mt]||null)s=o.formAction;else if(Dh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Wh(n)}}}function Kh(){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 qh(e){this._internalRoot=e}Jh.prototype.render=qh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;yh(n,Rd(),e,t,null,null)},Jh.prototype.unmount=qh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;yh(e.current,2,null,e,null,null),Kd(),t[Nt]=null}};function Jh(e){this._internalRoot=e}Jh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<X.length&&t!==0&&t<X[n].priority;n++);X.splice(n,0,e),n===0&&Rh(e)}};var Yh=n.version;if(Yh!==`19.3.1`)throw Error(i(527,Yh,`19.3.1`));Se.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Xh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Zh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zh.isDisabled&&Zh.supportsFiber)try{it=Zh.inject(Xh),at=Zh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ec,s=Dc,c=Oc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=_h(e,1,!1,null,null,n,r,null,o,s,c,Kh),e[Nt]=t.current,Qf(e),new qh(t)}})),f=r(((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=d()})),p=e=>(e.match(/\d+[xX]\d+|[A-Z]?[a-z]+|[A-Z]|\d+/g)??[]).join(`-`).toLowerCase();function m(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:p(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var h=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},g=e=>{let t=h(e);return t.charAt(0).toUpperCase()+t.slice(1)},_=(...e)=>{let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of n.split(/\s+/))e&&t.add(e);return[...t].join(` `)},v={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function y(e){return e!=null}function b(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??v.width,a=e.size??e.height??v.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?_(...c):_(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??v[`stroke-width`])*Number(e.size??e.width??v.width)/Number(t.size??t.width??v.width):t.strokeWidth??v[`stroke-width`];return[`svg`,{...Object.entries(v).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&y(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&y(t.width)&&{[r(`width`)]:t.width},...`height`in t&&y(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function x(e,t={}){return b(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var S=e=>{if(typeof e!=`object`||!e)return!1;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&(t.startsWith(`aria-`)||t===`role`||t===`title`)&&e[t]!=null)return!0;return!1},C=o(),w=(0,C.createContext)({}),T=()=>(0,C.useContext)(w),ee=(0,C.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:v=`currentColor`,className:y=``}=T()??{},b=!!c||S(d),[w,ee,E=[]]=x(u,{color:e??v,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:_(y,s),hasA11yProp:b,attributes:d});return(0,C.createElement)(w,{ref:f,...ee},[...E.map(([e,t])=>(0,C.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function E(e,t=[],n=[]){let r=typeof e==`string`?m(e,t,n):e,i=(0,C.forwardRef)(({className:e,...t},n)=>(0,C.createElement)(ee,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=g(r.name)),i}var te={name:`activity`,size:24,node:[[`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`}]]};te.node;var D=E(te),O={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};O.node;var ne=E(O),re={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};re.node;var ie=E(re),ae={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};ae.node;var oe=E(ae),se={name:`box`,size:24,node:[[`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`}]]};se.node;var ce=E(se),le={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};le.node;var ue=E(le),de={name:`building`,size:24,node:[[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M12 6h.01`,key:`1vi96p`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M16 6h.01`,key:`1x0f13`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M8 6h.01`,key:`1dz90k`}],[`path`,{d:`M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`,key:`cabbwy`}],[`rect`,{x:`4`,y:`2`,width:`16`,height:`20`,rx:`2`,key:`1uxh74`}]]};de.node;var fe=E(de),pe={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};pe.node;var me=E(pe),he={name:`castle`,size:24,node:[[`path`,{d:`M10 5V3`,key:`1y54qe`}],[`path`,{d:`M14 5V3`,key:`m6isi`}],[`path`,{d:`M15 21v-3a3 3 0 0 0-6 0v3`,key:`lbp5hj`}],[`path`,{d:`M18 3v8`,key:`2ollhf`}],[`path`,{d:`M18 5H6`,key:`98imr9`}],[`path`,{d:`M22 11H2`,key:`1lmjae`}],[`path`,{d:`M22 9v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9`,key:`1rly83`}],[`path`,{d:`M6 3v8`,key:`csox7g`}]]};he.node;var ge=E(he),_e={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};_e.node;var ve=E(_e),ye={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};ye.node;var be=E(ye),xe={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};xe.node;var k=E(xe),Se={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Se.node;var Ce=E(Se),we={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};we.node;var Te=E(we),Ee={name:`circle-dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Ee.node;var De=E(Ee),Oe={name:`circle-exclamation-point`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`,`circle-alert`]};Oe.node;var ke=E(Oe),Ae={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Ae.node;var je=E(Ae),Me={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};Me.node;var Ne=E(Me),Pe={name:`cloud-rain`,size:24,node:[[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`M16 14v6`,key:`1j4efv`}],[`path`,{d:`M8 14v6`,key:`17c4r9`}],[`path`,{d:`M12 16v6`,key:`c8a4gj`}]]};Pe.node;var Fe=E(Pe),Ie={name:`cloud-sun`,size:24,node:[[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}],[`path`,{d:`M15.947 12.65a4 4 0 0 0-5.925-4.128`,key:`dpwdj0`}],[`path`,{d:`M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z`,key:`s09mg5`}]]};Ie.node;var Le=E(Ie),Re={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};Re.node;var ze=E(Re),Be={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};Be.node;var Ve=E(Be),He={name:`cone`,size:24,node:[[`path`,{d:`m20.9 18.55-8-15.98a1 1 0 0 0-1.8 0l-8 15.98`,key:`53pte7`}],[`ellipse`,{cx:`12`,cy:`19`,rx:`9`,ry:`3`,key:`1ji25f`}]]};He.node;var Ue=E(He),We={name:`copy`,size:24,node:[[`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`}]]};We.node;var Ge=E(We),Ke={name:`cylinder`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5v14a9 3 0 0 0 18 0V5`,key:`aqi0yr`}]]};Ke.node;var qe=E(Ke),Je={name:`diamond`,size:24,node:[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]};Je.node;var Ye=E(Je),Xe={name:`donut`,size:24,node:[[`path`,{d:`M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3`,key:`19sr3x`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Xe.node;var Ze=E(Xe),Qe={name:`download`,size:24,node:[[`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`}]]};Qe.node;var $e=E(Qe),et={name:`droplets`,size:24,node:[[`path`,{d:`M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z`,key:`1ptgy4`}],[`path`,{d:`M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97`,key:`1sl1rz`}]]};et.node;var tt=E(et),nt={name:`earth`,size:24,node:[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],aliases:[`globe-2`]};nt.node;var rt=E(nt),it={name:`eye-off`,size:24,node:[[`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`}]]};it.node;var at=E(it),ot={name:`eye`,size:24,node:[[`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`}]]};ot.node;var st=E(ot),ct={name:`file-code`,size:24,node:[[`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 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]};ct.node;var lt=E(ct),ut={name:`film`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]};ut.node;var dt=E(ut),ft={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};ft.node;var pt=E(ft),mt={name:`flame`,size:24,node:[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]};mt.node;var ht=E(mt),gt={name:`focus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]};gt.node;var _t=E(gt),vt={name:`folder-open`,size:24,node:[[`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`}]]};vt.node;var yt=E(vt),bt={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};bt.node;var xt=E(bt),St={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};St.node;var Ct=E(St),wt={name:`gem`,size:24,node:[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]};wt.node;var Tt=E(wt),Et={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};Et.node;var Dt=E(Et),Ot={name:`grid-2x2`,size:24,node:[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]],aliases:[`grid-2-x-2`]};Ot.node;var kt=E(Ot),At={name:`grid-3x3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`grid`,`grid-3-x-3`]};At.node;var jt=E(At),Mt={name:`grip-vertical`,size:24,node:[[`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`}]]};Mt.node;var Nt=E(Mt),Pt={name:`hand`,size:24,node:[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]};Pt.node;var Ft=E(Pt),It={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};It.node;var Lt=E(It),Rt={name:`heart`,size:24,node:[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]};Rt.node;var zt=E(Rt),Bt={name:`hexagon`,size:24,node:[[`path`,{d:`M21 16V8a2 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:`yt0hxn`}]]};Bt.node;var Vt=E(Bt),Ht={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Ht.node;var Ut=E(Ht),Wt={name:`images`,size:24,node:[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]};Wt.node;var Gt=E(Wt),Kt={name:`infinity`,size:24,node:[[`path`,{d:`M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8`,key:`18ogeb`}]]};Kt.node;var qt=E(Kt),Jt={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};Jt.node;var Yt=E(Jt),Xt={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};Xt.node;var Zt=E(Xt),Qt={name:`keyboard`,size:24,node:[[`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`}]]};Qt.node;var $t=E(Qt),en={name:`lamp`,size:24,node:[[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M4.077 10.615A1 1 0 0 0 5 12h14a1 1 0 0 0 .923-1.385l-3.077-7.384A2 2 0 0 0 15 2H9a2 2 0 0 0-1.846 1.23Z`,key:`1l7kg2`}],[`path`,{d:`M8 20a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1z`,key:`1mmzpi`}]]};en.node;var tn=E(en),nn={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};nn.node;var rn=E(nn),an={name:`library`,size:24,node:[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]};an.node;var on=E(an),sn={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};sn.node;var cn=E(sn),ln={name:`link-2-off`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]};ln.node;var un=E(ln),dn={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};dn.node;var fn=E(dn),pn={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};pn.node;var mn=E(pn),hn={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};hn.node;var gn=E(hn),_n={name:`magnet`,size:24,node:[[`path`,{d:`m12 15 4 4`,key:`lnac28`}],[`path`,{d:`M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z`,key:`nlhkjb`}],[`path`,{d:`m5 8 4 4`,key:`j6kj7e`}]]};_n.node;var vn=E(_n),yn={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};yn.node;var bn=E(yn),xn={name:`mountain`,size:24,node:[[`path`,{d:`m8 3 4 8 5-5 5 15H2L8 3z`,key:`otkl63`}]]};xn.node;var Sn=E(xn),Cn={name:`mouse-pointer-2`,size:24,node:[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]};Cn.node;var wn=E(Cn),Tn={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};Tn.node;var En=E(Tn),Dn={name:`move-3d`,size:24,node:[[`path`,{d:`M5 3v16h16`,key:`1mqmf9`}],[`path`,{d:`m5 19 6-6`,key:`jh6hbb`}],[`path`,{d:`m2 6 3-3 3 3`,key:`tkyvxa`}],[`path`,{d:`m18 16 3 3-3 3`,key:`1d4glt`}]],aliases:[`move-3-d`]};Dn.node;var On=E(Dn),kn={name:`package`,size:24,node:[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]};kn.node;var An=E(kn),jn={name:`party-popper`,size:24,node:[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]};jn.node;var Mn=E(jn),Nn={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};Nn.node;var Pn=E(Nn),Fn={name:`pen-tool`,size:24,node:[[`path`,{d:`m18 13-.654-4.736a4 4 0 00-2.756-3.266l-9.163-2.9a2 2 0 00-2.017.493l-.82.819a2 2 0 00-.492 2.017l2.9 9.163a4 4 0 003.266 2.756L13 18`,key:`93nyr4`}],[`path`,{d:`M18.648 12.352a1.205 1.205 0 011.704 0l1.296 1.296a1.205 1.205 0 010 1.704l-6.296 6.296a1.205 1.205 0 01-1.704 0l-1.296-1.296a1.205 1.205 0 010-1.704z`,key:`lnux7s`}],[`path`,{d:`m3 3 6.586 6.586`,key:`1igwcn`}],[`circle`,{cx:`11`,cy:`11`,r:`2`,key:`xmgehs`}]]};Fn.node;var In=E(Fn),Ln={name:`pencil`,size:24,node:[[`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`}]]};Ln.node;var Rn=E(Ln),zn={name:`person-standing`,size:24,node:[[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`path`,{d:`m9 20 3-6 3 6`,key:`se2kox`}],[`path`,{d:`m6 8 6 2 6-2`,key:`4o3us4`}],[`path`,{d:`M12 10v4`,key:`1kjpxc`}]]};zn.node;var Bn=E(zn),Vn={name:`pill`,size:24,node:[[`path`,{d:`m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z`,key:`wa1lgi`}],[`path`,{d:`m8.5 8.5 7 7`,key:`rvfmvr`}]]};Vn.node;var Hn=E(Vn),Un={name:`play`,size:24,node:[[`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`}]]};Un.node;var Wn=E(Un),Gn={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Gn.node;var Kn=E(Gn),qn={name:`redo-2`,size:24,node:[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]};qn.node;var Jn=E(qn),Yn={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};Yn.node;var Xn=E(Yn),Zn={name:`rewind`,size:24,node:[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]};Zn.node;var Qn=E(Zn),$n={name:`rotate-3d`,size:24,node:[[`path`,{d:`m15.194 13.707 3.814 1.86-1.86 3.814`,key:`16shm9`}],[`path`,{d:`M16.47214 7.52786 A 5 10 0 1 0 13 21.79796`,key:`1245p8`}],[`path`,{d:`M21.79796 11 A 10 5 0 1 0 19 15.57071`,key:`1i40ks`}]],aliases:[`rotate-3-d`]};$n.node;var er=E($n),tr={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};tr.node;var nr=E(tr),rr={name:`route`,size:24,node:[[`path`,{d:`M9 5h8.5a1 1 0 010 7h-11a1 1 0 000 7H15`,key:`1r1aam`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`circle`,{cx:`6`,cy:`5`,r:`3`,key:`151irh`}]]};rr.node;var ir=E(rr),ar={name:`scale-3d`,size:24,node:[[`path`,{d:`M5 7v11a1 1 0 0 0 1 1h11`,key:`13dt1j`}],[`path`,{d:`M5.293 18.707 11 13`,key:`ezgbsx`}],[`circle`,{cx:`19`,cy:`19`,r:`2`,key:`17f5cg`}],[`circle`,{cx:`5`,cy:`5`,r:`2`,key:`1gwv83`}]],aliases:[`scale-3-d`]};ar.node;var or=E(ar),sr={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};sr.node;var cr=E(sr),lr={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};lr.node;var ur=E(lr),dr={name:`settings-2`,size:24,node:[[`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`}]]};dr.node;var fr=E(dr),pr={name:`shapes`,size:24,node:[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]};pr.node;var mr=E(pr),hr={name:`shield-check`,size:24,node:[[`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`}]]};hr.node;var gr=E(hr),_r={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};_r.node;var vr=E(_r),yr={name:`snowflake`,size:24,node:[[`path`,{d:`m10 20-1.25-2.5L6 18`,key:`18frcb`}],[`path`,{d:`M10 4 8.75 6.5 6 6`,key:`7mghy3`}],[`path`,{d:`m14 20 1.25-2.5L18 18`,key:`1chtki`}],[`path`,{d:`m14 4 1.25 2.5L18 6`,key:`1b4wsy`}],[`path`,{d:`m17 21-3-6h-4`,key:`15hhxa`}],[`path`,{d:`m17 3-3 6 1.5 3`,key:`11697g`}],[`path`,{d:`M2 12h6.5L10 9`,key:`kv9z4n`}],[`path`,{d:`m20 10-1.5 2 1.5 2`,key:`1swlpi`}],[`path`,{d:`M22 12h-6.5L14 15`,key:`1mxi28`}],[`path`,{d:`m4 10 1.5 2L4 14`,key:`k9enpj`}],[`path`,{d:`m7 21 3-6-1.5-3`,key:`j8hb9u`}],[`path`,{d:`m7 3 3 6h4`,key:`1otusx`}]]};yr.node;var br=E(yr),xr={name:`sparkle`,size:24,node:[[`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 1.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`}]]};xr.node;var Sr=E(xr),Cr={name:`sparkles`,size:24,node:[[`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 1.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`}]],aliases:[`stars`]};Cr.node;var wr=E(Cr),Tr={name:`spline`,size:24,node:[[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}],[`path`,{d:`M5 17A12 12 0 0 1 17 5`,key:`1okkup`}]]};Tr.node;var Er=E(Tr),Dr={name:`square-pen`,size:24,node:[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]],aliases:[`pen-box`,`edit`,`pen-square`]};Dr.node;var Or=E(Dr),kr={name:`square-round-corner`,size:24,node:[[`path`,{d:`M21 11a8 8 0 0 0-8-8`,key:`1lxwo5`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1dv2y5`}]]};kr.node;var Ar=E(kr),jr={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};jr.node;var Mr=E(jr),Nr={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};Nr.node;var Pr=E(Nr),Fr={name:`sun-dim`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 4h.01`,key:`1ujb9j`}],[`path`,{d:`M20 12h.01`,key:`1ykeid`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M4 12h.01`,key:`158zrr`}],[`path`,{d:`M17.657 6.343h.01`,key:`31pqzk`}],[`path`,{d:`M17.657 17.657h.01`,key:`jehnf4`}],[`path`,{d:`M6.343 17.657h.01`,key:`gdk6ow`}],[`path`,{d:`M6.343 6.343h.01`,key:`1uurf0`}]]};Fr.node;var Ir=E(Fr),Lr={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};Lr.node;var Rr=E(Lr),zr={name:`switch-camera`,size:24,node:[[`path`,{d:`M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5`,key:`mtk2lu`}],[`path`,{d:`M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5`,key:`120jsl`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m18 22-3-3 3-3`,key:`kgdoj7`}],[`path`,{d:`m6 2 3 3-3 3`,key:`1fnbkv`}]]};zr.node;var Br=E(zr),Vr={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};Vr.node;var Hr=E(Vr),Ur={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Ur.node;var Wr=E(Ur),Gr={name:`trash`,size:24,node:[[`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`}]],aliases:[`trash-2`]};Gr.node;var Kr=E(Gr),qr={name:`tree-pine`,size:24,node:[[`path`,{d:`m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z`,key:`cpyugq`}],[`path`,{d:`M12 22v-3`,key:`kmzjlo`}]]};qr.node;var Jr=E(qr),Yr={name:`trees`,size:24,node:[[`path`,{d:`M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z`,key:`1l6gj6`}],[`path`,{d:`M7 16v6`,key:`1a82de`}],[`path`,{d:`M13 19v3`,key:`13sx9i`}],[`path`,{d:`M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5`,key:`1sj9kv`}]]};Yr.node;var Xr=E(Yr),Zr={name:`triangle-exclamation-point`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`,`triangle-alert`]};Zr.node;var Qr=E(Zr),$r={name:`triangle`,size:24,node:[[`path`,{d:`M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z`,key:`14u9p9`}]]};$r.node;var ei=E($r),ti={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};ti.node;var ni=E(ti),ri={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};ri.node;var ii=E(ri),ai={name:`upload`,size:24,node:[[`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`}]]};ai.node;var oi=E(ai),si={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};si.node;var ci=E(si),li={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};li.node;var ui=E(li),di={name:`wind`,size:24,node:[[`path`,{d:`M12.8 19.6A2 2 0 1 0 14 16H2`,key:`148xed`}],[`path`,{d:`M17.5 8a2.5 2.5 0 1 1 2 4H2`,key:`1u4tom`}],[`path`,{d:`M9.8 4.4A2 2 0 1 1 11 8H2`,key:`75valh`}]]};di.node;var fi=E(di),pi={name:`wine`,size:24,node:[[`path`,{d:`M8 22h8`,key:`rmew8v`}],[`path`,{d:`M7 10h10`,key:`1101jm`}],[`path`,{d:`M12 15v7`,key:`t2xh3l`}],[`path`,{d:`M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z`,key:`10ffi3`}]]};pi.node;var mi=E(pi),hi={name:`wrench`,size:24,node:[[`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`}]]};hi.node;var gi=E(hi),_i={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};_i.node;var vi=E(_i),yi={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};yi.node;var bi=E(yi),xi=f(),Si=class{files=new Map;constructor(e){for(let[t,n]of Object.entries(e??{}))this.files.set(wi(t),typeof n==`string`?new TextEncoder().encode(n):n)}async readText(e){return new TextDecoder().decode(await this.readBytes(e))}async readBytes(e){let t=this.files.get(wi(e));if(!t)throw new Ci(`notFound`,`File not found: ${e}`);return t}async writeText(e,t){this.files.set(wi(e),new TextEncoder().encode(t))}async writeBytes(e,t){this.files.set(wi(e),t)}async exists(e){return this.files.has(wi(e))}async list(e=``){let t=e?wi(e).replace(/\/?$/,`/`):``;return[...this.files.keys()].filter(e=>e.startsWith(t)).sort()}async remove(e){this.files.delete(wi(e))}async size(e){return(await this.readBytes(e)).byteLength}},Ci=class extends Error{code;name=`FsError`;constructor(e,t){super(t),this.code=e}};function wi(e){let t=e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/+/g,`/`);if(t.startsWith(`/`)||t.split(`/`).includes(`..`)||/^[a-zA-Z]:/.test(t))throw new Ci(`invalidPath`,`Invalid project path: ${e}`);return t}var Ti=`0.4.0`,Ei=Ti,A=class extends Error{code;hint;details;name=`OpsError`;constructor(e,t,n,r){super(t),this.code=e,this.hint=n,this.details=r}toJSON(){return{code:this.code,message:this.message,...this.hint?{hint:this.hint}:{},...this.details===void 0?{}:{details:this.details}}}};function Di(e,t,n){let r=t.filter(e=>e.severity===`error`),i=r[0];return new A(`validation`,`${e} ${r.length} error${r.length===1?``:`s`}${i?`, first: ${i.path?`${i.path}: `:``}${i.message}`:``}`,n??i?.hint??`Fix the listed issues (details.issues) and retry.`,{issues:t})}var Oi=e=>e.some(e=>e.severity===`error`);function ki(){return new Date().toISOString()}async function Ai(e,t,n){let r;try{r=await e.readText(t)}catch(e){throw e instanceof Ci&&e.code===`notFound`?new A(`notFound`,`${n} not found (${t}).`,t===`agent3d.json`||t===`scene.json`?"This folder is not an Agent3D project: create one with `agent3d new <dir>` (tool project_create) or pass --project <dir>.":void 0):new A(`io`,`Cannot read ${t}: ${e.message}`)}try{return JSON.parse(r)}catch(e){throw new A(`invalid`,`${t} is not valid JSON: ${e.message}`,`Fix the JSON syntax in ${t} (trailing commas and comments are not allowed).`)}}async function ji(e,t,n){await e.writeText(t,`${JSON.stringify(n,null,2)}\n`)}async function Mi(e,t,n){return await e.exists(t)?Ai(e,t,t):n}var Ni=e=>Math.round(e/1024*10)/10;function Pi(e,t){if(e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let n=Array.from({length:t.length+1},(e,t)=>t);for(let r=1;r<=e.length;r++){let i=[r];for(let a=1;a<=t.length;a++)i[a]=Math.min(n[a]+1,i[a-1]+1,n[a-1]+(e[r-1]===t[a-1]?0:1));n=i}return n[t.length]}function Fi(e,t){let n=e.toLowerCase(),r,i=1/0;for(let e of t){let t=e.toLowerCase();if(t===n)return e;let a=Pi(n,t);t.startsWith(n)||n.startsWith(t)?a=Math.min(a,1.5):n.length>=4&&(t.includes(n)||n.includes(t))&&(a=Math.min(a,2)),a<i&&(i=a,r=e)}let a=Math.max(2,Math.floor(n.length/3));return i<=a?r:void 0}function j(e,t){let n=Fi(e,t);return n?`Did you mean "${n}"? `:``}function M(e,t=40){let n=e.slice(0,t).map(e=>`"${e}"`).join(`, `);return e.length>t?`${n}, … (${e.length} total)`:n}var Ii=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function Li(e){return typeof e==`string`&&Ii.test(e)}function Ri(e,t=`item`){let n=e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``).replace(/-{2,}/g,`-`);return n?/^[a-z]/.test(n)?n:`${t}-${n}`:t}function zi(e,t){let n=new Set(t),r=Li(e)?e:Ri(e);if(!n.has(r))return r;for(let e=2;;e++)if(!n.has(`${r}-${e}`))return`${r}-${e}`}var Bi=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/;function Vi(e){if(typeof e!=`string`)return null;let t=Bi.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return!(n>0)||!(r>0)?null:{width:n,height:r,ratio:n/r}}function Hi(e){return Vi(e)!==null}function Ui(e,t){let n=Vi(e)??{ratio:16/9};return{width:Math.round(t),height:Math.max(1,Math.round(t/n.ratio))}}var N=(e,t,n,r,i)=>({name:e,type:`number`,description:t,default:n,min:r,max:i}),P=(e,t,n,r,i)=>({name:e,type:`integer`,description:t,default:n,min:r,max:i}),F=(e,t,n)=>({name:e,type:`boolean`,description:t,default:n}),I=(e,t,n)=>({name:e,type:`color`,description:t,default:n}),L=(e,t,n)=>({name:e,type:`colors`,description:t,default:n}),Wi=(e,t,n)=>({name:e,type:`vec3`,description:t,default:n}),Gi=(e,t,n,r)=>({name:e,type:`enum`,description:t,options:n,default:r}),Ki=P(`segments`,`Smoothness (radial segments).`,32,3,256),qi=[{id:`box`,description:`Box.`,params:[N(`width`,`Size on X.`,1,0),N(`height`,`Size on Y.`,1,0),N(`depth`,`Size on Z.`,1,0)],cost:`12`},{id:`roundedBox`,description:`Box with rounded edges (nice for UI-like blocks, dice, buttons).`,params:[N(`width`,`Size on X.`,1,0),N(`height`,`Size on Y.`,1,0),N(`depth`,`Size on Z.`,1,0),N(`radius`,`Corner radius.`,.1,0),P(`segments`,`Corner smoothness.`,4,1,16)],cost:`~500`},{id:`sphere`,description:`Sphere.`,params:[N(`radius`,`Radius.`,.5,0),Ki,P(`heightSegments`,`Vertical segments.`,24,2,256)],cost:`segments*heightSegments*2`},{id:`cylinder`,description:`Cylinder (different top/bottom radii make a truncated cone).`,params:[N(`radiusTop`,`Top radius.`,.5,0),N(`radiusBottom`,`Bottom radius.`,.5,0),N(`height`,`Height.`,1,0),Ki,F(`openEnded`,`No caps.`,!1)],cost:`segments*4`},{id:`cone`,description:`Cone.`,params:[N(`radius`,`Base radius.`,.5,0),N(`height`,`Height.`,1,0),Ki],cost:`segments*2`},{id:`capsule`,description:`Capsule (pill).`,params:[N(`radius`,`Radius.`,.3,0),N(`length`,`Length of the straight part.`,.6,0),P(`segments`,`Smoothness.`,16,2,64)],cost:`~1000`},{id:`torus`,description:`Torus (donut).`,params:[N(`radius`,`Ring radius.`,.5,0),N(`tube`,`Tube radius.`,.15,0),P(`radialSegments`,`Tube segments.`,24,2),P(`tubularSegments`,`Ring segments.`,64,3),N(`arc`,`Arc in degrees.`,360,0,360)],cost:`radialSegments*tubularSegments*2`},{id:`torusKnot`,description:`Torus knot (decorative).`,params:[N(`radius`,`Radius.`,.5,0),N(`tube`,`Tube radius.`,.15,0),P(`tubularSegments`,`Segments along the knot.`,128,3),P(`radialSegments`,`Tube segments.`,16,3),P(`p`,`Winds around its axis.`,2,1),P(`q`,`Winds around the torus interior.`,3,1)],cost:`tubularSegments*radialSegments*2`},{id:`plane`,description:`Flat rectangle facing +Z (rotate [-90,0,0] for a floor).`,params:[N(`width`,`Width.`,1,0),N(`height`,`Height.`,1,0),P(`widthSegments`,`Subdivisions (for shaders).`,1,1),P(`heightSegments`,`Subdivisions.`,1,1)],cost:`2`},{id:`circle`,description:`Flat disc facing +Z.`,params:[N(`radius`,`Radius.`,.5,0),Ki],cost:`segments`},{id:`ring`,description:`Flat ring facing +Z.`,params:[N(`innerRadius`,`Inner radius.`,.3,0),N(`outerRadius`,`Outer radius.`,.5,0),Ki],cost:`segments*2`},{id:`icosahedron`,description:`Icosahedron (detail 0 = low-poly gem, 3+ = smooth sphere).`,params:[N(`radius`,`Radius.`,.5,0),P(`detail`,`Subdivision.`,0,0,6)],cost:`20*4^detail`},{id:`dodecahedron`,description:`Dodecahedron.`,params:[N(`radius`,`Radius.`,.5,0),P(`detail`,`Subdivision.`,0,0,5)],cost:`36`},{id:`octahedron`,description:`Octahedron (diamond).`,params:[N(`radius`,`Radius.`,.5,0),P(`detail`,`Subdivision.`,0,0,5)],cost:`8`},{id:`tetrahedron`,description:`Tetrahedron (pyramid).`,params:[N(`radius`,`Radius.`,.5,0),P(`detail`,`Subdivision.`,0,0,5)],cost:`4`},{id:`lathe`,description:`Surface of revolution from a 2D profile (vases, bottles, chess pieces).`,params:[{name:`points`,type:`array`,description:`Profile [[x,y], …] (x = radius) from bottom to top.`,required:!0},Ki],cost:`points*segments*2`},{id:`extrude`,description:`Extruded 2D shape (stars, arrows, custom polygons).`,params:[{name:`shape`,type:`array`,description:`Polygon [[x,y], …] (closed automatically).`,required:!0},N(`depth`,`Extrusion depth.`,.2,0),N(`bevel`,`Bevel size.`,.02,0)],cost:`~points*20`},{id:`tube`,description:`Tube along a smooth curve through points (pipes, paths, ribbons).`,params:[{name:`points`,type:`array`,description:`Curve points [[x,y,z], …].`,required:!0},N(`radius`,`Tube radius.`,.05,0),P(`tubularSegments`,`Segments along the curve.`,64,2),P(`radialSegments`,`Segments around.`,8,3),F(`closed`,`Close the loop.`,!1)],cost:`tubularSegments*radialSegments*2`}],Ji=[{id:`plastic`,description:`Glossy plastic.`,props:{type:`physical`,color:`#e8e8e8`,roughness:.35,metalness:0,clearcoat:.3}},{id:`matte`,description:`Flat, non-reflective paint.`,props:{type:`standard`,color:`#d9d9d9`,roughness:.95,metalness:0}},{id:`clay`,description:`Soft clay / ceramic look (great for stylised scenes).`,props:{type:`standard`,color:`#e9dccb`,roughness:.8,metalness:0}},{id:`chrome`,description:`Mirror chrome (needs environment lighting).`,props:{type:`physical`,color:`#ffffff`,roughness:.05,metalness:1}},{id:`brushedMetal`,description:`Brushed steel.`,props:{type:`physical`,color:`#c8ccd2`,roughness:.35,metalness:1,anisotropy:.6}},{id:`gold`,description:`Polished gold.`,props:{type:`physical`,color:`#ffcf6b`,roughness:.15,metalness:1}},{id:`copper`,description:`Copper.`,props:{type:`physical`,color:`#e8926a`,roughness:.25,metalness:1}},{id:`glass`,description:`Clear refractive glass.`,props:{type:`physical`,color:`#ffffff`,roughness:.02,metalness:0,transmission:1,thickness:.5,ior:1.5}},{id:`frostedGlass`,description:`Frosted glass.`,props:{type:`physical`,color:`#ffffff`,roughness:.4,metalness:0,transmission:1,thickness:.8,ior:1.4}},{id:`rubber`,description:`Matte rubber.`,props:{type:`standard`,color:`#2b2b2b`,roughness:1,metalness:0}},{id:`pearl`,description:`Iridescent pearl.`,props:{type:`physical`,color:`#f4f1ee`,roughness:.25,metalness:0,iridescence:1,clearcoat:1}},{id:`holographic`,description:`Holographic iridescent foil.`,props:{type:`physical`,color:`#d7e3ff`,roughness:.15,metalness:.9,iridescence:1}},{id:`neon`,description:`Glowing neon (shines with bloom).`,props:{type:`standard`,color:`#ff2fd6`,emissive:`#ff2fd6`,emissiveIntensity:3,roughness:.5}},{id:`toon`,description:`Cel-shaded cartoon.`,props:{type:`toon`,color:`#ffb347`}},{id:`flat`,description:`Unlit flat colour (ignores lights).`,props:{type:`basic`,color:`#ffffff`}},{id:`lowpoly`,description:`Faceted low-poly shading.`,props:{type:`standard`,color:`#8bc34a`,roughness:.9,flatShading:!0}},{id:`velvet`,description:`Soft fabric with sheen.`,props:{type:`physical`,color:`#7b2d5b`,roughness:.9,sheen:1}},{id:`wireframe`,description:`Wireframe lines.`,props:{type:`basic`,color:`#7cf7ff`,wireframe:!0}},{id:`normal`,description:`Rainbow normals (debug / playful).`,props:{type:`normal`}},{id:`carPaint`,description:`Metallic car paint: sparkling flakes under a glossy clearcoat.`,props:{type:`physical`,color:`#b3121f`,metalness:.6,roughness:.4,clearcoat:1,clearcoatRoughness:.03,normalMap:{procedural:`flakes`,scale:40},normalScale:.2}},{id:`ceramic`,description:`Glazed ceramic / porcelain (soft body, glossy glaze).`,props:{type:`physical`,color:`#f3efe8`,roughness:.45,metalness:0,clearcoat:1,clearcoatRoughness:.06}},{id:`marble`,description:`Polished white marble with grey veins (procedural, triplanar-mapped: no UV stretching).`,props:{type:`physical`,color:`#ffffff`,roughness:.2,metalness:0,clearcoat:.4,clearcoatRoughness:.1,map:{procedural:`marble`},triplanar:.5}},{id:`terrazzo`,description:`Terrazzo stone with coloured chips (procedural, triplanar-mapped).`,props:{type:`physical`,color:`#ffffff`,roughness:.45,metalness:0,map:{procedural:`terrazzo`},triplanar:.5}},{id:`wood`,description:`Varnished wood grain (procedural texture).`,props:{type:`physical`,color:`#ffffff`,roughness:.5,metalness:0,clearcoat:.5,clearcoatRoughness:.2,map:{procedural:`wood`}}},{id:`carbonFiber`,description:`Woven carbon fibre under clearcoat (procedural texture).`,props:{type:`physical`,color:`#ffffff`,roughness:.35,metalness:.3,clearcoat:1,clearcoatRoughness:.04,map:{procedural:`carbon`,scale:12},anisotropy:.5}},{id:`leather`,description:`Fine-grain leather with soft sheen.`,props:{type:`physical`,color:`#6b3a22`,roughness:.62,metalness:0,sheen:.5,sheenRoughness:.5,sheenColor:`#c49a7a`,bumpMap:{procedural:`voronoi`,scale:60},bumpScale:.6}},{id:`satin`,description:`Satin fabric: soft anisotropic sheen.`,props:{type:`physical`,color:`#c9a0dc`,roughness:.4,metalness:0,sheen:1,sheenRoughness:.3,sheenColor:`#ffffff`,anisotropy:.4}},{id:`silk`,description:`Silk: bright, very soft sheen.`,props:{type:`physical`,color:`#f2d7c9`,roughness:.3,metalness:0,sheen:1,sheenRoughness:.2,sheenColor:`#fff4ec`,specularIntensity:.6}},{id:`brushedAluminium`,description:`Brushed aluminium with stretched (anisotropic) highlights.`,props:{type:`physical`,color:`#d9dce1`,roughness:.3,metalness:1,anisotropy:.85,roughnessMap:{procedural:`brushed`,scale:1}}},{id:`ice`,description:`Clear blue-tinted ice with a frosty surface.`,props:{type:`physical`,color:`#eaf8ff`,roughness:.1,metalness:0,transmission:1,thickness:1.2,ior:1.31,attenuationColor:`#8fd3ff`,attenuationDistance:1.2,bumpMap:{procedural:`noise`,scale:3},bumpScale:.4}},{id:`water`,description:`Liquid water: clear, slightly blue-green.`,props:{type:`physical`,color:`#ffffff`,roughness:.02,metalness:0,transmission:1,thickness:1,ior:1.333,attenuationColor:`#4fc3d9`,attenuationDistance:2}},{id:`diamond`,description:`Diamond: high IOR with rainbow dispersion (fire).`,props:{type:`physical`,color:`#ffffff`,roughness:0,metalness:0,transmission:1,thickness:2.5,ior:2.33,dispersion:8,specularIntensity:1,envMapIntensity:2.5,attenuationColor:`#dde8ff`,attenuationDistance:3}},{id:`gem`,description:`Coloured gemstone (ruby-like; change color/attenuationColor for sapphire, emerald…).`,props:{type:`physical`,color:`#ffe5ec`,roughness:0,metalness:0,transmission:1,thickness:1,ior:1.77,dispersion:2,attenuationColor:`#e0115f`,attenuationDistance:.5,envMapIntensity:1.4}},{id:`jelly`,description:`Gummy jelly: coloured, translucent, glossy.`,props:{type:`physical`,color:`#ff7aa2`,roughness:.12,metalness:0,transmission:.95,thickness:1.5,ior:1.35,attenuationColor:`#ff2d6f`,attenuationDistance:.6,clearcoat:1,clearcoatRoughness:.1}},{id:`chromeGradient`,description:"Chrome tinted by a colour ramp (set `gradient`).",props:{type:`gradient`,gradient:[`#7f5cff`,`#ff5ca8`,`#ffd36e`],metalness:1,roughness:.08}},{id:`soapBubble`,description:`Soap bubble: clear with thin-film rainbow reflections.`,props:{type:`physical`,color:`#ffffff`,roughness:0,metalness:0,transmission:1,thickness:.05,ior:1.1,iridescence:1,iridescenceIOR:1.33,iridescenceThicknessRange:[120,900],side:`double`}},{id:`mattePastel`,description:`Soft matte pastel with a velvety edge (stylised product renders).`,props:{type:`physical`,color:`#f7c8d8`,roughness:.75,metalness:0,sheen:.35,sheenRoughness:.8}},{id:`emissiveGradient`,description:"Glowing colour ramp (set `gradient`; blooms with postfx bloom).",props:{type:`gradient`,gradient:[`#00e5ff`,`#7c4dff`,`#ff3d9a`],emissive:`#ffffff`,emissiveIntensity:1.6,gradientEmissive:!0,roughness:.4}}],Yi=[{id:`plasma`,description:`Animated colourful plasma.`,params:[L(`colors`,`Palette.`,[`#ff006e`,`#8338ec`,`#3a86ff`]),N(`speed`,`Animation speed.`,1,0),N(`scale`,`Pattern scale.`,1,0)]},{id:`waves`,description:`Moving stripes / waves.`,params:[L(`colors`,`Two colours.`,[`#0b132b`,`#5bc0be`]),N(`speed`,`Speed.`,1,0),N(`frequency`,`Stripe frequency.`,8,0)]},{id:`noise`,description:`Animated smooth noise (clouds, smoke, marble).`,params:[L(`colors`,`Ramp colours.`,[`#1b1b3a`,`#ff9f1c`]),N(`speed`,`Speed.`,.3,0),N(`scale`,`Scale.`,2,0)]},{id:`hologram`,description:`Sci-fi hologram with scanlines and fresnel rim (transparent).`,params:[I(`color`,`Colour.`,`#38f9ff`),N(`speed`,`Scanline speed.`,1,0),N(`lines`,`Scanline count.`,80,0)]},{id:`gradientFlow`,description:`Smooth flowing multi-colour gradient (backgrounds, blobs).`,params:[L(`colors`,`Palette.`,[`#ff7eb3`,`#ff758c`,`#7afcff`,`#feffb7`]),N(`speed`,`Speed.`,.4,0)]},{id:`toonRim`,description:`Cartoon shading with coloured rim light.`,params:[I(`color`,`Base colour.`,`#ffb347`),I(`rim`,`Rim colour.`,`#ffffff`),P(`steps`,`Shading bands.`,3,1,8)]},{id:`dissolve`,description:"Noise dissolve driven by `uniforms.progress` (0..1) — animate it in the timeline.",params:[I(`color`,`Colour.`,`#ffffff`),I(`edge`,`Burning edge colour.`,`#ff7b00`),N(`progress`,`0 = solid, 1 = gone.`,0,0,1)]},{id:`gradientMesh`,description:`Animated mesh gradient (Stripe-like soft colour blobs) — perfect banner backdrop on a plane.`,params:[L(`colors`,`Up to 6 colours.`,[`#ff6ec4`,`#7873f5`,`#4adede`,`#ffd86f`]),N(`speed`,`Animation speed.`,.25,0),N(`scale`,`Blob scale (higher = more blobs).`,1,.1),N(`grain`,`Film grain amount.`,.04,0,1)]},{id:`aurora`,description:`Northern-lights curtains over a dark sky (planes, sky domes).`,params:[L(`colors`,`Curtain colours.`,[`#00ffa3`,`#00b3ff`,`#b400ff`]),I(`background`,`Sky colour.`,`#030714`),N(`speed`,`Speed.`,.3,0),N(`intensity`,`Brightness.`,1.2,0)]},{id:`liquidChrome`,description:`Flowing liquid chrome / metaballs with a coloured reflection ramp.`,params:[L(`colors`,`Reflection ramp.`,[`#0a0a12`,`#5a5f7a`,`#e8ecff`,`#9ab8ff`]),N(`speed`,`Flow speed.`,.35,0),N(`scale`,`Pattern scale.`,1.5,.1)]},{id:`nebula`,description:`Deep-space nebula with stars (star-nest style) — space backdrops.`,params:[L(`colors`,`Gas colours.`,[`#1b0b3b`,`#7b2ff7`,`#f72585`,`#4cc9f0`]),N(`speed`,`Drift speed.`,.05,0),N(`stars`,`Star density.`,1,0,3),N(`scale`,`Scale.`,1,.1)]},{id:`caustics`,description:`Underwater light caustics (pools, water floors, light patterns).`,params:[I(`color`,`Light colour.`,`#bff6ff`),I(`background`,`Base colour.`,`#05677d`),N(`speed`,`Speed.`,.5,0),N(`scale`,`Pattern scale.`,3,.1),N(`intensity`,`Brightness.`,1.4,0)]},{id:`fresnelGlow`,description:`Glowing rim (fresnel) — force fields, atmospheres, x-ray looks (additive, transparent).`,params:[I(`color`,`Rim colour.`,`#4cc9f0`),I(`core`,`Centre colour (black = see-through).`,`#000000`),N(`power`,`Rim sharpness.`,2.5,.1),N(`intensity`,`Brightness.`,1.5,0),N(`pulse`,`Pulse speed (0 = steady).`,0,0)]},{id:`iridescentFoil`,description:`Holographic foil: view-dependent rainbow with fine noise sparkle.`,params:[N(`speed`,`Shimmer speed.`,.3,0),N(`scale`,`Rainbow bands.`,2,.1),N(`sparkle`,`Glitter amount.`,.5,0,1),I(`tint`,`Tint.`,`#ffffff`)]},{id:`lavaLamp`,description:`Soft rising lava-lamp blobs (warm retro backdrops).`,params:[L(`colors`,`Background → blob colours.`,[`#2a0845`,`#ff512f`,`#f09819`]),N(`speed`,`Speed.`,.3,0),N(`scale`,`Blob size.`,1,.1)]},{id:`grainGradient`,description:`Static-friendly grainy gradient (editorial, film look).`,params:[L(`colors`,`Gradient colours.`,[`#ffb88c`,`#de6262`,`#4b1248`]),N(`angle`,`Gradient angle (degrees).`,30),N(`grain`,`Grain amount.`,.06,0,1),N(`speed`,`Grain animation (0 = static).`,0,0)]},{id:`matrixRain`,description:`Falling digital glyph rain (cyber / hacker look).`,params:[I(`color`,`Glyph colour.`,`#3dff7a`),I(`background`,`Background.`,`#000a03`),N(`speed`,`Fall speed.`,1,0),N(`columns`,`Columns across the surface.`,40,4,200)]}],Xi=[N(`scale`,`Pattern repeats across the texture.`,1,.05),P(`seed`,`Random seed.`,1),P(`resolution`,`Texture size in pixels.`,512,32,2048)],Zi=[{id:`marble`,description:`Veined marble.`,params:[L(`colors`,`Base → vein colours.`,[`#f4f2ee`,`#b9b6b1`,`#5d5a57`]),N(`veins`,`Vein sharpness.`,.6,0,1),N(`turbulence`,`Vein waviness.`,1,0),...Xi]},{id:`wood`,description:`Wood grain (rings + fibres).`,params:[L(`colors`,`Light → dark wood.`,[`#d9a066`,`#a0632f`,`#6b3a17`]),N(`rings`,`Growth rings.`,10,1),N(`grain`,`Fibre detail.`,.5,0,1),...Xi]},{id:`terrazzo`,description:`Terrazzo: stone chips in a cement base.`,params:[L(`colors`,`Base colour, then chip colours.`,[`#efe9e1`,`#e07a5f`,`#3d405b`,`#81b29a`,`#f2cc8f`]),N(`density`,`Chip density.`,.5,0,1),N(`chipSize`,`Chip size.`,1,.2,4),...Xi]},{id:`carbon`,description:`Twill-woven carbon fibre.`,params:[L(`colors`,`Dark → light fibre.`,[`#0b0b0d`,`#2a2c31`,`#5b5e66`]),...Xi]},{id:`noise`,description:`Smooth fractal noise (clouds, stains, variation, bump).`,params:[L(`colors`,`Ramp colours.`,[`#000000`,`#ffffff`]),P(`octaves`,`Detail layers.`,5,1,8),N(`contrast`,`Contrast.`,1,0),...Xi]},{id:`voronoi`,description:`Cells (leather grain, scales, cracked ground, stone).`,params:[L(`colors`,`Cell colour → border colour.`,[`#ffffff`,`#000000`]),N(`jitter`,`Cell irregularity.`,1,0,1),...Xi]},{id:`flakes`,description:`Metallic paint flakes — use as normalMap (sparkle) or roughnessMap.`,params:[L(`colors`,`Flake colours (map slot).`,[`#808080`,`#ffffff`]),N(`strength`,`Flake tilt (normal slot).`,.6,0,1),...Xi]},{id:`brushed`,description:`Brushed-metal streaks — use as roughnessMap or bumpMap.`,params:[L(`colors`,`Ramp colours.`,[`#9a9a9a`,`#d0d0d0`]),N(`streaks`,`Streak density.`,1,.1),...Xi]},{id:`grid`,description:`Grid lines (blueprint, tiles, sci-fi floors).`,params:[L(`colors`,`Background → line colours.`,[`#0b1d3a`,`#6fd3ff`]),P(`cells`,`Cells per texture side.`,8,1,256),N(`lineWidth`,`Line width (fraction of a cell).`,.04,0,.5),...Xi]},{id:`checker`,description:`Checkerboard.`,params:[L(`colors`,`Two colours.`,[`#ffffff`,`#222222`]),P(`cells`,`Cells per texture side.`,8,1,256),...Xi]},{id:`stripes`,description:`Stripes.`,params:[L(`colors`,`Alternating colours.`,[`#ffffff`,`#ff4d6d`]),P(`count`,`Stripes per texture side.`,8,1,256),N(`angle`,`Angle in degrees (0, 45, 90 tile seamlessly).`,0),N(`softness`,`Edge softness.`,.05,0,.5),...Xi]},{id:`dots`,description:`Polka dots.`,params:[L(`colors`,`Background → dot colours.`,[`#ffffff`,`#ff4d6d`]),P(`cells`,`Dots per texture side.`,8,1,256),N(`radius`,`Dot radius (fraction of a cell).`,.3,0,.5),...Xi]}],Qi=[N(`intensity`,`Overall brightness multiplier.`,1,0),N(`rotation`,`Rotate the whole rig around Y (degrees).`,0),F(`castShadow`,`Key light casts shadows.`,!0),N(`scale`,`Distance multiplier (big scenes).`,1,.05),I(`color`,`Tint mixed into every light (optional).`)],$i=[{id:`studio-3point`,description:`Classic key / fill / rim: warm key with soft shadow, cool fill, bright back rim. Safe default for anything.`,params:Qi},{id:`softbox`,description:`Large overhead and side softboxes (area lights): soft wrap-around product lighting with long glossy highlights.`,params:Qi},{id:`product-top`,description:`Overhead softbox + two vertical strip lights: luxury product / packshot look (best on glossy and metal).`,params:Qi},{id:`rim`,description:`Two strong back rims (cool and warm) and a faint front fill: silhouettes and edge highlights on dark backgrounds.`,params:Qi},{id:`dramatic`,description:`One hard side key (spot) with deep shadows and a thin rim — moody, high contrast.`,params:Qi},{id:`golden-hour`,description:`Low warm sun with long shadows and a blue sky fill.`,params:Qi},{id:`noon`,description:`High white sun with crisp shadows and a sky-blue fill.`,params:Qi},{id:`overcast`,description:`Soft shadowless daylight (big sky dome, faint top key).`,params:Qi},{id:`neon`,description:`Magenta and cyan side lights (area panels) over a dark ambient — night / synthwave.`,params:Qi},{id:`moonlight`,description:`Cool blue moon key with soft shadows and a dim night-sky fill.`,params:Qi}],ea=Wi(`axis`,`Axis.`,[0,1,0]),ta=[{id:`rotate`,description:`Spin continuously.`,params:[ea,N(`speed`,`Degrees per second.`,45)],example:{type:`rotate`,axis:[0,1,0],speed:30}},{id:`float`,description:`Gentle up-down floating (sine).`,params:[N(`amplitude`,`Height of the motion.`,.15,0),N(`speed`,`Cycles per second.`,.5,0),N(`phase`,`Phase offset (0..1) to desync objects.`,0)]},{id:`bob`,description:`Bouncy hop (abs sine) — characters, icons.`,params:[N(`height`,`Hop height.`,.3,0),N(`speed`,`Hops per second.`,1.5,0)]},{id:`pulse`,description:`Breathing scale.`,params:[N(`amount`,`Scale change (0.1 = ±10%).`,.08,0),N(`speed`,`Cycles per second.`,1,0)]},{id:`wobble`,description:`Jelly-like squash and stretch.`,params:[N(`amount`,`Intensity.`,.08,0),N(`speed`,`Speed.`,2,0)]},{id:`sway`,description:`Pendulum rotation back and forth (trees, signs).`,params:[Wi(`axis`,`Rotation axis.`,[0,0,1]),N(`angle`,`Max angle (degrees).`,8,0),N(`speed`,`Cycles per second.`,.5,0)]},{id:`orbit`,description:`Move in a circle around a centre.`,params:[Wi(`center`,`Centre (parent space).`,[0,0,0]),N(`radius`,`Radius.`,2,0),N(`speed`,`Degrees per second.`,30),ea,F(`faceDirection`,`Turn to face the direction of travel.`,!1),N(`phase`,`Start angle (degrees).`,0)]},{id:`path`,description:`Follow a smooth path through points.`,params:[{name:`points`,type:`array`,description:`[[x,y,z], …].`,required:!0},N(`duration`,`Seconds per lap.`,5,0),F(`loop`,`Loop (closed curve).`,!0),F(`faceDirection`,`Look along the path.`,!0)]},{id:`followPointer`,description:`Lean / move toward the mouse or finger.`,params:[N(`strength`,`How far it moves (units).`,.5,0),N(`smoothing`,`0 = instant, 0.95 = very smooth.`,.9,0,.99),Gi(`mode`,`Move or rotate.`,[`move`,`rotate`,`both`],`rotate`)]},{id:`lookAtPointer`,description:`Turn to face the pointer (eyes, heads, turrets).`,params:[N(`maxAngle`,`Max rotation (degrees).`,35,0),N(`smoothing`,`Smoothing.`,.85,0,.99)]},{id:`hoverScale`,description:`Grow when hovered.`,params:[N(`scale`,`Scale when hovered.`,1.15,0),N(`smoothing`,`Smoothing.`,.8,0,.99)]},{id:`hoverLift`,description:`Rise and tilt when hovered (cards, products).`,params:[N(`height`,`Lift.`,.2),N(`tilt`,`Tilt toward the pointer (degrees).`,10)]},{id:`clickBounce`,description:`Squash-bounce on click / tap.`,params:[N(`amount`,`Intensity.`,.25,0)]},{id:`spinOnClick`,description:`Do a full spin on click (or each time the pointer enters, with trigger hover).`,params:[ea,N(`duration`,`Seconds.`,.8,0),Gi(`trigger`,`What starts a spin: a click / tap, or the pointer entering the object.`,[`click`,`hover`],`click`)]},{id:`scrollRotate`,description:`Rotate with the page scroll.`,params:[ea,N(`degrees`,`Rotation across the whole scroll range.`,360)]},{id:`scrollMove`,description:`Move with the page scroll (parallax depth).`,params:[Wi(`offset`,`Offset across the scroll range.`,[0,2,0])]},{id:`drift`,description:`Slow random wandering inside a box (fish, dust, balloons).`,params:[Wi(`area`,`Box size around the start position.`,[1,1,1]),N(`speed`,`Speed.`,.3,0),P(`seed`,`Random seed.`,1)]},{id:`blink`,description:`Toggle visibility / flicker (lights, signs, eyes).`,params:[N(`interval`,`Seconds between blinks.`,3,0),N(`duration`,`Blink length.`,.15,0),F(`random`,`Irregular timing.`,!0)]},{id:`colorCycle`,description:`Cycle the material colour through a palette.`,params:[L(`colors`,`Palette.`,[`#ff006e`,`#8338ec`,`#3a86ff`]),N(`speed`,`Colours per second.`,.5,0),F(`emissive`,`Also drive the emissive colour.`,!1)]},{id:`flicker`,description:`Random intensity flicker (fire, candles — on lights or emissive materials).`,params:[N(`amount`,`0..1.`,.3,0,1),N(`speed`,`Speed.`,8,0)]},{id:`billboard`,description:`Always face the camera (sprites, labels).`,params:[F(`lockY`,`Only rotate around Y.`,!0)]},{id:`appear`,description:`Entrance animation when the scene becomes visible.`,params:[Gi(`effect`,`Effect.`,[`scale`,`fade`,`rise`,`drop`,`spin`],`scale`),N(`duration`,`Seconds.`,.8,0),Gi(`ease`,`Easing.`,[`outBack`,`outCubic`,`outElastic`,`outBounce`],`outBack`)]},{id:`magnet`,description:`Pulled toward the pointer when close, springs back.`,params:[N(`radius`,`Influence radius (screen fraction 0..1).`,.25,0,1),N(`strength`,`Pull (units).`,.4,0)]},{id:`spring`,description:`Follow the pointer with spring physics (overshoot and settle) — lively cards, mascots.`,params:[N(`strength`,`Travel (units) at the canvas edge.`,.4,0),N(`stiffness`,`Spring stiffness (higher = snappier).`,120,1),N(`damping`,`Damping (lower = more bounce).`,12,0),N(`mass`,`Mass.`,1,.01),Gi(`mode`,`Move, lean (rotate) or both.`,[`move`,`rotate`,`both`],`move`),N(`angle`,`Lean at the edge (degrees, rotate mode).`,15,0)],example:{type:`spring`,mode:`both`,strength:.3,damping:9}},{id:`parallax`,description:`Depth layer moving with the pointer (and the page scroll) in proportion to its depth — stack layers with different depths.`,params:[N(`depth`,`0 = background, 1 = foreground (negative: opposite way).`,.5),N(`pointer`,`Pointer travel (units) at depth 1.`,.3),N(`scroll`,`Vertical travel (units) across the scroll range at depth 1.`,0),N(`smoothing`,`Smoothing.`,.9,0,.99)],example:{type:`parallax`,depth:1,pointer:.4}},{id:`tilt`,description:`Card tilt: leans toward the pointer, lifts and scales up (product cards, posters).`,params:[N(`maxAngle`,`Max tilt (degrees).`,12,0,60),N(`scale`,`Scale while active.`,1.04,0),N(`lift`,`Move toward the camera (units, +Z).`,.1),F(`hoverOnly`,`Only while the object is hovered (else whenever the pointer is over the canvas).`,!0),F(`reverse`,`Lean away from the pointer.`,!1),N(`smoothing`,`Smoothing.`,.86,0,.99)]},{id:`breathe`,description:`Organic breathing: slow inhale, shorter exhale, Y expands most (idle characters, blobs).`,params:[N(`amount`,`Scale change (0.04 = 4 %).`,.04,0),N(`period`,`Seconds per breath.`,4,.1),N(`rise`,`Rise at full inhale (units).`,.02),N(`phase`,`Phase offset (0..1).`,0)]},{id:`noise`,description:`Organic wandering from smooth noise: position + rotation (calmer, less repetitive than float / sway).`,params:[Wi(`amplitude`,`Position amplitude per axis (units).`,[.1,.1,.05]),Wi(`rotation`,`Rotation amplitude per axis (degrees).`,[3,3,2]),N(`speed`,`Speed.`,.3,0),P(`seed`,`Noise seed.`,1)]},{id:`lookAt`,description:`Turn to face another object, the camera or a point (smoothed). The object's front is +Z.`,params:[{name:`target`,type:`string`,description:`Object id or "camera" (default).`,default:`camera`},Wi(`point`,`Look at this point instead (parent space of the scene).`),N(`smoothing`,`Smoothing.`,.85,0,.99),F(`lockY`,`Only turn around the vertical axis.`,!1)],example:{type:`lookAt`,target:`hero`,lockY:!0}}],na=[{id:`terrain`,description:`Heightmap terrain with colour bands (low-poly or smooth): hills, mountains, islands, dunes, canyons, a lake basin ringed by mountains, a valley. Trees / rocks / grass / flowers with onTerrain sit on it (and stay below its snow).`,params:[N(`size`,`Width/depth.`,40,0),P(`resolution`,`Grid cells per side.`,96,8,512),N(`height`,`Max height.`,6,0),N(`scale`,`Noise scale (bigger = wider features).`,1,0),P(`octaves`,`Detail levels.`,5,1,8),Gi(`shape`,`Overall shape. basin = low flat floor in the middle (a lake with waterLevel ≈ 0.1 × height) ringed by mountains; valley = flat-floored valley running along z between mountain walls, closed by mountains at the far end (-z): a camera on +z looks down it.`,[`hills`,`mountains`,`island`,`dunes`,`canyon`,`basin`,`valley`,`flat`],`hills`),N(`edgeFalloff`,`Fraction (0..1) of the half-size over which the borders sink smoothly below 0 (no vertical cut walls at the edge). Default per shape: mountains 0.3, basin 0.2, valley 0.15, others 0.`,void 0,0,1),L(`palette`,`Colours from low to high (sand, grass, rock, snow).`,[`#e2c290`,`#6aa84f`,`#38761d`,`#7f6a5d`,`#ffffff`]),F(`lowpoly`,`Faceted shading.`,!0),N(`waterLevel`,`Water surface height in world units (absolute, not a fraction of height); null = no water.`,.6),I(`waterColor`,`Water colour.`,`#3d9bd6`),F(`waterPlane`,"Draw the built-in water plane at waterLevel. false = add your own `water` object at y = waterLevel (full control of colours, waves, foam); waterLevel still colours the shore and keeps trees / grass / flowers out of the lake.",!0),N(`snowLine`,`Height fraction (0..1, above the water) where the last palette colour (snow) caps the peaks; 1 = summit only. Relative to this terrain's own relief: use snowHeight for the same snow altitude across terrains.`,1,0,1),N(`snowHeight`,`Absolute snow altitude in terrain units (like waterLevel): everything above is snow-capped. Overrides snowLine.`,void 0,0)],cost:`resolution^2*2+(1-lowpoly)*max(resolution, 48)^2*2+~3200*lowpoly`,material:`The ground (not the water plane). Without colour / preset / map the palette bands are kept (e.g. { "roughness": 0.6, "flatShading": false }).`},{id:`trees`,description:`Scattered stylised trees.`,params:[P(`count`,`How many.`,30,1,2e3),Wi(`area`,`Scatter box (x, 0, z).`,[30,0,30]),Gi(`style`,`Tree style.`,[`pine`,`round`,`palm`,`birch`,`dead`,`mixed`],`mixed`),N(`minScale`,`Min scale.`,.7,0),N(`maxScale`,`Max scale.`,1.4,0),L(`leafColors`,`Foliage colours.`,[`#2e7d32`,`#43a047`,`#66bb6a`]),I(`trunkColor`,`Trunk colour.`,`#6d4c41`),F(`onTerrain`,`Drop onto a sibling terrain generator.`,!0),F(`sway`,`Wind sway animation.`,!0)],cost:`count*(70*style_pine+200*style_round+460*style_palm+430*style_birch+220*style_dead+212*style_mixed)`},{id:`rocks`,description:`Scattered low-poly rocks.`,params:[P(`count`,`How many.`,20,1,2e3),Wi(`area`,`Scatter box.`,[20,0,20]),N(`minSize`,`Min size.`,.3,0),N(`maxSize`,`Max size.`,1.5,0),L(`colors`,`Colours.`,[`#8d8d8d`,`#757575`,`#9e9e9e`]),F(`onTerrain`,`Drop onto a sibling terrain.`,!0)],cost:`count*40`,material:`Every rock. Without colour / preset / map the per-rock colours are kept.`},{id:`grass`,description:`Instanced grass blades swaying in the wind.`,params:[P(`count`,`Blades.`,5e3,1,1e5),Wi(`area`,`Area.`,[20,0,20]),N(`height`,`Blade height.`,.4,0),L(`colors`,`Colours (base → tip).`,[`#2d6a1f`,`#8bc34a`]),N(`wind`,`Wind strength.`,.5,0),F(`onTerrain`,`Follow a sibling terrain.`,!0)],cost:`count*3`},{id:`flowers`,description:`Scattered little flowers.`,params:[P(`count`,`How many.`,200,1,2e4),Wi(`area`,`Area.`,[20,0,20]),L(`colors`,`Petal colours.`,[`#ff5d8f`,`#ffd166`,`#ffffff`,`#9b5de5`]),F(`onTerrain`,`Follow a sibling terrain.`,!0)],cost:`count*56`},{id:`water`,description:`Animated stylised water: waves, shallow → deep colour from the terrain depth below, animated shore foam lines, ripple normals with a moving sun glint, fresnel.`,params:[N(`size`,`Width/depth.`,40,0),I(`color`,`Deep colour.`,`#1e6fa8`),I(`shallowColor`,`Shallow / crest colour.`,`#5ec8e5`),I(`foamColor`,`Foam colour.`,`#ffffff`),N(`waveHeight`,`Wave height.`,.15,0),N(`waveSpeed`,`Wave speed.`,1,0),N(`foam`,`Shore foam band width (depth units; 0 = none). Needs a sibling terrain below.`,.6,0),N(`ripples`,`Ripple normal strength (sun glint).`,1,0),N(`depthRange`,`Depth at which the colour is fully deep.`,3,.01),N(`opacity`,`Opacity.`,.9,0,1),F(`lowpoly`,`Faceted low-poly water (no ripples).`,!1),F(`reflections`,`Planar mirror reflections of the scene (mirror lakes at sunrise; lower waveHeight / ripples for a calm mirror). Costly: the scene is rendered a second time each frame (half resolution on the medium tier, off on the low tier).`,!1),N(`reflectivity`,`Reflection strength with reflections on (fresnel: stronger at grazing angles).`,.8,0,1)],cost:`min(size*(3-1.6*lowpoly), 160)^2*2`},{id:`clouds`,description:`Drifting clouds: soft puffy cotton balls (or faceted low-poly), bright tops, cool shadowed undersides, silver-lining rim.`,params:[P(`count`,`Clouds.`,8,1,200),Wi(`area`,`Area.`,[40,6,40]),N(`height`,`Altitude.`,10),N(`size`,`Cloud size factor.`,1,0),I(`color`,`Colour (lit tops).`,`#ffffff`),I(`shadowColor`,`Underside colour.`,`#a9bdd6`),N(`speed`,`Drift speed.`,.3,0),Gi(`style`,`puffy = smooth soft puffs, lowpoly = faceted.`,[`puffy`,`lowpoly`],`puffy`)],cost:`count*(2600-1950*style_lowpoly)`},{id:`city`,description:`Procedural city blocks with buildings (skylines, isometric towns).`,params:[P(`blocks`,`Blocks per side.`,6,1,40),N(`blockSize`,`Block size.`,4,0),N(`street`,`Street width.`,1.2,0),N(`minHeight`,`Min building height.`,1,0),N(`maxHeight`,`Max building height.`,8,0),L(`colors`,`Building colours.`,[`#e0e1dd`,`#778da9`,`#415a77`,`#ffd6a5`]),F(`windows`,`Lit windows (emissive).`,!0),I(`windowColor`,`Window colour.`,`#ffe8a3`),F(`trees`,`Street trees.`,!0)],cost:`blocks^2*(235+205*trees)`},{id:`character`,description:`Chibi character or mascot built from soft clay-like primitives on a real skeleton: expressive face (eyes with highlights, brows, mouth expressions), hair styles, outfits, accessories and procedural animations (idle, walk, run, wave, jump, dance, cheer, celebrate, sit, point, talk). Styles: humanoid, astronaut (bubble helmet), robot (glowing screen face), blob, cat, fox, bird, ghost.`,params:[Gi(`style`,`Body style.`,[`humanoid`,`astronaut`,`robot`,`blob`,`cat`,`fox`,`bird`,`ghost`],`humanoid`),I(`skin`,`Skin / fur / body colour (default per style).`),I(`shirt`,`Top / suit colour (robot: metal, blob: body, bird: wings; default per style).`),I(`pants`,`Bottom colour (robot: joints; default per style).`),I(`hair`,`Hair / brows colour (cat: stripes, fox: socks and ear tips, bird: crest; default per style).`),I(`accent`,`Accent: shoes, caps, scarves, robot glow, nose, beak (default per style).`),Gi(`expression`,`Facial expression (cheer / celebrate / dance / run switch the default happy face to a laugh).`,[`happy`,`laugh`,`neutral`,`surprised`,`wink`,`sad`,`angry`,`sleepy`],`happy`),Gi(`hairStyle`,`Hair style (humanoid).`,[`short`,`long`,`bob`,`bun`,`ponytail`,`spiky`,`curly`,`none`],`short`),Gi(`outfit`,`Outfit (humanoid).`,[`tshirt`,`hoodie`,`dress`,`suit`,`overalls`],`tshirt`),{name:`accessories`,type:`array`,description:`Accessories (humanoid / astronaut): any of cap, beanie, crown, glasses, sunglasses, headphones, backpack, scarf, bowtie.`,default:[],options:[`cap`,`beanie`,`glasses`,`sunglasses`,`headphones`,`backpack`,`scarf`,`bowtie`,`crown`]},Gi(`animation`,`Animation. sit = sitting on the ground; point = points to the screen right (mirror with scale [-1, 1, 1] to point left).`,[`idle`,`walk`,`run`,`wave`,`jump`,`dance`,`cheer`,`celebrate`,`sit`,`point`,`talk`,`none`],`idle`),N(`animationSpeed`,`Animation speed.`,1,0),N(`height`,`Total height.`,1.8,0),Gi(`shading`,`smooth = soft claymation, lowpoly = faceted (fewer triangles), toon = cel-shaded.`,[`smooth`,`lowpoly`,`toon`],`smooth`),F(`eyesFollowPointer`,`Head turns toward the pointer.`,!1)],cost:`(16100*style_humanoid+17300*style_astronaut+11600*style_robot+7700*style_blob+9500*style_cat+9800*style_fox+9100*style_bird+6400*style_ghost)*(1-0.82*shading_lowpoly)`},{id:`planet`,description:`Small stylised planet with continents, optional rings and atmosphere.`,params:[N(`radius`,`Radius.`,2,0),L(`palette`,`Ocean, land, mountain, ice.`,[`#2a6f97`,`#52b788`,`#8d6e63`,`#ffffff`]),N(`landAmount`,`0..1.`,.45,0,1),F(`rings`,`Rings.`,!1),I(`ringColor`,`Ring colour.`,`#e9c46a`),F(`atmosphere`,`Glow halo.`,!0),I(`atmosphereColor`,`Halo colour.`,`#8ecae6`),P(`detail`,`Subdivision.`,5,1,7),N(`spin`,`Globe rotation around its own (ring) axis in deg/s — use this rather than a rotate behaviour so the rings stay stable.`,0)],cost:`20*4^detail+~700`,material:`The globe surface (ocean + land; rings and atmosphere keep theirs). Without colour / preset / map the palette is kept.`},{id:`starfield`,description:`Large sphere of stars around the scene (space backdrops).`,params:[P(`count`,`Stars.`,3e3,1,5e4),N(`radius`,`Distance.`,80,0),L(`colors`,`Star colours.`,[`#ffffff`,`#cfe2ff`,`#ffe8c2`]),N(`size`,`Star size.`,.25,0),F(`twinkle`,`Twinkle.`,!0)],cost:`count`},{id:`blob`,description:`Organic animated blob (noise-displaced sphere) — modern hero banners.`,params:[N(`radius`,`Radius.`,1.2,0),N(`noise`,`Displacement amount.`,.3,0),N(`speed`,`Morph speed.`,.4,0),P(`detail`,`Smoothness.`,64,8,256),L(`colors`,`Colour ramp flowing over the surface (brand colours).`,[`#ff7eb3`,`#a78bfa`,`#60a5fa`,`#5eead4`])],cost:`detail^2*2`,material:`The whole blob; the morph keeps running with any material, shaders included (e.g. { "type": "shader", "shader": "gradientFlow" }, { "preset": "chrome" }). Without colour / preset / map the colour ramp is kept (e.g. { "type": "toon" }).`},{id:`waveGrid`,description:`Grid of points / bars rippling like a wave (tech / data banners).`,params:[P(`columns`,`Columns.`,60,2,400),P(`rows`,`Rows.`,30,2,400),N(`spacing`,`Spacing.`,.3,0),N(`amplitude`,`Wave height.`,.5,0),N(`speed`,`Speed.`,1,0),Gi(`shape`,`Element.`,[`dots`,`bars`,`lines`],`dots`),L(`colors`,`Colour ramp.`,[`#3a86ff`,`#ff006e`]),F(`pointerRipple`,`Ripple under the pointer.`,!0)],cost:`columns*rows*(1+shape_lines+11*shape_bars)`},{id:`maze`,description:`Grid maze walls from a seed (games).`,params:[P(`columns`,`Cells on X.`,10,2,60),P(`rows`,`Cells on Z.`,10,2,60),N(`cellSize`,`Cell size.`,2,0),N(`wallHeight`,`Wall height.`,1.5,0),I(`wallColor`,`Walls.`,`#5e548e`),I(`floorColor`,`Floor.`,`#e0b1cb`),F(`bodies`,`Add static physics bodies to walls.`,!0)],cost:`columns*rows*7`},{id:`road`,description:`Endless-runner road made of tiles that scroll toward the camera.`,params:[N(`width`,`Road width.`,6,0),N(`length`,`Visible length.`,60,0),P(`lanes`,`Lanes.`,3,1,8),I(`color`,`Asphalt.`,`#3d405b`),I(`lineColor`,`Lane lines.`,`#f4f1de`),N(`speed`,`Scroll speed (units/s), read by scripts as state.speed when set.`,10,0),L(`curbColors`,`Curb colours: two alternate (red / white kerbs); one = a solid curb (e.g. neon yellow).`,[`#e63946`,`#f1faee`]),F(`verge`,`Striped verges on both sides (false = road and curbs only, e.g. over a dark ground or a grid).`,!0),L(`vergeColor`,`Verge colours: two alternating stripes; one = that colour plus a slightly darker stripe.`,[`#7cc45a`,`#6bb44c`])],cost:`length*14+~220`},{id:`birds`,description:`Flock of stylised birds (one instanced draw call): V-shaped wings with a dihedral (a chevron from every angle), flapping in the shader and alternating with glides; boids-like flight (loose cloud or V formation, wander, banking into turns) that is a pure function of time. Modes: orbit (circle the area), path (closed loop through points), drift (cross the sky and wrap).`,params:[P(`count`,`Birds.`,12,1,500),Gi(`mode`,"Flight: orbit = flock circles an ellipse of radii area x/2, z/2 around the object position; path = closed loop through `points`; drift = crosses `area` x along `heading`, each bird wrapping around (keep the area wider than the view).",[`orbit`,`path`,`drift`],`orbit`),Wi(`area`,`Orbit ellipse (x, z = diameters) / drift length (x) and vertical drift range (y).`,[40,4,30]),{name:`points`,type:`array`,description:`path mode: [[x, y, z], …] (≥ 2 points, local to the object), flown as a closed smooth loop.`,default:[]},N(`heading`,`drift mode: direction in degrees around Y (0 = +x, left → right for a camera on +z; 180 = right → left; 90 = away from the camera).`,0),N(`speed`,`Flight speed (units/s).`,4,0),Gi(`formation`,"loose = a cloud of radius `spread` where each bird wanders; v = V formation (geese).",[`loose`,`v`],`loose`),N(`spread`,`loose formation radius.`,3,0),N(`size`,`Wingspan.`,1,.01),I(`color`,`Bird colour (each bird varies ±10 %). Dark reads as a silhouette against a bright sky.`,`#22252e`),N(`flapSpeed`,`Wing beats per second (each bird varies ±18 %).`,2.5,0)],example:{count:9,mode:`drift`,formation:`v`,area:[80,2,0],heading:10,speed:5,size:1.2},cost:`count*15`},{id:`floatingIsland`,description:`Stylised floating island diorama (hero favourite): grassy rolling top with a noisy outline, dirt band, rocky underside tapering to stalactite tips with coloured strata; optional trees, rocks, flowers, grass, a pond with a waterfall, floating debris and a slow bob.`,params:[N(`radius`,`Top radius.`,3,.1),N(`depth`,`Underside depth (top to tip).`,3.6,.1),N(`hills`,`Top relief (0 = flat lawn).`,1,0,4),L(`grassColors`,`Grass colours (dark → light).`,[`#4f9a3a`,`#7cc24a`,`#b5dd6a`]),I(`dirtColor`,`Dirt band colour.`,`#8a5a3c`),L(`rockColors`,`Rock strata colours of the underside.`,[`#7d6b5e`,`#93806f`,`#6a5a52`,`#a08c76`]),P(`trees`,`Trees planted on top.`,6,0,200),Gi(`treeStyle`,`Tree style.`,[`pine`,`round`,`palm`,`birch`,`dead`,`mixed`],`round`),L(`leafColors`,`Tree foliage colours.`,[`#2e7d32`,`#43a047`,`#7cb342`]),P(`rocks`,`Rocks on top.`,5,0,200),P(`flowers`,`Flowers on top.`,60,0,5e3),P(`grass`,`Grass blades on top.`,1500,0,3e4),F(`waterfall`,`Pond + waterfall pouring off the edge.`,!0),I(`waterColor`,`Pond / waterfall colour.`,`#4fc3f7`),P(`debris`,`Small rocks floating around.`,6,0,100),N(`float`,`Bob amplitude (0 = still).`,.12,0),F(`lowpoly`,`Faceted shading.`,!0)],cost:`~2500+7300*(1-lowpoly)+trees*220+grass*3+flowers*56`,material:`The island body (top + underside). Without colour / preset / map the vertex colours are kept.`},{id:`globe`,description:`Data globe for SaaS / network heroes: dot-matrix Earth (simplified continents), fresnel atmosphere, pulsing location markers and great-circle arcs with travelling light pulses between lat/lon points.`,params:[N(`radius`,`Radius.`,2,.1),P(`dots`,`Dot lattice density (dots on the whole sphere before the land mask).`,12e3,200,6e4),F(`continents`,`Dots only on land (simplified continents).`,!0),I(`dotColor`,`Land dot colour.`,`#7dd3fc`),I(`oceanDotColor`,`Ocean dot colour (same as baseColor = no ocean dots).`,`#0b1630`),I(`baseColor`,`Globe body colour.`,`#0b1630`),N(`dotSize`,`Dot size factor.`,1,0),{name:`points`,type:`array`,description:`Markers: [[lat, lon], …] or [{ "lat": 48.85, "lon": 2.35 }, …].`,default:[]},{name:`arcs`,type:`array`,description:`Arcs: [[[lat, lon], [lat, lon]], …] or [{ "from": [lat, lon], "to": [lat, lon] }, …]. Endpoints get markers.`,default:[]},I(`arcColor`,`Arc colour.`,`#f472b6`),N(`arcSpeed`,`Pulse speed along the arcs.`,1,0),N(`arcWidth`,`Arc thickness factor.`,1,0),I(`markerColor`,`Marker colour.`,`#fde68a`),N(`markerSize`,`Marker size factor.`,1,0),F(`atmosphere`,`Atmosphere glow.`,!0),I(`atmosphereColor`,`Atmosphere colour.`,`#38bdf8`),N(`spin`,`Rotation speed (deg/s).`,6),N(`longitude`,`Longitude facing the camera at t = 0 (degrees).`,0),N(`tilt`,`Axis tilt (degrees).`,12)],cost:`dots*(1.9+4.1*(1-continents))+~18000`,material:`The globe body sphere (dots, arcs and atmosphere keep theirs).`},{id:`crystals`,description:`Glowing gem crystals: faceted hexagonal prisms with pointed tips (cluster on a rock base, ring, or scatter), base → tip colour gradient, emissive fresnel glow that pulses. Pair with the bloom post effect.`,params:[P(`count`,`Crystals.`,14,1,400),N(`size`,`Height of a typical crystal.`,1.2,0),L(`colors`,`Gem colours (each crystal blends from one colour to the next).`,[`#7c3aed`,`#22d3ee`,`#f0abfc`]),Gi(`layout`,`Arrangement.`,[`cluster`,`ring`,`scatter`],`cluster`),N(`spread`,`Cluster radius / ring radius / scatter half-size.`,1,0),N(`glow`,`Emissive glow strength.`,.8,0),N(`pulse`,`Glow pulse amount (0 = steady).`,1,0),N(`opacity`,`Opacity (< 1 = translucent).`,1,0,1),F(`base`,`Rock base under a cluster.`,!0),I(`baseColor`,`Base rock colour.`,`#4b4560`)],cost:`count*16.5+~560*base*layout_cluster`,material:`The crystals (not the base). Without colour / preset / map the gradients are kept.`},{id:`galaxy`,description:`Spiral galaxy of soft additive stars: logarithmic arms, warm bulge, star-forming knots, glowing core and differential rotation (inner faster). Space / AI / tech heroes.`,params:[P(`count`,`Stars.`,4e4,100,3e5),N(`radius`,`Radius.`,6,.1),P(`arms`,`Spiral arms.`,3,1,8),N(`twist`,`Arm winding (radians from centre to rim).`,5,0),N(`thickness`,`Disc thickness (fraction of radius).`,.05,0),I(`coreColor`,`Core colour.`,`#ffd8a8`),I(`armColor`,`Outer arm colour.`,`#6d8bff`),I(`accentColor`,`Star-forming knots colour.`,`#ff7ac8`),N(`size`,`Star size.`,.035,0),N(`speed`,`Rotation speed.`,.3),N(`coreGlow`,`Core glow opacity.`,.9,0,1)],cost:`count`},{id:`bars3d`,description:`3D bar chart from data (row or grid) with rounded / box / cylinder bars, colour ramp by value / row / column, base plate and an eased staggered grow entrance (or a looping wave). Dashboards, stats, fintech heroes.`,params:[{name:`data`,type:`array`,description:`Values: [3, 5, 8] (one row) or [[3, 5], [4, 7]] (grid: rows go back in depth). Items may be { "value": n }.`,default:[3,5,4,7,6,9,8]},N(`barWidth`,`Bar width.`,.6,.01),N(`gap`,`Gap between bars.`,.25,0),N(`maxHeight`,`Height of the largest value.`,3,.01),L(`colors`,`Colour ramp (value) or palette (row / column).`,[`#93c5fd`,`#6366f1`,`#c026d3`]),Gi(`colorBy`,`What picks the colour.`,[`value`,`row`,`column`],`value`),Gi(`shape`,`Bar shape.`,[`rounded`,`box`,`cylinder`],`rounded`),Gi(`animation`,`grow = staggered entrance from t = 0; wave = looping ripple.`,[`grow`,`wave`,`none`],`grow`),N(`duration`,`Grow duration (s).`,1.6,.01),F(`base`,`Base plate.`,!0),I(`baseColor`,`Base plate colour.`,`#eef2ff`)],cost:`dataCells*(970*shape_rounded+12*shape_box+128*shape_cylinder)+~590`,material:`Every bar (per-bar colours are kept as instance colours).`},{id:`abstractShapes`,description:`Abstract Memphis / pastel composition for banners: spheres, tori, rings, pills, cones, cubes, half-discs, squiggles, triangles and stars evenly spread in a slab, gently floating and turning.`,params:[P(`count`,`Shapes.`,22,1,300),Wi(`area`,`Slab size (x, y, z).`,[10,4,2]),L(`colors`,`Palette.`,[`#ff8fab`,`#ffd166`,`#06d6a0`,`#118ab2`,`#a78bfa`,`#ff6b6b`]),{name:`shapes`,type:`array`,description:`Subset of shape kinds (default all): sphere, torus, ring, pill, cone, cube, halfDisc, squiggle, triangle, star.`,options:[`sphere`,`torus`,`ring`,`pill`,`cone`,`cube`,`halfDisc`,`squiggle`,`triangle`,`star`]},N(`minSize`,`Smallest shape size.`,.5,0),N(`maxSize`,`Largest shape size.`,1.6,0),Gi(`style`,`Material look.`,[`matte`,`glossy`,`toon`],`matte`),N(`motion`,`Float / spin amount (0 = still).`,1,0)],cost:`count*1250`,material:`Every shape (per-shape palette colours are kept as instance colours).`}],ra=[`point`,`soft`,`square`,`circle`,`star`,`spark`,`streak`,`heart`,`bubble`,`smoke`,`petal`,`leaf`,`ring`],ia=[P(`count`,`Number of particles (preset value when omitted; e.g. stars 900, snow 1200, fireflies 90).`,void 0,1,2e5),Wi(`area`,`Size [x, y, z] of the box the particles live in / are emitted from, centred on the object.`),{name:`size`,type:`number`,description:`Sprite size in units (world space).`,min:0},{name:`color`,type:`colors`,description:`A colour or a list of colours (each particle picks one), e.g. "#ffffff" or ["#ff006e", "#ffbe0b"].`},N(`speed`,"Speed in units/s along `direction` (0 = static).",void 0,0),Wi(`direction`,`Main direction of motion, e.g. [0, -1, 0] falls, [0, 1, 0] rises.`),N(`spread`,`Direction randomness 0 (parallel) … 1 (any direction).`,void 0,0,1),{name:`lifetime`,type:`number`,description:`Seconds a particle lives (emitters: sparks, embers, smoke…); omitted / 0 = forever (positions wrap inside the area).`,min:0},N(`opacity`,`Opacity 0…1.`,void 0,0,1),Gi(`blending`,`additive glows (sparks, magic, stars), normal keeps colours (snow, confetti, petals).`,[`normal`,`additive`]),Gi(`shape`,`Sprite shape.`,ra),P(`seed`,`Random seed (same seed = same particles).`)],aa=[{id:`stars`,description:`Twinkling static stars.`,params:ia},{id:`snow`,description:`Falling soft snowflakes.`,params:ia},{id:`rain`,description:`Falling rain streaks (velocity-stretched).`,params:ia},{id:`fireflies`,description:`Glowing wandering dots.`,params:ia},{id:`confetti`,description:`Colourful confetti falling and spinning.`,params:ia},{id:`sparks`,description:`Sparks fountain: fast streaks arcing under gravity, cooling from yellow to red (additive). Small emitter area: place it at the source.`,params:ia},{id:`dust`,description:`Slow floating dust motes.`,params:ia},{id:`bubbles`,description:`Rising bubbles.`,params:ia},{id:`embers`,description:`Rising glowing embers cooling to red.`,params:ia},{id:`hearts`,description:`Rising little hearts.`,params:ia},{id:`magic`,description:`Magic sparkles: twinkling star glints rising and shrinking (additive) — wands, reveals, product magic.`,params:ia},{id:`smoke`,description:`Soft rising smoke puffs that grow and fade (noise-shaped). Small emitter area: place it at the chimney / source.`,params:ia},{id:`fire`,description:`Flickering flame: additive noisy puffs rising fast, yellow → red, shrinking. Small emitter area: place it at the base of the fire.`,params:ia},{id:`petals`,description:`Cherry-blossom petals drifting down, fluttering and spinning.`,params:ia},{id:`leaves`,description:`Autumn leaves falling, fluttering and spinning.`,params:ia},{id:`galaxyDust`,description:`Flat disc of twinkling cosmic dust slowly swirling (inner faster).`,params:ia},{id:`bokeh`,description:`Big soft out-of-focus light orbs drifting (dreamy backgrounds).`,params:ia}],oa=[`none`,`cinematic`,`teal-orange`,`warm`,`cool`,`bleach`,`noir`,`vintage`,`pastel`],R=[`cinematic`,`product`,`dreamy`,`neon`,`retro`,`clean`],sa={cinematic:{description:`Soft S-curve, slightly desaturated, teal shadows / warm highlights.`,values:{contrast:1.12,saturation:.92,vibrance:.1,shadows:`#2f6f86`,highlights:`#ffb27a`,toning:.32,lift:.015,gain:1.02}},"teal-orange":{description:`Blockbuster complementary split: teal shadows, orange skin / highlights.`,values:{contrast:1.18,saturation:1.05,vibrance:.2,shadows:`#1b6f8a`,highlights:`#ff9a4a`,toning:.55,gain:1.03}},warm:{description:`Golden-hour warmth.`,values:{temperature:.3,tint:.04,saturation:1.06,contrast:1.05,highlights:`#ffcf8f`,toning:.2}},cool:{description:`Crisp cool daylight / tech.`,values:{temperature:-.3,saturation:.96,contrast:1.06,shadows:`#2d5c9e`,toning:.22}},bleach:{description:`Bleach bypass: desaturated, punchy, metallic.`,values:{bleach:.65,saturation:.7,contrast:1.2}},noir:{description:`Black and white, deep contrast.`,values:{saturation:0,contrast:1.35,lift:-.02,gain:1.06}},vintage:{description:`Faded film print: lifted blacks, warm, muted greens.`,values:{saturation:.78,contrast:.92,lift:.07,gain:.96,temperature:.15,shadows:`#4f6a5a`,highlights:`#ffe0ae`,toning:.35}},pastel:{description:`Airy, soft and bright.`,values:{saturation:.82,contrast:.86,lift:.08,gamma:1.08,highlights:`#ffe3ef`,shadows:`#8a9fd8`,toning:.25}}},ca={cinematic:{description:`Film-like: contact AO, restrained bloom, teal / orange grade, soft vignette, fine grain, supersampled stills.`,effects:[{type:`ao`,intensity:.9,radius:.6},{type:`bloom`,strength:.25,radius:.6,threshold:2.2,smoothing:.4},{type:`grading`,look:`cinematic`},{type:`vignette`,offset:1,darkness:.75},{type:`film`,intensity:.06},{type:`taa`,samples:8}]},product:{description:`Clean studio product shot: strong contact AO, crisp detail, neutral punchy grade, faint vignette, supersampled stills.`,effects:[{type:`ao`,intensity:1.1,radius:.5},{type:`bloom`,strength:.15,radius:.5,threshold:2.5,smoothing:.4},{type:`grading`,contrast:1.07,saturation:1.04,vibrance:.1},{type:`sharpen`,amount:.25},{type:`vignette`,offset:1.1,darkness:.4},{type:`taa`,samples:8}]},dreamy:{description:`Soft and glowing: wide bloom, pastel grade, gentle lens fringes, light vignette.`,effects:[{type:`bloom`,strength:.45,radius:.85,threshold:1,smoothing:.6},{type:`grading`,look:`pastel`},{type:`chromatic`,amount:.0015},{type:`vignette`,offset:1,darkness:.5},{type:`film`,intensity:.04}]},neon:{description:`Night-club neon: strong tight bloom, anamorphic streaks, saturated contrasty grade, deep vignette.`,effects:[{type:`bloom`,strength:1.3,radius:.55,threshold:.55,smoothing:.2},{type:`lensflare`,intensity:.45,threshold:1.4,streaks:1.2,ghosts:.2,halo:.1},{type:`grading`,contrast:1.15,saturation:1.2,vibrance:.2},{type:`chromatic`,amount:.001},{type:`vignette`,offset:.95,darkness:.95}]},retro:{description:`Old film / VHS: vintage faded grade, heavy grain + scanlines, fringes, strong vignette.`,effects:[{type:`grading`,look:`vintage`},{type:`film`,intensity:.3,scanlines:.25},{type:`chromatic`,amount:.0025,radial:!1},{type:`vignette`,offset:.9,darkness:1.2},{type:`bloom`,strength:.3,radius:.6,threshold:1.6,smoothing:.4}]},clean:{description:`Minimal polish for UI-like scenes: subtle contrast, light sharpening, faint vignette, supersampled stills. No FXAA (it softens small text; MSAA already smooths edges).`,effects:[{type:`grading`,contrast:1.04,saturation:1.02},{type:`sharpen`,amount:.15},{type:`vignette`,offset:1.2,darkness:.25},{type:`taa`,samples:8}]}},la=[{id:`look`,description:"Named look preset expanding into a tuned stack (`details.presets` lists exactly what each one expands to). Effects listed next to it override the matching expanded entry param by param.",params:[Gi(`preset`,`Look preset.`,R,`cinematic`),N(`intensity`,`Strength of the look (scales its effect amounts).`,1,0,1)],gpu:`medium`,example:{type:`look`,preset:`cinematic`},details:{presets:ca}},{id:`bloom`,description:`Glow around bright / emissive parts (HDR threshold, 5-level mip blur).`,params:[N(`strength`,`Strength.`,.8,0),N(`radius`,`Radius / spread (0…1).`,.4,0),N(`threshold`,`Luminance threshold (HDR: >1 = only emissive / very bright parts).`,.85,0),N(`smoothing`,`Soft knee above the threshold (0 = hard cut).`,.1,0,1)],gpu:`medium`},{id:`ao`,description:`Ambient occlusion (GTAO): contact shading in creases and under objects — grounds them and makes scenes read as real. Best with a ground.`,params:[N(`intensity`,`Darkening amount.`,1,0,2),N(`radius`,`Sampling radius in scene units (≈ metres).`,.6,.01,10),N(`thickness`,`Assumed thickness of surfaces (larger = darker behind thin objects).`,1,.01,10),N(`falloff`,`Distance falloff (0 = none, 1 = smooth).`,1,0,1)],gpu:`high`,example:{type:`ao`,intensity:1,radius:.6}},{id:`outline`,description:`Cartoon outlines (toon look) from depth + normal edges.`,params:[I(`color`,`Line colour.`,`#000000`),N(`thickness`,`Thickness (CSS px).`,1,0)],gpu:`medium`},{id:`godrays`,description:`Light shafts (screen-space radial scattering) from the sky sun, a light or a point, occluded by objects.`,params:[{name:`source`,type:`string`,description:`Where the rays come from: "auto" (sky sun, else the first directional / spot light, else top centre), "sun", or a light id.`,default:`auto`},N(`intensity`,`Strength.`,.6,0,4),N(`length`,`Ray length (0…1 of the distance to the source).`,.85,0,1),N(`decay`,`Falloff along the ray.`,.96,.5,1),I(`color`,`Tint of the light source glow (default: the light / sun colour).`),N(`size`,`Size of the source glow (fraction of the screen).`,.1,0,1)],gpu:`medium`,example:{type:`godrays`,intensity:.7}},{id:`dof`,description:"Depth of field (bokeh disc blur). Blur = |depth − focus| × aperture (clamped to maxblur). `focusOn` keeps an object sharp wherever it moves.",params:[N(`focus`,`Focus distance from the camera (scene units).`,8,0),{name:`focusOn`,type:`string`,description:`Object id to autofocus on every frame (overrides focus).`},N(`aperture`,`Aperture: blur per unit of distance from the focus plane.`,.002,0),N(`maxblur`,`Max blur radius (fraction of the screen height).`,.01,0,.1)],gpu:`high`},{id:`lensflare`,description:`Procedural lens flare from HDR highlights: anamorphic streaks, ghosts and a halo (no textures).`,params:[N(`intensity`,`Overall strength.`,.5,0,4),N(`threshold`,`HDR luminance that flares (>1 = only very bright parts).`,1.2,0),N(`streaks`,`Anamorphic horizontal streaks amount.`,1,0,4),N(`ghosts`,`Ghost reflections amount.`,.5,0,4),N(`halo`,`Halo ring amount.`,.3,0,4),I(`tint`,`Streak colour.`,`#9fc4ff`)],gpu:`medium`,example:{type:`lensflare`,intensity:.6}},{id:`fxaa`,description:`Fast approximate antialiasing (smooths shader / texture edges MSAA misses). Cheap.`,params:[],gpu:`low`},{id:`smaa`,description:`Subpixel morphological antialiasing — sharper than FXAA.`,params:[],gpu:`medium`},{id:`taa`,description:"Supersampled stills: deterministic renders (agent3d render / poster / video), the reduced-motion still and paused frames accumulate `samples` sub-pixel-jittered frames (perfect edges, smooth AO / shadows). No cost while playing.",params:[P(`samples`,`Jittered frames per still.`,8,2,64)],gpu:`low`,example:{type:`taa`,samples:8}},{id:`tiltshift`,description:`Tilt-shift miniature look: blur above and below a sharp horizontal band.`,params:[N(`focus`,`Vertical centre of the sharp band (0 = bottom, 1 = top).`,.5,0,1),N(`width`,`Half height of the sharp band (fraction of the screen).`,.18,0,1),N(`blur`,`Blur strength.`,1,0,4)],gpu:`medium`},{id:`pixelate`,description:`Retro pixels.`,params:[P(`pixelSize`,`Pixel size (CSS px).`,4,1,32)],gpu:`low`},{id:`halftone`,description:`Print halftone dots (comic / risograph banners).`,params:[N(`size`,`Dot spacing (CSS px).`,6,2,64),N(`angle`,`Screen angle in degrees.`,45),F(`mono`,`Black ink only (else CMYK colour dots).`,!1)],gpu:`low`},{id:`ascii`,description:`ASCII-art characters (procedural 5×5 glyphs).`,params:[N(`size`,`Cell size (CSS px).`,8,4,64),F(`mono`,`Single ink colour instead of the scene colours.`,!1),I(`color`,`Ink colour when mono.`,`#33ff88`)],gpu:`low`},{id:`glitch`,description:`Digital glitch: block displacement, RGB split, scan jitter (deterministic, driven by time).`,params:[N(`amount`,`Strength (0…1).`,.5,0,1),N(`speed`,`Glitch bursts per second.`,1,0,20)],gpu:`low`},{id:`chromatic`,description:`Chromatic aberration: RGB fringes growing towards the edges (dreamy / lens).`,params:[N(`amount`,`Shift amount (fraction of the screen).`,.002,0,.05),F(`radial`,`Radial lens fringes (false = uniform diagonal shift).`,!0)],gpu:`low`},{id:`sharpen`,description:`Unsharp-mask sharpening (crisper details after AA / blur).`,params:[N(`amount`,`Strength.`,.3,0,2)],gpu:`low`},{id:`grading`,description:"Colour grading in one pass: a procedural `look` LUT + exposure, white balance, contrast, lift / gamma / gain, split toning, saturation.",params:[Gi(`look`,`Procedural look (see GRADING_LOOKS).`,oa,`none`),N(`intensity`,`Strength of the look.`,1,0,1),N(`exposure`,`Exposure in stops.`,0,-5,5),N(`contrast`,`Contrast (S-curve, 1 = neutral).`,1,0,3),N(`saturation`,`Saturation (0 = grey).`,1,0,3),N(`vibrance`,`Saturates muted colours more than vivid ones.`,0,-1,1),N(`temperature`,`White balance: −1 cool … +1 warm.`,0,-1,1),N(`tint`,`White balance: −1 green … +1 magenta.`,0,-1,1),N(`lift`,`Raises (or crushes, < 0) the blacks.`,0,-.5,.5),N(`gamma`,`Midtones (>1 brighter).`,1,.2,5),N(`gain`,`Highlights multiplier.`,1,0,3),I(`shadows`,"Split toning: shadow tint colour (with `toning`)."),I(`highlights`,"Split toning: highlight tint colour (with `toning`)."),N(`toning`,`Split toning strength.`,0,0,1),N(`bleach`,`Bleach bypass (silver retention) amount.`,0,0,1)],gpu:`low`,example:{type:`grading`,look:`teal-orange`,intensity:.8},details:{looks:sa}},{id:`vignette`,description:`Darker (or tinted) edges.`,params:[N(`offset`,`Size (bigger = smaller vignette).`,1,0),N(`darkness`,`Darkness.`,1.1,0),I(`color`,`Vignette colour.`,`#000000`)],gpu:`low`},{id:`film`,description:`Film grain (luma-weighted, deterministic) + optional scanlines.`,params:[N(`intensity`,`Grain.`,.35,0,1),F(`grayscale`,`Black and white.`,!1),N(`scanlines`,`Scanlines strength.`,0,0,1),N(`size`,`Grain size (CSS px).`,1.5,.5,8)],gpu:`low`}],ua=[{id:`sans-bold`,description:`Inter Bold — clean neo-grotesk, the default: headlines, UI-like titles.`,params:[]},{id:`sans`,description:`Inter Regular — subtitles, taglines, small labels.`,params:[]},{id:`inter-black`,description:`Inter Black — heavy, punchy headlines (tech, sport, sales).`,params:[]},{id:`montserrat-extrabold`,description:`Montserrat ExtraBold — wide geometric sans: bold brand titles, posters.`,params:[]},{id:`space-grotesk-bold`,description:`Space Grotesk Bold — quirky tech grotesk (startups, crypto, dev tools).`,params:[]},{id:`bebas-neue`,description:`Bebas Neue — tall condensed all-caps display: banners, cinema, sport.`,params:[]},{id:`anton`,description:`Anton — heavy condensed impact display: loud banners, sales.`,params:[]},{id:`serif-bold`,description:`Playfair Display Bold — elegant high-contrast serif (luxury, editorial, food).`,params:[]},{id:`serif`,description:`Playfair Display Regular — refined serif for subtitles and quotes.`,params:[]},{id:`mono`,description:`JetBrains Mono Bold — monospace (tech, code, terminal looks); no kerning by design.`,params:[]},{id:`display`,description:`Fredoka SemiBold — rounded, friendly (kids, games, playful brands).`,params:[]},{id:`pacifico`,description:`Pacifico — brush script (retro, surf, cafés, handwritten feel).`,params:[]},{id:`lobster`,description:`Lobster — bold connected script (retro signage, bakery, vintage).`,params:[]}],da=[{id:`coin`,description:`Pickup / coin.`,params:[]},{id:`jump`,description:`Jump.`,params:[]},{id:`hit`,description:`Hit / damage.`,params:[]},{id:`explosion`,description:`Explosion.`,params:[]},{id:`click`,description:`UI click.`,params:[]},{id:`powerup`,description:`Power-up arpeggio.`,params:[]},{id:`laser`,description:`Laser shot.`,params:[]},{id:`win`,description:`Victory jingle.`,params:[]},{id:`lose`,description:`Game over.`,params:[]},{id:`whoosh`,description:`Whoosh.`,params:[]},{id:`ambient-pad`,description:`Soft looping pad (music).`,params:[]},{id:`chiptune-loop`,description:`Cheerful chiptune loop (music).`,params:[]}],fa={geometries:qi,materialPresets:Ji,shaders:Yi,textures:Zi,lightRigs:$i,behaviours:ta,generators:na,particlePresets:aa,instanceLayouts:[{id:`grid`,description:`Regular 3D grid centred on the object: count [nx, ny, nz] copies spaced by spacing [sx, sy, sz] (use 1 / 0 for a flat axis).`,params:[{name:`count`,type:`vec3`,description:`Copies per axis [nx, ny, nz] (integers ≥ 1).`,required:!0},{name:`spacing`,type:`vec3`,description:`Distance between copies per axis [sx, sy, sz] in units.`,required:!0}],cost:`count[0]*count[1]*count[2] * geometry`,example:{type:`grid`,count:[8,1,8],spacing:[1.2,0,1.2]}},{id:`scatter`,description:`Random positions inside a box (seeded): forests of props, rocks, debris.`,params:[{...P(`count`,`Number of copies.`,void 0,1,2e5),required:!0},{name:`area`,type:`vec3`,description:`Box size [x, y, z] centred on the object (y 0 = on a plane).`,required:!0},N(`minScale`,`Smallest random uniform scale.`,1,0),N(`maxScale`,`Largest random uniform scale.`,1,0),F(`randomRotation`,`Random rotation around Y.`,!1),P(`seed`,`Random seed (same seed = same layout).`)],cost:`count * geometry`,example:{type:`scatter`,count:200,area:[20,0,20],minScale:.6,maxScale:1.4,randomRotation:!0,seed:3}},{id:`circle`,description:`Copies evenly spaced on a horizontal circle (XZ plane) around the object.`,params:[{...P(`count`,`Number of copies.`,void 0,1,2e5),required:!0},{...N(`radius`,`Circle radius in units.`,void 0,0),required:!0}],cost:`count * geometry`,example:{type:`circle`,count:12,radius:3}},{id:`list`,description:`Explicit transforms, one copy per item: [{ position, rotation?, scale? }] (rotation in degrees, scale a number or [x, y, z]).`,params:[{name:`items`,type:`array`,description:`Transforms [{ "position": [x, y, z], "rotation"?: [x, y, z], "scale"?: n | [x, y, z] }, …].`,required:!0}],cost:`items * geometry`,example:{type:`list`,items:[{position:[-1,0,0]},{position:[1,0,0],rotation:[0,45,0],scale:1.5}]}}],postfx:la,fonts:ua,sounds:da};function pa(e,t){return fa[e].find(e=>e.id===t)}function ma(e){return Ji.find(t=>t.id===e)}var ha={aliceblue:`f0f8ff`,antiquewhite:`faebd7`,aqua:`00ffff`,aquamarine:`7fffd4`,azure:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`000000`,blanchedalmond:`ffebcd`,blue:`0000ff`,blueviolet:`8a2be2`,brown:`a52a2a`,burlywood:`deb887`,cadetblue:`5f9ea0`,chartreuse:`7fff00`,chocolate:`d2691e`,coral:`ff7f50`,cornflowerblue:`6495ed`,cornsilk:`fff8dc`,crimson:`dc143c`,cyan:`00ffff`,darkblue:`00008b`,darkcyan:`008b8b`,darkgoldenrod:`b8860b`,darkgray:`a9a9a9`,darkgreen:`006400`,darkgrey:`a9a9a9`,darkkhaki:`bdb76b`,darkmagenta:`8b008b`,darkolivegreen:`556b2f`,darkorange:`ff8c00`,darkorchid:`9932cc`,darkred:`8b0000`,darksalmon:`e9967a`,darkseagreen:`8fbc8f`,darkslateblue:`483d8b`,darkslategray:`2f4f4f`,darkslategrey:`2f4f4f`,darkturquoise:`00ced1`,darkviolet:`9400d3`,deeppink:`ff1493`,deepskyblue:`00bfff`,dimgray:`696969`,dimgrey:`696969`,dodgerblue:`1e90ff`,firebrick:`b22222`,floralwhite:`fffaf0`,forestgreen:`228b22`,fuchsia:`ff00ff`,gainsboro:`dcdcdc`,ghostwhite:`f8f8ff`,gold:`ffd700`,goldenrod:`daa520`,gray:`808080`,green:`008000`,greenyellow:`adff2f`,grey:`808080`,honeydew:`f0fff0`,hotpink:`ff69b4`,indianred:`cd5c5c`,indigo:`4b0082`,ivory:`fffff0`,khaki:`f0e68c`,lavender:`e6e6fa`,lavenderblush:`fff0f5`,lawngreen:`7cfc00`,lemonchiffon:`fffacd`,lightblue:`add8e6`,lightcoral:`f08080`,lightcyan:`e0ffff`,lightgoldenrodyellow:`fafad2`,lightgray:`d3d3d3`,lightgreen:`90ee90`,lightgrey:`d3d3d3`,lightpink:`ffb6c1`,lightsalmon:`ffa07a`,lightseagreen:`20b2aa`,lightskyblue:`87cefa`,lightslategray:`778899`,lightslategrey:`778899`,lightsteelblue:`b0c4de`,lightyellow:`ffffe0`,lime:`00ff00`,limegreen:`32cd32`,linen:`faf0e6`,magenta:`ff00ff`,maroon:`800000`,mediumaquamarine:`66cdaa`,mediumblue:`0000cd`,mediumorchid:`ba55d3`,mediumpurple:`9370db`,mediumseagreen:`3cb371`,mediumslateblue:`7b68ee`,mediumspringgreen:`00fa9a`,mediumturquoise:`48d1cc`,mediumvioletred:`c71585`,midnightblue:`191970`,mintcream:`f5fffa`,mistyrose:`ffe4e1`,moccasin:`ffe4b5`,navajowhite:`ffdead`,navy:`000080`,oldlace:`fdf5e6`,olive:`808000`,olivedrab:`6b8e23`,orange:`ffa500`,orangered:`ff4500`,orchid:`da70d6`,palegoldenrod:`eee8aa`,palegreen:`98fb98`,paleturquoise:`afeeee`,palevioletred:`db7093`,papayawhip:`ffefd5`,peachpuff:`ffdab9`,peru:`cd853f`,pink:`ffc0cb`,plum:`dda0dd`,powderblue:`b0e0e6`,purple:`800080`,rebeccapurple:`663399`,red:`ff0000`,rosybrown:`bc8f8f`,royalblue:`4169e1`,saddlebrown:`8b4513`,salmon:`fa8072`,sandybrown:`f4a460`,seagreen:`2e8b57`,seashell:`fff5ee`,sienna:`a0522d`,silver:`c0c0c0`,skyblue:`87ceeb`,slateblue:`6a5acd`,slategray:`708090`,slategrey:`708090`,snow:`fffafa`,springgreen:`00ff7f`,steelblue:`4682b4`,tan:`d2b48c`,teal:`008080`,thistle:`d8bfd8`,tomato:`ff6347`,turquoise:`40e0d0`,violet:`ee82ee`,wheat:`f5deb3`,white:`ffffff`,whitesmoke:`f5f5f5`,yellow:`ffff00`,yellowgreen:`9acd32`},ga=(e,t,n)=>Math.min(n,Math.max(t,e));function _a(e){if(!/^[0-9a-f]+$/i.test(e)||((e.length===3||e.length===4)&&(e=[...e].map(e=>e+e).join(``)),e.length!==6&&e.length!==8))return null;let t=t=>parseInt(e.slice(t,t+2),16);return{r:t(0),g:t(2),b:t(4),a:e.length===8?t(6)/255:1}}function va(e,t){let n=/^(-?\d*\.?\d+(?:e-?\d+)?)(%?)$/i.exec(e.trim());if(!n)return null;let r=Number(n[1]);return n[2]?r/100*t:r}function ya(e){let t=/^(-?\d*\.?\d+)(deg|rad|turn|grad)?$/i.exec(e.trim());if(!t)return null;let n=Number(t[1]);switch((t[2]??`deg`).toLowerCase()){case`rad`:return n*180/Math.PI;case`turn`:return n*360;case`grad`:return n*.9;default:return n}}function ba(e){let t=e.split(`/`);if(t.length>2)return null;let n=(t[0].includes(`,`)?t[0].split(`,`):t[0].trim().split(/\s+/)).map(e=>e.trim()).filter(e=>e!==``);return t.length===2&&n.push(t[1].trim()),n}function xa(e,t,n){e=(e%360+360)%360;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,[o,s,c]=e<60?[r,i,0]:e<120?[i,r,0]:e<180?[0,r,i]:e<240?[0,i,r]:e<300?[i,0,r]:[r,0,i];return[(o+a)*255,(s+a)*255,(c+a)*255]}function Sa(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();if(!t)return null;if(t.startsWith(`#`))return _a(t.slice(1));if(t===`transparent`)return{r:0,g:0,b:0,a:0};let n=ha[t];if(n)return _a(n);let r=/^(rgba?|hsla?)\((.*)\)$/.exec(t);if(!r)return null;let i=ba(r[2]);if(!i||i.length!==3&&i.length!==4)return null;let a=i.length===4?va(i[3],1):1;if(a===null)return null;if(r[1].startsWith(`rgb`)){let[e,t,n]=i.slice(0,3).map(e=>va(e,255));return e===null||t===null||n===null?null:{r:ga(e,0,255),g:ga(t,0,255),b:ga(n,0,255),a:ga(a,0,1)}}let o=ya(i[0]),s=va(i[1],1),c=va(i[2],1);if(o===null||s===null||c===null||!i[1].trim().endsWith(`%`)||!i[2].trim().endsWith(`%`))return null;let[l,u,d]=xa(o,ga(s,0,1),ga(c,0,1));return{r:l,g:u,b:d,a:ga(a,0,1)}}function Ca(e){return Sa(e)!==null}function wa({r:e,g:t,b:n}){return`#`+[e,t,n].map(e=>Math.round(ga(e,0,255)).toString(16).padStart(2,`0`)).join(``)}function Ta(e){let t=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function Ea(e,t){let n=Ta(e),r=Ta(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Da(e){let t=Sa(e);return t?Ea(t,{r:255,g:255,b:255,a:1})>=Ea(t,{r:17,g:19,b:24,a:1})?`#ffffff`:`#111318`:`#ffffff`}var Oa=[`linear`,...[`Quad`,`Cubic`,`Quart`,`Quint`,`Sine`,`Expo`,`Circ`,`Back`,`Elastic`,`Bounce`].flatMap(e=>[`in${e}`,`out${e}`,`inOut${e}`]),`step`],ka=[`outCubic`,`inOutSine`,`outBack`,`cubicBezier(0.22, 1, 0.36, 1)`,`spring(170, 18)`,`steps(4)`],Aa=new Map;function ja(e,t){let n=RegExp(`^${t}\\s*\\(([^)]*)\\)$`).exec(e);return n?n[1].split(`,`).map(e=>e.trim()):null}var Ma=e=>e!==``&&Number.isFinite(Number(e));function Na(e){let t=Aa.get(e);if(t)return t;let n=Pa(e.trim());return Aa.size<500&&Aa.set(e,n),n}function Pa(e){if(Oa.includes(e))return{kind:`named`,name:e};if(e.startsWith(`cubicBezier`)){let t=ja(e,`cubicBezier`);if(!t||t.length!==4||!t.every(Ma))return{error:`cubicBezier needs 4 numbers: "cubicBezier(x1, y1, x2, y2)", e.g. "cubicBezier(0.22, 1, 0.36, 1)".`};let[n,r,i,a]=t.map(Number);return n<0||n>1||i<0||i>1?{error:`cubicBezier x1 and x2 must be between 0 and 1 (y1, y2 may overshoot).`}:{kind:`cubicBezier`,x1:n,y1:r,x2:i,y2:a}}if(e===`spring`)return{kind:`spring`,stiffness:170,damping:18,mass:1};if(e.startsWith(`spring`)){let t=ja(e,`spring`);if(!t||t.length<2||t.length>3||!t.every(Ma))return{error:`spring takes stiffness, damping (and optional mass): "spring(170, 18)" (lower damping = more bounce).`};let[n,r,i=1]=t.map(Number);return!(n>0)||!(r>0)||!(i>0)?{error:`spring stiffness, damping and mass must be > 0.`}:{kind:`spring`,stiffness:n,damping:r,mass:i}}if(e.startsWith(`steps`)){let t=ja(e,`steps`);return!t||t.length<1||t.length>2||!Ma(t[0])||!Number.isInteger(Number(t[0]))||Number(t[0])<1||t[1]!==void 0&&t[1]!==`start`&&t[1]!==`end`?{error:`steps takes a whole number ≥ 1 and optionally "start" or "end": "steps(4)", "steps(4, start)".`}:{kind:`steps`,count:Number(t[0]),jumpStart:t[1]===`start`}}return{error:`Unknown easing "${e}".`}}function Fa(e){return typeof e==`string`&&e.startsWith(`library:`)}function Ia(e){return e.slice(8)}function La(e,t){return e?.assets.find(e=>e.id===t)}var Ra=[`low`,`medium`,`high`,`ultra`],za={low:1,medium:1.5,high:2,ultra:3};function Ba(e,t={}){return e&&e!==`auto`?e:t.deterministic?`high`:t.gpu&&/swiftshader|llvmpipe|softpipe|software|microsoft basic render/i.test(t.gpu)?`low`:t.mobile?(t.memoryGb??4)<=2||(t.cores??8)<=4?`low`:`medium`:t.cores!==void 0&&t.cores<=2||t.memoryGb!==void 0&&t.memoryGb<=2?`low`:t.cores!==void 0&&t.cores<=4||t.memoryGb!==void 0&&t.memoryGb<=4||t.gpu&&/intel|mali|adreno|powervr/i.test(t.gpu)?`medium`:`high`}var Va=new Set([`strength`,`intensity`,`darkness`,`amount`,`toning`,`streaks`,`ghosts`,`halo`,`bleach`,`scanlines`]);function Ha(e){if(!e?.length)return[];let t=new Map,n=new Map;for(let r of e){if(!r||typeof r.type!=`string`)continue;if(r.type!==`look`){t.has(r.type)||t.set(r.type,r);continue}let e=ca[String(r.preset??`cinematic`)];if(!e)continue;let i=typeof r.intensity==`number`?Math.max(0,Math.min(1,r.intensity)):1;for(let t of e.effects){if(n.has(t.type))continue;let e={...t};if(i!==1){for(let[n,r]of Object.entries(t))Va.has(n)&&typeof r==`number`&&(e[n]=r*i);t.type===`grading`&&t.look&&(e.intensity=i)}n.set(t.type,e)}}let r=[],i=new Set,a=e=>{if(i.has(e))return;i.add(e);let a=t.get(e),o=n.get(e);r.push(a&&o?{...o,...a}:a??o)};for(let n of e)if(n&&typeof n.type==`string`){if(n.type!==`look`)a(n.type);else for(let e of ca[String(n.preset??`cinematic`)]?.effects??[])t.has(e.type)||a(e.type)}return r}function Ua(e){let t={exposure:0,contrast:1,saturation:1,vibrance:0,temperature:0,tint:0,lift:0,gamma:1,gain:1,toning:0,bleach:0},n=e.look&&e.look!==`none`?sa[e.look]:void 0,r=typeof e.intensity==`number`?Math.max(0,Math.min(1,e.intensity)):1,i={...t};if(n)for(let[e,a]of Object.entries(n.values))i[e]=typeof a==`number`?t[e]+(a-t[e])*r:a;for(let[t,n]of Object.entries(e))t!==`type`&&t!==`look`&&t!==`intensity`&&(typeof n==`number`||typeof n==`string`)&&(i[t]=n);return i}var Wa={low:0,medium:1,high:2};function Ga(e){switch(e){case`low`:return{tier:e,dprCap:za.low,msaa:0,effectScale:.5,maxCost:`medium`,aoSamples:8,dofSamples:16,rays:24,maxStillSamples:4};case`medium`:return{tier:e,dprCap:za.medium,msaa:4,effectScale:.5,maxCost:`high`,aoSamples:12,dofSamples:24,rays:32,maxStillSamples:8};case`ultra`:return{tier:e,dprCap:za.ultra,msaa:8,effectScale:1,maxCost:`high`,aoSamples:24,dofSamples:64,rays:64,maxStillSamples:64};default:return{tier:`high`,dprCap:za.high,msaa:4,effectScale:.5,maxCost:`high`,aoSamples:16,dofSamples:40,rays:48,maxStillSamples:32}}}function Ka(e){let t=Ra.indexOf(e);return t>0?Ra[t-1]:null}function qa(e){return pa(`postfx`,e)?.gpu??`low`}function Ja(e,t){let n=Wa[Ga(t).maxCost],r=[],i=[];for(let t of Ha(e))Wa[qa(t.type)]>n?i.push(t.type):r.push(t);return{active:r,dropped:i}}var Ya={ao:5,dof:4,bloom:3,smaa:3,godrays:2,lensflare:2,outline:1,tiltshift:2,fxaa:1,pixelate:1,halftone:1,ascii:1,glitch:1,taa:0,grading:0,vignette:0,film:0,chromatic:0,sharpen:0},Xa=3,Za=new Set([`grading`,`vignette`,`film`,`chromatic`,`sharpen`]),Qa=new Set([`ao`,`dof`,`godrays`,`outline`]);function $a(e){let t=Ha(e),n=t.map(e=>({type:e.type,gpu:qa(e.type),passes:Ya[e.type]??1})),r=t.some(e=>Qa.has(e.type)),i=t.length?2:0;for(let e of n)i+=e.passes;r&&(i+=Xa),t.some(e=>Za.has(e.type))&&(i+=.5);let a=t.length?i<=6?`light`:i<=14?`moderate`:`heavy`:`none`;return{effects:n,passes:Math.round(i*10)/10,scenePrepass:r,level:a,dropped:{low:Ja(e,`low`).dropped}}}var eo=e=>!!e&&typeof e==`object`&&!Array.isArray(e),to=e=>typeof e==`number`&&Number.isFinite(e),no=e=>{let t=JSON.stringify(e);return t===void 0?String(e):t.length>60?`${t.slice(0,57)}…`:t},ro=[`duration`,`loop`,`autoplay`,`trigger`,`speed`,`markers`,`segments`,`scroll`,`tracks`],io=[`target`,`keys`,`ease`,`stagger`,`staggerFrom`,`colorSpace`],ao=[`oklch`,`oklab`,`rgb`,`hsl`],oo=[`start`,`end`,`center`,`edges`,`random`],so=[`click`,`hover`,`hoverEnd`,`visible`,`scroll`,`key`,`event`],co=[`play`,`toggle`,`seek`,`set`,`emit`,`openUrl`,`playClip`],lo=[`dolly`,`pushIn`,`pullOut`,`truck`,`pedestal`,`crane`,`orbit`,`zoom`,`move`,`path`,`lookAt`,`focus`],uo=[`type`,`at`,`duration`,`ease`,`distance`,`height`,`angle`,`elevation`,`fov`,`position`,`target`,`points`,`lookAhead`,`lookAt`,`object`,`focus`],fo=[`position`,`rotation`,`scale`],po=[`x`,`y`,`z`],mo={opacity:`number`,color:`color`,emissive:`color`,emissiveIntensity:`number`,metalness:`number`,roughness:`number`,transmission:`number`,thickness:`number`,ior:`number`,iridescence:`number`,iridescenceIOR:`number`,clearcoat:`number`,clearcoatRoughness:`number`,sheen:`number`,sheenColor:`color`,sheenRoughness:`number`,specularIntensity:`number`,specularColor:`color`,envMapIntensity:`number`,attenuationColor:`color`,attenuationDistance:`number`,dispersion:`number`,anisotropy:`number`,anisotropyRotation:`number`,wireframe:`boolean`},ho={position:`vec3`,target:`vec3`,fov:`number`,zoom:`number`,focus:`number`},go={intensity:`number`,color:`color`,position:`vec3`,target:`vec3`,visible:`boolean`,angle:`number`,penumbra:`number`,distance:`number`,decay:`number`,groundColor:`color`,width:`number`,height:`number`},_o={"fog.color":`color`,"fog.near":`number`,"fog.far":`number`,"fog.density":`number`,lightingIntensity:`number`,exposure:`number`,background:`color`},vo=/^\s*[+\-*]=\s*-?\d*\.?\d+(?:e[+-]?\d+)?\s*$/i,yo=e=>typeof e==`string`&&vo.test(e);function bo(e,t){let n=e.indexOf(`.`);if(n<1)return{error:{message:`Track target "${e}" must be "<id>.<property>".`,hint:`Examples: "logo.position", "logo.rotation.y", "logo.material.opacity", "camera.position", "key.intensity", "tag:letter.position.y".`}};let r=e.slice(0,n),i=e.slice(n+1);if(r===`camera`){let e=ho[i];return/^(position|target)\.[xyz]$/.test(i)?{kind:`number`}:e?{kind:e}:{error:{message:`Camera property "${i}" is not animatable.`,hint:`${j(i,Object.keys(ho))}Use one of: ${M(Object.keys(ho))} (or position.x …).`}}}if(r===`environment`){let e=_o[i];return e?{kind:e}:{error:{message:`Environment property "${i}" is not animatable.`,hint:`${j(i,Object.keys(_o))}Use one of: ${M(Object.keys(_o))}.`}}}if(r===`postfx`){let[n,r,...a]=i.split(`.`),o=fa.postfx.find(e=>e.id===n);if(!o||!r||a.length)return{error:{message:`Post effect track "${e}" must be "postfx.<type>.<param>".`,hint:`${n?j(n,fa.postfx.map(e=>e.id)):``}Example: "postfx.bloom.strength", "postfx.dof.focus".`}};if(t.postfx&&!t.postfx.has(n))return{error:{message:`"${e}" animates post effect "${n}", which is not in scene.postfx (nor brought by a look preset).`,hint:`Add { "type": "${n}" } to postfx first (or a look that includes it — see agent3d catalog postfx look).`}};let s=o.params.find(e=>e.name===r);if(!s||s.type!==`number`&&s.type!==`integer`&&s.type!==`color`){let e=o.params.filter(e=>e.type===`number`||e.type===`integer`||e.type===`color`).map(e=>e.name);return{error:{message:`Parameter "${r}" of post effect "${n}" is not animatable.`,hint:`${j(r,e)}Animatable: ${M(e)}.`}}}return{kind:s.type===`color`?`color`:`number`}}let a;if(r.startsWith(`tag:`)){let e=r.slice(4);if(t.tags&&!t.tags.has(e))return{error:{message:`No object has the tag "${e}" (selector "${r}").`,hint:`${j(e,t.tags)}Add "tags": ["${e}"] to the objects to animate.`}};a=[]}else if(r.startsWith(`children:`)){let e=r.slice(9);if(!t.objects.has(e))return{error:{message:`Selector "${r}" refers to "${e}", which is not an object id.`,hint:`${j(e,t.objects)}Use "children:<group id>".`}};if(t.parents&&!t.parents.has(e))return{error:{message:`"${e}" has no children (selector "${r}").`,hint:`Use children:<id> on a group with children (text letters count too).`}};a=[]}else a=r.split(`,`).map(e=>e.trim());let o;for(let n of a){let r=xo(n,i,t,e);if(r.error)return r;o??=r.warning}return a.length?{kind:xo(a[0],i,t,e).kind,...o?{warning:o}:{}}:So(i,!0)}function xo(e,t,n,r){if(n.lights.has(e)&&!n.objects.has(e)){let e=go[t];return/^(position|target)\.[xyz]$/.test(t)?{kind:`number`}:e?{kind:e}:{error:{message:`Light property "${t}" is not animatable.`,hint:`${j(t,Object.keys(go))}Use one of: ${M(Object.keys(go))}.`}}}let i=e,a=/^([a-zA-Z][a-zA-Z0-9_-]*)\/(\d+)$/.exec(e);if(a){if(!n.objects.has(a[1]))return{error:{message:`Track target "${r}" refers to letter ${a[2]} of "${a[1]}", which is not an object id.`,hint:`${j(a[1],n.objects)}Letters are addressed "<textId>/<n>" (n = 0, 1, … over non-space characters).`}};if(n.letters&&!n.letters.has(a[1]))return{error:{message:`"${a[1]}" is not split into letters, so "${e}" does not exist.`,hint:`Set "splitLetters": true (or a "reveal") on the text object "${a[1]}".`}};i=a[1];let o=n.letterCounts?.get(a[1]);if(o!==void 0&&Number(a[2])>=o){let r=bo(`${a[1]}.${t}`,n);return r.error?r:{kind:r.kind,warning:{message:`"${e}" is out of range: "${a[1]}" has ${o} letter${o===1?``:`s`} (${a[1]}/0 … ${a[1]}/${Math.max(0,o-1)}), so this target animates nothing.`,hint:`Letters are numbered from 0 over non-space characters. Use ${a[1]}/${Math.max(0,o-1)} for the last one, or "children:${a[1]}.${t}" for all of them.`}}}}if(!n.objects.has(i)){let t=[...n.objects,...n.lights,`camera`,`environment`,`postfx`];return{error:{message:`Track target "${r}" refers to "${e}", which is not an object id, a light id, "camera", "environment" or "postfx".`,hint:`${j(e,t)}Known ids: ${M(t)}. Several targets: "a,b,c.<prop>", "tag:<tag>.<prop>", "children:<id>.<prop>".`}}}let o=t.split(`.`);return o[0]===`morph`||o[0]===`animation`?n.models&&!n.models.has(i)?{error:{message:`"${t}" needs a model object; "${i}" is not one.`,hint:`morph.<name> and animation.<clip>.weight|speed|time animate glTF models (kind "model").`}}:o[0]===`morph`&&o.length>=2||o[0]===`animation`&&o.length>=3&&[`weight`,`speed`,`time`].includes(o[o.length-1])?{kind:`number`}:{error:{message:`Invalid model track "${t}".`,hint:`Use "morph.<name>" (0..1) or "animation.<clip>.weight" | ".speed" | ".time".`}}:So(t,!1)}function So(e,t){let n=e.split(`.`);if(fo.includes(n[0])){if(n.length===1)return{kind:n[0]===`scale`?`number|vec3`:`vec3`};if(n.length===2&&po.includes(n[1]))return{kind:`number`}}if(e===`visible`)return{kind:`boolean`};if(n[0]===`material`){if(n.length===2&&mo[n[1]])return{kind:mo[n[1]]};if(n.length===3&&n[1]===`uniforms`)return{kind:`number`}}if(t&&(n[0]===`morph`||n[0]===`animation`))return{kind:`number`};let r=[`position`,`position.x`,`rotation`,`rotation.y`,`scale`,`visible`,...Object.keys(mo).map(e=>`material.${e}`),`material.uniforms.<name>`,`morph.<name>`,`animation.<clip>.weight`];return{error:{message:`Property "${e}" is not animatable.`,hint:`${j(e,r)}Animatable: ${M(r)}.`}}}function Co(e,t){let n=e=>to(e)||yo(e),r=e=>Array.isArray(e)&&e.length===3&&e.every(n);switch(e){case`vec3`:return r(t)||yo(t);case`number`:return n(t);case`color`:return Ca(t);case`boolean`:return typeof t==`boolean`;case`number|vec3`:return n(t)||r(t)}}var wo={vec3:`[0, 1, 0] or ["+=0", "+=1", "+=0"]`,number:`1.5 or "+=1"`,color:`"#ff8800"`,boolean:`true`,"number|vec3":`1.2, [1, 2, 1] or "*=1.2"`},To=class{issues=[];add(e,t,n,r,i){this.issues.push(i?{severity:e,code:t,path:n,message:r,hint:i}:{severity:e,code:t,path:n,message:r})}error(e,t,n,r){this.add(`error`,e,t,n,r)}warn(e,t,n,r){this.add(`warning`,e,t,n,r)}unknownKeys(e,t,n,r){for(let i of Object.keys(e)){if(t.includes(i))continue;let e=Fi(i,t);this.warn(`unknown-field`,`${n}.${i}`,`Unknown field "${i}" on ${r} (ignored by the runtime).`,e?`Did you mean "${e}"? Otherwise remove it.`:`Remove it. Valid fields: ${M(t)}.`)}}number(e,t,n={}){return e===void 0?!0:to(e)?n.min!==void 0&&(n.exclusiveMin?e<=n.min:e<n.min)?(this.error(`range`,t,`${e} is below the minimum (${n.exclusiveMin?`>`:`≥`} ${n.min}).`),!1):n.max!==void 0&&e>n.max?(this.error(`range`,t,`${e} is above the maximum (${n.max}).`),!1):!0:(this.error(`type`,t,`Expected a number, got ${no(e)}.`),!1)}vec(e,t){return e===void 0||Array.isArray(e)&&e.length===3&&e.every(to)?!0:(this.error(`vec`,t,`Expected [x, y, z] (3 numbers), got ${no(e)}.`,`Write it as an array of 3 numbers, e.g. [0, 1.5, 0].`),!1)}ease(e,t){if(e===void 0)return;if(typeof e!=`string`)return this.error(`type`,t,`Expected an easing name, got ${no(e)}.`,`Examples: ${ka.map(e=>`"${e}"`).join(`, `)}.`);let n=Na(e);`error`in n&&this.error(`enum`,t,`Invalid easing ${no(e)}: ${n.error}`,`${j(e,Oa)}Named: ${M(Oa)}; parametric: "cubicBezier(x1, y1, x2, y2)", "spring(stiffness, damping)", "steps(n)".`)}loop(e,t){e!==void 0&&typeof e!=`boolean`&&e!==`pingpong`&&this.error(`enum`,t,`Invalid loop ${no(e)}.`,`Use true, false or "pingpong".`)}};function Eo(e,t){let n=new Set,r=new Set,i=new Set,a=e=>{if(Array.isArray(e)){for(let t of e)if(eo(t)&&typeof t.id==`string`){if(Array.isArray(t.tags))for(let e of t.tags)typeof e==`string`&&n.add(e);t.kind===`model`&&r.add(t.id),(Array.isArray(t.children)&&t.children.length||t.kind===`text`&&(t.splitLetters===!0||eo(t.reveal)))&&i.add(t.id),a(t.children)}}};a(e.objects);let o=new Set;if(Array.isArray(e.postfx))for(let t of Ha(e.postfx.filter(e=>eo(e)&&typeof e.type==`string`)))o.add(t.type);return{...t,tags:n,models:r,parents:i,postfx:o}}var Do=[`load`,`visible`,`hover`,`click`,`scroll`,`manual`],Oo=/^(top|center|bottom|-?\d*\.?\d+%|-?\d*\.?\d+px)\s+(top|center|bottom|-?\d*\.?\d+%|-?\d*\.?\d+px)$/;function ko(e,t,n){if(!eo(t))return e.error(`type`,`timeline`,`timeline must be an object.`,`Example: { "duration": 4, "loop": true, "tracks": [] }.`);e.unknownKeys(t,ro,`timeline`,`the timeline`),t.duration===void 0||t.duration===null?e.error(`required`,`timeline.duration`,`Missing required field "duration" (length in seconds).`,`Add "duration": length in seconds.`):e.number(t.duration,`timeline.duration`,{min:0,exclusiveMin:!0}),e.loop(t.loop,`timeline.loop`);let r=to(t.duration)?t.duration:1/0,i=eo(t.markers)?t.markers:{},a=eo(t.segments)?t.segments:{};if(t.trigger!==void 0&&!Do.includes(t.trigger)&&e.error(`enum`,`timeline.trigger`,`Invalid value ${no(t.trigger)}.`,`${typeof t.trigger==`string`?j(t.trigger,Do):``}Valid values: ${M(Do)}.`),t.autoplay!==void 0&&typeof t.autoplay!=`boolean`&&(typeof t.autoplay==`string`?t.autoplay in a||e.error(`unknown-ref`,`timeline.autoplay`,`autoplay "${t.autoplay}" is not a segment.`,`${j(t.autoplay,Object.keys(a))}Define it in timeline.segments, e.g. "segments": { "${t.autoplay}": { "from": 0, "to": 2 } }.`):e.error(`type`,`timeline.autoplay`,`Expected true, false or a segment name, got ${no(t.autoplay)}.`)),e.number(t.speed,`timeline.speed`,{min:0,exclusiveMin:!0}),t.markers!==void 0){if(!eo(t.markers))e.error(`type`,`timeline.markers`,`markers must be an object { name: time }.`,`Example: "markers": { "reveal": 1.2, "end": 4 }.`);else for(let[t,n]of Object.entries(i))e.number(n,`timeline.markers.${t}`,{min:0})&&to(n)&&n>r&&e.warn(`range`,`timeline.markers.${t}`,`Marker "${t}" (${n}s) is after timeline.duration (${r}s).`,`Move it inside the timeline.`)}let o=(t,n)=>{to(t)?(t<0||t>r)&&e.error(`range`,n,`${t}s is outside the timeline (0..${r}s).`):typeof t==`string`?t in i||e.error(`unknown-ref`,n,`"${t}" is not a marker.`,`${j(t,Object.keys(i))}Use seconds or a name from timeline.markers (${M(Object.keys(i))}).`):e.error(`type`,n,`Expected seconds or a marker name, got ${no(t)}.`)};if(t.segments!==void 0){if(!eo(t.segments))e.error(`type`,`timeline.segments`,`segments must be an object { name: { from, to } }.`,`Example: "segments": { "intro": { "from": 0, "to": 2 }, "hover-in": [2, 2.6] }.`);else for(let[t,n]of Object.entries(a)){let r=`timeline.segments.${t}`;t===`timeline`&&e.error(`reserved`,r,`"timeline" is reserved (it plays the whole timeline).`,`Rename the segment.`),Array.isArray(n)?n.length===2?(o(n[0],`${r}[0]`),o(n[1],`${r}[1]`)):e.error(`type`,r,`A segment array is [from, to], got ${no(n)}.`):eo(n)?(e.unknownKeys(n,[`from`,`to`,`loop`,`speed`],r,`a segment`),o(n.from,`${r}.from`),o(n.to,`${r}.to`),e.loop(n.loop,`${r}.loop`),e.number(n.speed,`${r}.speed`,{min:0,exclusiveMin:!0})):e.error(`type`,r,`Expected { "from", "to" } or [from, to], got ${no(n)}.`)}}if(t.scroll!==void 0){if(!eo(t.scroll))e.error(`type`,`timeline.scroll`,`scroll must be an object.`,`Example: { "start": "top bottom", "end": "bottom top", "smoothing": 0.8 }.`);else{e.unknownKeys(t.scroll,[`start`,`end`,`smoothing`],`timeline.scroll`,`timeline.scroll`);for(let n of[`start`,`end`]){let r=t.scroll[n];r===void 0||typeof r==`string`&&Oo.test(r.trim())||e.error(`type`,`timeline.scroll.${n}`,`Invalid scroll position ${no(r)}.`,`"<element edge> <viewport edge>", edges top | center | bottom | N% | Npx, e.g. "top bottom", "center center", "bottom 20%".`)}e.number(t.scroll.smoothing,`timeline.scroll.smoothing`,{min:0,max:.99}),t.trigger!==`scroll`&&e.warn(`ignored`,`timeline.scroll`,`timeline.scroll only applies with "trigger": "scroll".`,`Set "trigger": "scroll" or remove scroll.`)}}if(t.tracks===void 0||t.tracks===null)return e.error(`required`,`timeline.tracks`,`Missing required field "tracks" (an array of tracks).`,`Add "tracks": [].`);if(!Array.isArray(t.tracks))return e.error(`type`,`timeline.tracks`,`tracks must be an array.`);let s=new Set;t.tracks.forEach((t,i)=>Ao(e,t,`timeline.tracks[${i}]`,r,s,n))}function Ao(e,t,n,r,i,a){if(!eo(t))return e.error(`type`,n,`A track must be an object.`,`Example: { "target": "logo.rotation.y", "keys": [[0, 0], [4, 360]], "ease": "inOutSine" }.`);e.unknownKeys(t,io,n,`a track`),e.ease(t.ease,`${n}.ease`),e.number(t.stagger,`${n}.stagger`,{min:0}),t.staggerFrom!==void 0&&!oo.includes(t.staggerFrom)&&e.error(`enum`,`${n}.staggerFrom`,`Invalid value ${no(t.staggerFrom)}.`,`Valid values: ${M(oo)}.`),t.colorSpace!==void 0&&!ao.includes(t.colorSpace)&&e.error(`enum`,`${n}.colorSpace`,`Invalid value ${no(t.colorSpace)}.`,`Valid values: ${M(ao)} (default "oklch").`);let o;if(t.target===void 0||t.target===null)e.error(`required`,`${n}.target`,`Missing required field "target" ("<id>.<property>").`,`Add "target": "<id>.<property>".`);else if(typeof t.target!=`string`)e.error(`type`,`${n}.target`,`Expected a string, got ${no(t.target)}.`);else{let r=t.target;i.has(r)&&e.warn(`duplicate-track`,`${n}.target`,`Another track already animates "${r}"; the last one wins.`,`Merge the keys into a single track.`),i.add(r);let s=bo(r,a);s.error&&e.error(`track-target`,`${n}.target`,s.error.message,s.error.hint),s.warning&&e.warn(`track-target`,`${n}.target`,s.warning.message,s.warning.hint),o=s.kind;let c=r.slice(0,Math.max(r.indexOf(`.`),0)),l=c.includes(`,`)||c.startsWith(`tag:`)||c.startsWith(`children:`);t.stagger!==void 0&&!l&&e.warn(`ignored`,`${n}.stagger`,`stagger only applies to multi-target selectors.`,`Use "a,b,c.<prop>", "tag:<tag>.<prop>" or "children:<id>.<prop>".`)}if(t.keys===void 0||t.keys===null)return e.error(`required`,`${n}.keys`,`Missing required field "keys" ([[time, value], …]).`,`Add "keys": [[time, value], …].`);if(!Array.isArray(t.keys)||t.keys.length===0)return e.error(`type`,`${n}.keys`,`keys must be a non-empty array of [time, value].`,`Example: [[0, [0, 0, 0]], [2, [0, 1, 0]]].`);let s=-1/0,c=!0;t.keys.forEach((i,a)=>{let l=`${n}.keys[${a}]`;if(!Array.isArray(i)||i.length<2||i.length>3||!to(i[0]))return e.error(`type`,l,`Expected [time, value] or [time, value, ease], got ${no(i)}.`,`Example: [1.5, ${o?wo[o].split(` or `)[0]:`1`}] or [1.5, 1, "outBack"].`);let u=i[0];u<0&&e.error(`range`,`${l}[0]`,`Key time ${u} is negative.`,`Times are seconds from 0.`),u<s&&(c=!1),s=Math.max(s,u),u>r&&e.warn(`range`,`${l}[0]`,`Key time ${u}s is after timeline.duration (${r}s) and is never reached.`,`Increase timeline.duration to ≥ ${u} or move the key.`),o&&!Co(o,i[1])&&e.error(`track-value`,`${l}[1]`,`Value ${no(i[1])} does not match "${String(t.target)}" (expects ${o}).`,`Use a value like ${wo[o]}${o===`vec3`&&String(t.target).match(/rotation$/)?` (degrees)`:``}.`),i.length===3&&e.ease(i[2],`${l}[2]`)}),c||e.error(`track-order`,`${n}.keys`,`Keys are not sorted by time.`,`Sort the [time, value] pairs by ascending time.`)}function jo(e){if(typeof e!=`string`||!e.trim())return!1;let t=e.trim(),n=/^([a-z][a-z0-9+.-]*):/i.exec(t);return n?/^https?$/i.test(n[1])&&/^https?:\/\/[^/\s]+/i.test(t):!t.startsWith(`//`)&&!/\s/.test(t)}function Mo(e,t,n,r){if(!Array.isArray(t))return e.error(`type`,`interactions`,`interactions must be an array.`,`Example: [{ "on": "click", "target": "product", "do": [{ "openUrl": "https://shop.example/p/1" }] }].`);let i=eo(n.timeline)?n.timeline:null,a=i&&eo(i.segments)?Object.keys(i.segments):[],o=i&&eo(i.markers)?i.markers:{};t.forEach((t,n)=>{let i=`interactions[${n}]`;if(!eo(t))return e.error(`type`,i,`An interaction must be an object.`,`Example: { "on": "hover", "target": "card", "do": [{ "play": "hover-in" }] }.`);e.unknownKeys(t,[`on`,`target`,`key`,`event`,`at`,`once`,`do`],i,`an interaction`),so.includes(t.on)||e.error(t.on===void 0?`required`:`enum`,`${i}.on`,`Invalid "on" ${no(t.on)}.`,`${typeof t.on==`string`?j(t.on,so):``}Valid values: ${M(so)}.`);let s=t.on;if(t.target!==void 0&&(typeof t.target!=`string`||!r.objects.has(t.target)?e.error(`unknown-ref`,`${i}.target`,`target ${no(t.target)} is not an object id.`,`${typeof t.target==`string`?j(t.target,r.objects):``}Object ids: ${M([...r.objects])}.`):[`click`,`hover`,`hoverEnd`].includes(s)||e.warn(`ignored`,`${i}.target`,`target is ignored for on "${s}".`,`Targets apply to click, hover and hoverEnd.`)),s!==`key`||typeof t.key==`string`&&t.key||e.error(`required`,`${i}.key`,`on "key" needs "key": a KeyboardEvent.code.`,`Example: "key": "Space", "ArrowRight", "KeyE".`),s!==`event`||typeof t.event==`string`&&t.event||e.error(`required`,`${i}.event`,`on "event" needs "event": a marker or emitted event name.`,`Markers: ${M(Object.keys(o))}.`),s===`scroll`&&(t.at===void 0?e.error(`required`,`${i}.at`,`on "scroll" needs "at": the scroll progress (0..1) to cross.`,`Example: "at": 0.5.`):e.number(t.at,`${i}.at`,{min:0,max:1})),t.once!==void 0&&typeof t.once!=`boolean`&&e.error(`type`,`${i}.once`,`once must be true or false.`),!Array.isArray(t.do)||!t.do.length)return e.error(`required`,`${i}.do`,`"do" must be a non-empty array of actions.`,`Actions: ${co.map(e=>`{ "${e}": … }`).join(`, `)}.`);t.do.forEach((t,n)=>No(e,t,`${i}.do[${n}]`,s,a,o,r))})}function No(e,t,n,r,i,a,o){if(!eo(t))return e.error(`type`,n,`An action must be an object.`,`Example: { "play": "intro" }.`);let s=co.filter(e=>e in t);if(s.length!==1)return e.error(`type`,n,s.length?`An action has exactly one of ${M(co)}; got ${M(s)}.`:`Unknown action ${no(t)}.`,`Actions: ${co.map(e=>`{ "${e}": … }`).join(`, `)}.`);let c=s[0],l=(t,n)=>{if(typeof t!=`string`)return e.error(`type`,n,`Expected a segment name, got ${no(t)}.`);t!==`timeline`&&!i.includes(t)&&e.error(`unknown-ref`,n,`"${t}" is not a timeline segment.`,`${j(t,i)}Segments: ${M([`timeline`,...i])} — define it in timeline.segments.`)};switch(c){case`play`:e.unknownKeys(t,[`play`,`reverse`],n,`a play action`),l(t.play,`${n}.play`),t.reverse!==void 0&&typeof t.reverse!=`boolean`&&e.error(`type`,`${n}.reverse`,`reverse must be true or false.`);break;case`toggle`:e.unknownKeys(t,[`toggle`],n,`a toggle action`),l(t.toggle,`${n}.toggle`);break;case`seek`:e.unknownKeys(t,[`seek`],n,`a seek action`),!to(t.seek)&&!(typeof t.seek==`string`&&t.seek in a)&&e.error(`type`,`${n}.seek`,`seek needs seconds or a marker name, got ${no(t.seek)}.`,`Markers: ${M(Object.keys(a))}.`);break;case`set`:{e.unknownKeys(t,[`set`,`duration`,`ease`],n,`a set action`);let r=t.set;if(!eo(r)||typeof r.path!=`string`||r.value===void 0){e.error(`type`,`${n}.set`,`set needs { "path": "<id>.<property>", "value": … }.`,`Example: { "set": { "path": "logo.material.color", "value": "#ff3366" }, "duration": 0.4, "ease": "outCubic" }.`);break}e.unknownKeys(r,[`path`,`value`],`${n}.set`,`set`);let i=bo(r.path,o);i.error&&e.error(`track-target`,`${n}.set.path`,i.error.message,i.error.hint),i.warning?e.warn(`track-target`,`${n}.set.path`,i.warning.message,i.warning.hint):i.kind&&!Co(i.kind,r.value)&&e.error(`track-value`,`${n}.set.value`,`Value ${no(r.value)} does not match "${r.path}" (expects ${i.kind}).`,`Use a value like ${wo[i.kind]}.`),e.number(t.duration,`${n}.duration`,{min:0}),e.ease(t.ease,`${n}.ease`);break}case`emit`:e.unknownKeys(t,[`emit`,`payload`],n,`an emit action`),typeof t.emit==`string`&&t.emit||e.error(`type`,`${n}.emit`,`emit needs an event name.`);break;case`openUrl`:e.unknownKeys(t,[`openUrl`,`newTab`],n,`an openUrl action`),jo(t.openUrl)||e.error(`url`,`${n}.openUrl`,`openUrl ${no(t.openUrl)} is not allowed.`,`Only http(s) URLs ("https://shop.example/p/1") or page-relative paths ("/shop") can be opened.`),r!==`click`&&r!==`key`&&e.error(`gesture`,`${n}.openUrl`,`openUrl only works on "click" or "key" interactions (a user gesture), not "${r}".`,`Move it to an { "on": "click", "target": … } interaction.`),t.newTab!==void 0&&typeof t.newTab!=`boolean`&&e.error(`type`,`${n}.newTab`,`newTab must be true or false.`);break;case`playClip`:e.unknownKeys(t,[`playClip`,`target`,`loop`,`speed`,`crossfade`],n,`a playClip action`),typeof t.target==`string`&&o.models?.has(t.target)||e.error(`unknown-ref`,`${n}.target`,`playClip needs "target": a model object id, got ${no(t.target)}.`,`Models: ${M([...o.models??[]])}.`),typeof t.playClip!=`string`&&!(to(t.playClip)&&Number.isInteger(t.playClip)&&t.playClip>=0)&&e.error(`type`,`${n}.playClip`,`playClip is a clip name or index.`),e.number(t.speed,`${n}.speed`),e.number(t.crossfade,`${n}.crossfade`,{min:0}),t.loop!==void 0&&typeof t.loop!=`boolean`&&e.error(`type`,`${n}.loop`,`loop must be true or false.`)}}function Po(e,t,n){if(eo(t)&&(t.lookAt===void 0||typeof t.lookAt==`string`&&n.objects.has(t.lookAt)||e.error(`unknown-ref`,`camera.lookAt`,`camera.lookAt ${no(t.lookAt)} is not an object id.`,`${typeof t.lookAt==`string`?j(t.lookAt,n.objects):``}Object ids: ${M([...n.objects])}.`),t.shake!==void 0&&(eo(t.shake)?(e.unknownKeys(t.shake,[`amount`,`rotation`,`speed`,`seed`],`camera.shake`,`camera.shake`),e.number(t.shake.amount,`camera.shake.amount`,{min:0}),e.number(t.shake.rotation,`camera.shake.rotation`,{min:0}),e.number(t.shake.speed,`camera.shake.speed`,{min:0}),e.number(t.shake.seed,`camera.shake.seed`)):e.error(`type`,`camera.shake`,`shake must be an object.`,`Example: { "amount": 0.03, "rotation": 0.4, "speed": 0.5 }.`)),t.shots!==void 0)){if(!Array.isArray(t.shots))return e.error(`type`,`camera.shots`,`shots must be an array.`,`Example: [{ "type": "pushIn", "at": 0, "duration": 3 }].`);t.shots.forEach((t,r)=>{let i=`camera.shots[${r}]`;if(!eo(t))return e.error(`type`,i,`A shot must be an object.`);e.unknownKeys(t,uo,i,`a camera shot`),lo.includes(t.type)||e.error(t.type===void 0?`required`:`enum`,`${i}.type`,`Invalid shot type ${no(t.type)}.`,`${typeof t.type==`string`?j(t.type,lo):``}Types: ${M(lo)}.`),t.at===void 0?e.error(`required`,`${i}.at`,`Missing "at" (start time in seconds).`):e.number(t.at,`${i}.at`,{min:0}),t.duration===void 0?e.error(`required`,`${i}.duration`,`Missing "duration" (seconds).`):e.number(t.duration,`${i}.duration`,{min:0}),e.ease(t.ease,`${i}.ease`);for(let n of[`distance`,`height`,`angle`,`elevation`])e.number(t[n],`${i}.${n}`);e.number(t.fov,`${i}.fov`,{min:1,max:179}),e.number(t.focus,`${i}.focus`,{min:0}),e.number(t.lookAhead,`${i}.lookAhead`,{min:0,max:.5}),e.vec(t.position,`${i}.position`),e.vec(t.target,`${i}.target`);for(let r of[`object`,`lookAt`]){let a=t[r];typeof a==`string`&&!n.objects.has(a)&&e.error(`unknown-ref`,`${i}.${r}`,`"${a}" is not an object id.`,`${j(a,n.objects)}Object ids: ${M([...n.objects])}.`)}Array.isArray(t.lookAt)&&e.vec(t.lookAt,`${i}.lookAt`),t.type===`path`&&(!Array.isArray(t.points)||!t.points.length?e.error(`required`,`${i}.points`,`A "path" shot needs "points": [[x, y, z], …] (the camera starts from where it is).`):t.points.forEach((t,n)=>e.vec(t,`${i}.points[${n}]`))),(t.type===`lookAt`&&t.object===void 0&&t.target===void 0||t.type===`focus`&&t.object===void 0&&t.focus===void 0)&&e.error(`required`,i,`A "${t.type}" shot needs ${t.type===`lookAt`?`"object" (or "target": [x, y, z])`:`"object" or "focus" (distance)`}.`),t.type===`focus`&&n.postfx&&!n.postfx.has(`dof`)&&e.warn(`ignored`,i,`A "focus" shot drives the dof post effect, which is not in scene.postfx.`,`Add { "type": "dof" } to postfx.`),t.type===`zoom`&&t.fov===void 0&&e.error(`required`,`${i}.fov`,`A "zoom" shot needs "fov" (target field of view, degrees).`),t.type===`move`&&t.position===void 0&&t.target===void 0&&t.fov===void 0&&e.error(`required`,i,`A "move" shot needs "position", "target" and/or "fov".`)})}}function Fo(e,t,n){Array.isArray(t)&&t.forEach((t,r)=>{if(!eo(t))return;let i=typeof t.id==`string`?`objects#${t.id}`:`${n}[${r}]`;if(t.kind===`model`){if(t.morph!==void 0){if(!eo(t.morph))e.error(`type`,`${i}.morph`,`morph must be an object { targetName: 0..1 }.`,`Example: "morph": { "smile": 0.6 }.`);else for(let[n,r]of Object.entries(t.morph))e.number(r,`${i}.morph.${n}`)}let n=t.animation;if(eo(n)&&(e.number(n.offset,`${i}.animation.offset`,{min:0}),n.blend!==void 0)){if(!eo(n.blend))e.error(`type`,`${i}.animation.blend`,`blend must be an object { clipName: weight }.`,`Example: "blend": { "Wave": 0.5 }.`);else for(let[t,r]of Object.entries(n.blend))e.number(r,`${i}.animation.blend.${t}`,{min:0})}}Fo(e,t.children,`${i}.children`)})}function Io(e,t){let n=new To,r=Eo(e,t);return e.timeline!==void 0&&ko(n,e.timeline,r),e.interactions!==void 0&&Mo(n,e.interactions,e,r),Po(n,e.camera,r),Fo(n,e.objects,`objects`),n.issues}var Lo=[`banner`,`hero`,`card`,`square`,`fullscreen`,`inline`,`game`],Ro=[`mesh`,`text`,`model`,`group`,`generator`,`particles`,`instances`,`svg`,`photo`],zo=[`ambient`,`directional`,`point`,`spot`,`hemisphere`,`rect`],Bo=[`standard`,`physical`,`basic`,`lambert`,`toon`,`normal`,`matcap`,`gradient`,`shader`],Vo=[`studio`,`soft`,`sunset`,`night`,`neutral`,`sky`,`none`],Ho=[`sunrise`,`morning`,`noon`,`afternoon`,`golden-hour`,`sunset`,`dusk`],Uo=[`map`,`normalMap`,`roughnessMap`,`metalnessMap`,`aoMap`,`emissiveMap`,`bumpMap`,`displacementMap`,`alphaMap`],Wo=[`none`,`orbit`,`parallax`,`scroll`,`follow`],z=[`top-left`,`top`,`top-right`,`left`,`center`,`right`,`bottom-left`,`bottom`,`bottom-right`],Go=[`always`,`hover`,`click`,`visible`,`scroll`],Ko=Do,qo=[`none`,`aces`,`agx`,`neutral`,`reinhard`],Jo={banner:`4:1`,hero:`16:9`,card:`4:5`,square:`1:1`,inline:`16:9`,fullscreen:`16:9`,game:`16:9`},Yo={banner:600,hero:1500,card:400,square:600,inline:600,fullscreen:4e3,game:4e3},Xo=[`.glb`,`.gltf`],Zo=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.ktx2`,`.avif`],Qo=[`.hdr`,`.exr`,`.jpg`,`.jpeg`,`.png`,`.webp`],$o=[`.mp3`,`.ogg`,`.wav`,`.m4a`,`.aac`,`.opus`,`.webm`],es=[`.svg`],ts=[`.jpg`,`.jpeg`,`.png`,`.webp`],ns=[`parallax`,`mesh`,`layers`],rs=[`none`,`sway`,`orbit`,`zoom`],is=[`pointer`,`scroll`,`gyro`,`auto`,`speed`,`smoothing`],as=[`opacity`,`color`,`emissiveIntensity`],os=[`id`,`kind`,`name`,`visible`,`castShadow`,`receiveShadow`,`behaviours`,`children`,`tags`,`body`,`href`,`userData`,`attach`,`position`,`rotation`,`scale`],ss={mesh:[`geometry`,`material`],text:[`text`,`font`,`size`,`depth`,`bevel`,`align`,`letterSpacing`,`lineHeight`,`kerning`,`maxWidth`,`curveSegments`,`outline`,`splitLetters`,`reveal`,`material`],model:[`src`,`fit`,`center`,`animation`,`morph`,`material`],group:[],generator:[`generator`,`params`,`seed`,`material`],particles:[`preset`,...ia.map(e=>e.name)],instances:[`geometry`,`material`,`layout`,`colors`],svg:[`src`,`size`,`fit`,`depth`,`bevel`,`keepColors`,`strokes`,`curveSegments`,`layerGap`,`material`],photo:[`src`,`depth`,`mode`,`width`,`height`,`strength`,`focus`,`segments`,`layers`,`edgeCut`,`motion`,`material`]},cs=[`version`,`id`,`title`,`description`,`target`,`camera`,`environment`,`lights`,`objects`,`timeline`,`interactions`,`postfx`,`physics`,`scripts`,`ui`,`audio`,`data`,`ariaLabel`,`seed`],ls=[`kind`,`aspect`,`budgetKb`,`height`,`transparent`,`lazy`,`pauseOffscreen`,`maxDpr`,`reducedMotion`,`posterTime`,`antialias`,`shadows`,`toneMapping`,`exposure`,`quality`],us={radialSegments:[`segments`],widthSegments:[`segments`],capSegments:[`segments`],heightSegments:[`segments`],tubularSegments:[`segments`],thetaLength:[`arc`]},ds=[`type`,`fov`,`zoom`,`position`,`target`,`near`,`far`,`controls`,`autoRotate`,`orbitZoom`,`orbitLimits`,`parallax`,`scrollPath`,`follow`,`lookAt`,`shake`,`shots`],fs=[`background`,`lighting`,`lightingIntensity`,`fog`,`ground`,`rig`,`contactShadows`,`shadows`],ps=[`id`,`type`,`color`,`intensity`,`position`,`target`,`castShadow`,`skyColor`,`groundColor`,`distance`,`decay`,`angle`,`penumbra`,`width`,`height`,`panel`,`volumetric`,`shadow`,`behaviours`],ms=`preset.type.color.metalness.roughness.emissive.emissiveIntensity.opacity.transparent.wireframe.flatShading.side.transmission.thickness.ior.clearcoat.iridescence.sheen.map.normalMap.roughnessMap.repeat.gradient.shader.uniforms.clearcoatRoughness.sheenColor.sheenRoughness.anisotropy.anisotropyRotation.attenuationColor.attenuationDistance.specularIntensity.specularColor.dispersion.iridescenceIOR.iridescenceThicknessRange.envMapIntensity.metalnessMap.aoMap.emissiveMap.bumpMap.displacementMap.alphaMap.normalScale.bumpScale.aoMapIntensity.displacementScale.triplanar.gradientEmissive`.split(`.`),hs=[`type`,`shape`,`size`,`radius`,`height`,`shapes`,`offset`,`mass`,`restitution`,`friction`,`material`,`velocity`,`angularVelocity`,`linearDamping`,`angularDamping`,`gravityScale`,`fixedRotation`,`character`,`sleep`,`ccd`,`layer`,`collidesWith`],gs=[`static`,`dynamic`,`kinematic`,`trigger`],_s=[`box`,`sphere`,`auto`,`cylinder`,`capsule`,`convex`,`trimesh`,`heightfield`,`compound`],vs=[`box`,`sphere`,`cylinder`,`capsule`],ys=[`hinge`,`point`,`distance`,`lock`,`spring`],bs=[`gravity`,`step`,`substeps`,`iterations`,`sleep`,`debug`,`materials`,`contacts`,`layers`,`joints`],xs=[`id`,`type`,`a`,`b`,`pivot`,`axis`,`distance`,`restLength`,`stiffness`,`damping`,`motor`,`limits`,`maxForce`,`collideConnected`],Ss=new WeakMap,Cs=[`id`,`type`,`text`,`anchor`,`style`,`value`,`action`,`visible`,`color`,`background`],ws={"geometries.lathe.points":{dims:2,min:2},"geometries.extrude.shape":{dims:2,min:3},"geometries.tube.points":{dims:3,min:2},"behaviours.path.points":{dims:3,min:2}},B=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Ts=e=>typeof e==`number`&&Number.isFinite(e),Es=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,Ds=e=>{let t=JSON.stringify(e);return t===void 0?String(e):t.length>60?`${t.slice(0,57)}…`:t},Os=class{issues=[];ids=new Map;objectIds=new Set;lightIds=new Set;letterTexts=new Set;letterCounts=new Map;add(e,t,n,r,i){this.issues.push(i?{severity:e,code:t,path:n,message:r,hint:i}:{severity:e,code:t,path:n,message:r})}error(e,t,n,r){this.add(`error`,e,t,n,r)}warn(e,t,n,r){this.add(`warning`,e,t,n,r)}info(e,t,n,r){this.add(`info`,e,t,n,r)}required(e,t,n,r){return e[t]===void 0||e[t]===null?(this.error(`required`,ks(n,t),`Missing required field "${t}" (${r}).`,`Add "${t}": ${r}.`),!1):!0}number(e,t,n={}){return e===void 0?!0:Ts(e)?n.integer&&!Number.isInteger(e)?(this.error(`type`,t,`Expected an integer, got ${e}.`,`Use a whole number, e.g. ${Math.round(e)}.`),!1):n.min!==void 0&&(n.exclusiveMin?e<=n.min:e<n.min)?(this.error(`range`,t,`${e} is below the minimum (${n.exclusiveMin?`>`:`≥`} ${n.min}).`,`Use a value${js(n)}.`),!1):n.max!==void 0&&e>n.max?(this.error(`range`,t,`${e} is above the maximum (${n.max}).`,`Use a value${js(n)}.`),!1):!0:(this.error(`type`,t,`Expected a number, got ${Es(e)} ${Ds(e)}.`,`Set ${As(t)} to a number${js(n)}.`),!1)}boolean(e,t){return e===void 0||typeof e==`boolean`||(this.error(`type`,t,`Expected true or false, got ${Es(e)} ${Ds(e)}.`,`Set ${As(t)} to true or false.`),!1)}string(e,t,n={}){return e===void 0?!0:typeof e==`string`?n.nonEmpty&&!e.trim()?(this.error(`required`,t,`Must not be empty.`),!1):!0:(this.error(`type`,t,`Expected a string, got ${Es(e)} ${Ds(e)}.`),!1)}enumOf(e,t,n){if(e===void 0||typeof e==`string`&&t.includes(e))return!0;let r=typeof e==`string`?j(e,t):``;return this.error(`enum`,n,`Invalid value ${Ds(e)}.`,`${r}Valid values: ${M(t)}.`),!1}color(e,t){return e===void 0||Ca(e)?!0:(this.error(`color`,t,`Invalid colour ${Ds(e)}.`,`Use a CSS colour: "#ff8800", "#f80", "rgb(255,136,0)", "hsl(30 100% 50%)" or a CSS name like "tomato".`),!1)}colors(e,t,n=1){if(e===void 0)return!0;if(!Array.isArray(e))return this.error(`type`,t,`Expected an array of colours, got ${Es(e)}.`,`Example: ["#ff006e", "#3a86ff"].`),!1;e.length<n&&this.error(`required`,t,`Needs at least ${n} colour${n>1?`s`:``}.`,`Example: ["#ff006e", "#3a86ff"].`);let r=e.length>=n;return e.forEach((e,n)=>r=this.color(e,`${t}[${n}]`)&&r),r}vec(e,t,n){if(e===void 0)return!0;if(!Array.isArray(e)||e.length!==t||!e.every(Ts)){let r=t===3?`[0, 1.5, 0]`:`[1, 1]`;return this.error(`vec`,n,`Expected [${t===3?`x, y, z`:`x, y`}] (${t} numbers), got ${Ds(e)}.`,`Write it as an array of ${t} numbers, e.g. ${r}.`),!1}return!0}stringArray(e,t){return e===void 0?!0:!Array.isArray(e)||!e.every(e=>typeof e==`string`)?(this.error(`type`,t,`Expected an array of strings, got ${Ds(e)}.`),!1):!0}unknownKeys(e,t,n,r){for(let i of Object.keys(e)){if(t.includes(i))continue;let e=Fi(i,t);this.warn(`unknown-field`,ks(n,i),`Unknown field "${i}" on ${r} (ignored by the runtime).`,e?`Did you mean "${e}"? Otherwise remove it.`:`Remove it. Valid fields: ${M(t)}.`)}}assetPath(e,t,n,r){if(e===void 0)return!0;if(typeof e!=`string`||!e.trim())return this.error(`type`,t,`Expected an asset path string for ${r}, got ${Ds(e)}.`,`Use a project path like "assets/models/fox.glb" or a library id like "library:models/nature/pine-tree.glb".`),!1;let i=Ns(e);if(i)return this.error(`asset-path`,t,`Invalid asset path "${e}": ${i.message}`,i.hint),!1;if(!Fa(e)){let i=e.toLowerCase().split(`?`)[0];if(!n.some(e=>i.endsWith(e)))return this.error(`asset-path`,t,`"${e}" does not look like ${r} (expected ${n.join(`, `)}).`,`Point ${As(t)} at a ${n.join(` / `)} file.`),!1}return!0}declareId(e,t,n){if(typeof e!=`string`||!Ii.test(e))return this.error(`invalid-id`,t,`Invalid ${n} id ${Ds(e)}.`,`Ids start with a letter and use letters, digits, "_" or "-" (regex ${Ii.source}), e.g. "logo" or "tree-1".`),!1;if(n!==`ui`){let r=this.ids.get(e);if(r)return this.error(`duplicate-id`,t,`Duplicate id "${e}" (already used at ${r}).`,`Ids are unique across objects (including children) and lights. Rename this one, e.g. "${e}-2".`),!1;this.ids.set(e,t),(n===`object`?this.objectIds:this.lightIds).add(e)}return!0}params(e,t,n,r,i=[]){let a=t.params.map(e=>e.name);for(let i of t.params){let a=n[i.name],o=ks(r,i.name);a===void 0?i.required&&this.error(`required`,o,`${Ms(e)} "${t.id}" requires "${i.name}" (${i.description}).`,`Add "${i.name}" (${i.type}).`):e===`generators`&&JSON.stringify(a).includes(`{data.`)||this.param(`${e}.${t.id}.${i.name}`,i,a,o,t.id)}for(let o of Object.keys(n)){if(a.includes(o)||i.includes(o))continue;let n=e===`geometries`?us[o]?.find(e=>a.includes(e)):void 0;if(n){this.warn(`unknown-param`,ks(r,o),`"${o}" is not a parameter of ${Ms(e)} "${t.id}": it is called "${n}" here (the value is ignored as written).`,`Rename "${o}" to "${n}".`);continue}let s=Fi(o,a);this.warn(`unknown-param`,ks(r,o),`Unknown parameter "${o}" for ${Ms(e)} "${t.id}" (ignored).`,`${s?`Did you mean "${s}"? `:``}${a.length?`Valid parameters: ${M(a)}.`:`"${t.id}" takes no parameters — remove it.`}`)}}param(e,t,n,r,i){if(n===null&&/null/.test(t.description))return!0;let a=ws[e];if(a)return this.points(n,a.dims,a.min,r);switch(t.type){case`number`:return this.number(n,r,{min:t.min,max:t.max});case`integer`:return this.number(n,r,{min:t.min,max:t.max,integer:!0});case`boolean`:return this.boolean(n,r);case`string`:return this.string(n,r);case`color`:return this.color(n,r);case`colors`:return this.colors(n,r);case`vec2`:return this.vec(n,2,r);case`vec3`:return this.vec(n,3,r);case`enum`:return!!this.enumOf(n,t.options??[],r);case`object`:return B(n)?!0:(this.error(`type`,r,`Expected an object for "${t.name}" of "${i}", got ${Es(n)}.`),!1);case`array`:return Array.isArray(n)?!t.options||n.every((e,n)=>this.enumOf(e,t.options??[],`${r}[${n}]`)):(this.error(`type`,r,`Expected an array for "${t.name}" of "${i}", got ${Es(n)}.`,t.description),!1)}return!0}points(e,t,n,r){if(!Array.isArray(e))return this.error(`type`,r,`Expected an array of [${t===2?`x, y`:`x, y, z`}] points, got ${Es(e)}.`,t===2?`Example: [[0, 0], [0.5, 0.2], [0.3, 1]].`:`Example: [[0, 0, 0], [1, 1, 0], [2, 0, 1]].`),!1;e.length<n&&this.error(`required`,r,`Needs at least ${n} points, got ${e.length}.`);let i=e.length>=n;return e.forEach((e,n)=>i=this.vec(e,t,`${r}[${n}]`)&&i),i}};function ks(e,t){return e?`${e}.${t}`:t}function As(e){let t=/([^.#[\]]+)(?:\[\d+\])*$/.exec(e);return t?`"${t[1]}"`:`the value`}function js(e){return e.min!==void 0&&e.max!==void 0?` between ${e.min} and ${e.max}`:e.min===void 0?e.max===void 0?``:` ≤ ${e.max}`:e.exclusiveMin?` greater than ${e.min}`:` ≥ ${e.min}`}function Ms(e){return{geometries:`geometry`,materialPresets:`material preset`,shaders:`shader`,behaviours:`behaviour`,generators:`generator`,particlePresets:`particle preset`,instanceLayouts:`instance layout`,postfx:`post effect`,fonts:`font`,sounds:`sound`,textures:`procedural texture`,lightRigs:`light rig`}[e]}function Ns(e){if(Fa(e)){let t=Ia(e);return!/^[a-z0-9][a-z0-9._/-]*$/i.test(t)||t.includes(`..`)||t.endsWith(`/`)?{message:`library ids look like "library:<path in the library>".`,hint:`List valid ids with library_list (CLI: agent3d assets library), e.g. "library:models/nature/pine-tree.glb".`}:null}return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)||e.startsWith(`//`)?{message:`remote URLs are not allowed (exports never hotlink).`,hint:`Download the file into the project first (assets_search + assets_add, CLI: agent3d assets search|add) and use its assets/… path.`}:e.startsWith(`data:`)||e.startsWith(`blob:`)?{message:`inline data URIs are not allowed in scene.json.`,hint:`Save the file under assets/ and reference its path.`}:e.startsWith(`/`)||/^[a-zA-Z]:/.test(e)||e.includes(`\\`)?{message:`paths must be relative to the project folder, with forward slashes.`,hint:`Use e.g. "assets/textures/wood.jpg".`}:e.split(`/`).includes(`..`)?{message:`".." is not allowed: assets must live inside the project.`,hint:`Copy the file into assets/ and reference it from there.`}:null}function Ps(e){let t=new Os;if(!B(e))return t.error(`type`,``,`A scene must be a JSON object, got ${Es(e)}.`,"Start from scene_get / `agent3d scene get` or a template."),t.issues;let n=e;t.unknownKeys(n,cs,``,`the scene`),n.version!==1&&t.error(n.version===void 0?`required`:`enum`,`version`,`Scene "version" must be 1, got ${Ds(n.version)}.`,`Set "version": 1.`),t.required(n,`id`,``,`a short identifier, e.g. "spring-banner"`)&&t.string(n.id,`id`,{nonEmpty:!0}),t.required(n,`title`,``,`a human title`)&&t.string(n.title,`title`,{nonEmpty:!0}),t.string(n.description,`description`),t.string(n.ariaLabel,`ariaLabel`),t.number(n.seed,`seed`,{integer:!0}),n.data!==void 0&&!B(n.data)&&t.error(`type`,`data`,`scene.data must be an object.`,`Example: "data": { "levels": [] }.`),t.required(n,`target`,``,`{ "kind": "banner", "aspect": "4:1" }`)&&Is(t,n.target),t.required(n,`camera`,``,`{ "type": "perspective", "position": [0, 0, 8] }`)&&Ls(t,n.camera,`camera`),t.required(n,`environment`,``,`{ "background": "#101020" }`)&&zs(t,n.environment),n.lights===void 0?t.error(`required`,`lights`,`Missing "lights" array.`,`Add "lights": [] (or lights like { "type": "directional", "position": [5, 8, 5] }).`):Array.isArray(n.lights)||t.error(`type`,`lights`,`lights must be an array.`),n.objects===void 0?t.error(`required`,`objects`,`Missing "objects" array.`,`Add "objects": [].`):Array.isArray(n.objects)||t.error(`type`,`objects`,`objects must be an array.`);let r=Array.isArray(n.lights)?n.lights:[];r.forEach((e,n)=>Hs(t,e,`lights[${n}]`));let i=Array.isArray(n.objects)?n.objects:[];Ws.set(t,new Set(i.filter(B))),i.forEach((e,n)=>Gs(t,e,`objects[${n}]`)),Rs(t,n.camera),t.issues.push(...Io(n,{objects:t.objectIds,lights:t.lightIds,letters:t.letterTexts,letterCounts:t.letterCounts})),n.postfx!==void 0&&oc(t,n.postfx),n.physics!==void 0&&sc(t,n.physics),n.scripts!==void 0&&cc(t,n.scripts),n.ui!==void 0&&lc(t,n.ui),n.audio!==void 0&&uc(t,n.audio);let a=B(n.environment)&&(n.environment.rig!==void 0||B(n.environment.background)&&B(n.environment.background.sky)&&(n.environment.background.sky.preset!==void 0||n.environment.background.sky.physical===!0)&&n.environment.lighting!==`none`);return r.length===0&&!a&&B(n.environment)&&(n.environment.lighting===`none`||n.environment.lighting===void 0)&&Fs(i)&&t.warn(`no-lights`,`lights`,`The scene has no lights and no environment lighting: lit materials (standard, physical, toon…) will render black.`,`Add lights (e.g. { "type": "hemisphere", "intensity": 1 } and a directional key light) or set environment.lighting to "studio".`),t.issues}function Fs(e){return e.some(e=>B(e)&&(e.kind!==`photo`&&e.kind!==`group`||Array.isArray(e.children)&&Fs(e.children)))}function Is(e,t){if(!B(t))return e.error(`type`,`target`,`target must be an object.`,`Example: { "kind": "banner", "aspect": "4:1" }.`);e.unknownKeys(t,ls,`target`,`target`),e.required(t,`kind`,`target`,`one of ${M(Lo)}`)&&e.enumOf(t.kind,Lo,`target.kind`),e.required(t,`aspect`,`target`,`"W:H", e.g. "4:1"`)&&(Hi(t.aspect)||e.error(`aspect`,`target.aspect`,`Invalid aspect ${Ds(t.aspect)}.`,`Use "W:H" with positive numbers, e.g. "4:1" (banner), "16:9" (hero), "1:1" (square)${typeof t.kind==`string`&&t.kind in Jo?`; default for ${t.kind}: "${Jo[t.kind]}"`:``}.`)),e.number(t.budgetKb,`target.budgetKb`,{min:0,exclusiveMin:!0}),t.height===void 0||typeof t.height==`string`&&/^\d+(\.\d+)?(px|vh|vw|rem|em|%|svh|dvh|lvh)$/.test(t.height.trim())||e.error(`type`,`target.height`,`Invalid CSS height ${Ds(t.height)}.`,`Use a CSS length like "320px", "60vh" or "20rem" — or remove it to keep the aspect ratio.`);for(let n of[`transparent`,`lazy`,`pauseOffscreen`,`antialias`,`shadows`])e.boolean(t[n],`target.${n}`);e.number(t.maxDpr,`target.maxDpr`,{min:.5,max:4}),e.enumOf(t.reducedMotion,[`static`,`slow`,`ignore`],`target.reducedMotion`),e.number(t.posterTime,`target.posterTime`,{min:0}),e.enumOf(t.quality,[`auto`,`low`,`medium`,`high`,`ultra`],`target.quality`),e.enumOf(t.toneMapping,qo,`target.toneMapping`),e.number(t.exposure,`target.exposure`,{min:0,exclusiveMin:!0,max:10})}function Ls(e,t,n){if(!B(t))return e.error(`type`,n,`camera must be an object.`,`Example: { "type": "perspective", "fov": 40, "position": [0, 1, 8], "target": [0, 0, 0] }.`);e.unknownKeys(t,ds,n,`the camera`),e.required(t,`type`,n,`"perspective" or "orthographic"`)&&e.enumOf(t.type,[`perspective`,`orthographic`],`${n}.type`),e.required(t,`position`,n,`[x, y, z] in units`)&&e.vec(t.position,3,`${n}.position`),e.vec(t.target,3,`${n}.target`),e.number(t.fov,`${n}.fov`,{min:1,max:179}),t.fov!==void 0&&t.type===`orthographic`&&e.warn(`ignored`,`${n}.fov`,`fov is ignored by an orthographic camera.`,`Use "zoom" (world units visible vertically) instead.`),e.number(t.zoom,`${n}.zoom`,{min:0,exclusiveMin:!0}),e.number(t.near,`${n}.near`,{min:0,exclusiveMin:!0}),e.number(t.far,`${n}.far`,{min:0,exclusiveMin:!0}),Ts(t.near)&&Ts(t.far)&&t.far<=t.near&&e.error(`range`,`${n}.far`,`far (${t.far}) must be greater than near (${t.near}).`,`Typical values: near 0.1, far 1000.`),Array.isArray(t.position)&&Array.isArray(t.target)&&t.position.length===3&&t.target.length===3&&t.position.every((e,n)=>e===t.target[n])&&e.error(`range`,`${n}.position`,`camera.position equals camera.target: the camera has no direction.`,`Move the camera back, e.g. position [0, 1, 8] looking at [0, 0, 0].`),e.enumOf(t.controls,Wo,`${n}.controls`),e.number(t.autoRotate,`${n}.autoRotate`),e.boolean(t.orbitZoom,`${n}.orbitZoom`),t.orbitLimits!==void 0&&(B(t.orbitLimits)?(e.unknownKeys(t.orbitLimits,[`minDistance`,`maxDistance`,`minPolar`,`maxPolar`,`minAzimuth`,`maxAzimuth`],`${n}.orbitLimits`,`orbitLimits`),e.number(t.orbitLimits.minDistance,`${n}.orbitLimits.minDistance`,{min:0}),e.number(t.orbitLimits.maxDistance,`${n}.orbitLimits.maxDistance`,{min:0}),e.number(t.orbitLimits.minPolar,`${n}.orbitLimits.minPolar`,{min:0,max:180}),e.number(t.orbitLimits.maxPolar,`${n}.orbitLimits.maxPolar`,{min:0,max:180}),e.number(t.orbitLimits.minAzimuth,`${n}.orbitLimits.minAzimuth`,{min:-360,max:360}),e.number(t.orbitLimits.maxAzimuth,`${n}.orbitLimits.maxAzimuth`,{min:-360,max:360})):e.error(`type`,`${n}.orbitLimits`,`orbitLimits must be an object.`)),t.parallax!==void 0&&(B(t.parallax)?(e.unknownKeys(t.parallax,[`strength`,`smoothing`],`${n}.parallax`,`parallax`),e.number(t.parallax.strength,`${n}.parallax.strength`,{min:0}),e.number(t.parallax.smoothing,`${n}.parallax.smoothing`,{min:0,max:.99})):e.error(`type`,`${n}.parallax`,`parallax must be an object.`,`Example: { "strength": 0.5, "smoothing": 0.9 }.`)),t.scrollPath!==void 0&&(Array.isArray(t.scrollPath)?t.scrollPath.forEach((t,r)=>{let i=`${n}.scrollPath[${r}]`;if(!B(t))return e.error(`type`,i,`Expected { position: [x,y,z], target?: [x,y,z] }.`);e.required(t,`position`,i,`[x, y, z]`)&&e.vec(t.position,3,`${i}.position`),e.vec(t.target,3,`${i}.target`)}):e.error(`type`,`${n}.scrollPath`,`scrollPath must be an array of { position, target? }.`)),t.controls===`scroll`&&(!Array.isArray(t.scrollPath)||t.scrollPath.length<2)&&e.error(`required`,`${n}.scrollPath`,`controls "scroll" needs a scrollPath with at least 2 points.`,`Add "scrollPath": [{ "position": [0, 1, 8] }, { "position": [4, 2, 4], "target": [0, 0, 0] }].`),t.follow!==void 0&&(B(t.follow)?(e.unknownKeys(t.follow,[`target`,`offset`,`smoothing`,`lookAhead`],`${n}.follow`,`follow`),e.required(t.follow,`target`,`${n}.follow`,`the id of the object to follow`)&&e.string(t.follow.target,`${n}.follow.target`),e.vec(t.follow.offset,3,`${n}.follow.offset`),e.number(t.follow.smoothing,`${n}.follow.smoothing`,{min:0,max:.99}),e.number(t.follow.lookAhead,`${n}.follow.lookAhead`,{min:0})):e.error(`type`,`${n}.follow`,`follow must be an object.`,`Example: { "target": "player", "offset": [0, 3, 6] }.`)),t.controls===`follow`&&t.follow===void 0&&e.error(`required`,`${n}.follow`,`controls "follow" needs camera.follow.`,`Add "follow": { "target": "<object id>", "offset": [0, 3, 6] }.`)}function Rs(e,t){B(t)&&B(t.follow)&&typeof t.follow.target==`string`&&(e.objectIds.has(t.follow.target)||e.error(`unknown-ref`,`camera.follow.target`,`camera.follow.target "${t.follow.target}" is not an object id.`,`${j(t.follow.target,e.objectIds)}Object ids: ${M([...e.objectIds])}.`))}function zs(e,t){if(!B(t))return e.error(`type`,`environment`,`environment must be an object.`,`Example: { "background": { "gradient": ["#0f0c29", "#302b63"] }, "lighting": "studio" }.`);if(e.unknownKeys(t,fs,`environment`,`environment`),e.required(t,`background`,`environment`,`a colour, "transparent", { gradient: [...] }, { radial: [...] }, { sky: {...} } or { hdri: "assets/…" }`)&&Vs(e,t.background),t.lighting!==void 0&&(typeof t.lighting==`string`?e.enumOf(t.lighting,Vo,`environment.lighting`):B(t.lighting)?(e.unknownKeys(t.lighting,[`hdri`,`intensity`,`rotation`],`environment.lighting`,`environment.lighting`),e.number(t.lighting.rotation,`environment.lighting.rotation`),e.required(t.lighting,`hdri`,`environment.lighting`,`an .hdr/.exr path or library id`)&&e.assetPath(t.lighting.hdri,`environment.lighting.hdri`,Qo,`an HDRI`),e.number(t.lighting.intensity,`environment.lighting.intensity`,{min:0})):e.error(`type`,`environment.lighting`,`Invalid lighting ${Ds(t.lighting)}.`,`Use a preset (${M(Vo)}) or { "hdri": "assets/hdris/x.hdr" }.`)),e.number(t.lightingIntensity,`environment.lightingIntensity`,{min:0}),t.fog!==void 0){let n=t.fog;B(n)?(e.unknownKeys(n,[`color`,`near`,`far`,`density`,`height`,`falloff`],`environment.fog`,`fog`),e.color(n.color,`environment.fog.color`),n.density!==void 0&&e.number(n.density,`environment.fog.density`,{min:0,max:1}),e.number(n.height,`environment.fog.height`),e.number(n.falloff,`environment.fog.falloff`,{min:0,exclusiveMin:!0}),(n.height!==void 0||n.falloff!==void 0)&&n.density===void 0&&e.warn(`ignored`,`environment.fog.height`,`Height fog needs an exponential fog (density).`,`Use { "density": 0.04, "height": 0, "falloff": 0.3 }.`),e.number(n.near,`environment.fog.near`,{min:0}),e.number(n.far,`environment.fog.far`,{min:0}),Ts(n.near)&&Ts(n.far)&&n.far<=n.near&&e.error(`range`,`environment.fog.far`,`fog.far must be greater than fog.near.`)):e.error(`type`,`environment.fog`,`fog must be an object.`,`Use { "color": "#ccd", "near": 10, "far": 50 } (linear) or { "color": "#ccd", "density": 0.03 } (exponential).`)}if(t.ground!==void 0){let n=t.ground;B(n)?(e.unknownKeys(n,[`y`,`size`,`color`,`shadowOnly`,`grid`,`roughness`,`opacity`],`environment.ground`,`ground`),e.number(n.opacity,`environment.ground.opacity`,{min:0,max:1}),e.number(n.y,`environment.ground.y`),e.number(n.size,`environment.ground.size`,{min:0,exclusiveMin:!0}),e.color(n.color,`environment.ground.color`),e.boolean(n.shadowOnly,`environment.ground.shadowOnly`),e.boolean(n.grid,`environment.ground.grid`),e.number(n.roughness,`environment.ground.roughness`,{min:0,max:1})):e.error(`type`,`environment.ground`,`ground must be an object.`,`Example: { "y": 0, "shadowOnly": true }.`)}if(t.rig!==void 0){let n=t.rig,r=fa.lightRigs.map(e=>e.id),i=typeof n==`string`?n:B(n)?n.preset:void 0;if(!(typeof n==`string`||B(n)))e.error(`type`,`environment.rig`,`Invalid rig ${Ds(n)}.`,`Use a rig id (${M(r)}) or { "preset": "softbox", "intensity": 1 }.`);else if(typeof i!=`string`)e.error(`required`,`environment.rig.preset`,`rig needs a "preset" id.`,`One of ${M(r)}.`);else{let t=qs(e,`lightRigs`,i,typeof n==`string`?`environment.rig`:`environment.rig.preset`);t&&B(n)&&e.params(`lightRigs`,t,n,`environment.rig`,[`preset`])}}if(t.contactShadows!==void 0&&typeof t.contactShadows!=`boolean`){let n=t.contactShadows,r=`environment.contactShadows`;B(n)?(e.unknownKeys(n,[`y`,`size`,`center`,`opacity`,`blur`,`far`,`resolution`,`color`,`frames`],r,`contactShadows`),e.vec(n.center,2,`${r}.center`),e.number(n.y,`${r}.y`),e.number(n.size,`${r}.size`,{min:0,exclusiveMin:!0}),e.number(n.opacity,`${r}.opacity`,{min:0,max:1}),e.number(n.blur,`${r}.blur`,{min:0,max:20}),e.number(n.far,`${r}.far`,{min:0,exclusiveMin:!0}),e.number(n.resolution,`${r}.resolution`,{min:64,max:2048,integer:!0}),e.color(n.color,`${r}.color`),e.number(n.frames,`${r}.frames`,{min:0,integer:!0})):e.error(`type`,r,`contactShadows must be true or an object.`,`Example: { "opacity": 0.6, "blur": 2.5 }.`)}if(t.shadows!==void 0){let n=t.shadows;B(n)?(e.unknownKeys(n,[`type`,`softness`,`mapSize`,`intensity`],`environment.shadows`,`shadows`),e.enumOf(n.type,[`pcf`,`vsm`],`environment.shadows.type`),Bs(e,n,`environment.shadows`)):e.error(`type`,`environment.shadows`,`shadows must be an object.`,`Example: { "type": "vsm", "softness": 6 }.`)}}function Bs(e,t,n){e.number(t.softness,`${n}.softness`,{min:0,max:30}),e.number(t.mapSize,`${n}.mapSize`,{min:256,max:4096,integer:!0}),e.number(t.intensity,`${n}.intensity`,{min:0,max:1})}function Vs(e,t){let n=`environment.background`;if(typeof t==`string`){t!==`transparent`&&e.color(t,n);return}if(!B(t))return e.error(`type`,n,`Invalid background ${Ds(t)}.`,`Use a colour ("#101020"), "transparent", { "gradient": ["#a", "#b"], "angle": 0 }, { "radial": [...] }, { "meshGradient": [...] }, { "sky": {...} } or { "hdri": "assets/hdris/x.hdr" }.`);let r=Object.keys(t),i=[`gradient`,`radial`,`meshGradient`,`sky`,`hdri`].find(e=>e in t);if(!i)return e.error(`type`,n,`Background object needs one of "gradient", "radial", "meshGradient", "sky" or "hdri" (got keys ${M(r)}).`,`Example: { "gradient": ["#0f0c29", "#302b63", "#24243e"], "angle": 0 }.`);if(i===`gradient`)e.unknownKeys(t,[`gradient`,`angle`,`grain`],n,`a gradient background`),e.colors(t.gradient,`${n}.gradient`,2),e.number(t.angle,`${n}.angle`),e.number(t.grain,`${n}.grain`,{min:0,max:1});else if(i===`radial`)e.unknownKeys(t,[`radial`,`center`,`radius`,`grain`],n,`a radial background`),e.colors(t.radial,`${n}.radial`,2),e.vec(t.center,2,`${n}.center`),e.number(t.radius,`${n}.radius`,{min:0,exclusiveMin:!0}),e.number(t.grain,`${n}.grain`,{min:0,max:1});else if(i===`meshGradient`)e.unknownKeys(t,[`meshGradient`,`speed`,`scale`,`seed`,`grain`],n,`a mesh-gradient background`),e.colors(t.meshGradient,`${n}.meshGradient`,2),Array.isArray(t.meshGradient)&&t.meshGradient.length>6&&e.warn(`ignored`,`${n}.meshGradient`,`Only the first 6 colours are used.`),e.number(t.speed,`${n}.speed`,{min:0}),e.number(t.scale,`${n}.scale`,{min:.05}),e.number(t.seed,`${n}.seed`),e.number(t.grain,`${n}.grain`,{min:0,max:1});else if(i===`sky`){e.unknownKeys(t,[`sky`],n,`a sky background`);let r=t.sky;if(!B(r))return e.error(`type`,`${n}.sky`,`sky must be an object.`,`Example: { "top": "#4a90d9", "horizon": "#f6d6a8", "sun": { "direction": [1, 0.4, 0.2] } }.`);e.unknownKeys(r,[`top`,`horizon`,`bottom`,`sun`,`stars`,`physical`,`preset`,`turbidity`,`rayleigh`,`mieCoefficient`,`mieDirectionalG`,`exposure`,`clouds`],`${n}.sky`,`sky`),e.boolean(r.physical,`${n}.sky.physical`),e.enumOf(r.preset,Ho,`${n}.sky.preset`),e.number(r.turbidity,`${n}.sky.turbidity`,{min:0,max:30}),e.number(r.rayleigh,`${n}.sky.rayleigh`,{min:0,max:6}),e.number(r.mieCoefficient,`${n}.sky.mieCoefficient`,{min:0,max:.1}),e.number(r.mieDirectionalG,`${n}.sky.mieDirectionalG`,{min:0,max:.999}),e.number(r.exposure,`${n}.sky.exposure`,{min:0}),e.number(r.clouds,`${n}.sky.clouds`,{min:0,max:1});let i=r.physical===!0||r.preset!==void 0||r.turbidity!==void 0||r.rayleigh!==void 0;if(i)for(let t of[`top`,`horizon`,`bottom`])r[t]!==void 0&&e.warn(`ignored`,`${n}.sky.${t}`,`"${t}" is ignored by the physical sky (preset / physical).`,`Remove it, or drop preset/physical for a colour-gradient sky.`);if(e.color(r.top,`${n}.sky.top`),e.color(r.horizon,`${n}.sky.horizon`),e.color(r.bottom,`${n}.sky.bottom`),e.number(r.stars,`${n}.sky.stars`,{min:0,integer:!0,max:1e5}),r.sun!==void 0&&r.sun!==!1){if(!B(r.sun))e.error(`type`,`${n}.sky.sun`,`sun must be an object or false.`);else if(e.unknownKeys(r.sun,[`direction`,`elevation`,`azimuth`,`color`,`size`,`light`,`intensity`,`castShadow`],`${n}.sky.sun`,`sun`),e.vec(r.sun.direction,3,`${n}.sky.sun.direction`),e.number(r.sun.elevation,`${n}.sky.sun.elevation`,{min:-90,max:90}),e.number(r.sun.azimuth,`${n}.sky.sun.azimuth`),e.color(r.sun.color,`${n}.sky.sun.color`),e.number(r.sun.size,`${n}.sky.sun.size`,{min:0}),e.boolean(r.sun.light,`${n}.sky.sun.light`),e.number(r.sun.intensity,`${n}.sky.sun.intensity`,{min:0}),e.boolean(r.sun.castShadow,`${n}.sky.sun.castShadow`),!i)for(let t of[`light`,`intensity`,`castShadow`])r.sun[t]!==void 0&&e.warn(`ignored`,`${n}.sky.sun.${t}`,`sun.${t} only applies to the physical sky (it adds a sun light).`,`Set "preset" (e.g. "golden-hour") or "physical": true, or add a directional light yourself.`)}}else{e.unknownKeys(t,[`hdri`,`blur`,`intensity`,`rotation`,`groundProjection`],n,`an HDRI background`),e.assetPath(t.hdri,`${n}.hdri`,Qo,`an HDRI`),e.number(t.blur,`${n}.blur`,{min:0,max:1}),e.number(t.intensity,`${n}.intensity`,{min:0}),e.number(t.rotation,`${n}.rotation`);let r=t.groundProjection;r!==void 0&&typeof r!=`boolean`&&(B(r)?(e.unknownKeys(r,[`height`,`radius`],`${n}.groundProjection`,`groundProjection`),e.number(r.height,`${n}.groundProjection.height`,{min:0,exclusiveMin:!0}),e.number(r.radius,`${n}.groundProjection.radius`,{min:0,exclusiveMin:!0})):e.error(`type`,`${n}.groundProjection`,`groundProjection must be true or { height, radius }.`)),r&&t.blur&&e.warn(`ignored`,`${n}.blur`,`blur is ignored with groundProjection (the photo is projected sharp).`)}}function Hs(e,t,n){if(!B(t))return e.error(`type`,n,`A light must be an object.`,`Example: { "type": "directional", "position": [5, 8, 5], "intensity": 2 }.`);let r=t.id!==void 0&&Li(t.id)?`lights#${t.id}`:n;t.id!==void 0&&e.declareId(t.id,`${r}.id`,`light`),e.unknownKeys(t,ps,r,`a ${typeof t.type==`string`?t.type:``} light`.replace(` `,` `)),e.required(t,`type`,r,`one of ${M(zo)}`)&&e.enumOf(t.type,zo,`${r}.type`),e.color(t.color,`${r}.color`),e.number(t.intensity,`${r}.intensity`,{min:0}),e.vec(t.position,3,`${r}.position`),e.vec(t.target,3,`${r}.target`),e.boolean(t.castShadow,`${r}.castShadow`),e.color(t.skyColor,`${r}.skyColor`),e.color(t.groundColor,`${r}.groundColor`),e.number(t.distance,`${r}.distance`,{min:0}),e.number(t.decay,`${r}.decay`,{min:0}),e.number(t.angle,`${r}.angle`,{min:0,max:90}),e.number(t.penumbra,`${r}.penumbra`,{min:0,max:1}),e.number(t.width,`${r}.width`,{min:0}),e.number(t.height,`${r}.height`,{min:0}),e.boolean(t.panel,`${r}.panel`),t.panel&&t.type!==`rect`&&e.warn(`ignored`,`${r}.panel`,`panel only applies to rect lights.`),t.volumetric!==void 0&&typeof t.volumetric!=`boolean`&&(B(t.volumetric)?(e.unknownKeys(t.volumetric,[`intensity`,`length`,`color`],`${r}.volumetric`,`volumetric`),e.number(t.volumetric.intensity,`${r}.volumetric.intensity`,{min:0}),e.number(t.volumetric.length,`${r}.volumetric.length`,{min:0,exclusiveMin:!0}),e.color(t.volumetric.color,`${r}.volumetric.color`)):e.error(`type`,`${r}.volumetric`,`volumetric must be true or { intensity, length, color }.`)),t.volumetric&&t.type!==`spot`&&e.warn(`ignored`,`${r}.volumetric`,`volumetric only applies to spot lights.`,`Use "type": "spot" (with "angle" and "target") for a light cone.`),t.shadow!==void 0&&(B(t.shadow)?(e.unknownKeys(t.shadow,[`softness`,`mapSize`,`bias`,`normalBias`,`intensity`],`${r}.shadow`,`shadow`),Bs(e,t.shadow,`${r}.shadow`),e.number(t.shadow.bias,`${r}.shadow.bias`,{min:-.1,max:.1}),e.number(t.shadow.normalBias,`${r}.shadow.normalBias`,{min:0,max:1}),t.castShadow||e.info(`ignored`,`${r}.shadow`,`shadow settings only apply when castShadow is true.`)):e.error(`type`,`${r}.shadow`,`shadow must be an object.`,`Example: { "softness": 6, "mapSize": 2048 }.`)),(t.type===`directional`||t.type===`spot`||t.type===`point`||t.type===`rect`)&&t.position===void 0&&e.info(`default`,`${r}.position`,`This ${t.type} light has no position (the runtime uses a default).`,`Set position [x, y, z] explicitly so lighting is predictable, e.g. [5, 8, 5].`),t.castShadow&&(t.type===`ambient`||t.type===`hemisphere`||t.type===`rect`)&&e.warn(`ignored`,`${r}.castShadow`,`${t.type} lights cannot cast shadows.`,`Use a directional, spot or point light for shadows.`),Zs(e,t.behaviours,`${r}.behaviours`)}function Us(e,t){return Li(e.id)?`objects#${e.id}`:t}var Ws=new WeakMap;function Gs(e,t,n){if(!B(t))return e.error(`type`,n,`An object must be a JSON object.`,`Example: { "id": "box", "kind": "mesh", "geometry": { "type": "box" } }.`);let r=Us(t,n);e.declareId(t.id,`${r}.id`,`object`);let i=t.kind;if(!e.required(t,`kind`,r,`one of ${M(Ro)}`))return;if(!Ro.includes(i)){e.error(`enum`,`${r}.kind`,`Unknown object kind ${Ds(i)}.`,`${typeof i==`string`?j(i,Ro):``}Valid kinds: ${M(Ro)}.`);return}let a=i;if(e.unknownKeys(t,[...os,...ss[a]],r,`a "${a}" object`),e.string(t.name,`${r}.name`),e.boolean(t.visible,`${r}.visible`),e.boolean(t.castShadow,`${r}.castShadow`),e.boolean(t.receiveShadow,`${r}.receiveShadow`),e.vec(t.position,3,`${r}.position`),e.vec(t.rotation,3,`${r}.rotation`),Array.isArray(t.rotation)&&t.rotation.every(Ts)&&t.rotation.some(e=>e!==0)&&t.rotation.every(e=>Math.abs(e)<=2*Math.PI+1e-6)&&t.rotation.some(e=>!Number.isInteger(e))&&e.warn(`radians`,`${r}.rotation`,`rotation ${Ds(t.rotation)} looks like radians.`,`Angles are in DEGREES. E.g. ${Ds(t.rotation.map(e=>Math.round(e*180/Math.PI)))}.`),t.scale!==void 0&&(Ts(t.scale)?e.number(t.scale,`${r}.scale`,{min:0,exclusiveMin:!0}):e.vec(t.scale,3,`${r}.scale`)),e.stringArray(t.tags,`${r}.tags`),t.href!==void 0&&(typeof t.href!=`string`||!t.href.trim()?e.error(`type`,`${r}.href`,`href must be a URL string.`):/^\s*javascript:/i.test(t.href)&&e.error(`forbidden`,`${r}.href`,`javascript: links are not allowed.`,`Use an http(s) URL, a relative page path or "#anchor".`)),t.userData!==void 0&&!B(t.userData)&&e.error(`type`,`${r}.userData`,`userData must be an object.`),t.attach!==void 0&&(e.enumOf(t.attach,[`camera`],`${r}.attach`),t.attach===`camera`)){Ws.get(e)?.has(t)||e.error(`invalid`,`${r}.attach`,`Only top-level objects can be attached to the camera.`,`Move the object (or its group) to the root of objects[] and set attach there.`);let n=t.position;Array.isArray(n)&&Ts(n[2])&&n[2]>-.2?e.warn(`framing`,`${r}.position`,`A camera-attached object at z = ${String(n[2])} is behind or inside the lens: camera space looks down -z.`,`Use a negative z, e.g. [${Ts(n[0])?n[0]:0}, ${Ts(n[1])?n[1]:0}, -6] (6 units in front of the camera).`):n===void 0&&e.warn(`framing`,`${r}.position`,`A camera-attached object without position sits inside the lens.`,`Set position in camera space, e.g. [0, -1.5, -6] (6 units in front, a bit below centre).`)}if(t.body!==void 0&&(nc(e,t.body,`${r}.body`),$s(e,t,`${r}.body`),B(t.body)&&typeof t.id==`string`)){let n=Ss.get(e)??[];n.push({id:t.id,path:`${r}.body`,body:t.body}),Ss.set(e,n)}switch(Zs(e,t.behaviours,`${r}.behaviours`),a){case`mesh`:e.required(t,`geometry`,r,`{ "type": "box" } (see catalog geometries)`)&&Js(e,t.geometry,`${r}.geometry`),Ys(e,t.material,`${r}.material`);break;case`text`:e.required(t,`text`,r,`the text to display`)&&e.string(t.text,`${r}.text`,{nonEmpty:!0}),typeof t.font==`string`&&(t.font.includes(`/`)||t.font.includes(`:`))?e.assetPath(t.font,`${r}.font`,[`.json`],`a three.js typeface JSON font (scripts/convert-font.mjs)`):t.font!==void 0&&qs(e,`fonts`,t.font,`${r}.font`),e.number(t.size,`${r}.size`,{min:0,exclusiveMin:!0}),e.number(t.depth,`${r}.depth`,{min:0}),e.number(t.bevel,`${r}.bevel`,{min:0}),e.enumOf(t.align,[`left`,`center`,`right`],`${r}.align`),e.number(t.letterSpacing,`${r}.letterSpacing`),e.number(t.lineHeight,`${r}.lineHeight`,{min:0,exclusiveMin:!0}),ac(e,t,r),Ys(e,t.material,`${r}.material`);break;case`model`:if(e.required(t,`src`,r,`a .glb/.gltf path ("assets/models/fox.glb") or "library:<id>"`)&&e.assetPath(t.src,`${r}.src`,Xo,`a glTF model`),e.number(t.fit,`${r}.fit`,{min:0,exclusiveMin:!0}),e.boolean(t.center,`${r}.center`),t.animation!==void 0){let n=t.animation;B(n)?(e.unknownKeys(n,[`clip`,`loop`,`speed`,`crossfade`,`offset`,`blend`],`${r}.animation`,`animation`),n.clip!==void 0&&typeof n.clip!=`string`&&!(Ts(n.clip)&&Number.isInteger(n.clip)&&n.clip>=0)&&e.error(`type`,`${r}.animation.clip`,`clip must be a clip name or a clip index (integer ≥ 0).`),e.boolean(n.loop,`${r}.animation.loop`),e.number(n.speed,`${r}.animation.speed`),e.number(n.crossfade,`${r}.animation.crossfade`,{min:0})):e.error(`type`,`${r}.animation`,`animation must be an object.`,`Example: { "clip": "Walk", "loop": true }.`)}Ys(e,t.material,`${r}.material`);break;case`group`:Array.isArray(t.children)&&t.children.length||e.info(`empty-group`,r,`Group "${String(t.id)}" has no children.`,`Add children or remove the group.`);break;case`generator`:{if(!e.required(t,`generator`,r,`a catalog generator id (${M(fa.generators.map(e=>e.id))})`))break;let n=qs(e,`generators`,t.generator,`${r}.generator`);if(t.params!==void 0&&!B(t.params)?e.error(`type`,`${r}.params`,`params must be an object.`):n&&e.params(`generators`,n,t.params??{},`${r}.params`),e.number(t.seed,`${r}.seed`,{integer:!0}),t.material!==void 0&&(Ys(e,t.material,`${r}.material`),n&&!n.material)){let t=fa.generators.filter(e=>e.material).map(e=>e.id);e.warn(`ignored`,`${r}.material`,`The "${n.id}" generator ignores "material" (it uses its colour params).`,`Use its colour params (agent3d catalog generators ${n.id}); material overrides work on: ${M(t)}.`)}break}case`particles`:t.preset!==void 0&&qs(e,`particlePresets`,t.preset,`${r}.preset`),e.number(t.count,`${r}.count`,{integer:!0,min:1,max:2e5}),e.vec(t.area,3,`${r}.area`),e.number(t.size,`${r}.size`,{min:0,exclusiveMin:!0}),Array.isArray(t.color)?e.colors(t.color,`${r}.color`):e.color(t.color,`${r}.color`),e.number(t.speed,`${r}.speed`,{min:0}),e.vec(t.direction,3,`${r}.direction`),e.number(t.spread,`${r}.spread`,{min:0,max:1}),e.number(t.lifetime,`${r}.lifetime`,{min:0,exclusiveMin:!0}),e.number(t.opacity,`${r}.opacity`,{min:0,max:1}),e.enumOf(t.blending,[`normal`,`additive`],`${r}.blending`),e.enumOf(t.shape,ra,`${r}.shape`),e.number(t.seed,`${r}.seed`,{integer:!0}),t.preset===void 0&&t.count===void 0&&e.info(`default`,r,`Particles without preset or count use runtime defaults.`,`Set a preset (${M(fa.particlePresets.map(e=>e.id))}) and/or count.`);break;case`instances`:e.required(t,`geometry`,r,`{ "type": "box" }`)&&Js(e,t.geometry,`${r}.geometry`),Ys(e,t.material,`${r}.material`),e.required(t,`layout`,r,`{ "type": "grid" | "scatter" | "circle" | "list", … }`)&&Qs(e,t.layout,`${r}.layout`),e.colors(t.colors,`${r}.colors`);break;case`svg`:e.required(t,`src`,r,`inline "<svg …>" markup or a project .svg path`)&&(typeof t.src==`string`?/^\s*(<svg|<\?xml)/i.test(t.src)||e.assetPath(t.src,`${r}.src`,es,`an SVG file`):e.error(`type`,`${r}.src`,`src must be a string.`)),e.number(t.size,`${r}.size`,{min:0,exclusiveMin:!0}),e.number(t.depth,`${r}.depth`,{min:0}),e.number(t.bevel,`${r}.bevel`,{min:0}),e.enumOf(t.fit,[`width`,`height`,`max`],`${r}.fit`),e.boolean(t.keepColors,`${r}.keepColors`),e.boolean(t.strokes,`${r}.strokes`),e.number(t.curveSegments,`${r}.curveSegments`,{integer:!0,min:1,max:64}),e.number(t.layerGap,`${r}.layerGap`,{min:0}),Ys(e,t.material,`${r}.material`);break;case`photo`:Ks(e,t,r)}t.children!==void 0&&(Array.isArray(t.children)?t.children.forEach((t,n)=>Gs(e,t,`${r}.children[${n}]`)):e.error(`type`,`${r}.children`,`children must be an array of objects.`))}function Ks(e,t,n){e.required(t,`src`,n,`an image path ("assets/textures/photo.jpg") or "library:<id>" (.jpg / .png / .webp)`)&&e.assetPath(t.src,`${n}.src`,ts,`an image (.jpg / .png / .webp)`),e.assetPath(t.depth,`${n}.depth`,ts,`a depth map image (grayscale PNG, white = near)`),e.enumOf(t.mode,ns,`${n}.mode`),e.number(t.width,`${n}.width`,{min:0,exclusiveMin:!0}),e.number(t.height,`${n}.height`,{min:0,exclusiveMin:!0});for(let r of[`strength`,`focus`,`edgeCut`])e.number(t[r],`${n}.${r}`,{min:0,max:1});e.number(t.segments,`${n}.segments`,{integer:!0,min:8,max:1024}),e.number(t.layers,`${n}.layers`,{integer:!0,min:2,max:16});let r=typeof t.mode==`string`?t.mode:`parallax`;if(t.segments!==void 0&&r!==`mesh`&&e.info(`ignored`,`${n}.segments`,`segments only applies to mode "mesh" (this photo is "${r}").`,`Set mode: "mesh", or remove segments.`),t.layers!==void 0&&r!==`layers`&&e.info(`ignored`,`${n}.layers`,`layers only applies to mode "layers" (this photo is "${r}").`,`Set mode: "layers", or remove layers.`),t.depth===void 0&&typeof t.src==`string`&&ns.includes(r)&&e.warn(`photo-flat`,n,`Photo "${String(t.id)}" has no depth map: it renders flat (mode "${r}" needs one).`,`Run \`agent3d assets depth ${t.src}\` (writes a depth PNG next to it), then set ${n}.depth to its path.`),t.motion!==void 0){let r=t.motion;B(r)?(e.unknownKeys(r,is,`${n}.motion`,`photo motion`),e.number(r.pointer,`${n}.motion.pointer`,{min:0,max:1}),e.number(r.scroll,`${n}.motion.scroll`,{min:0,max:1}),e.boolean(r.gyro,`${n}.motion.gyro`),e.enumOf(r.auto,rs,`${n}.motion.auto`),e.number(r.speed,`${n}.motion.speed`,{min:0}),e.number(r.smoothing,`${n}.motion.smoothing`,{min:0,max:1})):e.error(`type`,`${n}.motion`,`motion must be an object.`,`Example: { "pointer": 1, "scroll": 0, "auto": "sway", "speed": 1 }.`)}if(t.material!==void 0){let r=t.material;if(!B(r))e.error(`type`,`${n}.material`,`material must be an object.`,`A photo material only takes { "opacity", "color", "emissiveIntensity" }, e.g. { "opacity": 0.9 }.`);else{for(let t of Object.keys(r)){if(as.includes(t))continue;let r=Fi(t,as);e.warn(`unknown-field`,`${n}.material.${t}`,`"${t}" is not supported on a photo material (ignored by the runtime).`,`${r?`Did you mean "${r}"? `:``}A photo is unlit: only ${M(as)} apply.`)}e.number(r.opacity,`${n}.material.opacity`,{min:0,max:1}),e.color(r.color,`${n}.material.color`),e.number(r.emissiveIntensity,`${n}.material.emissiveIntensity`,{min:0})}}}function qs(e,t,n,r){let i=fa[t].map(e=>e.id);if(typeof n!=`string`){e.error(`type`,r,`Expected a ${Ms(t)} id string, got ${Es(n)}.`,`Valid ids: ${M(i)}.`);return}let a=pa(t,n);return a||e.error(`unknown-id`,r,`Unknown ${Ms(t)} "${n}".`,`${j(n,i)}Valid ids: ${M(i)} (catalog_get section "${t}").`),a}function Js(e,t,n){if(!B(t))return e.error(`type`,n,`geometry must be an object.`,`Example: { "type": "sphere", "radius": 0.5 }.`);if(!e.required(t,`type`,n,`a catalog geometry (${M(fa.geometries.map(e=>e.id))})`))return;let r=qs(e,`geometries`,t.type,`${n}.type`);r&&e.params(`geometries`,r,t,n,[`type`])}function Ys(e,t,n){if(t===void 0)return;if(typeof t==`string`){let r=ma(t);return e.error(`type`,n,`material must be an object, got the string ${Ds(t)}.`,r?`Write { "preset": "${t}" }.`:Ca(t)?`Write { "color": "${t}" }.`:`Write { "preset": "plastic", "color": "#ff8800" }.`)}if(!B(t))return e.error(`type`,n,`material must be an object.`,`Example: { "preset": "gold" } or { "color": "#ff8800", "roughness": 0.4 }.`);if(e.unknownKeys(t,ms,n,`a material`),t.preset!==void 0){let r=fa.materialPresets.map(e=>e.id);typeof t.preset==`string`&&ma(t.preset)||e.error(`unknown-id`,`${n}.preset`,`Unknown material preset ${Ds(t.preset)}.`,`${typeof t.preset==`string`?j(t.preset,r):``}Valid presets: ${M(r)}.`)}e.enumOf(t.type,Bo,`${n}.type`),e.color(t.color,`${n}.color`),e.color(t.emissive,`${n}.emissive`),e.number(t.emissiveIntensity,`${n}.emissiveIntensity`,{min:0});for(let r of[`metalness`,`roughness`,`opacity`,`transmission`,`clearcoat`,`iridescence`,`sheen`])e.number(t[r],`${n}.${r}`,{min:0,max:1});e.number(t.thickness,`${n}.thickness`,{min:0}),e.number(t.ior,`${n}.ior`,{min:1,max:2.333});for(let r of[`transparent`,`wireframe`,`flatShading`])e.boolean(t[r],`${n}.${r}`);e.enumOf(t.side,[`front`,`back`,`double`],`${n}.side`);for(let r of Uo)Xs(e,t[r],`${n}.${r}`);e.vec(t.repeat,2,`${n}.repeat`);for(let r of[`clearcoatRoughness`,`sheenRoughness`,`anisotropy`,`specularIntensity`,`aoMapIntensity`])e.number(t[r],`${n}.${r}`,{min:0,max:1});for(let r of[`sheenColor`,`attenuationColor`,`specularColor`])e.color(t[r],`${n}.${r}`);e.number(t.anisotropyRotation,`${n}.anisotropyRotation`),e.number(t.attenuationDistance,`${n}.attenuationDistance`,{min:0,exclusiveMin:!0}),e.number(t.dispersion,`${n}.dispersion`,{min:0,max:10}),e.number(t.iridescenceIOR,`${n}.iridescenceIOR`,{min:1,max:2.333}),e.vec(t.iridescenceThicknessRange,2,`${n}.iridescenceThicknessRange`),e.number(t.envMapIntensity,`${n}.envMapIntensity`,{min:0}),e.number(t.normalScale,`${n}.normalScale`,{min:-10,max:10}),e.number(t.bumpScale,`${n}.bumpScale`,{min:-10,max:10}),e.number(t.displacementScale,`${n}.displacementScale`),t.triplanar!==void 0&&typeof t.triplanar!=`boolean`&&e.number(t.triplanar,`${n}.triplanar`,{min:0,exclusiveMin:!0}),e.boolean(t.gradientEmissive,`${n}.gradientEmissive`);let r=[`transmission`,`thickness`,`ior`,`clearcoat`,`iridescence`,`sheen`,`clearcoatRoughness`,`sheenColor`,`sheenRoughness`,`anisotropy`,`anisotropyRotation`,`attenuationColor`,`attenuationDistance`,`specularIntensity`,`specularColor`,`dispersion`,`iridescenceIOR`,`iridescenceThicknessRange`],i=t.type??(typeof t.preset==`string`?ma(t.preset)?.props.type:void 0);if(i!==void 0&&i!==`physical`)for(let a of r)t[a]!==void 0&&e.warn(`ignored`,`${n}.${a}`,`"${a}" needs a physical material (type is ${Ds(i)}).`,`Set "type": "physical".`);t.gradient!==void 0&&e.colors(t.gradient,`${n}.gradient`,2),t.type===`gradient`&&t.gradient===void 0&&e.error(`required`,`${n}.gradient`,`material type "gradient" needs a "gradient" colour list.`,`Add "gradient": ["#ff7eb3", "#7afcff"].`),Ts(t.opacity)&&t.opacity<1&&t.transparent!==!0&&t.transmission===void 0&&e.info(`opacity`,`${n}.opacity`,`opacity ${t.opacity} has no effect unless "transparent": true.`,`Add "transparent": true to the material.`);let a=t.type===`shader`;if(t.shader!==void 0){let r=qs(e,`shaders`,t.shader,`${n}.shader`);a||e.warn(`ignored`,`${n}.shader`,`"shader" is only used when material.type is "shader" (type is ${Ds(t.type??`unset`)}).`,`Set "type": "shader".`),r&&t.uniforms!==void 0&&(B(t.uniforms)?e.params(`shaders`,r,t.uniforms,`${n}.uniforms`):e.error(`type`,`${n}.uniforms`,`uniforms must be an object.`))}else a?e.error(`required`,`${n}.shader`,`material type "shader" needs a "shader" id.`,`Add "shader": one of ${M(fa.shaders.map(e=>e.id))}.`):t.uniforms!==void 0&&e.warn(`ignored`,`${n}.uniforms`,`uniforms are only used by shader materials.`,`Set "type": "shader" and "shader": "<id>", or remove uniforms.`)}function Xs(e,t,n){if(t!==void 0){if(B(t)){if(!e.required(t,`procedural`,n,`a procedural texture id (${M(fa.textures.map(e=>e.id))})`))return;let r=qs(e,`textures`,t.procedural,`${n}.procedural`);r&&e.params(`textures`,r,t,n,[`procedural`])}else e.assetPath(t,n,Zo,`a texture image`)}}function Zs(e,t,n){if(t!==void 0){if(!Array.isArray(t))return e.error(`type`,n,`behaviours must be an array.`,`Example: [{ "type": "rotate", "speed": 30 }].`);t.forEach((t,r)=>{let i=`${n}[${r}]`;if(!B(t))return e.error(`type`,i,`A behaviour must be an object.`,`Example: { "type": "float", "amplitude": 0.2 }.`);if(!e.required(t,`type`,i,`a catalog behaviour (${M(fa.behaviours.map(e=>e.id))})`))return;let a=qs(e,`behaviours`,t.type,`${i}.type`);e.enumOf(t.when,Go,`${i}.when`),e.number(t.delay,`${i}.delay`,{min:0}),a&&e.params(`behaviours`,a,t,i,[`type`,`when`,`delay`])})}}function Qs(e,t,n){if(!B(t))return e.error(`type`,n,`layout must be an object.`,'Example: { "type": "grid", "count": [5, 1, 5], "spacing": [1.2, 0, 1.2] }. See `agent3d catalog instanceLayouts`.');let r=fa.instanceLayouts.map(e=>e.id);if(!e.required(t,`type`,n,M(r))||!e.enumOf(t.type,r,`${n}.type`))return;let i=pa(`instanceLayouts`,t.type);switch(e.params(`instanceLayouts`,i,t,n,[`type`]),t.type){case`grid`:Array.isArray(t.count)&&t.count.length===3&&!t.count.every(e=>Number.isInteger(e)&&e>=1)&&e.error(`range`,`${n}.count`,`grid count values must be integers ≥ 1.`,`Use 1 for a flat axis, e.g. [8, 1, 8].`);break;case`scatter`:Ts(t.minScale)&&Ts(t.maxScale)&&t.minScale>t.maxScale&&e.warn(`range`,`${n}.minScale`,`minScale (${t.minScale}) is larger than maxScale (${t.maxScale}).`,`Swap them.`);break;case`list`:if(!Array.isArray(t.items))break;t.items.forEach((t,r)=>{let i=`${n}.items[${r}]`;if(!B(t))return e.error(`type`,i,`Expected { position?, rotation?, scale? }.`);e.unknownKeys(t,[`position`,`rotation`,`scale`],i,`a transform`),e.vec(t.position,3,`${i}.position`),e.vec(t.rotation,3,`${i}.rotation`),t.scale!==void 0&&!Ts(t.scale)&&e.vec(t.scale,3,`${i}.scale`)})}}function $s(e,t,n){let r=t.body,i=t.geometry;if(!B(r)||!Array.isArray(r.size)||r.size.length!==3||!r.size.every(Ts)||!B(i))return;let a=(e,t)=>Ts(e)?e:t,o=i.type===`plane`?[a(i.width,1),a(i.height,1),0]:i.type===`box`?[a(i.width,1),a(i.height,1),a(i.depth,1)]:null;if(!o)return;let s=e=>{let t=e.indexOf(Math.min(...e)),n=e.filter((e,n)=>n!==t);return e[t]<=.5*Math.min(...n)?t:-1},c=s(o),l=s(r.size);if(c<0||l<0||c===l)return;let u=[`x`,`y`,`z`],d=[...r.size];[d[c],d[l]]=[d[l],d[c]];let f=Array.isArray(t.rotation)&&t.rotation.some(e=>Ts(e)&&Math.abs(e)>1);e.warn(`body-frame`,`${n}.size`,`body.size ${JSON.stringify(r.size)} is thin on ${u[l]}, but this ${i.type}'s own thin axis is ${u[c]}: the size is applied in the object's frame${f?` (before its rotation)`:``}, so the collider ${i.type===`plane`&&f?`stands up like a wall`:`does not match the mesh`}.`,`Write it in the object's frame: "size": ${JSON.stringify(d)} — or drop size to fit the geometry automatically.`)}var ec=new Set([`true`,`false`,`null`,`undefined`]);function tc(e,t,n){let r=/([A-Za-z_$][\w$.]*)\s*(===|!==|==|!=)\s*([A-Za-z_$][\w$.]*)/g,i=t.replace(/'[^']*'|"[^"]*"/g,e=>` `.repeat(e.length));for(let a=r.exec(i);a;a=r.exec(i)){let[,r,i,o]=a;ec.has(o)||ec.has(r)||o.startsWith(`state.`)||e.warn(`expr-bare-word`,n,`"${r} ${i} ${o}" compares two state values: "${o}" is read as state.${o.replace(/^state\./,``)} (probably undefined), not as the text "${o}".`,`Quote the text: ${JSON.stringify(t.replace(a[0],`${r} ${i} '${o}'`))} (or write state.${o.replace(/^state\./,``)} to compare two state keys on purpose).`)}}function nc(e,t,n){if(!B(t))return e.error(`type`,n,`body must be an object.`,`Example: { "type": "dynamic", "shape": "box", "mass": 1 }.`);e.unknownKeys(t,hs,n,`a physics body`),e.required(t,`type`,n,`"static" | "dynamic" | "kinematic" | "trigger"`)&&e.enumOf(t.type,gs,`${n}.type`),e.enumOf(t.shape,_s,`${n}.shape`),e.vec(t.size,3,`${n}.size`),e.number(t.radius,`${n}.radius`,{min:0,exclusiveMin:!0}),e.number(t.height,`${n}.height`,{min:0,exclusiveMin:!0}),e.vec(t.offset,3,`${n}.offset`),e.number(t.mass,`${n}.mass`,{min:0}),e.number(t.restitution,`${n}.restitution`,{min:0,max:1}),e.number(t.friction,`${n}.friction`,{min:0}),e.string(t.material,`${n}.material`,{nonEmpty:!0}),e.vec(t.velocity,3,`${n}.velocity`),e.vec(t.angularVelocity,3,`${n}.angularVelocity`),e.number(t.linearDamping,`${n}.linearDamping`,{min:0,max:1}),e.number(t.angularDamping,`${n}.angularDamping`,{min:0,max:1}),e.number(t.gravityScale,`${n}.gravityScale`),e.boolean(t.fixedRotation,`${n}.fixedRotation`),e.boolean(t.character,`${n}.character`),e.boolean(t.sleep,`${n}.sleep`),e.boolean(t.ccd,`${n}.ccd`),e.string(t.layer,`${n}.layer`,{nonEmpty:!0}),e.stringArray(t.collidesWith,`${n}.collidesWith`),t.shapes!==void 0&&(!Array.isArray(t.shapes)||t.shapes.length===0?e.error(`type`,`${n}.shapes`,`shapes must be a non-empty array of colliders.`,`Example: [{ "shape": "box", "size": [1, 0.2, 1] }, { "shape": "sphere", "radius": 0.3, "offset": [0, 0.5, 0] }].`):t.shapes.forEach((t,r)=>{let i=`${n}.shapes[${r}]`;if(!B(t))return e.error(`type`,i,`A collider must be an object.`,`Example: { "shape": "box", "size": [1, 1, 1], "offset": [0, 0.5, 0] }.`);e.unknownKeys(t,[`shape`,`size`,`radius`,`height`,`offset`,`rotation`],i,`a collider`),e.required(t,`shape`,i,M(vs))&&e.enumOf(t.shape,vs,`${i}.shape`),e.vec(t.size,3,`${i}.size`),e.number(t.radius,`${i}.radius`,{min:0,exclusiveMin:!0}),e.number(t.height,`${i}.height`,{min:0,exclusiveMin:!0}),e.vec(t.offset,3,`${i}.offset`),e.vec(t.rotation,3,`${i}.rotation`)}),t.shape!==void 0&&t.shape!==`compound`&&e.warn(`ignored`,`${n}.shapes`,`shapes is only used with shape "compound" (shape is ${Ds(t.shape)}).`,`Set "shape": "compound" or remove "shapes".`)),t.shape===`compound`&&t.shapes===void 0&&e.error(`required`,`${n}.shapes`,`shape "compound" needs a "shapes" array.`,`Example: "shapes": [{ "shape": "box", "size": [1, 0.2, 1] }, { "shape": "sphere", "radius": 0.3, "offset": [0, 0.5, 0] }].`),(t.shape===`trimesh`||t.shape===`heightfield`)&&t.type===`dynamic`&&e.error(`invalid`,`${n}.shape`,`shape "${t.shape}" only works for static (or kinematic) bodies.`,`Use "convex" (hull of the mesh) or "box" / "compound" for dynamic bodies.`),t.mass!==void 0&&t.type!==void 0&&t.type!==`dynamic`&&e.info(`ignored`,`${n}.mass`,`mass is ignored on ${Ds(t.type)} bodies (they have infinite mass).`)}function rc(e,t,n,r){if(!B(t))return e.error(`type`,n,`A joint must be an object.`,`Example: { "type": "hinge", "a": "door", "pivot": [1, 1, 0], "axis": [0, 1, 0] }.`);e.unknownKeys(t,xs,n,`a joint`),e.required(t,`type`,n,M(ys))&&e.enumOf(t.type,ys,`${n}.type`),e.string(t.id,`${n}.id`,{nonEmpty:!0});let i=i=>{let a=t[i];if(a!==void 0){if(typeof a!=`string`)return e.error(`type`,`${n}.${i}`,`${i} must be an object id.`);if(!e.objectIds.has(a))return e.error(`unknown-ref`,`${n}.${i}`,`Joint ${i} "${a}" is not an object id.`,`${j(a,e.objectIds)}Object ids: ${M([...e.objectIds])}.`);if(!r.has(a))return e.error(`invalid`,`${n}.${i}`,`Object "${a}" has no body: joints connect physics bodies.`,`Add "body": { "type": "dynamic" } to "${a}".`)}};e.required(t,`a`,n,`the id of an object with a body`)&&i(`a`),i(`b`),typeof t.a==`string`&&t.a===t.b&&e.error(`invalid`,`${n}.b`,`A joint needs two different bodies.`,`Omit b to anchor the body to the world.`);let a=typeof t.a==`string`?r.get(t.a)?.type:void 0,o=typeof t.b==`string`?r.get(t.b)?.type:void 0;if(a&&a!==`dynamic`&&(t.b===void 0||o&&o!==`dynamic`)&&e.warn(`no-dynamic`,n,`This joint connects no dynamic body: it will have no visible effect.`,`Make "a" (or "b") a dynamic body.`),e.vec(t.pivot,3,`${n}.pivot`),e.vec(t.axis,3,`${n}.axis`),Array.isArray(t.axis)&&t.axis.every(Ts)&&t.axis.every(e=>e===0)&&e.error(`range`,`${n}.axis`,`axis must not be [0, 0, 0].`,`Example: [0, 1, 0] (vertical hinge, a door) or [0, 0, 1] (a pendulum swinging in the XY plane).`),e.number(t.distance,`${n}.distance`,{min:0}),e.number(t.restLength,`${n}.restLength`,{min:0}),e.number(t.stiffness,`${n}.stiffness`,{min:0}),e.number(t.damping,`${n}.damping`,{min:0}),e.number(t.maxForce,`${n}.maxForce`,{min:0,exclusiveMin:!0}),e.boolean(t.collideConnected,`${n}.collideConnected`),t.motor!==void 0&&(B(t.motor)?(e.unknownKeys(t.motor,[`speed`,`maxForce`],`${n}.motor`,`a motor`),e.required(t.motor,`speed`,`${n}.motor`,`degrees / s`)&&e.number(t.motor.speed,`${n}.motor.speed`),e.number(t.motor.maxForce,`${n}.motor.maxForce`,{min:0,exclusiveMin:!0})):e.error(`type`,`${n}.motor`,`motor must be an object.`,`Example: { "speed": 90, "maxForce": 50 } (degrees / s).`),t.type!==`hinge`&&e.warn(`ignored`,`${n}.motor`,`motor only drives hinge joints (this one is ${Ds(t.type)}).`)),t.limits!==void 0){let r=t.limits;!Array.isArray(r)||r.length!==2||!r.every(Ts)?e.error(`type`,`${n}.limits`,`limits must be [minDegrees, maxDegrees].`,`Example: [0, 110] (a door opening one way) or [-45, 45] (a flipper).`):r[0]>r[1]?e.error(`range`,`${n}.limits`,`limits min (${r[0]}) is greater than max (${r[1]}).`,`Write [${r[1]}, ${r[0]}].`):(r[0]<-360||r[1]>360)&&e.error(`range`,`${n}.limits`,`limits must stay within -360 … 360 degrees.`,`Angles are relative to the start pose, e.g. [-90, 90].`)}for(let[r,i]of Object.entries({distance:[`distance`],restLength:[`spring`],stiffness:[`spring`],damping:[`spring`],axis:[`hinge`],limits:[`hinge`]}))t[r]!==void 0&&typeof t.type==`string`&&!i.includes(t.type)&&e.warn(`ignored`,`${n}.${r}`,`${r} is ignored on ${Ds(t.type)} joints (used by ${i.join(`, `)}).`)}var ic=[`rise`,`fade`,`scale`,`spin`,`drop`];function ac(e,t,n){if(e.boolean(t.kerning,`${n}.kerning`),e.number(t.maxWidth,`${n}.maxWidth`,{min:0,exclusiveMin:!0}),e.number(t.curveSegments,`${n}.curveSegments`,{integer:!0,min:1,max:32}),e.boolean(t.splitLetters,`${n}.splitLetters`),t.outline!==void 0&&typeof t.outline!=`boolean`){if(!B(t.outline))e.error(`type`,`${n}.outline`,`outline must be true or an object.`,`Example: { "width": 0.06, "color": "#1a1033" }.`);else{let r=t.outline;e.unknownKeys(r,[`width`,`color`,`depth`,`material`],`${n}.outline`,`outline`),e.number(r.width,`${n}.outline.width`,{min:0,exclusiveMin:!0}),e.color(r.color,`${n}.outline.color`),e.number(r.depth,`${n}.outline.depth`,{min:0,exclusiveMin:!0}),Ys(e,r.material,`${n}.outline.material`)}}if(t.reveal!==void 0){if(!B(t.reveal))e.error(`type`,`${n}.reveal`,`reveal must be an object.`,`Example: { "effect": "rise", "stagger": 0.04, "duration": 0.6 }.`);else{let r=t.reveal;if(e.unknownKeys(r,[`effect`,`stagger`,`duration`,`delay`,`ease`,`order`],`${n}.reveal`,`reveal`),e.enumOf(r.effect,ic,`${n}.reveal.effect`),e.number(r.stagger,`${n}.reveal.stagger`,{min:0}),e.number(r.duration,`${n}.reveal.duration`,{min:0,exclusiveMin:!0}),e.number(r.delay,`${n}.reveal.delay`,{min:0}),e.enumOf(r.order,[`forward`,`reverse`,`center`,`random`],`${n}.reveal.order`),r.ease!==void 0){let t=typeof r.ease==`string`?Na(r.ease):{error:`ease must be a string.`};`error`in t&&e.error(`enum`,`${n}.reveal.ease`,`Invalid easing ${Ds(r.ease)}: ${t.error}`,`Examples: ${ka.join(`, `)}.`)}}}(t.splitLetters===!0||B(t.reveal))&&typeof t.id==`string`&&(e.letterTexts.add(t.id),typeof t.text==`string`&&!/\{data\./.test(t.text)&&e.letterCounts.set(t.id,Array.from(t.text).filter(e=>e.trim()).length))}function oc(e,t){if(!Array.isArray(t))return e.error(`type`,`postfx`,`postfx must be an array.`,`Example: [{ "type": "bloom", "strength": 0.8 }].`);let n=new Set;t.forEach((t,r)=>{let i=`postfx[${r}]`;if(!B(t))return e.error(`type`,i,`A post effect must be an object.`);if(!e.required(t,`type`,i,`a catalog post effect (${M(fa.postfx.map(e=>e.id))})`))return;let a=qs(e,`postfx`,t.type,`${i}.type`);typeof t.type==`string`&&(n.has(t.type)&&e.warn(`duplicate`,`${i}.type`,`Post effect "${t.type}" appears twice.`,`Keep a single entry.`),n.add(t.type)),a&&e.params(`postfx`,a,t,i,[`type`]),t.type===`dof`&&typeof t.focusOn==`string`&&!e.objectIds.has(t.focusOn)&&e.error(`unknown-ref`,`${i}.focusOn`,`dof.focusOn "${t.focusOn}" is not an object id.`,`${j(t.focusOn,e.objectIds)}Object ids: ${M([...e.objectIds])}.`),t.type===`godrays`&&typeof t.source==`string`&&t.source!==`auto`&&t.source!==`sun`&&!e.lightIds.has(t.source)&&e.error(`unknown-ref`,`${i}.source`,`godrays.source "${t.source}" is not "auto", "sun" or a light id.`,`${j(t.source,e.lightIds)}Light ids: ${M([...e.lightIds])}.`)});let r=t.map(e=>B(e)?e.type:void 0);r.includes(`fxaa`)&&r.includes(`smaa`)&&e.warn(`duplicate`,`postfx`,`Both fxaa and smaa are set: they do the same job.`,`Keep smaa (sharper) or fxaa (cheaper).`)}function sc(e,t){if(!B(t))return e.error(`type`,`physics`,`physics must be an object.`,`Example: { "gravity": [0, -9.81, 0] }.`);e.unknownKeys(t,bs,`physics`,`physics`),e.vec(t.gravity,3,`physics.gravity`),e.number(t.step,`physics.step`,{min:0,exclusiveMin:!0,max:.1}),e.number(t.substeps,`physics.substeps`,{min:1,max:8,integer:!0}),e.number(t.iterations,`physics.iterations`,{min:1,max:100,integer:!0}),e.boolean(t.sleep,`physics.sleep`),e.boolean(t.debug,`physics.debug`);let n=Ss.get(e)??[],r=new Map(n.map(e=>[e.id,e.body])),i=new Set;if(t.materials!==void 0){if(!B(t.materials))e.error(`type`,`physics.materials`,`materials must be an object { name: { friction, restitution } }.`,`Example: { "ice": { "friction": 0.02 }, "rubber": { "friction": 0.9, "restitution": 0.8 } }.`);else for(let[n,r]of Object.entries(t.materials)){let t=`physics.materials.${n}`;i.add(n),B(r)?(e.unknownKeys(r,[`friction`,`restitution`],t,`a physics material`),e.number(r.friction,`${t}.friction`,{min:0}),e.number(r.restitution,`${t}.restitution`,{min:0,max:1})):e.error(`type`,t,`A physics material must be an object.`,`Example: { "friction": 0.4, "restitution": 0.2 }.`)}}t.contacts!==void 0&&(Array.isArray(t.contacts)?t.contacts.forEach((t,n)=>{let r=`physics.contacts[${n}]`;if(!B(t))return e.error(`type`,r,`A contact must be an object.`,`Example: { "a": "ice", "b": "rubber", "friction": 0.05, "restitution": 0 }.`);e.unknownKeys(t,[`a`,`b`,`friction`,`restitution`],r,`a contact material`);for(let n of[`a`,`b`])e.required(t,n,r,`a physics.materials name`)&&(typeof t[n]==`string`&&i.has(t[n])||e.error(`unknown-ref`,`${r}.${n}`,`Unknown physics material ${Ds(t[n])}.`,i.size?`${j(String(t[n]),i)}Materials: ${M([...i])}.`:`Declare it in physics.materials first, e.g. "materials": { "ice": { "friction": 0.02 } }.`));e.number(t.friction,`${r}.friction`,{min:0}),e.number(t.restitution,`${r}.restitution`,{min:0,max:1})}):e.error(`type`,`physics.contacts`,`contacts must be an array.`,`Example: [{ "a": "ice", "b": "rubber", "friction": 0.05 }].`)),t.layers!==void 0&&e.stringArray(t.layers,`physics.layers`)&&Array.isArray(t.layers)&&new Set([`default`,...t.layers]).size>16&&e.error(`range`,`physics.layers`,`At most 16 collision layers (including "default").`);let a=new Set([`default`,...Array.isArray(t.layers)?t.layers.filter(e=>typeof e==`string`):[]]);for(let t of n)typeof t.body.material==`string`&&!i.has(t.body.material)&&e.error(`unknown-ref`,`${t.path}.material`,`Unknown physics material "${t.body.material}".`,i.size?`${j(t.body.material,i)}Materials: ${M([...i])}.`:`Declare it in physics.materials, e.g. "materials": { "ice": { "friction": 0.02 } }.`),typeof t.body.layer==`string`&&a.add(t.body.layer);a.size>16&&e.error(`range`,`physics.layers`,`Too many collision layers (${a.size}, max 16).`,`Reuse layer names: a layer is a group like "player", "enemy", "debris".`);for(let t of n)Array.isArray(t.body.collidesWith)&&t.body.collidesWith.forEach((n,r)=>{typeof n==`string`&&!a.has(n)&&e.warn(`unknown-ref`,`${t.path}.collidesWith[${r}]`,`Layer "${n}" is not used by any body.`,`${j(n,a)}Layers: ${M([...a])}.`)});t.joints!==void 0&&(Array.isArray(t.joints)?t.joints.forEach((t,n)=>rc(e,t,`physics.joints[${n}]`,r)):e.error(`type`,`physics.joints`,`joints must be an array.`,`Example: [{ "type": "hinge", "a": "door", "pivot": [1, 1, 0], "axis": [0, 1, 0] }].`))}function cc(e,t){if(!Array.isArray(t))return e.error(`type`,`scripts`,`scripts must be an array of paths.`,`Example: ["scripts/game.js"].`);let n=new Set;t.forEach((t,r)=>{let i=`scripts[${r}]`;if(typeof t!=`string`)return e.error(`type`,i,`A script entry must be a path string.`,`Example: "scripts/game.js".`);if(!/^scripts\/[A-Za-z0-9_\-./]+\.(m?js)$/.test(t)||t.split(`/`).includes(`..`))return e.error(`script-path`,i,`Invalid script path "${t}".`,`Scripts live under scripts/ and end with .js or .mjs, e.g. "scripts/game.js".`);n.has(t)&&e.warn(`duplicate`,i,`Script "${t}" is listed twice (it would run twice).`,`Remove the duplicate.`),n.add(t)})}function lc(e,t){if(!B(t))return e.error(`type`,`ui`,`ui must be an object.`,`Example: { "elements": [{ "id": "score", "type": "text", "text": "Score: {score}", "anchor": "top-left" }] }.`);if(e.unknownKeys(t,[`elements`,`font`,`color`,`accent`,`buttonText`],`ui`,`ui`),e.string(t.font,`ui.font`),typeof t.font==`string`&&/url\(|@import|https?:/i.test(t.font)&&e.error(`forbidden`,`ui.font`,`ui.font must be a CSS font-family list (no web fonts).`,`Use a system stack, e.g. "system-ui, sans-serif".`),e.color(t.color,`ui.color`),e.color(t.accent,`ui.accent`),e.color(t.buttonText,`ui.buttonText`),!e.required(t,`elements`,`ui`,`an array of HUD elements`))return;if(!Array.isArray(t.elements))return e.error(`type`,`ui.elements`,`elements must be an array.`);let n=new Set;t.elements.forEach((t,r)=>{let i=`ui.elements[${r}]`;if(!B(t))return e.error(`type`,i,`A UI element must be an object.`);Li(t.id)&&(i=`ui.elements#${t.id}`),e.declareId(t.id,`${i}.id`,`ui`)&&(n.has(t.id)&&e.error(`duplicate-id`,`${i}.id`,`Duplicate UI element id "${String(t.id)}".`,`Give each HUD element a unique id.`),n.add(t.id)),e.unknownKeys(t,Cs,i,`a UI element`),e.required(t,`type`,i,`"text" | "button" | "bar"`)&&e.enumOf(t.type,[`text`,`button`,`bar`],`${i}.type`),e.string(t.text,`${i}.text`),e.enumOf(t.anchor,z,`${i}.anchor`),e.enumOf(t.style,[`plain`,`pill`,`title`,`subtitle`,`panel`],`${i}.style`),e.color(t.color,`${i}.color`),e.color(t.background,`${i}.background`),e.string(t.value,`${i}.value`),e.string(t.action,`${i}.action`),t.visible!==void 0&&typeof t.visible!=`boolean`&&typeof t.visible!=`string`&&e.error(`type`,`${i}.visible`,`visible must be a boolean or a state expression string.`),typeof t.visible==`string`&&tc(e,t.visible,`${i}.visible`),t.type===`bar`&&t.value===void 0&&e.error(`required`,`${i}.value`,`A "bar" needs "value": the state key holding 0..1.`,`Add "value": "health" and set api.state.health in a script.`),t.type===`button`&&t.action===void 0&&e.error(`required`,`${i}.action`,`A "button" needs "action": the event name sent to scripts.`,`Add "action": "start" and handle it with api.on("start", …).`),(t.type===`text`||t.type===`button`)&&t.text===void 0&&e.warn(`required`,`${i}.text`,`A "${String(t.type)}" element without text shows nothing.`,`Add "text", e.g. "Score: {score}".`)})}function uc(e,t){if(!B(t))return e.error(`type`,`audio`,`audio must be an object.`,`Example: { "sounds": { "coin": { "preset": "coin" } } }.`);e.unknownKeys(t,[`sounds`,`music`,`muted`],`audio`,`audio`),e.boolean(t.muted,`audio.muted`);let n=fa.sounds.map(e=>e.id),r=(t,r,i)=>{if(!B(t))return e.error(`type`,r,`Expected { "preset": "coin" } or { "src": "assets/audio/x.mp3" }.`);if(e.unknownKeys(t,i?[`src`,`preset`,`volume`,`loop`]:[`src`,`preset`,`volume`],r,i?`music`:`a sound`),t.preset===void 0&&t.src===void 0)return e.error(`required`,r,`Needs "preset" (synth) or "src" (audio file).`,`Synth presets: ${M(n)}.`);t.preset!==void 0&&t.src!==void 0&&e.warn(`ambiguous`,r,`Both "preset" and "src" are set; "src" wins.`,`Keep only one.`),t.preset!==void 0&&qs(e,`sounds`,t.preset,`${r}.preset`),t.src!==void 0&&e.assetPath(t.src,`${r}.src`,$o,`an audio file`),e.number(t.volume,`${r}.volume`,{min:0,max:1}),i&&e.boolean(t.loop,`${r}.loop`)};if(t.sounds!==void 0){if(!B(t.sounds))e.error(`type`,`audio.sounds`,`sounds must be an object keyed by sound name.`);else for(let[e,n]of Object.entries(t.sounds))r(n,`audio.sounds.${e}`,!1)}t.music!==void 0&&r(t.music,`audio.music`,!0)}function dc(e){if(!B(e))return e;let t=JSON.parse(JSON.stringify(e));return t.version===void 0&&(t.version=1),t.lights===void 0&&(t.lights=[]),t.objects===void 0&&(t.objects=[]),B(t.timeline)&&t.timeline.tracks===void 0&&(t.timeline.tracks=[]),B(t.ui)&&t.ui.elements===void 0&&(t.ui.elements=[]),t}var fc=(e=1)=>[{id:`fill`,type:`hemisphere`,skyColor:`#e8ecff`,groundColor:`#3a2f5c`,intensity:.6*e},{id:`key`,type:`directional`,position:[4,6,6],intensity:1.6*e,castShadow:!0},{id:`rim`,type:`point`,position:[-5,2,-3],color:`#7cc8ff`,intensity:18*e,distance:20}],pc=1,mc=1.5;function hc(e,t,n={}){return{id:`title`,kind:`text`,text:e,font:`sans-bold`,size:t,depth:t*.3,bevel:t*.03,material:{preset:`plastic`,color:`#ebe3f7`,roughness:.4},behaviours:[{type:`appear`,effect:`rise`,duration:pc},{type:`float`,amplitude:.08,speed:.4}],...n}}var gc=(e,t,n,r,i={},a=0)=>({id:e,kind:`mesh`,geometry:{type:t,...i},material:{preset:`plastic`,color:r},position:n,rotation:[20,30,0],behaviours:[{type:`float`,amplitude:.2,speed:.3,phase:a},{type:`rotate`,axis:[.3,1,.2],speed:18}]});function _c(e){return{camera:{type:`perspective`,fov:30,position:[0,0,12],target:[0,0,0],controls:`parallax`,parallax:{strength:.4,smoothing:.92}},environment:{background:{gradient:[`#1b1446`,`#4a2a8f`,`#ff7ab6`],angle:20},lighting:`studio`,lightingIntensity:.6},lights:fc(),objects:[hc(e,.8),gc(`torus`,`torus`,[-7.6,.5,-1.5],`#ff9ccf`,{radius:.6,tube:.22}),gc(`gem`,`icosahedron`,[7.8,-.5,-1],`#7cc8ff`,{radius:.7,detail:0},.4),gc(`pill`,`capsule`,[5.9,1.6,-2.5],`#ffd36e`,{radius:.25,length:.5},.7),gc(`block`,`roundedBox`,[-5.8,-1.6,-2.5],`#b9a2ff`,{width:.6,height:.6,depth:.6,radius:.1},.2),{id:`dust`,kind:`particles`,preset:`dust`,count:120,area:[26,7,6],size:.05,color:`#ffffff`,opacity:.6}],postfx:[{type:`bloom`,strength:.25,radius:.5,threshold:1.5}]}}function vc(e){return{camera:{type:`perspective`,fov:35,position:[0,.3,10],target:[0,0,0],controls:`parallax`,parallax:{strength:.5}},environment:{background:{radial:[`#2b1f63`,`#0c0a1f`]},lighting:`studio`,lightingIntensity:.6},lights:fc(.8),objects:[{id:`blob`,kind:`generator`,generator:`blob`,params:{radius:1.4,noise:.3,speed:.35},position:[0,-1.05,-1.5]},hc(e,.7,{position:[0,1.75,.5]}),{id:`sparkles`,kind:`particles`,preset:`dust`,count:160,area:[16,9,6],size:.05,color:`#cfc6ff`,opacity:.7}],postfx:[{type:`bloom`,strength:.25,radius:.5,threshold:1.5},{type:`vignette`,darkness:.9}]}}function yc(e){return{camera:{type:`perspective`,fov:35,position:[0,1.2,7],target:[0,.4,0]},environment:{background:{gradient:[`#fdf2e9`,`#f6c6c6`],angle:0},lighting:`soft`,ground:{y:-1,shadowOnly:!0}},lights:fc(),objects:[{id:`pedestal`,kind:`mesh`,geometry:{type:`cylinder`,radiusTop:1.2,radiusBottom:1.3,height:.4,segments:64},material:{preset:`clay`,color:`#fff4ea`},position:[0,-.8,0],receiveShadow:!0,castShadow:!0},{id:`knot`,kind:`mesh`,geometry:{type:`torusKnot`,radius:.55,tube:.18},material:{preset:`pearl`,color:`#ff9fb8`},position:[0,.45,0],castShadow:!0,behaviours:[{type:`rotate`,speed:25},{type:`float`,amplitude:.1,speed:.4},{type:`hoverScale`,scale:1.1}]},hc(e,.24,{position:[0,1.75,0],material:{preset:`matte`,color:`#5a3e5d`}})]}}function bc(e){return{camera:{type:`perspective`,fov:35,position:[0,.4,7],target:[0,0,0],controls:`orbit`,orbitZoom:!1},environment:{background:{radial:[`#3a1c71`,`#0f0c29`]},lighting:`studio`,lightingIntensity:.6},lights:fc(.8),objects:[{id:`gem`,kind:`mesh`,geometry:{type:`icosahedron`,radius:1,detail:0},material:{preset:`holographic`},position:[0,.5,0],behaviours:[{type:`rotate`,axis:[.2,1,0],speed:20},{type:`float`,amplitude:.12,speed:.4}]},hc(e,.28,{position:[0,-1.25,.5]}),{id:`stars`,kind:`particles`,preset:`stars`,count:200,area:[12,12,8],size:.04}],postfx:[{type:`bloom`,strength:.35,radius:.4,threshold:1.5}]}}function xc(e){return{camera:{type:`perspective`,fov:45,position:[0,9,26],target:[0,1,0],controls:`orbit`,autoRotate:4,orbitLimits:{minDistance:10,maxDistance:45,maxPolar:85}},environment:{background:{sky:{top:`#3d7dd8`,horizon:`#f7d9b0`,sun:{direction:[.6,.35,.4]}}},lighting:`sunset`,fog:{color:`#f2dcc0`,near:30,far:90}},lights:[{id:`sky`,type:`hemisphere`,skyColor:`#cfe6ff`,groundColor:`#6b5a3a`,intensity:.9},{id:`sun`,type:`directional`,position:[20,18,12],color:`#ffe2b8`,intensity:2.5,castShadow:!0}],objects:[{id:`terrain`,kind:`generator`,generator:`terrain`,params:{size:60,height:7,shape:`island`,waterLevel:.8},seed:7,receiveShadow:!0},{id:`trees`,kind:`generator`,generator:`trees`,params:{count:60,area:[40,0,40],style:`mixed`},seed:3,castShadow:!0},{id:`clouds`,kind:`generator`,generator:`clouds`,params:{count:7,height:14}},hc(e,1.1,{position:[0,8.8,10],material:{preset:`plastic`,color:`#25406b`,roughness:.4},behaviours:[{type:`appear`,effect:`rise`,duration:pc},{type:`billboard`},{type:`float`,amplitude:.15,speed:.3}]})]}}function Sc(e){return{camera:{type:`perspective`,fov:50,position:[0,6,9],target:[0,0,0],controls:`follow`,follow:{target:`player`,offset:[0,6,9],smoothing:.9}},environment:{background:{gradient:[`#8ec5fc`,`#e0c3fc`],angle:0},lighting:`soft`},lights:[{id:`fill`,type:`hemisphere`,skyColor:`#ffffff`,groundColor:`#8a7fb0`,intensity:1},{id:`sun`,type:`directional`,position:[6,10,4],intensity:2,castShadow:!0}],objects:[{id:`floor`,kind:`mesh`,geometry:{type:`box`,width:20,height:.5,depth:20},material:{preset:`matte`,color:`#b8e0a8`},position:[0,-.25,0],receiveShadow:!0,body:{type:`static`}},{id:`player`,kind:`mesh`,geometry:{type:`roundedBox`,width:.8,height:.8,depth:.8,radius:.15},material:{preset:`plastic`,color:`#ff6b6b`},position:[0,.4,0],castShadow:!0,body:{type:`kinematic`},tags:[`player`]},{id:`coins`,kind:`group`,children:[-4,-1.5,2,4.5].map((e,t)=>({id:`coin-${t+1}`,kind:`mesh`,geometry:{type:`cylinder`,radiusTop:.3,radiusBottom:.3,height:.08},material:{preset:`gold`},position:[e,.6,t%2?-3:3],rotation:[90,0,0],tags:[`coin`],body:{type:`trigger`},behaviours:[{type:`rotate`,axis:[0,0,1],speed:120}]}))},hc(e,.6,{position:[0,3,-6],material:{preset:`plastic`,color:`#5b3fd1`,roughness:.35},behaviours:[{type:`float`,amplitude:.1,speed:.4}]})],scripts:[`scripts/game.js`],ui:{elements:[{id:`score`,type:`text`,text:`Coins: {score}`,anchor:`top-left`,style:`pill`}],color:`#2b2340`},physics:{gravity:[0,-9.81,0]},audio:{sounds:{coin:{preset:`coin`}}}}}var Cc=`// Move the player with the arrow keys / WASD, or swipe on a phone (the
|
|
11
|
+
// player keeps going that way; tap to stop); collect the coins.
|
|
12
|
+
// Scripts only get \`api\` (see ScriptApi in the Agent3D docs).
|
|
13
|
+
export default function (api) {
|
|
14
|
+
const player = api.get("player");
|
|
15
|
+
const speed = 4;
|
|
16
|
+
const edge = 9.5; // stay on the 20 x 20 floor
|
|
17
|
+
let heading = null; // last swipe direction (touch)
|
|
18
|
+
return {
|
|
19
|
+
start() {
|
|
20
|
+
api.state.score = 0;
|
|
21
|
+
},
|
|
22
|
+
update(dt) {
|
|
23
|
+
if (!player) return;
|
|
24
|
+
const left = api.input.isDown("ArrowLeft") || api.input.isDown("KeyA");
|
|
25
|
+
const right = api.input.isDown("ArrowRight") || api.input.isDown("KeyD");
|
|
26
|
+
const up = api.input.isDown("ArrowUp") || api.input.isDown("KeyW");
|
|
27
|
+
const down = api.input.isDown("ArrowDown") || api.input.isDown("KeyS");
|
|
28
|
+
const swipe = api.input.swipe();
|
|
29
|
+
if (swipe) heading = swipe;
|
|
30
|
+
else if (api.input.pointer.justPressed || left || right || up || down) heading = null;
|
|
31
|
+
let dx = (right ? 1 : 0) - (left ? 1 : 0);
|
|
32
|
+
let dz = (down ? 1 : 0) - (up ? 1 : 0);
|
|
33
|
+
if (heading) {
|
|
34
|
+
dx = heading === "right" ? 1 : heading === "left" ? -1 : 0;
|
|
35
|
+
dz = heading === "down" ? 1 : heading === "up" ? -1 : 0;
|
|
36
|
+
}
|
|
37
|
+
player.position.x = Math.max(-edge, Math.min(edge, player.position.x + dx * speed * dt));
|
|
38
|
+
player.position.z = Math.max(-edge, Math.min(edge, player.position.z + dz * speed * dt));
|
|
39
|
+
for (const coin of api.findByTag("coin")) {
|
|
40
|
+
if (coin.visible && api.physics.overlaps(player, coin)) {
|
|
41
|
+
coin.visible = false;
|
|
42
|
+
api.state.score = Number(api.state.score) + 1;
|
|
43
|
+
api.audio.play("coin");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
`;function wc(e){let t=e.target?.kind??`banner`,n=e.title.length>28?`${e.title.slice(0,27)}…`:e.title,r=t===`banner`?_c(n):t===`hero`||t===`inline`?vc(n):t===`card`?yc(n):t===`square`?bc(n):t===`fullscreen`?xc(n):Sc(n),i={version:1,id:e.id??Ri(e.title,`scene`),title:e.title,ariaLabel:`${e.title} — animated 3D ${t===`game`?`mini game`:t}`,target:{...t===`game`?{}:{posterTime:mc},...e.target,kind:t,aspect:e.target?.aspect??Jo[t]},...r};return(t===`banner`||t===`hero`||t===`square`||t===`inline`)&&(i.timeline={duration:8,loop:!0,tracks:[{target:`title.rotation.y`,keys:[[0,-6],[4,6],[8,-6]],ease:`inOutSine`}]}),i}var Tc=`agent3d.json`,Ec=`scene.json`,Dc=`assets/manifest.json`,Oc=new TextDecoder,kc=e=>typeof e==`string`?e:Oc.decode(e);async function Ac(e,t){if(!t.name||!t.name.trim())throw new A(`invalid`,`A project needs a name.`,`Pass a name, e.g. "spring-banner".`);if(!t.force&&(await e.exists(`agent3d.json`)||await e.exists(`scene.json`)))throw new A(`conflict`,`This folder already contains an Agent3D project.`,`Choose an empty folder, or pass force: true (CLI --force) to overwrite it.`);if(t.template&&!t.templateFiles)throw new A(`invalid`,`Template "${t.template}" was requested but its files were not provided.`,`The front door must read templates/<id>/ and pass templateFiles (tool: templates_list for valid ids).`);let n=Ri(t.name,`project`),r=t.title?.trim()||t.name.trim(),i=[],a;if(t.templateFiles){let o=t.templateFiles;if(!o[`scene.json`])throw new A(`invalid`,`Template "${t.template??`?`}" has no scene.json.`,`A template folder holds agent3d.json, scene.json, template.json and optional scripts/ and assets/.`);for(let[t,n]of Object.entries(o))t!==`scene.json`&&t!==`agent3d.json`&&t!==`template.json`&&t!==`preview.png`&&(typeof n==`string`?await e.writeText(t,n):await e.writeBytes(t,n),i.push(t));try{a=dc(JSON.parse(kc(o[Ec])))}catch(e){throw new A(`invalid`,`Template scene.json is not valid JSON: ${e.message}`)}a.id=n,t.title&&(a.title=r),t.target&&(a.target={...a.target,...t.target})}else a=wc({title:r,id:n,target:t.target}),a.scripts?.includes(`scripts/game.js`)&&(await e.writeText(`scripts/game.js`,Cc),i.push(`scripts/game.js`));let o=Ps(a);if(Oi(o))throw Di(`The new project's scene is invalid.`,o,`Fix the template (or the target options) and retry.`);let s=ki(),c={name:n,title:r,createdAt:s,updatedAt:s,...t.template?{template:t.template}:{},agent3d:Ei};return await ji(e,Tc,c),await ji(e,Ec,a),await e.exists(`assets/manifest.json`)||await ji(e,Dc,{assets:[]}),i.push(Tc,Ec,Dc),{manifest:c,scene:a,files:[...new Set(i)].sort(),issues:o}}async function jc(e){return Ai(e,Tc,`Project manifest`)}async function Mc(e){return{manifest:await jc(e),scene:await Ai(e,Ec,`Scene`)}}async function Nc(e){return Ai(e,Ec,`Scene`)}async function Pc(e,t,n={}){let r=Ps(t);if(Oi(r)&&!n.allowInvalid)throw Di(`Scene not saved:`,r);return await ji(e,Ec,t),await Fc(e),{issues:r}}async function Fc(e){let t=await Mi(e,Tc,null);t&&await ji(e,Tc,{...t,updatedAt:ki(),agent3d:Ei})}function Ic(e,t,n=null,r=0){if(!Array.isArray(e))return null;for(let i=0;i<e.length;i++){let a=e[i];if(a&&a.id===t)return{object:a,parent:n,container:e,index:i,depth:r}}for(let n of e){let e=n&&Array.isArray(n.children)?Ic(n.children,t,n,r+1):null;if(e)return e}return null}function V(e,t,n=null,r=0){if(Array.isArray(e))for(let i of e)i&&typeof i==`object`&&t(i,n,r)!==!1&&V(i.children,t,i,r+1)}function Lc(e,t){return!!Ic(e.children,t)}function Rc(e){switch(e.kind){case`mesh`:return`${e.geometry?.type??`?`}${e.material?.preset?` / ${e.material.preset}`:``}`;case`instances`:return`${e.geometry?.type??`?`} × ${e.layout?.type??`?`}`;case`text`:{let t=String(e.text??``);return JSON.stringify(t.length>40?`${t.slice(0,37)}…`:t)}case`model`:return String(e.src??``);case`generator`:return String(e.generator??``);case`particles`:return String(e.preset??`custom`);case`svg`:return typeof e.src==`string`&&e.src.trim().startsWith(`<`)?`inline svg`:String(e.src??``);case`photo`:return`${String(e.src??``)} · ${e.mode??`parallax`} · depth ${e.depth?`✓`:`✗ (flat)`}`;case`group`:return`${e.children?.length??0} children`;default:return``}}function zc(e){let t=[];return V(e.objects,(e,n,r)=>{t.push({id:e.id,kind:e.kind,detail:Rc(e),parent:n?n.id:null,depth:r,...e.name?{name:e.name}:{},...e.position?{position:e.position}:{},...e.behaviours?.length?{behaviours:e.behaviours.map(e=>e.type)}:{},...e.visible===!1?{hidden:!0}:{}})}),t}function Bc(e){let t=[];return V(e.objects,e=>void t.push(e.id)),t}function Vc(e,t){let n=e.environment;if(n){let e=n.background;if(e&&typeof e==`object`&&typeof e.hdri==`string`){let n=t(e.hdri,`environment.background.hdri`,`hdri`);typeof n==`string`&&(e.hdri=n)}let r=n.lighting;if(r&&typeof r==`object`&&typeof r.hdri==`string`){let e=t(r.hdri,`environment.lighting.hdri`,`hdri`);typeof e==`string`&&(r.hdri=e)}}let r=(e,n)=>{if(!e||typeof e!=`object`)return;let r=e;for(let e of Uo)if(typeof r[e]==`string`){let i=t(r[e],`${n}.${e}`,`texture`);typeof i==`string`&&(r[e]=i)}};V(e.objects,e=>{let n=`objects#${e.id}`;if(e.kind===`model`&&typeof e.src==`string`){let r=t(e.src,`${n}.src`,`model`);typeof r==`string`&&(e.src=r)}if(e.kind===`svg`&&typeof e.src==`string`&&!e.src.trim().startsWith(`<`)){let r=t(e.src,`${n}.src`,`svg`);typeof r==`string`&&(e.src=r)}if(e.kind===`photo`){if(typeof e.src==`string`){let r=t(e.src,`${n}.src`,`texture`);typeof r==`string`&&(e.src=r)}if(typeof e.depth==`string`){let r=t(e.depth,`${n}.depth`,`texture`);typeof r==`string`&&(e.depth=r)}}if(e.kind===`text`){let r=typeof e.font==`string`&&e.font?e.font:`sans-bold`,i=t(r.includes(`/`)||r.includes(`:`)?r:`library:fonts/${r}.typeface.json`,`${n}.font`,`font`);typeof i==`string`&&(e.font=i)}`material`in e&&r(e.material,`${n}.material`)});let i=e.audio;if(i?.sounds){for(let[e,n]of Object.entries(i.sounds))if(n&&typeof n==`object`&&`src`in n&&typeof n.src==`string`){let r=t(n.src,`audio.sounds.${e}.src`,`audio`);typeof r==`string`&&(n.src=r)}}if(i?.music&&typeof i.music.src==`string`){let e=t(i.music.src,`audio.music.src`,`audio`);typeof e==`string`&&(i.music.src=e)}}function Hc(e){let t=[];return Vc(e,(e,n,r)=>void t.push({path:e,at:n,kind:r})),t}function Uc(e){let t=e.toLowerCase().split(`?`)[0].split(`.`).pop()??``;return[`glb`,`gltf`,`bin`].includes(t)?`model`:[`hdr`,`exr`].includes(t)?`hdri`:[`png`,`jpg`,`jpeg`,`webp`,`ktx2`,`avif`].includes(t)?`texture`:[`mp3`,`ogg`,`wav`,`m4a`,`aac`,`opus`].includes(t)?`audio`:[`ttf`,`otf`,`woff`,`woff2`,`typeface`].includes(t)||e.endsWith(`.typeface.json`)?`font`:t===`svg`?`svg`:`other`}function Wc(e){return{glb:`model/gltf-binary`,gltf:`model/gltf+json`,bin:`application/octet-stream`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`,avif:`image/avif`,ktx2:`image/ktx2`,svg:`image/svg+xml`,hdr:`image/vnd.radiance`,exr:`image/x-exr`,mp3:`audio/mpeg`,ogg:`audio/ogg`,wav:`audio/wav`,m4a:`audio/mp4`,aac:`audio/aac`,opus:`audio/opus`,js:`text/javascript`,mjs:`text/javascript`,json:`application/json`,ttf:`font/ttf`,otf:`font/otf`,woff:`font/woff`,woff2:`font/woff2`}[e.toLowerCase().split(`?`)[0].split(`.`).pop()??``]??`application/octet-stream`}function Gc(e,t){let n;try{n=JSON.parse(t)}catch{return[]}let r=e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)+1):``,i=[];for(let e of[...n.buffers??[],...n.images??[]]){let t=e?.uri;typeof t!=`string`||t.startsWith(`data:`)||/^[a-z]+:/i.test(t)||i.push(Kc(r,decodeURIComponent(t)))}return[...new Set(i)]}function Kc(e,t){let n=`${e}${t}`.split(`/`),r=[];for(let e of n)e!==``&&e!==`.`&&(e===`..`?r.pop():r.push(e));return r.join(`/`)}var qc=class extends Error{name=`ZipError`},Jc=(e,t)=>e[t]|e[t+1]<<8,Yc=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,Xc=new TextDecoder;function Zc(e){let t=-1;for(let n=e.length-22;n>=Math.max(0,e.length-22-65535);n--)if(Yc(e,n)===101010256){t=n;break}if(t<0)throw new qc(`Not a ZIP file (end of central directory not found).`);let n=Jc(e,t+10),r=Yc(e,t+16);if(r===4294967295)throw new qc(`ZIP64 archives are not supported.`);let i=[];for(let t=0;t<n;t++){if(Yc(e,r)!==33639248)throw new qc(`Corrupt ZIP central directory.`);let t=Jc(e,r+10),n=Yc(e,r+16),a=Yc(e,r+20),o=Yc(e,r+24),s=Jc(e,r+28),c=Jc(e,r+30),l=Jc(e,r+32),u=Yc(e,r+42),d=Xc.decode(e.subarray(r+46,r+46+s));i.push({name:d,method:t,compressedSize:a,size:o,crc32:n,offset:u,dir:d.endsWith(`/`)}),r+=46+s+c+l}return i}async function Qc(e){let t=globalThis.DecompressionStream;if(!t)throw new qc(`Deflated ZIP entries need an inflate function (no DecompressionStream on this platform).`);let n=new Blob([e]).stream().pipeThrough(new t(`deflate-raw`));return new Uint8Array(await new Response(n).arrayBuffer())}async function $c(e,t,n){let r=t.offset;if(Yc(e,r)!==67324752)throw new qc(`Corrupt local header for ${t.name}.`);let i=r+30+Jc(e,r+26)+Jc(e,r+28),a=e.subarray(i,i+t.compressedSize);if(t.method===0)return a.slice();if(t.method===8)return await(n??Qc)(a);throw new qc(`Unsupported compression method ${t.method} for ${t.name}.`)}async function el(e,t={}){let n={},r=0;for(let i of Zc(e))if(!(i.dir||i.name.startsWith(`__MACOSX/`)||i.name.split(`/`).includes(`..`))&&(!t.filter||t.filter(i.name))){if(r+=i.size,t.maxBytes&&r>t.maxBytes)throw new qc(`ZIP content exceeds ${Math.round(t.maxBytes/1048576)} MB.`);n[i.name]=await $c(e,i,t.inflate)}return n}var tl=null;function nl(e){if(!tl){tl=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?3988292384^t>>>1:t>>>1;tl[e]=t>>>0}}let t=4294967295;for(let n=0;n<e.length;n++)t=tl[(t^e[n])&255]^t>>>8;return(t^4294967295)>>>0}var rl=[`polyhaven`,`ambientcg`,`kenney`,`quaternius`,`khronos`],il=class extends Error{name=`SourceError`};async function al(e,t){let n;try{n=await e(t,{headers:{accept:`application/json`}})}catch(e){throw new il(`Network error for ${t}: ${e.message}`)}if(!n.ok)throw new il(`HTTP ${n.status} for ${t}`);return await n.json()}async function ol(e,t){let n;try{n=await e(t)}catch(e){throw new il(`Network error for ${t}: ${e.message}`)}if(!n.ok)throw new il(`HTTP ${n.status} for ${t}`);return new Uint8Array(await n.arrayBuffer())}function sl(e,t){if(e===t)return!0;if(Math.abs(e.length-t.length)>1)return!1;let n=0,r=0,i=0;for(;n<e.length&&r<t.length;)if(e[n]===t[r])n++,r++;else{if(++i>1)return!1;e.length>t.length?n++:(t.length>e.length||n++,r++)}return i+(e.length-n)+(t.length-r)<=1}var cl=e=>e.length>3&&e.endsWith(`s`)&&!e.endsWith(`ss`)?e.slice(0,-1):e;function ll(e,t,n={}){let r=e.toLowerCase().split(/[\s,]+/).filter(Boolean);if(!r.length)return 1;let i=`${t.title??``} ${t.id??``}`.toLowerCase(),a=(t.tags??[]).map(e=>e.toLowerCase()),o=n.strict?``:(t.extra??``).toLowerCase(),s=0,c=i.split(/[\s_\-/]+/).filter(Boolean),l=a.flatMap(e=>e.split(/[\s_\-/]+/)).filter(Boolean),u=o.split(/[^a-z0-9]+/).filter(Boolean);for(let e of r){let t=cl(e),n=n=>n===e||cl(n)===t,r=0;if(c.some(n)?r=5:c.some(e=>e.startsWith(t))&&(r=3),a.some(n)?r=Math.max(r,4):l.some(e=>n(e)||e.startsWith(t))&&(r=Math.max(r,2)),!r&&t.length>=4&&[...c,...l].some(e=>e.length>=4&&sl(cl(e),t))&&(r=1),!r&&u.some(e=>e.startsWith(t))&&(r=1),!r)return 0;s+=r}return s}function ul(e,t){return e.filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,t).map(e=>e.item)}var dl=`https://ambientcg.com/api/v2/full_json`;function fl(e){let t={};for(let n of Object.values(e.downloadFolders??{}))for(let e of Object.values(n.downloadFiletypeCategories??{}))for(let n of e.downloads??[]){let e=n.downloadLink??n.fullDownloadPath;e&&n.attribute&&(t[n.attribute]=e)}return t}function pl(e,t){let n=Object.keys(e);if(!n.length)throw new il(`This ambientCG asset has no downloads.`);let r=(t??`1k`).toUpperCase(),i=n.find(e=>e.toUpperCase()===r)??n.find(e=>e.toUpperCase()===`${r}-JPG`)??n.find(e=>e.toUpperCase().startsWith(r))??n.find(e=>e.toUpperCase().startsWith(`1K`))??n[0];return[i,e[i]]}var ml={id:`ambientcg`,title:`ambientCG (CC0 PBR materials, HDRIs)`,kinds:[`texture`,`hdri`],async search(e,t){if(e.kind&&e.kind!==`texture`&&e.kind!==`hdri`)return[];let n=e.kind===`hdri`?[`HDRI`]:e.kind===`texture`?[`Material`]:[`Material`,`HDRI`],r=[];for(let i of n){let n=await al(t,`${dl}?type=${i}&q=${encodeURIComponent(e.query)}&include=downloadData,previewData&limit=${e.limit??12}`);for(let e of n.foundAssets??[])r.push({source:`ambientcg`,id:e.assetId,title:e.displayName??e.assetId,kind:i===`HDRI`?`hdri`:`texture`,license:`CC0-1.0`,author:`ambientCG`,previewUrl:e.previewImage?.[`256-PNG`]??e.previewImage?.[`128-PNG`],pageUrl:e.shortLink??`https://ambientcg.com/view?id=${e.assetId}`,tags:e.tags?.slice(0,8),downloads:fl(e),note:i===`HDRI`?`Zip with an .hdr/.exr environment map.`:`Zip with Color / NormalGL / Roughness maps (extracted).`})}return r.slice(0,e.limit??20)},async download(e,t,n){let[,r]=pl(e.downloads,n.resolution),i=await ol(t,r),a=i[0]===80&&i[1]===75,o=e.id;if(!a){let e=r.split(`?`)[0].split(`/`).pop()||`${o}.bin`;return{files:{[e]:i},main:e}}if(e.kind===`hdri`){let e=await el(i,{inflate:n.inflate,filter:e=>/\.(hdr|exr)$/i.test(e)}),t=Object.keys(e).sort((e,t)=>(e.endsWith(`.hdr`)?-1:1)-(t.endsWith(`.hdr`)?-1:1));if(!t.length)throw new il(`ambientCG zip for ${o} contains no .hdr/.exr file.`);let r=t[0].split(`/`).pop();return{files:{[r]:e[t[0]]},main:r}}let s=await el(i,{inflate:n.inflate,filter:e=>/_(Color|NormalGL|Roughness|AmbientOcclusion)\.(jpe?g|png|webp)$/i.test(e)}),c={},l={};for(let[e,t]of Object.entries(s)){let n=e.split(`/`).pop(),r=`${o}/${n}`;c[r]=t,/_Color\./i.test(n)?l.map=r:/_NormalGL\./i.test(n)?l.normalMap=r:/_Roughness\./i.test(n)&&(l.roughnessMap=r)}let u=l.map??Object.keys(c)[0];if(!u)throw new il(`ambientCG zip for ${o} has no Color/NormalGL/Roughness maps.`);return{files:c,main:u,suggestion:{material:l}}}},hl=(e,t,n,r)=>({id:e,title:t,description:n,tags:r,pageUrl:`https://kenney.nl/assets/${e}`}),gl=[hl(`nature-kit`,`Nature Kit`,`Low-poly trees, rocks, plants, cliffs, paths, tents and campfires.`,[`nature`,`tree`,`rock`,`plant`,`forest`,`camp`,`lowpoly`]),hl(`city-kit-suburban`,`City Kit (Suburban)`,`Suburban houses, fences, trees and driveways.`,[`city`,`house`,`suburb`,`building`,`town`]),hl(`city-kit-commercial`,`City Kit (Commercial)`,`Skyscrapers, shops and commercial buildings.`,[`city`,`building`,`skyscraper`,`shop`,`town`]),hl(`city-kit-roads`,`City Kit (Roads)`,`Road tiles, crossings, bridges and street props.`,[`city`,`road`,`street`,`traffic`,`bridge`]),hl(`car-kit`,`Car Kit`,`Stylised cars, trucks, police car, taxi, ambulance.`,[`car`,`vehicle`,`truck`,`taxi`,`racing`]),hl(`racing-kit`,`Racing Kit`,`Race track pieces, cars and props.`,[`racing`,`car`,`track`,`vehicle`]),hl(`train-kit`,`Train Kit`,`Trains, wagons and tracks.`,[`train`,`rail`,`vehicle`]),hl(`space-kit`,`Space Kit`,`Rockets, astronauts, planets, space station modules and terrain.`,[`space`,`rocket`,`astronaut`,`planet`,`scifi`]),hl(`modular-space-kit`,`Modular Space Kit`,`Modular sci-fi interior corridors and rooms.`,[`space`,`scifi`,`interior`,`modular`,`corridor`]),hl(`platformer-kit`,`Platformer Kit`,`Platforms, coins, flags, blocks and characters for 3D platformers.`,[`platformer`,`game`,`coin`,`block`,`level`]),hl(`prototype-kit`,`Prototype Kit`,`Blockout shapes, ramps, stairs for level prototyping.`,[`prototype`,`game`,`level`,`blockout`]),hl(`mini-arena`,`Mini Arena`,`Small arena game pieces and characters.`,[`arena`,`game`,`character`]),hl(`mini-characters`,`Mini Characters`,`Small rigged/animated characters.`,[`character`,`people`,`animated`]),hl(`mini-dungeon`,`Mini Dungeon`,`Dungeon tiles, walls, chests and characters.`,[`dungeon`,`fantasy`,`game`,`chest`]),hl(`blaster-kit`,`Blaster Kit`,`Toy blasters, targets and ammo.`,[`blaster`,`gun`,`weapon`,`shooter`,`game`]),hl(`food-kit`,`Food Kit`,`Fruit, vegetables, meals, drinks and kitchen props.`,[`food`,`fruit`,`drink`,`kitchen`,`restaurant`]),hl(`furniture-kit`,`Furniture Kit`,`Chairs, tables, sofas, beds, lamps and interior props.`,[`furniture`,`interior`,`chair`,`table`,`room`,`house`]),hl(`castle-kit`,`Castle Kit`,`Castle walls, towers, gates and siege props.`,[`castle`,`medieval`,`tower`,`fantasy`]),hl(`fantasy-town-kit`,`Fantasy Town Kit`,`Medieval fantasy houses, market stalls and props.`,[`fantasy`,`medieval`,`town`,`house`,`village`]),hl(`pirate-kit`,`Pirate Kit`,`Ships, palm trees, treasure, cannons and docks.`,[`pirate`,`ship`,`island`,`treasure`,`boat`]),hl(`holiday-kit`,`Holiday Kit`,`Christmas trees, presents, snowmen and decorations.`,[`holiday`,`christmas`,`winter`,`snow`,`gift`]),hl(`graveyard-kit`,`Graveyard Kit`,`Graves, crypts, fences, pumpkins — Halloween scenes.`,[`halloween`,`graveyard`,`spooky`,`pumpkin`]),hl(`tower-defense-kit`,`Tower Defense Kit`,`Towers, enemies paths and tiles for tower defense games.`,[`tower`,`defense`,`game`,`tile`]),hl(`minigolf-kit`,`Minigolf Kit`,`Minigolf course pieces.`,[`golf`,`minigolf`,`game`,`sport`]),hl(`coaster-kit`,`Coaster Kit`,`Roller coaster tracks and carts.`,[`coaster`,`theme park`,`track`,`fun`]),hl(`retro-urban-kit`,`Retro Urban Kit`,`Retro city blocks, walls and street props.`,[`city`,`urban`,`retro`,`street`]),hl(`survival-kit`,`Survival Kit`,`Tools, tents, barrels, crates and campfire.`,[`survival`,`camp`,`tool`,`crate`,`barrel`]),hl(`hexagon-kit`,`Hexagon Kit`,`Hex tiles with terrain, buildings and nature.`,[`hexagon`,`tile`,`strategy`,`terrain`,`board`])],_l=(e,t,n,r,i)=>({id:e,title:t,description:n,tags:r,pageUrl:`https://quaternius.com/packs/${e}.html`,...i?{downloadPage:`https://drive.google.com/drive/folders/${i}?usp=sharing`}:{}}),vl=[_l(`ultimatenature`,`Ultimate Nature Pack`,`Trees, bushes, rocks, flowers, grass — stylised low poly.`,[`nature`,`tree`,`rock`,`flower`,`forest`,`lowpoly`],`1-Kl0L_Jg8awbh0S5T-z3zxh4mVlnxTpa`),_l(`stylizednaturemegakit`,`Stylized Nature MegaKit`,`Large stylised nature kit (trees, rocks, plants, terrain pieces).`,[`nature`,`tree`,`rock`,`plant`,`stylized`]),_l(`simplenature`,`Simple Nature Pack`,`Simple low-poly trees, rocks and plants.`,[`nature`,`tree`,`rock`,`simple`,`lowpoly`],`18hb-5HGCLL9BS8jmxkE4h31wmHGeqfts`),_l(`ultimateanimatedanimals`,`Ultimate Animated Animal Pack`,`Animated animals (fox, deer, wolf, horse, …) with idle/walk/run clips.`,[`animal`,`animated`,`fox`,`deer`,`wolf`,`horse`],`1uJ3N5HfB7jKTseJUNQr3N4YaN0UuEtHk`),_l(`farmanimal`,`Farm Animal Pack`,`Animated farm animals: cow, pig, sheep, chicken…`,[`animal`,`farm`,`animated`,`cow`,`pig`,`sheep`,`chicken`],`1is1ax2V0mIEDS7BbbzBV_x2Pabya1dVJ`),_l(`cutefish`,`Animated Cute Fish Pack`,`Cute animated fish.`,[`fish`,`sea`,`ocean`,`animated`,`cute`],`1QK5NCgIxUZ1cYGzVwaNfcfEiQhvczqUB`),_l(`animatedfish`,`Animated Fish Pack`,`Animated fish (realistic-stylised).`,[`fish`,`sea`,`ocean`,`animated`],`1SvlOveJJjmhSn-FgCRyojc1T5QHjjGkF`),_l(`ultimatemonsters`,`Ultimate Monsters`,`Animated monsters for games.`,[`monster`,`creature`,`animated`,`game`,`enemy`],`18m4KpzpEzhC9wl7jzr6dUc0N8Jozr79C`),_l(`cutemonsters`,`Cute Animated Monsters Pack`,`Cute animated monsters.`,[`monster`,`cute`,`animated`,`creature`],`1zLLO_7ZoWgUsS4uooYnVSErQYRu1VdS0`),_l(`ultimatespaceships`,`Ultimate Spaceships Pack`,`Stylised spaceships.`,[`space`,`spaceship`,`scifi`,`ship`],`1NpfT3wqe2k3Jwue2xryi7tzxP4bWzETu`),_l(`spaceships`,`Spaceships Pack`,`Low-poly spaceships.`,[`space`,`spaceship`,`scifi`],`1ZxWZ-KuSOA-9s53PA1B1-O0txRJvne2i`),_l(`ultimatespacekit`,`Ultimate Space Kit`,`Astronauts, planets, rovers, bases and props.`,[`space`,`astronaut`,`planet`,`rover`,`scifi`],`17F8HlI2zPTlo32aieW5YPPwOk78xo-2m`),_l(`cars`,`Cars Pack`,`Low-poly cars.`,[`car`,`vehicle`,`road`],`1fKlbDry77iY8KlEoxzUxIAZQL_XhzWlA`),_l(`publictransport`,`Public Transport Pack`,`Buses, trams, taxis.`,[`bus`,`tram`,`vehicle`,`city`,`transport`],`1GUIE138uPVNraiQEf33dIx9wENhttZ15`),_l(`downtowncitymegakit`,`Downtown City MegaKit`,`Modular downtown city buildings and props.`,[`city`,`building`,`downtown`,`modular`]),_l(`simplebuildings`,`Simple Buildings Pack`,`Simple low-poly buildings.`,[`building`,`house`,`city`,`town`],`1r-FcNFxC6ziN0oI3GqZJdEkdzglFQHQH`),_l(`buildings`,`Buildings Pack`,`Low-poly buildings.`,[`building`,`house`,`city`],`1uWCsV9QfnAu8u_QbwkYwOfuU3McME7CA`),_l(`ultimatefood`,`Ultimate Food Pack`,`Food items: fruit, burgers, pizza, drinks…`,[`food`,`fruit`,`burger`,`pizza`,`drink`],`1zMfN7q9VU80M7mLAbBBJyY2OdoXslbl1`),_l(`junkfood`,`Junk Food Pack`,`Burgers, fries, hot dogs, sodas.`,[`food`,`junk`,`burger`,`fries`],`127xt6nsl4Z-YRy-FZru38Sf6ElBWc8IU`),_l(`ultimatefurniture`,`Ultimate Furniture Pack`,`Furniture: chairs, tables, beds, shelves.`,[`furniture`,`interior`,`chair`,`table`,`room`],`1n85oUi0RN5ZUXEIMKA-AnBsPErVXWcma`),_l(`ultimatehomeinterior`,`Ultimate House Interior Pack`,`Home interior props and furniture.`,[`interior`,`house`,`furniture`,`room`],`1SNK9PwPi8xqqxmpU5xEZeiQjB26C1oX6`),_l(`ultimateplatformer`,`Platformer Game Kit`,`Platformer level pieces, collectibles and characters.`,[`platformer`,`game`,`level`,`coin`],`1NDZn_aGnn0vfFV3M22Y8GPcDjO8BVcLs`),_l(`modularplatformer`,`Modular Platformer Pack`,`Modular platform blocks.`,[`platformer`,`game`,`modular`,`block`],`1ku_XmbHOZ5ypgKCAjpzX6hlXaOJT7Uoq`),_l(`cubeworldkit`,`Cube World Kit`,`Voxel-like cube world blocks, trees and characters.`,[`cube`,`voxel`,`world`,`block`,`game`],`1Yyag0ibcOX6lOBY9a3m6iPnz8HwjwLFJ`),_l(`animatedrobot`,`Animated Robot Pack`,`Animated robots.`,[`robot`,`animated`,`scifi`,`character`],`18MU0RtRu9G6SU6uSZ_zMQFmVkRlB4zH5`),_l(`rpgcharacters`,`RPG Character Pack`,`Animated RPG characters (warrior, mage, rogue…).`,[`character`,`rpg`,`fantasy`,`animated`,`hero`],`1MIRQXLfTd21HMI5rwOb6Xy0rv0xv1m8b`),_l(`universalbasecharacters`,`Universal Base Characters`,`Rigged base humanoid characters.`,[`character`,`human`,`rigged`,`base`]),_l(`medievalvillagemegakit`,`Medieval Village MegaKit`,`Modular medieval village buildings and props.`,[`medieval`,`village`,`building`,`fantasy`,`modular`]),_l(`ultimatecrops`,`Ultimate Crops Pack`,`Farm crops at growth stages.`,[`farm`,`crop`,`plant`,`vegetable`],`1uhbi-NWp7pwqOGtraBZurbphyxAvoABZ`),_l(`piratekit`,`Pirate Kit`,`Pirate ships, characters and props.`,[`pirate`,`ship`,`treasure`,`island`],`1KjMzhVsDcyvYMWeVjZcRfuu8auBLpNi2`)];function yl(e,t,n,r){return{id:e,title:t,kinds:[`model`],async search(t){return t.kind&&t.kind!==`model`?[]:ul(n.map(n=>({score:ll(t.query,{id:n.id,title:n.title,tags:n.tags,extra:n.description}),item:{source:e,id:n.id,title:`${n.title} (pack)`,kind:`model`,license:`CC0-1.0`,author:r,pageUrl:n.pageUrl,tags:n.tags,downloads:{},manual:!0,note:`${n.description} No direct download: ask the user to download the pack zip from ${n.downloadPage??n.pageUrl}, then import it with \`agent3d assets add <file.zip> --source ${e} --license CC0-1.0 --filter <word>\` (AI tool: assets_add { file, source: "${e}", license: "CC0-1.0", filter: ["<word>"] }). Only .glb/.gltf + textures are extracted; --filter (repeatable) keeps the models whose path contains a word.`}})),t.limit??10)}}}var bl=yl(`kenney`,`Kenney (CC0 3D packs, curated index — manual zip download)`,gl,`Kenney`),xl=yl(`quaternius`,`Quaternius (CC0 3D packs, curated index — manual zip download)`,vl,`Quaternius`),Sl=`https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models`,Cl=new Set([`CC0-1.0`,`CC-BY-4.0`]),wl={id:`khronos`,title:`Khronos glTF sample models (CC0 / CC-BY only)`,kinds:[`model`],async search(e,t){if(e.kind&&e.kind!==`model`)return[];let n=ul((await al(t,`${Sl}/model-index.json`)).filter(e=>e.variants?.[`glTF-Binary`]).map(t=>({item:t,score:ll(e.query,{title:t.label,id:t.name,tags:t.tags})})),Math.min(30,(e.limit??10)*2)),r=[];await Promise.all(n.map(async e=>{let n;try{n=await al(t,`${Sl}/${e.name}/metadata.json`)}catch{return}let i=n.legal??[];if(!i.length||!i.every(e=>e.license&&Cl.has(e.license)))return;let a=i.some(e=>e.license===`CC-BY-4.0`),o=[...new Set(i.map(e=>e.artist).filter(Boolean))];r.push({source:`khronos`,id:e.name,title:e.label,kind:`model`,license:a?`CC-BY-4.0`:`CC0-1.0`,author:o.join(`, `)||void 0,...a?{attribution:`"${e.label}" — ${i.map(e=>`${e.what??`model`} by ${e.artist??e.owner??`unknown`} (${e.license})`).join(`; `)}. Source: Khronos glTF-Sample-Assets.`}:{},previewUrl:e.screenshot?`${Sl}/${e.name}/${e.screenshot}`:void 0,pageUrl:`https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/${e.name}`,tags:e.tags,downloads:{glb:`${Sl}/${e.name}/glTF-Binary/${e.variants[`glTF-Binary`]}`},note:n.summary})}));let i=new Map(n.map((e,t)=>[e.name,t]));return r.sort((e,t)=>(i.get(e.id)??0)-(i.get(t.id)??0)).slice(0,e.limit??10)},async download(e,t){let n=e.downloads.glb;if(!n)throw new il(`Khronos model ${e.id} has no .glb download.`);let r=`${e.id}.glb`;return{files:{[r]:await ol(t,n)},main:r}}},Tl=`https://api.polyhaven.com`,El={hdri:`hdris`,texture:`textures`,model:`models`},Dl=[`1k`,`2k`,`4k`],Ol=e=>e===0?`hdri`:e===1?`texture`:`model`,kl={polyhaven:{id:`polyhaven`,title:`Poly Haven (CC0 HDRIs, textures, models)`,kinds:[`hdri`,`texture`,`model`],async search(e,t){let n=e.kind?[e.kind]:[`hdri`,`texture`,`model`],r=[];for(let i of n){let n=El[i];if(!n)continue;let a=await al(t,`${Tl}/assets?t=${n}`);for(let[t,n]of Object.entries(a)){let a=ll(e.query,{id:t,title:n.name,tags:[...n.tags??[],...n.categories??[]]},{strict:!0});if(!a)continue;let o=Ol(n.type??(i===`hdri`?0:i===`texture`?1:2));r.push({score:a,item:{source:`polyhaven`,id:t,title:n.name,kind:o,license:`CC0-1.0`,author:Object.keys(n.authors??{}).join(`, `)||void 0,previewUrl:`https://cdn.polyhaven.com/asset_img/thumbs/${t}.png?width=256`,pageUrl:`https://polyhaven.com/a/${t}`,tags:n.tags?.slice(0,8),downloads:Object.fromEntries(Dl.map(e=>[e,`${Tl}/files/${t}`])),note:o===`texture`?`Downloads diffuse + normal (GL) + roughness maps.`:o===`model`?`Downloads a .gltf with its .bin and textures.`:`Downloads an .hdr environment map.`}})}}return ul(r,e.limit??20)},async download(e,t,n){let r=(n.resolution??`1k`).toLowerCase(),i=await al(t,`${Tl}/files/${encodeURIComponent(e.id)}`),a=(t,n)=>{let a=i[t],o=a?.[r]?.[n]??a?.[`1k`]?.[n];if(!o)throw new il(`Poly Haven "${e.id}" has no ${t} ${n} at ${r} (available: ${Object.keys(a??{}).join(`, `)||`none`}).`);return o};if(e.kind===`hdri`){let n=a(`hdri`,`hdr`),i=`${e.id}_${r}.hdr`;return{files:{[i]:await ol(t,n.url)},main:i,suggestion:{environment:{lighting:{hdri:`<path>`},background:{hdri:`<path>`,blur:.5}}}}}if(e.kind===`texture`){let n={},o=[[`Diffuse`,`diff`,`map`],[`nor_gl`,`nor_gl`,`normalMap`],[`Rough`,`rough`,`roughnessMap`]],s={};for(let[c,l,u]of o){if(!i[c])continue;let o=`${e.id}/${e.id}_${l}_${r}.jpg`;n[o]=await ol(t,a(c,`jpg`).url),s[u]=o}let c=s.map??Object.keys(n)[0];if(!c)throw new il(`Poly Haven "${e.id}" has no downloadable texture maps.`);return{files:n,main:c,suggestion:{material:s}}}let o=a(`gltf`,`gltf`),s=`${e.id}/`,c={[`${s}${e.id}_${r}.gltf`]:await ol(t,o.url)};for(let[e,n]of Object.entries(o.include??{}))e.split(`/`).includes(`..`)||(c[`${s}${e}`]=await ol(t,n.url));return{files:c,main:`${s}${e.id}_${r}.gltf`}}},ambientcg:ml,kenney:bl,quaternius:xl,khronos:wl};function Al(e){if(e.byteLength<20)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895)return null;let n=t.getUint32(12,!0);if(t.getUint32(16,!0)!==1313821514||20+n>e.byteLength)return null;try{return JSON.parse(new TextDecoder().decode(e.subarray(20,20+n)))}catch{return null}}function jl(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.accessors??[],r=e=>{let r=0;for(let i of t.meshes?.[e]?.primitives??[]){let e=i.attributes?.POSITION,t=i.indices===void 0?e===void 0?0:n[e]?.count:n[i.indices]?.count,a=i.mode??4,o=Number(t)||0;r+=a===4?o/3:a===5||a===6?Math.max(0,o-2):0}return r},i=0,a=new Set,o=(e,n)=>{let s=t.nodes?.[e];if(!(!s||n>64||a.has(e))){a.add(e),s.mesh!==void 0&&(i+=r(s.mesh));for(let e of s.children??[])o(e,n+1)}},s=t.scenes?.[t.scene??0];if(s)for(let e of s.nodes??[])o(e,0);else(t.meshes??[]).forEach((e,t)=>i+=r(t));return{triangles:Math.round(i),animations:(t.animations??[]).map((e,t)=>e.name||`clip${t}`)}}function Ml(e,t){if(/\.glb$/i.test(e))return jl(Al(t));try{return jl(JSON.parse(new TextDecoder().decode(t)))}catch{return null}}var Nl={5120:127,5121:255,5122:32767,5123:65535},Pl=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function Fl(e,t){let n=Array(16).fill(0);for(let r=0;r<4;r++)for(let i=0;i<4;i++)for(let a=0;a<4;a++)n[r*4+i]+=e[a*4+i]*t[r*4+a];return n}function Il(e){if(e.matrix?.length===16)return e.matrix.slice();let[t,n,r,i]=e.rotation??[0,0,0,1],[a,o,s]=e.scale??[1,1,1],[c,l,u]=e.translation??[0,0,0];return[(1-2*(n*n+r*r))*a,2*(t*n+r*i)*a,2*(t*r-n*i)*a,0,2*(t*n-r*i)*o,(1-2*(t*t+r*r))*o,2*(n*r+t*i)*o,0,2*(t*r+n*i)*s,2*(n*r-t*i)*s,(1-2*(t*t+n*n))*s,0,c,l,u,1]}function Ll(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.accessors??[],r=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0],a=new Set,o=(e,s,c)=>{let l=t.nodes?.[e];if(!l||c>64||a.has(e))return;a.add(e);let u=Fl(s,Il(l));if(l.mesh!==void 0)for(let e of t.meshes?.[l.mesh]?.primitives??[]){let t=e.attributes?.POSITION===void 0?void 0:n[e.attributes.POSITION];if(!t?.min||!t.max)continue;let a=t.normalized?1/(Nl[t.componentType??0]??1):1,o=t.min.map(e=>e*a),s=t.max.map(e=>e*a);for(let e=0;e<8;e++){let t=e&1?s[0]:o[0],n=e&2?s[1]:o[1],a=e&4?s[2]:o[2],c=[u[0]*t+u[4]*n+u[8]*a+u[12],u[1]*t+u[5]*n+u[9]*a+u[13],u[2]*t+u[6]*n+u[10]*a+u[14]];for(let e=0;e<3;e++)r[e]=Math.min(r[e],c[e]),i[e]=Math.max(i[e],c[e])}}for(let e of l.children??[])o(e,u,c+1)},s=t.scenes?.[t.scene??0]?.nodes??(t.nodes??[]).map((e,t)=>t);for(let e of s)o(e,Pl,0);if(!Number.isFinite(r[0]))return null;let c=e=>Math.round(e*1e3)/1e3,l=[0,1,2].map(e=>c(i[e]-r[e])),u=[0,1,2].map(e=>c((i[e]+r[e])/2)),d=l[2]>l[1]*2&&l[2]>l[0]*1.2&&Math.abs(u[2])>l[1]*.25;return{size:l,center:u,min:r.map(c),max:i.map(c),upAxis:d?`z?`:`y`,...d?{hint:"Much deeper (Z) than tall (Y) and off-centre in Z: it may have been exported Z-up (lying on its back). Check with `agent3d render --isolate <id>`; if so set the object's rotation to [-90, 0, 0]."}:{}}}function Rl(e,t){if(/\.glb$/i.test(e))return Ll(Al(t));try{return Ll(JSON.parse(new TextDecoder().decode(t)))}catch{return null}}async function zl(e,t){return!/\.(glb|gltf)$/i.test(t)||!await e.exists(t)?null:Rl(t,await e.readBytes(t))}var Bl=`modulepreload`,Vl=function(e,t){return new URL(e,t).href},Hl={},Ul=function(e){return e.pathname.endsWith(`.css`)},Wl=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Gl=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Vl(t,n);let r=s(t),i=Ul(r);return Wl(Hl,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Bl,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Kl=null;async function ql(){return Kl??=Gl(()=>import(`./meshoptimizer-BCSwHBL3.js`).then(async e=>(await Promise.all([e.MeshoptEncoder.ready,e.MeshoptDecoder.ready,e.MeshoptSimplifier.ready]),e)),[],import.meta.url),Kl}var Jl=`EXT_meshopt_compression`,Yl=`EXT_texture_webp`,Xl=`KHR_mesh_quantization`,Zl=1179937895,Ql=1313821514,$l=5130562;function eu(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.byteLength<20||t.getUint32(0,!0)!==Zl)throw Error(`Not a binary glTF (.glb) file.`);let n=12,r=null,i=null;for(;n+8<=e.byteLength;){let a=t.getUint32(n,!0),o=t.getUint32(n+4,!0),s=e.subarray(n+8,n+8+a);o===Ql?r=JSON.parse(new TextDecoder().decode(s)):o===$l&&!i&&(i=s),n+=8+a}if(!r)throw Error(`The .glb has no JSON chunk.`);return{json:r,bin:i}}function tu(e,t){let n=new TextEncoder().encode(JSON.stringify(e)),r=n.byteLength+3&-4,i=t?t.byteLength+3&-4:0,a=20+r+(t?8+i:0),o=new Uint8Array(a),s=new DataView(o.buffer);if(s.setUint32(0,Zl,!0),s.setUint32(4,2,!0),s.setUint32(8,a,!0),s.setUint32(12,r,!0),s.setUint32(16,Ql,!0),o.set(n,20),o.fill(32,20+n.byteLength,20+r),t){let e=20+r;s.setUint32(e,i,!0),s.setUint32(e+4,$l,!0),o.set(t,e+8)}return o}var nu=e=>!!e?.extensions?.[Jl]?.fallback;async function ru(e){let{json:t,bin:n}=eu(e),r=t.buffers??[];for(let[e,t]of r.entries())if(!nu(t)&&(e!==0||t.uri!==void 0))throw Error(`This .glb references external buffers (.bin files): optimise the self-contained .glb instead.`);let i=!1,a=[],o=[];for(let[e,s]of(t.bufferViews??[]).entries()){let t=s.extensions?.[Jl];if(t){if(t.buffer!==0||!n)throw Error(`bufferView ${e}: meshopt data outside the GLB binary chunk.`);let{MeshoptDecoder:r}=await ql(),c=new Uint8Array(t.count*t.byteStride),l=n.subarray(t.byteOffset??0,(t.byteOffset??0)+t.byteLength);r.decodeGltfBuffer(c,t.count,t.byteStride,l,t.mode,t.filter&&t.filter!==`NONE`?t.filter:void 0),o.push(c),a.push({mode:t.mode,stride:t.byteStride,count:t.count}),i=!0,delete s.extensions[Jl],Object.keys(s.extensions).length||delete s.extensions,s.buffer=0}else{if(s.buffer!==0||!n)throw nu(r[s.buffer])?Error(`bufferView ${e} points at a meshopt fallback buffer without compressed data.`):Error(`bufferView ${e} is outside the GLB binary chunk.`);o.push(n.slice(s.byteOffset??0,(s.byteOffset??0)+s.byteLength)),a.push(void 0)}}return t.buffers=r.length?[{byteLength:0}]:[],au(t,Jl),{json:t,views:o,meta:a,wasCompressed:i}}function iu(e,t,n){e.extensionsUsed=[...new Set([...e.extensionsUsed??[],t])],n&&(e.extensionsRequired=[...new Set([...e.extensionsRequired??[],t])])}function au(e,t){e.extensionsUsed&&=e.extensionsUsed.filter(e=>e!==t),e.extensionsRequired&&=e.extensionsRequired.filter(e=>e!==t),e.extensionsUsed&&!e.extensionsUsed.length&&delete e.extensionsUsed,e.extensionsRequired&&!e.extensionsRequired.length&&delete e.extensionsRequired}var ou=e=>e.mode===`ATTRIBUTES`?e.stride%4==0&&e.stride<=256:(e.stride===2||e.stride===4)&&(e.mode!==`TRIANGLES`||e.count%3==0);async function su(e,t){let{json:n,views:r,meta:i}=e,{MeshoptEncoder:a}=await ql(),o=[],s=0,c=0,l=0,u=e=>{s=s+3&-4;let t=s;return o.push(e),s+=e.byteLength,t},d=[],f=n.bufferViews??[];for(let[e,n]of f.entries()){let f=r[e],p=i[e],m=null;if(t.compress&&p&&ou(p))try{let e=a.encodeGltfBuffer(f,p.count,p.stride,p.mode);(e.byteLength<f.byteLength*.97||p.filter)&&(m=e)}catch{m=null}if(p?.filter&&!m)throw Error(`bufferView ${e}: a meshopt filter needs compression.`);if(m){let e=s=s+3&-4;o.push(m),d.push({at:e,data:m}),s+=m.byteLength,c=c+3&-4,n.buffer=1,n.byteOffset=c,n.byteLength=f.byteLength,c+=f.byteLength,n.extensions={...n.extensions??{},[Jl]:{buffer:0,byteOffset:e,byteLength:m.byteLength,byteStride:p.stride,mode:p.mode,count:p.count,...p.filter?{filter:p.filter}:{}}},l++}else{let e=u(f);d.push({at:e,data:f}),n.buffer=0,n.byteOffset=e,n.byteLength=f.byteLength}}let p=s+3&-4,m=new Uint8Array(p);for(let e of d)m.set(e.data,e.at);return n.buffers=[{byteLength:p}],l?(n.buffers.push({byteLength:c+3&-4,extensions:{[Jl]:{fallback:!0}}}),iu(n,Jl,!0)):au(n,Jl),f.length||delete n.buffers,{bytes:tu(n,f.length?m:null),compressedViews:l}}var cu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},lu={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},uu=5126,du=5123,fu=5125,pu=5122,mu=e=>(cu[e.type]??1)*(lu[e.componentType]??4);function hu(e,t){let n=mu(t),r=new Uint8Array(t.count*n);if(t.bufferView===void 0)return r;let i=e.json.bufferViews[t.bufferView],a=e.views[t.bufferView],o=i.byteStride||n,s=t.byteOffset??0;if(o===n)r.set(a.subarray(s,s+r.byteLength));else for(let e=0;e<t.count;e++)r.set(a.subarray(s+e*o,s+e*o+n),e*n);return r}function gu(e,t){let n=t.count*(cu[t.type]??1),r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=new Float32Array(n),a=lu[t.componentType];for(let e=0;e<n;e++){let n=e*a,o;switch(t.componentType){case 5126:o=r.getFloat32(n,!0);break;case 5120:o=r.getInt8(n),t.normalized&&(o=Math.max(o/127,-1));break;case 5121:o=r.getUint8(n),t.normalized&&(o/=255);break;case 5122:o=r.getInt16(n,!0),t.normalized&&(o=Math.max(o/32767,-1));break;case 5123:o=r.getUint16(n,!0),t.normalized&&(o/=65535);break;default:o=r.getUint32(n,!0)}i[e]=o}return i}function _u(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=new Uint32Array(t.count);for(let e=0;e<t.count;e++)r[e]=t.componentType===5121?n.getUint8(e):t.componentType===du?n.getUint16(e*2,!0):n.getUint32(e*4,!0);return r}function vu(e,t){let n=Array(t).fill(1/0),r=Array(t).fill(-1/0);for(let i=0;i<e.length;i++){let a=i%t;e[i]<n[a]&&(n[a]=e[i]),e[i]>r[a]&&(r[a]=e[i])}return{min:n.map(e=>Number.isFinite(e)?e:0),max:r.map(e=>Number.isFinite(e)?e:0)}}var yu=16,bu=16,xu=10;function Su(e){if((e.extensionsUsed??[]).includes(`KHR_draco_mesh_compression`))return`Draco-compressed geometry (KHR_draco_mesh_compression) cannot be decoded here: geometry kept as is.`;if((e.accessors??[]).some(e=>e.sparse))return`Sparse accessors: geometry kept as is.`;for(let t of e.accessors??[])if(/^MAT/.test(t.type)&&(lu[t.componentType]??4)<4)return`Padded matrix accessors: geometry kept as is.`;return null}async function Cu(e,t){let{MeshoptEncoder:n,MeshoptSimplifier:r}=await ql(),{json:i}=e,a=i.accessors??[],o={trianglesBefore:0,trianglesAfter:0,verticesBefore:0,verticesAfter:0,welded:0,simplified:!1,filters:[],notes:[]},s=new Map,c=new Map,l=(e,t,n)=>{if(e===void 0||!a[e])return;let r=s.get(e);r&&r!==`other`||s.set(e,t),c.has(e)||c.set(e,new Set),c.get(e).add(n)},u=[];for(let e of i.meshes??[])for(let t of e.primitives??[]){u.push(t);for(let e of Object.values(t.attributes??{}))l(e,`vertex`,t);for(let e of t.targets??[])for(let n of Object.values(e))l(n,`target`,t);l(t.indices,`index`,t)}for(let e of i.skins??[])l(e.inverseBindMatrices,`other`,`other`);for(let e of i.animations??[])for(let t of e.samplers??[])l(t.input,`other`,`other`),l(t.output,`other`,`other`);for(let e of i.nodes??[]){let t=e.extensions?.EXT_mesh_gpu_instancing;for(let e of Object.values(t?.attributes??{}))l(e,`other`,`other`)}let d=new Map;for(let[t,n]of a.entries())d.set(t,hu(e,n));let f=e=>{let t=e.mode??4,n=e.indices===void 0?a[e.attributes.POSITION]?.count??0:a[e.indices].count;return t===4?n/3:t===5||t===6?Math.max(0,n-2):0};for(let e of u)o.trianglesBefore+=f(e);let p=new Set;for(let e of u)e.attributes.POSITION!==void 0&&!p.has(e.attributes.POSITION)&&(p.add(e.attributes.POSITION),o.verticesBefore+=a[e.attributes.POSITION].count);let m=new Map;for(let e of u){if((e.mode??4)!==4||e.extensions?.KHR_draco_mesh_compression||e.attributes.POSITION===void 0)continue;let t=JSON.stringify([e.attributes,e.targets??[]]);m.set(t,[...m.get(t)??[],e])}let h=!1,g=!1,_=new Set;for(let e of m.values()){let i=e[0],l=[...Object.values(i.attributes),...(i.targets??[]).flatMap(e=>Object.values(e))];if(!l.every(t=>[...c.get(t)??[]].every(t=>t!==`other`&&e.includes(t)))||e.some(e=>e.indices!==void 0&&(c.get(e.indices).size>1||s.get(e.indices)!==`index`)))continue;let u=a[i.attributes.POSITION],f=u.count;if(l.some(e=>a[e].count!==f||a[e].bufferView===void 0))continue;let p=e.map(e=>e.indices===void 0?Uint32Array.from({length:f},(e,t)=>t):_u(d.get(e.indices),a[e.indices]));if(p.some(e=>e.length%3))continue;let m=l.map(e=>mu(a[e])),v=l.map(e=>d.get(e)),y=new Uint32Array(f),b=new Map,x=0;for(let e=0;e<f;e++){let t=``;for(let n=0;n<l.length;n++){let r=v[n];for(let i=e*m[n];i<(e+1)*m[n];i++)t+=String.fromCharCode(r[i])}let n=b.get(t);n===void 0?(b.set(t,e),y[e]=e):(y[e]=n,x++)}if(x&&(p=p.map(e=>e.map(e=>y[e]))),o.welded+=x,t.simplify!==void 0&&t.simplify<1&&i.targets===void 0){let e=gu(d.get(i.attributes.POSITION),u);p=p.map(n=>{let i=n.length/3;if(i<32)return n;let a=Math.max(3,Math.floor(i*t.simplify|0)*3),[o,s]=r.simplify(n,e,3,a,t.simplifyError??.01,[`LockBorder`]);return o.length?(o.length>a*1.05&&(g=!0),h||=o.length<n.length,o):n})}let S=new Uint32Array(p.reduce((e,t)=>e+t.length,0)),C=0;for(let e of p)S.set(e,C),C+=e.length;let[w,T]=n.reorderMesh(S,e.length===1,!0);C=0,p=p.map(e=>{let t=S.slice(C,C+e.length);return C+=e.length,t});for(let[e,t]of l.entries()){let n=m[e],r=v[e],i=new Uint8Array(T*n);for(let e=0;e<f;e++){let t=w[e];t!==4294967295&&t<T&&i.set(r.subarray(e*n,(e+1)*n),t*n)}d.set(t,i);let o=a[t];o.count=T,o.byteOffset=0}for(let[t,n]of e.entries()){let e=p[t],r=T>65535,i=new Uint8Array(r?new Uint32Array(e).buffer:new Uint16Array(e).buffer),o=n.indices;o===void 0&&(o=a.length,a.push({componentType:r?fu:du,count:e.length,type:`SCALAR`}),_.add(o),s.set(o,`index`),c.set(o,new Set([n])),n.indices=o);let l=a[o];l.componentType=r?fu:du,l.count=e.length,l.byteOffset=0,delete l.min,delete l.max,d.set(o,i)}}h&&(o.simplified=!0),g&&o.notes.push(`Simplification stopped early to stay within the error bound (${t.simplifyError??.01} of the mesh size): raise --simplify-error to go further.`);for(let[e,t]of a.entries())s.get(e)===`index`&&t.componentType===5121&&(d.set(e,new Uint8Array(new Uint16Array(_u(d.get(e),t)).buffer)),t.componentType=du);let v=new Map;if(t.compress){let e=new Map;for(let t of u)for(let[n,r]of Object.entries(t.attributes))e.set(r,e.has(r)&&e.get(r)!==n?`?`:n);for(let[t,r]of a.entries()){if(s.get(t)!==`vertex`||r.componentType!==uu||r.bufferView===void 0||[...c.get(t)??[]].some(e=>e===`other`))continue;let a=e.get(t)??`?`,o=gu(d.get(t),r);if(a===`NORMAL`&&r.type===`VEC3`||a===`TANGENT`&&r.type===`VEC4`){let e=new Float32Array(r.count*4);for(let t=0;t<r.count;t++){let n=r.type===`VEC3`?3:4;e[t*4]=o[t*n],e[t*4+1]=o[t*n+1],e[t*4+2]=o[t*n+2],e[t*4+3]=n===4?o[t*n+3]:0}d.set(t,n.encodeFilterOct(e,r.count,8,xu)),r.componentType=pu,r.normalized=!0,delete r.min,delete r.max,v.set(t,`OCTAHEDRAL`),iu(i,Xl,!0)}else if(a===`POSITION`||/^TEXCOORD_\d+$/.test(a)){let e=cu[r.type],i=a===`POSITION`?yu:bu,s=n.encodeFilterExp(o,r.count,e*4,i,`SharedComponent`);d.set(t,s),v.set(t,`EXPONENTIAL`),a===`POSITION`&&Object.assign(r,vu(Eu(s),e))}}o.filters=[...new Set([...v.entries()].map(([t,n])=>`${e.get(t)}: ${n===`OCTAHEDRAL`?`octahedral ${xu} bits`:`exponential ${e.get(t)===`POSITION`?yu:bu} bits`}`))].sort()}for(let e of u)for(let t of[e.attributes.POSITION,...(e.targets??[]).map(e=>e.POSITION)]){if(t===void 0||v.has(t))continue;let e=a[t];e.bufferView!==void 0&&Object.assign(e,vu(gu(d.get(t),e),cu[e.type]))}let y=i.bufferViews??[],b=new Set;for(let e of i.images??[])e.bufferView!==void 0&&b.add(e.bufferView);wu(i,b);let x=new Map,S=[],C=[],w=[];for(let[t,n]of y.entries())b.has(t)&&(x.set(t,S.length),S.push(n),C.push(e.views[t]),w.push(e.meta[t]));for(let[e,t]of a.entries()){if(t.bufferView===void 0&&!_.has(e))continue;let n=s.get(e)??`other`,r=mu(t),i=d.get(e),a=v.get(e),o=a===`OCTAHEDRAL`?8:n===`vertex`||n===`target`?r+3&-4:r;if(!a&&o!==r){let e=new Uint8Array(t.count*o);for(let n=0;n<t.count;n++)e.set(i.subarray(n*r,(n+1)*r),n*o);i=e}let l={buffer:0,byteLength:i.byteLength};(n===`vertex`||n===`target`)&&(l.byteStride=o,l.target=34962),n===`index`&&(l.target=34963);let u;n===`index`?u={mode:[...c.get(e)??[]].every(e=>e!==`other`&&(e.mode??4)===4)&&t.count%3==0?`TRIANGLES`:`INDICES`,stride:r,count:t.count}:o%4==0&&o<=256&&(u={mode:`ATTRIBUTES`,stride:o,count:t.count,...a?{filter:a}:{}}),t.bufferView=S.length,t.byteOffset=0,S.push(l),C.push(i),w.push(u)}for(let e of i.images??[])e.bufferView!==void 0&&(e.bufferView=x.get(e.bufferView));Tu(i,x),i.bufferViews=S,e.views=C,e.meta=w;for(let e of u)o.trianglesAfter+=f(e);let T=new Set;for(let e of u)e.attributes.POSITION!==void 0&&!T.has(e.attributes.POSITION)&&(T.add(e.attributes.POSITION),o.verticesAfter+=a[e.attributes.POSITION].count);return o.trianglesBefore=Math.round(o.trianglesBefore),o.trianglesAfter=Math.round(o.trianglesAfter),o}function wu(e,t){for(let n of e.meshes??[])for(let e of n.primitives??[])for(let n of Object.values(e.extensions??{})){let e=n?.bufferView;typeof e==`number`&&t.add(e)}}function Tu(e,t){for(let n of e.meshes??[])for(let e of n.primitives??[])for(let n of Object.values(e.extensions??{})){let e=n;e&&typeof e.bufferView==`number`&&(e.bufferView=t.get(e.bufferView))}}function Eu(e){let t=e.byteLength/4,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=new Float32Array(t);for(let e=0;e<t;e++){let t=n.getInt32(e*4,!0),i=t>>24,a=t<<8>>8;r[e]=a*2**i}return r}function Du(e){let{json:t}=e,n=new Set;for(let e of t.accessors??[])e.bufferView!==void 0&&n.add(e.bufferView);for(let e of t.images??[])e.bufferView!==void 0&&n.add(e.bufferView);wu(t,n);let r=new Map,i=[],a=[],o=[];for(let[s,c]of(t.bufferViews??[]).entries())n.has(s)&&(r.set(s,i.length),i.push(c),a.push(e.views[s]),o.push(e.meta[s]));if(i.length!==(t.bufferViews??[]).length){for(let e of t.accessors??[])e.bufferView!==void 0&&(e.bufferView=r.get(e.bufferView));for(let e of t.images??[])e.bufferView!==void 0&&(e.bufferView=r.get(e.bufferView));Tu(t,r),t.bufferViews=i,e.views=a,e.meta=o}}var Ou=new Set([`metallicRoughnessTexture`,`occlusionTexture`,`clearcoatTexture`,`clearcoatRoughnessTexture`,`transmissionTexture`,`thicknessTexture`,`specularTexture`,`sheenRoughnessTexture`,`iridescenceTexture`,`iridescenceThicknessTexture`,`anisotropyTexture`]),ku=new Set([`normalTexture`,`clearcoatNormalTexture`]);function Au(e){return e.extensions?.EXT_texture_webp?.source??e.extensions?.EXT_texture_avif?.source??e.extensions?.KHR_texture_basisu?.source??e.source}function ju(e){let t=new Map,n={data:0,normal:1,color:2},r=(i,a)=>{if(!i||typeof i!=`object`)return;let o=i;if(typeof o.index==`number`&&a.endsWith(`Texture`)){let r=e.textures?.[o.index],i=r?Au(r):void 0;if(i!==void 0){let e=ku.has(a)?`normal`:Ou.has(a)?`data`:`color`,r=t.get(i);(!r||n[e]>n[r])&&t.set(i,e)}}else for(let[e,t]of Object.entries(o))r(t,e)};for(let t of e.materials??[])r(t,``);return t}function Mu(e){let t=!1,n=new Set;for(let r of e.textures??[]){let i=Au(r);if(i===void 0)continue;typeof r.source==`number`&&r.source!==i&&n.add(r.source);let a=e.images?.[i]?.mimeType===`image/webp`;r.extensions?.EXT_texture_avif||r.extensions?.KHR_texture_basisu||(a?(r.extensions={...r.extensions??{},[Yl]:{source:i}},delete r.source,t=!0):(r.source=i,r.extensions&&(delete r.extensions[Yl],Object.keys(r.extensions).length||delete r.extensions)))}return t?iu(e,Yl,!0):au(e,Yl),n}function Nu(e,t){let n=e.images??[],r=new Set;for(let t of e.textures??[])for(let e of[t.source,...Object.values(t.extensions??{}).map(e=>e?.source)])typeof e==`number`&&r.add(e);let i=new Set([...t].filter(e=>!r.has(e)&&n[e]));if(!i.size)return 0;let a=new Map,o=[];n.forEach((e,t)=>{i.has(t)||(a.set(t,o.length),o.push(e))});for(let t of e.textures??[]){typeof t.source==`number`&&(t.source=a.get(t.source));for(let e of Object.values(t.extensions??{}))e&&typeof e.source==`number`&&(e.source=a.get(e.source))}return e.images=o,o.length||delete e.images,n.length-o.length}var Pu=[256,512,1024,2048],Fu=[512,1024,2048,4096],Iu={banner:1440,hero:1440,fullscreen:1920,inline:800,card:400,square:600,game:1280},Lu={banner:256,hero:512,fullscreen:512,inline:256,card:256,square:256,game:256},Ru={banner:2048,hero:2048,fullscreen:2048,inline:2048,card:1024,square:2048,game:1024},zu={color:1,normal:.75,data:.5,background:1,lighting:1,depth:.5},Bu=1024,Vu=1.2,Hu=512,Uu=1024,Wu=1.5,Gu=1.15;function Ku(e){let t=e.target?.kind&&e.target.kind in Iu?e.target.kind:`hero`,n=Math.min(2,Math.max(1,Number(e.target?.maxDpr)||2)),[r,i]=String(e.target?.aspect??Jo[t]).split(`:`).map(Number),a=r>0&&i>0?r/i:16/9,o=Iu[t],s=o/a,c=/^(\d+(?:\.\d+)?)(px|vh|svh|dvh|lvh)$/.exec(String(e.target?.height??``).trim());return c&&(s=c[2]===`px`?Number(c[1]):900*Number(c[1])/100),{width:Math.round(o*n),height:Math.round(s*n),dpr:n,kind:t}}function qu(e,t,n,r){let i=e/1.12,a=t.find(e=>e>=i)??t[t.length-1];return Math.max(n,Math.min(r,a))}var Ju=(e,t)=>Array.isArray(e)&&e.length===3&&e.every(e=>typeof e==`number`)?e:[t,t,t],Yu=e=>typeof e==`number`?Math.abs(e):Array.isArray(e)&&Math.max(...e.map(e=>Math.abs(Number(e)||0)))||1,Xu=(e,t)=>Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2]),Zu=new Map(fa.geometries.map(e=>[e.id,Object.fromEntries(e.params.map(e=>[e.name,e.default]))]));function Qu(e){if(!e)return 1;let t={...Zu.get(String(e.type))??{},...e},n=e=>typeof t[e]==`number`?t[e]:0,r=Math.max(n(`width`),n(`height`),n(`depth`),n(`length`)+2*n(`radius`),2*n(`radius`)+2*n(`tube`),2*n(`outerRadius`),2*n(`radiusTop`),2*n(`radiusBottom`),n(`size`));return r>0?r:1}function $u(e){let t=[],n=(e,r,i)=>{for(let a of e??[]){if(!a||typeof a!=`object`)continue;let e=Ju(a.position,0),o=[r[0]+e[0]*i,r[1]+e[1]*i,r[2]+e[2]*i],s=i*Yu(a.scale);t.push({object:a,world:o,scale:s}),n(a.children,o,s)}};return n(e.objects,[0,0,0],1),t}function ed(e,t){return(e.timeline?.tracks??[]).filter(e=>e?.target===t).flatMap(e=>(e.keys??[]).map(e=>e?.[1]))}function td(e){let t=e.camera,n=[Ju(t?.position,5)];for(let e of t?.scrollPath??[])Array.isArray(e?.position)&&n.push(Ju(e.position,5));for(let t of ed(e,`camera.position`))Array.isArray(t)&&t.length===3&&n.push(t);return n}function nd(e,t,n,r){let i=e.camera,a=Math.min(...td(e).map(e=>Xu(e,t))),o;if(i?.controls===`follow`&&i.follow){let e=Ju(i.follow.offset,0),t=Math.hypot(...e)||a;a=i.follow.target===n?t:Math.min(a,t),o=`follow camera`}if(i?.controls===`orbit`&&i.orbitZoom!==!1){let e=Number(i.orbitLimits?.minDistance),t=Number.isFinite(e)&&e>0?e:a*.6;t<a&&(a=t,o=`orbit zoom`)}return i?.controls===`parallax`&&(a*=.9),{d:Math.max(a-r*.5,r*.35,Number(i?.near)||.1),note:o}}function rd(e,t,n,r){let i=e.camera;if(i?.type===`orthographic`){let e=Number(i.zoom)>0?Number(i.zoom):10;return n*t.height/e}let a=[Number(i?.fov)||45,...ed(e,`camera.fov`).map(Number).filter(e=>e>0)],o=Math.min(...a),s=2*r*Math.tan(o*Math.PI/180/2);return n*t.height/Math.max(s,.001)}async function id(e,t,n){switch(t.kind){case`mesh`:return Qu(t.geometry);case`text`:return Math.max(1,(Number(t.size)||1)*Math.max(1,String(t.text??``).split(`
|
|
50
|
+
`).reduce((e,t)=>Math.max(e,t.length),0))*.65);case`model`:if(typeof t.fit==`number`&&t.fit>0)return t.fit;if(Fa(t.src)){let e=La(n.library,Ia(t.src))?.size;if(e)return Math.max(...e)}else{let n=await zl(e,String(t.src??``)).catch(()=>null);if(n)return Math.max(...n.size)}return 1;case`photo`:{let n=Number(t.width)>0?Number(t.width):void 0,r=Number(t.height)>0?Number(t.height):void 0;if(n&&r)return Math.max(n,r);let i;if(typeof t.src==`string`&&!Fa(t.src)&&await e.exists(t.src).catch(()=>!1)){let n=sd(await e.readBytes(t.src));n&&n.width>0&&n.height>0&&(i=n.width/n.height)}if(r)return i?Math.max(r,r*i):r;let a=n??4;return i?Math.max(a,a/i):a}default:return 1}}function ad(e,t,n,r,i){let a=qu(t.pixels,n,r,i);if(!e)return{maxSize:a,reason:`${t.why} → ${a} px`,uses:[t]};let o=[...e.uses,t],s=a>e.maxSize?`${t.why} → ${a} px`:e.reason.replace(/ \(largest of \d+ uses\)$/,``);return{maxSize:Math.max(a,e.maxSize),reason:`${s} (largest of ${o.length} uses)`,uses:o}}function H(e,t,n,r,i,a){e.set(t,ad(e.get(t),n,r,i,a))}var U=e=>Math.round(e);async function od(e,t,n={}){let r=Ku(t),i=new Map,a=new Map,o=Ru[r.kind],s=`${r.kind} ${r.width}x${r.height}`;for(let{object:c,world:l,scale:u}of $u(t)){let d=await id(e,c,n)*u,f=ed(t,`${c.id}.scale`).map(Yu),p=d*Math.max(1,...f),m=[l,...ed(t,`${c.id}.position`).filter(e=>Array.isArray(e)&&e.length===3).map(e=>e)],h={d:1/0};for(let e of m){let n=nd(t,e,c.id,p);n.d<h.d&&(h=n)}let g=Math.min(rd(t,r,p,h.d),Math.max(r.width,r.height)*1.5),_=`${p.toFixed(2)} u at ${h.d.toFixed(1)} u${h.note?` (${h.note})`:``}`;if(c.kind===`model`&&typeof c.src==`string`&&(n.includeLibrary||!Fa(c.src))&&/\.glb$/i.test(c.src)){let e=a.get(c.src)??{};for(let t of[`color`,`normal`,`data`]){let n=g*Wu*zu[t]*Gu,i={at:`objects#${c.id}.src`,role:t,pixels:U(n),why:`${t} atlas of model "${c.id}", ${_} ≈ ${U(g)} px on a ${s} canvas`};e[t]=ad(e[t],i,Pu,t===`color`?Lu[r.kind]:256,o)}a.set(c.src,e),H(i,c.src,{at:`objects#${c.id}.src`,role:`color`,pixels:U(g*Wu*Gu),why:`model "${c.id}", ${_} ≈ ${U(g)} px on a ${s} canvas`},Pu,Lu[r.kind],o)}if(c.kind===`photo`){if(typeof c.src==`string`&&(n.includeLibrary||!Fa(c.src))){let e=g*Gu*Vu;H(i,c.src,{at:`objects#${c.id}.src`,role:`color`,pixels:U(e),why:`photo "${c.id}", ${_} ≈ ${U(g)} px on a ${s} canvas (≥ ${Bu} px: the view drifts over it)`},Pu,Math.min(Bu,o),o)}if(typeof c.depth==`string`&&(n.includeLibrary||!Fa(c.depth))){let e=g*zu.depth*Gu;H(i,c.depth,{at:`objects#${c.id}.depth`,role:`depth`,pixels:U(e),why:`depth map of photo "${c.id}" (smooth data, kept lossless) ≈ ${U(e)} px`},Pu,Hu,Math.min(Uu,o))}}let v=c.material;if(v&&typeof v==`object`){let e=Array.isArray(v.repeat)?Math.max(1,...v.repeat.map(e=>Math.abs(Number(e)||1))):1;for(let[t,a]of[[`map`,`color`],[`normalMap`,`normal`],[`roughnessMap`,`data`]]){let l=v[t];if(typeof l!=`string`||Fa(l)&&!n.includeLibrary)continue;let u=g/e*zu[a]*Gu;H(i,l,{at:`objects#${c.id}.material.${t}`,role:a,pixels:U(u),why:`${t} of "${c.id}", ${_}${e>1?`, repeat ${e}`:``} ≈ ${U(g/e)} px per tile on a ${s} canvas`},Pu,a===`color`?Lu[r.kind]:256,o)}}}let c=t.environment,l=c?.background;if(l&&typeof l==`object`&&typeof l.hdri==`string`&&(n.includeLibrary||!Fa(l.hdri))){let e=Number(t.camera?.fov)||45,n=2*Math.atan(Math.tan(e*Math.PI/180/2)*(r.width/r.height))*180/Math.PI,a=Math.max(0,Number(l.blur)||0),o=r.width*360/Math.max(n,10)/(1+a*8);H(i,l.hdri,{at:`environment.background.hdri`,role:`background`,pixels:U(o),why:`equirect background seen ${U(n)}° wide on a ${s} canvas${a?`, blur ${a}`:``} needs ≈ ${U(o)} px`},Fu,1024,4096)}let u=c?.lighting;return u&&typeof u==`object`&&typeof u.hdri==`string`&&(n.includeLibrary||!Fa(u.hdri))&&H(i,u.hdri,{at:`environment.lighting.hdri`,role:`lighting`,pixels:1024,why:`image-based lighting only (prefiltered to a 256 px cube map)`},Fu,1024,1024),{viewport:r,files:i,modelRoles:a}}function sd(e){let t=e,n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.byteLength>24&&t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t[25];return{width:n.getUint32(16),height:n.getUint32(20),mimeType:`image/png`,alpha:(e===4||e===6||e===3)&&`maybe`}}if(t.byteLength>4&&t[0]===255&&t[1]===216){let e=2;for(;e+9<t.byteLength;){if(t[e]!==255){e++;continue}let r=t[e+1];if(r===216||r===1||r>=208&&r<=215){e+=2;continue}let i=n.getUint16(e+2);if(r>=192&&r<=207&&r!==196&&r!==200&&r!==204)return{height:n.getUint16(e+5),width:n.getUint16(e+7),mimeType:`image/jpeg`,alpha:!1};e+=2+i}return null}if(t.byteLength>30&&String.fromCharCode(t[0],t[1],t[2],t[3])===`RIFF`&&String.fromCharCode(t[8],t[9],t[10],t[11])===`WEBP`){let e=String.fromCharCode(t[12],t[13],t[14],t[15]);if(e===`VP8 `)return{width:n.getUint16(26,!0)&16383,height:n.getUint16(28,!0)&16383,mimeType:`image/webp`,alpha:!1};if(e===`VP8L`){let e=n.getUint32(21,!0);return{width:(e&16383)+1,height:(e>>14&16383)+1,mimeType:`image/webp`,alpha:e>>28&1?`maybe`:!1}}if(e===`VP8X`)return{width:1+(t[24]|t[25]<<8|t[26]<<16),height:1+(t[27]|t[28]<<8|t[29]<<16),mimeType:`image/webp`,alpha:t[20]&16?`maybe`:!1}}return null}var cd=e=>Math.round(e/102.4)/10;async function ld(e,t,n={}){let r={models:[],textures:[]},i=(await e.list(`assets/`)).filter(e=>/\.(png|jpe?g|webp|glb)$/i.test(e));if(!i.length)return r;let a=await od(e,t,n);for(let t of i){let n=await e.readBytes(t);if(/\.glb$/i.test(t)){if(n.byteLength<51200)continue;let e=Al(n),i=e?.extensionsUsed??[];e&&e.meshes?.length&&!i.includes(`EXT_meshopt_compression`)&&!i.includes(`KHR_draco_mesh_compression`)&&!(e.accessors??[]).some(e=>e.sparse)&&r.models.push({path:t,kb:cd(n.byteLength)});continue}let i=sd(n),o=a.files.get(t);i&&o&&Math.max(i.width,i.height)>=o.maxSize*2&&r.textures.push({path:t,size:Math.max(i.width,i.height),maxSize:o.maxSize,kb:cd(n.byteLength)})}return r}var ud=[`auto`,`webp`,`jpeg`,`png`,`keep`],dd={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`},fd={"image/png":`png`,"image/jpeg":`jpg`,"image/webp":`webp`},pd=e=>e.slice(e.lastIndexOf(`.`)+1).toLowerCase(),md=e=>!!dd[pd(e)]||pd(e)===`glb`,hd=(e,t,n,r)=>`${e}x${t} ${n} ${Ni(r)} KB`;async function gd(e,t){let n=[];if(t.paths?.length){let r=[];for(let i of t.paths){let t=i.replace(/^\.\//,``);if(t.startsWith(`library:`))n.push({path:t,reason:`Library assets are already optimised and read-only (export --optimize can shrink the exported copies).`});else{if(!await e.exists(t))throw new A(`notFound`,`No file "${t}" in the project.`,`List the project's assets with assets_list (CLI: agent3d assets list).`);md(t)?r.includes(t)||r.push(t):n.push({path:t,reason:t.endsWith(`.gltf`)?`A .gltf keeps its textures as separate files: optimise those image files instead.`:/\.(hdr|exr)$/i.test(t)?`Radiance .hdr / .exr files are not re-encoded (image-based lighting is prefiltered to a 256 px cube map: a 1k file is plenty).`:`Not a .jpg / .png / .webp texture or a .glb model.`})}}return{targets:r,skipped:n}}if(!t.all)throw new A(`invalid`,`Say which assets to optimise.`,`Pass paths (e.g. "assets/textures/wood/wood_diff_1k.jpg", "assets/models/fox.glb") or all: true (CLI: --all).`);return{targets:(await e.list(`assets/`)).filter(e=>e!==Dc).filter(md).sort(),skipped:n}}function _d(e){if(e.maxSize!==void 0&&!(e.maxSize>=16&&e.maxSize<=8192))throw new A(`invalid`,`maxSize must be between 16 and 8192 pixels (got ${e.maxSize}).`,`Leave it out for the smart per-texture size, or use 512 (banners, small props), 1024 (heroes), 2048 (close-ups).`);if(e.quality!==void 0&&!(e.quality>=1&&e.quality<=100))throw new A(`invalid`,`quality must be between 1 and 100 (got ${e.quality}).`,`80 is a good default for WebP / JPEG.`);if(e.format!==void 0&&!ud.includes(e.format))throw new A(`invalid`,`Unknown format "${e.format}".`,`Use ${ud.join(`, `)} (auto = WebP).`);if(e.simplify!==void 0&&!(e.simplify>0&&e.simplify<=1))throw new A(`invalid`,`simplify must be a ratio between 0 and 1 (got ${e.simplify}).`,`e.g. 0.5 keeps about half of the triangles (within the error bound).`);if(e.simplifyError!==void 0&&!(e.simplifyError>0&&e.simplifyError<=1))throw new A(`invalid`,`simplifyError must be between 0 and 1 (got ${e.simplifyError}).`,`0.01 = 1 % of the mesh size (default); 0.05 allows visible changes.`)}async function vd(e){if(!await e.exists(`scene.json`))return null;try{return await Nc(e)}catch{return null}}function yd(e,t,n){return n?{maxSize:n,reason:`--max-size ${n}`,uses:[]}:e.files.get(t)??{maxSize:1024,reason:`not placed in scene.json (scripts / unused) → 1024 px`,uses:[]}}function bd(e,t){return!!e.files.get(t)?.uses.some(e=>e.role===`depth`)}var xd="Depth map of a 3D photo: only PNG depth maps are resized (losslessly); re-encoding a lossy one adds relief artefacts. Regenerate it as PNG with `agent3d assets depth <photo>`.";function Sd(e,t,n,r){return r?{maxSize:r,reason:`--max-size ${r}`,uses:[]}:e.modelRoles.get(t)?.[n]??{maxSize:1024,reason:`model not placed in scene.json → 1024 px`,uses:[]}}async function Cd(e,t,n,r){if(await e.exists(r))return`${r} already exists`;let i=n.slice(n.lastIndexOf(`/`)+1);if(t){let e=0;if(Vc(JSON.parse(JSON.stringify(t)),t=>void(t===n&&e++)),JSON.stringify(t).split(JSON.stringify(n)).length-1>e)return`scene.json mentions it outside asset fields`}for(let t of[...await e.list(`scripts/`),...(await e.list(`assets/`)).filter(e=>e.endsWith(`.gltf`))])if(/\.(m?js|gltf)$/i.test(t)&&(await e.readText(t)).includes(i))return`${t} mentions it`;return null}async function wd(e,t,n){_d(t);let r=Math.round(t.quality??80),i=t.maxSize===void 0?void 0:Math.round(t.maxSize),a=t.format??`auto`,o=t.compress!==!1,{targets:s,skipped:c}=await gd(e,t),l=await vd(e),u=await od(e,l??{target:{kind:`hero`,aspect:`16:9`},camera:{type:`perspective`,position:[0,0,5]},objects:[]},{library:t.library}),d=[],f=[];for(let p of s){let s=await e.readBytes(p);try{if(pd(p)===`glb`){let c=await Ed(s,p,{sizing:u,forced:i,quality:r,format:a,compress:o,simplify:t.simplify,simplifyError:t.simplifyError},n),l=!!c.bytes&&c.bytes.byteLength<s.byteLength;l&&!t.dryRun&&await e.writeBytes(p,c.bytes);let f=yd(u,p,i);d.push({path:p,beforeBytes:s.byteLength,afterBytes:l?c.bytes.byteLength:s.byteLength,changed:l,maxSize:f.maxSize,sizeReason:f.reason,images:c.images,...c.geometry?{geometry:c.geometry}:{},...c.notes.length?{note:c.notes.join(` `)}:l?{}:{note:`Already small enough: kept as is.`}});continue}if(!n){c.push({path:p,reason:"Textures need an image codec (headless Chrome): run `agent3d assets optimize` from the CLI."});continue}let m=yd(u,p,i),h=dd[pd(p)],g=bd(u,p);if(g&&h!==`image/png`){c.push({path:p,reason:xd});continue}let _=m.uses.some(e=>e.role===`color`||e.role===`background`)?`color`:m.uses.length&&m.uses.every(e=>e.role===`data`)?`data`:m.uses.some(e=>e.role===`normal`)?`normal`:`color`,v=g?`keep`:a,y=g&&a!==`keep`&&a!==`png`?`Depth map: kept as lossless PNG.`:void 0,b=g?h:a===`auto`||a===`webp`?`image/webp`:a===`jpeg`?`image/jpeg`:a===`png`?`image/png`:h;if(b!==h){let t=p.slice(0,p.lastIndexOf(`.`)+1)+fd[b],n=await Cd(e,l,p,t);n&&(v=`keep`,y=`Format kept (${n}).`)}let x=await n({bytes:s,mimeType:h,maxSize:m.maxSize,quality:_===`normal`?Math.max(r,90):r,format:v}),S=Td(x,s.byteLength),C={name:`image`,role:g?`depth`:m.uses.some(e=>e.role===`background`)?`background`:m.uses.length&&m.uses.every(e=>e.role===`lighting`)?`lighting`:_,from:hd(x.srcWidth,x.srcHeight,h,s.byteLength),to:hd(x.width,x.height,x.mimeType,x.bytes.byteLength),replaced:S,maxSize:m.maxSize},w;S&&x.mimeType!==h&&(w=p.slice(0,p.lastIndexOf(`.`)+1)+fd[x.mimeType]),S&&!t.dryRun&&(w?(await e.writeBytes(w,x.bytes),await e.remove(p),await Md(e,p,w),l&&=(Vc(l,e=>e===p?w:void 0),await Pc(e,l,{allowInvalid:!0}),await vd(e))):await e.writeBytes(p,x.bytes)),w&&S&&f.push({from:p,to:w});let T=[y,S?void 0:`Already small enough: kept as is.`,w?t.dryRun?`Would be renamed to ${w} (scene references rewritten).`:`Renamed to ${w}; scene references rewritten.`:void 0].filter(Boolean).join(` `);d.push({path:p,...w?{newPath:w}:{},beforeBytes:s.byteLength,afterBytes:S?x.bytes.byteLength:s.byteLength,changed:S,maxSize:m.maxSize,sizeReason:m.reason,images:[C],...T?{note:T}:{}})}catch(e){if(e instanceof A)throw e;c.push({path:p,reason:e.message})}}!t.dryRun&&d.some(e=>e.changed)&&await jd(e);let p=d.reduce((e,t)=>e+t.beforeBytes,0),m=d.reduce((e,t)=>e+t.afterBytes,0);return{files:d,skipped:c,beforeKb:Ni(p),afterKb:Ni(m),savedKb:Ni(p-m),maxSize:i??`auto`,quality:r,format:a,compress:o,...t.dryRun?{dryRun:!0}:{},...f.length?{renamed:f}:{}}}function Td(e,t){return e.width<e.srcWidth||e.height<e.srcHeight?e.bytes.byteLength<t:e.bytes.byteLength<t*.9}async function Ed(e,t,n,r){let i=await ru(e),{json:a}=i,o=[],s=[],c=i.wasCompressed,l=a.images??[];if(l.length&&!r&&o.push(`Embedded textures not re-encoded (needs headless Chrome).`),l.length&&r){let e=ju(a);for(let[a,o]of l.entries()){let u=o.name||`image${a}`;if(o.bufferView===void 0)continue;let d=o.mimeType??``;if(![`image/png`,`image/jpeg`,`image/webp`].includes(d)){s.push({name:u,from:d||`unknown type`,to:`kept (unsupported format)`,replaced:!1});continue}let f=l.some((e,t)=>t!==a&&e.bufferView===o.bufferView),p=e.get(a)??`color`,m=n.roleSizes?.[p]??(n.sizing?Sd(n.sizing,t,p,n.forced).maxSize:n.forced??1024),h=i.views[o.bufferView],g=await r({bytes:h,mimeType:d,maxSize:m,quality:p===`normal`?Math.max(n.quality,90):n.quality,format:n.format,allowJpeg:n.format===`keep`}),_=!f&&Td(g,h.byteLength);_&&(i.views[o.bufferView]=g.bytes,o.mimeType=g.mimeType,c=!0),s.push({name:u,role:p,from:hd(g.srcWidth,g.srcHeight,d,h.byteLength),to:hd(g.width,g.height,g.mimeType,g.bytes.byteLength),replaced:_,maxSize:m})}Nu(a,Mu(a))&&(c=!0),Du(i)}let u,d=Su(a);if(d&&(n.compress||n.simplify!==void 0)&&o.push(d),!d&&(a.meshes??[]).length){let e=await Cu(i,{compress:n.compress,simplify:n.simplify,simplifyError:n.simplifyError});u={...e,compressed:!1},c=!0,o.push(...e.notes)}if(!c)return{images:s,notes:o};let f=await su(i,{compress:n.compress});if(u&&(u.compressed=f.compressedViews>0),!Ml(t,f.bytes))throw Error(`Internal error: the optimised .glb could not be read back (file kept).`);return{bytes:f.bytes,images:s,...u?{geometry:u}:{},notes:o}}async function Dd(e,t,n={}){let r=await od(e,await vd(e)??{target:{kind:`hero`,aspect:`16:9`},camera:{type:`perspective`,position:[0,0,5]},objects:[]},{library:t.index,includeLibrary:!0}),i=n.quality??80,a=new Map,o=[],s=(e,t)=>{let s=a.get(e);return s||(s=(async()=>{try{let a=pd(e),s,c=r.files.get(e);if(a===`glb`){let a=r.modelRoles.get(e);s=(await Ed(t,e,{sizing:r,quality:i,format:`auto`,compress:!0,roleSizes:a?Object.fromEntries(Object.entries(a).map(([e,t])=>[e,t.maxSize])):void 0},n.codec)).bytes}else if(dd[a]&&n.codec&&c&&!(bd(r,e)&&a!==`png`)){let e=c.uses.every(e=>e.role===`normal`)?`normal`:`color`,r=await n.codec({bytes:t,mimeType:dd[a],maxSize:c.maxSize,quality:e===`normal`?Math.max(i,90):i,format:`keep`});r.mimeType===dd[a]&&Td(r,t.byteLength)&&(s=r.bytes)}let l=s&&s.byteLength<t.byteLength?s:t;return o.push({path:e,beforeBytes:t.byteLength,afterBytes:l.byteLength,...c?{maxSize:c.maxSize}:{}}),l}catch{return t}})(),a.set(e,s)),s};return{fs:{readText:t=>e.readText(t),writeText:(t,n)=>e.writeText(t,n),writeBytes:(t,n)=>e.writeBytes(t,n),exists:t=>e.exists(t),list:t=>e.list(t),remove:t=>e.remove(t),size:t=>e.size(t),readBytes:async t=>{let n=await e.readBytes(t);return t.startsWith(`assets/`)&&md(t)?s(t,n):n}},library:{...t,index:t.index,read:async e=>{let n=await t.read(e);return md(e)?s(`library:${e}`,n):n}},report:()=>{let e=o.reduce((e,t)=>e+t.beforeBytes,0),t=o.reduce((e,t)=>e+t.afterBytes,0);return{files:[...o].sort((e,t)=>e.path.localeCompare(t.path)),beforeKb:Ni(e),afterKb:Ni(t),savedKb:Ni(e-t)}}}}var Od={model:`models`,texture:`textures`,hdri:`hdris`,audio:`audio`,font:`fonts`,svg:`svg`,other:`other`};async function kd(e){let t=await Mi(e,Dc,{assets:[]});return{assets:Array.isArray(t.assets)?t.assets:[]}}async function Ad(e,t){t.assets.sort((e,t)=>e.path.localeCompare(t.path));for(let n of t.assets)await e.exists(n.path)&&(n.bytes=await e.size(n.path));await ji(e,Dc,t)}async function jd(e){if(!await e.exists(`assets/manifest.json`))return[];let t=await kd(e),n=[];for(let r of t.assets)await e.exists(r.path)&&await e.size(r.path)!==r.bytes&&n.push(r.path);return n.length&&await Ad(e,t),n}async function Md(e,t,n){if(!await e.exists(`assets/manifest.json`))return;let r=await kd(e),i=r.assets.find(e=>e.path===t);i&&(i.path=n,await Ad(e,r))}async function Nd(e){let t=await kd(e),n=[],r=await e.exists(`scene.json`)?Hc(await Nc(e)):[],i=new Set((await e.list(`assets/`)).filter(e=>e!==Dc)),a=[];for(let o of t.assets){let t=i.has(o.path),s=t?await e.size(o.path):o.bytes;t&&s!==o.bytes&&n.push(o.path),a.push({...o,bytes:s,exists:t,usedBy:r.filter(e=>e.path===o.path).map(e=>e.at)}),i.delete(o.path)}for(let t of i)a.push({path:t,kind:Uc(t),bytes:await e.size(t),source:`local`,license:`unknown`,addedAt:``,exists:!0,usedBy:r.filter(e=>e.path===t).map(e=>e.at)});return{assets:a,totalKb:Ni(a.reduce((e,t)=>e+(t.exists?t.bytes:0),0)),...n.length?{stale:n}:{}}}async function Pd(e,t){if(!t.license?.trim())throw new A(`invalid`,`An asset needs a licence.`,`Pass license, e.g. "CC0-1.0" (public domain) or "CC-BY-4.0" (with author).`);let n=t.path.replace(/^\.\//,``),r=t.kind??Uc(n);n.includes(`/`)||(n=`assets/${Od[r]}/${n}`);try{n=wi(n)}catch{throw new A(`invalid`,`Invalid asset path "${t.path}".`,`Use a project path under assets/, e.g. "assets/models/fox.glb".`)}if(!n.startsWith(`assets/`)||n===`assets/manifest.json`)throw new A(`invalid`,`Assets live under assets/ (got "${n}").`,`Use e.g. "assets/${Od[r]}/${n.split(`/`).pop()}".`);await e.writeBytes(n,t.bytes);let i={path:n,kind:r,bytes:t.bytes.byteLength,source:t.source,...t.sourceUrl?{sourceUrl:t.sourceUrl}:{},license:t.license,...t.author?{author:t.author}:{},...t.attribution?{attribution:t.attribution}:{},addedAt:ki()},a=await kd(e);return a.assets=a.assets.filter(e=>e.path!==n),a.assets.push(i),await Ad(e,a),i}async function Fd(e,t){if(!e.query?.trim())throw new A(`invalid`,`Empty search query.`,`Search with a few words, e.g. "pine tree", "wood floor", "sunset sky".`);if(e.source&&!kl[e.source])throw new A(`invalid`,`Unknown source "${e.source}".`,`${Fi(e.source,rl)?`Did you mean "${Fi(e.source,rl)}"? `:``}Sources: ${rl.join(`, `)}.`);let n=e.source?[kl[e.source]]:Object.values(kl).filter(t=>!e.kind||t.kinds.includes(e.kind)),r=[],i=await Promise.all(n.map(async n=>{try{return await n.search({query:e.query,kind:e.kind,limit:e.limit??10},t)}catch(e){return r.push({source:n.id,message:e.message}),[]}}));if(e.source&&r.length)throw new A(`io`,`Search on ${e.source} failed: ${r[0].message}`,`Check the network connection, or try another source.`);return{hits:i.flat().sort((e,t)=>Number(!!e.manual)-Number(!!t.manual)),errors:r}}function Id(e,t){return typeof e==`string`?t(e):Array.isArray(e)?e.map(e=>Id(e,t)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,Id(n,t)])):e}function Ld(e){if(!e)return{};let t=e.trim().toLowerCase(),n=/^(\d+)\s*(px)?$/.exec(t),r=/^(\d*\.?\d+)\s*k$/.exec(t),i=n?Number(n[1]):r?Math.round(Number(r[1])*1024):NaN;return Number.isFinite(i)?i<1024?{resolution:`1k`,maxSize:Math.max(16,i)}:{resolution:r?t:`${Math.round(i/1024)}k`}:{resolution:t}}async function Rd(e,t,n,r={}){let i=kl[t?.source];if(!t||!i)throw new A(`invalid`,`Pass an asset hit returned by assets_search (source, id, kind, downloads…).`,`Sources: ${rl.join(`, `)}.`);if(t.manual||!i.download||!Object.keys(t.downloads??{}).length)throw new A(`invalid`,`"${t.title}" (${t.source}) has no direct download.`,`Ask the user to download the pack from ${t.pageUrl??`the source website`}, then import the zip: \`agent3d assets add <file.zip> --source ${t.source} --license ${t.license}\` (importAssetZip).`);let a=Ld(r.resolution),o=r.maxSize??a.maxSize,s;try{s=await i.download(t,n,{resolution:a.resolution,inflate:r.inflate})}catch(e){throw e instanceof il?new A(`io`,`Download from ${t.source} failed: ${e.message}`,`Retry, pick another resolution (1k, 2k) or another asset.`):e}let c=Ri(r.name??t.id,`asset`),l=`assets/${Od[t.kind]}`,u=Object.keys(s.files),d=u.length===1,f=e=>{if(d){let t=e.includes(`.`)?e.slice(e.lastIndexOf(`.`)):``;return`${l}/${c}${t.toLowerCase()}`}let t=e.includes(`/`)?e.slice(e.indexOf(`/`)+1):e;return`${l}/${c}/${t}`},p=[],m=null;for(let n of[s.main,...u.filter(e=>e!==s.main)]){let r=await Pd(e,{path:f(n),bytes:s.files[n],kind:n===s.main?t.kind:Uc(n),source:t.source,sourceUrl:t.pageUrl,license:t.license,author:t.author,attribution:t.attribution});p.push(r.path),n===s.main&&(m=r)}let h=s.suggestion?Id(s.suggestion,e=>e===`<path>`?m.path:s.files[e]?f(e):e):void 0,g,_,v=p.filter(e=>/\.(png|jpe?g|webp|glb)$/i.test(e));o&&v.length&&(r.codec?(g=await wd(e,{paths:v,maxSize:o,quality:r.quality,format:`keep`,compress:!1},r.codec),m=(await kd(e)).assets.find(e=>e.path===m.path)??m):_=`Not downscaled to ${o} px here (needs headless Chrome): run \`agent3d assets optimize ${v.join(` `)} --max-size ${o} --yes\`.`);let y;return t.kind===`model`&&(y=await zl(e,m.path)??void 0),{...m,files:p,...h?{suggestion:h}:{},...g?{optimized:g}:{},...y?{bounds:y}:{},..._?{note:_}:{}}}var zd=/\.(glb|gltf|bin|png|jpe?g|webp|ktx2)$/i;async function Bd(e,t,n){let r;try{r=await el(t,{inflate:n.inflate,filter:e=>zd.test(e),maxBytes:209715200})}catch(e){throw new A(`invalid`,`Cannot read the zip: ${e.message}`,`Pass the original .zip downloaded from the pack page.`)}let i=Object.keys(r),a=(n.filter??[]).map(e=>e.toLowerCase()).filter(Boolean),o=i.filter(e=>/\.(glb|gltf)$/i.test(e)&&(!a.length||a.some(t=>e.toLowerCase().includes(t))));if(!o.length)throw new A(`invalid`,`The zip contains no .glb / .gltf model`+(a.length?` matching ${a.join(`, `)}`:``)+`.`,`Kenney / Quaternius packs ship glTF in a 'GLB format' / 'glTF' folder; check the pack, or drop --filter.`);let s=new Set(o.map(e=>e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)+1):``));i=i.filter(e=>o.includes(e)||!/\.(glb|gltf)$/i.test(e)&&[...s].some(t=>e.startsWith(t)||e.includes(`Textures`)||e.includes(`textures`)));let c=n.maxFiles??400,l=Math.max(0,i.length-c);i=i.slice(0,c);let u=`assets/models/${Ri(n.name,`pack`)}`,d=Vd(i),f=[];for(let t of i){let i=t.slice(d.length).replace(/\s+/g,`-`);f.push(await Pd(e,{path:`${u}/${i}`,bytes:r[t],kind:Uc(t),source:n.source,license:n.license,author:n.author,sourceUrl:n.sourceUrl,attribution:n.attribution}))}return{assets:f,models:f.filter(e=>/\.(glb|gltf)$/i.test(e.path)).map(e=>e.path),skipped:l}}function Vd(e){if(!e.length)return``;let t=e.map(e=>e.split(`/`).slice(0,-1)),n=t[0],r=0;for(;r<n.length&&t.every(e=>e[r]===n[r]);)r++;return r?`${n.slice(0,r).join(`/`)}/`:``}function Hd(e,t={}){let n=(e?.assets??[]).filter(e=>!t.kind||e.kind===t.kind);t.query?.trim()&&(n=n.map(e=>({a:e,s:ll(t.query,{id:e.id,title:e.id.replace(/[/-]/g,` `),tags:[...e.tags,...e.animations??[]],extra:e.description})})).filter(e=>e.s>0).sort((e,t)=>t.s-e.s).map(e=>e.a));let r=n.length,i=Math.max(0,Math.floor(t.offset??0)),a=t.limit===0?1/0:Math.max(1,Math.floor(t.limit??50)),o=n.slice(i,i+a);return{total:r,offset:i,more:i+o.length<r,assets:o.map(e=>({id:e.id,ref:`library:${e.id}`,kind:e.kind,license:e.license,...e.author?{author:e.author}:{},tags:e.tags,description:e.description,kb:Ni(e.bytes),...e.animations?.length?{animations:e.animations}:{},...typeof e.triangles==`number`?{triangles:e.triangles}:{},...Array.isArray(e.size)?{size:e.size}:{}}))}}async function Ud(e,t){if(t)return t(e);let n=globalThis.CompressionStream;if(!n)throw Error("No deflate available: pass `deflate` (CompressionStream is missing).");let r=new Blob([e]).stream().pipeThrough(new n(`deflate`));return new Uint8Array(await new Response(r).arrayBuffer())}async function Wd(e,t,n,r={}){if(e.length!==t*n*4)throw Error(`encodePng: expected ${t*n*4} bytes, got ${e.length}`);let i=r.channels??`auto`;if(i===`auto`){let t=!0,n=!0;for(let r=0;r<e.length&&(t||n);r+=4)(e[r]!==e[r+1]||e[r]!==e[r+2])&&(t=!1),e[r+3]!==255&&(n=!1);i=t?n?1:2:n?3:4}let a={1:0,2:4,3:2,4:6}[i],o=t*i,s=new Uint8Array((o+1)*n),c=new Uint8Array(o),l=new Uint8Array(o),u=new Uint8Array(o);for(let r=0;r<n;r++){for(let n=0;n<t;n++){let a=(r*t+n)*4,o=n*i;if(i===1)c[o]=e[a];else if(i===2)c[o]=e[a],c[o+1]=e[a+3];else for(let t=0;t<i;t++)c[o+t]=e[a+t]}let n=0,a=1/0,d=s.subarray(r*(o+1)+1,(r+1)*(o+1));for(let e=0;e<5;e++){let t=0;for(let n=0;n<o;n++){let r=n>=i?c[n-i]:0,o=l[n],s=n>=i?l[n-i]:0,d;if(e===0)d=0;else if(e===1)d=r;else if(e===2)d=o;else if(e===3)d=r+o>>1;else{let e=Math.abs(o-s),t=Math.abs(r-s),n=Math.abs(r+o-2*s);d=e<=t&&e<=n?r:t<=n?o:s}let f=c[n]-d&255;if(u[n]=f,t+=f<128?f:256-f,t>=a)break}t<a&&(a=t,n=e,d.set(u))}s[r*(o+1)]=n,l.set(c)}let d=await Ud(s,r.deflate),f=new Uint8Array(13),p=new DataView(f.buffer);p.setUint32(0,t),p.setUint32(4,n),f[8]=8,f[9]=a;let m=[Gd(`IHDR`,f),Gd(`IDAT`,d),Gd(`IEND`,new Uint8Array)],h=[137,80,78,71,13,10,26,10],g=8+m.reduce((e,t)=>e+t.length,0),_=new Uint8Array(g);_.set(h,0);let v=8;for(let e of m)_.set(e,v),v+=e.length;return _}function Gd(e,t){let n=new Uint8Array(12+t.length),r=new DataView(n.buffer);r.setUint32(0,t.length);for(let t=0;t<4;t++)n[4+t]=e.charCodeAt(t);return n.set(t,8),r.setUint32(8+t.length,nl(n.subarray(4,8+t.length))),n}var Kd=`4472b7362082ad9968fee890ca0f1e5aca36b93d`,qd={id:`depth-anything-v2-small`,title:`Depth Anything V2 Small (ONNX, quantized)`,repo:`onnx-community/depth-anything-v2-small`,file:`onnx/model_quantized.onnx`,revision:Kd,url:`https://huggingface.co/onnx-community/depth-anything-v2-small/resolve/${Kd}/onnx/model_quantized.onnx`,bytes:27258801,sha256:`fcf51f1b230362b28690bb9d1809bf0431f29cad20534e3f589bd7285547f20d`,license:`Apache-2.0`,author:`Depth Anything V2 (Yang et al.)`,pageUrl:`https://huggingface.co/onnx-community/depth-anything-v2-small`,attribution:`Depth Anything V2 Small by Lihe Yang, Bingyi Kang, Zilong Huang, Zhen Zhao, Xiaogang Xu, Jiashi Feng, Hengshuang Zhao (https://github.com/DepthAnything/Depth-Anything-V2), licensed under Apache-2.0.`,defaultSize:518,multipleOf:14,mean:[.485,.456,.406],std:[.229,.224,.225],inputName:`pixel_values`,outputName:`predicted_depth`},Jd=1036;function Yd(e,t,n={}){let r=n.model??qd,i=r.multipleOf;if(!(e>0&&t>0))throw new A(`invalid`,`Invalid image size ${e}x${t}.`);let a=n.size??r.defaultSize;if(!Number.isFinite(a)||a<140||a>1036)throw new A(`invalid`,`size must be between 140 and ${Jd} (got ${a}).`,`Use the default ${r.defaultSize} (fast, enough for web photos), or up to 1036 for finer edges (≈ 4× slower).`);let o=Math.max(i,Math.round(a/i)*i),s=o/Math.max(e,t),c=e=>Math.max(i,Math.round(e*s/i)*i);return e>=t?{width:o,height:c(t),size:o}:{width:c(e),height:o,size:o}}function Xd(e,t){return e.length?e[Math.min(e.length-1,Math.max(0,Math.round(t*(e.length-1))))]:0}function Zd(e,t,n,r={}){if(e.length!==t*n||t<1||n<1)throw new A(`invalid`,`Depth output has ${e.length} values, expected ${t}x${n}.`);let i=t*n,a=e.filter(e=>Number.isFinite(e));a.sort();let o=Xd(a,r.lowPercentile??.01),s=Xd(a,r.highPercentile??.99),c=s-o,l=new Float32Array(i);for(let t=0;t<i;t++){let n=e[t];l[t]=Number.isFinite(n)?c>1e-12?Math.min(1,Math.max(0,(n-o)/c)):.5:0}let u=Math.max(0,Math.round(r.smooth??1)),d=[];for(let e=-2;e<=2;e++)for(let t=-2;t<=2;t++)d.push(Math.exp(-(t*t+e*e)/4.5));for(let e=0;e<u;e++){let e=new Float32Array(i);for(let r=0;r<n;r++)for(let i=0;i<t;i++){let a=l[r*t+i],o=0,s=0,c=0;for(let e=-2;e<=2;e++){let u=Math.min(n-1,Math.max(0,r+e));for(let e=-2;e<=2;e++,c++){let n=Math.min(t-1,Math.max(0,i+e)),r=l[u*t+n],f=r-a,p=d[c]*Math.exp(-(f*f)/.0072);o+=r*p,s+=p}}e[r*t+i]=o/s}l=e}let f=Math.max(0,Math.round(r.dilate??1));if(f>0){let e=new Float32Array(i);for(let r=0;r<n;r++)for(let n=0;n<t;n++){let i=0;for(let e=-f;e<=f;e++)i=Math.max(i,l[r*t+Math.min(t-1,Math.max(0,n+e))]);e[r*t+n]=i}let r=new Float32Array(i);for(let i=0;i<n;i++)for(let a=0;a<t;a++){let o=0;for(let r=-f;r<=f;r++)o=Math.max(o,e[Math.min(n-1,Math.max(0,i+r))*t+a]);r[i*t+a]=o}l=r}let p=r.edgeThreshold??.08,m=new Float32Array(i).fill(1),h=0;if(p>0)for(let e=0;e<n;e++)for(let r=0;r<t;r++){let i=l[e*t+r],a=0;for(let o=-1;o<=1;o++)for(let s=-1;s<=1;s++){let c=r+s,u=e+o;c<0||u<0||c>=t||u>=n||(a=Math.max(a,Math.abs(l[u*t+c]-i)))}a>p&&(m[e*t+r]=0,h++)}let g=Math.max(1,Math.round(r.width??t)),_=Math.max(1,Math.round(r.height??n)),v=new Uint8Array(g*_*4),y=t/g,b=n/_;for(let e=0;e<_;e++){let r=Math.min(n-1,Math.max(0,(e+.5)*b-.5)),i=Math.floor(r),a=Math.min(n-1,i+1),o=r-i;for(let n=0;n<g;n++){let r=Math.min(t-1,Math.max(0,(n+.5)*y-.5)),s=Math.floor(r),c=Math.min(t-1,s+1),u=r-s,d=i*t+s,f=i*t+c,p=a*t+s,h=a*t+c,_=(l[d]*(1-u)+l[f]*u)*(1-o)+(l[p]*(1-u)+l[h]*u)*o,b=(m[d]*(1-u)+m[f]*u)*(1-o)+(m[p]*(1-u)+m[h]*u)*o,x=(e*g+n)*4,S=Math.round(_*255);v[x]=S,v[x+1]=S,v[x+2]=S,v[x+3]=Math.round(b*255)}}return{data:v,width:g,height:_,range:{low:o,high:s},edgePixels:h}}function Qd(e){return`assets/depth/${e.replace(/^library:/,``).split(`/`).pop().replace(/\.[^.]+$/,``).replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``)||`image`}-depth.png`}async function $d(e,t,n){if(Fa(t)){let e=Ia(t);if(!n)throw new A(`invalid`,`Library assets are not available in this host (${t}).`,`Copy the image into the project (assets add) and pass its project path.`);let r=La(n.index,e);if(!r)throw new A(`notFound`,`No library asset "${e}".`,`List images with library_list { kind: "texture" } (CLI: agent3d assets library --kind texture).`);return{bytes:await n.read(e),entry:{license:r.license,author:r.author,attribution:r.attribution,sourceUrl:r.sourceUrl}}}let r;try{r=wi(t.replace(/^\.\//,``))}catch{throw new A(`invalid`,`Invalid image path "${t}".`,`Use a project path, e.g. "assets/textures/photo.jpg".`)}if(!await e.exists(r)){let n=(await e.list(`assets/`)).filter(e=>/\.(png|jpe?g|webp)$/i.test(e));throw new A(`notFound`,`Image "${t}" not found in the project.`,n.length?`Images in the project: ${n.slice(0,8).join(`, `)}${n.length>8?`, …`:``}.`:`Add the photo first: assets_add { file } (CLI: agent3d assets add <photo.jpg> --license …), then pass its project path.`)}let i=(await kd(e)).assets.find(e=>e.path===r);return{bytes:await e.readBytes(r),entry:i}}async function ef(e,t){if(!t.image?.trim())throw new A(`invalid`,`Depth estimation needs an image.`,`Pass image: a project path ("assets/textures/photo.jpg") or "library:<id>".`);let n=tf(t),{bytes:r}=await $d(e,t.image,t.library),i=sd(r);if(!i)throw new A(`invalid`,`"${t.image}" is not a PNG, JPEG or WebP image.`,`Depth estimation reads .png, .jpg and .webp photos.`);return{out:n,width:i.width,height:i.height,input:Yd(i.width,i.height,{size:t.size})}}function tf(e){let t=e.out??Qd(e.image);try{t=wi(t.replace(/^\.\//,``))}catch{throw new A(`invalid`,`Invalid output path "${e.out}".`,`Use e.g. "assets/depth/photo-depth.png".`)}if(!t.startsWith(`assets/`)||!/\.png$/i.test(t))throw new A(`invalid`,`The depth map must be a .png under assets/ (got "${t}").`,`Use e.g. "${Qd(e.image)}".`);return t}async function nf(e,t,n){if(!t.image?.trim())throw new A(`invalid`,`Depth estimation needs an image.`,`Pass image: a project path ("assets/textures/photo.jpg") or "library:<id>".`);let r=tf(t),{bytes:i,entry:a}=await $d(e,t.image,t.library),o=sd(i);if(!o)throw new A(`invalid`,`"${t.image}" is not a PNG, JPEG or WebP image.`,`Depth estimation reads .png, .jpg and .webp photos.`);let s=Yd(o.width,o.height,{size:t.size}),c=Date.now(),l=await n({bytes:i,mimeType:o.mimeType,width:s.width,height:s.height}),u=Date.now()-c;if(l.depth.length!==l.width*l.height)throw new A(`io`,`The depth estimator returned ${l.depth.length} values for ${l.width}x${l.height}.`);let d=l.srcWidth||o.width,f=l.srcHeight||o.height,p=Math.min(t.maxSize??1024,Math.max(d,f))/Math.max(d,f),m=Zd(l.depth,l.width,l.height,{width:Math.max(1,Math.round(d*p)),height:Math.max(1,Math.round(f*p)),smooth:t.smooth,dilate:t.dilate,edgeThreshold:t.edgeThreshold}),h=await Wd(m.data,m.width,m.height,{deflate:t.deflate}),g=a?.license??`derived`,_=t.image.split(`/`).pop(),v=a?.attribution??(a?.author?`"${_}" by ${a.author}${a.sourceUrl?` (${a.sourceUrl})`:``}, licensed under ${g}.`:``),y=`Depth map of ${t.image} estimated with Depth Anything V2 Small (Apache-2.0).${v?` Image: ${v}`:``}`,b=await Pd(e,{path:r,bytes:h,kind:`texture`,source:qd.id,license:g,author:a?.author,sourceUrl:qd.pageUrl,attribution:y});return{path:b.path,image:t.image,width:m.width,height:m.height,input:{width:l.width,height:l.height},ms:u,kb:Math.round(h.byteLength/102.4)/10,license:g,model:{id:qd.id,revision:qd.revision,license:qd.license,...l.backend?{backend:l.backend}:{}},edgePixels:m.edgePixels,suggestion:{kind:`photo`,src:t.image,depth:b.path}}}var rf=/\{data\.([a-zA-Z_$][\w$-]*(?:\.[a-zA-Z_$][\w$-]*)*)(?:\|([^}]*))?\}/g;function af(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function of(e){return typeof e!=`string`||!e.includes(`{data.`)?!1:(rf.lastIndex=0,rf.test(e))}function sf(e,t){return e.includes(`{data.`)?e.replace(rf,(e,n,r)=>{let i=af(t,n);return i==null||i===``?r??``:typeof i==`object`?JSON.stringify(i):String(i)}):e}var cf=/^\{data\.([a-zA-Z_$][\w$-]*(?:\.[a-zA-Z_$][\w$-]*)*)(?:\|([^}]*))?\}$/;function lf(e,t){if(typeof e!=`string`||!e.includes(`{data.`))return e;let n=cf.exec(e.trim());if(!n)return sf(e,t);let r=af(t,n[1]);if(r!=null&&r!==``)return r;if(n[2]!==void 0)try{return JSON.parse(n[2])}catch{return n[2]}}var uf=class extends Error{hint;name=`PathError`;constructor(e,t){super(e),this.hint=t}},df=/^([^#[\]]*)(?:#([^[\]]+))?((?:\[\d+\])*)$/;function ff(e){if(typeof e!=`string`||!e.trim())throw new uf(`Empty path.`,`Use a path like "camera.position" or "objects#logo.material.color".`);let t=[];for(let n of pf(e.trim())){let r=df.exec(n);if(!r)throw new uf(`Invalid path segment "${n}" in "${e}".`,`Segments are keys, "[index]" or "key#id", e.g. "objects#logo.children[0].position".`);let[,i,a,o]=r;if(i)t.push({key:i});else if(!a&&!o)throw new uf(`Empty segment in "${e}".`);a&&t.push({ref:a,tree:i===`objects`||i===`children`});for(let e of o.matchAll(/\[(\d+)\]/g))t.push({index:Number(e[1])})}return t}function pf(e){return e.split(`.`)}function mf(e){let t=``;for(let n of e)`key`in n?t+=t?`.${n.key}`:n.key:`index`in n?t+=`[${n.index}]`:t+=`#${n.ref}`;return t}var hf=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function gf(e,t,n){for(let n=0;n<e.length;n++){let r=e[n];if(hf(r)&&r.id===t)return{container:e,index:n}}if(n){for(let n of e)if(hf(n)&&Array.isArray(n.children)){let e=gf(n.children,t,!0);if(e)return e}}return null}function _f(e,t,n,r){if(!t.length)throw new uf(`Empty path.`);let i=e,a=t.map((e,n)=>({tok:e,next:t[n+1]})),o=null;for(let e=0;e<a.length;e++){let{tok:s,next:c}=a[e],l=mf(t.slice(0,e+1));if(`ref`in s){if(!Array.isArray(i))throw new uf(`"${mf(t.slice(0,e))}" is not an array, cannot look up "#${s.ref}" in "${r}".`);let n=gf(i,s.ref,s.tree);if(!n)throw new uf(`No element with id "${s.ref}" (path "${r}").`,s.tree?`List the object ids with scene_summary / object_list.`:void 0);o={parent:n.container,key:n.index}}else if(`index`in s){if(!Array.isArray(i))throw new uf(`"${mf(t.slice(0,e))}" is not an array (path "${r}").`);if(s.index>i.length||s.index===i.length&&(e<a.length-1||!n))throw new uf(`Index ${s.index} out of range at "${l}" (length ${i.length}).`);o={parent:i,key:s.index}}else{if(!hf(i))throw new uf(`"${mf(t.slice(0,e))||`<root>`}" is not an object, cannot read "${s.key}" (path "${r}").`);o={parent:i,key:s.key}}if(e===a.length-1)return o;let u=o.parent[o.key];if(u==null){if(!n)throw new uf(`Nothing at "${l}" (path "${r}").`);u=c&&(`index`in c||`ref`in c)?[]:{},o.parent[o.key]=u}i=u}throw new uf(`Unreachable`)}function vf(e,t){let n=typeof t==`string`?ff(t):t,r=_f(e,n,!1,typeof t==`string`?t:mf(n));return r.parent[r.key]}function yf(e,t){try{return vf(e,t)!==void 0}catch{return!1}}function bf(e,t,n){let r=typeof t==`string`?ff(t):t,i=_f(e,r,!0,typeof t==`string`?t:mf(r));i.parent[i.key]=n}function xf(e,t){let n=typeof t==`string`?ff(t):t,r=_f(e,n,!1,typeof t==`string`?t:mf(n));if(Array.isArray(r.parent)){let e=r.key;return e>=r.parent.length?!1:(r.parent.splice(e,1),!0)}return String(r.key)in r.parent&&(delete r.parent[String(r.key)],!0)}function Sf(e,t){if(!hf(t))return Cf(t);let n=hf(e)?{...e}:{};for(let[e,r]of Object.entries(t))r===null?delete n[e]:n[e]=Sf(n[e],r);return n}function Cf(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function wf(e){return JSON.stringify(Tf(e))}function Tf(e){if(Array.isArray(e))return e.map(Tf);if(hf(e)){let t={};for(let n of Object.keys(e).sort())e[n]!==void 0&&(t[n]=Tf(e[n]));return t}return e}function Ef(e,t){return wf(e)===wf(t)}var Df=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function Of(e){let t=``,n=e.length,r=0;for(;r+2<n;r+=3){let n=e[r]<<16|e[r+1]<<8|e[r+2];t+=Df[n>>18]+Df[n>>12&63]+Df[n>>6&63]+Df[n&63]}if(r<n){let i=e[r]<<16|(r+1<n?e[r+1]:0)<<8;t+=Df[i>>18]+Df[i>>12&63]+(r+1<n?Df[i>>6&63]:`=`)+`=`}return t}function kf(e,t){return`data:${t};base64,${Of(e)}`}function Af(e,t){let n=e.replace(/~/g,``),r=0,i=()=>{for(;n[r]===` `;)r++;return n[r]},a=()=>{let e=o();for(let t=i();t===`+`||t===`-`;t=i())r++,e=t===`+`?e+o():e-o();return e},o=()=>{let e=s();for(let t=i();t===`*`||t===`/`;t=i()){r++;let n=s();e=t===`*`?e*n:n===0?0:e/n}return e},s=()=>{let e=c();return i()===`^`?(r++,e**s()):e},c=()=>{let e=i();if(e===`(`){r++;let e=a();return i()===`)`&&r++,e}if(e===`-`)return r++,-c();let o=/^(\d+(?:\.\d+)?)|^([A-Za-z_]\w*)/.exec(n.slice(r));if(!o)return r=n.length,0;if(r+=o[0].length,o[1])return Number(o[1]);if((o[2]===`min`||o[2]===`max`)&&i()===`(`){r++;let e=[a()];for(;i()===`,`;)r++,e.push(a());return i()===`)`&&r++,o[2]===`min`?Math.min(...e):Math.max(...e)}let s=t[o[2]];return typeof s==`number`&&Number.isFinite(s)?s:0},l=a();return Number.isFinite(l)?Math.max(0,Math.round(l)):0}function jf(e,t){let n={};for(let r of e.params){let e=t[r.name]===void 0?r.default:t[r.name];typeof e==`number`?n[r.name]=e:typeof e==`boolean`?n[r.name]=+!!e:typeof e==`string`&&r.type===`enum`?n[`${r.name}_${e}`]=1:Array.isArray(e)&&(n[r.name]=e.length,n[`${r.name}Cells`]=e.reduce((e,t)=>e+(Array.isArray(t)?t.length:1),0))}return n}function Mf(e){let t=typeof e?.type==`string`?pa(`geometries`,e.type):void 0;return t?.cost?Af(t.cost,jf(t,e)):0}function Nf(e){let t=e;return t?t.type===`grid`&&Array.isArray(t.count)?t.count.reduce((e,t)=>e*(Number(t)||0),1):t.type===`list`?Array.isArray(t.items)?t.items.length:0:typeof t.count==`number`?t.count:0:0}var Pf={"sans-bold":9.9,sans:10.4,"inter-black":9.4,"montserrat-extrabold":9.2,"space-grotesk-bold":8.4,"bebas-neue":5.1,anton:6.5,"serif-bold":18.3,serif:18.1,mono:8.4,display:13.4,pacifico:24,lobster:14.9};function Ff(e){let t=typeof e.size==`number`?e.size:1,n=typeof e.depth==`number`?e.depth:.2,r=typeof e.curveSegments==`number`?e.curveSegments:n>0?5+t*3:8+t*4;return Math.round(Math.max(2,Math.min(32,r)))}function If(e){let t=String(e.text??``).replace(/\s/g,``).length,n=(Pf[typeof e.font==`string`?e.font:`sans-bold`]??12)*Ff(e),r=typeof e.depth==`number`?e.depth:.2,i=r>0&&(typeof e.bevel==`number`?e.bevel:1)>0,a=r<=0?1:i?16.6:4.1;return Math.round(t*n*(a+(e.outline?4.8:0)))}function Lf(e,t){switch(e.kind){case`mesh`:return Mf(e.geometry);case`instances`:return Mf(e.geometry)*Nf(e.layout);case`text`:return If(e);case`model`:{let n=e.src;return typeof n==`string`?t?.(n)??0:0}case`generator`:{let t=typeof e.generator==`string`?pa(`generators`,e.generator):void 0;return t?.cost?Af(t.cost,jf(t,e.params??{})):0}case`particles`:return(e.count??200)*2;case`svg`:return 2e3;case`photo`:return Rf(e);default:return 0}}function Rf(e){if(typeof e.depth!=`string`||!e.depth)return 2;let t=e.mode??`parallax`;if(t===`layers`)return 2*(typeof e.layers==`number`&&e.layers>0?Math.round(e.layers):6);if(t===`mesh`){let t=typeof e.segments==`number`&&e.segments>0?Math.round(e.segments):256,n=Number(e.width),r=Number(e.height),i=n>0&&r>0?Math.min(n,r)/Math.max(n,r):1;return Math.round(t*Math.max(1,Math.round(t*i))*2*1.25)}return 2}function zf(e,t={}){let n=[];return V(e.objects,e=>{if(e.visible===!1)return!1;let r=Lf(e,t.models);r&&n.push({id:e.id,triangles:r})}),n.sort((e,t)=>t.triangles-e.triangles),{total:n.reduce((e,t)=>e+t.triangles,0),byObject:n}}var Bf=new Set([`ao`,`dof`,`godrays`,`outline`]);function Vf(e,t,n={}){let r=new Set;V(e.objects??[],e=>{let t=e;(t.castShadow===!1||t.kind===`particles`)&&(r.add(e.id),t.castShadow===!1&&V(e.children??[],e=>void r.add(e.id)))});let i=t.byObject.filter(e=>!r.has(e.id)).reduce((e,t)=>e+t.triangles,0),a=e.environment??{},o=0;if(e.target?.shadows!==!1){for(let t of e.lights??[])t.castShadow&&[`directional`,`spot`,`point`].includes(t.type)&&(o+=t.type===`point`?6:1);let t=a.rig;t&&(typeof t==`string`||t.castShadow!==!1)&&(o+=1);let n=a.background&&typeof a.background==`object`?a.background.sky:void 0;n&&(n.physical||n.preset)&&n.sun!==!1&&n.sun?.light!==!1&&n.sun?.castShadow!==!1&&(o+=1)}let s=(n.expandPostFx?n.expandPostFx(e.postfx):e.postfx??[]).some(e=>Bf.has(e.type))?t.total:0,c=a.contactShadows?i:0,l={main:t.total,shadowMaps:i*o,prepass:s,contactShadows:c};return{perFrame:l.main+l.shadowMaps+l.prepass+l.contactShadows,passes:l,shadowLights:o}}var Hf={banner:15e4,card:15e4,square:25e4,inline:25e4,hero:4e5,fullscreen:6e5,game:3e5},Uf={banner:5e5,card:4e5,square:5e5,inline:5e5,hero:1e6,fullscreen:2e6,game:2e6};fa.geometries,fa.generators;function Wf(e){let t=e.target?.quality??`auto`,n=$a(e.postfx),r=[],i=e.target?.kind,a=n.effects.filter(e=>e.gpu===`high`).map(e=>e.type);return i===`game`&&a.length&&r.push({severity:`warning`,code:`postfx-cost`,path:`postfx`,message:`${a.join(`, `)} on a game target: ${a.length>1?`these effects re-render`:`this effect re-renders`} the scene depth / normals and sample${a.length>1?``:`s`} heavily every frame — frame drops on laptops and phones.`,hint:`Games need a steady 60 fps: remove them, or keep cheap effects only (bloom, grading, vignette, fxaa). target.quality "auto" also drops them on weak devices.`}),n.level===`heavy`&&r.push({severity:i===`game`||i===`fullscreen`?`warning`:`info`,code:`postfx-cost`,path:`postfx`,message:`Post-processing costs ~${n.passes} fullscreen passes per frame (${n.effects.map(e=>e.type).join(`, `)}).`,hint:`Keep the effects that change the image the most; grading / vignette / film / chromatic / sharpen are merged into one pass and nearly free, ao / dof / smaa / bloom are not.`}),t===`ultra`&&i!==`fullscreen`&&i!==`hero`&&r.push({severity:`info`,code:`quality`,path:`target.quality`,message:`quality "ultra" on a ${i}: full-resolution effects and MSAA 8 for every visitor.`,hint:`Use "auto" (adapts to the device and frame rate) or "high".`}),t===`low`&&a.length&&r.push({severity:`info`,code:`quality`,path:`target.quality`,message:`quality "low" disables ${a.join(`, `)} (cost "high").`,hint:`Remove them from postfx, or use quality "auto" / "medium".`}),{gpu:{...n,quality:t},issues:r}}var Gf={fetch:`network access`,XMLHttpRequest:`network access`,WebSocket:`network access`,EventSource:`network access`,eval:`dynamic code execution`,Function:`dynamic code execution`,document:`DOM access outside the HUD`,window:`global page access`,globalThis:`global page access`,self:`global page access`,localStorage:`storage (use api.storage)`,sessionStorage:`storage (use api.storage)`,indexedDB:`storage (use api.storage)`,parent:`access to the parent page`,top:`access to the top page`,opener:`access to the opener page`,postMessage:`cross-frame messaging`,importScripts:`loading remote code`,navigator:`device / network APIs`,location:`page navigation`,Worker:`spawning code`},Kf=new Set([`parent`,`top`,`self`,`location`,`opener`]);function qf(e){let t=``,n=0,r=e.length,i=[],a=0,o=e=>e.replace(/[^\n]/g,` `),s=``;for(;n<r;){let c=e[n],l=e[n+1];if(c===`/`&&l===`/`){let i=e.indexOf(`
|
|
51
|
+
`,n),a=i<0?r:i;t+=o(e.slice(n,a)),n=a}else if(c===`/`&&l===`*`){let i=e.indexOf(`*/`,n+2),a=i<0?r:i+2;t+=o(e.slice(n,a)),n=a}else if(c===`"`||c===`'`){let i=n+1;for(;i<r&&e[i]!==c&&e[i]!==`
|
|
52
|
+
`;)i+=e[i]===`\\`?2:1;t+=c+o(e.slice(n+1,i))+(i<r?e[i]:``),n=i+1,s=c}else if(c==="`"||c===`}`&&i.length&&i[i.length-1]===a){c===`}`&&i.pop();let l=n+1,u=!1;for(;l<r;)if(e[l]===`\\`)l+=2;else{if(e[l]==="`")break;if(e[l]===`$`&&e[l+1]===`{`){u=!0;break}l++}t+=c+o(e.slice(n+1,l)),u?(t+="${",i.push(a),n=l+2):(t+=l<r?"`":``,n=l+1),s="`"}else{if(c===`/`&&/^$|[(,=:[!&|?{};+\-*%<>~^]$/.test(s)){let i=n+1,a=!1;for(;i<r&&e[i]!==`
|
|
53
|
+
`;)if(e[i]===`\\`)i+=2;else{if(e[i]===`[`)a=!0;else if(e[i]===`]`)a=!1;else if(e[i]===`/`&&!a)break;i++}if(i<r&&e[i]===`/`){t+=`/`+o(e.slice(n+1,i))+`/`,n=i+1,s=`/x`;continue}}c===`{`&&a++,c===`}`&&a--,t+=c,/\s/.test(c)||(s=c),n++}}return t}function Jf(e,t){let n=1;for(let r=0;r<t&&r<e.length;r++)e.charCodeAt(r)===10&&n++;return n}function Yf(e,t){let n=[],r=qf(e),i=new Set;for(let e of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))i.add(e[1]);for(let a of r.matchAll(/[A-Za-z_$][\w$]*/g)){let o=a[0],s=a.index??0;if(o===`import`){let i=r.slice(s+6).trimStart();if(r.slice(0,s).trimEnd().endsWith(`.`))continue;i.startsWith(`(`)?n.push(Xf(t,Jf(e,s),`Dynamic import() is forbidden in scripts.`,"Scripts cannot load code: everything they need comes from the `api` argument.")):i.startsWith(`.meta`)?n.push(Xf(t,Jf(e,s),`import.meta is forbidden in scripts.`,`Use api.data for configuration.`)):(/^[\w${*]/.test(i)||i.startsWith(`"`)||i.startsWith(`'`))&&n.push(Xf(t,Jf(e,s),`Static imports are not allowed in scripts.`,"Scripts are self-contained modules: remove the import and use the `api` passed to the default export."));continue}let c=Gf[o];if(!c)continue;let l=r.slice(s+o.length).trimStart(),u=r.slice(Math.max(0,s-200),s).trimEnd().slice(-1);u===`.`||l.startsWith(`(`)&&/^\s*\)\s*\{/.test(r.slice(s+o.length).replace(/^\s*\([^)]*/,``))&&(u===`{`||u===`,`||u===`}`)||l.startsWith(`:`)&&(u===`{`||u===`,`)||Kf.has(o)&&i.has(o)||(!Kf.has(o)||/^[.([]/.test(l))&&n.push(Xf(t,Jf(e,s),`Forbidden global "${o}" (${c}).`,W(o)))}if(/\bdocument\s*\.\s*cookie\b|\.cookie\b/.test(r)&&!n.some(e=>e.message.includes(`document`))){let i=r.search(/\.cookie\b/);n.push(Xf(t,Jf(e,i),`Cookie access is forbidden in scripts.`,`Use api.storage.get/set for small persistent values.`))}return/\bexport\s+default\b/.test(r)||n.push({severity:`error`,code:`forbidden-script`,path:t,message:"The script has no `export default` factory.",hint:"Write `export default function (api) { return { start() {}, update(dt, t) {} }; }`."}),Zf(n)}function W(e){return[`fetch`,`XMLHttpRequest`,`WebSocket`,`EventSource`].includes(e)?`Scenes never call the network at run time. Put data in scene.data (api.data) or in project assets.`:[`localStorage`,`sessionStorage`,`indexedDB`].includes(e)?`Use api.storage.get(key) / api.storage.set(key, value).`:e===`document`||e===`window`||e===`globalThis`||e===`self`?`Use the api: api.ui.set(id, { text }) for the HUD, api.input for keys/pointer, api.state for shared values.`:e===`eval`||e===`Function`?`Write the logic directly; dynamic code is not allowed.`:"Remove it — scripts only get the `api` argument (see ScriptApi)."}function Xf(e,t,n,r){return{severity:`error`,code:`forbidden-script`,path:`${e}:${t}`,message:n,hint:r}}function Zf(e){let t=new Set;return e.filter(e=>{let n=`${e.path}|${e.message}`;return!t.has(n)&&(t.add(n),!0)})}var Qf=e=>/^(cc0|cc-?0|public ?domain)/i.test(e.trim());function $f(e){return e.attribution?e.attribution:`"${e.title??e.path?.split(`/`).pop()??`Asset`}"${e.author?` by ${e.author}`:``}${e.sourceUrl?` (${e.sourceUrl})`:``}, licensed under ${e.license}.`}async function ep(e,t={}){let n=[],r=await Nc(e);n.push(...Ps(r));let i=r.target?.kind??`banner`,a=await Mi(e,Dc,{assets:[]}),o=new Map((a.assets??[]).map(e=>[e.path,e])),s=0,c=new Set,l=[],u=await e.list(`assets/`),d=e=>{l.some(t=>t.path===e.path)||l.push(e)},f=new Map,p=async t=>{if(c.has(t))return;c.add(t);let n=await e.size(t);f.set(t,n),s+=n};for(let i of Hc(r)){if(Fa(i.path)){let e=Ia(i.path);if(!t.library)continue;let r=La(t.library,e);if(!r){let r=Fi(e,t.library.assets.map(e=>e.id));n.push({severity:`error`,code:`unknown-library-id`,path:i.at,message:`Library asset "${e}" does not exist.`,hint:`${r?`Did you mean "library:${r}"? `:``}List the library with library_list (CLI: agent3d assets library --query <word>).`});continue}c.has(i.path)||(c.add(i.path),s+=r.bytes,f.set(i.path,r.bytes)),Qf(r.license)||d({path:i.path,license:r.license,author:r.author,attribution:$f({...r,title:r.id})});continue}if(!i.path||/^[a-z]+:/i.test(i.path))continue;if(!await e.exists(i.path)){let e=Fi(i.path,u);n.push({severity:`error`,code:`missing-asset`,path:i.at,message:`Asset file "${i.path}" does not exist in the project.`,hint:`${e?`Did you mean "${e}"? `:``}Add it with assets_add / \`agent3d assets add\`, or point ${i.at} at an existing file (assets_list).`});continue}if(await p(i.path),i.path.toLowerCase().endsWith(`.gltf`))for(let t of Gc(i.path,await e.readText(i.path)))await e.exists(t)?await p(t):n.push({severity:`error`,code:`missing-asset`,path:i.at,message:`"${i.path}" references "${t}", which is missing.`,hint:`Copy the .bin / texture files next to the .gltf, or convert it to a single .glb.`});let r=o.get(i.path);r?Qf(r.license)||d({path:r.path,license:r.license,author:r.author,attribution:$f(r)}):n.push({severity:`info`,code:`unregistered-asset`,path:i.at,message:`"${i.path}" is not listed in assets/manifest.json (licence unknown).`,hint:`Register it with assets_add (CLI: agent3d assets add <file> --license CC0-1.0 --author …) so the export can credit it.`})}for(let e of l)n.push({severity:`info`,code:`attribution`,path:e.path,message:`${e.path} is ${e.license}: it requires attribution.`,hint:`Show this credit near the embed (the export's index.html lists it): ${e.attribution}`});n.push(...await rp(e,r));let m=0;for(let[t,i]of(r.scripts??[]).entries()){if(typeof i!=`string`||!i.startsWith(`scripts/`))continue;if(!await e.exists(i)){let r=Fi(i,await e.list(`scripts/`));n.push({severity:`error`,code:`missing-script`,path:`scripts[${t}]`,message:`Script "${i}" does not exist.`,hint:`${r?`Did you mean "${r}"? `:``}Create ${i} with \`export default function (api) { return { update(dt, t) {} }; }\`, or remove it from scene.scripts.`});continue}let r=await e.readText(i);m+=new TextEncoder().encode(r).byteLength,n.push(...Yf(r,i))}let h=new Set(r.scripts??[]);for(let t of await e.list(`scripts/`))/\.m?js$/.test(t)&&!h.has(t)&&n.push({severity:`info`,code:`unused-script`,path:t,message:`${t} is not listed in scene.scripts (it will not run or be exported).`,hint:`Add "${t}" to scene.scripts, or delete it.`});let g=new Map;for(let n of Hc(r))if(!(n.kind!==`model`||g.has(n.path))){if(Fa(n.path)){let e=t.library?La(t.library,Ia(n.path))?.triangles:void 0;typeof e==`number`&&g.set(n.path,e)}else if(/\.(glb|gltf)$/i.test(n.path)&&await e.exists(n.path)){let t=Ml(n.path,await e.readBytes(n.path));t&&g.set(n.path,t.triangles)}}let _=zf(r,{models:e=>g.get(e)}),v=Vf(r,_,{expandPostFx:e=>Ha(e)}),y=await e.exists(`scene.json`)?await e.size(Ec):0,b=r.target?.budgetKb??Yo[i]??600,x=Ni(s+m+y);if(x>b){let e=[...f.entries()].sort((e,t)=>t[1]-e[1]).slice(0,3);budgetIssue:{let t=e.filter(([e])=>/\.(hdr|exr)$/i.test(e)).map(([e])=>e);if(t.length){let r=e.filter(([e])=>!t.includes(e));n.push({severity:`warning`,code:`budget`,path:`target.budgetKb`,message:`The bundle weighs ~${x} KB (runtime excluded), above the ${b} KB budget for a ${i}.`,hint:`Heaviest files: ${e.map(([e,t])=>`${e} (${Ni(t)} KB)`).join(`, `)}. ${t.join(`, `)} ${t.length>1?`are HDRIs`:`is an HDRI`}: \`assets optimize\` never shrinks .hdr files. Use a lighter HDRI (a smaller download: \`assets add --hit … --resolution 1k\`; library sizes: \`agent3d assets library --kind hdri\`), or light without one — \`environment.lighting: "studio"\` (or "soft" / "sunset" / "night", built in, 0 KB), \`"sky"\` with a sky background, or a light rig (\`environment.rig\`, see \`agent3d catalog lightRigs\`) — and drop the background HDRI (\`environment.background\`: a colour, gradient or sky).${r.length?` For ${r.map(([e])=>e).join(`, `)}: \`agent3d assets optimize --all\` (plan, then --yes).`:``} Raise target.budgetKb only if the page can afford it.`});break budgetIssue}n.push({severity:`warning`,code:`budget`,path:`target.budgetKb`,message:`The bundle weighs ~${x} KB (runtime excluded), above the ${b} KB budget for a ${i}.`,hint:`${e.length?`Heaviest files: ${e.map(([e,t])=>`${e} (${Ni(t)} KB)`).join(`, `)}. `:``}Run \`agent3d assets optimize --all\` (shows the plan: a size per texture from how the scene uses it, WebP, meshopt geometry; then add --yes; --dry-run reports the real savings), download smaller resolutions (\`assets add --hit … --resolution 512\`), or replace heavy models with catalog geometries / generators (zero bytes). Raise target.budgetKb only if the page can afford it.`})}}let S=await ld(e,r,{library:t.library}).catch(()=>null);if(S&&(S.models.length||S.textures.length)){let e=[...S.textures.map(e=>`${e.path} (${e.size} px, the scene needs ~${e.maxSize})`),...S.models.map(e=>`${e.path} (${e.kb} KB, geometry not compressed)`)];n.push({severity:`info`,code:`optimizable`,path:e.length===1?S.textures[0]?.path??S.models[0].path:`assets/`,message:`${e.length} asset(s) are heavier than this scene needs: ${e.slice(0,4).join(`, `)}${e.length>4?`, …`:``}.`,hint:"Run `agent3d assets optimize --all` to see the plan (per-texture size + reason, WebP, meshopt geometry), then add --yes (assets_optimize { all: true, dryRun: true } first from an agent)."})}let C=Uf[i]??5e5,w=Hf[i]??15e4,T=_.byObject.slice(0,3).map(e=>`${e.id} (~${e.triangles.toLocaleString(`en-US`)})`).join(`, `)||`n/a`,ee=tp(v);if(v.perFrame>C&&!t.runtimeStats?n.push({severity:`warning`,code:`triangles`,path:_.byObject[0]?`objects#${_.byObject[0].id}`:`objects`,message:`Estimated ${v.perFrame.toLocaleString(`en-US`)} triangles per frame (${ee}), above ${C.toLocaleString(`en-US`)} for a ${i}.`,hint:`Heaviest: ${T}. Lower segments / resolution / detail / count params, use "instances" for repeated meshes, or simplify project models (\`agent3d assets optimize <model.glb> --simplify 0.5\`).${np(v)}`}):v.perFrame>w&&!t.runtimeStats&&n.push({severity:`info`,code:`triangles-aim`,path:_.byObject[0]?`objects#${_.byObject[0].id}`:`objects`,message:`Estimated ${v.perFrame.toLocaleString(`en-US`)} triangles per frame (${ee}), above the ~${w.toLocaleString(`en-US`)} to aim for on a ${i} (fast on a mid-range phone; limit ${C.toLocaleString(`en-US`)}).`,hint:`Heaviest: ${T}.${np(v)} \`check --render\` measures the real number.`}),t.inspect&&n.push(...sp(r,t.inspect)),t.runtimeStats){let e=t.runtimeStats;if(e.drawCalls>150){let t=ap(r,v.shadowLights,!!v.passes.prepass);n.push({severity:`warning`,code:`draw-calls`,path:t[0]?`objects#${t[0].id}`:`objects`,message:`${e.drawCalls} draw calls per frame (limit 150).${t.length?` Most draw calls: ${t.slice(0,5).map(e=>`${e.id} (~${e.drawCalls}: ${e.why})`).join(`, `)}.`:``}`,hint:`${t.some(e=>/splitLetters|per-letter/.test(e.why))?`Per-letter text (splitLetters / a per-letter reveal) draws every glyph separately — and twice with an outline: reveal by word or line, or drop the outline on split text. `:``}${t.some(e=>/copies/.test(e.why))?`Repeated copies of the same object: use one "instances" object (or a generator) instead. `:``}Merge repeated meshes into an "instances" object, group static decoration into fewer meshes, reduce particle systems and post effects${v.shadowLights?`; every shadow-casting light re-draws each caster (castShadow: false on small / distant objects)`:``}.`})}e.triangles>C?n.push({severity:`warning`,code:`triangles`,path:_.byObject[0]?`objects#${_.byObject[0].id}`:`objects`,message:`The runtime renders ${e.triangles.toLocaleString(`en-US`)} triangles per frame, all passes included (limit ${C.toLocaleString(`en-US`)} for a ${i}; geometry estimate ~${_.total.toLocaleString(`en-US`)}).`,hint:`Heaviest: ${T}. Lower geometry segments / generator resolution or counts, use lighter models (decimate them); shadow-casting lights re-draw every caster (castShadow only where it shows).${np(v)}`}):e.triangles>w&&n.push({severity:`warning`,code:`triangles-aim`,path:_.byObject[0]?`objects#${_.byObject[0].id}`:`objects`,message:`The runtime renders ${e.triangles.toLocaleString(`en-US`)} triangles per frame (all passes), above the ~${w.toLocaleString(`en-US`)} to aim for on a ${i} (limit ${C.toLocaleString(`en-US`)}; estimate ${v.perFrame.toLocaleString(`en-US`)}: ${ee}).`,hint:`It works, but mid-range phones will struggle. Heaviest: ${T}.${np(v)}`});let a=ip(r);a.length>12?n.push({severity:`info`,code:`textures`,path:`objects`,message:`${a.length} texture files used by materials / the environment (${e.textures} GPU textures in all, including generated ones).`,hint:"Share textures between materials and prefer 1k maps for web embeds (`agent3d assets optimize --all`)."}):e.textures>24&&!a.length&&n.push({severity:`info`,code:`textures`,path:`objects`,message:`${e.textures} GPU textures, none from image files: they are generated (procedural textures, gradients, text / HUD canvases, shadow maps, post-processing targets) — no download.`,hint:`Nothing to do unless memory is tight: fewer procedural maps / post effects lower it.`}),e.fps!==void 0&&e.fps<30&&n.push({severity:`warning`,code:`fps`,path:`target`,message:`Measured ${Math.round(e.fps)} fps in the headless render.`,hint:`Headless rendering is slower than a real GPU, but simplify if it drops below ~20: fewer post effects, lower maxDpr, fewer shadows.`})}let E=Wf(r);n.push(...E.issues),r.ariaLabel||n.push({severity:`info`,code:`aria-label`,path:`ariaLabel`,message:`No ariaLabel: screen readers will announce the title "${r.title??``}".`,hint:`Set "ariaLabel" to a one-sentence description of what the animation shows.`});let te=!!r.timeline?.loop||op(r)||!!r.camera?.autoRotate;r.target?.reducedMotion===`ignore`&&te&&i!==`game`&&n.push({severity:`warning`,code:`reduced-motion`,path:`target.reducedMotion`,message:`reducedMotion "ignore" on a looping ${i}: visitors who asked for less motion will still see it move.`,hint:`Use "static" (freeze at posterTime) or "slow".`}),r.target?.lazy===!1&&i!==`fullscreen`&&i!==`game`&&n.push({severity:`info`,code:`lazy`,path:`target.lazy`,message:`lazy is off: the scene starts rendering before it is visible.`,hint:`Keep lazy: true (default) for embeds below the fold.`}),(r.target?.maxDpr??2)>2&&n.push({severity:`info`,code:`dpr`,path:`target.maxDpr`,message:`maxDpr ${r.target?.maxDpr} renders up to ${(r.target?.maxDpr??2)**2}× the pixels on retina screens.`,hint:`2 is plenty for web embeds; 1.5 for heavy scenes.`});let D={errors:0,warnings:0,infos:0};for(let e of n)D[e.severity===`error`?`errors`:e.severity===`warning`?`warnings`:`infos`]++;let O={error:0,warning:1,info:2};return n.sort((e,t)=>O[e.severity]-O[t.severity]),{ok:D.errors===0,issues:n,counts:D,budget:{estimatedTriangles:_.total,estimatedFrameTriangles:v.perFrame,passes:v.passes,triangleAim:w,...t.runtimeStats?{runtimeTriangles:t.runtimeStats.triangles}:{},triangles:t.runtimeStats?t.runtimeStats.triangles:v.perFrame,trianglesSource:t.runtimeStats?`runtime`:`estimate`,heaviestObjects:_.byObject.slice(0,5),assetsKb:Ni(s),scriptsKb:Ni(m),sceneKb:Ni(y),totalKb:x,budgetKb:b,runtimeKb:t.runtimeKb??0,gpu:E.gpu},licences:l}}function tp(e){let t=e.passes;return[`geometry ${t.main.toLocaleString(`en-US`)}`,...t.shadowMaps?[`shadow maps ${t.shadowMaps.toLocaleString(`en-US`)} (${e.shadowLights} light${e.shadowLights>1?`s`:``})`]:[],...t.prepass?[`ao / dof depth-normal pre-pass ${t.prepass.toLocaleString(`en-US`)}`]:[],...t.contactShadows?[`contact shadows ${t.contactShadows.toLocaleString(`en-US`)}`]:[]].join(` + `)}function np(e){let t=e.passes,n=[];return t.prepass&&n.push(`the ao / dof / godrays / outline post effect re-draws the whole scene once more (drop it, or keep it for heroes)`),t.shadowMaps&&n.push(`each shadow-casting light re-draws every caster (castShadow: false on text and small objects)`),t.contactShadows&&n.push(`contactShadows re-draws the casters from below`),n.length?` Passes: ${n.join(`; `)}.`:``}async function rp(e,t){let n=[],r=[];V(t.objects,e=>void(e.kind===`photo`&&r.push(e)));let i=async t=>{if(typeof t!=`string`||!t||Fa(t)||!await e.exists(t))return null;let n=await e.readBytes(t);return{bytes:n.byteLength,h:sd(n)}};for(let e of r){let t=`objects#${e.id}`,r=await i(e.src).catch(()=>null);r&&r.bytes>1572864&&n.push({severity:`warning`,code:`photo-heavy`,path:`${t}.src`,message:`Photo "${String(e.src)}" weighs ${Ni(r.bytes)} KB${r.h?` (${r.h.width}x${r.h.height})`:``}: slow to load on phones.`,hint:`Run \`agent3d assets optimize ${String(e.src)}\` (sized from how big the photo shows on screen, WebP; plan first, then --yes).`});let a=await i(e.depth).catch(()=>null);if(r?.h&&a?.h&&r.h.height>0&&a.h.height>0){let i=r.h.width/r.h.height,o=a.h.width/a.h.height;Math.abs(i-o)/i>.02&&n.push({severity:`warning`,code:`photo-depth-aspect`,path:`${t}.depth`,message:`Depth map "${String(e.depth)}" is ${a.h.width}x${a.h.height} but the photo is ${r.h.width}x${r.h.height}: different aspect ratios, the relief will not line up with the picture.`,hint:`Regenerate it from this image: \`agent3d assets depth ${String(e.src)}\` (or crop both the same way).`})}a?.h&&a.h.mimeType===`image/jpeg`&&n.push({severity:`info`,code:`photo-depth-lossy`,path:`${t}.depth`,message:`Depth map "${String(e.depth)}" is a JPEG: lossy compression adds steps and noise to the relief and drops the alpha cut-edge mask.`,hint:`Use a PNG depth map (\`agent3d assets depth ${String(e.src)}\` writes one).`})}return n}function ip(e){return[...new Set(Hc(e).filter(e=>e.kind===`texture`||e.kind===`hdri`).map(e=>e.path))]}function ap(e,t=0,n=!1){let r=1+t+ +!!n,i=new Set;for(let t of e.timeline?.tracks??[]){let e=String(t?.target??``);for(let t of e.split(`.`)[0].split(`,`)){let e=/^(.+)\/\d+$/.exec(t.trim());e&&i.add(e[1])}}let a=new Map,o=[];for(let t of e.objects??[]){let e=0,n=[];V([t],t=>{let r=t;if(r.kind===`text`){let a=String(r.text??``).replace(/\s/g,``).length,o=r.splitLetters===!0||!!r.reveal||i.has(t.id),s=r.outline?2:1;o?(e+=a*s,n.push(`"${t.id}" per-letter text (splitLetters / reveal), ${a} glyphs${s>1?` × outline`:``}`)):e+=s}else if(r.kind===`mesh`||r.kind===`instances`||r.kind===`particles`||r.kind===`svg`)e+=1;else if(r.kind===`photo`)e+=r.mode===`layers`&&r.depth?typeof r.layers==`number`?r.layers:6:1;else if(r.kind===`model`||r.kind===`generator`){e+=r.kind===`model`?4:2;let n=r.kind===`model`?`model:${String(r.src)}`:`generator:${String(r.generator)}:${JSON.stringify(r.params??{})}`;a.set(n,[...a.get(n)??[],t.id])}}),e&&o.push({id:t.id,drawCalls:e*r,why:n.join(`, `)||`meshes`})}for(let[e,t]of a){if(t.length<3)continue;let n=o.find(e=>e.id===t[0]),i=`${t.length} copies of ${e.split(`:`).slice(0,2).join(` `)} (${t.slice(0,4).join(`, `)}${t.length>4?`, …`:``})`;o.push({id:t[0],drawCalls:t.length*(e.startsWith(`model`)?4:2)*r,why:i}),n&&n.why===`meshes`&&(n.why=i)}return o.sort((e,t)=>t.drawCalls-e.drawCalls)}function op(e){let t=!1;return V(e.objects,e=>{e.behaviours?.length&&(t=!0)}),t||(e.lights??[]).some(e=>e.behaviours?.length)}function sp(e,t){let n=[],r=new Set;V(e.objects,e=>{e.visible===!1&&r.add(e.id)});let i=new Set,a=new Set,o=new Set(na.filter(e=>e.params.some(e=>e.name===`area`)).map(e=>e.id));V(e.objects,e=>{i.add(e.id);let t=e;(t.kind===`particles`||t.kind===`photo`||t.kind===`generator`&&t.generator&&o.has(t.generator))&&a.add(e.id)});let s=new Set,c=(e.camera?.shots?.length??0)>0,l=t=>{V(e.objects,e=>{e.tags?.includes(t)&&s.add(e.id)})},u=new Set,d=(e,t)=>{let n=Array.isArray(t)?t.find(e=>Array.isArray(e)):void 0;if(!Array.isArray(n)||typeof n[0]!=`number`||n[0]>1e-6)return!1;let r=n[1];return/^(material\.)?opacity$/.test(e)?r===0:e===`visible`?r===!1||r===0:/^scale$/.test(e)?r===0||Array.isArray(r)&&r.every(e=>e===0):!1};for(let t of e.timeline?.tracks??[]){let n=typeof t?.target==`string`?t.target:``,r=n.indexOf(`.`);if(r<1)continue;let i=n.slice(0,r),a=n.slice(r+1);if(i===`camera`){c=!0;continue}if(!/^(position|scale|rotation|visible|material\.opacity|opacity)/.test(a))continue;let o=[];if(i.startsWith(`tag:`)){let e=new Set(s);l(i.slice(4));for(let t of s)e.has(t)||o.push(t)}else if(i.startsWith(`children:`)){let t=i.slice(9);o.push(t),V(e.objects,e=>{if(e.id===t)for(let t of e.children??[])o.push(t.id)})}else for(let e of i.split(`,`))o.push(e.trim().replace(/\/\d+$/,``));for(let e of o)s.add(e);if(d(a,t.keys))for(let e of o)u.add(e)}let f=new Set((e.objects??[]).filter(e=>e.attach===`camera`).map(e=>e.id));for(let t of[...f])V(e.objects.find(e=>e.id===t)?.children??[],e=>void f.add(e.id));let p=t.objects.filter(e=>!r.has(e.id)&&i.has(e.id)&&!f.has(e.id)),m=`camera position ${JSON.stringify(t.camera.position)} looking at ${JSON.stringify(t.camera.target)}`;t.camera.insideObject&&n.push({severity:`warning`,code:`camera-inside`,path:`objects#${t.camera.insideObject}`,message:`The camera is inside "${t.camera.insideObject}" (${m}).`,hint:`Move camera.position outside its bounding box, or scale / move "${t.camera.insideObject}".`});for(let t of p){let r=t.max.map((e,n)=>Math.round((e-t.min[n])*100)/100),i=t.max.map((e,n)=>Math.round((e+t.min[n])/2*100)/100),o=Math.max(...r)>30,l=e.timeline?.trigger===`scroll`,d=l?`further down the page`:`later in the timeline`,f=l?"Check the other scroll states with `agent3d render --count 8` (or --scroll 0.5).":"Check later frames with `agent3d render --count 6` (or --frames …).";u.has(t.id)&&t.inView!==`none`?n.push({severity:`info`,code:`out-of-view-at-start`,path:`objects#${t.id}`,message:`"${t.id}" is hidden at the checked frame (t = 0): the timeline starts it transparent / invisible / at scale 0 and reveals it ${d}.`,hint:f}):t.inView===`none`&&l&&(c||s.has(t.id))?n.push({severity:`info`,code:`out-of-view-at-start`,path:`objects#${t.id}`,message:`"${t.id}" is outside the camera view at the checked frame (t = 0)${u.has(t.id)?` and hidden by the timeline`:``}; the ${l?`scroll-driven `:``}${s.has(t.id)?`timeline animates it`:`camera moves`}, so it may come into view ${d}.`,hint:f}):t.inView===`none`?n.push({severity:`warning`,code:`out-of-view`,path:`objects#${t.id}`,message:`"${t.id}" is completely outside the camera view (centre ${JSON.stringify(i)}, size ${JSON.stringify(r)}; ${m}).`,hint:`Move it toward camera.target, widen camera.fov / move the camera back, or set "visible": false if it is meant to enter later.${s.has(t.id)||c?" The timeline animates it: if it enters later on purpose, check later frames (`agent3d render --count 6`) and ignore this.":``}`}):t.inView===`partial`&&!o&&!a.has(t.id)&&n.push({severity:`info`,code:`clipped`,path:`objects#${t.id}`,message:`"${t.id}" is clipped by the frame edges (centre ${JSON.stringify(i)}, size ${JSON.stringify(r)}).`,hint:`If unintended, move it inward, scale it down or move the camera back. For wide banners, keep content within the central ~80% of the width.`})}let h=Math.min(1,p.reduce((e,t)=>e+(t.inView===`none`?0:t.screenCoverage),0));return p.length&&h<.05&&n.push({severity:`warning`,code:`too-small`,path:`camera`,message:`The objects cover only ${(h*100).toFixed(1)}% of the frame: the scene looks empty.`,hint:`Move camera.position closer to camera.target (or lower camera.fov), or scale the main objects up.`}),n}var cp=`agent3d-photo.js`,lp=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,up=e=>Array.isArray(e)?e.length>0:e!=null&&e!==!1;function dp(e){let t=[],n=(e,n)=>{e&&t.push(n)},r=e??{};n((r.target??{}).kind===`game`,`target.kind is game`),n(up(r.timeline),`timeline`),n(up(r.interactions),`interactions`),n(up(r.postfx),`post effects (postfx)`),n(up(r.physics),`physics`),n(up(r.scripts),`scripts`),n(r.ui?.elements?.length,`ui (HUD)`),n(up(r.audio),`audio`),n(/\{data\./.test(JSON.stringify(e??{})),`data bindings ({data.*} placeholders)`);let i=r.camera;!i||i.type!==`perspective`?t.push(`camera is not perspective`):(n(i.controls&&i.controls!==`none`,`camera.controls "${i.controls}"`),n(i.autoRotate,`camera.autoRotate`),n(up(i.shots),`camera.shots`),n(i.shake,`camera.shake`),n(i.lookAt,`camera.lookAt`),n(i.follow,`camera.follow`));let a=r.environment,o=a?.background;n(o!==void 0&&(typeof o!=`string`||o!==`transparent`&&!lp.test(o)),`environment.background is not a #hex colour or transparent`),n(a?.ground,`environment.ground`),n(a?.contactShadows,`environment.contactShadows`),n(a?.rig,`environment.rig (light rig)`);for(let e of r.lights??[])n(e.type===`rect`,`rect lights (visible panels)`),n(e.type===`spot`&&e.volumetric,`volumetric spot lights`);let s=r.objects??[];s.length!==1&&t.push(`${s.length} objects (the lite runtime shows exactly one photo)`);let c=s[0];if(c&&c.kind!==`photo`)t.push(`object "${c.id}" is a ${c.kind}, not a photo`);else if(c){let e=c;n(!!e.depth&&e.mode&&e.mode!==`parallax`,`photo mode "${e.mode}" (lite: parallax or a flat photo)`),n(up(e.children),`photo has children`),n(e.visible===!1,`photo is hidden`),n(up(e.behaviours),`photo behaviours`),n(e.body,`photo physics body`),n(e.href,`photo link (href)`),n(e.attach,`photo attached to the camera`),n(Array.isArray(e.rotation)&&e.rotation.some(e=>e!==0),`photo is rotated`);let t=e.scale;n(t!==void 0&&(typeof t==`number`?!(t>0):!Array.isArray(t)||!(t[0]>0&&t[1]>0)),`photo scale is not positive`),n(e.material?.color!==void 0&&!(typeof e.material.color==`string`&&lp.test(e.material.color)),`photo material.color is not a #hex colour`),n(typeof e.src!=`string`||!e.src,`photo has no src`)}return t.length?{ok:!1,reasons:t}:{ok:!0}}var fp=(e,t)=>{let n=e=>!!e?.some(e=>t.includes(e.kind)||n(e.children));return n(e.objects)},pp=e=>{let t=e=>!!e?.some(e=>!!e.body||t(e.children));return t(e.objects)},mp=e=>!!(e.scripts?.length||e.ui?.elements?.length||e.physics||e.audio||pp(e)),hp={postfx:{feature:`post effects (scene.postfx)`,needed:e=>!!e.postfx?.length},generators:{feature:`generators`,needed:e=>fp(e,[`generator`])},shaders:{feature:`shader materials / backgrounds`,needed:(e,t)=>/"shader"\s*:/.test(t)},OrbitControls:{feature:`orbit controls`,needed:(e,t)=>/"controls"\s*:\s*"orbit"/.test(t)},RectAreaLightUniformsLib:{feature:`rect lights (incl. light rigs)`,needed:(e,t)=>/"type"\s*:\s*"rect"/.test(t)||!!e.environment?.rig},Sky:{feature:`physical sky`,needed:(e,t)=>/"sky"\s*:/.test(t)},HDRLoader:{feature:`.hdr environment`,needed:(e,t)=>/\.hdr"/i.test(t)},EXRLoader:{feature:`.exr environment`,needed:(e,t)=>/\.exr"/i.test(t)},GroundedSkybox:{feature:`HDRI ground projection`,needed:(e,t)=>/"groundProjection"\s*:\s*(true|\{)/.test(t)},RoomEnvironment:{feature:`studio / soft image-based lighting`,needed:()=>!0},text:{feature:`3D text`,needed:e=>fp(e,[`text`])},svg:{feature:`SVG objects`,needed:e=>fp(e,[`svg`])},model:{feature:`glTF models`,needed:e=>fp(e,[`model`])},photo:{feature:`3D photos`,needed:e=>fp(e,[`photo`])},game:{feature:`scripts / HUD / physics / audio`,needed:e=>mp(e)},audio:{feature:`audio`,needed:e=>!!e.audio},physicsHost:{feature:`physics`,needed:e=>!!e.physics||pp(e)},GLTFLoader:{feature:`glTF models`,needed:e=>fp(e,[`model`])},SkeletonUtils:{feature:`glTF models`,needed:e=>fp(e,[`model`])},meshopt_decoder:{feature:`meshopt-compressed models`,needed:e=>fp(e,[`model`])},FontLoader:{feature:`3D text`,needed:e=>fp(e,[`text`])},SVGLoader:{feature:`SVG objects`,needed:e=>fp(e,[`svg`])},BufferGeometryUtils:{feature:`3D text / SVG`,needed:e=>fp(e,[`text`,`svg`])}};function gp(e){return e.slice(e.lastIndexOf(`/`)+1).replace(/\.js$/,``).replace(/-[A-Za-z0-9_-]{6,12}$/,``).replace(/\.module$/,``)}function _p(e,t){let n=[];for(let r of(e+t).split(`/`))r!==`.`&&r!==``&&(r===`..`?n.pop():n.push(r));return n.join(`/`)}function vp(e){let t=new TextDecoder,n=new Map;for(let[r,i]of Object.entries(e)){if(!r.endsWith(`.js`))continue;let a=t.decode(i),o=r.includes(`/`)?r.slice(0,r.lastIndexOf(`/`)+1):``,s=new Set,c=new Set;for(let e of a.matchAll(/\b(?:import|export)\s*(?:[^'"`();]*?\bfrom\s*)?["'](\.{1,2}\/[^"']+)["']/g))s.add(_p(o,e[1]));for(let e of a.matchAll(/\bimport\(\s*[`"'](\.{1,2}\/[^`"']+)[`"']\s*\)/g))c.add(_p(o,e[1]));for(let e of c)s.delete(e);n.set(r,{static:[...s].filter(t=>e[t]),dynamic:[...c].filter(t=>e[t])})}return n}function yp(e,t,n){let r=vp(e),i=JSON.stringify(n),a=new Set,o=new Set,s={},c=[t],l=e=>{a.has(e)||(a.add(e),c.push(e))},u=new Set([t]),d=[t];for(;d.length;)for(let e of r.get(d.pop())?.static??[])u.has(e)||(u.add(e),d.push(e));for(a.add(t);c.length;){let e=c.shift(),t=r.get(e);if(t){for(let e of t.static)l(e);for(let e of t.dynamic){if(u.has(e)){l(e);continue}let t=gp(e),r=hp[t];r?r.needed(n,i)&&(s[t]=r.feature,l(e)):(o.add(e),l(e))}}}let f=Object.keys(e).filter(e=>e.endsWith(`.js`)&&!e.endsWith(`.single.js`)&&e!==`agent3d-photo.js`);return{loaded:[...a],skipped:f.filter(e=>!a.has(e)),unknown:[...o],features:s}}async function bp(e,t){let n=new TextEncoder,r=0;for(let i of e){let e=typeof i==`string`?n.encode(i):i;if(t){r+=(await t(e)).byteLength;continue}if(typeof CompressionStream>`u`)return;let a=new Blob([e]).stream().pipeThrough(new CompressionStream(`gzip`));r+=(await new Response(a).arrayBuffer()).byteLength}return r}var xp=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function Sp(e){return`"use client";
|
|
54
|
+
// Agent3DScene.tsx — React (and Next.js) wrapper for the <agent3d-scene> Web Component.
|
|
55
|
+
// Generated by \`agent3d export\` for "${e.title}". No dependency besides React (>= 17).
|
|
56
|
+
//
|
|
57
|
+
// import { Agent3DScene } from "./Agent3DScene";
|
|
58
|
+
// <Agent3DScene src="${e.sceneSrc}" poster=${JSON.stringify(e.posterSrc??``)} aspect="${e.aspect}"
|
|
59
|
+
// data={{ ${e.dataKeys[0]?`${e.dataKeys[0]}: "…"`:`title: "…"`} }} onSceneEvent={(e) => console.log(e.name)} />
|
|
60
|
+
//
|
|
61
|
+
// Next.js: this file is a client component ("use client"); the runtime is loaded
|
|
62
|
+
// in the browser only (a <script type="module"> added once), so it is SSR-safe.
|
|
63
|
+
// Copy the export's agent3d-runtime/ and ${e.name}/ folders into public/.
|
|
64
|
+
import { createElement, useEffect, useRef, type CSSProperties } from "react";
|
|
65
|
+
|
|
66
|
+
export const AGENT3D_RUNTIME_SRC = ${JSON.stringify(e.runtimeSrc)};
|
|
67
|
+
|
|
68
|
+
export interface Agent3DPlayer {
|
|
69
|
+
play(): void;
|
|
70
|
+
pause(): void;
|
|
71
|
+
seek(t: number): Promise<void>;
|
|
72
|
+
time(): number;
|
|
73
|
+
snapshot(type?: "image/png" | "image/webp", quality?: number): string;
|
|
74
|
+
state(): Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface Agent3DSceneElement extends HTMLElement {
|
|
78
|
+
player: Agent3DPlayer | null;
|
|
79
|
+
ready: Promise<Agent3DPlayer>;
|
|
80
|
+
readonly data: Record<string, unknown>;
|
|
81
|
+
play(): void;
|
|
82
|
+
pause(): void;
|
|
83
|
+
seek(t: number): Promise<void>;
|
|
84
|
+
setData(values: Record<string, unknown>, opts?: { replace?: boolean }): Promise<void>;
|
|
85
|
+
trigger(name: string, payload?: unknown): void;
|
|
86
|
+
reload(): Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface Agent3DSceneProps {
|
|
90
|
+
src: string;
|
|
91
|
+
poster?: string;
|
|
92
|
+
aspect?: string;
|
|
93
|
+
alt?: string;
|
|
94
|
+
ariaLabel?: string;
|
|
95
|
+
// Values for {data.key} placeholders of the scene (texts, links) — applied live.
|
|
96
|
+
data?: Record<string, string | number | boolean>;
|
|
97
|
+
autoplay?: boolean;
|
|
98
|
+
paused?: boolean;
|
|
99
|
+
loop?: boolean | "pingpong";
|
|
100
|
+
quality?: "low" | "medium" | "high" | "auto";
|
|
101
|
+
interactive?: boolean;
|
|
102
|
+
runtimeSrc?: string;
|
|
103
|
+
className?: string;
|
|
104
|
+
style?: CSSProperties;
|
|
105
|
+
onReady?(el: Agent3DSceneElement): void;
|
|
106
|
+
onError?(issue: { code: string; message: string; path?: string }): void;
|
|
107
|
+
onSceneEvent?(e: { name: string; payload?: unknown }): void;
|
|
108
|
+
onSceneClick?(e: { id: string | null; x: number; y: number }): void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function loadRuntime(src: string): void {
|
|
112
|
+
if (typeof window === "undefined" || window.customElements?.get("agent3d-scene")) return;
|
|
113
|
+
const abs = new URL(src, document.baseURI).href;
|
|
114
|
+
if ([...document.querySelectorAll<HTMLScriptElement>("script[type=module]")].some((s) => s.src === abs)) return;
|
|
115
|
+
const s = document.createElement("script");
|
|
116
|
+
s.type = "module";
|
|
117
|
+
s.src = abs;${e.integrity?`\n if (src === AGENT3D_RUNTIME_SRC) s.integrity = ${JSON.stringify(e.integrity)};`:``}
|
|
118
|
+
document.head.appendChild(s);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function Agent3DScene(props: Agent3DSceneProps) {
|
|
122
|
+
const ref = useRef<Agent3DSceneElement | null>(null);
|
|
123
|
+
const handlers = useRef(props);
|
|
124
|
+
handlers.current = props;
|
|
125
|
+
const runtimeSrc = props.runtimeSrc ?? AGENT3D_RUNTIME_SRC;
|
|
126
|
+
|
|
127
|
+
useEffect(() => loadRuntime(runtimeSrc), [runtimeSrc]);
|
|
128
|
+
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
const el = ref.current;
|
|
131
|
+
if (!el) return;
|
|
132
|
+
const on = (type: string, fn: (detail: never) => void) => {
|
|
133
|
+
const l = (e: Event) => fn((e as CustomEvent).detail as never);
|
|
134
|
+
el.addEventListener(type, l);
|
|
135
|
+
return () => el.removeEventListener(type, l);
|
|
136
|
+
};
|
|
137
|
+
const offs = [
|
|
138
|
+
on("agent3d:ready", () => handlers.current.onReady?.(el)),
|
|
139
|
+
on("agent3d:error", (d) => handlers.current.onError?.(d)),
|
|
140
|
+
on("agent3d:event", (d) => handlers.current.onSceneEvent?.(d)),
|
|
141
|
+
on("agent3d:click", (d) => handlers.current.onSceneClick?.(d)),
|
|
142
|
+
];
|
|
143
|
+
return () => offs.forEach((off) => off());
|
|
144
|
+
}, []);
|
|
145
|
+
|
|
146
|
+
const dataJson = JSON.stringify(props.data ?? {});
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
const el = ref.current;
|
|
149
|
+
if (el && typeof el.setData === "function" && props.data) void el.setData(props.data);
|
|
150
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
151
|
+
}, [dataJson]);
|
|
152
|
+
|
|
153
|
+
const attrs: Record<string, unknown> = {
|
|
154
|
+
ref,
|
|
155
|
+
src: props.src,
|
|
156
|
+
poster: props.poster,
|
|
157
|
+
aspect: props.aspect,
|
|
158
|
+
alt: props.alt,
|
|
159
|
+
"aria-label": props.ariaLabel,
|
|
160
|
+
class: props.className,
|
|
161
|
+
style: props.style,
|
|
162
|
+
autoplay: props.autoplay === false ? "false" : undefined,
|
|
163
|
+
paused: props.paused ? "" : undefined,
|
|
164
|
+
loop: props.loop === undefined ? undefined : String(props.loop),
|
|
165
|
+
quality: props.quality,
|
|
166
|
+
interactive: props.interactive === false ? "false" : undefined,
|
|
167
|
+
};
|
|
168
|
+
// Initial data as data-* attributes (bound before the first frame, SSR-friendly).
|
|
169
|
+
for (const [k, v] of Object.entries(props.data ?? {})) attrs[\`data-\${k.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase())}\`] = String(v);
|
|
170
|
+
return createElement("agent3d-scene", attrs);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export default Agent3DScene;
|
|
174
|
+
`}function Cp(e){return`<!--
|
|
175
|
+
Agent3DScene.vue — Vue 3 wrapper for the <agent3d-scene> Web Component (generated by agent3d export).
|
|
176
|
+
Tell Vue it is a custom element (vite.config: vue({ template: { compilerOptions: { isCustomElement: (t) => t === "agent3d-scene" } } })
|
|
177
|
+
or Nuxt: vue.compilerOptions.isCustomElement), then:
|
|
178
|
+
<Agent3DScene src="${e.sceneSrc}" aspect="${e.aspect}" :data="{ ${e.dataKeys[0]??`title`}: '…' }" @scene-event="(e) => …" />
|
|
179
|
+
Nuxt: wrap it in <ClientOnly>.
|
|
180
|
+
-->
|
|
181
|
+
<script setup lang="ts">
|
|
182
|
+
import { onMounted, ref, watch } from "vue";
|
|
183
|
+
|
|
184
|
+
const props = defineProps<{
|
|
185
|
+
src: string;
|
|
186
|
+
poster?: string;
|
|
187
|
+
aspect?: string;
|
|
188
|
+
alt?: string;
|
|
189
|
+
data?: Record<string, string | number | boolean>;
|
|
190
|
+
autoplay?: boolean;
|
|
191
|
+
paused?: boolean;
|
|
192
|
+
loop?: boolean | "pingpong";
|
|
193
|
+
quality?: "low" | "medium" | "high" | "auto";
|
|
194
|
+
interactive?: boolean;
|
|
195
|
+
runtimeSrc?: string;
|
|
196
|
+
}>();
|
|
197
|
+
const emit = defineEmits<{ ready: [el: HTMLElement]; error: [issue: unknown]; sceneEvent: [e: { name: string; payload?: unknown }]; sceneClick: [e: { id: string | null }] }>();
|
|
198
|
+
const el = ref<HTMLElement & { setData?: (d: Record<string, unknown>) => Promise<void> }>();
|
|
199
|
+
|
|
200
|
+
onMounted(() => {
|
|
201
|
+
if (!customElements.get("agent3d-scene")) {
|
|
202
|
+
const s = document.createElement("script");
|
|
203
|
+
s.type = "module";
|
|
204
|
+
s.src = props.runtimeSrc ?? ${JSON.stringify(e.runtimeSrc)};
|
|
205
|
+
document.head.appendChild(s);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
watch(() => JSON.stringify(props.data ?? {}), () => props.data && el.value?.setData?.(props.data));
|
|
209
|
+
<\/script>
|
|
210
|
+
|
|
211
|
+
<template>
|
|
212
|
+
<agent3d-scene
|
|
213
|
+
ref="el"
|
|
214
|
+
:src="src"
|
|
215
|
+
:poster="poster"
|
|
216
|
+
:aspect="aspect"
|
|
217
|
+
:alt="alt"
|
|
218
|
+
:autoplay="autoplay === false ? 'false' : undefined"
|
|
219
|
+
:paused="paused ? '' : undefined"
|
|
220
|
+
:loop="loop === undefined ? undefined : String(loop)"
|
|
221
|
+
:quality="quality"
|
|
222
|
+
:interactive="interactive === false ? 'false' : undefined"
|
|
223
|
+
v-bind="Object.fromEntries(Object.entries(data ?? {}).map(([k, v]) => ['data-' + k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()), String(v)]))"
|
|
224
|
+
@agent3d:ready="emit('ready', $event.target)"
|
|
225
|
+
@agent3d:error="emit('error', $event.detail)"
|
|
226
|
+
@agent3d:event="emit('sceneEvent', $event.detail)"
|
|
227
|
+
@agent3d:click="emit('sceneClick', $event.detail)"
|
|
228
|
+
/>
|
|
229
|
+
</template>
|
|
230
|
+
`}function wp(e){return`<!--
|
|
231
|
+
Agent3DScene.svelte — Svelte wrapper for the <agent3d-scene> Web Component (generated by agent3d export).
|
|
232
|
+
<Agent3DScene src="${e.sceneSrc}" aspect="${e.aspect}" data={{ ${e.dataKeys[0]??`title`}: "…" }} on:sceneevent={(e) => …} />
|
|
233
|
+
SvelteKit: the runtime loads in onMount (browser only), so SSR is fine.
|
|
234
|
+
-->
|
|
235
|
+
<script>
|
|
236
|
+
import { onMount, createEventDispatcher } from "svelte";
|
|
237
|
+
export let src;
|
|
238
|
+
export let poster = undefined;
|
|
239
|
+
export let aspect = ${JSON.stringify(e.aspect)};
|
|
240
|
+
export let alt = undefined;
|
|
241
|
+
export let data = undefined;
|
|
242
|
+
export let autoplay = undefined;
|
|
243
|
+
export let paused = false;
|
|
244
|
+
export let loop = undefined;
|
|
245
|
+
export let quality = undefined;
|
|
246
|
+
export let interactive = undefined;
|
|
247
|
+
export let runtimeSrc = ${JSON.stringify(e.runtimeSrc)};
|
|
248
|
+
const dispatch = createEventDispatcher();
|
|
249
|
+
let el;
|
|
250
|
+
onMount(() => {
|
|
251
|
+
if (!customElements.get("agent3d-scene")) {
|
|
252
|
+
const s = document.createElement("script");
|
|
253
|
+
s.type = "module";
|
|
254
|
+
s.src = runtimeSrc;
|
|
255
|
+
document.head.appendChild(s);
|
|
256
|
+
}
|
|
257
|
+
const fwd = (type, name) => { const l = (e) => dispatch(name, e.detail); el.addEventListener(type, l); return () => el.removeEventListener(type, l); };
|
|
258
|
+
const offs = [fwd("agent3d:ready", "ready"), fwd("agent3d:error", "error"), fwd("agent3d:event", "sceneevent"), fwd("agent3d:click", "sceneclick")];
|
|
259
|
+
return () => offs.forEach((off) => off());
|
|
260
|
+
});
|
|
261
|
+
$: if (el && data && el.setData) el.setData(data);
|
|
262
|
+
<\/script>
|
|
263
|
+
|
|
264
|
+
<agent3d-scene bind:this={el} {src} {poster} {aspect} {alt} {quality} autoplay={autoplay === false ? "false" : undefined} paused={paused ? "" : undefined} loop={loop === undefined ? undefined : String(loop)} interactive={interactive === false ? "false" : undefined}></agent3d-scene>
|
|
265
|
+
`}var Tp=`// agent3d-scene.d.ts — types of the <agent3d-scene> element (generated by agent3d export).
|
|
266
|
+
export interface Agent3DSceneElement extends HTMLElement {
|
|
267
|
+
player: { play(): void; pause(): void; seek(t: number): Promise<void>; time(): number; snapshot(type?: string, quality?: number): string; state(): Record<string, unknown> } | null;
|
|
268
|
+
ready: Promise<NonNullable<Agent3DSceneElement["player"]>>;
|
|
269
|
+
readonly data: Record<string, unknown>;
|
|
270
|
+
play(): void;
|
|
271
|
+
pause(): void;
|
|
272
|
+
seek(t: number): Promise<void>;
|
|
273
|
+
setData(values: Record<string, unknown>, opts?: { replace?: boolean }): Promise<void>;
|
|
274
|
+
trigger(name: string, payload?: unknown): void;
|
|
275
|
+
reload(): Promise<void>;
|
|
276
|
+
}
|
|
277
|
+
export interface Agent3DSceneEventMap {
|
|
278
|
+
"agent3d:ready": CustomEvent<{ player: NonNullable<Agent3DSceneElement["player"]> }>;
|
|
279
|
+
"agent3d:error": CustomEvent<{ code: string; message: string; path?: string }>;
|
|
280
|
+
"agent3d:event": CustomEvent<{ name: string; payload?: unknown }>;
|
|
281
|
+
"agent3d:click": CustomEvent<{ id: string | null; x: number; y: number }>;
|
|
282
|
+
"agent3d:progress": CustomEvent<{ loaded: number; total: number }>;
|
|
283
|
+
}
|
|
284
|
+
declare global {
|
|
285
|
+
interface HTMLElementTagNameMap {
|
|
286
|
+
"agent3d-scene": Agent3DSceneElement;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
`;function Ep(e){let t=e.dataKeys.length?e.dataKeys.map(e=>`data-${xp(e)}="…"`).join(` `):`data-title="…"`;return`# ${e.title} — how to put it on your website
|
|
290
|
+
|
|
291
|
+
This folder is a self-contained 3D element: no server code, no account, no
|
|
292
|
+
third-party requests. Upload it as-is to any static host or CMS file area.
|
|
293
|
+
|
|
294
|
+
\`\`\`
|
|
295
|
+
agent3d-runtime/ the player (shared by every Agent3D scene on the site)
|
|
296
|
+
${e.name}/ the scene (scene.json, assets, poster${e.hasScripts?`, scripts`:``})
|
|
297
|
+
index.html a demo page
|
|
298
|
+
snippet.html the code to paste
|
|
299
|
+
frameworks/ React / Next.js, Vue and Svelte wrappers + TypeScript types
|
|
300
|
+
\`\`\`
|
|
301
|
+
|
|
302
|
+
## 1. Paste the snippet
|
|
303
|
+
|
|
304
|
+
\`\`\`html
|
|
305
|
+
${e.snippet}
|
|
306
|
+
\`\`\`
|
|
307
|
+
|
|
308
|
+
The paths are relative to the page that includes the snippet. If the page lives
|
|
309
|
+
elsewhere (e.g. \`/blog/post/\`), either upload the folders next to it or
|
|
310
|
+
re-export with \`agent3d export --base-url /assets/3d/\` (absolute URLs).
|
|
311
|
+
The \`<img slot="poster">\` inside the element is shown before the runtime has
|
|
312
|
+
loaded, without JavaScript, without WebGL and when printing — keep it.
|
|
313
|
+
|
|
314
|
+
## 2. Platforms
|
|
315
|
+
|
|
316
|
+
- **Plain HTML / static sites** (Netlify, Vercel, GitHub Pages, Cloudflare Pages, S3): upload the folder, paste the snippet.
|
|
317
|
+
- **WordPress**: upload the two folders to \`wp-content/uploads/agent3d/\` (SFTP or a file-manager plugin),
|
|
318
|
+
re-export with \`--base-url /wp-content/uploads/agent3d/\`, then add a **Custom HTML** block with the snippet.
|
|
319
|
+
(Media Library uploads rename files: use SFTP for the folders.)
|
|
320
|
+
- **Webflow**: host the folders on your own static host / CDN (Webflow cannot host .js / .json files),
|
|
321
|
+
export with \`--base-url https://your-cdn.example/3d/\`, then paste the snippet in an **Embed** element.
|
|
322
|
+
- **Shopify**: upload the files to *Content → Files* is not folder-aware — host the folders on a static host,
|
|
323
|
+
export with \`--base-url\`, and paste the snippet in a **Custom Liquid** section.
|
|
324
|
+
- **Squarespace / Wix / Framer / Google Sites**: their embed boxes run in an iframe. Use the
|
|
325
|
+
single-file export (\`agent3d export --format single-html\`), host that one file and embed it with
|
|
326
|
+
\`<iframe src="…/${e.name}.html" style="width:100%;aspect-ratio:${e.aspect.replace(`:`,`/`)};border:0" title="${e.title}" loading="lazy"></iframe>\`.
|
|
327
|
+
- **AgentCMS**: use the "Agent3D scene" editor block (integrations/agentcms).
|
|
328
|
+
|
|
329
|
+
## 3. Frameworks
|
|
330
|
+
|
|
331
|
+
- **React / Next.js**: \`frameworks/react/Agent3DScene.tsx\` (client component, SSR-safe). Put the
|
|
332
|
+
folders in \`public/\` and render \`<Agent3DScene src="${e.sceneSrc}" aspect="${e.aspect}" />\`.
|
|
333
|
+
- **Vue / Nuxt**: \`frameworks/vue/Agent3DScene.vue\` — declare \`agent3d-scene\` as a custom element
|
|
334
|
+
(\`compilerOptions.isCustomElement\`); in Nuxt wrap it in \`<ClientOnly>\`.
|
|
335
|
+
- **Svelte / SvelteKit**: \`frameworks/svelte/Agent3DScene.svelte\`.
|
|
336
|
+
- **Angular**: add \`CUSTOM_ELEMENTS_SCHEMA\` to the component and use the snippet.
|
|
337
|
+
- Types: \`frameworks/agent3d-scene.d.ts\`.
|
|
338
|
+
|
|
339
|
+
## 4. Personalise it (data bindings)
|
|
340
|
+
|
|
341
|
+
Texts and links of the scene written as \`{data.key}\` take their value from \`data-*\`
|
|
342
|
+
attributes or from JavaScript — no re-export needed:
|
|
343
|
+
|
|
344
|
+
\`\`\`html
|
|
345
|
+
<agent3d-scene src="${e.sceneSrc}" ${t}></agent3d-scene>
|
|
346
|
+
<script>document.querySelector("agent3d-scene").setData({ ${e.dataKeys[0]??`title`}: "Winter sale" });<\/script>
|
|
347
|
+
\`\`\`
|
|
348
|
+
${e.dataKeys.length?`\nThis scene's data keys: ${e.dataKeys.map(e=>`\`${e}\``).join(`, `)}.\n`:``}
|
|
349
|
+
## 5. Attributes, JavaScript API, events
|
|
350
|
+
|
|
351
|
+
| Attribute | |
|
|
352
|
+
|---|---|
|
|
353
|
+
| \`src\` | scene.json URL |
|
|
354
|
+
| \`poster\` / \`<img slot="poster">\` | still image before the first frame / fallback |
|
|
355
|
+
| \`aspect\` | "W:H" reserved before the scene loads (no layout shift) |
|
|
356
|
+
| \`autoplay="false"\`, \`paused\` | start paused / pause while present |
|
|
357
|
+
| \`loop="true\\|false\\|pingpong"\` | override the timeline loop |
|
|
358
|
+
| \`quality="low\\|medium\\|high\\|auto"\` | pixel-ratio cap (low also drops antialiasing, shadows, post effects) |
|
|
359
|
+
| \`interactive="false"\` | let clicks and scrolling pass through |
|
|
360
|
+
| \`data-*\` | data bindings (above) |
|
|
361
|
+
|
|
362
|
+
\`\`\`js
|
|
363
|
+
const el = document.querySelector("agent3d-scene");
|
|
364
|
+
await el.ready; // the player, once the first frame is drawn
|
|
365
|
+
el.pause(); el.play(); await el.seek(2.5);
|
|
366
|
+
el.trigger("start"); // event for the scene's scripts
|
|
367
|
+
el.addEventListener("agent3d:click", (e) => console.log(e.detail.id)); // object clicked
|
|
368
|
+
el.addEventListener("agent3d:event", (e) => console.log(e.detail.name)); // script / UI events
|
|
369
|
+
el.addEventListener("agent3d:error", (e) => console.warn(e.detail));
|
|
370
|
+
\`\`\`
|
|
371
|
+
|
|
372
|
+
Styling: \`agent3d-scene::part(poster)\`, \`::part(loading)\`, \`::part(loading-bar)\`, \`::part(fallback)\`,
|
|
373
|
+
\`--agent3d-background\`, \`--agent3d-loading-color\`, \`--agent3d-poster-fit\`, \`--agent3d-fade\`.
|
|
374
|
+
The element carries \`status="loading|ready|error|unsupported"\`.
|
|
375
|
+
|
|
376
|
+
## 6. Performance & behaviour
|
|
377
|
+
|
|
378
|
+
- Starts when scrolled into view, pauses off-screen and in background tabs, honours
|
|
379
|
+
\`prefers-reduced-motion\` (shows a still frame), caps the pixel ratio, gives its WebGL
|
|
380
|
+
context back when far off-screen, recovers from a lost GPU context.
|
|
381
|
+
- Several scenes on a page share one runtime (load the script once).
|
|
382
|
+
- Cache: \`agent3d-runtime/\` can be cached for a long time (\`Cache-Control: max-age=31536000, immutable\`)
|
|
383
|
+
when exported with \`--cache-bust\` (versioned folder name).
|
|
384
|
+
|
|
385
|
+
## 7. Content-Security-Policy
|
|
386
|
+
|
|
387
|
+
The runtime needs no \`unsafe-eval\` and no inline script:
|
|
388
|
+
|
|
389
|
+
\`\`\`
|
|
390
|
+
script-src 'self'; img-src 'self' data: blob:; connect-src 'self' data: blob:; worker-src 'self' blob:; style-src 'self' 'unsafe-inline'
|
|
391
|
+
\`\`\`
|
|
392
|
+
|
|
393
|
+
(\`style-src 'unsafe-inline'\` is only needed by scenes with a HUD; \`blob:\` / \`data:\` for textures
|
|
394
|
+
decoded in the browser; add \`'wasm-unsafe-eval'\` to script-src for meshopt-compressed models (\`export --optimize\`). Scenes with scripts load them as modules from \`${e.name}/scripts/\`.
|
|
395
|
+
Hosting on another origin: add it to script-src / connect-src / img-src and serve with CORS.)${e.integrity?`\nThe snippet pins the runtime with Subresource Integrity (\`integrity="${e.integrity}"\`): re-copy the snippet after updating the runtime.`:``}
|
|
396
|
+
${e.ogImage?`\n## 8. Social preview\n\n\`${e.ogImage}\` is a 1200×630 render for link previews:\n\n\`\`\`html\n<meta property="og:image" content="https://your-site.example/${e.ogImage}">\n<meta name="twitter:card" content="summary_large_image">\n\`\`\`\n`:``}${e.credits.length?`\n## Credits\n\n${e.credits.map(e=>`- ${e}`).join(`
|
|
397
|
+
`)}\n`:``}
|
|
398
|
+
---
|
|
399
|
+
Made with Agent3D${e.version?` ${e.version}`:``}.
|
|
400
|
+
`}var Dp=new TextEncoder,Op=e=>typeof e==`string`?Dp.encode(e).byteLength:e.byteLength,kp=5242880,Ap=102400;function jp(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function Mp(e){return JSON.stringify(e).replace(/</g,`\\u003c`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}function Np(e){return e.replace(/<\/(script)/gi,`<\\/$1`).replace(/<!--/g,`<\\!--`)}function Pp(e){return e[0]===137&&e[1]===80?{ext:`png`,mime:`image/png`}:e[0]===255&&e[1]===216?{ext:`jpg`,mime:`image/jpeg`}:{ext:`webp`,mime:`image/webp`}}function Fp(e,t){let n=Object.keys(e?.files??{}),r=n.filter(e=>/\.m?js$/.test(e)),i=t===`single-html`?r.find(e=>e.endsWith(`.single.js`))??(r.length===1?r[0]:void 0):r.find(e=>e===`agent3d-runtime.js`)??r.find(e=>!e.includes(`/`)&&!e.endsWith(`.single.js`));if(!i)throw new A(`invalid`,`No ${t===`single-html`?`single-file runtime (agent3d-runtime.single.js)`:`runtime entry (agent3d-runtime.js)`} in the runtime files (${n.slice(0,5).join(`, `)||`none`}).`,`Build the runtime first (npm run build:runtime) — the front door passes dist/runtime/.`);return i}function Ip(e){let t=(e??``).trim();if(!t||t===`.`||t===`./`)return`./`;if(/^(javascript|data|vbscript):/i.test(t)||/["'<>\s]/.test(t))throw new A(`invalid`,`Invalid base URL "${e}".`,`Use a path ("/static/3d/"), a relative path ("../3d/") or an https URL ("https://cdn.example.com/3d/").`);return t.endsWith(`/`)?t:`${t}/`}async function Lp(e,t){let n=t.reduce((e,t)=>e+t.byteLength,0),r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.byteLength;let a=globalThis.crypto?.subtle;if(!a)throw new A(`invalid`,`WebCrypto is not available to hash the runtime.`,`Use Node ≥ 20 or a modern browser, or export with integrity: false.`);return new Uint8Array(await a.digest(e,r))}async function Rp(e){let t=await Lp(`SHA-384`,[e]),n=``;for(let e of t)n+=String.fromCharCode(e);return`sha384-${btoa(n)}`}async function zp(e){return[...(await Lp(`SHA-256`,e)).slice(0,5)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function Bp(e,t){let n=new TextDecoder,r=new Set,i=[],a=t=>{let o=e[t];if(!o)return;let s=n.decode(o),c=t.includes(`/`)?t.slice(0,t.lastIndexOf(`/`)+1):``;for(let t of s.matchAll(/\b(?:import|export)\s*(?:[^'"();]*?\bfrom\s*)?["'](\.{1,2}\/[^"']+)["']/g)){let n=Vp(c,t[1]);!r.has(n)&&e[n]&&(r.add(n),i.push(n),a(n))}};return a(t),i}function Vp(e,t){let n=(e+t).split(`/`),r=[];for(let e of n)e!==`.`&&e!==``&&(e===`..`?r.pop():r.push(e));return r.join(`/`)}function Hp(e){let t=e.size?` width="${Math.round(e.size.width)}" height="${Math.round(e.size.height)}"`:``,n=e.priority?` fetchpriority="high"`:``,r=r=>`<img${r?` slot="poster"`:``} src="${jp(e.src)}" alt="${jp(e.alt)}"${t}${n} decoding="async" style="display:block;width:100%;height:auto">`;return e.avif?`<picture slot="poster"><source type="image/avif" srcset="${jp(e.avif)}">${r(!1)}</picture>`:r(!0)}async function Up(e,t){let n=t??(typeof CompressionStream<`u`?async e=>new Uint8Array(await new Response(new Blob([e]).stream().pipeThrough(new CompressionStream(`deflate-raw`))).arrayBuffer()):void 0),r=[],i=[],a=0,o=(e,t)=>{let n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e>>>8*r&255;return n},s=(...e)=>{let t=new Uint8Array(e.reduce((e,t)=>e+t.byteLength,0)),n=0;for(let r of e)t.set(r,n),n+=r.byteLength;return t};for(let[t,c]of Object.entries(e)){let e=typeof c==`string`?Dp.encode(c):c,l=Dp.encode(t),u=nl(e),d=0,f=e;if(n&&e.byteLength>64){let t=await n(e);t.byteLength<e.byteLength&&(d=8,f=t)}let p=s(o(20,2),o(2048,2),o(d,2),o(0,2),o(33,2),o(u,4),o(f.byteLength,4),o(e.byteLength,4),o(l.byteLength,2),o(0,2)),m=s(o(67324752,4),p,l);i.push(s(o(33639248,4),o(20,2),p,o(0,2),o(0,2),o(0,2),o(0,4),o(a,4),l)),r.push(m,f),a+=m.byteLength+f.byteLength}let c=s(...i),l=s(o(101010256,4),o(0,2),o(0,2),o(i.length,2),o(i.length,2),o(c.byteLength,4),o(a,4),o(0,2));return s(...r,c,l)}async function Wp(e,t){let n=t.format??`embed`;if(n!==`embed`&&n!==`single-html`&&n!==`zip`)throw new A(`invalid`,`Unknown export format "${String(n)}".`,`Use "embed" (folder for a static site), "zip" (the same folder as one .zip) or "single-html" (one self-contained file). Poster/video exports are done by the CLI renderer.`);let r=Ip(t.baseUrl),i=await Nc(e),a=Ps(i).filter(e=>e.severity!==`info`);if(Oi(a))throw Di(`Cannot export an invalid scene:`,a,`Run check / scene_validate and fix the errors first.`);let o=await Mi(e,Tc,null),s=Ri(t.name??o?.name??i.id??`scene`,`scene`),c=t.runtimeChoice??`auto`;if(c!==`auto`&&c!==`full`)throw new A(`invalid`,`Unknown runtime "${String(c)}".`,`Use "auto" (the photo-only lite runtime when the scene is a single 3D photo) or "full".`);let l=dp(i),u=!!t.runtime?.files?.[cp],d=c===`full`?[`runtime: full was requested`]:l.ok?u?void 0:[`the runtime files have no ${cp} (rebuild the runtime: npm run build:runtime)`]:l.reasons,f=!d,p=f?cp:Fp(t.runtime,n===`single-html`?`single-html`:`embed`),m=await kd(e),h=new Map(m.assets.map(e=>[e.path,e])),g=Cf(i),_=new Map,v=[],y=[],b=new Map,x=[],S=new Set;if(Vc(g,(n,r)=>{if(Fa(n)){let e=Ia(n),i=La(t.library?.index,e);if(!i){x.push(`${r}: unknown library asset "${e}"`);return}let a=i.path.includes(`.`)?i.path.slice(i.path.lastIndexOf(`.`)):``,o=`assets/library/${e.endsWith(a)?e:e+a}`;return b.has(e)||(b.set(e,o),y.push((async()=>{_.set(o,await t.library.read(e))})()),v.push({path:o,license:i.license,author:i.author,source:`Agent3D library`,...i.attribution?{attribution:i.attribution}:{}})),o}if(!S.has(n)){S.add(n),y.push((async()=>{if(!await e.exists(n)){x.push(`${r}: "${n}" does not exist`);return}let t=await e.readBytes(n);if(_.set(n,t),n.toLowerCase().endsWith(`.gltf`))for(let i of Gc(n,new TextDecoder().decode(t)))await e.exists(i)?_.set(i,await e.readBytes(i)):x.push(`${r}: "${n}" needs "${i}"`)})());let t=h.get(n);v.push(t?{path:n,license:t.license,author:t.author,source:t.sourceUrl??t.source,...t.attribution?{attribution:t.attribution}:{}}:{path:n,license:`unknown`})}}),await Promise.all(y),x.length)throw new A(`notFound`,`Missing assets: ${x.slice(0,5).join(`; `)}${x.length>5?`; …`:``}`,`Run check to list missing files, add them (assets_add) or fix the paths.`,{missing:x});let C=new Map;for(let t of g.scripts??[]){if(!await e.exists(t))throw new A(`notFound`,`Script "${t}" does not exist.`,`Create it or remove it from scene.scripts.`);C.set(t,await e.readText(t))}let w=g.target?.kind??`banner`,T=g.target?.budgetKb??Yo[w]??600,ee=`${JSON.stringify(g,null,2)}\n`,E=[..._.values()].reduce((e,t)=>e+t.byteLength,0),te=[...C.values()].reduce((e,t)=>e+Op(t),0),D=t.poster?.byteLength??0,O={},ne=[...a],re=sf(g.title??``,g.data).trim()||s,ie=g.ariaLabel===void 0?re:sf(g.ariaLabel,g.data).trim()||re,ae=Vi(g.target?.aspect)??{width:16,height:9,ratio:16/9},oe=g.target?.height?`height:${g.target.height}`:`aspect-ratio:${ae.width} / ${ae.height}`,se,ce,le=0,ue,de=null,fe=!1,pe,me;if(n===`embed`||n===`zip`){let e=Object.entries(t.runtime.files).filter(([e])=>!e.endsWith(`.single.js`));de=f?{loaded:[cp],skipped:[],unknown:[],features:{}}:yp(Object.fromEntries(e.filter(([e])=>e!==cp)),p,g),fe=!!t.pruneRuntime&&!de.unknown.length,t.pruneRuntime&&de.unknown.length&&ne.push({severity:`info`,code:`prune-runtime`,path:`runtime`,message:`Kept every runtime chunk: ${de.unknown.join(`, `)} ${de.unknown.length>1?`have`:`has`} no known feature.`,hint:`Nothing to do — the export works; report it so the chunk gets mapped (src/ops/runtimeChunks.ts).`});let i=new Set(de.loaded),a=fe?e.filter(([e])=>i.has(e)||!e.endsWith(`.js`)):e;ue=t.cacheBust?`agent3d-runtime-${await zp(a.map(([e,t])=>[Dp.encode(e),t]).flat())}`:`agent3d-runtime`;for(let[e,t]of a)O[`${ue}/${e}`]=t,le+=t.byteLength;O[`${s}/scene.json`]=ee;for(let[e,t]of _)O[`${s}/${e}`]=t;for(let[e,t]of C)O[`${s}/${e}`]=t;let o=e=>`${r}${e}`,c;if(t.poster){let{ext:e}=Pp(t.poster);c=`${s}/poster.${e}`,O[c]=t.poster,t.posterAvif&&(O[`${s}/poster.avif`]=t.posterAvif)}let l;t.ogImage&&(l=`${s}/og-image.png`,O[l]=t.ogImage);let u=t.runtime.files[p],d=t.integrity!==!1;pe=d?await Rp(u):void 0;let m=e=>d?Rp(e).then(e=>` integrity="${e}"`):Promise.resolve(``),h=[],y=[];for(let e of Bp(t.runtime.files,p)){let n=`<link rel="modulepreload" href="${o(`${ue}/${e}`)}"${await m(t.runtime.files[e])}>`;y.push(n),t.runtime.files[e].byteLength>=Ap&&h.push(n)}me=y.join(`
|
|
401
|
+
`);let b=t.cacheBust?`?v=${await zp([Dp.encode(ee),..._.values()])}`:``,x=g.target?.height?``:` aspect="${ae.width}:${ae.height}"`,S=t.cacheBust&&t.poster?`?v=${await zp([t.poster,...t.posterAvif?[t.posterAvif]:[]])}`:``,T=c?Hp({src:o(c)+S,avif:t.posterAvif?o(`${s}/poster.avif`)+S:void 0,alt:ie,size:t.posterSize,priority:w===`hero`||w===`fullscreen`}):``;if(se=[...h,`<script type="module" src="${o(`${ue}/${p}`)}"${pe?` integrity="${pe}"`:``}><\/script>`,`<agent3d-scene src="${o(`${s}/scene.json`)}${b}"${x} role="${w===`game`?`application`:`img`}" aria-label="${jp(ie)}">${T?`\n ${T}\n`:``}</agent3d-scene>`].join(`
|
|
402
|
+
`),O[`snippet.html`]=`${se}\n`,me&&(O[`head.html`]=`<!-- Optional: in the <head> of pages showing Agent3D scenes (preloads the runtime's modules). -->\n${me}\n`),v.length&&(O[`${s}/CREDITS.txt`]=Kp(re,v)),O[`index.html`]=Yp({title:re,description:g.description===void 0?void 0:sf(g.description,g.data),snippet:se,credits:v,sizeStyle:oe,poster:c?o(c):void 0,ogImage:l?r===`./`?`./${l}`:o(l):void 0}),t.extras!==!1){let e={name:s,title:re,runtimeSrc:o(`${ue}/${p}`),sceneSrc:o(`${s}/scene.json`),posterSrc:c?o(c)+S:void 0,aspect:`${ae.width}:${ae.height}`,snippet:se,dataKeys:Object.keys(g.data??{}).filter(e=>/^[a-zA-Z][\w]*$/.test(e)),integrity:pe,ogImage:l,hasScripts:C.size>0,credits:v.filter(e=>!/^(cc0|public)/i.test(e.license)).map(Gp),version:t.version};O[`EMBED.md`]=Ep(e),O[`frameworks/react/Agent3DScene.tsx`]=Sp(e),O[`frameworks/vue/Agent3DScene.vue`]=Cp(e),O[`frameworks/svelte/Agent3DScene.svelte`]=wp(e),O[`frameworks/agent3d-scene.d.ts`]=Tp}if(ce=`index.html`,n===`zip`){let e=`${s}-embed.zip`,n=await Up(O,t.deflate);for(let e of Object.keys(O))delete O[e];O[e]=n,ce=e}}else{let e=new TextDecoder().decode(t.runtime.files[p]);le=t.runtime.files[p].byteLength;let n={};for(let[e,t]of _)n[e]=kf(t,Wc(e));let r=Object.fromEntries(C),i=t.poster?` poster="${kf(t.poster,Pp(t.poster).mime)}"`:``;se=[`<agent3d-scene aria-label="${jp(ie)}"${g.target?.height?``:` aspect="${ae.width}:${ae.height}"`}${i} style="display:block;width:100%">`,`<script type="application/json">${Mp(g)}<\/script>`,...Object.keys(n).length?[`<script type="application/json" data-assets>${Mp(n)}<\/script>`]:[],...Object.entries(r).map(([e,t])=>`<script type="text/agent3d-script" data-path="${jp(e)}">${Np(t)}<\/script>`),`</agent3d-scene>`,`<script type="module">${Np(e)}<\/script>`].join(`
|
|
403
|
+
`),ce=`${s}.html`,O[ce]=Xp({title:re,body:se,credits:v});let a=Op(O[ce]);a>kp&&ne.push({severity:`warning`,code:`single-html-size`,path:ce,message:`${ce} weighs ${(a/1048576).toFixed(1)} MB (data: URIs inflate assets by ~33%).`,hint:`Use the "embed" format for heavy scenes, or shrink textures / models.`})}let he=Ni(Op(ee)+E+te);he>T&&ne.push({severity:`warning`,code:`budget`,path:`target.budgetKb`,message:`The export weighs ${he} KB (runtime excluded), above the ${T} KB budget for a ${w}.`,hint:`Shrink textures (1k, .jpg/.webp), compress or replace models, or raise target.budgetKb.`});for(let e of v)e.license===`unknown`&&ne.push({severity:`warning`,code:`unknown-licence`,path:e.path,message:`${e.path} has no licence in assets/manifest.json.`,hint:`Register it with assets_add (license + author) before publishing.`});let ge=Object.values(O).reduce((e,t)=>e+Op(t),0),_e=n===`single-html`?[O[ce]]:[...(de?.loaded??[]).map(e=>t.runtime.files[e]).filter(Boolean),ee,..._.values(),...C.values(),...t.poster?[t.poster]:[]],ve=_e.reduce((e,t)=>e+Op(t),0),ye=n===`single-html`?le:(de?.loaded??[]).reduce((e,n)=>e+(t.runtime.files[n]?.byteLength??0),0),be=await bp(_e,t.gzip).catch(()=>void 0);return{format:n,name:s,files:O,snippet:se,entry:ce,totalKb:Ni(ge),folderKb:Ni(ge),pageKb:Ni(ve),...be===void 0?{}:{pageKbGzip:Ni(be)},page:{runtimeKb:Ni(ye),runtimeFiles:n===`single-html`?[p]:de?.loaded??[],skippedChunks:n===`single-html`?[]:de?.skipped??[],unknownChunks:de?.unknown??[],pruned:fe},sizes:{runtimeKb:Ni(le),sceneKb:Ni(Op(ee)),assetsKb:Ni(E),scriptsKb:Ni(te),posterKb:Ni(D)},credits:v,issues:ne,runtime:f?`photo-lite`:`full`,...d?{runtimeReasons:d}:{},...ue?{runtimeDir:ue}:{},...pe?{integrity:pe}:{},...me?{head:me}:{}}}function Gp(e){return/^(cc0|public)/i.test(e.license)?`${e.path.split(`/`).pop()} — ${e.license}${e.author?` (${e.author})`:``}`:$f({path:e.path,license:e.license,author:e.author,attribution:e.attribution,sourceUrl:e.source})}function Kp(e,t){return[`Credits — ${e}`,``,...t.map(e=>`- ${Gp(e)}`),``,`Made with Agent3D.`].join(`
|
|
404
|
+
`)+`
|
|
405
|
+
`}function qp(e){return e.length?`<section class="credits"><h2>Credits & licences</h2><ul>${e.map(e=>`<li>${jp(Gp(e))}</li>`).join(``)}</ul></section>`:``}function Jp(){return`<script>
|
|
406
|
+
if (location.protocol === "file:") {
|
|
407
|
+
var note = document.getElementById("a3d-file-note");
|
|
408
|
+
if (note) note.hidden = false;
|
|
409
|
+
}
|
|
410
|
+
<\/script>`}function Yp(e){return`<!doctype html>
|
|
411
|
+
<html lang="en">
|
|
412
|
+
<head>
|
|
413
|
+
<meta charset="utf-8">
|
|
414
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
415
|
+
<title>${jp(e.title)} — Agent3D embed</title>${e.description?`\n<meta name="description" content="${jp(e.description)}">`:``}${e.ogImage?`\n<meta property="og:title" content="${jp(e.title)}">\n<meta property="og:image" content="${jp(e.ogImage)}">\n<meta name="twitter:card" content="summary_large_image">`:``}
|
|
416
|
+
<style>
|
|
417
|
+
:root { color-scheme: light dark; --fg: #1d1d22; --muted: #666; --bg: #f6f6f8; --card: #fff; --code: #0f1117; }
|
|
418
|
+
@media (prefers-color-scheme: dark) { :root { --fg: #ececf1; --muted: #9a9aa5; --bg: #111216; --card: #1a1b21; } }
|
|
419
|
+
* { box-sizing: border-box; }
|
|
420
|
+
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg); }
|
|
421
|
+
main { max-width: 1100px; margin: 0 auto; padding: 32px 16px 64px; }
|
|
422
|
+
h1 { font-size: 1.6rem; margin: 0 0 4px; }
|
|
423
|
+
p.lead { color: var(--muted); margin: 0 0 24px; }
|
|
424
|
+
.stage { border-radius: 14px; overflow: hidden; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
|
|
425
|
+
agent3d-scene { display: block; width: 100%; ${e.sizeStyle}; }
|
|
426
|
+
agent3d-scene:not(:defined) > img, agent3d-scene:not(:defined) > picture img { width: 100%; height: 100%; object-fit: cover; }
|
|
427
|
+
h2 { font-size: 1.05rem; margin: 32px 0 8px; }
|
|
428
|
+
pre { background: var(--code); color: #e6e6e6; padding: 16px; border-radius: 10px; overflow-x: auto; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
|
|
429
|
+
.credits ul { padding-left: 20px; color: var(--muted); font-size: .92rem; }
|
|
430
|
+
footer { margin-top: 40px; color: var(--muted); font-size: .85rem; }
|
|
431
|
+
.file-note { margin: 0 0 16px; padding: 12px 16px; border-radius: 10px; background: #fff3cd; color: #5c4400; font-weight: 600; }
|
|
432
|
+
.file-note code { font-weight: 700; }
|
|
433
|
+
</style>
|
|
434
|
+
</head>
|
|
435
|
+
<body>
|
|
436
|
+
<main>
|
|
437
|
+
<h1>${jp(e.title)}</h1>
|
|
438
|
+
<p class="lead">${jp(e.description??`A 3D element made with Agent3D. Paste the snippet below into any page of this site.`)}</p>
|
|
439
|
+
<p class="file-note" id="a3d-file-note" role="status" hidden>Open this page through a web server (file:// blocks module scripts) — e.g. <code>npx serve</code> in this folder, then open the address it prints.${e.poster?` Showing the poster image meanwhile.`:``}</p>
|
|
440
|
+
<div class="stage">
|
|
441
|
+
${e.snippet}
|
|
442
|
+
</div>
|
|
443
|
+
${Jp()}
|
|
444
|
+
<h2>Embed snippet</h2>
|
|
445
|
+
<pre><code>${jp(e.snippet)}</code></pre>
|
|
446
|
+
<p>Upload this whole folder to your static site; the paths in the snippet are relative to the page that includes it. Several scenes can share the same runtime folder. <code>EMBED.md</code> explains WordPress, Webflow, Shopify, React / Next.js, Vue, Svelte, data bindings, the JavaScript API and the Content-Security-Policy; <code>frameworks/</code> holds ready-made wrapper components.</p>
|
|
447
|
+
${qp(e.credits)}
|
|
448
|
+
<footer>Made with Agent3D — no server, no tracking, no third-party requests.</footer>
|
|
449
|
+
</main>
|
|
450
|
+
</body>
|
|
451
|
+
</html>
|
|
452
|
+
`}function Xp(e){let t=e.credits.filter(e=>!/^(cc0|public)/i.test(e.license));return`<!doctype html>
|
|
453
|
+
<html lang="en">
|
|
454
|
+
<head>
|
|
455
|
+
<meta charset="utf-8">
|
|
456
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
457
|
+
<title>${jp(e.title)}</title>
|
|
458
|
+
<style>html,body{margin:0;background:transparent}body{font:14px system-ui,sans-serif}.agent3d-credits{font-size:12px;opacity:.7;padding:4px 8px}</style>
|
|
459
|
+
</head>
|
|
460
|
+
<body>
|
|
461
|
+
${e.body}
|
|
462
|
+
${t.length?`<div class="agent3d-credits">${t.map(e=>jp(Gp(e))).join(` · `)}</div>`:``}
|
|
463
|
+
</body>
|
|
464
|
+
</html>
|
|
465
|
+
`}function Zp(e,t){let n=t.replace(/\/+$/,``);return Object.fromEntries(Object.entries(e).map(([e,t])=>[`${n}/${e}`,t]))}function Qp(e,t,n=!0){let r=e[t];if(typeof r==`string`&&r.trim())return r.trim();if(n)throw new A(`invalid`,`Missing "${t}" (string).`);return``}function G(e,t){let n=e[t];return typeof n==`string`&&n.trim()?n.trim():void 0}function $p(e,t,n=!1){let r=e[t];return typeof r==`boolean`?r:n}function em(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function tm(e,t=40){let n={error:0,warning:1,info:2},r=[...e].sort((e,t)=>n[e.severity]-n[t.severity]),i=r.slice(0,t);return r.length>t?{issues:i,omitted:r.length-t}:{issues:i}}function nm(e){let t={errors:0,warnings:0,infos:0};for(let n of e)t[n.severity===`error`?`errors`:n.severity===`warning`?`warnings`:`infos`]++;return t}function rm(e,t){let n=nm(e.issues),r=n.errors?`refused`:e.plan.empty?`unchanged`:t?`dry-run`:`applied`;return{status:r,applied:e.applied,plan:e.plan.empty?{summary:e.plan.summary}:e.plan,counts:n,...tm(e.issues.filter(e=>n.errors===0||e.severity!==`info`)),hint:r===`refused`?`Nothing was written: fix the errors (each issue has a hint) and call again.`:r===`applied`?`Saved. Call render_preview (when available) and look at the image to verify, or check for budget / framing issues.`:r===`dry-run`?`Dry run: call again without dryRun to write.`:`The scene already matches: nothing to do.`}}function im(e,t,n){if(t??={},typeof t!=`object`||Array.isArray(t))throw new A(`invalid`,`${n}: input must be a JSON object.`);let r=t;for(let t of e.required??[])if(r[t]===void 0||r[t]===null||r[t]===``)throw new A(`invalid`,`${n}: missing required input "${t}".`,e.properties?.[t]?.description);for(let[t,i]of Object.entries(r)){let r=e.properties?.[t];if(!r||i==null||!r.type)continue;let a=Array.isArray(r.type)?r.type:[r.type],o=Array.isArray(i)?`array`:typeof i==`number`?Number.isInteger(i)?`integer`:`number`:typeof i;if(!a.some(e=>e===o||e===`number`&&o===`integer`))throw new A(`invalid`,`${n}: "${t}" must be ${a.join(` or `)}, got ${o}.`,r.description);if(r.enum&&!r.enum.includes(i))throw new A(`invalid`,`${n}: "${t}" must be one of ${r.enum.map(e=>JSON.stringify(e)).join(`, `)}.`)}return r}async function am(e){return Nc(e)}function om(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e;if(Array.isArray(t.gradient))return`gradient(${t.gradient.join(`, `)})`;if(Array.isArray(t.radial))return`radial(${t.radial.join(`, `)})`;if(t.sky)return`sky`;if(typeof t.hdri==`string`)return`hdri ${t.hdri}`}return`?`}function sm(e){let t=0,n=0,r=e=>(t++,n+=e.behaviours?.length??0,{id:e.id,kind:e.kind,detail:Rc(e),...e.position?{position:e.position}:{},...e.behaviours?.length?{behaviours:e.behaviours.map(e=>e.type)}:{},...e.visible===!1?{hidden:!0}:{},...e.children?.length?{children:e.children.map(r)}:{}}),i=(e.objects??[]).filter(e=>e&&typeof e==`object`).map(r),a=e.environment?.lighting;return{id:e.id,title:e.title,target:{kind:e.target?.kind,aspect:e.target?.aspect,...e.target?.budgetKb?{budgetKb:e.target.budgetKb}:{}},camera:{type:e.camera?.type,position:e.camera?.position,...e.camera?.target?{target:e.camera.target}:{},...e.camera?.fov===void 0?{}:{fov:e.camera.fov},...e.camera?.controls?{controls:e.camera.controls}:{}},background:om(e.environment?.background),...a?{lighting:typeof a==`string`?a:`hdri ${a.hdri}`}:{},lights:(e.lights??[]).map(e=>({...e.id?{id:e.id}:{},type:e.type,...e.intensity===void 0?{}:{intensity:e.intensity},...e.position?{position:e.position}:{}})),objects:i,counts:{objects:t,lights:e.lights?.length??0,tracks:e.timeline?.tracks?.length??0,behaviours:n},...e.timeline?{timeline:{duration:e.timeline.duration,...e.timeline.loop===void 0?{}:{loop:e.timeline.loop},...e.timeline.trigger?{trigger:e.timeline.trigger}:{},tracks:(e.timeline.tracks??[]).map(e=>({target:e.target,keys:e.keys?.length??0,from:e.keys?.[0]?.[0]??0,to:e.keys?.[e.keys.length-1]?.[0]??0}))}}:{},...e.postfx?.length?{postfx:e.postfx.map(e=>e.type)}:{},...e.scripts?.length?{scripts:e.scripts}:{},...e.ui?.elements?.length?{ui:e.ui.elements.map(e=>e.id)}:{},...e.audio?.sounds?{sounds:Object.keys(e.audio.sounds)}:{}}}function cm(e){let t=new Map,n=new Map;return V(e?.objects,(e,r)=>{let i=r?.id??null,a=n.get(i)??0;if(n.set(i,a+1),typeof e.id!=`string`)return;let{children:o,...s}=e;t.set(e.id,{object:s,parent:i,index:a})}),t}function lm(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t||t.parent!==i.parent)continue;let a=n.get(i.parent)??[];a.push(r),n.set(i.parent,a)}let r=new Set;for(let i of n.values()){i.sort((e,n)=>t.get(e).index-t.get(n).index);let n=i.map(t=>e.get(t).index),a=n.map(()=>1),o=n.map(()=>-1);for(let e=0;e<n.length;e++)for(let t=0;t<e;t++)n[t]<n[e]&&a[t]+1>a[e]&&(a[e]=a[t]+1,o[e]=t);let s=-1;for(let e=0;e<n.length;e++)(s<0||a[e]>a[s])&&(s=e);let c=new Set;for(let e=s;e>=0;e=o[e])c.add(e);i.forEach((e,t)=>{c.has(t)||r.add(e)})}return r}function um(e,t){let n=cm(e),r=cm(t),i=[...r.keys()].filter(e=>!n.has(e)),a=[...n.keys()].filter(e=>!r.has(e)),o=[],s=[];for(let[e,t]of r){let r=n.get(e);if(!r)continue;let i=[...new Set([...Object.keys(r.object),...Object.keys(t.object)])].filter(e=>!Ef(r.object[e],t.object[e])).sort();i.length&&o.push({id:e,fields:i}),r.parent!==t.parent&&s.push({id:e,from:r.parent,to:t.parent,index:t.index})}for(let e of lm(n,r)){let t=r.get(e);s.push({id:e,from:t.parent,to:t.parent,index:t.index})}let c=e=>{let t=[];return V(e?.objects,e=>void t.push(String(e.id))),t.join(`|`)},l=!i.length&&!a.length&&!s.length&&c(e)!==c(t),u=[],d=new Set([...Object.keys(e??{}),...Object.keys(t)]);for(let n of[...d].sort())n!==`objects`&&(Ef(e?.[n],t[n])||u.push(n));l&&u.push(`objects (order)`);let f=!i.length&&!a.length&&!o.length&&!s.length&&!u.length,p=[];return i.length&&p.push(`add ${i.length} object${i.length>1?`s`:``} (${i.slice(0,8).join(`, `)}${i.length>8?`, …`:``})`),a.length&&p.push(`remove ${a.length} (${a.slice(0,8).join(`, `)}${a.length>8?`, …`:``})`),o.length&&p.push(`change ${o.length} (${o.slice(0,8).map(e=>e.id).join(`, `)}${o.length>8?`, …`:``})`),s.length&&p.push(`move ${s.length}`),u.length&&p.push(`update ${u.join(`, `)}`),{empty:f,objects:{added:i,removed:a,changed:o,moved:s},sections:u,summary:f?`No changes.`:`${p.join(`; `)}.`}}async function dm(e){return await e.exists(`scene.json`)?Nc(e):null}async function fm(e,t,n={}){if(!t||typeof t!=`object`||Array.isArray(t))throw new A(`invalid`,`scene must be a JSON object (a full SceneDoc).`,`Use scene_get to fetch the current scene, edit it, and pass the whole document; or use scene_patch for small edits.`);let r=await dm(e),i=Ps(t),a=um(r,t);return Oi(i)||a.empty||n.dryRun?{plan:a,issues:i,applied:!1}:(await Pc(e,t),{plan:a,issues:i,applied:!0})}var pm=[`set`,`merge`,`remove`,`addObject`,`updateObject`,`removeObject`,`moveObject`,`addBehaviour`,`addTrack`,`removeTrack`];function mm(e,t,n,r){return new A(`invalid`,`Patch op #${e} (${t?.op??`?`}) failed: ${n}`,r,{opIndex:e,op:t})}function hm(e,t,n,r){if(typeof t!=`string`)throw mm(n,r,`"id" must be an object id string.`);let i=Ic(e.objects,t);if(!i){let i=Fi(t,Bc(e));throw mm(n,r,`No object with id "${t}".`,`${i?`Did you mean "${i}"? `:``}List ids with scene_summary / object_list.`)}return i}function gm(e,t){if(!Array.isArray(t))throw new A(`invalid`,`ops must be an array of patch operations.`,`Ops: ${pm.join(`, `)}.`);let n=Cf(e);return Array.isArray(n.objects)||(n.objects=[]),t.forEach((e,t)=>{if(!e||typeof e!=`object`||!pm.includes(e.op)){let n=e?.op,r=typeof n==`string`?Fi(n,pm):void 0;throw mm(t,e,`Unknown op ${JSON.stringify(n)}.`,`${r?`Did you mean "${r}"? `:``}Valid ops: ${pm.join(`, `)}.`)}try{_m(n,e,t)}catch(n){throw n instanceof uf?mm(t,e,n.message,n.hint):n}}),n}function _m(e,t,n){switch(t.op){case`set`:if(t.value===void 0)throw mm(n,t,`"value" is required (use op "remove" to delete).`);if(ff(t.path).length===0)throw mm(n,t,`Empty path.`);bf(e,t.path,Cf(t.value));return;case`merge`:{let n;try{n=vf(e,t.path)}catch{n=void 0}bf(e,t.path,Sf(n,t.value));return}case`remove`:if(!xf(e,t.path))throw mm(n,t,`Nothing to remove at "${t.path}".`);return;case`addObject`:{let r=t.object;if(!r||typeof r!=`object`)throw mm(n,t,`"object" must be an ObjectDef.`,`Example: { "id": "box", "kind": "mesh", "geometry": { "type": "box" } }.`);if(!Li(r.id))throw mm(n,t,`Invalid object id ${JSON.stringify(r.id)}.`,`Ids start with a letter: letters, digits, "_" or "-".`);let i=new Set([...Bc(e),...(e.lights??[]).map(e=>e.id).filter(Boolean)]),a=[];V([r],e=>void a.push(e.id));let o=a.find(e=>i.has(e));if(o)throw new A(`conflict`,`Patch op #${n} (addObject) failed: id "${o}" is already used.`,`Pick another id (e.g. "${o}-2"), or use updateObject to change the existing one.`,{opIndex:n});let s=e.objects;if(t.parent!==void 0&&t.parent!==null){let r=hm(e,t.parent,n,t).object;r.children=r.children??[],s=r.children}let c=t.index===void 0?s.length:Math.max(0,Math.min(s.length,Math.floor(t.index)));s.splice(c,0,Cf(r));return}case`updateObject`:{let r=hm(e,t.id,n,t);if(!t.set||typeof t.set!=`object`)throw mm(n,t,`"set" must be an object of fields to change.`,`Example: { "position": [0, 1, 0], "material": { "color": "#ff0000" } } (objects merge, null deletes).`);let i=t.set;if(`id`in i&&i.id!==t.id)throw mm(n,t,`Changing an object id is not supported by updateObject.`,`Remove the object and add it again with the new id (and update timeline tracks / camera.follow).`);if(`children`in i)throw mm(n,t,`updateObject cannot replace children.`,`Use addObject with parent, removeObject or moveObject.`);r.container[r.index]=Sf(r.object,i);return}case`removeObject`:{let r=hm(e,t.id,n,t),i=[];V([r.object],e=>void i.push(e.id)),r.container.splice(r.index,1),e.timeline?.tracks&&(e.timeline.tracks=e.timeline.tracks.filter(e=>!i.includes(String(e.target).split(`.`)[0])));return}case`moveObject`:{let r=hm(e,t.id,n,t),i;if(t.parent===void 0)i=r.container;else if(t.parent===null)i=e.objects;else{if(t.parent===t.id||Lc(r.object,t.parent))throw mm(n,t,`Cannot move an object into itself or one of its descendants.`);let a=hm(e,t.parent,n,t).object;a.children=a.children??[],i=a.children}r.container.splice(r.index,1);let a=t.index===void 0?i.length:Math.max(0,Math.min(i.length,Math.floor(t.index)));i.splice(a,0,r.object);return}case`addBehaviour`:{if(!t.behaviour||typeof t.behaviour!=`object`||typeof t.behaviour.type!=`string`)throw mm(n,t,`"behaviour" must be { "type": "<catalog behaviour>", …params }.`);let r=Ic(e.objects,t.id),i=r?null:(e.lights??[]).find(e=>e.id===t.id),a=r?.object??i;a||hm(e,t.id,n,t);let o=a.behaviours=a.behaviours??[];o.some(e=>Ef(e,t.behaviour))||o.push(Cf(t.behaviour));return}case`addTrack`:{let r=t.track;if(!r||typeof r!=`object`||typeof r.target!=`string`||!Array.isArray(r.keys))throw mm(n,t,`"track" must be { "target": "<id>.<property>", "keys": [[t, v], …] }.`);let i=Math.max(0,...r.keys.map(e=>Array.isArray(e)&&typeof e[0]==`number`?e[0]:0));e.timeline||={duration:Math.max(1,i),loop:!0,tracks:[]},e.timeline.tracks=e.timeline.tracks??[];let a=Cf(r);a.keys=[...a.keys].sort((e,t)=>(e?.[0]??0)-(t?.[0]??0));let o=e.timeline.tracks.findIndex(e=>e.target===r.target);o>=0?e.timeline.tracks[o]=a:e.timeline.tracks.push(a),i>e.timeline.duration&&(e.timeline.duration=i);return}case`removeTrack`:{let r=e.timeline?.tracks??[],i=r.findIndex(e=>e.target===t.target);if(i<0){let e=Fi(String(t.target),r.map(e=>e.target));throw mm(n,t,`No track targets "${t.target}".`,e?`Did you mean "${e}"?`:`Existing tracks: ${r.map(e=>e.target).join(`, `)||`none`}.`)}r.splice(i,1);return}}}async function vm(e,t,n={}){let r=await Nc(e),i=gm(r,t),a=Ps(i),o=um(r,i);return Oi(a)||o.empty||n.dryRun?{plan:o,issues:a,applied:!1,scene:Oi(a)?r:i}:(await Pc(e,i),{plan:o,issues:a,applied:!0,scene:i})}async function ym(e){return zc(await Nc(e))}function bm(e,t,n={}){return vm(e,[{op:`addObject`,object:t,parent:n.parent,index:n.index}],n)}function xm(e,t,n,r={}){return vm(e,[{op:`updateObject`,id:t,set:n}],r)}function Sm(e,t,n={}){return vm(e,[{op:`removeObject`,id:t}],n)}async function Cm(e,t,n={}){return t===null?vm(e,(await Nc(e)).timeline===void 0?[]:[{op:`remove`,path:`timeline`}],n):vm(e,[{op:`set`,path:`timeline`,value:Em(t)}],n)}async function wm(e,t,n={}){let r=[];for(let e of t.addTracks??[])r.push({op:`addTrack`,track:e});for(let e of t.removeTargets??[])r.push({op:`removeTrack`,target:e});let i={...t.settings??{}};return t.markers&&Object.keys(t.markers).length&&(i.markers={...i.markers??{},...t.markers}),t.segments&&Object.keys(t.segments).length&&(i.segments={...i.segments??{},...t.segments}),Object.keys(i).length&&(!r.length&&(await Nc(e)).timeline===void 0&&r.push({op:`set`,path:`timeline`,value:{duration:4,tracks:[]}}),r.push({op:`merge`,path:`timeline`,value:i})),vm(e,r,n)}async function Tm(e,t,n={}){let r=(await Nc(e)).interactions,i=t.interactions===void 0?r??[]:t.interactions;return t.add?.length&&(i=[...i??[],...t.add]),!i||!i.length?vm(e,r===void 0?[]:[{op:`remove`,path:`interactions`}],n):vm(e,[{op:`set`,path:`interactions`,value:i}],n)}function Em(e){return{...e,tracks:(e.tracks??[]).map(e=>({...e,keys:Array.isArray(e.keys)?[...e.keys].sort((e,t)=>(e?.[0]??0)-(t?.[0]??0)):e.keys}))}}function Dm(e,t={}){let n=(t.query??``).toLowerCase().split(/\s+/).filter(Boolean);return(e??[]).filter(e=>{if(t.kind&&e.kind!==t.kind)return!1;let r=`${e.id} ${e.title} ${e.description} ${e.tags.join(` `)}`.toLowerCase();return n.every(e=>r.includes(e))})}function Om(e,t){let n=(e??[]).find(e=>e.id===t);if(!n){let n=Fi(t,(e??[]).map(e=>e.id));throw new A(`notFound`,`Unknown template "${t}".`,`${n?`Did you mean "${n}"? `:``}List templates with templates_list / \`agent3d templates list\`.`)}return n}var km={type:`boolean`,description:`Preview the plan and issues without writing (default false).`},Am={type:`object`,description:`An ObjectDef: { "id": "logo", "kind": "mesh|text|model|group|generator|particles|instances|svg", "position": [x,y,z], "rotation": [x,y,z] (DEGREES), "scale": n | [x,y,z], "behaviours": [{ "type": "rotate", "speed": 30 }], "children": [...] } + kind fields: mesh { geometry: { type, …params }, material }, text { text, font, size, depth }, model { src: "assets/…glb" | "library:<id>", fit }, generator { generator, params, seed }, particles { preset, count, area, size, color }, instances { geometry, material, layout }, svg { src, depth }. Units ≈ metres, Y up. Look ids/params up with catalog_get first.`,additionalProperties:!0},jm=Object.keys(fa);function Mm(e,t){if(!e)return{sections:Object.fromEntries(jm.map(e=>[e,fa[e].map(e=>`${e.id} — ${e.description}`)])),hint:`Call catalog_get { section, id } for the full parameter list of one entry (types, defaults, ranges). Sections: `+jm.join(`, `)+`.`};let n=jm.find(t=>t.toLowerCase()===e.toLowerCase())??jm.find(t=>t.toLowerCase().startsWith(e.toLowerCase()));if(!n){let t=Fi(e,jm);throw new A(`notFound`,`Unknown catalog section "${e}".`,`${t?`Did you mean "${t}"? `:``}Sections: ${jm.join(`, `)}.`)}let r=fa[n];if(!t)return{section:n,entries:r.map(e=>`props`in e?{id:e.id,description:e.description,sets:e.props}:{id:e.id,description:e.description,params:e.params.map(e=>e.name)}),hint:n===`materialPresets`?`Use as material { "preset": "<id>", …overrides }.`:`catalog_get { section: "${n}", id } for parameter details.`};let i=r.find(e=>e.id===t)??r.find(e=>e.id.toLowerCase()===t.toLowerCase());if(!i){let e=Fi(t,r.map(e=>e.id));throw new A(`notFound`,`No "${t}" in ${n}.`,`${e?`Did you mean "${e}"? `:``}Valid ids: ${r.map(e=>e.id).join(`, `)}.`)}return{section:n,...i}}var Nm=[{name:`project_info`,description:`Overview of the current Agent3D project: manifest, target (kind/aspect), compact scene outline (objects tree, lights, camera, timeline), asset count and validation status. Call this first to orient yourself.`,inputSchema:{type:`object`,properties:{}},mutating:!1,async handler(e){let{manifest:t,scene:n}=await Mc(e.fs),r=Ps(n),i=await Nd(e.fs);return{manifest:t,summary:sm(n),assets:{count:i.assets.length,totalKb:i.totalKb},validation:nm(r),hint:`Edit with scene_patch / object_add / object_update (small changes) or scene_apply (full document). Look up ids and params with catalog_get.`}}},{name:`scene_get`,description:'Return the scene document (scene.json), or one part of it with `path`: "camera", "lights[0]", "objects#logo", "objects#logo.material", "timeline.tracks". Use scene_summary for a compact outline of big scenes.',inputSchema:{type:`object`,properties:{path:{type:`string`,description:`Optional JSON path, e.g. "objects#logo.material" or "environment.background".`}}},mutating:!1,async handler(e,t){let n=await am(e.fs),r=G(t,`path`);if(!r)return n;try{return{path:r,value:vf(n,r)}}catch(e){throw e instanceof uf?new A(`notFound`,e.message,e.hint??`Use scene_summary to see the structure.`):e}}},{name:`scene_summary`,description:`Compact outline of the scene: objects tree (id, kind, geometry/generator/preset, position, behaviours), lights, camera, background, timeline tracks, post effects, scripts, HUD ids.`,inputSchema:{type:`object`,properties:{}},mutating:!1,async handler(e){return sm(await am(e.fs))}},{name:`scene_apply`,description:`Replace the whole scene with a full SceneDoc (version 1, id, title, target, camera, environment, lights, objects, optional timeline/postfx/physics/scripts/ui/audio). Validated first: a scene with errors is refused and nothing is written. Returns a diff plan (objects added/removed/changed by id, sections changed); applying the same document twice is a no-op. Prefer scene_patch for small edits. Angles are degrees, units ≈ metres, colours CSS strings.`,inputSchema:{type:`object`,properties:{scene:{type:`object`,description:`The complete SceneDoc.`,additionalProperties:!0},dryRun:km},required:[`scene`]},mutating:!0,async handler(e,t){let n=$p(t,`dryRun`);return rm(await fm(e.fs,t.scene,{dryRun:n}),n)}},{name:`scene_patch`,description:`Apply several edits atomically (all or nothing; the result is validated and refused on errors). Ops: {op:"set", path, value} · {op:"merge", path, value} (deep merge, null deletes a key) · {op:"remove", path} · {op:"addObject", object, parent?, index?} · {op:"updateObject", id, set} (deep merge) · {op:"removeObject", id} (also drops its tracks) · {op:"moveObject", id, parent? (null = root), index?} · {op:"addBehaviour", id, behaviour} · {op:"addTrack", track} (replaces a track with the same target) · {op:"removeTrack", target}. Paths: "camera.position", "lights[1].intensity", "objects#logo.material.color" (object by id anywhere in the tree), "objects#logo.position[1]". Example: [{"op":"set","path":"objects#logo.material.color","value":"#ff3366"},{"op":"addBehaviour","id":"logo","behaviour":{"type":"float","amplitude":0.2}}].`,inputSchema:{type:`object`,properties:{ops:{type:`array`,minItems:1,description:`Patch operations, applied in order.`,items:{type:`object`,properties:{op:{type:`string`,enum:pm},path:{type:`string`},value:{description:`Value for set / merge.`},object:Am,parent:{type:[`string`,`null`]},index:{type:`integer`},id:{type:`string`},set:{type:`object`,additionalProperties:!0},behaviour:{type:`object`,additionalProperties:!0},track:{type:`object`,additionalProperties:!0},target:{type:`string`}},required:[`op`]}},dryRun:km},required:[`ops`]},mutating:!0,async handler(e,t){let n=$p(t,`dryRun`);return rm(await vm(e.fs,t.ops,{dryRun:n}),n)}},{name:`scene_validate`,description:"Validate a scene document (or the current scene.json when `scene` is omitted) against the format and the catalog. Returns issues with readable paths (objects#logo.material.roughness), messages and hints that say exactly what to change. Errors block saving; warnings are ignored fields or likely mistakes.",inputSchema:{type:`object`,properties:{scene:{type:`object`,description:`A SceneDoc to validate (default: the project's scene).`,additionalProperties:!0}}},mutating:!1,async handler(e,t){let n=Ps(t.scene??await am(e.fs)),r=nm(n);return{ok:r.errors===0,counts:r,...tm(n,60)}}},{name:`object_add`,description:'Add an object to the scene (at the root or under `parent`). Ids must be unique across the whole tree and the lights. Example: { "object": { "id": "planet", "kind": "generator", "generator": "planet", "params": { "radius": 1.5, "rings": true }, "position": [3, 0, 0], "behaviours": [{ "type": "rotate", "speed": 10 }] } }. Check generator / geometry params with catalog_get first.',inputSchema:{type:`object`,properties:{object:Am,parent:{type:`string`,description:`Parent object id (default: scene root).`},index:{type:`integer`,description:`Position among siblings (default: last).`},dryRun:km},required:[`object`]},mutating:!0,async handler(e,t){let n=$p(t,`dryRun`);return rm(await bm(e.fs,t.object,{parent:G(t,`parent`),index:typeof t.index==`number`?t.index:void 0,dryRun:n}),n)}},{name:`object_update`,description:'Change fields of an object by id. `set` is deep-merged: { "material": { "color": "#ff0000" } } keeps the other material fields; null deletes a field; arrays (position, behaviours, colors) are replaced. Rotation in degrees. Example: { "id": "logo", "set": { "position": [0, 1.2, 0], "scale": 1.5 } }.',inputSchema:{type:`object`,properties:{id:{type:`string`,description:`Object id.`},set:{type:`object`,description:`Fields to merge into the object.`,additionalProperties:!0},dryRun:km},required:[`id`,`set`]},mutating:!0,async handler(e,t){let n=$p(t,`dryRun`);return rm(await xm(e.fs,Qp(t,`id`),t.set,{dryRun:n}),n)}},{name:`object_remove`,description:`Remove an object (and its children) by id. Timeline tracks animating it are removed too. Check camera.follow if it followed this object.`,inputSchema:{type:`object`,properties:{id:{type:`string`,description:`Object id.`},dryRun:km},required:[`id`]},mutating:!0,async handler(e,t){let n=$p(t,`dryRun`);return rm(await Sm(e.fs,Qp(t,`id`),{dryRun:n}),n)}},{name:`object_list`,description:`Flat list of every object: id, kind, detail (geometry / generator / preset / text), parent id, depth, position, behaviours.`,inputSchema:{type:`object`,properties:{}},mutating:!1,async handler(e){let t=await ym(e.fs);return{count:t.length,objects:t}}},{name:`timeline_set`,description:'Edit the keyframe timeline. Replace it with `timeline` ({ "duration": 6, "loop": true | "pingpong", "trigger": "visible|load|hover|click|scroll|manual", "speed", "autoplay": true | false | "<segment>", "markers": { "name": seconds }, "segments": { "name": { "from", "to" } | [from, to] }, "scroll": { "start": "top bottom", "end": "bottom top", "smoothing": 0.8 }, "tracks": [...] }, null removes it), or edit incrementally: `addTracks` (replaces tracks with the same target), `removeTargets`, `settings` (duration, loop, trigger, speed, autoplay, scroll), `markers` / `segments` (merged by name, null removes). A track: { "target": "<selector>.<property>", "keys": [[time_s, value], [time_s, value, "ease"]…], "ease": "outCubic", "stagger": 0.06, "staggerFrom": "start|end|center|edges|random" }. Selector: an id, "a,b,c", "tag:<tag>", "children:<id>" (text letters too), "camera", "environment", "postfx". Properties: position | rotation | scale (vec3, rotation in DEGREES) or .x/.y/.z, visible, material.<opacity|color|emissive|emissiveIntensity|metalness|roughness|…>, material.uniforms.<name>, morph.<name>, animation.<clip>.weight|speed|time (models), light intensity/color/angle/penumbra, camera.position|target|fov|zoom|focus, environment.fog.color|near|far|density, environment.lightingIntensity|exposure|background, postfx.<type>.<param>. Values may be relative: "+=1", "-=0.5", "*=1.2". Easings: in/out/inOut × Quad Cubic Quart Quint Sine Expo Circ Back Elastic Bounce, linear, step, "cubicBezier(x1,y1,x2,y2)", "spring(stiffness,damping)", "steps(n)". Keys are sorted for you.',inputSchema:{type:`object`,properties:{timeline:{type:[`object`,`null`],description:`Full replacement (null removes the timeline).`,additionalProperties:!0},addTracks:{type:`array`,items:{type:`object`,additionalProperties:!0},description:`Tracks to add or replace (by target).`},removeTargets:{type:`array`,items:{type:`string`},description:`Targets of tracks to remove.`},settings:{type:`object`,description:`Timeline settings to merge: duration, loop, trigger, speed, autoplay, scroll.`,additionalProperties:!0},markers:{type:`object`,description:`Markers to add / move ({ "reveal": 1.2 }); null removes one.`,additionalProperties:!0},segments:{type:`object`,description:`Segments to add / change ({ "hover-in": { "from": 0, "to": 0.6 } }); null removes one.`,additionalProperties:!0},dryRun:km}},mutating:!0,async handler(e,t){let n=$p(t,`dryRun`);if(`timeline`in t&&t.timeline!==void 0)return rm(await Cm(e.fs,t.timeline,{dryRun:n}),n);if(!t.addTracks&&!t.removeTargets&&!t.settings&&!t.markers&&!t.segments)throw new A(`invalid`,"timeline_set needs `timeline`, `addTracks`, `removeTargets`, `settings`, `markers` or `segments`.");return rm(await wm(e.fs,{addTracks:t.addTracks,removeTargets:t.removeTargets,settings:t.settings,markers:t.markers,segments:t.segments},{dryRun:n}),n)}},{name:`interactions_set`,description:'Edit scene.interactions — no-code triggers. Replace the list with `interactions` (null or [] removes them) or append with `add`. An interaction: { "on": "click" | "hover" | "hoverEnd" | "visible" | "scroll" | "key" | "event", "target"?: "<objectId>" (click/hover/hoverEnd; omitted = whole canvas), "key"?: "Space" (on key), "event"?: "<marker or emitted name>" (on event), "at"?: 0.5 (on scroll: progress crossed downward), "once"?: true, "do": [actions] }. Actions: { "play": "<segment>" | "timeline", "reverse"?: true }, { "toggle": "<segment>" } (forward, then backward), { "seek": seconds | "<marker>" }, { "set": { "path": "<id>.<property>", "value": … }, "duration"?: 0.4, "ease"?: "outCubic" } (tweened from the current value), { "emit": "<event>", "payload"? }, { "openUrl": "https://…" | "/path", "newTab"? } (click / key only — the only way a scene navigates), { "playClip": "Wave", "target": "<modelId>", "loop"?, "speed"?, "crossfade"? }. Hover / click targets get a pointer cursor. Check hover / click states with render_preview `input` (pointer / click events).',inputSchema:{type:`object`,properties:{interactions:{type:[`array`,`null`],items:{type:`object`,additionalProperties:!0},description:`Full replacement (null or [] removes them).`},add:{type:`array`,items:{type:`object`,additionalProperties:!0},description:`Interactions to append.`},dryRun:km}},mutating:!0,async handler(e,t){let n=$p(t,`dryRun`);if(t.interactions===void 0&&!t.add)throw new A(`invalid`,"interactions_set needs `interactions` or `add`.");return rm(await Tm(e.fs,{interactions:t.interactions,add:t.add},{dryRun:n}),n)}},{name:`catalog_get`,description:`Look up what scenes can reference: geometries, materialPresets, shaders, behaviours, generators, particlePresets, postfx, fonts, sounds. No input → every section with ids and one-line descriptions. { section } → entries with param names. { section, id } → the full entry (param types, defaults, min/max, enum options, triangle cost). Always check here before using an id or a param — validation rejects unknown ids.`,inputSchema:{type:`object`,properties:{section:{type:`string`,enum:jm,description:`Catalog section.`},id:{type:`string`,description:`Entry id within the section.`}}},mutating:!1,handler(e,t){return Mm(G(t,`section`),G(t,`id`))}},{name:`templates_list`,description:`List starter templates (id, title, description, kind, aspect, tags) to start a project from with project_create { template }. Filter by kind (banner, hero, card, square, fullscreen, inline, game) or words.`,inputSchema:{type:`object`,properties:{kind:{type:`string`,enum:Lo},query:{type:`string`,description:`Words to match in title / description / tags.`}}},mutating:!1,handler(e,t){let n=e.host?.templates?.index??[],r=Dm(n,{kind:G(t,`kind`),query:G(t,`query`)});return{count:r.length,templates:r,...n.length?{}:{hint:`No templates available in this host; project_create without a template makes a good-looking starter scene for the target kind.`}}}},{name:`project_create`,description:`Create a new project in the current folder: agent3d.json, scene.json, assets/manifest.json (+ scripts for games). Without a template you get an attractive starter for the target kind (banner: gradient background, studio lighting, floating 3D title; hero: blob + title; card: product on a pedestal; square: holographic gem; fullscreen: island landscape; game: coin collector with a script). Then edit it with scene_patch and verify with render_preview. Default aspects: banner 4:1, hero 16:9, card 4:5, square 1:1.`,inputSchema:{type:`object`,properties:{name:{type:`string`,description:`Project slug, e.g. "spring-sale-banner".`},title:{type:`string`,description:`Human title (also the starter's 3D text).`},template:{type:`string`,description:`Template id from templates_list.`},kind:{type:`string`,enum:Lo,description:`Target kind (default banner).`},aspect:{type:`string`,description:`"W:H", e.g. "4:1", "16:9", "1:1".`},force:{type:`boolean`,description:`Overwrite an existing project in this folder.`}},required:[`name`]},mutating:!0,async handler(e,t){let n=G(t,`template`),r;if(n){if(!e.host?.templates)throw new A(`invalid`,`Templates are not available in this host.`,`Create the project without a template (a starter scene is generated for the target kind).`);Om(e.host.templates.index,n),r=await e.host.templates.files(n)}let i=G(t,`kind`),a=G(t,`aspect`),o=i||a?{...i?{kind:i}:{},...a?{aspect:a}:i?{aspect:Jo[i]}:{}}:void 0,s=await Ac(e.fs,{name:Qp(t,`name`),title:G(t,`title`),template:n,templateFiles:r,target:o,force:$p(t,`force`)});return{manifest:s.manifest,files:s.files,summary:sm(s.scene),...tm(s.issues),hint:`Next: render_preview to see it, then scene_patch to make it yours.`}}},{name:`check`,description:"Pre-publish check: validation, missing asset / script files, script sandbox lint (no fetch, DOM, eval, storage… — scripts only get `api`), triangle + bundle-size budget for the target kind, licences that need attribution, accessibility (ariaLabel, reduced motion). With render data from render_preview it also reports framing (objects out of view, clipped, camera inside an object, scene too small) and runtime performance (draw calls, triangles). Every issue has a hint saying what to change.",inputSchema:{type:`object`,properties:{useLastRender:{type:`boolean`,description:`Include stats/inspect from the last render_preview of this session (default true).`}}},mutating:!1,async handler(e,t){let n=$p(t,`useLastRender`,!0)?Pm.get(e.fs):void 0,r=await ep(e.fs,{library:e.host?.library?.index,runtimeStats:n?.stats,inspect:n?.inspect});return{ok:r.ok,counts:r.counts,budget:r.budget,licences:r.licences,...tm(r.issues,50)}}}],Pm=new WeakMap,Fm=[`model`,`texture`,`hdri`,`audio`,`font`,`svg`,`other`],Im=[{name:`assets_list`,description:"List the project's assets (assets/manifest.json + unregistered files): path, kind, size on disk, source, licence, author, and which scene paths use each one (read-only; `stale` lists entries whose manifest size differs from the file — assets_optimize / assets_add rewrite it).",inputSchema:{type:`object`,properties:{}},mutating:!1,async handler(e){let t=await Nd(e.fs);return{count:t.assets.length,totalKb:t.totalKb,...t.stale?{stale:t.stale}:{},assets:t.assets.map(e=>({path:e.path,kind:e.kind,kb:Math.round(e.bytes/102.4)/10,source:e.source,license:e.license,...e.author?{author:e.author}:{},...e.exists?{}:{missing:!0},usedBy:e.usedBy}))}}},{name:`library_list`,description:'Search the built-in asset library (shipped with Agent3D, works offline): models, textures, HDRIs. Use an asset directly in the scene as "library:<id>" (e.g. model src "library:models/nature/pine-tree.glb") — no download, the export copies it. Returns { assets: [{ id, ref, kind, license, tags, description, kb, triangles?, animations?, size? (w × h × d, Y-up) }], total, offset, more } (the list is `assets`, not `hits` as in assets_search). Models list their animation clip names (`animations`, play one with the model object animation { clip }) and triangles. 50 results per page: when `more` is true, call again with `offset`, or `limit: 0` for all. Prefer catalog generators / geometries (zero bytes) and the library before downloading assets.',inputSchema:{type:`object`,properties:{query:{type:`string`,description:`Words, e.g. "tree", "rock moss".`},kind:{type:`string`,enum:Fm},limit:{type:`integer`,minimum:0,maximum:500,description:`Results per page (default 50; 0 = all).`},offset:{type:`integer`,minimum:0,description:`Skip the first N results (when the previous page returned more: true).`}}},mutating:!1,handler(e,t){let n=e.host?.library?.index;return n?Hd(n,{query:G(t,`query`),kind:G(t,`kind`),limit:em(t,`limit`),offset:em(t,`offset`)}):{total:0,assets:[],hint:`The built-in library is not available in this host.`}}},{name:`assets_search`,description:`Search free, account-less sources for CC0 / CC-BY assets: polyhaven (HDRIs, PBR textures, models), ambientcg (PBR materials, HDRIs), khronos (glTF sample models; CC0 / CC-BY only), kenney and quaternius (curated CC0 3D packs — no direct download: the user downloads the zip and assets_add imports it with { file }). Returns hits { source, id, title, kind, license, author, previewUrl, downloads }. Pass a hit to assets_add to download it into the project. Needs network.`,inputSchema:{type:`object`,properties:{query:{type:`string`,description:`Words, e.g. "sunset sky", "wood planks", "fox".`},kind:{type:`string`,enum:Fm},source:{type:`string`,enum:rl},limit:{type:`integer`,minimum:1,maximum:50}},required:[`query`]},mutating:!1,async handler(e,t){if(!e.fetch)throw new A(`io`,`Network access is not available to this tool host.`,`Use library_list (offline) or catalog generators instead.`);let n=await Fd({query:Qp(t,`query`),kind:G(t,`kind`),source:G(t,`source`),limit:em(t,`limit`)??8},e.fetch);return{count:n.hits.length,hits:n.hits,...n.errors.length?{sourceErrors:n.errors}:{},hint:'Download with assets_add { "hit": <hit>, "resolution": "1k" } (pass the hit object as returned; resolutions are the keys of `downloads`). 1k is plenty for web embeds; "512" downloads 1k and downscales it. Models come back with `bounds` (size + up-axis guess).'}}},{name:`assets_add`,description:'Add an asset to the project (written under assets/, licence recorded in assets/manifest.json). Either { "hit": <an assets_search hit>, "resolution": "1k", "name"?: "wood" } to download it, or { "file": "/path/on/disk/pack.zip" | "/path/model.glb", "source": "kenney", "license": "CC0-1.0", "author"?, "filter"?: ["tree"] } to import a local file / pack zip (extracts .glb/.gltf + textures). Returns the project path(s) to use in the scene, plus a ready-made `suggestion` (e.g. a material using a texture set).',inputSchema:{type:`object`,properties:{hit:{type:`object`,description:`A hit from assets_search (source, id, kind, license, downloads…).`,additionalProperties:!0},resolution:{type:`string`,description:`Download key, e.g. "1k", "2k", "1K-JPG", "glb" (default 1k). Below the source minimum ("512", "256"): downloads 1k, then downscales (needs a host with headless Chrome).`},maxSize:{type:`integer`,minimum:16,maximum:8192,description:`Downscale the downloaded textures (also inside .glb) to this longest side in pixels.`},name:{type:`string`,description:`File / folder name in the project (default: the asset id).`},file:{type:`string`,description:`Local file to import (needs a CLI/MCP host).`},source:{type:`string`,description:`Where the local file comes from: "kenney", "quaternius", "local", a URL…`},license:{type:`string`,description:`"CC0-1.0", "CC-BY-4.0", …`},author:{type:`string`},filter:{type:`array`,items:{type:`string`},description:`Zip import: only models whose path contains one of these words.`}}},mutating:!0,async handler(e,t){if(t.hit){if(!e.fetch)throw new A(`io`,`Network access is not available to this tool host.`);let n=t.hit,r=G(t,`resolution`),i=em(t,`maxSize`)??Ld(r).maxSize,a=a=>Rd(e.fs,n,e.fetch,{resolution:r,maxSize:i,codec:a,name:G(t,`name`),inflate:e.host?.inflate}),o=i&&e.host?.withImageCodec?await e.host.withImageCodec(e=>a(e)):await a();return{path:o.path,files:o.files,kind:o.kind,license:o.license,kb:Math.round(o.bytes/102.4)/10,...o.bounds?{bounds:o.bounds}:{},...o.optimized?{optimized:{maxSize:o.optimized.maxSize,savedKb:o.optimized.savedKb,afterKb:o.optimized.afterKb}}:{},...o.note?{note:o.note}:{},...o.attribution?{attribution:o.attribution}:{},...o.suggestion?{suggestion:o.suggestion}:{},hint:o.kind===`model`?`Use it: object_add { "object": { "id": "…", "kind": "model", "src": "${o.path}", "fit": 2 } }.`:`Reference the path(s) in the scene (see suggestion).`}}let n=G(t,`file`);if(!n)throw new A(`invalid`,`assets_add needs "hit" (from assets_search) or "file" (a local file to import).`);if(!e.host?.readLocalFile)throw new A(`invalid`,`This host cannot read local files.`,`Use the CLI: agent3d assets add <file> --license CC0-1.0.`);let r=Qp(t,`license`),i=G(t,`source`)??`local`,a=await e.host.readLocalFile(n),o=n.split(/[\\/]/).pop()??`asset`;if(a[0]===80&&a[1]===75){let n=await Bd(e.fs,a,{name:G(t,`name`)??o.replace(/\.zip$/i,``),source:i,license:r,author:G(t,`author`),filter:Array.isArray(t.filter)?t.filter:void 0,inflate:e.host?.inflate});return{imported:n.assets.length,models:n.models.slice(0,60),...n.models.length>60?{moreModels:n.models.length-60}:{},skipped:n.skipped,hint:`Use a model: object_add { "object": { "id": "…", "kind": "model", "src": "<one of models>", "fit": 2 } }.`}}let s=await Pd(e.fs,{path:G(t,`name`)??o,bytes:a,source:i,license:r,author:G(t,`author`)}),c=s.kind===`model`?await zl(e.fs,s.path):null;return{path:s.path,kind:s.kind,license:s.license,...c?{bounds:c}:{}}}},{name:`assets_optimize`,description:"Make project textures and .glb models lighter (run it when `check` reports the KB budget is exceeded, or before export). Textures (.jpg / .png / .webp files and images inside .glb) get the size the scene needs — a smart per-texture size from the target kind, the object's size on screen, the camera distance and the role (colour / normal / roughness, background) unless `maxSize` forces one — and are re-encoded as WebP by default (`format`; standalone files are renamed and scene references rewritten; models use EXT_texture_webp). .glb geometry is welded, reordered and meshopt-compressed (`compress`, default true; the runtime decodes it), optionally simplified (`simplify` ratio). A file only changes when it gets smaller; each file reports the size chosen and why. Lossy: call with `dryRun: true` first to show the user the savings, then without it once they agree. Pass `paths` (files or folders) or `all: true`. Textures need a host with headless Chrome (CLI / MCP); geometry does not.",inputSchema:{type:`object`,properties:{paths:{type:`array`,items:{type:`string`},description:`Project paths, e.g. ["assets/textures/wood/wood_diff_1k.jpg", "assets/models/fox.glb"] (folders: every image / .glb inside).`},all:{type:`boolean`,description:`Every texture and .glb under assets/.`},maxSize:{type:`integer`,minimum:16,maximum:8192,description:`Force this longest side in pixels for every texture (default: smart size per texture from the scene; never upscales).`},quality:{type:`integer`,minimum:1,maximum:100,description:`WebP / JPEG quality (default 80; normal maps use at least 90).`},format:{type:`string`,enum:[`auto`,`webp`,`jpeg`,`png`,`keep`],description:`Texture output format (default auto = WebP; jpeg keeps images with alpha in their format).`},compress:{type:`boolean`,description:`Meshopt-compress .glb geometry (default true).`},simplify:{type:`number`,minimum:.01,maximum:1,description:`Keep this fraction of each .glb mesh's triangles (e.g. 0.5), within simplifyError.`},simplifyError:{type:`number`,minimum:1e-4,maximum:1,description:`Max deviation for simplify, as a fraction of the mesh size (default 0.01).`},dryRun:{type:`boolean`,description:`Encode everything and report the savings, write nothing.`}}},mutating:!0,async handler(e,t){let n=Array.isArray(t.paths)?t.paths:[],r=[];for(let t of n){let n=t.replace(/^\.\//,``).replace(/\/+$/,``);if(await e.fs.exists(n))r.push(n);else{let t=(await e.fs.list(`${n}/`)).filter(e=>/\.(png|jpe?g|webp|glb)$/i.test(e));r.push(...t.length?t:[n])}}let i={paths:r,all:t.all===!0,maxSize:em(t,`maxSize`),quality:em(t,`quality`),format:G(t,`format`),compress:t.compress!==!1,simplify:em(t,`simplify`),simplifyError:em(t,`simplifyError`),dryRun:t.dryRun===!0,library:e.host?.library?.index},a=e.host?.withImageCodec?await e.host.withImageCodec(t=>wd(e.fs,i,t)):await wd(e.fs,i);return{...a,hint:a.dryRun?`Nothing written: show the user the savings, then call again without dryRun.`:`Run check again to see the new budget.${e.host?.withImageCodec?``:" Textures were skipped (this host has no headless Chrome): use the CLI `agent3d assets optimize` for them."}`}}},{name:`image_depth`,description:'Estimate a depth map for a photo (the "3D photo" effect: a photo object with `depth`). Runs Depth Anything V2 Small locally (CLI / MCP host: headless Chrome, ~1-3 s per image; the 27 MB Apache-2.0 model is downloaded once into the user cache, later runs work offline). Writes a grey PNG (white = near, transparent where depth jumps) at the photo size (max 1024 px) under assets/depth/, registered in assets/manifest.json with the photo\'s licence. Returns { path, width, height, ms, model, suggestion: { kind: "photo", src, depth } } — then add or update the photo object with `depth: path`. Without a host that can run it, paint a depth map by hand instead.',inputSchema:{type:`object`,properties:{image:{type:`string`,description:`The photo: project path ("assets/textures/photo.jpg") or "library:<id>" (.jpg / .png / .webp).`},out:{type:`string`,description:`Project path of the depth PNG (default "assets/depth/<image name>-depth.png").`},size:{type:`integer`,minimum:140,maximum:1036,description:`Model input long side in pixels (default 518; larger = finer edges, slower; rounded to a multiple of 14).`},maxSize:{type:`integer`,minimum:16,maximum:8192,description:`Longest side of the written depth map (default: the photo size, capped at 1024).`}},required:[`image`]},mutating:!0,async handler(e,t){let n={image:Qp(t,`image`).replace(/^\.\//,``),out:G(t,`out`),size:em(t,`size`),maxSize:em(t,`maxSize`),library:e.host?.library,deflate:e.host?.deflate};if(await ef(e.fs,n),!e.host?.withDepthEstimator)return{status:`refused`,reason:`This host cannot run the depth model (it needs the CLI / MCP host with headless Chrome).`,hint:"Run `agent3d assets depth <image>` from the CLI, or provide a depth map by hand (grey PNG, white = near, same aspect as the photo) and set it as the photo object's `depth`."};let r=await e.host.withDepthEstimator(t=>nf(e.fs,n,t));return{...r,hint:`Set it on the photo object: object_update { id, set: { depth: "${r.path}" } }, or object_add with ${JSON.stringify(r.suggestion)}. Then render_preview to check the parallax.`}}},{name:`export`,description:'Build the self-contained embed and write it into the project (default dist/<format>/). "embed": a folder for any static site — agent3d-runtime/ (shared), <name>/scene.json + assets + scripts, index.html (demo page), snippet.html (paste into the page), EMBED.md and frameworks/ (React / Vue / Svelte wrappers). "zip": the same folder as one <name>-embed.zip. "single-html": one <name>.html with everything inline. Library assets are copied; nothing is hotlinked. Options: `baseUrl` (where the folder is served, so the snippet works from any page), `cacheBust` (versioned runtime folder + ?v= hash for long-term caching), `integrity` (SRI hash on the runtime script, default true), `optimize` (export lighter copies of the assets — the project is not modified), `og` (render a 1200×630 og-image.png social preview), `runtime` ("auto" default: a scene that is a single 3D photo ships the photo-only lite runtime agent3d-photo.js, ~14 KB gzipped instead of ~210 KB; "full" forces agent3d-runtime.js — the result says which in `runtime`, with `runtimeReasons` when full). Run check first; returns the snippet, sizes and budget warnings. When the host can render (CLI / MCP / Studio with Chrome): "poster" writes a still image (dist/poster.webp; `time`, `image`), "video" an MP4 / WebM (dist/video.webm; `codec`, `duration`, `fps`, `size`), "gif" / "animated-webp" an animated image (dist/animation.gif / .webp), returning { path } — `quality` supersamples, `transparent` keeps the alpha (poster, gif, animated-webp).',inputSchema:{type:`object`,properties:{format:{type:`string`,enum:[`embed`,`zip`,`single-html`,`poster`,`video`,`gif`,`animated-webp`],description:`Default embed. poster / video / gif / animated-webp need a host that can render (Chrome).`},name:{type:`string`,description:`Folder / file name of the scene in the export (default: project name).`},outDir:{type:`string`,description:`embed / zip / single-html: project-relative output folder (default "dist/<format>").`},poster:{type:`string`,description:`Project path of a PNG/WebP still to use as poster (e.g. a frame from renders/).`},baseUrl:{type:`string`,description:`embed / zip: URL of the export folder as seen from the pages (default "./"), e.g. "/static/3d/" or "https://cdn.example.com/3d/".`},cacheBust:{type:`boolean`,description:`embed / zip: versioned runtime folder (agent3d-runtime-<hash>/) and ?v=<hash> on the scene URL, for year-long caching (default false).`},integrity:{type:`boolean`,description:`embed / zip: Subresource Integrity (sha384) on the runtime <script> (default true).`},extras:{type:`boolean`,description:`embed / zip: EMBED.md and framework wrappers (default true).`},optimize:{type:`boolean`,description:`embed / zip / single-html: export optimised copies of the assets — textures at the size the scene needs, .glb geometry meshopt-compressed (textures need a host with headless Chrome). The project is not modified (default false).`},og:{type:`boolean`,description:`embed / zip: render a 1200×630 og-image.png social preview (needs a host that can render; default false).`},runtime:{type:`string`,enum:[`auto`,`full`],description:`embed / zip / single-html: "auto" (default) ships the photo-only lite runtime (agent3d-photo.js, no three.js) when the scene is a single 3D photo, "full" always the full runtime.`},out:{type:`string`,description:`poster / video / gif / animated-webp: project-relative output file under dist/ or renders/ (default "dist/poster.webp", "dist/video.webm" (.mp4 with codec mp4), "dist/animation.gif", "dist/animation.webp").`},time:{type:`number`,minimum:0,description:`poster: time in seconds (default target.posterTime).`},image:{type:`string`,enum:[`webp`,`png`],description:`poster: image format (default webp).`},codec:{type:`string`,enum:[`webm`,`mp4`],description:"video: WebM VP9 (default) or MP4 H.264 (needs Google Chrome); an .mp4 `out` implies mp4."},duration:{type:`number`,minimum:.1,maximum:120,description:`video / gif / animated-webp: seconds (default the timeline duration, else 5).`},fps:{type:`integer`,minimum:1,maximum:60,description:`video / gif / animated-webp: frames per second (default 30 / 15 / 20).`},size:{type:`string`,description:`poster / video / gif / animated-webp: pixel size "WxH" (default from the target aspect).`},quality:{type:`string`,enum:[`draft`,`standard`,`high`,`ultra`],description:`poster / video / gif / animated-webp: supersampling — draft / standard (1×, default), high (2×), ultra (3×).`},transparent:{type:`boolean`,description:`poster / gif / animated-webp: transparent background (alpha).`}}},mutating:!0,async handler(e,t){let n=G(t,`format`)??`embed`;if(Lm.includes(n))return zm(e,n,t);let r=n;if(r!==`embed`&&r!==`single-html`&&r!==`zip`)throw new A(`invalid`,`Unknown export format "${n}".`,`Use ${[`embed`,`zip`,`single-html`,...Lm].join(`, `)}.`);if(!e.host?.runtimeFiles)throw new A(`invalid`,`This host cannot provide the runtime files.`,`Export with the CLI: agent3d export --format `+r);let i=G(t,`quality`);if(i!==void 0&&!Rm.includes(i))throw new A(`invalid`,`Unknown quality "${i}".`,`Use ${Rm.join(`, `)}.`);let a=(G(t,`outDir`)??`dist/${r}`).replace(/^\.?\//,``);if(!a.startsWith(`dist/`)&&a!==`dist`)throw new A(`invalid`,`outDir must be under dist/ (got "${a}").`,`Use e.g. "dist/embed".`);let o=t.og===!0&&r!==`single-html`;if(o&&!e.host.media)throw new A(`invalid`,`This host cannot render the og image.`,`Export without og, or with the CLI: agent3d export (renders the poster and og-image.png with Chrome).`);let s=G(t,`runtime`)??`auto`;if(s!==`auto`&&s!==`full`)throw new A(`invalid`,`Unknown runtime "${s}".`,`Use "auto" (default: the photo-only lite runtime for single-3D-photo scenes) or "full".`);let c={files:await e.host.runtimeFiles(r)},l=e.host.library??{index:{assets:[]},read:async e=>Promise.reject(new A(`notFound`,`Library asset ${e} unavailable`))},u=G(t,`poster`),d=u?await e.fs.readBytes(u):void 0,f=o?(await e.host.media({format:`og`})).bytes:void 0,p=async(e,n)=>Wp(e,{format:r,name:G(t,`name`),runtime:c,library:n,poster:d,ogImage:f,baseUrl:G(t,`baseUrl`),cacheBust:t.cacheBust===!0,integrity:t.integrity!==!1,extras:t.extras!==!1,runtimeChoice:s}),m,h;if(t.optimize===!0){let t=async t=>{let n=await Dd(e.fs,l,{codec:t});l=n.library;let r=await p(n.fs,n.library);return m=n.report(),r};h=e.host.withImageCodec?await e.host.withImageCodec(e=>t(e)):await t()}else h=await p(e.fs,l);for(let[t,n]of Object.entries(Zp(h.files,a)))typeof n==`string`?await e.fs.writeText(t,n):await e.fs.writeBytes(t,n);return{format:r,outDir:a,entry:`${a}/${h.entry}`,files:Object.keys(h.files).length,pageKb:h.pageKb,...h.pageKbGzip===void 0?{}:{pageKbGzip:h.pageKbGzip},folderKb:h.folderKb,totalKb:h.totalKb,sizes:h.sizes,page:{runtimeKb:h.page.runtimeKb,skippedChunks:h.page.skippedChunks.length,...h.page.pruned?{pruned:!0}:{}},runtime:h.runtime,...h.runtimeReasons?{runtimeReasons:h.runtimeReasons}:{},snippet:r===`single-html`?`(single file) ${a}/${h.entry}`:h.snippet,...h.head?{head:h.head}:{},...h.runtimeDir?{runtimeDir:h.runtimeDir}:{},...f?{ogImage:!0}:{},...m?{optimized:m}:{},credits:h.credits,...tm(h.issues),...t.optimize===!0&&!e.host.withImageCodec?{hint:`Textures were not resized (this host has no headless Chrome); geometry was compressed.`}:{}}}}],Lm=[`poster`,`video`,`gif`,`animated-webp`],Rm=[`draft`,`standard`,`high`,`ultra`];async function zm(e,t,n){if(!e.host?.media)throw new A(`invalid`,`This host cannot render a ${t}.`,`Export it with the CLI: agent3d export --format ${t===`animated-webp`?`gif`:t} (needs Chrome / Chromium).`);let r=G(n,`quality`);if(r!==void 0&&!Rm.includes(r))throw new A(`invalid`,`Unknown quality "${r}".`,`Use ${Rm.join(`, `)}.`);let i=G(n,`out`)?.replace(/^\.?\//,``),a=G(n,`image`)??(i?.endsWith(`.png`)?`png`:`webp`),o=G(n,`codec`)??(i?.toLowerCase().endsWith(`.mp4`)?`mp4`:`webm`);if(o!==`webm`&&o!==`mp4`)throw new A(`invalid`,`Unknown codec "${o}".`,`Use webm or mp4.`);let s=t===`poster`?`dist/poster.${a}`:t===`video`?`dist/video.${o}`:t===`gif`?`dist/animation.gif`:`dist/animation.webp`,c=i??s;if(!c.startsWith(`dist/`)&&!c.startsWith(`renders/`))throw new A(`invalid`,`out must be under dist/ or renders/ (got "${c}").`,`Use e.g. "${s}".`);let l=c.split(`.`).pop()?.toLowerCase(),u=t===`poster`?[`webp`,`png`]:t===`video`?[o]:t===`gif`?[`gif`]:[`webp`];if(!l||!u.includes(l))throw new A(`invalid`,`out "${c}" does not match the ${t} format (expected .${u.join(` / .`)}).`,`Use e.g. "${s}".`);let d=await e.host.media({format:t===`animated-webp`?`webp`:t,image:a,time:em(n,`time`),duration:em(n,`duration`),fps:em(n,`fps`),size:G(n,`size`),...t===`video`?{video:o}:{},...r?{quality:r}:{},...n.transparent===!0?{transparent:!0}:{}});return await e.fs.writeBytes(c,d.bytes),{format:t,path:c,kb:Math.round(d.bytes.byteLength/102.4)/10,size:d.size,...d.codec?{codec:d.codec}:{},...d.t===void 0?{}:{t:d.t},...d.frames===void 0?{}:{frames:d.frames,fps:d.fps,duration:d.duration}}}var Bm={name:`render_preview`,description:"Render the scene headless (deterministic) and save PNG frames + a contact sheet into renders/. ALWAYS look at the returned image (sheet) after changes: check composition, framing (nothing cut at the edges of a wide banner), readability of text, colours and lighting, then fix with scene_patch and render again. Returns frame paths (relative to the project folder `dir`), render stats (triangles, draw calls), per-object inspect data (in view / clipped / screen coverage), the game `state` (api.state, e.g. the score), runtime issues and console errors. Games: `input` plays simulated keys / clicks / drags / swipes while seeking, to test them headlessly. check reuses this data for framing / performance issues.",inputSchema:{type:`object`,properties:{frames:{type:`array`,items:{type:`number`},description:`Times in seconds, e.g. [0, 1.5, 3].`},count:{type:`integer`,minimum:1,maximum:16,description:`Or N evenly spaced frames over the timeline.`},size:{type:`string`,description:`Pixel size "WxH" (default 1200 wide at the target aspect).`},sheet:{type:`boolean`,description:`Compose a contact sheet (default true).`},isolate:{type:`string`,description:`Render only this object id, auto-framed from the front (+Z) three-quarter view on a neutral background — check a model's orientation / size after assets_add.`},bg:{type:`string`,description:`Background under the frames: "checker", a CSS colour or "none" (default: checkerboard under the sheet of transparent scenes).`},maxWidth:{type:`integer`,minimum:0,maximum:4096,description:`Width in pixels of the image returned to the client (MCP image block): the sheet / first frame is scaled down to it to save context (default 800; 0 = full size). Full-size PNGs stay on disk (sheet, frames).`},input:{type:`array`,description:`Games: simulated input applied while seeking (frames render in time order). Events: {"t": 0.5, "key": "ArrowRight", "down": true} (down false = release), {"t": 0.5, "key": "Space", "hold": 0.3}, {"t": 1, "click": [0, 0]}, {"t": 1, "pointer": [0.5, -0.2], "down"?: true|false}, {"t": 1, "pointerDown": [0, 0]}, {"t": 2, "pointerUp": [0.4, 0] | true}, {"t": 1, "drag": {"from": [-0.5, 0], "to": [0.5, 0], "duration": 0.4}}, {"t": 1, "swipe": "left"|"right"|"up"|"down"}, {"t": 1, "scroll": 0.5}, {"t": 3, "emit": "retry"} (emit an event, like a HUD button action), {"t": 3, "ui": "<HUD button id>"} (click that button), {"t": 0, "segment": "<timeline segment>"}. key = KeyboardEvent.code; coordinates are -1..1 (y up). Unknown fields are rejected.`,items:{type:`object`,additionalProperties:!0}},scroll:{type:`number`,minimum:0,maximum:1,description:"Scroll progress 0..1 for scroll-driven scenes (one frame unless frames / count are given); frames carry `scroll`."},reducedMotion:{type:`boolean`,description:`Render as visitors with prefers-reduced-motion see the scene (static pose / poster time).`},segment:{type:`string`,description:`Play this timeline segment (timeline.segments, or "timeline") from t = 0 — for scenes whose timeline waits for a click / interaction.`}}},mutating:!1,async handler(e,t){if(!e.host?.render)throw new A(`invalid`,`Rendering is not available in this host.`,`Use the CLI (agent3d render) — it needs Chrome / Chromium installed.`);let n=await e.host.render({frames:Array.isArray(t.frames)?t.frames:void 0,count:em(t,`count`),size:G(t,`size`),sheet:typeof t.sheet!=`boolean`||t.sheet,previewWidth:em(t,`maxWidth`)??800,...G(t,`isolate`)?{isolate:G(t,`isolate`)}:{},...G(t,`bg`)?{bg:G(t,`bg`)}:{},...Array.isArray(t.input)?{input:t.input}:{},...em(t,`scroll`)===void 0?{}:{scroll:em(t,`scroll`)},...t.reducedMotion===!0?{reducedMotion:!0}:{},...G(t,`segment`)?{segment:G(t,`segment`)}:{}});return Pm.set(e.fs,{stats:n.stats,inspect:n.inspect}),{...n.dir?{dir:n.dir}:{},sheet:n.sheet,...n.preview?{preview:n.preview}:{},...n.isolated?{isolated:n.isolated}:{},frames:n.frames,...n.state&&Object.keys(n.state).length?{state:n.state}:{},...n.inputWarnings?.length?{inputWarnings:n.inputWarnings}:{},stats:n.stats,...n.inspect?{inspect:{camera:n.inspect.camera,objects:n.inspect.objects.map(e=>({id:e.id,inView:e.inView,coverage:Math.round(e.screenCoverage*1e3)/1e3}))}}:{},...tm(n.issues,30),consoleErrors:n.consoleErrors.slice(0,20),hint:n.sheet?`Open ${n.sheet} and look at it before the next change.`:`Open the frame images and look at them before the next change.`}}},Vm=[`project_info`,`scene_get`,`scene_summary`,`scene_apply`,`scene_patch`,`scene_validate`,`object_add`,`object_update`,`object_remove`,`object_list`,`timeline_set`,`interactions_set`,`catalog_get`,`templates_list`,`project_create`,`check`,`assets_list`,`assets_search`,`assets_add`,`assets_optimize`,`image_depth`,`library_list`,`export`],Hm=new Map([...Nm,...Im].map(e=>[e.name,e])),Um=Vm.map(e=>{let t=Hm.get(e);if(!t)throw Error(`AI tool ${e} is not implemented`);return t});function Wm(e,t={}){let n=e?.render?[...Um,Bm]:[...Um];return t.readOnly?n.filter(e=>!e.mutating):n}function Gm(e,t){let n=Wm(t),r=n.find(t=>t.name===e);if(!r){let t=Fi(e,n.map(e=>e.name));throw new A(`notFound`,`Unknown tool "${e}".`,`${t?`Did you mean "${t}"? `:``}Tools: ${n.map(e=>e.name).join(`, `)}.`)}return r}async function Km(e,t,n){let r=Gm(t,e.host);return r.handler(e,im(r.inputSchema,n,t))}var qm=`agent3d-studio`,Jm=`projects`;function Ym(){return typeof indexedDB>`u`?Promise.resolve(null):new Promise(e=>{try{let t=indexedDB.open(qm,1);t.onupgradeneeded=()=>t.result.createObjectStore(Jm,{keyPath:`id`}),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}async function Xm(e,t){let n=await Ym();if(n)return new Promise(r=>{let i=t(n.transaction(Jm,e).objectStore(Jm));i.onsuccess=()=>r(i.result),i.onerror=()=>r(void 0)})}var Zm={async list(){return(await Xm(`readonly`,e=>e.getAll())??[]).map(({id:e,title:t,updatedAt:n,kind:r})=>({id:e,title:t,updatedAt:n,kind:r})).sort((e,t)=>String(t.updatedAt).localeCompare(String(e.updatedAt)))},async get(e){return await Xm(`readonly`,t=>t.get(e))},async put(e){await Xm(`readwrite`,t=>t.put(e))},async remove(e){await Xm(`readwrite`,t=>t.delete(e))}},Qm=class extends Si{id;meta;delay;timer=null;constructor(e,t,n,r=300){super(t),this.id=e,this.meta=n,this.delay=r}schedule(){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>void this.save(),this.delay)}async save(){this.timer=null,await Zm.put({id:this.id,...this.meta(),updatedAt:new Date().toISOString(),files:Object.fromEntries(this.files)})}async writeText(e,t){await super.writeText(e,t),this.schedule()}async writeBytes(e,t){await super.writeBytes(e,t),this.schedule()}async remove(e){await super.remove(e),this.schedule()}},$m=class extends Error{code;hint;details;constructor(e,t,n,r){super(t),this.code=e,this.hint=n,this.details=r,this.name=`ToolCallError`}},eh=`./library/`,th=[`./runtime/`,`./dist/runtime/`];async function nh(e){try{let t=await fetch(e);return!t.ok||(t.headers.get(`content-type`)??``).includes(`text/html`)?null:new Uint8Array(await t.arrayBuffer())}catch{return null}}var rh=class{mode=`local`;version=void 0;capabilities={render:!1,exportFormats:[`poster`],exportHint:`local`};fs=null;title=``;kind=``;libraryIndex=null;singleRuntime=null;blobUrls=[];async init(){for(let e of th)if(this.singleRuntime=await nh(`${e}agent3d-runtime.single.js`),this.singleRuntime)break;this.singleRuntime&&(this.capabilities={render:!1,exportFormats:[`single-html`,`poster`],exportHint:`local`})}get location(){return this.fs?.id??null}host(){let e=this.libraryIndex??{assets:[]};return{library:{index:e,read:async t=>{let n=e.assets.find(e=>e.id===t),r=n?await nh(eh+n.path):null;if(!r)throw new A(`notFound`,`Library asset ${t} is not available here.`);return r}},...this.singleRuntime?{runtimeFiles:async e=>{if(e!==`single-html`)throw new A(`invalid`,`Only single-html exports work in the browser.`,`Use the CLI for embed exports: agent3d export.`);return{"agent3d-runtime.single.js":this.singleRuntime}}}:{}}}hasProject(){return!!this.fs}canCreate(){return!0}projectTitle(){return this.title||`Untitled`}requireFs(){if(!this.fs)throw new $m(`no-project`,`No project is open.`);return this.fs}async loadScene(){return JSON.parse(await this.requireFs().readText(`scene.json`))}async tools(){return Wm(this.host()).map(({name:e,description:t,inputSchema:n,mutating:r})=>({name:e,description:t,inputSchema:n,mutating:r}))}async call(e,t){try{let n=await Km({fs:this.requireFs(),host:this.host()},e,t);return(e===`scene_apply`||e===`scene_patch`||e===`project_create`)&&await this.refreshTitle(),n}catch(e){throw e instanceof A?new $m(e.code,e.message,e.hint,e.details):e instanceof $m?e:new $m(`io`,e.message)}}async refreshTitle(){try{let e=await this.loadScene();this.title=e.title,this.kind=e.target?.kind??``}catch{}}async library(){if(!this.libraryIndex){let e=await nh(`${eh}index.json`);try{this.libraryIndex=e?JSON.parse(new TextDecoder().decode(e)):{assets:[]}}catch{this.libraryIndex={assets:[]}}}return this.libraryIndex}async templates(){return[]}templatePreview(){return null}blob(e,t){let n=URL.createObjectURL(new Blob([t],{type:Wc(e)}));return this.blobUrls.push(n),n}async fileUrl(e){return this.blob(e,await this.requireFs().readBytes(e))}readFile(e){return this.requireFs().readBytes(e)}writeFile(e,t){return this.requireFs().writeBytes(e,t)}onChange(){return()=>void 0}async mountConfig(){await this.library();let e=this.requireFs(),t={};for(let n of await e.list(`assets/`))t[n]=this.blob(n,await e.readBytes(n));let n={};for(let t of await e.list(`scripts/`))n[t]=await e.readText(t);return{libraryBase:eh,assetUrls:t,scriptSources:n}}async createProject(e){let t=new Qm(`${Ri(e.name,`project`)}-${Date.now().toString(36)}`,{},()=>({title:this.title,kind:this.kind}));this.fs=t,this.title=e.title??e.name,await this.call(`project_create`,{name:Ri(e.name,`project`),...e.title?{title:e.title}:{},...e.kind?{kind:e.kind}:{}}),await t.save()}async recent(){return Zm.list()}async open(e){let t=await Zm.get(e);if(!t)throw new $m(`notFound`,`This project is no longer stored in this browser.`);this.blobUrls.forEach(e=>URL.revokeObjectURL(e)),this.blobUrls=[],this.title=t.title,this.kind=t.kind??``,this.fs=new Qm(t.id,t.files,()=>({title:this.title,kind:this.kind}))}async remove(e){await Zm.remove(e),this.fs?.id===e&&(this.fs=null)}close(){this.fs=null}};async function ih(e,t,n=fetch){let r;try{r=await n(e,t)}catch(e){throw new $m(`offline`,`The Studio server is not reachable (${e.message}).`,"Is `agent3d studio` still running?")}let i;try{i=await r.json()}catch{throw new $m(`bad-response`,`Unexpected response from ${e} (HTTP ${r.status}).`)}if(!i.ok)throw new $m(i.error.code,i.error.message,i.error.hint,i.error.details);return i.data}async function ah(e=fetch){try{let t=await e(`./api/info`,{headers:{accept:`application/json`}});if(!t.ok||!(t.headers.get(`content-type`)??``).includes(`json`))return null;let n=await t.json();return n.ok?n.data:null}catch{return null}}var oh=`agent3d.studio.recentDirs`,sh=class{info;mode=`cli`;version;toolsCache=null;constructor(e){this.info=e,this.version=e.version,e.project?.exists&&lh(e.project.dir,this.projectTitle())}get location(){return this.info.project?.dir??null}capabilities={render:!0,depth:!0,exportFormats:[`embed`,`zip`,`single-html`,`poster`,`video`,`gif`]};hasProject(){return!!this.info.project?.exists}canCreate(){return!!this.info.project}projectTitle(){let e=this.info.project?.manifest;return e?.title||e?.name||this.info.project?.dir.split(`/`).pop()||`Untitled`}async loadScene(){let e=await fetch(`./api/project/scene.json?ts=${Date.now()}`,{cache:`no-store`});if(!e.ok)throw new $m(`notFound`,`scene.json could not be read.`);return await e.json()}tools(){return this.toolsCache||=ih(`./api/tools`).then(e=>e.tools),this.toolsCache}call(e,t){return ih(`./api/tools/call`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:e,input:t})})}async library(){try{return await ih(`./api/library`)}catch{return{assets:[]}}}async templates(){try{return(await ih(`./api/templates`)).templates}catch{return[]}}templatePreview(e){return`./api/templates/${encodeURIComponent(e)}/preview.png`}rel(e){let t=this.info.project?.dir;if(t&&e.startsWith(`${t}/`))return e.slice(t.length+1);let n=t?.replace(/^\/private\//,`/`);return n&&e.startsWith(`${n}/`)?e.slice(n.length+1):e.replace(/^\.\//,``)}async fileUrl(e){return e=this.rel(e),`${this.info.assetBase.replace(/\/?$/,`/`)}${e.split(`/`).map(encodeURIComponent).join(`/`)}?v=${Date.now()}`}async readFile(e){e=this.rel(e);let t=await fetch(`./api/project/${e.split(`/`).map(encodeURIComponent).join(`/`)}`,{cache:`no-store`});if(!t.ok)throw new $m(`notFound`,`No file ${e}.`);return new Uint8Array(await t.arrayBuffer())}async writeFile(e,t){await ih(`./api/project/${e.split(`/`).map(encodeURIComponent).join(`/`)}`,{method:`PUT`,body:t})}onChange(e){if(typeof EventSource>`u`)return()=>void 0;let t=new EventSource(`./api/events`);return t.addEventListener(`change`,t=>{try{let n=JSON.parse(String(t.data));Array.isArray(n.paths)&&e(n.paths)}catch{}}),()=>t.close()}async mountConfig(){return{assetBase:this.info.assetBase,libraryBase:this.info.libraryBase}}async createProject(e){await this.call(`project_create`,{name:e.name,...e.title?{title:e.title}:{},...e.template?{template:e.template}:{},...e.kind?{kind:e.kind}:{},force:!0}),this.info=await ah()??this.info}async recent(){return ch()}async open(){}};function ch(){try{let e=JSON.parse(localStorage.getItem(oh)??`[]`);return Array.isArray(e)?e:[]}catch{return[]}}function lh(e,t){try{let n=[{id:e,title:t,updatedAt:new Date().toISOString()},...ch().filter(t=>t.id!==e)].slice(0,8);localStorage.setItem(oh,JSON.stringify(n))}catch{}}var uh={fields:{accent:`Accent`,action:`Action`,align:`Align`,alphaMap:`Alpha map`,anchor:`Anchor`,angle:`Angle`,angularDamping:`Angular damping`,angularVelocity:`Angular velocity`,anisotropy:`Anisotropy`,anisotropyRotation:`Anisotropy rotation`,antialias:`Antialias`,aoMap:`Ao map`,aoMapIntensity:`Ao map intensity`,area:`Area`,ariaLabel:`Accessible label`,aspect:`Aspect`,attach:`Attach`,attenuationColor:`Attenuation color`,attenuationDistance:`Attenuation distance`,autoRotate:`Auto rotate`,axis:`Axis`,azimuth:`Azimuth`,background:`Background`,bevel:`Bevel`,bias:`Bias`,blending:`Blending`,blur:`Blur`,bottom:`Bottom`,budgetKb:`Budget KB`,bumpMap:`Bump map`,bumpScale:`Bump scale`,buttonText:`Button text`,castShadow:`Cast shadow`,ccd:`CCD (anti-tunnelling)`,center:`Center`,character:`Character`,clearcoat:`Clearcoat`,clearcoatRoughness:`Clearcoat roughness`,clip:`Clip`,clouds:`Clouds`,collideConnected:`Collide connected`,collidesWith:`Collides with`,color:`Color`,controls:`Controls`,count:`Count`,crossfade:`Crossfade`,curveSegments:`Curve segments`,damping:`Damping`,debug:`Debug`,decay:`Decay`,delay:`Delay`,density:`Density`,depth:`Depth`,description:`Description`,direction:`Direction`,dispersion:`Dispersion`,displacementMap:`Displacement map`,displacementScale:`Displacement scale`,distance:`Distance`,duration:`Duration`,effect:`Effect`,elevation:`Elevation`,emissive:`Emissive`,emissiveIntensity:`Emissive intensity`,emissiveMap:`Emissive map`,envMapIntensity:`Env map intensity`,exposure:`Exposure`,falloff:`Falloff`,far:`Far`,fit:`Fit`,fixedRotation:`Fixed rotation`,flatShading:`Flat shading`,font:`Font`,fov:`FOV`,frames:`Frames`,friction:`Friction`,grain:`Grain`,gravity:`Gravity`,gravityScale:`Gravity scale`,grid:`Grid`,groundColor:`Ground color`,height:`Height`,horizon:`Horizon`,href:`Link`,intensity:`Intensity`,ior:`IOR`,iridescence:`Iridescence`,iridescenceIOR:`Iridescence IOR`,iridescenceThicknessRange:`Iridescence thickness range`,iterations:`Iterations`,keepColors:`Keep colors`,kerning:`Kerning`,layer:`Layer`,layerGap:`Layer gap`,lazy:`Lazy`,length:`Length`,letterSpacing:`Letter spacing`,lifetime:`Lifetime`,light:`Light`,lineHeight:`Line height`,linearDamping:`Linear damping`,loop:`Loop`,map:`Colour map`,mapSize:`Map size`,mass:`Mass`,material:`Material`,maxDpr:`Max DPR`,maxForce:`Max force`,maxWidth:`Max width`,metalness:`Metalness`,metalnessMap:`Metalness map`,mieCoefficient:`Mie coefficient`,mieDirectionalG:`Mie directional g`,near:`Near`,normalBias:`Normal bias`,normalMap:`Normal map`,normalScale:`Normal scale`,offset:`Offset`,opacity:`Opacity`,orbitZoom:`Orbit zoom`,order:`Order`,panel:`Panel`,pauseOffscreen:`Pause offscreen`,penumbra:`Penumbra`,pivot:`Pivot`,position:`Position`,posterTime:`Poster time`,preset:`Preset`,quality:`Quality`,radius:`Radius`,rayleigh:`Rayleigh`,receiveShadow:`Receive shadow`,reducedMotion:`Reduced motion`,repeat:`Repeat`,resolution:`Resolution`,restLength:`Rest length`,restitution:`Restitution`,rotation:`Rotation`,roughness:`Roughness`,roughnessMap:`Roughness map`,scale:`Scale`,seed:`Seed`,shadowOnly:`Shadow only`,shadows:`Shadows`,shape:`Shape`,sheen:`Sheen`,sheenColor:`Sheen color`,sheenRoughness:`Sheen roughness`,side:`Side`,size:`Size`,skyColor:`Sky color`,sleep:`Sleep`,softness:`Softness`,specularColor:`Specular color`,specularIntensity:`Specular intensity`,speed:`Speed`,splitLetters:`Split letters`,spread:`Spread`,src:`Src`,stagger:`Stagger`,stars:`Stars`,step:`Step`,stiffness:`Stiffness`,strokes:`Strokes`,style:`Style`,substeps:`Substeps`,target:`Target`,text:`Text`,thickness:`Thickness`,title:`Title`,toneMapping:`Tone mapping`,top:`Top`,transmission:`Transmission`,transparent:`Transparent`,triplanar:`Triplanar`,turbidity:`Turbidity`,type:`Type`,value:`Value`,velocity:`Velocity`,width:`Width`,wireframe:`Wireframe`,y:`Y`,mode:`Mode`,strength:`Strength`,focus:`Focus`,segments:`Segments`,layers:`Layers`,edgeCut:`Edge cut`,pointer:`Pointer`,scroll:`Scroll`,gyro:`Gyroscope`,auto:`Auto motion`,smoothing:`Smoothing`,zoom:`Zoom`},ui:{close:`Close`,reset:`Reset to default`,colourValue:`Colour value`,removeColour:`Remove colour`,addColour:`Add colour`,triplanarScale:`Triplanar scale`,urlPlaceholder:`https://… or /page`},app:{loading:`Loading…`,loadingScene:`Opening the scene…`,loadFailed:`The project could not be opened.`},top:{projects:`Projects`,inBrowser:`Stored in this browser`,undo:`Undo`,redo:`Redo`,play:`Play`,pause:`Pause`,scrub:`Time`,check:`Check`,checkHint:`Check validation, budgets, framing and accessibility before export`,render:`Render`,renderHint:`Render frames headless and show the contact sheet`,export:`Export`,assistant:`Assistant`,shortcuts:`Keyboard shortcuts`,language:`Language`},save:{saved:`Saved`,saving:`Saving…`,pending:`Unsaved`,error:`Not saved`,errorHint:`The scene has errors: fix them (JSON tab) and it saves again.`},external:{title:`scene.json changed externally`,files:`Project files changed`,undo:`Undo`},edit:{failed:`This change could not be applied`},outliner:{title:`Outliner`,scene:`Scene`,addGroup:`Add group`,duplicate:`Duplicate`,delete:`Delete`,hide:`Hide`,show:`Show`,expand:`Expand`,collapse:`Collapse`,empty:`No objects yet. Add one below.`},add:{primitives:`Primitives`,text:`Text`,generators:`Generators`,particles:`Particles`,library:`Library`,lights:`Lights`,textValue:`Text to add`,searchModels:`Search {n} models`,noMatch:`No model matches.`,noLibrary:`The built-in library is not available here.`,lightHint:`Adds a light to the scene`,photo:`3D photo`,photoHint:`Pick an image: it becomes a 3D photo (parallax). Add a depth map in the inspector for the relief.`,photoSelected:`Use the selected image`,photoNone:`No image in this project yet. Import one (agent3d assets add) or type its path below.`,photoAdd:`Add the 3D photo`},kinds:{mesh:`Mesh`,text:`Text`,model:`Model`,group:`Group`,generator:`Generator`,particles:`Particles`,instances:`Instances`,svg:`SVG`,photo:`3D photo`},inspector:{idHint:`Object id (used by timeline tracks and scripts)`,deselect:`Deselect`,name:`Name`,visible:`Visible`,transform:`Transform`,position:`Position`,rotation:`Rotation`,scale:`Scale`,scaleSplit:`Scale axes separately`,scaleUniform:`Uniform scale`,geometry:`Geometry`,type:`Type`,layout:`Layout`,text:`Text`,seed:`Seed`,material:`Material`,preset:`Preset`,noPreset:`No preset`,shader:`Shader`,moreOptions:`More options`,lessOptions:`Fewer options`,behaviours:`Behaviours`,addBehaviour:`Add behaviour`,searchBehaviours:`Search behaviours`,noBehaviours:`No behaviour. Add rotate, float, hover effects…`,removeBehaviour:`Remove behaviour`,unknownBehaviour:`Unknown behaviour type.`,when:`When`,physics:`Physics body`,addBody:`Add body`,removeBody:`Remove body`,advanced:`Advanced`,tags:`Tags`,tagsHint:`Scripts find objects by tag`,font:`Font`,outline:`Outline`,outlineHint:`A contrasting rim behind the letters.`,reveal:`Letter reveal`,revealHint:`Per-letter staggered entrance (rise, fade, scale, spin, drop).`,ease:`Easing`,physicalLayers:`Physical layers`,physicalHint:`These need a physical material (type physical or a physical preset).`,textures:`Textures`,fromPreset:`From the preset: {v}`,moreSlots:`More options shows every texture slot.`,triplanarHint:`Project textures along X/Y/Z instead of UVs (no stretching).`,renderingPresets:`Rendering previews…`,addStaticBody:`Static body`,addDynamicBody:`Dynamic body`,bodyMotion:`Motion & surface`,collidesWithHint:`Layers this body collides with (empty: all).`,allLayers:`all layers`,staticOnlyShape:`This shape only works on static or kinematic bodies.`,collider:`Collider {n}`,addCollider:`Add collider`,removeCollider:`Remove collider`},photo:{image:`Image`,imageHint:`The photo (.jpg / .png / .webp): a project file or a library image.`,depth:`Depth map`,depthHint:`Grayscale image of the same aspect, white = near. Without it the photo is flat.`,none:`None`,projectImages:`Project images`,libraryImages:`Library images`,typePath:`Type a path…`,pathPlaceholder:`assets/textures/photo.jpg`,generateDepth:`Generate depth map`,generateDepthHint:`Estimate a depth map from the image (runs locally in headless Chrome) and use it`,generatingDepth:`Estimating depth…`,depthNeedsCli:`Depth estimation needs the CLI: open this project with agent3d studio.`,flatHint:`No depth map yet: the photo renders flat. Generate one or pick an existing depth image.`,depthDone:`Depth map ready`,depthFailed:`Depth estimation failed`,depthNoPath:`The tool did not return a depth map path.`,motion:`Motion`},when:{always:`always`,hover:`on hover`,click:`on click`,visible:`when visible`,scroll:`on scroll`,manual:`manual (interactions)`},scene:{title:`Scene`,subtitle:`Nothing selected: these settings apply to the whole scene.`,meta:`Scene`,target:`Target`,kind:`Kind`,camera:`Camera`,environment:`Environment`,background:`Background`,color:`Colour`,colors:`Colours`,angle:`Angle`,stars:`Stars`,blur:`Blur`,lighting:`Lighting`,lightingHint:`Image-based lighting for reflections`,intensity:`Intensity`,fog:`Fog`,off:`Off`,fogLinear:`Linear`,fogDensity:`Density`,ground:`Ground`,lights:`Lights`,lightType:`Light type`,addLight:`Add light`,removeLight:`Remove light`,noLights:`No lights: only environment lighting.`,postfx:`Post effects`,addEffect:`Add effect`,removeEffect:`Remove effect`,searchEffects:`Search effects`,noEffects:`No post effect.`,physics:`Physics`,enablePhysics:`Enable physics`,disable:`Disable`,audio:`Audio`,music:`Music`,volume:`Volume`,muted:`Start muted`,none:`None`,sounds:`Sounds: {list}`,hud:`HUD`,addHud:`Add HUD element`,removeHud:`Remove HUD element`},bg:{color:`Solid colour`,gradient:`Gradient`,radial:`Radial`,sky:`Gradient sky`,hdri:`HDRI`,transparent:`Transparent`,meshGradient:`Mesh gradient`,physicalSky:`Physical sky`},viewport:{device:`Device preview`,desktop:`Desktop`,tablet:`Tablet (820 px)`,phone:`Phone (390 px)`,select:`Select objects`,interact:`Interact with the scene`,helpers:`Grid and helpers`,clickToSelect:`Click to select an object`,tris:`tris`,calls:`draw calls`,starting:`Starting…`,runtimeIssues:`Runtime issues: {n}`,tools:`Viewport tools`,move:`Move`,rotate:`Rotate`,scale:`Scale`,world:`World space (click for local)`,local:`Local space (click for world)`,snap:`Snap to grid, 15° and 0.1 (hold Shift to toggle while dragging)`,view:`View`,editorCamera:`Editor camera`,sceneCamera:`Scene camera`,editorShort:`Editor`,cameraShort:`Camera`,setCamera:`Set the scene camera from this view`,cameraSet:`Scene camera updated`,cameraSetDetail:`camera.position and camera.target now match the editor view.`,frame:`Frame selection`,dropHere:`Drop to place it here`,navHint:`Drag: orbit · Right-drag: pan · Wheel: zoom`,cameraHint:`What the website shows`},bottom:{timeline:`Timeline`,json:`JSON`,check:`Check`,collapse:`Collapse panel`,expand:`Expand panel`,interactions:`Interactions`},timeline:{keyN:`key {n} / {total}`,property:`Property to key`,addKey:`Key at {t}s`,addKeyHint:`Add a keyframe at the playhead with the current value`,duration:`Duration`,once:`Once`,loop:`Loop`,pingpong:`Ping-pong`,trigger:`Trigger`,autoplay:`Autoplay`,remove:`Remove timeline`,none:`No timeline yet`,ease:`Easing`,removeTrack:`Remove track`,keyTime:`Key time`,keyValue:`Key value`,deleteKey:`Delete key`,empty:`Select an object (or keep the camera) and add a key at the playhead.`,emptySelected:`Pick a property and add a key to animate {id}.`,speed:`Speed`,speedHint:`Playback rate of the whole timeline`,autoplayOn:`Autoplay`,autoplayOff:`Waits`,autoplaySegment:`Plays {name}`,markers:`Markers`,segments:`Segments`,markerLaneHint:`Double-click to add a marker, drag to move it`,addMarker:`Add a marker at the playhead`,markerName:`Marker name`,markerTime:`Marker time`,removeMarker:`Remove marker`,noMarkers:`Markers name times: crossing one emits an event (scripts, interactions).`,addSegment:`Add a segment`,segmentName:`Segment name`,playSegment:`Play segment`,playReverse:`Play backwards`,removeSegment:`Remove segment`,noSegments:`Segments are named ranges that interactions play (hover-in, open…).`,from:`from`,to:`to`,keyEase:`Easing into this key`,keyEaseHint:`Shapes the motion that ends at this key`,trackEase:`Track easing ({ease})`},trigger:{load:`on load`,visible:`when visible`,hover:`on hover`,click:`on click`,scroll:`on scroll`,manual:`manual (interactions)`},json:{valid:`Valid`,errors:`{n} errors`,invalidJson:`Invalid JSON`,format:`Format`,revert:`Revert`,apply:`Apply`,fixFirst:`Fix the errors first`,noIssues:`No issues.`,unapplied:`Edits not applied yet.`},check:{failed:`Check failed`,emptyTitle:`Check before you export`,emptyBody:`Validation, missing files, script sandbox, triangle and size budgets, framing (after a render) and accessibility. Every issue says what to change.`,run:`Run check`,rerun:`Run again`,ready:`Ready to export`,notReady:`Fix the errors`,errors:`{n} errors`,warnings:`{n} warnings`,infos:`{n} notes`,triangles:`Estimated triangles`,weight:`Bundle weight`,runtime:`Runtime (shared)`,heaviest:`Heaviest objects`,licences:`Credits required`,clean:`No issues. Ship it.`},render:{title:`Render preview`,intro:`Renders the scene headless in Chrome (deterministic) and saves the frames and a contact sheet in renders/. Agents use the same images to check their work.`,localIntro:`Headless rendering needs the CLI (agent3d studio). Here you get a clean still of the current frame.`,frames:`Frames`,run:`Render`,again:`Render again`,rendering:`Rendering…`,download:`Download PNG`,placeholder:`The contact sheet appears here.`,sheetAlt:`Contact sheet of the rendered frames`,stats:`{tris} triangles · {calls} draw calls`,tabFrames:`Frames`,tabMedia:`Video & animation`,mediaIntro:`Renders every frame exactly (deterministic) in headless Chrome and saves the file in renders/.`,mediaNeedsCli:`Video and animation renders need the CLI (agent3d studio) and Chrome.`,renderMedia:`Render {kind}`,renderingMedia:`Rendering every frame… this can take a while.`,mediaPlaceholder:`The video or animation appears here.`,framesUnit:`frames`},export:{title:`Export`,embed:`Embed folder`,embedBody:`A folder for any static site: runtime, scene, assets and the snippet to paste.`,single:`Single HTML file`,singleBody:`Everything inline in one .html file (scene, assets, runtime).`,poster:`Poster image`,posterBody:`A WebP or PNG still at the poster time, for fallbacks and social cards.`,video:`Video`,videoBody:`An MP4 or WebM video of the timeline, frame-exact.`,videoCli:`From the terminal for now: agent3d export --format video`,needsCli:`Needs the CLI (agent3d studio) or the runtime files next to the Studio.`,name:`Name`,withPoster:`Render a poster`,run:`Export`,done:`Exported {files} files, {kb} KB.`,output:`Output`,copy:`Copy`,copied:`Copied`,download:`Download file`,downloadPoster:`Download poster`,localNote:`In-browser projects export a single HTML file you can download.`,zip:`Zip archive`,zipBody:`The embed folder as one .zip to upload (CMS, hosting panels).`,gif:`Animated GIF`,gifBody:`A looping GIF of the timeline (emails, docs, chats).`,baseUrl:`Base URL`,baseUrlHint:`Where the folder is served (e.g. /static/3d/)`,cacheBust:`Cache-bust`,cacheBustHint:`Versioned runtime folder + ?v= hash`,integrity:`Integrity (SRI)`,integrityHint:`sha384 hash on the runtime script`,optimize:`Optimise assets`,optimizeHint:`Lighter copies; the project is unchanged`,withPosterHint:`Shown before load and without WebGL`,og:`Social image`,ogHint:`1200×630 og-image.png`,optimized:`Assets {before} → {after} KB`},ease:{title:`Easing`,named:`Curves`,cubicBezier:`Bezier`,spring:`Spring`,steps:`Steps`,stiffness:`Stiffness`,damping:`Damping`,mass:`Mass`,springHint:`Lower damping = more bounce. The spring settles at the end of the segment.`,count:`Steps`,jumpStart:`Jump at start`},env:{lightingIntensity:`Overall intensity`,skyPreset:`Time of day`,sun:`Sun`,noSun:`Hide the sun`,atmosphere:`Atmosphere`,groundProjection:`Ground projection`,groundProjectionHint:`Objects stand inside the photo (lower half projected on a ground disc)`,hdriPath:`Or a project path (.hdr / .exr / .jpg)`,lighting:`Lighting`,rig:`Light rig`,rigHint:`Named lighting setup added to the lights`,shadows:`Shadows`,contactShadows:`Contact shadows`,contactShadowsHint:`Soft blurred shadows under the objects (product shots)`,shadowQuality:`Shadow quality`,shadowQualityHint:`Shadow-map type, softness and size for every light`,atmosphereGround:`Fog & ground`,fogHeight:`Height fog`},lighting:{studio:`Studio`,soft:`Soft`,sunset:`Sunset`,night:`Night`,neutral:`Neutral`,sky:`From the sky / background`,none:`None`,hdri:`HDRI file`},lights:{volumetric:`Volumetric cone`,volumetricHint:`Cheap visible light cone`,shadow:`Shadow settings`},texture:{none:`None`,file:`File`,library:`Library`,procedural:`Procedural`},matgroup:{clearcoat:`Clearcoat`,sheen:`Sheen`,transmission:`Transmission`,iridescence:`Iridescence`,anisotropy:`Anisotropy`,specular:`Specular`},postfx:{look:`Look`,lookHint:`A tuned stack of effects; effects listed below override it`,drag:`Drag to reorder`,up:`Move up`,down:`Move down`,unknown:`Unknown effect.`,gpuHint:`GPU cost (quality tiers drop costly effects on weak devices)`,gpu:{low:`light`,medium:`medium`,high:`heavy`},level:{none:`none`,light:`Light`,moderate:`Moderate`,heavy:`Heavy`},passes:`≈ {n} passes per frame`,droppedLow:`off on low: {list}`,costHint:`Estimated cost of the post-processing pipeline`},physics:{layers:`Layers`,layersHint:`Collision layer names in bit order (max 16)`,materials:`Surface materials`,addMaterial:`Add a surface material`,removeMaterial:`Remove material`,materialName:`Material name`,noMaterials:`Named friction / bounciness pairs that bodies refer to.`,contacts:`Contacts`,contactsHint:`Per-pair overrides: [{ a, b, friction, restitution }]`,joints:`Joints`,addJoint:`Add a joint`,removeJoint:`Remove joint`,jointType:`Joint type`,world:`world`,motor:`Motor`,motorHint:`Hinge motor: speed (°/s) and max force`,noJoints:`Connect two bodies (door hinge, pendulum, spring…).`,noBodies:`Add a physics body to objects first (inspector → Physics body).`},shots:{title:`Camera shots`,add:`Add shot`,search:`Search shot types`,empty:`Cinematic camera moves on the timeline clock: push in, orbit, crane, follow a path…`,laneHint:`When each shot plays (click to jump there)`,typeLabel:`Shot type`,play:`Play from this shot`,remove:`Remove shot`,timing:`Start / length`,at:`Start`,duration:`Duration`,object:`Object`,objectHint:`Object to look at / focus on`,points:`Points`,preview:`Preview`,previewHint:`Scrub through this shot`,type:{dolly:`along the view axis`,pushIn:`move closer`,pullOut:`move back`,truck:`slide sideways`,pedestal:`rise / lower, target follows`,crane:`rise while looking at the target`,orbit:`circle around the target`,zoom:`change the field of view`,move:`go to a position / target`,path:`follow a smooth path`,lookAt:`pan to an object`,focus:`rack focus (dof)`}},interactions:{intro:`No-code triggers: when something happens, do something.`,add:`Add interaction`,empty:`No interaction yet.`,emptyHint:`Play a segment on hover, open a link on click, toggle a panel with a key, react to a marker…`,when:`When`,anywhere:`anywhere`,target:`Target object`,key:`Key code`,eventName:`Event name`,marker:`marker…`,at:`Scroll progress`,once:`Once`,onceHint:`Fire only the first time`,test:`Test`,testHint:`Fire it in the viewport now`,remove:`Remove interaction`,action:`Action`,addAction:`Add action`,removeAction:`Remove action`,segment:`Segment`,reverse:`Reverse`,seek:`Time or marker`,useMarker:`Use a marker`,useSeconds:`Use seconds`,newTab:`New tab`,model:`Model`,clip:`Clip name or index`,path:`Property`,value:`Value`,tween:`Tween`,payload:`Payload`,badUrl:`Only http(s) URLs or page-relative paths (/shop) can be opened.`,needsGesture:`Opening a URL needs a click or key interaction (a user gesture).`,on:{click:`Click`,hover:`Hover`,hoverEnd:`Hover end`,visible:`Becomes visible`,scroll:`Scroll past`,key:`Key press`,event:`Event / marker`},do:{play:`Play segment`,toggle:`Toggle segment`,seek:`Jump to`,set:`Set property`,emit:`Emit event`,openUrl:`Open URL`,playClip:`Play model clip`}},media:{quality:`Quality`,qualityHint:`Supersampling: high = 2×, ultra = 3× (smoother edges, slower)`,q:{draft:`Draft`,standard:`Standard`,high:`High (2×)`,ultra:`Ultra (3×)`},fps:`Frames / s`,duration:`Duration`,time:`Time`,image:`Format`,size:`Size (px)`,sizeHint:`Empty: from the target aspect`,width:`Width`,height:`Height`,transparent:`Transparent`,transparentHint:`Keep the alpha channel (no background)`,kind:{mp4:`MP4`,webm:`WebM`,gif:`GIF`,webp:`WebP`,poster:`Still`},about:{mp4:`H.264 video: plays everywhere (needs Google Chrome to encode).`,webm:`VP9 video: small files for the web.`,gif:`Looping animated GIF (640 px, 15 fps by default).`,webp:`Animated WebP: smaller than GIF, with alpha (800 px, 20 fps by default).`,poster:`A single still image.`}},keys:{title:`Keyboard shortcuts`,general:`General`,undo:`Undo`,redo:`Redo`,save:`Save now`,duplicate:`Duplicate selection`,delete:`Delete selection`,hide:`Hide / show selection`,deselect:`Deselect`,play:`Play / pause`,timeline:`Toggle timeline`,json:`Toggle JSON`,interact:`Interact mode`,assistant:`Toggle assistant`,dragFast:`Drag a number faster`,dragFine:`Drag a number finer`,selectTool:`Select tool`,move:`Move gizmo`,rotate:`Rotate gizmo`,scale:`Scale gizmo`,space:`Local / world space`,snapHold:`Toggle snapping while dragging`,frame:`Frame selection (or the whole scene)`,cameraView:`Editor camera / scene camera`,grid:`Grid and helpers`,orbit:`Orbit / pan the editor camera`,zoom:`Zoom the editor camera`,drop:`Place an item where it is dropped`},start:{tagline:`See, tweak and export the 3D scenes your AI agent builds. Edits are saved to scene.json, so agents in a terminal see them too.`,cliMode:`Project folder · agent3d {v}`,localMode:`In-browser projects`,noFolderTitle:`The Studio was started without a project folder`,noFolderBody:`Create a project from the terminal, then open it in the Studio:`,starters:`New project`,startersHint:`A good-looking starter scene for each format`,templates:`Templates`,all:`All`,noTemplates:`No templates found next to the CLI.`,noTemplatesLocal:`Templates come with the CLI (agent3d studio). Start from a format above.`,recent:`Recent`,noRecent:`Nothing yet.`,remove:`Remove from this browser`,otherFolder:`Open it with: agent3d studio --project {dir}`,continue:`Open {title}`,replaceConfirm:`This replaces the project in {dir} with a new one. Continue?`,agentTitle:`Working with an agent`,agentBody:`Ask Claude Code (or any MCP client) to edit the scene while the Studio is open: changes appear live, highlighted, and you can undo them here.`,kinds:{banner:`Wide 4:1 strip`,hero:`16:9 page header`,card:`Product card`,square:`Square tile`,fullscreen:`Landscape, full page`,game:`Mini game`},untitled:{banner:`Untitled banner`,hero:`Untitled hero`,card:`Untitled card`,square:`Untitled square`,fullscreen:`Untitled landscape`,game:`Untitled game`}},assistant:{title:`Assistant`,model:`Model`,newChat:`New chat`,settings:`API key`,close:`Close`,keyTitle:`Optional: chat with Claude using your own API key`,keyBody1:`The assistant edits this scene with the same tools as the CLI and MCP agents. It uses your Anthropic API key and your account is billed for it.`,keyBody2:`The key is stored only in this browser (localStorage) and sent only to api.anthropic.com.`,keyLabel:`Anthropic API key`,showKey:`Show key`,hideKey:`Hide key`,saveKey:`Save`,forgetKey:`Forget the key`,emptyTitle:`Describe a change, the assistant does it in the scene.`,example1:`Make the title gold and add a gentle float`,example2:`Add snow particles and a night sky`,example3:`Render a preview and fix anything cut at the edges`,placeholder:`Ask for a change… (Enter to send)`,needKey:`Add an API key above to chat`,send:`Send`,stop:`Stop`,working:`Working…`,undo:`Undo`,stopped:`Stopped.`,maxIterations:`Stopped after many steps. Ask to continue if needed.`,refused:`Claude declined this request.`,renderAlt:`Rendered preview`,toolsCount:`{n} tools`}},dh={en:uh,fr:{fields:{accent:`Accent`,action:`Action`,align:`Alignement`,alphaMap:`Alpha (carte)`,anchor:`Ancrage`,angle:`Angle`,angularDamping:`Amortissement angulaire`,angularVelocity:`Vitesse angulaire`,anisotropy:`Anisotropie`,anisotropyRotation:`Rotation de l’anisotropie`,antialias:`Anticrénelage`,aoMap:`Occlusion (AO)`,aoMapIntensity:`Intensité AO`,area:`Zone`,ariaLabel:`Libellé accessible`,aspect:`Format`,attach:`Attacher à`,attenuationColor:`Couleur d’atténuation`,attenuationDistance:`Distance d’atténuation`,autoRotate:`Rotation auto`,axis:`Axe`,azimuth:`Azimut`,background:`Fond`,bevel:`Biseau`,bias:`Biais`,blending:`Fusion`,blur:`Flou`,bottom:`Bas`,budgetKb:`Budget (Ko)`,bumpMap:`Relief (carte)`,bumpScale:`Relief`,buttonText:`Texte des boutons`,castShadow:`Projette des ombres`,ccd:`CCD (anti-traversée)`,center:`Centre`,character:`Personnage`,clearcoat:`Vernis`,clearcoatRoughness:`Rugosité du vernis`,clip:`Clip`,clouds:`Nuages`,collideConnected:`Collision entre liés`,collidesWith:`Entre en collision avec`,color:`Couleur`,controls:`Contrôles`,count:`Nombre`,crossfade:`Fondu`,curveSegments:`Segments de courbe`,damping:`Amortissement`,debug:`Débogage`,decay:`Décroissance`,delay:`Délai`,density:`Densité`,depth:`Profondeur`,description:`Description`,direction:`Direction`,dispersion:`Dispersion`,displacementMap:`Déplacement (carte)`,displacementScale:`Déplacement`,distance:`Distance`,duration:`Durée`,effect:`Effet`,elevation:`Élévation`,emissive:`Émissif`,emissiveIntensity:`Intensité émissive`,emissiveMap:`Émissif (carte)`,envMapIntensity:`Intensité de l’environnement`,exposure:`Exposition`,falloff:`Atténuation`,far:`Loin`,fit:`Ajustement`,fixedRotation:`Rotation bloquée`,flatShading:`Ombrage plat`,font:`Police`,fov:`Champ de vision`,frames:`Images`,friction:`Friction`,grain:`Grain`,gravity:`Gravité`,gravityScale:`Échelle de gravité`,grid:`Grille`,groundColor:`Couleur du sol`,height:`Hauteur`,horizon:`Horizon`,href:`Lien`,intensity:`Intensité`,ior:`IOR`,iridescence:`Irisation`,iridescenceIOR:`IOR de l’irisation`,iridescenceThicknessRange:`Épaisseur de l’irisation`,iterations:`Itérations`,keepColors:`Garder les couleurs`,kerning:`Crénage`,layer:`Calque`,layerGap:`Écart entre calques`,lazy:`Démarrage différé`,length:`Longueur`,letterSpacing:`Interlettrage`,lifetime:`Durée de vie`,light:`Lumière`,lineHeight:`Interligne`,linearDamping:`Amortissement linéaire`,loop:`Boucle`,map:`Couleur (map)`,mapSize:`Taille de la carte`,mass:`Masse`,material:`Matériau`,maxDpr:`DPR max`,maxForce:`Force max`,maxWidth:`Largeur max`,metalness:`Métal`,metalnessMap:`Métal (carte)`,mieCoefficient:`Coefficient de Mie`,mieDirectionalG:`Directivité de Mie`,near:`Près`,normalBias:`Biais normal`,normalMap:`Normales`,normalScale:`Intensité normale`,offset:`Décalage`,opacity:`Opacité`,orbitZoom:`Zoom d’orbite`,order:`Ordre`,panel:`Panneau`,pauseOffscreen:`Pause hors écran`,penumbra:`Pénombre`,pivot:`Pivot`,position:`Position`,posterTime:`Temps de l’affiche`,preset:`Préréglage`,quality:`Qualité`,radius:`Rayon`,rayleigh:`Rayleigh`,receiveShadow:`Reçoit les ombres`,reducedMotion:`Mouvement réduit`,repeat:`Répétition`,resolution:`Résolution`,restLength:`Longueur au repos`,restitution:`Rebond`,rotation:`Rotation`,roughness:`Rugosité`,roughnessMap:`Rugosité (carte)`,scale:`Échelle`,seed:`Graine`,shadowOnly:`Ombres seules`,shadows:`Ombres`,shape:`Forme`,sheen:`Lustre`,sheenColor:`Couleur du lustre`,sheenRoughness:`Rugosité du lustre`,side:`Face`,size:`Taille`,skyColor:`Couleur du ciel`,sleep:`Mise en veille`,softness:`Douceur`,specularColor:`Couleur spéculaire`,specularIntensity:`Intensité spéculaire`,speed:`Vitesse`,splitLetters:`Lettres séparées`,spread:`Dispersion`,src:`Source`,stagger:`Décalage`,stars:`Étoiles`,step:`Pas`,stiffness:`Raideur`,strokes:`Contours`,style:`Style`,substeps:`Sous-étapes`,target:`Cible`,text:`Texte`,thickness:`Épaisseur`,title:`Titre`,toneMapping:`Mappage des tons`,top:`Haut`,transmission:`Transmission`,transparent:`Transparent`,triplanar:`Triplanaire`,turbidity:`Turbidité`,type:`Type`,value:`Valeur`,velocity:`Vitesse`,width:`Largeur`,wireframe:`Fil de fer`,y:`Y`,mode:`Mode`,strength:`Intensité`,focus:`Point fixe`,segments:`Segments`,layers:`Couches`,edgeCut:`Coupe des bords`,pointer:`Pointeur`,scroll:`Défilement`,gyro:`Gyroscope`,auto:`Mouvement auto`,smoothing:`Lissage`,zoom:`Zoom`},ui:{close:`Fermer`,reset:`Valeur par défaut`,colourValue:`Valeur de la couleur`,removeColour:`Retirer la couleur`,addColour:`Ajouter une couleur`,triplanarScale:`Échelle triplanaire`,urlPlaceholder:`https://… ou /page`},app:{loading:`Chargement…`,loadingScene:`Ouverture de la scène…`,loadFailed:`Impossible d'ouvrir le projet.`},top:{projects:`Projets`,inBrowser:`Enregistré dans ce navigateur`,undo:`Annuler`,redo:`Rétablir`,play:`Lecture`,pause:`Pause`,scrub:`Temps`,check:`Vérifier`,checkHint:`Vérifier la validation, les budgets, le cadrage et l'accessibilité avant l'export`,render:`Rendu`,renderHint:`Rendre des images en headless et afficher la planche contact`,export:`Exporter`,assistant:`Assistant`,shortcuts:`Raccourcis clavier`,language:`Langue`},save:{saved:`Enregistré`,saving:`Enregistrement…`,pending:`Non enregistré`,error:`Non enregistré`,errorHint:`La scène contient des erreurs : corrigez-les (onglet JSON) et elle sera de nouveau enregistrée.`},external:{title:`scene.json modifié depuis l'extérieur`,files:`Fichiers du projet modifiés`,undo:`Annuler`},edit:{failed:`Cette modification n'a pas pu être appliquée`},outliner:{title:`Objets`,scene:`Scène`,addGroup:`Ajouter un groupe`,duplicate:`Dupliquer`,delete:`Supprimer`,hide:`Masquer`,show:`Afficher`,expand:`Déplier`,collapse:`Replier`,empty:`Aucun objet. Ajoutez-en un ci-dessous.`},add:{primitives:`Primitives`,text:`Texte`,generators:`Générateurs`,particles:`Particules`,library:`Bibliothèque`,lights:`Lumières`,textValue:`Texte à ajouter`,searchModels:`Chercher parmi {n} modèles`,noMatch:`Aucun modèle ne correspond.`,noLibrary:`La bibliothèque intégrée n'est pas disponible ici.`,lightHint:`Ajoute une lumière à la scène`,photo:`Photo 3D`,photoHint:`Choisissez une image : elle devient une photo 3D (parallaxe). Ajoutez une carte de profondeur dans l'inspecteur pour le relief.`,photoSelected:`Utiliser l'image sélectionnée`,photoNone:`Aucune image dans ce projet. Importez-en une (agent3d assets add) ou saisissez son chemin ci-dessous.`,photoAdd:`Ajouter la photo 3D`},kinds:{mesh:`Maillage`,text:`Texte`,model:`Modèle`,group:`Groupe`,generator:`Générateur`,particles:`Particules`,instances:`Instances`,svg:`SVG`,photo:`Photo 3D`},inspector:{idHint:`Identifiant de l'objet (utilisé par les pistes et les scripts)`,deselect:`Désélectionner`,name:`Nom`,visible:`Visible`,transform:`Transformation`,position:`Position`,rotation:`Rotation`,scale:`Échelle`,scaleSplit:`Échelle par axe`,scaleUniform:`Échelle uniforme`,geometry:`Géométrie`,type:`Type`,layout:`Disposition`,text:`Texte`,seed:`Graine`,material:`Matériau`,preset:`Préréglage`,noPreset:`Aucun préréglage`,shader:`Shader`,moreOptions:`Plus d'options`,lessOptions:`Moins d'options`,behaviours:`Comportements`,addBehaviour:`Ajouter un comportement`,searchBehaviours:`Chercher un comportement`,noBehaviours:`Aucun comportement. Ajoutez rotation, flottement, effets au survol…`,removeBehaviour:`Retirer le comportement`,unknownBehaviour:`Type de comportement inconnu.`,when:`Quand`,physics:`Corps physique`,addBody:`Ajouter un corps`,removeBody:`Retirer le corps`,advanced:`Avancé`,tags:`Tags`,tagsHint:`Les scripts trouvent les objets par tag`,font:`Police`,outline:`Contour`,outlineHint:`Un liseré contrasté derrière les lettres.`,reveal:`Apparition des lettres`,revealHint:`Entrée lettre par lettre en cascade (montée, fondu, échelle, rotation, chute).`,ease:`Courbe`,physicalLayers:`Couches physiques`,physicalHint:`Ces réglages demandent un matériau physique (type physical ou un préréglage physique).`,textures:`Textures`,fromPreset:`Du préréglage : {v}`,moreSlots:`« Plus d'options » affiche tous les emplacements de texture.`,triplanarHint:`Projeter les textures selon X/Y/Z au lieu des UV (sans étirement).`,renderingPresets:`Rendu des aperçus…`,addStaticBody:`Corps statique`,addDynamicBody:`Corps dynamique`,bodyMotion:`Mouvement et surface`,collidesWithHint:`Calques avec lesquels ce corps entre en collision (vide : tous).`,allLayers:`tous les calques`,staticOnlyShape:`Cette forme ne fonctionne que sur des corps statiques ou cinématiques.`,collider:`Collisionneur {n}`,addCollider:`Ajouter un collisionneur`,removeCollider:`Supprimer le collisionneur`},photo:{image:`Image`,imageHint:`La photo (.jpg / .png / .webp) : un fichier du projet ou une image de la bibliothèque.`,depth:`Carte de profondeur`,depthHint:`Image en niveaux de gris de même format, blanc = proche. Sans elle, la photo est plate.`,none:`Aucune`,projectImages:`Images du projet`,libraryImages:`Images de la bibliothèque`,typePath:`Saisir un chemin…`,pathPlaceholder:`assets/textures/photo.jpg`,generateDepth:`Générer la carte de profondeur`,generateDepthHint:`Estime une carte de profondeur à partir de l'image (en local, dans Chrome headless) et l'utilise`,generatingDepth:`Estimation de la profondeur…`,depthNeedsCli:`L'estimation de profondeur nécessite la CLI : ouvrez ce projet avec agent3d studio.`,flatHint:`Pas encore de carte de profondeur : la photo est plate. Générez-en une ou choisissez une image de profondeur existante.`,depthDone:`Carte de profondeur prête`,depthFailed:`Échec de l'estimation de profondeur`,depthNoPath:`L'outil n'a pas renvoyé de chemin de carte de profondeur.`,motion:`Mouvement`},when:{always:`toujours`,hover:`au survol`,click:`au clic`,visible:`quand visible`,scroll:`au défilement`,manual:`manuel (interactions)`},scene:{title:`Scène`,subtitle:`Rien de sélectionné : ces réglages s'appliquent à toute la scène.`,meta:`Scène`,target:`Cible`,kind:`Format`,camera:`Caméra`,environment:`Environnement`,background:`Fond`,color:`Couleur`,colors:`Couleurs`,angle:`Angle`,stars:`Étoiles`,blur:`Flou`,lighting:`Éclairage`,lightingHint:`Éclairage par image pour les reflets`,intensity:`Intensité`,fog:`Brouillard`,off:`Aucun`,fogLinear:`Linéaire`,fogDensity:`Densité`,ground:`Sol`,lights:`Lumières`,lightType:`Type de lumière`,addLight:`Ajouter une lumière`,removeLight:`Retirer la lumière`,noLights:`Aucune lumière : seulement l'éclairage d'environnement.`,postfx:`Effets`,addEffect:`Ajouter un effet`,removeEffect:`Retirer l'effet`,searchEffects:`Chercher un effet`,noEffects:`Aucun effet.`,physics:`Physique`,enablePhysics:`Activer la physique`,disable:`Désactiver`,audio:`Audio`,music:`Musique`,volume:`Volume`,muted:`Démarrer en sourdine`,none:`Aucune`,sounds:`Sons : {list}`,hud:`Interface (HUD)`,addHud:`Ajouter un élément d'interface`,removeHud:`Retirer l'élément`},bg:{color:`Couleur unie`,gradient:`Dégradé`,radial:`Radial`,sky:`Ciel dégradé`,hdri:`HDRI`,transparent:`Transparent`,meshGradient:`Dégradé maillé`,physicalSky:`Ciel physique`},viewport:{device:`Aperçu par appareil`,desktop:`Ordinateur`,tablet:`Tablette (820 px)`,phone:`Téléphone (390 px)`,select:`Sélectionner des objets`,interact:`Interagir avec la scène`,helpers:`Grille et repères`,clickToSelect:`Cliquez pour sélectionner un objet`,tris:`triangles`,calls:`appels de rendu`,starting:`Démarrage…`,runtimeIssues:`Problèmes d'exécution : {n}`,tools:`Outils de la vue`,move:`Déplacer`,rotate:`Pivoter`,scale:`Mettre à l'échelle`,world:`Repère monde (cliquer pour local)`,local:`Repère local (cliquer pour monde)`,snap:`Magnétisme grille, 15° et 0,1 (maintenir Maj pour inverser pendant le glisser)`,view:`Vue`,editorCamera:`Caméra d'édition`,sceneCamera:`Caméra de la scène`,editorShort:`Édition`,cameraShort:`Caméra`,setCamera:`Placer la caméra de la scène sur cette vue`,cameraSet:`Caméra de la scène mise à jour`,cameraSetDetail:`camera.position et camera.target correspondent maintenant à la vue d'édition.`,frame:`Cadrer la sélection`,dropHere:`Déposer pour placer ici`,navHint:`Glisser : orbiter · Clic droit : panoramique · Molette : zoom`,cameraHint:`Ce que le site affiche`},bottom:{timeline:`Timeline`,json:`JSON`,check:`Vérification`,collapse:`Replier le panneau`,expand:`Déplier le panneau`,interactions:`Interactions`},timeline:{keyN:`clé {n} / {total}`,property:`Propriété à animer`,addKey:`Clé à {t} s`,addKeyHint:`Ajouter une clé à la tête de lecture avec la valeur actuelle`,duration:`Durée`,once:`Une fois`,loop:`En boucle`,pingpong:`Aller-retour`,trigger:`Déclencheur`,autoplay:`Lecture auto`,remove:`Supprimer la timeline`,none:`Pas encore de timeline`,ease:`Courbe`,removeTrack:`Supprimer la piste`,keyTime:`Temps de la clé`,keyValue:`Valeur de la clé`,deleteKey:`Supprimer la clé`,empty:`Sélectionnez un objet (ou gardez la caméra) et ajoutez une clé à la tête de lecture.`,emptySelected:`Choisissez une propriété et ajoutez une clé pour animer {id}.`,speed:`Vitesse`,speedHint:`Vitesse de lecture de toute la timeline`,autoplayOn:`Lecture auto`,autoplayOff:`Attend`,autoplaySegment:`Joue {name}`,markers:`Repères`,segments:`Segments`,markerLaneHint:`Double-cliquez pour ajouter un repère, faites-le glisser pour le déplacer`,addMarker:`Ajouter un repère à la tête de lecture`,markerName:`Nom du repère`,markerTime:`Temps du repère`,removeMarker:`Supprimer le repère`,noMarkers:`Les repères nomment des instants : en passer un émet un événement (scripts, interactions).`,addSegment:`Ajouter un segment`,segmentName:`Nom du segment`,playSegment:`Jouer le segment`,playReverse:`Jouer à l'envers`,removeSegment:`Supprimer le segment`,noSegments:`Les segments sont des plages nommées que les interactions jouent (survol, ouverture…).`,from:`de`,to:`à`,keyEase:`Courbe jusqu'à cette clé`,keyEaseHint:`Façonne le mouvement qui finit sur cette clé`,trackEase:`Courbe de la piste ({ease})`},trigger:{load:`au chargement`,visible:`quand visible`,hover:`au survol`,click:`au clic`,scroll:`au défilement`,manual:`manuel (interactions)`},json:{valid:`Valide`,errors:`{n} erreurs`,invalidJson:`JSON invalide`,format:`Formater`,revert:`Annuler`,apply:`Appliquer`,fixFirst:`Corrigez d'abord les erreurs`,noIssues:`Aucun problème.`,unapplied:`Modifications non appliquées.`},check:{failed:`La vérification a échoué`,emptyTitle:`Vérifiez avant d'exporter`,emptyBody:`Validation, fichiers manquants, bac à sable des scripts, budgets de triangles et de poids, cadrage (après un rendu) et accessibilité. Chaque problème indique quoi changer.`,run:`Lancer la vérification`,rerun:`Relancer`,ready:`Prêt à exporter`,notReady:`Corrigez les erreurs`,errors:`{n} erreurs`,warnings:`{n} avertissements`,infos:`{n} remarques`,triangles:`Triangles estimés`,weight:`Poids du bundle`,runtime:`Runtime (partagé)`,heaviest:`Objets les plus lourds`,licences:`Crédits requis`,clean:`Aucun problème. Vous pouvez publier.`},render:{title:`Aperçu rendu`,intro:`Rend la scène en headless dans Chrome (déterministe) et enregistre les images et une planche contact dans renders/. Les agents utilisent ces mêmes images pour vérifier leur travail.`,localIntro:`Le rendu headless nécessite la CLI (agent3d studio). Ici, vous obtenez une image propre de l'instant courant.`,frames:`Images`,run:`Rendre`,again:`Rendre à nouveau`,rendering:`Rendu en cours…`,download:`Télécharger le PNG`,placeholder:`La planche contact apparaîtra ici.`,sheetAlt:`Planche contact des images rendues`,stats:`{tris} triangles · {calls} appels de rendu`,tabFrames:`Images`,tabMedia:`Vidéo et animation`,mediaIntro:`Rend chaque image exactement (déterministe) dans Chrome headless et enregistre le fichier dans renders/.`,mediaNeedsCli:`Les rendus vidéo et animation demandent la CLI (agent3d studio) et Chrome.`,renderMedia:`Rendre en {kind}`,renderingMedia:`Rendu de chaque image… cela peut prendre un moment.`,mediaPlaceholder:`La vidéo ou l'animation s'affiche ici.`,framesUnit:`images`},export:{title:`Exporter`,embed:`Dossier à intégrer`,embedBody:`Un dossier pour n'importe quel site statique : runtime, scène, ressources et le code à coller.`,single:`Fichier HTML unique`,singleBody:`Tout en ligne dans un seul fichier .html (scène, ressources, runtime).`,poster:`Image d'affiche`,posterBody:`Une image WebP ou PNG à l'instant d'affiche, pour les replis et les cartes sociales.`,video:`Vidéo`,videoBody:`Une vidéo MP4 ou WebM de la timeline, image par image.`,videoCli:`Depuis le terminal pour l'instant : agent3d export --format video`,needsCli:`Nécessite la CLI (agent3d studio) ou les fichiers du runtime à côté du Studio.`,name:`Nom`,withPoster:`Rendre une affiche`,run:`Exporter`,done:`{files} fichiers exportés, {kb} Ko.`,output:`Sortie`,copy:`Copier`,copied:`Copié`,download:`Télécharger le fichier`,downloadPoster:`Télécharger l'affiche`,localNote:`Les projets dans le navigateur s'exportent en un fichier HTML unique à télécharger.`,zip:`Archive zip`,zipBody:`Le dossier embed en un seul .zip à téléverser (CMS, hébergeurs).`,gif:`GIF animé`,gifBody:`Un GIF en boucle de la timeline (e-mails, docs, messageries).`,baseUrl:`URL de base`,baseUrlHint:`Où le dossier est servi (ex. /static/3d/)`,cacheBust:`Anti-cache`,cacheBustHint:`Dossier runtime versionné + hash ?v=`,integrity:`Intégrité (SRI)`,integrityHint:`Hash sha384 sur le script runtime`,optimize:`Optimiser les assets`,optimizeHint:`Copies allégées ; le projet n'est pas modifié`,withPosterHint:`Affiché avant le chargement et sans WebGL`,og:`Image sociale`,ogHint:`og-image.png 1200×630`,optimized:`Assets {before} → {after} Ko`},ease:{title:`Courbe d'accélération`,named:`Courbes`,cubicBezier:`Bézier`,spring:`Ressort`,steps:`Paliers`,stiffness:`Raideur`,damping:`Amortissement`,mass:`Masse`,springHint:`Moins d'amortissement = plus de rebond. Le ressort se stabilise à la fin du segment.`,count:`Paliers`,jumpStart:`Saut au début`},env:{lightingIntensity:`Intensité globale`,skyPreset:`Moment de la journée`,sun:`Soleil`,noSun:`Masquer le soleil`,atmosphere:`Atmosphère`,groundProjection:`Projection au sol`,groundProjectionHint:`Les objets se tiennent dans la photo (moitié basse projetée sur un disque au sol)`,hdriPath:`Ou un chemin du projet (.hdr / .exr / .jpg)`,lighting:`Éclairage`,rig:`Kit d'éclairage`,rigHint:`Configuration d'éclairage nommée ajoutée aux lumières`,shadows:`Ombres`,contactShadows:`Ombres de contact`,contactShadowsHint:`Ombres douces et floues sous les objets (packshots)`,shadowQuality:`Qualité des ombres`,shadowQualityHint:`Type, douceur et taille des shadow maps pour toutes les lumières`,atmosphereGround:`Brouillard et sol`,fogHeight:`Brouillard au sol`},lighting:{studio:`Studio`,soft:`Doux`,sunset:`Coucher de soleil`,night:`Nuit`,neutral:`Neutre`,sky:`Depuis le ciel / fond`,none:`Aucun`,hdri:`Fichier HDRI`},lights:{volumetric:`Cône volumétrique`,volumetricHint:`Cône de lumière visible peu coûteux`,shadow:`Réglages d'ombre`},texture:{none:`Aucune`,file:`Fichier`,library:`Bibliothèque`,procedural:`Procédurale`},matgroup:{clearcoat:`Vernis`,sheen:`Lustre`,transmission:`Transmission`,iridescence:`Irisation`,anisotropy:`Anisotropie`,specular:`Spéculaire`},postfx:{look:`Look`,lookHint:`Une pile d'effets réglée ; les effets listés dessous la surchargent`,drag:`Glisser pour réordonner`,up:`Monter`,down:`Descendre`,unknown:`Effet inconnu.`,gpuHint:`Coût GPU (les niveaux de qualité retirent les effets coûteux sur les appareils faibles)`,gpu:{low:`léger`,medium:`moyen`,high:`lourd`},level:{none:`aucun`,light:`Léger`,moderate:`Modéré`,heavy:`Lourd`},passes:`≈ {n} passes par image`,droppedLow:`coupés en low : {list}`,costHint:`Coût estimé de la chaîne de post-traitement`},physics:{layers:`Calques`,layersHint:`Noms des calques de collision dans l'ordre des bits (max 16)`,materials:`Matériaux de surface`,addMaterial:`Ajouter un matériau de surface`,removeMaterial:`Supprimer le matériau`,materialName:`Nom du matériau`,noMaterials:`Paires friction / rebond nommées auxquelles les corps se réfèrent.`,contacts:`Contacts`,contactsHint:`Surcharges par paire : [{ a, b, friction, restitution }]`,joints:`Liaisons`,addJoint:`Ajouter une liaison`,removeJoint:`Supprimer la liaison`,jointType:`Type de liaison`,world:`monde`,motor:`Moteur`,motorHint:`Moteur de charnière : vitesse (°/s) et force max`,noJoints:`Reliez deux corps (charnière, pendule, ressort…).`,noBodies:`Ajoutez d'abord un corps physique aux objets (inspecteur → Corps physique).`},shots:{title:`Plans caméra`,add:`Ajouter un plan`,search:`Chercher un type de plan`,empty:`Mouvements de caméra cinématiques sur l'horloge de la timeline : travelling avant, orbite, grue, trajectoire…`,laneHint:`Quand chaque plan est joué (cliquez pour y aller)`,typeLabel:`Type de plan`,play:`Jouer depuis ce plan`,remove:`Supprimer le plan`,timing:`Début / durée`,at:`Début`,duration:`Durée`,object:`Objet`,objectHint:`Objet à regarder / sur lequel faire le point`,points:`Points`,preview:`Aperçu`,previewHint:`Parcourir ce plan`,type:{dolly:`le long de l'axe de vue`,pushIn:`se rapprocher`,pullOut:`reculer`,truck:`glisser latéralement`,pedestal:`monter / descendre, la cible suit`,crane:`monter en gardant la cible`,orbit:`tourner autour de la cible`,zoom:`changer le champ de vision`,move:`aller à une position / cible`,path:`suivre une trajectoire`,lookAt:`pivoter vers un objet`,focus:`bascule de point (dof)`}},interactions:{intro:`Déclencheurs sans code : quand il se passe quelque chose, faire quelque chose.`,add:`Ajouter une interaction`,empty:`Aucune interaction pour l'instant.`,emptyHint:`Jouer un segment au survol, ouvrir un lien au clic, basculer un panneau avec une touche, réagir à un repère…`,when:`Quand`,anywhere:`n'importe où`,target:`Objet cible`,key:`Code de touche`,eventName:`Nom de l'événement`,marker:`repère…`,at:`Progression du défilement`,once:`Une fois`,onceHint:`Ne déclencher que la première fois`,test:`Tester`,testHint:`Le déclencher maintenant dans la vue`,remove:`Supprimer l'interaction`,action:`Action`,addAction:`Ajouter une action`,removeAction:`Supprimer l'action`,segment:`Segment`,reverse:`Inverser`,seek:`Temps ou repère`,useMarker:`Utiliser un repère`,useSeconds:`Utiliser des secondes`,newTab:`Nouvel onglet`,model:`Modèle`,clip:`Nom ou index du clip`,path:`Propriété`,value:`Valeur`,tween:`Transition`,payload:`Données`,badUrl:`Seules les URL http(s) ou les chemins relatifs (/boutique) peuvent être ouverts.`,needsGesture:`Ouvrir une URL demande une interaction clic ou touche (un geste de l'utilisateur).`,on:{click:`Clic`,hover:`Survol`,hoverEnd:`Fin de survol`,visible:`Devient visible`,scroll:`Défilement`,key:`Touche`,event:`Événement / repère`},do:{play:`Jouer un segment`,toggle:`Basculer un segment`,seek:`Aller à`,set:`Changer une propriété`,emit:`Émettre un événement`,openUrl:`Ouvrir une URL`,playClip:`Jouer un clip du modèle`}},media:{quality:`Qualité`,qualityHint:`Suréchantillonnage : high = 2×, ultra = 3× (bords plus lisses, plus lent)`,q:{draft:`Brouillon`,standard:`Standard`,high:`Haute (2×)`,ultra:`Ultra (3×)`},fps:`Images / s`,duration:`Durée`,time:`Instant`,image:`Format`,size:`Taille (px)`,sizeHint:`Vide : d'après le ratio de la cible`,width:`Largeur`,height:`Hauteur`,transparent:`Transparent`,transparentHint:`Garder le canal alpha (sans fond)`,kind:{mp4:`MP4`,webm:`WebM`,gif:`GIF`,webp:`WebP`,poster:`Image fixe`},about:{mp4:`Vidéo H.264 : lisible partout (encodage avec Google Chrome).`,webm:`Vidéo VP9 : fichiers légers pour le web.`,gif:`GIF animé en boucle (640 px, 15 i/s par défaut).`,webp:`WebP animé : plus léger qu'un GIF, avec alpha (800 px, 20 i/s par défaut).`,poster:`Une seule image fixe.`}},keys:{title:`Raccourcis clavier`,general:`Général`,undo:`Annuler`,redo:`Rétablir`,save:`Enregistrer maintenant`,duplicate:`Dupliquer la sélection`,delete:`Supprimer la sélection`,hide:`Masquer / afficher la sélection`,deselect:`Désélectionner`,play:`Lecture / pause`,timeline:`Afficher la timeline`,json:`Afficher le JSON`,interact:`Mode interaction`,assistant:`Afficher l'assistant`,dragFast:`Glisser un nombre plus vite`,dragFine:`Glisser un nombre plus finement`,selectTool:`Outil de sélection`,move:`Manipulateur de déplacement`,rotate:`Manipulateur de rotation`,scale:`Manipulateur d'échelle`,space:`Repère local / monde`,snapHold:`Inverser le magnétisme pendant le glisser`,frame:`Cadrer la sélection (ou toute la scène)`,cameraView:`Caméra d'édition / caméra de la scène`,grid:`Grille et aides visuelles`,orbit:`Orbiter / panoramique de la caméra d'édition`,zoom:`Zoomer la caméra d'édition`,drop:`Placer un élément là où il est déposé`},start:{tagline:`Voyez, ajustez et exportez les scènes 3D que votre agent IA construit. Les modifications sont enregistrées dans scene.json : les agents dans un terminal les voient aussi.`,cliMode:`Dossier de projet · agent3d {v}`,localMode:`Projets dans le navigateur`,noFolderTitle:`Le Studio a été lancé sans dossier de projet`,noFolderBody:`Créez un projet depuis le terminal, puis ouvrez-le dans le Studio :`,starters:`Nouveau projet`,startersHint:`Une scène de départ soignée pour chaque format`,templates:`Modèles`,all:`Tous`,noTemplates:`Aucun modèle trouvé à côté de la CLI.`,noTemplatesLocal:`Les modèles sont fournis avec la CLI (agent3d studio). Partez d'un format ci-dessus.`,recent:`Récents`,noRecent:`Rien pour l'instant.`,remove:`Retirer de ce navigateur`,otherFolder:`Ouvrez-le avec : agent3d studio --project {dir}`,continue:`Ouvrir {title}`,replaceConfirm:`Cela remplace le projet de {dir} par un nouveau. Continuer ?`,agentTitle:`Travailler avec un agent`,agentBody:`Demandez à Claude Code (ou à tout client MCP) de modifier la scène pendant que le Studio est ouvert : les changements apparaissent en direct, mis en évidence, et vous pouvez les annuler ici.`,kinds:{banner:`Bandeau large 4:1`,hero:`En-tête de page 16:9`,card:`Carte produit`,square:`Tuile carrée`,fullscreen:`Paysage, pleine page`,game:`Mini-jeu`},untitled:{banner:`Bannière sans titre`,hero:`En-tête sans titre`,card:`Carte sans titre`,square:`Carré sans titre`,fullscreen:`Paysage sans titre`,game:`Jeu sans titre`}},assistant:{title:`Assistant`,model:`Modèle`,newChat:`Nouvelle conversation`,settings:`Clé d'API`,close:`Fermer`,keyTitle:`Facultatif : discutez avec Claude avec votre propre clé d'API`,keyBody1:`L'assistant modifie cette scène avec les mêmes outils que les agents CLI et MCP. Il utilise votre clé d'API Anthropic et votre compte est facturé.`,keyBody2:`La clé est conservée uniquement dans ce navigateur (localStorage) et envoyée uniquement à api.anthropic.com.`,keyLabel:`Clé d'API Anthropic`,showKey:`Afficher la clé`,hideKey:`Masquer la clé`,saveKey:`Enregistrer`,forgetKey:`Oublier la clé`,emptyTitle:`Décrivez un changement, l'assistant le fait dans la scène.`,example1:`Mets le titre en or et ajoute un léger flottement`,example2:`Ajoute de la neige et un ciel de nuit`,example3:`Fais un rendu et corrige ce qui est coupé sur les bords`,placeholder:`Demandez un changement… (Entrée pour envoyer)`,needKey:`Ajoutez une clé d'API ci-dessus pour discuter`,send:`Envoyer`,stop:`Arrêter`,working:`En cours…`,undo:`Annuler`,stopped:`Arrêté.`,maxIterations:`Arrêté après de nombreuses étapes. Demandez de continuer si besoin.`,refused:`Claude a décliné cette demande.`,renderAlt:`Aperçu rendu`,toolsCount:`{n} outils`}}},fh=`agent3d.studio.lang`;function ph(){try{let e=new URLSearchParams(location.search).get(`lang`);if(e===`en`||e===`fr`)return e;let t=localStorage.getItem(fh);if(t===`en`||t===`fr`)return t}catch{}return(typeof navigator<`u`?navigator.languages?.[0]??navigator.language:`en`)?.toLowerCase().startsWith(`fr`)?`fr`:`en`}var mh=ph(),hh=new Set;function gh(e){mh=e;try{localStorage.setItem(fh,e)}catch{}document.documentElement.lang=e,hh.forEach(e=>e())}function _h(){return mh}function vh(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`)return;n=n[e]}return typeof n==`string`?n:void 0}function yh(e,t,n){let r=vh(dh[e],t)??vh(uh,t)??t;return n?r.replace(/\{(\w+)\}/g,(e,t)=>t in n?String(n[t]):e):r}function bh(e,t=mh){return vh(dh[t],e)??vh(uh,e)}function xh(e,t){return yh(mh,e,t)}function K(){return{t:xh,lang:(0,C.useSyncExternalStore)(e=>(hh.add(e),()=>hh.delete(e)),()=>mh),setLang:gh}}function Sh(e){try{return new URLSearchParams(location.search).get(e)??new URLSearchParams(location.hash.replace(/^#/,``)).get(e)}catch{return null}}function Ch(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ch(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function q(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ch(e))&&(r&&(r+=` `),r+=t);return r}var wh=r((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})),J=r(((e,t)=>{t.exports=wh()}))(),Th=[],Eh=0,Dh=new Set,Oh=()=>Dh.forEach(e=>e());function kh(e,t=4200){let n=++Eh;return Th=[...Th.slice(-3),{...e,id:n}],Oh(),setTimeout(()=>Ah(n),t),n}function Ah(e){Th=Th.filter(t=>t.id!==e),Oh()}var jh={info:(0,J.jsx)(Yt,{size:14,className:`text-accent`}),success:(0,J.jsx)(ve,{size:14,className:`text-agent`}),error:(0,J.jsx)(ke,{size:14,className:`text-danger`}),agent:(0,J.jsx)(oe,{size:14,className:`text-agent`})};function Mh(){let e=(0,C.useSyncExternalStore)(e=>(Dh.add(e),()=>Dh.delete(e)),()=>Th);return(0,J.jsx)(`div`,{"aria-live":`polite`,className:`pointer-events-none absolute bottom-3 left-1/2 z-40 flex w-[min(420px,90%)] -translate-x-1/2 flex-col items-center gap-1.5`,children:e.map(e=>(0,J.jsxs)(`div`,{className:q(`toast-in pointer-events-auto flex w-full items-start gap-2 rounded-lg border bg-ink-1/95 px-3 py-2 shadow-lg shadow-black/40 backdrop-blur`,e.tone===`agent`?`border-agent/40`:e.tone===`error`?`border-danger/40`:`border-line`),children:[(0,J.jsx)(`div`,{className:`mt-0.5`,children:jh[e.tone]}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:e.title}),e.detail&&(0,J.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-fg-muted`,children:e.detail})]}),e.action&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>{e.action.run(),Ah(e.id)},className:`shrink-0 rounded px-1.5 py-0.5 text-xs font-medium text-accent hover:bg-ink-3`,children:e.action.label})]},e.id))})}var Y=(e,t,n,r,i=``)=>({name:e,type:`number`,description:i,default:t,min:n,max:r}),Nh=(e,t,n,r,i=``)=>({name:e,type:`integer`,description:i,default:t,min:n,max:r}),X=(e,t,n=``)=>({name:e,type:`boolean`,description:n,default:t}),Ph=(e,t,n=``)=>({name:e,type:`color`,description:n,default:t}),Fh=(e,t,n,r=``)=>({name:e,type:`enum`,description:r,options:t,default:n}),Ih=(e,t,n=``)=>({name:e,type:`vec3`,description:n,default:t}),Lh=(e,t=``)=>({name:e,type:`string`,description:t}),Rh=[Fh(`font`,ua.map(e=>e.id),`sans-bold`,`Bundled font.`),Y(`size`,1,0,void 0,`Cap height in units.`),Y(`depth`,.2,0,void 0,`Extrusion (0 = flat).`),Y(`bevel`,.02,0,void 0,`Bevel size.`),Fh(`align`,[`left`,`center`,`right`],`center`),X(`kerning`,!0,`Apply the font's kerning pairs.`),Y(`letterSpacing`,0,-.5,2,`Units added between characters (on top of kerning).`),Y(`lineHeight`,1.25,.5,3,`Multiple of the font size.`),Y(`maxWidth`,void 0,0,void 0,`Wrap lines on spaces to this width (units).`),Nh(`curveSegments`,void 0,1,32,`Points per glyph curve (default grows with the size).`),X(`splitLetters`,!1,`One child per glyph ("<id>/0", "<id>/1"…) that tracks can target.`)],zh=[Y(`width`,void 0,0,void 0,`Units (default size × 0.06).`),Ph(`color`,`#111111`),Y(`depth`,void 0,0,void 0,`Thickness (default depth × 0.6).`)],Bh=[Fh(`effect`,[`rise`,`fade`,`scale`,`spin`,`drop`],`rise`),Y(`stagger`,.04,0,1,`Seconds between letters.`),Y(`duration`,.6,0,5,`Seconds per letter.`),Y(`delay`,0,0,10,`Seconds before the first letter.`),Fh(`order`,[`forward`,`reverse`,`center`,`random`],`forward`)],Vh=[Lh(`src`,`Project .glb/.gltf or library:<id>.`),Y(`fit`,void 0,0,void 0,`Largest dimension (units).`),X(`center`,!0,`Bottom-centre at the origin.`)],Hh=[Lh(`clip`,`Clip name or index.`),X(`loop`,!0),Y(`speed`,1,0),Y(`crossfade`,.3,0)],Uh=[Fh(`preset`,aa.map(e=>e.id),void 0),Nh(`count`,void 0,1,1e5),Ih(`area`,void 0,`Emission box size.`),Y(`size`,void 0,0),Ph(`color`,void 0),Y(`speed`,void 0,0),Ih(`direction`,void 0),Y(`spread`,void 0,0,1,`Randomness of direction.`),Y(`lifetime`,void 0,0),Y(`opacity`,void 0,0,1),Fh(`blending`,[`normal`,`additive`],void 0),Fh(`shape`,[`point`,`square`,`circle`,`star`,`spark`],void 0),Nh(`seed`,void 0)],Wh=[Y(`size`,2,0,void 0,`Size in units (see fit).`),Fh(`fit`,[`width`,`height`,`max`],`width`,"Which dimension `size` sets."),Y(`depth`,.2,0,void 0,`Extrusion (0 = flat).`),Y(`bevel`,0,0),X(`keepColors`,void 0,`Keep the SVG's own fill / stroke colours (default: true without a material).`),X(`strokes`,!0,`Extrude stroked paths (stroke-width, joins, caps).`),Nh(`curveSegments`,12,1,64,`Points per curve.`),Y(`layerGap`,void 0,0,.5,`Z step between successive paths (default depth × 0.02).`)],Gh=Fh(`mode`,ns,`parallax`,`parallax: flat quad with shader relief (small motions). mesh: displaced grid (larger camera moves). layers: depth slices, a pop-up book look.`),Kh=[Y(`width`,4,0,void 0,`World width in units (height follows the image aspect).`),Y(`height`,void 0,0,void 0,`World height (overrides the aspect when both are set).`),Y(`strength`,.5,0,1,`Depth effect amount.`),Y(`focus`,.5,0,1,`Depth that stays still while the view moves (0 far, 1 near).`),Nh(`segments`,256,8,1024,`Grid cells on the long side.`),Nh(`layers`,6,2,16,`Number of depth slices.`),Y(`edgeCut`,.08,0,1,`Hide stretched edges where depth jumps more than this (0 = off).`)],qh=[Y(`pointer`,1,0,1,`How much the pointer moves the view.`),Y(`scroll`,0,0,1,`How much page scroll moves the view.`),X(`gyro`,!0,`Tilt on phones (when pointer > 0).`),Fh(`auto`,rs,`sway`,`Looping drift for renders, videos and touch screens.`),Y(`speed`,1,0,void 0,`Auto drift cycles per 10 s.`),Y(`smoothing`,void 0,0,1,`Easing of the view towards the pointer.`)],Jh=[Ph(`color`,`#ffffff`,`Tint.`),Y(`opacity`,1,0,1),Y(`emissiveIntensity`,void 0,0,void 0,`Self-lit amount (photos are unlit by default).`)],Yh=[Ph(`color`,`#ffffff`),Y(`metalness`,0,0,1),Y(`roughness`,.5,0,1),Ph(`emissive`,`#000000`),Y(`emissiveIntensity`,1,0),Y(`opacity`,1,0,1)],Xh=[X(`transparent`,!1),X(`wireframe`,!1),X(`flatShading`,!1),Fh(`side`,[`front`,`back`,`double`],`front`),Y(`envMapIntensity`,1,0,5,`Reflection strength of the environment lighting.`)],Zh=[{id:`clearcoat`,specs:[Y(`clearcoat`,0,0,1,`Glossy varnish layer.`),Y(`clearcoatRoughness`,0,0,1)]},{id:`sheen`,specs:[Y(`sheen`,0,0,1,`Fabric sheen (velvet, satin).`),Ph(`sheenColor`,`#ffffff`),Y(`sheenRoughness`,1,0,1)]},{id:`transmission`,specs:[Y(`transmission`,0,0,1,`Glass-like transmission.`),Y(`thickness`,0,0,10,`Volume thickness (refraction).`),Y(`ior`,1.5,1,2.333,`Index of refraction.`),Ph(`attenuationColor`,`#ffffff`,`Colour picked up through the volume.`),Y(`attenuationDistance`,void 0,0,void 0,`Distance for the attenuation colour.`),Y(`dispersion`,0,0,10,`Rainbow fire (gems).`)]},{id:`iridescence`,specs:[Y(`iridescence`,0,0,1,`Thin-film rainbow (soap, pearl).`),Y(`iridescenceIOR`,1.3,1,2.333),{name:`iridescenceThicknessRange`,type:`vec2`,description:`Film thickness range (nm).`,default:[100,400]}]},{id:`anisotropy`,specs:[Y(`anisotropy`,0,0,1,`Stretched highlights (brushed metal).`),Y(`anisotropyRotation`,0,-180,180,`Degrees.`)]},{id:`specular`,specs:[Y(`specularIntensity`,1,0,1),Ph(`specularColor`,`#ffffff`)]}],Qh={normalMap:Y(`normalScale`,1,0,5),bumpMap:Y(`bumpScale`,1,0,5),aoMap:Y(`aoMapIntensity`,1,0,2),displacementMap:Y(`displacementScale`,1,0,5)},$h=[{name:`repeat`,type:`vec2`,description:`Texture repeats (U, V).`,default:[1,1]}],eg=Fh(`type`,Bo,`standard`),tg=[Fh(`type`,gs,`static`),Fh(`shape`,_s,`box`,`auto: primitive → matching shape, terrain → heightfield.`),Ih(`size`,void 0,`Box size override.`),Y(`radius`,void 0,0,void 0,`Sphere / cylinder / capsule radius.`),Y(`height`,void 0,0,void 0,`Cylinder / capsule height.`),Ih(`offset`,void 0,`Collider centre offset.`)],ng=[Y(`mass`,1,0,void 0,`Dynamic bodies only.`),Y(`friction`,.5,0,2),Y(`restitution`,0,0,1,`Bounciness.`),Lh(`material`,`physics.materials name (friction / restitution defaults).`),Y(`linearDamping`,.01,0,1),Y(`angularDamping`,.01,0,1),Y(`gravityScale`,1,-5,5),Ih(`velocity`,void 0,`Initial velocity.`),Ih(`angularVelocity`,void 0,`Initial spin (deg/s).`)],rg=[X(`fixedRotation`,!1,`No rotation (players).`),X(`character`,!1,`Character controller: fixed rotation, no friction, never sleeps.`),X(`sleep`,!0,`Allow resting bodies to sleep.`),X(`ccd`,!1,`Fast object: extra sub-steps against tunnelling.`),Lh(`layer`,`Collision layer (default "default").`)],ig=[Fh(`shape`,vs,`box`),Ih(`size`,[1,1,1]),Y(`radius`,.5,0),Y(`height`,1,0),Ih(`offset`,[0,0,0]),Ih(`rotation`,[0,0,0],`Degrees.`)],ag=[Fh(`type`,ys,`hinge`),Ih(`pivot`,void 0,`World anchor (default: b's centre).`),Ih(`axis`,[0,1,0],`Hinge axis.`),Y(`distance`,void 0,0,void 0,`Distance joint (default: current).`),Y(`restLength`,void 0,0,void 0,`Spring (default: current distance).`),Y(`stiffness`,50,0,void 0,`Spring.`),Y(`damping`,1,0,void 0,`Spring.`),Y(`maxForce`,1e6,0),X(`collideConnected`,!1)],og=Fh(`attach`,[`none`,`camera`],`none`,`camera: the object rides with the camera (position / rotation in camera space: x right, y up, -z forward). Captions and labels that stay on screen during camera moves.`),sg=[X(`castShadow`,!1),X(`receiveShadow`,!1),Lh(`href`,`Clicking the object opens this URL.`)],cg=[{name:`aspect`,type:`string`,description:`"W:H", e.g. "4:1".`},Lh(`height`,`Fixed CSS height instead of the aspect (e.g. "320px").`),X(`transparent`,!1,`Transparent canvas (page shows through).`),Nh(`budgetKb`,void 0,0,void 0,`Bundle budget (KB).`),Fh(`reducedMotion`,[`static`,`slow`,`ignore`],`static`),Y(`posterTime`,0,0,void 0,`Time of the poster frame.`),Fh(`quality`,[`auto`,...Ra],`auto`,`Rendering quality tier (auto: from the device, steps down when slow).`),Fh(`toneMapping`,qo,`aces`),Y(`exposure`,1,0,4),Y(`maxDpr`,2,.5,4),X(`antialias`,!0),X(`shadows`,!0),X(`lazy`,!0,`Start when visible.`),X(`pauseOffscreen`,!0)],lg=[Fh(`type`,[`perspective`,`orthographic`],`perspective`),Y(`fov`,45,1,179),Y(`zoom`,10,0),Ih(`position`,[0,0,10]),Ih(`target`,[0,0,0]),Fh(`controls`,[`none`,`orbit`,`parallax`,`scroll`,`follow`],`none`),Y(`autoRotate`,0,void 0,void 0,`deg/s`),X(`orbitZoom`,!0),Y(`near`,.1,0),Y(`far`,1e3,0)],ug={ambient:[Ph(`color`,`#ffffff`),Y(`intensity`,1,0,10)],hemisphere:[Ph(`skyColor`,`#ffffff`),Ph(`groundColor`,`#444444`),Y(`intensity`,1,0,10)],directional:[Ph(`color`,`#ffffff`),Y(`intensity`,1,0,20),Ih(`position`,[5,10,5]),Ih(`target`,[0,0,0]),X(`castShadow`,!1)],point:[Ph(`color`,`#ffffff`),Y(`intensity`,1,0,100),Ih(`position`,[0,2,0]),Y(`distance`,0,0),Y(`decay`,2,0,4),X(`castShadow`,!1)],spot:[Ph(`color`,`#ffffff`),Y(`intensity`,1,0,100),Ih(`position`,[0,5,0]),Ih(`target`,[0,0,0]),Y(`angle`,30,0,90),Y(`penumbra`,0,0,1),Y(`distance`,0,0),Y(`decay`,2,0,4),X(`castShadow`,!1)],rect:[Ph(`color`,`#ffffff`),Y(`intensity`,1,0,50),Ih(`position`,[0,3,3]),Ih(`target`,[0,0,0]),Y(`width`,1,0),Y(`height`,1,0),X(`panel`,!1,`Draw the glowing panel (visible in the frame and reflections).`)]},dg=[Y(`softness`,3,0,30),Nh(`mapSize`,2048,256,4096),Y(`bias`,0,-.01,.01),Y(`normalBias`,0,0,1),Y(`intensity`,1,0,1,`Shadow darkness.`)],fg=[Y(`intensity`,1,0,5),Y(`length`,void 0,0,void 0,`Cone length (default: to the target).`),Ph(`color`,void 0,`Default: the light colour.`)],pg=[Ph(`top`,`#3a7bd5`),Ph(`horizon`,`#f6d5a8`),Ph(`bottom`,`#d1d7e0`),Nh(`stars`,0,0,5e3)],mg=[Fh(`preset`,Ho,void 0,`Time-of-day preset (implies a physical sky).`),Y(`turbidity`,void 0,0,30,`Haze.`),Y(`rayleigh`,void 0,0,6,`Blue scattering.`),Y(`mieCoefficient`,void 0,0,.1),Y(`mieDirectionalG`,void 0,0,.999),Y(`exposure`,1,0,4),Y(`clouds`,0,0,1,`Cloud coverage.`),Nh(`stars`,0,0,5e3)],hg=[Y(`elevation`,void 0,-90,90,`Degrees above the horizon.`),Y(`azimuth`,void 0,-180,180,`Degrees, 0 = +Z (towards the default camera).`),Ph(`color`,void 0),Y(`size`,void 0,0,10),X(`light`,!0,`Add the matching directional sun light.`),Y(`intensity`,void 0,0,20),X(`castShadow`,!0)],gg=[Y(`intensity`,1,0,5),Y(`rotation`,0,-180,180,`Degrees around Y.`),Y(`blur`,0,0,1)],_g=[Y(`height`,15,0,void 0,`Camera height of the photo.`),Y(`radius`,100,0,void 0,`Ground disc radius.`)],vg=[Y(`speed`,0,0,2,`Animation speed (0 = static).`),Y(`scale`,1,.05,5),Nh(`seed`,void 0),Y(`grain`,0,0,1)],yg=[Y(`opacity`,.6,0,1),Y(`blur`,2.5,0,20),Y(`far`,1.5,0,void 0,`How high above the plane objects still cast.`),Y(`y`,void 0,void 0,void 0,`Plane height (default: ground.y or 0).`),Y(`size`,void 0,0,void 0,`Square side (default: fitted).`),Nh(`resolution`,512,64,2048),Ph(`color`,`#000000`),Nh(`frames`,0,0,void 0,`Re-render only the first N frames (0 = always).`)],bg=[Fh(`type`,[`pcf`,`vsm`],`pcf`,`vsm = smooth blurred shadows.`),Y(`softness`,3,0,30),Nh(`mapSize`,2048,256,4096),Y(`intensity`,1,0,1)],xg=[Ph(`color`,`#ffffff`),Y(`near`,void 0,0),Y(`far`,void 0,0)],Sg=[Ph(`color`,`#ffffff`),Y(`density`,void 0,0,.5),Y(`height`,void 0,void 0,void 0,`Height fog: thick below this y.`),Y(`falloff`,void 0,0,5,`Height fog falloff.`)],Cg=[Y(`intensity`,1,0,5),Y(`rotation`,0,-180,180)],wg=[Y(`y`,0),Y(`size`,40,0),Ph(`color`,`#888888`),X(`shadowOnly`,!1),X(`grid`,!1),Y(`roughness`,1,0,1),Y(`opacity`,1,0,1)],Tg=[Ih(`gravity`,[0,-9.81,0]),Y(`step`,1/60,.001,.1,`Fixed step (s).`),Nh(`substeps`,1,1,8,`Solver sub-steps per step.`),Nh(`iterations`,10,1,100,`Constraint solver iterations.`),X(`sleep`,!0,`Let resting bodies sleep.`),X(`debug`,!1,`Draw collider wireframes.`)],Eg=[Lh(`font`,`CSS font-family (system stacks).`),Ph(`color`,`#ffffff`),Ph(`accent`,`#7c8cff`),Ph(`buttonText`,void 0,`Button label colour (default: white or near-black, whichever contrasts best with the accent).`)],Dg=[Fh(`type`,[`text`,`button`,`bar`],`text`),Lh(`text`,`May contain {state.key} placeholders.`),Fh(`anchor`,[`top-left`,`top`,`top-right`,`left`,`center`,`right`,`bottom-left`,`bottom`,`bottom-right`],`top-left`),Fh(`style`,[`plain`,`pill`,`title`,`subtitle`,`panel`],`plain`,`panel = a backdrop card (game-over / pause screens; \\n breaks lines).`),Lh(`value`,`Bar: state key holding 0..1.`),Lh(`action`,`Button: event emitted to scripts.`),Ph(`color`,void 0,`Text colour of this element.`),Ph(`background`,void 0,`Background of a button / pill / panel / bar track.`)],Og=[Lh(`title`),Lh(`description`),Lh(`ariaLabel`,`Accessible label (defaults to the title).`),Nh(`seed`,void 0,0,void 0,`Seed for generators / particles.`)],kg=/\.(jpe?g|png|webp)$/i,Ag=e=>kg.test(e.replace(/[?#].*$/,``)),jg=e=>e.mode??Gh.default,Mg={segments:[`mesh`],layers:[`layers`],edgeCut:[`mesh`,`layers`]};function Ng(e){let t=jg(e),n=e;return Kh.filter(e=>!Mg[e.name]||Mg[e.name].includes(t)||n[e.name]!==void 0)}function Pg(e,t,n,r={}){let i=[],a=new Set,o=e=>{a.has(e.value)||(a.add(e.value),i.push(e))};for(let t of e??[])!t.missing&&Ag(t.path)&&o({value:t.path,label:t.path.replace(/^assets\//,``),group:`project`});if(r.library!==!1)for(let e of t?.assets??[])e.kind===`texture`&&Ag(e.path||e.id)&&o({value:`library:${e.id}`,label:e.id.replace(/^textures\//,``),group:`library`});return n&&!a.has(n)&&i.unshift({value:n,label:n.replace(/^assets\//,``),group:`current`}),i}function Fg(e){if(!e)return;if(e.kind===`photo`)return e.src;let t=e.material?.map;return typeof t==`string`&&Ag(t)?t:void 0}function Ig(e){let t=(e.split(/[/:]/).pop()??``).replace(kg,``).replace(/[^A-Za-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``);return t?`photo-${t}`.slice(0,40):`photo`}function Lg(e,t,n=[0,0,0]){return{id:e,kind:`photo`,src:t,mode:`parallax`,position:n}}var Rg=`image_depth`,zg=e=>({image:e.src});function Bg(e){if(typeof e==`string`)return Ag(e)?e:void 0;if(!e||typeof e!=`object`)return;let t=e;for(let e of[`depth`,`path`,`out`,`file`]){let n=t[e];if(typeof n==`string`&&Ag(n))return n.replace(/^\.\//,``)}}var Vg=e=>e.depth===!0,Hg=(e,t)=>`objects#${e}${t?`.${t}`:``}`;function Ug(e,t){try{return vf(e,t)}catch{return}}function Wg(e,t,n){return n===void 0?yf(e,t)?[{op:`remove`,path:t}]:[]:JSON.stringify(Ug(e,t))===JSON.stringify(n)?[]:[{op:`set`,path:t,value:n}]}function Gg(e){return new Set([...Bc(e),...(e.lights??[]).map(e=>e.id).filter(e=>!!e),...(e.ui?.elements??[]).map(e=>e.id)])}function Kg(e){let t={};for(let n of e?.params??[])n.required&&n.default!==void 0&&(t[n.name]=Cf(n.default));return t}var qg={lathe:{points:[[0,0],[.4,0],[.5,.3],[.3,.8],[.35,1.2],[0,1.2]]},extrude:{shape:[[0,.5],[.15,.15],[.5,.1],[.2,-.12],[.3,-.5],[0,-.25],[-.3,-.5],[-.2,-.12],[-.5,.1],[-.15,.15]]},tube:{points:[[-1.5,0,0],[-.5,.6,.3],[.5,-.4,-.3],[1.5,.2,0]]}};function Jg(e,t,n=[0,0,0]){let r=Gg(e);switch(t.kind){case`mesh`:{let e=qi.find(e=>e.id===t.geometry);return{id:zi(t.geometry,r),kind:`mesh`,position:n,geometry:{type:t.geometry,...Kg(e),...qg[t.geometry]??{}},material:{preset:`plastic`,color:`#7c8cff`}}}case`text`:return{id:zi(`text`,r),kind:`text`,position:n,text:t.text??`Hello`,font:t.font??`sans-bold`,size:.6,depth:.15,material:{preset:`plastic`,color:`#ffffff`}};case`generator`:{let e=Kg(na.find(e=>e.id===t.generator));return{id:zi(t.generator,r),kind:`generator`,generator:t.generator,position:n,...Object.keys(e).length?{params:e}:{}}}case`particles`:return{id:zi(t.preset,r),kind:`particles`,preset:t.preset,position:n};case`model`:return{id:zi((t.name??t.src.split(/[/:]/).pop()??`model`).replace(/\.(glb|gltf)$/i,``),r),kind:`model`,src:t.src,fit:1.5,position:n};case`photo`:return Lg(zi(Ig(t.src),r),t.src,n);case`group`:return{id:zi(`group`,r),kind:`group`,position:n,children:[]}}}function Yg(e,t){let n=Ic(e.objects,t);if(!n)return null;let r=Cf(n.object),i=Gg(e);V([r],e=>{let t=zi(e.id.replace(/-\d+$/,``),i);i.add(t),e.id=t});let a=r.position??[0,0,0];return r.position=[Math.round((a[0]+.5)*1e3)/1e3,a[1],a[2]],{ops:[{op:`addObject`,object:r,...n.parent?{parent:n.parent.id}:{},index:n.index+1}],newId:r.id}}function Xg(e,t,n,r){if(t===n)return[];let i=Ic(e.objects,t),a=Ic(e.objects,n);if(!i||!a||Ic(i.object.children,n))return[];if(r===`inside`)return[{op:`moveObject`,id:t,parent:n}];let o=a.parent?a.parent.id:null,s=a.index+ +(r===`after`);return i.container===a.container&&i.index<s&&--s,i.container===a.container&&i.index===s?[]:[{op:`moveObject`,id:t,parent:o,index:s}]}function Zg(e){let t={type:e.id};for(let n of e.params)n.required&&n.default!==void 0&&(t[n.name]=Cf(n.default));return e.id===`path`&&(t.points=[[-1,0,0],[0,.5,1],[1,0,0],[0,-.5,-1]]),t}var Qg=new Set([`mesh`,`text`,`model`,`instances`,`svg`]),$g=Math.PI/180,e_={translate:.25,rotate:15,scale:.1},t_=(e,t=.001)=>{let n=Math.round(e/t)*t,r=Number(n.toFixed(Math.max(0,Math.ceil(-Math.log10(t))+1)));return Object.is(r,-0)?0:r},n_=(e,t)=>t>0?t_(Math.round(e/t)*t,Math.min(t,.001)):e;function r_(e,t,n,r=1e-5){return e.map((e,i)=>Math.abs(e-t[i])>r?n_(e,n):t[i])}function i_(e,t){return e+Math.round((t-e)/360)*360}function a_(e,t){let r=new n().setFromQuaternion(e,`XYZ`),i=[r.x/$g,r.y/$g,r.z/$g],a=[i[0]+180,180-i[1],i[2]+180],o=e=>e.map((e,n)=>i_(e,t[n])),s=o(i),c=o(a),l=e=>Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])+Math.abs(e[2]-t[2]);return l(c)+1e-6<l(s)?c:s}function o_(n,r,a){let o=r?new i().copy(r).invert().multiply(n):n.clone(),s=new t,c=new e,l=new t;return o.decompose(s,c,l),{position:[s.x,s.y,s.z],rotation:a_(c,a.rotation),scale:[l.x,l.y,l.z]}}function s_(e,t,n,r){let i={position:[...e.position],rotation:[...e.rotation],scale:[...e.scale]};return n===`translate`?i.position=(r?r_(t.position,e.position,r.translate):t.position).map(e=>t_(e)):n===`rotate`?i.rotation=t.rotation.map(e=>t_(e,.01)):i.scale=(r?r_(t.scale,e.scale,r.scale):t.scale).map(e=>Math.max(t_(e),.001)),i}function c_(e,t){let n=e=>e.every(e=>e===0),r={};r.position=e.position===void 0&&n(t.position)?void 0:t.position,r.rotation=e.rotation===void 0&&n(t.rotation)?void 0:t.rotation;let i=t.scale[0]===t.scale[1]&&t.scale[1]===t.scale[2];return r.scale=e.scale===void 0&&i&&t.scale[0]===1?void 0:i&&(e.scale===void 0||typeof e.scale==`number`)?t.scale[0]:t.scale,r}function l_(e,n,r,i,a=1){let o=new t(r[0]-e[0],r[1]-e[1],r[2]-e[2]);o.lengthSq()<1e-9&&o.set(0,.3,1),o.normalize();let s=Math.max(i,1)*$g,c=2*Math.atan(Math.tan(s/2)*Math.max(a,.1)),l=Math.max(n,.05)/Math.sin(Math.min(s,c)/2)*1.4;return{position:[e[0]+o.x*l,e[1]+o.y*l,e[2]+o.z*l],target:[...e]}}function u_(e,t){let n=e.lights??[],r=n.findIndex(e=>e.id===t);if(r>=0)return r;let i=/^light(\d+)$/.exec(t);return i&&n[Number(i[1])]&&!n[Number(i[1])].id?Number(i[1]):-1}function d_(e,t){let n=u_(e,t);if(n<0)return null;let r=e.lights[n];return r.id?`lights#${r.id}`:`lights[${n}]`}function f_(e,t,n){let r=Ic(e.objects,t);if(!r)return[];let i=c_(r.object,n);return[...Wg(e,Hg(t,`position`),i.position),...Wg(e,Hg(t,`rotation`),i.rotation),...Wg(e,Hg(t,`scale`),i.scale)]}function p_(e,t,n,r){let i=d_(e,t);return i?Wg(e,`${i}.${n}`,r):[]}function m_(e,t,n){let r=e=>e.map(e=>Math.round(e*1e3)/1e3||0);return[...Wg(e,`camera.position`,r(t)),...Wg(e,`camera.target`,r(n))]}function h_(e,t){if(!e.length)return null;let n=e[e.length-1];if(!t)return n;let r=e.indexOf(t);return r<0?n:r>0?e[r-1]:t}function g_({variant:e=`subtle`,size:t=`sm`,className:n,...r}){return(0,J.jsx)(`button`,{type:`button`,...r,className:q(`inline-flex select-none items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-medium transition-colors disabled:pointer-events-none disabled:opacity-40`,t===`xs`&&`h-6 px-2 text-xs`,t===`sm`&&`h-7 px-2.5 text-sm`,t===`md`&&`h-8 px-3.5 text-base`,e===`ghost`&&`text-fg-muted hover:bg-ink-3 hover:text-fg`,e===`subtle`&&`bg-ink-3 text-fg hover:bg-ink-4`,e===`primary`&&`bg-accent text-ink-0 hover:bg-accent/90`,e===`danger`&&`bg-danger/15 text-danger hover:bg-danger/25`,n)})}function Z({label:e,active:t,className:n,children:r,shortcut:i,...a}){return(0,J.jsx)(`button`,{type:`button`,"aria-label":e,title:i?`${e} (${i})`:e,"aria-pressed":t,...a,className:q(`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors disabled:pointer-events-none disabled:opacity-35`,t?`bg-accent/15 text-accent`:`text-fg-muted hover:bg-ink-3 hover:text-fg`,n),children:r})}function __({value:e,onCommit:t,placeholder:n,className:r,multiline:i,mono:a,ariaLabel:o}){let[s,c]=(0,C.useState)(e);(0,C.useEffect)(()=>{c(e)},[e]);let l=()=>s!==e&&t(s),u={value:s,placeholder:n,"aria-label":o,onChange:e=>c(e.target.value),onBlur:l};return i?(0,J.jsx)(`textarea`,{...u,rows:2,onKeyDown:t=>{t.key===`Enter`&&(t.metaKey||t.ctrlKey)&&l(),t.key===`Escape`&&c(e)},className:q(`field h-auto min-h-[44px] resize-y py-1 leading-snug`,a&&`font-mono text-xs`,r)}):(0,J.jsx)(`input`,{...u,spellCheck:!1,onKeyDown:t=>{t.key===`Enter`&&t.target.blur(),t.key===`Escape`&&(c(e),requestAnimationFrame(()=>t.target.blur()))},className:q(`field`,a&&`font-mono text-xs`,r)})}function v_({value:e,options:t,onChange:n,className:r,ariaLabel:i,placeholder:a}){return(0,J.jsxs)(`select`,{"aria-label":i,value:e,onChange:e=>n(e.target.value),className:q(`field`,r),children:[a!==void 0&&(0,J.jsx)(`option`,{value:``,children:a}),t.map(e=>{let t=typeof e==`string`?e:e.value;return(0,J.jsx)(`option`,{value:t,children:typeof e==`string`?e:e.label},t)})]})}function y_({checked:e,onChange:t,ariaLabel:n}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,onClick:()=>t(!e),className:q(`relative h-4 w-7 shrink-0 rounded-full transition-colors`,e?`bg-accent`:`bg-ink-4`),children:(0,J.jsx)(`span`,{className:q(`absolute top-0.5 h-3 w-3 rounded-full bg-white shadow transition-[left]`,e?`left-[14px]`:`left-0.5`)})})}function Q({label:e,children:t,hint:n,onReset:r,overridden:i,align:a=`center`}){return(0,J.jsxs)(`div`,{className:q(`group grid grid-cols-[104px_minmax(0,1fr)_16px] gap-x-2 px-3 py-[3px]`,a===`center`?`items-center`:`items-start`),children:[(0,J.jsx)(`div`,{className:q(`line-clamp-2 break-words text-xs leading-tight text-fg-muted [hyphens:auto]`,a===`start`&&`pt-1`),title:typeof e==`string`?n?`${e} — ${n}`:e:n,children:e}),(0,J.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,children:t}),(0,J.jsx)(`div`,{className:`flex justify-end`,children:r&&i&&(0,J.jsx)(`button`,{type:`button`,title:xh(`ui.reset`),"aria-label":xh(`ui.reset`),onClick:r,className:`text-fg-faint opacity-0 transition-opacity hover:text-fg group-hover:opacity-100`,children:(0,J.jsx)(nr,{size:11})})})]})}function b_({title:e,children:t,defaultOpen:n=!0,actions:r,id:i}){let a=i?`agent3d.section.${i}`:null,[o,s]=(0,C.useState)(()=>{if(!a)return n;try{let e=localStorage.getItem(a);return e===null?n:e===`1`}catch{return n}});return(0,J.jsxs)(`section`,{className:`border-b border-line`,children:[(0,J.jsxs)(`div`,{className:`flex h-8 items-center gap-1 pl-2 pr-2`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{s(e=>{try{a&&localStorage.setItem(a,e?`0`:`1`)}catch{}return!e})},"aria-expanded":o,className:`flex min-w-0 flex-1 items-center gap-1 text-left text-xs font-semibold text-fg`,children:[o?(0,J.jsx)(be,{size:12,className:`text-fg-faint`}):(0,J.jsx)(Ce,{size:12,className:`text-fg-faint`}),(0,J.jsx)(`span`,{className:`truncate`,children:e})]}),r]}),o&&(0,J.jsx)(`div`,{className:`pb-2`,children:t})]})}function x_({children:e}){return(0,J.jsx)(`kbd`,{className:`rounded border border-line bg-ink-2 px-1 font-sans text-2xs text-fg-muted`,children:e})}function S_({icon:e,title:t,children:n}){return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-6 py-8 text-center`,children:[e&&(0,J.jsx)(`div`,{className:`text-fg-faint`,children:e}),(0,J.jsx)(`div`,{className:`text-sm font-medium text-fg-muted`,children:t}),n&&(0,J.jsx)(`div`,{className:`text-xs text-fg-faint`,children:n})]})}function C_(e){let t=e,n=new Set;return{get:()=>t,set(e){let r=typeof e==`function`?e(t):e;t={...t,...r},n.forEach(e=>e())},subscribe(e){return n.add(e),()=>n.delete(e)}}}function w_(e,t){return(0,C.useSyncExternalStore)(e.subscribe,()=>t(e.get()))}var T_=(0,C.createContext)(null);function E_(){let e=(0,C.useContext)(T_);if(!e)throw Error(`useEditor outside EditorContext`);return e}function D_(){let{store:e}=E_();return(0,C.useSyncExternalStore)(e.subscribe,e.getSnapshot)}function O_(e){return w_(E_().ui,e)}var k_=[`claude-sonnet-5-5`,`claude-opus-5-5`,`claude-haiku-5-5`],A_=`https://api.anthropic.com/v1/messages`,j_=class extends Error{status;constructor(e,t){super(t),this.status=e}};function M_(e,t){if(e!==`render_preview`||!t||typeof t!=`object`)return null;let n=t;return n.sheet??n.frames?.[0]?.path??null}function N_(e,t=24e3){return e.length>t?`${e.slice(0,t)}\n… (truncated, ${e.length-t} more characters)`:e}async function P_(e,t,n){let r=e.fetchImpl??fetch,i={"content-type":`application/json`,"x-api-key":e.apiKey,"anthropic-version":`2023-06-01`,"anthropic-dangerous-direct-browser-access":`true`};n&&(i[`anthropic-beta`]=`server-side-fallback-2026-07-01`);let a=await r(A_,{method:`POST`,headers:i,body:JSON.stringify(n?{...t,fallbacks:`default`}:t),signal:e.signal}),o=await a.json().catch(()=>({}));if(!a.ok){let e=o.error?.message??`HTTP ${a.status}`;throw new j_(a.status,e)}return o}async function F_(e){let t=[...e.messages],n=e.tools.map(e=>({name:e.name,description:e.description,input_schema:e.inputSchema})),r=e.fallbacks??e.model!==`claude-haiku-5-5`,i=e.maxIterations??25;for(let a=0;a<i;a++){if(e.signal?.aborted)return{messages:t,status:`aborted`};let i={model:e.model,max_tokens:e.maxTokens??16e3,system:e.system,tools:n,messages:t},a;try{try{a=await P_(e,i,r)}catch(t){if(r&&t instanceof j_&&t.status===400&&/fallback|beta/i.test(t.message))r=!1,a=await P_(e,i,!1);else throw t}}catch(e){return e.name===`AbortError`?{messages:t,status:`aborted`}:{messages:t,status:`error`,error:e.message}}let o=a.content??[];t.push({role:`assistant`,content:o});for(let t of o)t.type===`text`&&typeof t.text==`string`&&t.text.trim()&&e.onEvent({type:`text`,text:t.text});if(a.stop_reason===`refusal`)return e.onEvent({type:`refusal`,explanation:a.stop_details?.explanation}),{messages:t,status:`refusal`};let s=o.filter(e=>e.type===`tool_use`);if(a.stop_reason!==`tool_use`||!s.length)return{messages:t,status:`done`};let c=[];for(let n of s){if(e.signal?.aborted)return{messages:t,status:`aborted`};e.onEvent({type:`tool_start`,id:n.id,name:n.name,input:n.input??{}});try{let t=await e.callTool(n.name,n.input??{}),r=[{type:`text`,text:N_(JSON.stringify(t))}],i=M_(n.name,t),a;if(i&&e.readImage){let t=await e.readImage(i).catch(()=>null);t&&(r.push({type:`image`,source:{type:`base64`,media_type:`image/png`,data:t}}),a=i)}c.push({type:`tool_result`,tool_use_id:n.id,content:r}),e.onEvent({type:`tool_end`,id:n.id,name:n.name,result:t,image:a})}catch(t){let r=t,i=JSON.stringify({error:r.message,...r.hint?{hint:r.hint}:{},...r.details?{details:r.details}:{}});c.push({type:`tool_result`,tool_use_id:n.id,content:[{type:`text`,text:N_(i)}],is_error:!0}),e.onEvent({type:`tool_end`,id:n.id,name:n.name,error:r.message})}}t.push({role:`user`,content:c})}return{messages:t,status:`max_iterations`}}var I_=`You are the assistant inside Agent3D Studio, a visual editor for 3D web elements (banners, heroes, product cards, landscapes, mini games). The user sees the scene live in the Studio viewport while you work; every change you make through the tools is saved to the project's scene.json and shown immediately.
|
|
466
|
+
|
|
467
|
+
The scene format (SceneDoc, scene.json): { version: 1, id, title, target: { kind: banner|hero|card|square|fullscreen|inline|game, aspect: "W:H" }, camera: { type, fov, position, target, controls }, environment: { background (CSS colour | {gradient:[…], angle} | {radial:[…]} | {sky:{…}} | {hdri}), lighting preset, fog, ground }, lights: [{ id, type, color, intensity, position }], objects: [{ id, kind: mesh|text|model|group|generator|particles|instances|svg, position, rotation (degrees), scale, material: { preset, color, … }, behaviours: [{ type, …params }], children }], timeline?: { duration, loop, tracks: [{ target: "<id>.<property>", keys: [[t, value], …], ease }] }, postfx?, physics?, ui?, audio? }. Units ≈ metres, Y up, angles in degrees, colours are CSS strings. Geometry types, material presets, behaviours, generators, particle presets, post effects and fonts come from the catalog.
|
|
468
|
+
|
|
469
|
+
Rules:
|
|
470
|
+
- Start with scene_summary to see what exists. Call catalog_get before using any catalog id or parameter you are not sure about.
|
|
471
|
+
- Prefer small scene_patch edits (object ids are stable) over replacing the whole scene.
|
|
472
|
+
- Mutating tools are applied directly; the user can undo each one from the Studio.
|
|
473
|
+
- After visual changes, call render_preview (when available) and look at the image you get back: check framing (nothing cut at the edges of wide banners), legibility of text, colours and lighting, then fix and render again.
|
|
474
|
+
- Run check before suggesting an export.
|
|
475
|
+
- Be concise: say what you changed in one or two sentences.`,L_=`agent3d.studio.anthropicKey`,R_=`agent3d.studio.model`,z_=e=>{try{return localStorage.getItem(e)??``}catch{return``}},B_=(e,t)=>{try{t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}},V_=new Map,H_=0,U_=()=>`i${Date.now().toString(36)}${(H_++).toString(36)}`;function W_(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function G_(e){if(!e||typeof e!=`object`)return;let t=e;if(t.plan?.summary)return`${t.status??``} · ${t.plan.summary}`;if(t.status)return t.status}function K_(e,t){if(e===`scene_patch`&&Array.isArray(t.ops))return t.ops.map(e=>`${e.op} ${e.path??e.id??``}`.trim()).slice(0,3).join(`, `)+(t.ops.length>3?`…`:``);if(e===`catalog_get`)return[t.section,t.id].filter(Boolean).join(` / `);if(e===`object_update`||e===`object_remove`)return String(t.id??``);if(e===`object_add`)return String(t.object?.id??``);let n=JSON.stringify(t);return n===`{}`?``:n.slice(0,80)}function q_({text:e}){let t=(e,t)=>e.split(/(`[^`]+`|\*\*[^*]+\*\*)/g).map((e,n)=>e.startsWith("`")&&e.endsWith("`")?(0,J.jsx)(`code`,{className:`rounded bg-ink-3 px-1 font-mono text-2xs`,children:e.slice(1,-1)},`${t}${n}`):e.startsWith(`**`)&&e.endsWith(`**`)?(0,J.jsx)(`strong`,{children:e.slice(2,-2)},`${t}${n}`):e);return(0,J.jsx)(`div`,{className:`space-y-1.5`,children:e.split(/\n{2,}/).map((e,n)=>/^\s*[-*] /.test(e)?(0,J.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4`,children:e.split(`
|
|
476
|
+
`).map((e,r)=>(0,J.jsx)(`li`,{children:t(e.replace(/^\s*[-*] /,``),`${n}-${r}-`)},r))},n):(0,J.jsx)(`p`,{className:`whitespace-pre-wrap`,children:t(e,`${n}-`)},n))})}function J_(){let{t:e}=K(),{backend:t,store:n,tools:r,reloadScene:i,ui:a}=E_(),o=t.location??`default`,[s,c]=(0,C.useState)(()=>V_.get(o)??{messages:[],items:[]}),[l,u]=(0,C.useState)(()=>z_(L_)),[d,f]=(0,C.useState)(()=>z_(R_)||`claude-sonnet-5-5`),[p,m]=(0,C.useState)(!1),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(!1),y=(0,C.useRef)(null),b=(0,C.useRef)(null),x=(0,C.useRef)(s);x.current=s,(0,C.useEffect)(()=>{V_.set(o,s)},[s,o]),(0,C.useEffect)(()=>{b.current?.scrollIntoView({block:`end`})},[s.items.length]),(0,C.useEffect)(()=>()=>y.current?.abort(),[]);let S=e=>c(t=>({...t,items:e(t.items)})),w=(e,t)=>S(n=>n.map(n=>n.kind===`tool`&&n.id===e?{...n,...t}:n)),T=async()=>{let a=h.trim();if(!a||_||!l)return;g(``),v(!0);let o=new AbortController;y.current=o;let s=n.getSnapshot().selection,u=`[Studio] Project: ${t.projectTitle()}.${s?` Selected object: "${s}".`:` Nothing selected.`}`,f=[...x.current.messages,{role:`user`,content:[{type:`text`,text:u},{type:`text`,text:a}]}];c(e=>({messages:f,items:[...e.items,{kind:`user`,id:U_(),text:a}]})),await n.flush();let p=new Set(r.filter(e=>e.mutating).map(e=>e.name)),m=new Map,b=``,C=await F_({apiKey:l,model:d,system:I_,messages:f,tools:r,signal:o.signal,callTool:async(e,r)=>{let a=b;if(p.has(e)){await n.flush();let e=n.getSnapshot().scene;e&&m.set(a,e)}let o=await t.call(e,r);return p.has(e)&&await i({toast:!1}).catch(()=>void 0),o},readImage:async e=>W_(await t.readFile(e)),onEvent:n=>{n.type===`text`?S(e=>[...e,{kind:`assistant`,id:U_(),text:n.text}]):n.type===`tool_start`?(b=n.id,S(e=>[...e,{kind:`tool`,id:n.id,name:n.name,input:n.input,status:`running`,mutating:p.has(n.name)}])):n.type===`tool_end`?(async()=>{let e=n.image?await t.fileUrl(n.image).catch(()=>void 0):void 0;w(n.id,{status:n.error?`error`:`done`,error:n.error,summary:G_(n.result),image:e,before:m.get(n.id)})})():n.type===`refusal`&&S(t=>[...t,{kind:`notice`,id:U_(),text:n.explanation??e(`assistant.refused`),tone:`error`}])}});y.current=null,v(!1),c(t=>({messages:C.messages,items:[...t.items,...C.status===`error`?[{kind:`notice`,id:U_(),text:C.error??`Error`,tone:`error`}]:[],...C.status===`aborted`?[{kind:`notice`,id:U_(),text:e(`assistant.stopped`)}]:[],...C.status===`max_iterations`?[{kind:`notice`,id:U_(),text:e(`assistant.maxIterations`)}]:[]]}))},ee=!!l;return(0,J.jsxs)(`aside`,{className:`flex w-[360px] shrink-0 flex-col border-l border-line bg-ink-1`,"aria-label":e(`assistant.title`),children:[(0,J.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-line pl-3 pr-1.5`,children:[(0,J.jsx)(oe,{size:15,className:`text-agent`}),(0,J.jsx)(`span`,{className:`text-sm font-semibold`,children:e(`assistant.title`)}),(0,J.jsx)(`select`,{value:d,onChange:e=>(f(e.target.value),B_(R_,e.target.value)),"aria-label":e(`assistant.model`),className:`ml-1 h-6 rounded bg-transparent px-1 text-2xs text-fg-muted outline-none hover:bg-ink-3`,children:k_.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))}),(0,J.jsxs)(`div`,{className:`ml-auto flex`,children:[(0,J.jsx)(Z,{label:e(`assistant.newChat`),disabled:_,onClick:()=>c({messages:[],items:[]}),children:(0,J.jsx)(Or,{size:14})}),(0,J.jsx)(Z,{label:e(`assistant.settings`),active:p,onClick:()=>m(e=>!e),children:(0,J.jsx)(fr,{size:14})}),(0,J.jsx)(Z,{label:e(`assistant.close`),onClick:()=>a.set({assistant:!1}),children:(0,J.jsx)(vi,{size:14})})]})]}),(!ee||p)&&(0,J.jsx)(Y_,{apiKey:l,onSave:e=>(u(e),B_(L_,e||null),m(!1))}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2.5 overflow-auto px-3 py-3 text-sm`,children:[!s.items.length&&ee&&(0,J.jsxs)(`div`,{className:`space-y-2 pt-4 text-center`,children:[(0,J.jsx)(`div`,{className:`text-sm text-fg-muted`,children:e(`assistant.emptyTitle`)}),(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,children:[e(`assistant.example1`),e(`assistant.example2`),e(`assistant.example3`)].map(e=>(0,J.jsx)(`button`,{type:`button`,onClick:()=>g(e),className:`rounded-md border border-line px-2.5 py-1.5 text-left text-xs text-fg-muted hover:border-fg-faint hover:text-fg`,children:e},e))})]}),s.items.map(t=>t.kind===`user`?(0,J.jsx)(`div`,{className:`ml-8 rounded-lg bg-accent/15 px-3 py-2 text-fg`,children:t.text},t.id):t.kind===`assistant`?(0,J.jsx)(`div`,{className:`leading-relaxed text-fg`,children:(0,J.jsx)(q_,{text:t.text})},t.id):t.kind===`notice`?(0,J.jsx)(`div`,{className:q(`rounded-md px-2.5 py-1.5 text-xs`,t.tone===`error`?`bg-danger/10 text-danger`:`bg-ink-2 text-fg-muted`),children:t.text},t.id):(0,J.jsxs)(`div`,{className:q(`rounded-md border bg-ink-0/40`,t.mutating&&t.status===`done`?`border-agent/30`:`border-line`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5`,children:[t.status===`running`?(0,J.jsx)(gn,{size:12,className:`animate-spin text-fg-muted`}):t.status===`error`?(0,J.jsx)(ke,{size:12,className:`text-danger`}):t.status===`undone`?(0,J.jsx)(nr,{size:12,className:`text-fg-faint`}):t.mutating?(0,J.jsx)(Rn,{size:12,className:`text-agent`}):(0,J.jsx)(ve,{size:12,className:`text-fg-faint`}),(0,J.jsx)(`span`,{className:`font-mono text-2xs text-fg`,children:t.name}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-2xs text-fg-faint`,children:K_(t.name,t.input)}),t.mutating&&t.status===`done`&&t.before&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>{n.replace(t.before),w(t.id,{status:`undone`})},className:`rounded px-1.5 py-0.5 text-2xs font-medium text-accent hover:bg-ink-3`,children:e(`assistant.undo`)})]}),(t.summary||t.error)&&(0,J.jsx)(`div`,{className:q(`border-t border-line/70 px-2.5 py-1 text-2xs`,t.error?`text-danger`:`text-fg-muted`),children:t.error??t.summary}),t.image&&(0,J.jsx)(`img`,{src:t.image,alt:e(`assistant.renderAlt`),className:`block w-full rounded-b-md border-t border-line/70`})]},t.id)),_&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,J.jsx)(gn,{size:12,className:`animate-spin`}),` `,e(`assistant.working`)]}),(0,J.jsx)(`div`,{ref:b})]}),(0,J.jsxs)(`div`,{className:`shrink-0 border-t border-line p-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-end gap-1.5 rounded-lg border border-line bg-ink-2 p-1.5 focus-within:border-accent/60`,children:[(0,J.jsx)(`textarea`,{value:h,rows:2,disabled:!ee,placeholder:e(ee?`assistant.placeholder`:`assistant.needKey`),onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),T())},className:`max-h-40 min-h-[36px] flex-1 resize-none bg-transparent px-1 text-sm outline-none placeholder:text-fg-faint`}),_?(0,J.jsx)(Z,{label:e(`assistant.stop`),onClick:()=>y.current?.abort(),children:(0,J.jsx)(Mr,{size:13,fill:`currentColor`})}):(0,J.jsx)(Z,{label:e(`assistant.send`),disabled:!h.trim()||!ee,onClick:()=>void T(),className:`text-accent`,children:(0,J.jsx)(ur,{size:14})})]}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 px-1 text-2xs text-fg-faint`,children:[(0,J.jsx)(gi,{size:10}),` `,e(`assistant.toolsCount`,{n:r.length})]})]})]})}function Y_({apiKey:e,onSave:t}){let{t:n}=K(),[r,i]=(0,C.useState)(e),[a,o]=(0,C.useState)(!1);return(0,J.jsxs)(`div`,{className:`shrink-0 space-y-2.5 border-b border-line bg-ink-0/40 p-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(Zt,{size:14,className:`mt-0.5 shrink-0 text-key`}),(0,J.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,J.jsx)(`p`,{className:`font-medium text-fg`,children:n(`assistant.keyTitle`)}),(0,J.jsx)(`p`,{children:n(`assistant.keyBody1`)}),(0,J.jsx)(`p`,{children:n(`assistant.keyBody2`)})]})]}),(0,J.jsxs)(`div`,{className:`flex gap-1`,children:[(0,J.jsxs)(`div`,{className:`relative flex-1`,children:[(0,J.jsx)(`input`,{type:a?`text`:`password`,value:r,onChange:e=>i(e.target.value),placeholder:`sk-ant-…`,autoComplete:`off`,spellCheck:!1,"aria-label":n(`assistant.keyLabel`),className:`field h-7 pr-7 font-mono`}),(0,J.jsx)(`button`,{type:`button`,"aria-label":n(a?`assistant.hideKey`:`assistant.showKey`),onClick:()=>o(e=>!e),className:`absolute right-1.5 top-1/2 -translate-y-1/2 text-fg-faint hover:text-fg`,children:a?(0,J.jsx)(at,{size:12}):(0,J.jsx)(st,{size:12})})]}),(0,J.jsx)(g_,{size:`sm`,variant:`primary`,disabled:!r.trim()||r.trim()===e,onClick:()=>t(r.trim()),children:n(`assistant.saveKey`)})]}),e&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>(i(``),t(``)),className:`text-2xs text-fg-faint hover:text-danger`,children:n(`assistant.forgetKey`)})]})}var X_=1.70158,Z_=X_*1.525,Q_=2.70158,$_=2*Math.PI/3,ev=2*Math.PI/4.5;function tv(e){let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375}function nv(e){return[e,t=>1-e(1-t),t=>t<.5?e(2*t)/2:1-e(2-2*t)/2]}var[rv,iv,av]=nv(e=>e*e),[ov,sv,cv]=nv(e=>e*e*e),[lv,uv,dv]=nv(e=>e*e*e*e),[fv,pv,mv]=nv(e=>e*e*e*e*e),[hv,gv,_v]=nv(e=>1-Math.sqrt(1-Math.min(e*e,1))),vv={linear:e=>e,inQuad:rv,outQuad:iv,inOutQuad:av,inCubic:ov,outCubic:sv,inOutCubic:cv,inQuart:lv,outQuart:uv,inOutQuart:dv,inQuint:fv,outQuint:pv,inOutQuint:mv,inSine:e=>1-Math.cos(e*Math.PI/2),outSine:e=>Math.sin(e*Math.PI/2),inOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,inExpo:e=>e<=0?0:2**(10*e-10),outExpo:e=>e>=1?1:1-2**(-10*e),inOutExpo:e=>e<=0?0:e>=1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,inCirc:hv,outCirc:gv,inOutCirc:_v,inBack:e=>Q_*e*e*e-X_*e*e,outBack:e=>1+Q_*(e-1)**3+X_*(e-1)**2,inOutBack:e=>e<.5?(2*e)**2*(7.189819*e-Z_)/2:((2*e-2)**2*(3.5949095*(e*2-2)+Z_)+2)/2,inElastic:e=>e<=0?0:e>=1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*$_),outElastic:e=>e<=0?0:e>=1?1:2**(-10*e)*Math.sin((e*10-.75)*$_)+1,inOutElastic:e=>e<=0?0:e>=1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*ev))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*ev)/2+1,inBounce:e=>1-tv(1-e),outBounce:tv,inOutBounce:e=>e<.5?(1-tv(1-2*e))/2:(1+tv(2*e-1))/2,step:e=>+(e>=1)};function yv(e,t,n,r){let i=3*e,a=3*(n-e)-i,o=1-i-a,s=3*t,c=3*(r-t)-s,l=1-s-c,u=e=>((o*e+a)*e+i)*e,d=e=>((l*e+c)*e+s)*e,f=e=>(3*o*e+2*a)*e+i;return e=>{if(e<=0)return 0;if(e>=1)return 1;let t=e;for(let n=0;n<8;n++){let n=u(t)-e;if(Math.abs(n)<1e-6)return d(t);let r=f(t);if(Math.abs(r)<1e-6)break;t-=n/r}let n=0,r=1;t=e;for(let i=0;i<40;i++){let i=u(t);if(Math.abs(i-e)<1e-6)break;i<e?n=t:r=t,t=(n+r)/2}return d(t)}}function bv(e,t,n=1){let r=Math.sqrt(e/n),i=t/(2*Math.sqrt(e*n)),a=i<1?6.9/(i*r):6.9/(r*(i-Math.sqrt(Math.max(i*i-1,0))||.001)),o=Math.min(Math.max(a,.001),60),s;if(i<1){let e=r*Math.sqrt(1-i*i);s=t=>1-Math.exp(-i*r*t)*(Math.cos(e*t)+i*r/e*Math.sin(e*t))}else if(i===1)s=e=>1-Math.exp(-r*e)*(1+r*e);else{let e=Math.sqrt(i*i-1),t=-r*(i-e),n=-r*(i+e);s=e=>1-(n*Math.exp(t*e)-t*Math.exp(n*e))/(n-t)}let c=s(o);return e=>e<=0?0:e>=1?1:s(e*o)+(1-c)*e}function xv(e,t=!1){let n=Math.max(1,Math.floor(e));return e=>e>=1?1:e<=0?0:Math.min(1,(t?Math.ceil(e*n):Math.floor(e*n))/n)}function Sv(e){switch(e.kind){case`named`:return vv[e.name]??vv.linear;case`cubicBezier`:return yv(e.x1,e.y1,e.x2,e.y2);case`spring`:return bv(e.stiffness,e.damping,e.mass);case`steps`:return xv(e.count,e.jumpStart)}}var Cv=new Map;function wv(e){let t=e??`linear`,n=Cv.get(t);if(!n){let e=Na(t);n=`error`in e?vv.linear:Sv(e),Cv.size<500&&Cv.set(t,n)}return n}function Tv(e,t){let n=t<=0?0:t>=1?1:t;return wv(e)(n)}var Ev=(e,t=3)=>String(Number(e.toFixed(t)));function Dv(e){switch(e.kind){case`named`:return e.name;case`cubicBezier`:return`cubicBezier(${Ev(e.x1)}, ${Ev(e.y1)}, ${Ev(e.x2)}, ${Ev(e.y2)})`;case`spring`:return e.mass===1?`spring(${Ev(e.stiffness,1)}, ${Ev(e.damping,1)})`:`spring(${Ev(e.stiffness,1)}, ${Ev(e.damping,1)}, ${Ev(e.mass,2)})`;case`steps`:return e.jumpStart?`steps(${e.count}, start)`:`steps(${e.count})`}}function Ov(e,t=`linear`){let n=Na(e??t);return`error`in n?{kind:`named`,name:t}:n}var kv={named:{kind:`named`,name:`inOutCubic`},cubicBezier:{kind:`cubicBezier`,x1:.22,y1:1,x2:.36,y2:1},spring:{kind:`spring`,stiffness:170,damping:18,mass:1},steps:{kind:`steps`,count:4,jumpStart:!1}},Av=[{name:`ease`,v:[.25,.1,.25,1]},{name:`easeOut`,v:[0,0,.58,1]},{name:`expo`,v:[.16,1,.3,1]},{name:`snappy`,v:[.22,1,.36,1]},{name:`anticipate`,v:[.68,-.6,.32,1.6]}];function jv(e,t,n,r={}){let i=wv(e),a=r.pad??2,[o,s]=r.range??[0,1],c=r.samples??48,l=[];for(let e=0;e<=c;e++){let r=e/c,u=i(r),d=a+r*(t-2*a),f=n-a-(u-o)/(s-o||1)*(n-2*a);l.push(`${e?`L`:`M`}${d.toFixed(1)} ${f.toFixed(1)}`)}return l.join(``)}function Mv(e){let t=wv(e),n=0,r=1;for(let e=0;e<=64;e++){let i=t(e/64);Number.isFinite(i)&&(n=Math.min(n,i),r=Math.max(r,i))}return[n,r]}function Nv(e){if(e.default!==void 0)return e.default;switch(e.type){case`number`:case`integer`:return e.min===void 0?0:e.min;case`boolean`:return!1;case`color`:return`#ffffff`;case`colors`:return[`#ffffff`];case`vec2`:return[0,0];case`vec3`:return[0,0,0];case`enum`:return e.options?.[0];case`array`:return[];case`object`:return{};default:return``}}function Pv(e,t){return t===void 0?Nv(e):t}function Fv(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`&&e.trim()!==``){let t=Number(e.trim().replace(`,`,`.`));return Number.isFinite(t)?t:null}return null}function Iv(e,t){let n=Array.isArray(e)?e:typeof e==`string`?e.split(/[\s,;]+/).filter(Boolean):null;if(!n||n.length!==t)return null;let r=n.map(Fv);return r.every(e=>e!==null)?r:null}function Lv(e,t){let n=t;return e.min!==void 0&&(n=Math.max(e.min,n)),e.max!==void 0&&(n=Math.min(e.max,n)),e.type===`integer`&&(n=Math.round(n)),n}function Rv(e,t){switch(e.type){case`number`:case`integer`:{let n=Fv(t);return n===null?{ok:!1,error:`number`}:{ok:!0,value:Lv(e,n)}}case`boolean`:return{ok:!0,value:t===!0||t===`true`||t===1||t===`1`};case`string`:return{ok:!0,value:t==null?``:String(t)};case`color`:return typeof t==`string`&&Ca(t.trim())?{ok:!0,value:t.trim()}:{ok:!1,error:`color`};case`colors`:{let e=Array.isArray(t)?t:typeof t==`string`?t.split(/[\s,;]+/).filter(Boolean):null;return!e||!e.length||!e.every(e=>typeof e==`string`&&Ca(e))?{ok:!1,error:`colors`}:{ok:!0,value:e.map(e=>String(e))}}case`vec2`:case`vec3`:{let n=Iv(t,e.type===`vec2`?2:3);return n?{ok:!0,value:n}:{ok:!1,error:e.type}}case`enum`:return typeof t==`string`&&(e.options??[]).includes(t)?{ok:!0,value:t}:{ok:!1,error:`enum`};case`array`:case`object`:{let n=t;if(typeof t==`string`)try{n=JSON.parse(t)}catch{return{ok:!1,error:`json`}}return(e.type===`array`?!Array.isArray(n):!n||typeof n!=`object`||Array.isArray(n))?{ok:!1,error:e.type}:{ok:!0,value:n}}}}function zv(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Bv(e,t,{keepDefault:n=!1}={}){let r=Rv(e,t);return r.ok&&!n&&e.default!==void 0&&zv(r.value,e.default)?{...r,drop:!0}:r}function Vv(e,t=3){if(!Number.isFinite(e))return`0`;let n=Number(e.toFixed(t));return Object.is(n,-0)?`0`:String(n)}function Hv({value:e,onChange:t,label:n,labelClass:r,step:i,min:a,max:o,integer:s,suffix:c,placeholder:l,empty:u,ariaLabel:d,className:f}){let[p,m]=(0,C.useState)(null),h=(0,C.useRef)(null),g=(0,C.useRef)(null),_=i??(s?1:Math.abs(e)>=10?.1:.01),v=e=>Lv({min:a,max:o,type:s?`integer`:`number`},e);(0,C.useEffect)(()=>{m(null)},[e]);let y=()=>{if(p===null)return;let n=Number(p.replace(`,`,`.`));m(null),Number.isFinite(n)&&n!==e&&t(v(n),!0)},b=t=>{t.button===0&&(t.target.setPointerCapture(t.pointerId),h.current={x:t.clientX,start:e,moved:!1,last:e},t.preventDefault())},x=e=>{let n=h.current;if(!n)return;let r=e.clientX-n.x;if(!n.moved&&Math.abs(r)<2)return;n.moved=!0;let i=e.shiftKey?10:e.altKey?.1:1,a=n.start+r*_*i,o=s?0:Math.max(0,Math.ceil(-Math.log10(_*i))),c=v(Number(a.toFixed(Math.min(o,6))));c!==n.last&&(n.last=c,t(c,!1))},S=e=>{let n=h.current;h.current=null,e.target.releasePointerCapture?.(e.pointerId),n&&(n.moved?t(n.last,!0):g.current?.focus())};return(0,J.jsxs)(`div`,{className:q(`flex h-6 min-w-0 flex-1 items-center rounded-[5px] border border-transparent bg-ink-2 focus-within:border-accent/70 focus-within:bg-ink-1 hover:border-line`,f),children:[n!==void 0&&(0,J.jsx)(`span`,{onPointerDown:b,onPointerMove:x,onPointerUp:S,className:q(`flex h-full w-4 shrink-0 cursor-ew-resize select-none items-center justify-center text-2xs font-semibold`,r??`text-fg-faint`),children:n}),(0,J.jsx)(`input`,{ref:g,"aria-label":d??n,inputMode:`decimal`,value:p??(u?``:Vv(e,s?0:3)),placeholder:u?`auto`:void 0,onPointerDown:n===void 0?b:void 0,onPointerMove:n===void 0?x:void 0,onPointerUp:n===void 0?S:void 0,onFocus:t=>{m(Vv(e,s?0:3)),requestAnimationFrame(()=>t.target.select())},onChange:e=>m(e.target.value),onBlur:y,onKeyDown:n=>{if(n.key===`Enter`)n.target.blur();else if(n.key===`Escape`)m(null),requestAnimationFrame(()=>n.target.blur());else if(n.key===`ArrowUp`||n.key===`ArrowDown`){n.preventDefault();let r=v(Number(((Number(p??e)||0)+(n.key===`ArrowUp`?1:-1)*_*(n.shiftKey?10:1)).toFixed(6)));m(Vv(r,s?0:3)),t(r,!0)}},className:q(`h-full w-full min-w-0 bg-transparent px-1 text-sm tabular-nums outline-none`,n===void 0&&`cursor-ew-resize focus:cursor-text`,l&&p===null?`text-fg-faint`:`text-fg`)}),c&&(0,J.jsx)(`span`,{className:`pr-1.5 text-2xs text-fg-faint`,children:c})]})}var Uv=[`text-[#f2766d]`,`text-[#7bd88f]`,`text-[#6fa8ff]`];function Wv({value:e,onChange:t,labels:n=[`X`,`Y`,`Z`],step:r,suffix:i,placeholder:a,min:o}){return(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 gap-1`,children:e.map((s,c)=>(0,J.jsx)(Hv,{label:n[c],labelClass:Uv[c],value:s,step:r,min:o,suffix:i,placeholder:a,onChange:(n,r)=>{let i=[...e];i[c]=n,t(i,r)}},c))})}function Gv({value:e,min:t,max:n,onChange:r,integer:i,placeholder:a,empty:o,ariaLabel:s,step:c}){let l=n-t||1,u=c??(i?1:l<=2?.01:l<=20?.05:l/200),d=o?0:Math.max(0,Math.min(1,(e-t)/l))*100;return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`relative flex h-6 min-w-0 flex-1 items-center`,children:[(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 h-[3px] rounded-full bg-ink-4`,children:(0,J.jsx)(`div`,{className:q(`h-full rounded-full`,a?`bg-fg-faint/50`:`bg-accent`),style:{width:`${d}%`}})}),(0,J.jsx)(`input`,{type:`range`,min:t,max:n,step:u,value:Number.isFinite(e)?e:t,"aria-label":s,onChange:e=>r(Lv({min:t,max:n,type:i?`integer`:`number`},Number(e.target.value)),!1),onPointerUp:e=>r(Lv({min:t,max:n,type:i?`integer`:`number`},Number(e.target.value)),!0),onKeyUp:e=>r(Lv({min:t,max:n,type:i?`integer`:`number`},Number(e.target.value)),!0),className:q(`slider relative h-6 w-full cursor-pointer appearance-none bg-transparent`,o&&`opacity-40`)})]}),(0,J.jsx)(Hv,{value:e,min:t,max:n,integer:i,placeholder:a,empty:o,onChange:r,ariaLabel:s,className:`w-[52px] flex-none`,step:u})]})}var Kv=u();function qv({trigger:e,children:t,width:n=280,align:r=`end`}){let[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useRef)(null),[c,l]=(0,C.useState)(null);return(0,C.useLayoutEffect)(()=>{if(!i||!o.current)return;let e=()=>{let e=o.current.getBoundingClientRect(),t=window.innerWidth,i=window.innerHeight,a=r===`end`?e.right-n:e.left;a=Math.max(8,Math.min(t-n-8,a));let c=i-e.bottom-12,u=e.top-12,d=s.current?.scrollHeight??320;l(c>=Math.min(d,260)||c>=u?{left:a,top:e.bottom+4,maxHeight:c}:{left:a,top:Math.max(8,e.top-4-Math.min(d,u)),maxHeight:u})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[i,n,r]),(0,C.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;!o.current?.contains(t)&&!s.current?.contains(t)&&a(!1)},t=e=>e.key===`Escape`&&(e.stopPropagation(),a(!1));return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t,!0)}},[i]),(0,J.jsxs)(`div`,{ref:o,className:`flex min-w-0 flex-1`,children:[e(()=>a(e=>!e),i),i&&(0,Kv.createPortal)((0,J.jsx)(`div`,{ref:s,className:`toast-in fixed z-50 overflow-auto rounded-lg border border-line bg-ink-1 shadow-xl shadow-black/50`,style:{width:n,left:c?.left??-9999,top:c?.top??-9999,maxHeight:c?.maxHeight??400},children:t(()=>a(!1))}),document.body)]})}function Jv({onClick:e,children:t,open:n,ariaLabel:r}){return(0,J.jsx)(`button`,{type:`button`,"aria-label":r,"aria-expanded":n,onClick:e,className:`field flex items-center gap-1.5 text-left ${n?`border-accent/70 bg-ink-1`:``}`,style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%23989fae' fill='none' stroke-width='1.2'/%3E%3C/svg%3E")`,backgroundRepeat:`no-repeat`,backgroundPosition:`right 6px center`,paddingRight:18},children:t})}function Yv({spec:e,size:t=14,className:n}){let r=Mv(e);return(0,J.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,className:q(`shrink-0`,n),"aria-hidden":!0,children:(0,J.jsx)(`path`,{d:jv(e,t,t,{pad:1.5,range:r,samples:32}),fill:`none`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`})})}var Xv=[`Sine`,`Quad`,`Cubic`,`Quart`,`Quint`,`Expo`,`Circ`,`Back`,`Elastic`,`Bounce`];function Zv({value:e,onChange:t,placeholder:n=`linear`,allowInherit:r,compact:i,ariaLabel:a}){let{t:o}=K(),s=e??n;return(0,J.jsx)(qv,{width:300,align:`start`,trigger:(t,n)=>i?(0,J.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":a??o(`ease.title`),title:s,className:q(`flex h-5 min-w-0 max-w-full items-center gap-1 rounded px-1 text-2xs hover:bg-ink-3`,e?`text-fg-muted`:`text-fg-faint`,n&&`bg-ink-3`),children:[(0,J.jsx)(Yv,{spec:s,size:12}),(0,J.jsx)(`span`,{className:`truncate`,children:s})]}):(0,J.jsxs)(Jv,{onClick:t,open:n,ariaLabel:a??o(`ease.title`),children:[(0,J.jsx)(Yv,{spec:s,className:`text-key`}),(0,J.jsx)(`span`,{className:q(`truncate font-mono text-xs`,!e&&`text-fg-faint`),children:s})]}),children:()=>(0,J.jsx)(Qv,{value:e,placeholder:n,onChange:t,allowInherit:r})})}function Qv({value:e,placeholder:t,onChange:n,allowInherit:r}){let{t:i}=K(),a=Ov(e,t),o=e=>n(Dv(e));return(0,J.jsxs)(`div`,{className:`p-2`,children:[(0,J.jsx)(`div`,{className:`mb-2 flex gap-0.5 rounded-md bg-ink-2 p-0.5`,role:`tablist`,children:[`named`,`cubicBezier`,`spring`,`steps`].map(e=>(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a.kind===e,onClick:()=>a.kind!==e&&o(kv[e]),className:q(`h-6 flex-1 rounded text-2xs font-medium`,a.kind===e?`bg-ink-4 text-fg`:`text-fg-muted hover:text-fg`),children:i(`ease.${e}`)},e))}),r!==void 0&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>n(void 0),className:q(`mb-2 w-full rounded-md border px-2 py-1 text-left text-2xs`,e===void 0?`border-accent/60 bg-accent/10 text-accent`:`border-line text-fg-muted hover:text-fg`),children:r}),a.kind===`named`&&(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:[`linear`,`step`].map(e=>(0,J.jsx)(ey,{name:e,active:a.name===e,onPick:()=>o({kind:`named`,name:e})},e))}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[52px_repeat(3,1fr)] items-center gap-1`,children:[(0,J.jsx)(`span`,{}),[`in`,`out`,`inOut`].map(e=>(0,J.jsx)(`span`,{className:`text-center text-2xs text-fg-faint`,children:e},e)),Xv.map(e=>(0,J.jsx)(ty,{family:e,current:a.name,onPick:e=>o({kind:`named`,name:e})},e))]})]}),a.kind===`cubicBezier`&&(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(ry,{value:[a.x1,a.y1,a.x2,a.y2],onChange:([e,t,n,r])=>o({kind:`cubicBezier`,x1:e,y1:t,x2:n,y2:r})}),(0,J.jsx)(`div`,{className:`grid grid-cols-4 gap-1`,children:[`x1`,`y1`,`x2`,`y2`].map((e,t)=>(0,J.jsx)(Hv,{label:e[0].toUpperCase(),value:[a.x1,a.y1,a.x2,a.y2][t],min:t%2==0?0:-2,max:t%2==0?1:3,step:.01,onChange:t=>o({...a,[e]:t}),ariaLabel:e},e))}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Av.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>o({kind:`cubicBezier`,x1:e.v[0],y1:e.v[1],x2:e.v[2],y2:e.v[3]}),className:`flex h-5 items-center gap-1 rounded border border-line px-1.5 text-2xs text-fg-muted hover:border-fg-faint hover:text-fg`,children:[(0,J.jsx)(Yv,{spec:`cubicBezier(${e.v.join(`, `)})`,size:10}),e.name]},e.name))})]}),a.kind===`spring`&&(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(ny,{spec:Dv(a)}),(0,J.jsx)($v,{label:i(`ease.stiffness`),children:(0,J.jsx)(Gv,{value:a.stiffness,min:10,max:600,step:1,onChange:e=>o({...a,stiffness:e}),ariaLabel:i(`ease.stiffness`)})}),(0,J.jsx)($v,{label:i(`ease.damping`),children:(0,J.jsx)(Gv,{value:a.damping,min:1,max:60,step:.5,onChange:e=>o({...a,damping:e}),ariaLabel:i(`ease.damping`)})}),(0,J.jsx)($v,{label:i(`ease.mass`),children:(0,J.jsx)(Gv,{value:a.mass,min:.1,max:5,step:.1,onChange:e=>o({...a,mass:e}),ariaLabel:i(`ease.mass`)})}),(0,J.jsx)(`p`,{className:`text-2xs leading-snug text-fg-faint`,children:i(`ease.springHint`)})]}),a.kind===`steps`&&(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(ny,{spec:Dv(a)}),(0,J.jsx)($v,{label:i(`ease.count`),children:(0,J.jsx)(Gv,{value:a.count,min:1,max:24,integer:!0,onChange:e=>o({...a,count:Math.max(1,Math.round(e))}),ariaLabel:i(`ease.count`)})}),(0,J.jsx)($v,{label:i(`ease.jumpStart`),children:(0,J.jsx)(y_,{checked:a.jumpStart,onChange:e=>o({...a,jumpStart:e}),ariaLabel:i(`ease.jumpStart`)})})]}),(0,J.jsx)(`div`,{className:`mt-2 truncate rounded bg-ink-0 px-2 py-1 font-mono text-2xs text-fg-muted`,children:e??t})]})}function $v({label:e,children:t}){return(0,J.jsxs)(`div`,{className:`grid grid-cols-[70px_1fr] items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e}),(0,J.jsx)(`div`,{className:`flex min-w-0`,children:t})]})}function ey({name:e,active:t,onPick:n,label:r}){return(0,J.jsxs)(`button`,{type:`button`,title:e,"aria-pressed":t,onClick:n,className:q(`flex h-6 items-center justify-center gap-1 rounded border text-2xs`,t?`border-accent/70 bg-accent/15 text-accent`:`border-line text-fg-muted hover:border-fg-faint hover:text-fg`),children:[(0,J.jsx)(Yv,{spec:e,size:14}),r??e]})}function ty({family:e,current:t,onPick:n}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e}),[`in`,`out`,`inOut`].map(r=>{let i=`${r}${e}`;return Oa.includes(i)?(0,J.jsx)(`button`,{type:`button`,title:i,"aria-label":i,"aria-pressed":t===i,onClick:()=>n(i),className:q(`flex h-6 items-center justify-center rounded border`,t===i?`border-accent/70 bg-accent/15 text-accent`:`border-line text-fg-muted hover:border-fg-faint hover:text-fg`),children:(0,J.jsx)(Yv,{spec:i,size:16})},r):(0,J.jsx)(`span`,{},r)})]})}function ny({spec:e}){let t=Mv(e),n=e=>66-(e-t[0])/(t[1]-t[0]||1)*62;return(0,J.jsxs)(`svg`,{width:284,height:70,className:`block rounded-md bg-ink-0`,"aria-hidden":!0,children:[(0,J.jsx)(`line`,{style:{stroke:`rgb(var(--line))`},x1:4,x2:280,y1:n(1),y2:n(1),strokeDasharray:`3 3`}),(0,J.jsx)(`line`,{style:{stroke:`rgb(var(--line))`},x1:4,x2:280,y1:n(0),y2:n(0)}),(0,J.jsx)(`path`,{style:{stroke:`rgb(var(--key))`},d:jv(e,284,70,{pad:4,range:t,samples:96}),fill:`none`,strokeWidth:1.6})]})}function ry({value:e,onChange:t}){let n=(0,C.useRef)(null),r=(0,C.useRef)(null),i=e=>12+e*180,a=e=>50+(1-e)*180,[o,s,c,l]=e,u=e=>{let t=n.current.getBoundingClientRect(),r=Math.max(0,Math.min(1,(e.clientX-t.left-12)/180)),i=Math.max(-50/180,Math.min(1.2777777777777777,1-(e.clientY-t.top-50)/180));return[Math.round(r*100)/100,Math.round(i*100)/100]},d=e=>{if(r.current===null)return;let[n,i]=u(e);t(r.current===0?[n,i,c,l]:[o,s,n,i])},f=(e,t,n,o,s)=>(0,J.jsxs)(`g`,{children:[(0,J.jsx)(`line`,{style:{stroke:`rgb(var(--accent))`},x1:i(o),y1:a(s),x2:i(t),y2:a(n),strokeWidth:1,opacity:.7}),(0,J.jsx)(`circle`,{style:{fill:`rgb(var(--ink-1))`,stroke:`rgb(var(--accent))`},cx:i(t),cy:a(n),r:6,strokeWidth:2,className:`cursor-grab active:cursor-grabbing`,onPointerDown:t=>{t.stopPropagation(),t.target.setPointerCapture(t.pointerId),r.current=e},role:`slider`,"aria-label":`handle ${e+1}`,"aria-valuenow":t})]});return(0,J.jsxs)(`svg`,{ref:n,width:204,height:280,className:`mx-auto block touch-none select-none rounded-md bg-ink-0`,onPointerMove:d,onPointerUp:()=>r.current=null,children:[(0,J.jsx)(`rect`,{style:{stroke:`rgb(var(--line))`},x:12,y:50,width:180,height:180,fill:`none`}),[.25,.5,.75].map(e=>(0,J.jsxs)(`g`,{style:{stroke:`rgb(var(--line))`},strokeDasharray:`2 4`,children:[(0,J.jsx)(`line`,{x1:i(e),x2:i(e),y1:50,y2:230}),(0,J.jsx)(`line`,{y1:a(e),y2:a(e),x1:12,x2:192})]},e)),(0,J.jsx)(`line`,{style:{stroke:`rgb(var(--fg-faint))`},x1:i(0),y1:a(0),x2:i(1),y2:a(1),strokeDasharray:`3 3`,opacity:.5}),(0,J.jsx)(`path`,{style:{stroke:`rgb(var(--key))`},d:`M${i(0)} ${a(0)} C${i(o)} ${a(s)} ${i(c)} ${a(l)} ${i(1)} ${a(1)}`,fill:`none`,strokeWidth:2}),f(0,o,s,0,0),f(1,c,l,1,1)]})}function iy(e){let t=e?Sa(e):null;return t?wa(t):`#000000`}function ay({value:e,onChange:t,final:n,className:r,ariaLabel:i}){let a=(0,C.useRef)(null);return(0,J.jsx)(`label`,{className:q(`relative h-6 w-6 shrink-0 cursor-pointer overflow-hidden rounded-[5px] border border-white/10`,r),style:{background:Ca(e)?e:`transparent`},title:e,children:(0,J.jsx)(`input`,{ref:a,type:`color`,"aria-label":i??`Colour`,value:iy(e),onInput:e=>t(e.target.value,!!n),onChange:e=>t(e.target.value,!0),className:`absolute inset-0 h-full w-full cursor-pointer opacity-0`})})}function oy({value:e,onChange:t,placeholder:n}){return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,J.jsx)(ay,{value:e,onChange:t}),(0,J.jsx)(__,{value:e,onCommit:e=>Ca(e.trim())&&t(e.trim(),!0),className:q(`font-mono text-xs`,n&&`text-fg-faint`),ariaLabel:xh(`ui.colourValue`)})]})}function sy({value:e,onChange:t}){return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1`,children:[e.map((n,r)=>(0,J.jsxs)(`div`,{className:`group/sw relative`,children:[(0,J.jsx)(ay,{value:n,onChange:(n,i)=>{let a=[...e];a[r]=n,t(a,i)}}),e.length>1&&(0,J.jsx)(`button`,{type:`button`,"aria-label":xh(`ui.removeColour`),onClick:()=>t(e.filter((e,t)=>t!==r),!0),className:`absolute -right-1 -top-1 hidden h-3.5 w-3.5 items-center justify-center rounded-full bg-ink-4 text-fg group-hover/sw:flex`,children:(0,J.jsx)(vi,{size:9})})]},r)),(0,J.jsx)(`button`,{type:`button`,"aria-label":xh(`ui.addColour`),onClick:()=>t([...e,e[e.length-1]??`#ffffff`],!0),className:`flex h-6 w-6 items-center justify-center rounded-[5px] border border-dashed border-line text-fg-faint hover:border-fg-faint hover:text-fg`,children:(0,J.jsx)(Kn,{size:11})})]})}var cy=[`position`,`rotation`,`scale`,`visible`,`material.opacity`,`material.color`,`material.emissiveIntensity`],ly=[`camera.position`,`camera.target`,`camera.fov`],uy={position:[0,0,0],rotation:[0,0,0],scale:1,visible:!0,"material.opacity":1,"material.color":`#ffffff`,"material.emissiveIntensity":1,"camera.target":[0,0,0],"camera.fov":45,intensity:1,color:`#ffffff`};function dy(e,t){try{return vf(e,t)}catch{return}}function fy(e){let t=e.indexOf(`.`);return t<0?{id:e,prop:``}:{id:e.slice(0,t),prop:e.slice(t+1)}}function py(e,t){let{id:n,prop:r}=fy(t);if(n===`camera`)return dy(e.camera,r)??uy[t];let i=Ic(e.objects,n)?.object??(e.lights??[]).find(e=>e.id===n);if(!i)return;let a=/^(position|rotation|scale)\.([xyz])$/.exec(r);if(a){let e=dy(i,a[1]),t=`xyz`.indexOf(a[2]);return Array.isArray(e)?e[t]:typeof e==`number`?e:+(a[1]===`scale`)}let o=dy(i,r);return r===`scale`&&Array.isArray(o)&&(o=o[0]),o??uy[r]}var my=.001,hy=e=>Math.round(e*1e3)/1e3;function gy(e,t,n){let r=hy(Math.max(0,t)),i=e.keys.find(e=>Math.abs(e[0]-r)<=my),a=e.keys.filter(e=>Math.abs(e[0]-r)>my);return a.push(i?.length===3?[r,n,i[2]]:[r,n]),a.sort((e,t)=>e[0]-t[0]),{...e,keys:a}}function _y(e,t,n){let r=e.keys[t];if(!r)return{track:e,index:t};let i=r.length===3?[hy(Math.max(0,n)),r[1],r[2]]:[hy(Math.max(0,n)),r[1]],a=e.keys.filter((e,n)=>n!==t);return a.push(i),a.sort((e,t)=>e[0]-t[0]),{track:{...e,keys:a},index:a.indexOf(i)}}function vy(e,t){return{...e,keys:e.keys.filter((e,n)=>n!==t)}}function yy(e,t=.05,n=!1){return hy(n?e:Math.round(e/t)*t)}var by=[.1,.25,.5,1,2,5,10,15,30,60,120,300,600];function xy(e,t=1/0,n=48){let r=e>0?e:1,i=Number.isFinite(t)&&t>0?t/r:1/0;for(let e of by)if(r/e<=16&&e*i>=n)return e;return by[by.length-1]}var Sy=e=>Array.isArray(e)?{from:e[0],to:e[1]}:e;function Cy(e,t){let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r++;return`${e}${r}`}var wy=/^[A-Za-z][\w-]*$/;function Ty(e,t,n){let r=[{op:`set`,path:`timeline`,value:t}];return n&&JSON.stringify(n)!==JSON.stringify(e.interactions??[])&&r.push({op:`set`,path:`interactions`,value:n}),r}var Ey=e=>{let t={...e};return t.markers&&!Object.keys(t.markers).length&&delete t.markers,t.segments&&!Object.keys(t.segments).length&&delete t.segments,t};function Dy(e,t,n){let r=e.timeline;return r?[{op:`set`,path:`timeline.markers`,value:{...r.markers??{},[t]:Math.round(Math.max(0,Math.min(r.duration,n))*1e3)/1e3}}]:[]}function Oy(e,t){let n=Cy(`marker`,Object.keys(e.timeline?.markers??{}));return{ops:Dy(e,n,t),name:n}}function ky(e,t,n){let r=e.timeline;if(!r?.markers||!(t in r.markers)||t===n||!wy.test(n)||n in r.markers)return[];let i=Object.fromEntries(Object.entries(r.markers).map(([e,r])=>[e===t?n:e,r])),a=e=>e===t?n:e,o=r.segments?Object.fromEntries(Object.entries(r.segments).map(([e,t])=>{let n=Sy(t);return[e,Array.isArray(t)?[a(t[0]),a(t[1])]:{...n,from:a(n.from),to:a(n.to)}]})):void 0,s=e.interactions?.map(e=>({...e,...e.on===`event`&&e.event===t?{event:n}:{},do:e.do.map(e=>`seek`in e&&e.seek===t?{...e,seek:n}:e)}));return Ty(e,Ey({...r,markers:i,...o?{segments:o}:{}}),s)}function Ay(e,t){let n=e.timeline;if(!n?.markers||!(t in n.markers))return[];let r=n.markers[t],i={...n.markers};delete i[t];let a=e=>e===t?r:e,o=n.segments?Object.fromEntries(Object.entries(n.segments).map(([e,t])=>[e,Array.isArray(t)?[a(t[0]),a(t[1])]:{...t,from:a(t.from),to:a(t.to)}])):void 0,s=e.interactions?.map(e=>({...e,do:e.do.map(e=>`seek`in e&&e.seek===t?{...e,seek:r}:e)}));return Ty(e,Ey({...n,markers:i,...o?{segments:o}:{}}),s)}function jy(e,t){let n=e.timeline;if(!n)return{ops:[],name:``};let r=Cy(`segment`,Object.keys(n.segments??{})),i=Math.round(Math.min(t,Math.max(0,n.duration-.5))*100)/100,a=Math.round(Math.min(n.duration,i+Math.min(1,n.duration))*100)/100;return{ops:[{op:`set`,path:`timeline.segments`,value:{...n.segments??{},[r]:{from:i,to:a}}}],name:r}}function My(e,t,n){let r=e.timeline;if(!r?.segments||!(t in r.segments)||t===n||!wy.test(n)||n in r.segments||n===`timeline`)return[];let i=Object.fromEntries(Object.entries(r.segments).map(([e,r])=>[e===t?n:e,r])),a=e.interactions?.map(e=>({...e,do:e.do.map(e=>`play`in e&&e.play===t?{...e,play:n}:`toggle`in e&&e.toggle===t?{...e,toggle:n}:e)}));return Ty(e,{...r,segments:i,...r.autoplay===t?{autoplay:n}:{}},a)}function Ny(e,t){let n=e.timeline;if(!n?.segments||!(t in n.segments))return[];let r={...n.segments};delete r[t];let i=Ey({...n,segments:r});return i.autoplay===t&&delete i.autoplay,[{op:`set`,path:`timeline`,value:i}]}function Py(e,t){return typeof e==`number`?e:t.markers?.[e]??0}var Fy=[`#7c8cff`,`#4fd1a5`,`#f26d9b`,`#6fc3ff`,`#c39bff`,`#f2b654`],Iy=26,Ly=236;function Ry(){let{t:e}=K(),{edit:t,player:n,store:r}=E_(),i=D_(),a=i.scene,o=a.timeline,s=o?.tracks??[],c=o?.duration||4,[l,u]=(0,C.useState)(0),[d,f]=(0,C.useState)(null),[p,m]=(0,C.useState)(`position`),[h,g]=(0,C.useState)(null),_=o?.markers??{},v=o?.segments??{},y=Object.keys(v),b=y.length?6+y.length*5:0,x=24+(o?16:0)+b,S=(0,C.useRef)(null);(0,C.useEffect)(()=>n.onTime(u),[n]);let w=i.selection,T=w?cy:ly;(0,C.useEffect)(()=>{T.includes(p)||m(T[0])},[T,p]);let ee=w?`${w}.${p}`:p,E=(e,n)=>t([{op:`addTrack`,track:e}],n?{coalesce:n}:void 0),te=()=>{let e=py(a,ee);if(e===void 0)return;let n=s.find(e=>e.target===ee)??{target:ee,keys:[],ease:`inOutCubic`},i=yy(l),c=[];o||c.push({op:`set`,path:`timeline`,value:{duration:Math.max(4,i),loop:!0,tracks:[]}}),c.push({op:`addTrack`,track:gy(n,i,e)}),t(c);let u=r.getSnapshot().scene?.timeline?.tracks.find(e=>e.target===ee);u&&f({target:ee,index:u.keys.findIndex(e=>Math.abs(e[0]-i)<.001)})},D=(e,t)=>e/c*t,[O,ne]=(0,C.useState)(600);(0,C.useEffect)(()=>{let e=S.current;if(!e)return;let t=new ResizeObserver(()=>ne(e.clientWidth-40));return t.observe(e),()=>t.disconnect()},[]);let re=xy(c,O),ie=(0,C.useMemo)(()=>{let e=[];for(let t=0;t<=c+1e-6;t+=re)e.push(Number(t.toFixed(3)));return e},[c,re]),ae=e=>{let t=S.current.getBoundingClientRect();return Math.max(0,Math.min(c,(e-t.left-8)/O*c))},oe=d?s.find(e=>e.target===d.target):void 0,se=oe&&d?oe.keys[d.index]:void 0;return(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line px-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(v_,{value:p,options:T.map(e=>({value:e,label:w?`${w}.${e}`:e})),onChange:m,className:`w-[170px]`,ariaLabel:e(`timeline.property`)}),(0,J.jsxs)(g_,{size:`xs`,variant:`subtle`,onClick:te,title:e(`timeline.addKeyHint`),children:[(0,J.jsx)(Ye,{size:11,className:`text-key`,fill:`currentColor`}),` `,e(`timeline.addKey`,{t:yy(l).toFixed(2)})]})]}),(0,J.jsx)(`div`,{className:`ml-auto flex items-center gap-2 text-xs text-fg-muted`,children:o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`flex items-center gap-1`,children:[e(`timeline.duration`),(0,J.jsx)(Hv,{value:o.duration,min:.1,step:.1,suffix:`s`,className:`w-[70px] flex-none`,onChange:(e,n)=>t([{op:`set`,path:`timeline.duration`,value:e}],{coalesce:n?void 0:`tl:duration`}),ariaLabel:e(`timeline.duration`)})]}),(0,J.jsx)(v_,{value:o.loop===`pingpong`?`pingpong`:o.loop?`loop`:`once`,options:[{value:`once`,label:e(`timeline.once`)},{value:`loop`,label:e(`timeline.loop`)},{value:`pingpong`,label:e(`timeline.pingpong`)}],onChange:e=>t([{op:`set`,path:`timeline.loop`,value:e===`pingpong`?`pingpong`:e===`loop`}]),className:`w-[96px]`,ariaLabel:e(`timeline.loop`)}),(0,J.jsxs)(`label`,{className:`flex items-center gap-1`,title:e(`timeline.speedHint`),children:[e(`timeline.speed`),(0,J.jsx)(Hv,{value:o.speed??1,min:.05,max:10,step:.05,suffix:`×`,placeholder:o.speed===void 0,className:`w-[58px] flex-none`,onChange:(e,n)=>t(e===1?o.speed===void 0?[]:[{op:`remove`,path:`timeline.speed`}]:[{op:`set`,path:`timeline.speed`,value:e}],{coalesce:n?void 0:`tl:speed`}),ariaLabel:e(`timeline.speed`)})]}),(0,J.jsx)(v_,{value:o.trigger??`visible`,options:Ko.map(t=>({value:t,label:e(`trigger.${t}`)})),onChange:e=>t([{op:`set`,path:`timeline.trigger`,value:e}]),className:`w-[124px]`,ariaLabel:e(`timeline.trigger`)}),(0,J.jsx)(v_,{value:o.autoplay===!1?`__off`:typeof o.autoplay==`string`?o.autoplay:`__on`,options:[{value:`__on`,label:e(`timeline.autoplayOn`)},{value:`__off`,label:e(`timeline.autoplayOff`)},...y.map(t=>({value:t,label:e(`timeline.autoplaySegment`,{name:t})}))],onChange:e=>t(e===`__on`?o.autoplay===void 0?[]:[{op:`remove`,path:`timeline.autoplay`}]:[{op:`set`,path:`timeline.autoplay`,value:e!==`__off`&&e}]),className:`w-[112px]`,ariaLabel:e(`timeline.autoplay`)}),(0,J.jsx)(Z,{label:e(`timeline.remove`),onClick:()=>t([{op:`remove`,path:`timeline`}]),children:(0,J.jsx)(Kr,{size:13})})]}):(0,J.jsx)(`span`,{className:`text-fg-faint`,children:e(`timeline.none`)})})]}),oe&&se&&d&&(0,J.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-line bg-ink-0/40 px-2`,children:[(0,J.jsxs)(`span`,{className:`truncate text-2xs text-fg-faint`,children:[oe.target,` · `,e(`timeline.keyN`,{n:d.index+1,total:oe.keys.length})]}),(0,J.jsx)(Uy,{track:oe,index:d.index,onChange:(e,t,n)=>{E(e,n?void 0:`key:${e.target}`),f({target:e.target,index:t})},onDelete:()=>{let e=vy(oe,d.index);t(e.keys.length?[{op:`addTrack`,track:e}]:[{op:`removeTrack`,target:e.target}]),f(null)}})]}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-auto`,children:[(0,J.jsxs)(`div`,{className:`sticky left-0 z-10 shrink-0 border-r border-line bg-ink-1`,style:{width:Ly},children:[(0,J.jsxs)(`div`,{className:`flex flex-col justify-end border-b border-line pb-0.5 pl-2 text-2xs text-fg-faint`,style:{height:x},children:[o&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,style:{height:16},children:[(0,J.jsx)(pt,{size:9}),` `,e(`timeline.markers`)]}),b>0&&(0,J.jsx)(`span`,{style:{height:b},children:e(`timeline.segments`)})]}),s.map(n=>{let{id:i,prop:a}=fy(n.target);return(0,J.jsxs)(`div`,{className:q(`group flex items-center gap-1 border-b border-line/60 pl-2 pr-1`,w===i&&`bg-accent/5`),style:{height:Iy},children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i!==`camera`&&r.select(i),className:`min-w-0 flex-1 truncate text-left text-xs`,children:[(0,J.jsx)(`span`,{className:q(w===i?`text-accent`:`text-fg`),children:i}),(0,J.jsxs)(`span`,{className:`text-fg-faint`,children:[`.`,a]})]}),(0,J.jsx)(`div`,{className:`w-[92px] shrink-0`,children:(0,J.jsx)(Zv,{compact:!0,value:n.ease,placeholder:`linear`,onChange:e=>E({...n,ease:e}),ariaLabel:e(`timeline.ease`)})}),(0,J.jsx)(Z,{label:e(`timeline.removeTrack`),className:`h-5 w-5 opacity-0 group-hover:opacity-100`,onClick:()=>t([{op:`removeTrack`,target:n.target}]),children:(0,J.jsx)(vi,{size:11})})]},n.target)})]}),(0,J.jsxs)(`div`,{ref:S,className:`relative min-w-[300px] flex-1`,children:[(0,J.jsxs)(`div`,{className:`sticky top-0 z-[5] border-b border-line bg-ink-1`,style:{height:x},children:[(0,J.jsx)(`div`,{className:`relative cursor-pointer`,style:{height:24},onPointerDown:e=>{e.target.setPointerCapture(e.pointerId),n.seek(ae(e.clientX))},onPointerMove:e=>e.buttons===1&&void n.seek(ae(e.clientX)),children:ie.map(e=>(0,J.jsxs)(`div`,{className:`pointer-events-none absolute top-0 h-full`,style:{left:8+D(e,O)},children:[(0,J.jsx)(`div`,{className:`h-2 w-px bg-fg-faint/60`}),(0,J.jsxs)(`div`,{className:`absolute left-1 top-1.5 text-2xs tabular-nums text-fg-faint`,children:[e,`s`]})]},e))}),o&&(0,J.jsx)(`div`,{className:`relative border-t border-line/50`,style:{height:16},title:e(`timeline.markerLaneHint`),onDoubleClick:e=>{if(e.target!==e.currentTarget)return;let n=Oy(a,yy(ae(e.clientX)));t(n.ops),g(n.name)},children:Object.entries(_).map(([e,i])=>(0,J.jsx)(zy,{name:e,x:8+D(i,O),selected:h===e,onSelect:()=>{g(e),n.seek(i)},onDrag:(n,i,a)=>t(Dy(r.getSnapshot().scene,e,yy(ae(n),.05,i)),a?void 0:{coalesce:`marker:${e}`})},e))}),b>0&&o&&(0,J.jsx)(`div`,{className:`relative border-t border-line/50`,style:{height:b},children:y.map((e,t)=>{let r=Sy(v[e]),i=Py(r.from,o),a=Py(r.to,o),s=Math.min(i,a);return(0,J.jsx)(`button`,{type:`button`,title:`${e}: ${i}s → ${a}s`,onClick:()=>n.playSegment(e),className:`absolute h-[4px] rounded-full opacity-80 hover:opacity-100`,style:{top:3+t*5,left:8+D(s,O),width:Math.max(3,D(Math.abs(a-i),O)),background:Fy[t%Fy.length]}},e)})})]}),s.map(e=>(0,J.jsxs)(`div`,{className:`relative border-b border-line/60`,style:{height:Iy},onPointerDown:e=>e.target===e.currentTarget&&f(null),children:[e.keys.length>1&&(0,J.jsx)(`div`,{className:`absolute top-1/2 h-px bg-key/30`,style:{left:8+D(e.keys[0][0],O),width:D(e.keys[e.keys.length-1][0]-e.keys[0][0],O)}}),e.keys.map((i,a)=>(0,J.jsx)(Hy,{x:8+D(i[0],O),selected:d?.target===e.target&&d.index===a,title:`${i[0]}s · ${JSON.stringify(i[1])}`,onSelect:()=>{f({target:e.target,index:a}),n.seek(i[0])},onDrag:(t,n,i)=>{let o=r.getSnapshot().scene?.timeline?.tracks.find(t=>t.target===e.target);if(!o)return;let s=d?.target===e.target?d.index:a,c=_y(o,Math.min(s,o.keys.length-1),yy(ae(t),.05,n));E(c.track,i?void 0:`key:${e.target}`),f({target:e.target,index:c.index})},onDelete:()=>{let n=vy(e,a);t(n.keys.length?[{op:`addTrack`,track:n}]:[{op:`removeTrack`,target:e.target}]),f(null)}},a))]},e.target)),!s.length&&(0,J.jsxs)(`div`,{className:`flex h-24 items-center justify-center gap-2 text-xs text-fg-faint`,children:[(0,J.jsx)(Kn,{size:12}),` `,w?e(`timeline.emptySelected`,{id:w}):e(`timeline.empty`)]}),Object.entries(_).map(([e,t])=>(0,J.jsx)(`div`,{className:q(`pointer-events-none absolute bottom-0 z-[3] w-px`,h===e?`bg-key/70`:`bg-key/25`),style:{left:8+D(t,O),top:x}},e)),(0,J.jsx)(`div`,{className:`pointer-events-none absolute bottom-0 top-0 z-[6] w-px bg-accent`,style:{left:8+D(Math.min(l,c),O)},children:(0,J.jsx)(`div`,{className:`absolute -left-[5px] top-0 h-0 w-0 border-x-[5px] border-t-[7px] border-x-transparent border-t-accent`})})]})]}),o&&(0,J.jsx)(By,{tl:o,time:l,selMarker:h,onSelectMarker:g})]})]})}function zy({name:e,x:t,selected:n,onSelect:r,onDrag:i}){let a=(0,C.useRef)(null);return(0,J.jsxs)(`button`,{type:`button`,title:e,"aria-label":e,"aria-pressed":n,onPointerDown:e=>{e.stopPropagation(),e.target.setPointerCapture(e.pointerId),a.current={x:e.clientX,moved:!1},r()},onPointerMove:e=>{let t=a.current;!t||!t.moved&&Math.abs(e.clientX-t.x)<3||(t.moved=!0,i(e.clientX,e.altKey,!1))},onPointerUp:e=>{let t=a.current;a.current=null,t?.moved&&i(e.clientX,e.altKey,!0)},className:`absolute top-0 z-[4] flex h-full cursor-ew-resize items-center outline-none`,style:{left:t},children:[(0,J.jsx)(`span`,{className:q(`absolute left-0 top-0 h-full w-px`,n?`bg-key`:`bg-key/60`)}),(0,J.jsx)(`span`,{className:q(`ml-px max-w-[90px] truncate rounded-r-sm px-1 text-[9px] font-medium leading-[13px]`,n?`bg-key text-ink-0`:`bg-key/25 text-key`),children:e})]})}function By({tl:e,time:t,selMarker:n,onSelectMarker:r}){let{t:i}=K(),{edit:a,player:o,store:s}=E_(),c=()=>s.getSnapshot().scene,l=Object.entries(e.markers??{}).sort((e,t)=>e[1]-t[1]),u=Object.entries(e.segments??{}),d=l.map(([e])=>e);return(0,J.jsxs)(`div`,{className:`flex w-[300px] shrink-0 flex-col overflow-y-auto border-l border-line bg-ink-1`,children:[(0,J.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-1 border-b border-line/60 pl-2.5 pr-1 text-2xs font-semibold text-fg-muted`,children:[(0,J.jsx)(pt,{size:10,className:`text-key`}),(0,J.jsx)(`span`,{className:`flex-1`,children:i(`timeline.markers`)}),(0,J.jsx)(Z,{label:i(`timeline.addMarker`),className:`h-5 w-5`,onClick:()=>{let e=Oy(c(),yy(t));a(e.ops),r(e.name)},children:(0,J.jsx)(Kn,{size:11})})]}),l.map(([t,o])=>(0,J.jsxs)(`div`,{className:q(`flex items-center gap-1 px-2 py-0.5`,n===t&&`bg-key/10`),onClick:()=>r(t),children:[(0,J.jsx)(__,{value:t,onCommit:e=>{let n=ky(c(),t,e.trim());n.length&&(a(n),r(e.trim()))},mono:!0,className:`text-2xs`,ariaLabel:i(`timeline.markerName`)}),(0,J.jsx)(Hv,{value:o,min:0,max:e.duration,step:.05,suffix:`s`,className:`w-[70px] flex-none`,onChange:(e,n)=>a(Dy(c(),t,e),n?void 0:{coalesce:`marker:${t}`}),ariaLabel:i(`timeline.markerTime`)}),(0,J.jsx)(Z,{label:i(`timeline.removeMarker`),className:`h-5 w-5`,onClick:()=>a(Ay(c(),t)),children:(0,J.jsx)(vi,{size:11})})]},t)),!l.length&&(0,J.jsx)(`div`,{className:`px-2.5 py-1 text-2xs leading-snug text-fg-faint`,children:i(`timeline.noMarkers`)}),(0,J.jsxs)(`div`,{className:`mt-1 flex h-7 shrink-0 items-center gap-1 border-y border-line/60 pl-2.5 pr-1 text-2xs font-semibold text-fg-muted`,children:[(0,J.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-accent`}),(0,J.jsx)(`span`,{className:`flex-1`,children:i(`timeline.segments`)}),(0,J.jsx)(Z,{label:i(`timeline.addSegment`),className:`h-5 w-5`,onClick:()=>a(jy(c(),t).ops),children:(0,J.jsx)(Kn,{size:11})})]}),u.map(([t,n],r)=>{let s=Sy(n),l=`timeline.segments.${t}`,u=e=>{let t={...s,...e};for(let e of Object.keys(t))t[e]===void 0&&delete t[e];a([{op:`set`,path:l,value:t}])},f=o.segment?.name===t;return(0,J.jsxs)(`div`,{className:`border-b border-line/40 px-2 py-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{background:Fy[r%Fy.length]}}),(0,J.jsx)(__,{value:t,onCommit:e=>{let n=My(c(),t,e.trim());n.length&&a(n)},mono:!0,className:`text-2xs`,ariaLabel:i(`timeline.segmentName`)}),(0,J.jsx)(Z,{label:i(`timeline.playSegment`),active:f,className:`h-5 w-5`,onClick:()=>o.playSegment(t),children:(0,J.jsx)(Wn,{size:10})}),(0,J.jsx)(Z,{label:i(`timeline.playReverse`),className:`h-5 w-5`,onClick:()=>o.playSegment(t,{reverse:!0}),children:(0,J.jsx)(Qn,{size:10})}),(0,J.jsx)(Z,{label:i(`timeline.removeSegment`),className:`h-5 w-5`,onClick:()=>a(Ny(c(),t)),children:(0,J.jsx)(vi,{size:11})})]}),(0,J.jsxs)(`div`,{className:`mt-1 grid grid-cols-2 gap-1`,children:[(0,J.jsx)(Vy,{label:i(`timeline.from`),value:s.from,markers:d,max:e.duration,onChange:e=>u({from:e})}),(0,J.jsx)(Vy,{label:i(`timeline.to`),value:s.to,markers:d,max:e.duration,onChange:e=>u({to:e})})]}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,J.jsx)(v_,{value:s.loop===`pingpong`?`pingpong`:s.loop?`loop`:`once`,options:[{value:`once`,label:i(`timeline.once`)},{value:`loop`,label:i(`timeline.loop`)},{value:`pingpong`,label:i(`timeline.pingpong`)}],onChange:e=>u({loop:e===`once`?void 0:e!==`pingpong`||`pingpong`}),className:`flex-1`,ariaLabel:i(`timeline.loop`)}),(0,J.jsx)(Hv,{label:`×`,value:s.speed??1,min:.05,max:10,step:.05,placeholder:s.speed===void 0,className:`w-[70px] flex-none`,onChange:e=>u({speed:e===1?void 0:e}),ariaLabel:i(`timeline.speed`)})]})]},t)}),!u.length&&(0,J.jsx)(`div`,{className:`px-2.5 py-1 text-2xs leading-snug text-fg-faint`,children:i(`timeline.noSegments`)})]})}function Vy({label:e,value:t,markers:n,max:r,onChange:i}){let a=typeof t==`string`;return(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5`,children:[(0,J.jsx)(`span`,{className:`w-6 shrink-0 text-2xs text-fg-faint`,children:e}),a?(0,J.jsx)(v_,{value:t,options:n.includes(t)?n:[t,...n],onChange:i,className:`text-2xs`,ariaLabel:e}):(0,J.jsx)(Hv,{value:t,min:0,max:r,step:.05,suffix:`s`,onChange:e=>i(e),ariaLabel:e}),n.length>0&&(0,J.jsx)(`button`,{type:`button`,title:a?`s`:`marker`,onClick:()=>i(a?0:n[0]),className:q(`flex h-5 w-4 shrink-0 items-center justify-center rounded`,a?`text-key`:`text-fg-faint hover:text-fg`),children:(0,J.jsx)(pt,{size:9})})]})}function Hy({x:e,selected:t,title:n,onSelect:r,onDrag:i,onDelete:a}){let o=(0,C.useRef)(null);return(0,J.jsx)(`button`,{type:`button`,title:n,"aria-label":n,"aria-pressed":t,onPointerDown:e=>{e.stopPropagation(),e.target.setPointerCapture(e.pointerId),o.current={x:e.clientX,moved:!1},r()},onPointerMove:e=>{let t=o.current;!t||!t.moved&&Math.abs(e.clientX-t.x)<3||(t.moved=!0,i(e.clientX,e.altKey,!1))},onPointerUp:e=>{let t=o.current;o.current=null,t?.moved&&i(e.clientX,e.altKey,!0)},onKeyDown:e=>{(e.key===`Delete`||e.key===`Backspace`)&&(e.stopPropagation(),e.preventDefault(),a())},className:`absolute top-1/2 z-[4] flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize items-center justify-center outline-none`,style:{left:e},children:(0,J.jsx)(`span`,{className:q(`block h-2.5 w-2.5 rotate-45 rounded-[2px] border transition-transform`,t?`scale-125 border-white bg-key`:`border-key/80 bg-key/80 hover:bg-key`)})})}function Uy({track:e,index:t,onChange:n,onDelete:r}){let{t:i}=K(),a=e.keys[t];if(!a)return null;let[o,s]=a,c=(r,i)=>{let a=e.keys.map((e,n)=>n===t?e.length===3?[e[0],r,e[2]]:[e[0],r]:e);n({...e,keys:a},t,i)};return(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 rounded-md bg-ink-2 py-0.5 pl-2 pr-0.5 text-xs`,children:[(0,J.jsx)(Ye,{size:10,className:`text-key`,fill:`currentColor`}),(0,J.jsx)(Hv,{value:o,min:0,step:.01,suffix:`s`,className:`w-[64px] flex-none bg-ink-1`,onChange:(r,i)=>{let a=_y(e,t,r);n(a.track,a.index,i)},ariaLabel:i(`timeline.keyTime`)}),(0,J.jsx)(`div`,{className:`flex w-[200px] min-w-0 items-center`,children:typeof s==`number`?(0,J.jsx)(Hv,{value:s,onChange:(e,t)=>c(e,t),className:`bg-ink-1`,ariaLabel:i(`timeline.keyValue`)}):typeof s==`boolean`?(0,J.jsx)(y_,{checked:s,onChange:e=>c(e,!0),ariaLabel:i(`timeline.keyValue`)}):Array.isArray(s)?(0,J.jsx)(Wv,{value:s.map(e=>typeof e==`number`?e:0),onChange:(e,t)=>c(e,t)}):(0,J.jsx)(oy,{value:String(s),onChange:(e,t)=>c(e,t)})}),(0,J.jsx)(`div`,{className:`w-[120px] min-w-0`,title:i(`timeline.keyEaseHint`),children:t>0&&(0,J.jsx)(Zv,{compact:!0,value:a[2],placeholder:e.ease??`linear`,allowInherit:i(`timeline.trackEase`,{ease:e.ease??`linear`}),onChange:r=>{let i=e.keys.map((e,n)=>n===t?r?[e[0],e[1],r]:[e[0],e[1]]:e);n({...e,keys:i},t,!0)},ariaLabel:i(`timeline.keyEase`)})}),(0,J.jsx)(Z,{label:i(`timeline.deleteKey`),className:`h-6 w-6`,onClick:r,children:(0,J.jsx)(Kr,{size:12})})]})}function Wy(e){return/objects#([A-Za-z][\w-]*)/.exec(e)?.[1]??null}function Gy({issues:e,dense:t}){let{store:n}=E_();return(0,J.jsx)(`ul`,{className:`divide-y divide-line/70`,children:e.map((e,r)=>{let i=Wy(e.path),a=i&&n.getSnapshot().scene&&Ic(n.getSnapshot().scene.objects,i),o=e.severity===`error`?ke:e.severity===`warning`?Qr:Yt;return(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,disabled:!a,onClick:()=>a&&n.select(i),className:q(`flex w-full items-start gap-2 px-3 text-left enabled:hover:bg-ink-2`,t?`py-1`:`py-1.5`),children:[(0,J.jsx)(o,{size:13,className:q(`mt-0.5 shrink-0`,e.severity===`error`?`text-danger`:e.severity===`warning`?`text-warn`:`text-accent`)}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-xs text-fg`,children:e.message}),e.hint&&(0,J.jsx)(`div`,{className:`text-2xs text-fg-muted`,children:e.hint}),(0,J.jsxs)(`div`,{className:`font-mono text-2xs text-fg-faint`,children:[e.code,` · `,e.path||`scene`]})]})]})},r)})})}function Ky({label:e,value:t,max:n,unit:r}){let i=n?Math.min(1,t/n):0,a=n!==void 0&&t>n;return(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-baseline justify-between text-2xs text-fg-muted`,children:[(0,J.jsx)(`span`,{children:e}),(0,J.jsxs)(`span`,{className:q(`tabular-nums`,a?`text-danger`:`text-fg`),children:[t.toLocaleString(),` `,r,n?(0,J.jsxs)(`span`,{className:`text-fg-faint`,children:[` / `,n.toLocaleString()]}):null]})]}),n?(0,J.jsx)(`div`,{className:`mt-1 h-1 overflow-hidden rounded-full bg-ink-3`,children:(0,J.jsx)(`div`,{className:q(`h-full rounded-full`,a?`bg-danger`:i>.8?`bg-warn`:`bg-agent`),style:{width:`${i*100}%`}})}):null]})}function qy(){let{t:e}=K(),{runCheck:t}=E_(),n=O_(e=>e.check),r=O_(e=>e.checkRunning);if(!n)return(0,J.jsxs)(S_,{icon:(0,J.jsx)(gr,{size:22}),title:e(`check.emptyTitle`),children:[(0,J.jsx)(`p`,{className:`mb-3 max-w-sm`,children:e(`check.emptyBody`)}),(0,J.jsxs)(g_,{variant:`primary`,size:`xs`,onClick:()=>void t(),disabled:r,children:[r?(0,J.jsx)(gn,{size:11,className:`animate-spin`}):(0,J.jsx)(gr,{size:11}),` `,e(`check.run`)]})]});let i=n.budget;return(0,J.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,J.jsxs)(`div`,{className:`w-[300px] shrink-0 space-y-3 overflow-auto border-r border-line p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:q(`rounded-md px-2 py-0.5 text-xs font-semibold`,n.ok?`bg-agent/15 text-agent`:`bg-danger/15 text-danger`),children:n.ok?e(`check.ready`):e(`check.notReady`)}),(0,J.jsx)(`span`,{className:`text-2xs text-fg-faint`,children:new Date(n.at).toLocaleTimeString()}),(0,J.jsxs)(g_,{size:`xs`,variant:`ghost`,className:`ml-auto`,onClick:()=>void t(),disabled:r,children:[r?(0,J.jsx)(gn,{size:11,className:`animate-spin`}):(0,J.jsx)(Xn,{size:11}),` `,e(`check.rerun`)]})]}),(0,J.jsxs)(`div`,{className:`flex gap-3 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-danger`,children:e(`check.errors`,{n:n.counts?.errors??0})}),(0,J.jsx)(`span`,{className:`text-warn`,children:e(`check.warnings`,{n:n.counts?.warnings??0})}),(0,J.jsx)(`span`,{className:`text-fg-muted`,children:e(`check.infos`,{n:n.counts?.infos??0})})]}),i&&(0,J.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,J.jsx)(Ky,{label:e(`check.triangles`),value:i.estimatedTriangles??0,unit:``}),(0,J.jsx)(Ky,{label:e(`check.weight`),value:Math.round(i.totalKb??0),max:i.budgetKb,unit:`KB`}),i.runtimeKb?(0,J.jsx)(Ky,{label:e(`check.runtime`),value:Math.round(i.runtimeKb),unit:`KB`}):null]}),i?.heaviestObjects?.length?(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-2xs text-fg-muted`,children:e(`check.heaviest`)}),i.heaviestObjects.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`flex justify-between text-2xs`,children:[(0,J.jsx)(`span`,{className:`font-mono text-fg`,children:e.id}),(0,J.jsx)(`span`,{className:`tabular-nums text-fg-faint`,children:e.triangles.toLocaleString()})]},e.id))]}):null,n.licences?.length?(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-2xs text-fg-muted`,children:e(`check.licences`)}),n.licences.map(e=>(0,J.jsx)(`div`,{className:`text-2xs text-fg-faint`,children:e.attribution},e.path))]}):null]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:n.issues.length?(0,J.jsx)(Gy,{issues:n.issues}):(0,J.jsx)(`div`,{className:`p-4 text-xs text-agent`,children:e(`check.clean`)})})]})}function Jy(e){return bh(`fields.${e}`)??Xy(e)}var Yy={kb:`KB`,dpr:`DPR`,ior:`IOR`,svg:`SVG`,hdri:`HDRI`,fov:`FOV`,ui:`UI`,id:`ID`,url:`URL`};function Xy(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).toLowerCase().split(` `).filter(Boolean).map(e=>Yy[e]??e);if(!t.length)return e;let n=t[0];return t[0]=n===n.toUpperCase()?n:n[0].toUpperCase()+n.slice(1),t.join(` `)}function Zy({spec:e,value:t,onChange:n}){let r=Pv(e,t),i=t===void 0,a=i&&e.default===void 0,o=(t,r)=>{let i=Bv(e,t);i.ok&&n(i.drop?void 0:i.value,r)};switch(e.type){case`number`:case`integer`:return e.min!==void 0&&e.max!==void 0&&e.max-e.min<=1e4?(0,J.jsx)(Gv,{value:Number(r)||0,min:e.min,max:e.max,integer:e.type===`integer`,placeholder:i,empty:a,onChange:(e,t)=>o(e,t),ariaLabel:e.name}):(0,J.jsx)(Hv,{value:Number(r)||0,min:e.min,max:e.max,integer:e.type===`integer`,placeholder:i,empty:a,onChange:(e,t)=>o(e,t),ariaLabel:e.name});case`boolean`:return(0,J.jsx)(y_,{checked:!!r,onChange:e=>o(e,!0),ariaLabel:e.name});case`color`:return(0,J.jsx)(oy,{value:String(r),placeholder:i,onChange:(e,t)=>o(e,t)});case`colors`:return(0,J.jsx)(sy,{value:Array.isArray(r)?r:[],onChange:(e,t)=>o(e,t)});case`vec2`:case`vec3`:return(0,J.jsx)(Wv,{value:Array.isArray(r)?r:e.type===`vec2`?[0,0]:[0,0,0],labels:e.type===`vec2`?[`X`,`Y`]:void 0,placeholder:i,onChange:(e,t)=>o(e,t)});case`enum`:return(0,J.jsx)(v_,{value:String(r??``),options:e.options??[],onChange:e=>o(e,!0),ariaLabel:e.name});case`array`:return e.options?.length?(0,J.jsx)(Qy,{value:Array.isArray(r)?r:[],options:e.options,onChange:e=>o(e,!0)}):(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)($y,{value:r,onCommit:e=>o(e,!0)}),e.description&&(0,J.jsx)(`span`,{className:`text-[10px] leading-snug text-fg-faint`,children:e.description})]});case`string`:return(0,J.jsx)(__,{value:String(r??``),onCommit:e=>n(e===``?void 0:e,!0),ariaLabel:e.name});default:return(0,J.jsx)($y,{value:r,onCommit:e=>o(e,!0)})}}function Qy({value:e,options:t,onChange:n}){return(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap gap-1 py-0.5`,children:t.map(t=>{let r=e.includes(t);return(0,J.jsx)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>n(r?e.filter(e=>e!==t):[...e,t]),className:`h-5 rounded-full border px-2 text-2xs transition-colors ${r?`border-accent/60 bg-accent/15 text-accent`:`border-line text-fg-muted hover:border-fg-faint hover:text-fg`}`,children:t},t)})})}function $y({value:e,onCommit:t,rows:n=3}){let r=JSON.stringify(e??null),[i,a]=(0,C.useState)(r),[o,s]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{a(r),s(!1)},[r]),(0,J.jsx)(`textarea`,{value:i,rows:n,spellCheck:!1,onChange:e=>a(e.target.value),onBlur:()=>{try{let e=JSON.parse(i);s(!1),JSON.stringify(e)!==r&&t(e)}catch{s(!0)}},className:`field h-auto resize-y py-1 font-mono text-2xs leading-snug ${o?`border-danger/70`:``}`})}function eb({spec:e,value:t,onChange:n}){return K(),(0,J.jsx)(Q,{label:Jy(e.name),hint:e.description,overridden:t!==void 0,onReset:()=>n(void 0,!0),align:e.type===`array`&&!e.options?.length||e.type===`object`?`start`:`center`,children:(0,J.jsx)(Zy,{spec:e,value:t,onChange:n})})}function $({specs:e,base:t,values:n,skip:r}){let i=tb();return(0,J.jsx)(J.Fragment,{children:e.filter(e=>!r?.includes(e.name)).map(e=>(0,J.jsx)(eb,{spec:e,value:n?.[e.name],onChange:(n,r)=>i(t?`${t}.${e.name}`:e.name,n,r)},e.name))})}function tb(){let{edit:e,store:t}=E_();return D_(),(n,r,i=!0,a=[])=>{let o=t.getSnapshot().scene;if(!o)return;let s=[...Wg(o,n,r),...a];s.length&&e(s,{coalesce:`field:${n}`})}}var nb=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function rb({specs:e,path:t,value:n,expand:r,collapse:i,skip:a}){let o=tb(),s=nb(n)?n:r?r(n):{};return(0,J.jsx)(J.Fragment,{children:e.filter(e=>!a?.includes(e.name)).map(e=>(0,J.jsx)(eb,{spec:e,value:s[e.name],onChange:(n,r)=>{let a={...s};n===void 0?delete a[e.name]:a[e.name]=n,o(t,i?i(a):a,r)}},e.name))})}function ib(e){let t=co.filter(t=>t in e);return t.length===1?t[0]:null}var ab=[`click`,`hover`,`hoverEnd`],ob=[`click`,`key`];function sb(e){return[`timeline`,...Object.keys(e.timeline?.segments??{})]}function cb(e){let t=[];return V(e.objects,e=>void(e.kind===`model`&&t.push(e.id))),t}function lb(e,t){let n=sb(t);switch(e){case`play`:return{play:n[1]??`timeline`};case`toggle`:return{toggle:n[1]??`timeline`};case`seek`:return{seek:Object.keys(t.timeline?.markers??{})[0]??0};case`set`:{let e=t.objects[0]?.id??`camera`;return V(t.objects,n=>void(n.kind!==`group`&&e===t.objects[0]?.id&&(e=n.id))),{set:{path:`${e}.scale`,value:1.1},duration:.3,ease:`outCubic`}}case`emit`:return{emit:`clicked`};case`openUrl`:return{openUrl:`https://example.com`,newTab:!0};case`playClip`:return{playClip:0,target:cb(t)[0]??``}}}function ub(e,t=`click`){let n=e.objects[0]?.id,r={on:t,do:[lb(e.timeline?.segments?`play`:`emit`,e)]};return ab.includes(t)&&n&&(r.target=n),t===`key`&&(r.key=`Space`),t===`event`&&(r.event=Object.keys(e.timeline?.markers??{})[0]??`clicked`),t===`scroll`&&(r.at=.5),r}function db(e,t,n){let r={on:t,do:e.do,...e.once===void 0?{}:{once:e.once}};return ab.includes(t)&&e.target&&(r.target=e.target),t===`key`&&(r.key=e.key??`Space`),t===`event`&&(r.event=e.event??Object.keys(n.timeline?.markers??{})[0]??`clicked`),t===`scroll`&&(r.at=e.at??.5),r}function fb(e,t){if(`openUrl`in e){if(!jo(e.openUrl))return`url`;if(!ob.includes(t))return`gesture`}return null}function pb(e){let t=[];V(e.objects,e=>{t.push(`${e.id}.position`,`${e.id}.rotation`,`${e.id}.scale`,`${e.id}.visible`),(`material`in e||e.kind===`mesh`||e.kind===`text`)&&t.push(`${e.id}.material.color`,`${e.id}.material.emissiveIntensity`,`${e.id}.material.opacity`)});for(let n of e.lights??[])n.id&&t.push(`${n.id}.intensity`,`${n.id}.color`);return t.push(`camera.position`,`camera.target`,`camera.fov`),t}function mb(){let{t:e}=K(),{edit:t}=E_(),n=D_().scene,r=n.interactions??[],i=(e,n)=>t(e.length?[{op:`set`,path:`interactions`,value:e}]:r.length?[{op:`remove`,path:`interactions`}]:[],n?{coalesce:n}:void 0),a=(e,t,n)=>i(r.map((n,r)=>r===e?t:n),n);return(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line px-3`,children:[(0,J.jsx)(bi,{size:12,className:`text-accent`}),(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e(`interactions.intro`)}),(0,J.jsxs)(g_,{size:`xs`,variant:`subtle`,className:`ml-auto`,onClick:()=>i([...r,ub(n)]),children:[(0,J.jsx)(Kn,{size:11}),` `,e(`interactions.add`)]})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[!r.length&&(0,J.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1 text-center text-xs text-fg-faint`,children:[(0,J.jsx)(En,{size:18}),(0,J.jsx)(`div`,{children:e(`interactions.empty`)}),(0,J.jsx)(`div`,{className:`max-w-md text-2xs`,children:e(`interactions.emptyHint`)})]}),(0,J.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(420px,1fr))] gap-2`,children:r.map((e,t)=>(0,J.jsx)(hb,{it:e,index:t,onChange:(e,n)=>a(t,e,n),onRemove:()=>i(r.filter((e,n)=>n!==t))},t))})]})]})}function hb({it:e,index:t,onChange:n,onRemove:r}){let{t:i}=K(),{player:a}=E_(),o=D_().scene,s=Bc(o),c=Object.keys(o.timeline?.markers??{}),l=e.on,u=(t,r,i)=>n({...e,do:e.do.map((e,n)=>n===t?r:e)},i);return(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-ink-0/40`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b border-line/60 px-2 py-1.5`,children:[(0,J.jsx)(`span`,{className:`text-2xs font-semibold uppercase tracking-wide text-fg-faint`,children:i(`interactions.when`)}),(0,J.jsx)(v_,{value:l,options:so.map(e=>({value:e,label:i(`interactions.on.${e}`)})),onChange:t=>n(db(e,t,o)),className:`w-[118px] flex-none`,ariaLabel:i(`interactions.when`)}),ab.includes(l)&&(0,J.jsx)(v_,{value:e.target??``,placeholder:i(`interactions.anywhere`),options:s,onChange:t=>n({...e,target:t||void 0}),className:`w-[130px] flex-none`,ariaLabel:i(`interactions.target`)}),l===`key`&&(0,J.jsx)(__,{value:e.key??``,placeholder:`Space, KeyE, ArrowRight`,onCommit:t=>n({...e,key:t.trim()}),mono:!0,className:`w-[130px] flex-none`,ariaLabel:i(`interactions.key`)}),l===`event`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(__,{value:e.event??``,placeholder:i(`interactions.eventName`),onCommit:t=>n({...e,event:t.trim()}),mono:!0,className:`w-[110px] flex-none`,ariaLabel:i(`interactions.eventName`)}),c.length>0&&(0,J.jsx)(v_,{value:``,placeholder:i(`interactions.marker`),options:c,onChange:t=>t&&n({...e,event:t}),className:`w-[90px] flex-none`,ariaLabel:i(`interactions.marker`)})]}),l===`scroll`&&(0,J.jsx)(`div`,{className:`flex w-[150px] items-center`,children:(0,J.jsx)(Gv,{value:e.at??.5,min:0,max:1,onChange:(r,i)=>n({...e,at:r},i?void 0:`ix:${t}:at`),ariaLabel:i(`interactions.at`)})}),(0,J.jsxs)(`label`,{className:`ml-auto flex items-center gap-1 text-2xs text-fg-muted`,title:i(`interactions.onceHint`),children:[i(`interactions.once`),(0,J.jsx)(y_,{checked:!!e.once,onChange:t=>n({...e,once:t||void 0}),ariaLabel:i(`interactions.once`)})]}),(0,J.jsxs)(g_,{size:`xs`,variant:`ghost`,title:i(`interactions.testHint`),onClick:()=>a.player?.trigger?.(l,l===`key`?e.key:l===`event`?e.event:e.target),children:[(0,J.jsx)(bi,{size:11}),` `,i(`interactions.test`)]}),(0,J.jsx)(Z,{label:i(`interactions.remove`),className:`h-6 w-6`,onClick:r,children:(0,J.jsx)(vi,{size:12})})]}),(0,J.jsxs)(`div`,{className:`space-y-1 p-2`,children:[e.do.map((r,i)=>(0,J.jsx)(gb,{action:r,on:l,index:t,j:i,onChange:(e,t)=>u(i,e,t),onRemove:e.do.length>1?()=>n({...e,do:e.do.filter((e,t)=>t!==i)}):void 0},i)),(0,J.jsxs)(g_,{size:`xs`,variant:`ghost`,onClick:()=>n({...e,do:[...e.do,lb(`emit`,o)]}),children:[(0,J.jsx)(Kn,{size:11}),` `,i(`interactions.addAction`)]})]})]})}function gb({action:e,on:t,index:n,j:r,onChange:i,onRemove:a}){let{t:o}=K(),s=D_().scene,c=ib(e),l=sb(s),u=Object.keys(s.timeline?.markers??{}),d=fb(e,t),f=`ix:${n}:${r}`;return(0,J.jsxs)(`div`,{className:q(`rounded-md border px-1.5 py-1`,d?`border-danger/50 bg-danger/5`:`border-line/70`),children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`w-5 text-center text-2xs text-fg-faint`,children:r===0?`→`:`+`}),(0,J.jsx)(v_,{value:c??``,options:co.map(e=>({value:e,label:o(`interactions.do.${e}`)})),onChange:e=>i(lb(e,s)),className:`w-[128px] flex-none`,ariaLabel:o(`interactions.action`)}),`play`in e&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v_,{value:e.play,options:l,onChange:t=>i({...e,play:t}),className:`w-[120px] flex-none`,ariaLabel:o(`interactions.segment`)}),(0,J.jsxs)(`label`,{className:`flex items-center gap-1 text-2xs text-fg-muted`,children:[o(`interactions.reverse`),(0,J.jsx)(y_,{checked:!!e.reverse,onChange:t=>i({play:e.play,...t?{reverse:!0}:{}}),ariaLabel:o(`interactions.reverse`)})]})]}),`toggle`in e&&(0,J.jsx)(v_,{value:e.toggle,options:l,onChange:e=>i({toggle:e}),className:`w-[120px] flex-none`,ariaLabel:o(`interactions.segment`)}),`seek`in e&&(0,J.jsxs)(J.Fragment,{children:[typeof e.seek==`number`?(0,J.jsx)(Hv,{value:e.seek,min:0,step:.05,suffix:`s`,className:`w-[80px] flex-none`,onChange:e=>i({seek:e}),ariaLabel:o(`interactions.seek`)}):(0,J.jsx)(v_,{value:e.seek,options:u.includes(e.seek)?u:[e.seek,...u],onChange:e=>i({seek:e}),className:`w-[110px] flex-none`,ariaLabel:o(`interactions.seek`)}),u.length>0&&(0,J.jsx)(g_,{size:`xs`,variant:`ghost`,onClick:()=>i({seek:typeof e.seek==`number`?u[0]:0}),children:typeof e.seek==`number`?o(`interactions.useMarker`):o(`interactions.useSeconds`)})]}),`emit`in e&&(0,J.jsx)(__,{value:e.emit,onCommit:t=>i({...e,emit:t.trim()}),mono:!0,className:`w-[140px] flex-none`,ariaLabel:o(`interactions.eventName`)}),`openUrl`in e&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_b,{value:e.openUrl,onCommit:t=>i({...e,openUrl:t})}),(0,J.jsxs)(`label`,{className:`flex items-center gap-1 text-2xs text-fg-muted`,children:[o(`interactions.newTab`),(0,J.jsx)(y_,{checked:e.newTab!==!1&&e.newTab!==void 0,onChange:t=>i({openUrl:e.openUrl,...t?{newTab:!0}:{}}),ariaLabel:o(`interactions.newTab`)})]})]}),`playClip`in e&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v_,{value:e.target,placeholder:`—`,options:cb(s),onChange:t=>i({...e,target:t}),className:`w-[110px] flex-none`,ariaLabel:o(`interactions.model`)}),(0,J.jsx)(__,{value:String(e.playClip),onCommit:t=>i({...e,playClip:/^\d+$/.test(t.trim())?Number(t.trim()):t.trim()}),mono:!0,className:`w-[90px] flex-none`,ariaLabel:o(`interactions.clip`),placeholder:`clip`}),(0,J.jsxs)(`label`,{className:`flex items-center gap-1 text-2xs text-fg-muted`,children:[o(`timeline.loop`),(0,J.jsx)(y_,{checked:e.loop!==!1,onChange:t=>i({...e,loop:t?void 0:!1}),ariaLabel:o(`timeline.loop`)})]})]}),a&&(0,J.jsx)(Z,{label:o(`interactions.removeAction`),className:`ml-auto h-5 w-5`,onClick:a,children:(0,J.jsx)(vi,{size:11})})]}),`set`in e&&(0,J.jsx)(vb,{action:e,onChange:i,coalesce:f}),`emit`in e&&(0,J.jsxs)(`div`,{className:`mt-1 flex items-start gap-1 pl-6`,children:[(0,J.jsx)(`span`,{className:`w-14 pt-1 text-2xs text-fg-faint`,children:o(`interactions.payload`)}),(0,J.jsx)($y,{value:e.payload??null,rows:1,onCommit:t=>i(t===null?{emit:e.emit}:{emit:e.emit,payload:t})})]}),d&&(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 pl-6 text-2xs text-danger`,children:[(0,J.jsx)(Qr,{size:10}),` `,o(d===`url`?`interactions.badUrl`:`interactions.needsGesture`)]})]})}function _b({value:e,onCommit:t}){let{t:n}=K(),[r,i]=(0,C.useState)(e),[a,o]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{i(e),o(!1)},[e]),(0,J.jsxs)(`div`,{className:`flex min-w-[160px] flex-1 flex-col`,children:[(0,J.jsx)(`input`,{value:r,spellCheck:!1,"aria-label":`URL`,"aria-invalid":a,placeholder:n(`ui.urlPlaceholder`),onChange:e=>i(e.target.value),onBlur:()=>{let n=r.trim();if(n===e)return o(!1);if(!jo(n))return o(!0);o(!1),t(n)},onKeyDown:t=>{t.key===`Enter`&&t.target.blur(),t.key===`Escape`&&i(e)},className:q(`field font-mono text-xs`,a&&`!border-danger/70`)}),a&&(0,J.jsx)(`span`,{className:`mt-0.5 text-2xs text-danger`,children:n(`interactions.badUrl`)})]})}function vb({action:e,onChange:t,coalesce:n}){let{t:r}=K(),i=D_().scene,a=`set-paths-${n}`,o=e.set.value;return(0,J.jsxs)(`div`,{className:`mt-1 space-y-1 pl-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`w-14 text-2xs text-fg-faint`,children:r(`interactions.path`)}),(0,J.jsx)(`input`,{list:a,defaultValue:e.set.path,onBlur:n=>n.target.value.trim()!==e.set.path&&t({...e,set:{...e.set,path:n.target.value.trim()}}),onKeyDown:e=>e.key===`Enter`&&e.target.blur(),spellCheck:!1,className:`field font-mono text-xs`,"aria-label":r(`interactions.path`)},e.set.path),(0,J.jsx)(`datalist`,{id:a,children:pb(i).map(e=>(0,J.jsx)(`option`,{value:e},e))})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`w-14 text-2xs text-fg-faint`,children:r(`interactions.value`)}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)($y,{value:o,rows:1,onCommit:n=>t({...e,set:{...e.set,value:n}})})})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`w-14 text-2xs text-fg-faint`,children:r(`interactions.tween`)}),(0,J.jsx)(Hv,{value:e.duration??0,min:0,step:.05,suffix:`s`,className:`w-[72px] flex-none`,placeholder:e.duration===void 0,onChange:(r,i)=>t({...e,duration:r||void 0},i?void 0:n),ariaLabel:r(`interactions.tween`)}),(0,J.jsx)(`div`,{className:`w-[150px]`,children:(0,J.jsx)(Zv,{value:e.ease,placeholder:`linear`,onChange:n=>t({...e,ease:n})})})]})]})}function yb(){let{t:e}=K(),{store:t}=E_(),n=D_(),r=(0,C.useMemo)(()=>JSON.stringify(n.scene,null,2),[n.scene]),[i,a]=(0,C.useState)(r),[o,s]=(0,C.useState)(!1),[c,l]=(0,C.useState)({issues:n.issues,scene:n.scene}),u=(0,C.useRef)(null);(0,C.useEffect)(()=>{o||(a(r),l({issues:n.issues,scene:n.scene}))},[r,o,n.issues,n.scene]);let d=e=>{a(e),s(e!==r),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{try{let t=JSON.parse(e);l({scene:t,issues:Ps(t)})}catch(e){l({error:e.message,issues:[]})}},250)},f=c.issues.filter(e=>e.severity===`error`).length,p=i.split(`
|
|
477
|
+
`).length;return(0,J.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,J.jsxs)(`div`,{className:`relative flex min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{"aria-hidden":!0,className:`w-10 shrink-0 select-none overflow-hidden border-r border-line bg-ink-0/40 pt-2 text-right font-mono text-2xs leading-[18px] text-fg-faint`,children:Array.from({length:Math.min(p,5e3)},(e,t)=>(0,J.jsx)(`div`,{className:`pr-2`,children:t+1},t))}),(0,J.jsx)(`textarea`,{value:i,spellCheck:!1,wrap:`off`,"aria-label":`scene.json`,onChange:e=>d(e.target.value),onScroll:e=>{let t=e.currentTarget.previousElementSibling;t.scrollTop=e.currentTarget.scrollTop},onKeyDown:e=>{if(e.key===`Tab`){e.preventDefault();let t=e.currentTarget,{selectionStart:n,selectionEnd:r}=t,a=i.slice(0,n)+` `+i.slice(r);d(a),requestAnimationFrame(()=>t.setSelectionRange(n+2,n+2))}},className:`min-w-0 flex-1 resize-none overflow-auto whitespace-pre bg-transparent p-2 font-mono text-xs leading-[18px] text-fg outline-none`})]}),(0,J.jsxs)(`div`,{className:`flex w-[340px] shrink-0 flex-col border-l border-line`,children:[(0,J.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-1.5 border-b border-line px-2`,children:[(0,J.jsx)(`span`,{className:q(`text-xs`,c.error||f?`text-danger`:`text-agent`),children:c.error?e(`json.invalidJson`):f?e(`json.errors`,{n:f}):e(`json.valid`)}),(0,J.jsxs)(`div`,{className:`ml-auto flex gap-1`,children:[(0,J.jsx)(g_,{size:`xs`,variant:`ghost`,disabled:!!c.error,title:e(`json.format`),onClick:()=>c.scene&&d(JSON.stringify(c.scene,null,2)),children:(0,J.jsx)(ui,{size:11})}),(0,J.jsxs)(g_,{size:`xs`,variant:`ghost`,disabled:!o,onClick:()=>(s(!1),a(r)),children:[(0,J.jsx)(nr,{size:11}),` `,e(`json.revert`)]}),(0,J.jsxs)(g_,{size:`xs`,variant:`primary`,disabled:!o||!!c.error||f>0,title:f?e(`json.fixFirst`):void 0,onClick:()=>{c.scene&&(t.replace(c.scene),s(!1))},children:[(0,J.jsx)(ve,{size:11}),` `,e(`json.apply`)]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:c.error?(0,J.jsx)(`div`,{className:`p-3 font-mono text-xs text-danger`,children:c.error}):c.issues.length?(0,J.jsx)(Gy,{issues:c.issues,dense:!0}):(0,J.jsx)(`div`,{className:`p-3 text-xs text-fg-faint`,children:e(`json.noIssues`)})}),o&&(0,J.jsx)(`div`,{className:`border-t border-line px-3 py-1.5 text-2xs text-key`,children:e(`json.unapplied`)})]})]})}var bb=[{id:`timeline`,label:`bottom.timeline`,icon:mn,key:`T`},{id:`interactions`,label:`bottom.interactions`,icon:En,key:``},{id:`json`,label:`bottom.json`,icon:ue,key:`J`},{id:`check`,label:`bottom.check`,icon:gr,key:``}];function xb(){let{t:e}=K(),{ui:t}=E_(),n=D_(),r=O_(e=>e.bottom),i=O_(e=>e.bottomHeight),a=O_(e=>e.check),o=(0,C.useRef)(null),s=n.scene?.timeline?.tracks.length??0,c=n.issues.filter(e=>e.severity===`error`).length;return(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-line bg-ink-1`,style:{height:r?i:34},children:[r&&(0,J.jsx)(`div`,{className:`h-1 shrink-0 cursor-ns-resize hover:bg-accent/40`,onPointerDown:e=>{e.target.setPointerCapture(e.pointerId),o.current={y:e.clientY,h:i}},onPointerMove:e=>{o.current&&t.set({bottomHeight:Math.max(140,Math.min(window.innerHeight*.7,o.current.h-(e.clientY-o.current.y)))})},onPointerUp:()=>o.current=null}),(0,J.jsxs)(`div`,{className:`flex h-[33px] shrink-0 items-center gap-0.5 border-b border-line px-1.5`,role:`tablist`,children:[bb.map(i=>{let o=i.icon,l=i.id===`timeline`?s:i.id===`interactions`?n.scene?.interactions?.length??0:i.id===`json`?c:a?(a.counts?.errors??0)+(a.counts?.warnings??0):0;return(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r===i.id,title:i.key?`${e(i.label)} (${i.key})`:e(i.label),onClick:()=>t.set({bottom:r===i.id?null:i.id}),className:q(`flex h-6 items-center gap-1.5 rounded-md px-2 text-xs`,r===i.id?`bg-ink-3 text-fg`:`text-fg-muted hover:text-fg`),children:[(0,J.jsx)(o,{size:12}),e(i.label),l>0&&(0,J.jsx)(`span`,{className:q(`rounded px-1 text-2xs`,i.id===`json`?`bg-danger/20 text-danger`:i.id===`check`?`bg-warn/20 text-warn`:`bg-ink-4 text-fg-muted`),children:l})]},i.id)}),(0,J.jsx)(`div`,{className:`ml-auto`,children:(0,J.jsx)(Z,{label:e(r?`bottom.collapse`:`bottom.expand`),onClick:()=>t.set({bottom:r?null:`timeline`}),className:`h-6 w-6`,children:r?(0,J.jsx)(be,{size:13}):(0,J.jsx)(Te,{size:13})})})]}),r&&(0,J.jsxs)(`div`,{className:`min-h-0 flex-1`,children:[r===`timeline`&&(0,J.jsx)(Ry,{}),r===`interactions`&&(0,J.jsx)(mb,{}),r===`json`&&(0,J.jsx)(yb,{}),r===`check`&&(0,J.jsx)(qy,{})]})]})}function Sb({title:e,onClose:t,children:n,footer:r,width:i=560}){let a=(0,C.useRef)(null);return(0,C.useEffect)(()=>{let e=document.activeElement;a.current?.focus();let n=e=>e.key===`Escape`&&t();return window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`keydown`,n),e?.focus?.()}},[t]),(0,J.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4`,onMouseDown:e=>e.target===e.currentTarget&&t(),children:(0,J.jsxs)(`div`,{ref:a,tabIndex:-1,role:`dialog`,"aria-modal":`true`,className:`toast-in flex max-h-[86vh] w-full flex-col overflow-hidden rounded-xl border border-line bg-ink-1 shadow-2xl shadow-black/50 outline-none focus-visible:outline-none`,style:{maxWidth:i},children:[(0,J.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-line pl-4 pr-2`,children:[(0,J.jsx)(`div`,{className:`text-base font-semibold`,children:e}),(0,J.jsx)(Z,{label:xh(`ui.close`),onClick:t,children:(0,J.jsx)(vi,{size:15})})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:n}),r&&(0,J.jsx)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-line px-4 py-2.5`,children:r})]})})}function Cb(e,t,n=`application/octet-stream`){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),setTimeout(()=>URL.revokeObjectURL(i),2e3)}function wb(e){let t=e.split(`,`)[1]??``,n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}async function Tb(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}var Eb=(e,t,n)=>e<t?t:e>n?n:e;function Db(e,t,n){if(!(t>0))return 0;if(!n)return Math.min(Math.max(e,0),t);if(n===`pingpong`){let n=e%(2*t);return n>t?2*t-n:n}return e%t}function Ob(e,t,n){return typeof e==`number`&&Number.isFinite(e)?e:typeof e==`string`&&t&&typeof t[e]==`number`?t[e]:n}function kb(e,t){let n=Math.max(e.duration||0,.001);if(t===`timeline`)return{from:0,to:n,loop:e.loop,speed:1};let r=e.segments?.[t];if(!r)return null;let i=Array.isArray(r)?{from:r[0],to:r[1]}:r;return{from:Eb(Ob(i.from,e.markers,0),0,n),to:Eb(Ob(i.to,e.markers,n),0,n),loop:i.loop??!1,speed:typeof i.speed==`number`&&i.speed>0?i.speed:1}}function Ab(e,t){let n=Math.abs(e.to-e.from),r=e.to>=e.from?1:-1;return e.from+r*(n<=0?0:Db(Math.max(0,t*e.speed),n,e.loop))}var jb=e=>e&&typeof e.speed==`number`&&e.speed>0?e.speed:1;function Mb(e,t,n){let r=t?.timeline;return!r||!(r.duration>0)?e:Eb(n?Ab(n.range,Math.max(0,e-n.start)):Ab({from:0,to:r.duration,loop:r.loop,speed:jb(r)},e),0,r.duration)}function Nb(e,t){let n=t?.timeline;return!n||!(n.duration>0)?Math.max(0,e):Eb(e,0,n.duration)/jb(n)}function Pb(e){let t=e.timeline,n=!t||(t.trigger===void 0||t.trigger===`load`||t.trigger===`visible`)&&t.autoplay===void 0,r=!!e.scripts?.length;if(n&&!r)return e;let i=e;if(!n&&t){let{autoplay:e,...n}=t;i={...i,timeline:{...n,trigger:`load`}}}if(r){let{scripts:e,...t}=i;i=t}return i}var Fb=null;function Ib(){return Fb||=Gl(()=>import(`./runtime-rd9RW3WH.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),Fb}var Lb=class{player=null;sceneEditor=null;issues=[];playing=!1;latest=null;updating=!1;raf=0;timeListeners=new Set;stateListeners=new Set;scene=null;disposed=!1;interact=!1;segment=null;ready=!1;async mount(e,t,n,r){this.dispose(),this.disposed=!1,this.issues=[],this.ready=!1,this.scene=t,this.segment=null;let i=await Ib();if(!this.disposed){this.player=i.mountScene(e,this.view(t),{...n,editor:r.editor,reducedMotion:!1,onError:e=>{this.issues=[...this.issues.slice(-30),e],this.notify()}});try{await this.player.ready}catch{}if(this.ready=!0,this.playing)this.player?.play();else{this.player?.pause();let e=t.target?.posterTime;e&&e>0&&await this.player?.seek(e).catch(()=>void 0)}this.loop(),this.notify()}}loop=()=>{cancelAnimationFrame(this.raf);let e=()=>{if(!this.player)return;let t=this.player.time();t<0&&!this.updating&&this.player.seek(0);let n=Mb(Math.max(0,t),this.scene,this.segment);this.timeListeners.forEach(e=>e(n)),this.raf=requestAnimationFrame(e)};this.raf=requestAnimationFrame(e)};view(e){return this.interact?e:Pb(e)}setInteract(e){this.interact!==e&&(this.interact=e,this.scene&&this.update(this.scene),e?this.play():this.pause())}update(e){this.segment=null,this.scene=e,this.latest=e,!this.updating&&this.player&&this.drain()}async drain(){for(this.updating=!0;this.latest&&this.player;){let e=this.latest;this.latest=null;let t=this.player.time();try{await this.player.update(this.view(e)),this.playing||await this.player.seek(t)}catch{}}this.updating=!1}play(){this.playing=!0,this.player?.play(),this.notify()}pause(){this.playing=!1,this.player?.pause(),this.notify()}toggle(){this.playing?this.pause():this.play()}async seek(e){this.playing&&this.pause(),this.segment&&(this.segment=null,await this.player?.seek(0));let t=Nb(e,this.scene);await this.player?.seek(t),this.timeListeners.forEach(e=>e(Mb(t,this.scene)))}playSegment(e,t={}){let n=this.scene?.timeline,r=n?kb(n,e):null;return!r||!this.player?.playSegment?!1:(this.player.playSegment(e,t),this.segment={name:e,range:t.reverse?{...r,from:r.to,to:r.from}:r,start:this.player.time()},this.play(),!0)}stats(){try{return this.player?.stats()??null}catch{return null}}pick(e,t){try{return this.player?.pick?.(e,t)??null}catch{return null}}snapshot(){try{return this.player?.snapshot(`image/png`)??null}catch{return null}}onTime(e){return this.timeListeners.add(e),()=>this.timeListeners.delete(e)}onState(e){return this.stateListeners.add(e),()=>this.stateListeners.delete(e)}notify(){this.stateListeners.forEach(e=>e())}dispose(){this.disposed=!0,cancelAnimationFrame(this.raf),this.sceneEditor?.dispose(),this.sceneEditor=null,this.player?.dispose(),this.player=null}};async function Rb(e,t,n,r,i){let a=await Ib(),o=document.createElement(`div`);o.style.cssText=`position:fixed;left:-10000px;top:0;width:${r}px;height:${i}px;`,document.body.appendChild(o);let s=a.mountScene(o,e,{...t,deterministic:!0,pixelRatio:1});try{return await s.ready,await s.seek(n),s.snapshot(`image/png`)}finally{s.dispose(),o.remove()}}var zb={mp4:30,webm:30,gif:15,webp:20,poster:0},Bb={mp4:`mp4`,webm:`webm`,gif:`gif`,webp:`webp`,poster:`webp`};function Vb(e=`mp4`){return{kind:e,quality:`standard`,transparent:!1,image:`webp`}}function Hb(e,t){let n=e.width&&e.height?`${Math.round(e.width)}x${Math.round(e.height)}`:void 0,r={out:t,...e.quality===`standard`?{}:{quality:e.quality},...n?{size:n}:{}};if(e.kind===`poster`)return{format:`poster`,image:e.image,...e.time===void 0?{}:{time:e.time},...e.transparent?{transparent:!0}:{},...r};let i={...e.fps?{fps:e.fps}:{},...e.duration?{duration:e.duration}:{}};return e.kind===`mp4`||e.kind===`webm`?{format:`video`,codec:e.kind,...i,...r}:{format:e.kind===`gif`?`gif`:`animated-webp`,...i,...e.transparent?{transparent:!0}:{},...r}}function Ub({label:e,children:t,hint:n}){return(0,J.jsxs)(`label`,{className:`flex flex-col gap-1`,title:n,children:[(0,J.jsx)(`span`,{className:`text-2xs font-medium text-fg-muted`,children:e}),(0,J.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,children:t})]})}function Wb({value:e,kinds:t,onChange:n}){let{t:r}=K();return(0,J.jsx)(`div`,{className:`flex gap-0.5 rounded-md bg-ink-2 p-0.5`,role:`radiogroup`,children:t.map(t=>(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===t,onClick:()=>n(t),className:q(`h-7 flex-1 rounded px-2 text-xs font-medium`,e===t?`bg-ink-4 text-fg`:`text-fg-muted hover:text-fg`),children:r(`media.kind.${t}`)},t))})}function Gb({value:e,onChange:t,scene:n}){let{t:r}=K(),i=n=>t({...e,...n}),a=e.kind!==`poster`,o=e.kind===`gif`||e.kind===`webp`||e.kind===`poster`,s=n.timeline?.duration&&n.timeline.duration>0?n.timeline.duration:5;return(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-2.5 sm:grid-cols-4`,children:[(0,J.jsx)(Ub,{label:r(`media.quality`),hint:r(`media.qualityHint`),children:(0,J.jsx)(v_,{value:e.quality,options:[`draft`,`standard`,`high`,`ultra`].map(e=>({value:e,label:r(`media.q.${e}`)})),onChange:e=>i({quality:e}),ariaLabel:r(`media.quality`)})}),a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ub,{label:r(`media.fps`),children:(0,J.jsx)(Hv,{value:e.fps??zb[e.kind],placeholder:e.fps===void 0,integer:!0,min:1,max:60,onChange:t=>i({fps:t===zb[e.kind]?void 0:t}),ariaLabel:r(`media.fps`)})}),(0,J.jsx)(Ub,{label:r(`media.duration`),children:(0,J.jsx)(Hv,{value:e.duration??s,placeholder:e.duration===void 0,min:.1,max:120,step:.1,suffix:`s`,onChange:e=>i({duration:e===s?void 0:e}),ariaLabel:r(`media.duration`)})})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ub,{label:r(`media.time`),children:(0,J.jsx)(Hv,{value:e.time??n.target.posterTime??0,placeholder:e.time===void 0,min:0,step:.05,suffix:`s`,onChange:e=>i({time:e}),ariaLabel:r(`media.time`)})}),(0,J.jsx)(Ub,{label:r(`media.image`),children:(0,J.jsx)(v_,{value:e.image,options:[`webp`,`png`],onChange:e=>i({image:e}),ariaLabel:r(`media.image`)})})]}),(0,J.jsxs)(Ub,{label:r(`media.size`),hint:r(`media.sizeHint`),children:[(0,J.jsx)(Hv,{label:`W`,value:e.width??0,placeholder:!e.width,empty:!e.width,integer:!0,min:0,max:4096,onChange:e=>i({width:e||void 0}),ariaLabel:r(`media.width`)}),(0,J.jsx)(Hv,{label:`H`,value:e.height??0,placeholder:!e.height,empty:!e.height,integer:!0,min:0,max:4096,onChange:e=>i({height:e||void 0}),ariaLabel:r(`media.height`)})]}),o&&(0,J.jsx)(Ub,{label:r(`media.transparent`),hint:r(`media.transparentHint`),children:(0,J.jsx)(y_,{checked:e.transparent,onChange:e=>i({transparent:e}),ariaLabel:r(`media.transparent`)})})]})}var Kb=[{id:`embed`,icon:Ve,title:`export.embed`,body:`export.embedBody`},{id:`zip`,icon:ne,title:`export.zip`,body:`export.zipBody`},{id:`single-html`,icon:lt,title:`export.single`,body:`export.singleBody`},{id:`poster`,icon:Ut,title:`export.poster`,body:`export.posterBody`},{id:`video`,icon:ci,title:`export.video`,body:`export.videoBody`},{id:`gif`,icon:dt,title:`export.gif`,body:`export.gifBody`}];function qb({label:e,hint:t,children:n}){return(0,J.jsxs)(`div`,{className:`grid grid-cols-[120px_1fr] items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,title:t,children:e}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[n,t&&(0,J.jsx)(`span`,{className:`truncate text-2xs text-fg-faint`,children:t})]})]})}function Jb(){let{t:e}=K(),{ui:t,backend:n,store:r}=E_(),i=D_().scene,a=n.capabilities,[o,s]=(0,C.useState)(a.exportFormats[0]??`poster`),[c,l]=(0,C.useState)(i.id),[u,d]=(0,C.useState)(a.render),[f,p]=(0,C.useState)(a.render),[m,h]=(0,C.useState)(``),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(!0),[b,x]=(0,C.useState)(!1),[S,w]=(0,C.useState)(Vb(`mp4`)),[T,ee]=(0,C.useState)(!1),[E,te]=(0,C.useState)(null),[D,O]=(0,C.useState)(null),[ne,re]=(0,C.useState)(null),[ie,ae]=(0,C.useState)(null),[oe,se]=(0,C.useState)(!1),ce=e=>a.exportFormats.includes(e),le=o===`embed`||o===`zip`,ue=le||o===`single-html`,de=o===`video`||o===`gif`||o===`poster`&&a.render,fe=async()=>{let e=Ui(i.target.aspect,1200),t=await Rb(i,await n.mountConfig(),i.target.posterTime??0,e.width,e.height),r=`renders/poster.png`;return await n.writeFile(r,wb(t)),ae({url:t,dataUrl:t,path:r}),r},pe=async()=>{if(!a.render)return fe();let e=(await n.call(`render_preview`,{frames:[i.target.posterTime??0],sheet:!1})).frames[0]?.path;return e&&ae({url:await n.fileUrl(e),path:e}),e},me=async()=>{ee(!0),te(null),O(null),re(null),ae(null);try{if(await r.flush(),o===`poster`&&!a.render)await fe();else if(de){let e=o===`gif`?{...S,kind:`gif`}:o===`poster`?{...S,kind:`poster`}:S.kind===`mp4`||S.kind===`webm`?S:{...S,kind:`mp4`},t=e.kind===`poster`?e.image:e.kind===`gif`?`gif`:e.kind,r=e.kind===`poster`?`dist/poster.${t}`:e.kind===`gif`?`dist/animation.gif`:`dist/video.${t}`,i=await n.call(`export`,Hb(e,r));re({url:await n.fileUrl(i.path),out:i})}else{let e=ue&&u?await pe():void 0,t=await n.call(`export`,{format:o,...c?{name:c}:{},...e?{poster:e}:{},...le&&m.trim()?{baseUrl:m.trim()}:{},...le&&g?{cacheBust:!0}:{},...le&&!v?{integrity:!1}:{},...b?{optimize:!0}:{},...le&&f&&a.render?{og:!0}:{}});O(t)}}catch(e){let t=e;te({message:t.message,issues:t.details?.issues})}finally{ee(!1)}},he=async e=>{await Tb(e)&&(se(!0),setTimeout(()=>se(!1),1500))};return(0,J.jsx)(Sb,{title:e(`export.title`),width:700,onClose:()=>t.set({dialog:null}),footer:(0,J.jsxs)(J.Fragment,{children:[n.mode===`local`&&D&&(0,J.jsxs)(g_,{variant:`ghost`,onClick:async()=>Cb(D.entry.split(`/`).pop(),await n.readFile(D.entry),`text/html`),children:[(0,J.jsx)($e,{size:13}),` `,e(`export.download`)]}),n.mode===`cli`&&D&&o===`zip`&&(0,J.jsxs)(g_,{variant:`ghost`,onClick:async()=>Cb(D.entry.split(`/`).pop(),await n.readFile(D.entry),`application/zip`),children:[(0,J.jsx)($e,{size:13}),` `,e(`export.download`)]}),ne&&(0,J.jsxs)(g_,{variant:`ghost`,onClick:async()=>Cb(ne.out.path.split(`/`).pop(),await n.readFile(ne.out.path),`application/octet-stream`),children:[(0,J.jsx)($e,{size:13}),` `,e(`export.download`)]}),ie?.dataUrl&&(0,J.jsxs)(g_,{variant:`ghost`,onClick:()=>Cb(`${i.id}-poster.png`,wb(ie.dataUrl),`image/png`),children:[(0,J.jsx)($e,{size:13}),` `,e(`export.downloadPoster`)]}),(0,J.jsxs)(g_,{variant:`primary`,onClick:()=>void me(),disabled:T||!ce(o),children:[T?(0,J.jsx)(gn,{size:13,className:`animate-spin`}):(0,J.jsx)(oi,{size:13}),` `,e(`export.run`)]})]}),children:(0,J.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,J.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,role:`radiogroup`,children:Kb.map(t=>{let n=t.icon,r=ce(t.id);return(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":o===t.id,disabled:!r,onClick:()=>{s(t.id),O(null),re(null),ae(null),te(null)},className:q(`flex gap-2.5 rounded-lg border p-3 text-left transition-colors`,o===t.id?`border-accent bg-accent/10`:`border-line hover:border-fg-faint`,!r&&`cursor-not-allowed opacity-45`),children:[(0,J.jsx)(n,{size:16,className:q(`shrink-0`,o===t.id?`text-accent`:`text-fg-muted`)}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:e(t.title)}),(0,J.jsx)(`div`,{className:`text-2xs leading-snug text-fg-muted`,children:e(r?t.body:`export.needsCli`)})]})]},t.id)})}),ue&&(0,J.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-line p-3`,children:[(0,J.jsx)(qb,{label:e(`export.name`),children:(0,J.jsx)(__,{value:c,onCommit:l,ariaLabel:e(`export.name`),className:`max-w-[220px]`})}),le&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(qb,{label:e(`export.baseUrl`),hint:e(`export.baseUrlHint`),children:(0,J.jsx)(__,{value:m,placeholder:`./`,onCommit:h,mono:!0,ariaLabel:e(`export.baseUrl`),className:`max-w-[220px]`})}),(0,J.jsx)(qb,{label:e(`export.cacheBust`),hint:e(`export.cacheBustHint`),children:(0,J.jsx)(y_,{checked:g,onChange:_,ariaLabel:e(`export.cacheBust`)})}),(0,J.jsx)(qb,{label:e(`export.integrity`),hint:e(`export.integrityHint`),children:(0,J.jsx)(y_,{checked:v,onChange:y,ariaLabel:e(`export.integrity`)})})]}),a.render&&(0,J.jsx)(qb,{label:e(`export.optimize`),hint:e(`export.optimizeHint`),children:(0,J.jsx)(y_,{checked:b,onChange:x,ariaLabel:e(`export.optimize`)})}),(0,J.jsx)(qb,{label:e(`export.withPoster`),hint:e(`export.withPosterHint`),children:(0,J.jsx)(y_,{checked:u,onChange:d,ariaLabel:e(`export.withPoster`)})}),le&&a.render&&(0,J.jsx)(qb,{label:e(`export.og`),hint:e(`export.ogHint`),children:(0,J.jsx)(y_,{checked:f,onChange:p,ariaLabel:e(`export.og`)})})]}),de&&(0,J.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-line p-3`,children:[o===`video`&&(0,J.jsx)(Wb,{value:S.kind===`webm`?`webm`:`mp4`,kinds:[`mp4`,`webm`],onChange:e=>w({...S,kind:e})}),(0,J.jsx)(Gb,{value:{...S,kind:o===`gif`?`gif`:o===`poster`?`poster`:S.kind===`webm`?`webm`:`mp4`},onChange:e=>w({...e,kind:o===`video`?e.kind:S.kind}),scene:i})]}),n.mode===`local`&&(0,J.jsx)(`p`,{className:`text-2xs text-fg-faint`,children:e(`export.localNote`)}),E&&(0,J.jsxs)(`div`,{className:`rounded-md bg-danger/10 text-xs text-danger`,children:[(0,J.jsx)(`div`,{className:`px-3 py-2`,children:E.message}),E.issues&&(0,J.jsx)(Gy,{issues:E.issues,dense:!0})]}),ie&&!D&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`img`,{src:ie.url,alt:e(`export.poster`),className:`block w-full rounded-md border border-line`}),ie.path&&(0,J.jsx)(`div`,{className:`mt-1 font-mono text-2xs text-fg-faint`,children:ie.path})]}),ne&&(0,J.jsxs)(`div`,{className:`space-y-1`,children:[ne.out.format===`video`?(0,J.jsx)(`video`,{src:ne.url,controls:!0,autoPlay:!0,loop:!0,muted:!0,className:`block w-full rounded-md border border-line`}):(0,J.jsx)(`img`,{src:ne.url,alt:ne.out.path,className:`block w-full rounded-md border border-line`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(ve,{size:13,className:`text-agent`}),(0,J.jsx)(`span`,{className:`font-mono text-2xs text-fg`,children:n.location&&n.mode===`cli`?`${n.location}/${ne.out.path}`:ne.out.path}),(0,J.jsxs)(`span`,{className:`text-2xs text-fg-faint`,children:[ne.out.size.width,`×`,ne.out.size.height,` · `,ne.out.kb,` KB`]})]})]}),D&&(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(ve,{size:13,className:`text-agent`}),(0,J.jsx)(`span`,{children:e(`export.done`,{files:D.files,kb:Math.round(D.totalKb)})}),D.optimized&&(0,J.jsx)(`span`,{className:`text-2xs text-fg-faint`,children:e(`export.optimized`,{before:D.optimized.beforeKb,after:D.optimized.afterKb})}),D.ogImage&&(0,J.jsx)(`span`,{className:`rounded bg-ink-3 px-1.5 text-2xs text-fg-muted`,children:`og-image.png`})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[100px_1fr] gap-2 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-fg-muted`,children:e(`export.output`)}),(0,J.jsx)(`span`,{className:`break-all font-mono text-fg`,children:n.location&&n.mode===`cli`?`${n.location}/${D.entry}`:D.entry})]}),o!==`zip`&&(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-md border border-line bg-ink-0 p-3 pr-20 font-mono text-2xs leading-relaxed text-fg`,children:D.snippet}),(0,J.jsxs)(g_,{size:`xs`,variant:`subtle`,className:`absolute right-2 top-2`,onClick:()=>void he(D.snippet),children:[oe?(0,J.jsx)(ve,{size:11}):(0,J.jsx)(Ne,{size:11}),` `,e(oe?`export.copied`:`export.copy`)]})]}),D.hint&&(0,J.jsx)(`div`,{className:`text-2xs text-warn`,children:D.hint}),!!D.credits?.length&&(0,J.jsx)(`div`,{className:`text-2xs text-fg-faint`,children:D.credits.map(e=>e.attribution??`${e.path} (${e.license})`).join(` · `)}),!!D.issues?.length&&(0,J.jsx)(`div`,{className:`rounded-md border border-line`,children:(0,J.jsx)(Gy,{issues:D.issues,dense:!0})})]})]})})}function Yb(){let{t:e}=K(),{ui:t,backend:n,store:r,player:i}=E_(),a=D_().scene,[o,s]=(0,C.useState)(`frames`),[c,l]=(0,C.useState)(4),[u,d]=(0,C.useState)(Vb(`mp4`)),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[v,y]=(0,C.useState)(null),b=n.capabilities.render,x=async()=>{p(!0),h(null);try{if(o===`media`){await r.flush();let e=new Date().toISOString().replace(/[-:]/g,``).replace(/\..+/,``).replace(`T`,`-`),t=await n.call(`export`,Hb(u,`renders/${a.id}-${e}.${Bb[u.kind]}`));y({url:await n.fileUrl(t.path),out:t})}else if(b){await r.flush();let e=await n.call(`render_preview`,{count:c,sheet:!0}),t=e.sheet??e.frames[0]?.path;_({img:t?await n.fileUrl(t):``,out:e,path:t})}else{let e=Ui(a.target.aspect,1200),t=await Rb(a,await n.mountConfig(),i.player?.time()??0,e.width,e.height);_({img:t})}}catch(e){h(e.message)}finally{p(!1)}};return(0,J.jsx)(Sb,{title:e(`render.title`),width:880,onClose:()=>t.set({dialog:null}),footer:(0,J.jsxs)(J.Fragment,{children:[o===`frames`&&b&&(0,J.jsxs)(`label`,{className:`mr-auto flex items-center gap-2 text-xs text-fg-muted`,children:[e(`render.frames`),(0,J.jsx)(`select`,{value:c,onChange:e=>l(Number(e.target.value)),className:`field w-16`,children:[1,2,4,6,8,12].map(e=>(0,J.jsx)(`option`,{children:e},e))})]}),o===`media`&&v&&(0,J.jsxs)(g_,{variant:`ghost`,className:`mr-auto`,onClick:async()=>Cb(v.out.path.split(`/`).pop(),await n.readFile(v.out.path),v.out.format===`video`?`video/${v.out.path.endsWith(`.mp4`)?`mp4`:`webm`}`:`image/${v.out.path.split(`.`).pop()}`),children:[(0,J.jsx)($e,{size:13}),` `,e(`export.download`)]}),g&&!b&&o===`frames`&&(0,J.jsxs)(g_,{variant:`ghost`,onClick:()=>Cb(`${a.id}.png`,wb(g.img),`image/png`),children:[(0,J.jsx)($e,{size:13}),` `,e(`render.download`)]}),(0,J.jsxs)(g_,{variant:`primary`,onClick:()=>void x(),disabled:f||o===`media`&&!b,children:[f?(0,J.jsx)(gn,{size:13,className:`animate-spin`}):o===`media`?(0,J.jsx)(dt,{size:13}):(0,J.jsx)(me,{size:13}),` `,f?e(`render.rendering`):o===`media`?e(`render.renderMedia`,{kind:e(`media.kind.${u.kind}`)}):e(g?`render.again`:`render.run`)]})]}),children:(0,J.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,J.jsx)(`div`,{className:`flex gap-1 border-b border-line`,role:`tablist`,children:[{id:`frames`,icon:Gt,label:e(`render.tabFrames`)},{id:`media`,icon:dt,label:e(`render.tabMedia`)}].map(e=>(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===e.id,onClick:()=>s(e.id),className:q(`-mb-px flex items-center gap-1.5 border-b-2 px-3 pb-2 text-sm`,o===e.id?`border-accent text-fg`:`border-transparent text-fg-muted hover:text-fg`),children:[(0,J.jsx)(e.icon,{size:13}),` `,e.label]},e.id))}),m&&(0,J.jsx)(`div`,{className:`rounded-md bg-danger/10 px-3 py-2 text-xs text-danger`,children:m}),o===`frames`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e(b?`render.intro`:`render.localIntro`)}),g?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-line bg-black`,children:g.img&&(0,J.jsx)(`img`,{src:g.img,alt:e(`render.sheetAlt`),className:`block w-full`})}),g.path&&(0,J.jsx)(`div`,{className:`font-mono text-2xs text-fg-faint`,children:g.path}),g.out?.stats&&(0,J.jsx)(`div`,{className:`text-xs text-fg-muted`,children:e(`render.stats`,{tris:g.out.stats.triangles.toLocaleString(),calls:g.out.stats.drawCalls})}),!!g.out?.issues?.length&&(0,J.jsx)(`div`,{className:`rounded-md border border-line`,children:(0,J.jsx)(Gy,{issues:g.out.issues,dense:!0})}),!!g.out?.consoleErrors?.length&&(0,J.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md bg-ink-0 p-2 text-2xs text-danger`,children:g.out.consoleErrors.join(`
|
|
478
|
+
`)})]}):(0,J.jsx)(`div`,{className:`flex aspect-[3/1] items-center justify-center rounded-lg border border-dashed border-line text-xs text-fg-faint`,children:e(f?`render.rendering`:`render.placeholder`)})]}),o===`media`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e(b?`render.mediaIntro`:`render.mediaNeedsCli`)}),(0,J.jsx)(Wb,{value:u.kind,kinds:[`mp4`,`webm`,`gif`,`webp`],onChange:e=>d({...u,kind:e,fps:void 0,transparent:e===`gif`||e===`webp`?u.transparent:!1})}),(0,J.jsx)(`div`,{className:`text-2xs text-fg-faint`,children:e(`media.about.${u.kind}`)}),(0,J.jsx)(Gb,{value:u,onChange:d,scene:a}),v?(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-line`,style:{background:`repeating-conic-gradient(#2a2e38 0 25%, #1f222a 0 50%) 0 0 / 16px 16px`},children:v.out.format===`video`?(0,J.jsx)(`video`,{src:v.url,controls:!0,autoPlay:!0,loop:!0,muted:!0,className:`block w-full`}):(0,J.jsx)(`img`,{src:v.url,alt:v.out.path,className:`block w-full`})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 font-mono text-2xs text-fg-faint`,children:[(0,J.jsx)(`span`,{children:v.out.path}),(0,J.jsxs)(`span`,{children:[v.out.size.width,`×`,v.out.size.height]}),v.out.frames!==void 0&&(0,J.jsxs)(`span`,{children:[v.out.frames,` `,e(`render.framesUnit`),` @ `,v.out.fps,` fps · `,v.out.duration,`s`]}),v.out.codec&&(0,J.jsx)(`span`,{children:v.out.codec}),(0,J.jsxs)(`span`,{children:[v.out.kb,` KB`]})]})]}):(0,J.jsx)(`div`,{className:`flex aspect-[3/1] items-center justify-center rounded-lg border border-dashed border-line text-xs text-fg-faint`,children:e(f?`render.renderingMedia`:`render.mediaPlaceholder`)})]})]})})}var Xb=typeof navigator<`u`&&/Mac/.test(navigator.platform)?`⌘`:`Ctrl`,Zb=[[[`Q`],`keys.selectTool`],[[`W`],`keys.move`],[[`E`],`keys.rotate`],[[`R`],`keys.scale`],[[`X`],`keys.space`],[[`Shift`,`drag`],`keys.snapHold`],[[`F`],`keys.frame`],[[`C`],`keys.cameraView`],[[`G`],`keys.grid`],[[`drag`,`right-drag`],`keys.orbit`],[[`wheel`],`keys.zoom`]],Qb=[[[Xb,`Z`],`keys.undo`],[[Xb,`⇧`,`Z`],`keys.redo`],[[Xb,`S`],`keys.save`],[[Xb,`D`],`keys.duplicate`],[[`Del`],`keys.delete`],[[`H`],`keys.hide`],[[`Esc`],`keys.deselect`],[[`Space`],`keys.play`],[[`T`],`keys.timeline`],[[`J`],`keys.json`],[[`I`],`keys.interact`],[[`A`],`keys.assistant`],[[`Shift`,`drag`],`keys.dragFast`],[[`Alt`,`drag`],`keys.dragFine`]];function $b(){let{t:e}=K(),{ui:t}=E_();return(0,J.jsx)(Sb,{title:e(`keys.title`),width:680,onClose:()=>t.set({dialog:null}),children:(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-6 px-4 py-2 sm:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`pb-1 pt-1.5 text-2xs font-semibold uppercase tracking-wide text-fg-faint`,children:e(`keys.general`)}),(0,J.jsx)(ex,{rows:Qb})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`pb-1 pt-1.5 text-2xs font-semibold uppercase tracking-wide text-fg-faint`,children:e(`viewport.tools`)}),(0,J.jsx)(ex,{rows:Zb})]})]})})}function ex({rows:e}){let{t}=K();return(0,J.jsx)(`div`,{className:`divide-y divide-line`,children:e.map(([e,n])=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`text-fg-muted`,children:t(n)}),(0,J.jsx)(`span`,{className:`flex shrink-0 gap-1`,children:e.map(e=>(0,J.jsx)(x_,{children:e},e))})]},n))})}var tx=`application/x-agent3d-add`;function nx(e,t){e.dataTransfer&&(e.dataTransfer.setData(tx,JSON.stringify(t)),e.dataTransfer.effectAllowed=`copy`)}function rx(e){return!!e.dataTransfer&&Array.from(e.dataTransfer.types).includes(`application/x-agent3d-add`)}function ix(e){try{let t=e.dataTransfer?.getData(tx);if(!t)return null;let n=JSON.parse(t);return n&&typeof n==`object`&&(`object`in n||`light`in n)?n:null}catch{return null}}function ax(e,t){let n=e=>Math.round(e*100)/100||0,[r,i,a]=t;return e.type===`ambient`||e.type===`hemisphere`?e:e.type===`point`?{...e,position:[n(r),n(i+1.5),n(a)]}:{...e,position:[n(r+2),n(i+4),n(a+3)],target:[n(r),n(i),n(a)]}}var ox=null;function sx(){let{backend:e}=E_(),[t,n]=(0,C.useState)(null);return(0,C.useEffect)(()=>{let t=!0;return ox||=e.mountConfig().then(e=>(e.libraryBase??`./library/`).replace(/\/?$/,`/`)),ox.then(e=>t&&n(e)).catch(()=>void 0),()=>{t=!1}},[e]),t}function cx(e,t){return e+t.replace(/^library:/,``).split(`/`).map(encodeURIComponent).join(`/`)}var lx=`__path__`;function ux(e=!0){let{backend:t}=E_(),[n,r]=(0,C.useState)(void 0),i=(0,C.useCallback)(()=>{t.call(`assets_list`,{}).then(e=>r(e.assets??[])).catch(()=>r([]))},[t]);return(0,C.useEffect)(()=>{e&&i()},[i,e]),{assets:n,reload:i}}function dx({label:e,hint:t,value:n,onChange:r,projectAssets:i,onOpen:a,library:o=!0,ariaLabel:s}){let{t:c}=K(),{library:l,backend:u}=E_(),d=sx(),[f,p]=(0,C.useState)(!1),m=(0,C.useMemo)(()=>Pg(i,l,n,{library:o}),[i,l,n,o]),[h,g]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!0;if(g(null),n)return n.startsWith(`library:`)?g(d?cx(d,n):null):u.fileUrl(n).then(t=>e&&g(t)).catch(()=>void 0),()=>{e=!1}},[n,d,u]);let _=e=>m.filter(t=>t.group===e);return(0,J.jsxs)(Q,{label:e,hint:t,overridden:n!==void 0,onReset:()=>r(void 0),children:[h&&(0,J.jsx)(`img`,{src:h,alt:``,className:`h-6 w-6 shrink-0 rounded object-cover`,onError:()=>g(null)}),f?(0,J.jsx)(__,{value:n??``,placeholder:c(`photo.pathPlaceholder`),mono:!0,onCommit:e=>{p(!1),r(e.trim()||void 0)},ariaLabel:s}):(0,J.jsxs)(`select`,{"aria-label":s,value:n??``,onFocus:a,onChange:e=>{e.target.value===lx?p(!0):r(e.target.value||void 0)},className:`field min-w-0 flex-1`,children:[(0,J.jsx)(`option`,{value:``,children:c(`photo.none`)}),_(`current`).map(e=>(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value)),_(`project`).length>0&&(0,J.jsx)(`optgroup`,{label:c(`photo.projectImages`),children:_(`project`).map(e=>(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value))}),_(`library`).length>0&&(0,J.jsx)(`optgroup`,{label:c(`photo.libraryImages`),children:_(`library`).map(e=>(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,J.jsx)(`option`,{value:lx,children:c(`photo.typePath`)})]})]})}var fx={box:ce,roundedBox:Ar,sphere:je,cylinder:qe,cone:Ue,capsule:Hn,torus:Ze,torusKnot:qt,plane:Mr,circle:je,ring:De,icosahedron:Tt,dodecahedron:Vt,octahedron:Ye,tetrahedron:ei,lathe:mi,extrude:Pr,tube:Er},px={terrain:Sn,trees:Xr,rocks:mr,grass:Jr,flowers:Sr,water:tt,clouds:ze,city:fe,character:Bn,planet:Dt,starfield:wr,blob:je,waveGrid:D,maze:jt,road:ir},mx={stars:wr,snow:br,rain:Fe,fireflies:Sr,confetti:Mn,sparks:ht,dust:fi,bubbles:je,embers:ht,hearts:zt},hx=[{type:`directional`,icon:Rr,def:{type:`directional`,color:`#ffffff`,intensity:2,position:[4,6,5]}},{type:`point`,icon:cn,def:{type:`point`,color:`#ffd9a8`,intensity:8,position:[0,2,2],distance:12}},{type:`spot`,icon:tn,def:{type:`spot`,color:`#ffffff`,intensity:20,position:[0,5,3],target:[0,0,0],angle:30,penumbra:.4}},{type:`hemisphere`,icon:Le,def:{type:`hemisphere`,skyColor:`#dfe9ff`,groundColor:`#3a3f4a`,intensity:.8}},{type:`ambient`,icon:Ir,def:{type:`ambient`,color:`#ffffff`,intensity:.3}},{type:`rect`,icon:Mr,def:{type:`rect`,color:`#ffffff`,intensity:4,position:[0,3,3],target:[0,0,0],width:3,height:1.5}}],gx=[{id:`primitives`,icon:ce,label:`add.primitives`},{id:`text`,icon:ni,label:`add.text`},{id:`generators`,icon:Sn,label:`add.generators`},{id:`particles`,icon:wr,label:`add.particles`},{id:`library`,icon:on,label:`add.library`},{id:`photo`,icon:Ut,label:`add.photo`},{id:`lights`,icon:cn,label:`add.lights`}];function _x(){let{t:e}=K(),{ui:t,edit:n,library:r}=E_(),i=D_(),a=i.scene,o=O_(e=>e.addTab),[s,c]=(0,C.useState)(`Hello`),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(null),p=e=>{let t=i.selection?Ic(a.objects,i.selection):null,r=t?.object.kind===`group`?t.object.id:void 0,o=Jg(a,e);n([{op:`addObject`,object:o,...r?{parent:r}:{}}],{select:o.id})},m=e=>{let t=zi(e.type,Gg(a));n([{op:`set`,path:`lights[${(a.lights??[]).length}]`,value:{id:t,...e}}],{select:null})},h=ux(o===`photo`),[g,_]=(0,C.useState)(``),v=Fg(i.selection?Ic(a.objects,i.selection)?.object:null),y=(0,C.useMemo)(()=>Pg(h.assets,void 0,void 0,{library:!1}),[h.assets]),b=(0,C.useMemo)(()=>r.assets.filter(e=>e.kind===`model`),[r]),x=(0,C.useMemo)(()=>{let e=new Map;for(let t of b)for(let n of t.tags)e.set(n,(e.get(n)??0)+1);return[...e.entries()].sort((e,t)=>t[1]-e[1]).slice(0,14).map(([e])=>e)},[b]),S=(0,C.useMemo)(()=>{let e=l.toLowerCase().split(/\s+/).filter(Boolean);return b.filter(t=>(!d||t.tags.includes(d))&&e.every(e=>t.id.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))))},[b,l,d]),w;switch(o){case`primitives`:w=(0,J.jsx)(vx,{children:qi.map(e=>(0,J.jsx)(yx,{icon:fx[e.id]??ce,label:Xy(e.id),hint:e.description,drag:{object:{kind:`mesh`,geometry:e.id}},onClick:()=>p({kind:`mesh`,geometry:e.id})},e.id))});break;case`text`:w=(0,J.jsxs)(`div`,{className:`space-y-2 p-2.5`,children:[(0,J.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),className:`field h-7`,"aria-label":e(`add.textValue`),placeholder:e(`add.textValue`)}),(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:ua.map(e=>(0,J.jsxs)(`button`,{type:`button`,title:e.description,draggable:!0,onDragStart:t=>nx(t,{object:{kind:`text`,text:s||`Text`,font:e.id}}),onClick:()=>p({kind:`text`,text:s||`Text`,font:e.id}),className:`flex h-12 flex-col items-start justify-center rounded-md bg-ink-2 px-2 text-left hover:bg-ink-3`,children:[(0,J.jsx)(`span`,{className:q(`text-base leading-none`,e.id.includes(`serif`)&&`font-serif`,e.id===`mono`&&`font-mono`,e.id.includes(`bold`)&&`font-bold`,e.id===`display`&&`font-black tracking-tight`),children:`Aa`}),(0,J.jsx)(`span`,{className:`mt-1 text-2xs text-fg-faint`,children:e.id})]},e.id))})]});break;case`generators`:w=(0,J.jsx)(vx,{children:na.map(e=>(0,J.jsx)(yx,{icon:px[e.id]??ge,label:Xy(e.id),hint:e.description,drag:{object:{kind:`generator`,generator:e.id}},onClick:()=>p({kind:`generator`,generator:e.id})},e.id))});break;case`particles`:w=(0,J.jsx)(vx,{children:aa.map(e=>(0,J.jsx)(yx,{icon:mx[e.id]??wr,label:Xy(e.id),hint:e.description,drag:{object:{kind:`particles`,preset:e.id}},onClick:()=>p({kind:`particles`,preset:e.id})},e.id))});break;case`library`:w=(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,J.jsxs)(`div`,{className:`space-y-1.5 border-b border-line p-2`,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(cr,{size:12,className:`absolute left-2 top-1/2 -translate-y-1/2 text-fg-faint`}),(0,J.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:e(`add.searchModels`,{n:b.length}),className:`field h-7 pl-6`,"aria-label":e(`add.searchModels`,{n:b.length})})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:x.map(e=>(0,J.jsx)(`button`,{type:`button`,onClick:()=>f(d===e?null:e),className:q(`rounded px-1.5 py-0.5 text-2xs`,d===e?`bg-accent/20 text-accent`:`bg-ink-2 text-fg-muted hover:text-fg`),children:e},e))})]}),(0,J.jsxs)(`div`,{className:`py-1`,children:[S.slice(0,120).map(e=>(0,J.jsxs)(`button`,{type:`button`,title:`${e.description}\n${e.license}${e.author?` · ${e.author}`:``}`,draggable:!0,onDragStart:t=>nx(t,{object:{kind:`model`,src:`library:${e.id}`,name:e.id.split(`/`).pop()}}),onClick:()=>p({kind:`model`,src:`library:${e.id}`,name:e.id.split(`/`).pop()}),className:`flex w-full items-center gap-2 px-2.5 py-1 text-left hover:bg-ink-2`,children:[(0,J.jsx)(ce,{size:12,className:`shrink-0 text-fg-faint`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e.id.split(`/`).pop()}),(0,J.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-faint`,children:e.id.split(`/`)[0]})]},e.id)),!S.length&&(0,J.jsx)(`div`,{className:`px-3 py-3 text-xs text-fg-faint`,children:b.length?e(`add.noMatch`):e(`add.noLibrary`)})]})]});break;case`photo`:w=(0,J.jsxs)(`div`,{className:`space-y-1 py-1.5`,children:[(0,J.jsx)(`div`,{className:`px-2.5 pb-1 text-2xs leading-snug text-fg-faint`,children:e(`add.photoHint`)}),v&&(0,J.jsxs)(`button`,{type:`button`,title:v,onClick:()=>p({kind:`photo`,src:v}),className:`flex w-full items-center gap-2 px-2.5 py-1 text-left hover:bg-ink-2`,children:[(0,J.jsx)(Ut,{size:12,className:`shrink-0 text-accent`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e(`add.photoSelected`)}),(0,J.jsx)(`span`,{className:`shrink-0 truncate text-2xs text-fg-faint`,children:v.split(`/`).pop()})]}),y.map(e=>(0,J.jsxs)(`button`,{type:`button`,title:e.value,draggable:!0,onDragStart:t=>nx(t,{object:{kind:`photo`,src:e.value}}),onClick:()=>p({kind:`photo`,src:e.value}),className:`flex w-full items-center gap-2 px-2.5 py-1 text-left hover:bg-ink-2`,children:[(0,J.jsx)(Ut,{size:12,className:`shrink-0 text-fg-faint`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e.label})]},e.value)),h.assets&&!y.length&&(0,J.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-faint`,children:e(`add.photoNone`)}),(0,J.jsxs)(`form`,{className:`flex gap-1 px-2.5 pt-1`,onSubmit:e=>{e.preventDefault();let t=g.trim();t&&(p({kind:`photo`,src:t}),_(``))},children:[(0,J.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:`field h-7 font-mono`,"aria-label":e(`photo.typePath`),placeholder:e(`photo.pathPlaceholder`)}),(0,J.jsx)(`button`,{type:`submit`,disabled:!g.trim(),title:e(`add.photoAdd`),"aria-label":e(`add.photoAdd`),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-ink-3 text-fg hover:bg-ink-4 disabled:opacity-40`,children:(0,J.jsx)(Kn,{size:13})})]})]});break;default:w=(0,J.jsx)(vx,{children:hx.map(t=>(0,J.jsx)(yx,{icon:t.icon,label:Xy(t.type),hint:e(`add.lightHint`),drag:{light:t.def},onClick:()=>m(t.def)},t.type))})}return(0,J.jsxs)(`div`,{className:`flex h-[44%] min-h-[220px] shrink-0 flex-col border-t border-line`,children:[(0,J.jsx)(`div`,{className:`flex h-9 shrink-0 items-center gap-0.5 border-b border-line px-1.5`,role:`tablist`,children:gx.map(n=>{let r=n.icon,i=o===n.id;return(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i,title:e(n.label),onClick:()=>t.set({addTab:n.id}),className:q(`flex h-7 items-center gap-1 rounded-md px-1.5 text-xs`,i?`bg-ink-3 text-fg`:`text-fg-faint hover:text-fg`),children:[(0,J.jsx)(r,{size:13,strokeWidth:1.75}),i&&(0,J.jsx)(`span`,{className:`font-medium`,children:e(n.label)})]},n.id)})}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:w})]})}function vx({children:e}){return(0,J.jsx)(`div`,{className:`grid grid-cols-3 gap-1 p-1.5`,children:e})}function yx({icon:e,label:t,hint:n,onClick:r,drag:i}){return(0,J.jsxs)(`button`,{type:`button`,title:n,onClick:r,draggable:!!i,onDragStart:i?e=>nx(e,i):void 0,className:`flex h-[60px] flex-col items-center justify-center gap-1.5 rounded-md text-fg-muted transition-colors hover:bg-ink-3 hover:text-fg active:bg-ink-4`,children:[(0,J.jsx)(e,{size:18,strokeWidth:1.5}),(0,J.jsx)(`span`,{className:`w-full truncate px-1 text-center text-2xs`,children:t})]})}var bx={mesh:ce,text:ni,model:An,group:Ct,generator:Sn,particles:wr,instances:rn,svg:In,photo:Ut},xx={ambient:Ir,directional:Rr,point:cn,spot:tn,hemisphere:Le,rect:Mr};function Sx({kind:e,size:t=13,className:n}){let r=bx[e]??ce;return(0,J.jsx)(r,{size:t,className:n,strokeWidth:1.75})}function Cx(){let{t:e}=K(),{store:t,edit:n}=E_(),r=D_(),i=r.scene,a=O_(e=>e.flash),[o,s]=(0,C.useState)(new Set),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(null),f=r.selection,p=(0,C.useMemo)(()=>{let e=new Map;for(let t of r.issues){let n=/objects#([\w-]+)/.exec(t.path)?.[1];n&&t.severity!==`info`&&e.get(n)!==`error`&&e.set(n,t.severity)}return e},[r.issues]),m=[],h=(e,t)=>{for(let n of e)m.push({o:n,depth:t}),n.children?.length&&!o.has(n.id)&&h(n.children,t+1)};return h(i.objects??[],0),(0,J.jsxs)(`div`,{className:`flex min-h-[140px] flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center justify-between border-b border-line pl-3 pr-1.5`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold`,children:e(`outliner.title`)}),(0,J.jsxs)(`div`,{className:`flex`,children:[(0,J.jsx)(Z,{label:e(`outliner.addGroup`),onClick:()=>{let e=Jg(i,{kind:`group`});n([{op:`addObject`,object:e}],{select:e.id})},children:(0,J.jsx)(xt,{size:14})}),(0,J.jsx)(Z,{label:e(`outliner.duplicate`),shortcut:`⌘D`,disabled:!f,onClick:()=>{if(!f)return;let e=Yg(i,f);e&&n(e.ops,{select:e.newId})},children:(0,J.jsx)(Ge,{size:13})}),(0,J.jsx)(Z,{label:e(`outliner.delete`),shortcut:`Del`,disabled:!f,onClick:()=>f&&n([{op:`removeObject`,id:f}]),children:(0,J.jsx)(Kr,{size:13})})]})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto py-1`,role:`tree`,"aria-label":e(`outliner.title`),children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t.select(null),className:q(`flex h-7 w-full items-center gap-2 px-3 text-left text-sm`,f===null?`bg-accent/15 text-fg`:`text-fg-muted hover:bg-ink-2`),children:[(0,J.jsx)(rt,{size:13,className:`text-fg-faint`}),(0,J.jsx)(`span`,{className:`flex-1 truncate`,children:e(`outliner.scene`)}),(0,J.jsx)(`span`,{className:`flex gap-0.5 text-fg-faint`,children:(i.lights??[]).slice(0,4).map((e,t)=>{let n=xx[e.type]??xx.point;return(0,J.jsx)(n,{size:11,"aria-label":e.type},t)})})]}),m.map(({o:r,depth:m})=>{let h=!!r.children?.length,g=r.id===f,_=r.visible===!1,v=p.get(r.id),y=u?.id===r.id?u.where:null;return(0,J.jsxs)(`div`,{role:`treeitem`,"aria-selected":g,"aria-expanded":h?!o.has(r.id):void 0,draggable:!0,onDragStart:e=>{l(r.id),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,r.id)},onDragEnd:()=>{l(null),d(null)},onDragOver:e=>{if(!c||c===r.id)return;e.preventDefault();let t=e.currentTarget.getBoundingClientRect(),n=(e.clientY-t.top)/t.height;d({id:r.id,where:n<.28?`before`:n>.72?`after`:`inside`})},onDragLeave:()=>d(e=>e?.id===r.id?null:e),onDrop:e=>{if(e.preventDefault(),c&&u){let e=Xg(i,c,u.id,u.where);e.length&&n(e),u.where===`inside`&&s(e=>new Set([...e].filter(e=>e!==u.id)))}l(null),d(null)},onClick:()=>t.select(r.id),className:q(`group relative flex h-7 cursor-default items-center gap-1.5 pr-1 text-sm`,a?.ids.includes(r.id)&&`row-flash`,g?`bg-accent/15 text-fg`:`text-fg-muted hover:bg-ink-2 hover:text-fg`,c===r.id&&`opacity-40`,y===`inside`&&`ring-1 ring-inset ring-accent`),style:{paddingLeft:8+m*14},children:[y===`before`&&(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-x-2 top-0 h-0.5 rounded bg-accent`}),y===`after`&&(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-x-2 bottom-0 h-0.5 rounded bg-accent`}),(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":o.has(r.id)?e(`outliner.expand`):e(`outliner.collapse`),onClick:e=>{e.stopPropagation(),s(e=>{let t=new Set(e);return t.has(r.id)?t.delete(r.id):t.add(r.id),t})},className:q(`flex h-4 w-4 items-center justify-center text-fg-faint`,!h&&`invisible`),children:o.has(r.id)?(0,J.jsx)(Ce,{size:11}):(0,J.jsx)(be,{size:11})}),(0,J.jsx)(Sx,{kind:r.kind,className:g?`text-accent`:`text-fg-faint`}),(0,J.jsx)(`span`,{className:q(`truncate`,_&&`opacity-50`),children:r.name||r.id}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-2xs text-fg-faint`,children:r.kind===`group`?``:Rc(r).replace(/^"|"$/g,``)}),v&&(0,J.jsx)(`span`,{className:q(`h-1.5 w-1.5 shrink-0 rounded-full`,v===`error`?`bg-danger`:`bg-warn`),title:v}),(0,J.jsx)(`button`,{type:`button`,"aria-label":e(_?`outliner.show`:`outliner.hide`),title:`${e(_?`outliner.show`:`outliner.hide`)} (H)`,onClick:e=>{e.stopPropagation(),n(_?[{op:`remove`,path:`objects#${r.id}.visible`}]:[{op:`set`,path:`objects#${r.id}.visible`,value:!1}])},className:q(`flex h-5 w-5 shrink-0 items-center justify-center rounded text-fg-faint hover:text-fg`,_?`opacity-100`:`opacity-0 group-hover:opacity-100`),children:_?(0,J.jsx)(at,{size:12}):(0,J.jsx)(st,{size:12})})]},`${r.id}-${a?.ids.includes(r.id)?a.at:0}`)}),!m.length&&(0,J.jsx)(`div`,{className:`px-3 py-4 text-xs text-fg-faint`,children:e(`outliner.empty`)})]})]})}function wx(){return(0,J.jsxs)(`aside`,{className:`flex w-[268px] shrink-0 flex-col border-r border-line bg-ink-1`,children:[(0,J.jsx)(Cx,{}),(0,J.jsx)(_x,{})]})}function Tx(){let{t:e,lang:t,setLang:n}=K(),{store:r,ui:i,backend:a,closeProject:o,runCheck:s}=E_(),c=D_(),l=O_(e=>e.assistant),u=O_(e=>e.check),d=O_(e=>e.checkRunning),f=c.issues.filter(e=>e.severity===`error`).length,p=u?(u.counts?.errors??0)+(u.counts?.warnings??0):f,m=typeof navigator<`u`&&/Mac/.test(navigator.platform)?`⌘`:`Ctrl+`;return(0,J.jsxs)(`header`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-line bg-ink-1 px-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,style:{width:268},children:[(0,J.jsx)(Z,{label:e(`top.projects`),onClick:o,children:(0,J.jsx)(k,{size:15})}),(0,J.jsx)(Dx,{}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`truncate text-sm font-semibold leading-tight`,children:c.scene?.title||a.projectTitle()}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 truncate text-2xs text-fg-faint`,title:a.location??``,children:[a.mode===`cli`?(0,J.jsx)(Lt,{size:10}):(0,J.jsx)(ze,{size:10}),(0,J.jsx)(`span`,{className:`truncate`,children:a.mode===`cli`?Ex(a.location):e(`top.inBrowser`)})]})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,J.jsx)(Z,{label:e(`top.undo`),shortcut:`${m}Z`,disabled:!c.canUndo,onClick:()=>r.undo(),children:(0,J.jsx)(ii,{size:15})}),(0,J.jsx)(Z,{label:e(`top.redo`),shortcut:`${m}⇧Z`,disabled:!c.canRedo,onClick:()=>r.redo(),children:(0,J.jsx)(Jn,{size:15})}),(0,J.jsx)(Ox,{})]}),(0,J.jsx)(kx,{}),(0,J.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,J.jsxs)(g_,{variant:`ghost`,onClick:()=>void s(),title:e(`top.checkHint`),children:[d?(0,J.jsx)(gn,{size:14,className:`animate-spin`}):(0,J.jsx)(gr,{size:14}),e(`top.check`),p>0&&(0,J.jsx)(`span`,{className:q(`rounded px-1 text-2xs font-semibold`,(u?.counts?.errors??f)>0?`bg-danger/20 text-danger`:`bg-warn/20 text-warn`),children:p})]}),(0,J.jsxs)(g_,{variant:`ghost`,onClick:()=>i.set({dialog:`render`}),title:e(`top.renderHint`),children:[(0,J.jsx)(me,{size:14}),e(`top.render`)]}),(0,J.jsxs)(g_,{variant:`primary`,onClick:()=>i.set({dialog:`export`}),children:[(0,J.jsx)(oi,{size:14}),e(`top.export`)]}),(0,J.jsx)(`div`,{className:`mx-1 h-5 w-px bg-line`}),(0,J.jsx)(Z,{label:e(`top.assistant`),shortcut:`A`,active:l,onClick:()=>i.set({assistant:!l}),children:(0,J.jsx)(oe,{size:16})}),(0,J.jsx)(Z,{label:e(`top.shortcuts`),shortcut:`?`,onClick:()=>i.set({dialog:`shortcuts`}),children:(0,J.jsx)($t,{size:15})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>n(t===`en`?`fr`:`en`),title:e(`top.language`),className:`h-7 rounded-md px-1.5 text-2xs font-semibold text-fg-muted hover:bg-ink-3 hover:text-fg`,children:t.toUpperCase()})]})]})}function Ex(e){if(!e)return``;let t=e.split(`/`).filter(Boolean);return t.length>2?`…/${t.slice(-2).join(`/`)}`:e}function Dx({size:e=20}){let t=(0,C.useId)().replace(/:/g,``);return(0,J.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 32 32`,"aria-hidden":!0,className:`shrink-0`,children:[(0,J.jsxs)(`defs`,{children:[(0,J.jsxs)(`linearGradient`,{id:`${t}bg`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#2a2a30`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#0c0c0f`})]}),(0,J.jsxs)(`linearGradient`,{id:`${t}dot`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#7aa5ff`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#3d6bff`})]}),(0,J.jsxs)(`radialGradient`,{id:`${t}glow`,cx:`0.5`,cy:`0.5`,r:`0.5`,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:`#598bff`,stopOpacity:`0.55`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#598bff`,stopOpacity:`0`})]})]}),(0,J.jsx)(`rect`,{width:`32`,height:`32`,rx:`7.5`,fill:`url(#${t}bg)`}),(0,J.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`31`,height:`31`,rx:`7`,fill:`none`,stroke:`#ffffff`,strokeOpacity:`0.12`}),(0,J.jsx)(`circle`,{cx:`16`,cy:`16.6`,r:`5`,fill:`url(#${t}glow)`}),(0,J.jsx)(`path`,{d:`M16 8L23.45 12.3L23.45 20.9L16 25.2L8.55 20.9L8.55 12.3ZM12.62 14.65L8.55 12.3M19.38 14.65L23.45 12.3M16 20.5L16 25.2`,fill:`none`,stroke:`#fff`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,J.jsx)(`circle`,{cx:`16`,cy:`16.6`,r:`2.2`,fill:`url(#${t}dot)`})]})}function Ox(){let{t:e}=K(),t=D_().save,n=t.state===`saved`?e(`save.saved`):t.state===`saving`?e(`save.saving`):t.state===`pending`?e(`save.pending`):e(`save.error`);return(0,J.jsxs)(`div`,{className:q(`ml-1 flex h-6 items-center gap-1 rounded-md px-1.5 text-2xs`,t.state===`error`?`bg-danger/15 text-danger`:`text-fg-faint`),title:t.state===`error`?`${t.message??``}\n${e(`save.errorHint`)}`:n,children:[t.state===`error`?(0,J.jsx)(ke,{size:11}):(0,J.jsx)(`span`,{className:q(`h-1.5 w-1.5 rounded-full`,t.state===`saved`?`bg-agent/70`:`bg-key animate-pulse`)}),n]})}function kx(){let{t:e}=K(),{player:t}=E_(),n=D_(),r=(0,C.useSyncExternalStore)(e=>t.onState(e),()=>t.playing),[i,a]=(0,C.useState)(0),o=(0,C.useRef)(0);(0,C.useEffect)(()=>t.onTime(e=>{Math.abs(e-o.current)>.015&&(o.current=e,a(e))}),[t]);let s=n.scene?.timeline?.duration||10;return(0,J.jsxs)(`div`,{className:`mx-auto flex min-w-0 max-w-[460px] flex-1 items-center gap-2`,children:[(0,J.jsx)(Z,{label:e(r?`top.pause`:`top.play`),shortcut:`Space`,onClick:()=>t.toggle(),className:`text-fg`,children:r?(0,J.jsx)(Pn,{size:15,fill:`currentColor`}):(0,J.jsx)(Wn,{size:15,fill:`currentColor`})}),(0,J.jsxs)(`div`,{className:`w-[86px] shrink-0 text-xs tabular-nums text-fg-muted`,children:[(0,J.jsx)(`span`,{className:`text-fg`,children:i.toFixed(2)}),(0,J.jsxs)(`span`,{className:`text-fg-faint`,children:[` / `,s.toFixed(2),`s`]})]}),(0,J.jsx)(Ax,{value:i,max:s,onSeek:e=>void t.seek(e),ariaLabel:e(`top.scrub`)})]})}function Ax({value:e,max:t,onSeek:n,ariaLabel:r}){let i=(0,C.useRef)(null),a=e=>{let r=i.current.getBoundingClientRect();n(Math.max(0,Math.min(1,(e-r.left)/r.width))*t)},o=Math.max(0,Math.min(1,e/t))*100;return(0,J.jsxs)(`div`,{ref:i,role:`slider`,tabIndex:0,"aria-label":r,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":Number(e.toFixed(2)),onPointerDown:e=>{e.target.setPointerCapture(e.pointerId),a(e.clientX)},onPointerMove:e=>e.buttons===1&&a(e.clientX),onKeyDown:r=>{r.key===`ArrowLeft`&&n(Math.max(0,e-(r.shiftKey?1:.1))),r.key===`ArrowRight`&&n(Math.min(t,e+(r.shiftKey?1:.1)))},className:`group relative h-6 min-w-[80px] flex-1 cursor-pointer`,children:[(0,J.jsx)(`div`,{className:`absolute inset-x-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-ink-3`}),(0,J.jsx)(`div`,{className:`absolute left-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-accent/60`,style:{width:`${o}%`}}),(0,J.jsx)(`div`,{className:`absolute top-1/2 h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-ink-1 bg-fg shadow`,style:{left:`${o}%`}})]})}var jx={tl:`left-2 top-2`,tr:`right-2 top-2`,bl:`left-2 bottom-2`,br:`right-2 bottom-2`};function Mx(e){let t=new Set;for(let n of e?.elements??[]){if(n.visible===!1)continue;let e=n.anchor??`top-left`;e===`top-left`?t.add(`tl`):e===`top-right`?t.add(`tr`):e===`bottom-left`?t.add(`bl`):e===`bottom-right`?t.add(`br`):e===`top`?t.add(`tl`).add(`tr`):e===`bottom`&&t.add(`bl`).add(`br`)}return t}function Nx(e){let t=Mx(e),n=(e,n)=>e.find(e=>!t.has(e)&&e!==n)??e.find(e=>e!==n)??e[0],r=n([`tr`,`br`,`tl`,`bl`]);return{camera:r,selection:n([`tl`,`bl`,`tr`,`br`],r)}}var Px={desktop:0,tablet:820,phone:390},Fx=new Map,Ix=new Set([`mesh`,`text`,`model`,`svg`]);function Lx(){let{t:e}=K(),{player:t,backend:n,ui:r,store:i,edit:a}=E_(),o=D_(),s=o.scene,c=O_(e=>e.device),l=O_(e=>e.helpers),u=O_(e=>e.interact),d=O_(e=>e.agentPulse),f=O_(e=>e.gizmo),p=O_(e=>e.space),m=O_(e=>e.snap),h=O_(e=>e.view),g=O_(e=>e.lightSel),_=(0,C.useRef)(null),v=(0,C.useRef)(null),y=(0,C.useRef)(null),[b,x]=(0,C.useState)({w:800,h:500}),[S,w]=(0,C.useState)(null),[T,ee]=(0,C.useState)([]),[E,te]=(0,C.useState)(!1),[D,O]=(0,C.useState)(null),[ne,re]=(0,C.useState)(!1),ie=(0,C.useRef)(-1),ae=(0,C.useRef)(null);(0,C.useLayoutEffect)(()=>{let e=_.current;if(!e)return;let t=new ResizeObserver(()=>x({w:e.clientWidth,h:e.clientHeight}));return t.observe(e),x({w:e.clientWidth,h:e.clientHeight}),()=>t.disconnect()},[]);let oe=(0,C.useCallback)((e,n)=>{let r=i.getSnapshot().scene;if(!r)return;let o=e.kind===`object`&&n.transform?f_(r,e.id,n.transform):e.kind===`light`&&n.point?p_(r,e.id,e.part,n.point):[];o.length?a(o):t.update(r)},[i,a,t]);(0,C.useEffect)(()=>{let e=v.current;if(!e)return;let o=!1,s=null,c=()=>{};(async()=>{let l=await n.mountConfig();if(o)return;let u=i.getSnapshot();if(ie.current=u.revision,await t.mount(e,u.scene,l,{editor:!0}),o)return;let d=i.getSnapshot();d.revision!==ie.current&&t.update(d.scene);let f=t.player?.editor,p=y.current;if(!f||!p)return;let{SceneEditor:m}=await Gl(async()=>{let{SceneEditor:e}=await import(`./editor-DzyukvQl.js`);return{SceneEditor:e}},__vite__mapDeps([6,7,1,2,3]),import.meta.url);if(o)return;let h=d.scene?.id??`scene`;s=new m({bridge:f,dom:p,initialPose:Fx.get(h)??null,onCameraChange:e=>Fx.set(h,e),onPick:e=>{e?`light`in e?(i.select(null),r.set({lightSel:{id:e.light,part:e.part}})):(r.set({lightSel:null}),i.select(h_(e.chain,i.getSnapshot().selection))):(i.select(null),r.set({lightSel:null}))},onTransformEnd:(e,t)=>oe(e,t)}),c=f.onWorld(()=>{let e=ae.current;if(!e||!s||(ae.current=null,Date.now()-e.at>5e3))return;let t=s.objectBox(e.id),n=i.getSnapshot().scene;if(!t||!n)return;let r=e.y-t.min[1];if(r<.005||r>50)return;let o=n.objects.find(t=>t.id===e.id);if(!o)return;let c=o.position??[0,0,0];a([{op:`set`,path:`objects#${e.id}.position`,value:[c[0],Math.round((c[1]+r)*1e3)/1e3,c[2]]}],{coalesce:e.key})}),t.sceneEditor=s,O(s)})();let l=t.onState(()=>ee([...t.issues]));return()=>{o=!0,l(),c(),s?.dispose(),t.sceneEditor===s&&(t.sceneEditor=null),O(null),t.dispose(),e.replaceChildren()}},[n,t,i,r,a,oe]),(0,C.useEffect)(()=>{o.revision!==ie.current&&t.update(s)},[o.revision,s,t]),(0,C.useEffect)(()=>{let e=setInterval(()=>w(t.stats()),1e3);return()=>clearInterval(e)},[t]);let se=o.selection;(0,C.useEffect)(()=>{se&&g&&r.set({lightSel:null})},[se,g,r]),(0,C.useEffect)(()=>{D?.setSelection(g&&!se?{kind:`light`,...g}:se?{kind:`object`,id:se}:null)},[D,se,g,o.revision]),(0,C.useEffect)(()=>D?.setMode(f),[D,f]),(0,C.useEffect)(()=>D?.setSpace(p),[D,p]),(0,C.useEffect)(()=>D?.setSnap(m),[D,m]),(0,C.useEffect)(()=>D?.setHelpers(l),[D,l]),(0,C.useEffect)(()=>D?.setView(u?`camera`:h),[D,h,u]),(0,C.useEffect)(()=>D?.setEnabled(!u),[D,u]),(0,C.useEffect)(()=>t.setInteract(u),[t,u]);let le=Vi(s.target?.aspect)??{width:16,height:9},ue=le.width/le.height,de=Math.max(50,b.w-104),fe=Math.max(50,b.h-56),pe=Px[c],he=pe||de,ge=he/ue,_e=1;pe?_e=Math.min(1,de/he,fe/ge):ge>fe&&(ge=fe,he=ge*ue);let ve=e=>{let t=y.current;if(!t)return null;let n=t.getBoundingClientRect();return[(e.clientX-n.left)/n.width*2-1,-((e.clientY-n.top)/n.height*2-1)]},ye=e=>{rx(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,ne||re(!0))},be=e=>{re(!1);let t=ix(e),n=ve(e),o=i.getSnapshot().scene;if(!t||!n||!o)return;e.preventDefault();let s=D?D.dropPoint(n[0],n[1]):[0,0,0],c=.25,l=s.map((e,t)=>(m&&t!==1?Math.round(e/c)*c:Math.round(e*100)/100)||0);if(`light`in t){let e=zi(t.light.type,Gg(o));a([{op:`set`,path:`lights[${(o.lights??[]).length}]`,value:{id:e,...ax(t.light,l)}}],{select:null}),r.set({lightSel:{id:e,part:`position`},interact:!1});return}let u=Jg(o,t.object,l),d=`drop:${u.id}`;Ix.has(u.kind)&&(ae.current={id:u.id,y:l[1],key:d,at:Date.now()}),a([{op:`addObject`,object:u}],{select:u.id,coalesce:d}),r.set({lightSel:null,interact:!1})},xe=()=>{let t=i.getSnapshot().scene;if(!D||!t)return;let n=D.pose(),r=m_(t,n.position,n.target);r.length&&(a(r),kh({tone:`success`,title:e(`viewport.cameraSet`),detail:e(`viewport.cameraSetDetail`)}))},k=e=>e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e),Se=g&&!se&&d_(s,g.id)!==null,Ce=se??(Se?`${g.id}${g.part===`target`?` · target`:``}`:null),we=u?`camera`:h,Te=Nx(o.scene?.ui),Ee=(t,n,i,a)=>(0,J.jsx)(Rx,{label:e(n),shortcut:i,active:!u&&f===t,disabled:u,onClick:()=>r.set({gizmo:t,interact:!1}),children:a});return(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line bg-ink-1 px-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[(0,J.jsx)(`span`,{className:`rounded bg-ink-3 px-1.5 py-0.5 font-medium text-fg`,children:s.target?.kind}),(0,J.jsx)(`span`,{className:`tabular-nums`,children:s.target?.aspect}),(0,J.jsxs)(`span`,{className:`hidden text-fg-faint tabular-nums lg:inline`,children:[Math.round(he),`×`,Math.round(ge)]})]}),(0,J.jsx)(`div`,{className:`mx-auto flex items-center rounded-md bg-ink-2 p-0.5`,role:`radiogroup`,"aria-label":e(`viewport.device`),children:[[`desktop`,bn],[`tablet`,Hr],[`phone`,vr]].map(([t,n])=>(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":c===t,title:e(`viewport.${t}`),onClick:()=>r.set({device:t}),className:q(`flex h-6 w-8 items-center justify-center rounded`,c===t?`bg-ink-4 text-fg`:`text-fg-faint hover:text-fg`),children:(0,J.jsx)(n,{size:13})},t))}),(0,J.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center rounded-md bg-ink-2 p-0.5`,role:`radiogroup`,"aria-label":e(`viewport.view`),children:[(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":we===`editor`,disabled:u,title:`${e(`viewport.editorCamera`)} (C)`,onClick:()=>r.set({view:`editor`}),className:q(`flex h-6 items-center gap-1 rounded px-1.5 text-2xs font-medium disabled:opacity-40`,we===`editor`?`bg-ink-4 text-fg`:`text-fg-faint hover:text-fg`),children:[(0,J.jsx)(ci,{size:12}),` `,(0,J.jsx)(`span`,{className:`hidden xl:inline`,children:e(`viewport.editorShort`)})]}),(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":we===`camera`,title:`${e(`viewport.sceneCamera`)} (C)`,onClick:()=>r.set({view:`camera`}),className:q(`flex h-6 items-center gap-1 rounded px-1.5 text-2xs font-medium`,we===`camera`?`bg-ink-4 text-fg`:`text-fg-faint hover:text-fg`),children:[(0,J.jsx)(me,{size:12}),` `,(0,J.jsx)(`span`,{className:`hidden xl:inline`,children:e(`viewport.cameraShort`)})]})]}),(0,J.jsx)(Z,{label:e(`viewport.setCamera`),disabled:we!==`editor`||!D,onClick:xe,children:(0,J.jsx)(Br,{size:14})}),(0,J.jsx)(Z,{label:e(`viewport.frame`),shortcut:`F`,disabled:!D,onClick:()=>{h===`camera`&&r.set({view:`editor`,interact:!1}),D?.frameSelection()},children:(0,J.jsx)(_t,{size:14})}),(0,J.jsx)(`div`,{className:`mx-1 h-4 w-px bg-line`}),(0,J.jsx)(Z,{label:e(`viewport.helpers`),shortcut:`G`,active:l,onClick:()=>r.set({helpers:!l}),children:(0,J.jsx)(kt,{size:14})})]})]}),(0,J.jsxs)(`div`,{ref:_,className:`viewport-stage relative flex min-h-0 flex-1 items-center justify-center overflow-hidden`,children:[(0,J.jsxs)(`div`,{style:{width:he,height:ge,transform:_e===1?void 0:`scale(${_e})`},className:`relative shrink-0`,onDragOver:ye,onDragLeave:()=>re(!1),onDrop:be,children:[d>0&&(0,J.jsx)(`div`,{className:`agent-pulse pointer-events-none absolute inset-0 rounded-[3px]`},d),(0,J.jsxs)(`div`,{className:q(`absolute inset-0 overflow-hidden rounded-[3px] shadow-[0_0_0_1px_rgb(255_255_255/0.08),0_20px_60px_-20px_rgb(0_0_0/0.8)]`,ne&&`ring-2 ring-accent`),children:[(0,J.jsx)(`div`,{ref:v,className:`absolute inset-0`}),we===`camera`&&!u&&l&&(0,J.jsx)(zx,{}),(0,J.jsx)(`div`,{ref:y,"data-testid":`viewport-surface`,className:q(`absolute inset-0 select-none`,u&&`pointer-events-none`),style:{touchAction:`none`},"aria-label":e(`viewport.clickToSelect`)}),Ce&&!u&&(0,J.jsxs)(`div`,{className:q(`pointer-events-none absolute z-10 flex max-w-[60%] items-center gap-1 truncate rounded-[4px] bg-ink-0/75 px-1.5 py-0.5 text-2xs font-medium text-accent backdrop-blur`,jx[Te.selection]),children:[Se?(0,J.jsx)(cn,{size:10}):(0,J.jsx)(ce,{size:10}),(0,J.jsx)(`span`,{className:`truncate`,children:Ce})]}),!u&&(0,J.jsxs)(`div`,{className:q(`pointer-events-none absolute z-10 flex items-center gap-1 rounded-[4px] bg-ink-0/60 px-1.5 py-0.5 text-2xs text-fg-muted backdrop-blur`,jx[Te.camera]),children:[we===`camera`?(0,J.jsx)(me,{size:10}):(0,J.jsx)(ci,{size:10}),e(we===`camera`?`viewport.sceneCamera`:`viewport.editorCamera`)]}),ne&&(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-accent px-2 py-1 text-2xs font-medium text-ink-0`,children:e(`viewport.dropHere`)})]})]}),(0,J.jsxs)(`div`,{className:`absolute left-2 top-2 flex flex-col gap-0.5 rounded-lg border border-line bg-ink-1/90 p-0.5 shadow-lg shadow-black/30 backdrop-blur`,role:`toolbar`,"aria-label":e(`viewport.tools`),children:[(0,J.jsx)(Rx,{label:e(`viewport.select`),shortcut:`Q`,active:!u,onClick:()=>r.set({interact:!1}),children:(0,J.jsx)(wn,{size:14})}),(0,J.jsx)(Rx,{label:e(`viewport.interact`),shortcut:`I`,active:u,onClick:()=>r.set({interact:!0}),children:(0,J.jsx)(Ft,{size:14})}),(0,J.jsx)(`div`,{className:`mx-1 my-0.5 h-px bg-line`}),Ee(`translate`,`viewport.move`,`W`,(0,J.jsx)(On,{size:14})),Ee(`rotate`,`viewport.rotate`,`E`,(0,J.jsx)(er,{size:14})),Ee(`scale`,`viewport.scale`,`R`,(0,J.jsx)(or,{size:14})),(0,J.jsx)(`div`,{className:`mx-1 my-0.5 h-px bg-line`}),(0,J.jsx)(Rx,{label:e(p===`world`?`viewport.world`:`viewport.local`),shortcut:`X`,active:!1,disabled:u,onClick:()=>r.set({space:p===`world`?`local`:`world`}),children:p===`world`?(0,J.jsx)(Dt,{size:14}):(0,J.jsx)(ce,{size:14})}),(0,J.jsx)(Rx,{label:e(`viewport.snap`),shortcut:`⇧`,active:m,disabled:u,onClick:()=>r.set({snap:!m}),children:(0,J.jsx)(vn,{size:14})})]}),(0,J.jsxs)(`div`,{className:`pointer-events-none absolute bottom-2 left-2 flex gap-2 rounded-md bg-ink-0/70 px-2 py-1 text-2xs tabular-nums text-fg-muted backdrop-blur`,children:[S?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`b`,{className:`font-semibold text-fg`,children:k(S.triangles)}),` `,e(`viewport.tris`)]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`b`,{className:`font-semibold text-fg`,children:S.drawCalls}),` `,e(`viewport.calls`)]}),S.fps?(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`b`,{className:`font-semibold text-fg`,children:S.fps}),` fps`]}):null]}):(0,J.jsx)(`span`,{children:e(`viewport.starting`)}),!u&&(0,J.jsx)(`span`,{className:`hidden border-l border-line pl-2 text-fg-faint md:inline`,children:e(we===`editor`?`viewport.navHint`:`viewport.cameraHint`)})]}),T.length>0&&(0,J.jsxs)(`div`,{className:`absolute bottom-2 right-2`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>te(e=>!e),className:`flex items-center gap-1 rounded-md bg-warn/15 px-2 py-1 text-2xs font-medium text-warn backdrop-blur hover:bg-warn/25`,children:[(0,J.jsx)(Qr,{size:11}),` `,e(`viewport.runtimeIssues`,{n:T.length})]}),E&&(0,J.jsx)(`div`,{className:`absolute bottom-8 right-0 max-h-60 w-80 overflow-auto rounded-lg border border-line bg-ink-1 p-2 text-xs shadow-xl`,children:T.map((e,t)=>(0,J.jsxs)(`div`,{className:`border-b border-line py-1 last:border-0`,children:[(0,J.jsx)(`div`,{className:`font-mono text-2xs text-warn`,children:e.code}),(0,J.jsx)(`div`,{className:`text-fg-muted`,children:e.message})]},t))})]})]})]})}function Rx({label:e,shortcut:t,active:n,disabled:r,onClick:i,children:a}){return(0,J.jsx)(`button`,{type:`button`,"aria-label":e,"aria-pressed":n,title:t?`${e} (${t})`:e,disabled:r,onClick:i,className:q(`flex h-7 w-7 items-center justify-center rounded-md transition-colors disabled:pointer-events-none disabled:opacity-35`,n?`bg-accent/20 text-accent`:`text-fg-muted hover:bg-ink-3 hover:text-fg`),children:a})}function zx(){return(0,J.jsxs)(`div`,{className:`pointer-events-none absolute inset-0`,children:[(0,J.jsx)(`div`,{className:`absolute inset-[5%] rounded-[2px] border border-dashed border-white/25`}),[33.333,66.666].map(e=>(0,J.jsx)(`div`,{className:`absolute inset-y-0 w-px bg-white/10`,style:{left:`${e}%`}},`v${e}`)),[33.333,66.666].map(e=>(0,J.jsx)(`div`,{className:`absolute inset-x-0 h-px bg-white/10`,style:{top:`${e}%`}},`h${e}`)),(0,J.jsx)(`div`,{className:`absolute left-1/2 top-1/2 h-3 w-px -translate-x-1/2 -translate-y-1/2 bg-white/30`}),(0,J.jsx)(`div`,{className:`absolute left-1/2 top-1/2 h-px w-3 -translate-x-1/2 -translate-y-1/2 bg-white/30`})]})}function Bx({trigger:e,items:t,onPick:n,placeholder:r,align:i=`right`}){let[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(``),[l,u]=(0,C.useState)(0),d=(0,C.useRef)(null),f=(0,C.useMemo)(()=>{let e=s.trim().toLowerCase();return e?t.filter(t=>t.label.toLowerCase().includes(e)||t.hint?.toLowerCase().includes(e)):t},[t,s]);(0,C.useEffect)(()=>{if(!a)return;let e=e=>!d.current?.contains(e.target)&&o(!1);return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]);let p=e=>{o(!1),c(``),n(e)};return(0,J.jsxs)(`div`,{ref:d,className:`relative`,children:[e(()=>{o(e=>!e),u(0)}),a&&(0,J.jsxs)(`div`,{className:`toast-in absolute top-full z-30 mt-1 w-64 overflow-hidden rounded-lg border border-line bg-ink-1 shadow-xl shadow-black/50 ${i===`right`?`right-0`:`left-0`}`,children:[(0,J.jsx)(`input`,{autoFocus:!0,value:s,placeholder:r,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{if(e.key===`ArrowDown`)u(e=>Math.min(f.length-1,e+1));else if(e.key===`ArrowUp`)u(e=>Math.max(0,e-1));else if(e.key===`Enter`&&f[l])p(f[l].id);else if(e.key===`Escape`)o(!1);else return;e.preventDefault()},className:`h-8 w-full border-b border-line bg-transparent px-2.5 text-sm outline-none placeholder:text-fg-faint`}),(0,J.jsxs)(`div`,{className:`max-h-72 overflow-auto py-1`,children:[f.map((e,t)=>(0,J.jsxs)(`button`,{type:`button`,onMouseEnter:()=>u(t),onClick:()=>p(e.id),className:`block w-full px-2.5 py-1 text-left ${t===l?`bg-ink-3`:``}`,children:[(0,J.jsx)(`div`,{className:`text-sm`,children:e.label}),e.hint&&(0,J.jsx)(`div`,{className:`truncate text-2xs text-fg-faint`,children:e.hint})]},e.id)),!f.length&&(0,J.jsx)(`div`,{className:`px-2.5 py-2 text-xs text-fg-faint`,children:`—`})]})]})]})}var Vx=e=>Math.round(e*10)/10;function Hx(e,t,n=1){let r=e.trim().split(/\s+/),i=[],a=e=>Vx(t+Number(e)*n),o=e=>Vx(-Number(e)*n);for(let e=0;e<r.length;){let t=r[e++];if(t===`m`||t===`l`)i.push(`${t===`m`?`M`:`L`}${a(r[e])} ${o(r[e+1])}`),e+=2;else if(t===`q`)i.push(`Q${a(r[e+2])} ${o(r[e+3])} ${a(r[e])} ${o(r[e+1])}`),e+=4;else if(t===`b`)i.push(`C${a(r[e+2])} ${o(r[e+3])} ${a(r[e+4])} ${o(r[e+5])} ${a(r[e])} ${o(r[e+1])}`),e+=6;else if(t===`z`)i.push(`Z`);else break}return i.join(``)}function Ux(e,t,n=1){let r=0,i=[];for(let a of t){let t=e.glyphs[a]??e.glyphs[`?`];t?(t.o&&i.push(Hx(t.o,r,n)),r+=t.ha*n):r+=(e.resolution??1e3)*.3*n}let a=e.resolution??1e3;return{d:i.join(``),width:r,ascent:(e.ascender??a*.8)*n,descent:Math.abs(e.descender??-a*.2)*n}}var Wx=new Map;function Gx(e,t){let n=Wx.get(t);return n||(n=fetch(cx(e,`fonts/${t}.typeface.json`)).then(e=>e.ok?e.json():null).catch(()=>null),Wx.set(t,n)),n}var Kx={"sans-bold":`Inter Bold`,sans:`Inter`,"inter-black":`Inter Black`,"montserrat-extrabold":`Montserrat`,"space-grotesk-bold":`Space Grotesk`,"bebas-neue":`BEBAS NEUE`,anton:`ANTON`,"serif-bold":`Playfair Bold`,serif:`Playfair`,mono:`JetBrains Mono`,display:`Fredoka`,pacifico:`Pacifico`,lobster:`Lobster`},qx=e=>Kx[e]??e;function Jx({id:e,height:t=18,className:n}){let r=sx(),[i,a]=(0,C.useState)(null);(0,C.useEffect)(()=>{let t=!0;return r&&Gx(r,e).then(e=>t&&a(e)),()=>{t=!1}},[r,e]);let o=qx(e);if(!i)return(0,J.jsx)(`span`,{className:q(`truncate text-sm text-fg-muted`,n),children:o});let s=Ux(i,o),c=s.ascent+s.descent;return(0,J.jsx)(`svg`,{viewBox:`0 ${-s.ascent} ${Math.max(1,s.width)} ${c}`,height:t,className:q(`block max-w-full fill-current`,n),preserveAspectRatio:`xMinYMid meet`,"aria-label":o,role:`img`,children:(0,J.jsx)(`path`,{d:s.d})})}function Yx({value:e,onChange:t}){return(0,J.jsx)(qv,{width:268,trigger:(t,n)=>(0,J.jsx)(Jv,{onClick:t,open:n,ariaLabel:Jy(`font`),children:(0,J.jsx)(Jx,{id:e,height:15,className:`text-fg`})}),children:n=>(0,J.jsx)(`div`,{className:`py-1`,role:`listbox`,children:ua.map(r=>(0,J.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":r.id===e,title:r.description,onClick:()=>{t(r.id),n()},className:q(`flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-ink-3`,r.id===e&&`bg-accent/10`),children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(Jx,{id:r.id,height:20,className:r.id===e?`text-accent`:`text-fg`}),(0,J.jsx)(`div`,{className:`mt-0.5 truncate text-2xs text-fg-faint`,children:r.description.split(` — `)[1]??r.description})]}),r.id===e&&(0,J.jsx)(ve,{size:12,className:`shrink-0 text-accent`})]},r.id))})})}var Xx=(e,t)=>{let n=typeof e==`string`?Sa(e):null;return n?wa(n):t};function Zx(e,t,n){let r=Sa(e),i=Sa(t);return!r||!i?e:wa({r:r.r+(i.r-r.r)*n,g:r.g+(i.g-r.g)*n,b:r.b+(i.b-r.b)*n,a:1})}function Qx(e){let t=(t,n)=>typeof e[t]==`number`?e[t]:n,n=t(`metalness`,0),r=t(`roughness`,.5),i=t(`transmission`,0),a=Array.isArray(e.gradient)?e.gradient.map(e=>Xx(e,`#888888`)):null;if(e.type===`normal`)return`radial-gradient(circle at 35% 30%, #ffffff 0 4%, transparent 30%), conic-gradient(from 200deg, #8080ff, #ff8080, #80ff80, #8080ff)`;let o=a?a[Math.floor(a.length/2)]:Xx(e.color,`#d0d0d0`),s=typeof e.emissive==`string`&&t(`emissiveIntensity`,1)>0?Xx(e.emissive,`#000000`):null,c=s&&s!==`#000000`?Zx(o,s,.6):o,l=Zx(c,`#000000`,n>.5?.82:.6),u=Zx(c,n>.5?`#000000`:`#ffffff`,n>.5?.25:.05),d=Math.round(4+r*22),f=`radial-gradient(circle at 34% 28%, rgba(255,255,255,${((1-r*.7)*(n>.5?1:.85)).toFixed(2)}) 0 ${d*.35}%, rgba(255,255,255,0) ${d+6}%)`,p=a?`linear-gradient(180deg, ${a.join(`, `)})`:`radial-gradient(circle at 38% 32%, ${u} 0%, ${c} 35%, ${l} 100%)`,m=[f];return n>.5&&m.push(`radial-gradient(circle at 60% 80%, ${Zx(c,`#ffffff`,.35)} 0 6%, transparent 30%)`),s&&m.push(`radial-gradient(circle at 50% 50%, ${s}66 0 40%, transparent 72%)`),i>0&&m.push(`radial-gradient(circle at 55% 60%, rgba(255,255,255,0.08) 0 45%, rgba(255,255,255,0.35) 62%, rgba(255,255,255,0) 72%)`),m.push(i>0?`radial-gradient(circle at 40% 35%, ${Zx(c,`#9fb7d0`,.3)}55 0%, #1b2030 100%)`:p),e.wireframe?`repeating-linear-gradient(45deg, ${o} 0 1px, transparent 1px 6px), repeating-linear-gradient(-45deg, ${o} 0 1px, #0e1015 1px 6px)`:m.join(`, `)}function $x(e){return Qx(e?.props??{color:`#cfd3da`,roughness:.5})}var eS={cols:8,cell:72,spacing:2.5};function tS(e=Ji){let{cols:t,cell:n,spacing:r}=eS,i=Math.ceil(e.length/t),a={},o=e.map((e,o)=>{let s=o%t,c=Math.floor(o/t);return a[e.id]={x:s*n,y:c*n},{id:`s${o}`,kind:`mesh`,position:[(s-(t-1)/2)*r,((i-1)/2-c)*r,0],geometry:{type:`sphere`,radius:1,segments:48},material:{preset:e.id}}});return{scene:{version:1,id:`preset-sheet`,title:`Material presets`,target:{kind:`card`,aspect:`${t}:${i}`,toneMapping:`aces`,lazy:!1,quality:`high`},camera:{type:`orthographic`,zoom:i*r,position:[0,0,20],target:[0,0,0]},environment:{background:`#1c2029`,lighting:`studio`},lights:[{id:`key`,type:`directional`,position:[4,6,8],intensity:2.2},{id:`fill`,type:`ambient`,intensity:.35}],objects:o},width:t*n,height:i*n,cells:a}}var nS=`agent3d.studio.presetSheet.v1.${Ji.map(e=>e.id).join(`,`).length}`,rS=null;function iS(){let{backend:e}=E_(),[t,n]=(0,C.useState)(()=>{try{return localStorage.getItem(nS)}catch{return null}});return(0,C.useEffect)(()=>{if(t)return;let r=!0;return rS||=(async()=>{let{scene:t,width:n,height:r}=tS(),i=await Rb(t,{libraryBase:(await e.mountConfig()).libraryBase},0,n,r);try{localStorage.setItem(nS,i)}catch{}return i})().catch(()=>null),rS.then(e=>r&&e&&n(e)),()=>{r=!1}},[e,t]),t}function aS({id:e,size:t=36,sheet:n,className:r}){let i=e?ma(e):void 0,{cells:a,width:o,height:s}=oS,c=e?a[e]:void 0,l=t/eS.cell,u=n&&c?{backgroundImage:`url(${n})`,backgroundSize:`${o*l}px ${s*l}px`,backgroundPosition:`${-c.x*l}px ${-c.y*l}px`}:{background:$x(i),borderRadius:999,transform:`scale(0.8)`};return(0,J.jsx)(`span`,{className:q(`block shrink-0 overflow-hidden rounded-md`,r),style:{width:t,height:t,...u},"aria-hidden":!0})}var oS=tS();function sS({value:e,onChange:t}){let{t:n}=K(),r=iS(),i=e?ma(e):void 0;return(0,J.jsx)(qv,{width:348,trigger:(t,a)=>(0,J.jsxs)(Jv,{onClick:t,open:a,ariaLabel:n(`inspector.preset`),children:[i?(0,J.jsx)(aS,{id:e,size:16,sheet:r,className:`rounded`}):(0,J.jsx)(ie,{size:12,className:`text-fg-faint`}),(0,J.jsx)(`span`,{className:q(`truncate`,!i&&`text-fg-faint`),children:i?Xy(i.id):n(`inspector.noPreset`)})]}),children:i=>(0,J.jsxs)(`div`,{className:`p-2`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-5 gap-1`,children:[(0,J.jsx)(cS,{active:!e,label:n(`inspector.noPreset`),onPick:()=>{t(void 0),i()},children:(0,J.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-md border border-dashed border-line text-fg-faint`,children:(0,J.jsx)(ie,{size:14})})}),Ji.map(n=>(0,J.jsx)(cS,{active:e===n.id,label:Xy(n.id),hint:n.description,onPick:()=>{t(n.id),i()},children:(0,J.jsx)(aS,{id:n.id,size:44,sheet:r})},n.id))]}),!r&&(0,J.jsx)(`div`,{className:`mt-2 text-center text-2xs text-fg-faint`,children:n(`inspector.renderingPresets`)})]})})}function cS({active:e,label:t,hint:n,onPick:r,children:i}){return(0,J.jsxs)(`button`,{type:`button`,title:n?`${t} — ${n}`:t,"aria-pressed":e,onClick:r,className:q(`relative flex flex-col items-center gap-1 rounded-md p-1 transition-colors`,e?`bg-accent/15 ring-1 ring-accent/70`:`hover:bg-ink-3`),children:[i,(0,J.jsx)(`span`,{className:q(`w-full truncate text-center text-[10px] leading-tight`,e?`text-accent`:`text-fg-muted`),children:t}),e&&(0,J.jsx)(ve,{size:10,className:`absolute right-1 top-1 text-accent`})]})}function lS(e){return e===void 0?`none`:typeof e==`object`?`procedural`:e.startsWith(`library:`)?`library`:`file`}function uS({slot:e,value:t,path:n,onChange:r}){let{t:i}=K(),{library:a}=E_(),o=sx(),s=lS(t),c=(0,C.useMemo)(()=>a.assets.filter(e=>e.kind===`texture`),[a]),l=/normal/i.test(e)?`normal`:/rough|metal|ao|bump|displacement|alpha/i.test(e)?`roughness`:`color`,u=(0,C.useMemo)(()=>[...c].sort((e,t)=>Number(!e.tags?.includes(l))-Number(!t.tags?.includes(l))||e.id.localeCompare(t.id)),[c,l]),d=typeof t==`object`?t:null,f=d?pa(`textures`,d.procedural):void 0;return(0,J.jsxs)(`div`,{className:q(`rounded-md`,s!==`none`&&`bg-ink-0/40 pb-1`),children:[(0,J.jsxs)(Q,{label:Jy(e),overridden:t!==void 0,onReset:()=>r(void 0),children:[(0,J.jsx)(v_,{value:s,options:[`none`,`file`,`library`,`procedural`].map(e=>({value:e,label:i(`texture.${e}`)})),onChange:e=>r(e===`none`?void 0:e===`file`?`assets/textures/`:e===`library`?`library:${u[0]?.id??`textures/concrete-color.jpg`}`:{procedural:l===`normal`?`flakes`:`noise`}),className:`w-[86px] flex-none`,ariaLabel:e}),s===`file`&&(0,J.jsx)(__,{value:String(t),onCommit:e=>r(e.trim()||void 0),mono:!0,ariaLabel:`${e} path`}),s===`library`&&(0,J.jsxs)(J.Fragment,{children:[o&&(0,J.jsx)(`img`,{src:cx(o,String(t)),alt:``,className:`h-6 w-6 shrink-0 rounded object-cover`}),(0,J.jsx)(v_,{value:String(t).replace(/^library:/,``),options:u.map(e=>({value:e.id,label:e.id.replace(/^textures\//,``).replace(/\.\w+$/,``)})),onChange:e=>r(`library:${e}`),ariaLabel:`${e} library`})]}),s===`procedural`&&d&&(0,J.jsx)(v_,{value:d.procedural,options:Zi.map(e=>({value:e.id,label:Xy(e.id)})),onChange:e=>r({procedural:e}),ariaLabel:`${e} procedural`})]}),d&&f&&(0,J.jsx)($,{specs:f.params,base:n,values:d})]})}function dS({object:e}){let{t}=K(),n=tb(),{backend:r,tools:i}=E_(),a=ux(),[o,s]=(0,C.useState)(!1),c=Hg(e.id,``),l=e,u=Vg(r.capabilities)&&i.some(e=>e.name===`image_depth`),d=async()=>{s(!0);try{let i=Bg(await r.call(Rg,zg(e)));if(!i)throw new $m(`io`,t(`photo.depthNoPath`));n(Hg(e.id,`depth`),i),a.reload(),kh({tone:`success`,title:t(`photo.depthDone`),detail:i})}catch(e){let n=e;kh({tone:`error`,title:t(`photo.depthFailed`),detail:[n.message,n.hint].filter(Boolean).join(` `)},8e3)}finally{s(!1)}};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(b_,{title:t(`kinds.photo`),id:`photo`,children:[(0,J.jsx)(dx,{label:t(`photo.image`),hint:t(`photo.imageHint`),value:e.src,onChange:t=>t&&n(Hg(e.id,`src`),t),projectAssets:a.assets,onOpen:a.reload,ariaLabel:t(`photo.image`)}),(0,J.jsx)(dx,{label:t(`photo.depth`),hint:t(`photo.depthHint`),value:e.depth,onChange:t=>n(Hg(e.id,`depth`),t),projectAssets:a.assets,onOpen:a.reload,library:!1,ariaLabel:t(`photo.depth`)}),(0,J.jsx)(`div`,{className:`flex items-center gap-2 px-3 py-1`,children:(0,J.jsx)(`span`,{title:t(u?`photo.generateDepthHint`:`photo.depthNeedsCli`),className:`inline-flex`,children:(0,J.jsxs)(g_,{size:`xs`,disabled:!u||o,onClick:()=>void d(),children:[o?(0,J.jsx)(gn,{size:11,className:`animate-spin`}):(0,J.jsx)(ui,{size:11}),` `,t(o?`photo.generatingDepth`:`photo.generateDepth`)]})})}),!e.depth&&(0,J.jsx)(`div`,{className:`px-3 pb-1 text-2xs leading-snug text-fg-faint`,children:t(u?`photo.flatHint`:`photo.depthNeedsCli`)}),(0,J.jsx)(eb,{spec:Gh,value:e.mode,onChange:t=>n(Hg(e.id,`mode`),t)}),(0,J.jsx)($,{specs:Ng(e),base:c,values:l})]}),(0,J.jsx)(b_,{title:t(`photo.motion`),id:`photo-motion`,children:(0,J.jsx)($,{specs:qh,base:Hg(e.id,`motion`),values:e.motion})}),(0,J.jsx)(b_,{title:t(`inspector.material`),id:`photo-material`,defaultOpen:!!e.material,children:(0,J.jsx)($,{specs:Jh,base:Hg(e.id,`material`),values:e.material})})]})}var fS={lathe:{points:[[0,0],[.4,0],[.5,.3],[.3,.8],[.35,1.2],[0,1.2]]},extrude:{shape:[[0,.5],[.15,.15],[.5,.1],[.2,-.12],[.3,-.5],[0,-.25],[-.3,-.5],[-.2,-.12],[-.5,.1],[-.15,.15]]},tube:{points:[[-1.5,0,0],[-.5,.6,.3],[.5,-.4,-.3],[1.5,.2,0]]}};function pS({object:e}){let{t}=K(),{edit:n,store:r}=E_(),i=tb(),a=t=>Hg(e.id,t);return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line px-3 py-2.5`,children:[(0,J.jsx)(`div`,{className:`flex h-7 w-7 items-center justify-center rounded-md bg-accent/15 text-accent`,children:(0,J.jsx)(Sx,{kind:e.kind,size:14})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate font-mono text-xs text-fg`,title:t(`inspector.idHint`),children:e.id}),(0,J.jsx)(`div`,{className:`text-2xs text-fg-faint`,children:t(`kinds.${e.kind}`)})]}),(0,J.jsx)(Z,{label:t(`outliner.delete`),onClick:()=>n([{op:`removeObject`,id:e.id}]),children:(0,J.jsx)(Kr,{size:13})}),(0,J.jsx)(Z,{label:t(`inspector.deselect`),shortcut:`Esc`,onClick:()=>r.select(null),children:(0,J.jsx)(vi,{size:14})})]}),(0,J.jsxs)(`div`,{className:`border-b border-line py-1.5`,children:[(0,J.jsx)(Q,{label:t(`inspector.name`),children:(0,J.jsx)(__,{value:e.name??``,placeholder:e.id,onCommit:e=>i(a(`name`),e.trim()||void 0),ariaLabel:t(`inspector.name`)})}),(0,J.jsx)(Q,{label:t(`inspector.visible`),children:(0,J.jsx)(y_,{checked:e.visible!==!1,onChange:e=>i(a(`visible`),e?void 0:!1),ariaLabel:t(`inspector.visible`)})})]}),(0,J.jsxs)(b_,{title:t(`inspector.transform`),id:`transform`,children:[(0,J.jsx)(Q,{label:t(`inspector.position`),children:(0,J.jsx)(Wv,{value:e.position??[0,0,0],placeholder:!e.position,step:.01,onChange:(e,t)=>i(a(`position`),e,t)})}),(0,J.jsx)(Q,{label:t(`inspector.rotation`),children:(0,J.jsx)(Wv,{value:e.rotation??[0,0,0],placeholder:!e.rotation,step:.5,suffix:`°`,onChange:(e,t)=>i(a(`rotation`),e,t)})}),(0,J.jsx)(mS,{object:e})]}),(0,J.jsx)(hS,{object:e}),Qg.has(e.kind)&&(0,J.jsx)(_S,{object:e}),(0,J.jsx)(yS,{object:e}),(0,J.jsx)(xS,{object:e}),(0,J.jsxs)(b_,{title:t(`inspector.advanced`),id:`advanced`,defaultOpen:!1,children:[(r.getSnapshot().scene?.objects??[]).some(t=>t.id===e.id)&&(0,J.jsx)($,{specs:[og],base:Hg(e.id,``),values:e}),(0,J.jsx)($,{specs:sg,base:Hg(e.id,``),values:e}),(0,J.jsx)(Q,{label:t(`inspector.tags`),hint:t(`inspector.tagsHint`),children:(0,J.jsx)(__,{value:(e.tags??[]).join(`, `),onCommit:e=>i(a(`tags`),e.trim()?e.split(/[\s,]+/).filter(Boolean):void 0),ariaLabel:t(`inspector.tags`)})})]})]})}function mS({object:e}){let{t}=K(),n=tb(),r=e.scale===void 0||typeof e.scale==`number`,i=Hg(e.id,`scale`),a=typeof e.scale==`number`?[e.scale,e.scale,e.scale]:e.scale??[1,1,1];return(0,J.jsxs)(Q,{label:t(`inspector.scale`),children:[r?(0,J.jsx)(Hv,{label:`⇔`,value:typeof e.scale==`number`?e.scale:1,placeholder:e.scale===void 0,step:.01,min:0,onChange:(e,t)=>n(i,e===1?void 0:e,t),ariaLabel:t(`inspector.scale`)}):(0,J.jsx)(Wv,{value:a,step:.01,onChange:(e,t)=>n(i,e,t)}),(0,J.jsx)(Z,{label:t(r?`inspector.scaleSplit`:`inspector.scaleUniform`),className:`h-6 w-6`,onClick:()=>n(i,r?a:a[0]===1?void 0:a[0]),children:r?(0,J.jsx)(fn,{size:12}):(0,J.jsx)(un,{size:12})})]})}function hS({object:e}){let{t}=K(),n=tb(),r=e,i=Hg(e.id,``);switch(e.kind){case`mesh`:case`instances`:{let r=pa(`geometries`,e.geometry?.type);return(0,J.jsxs)(b_,{title:t(`inspector.geometry`),id:`geometry`,children:[(0,J.jsx)(Q,{label:t(`inspector.type`),children:(0,J.jsx)(v_,{value:e.geometry?.type??``,options:qi.map(e=>({value:e.id,label:Xy(e.id)})),onChange:t=>n(Hg(e.id,`geometry`),{type:t,...fS[t]??{}}),ariaLabel:t(`inspector.type`)})}),r&&(0,J.jsx)($,{specs:r.params,base:Hg(e.id,`geometry`),values:e.geometry}),e.kind===`instances`&&(0,J.jsx)(Q,{label:t(`inspector.layout`),align:`start`,children:(0,J.jsx)($y,{value:e.layout,rows:4,onCommit:t=>n(Hg(e.id,`layout`),t)})})]})}case`text`:return(0,J.jsx)(gS,{object:e});case`model`:return(0,J.jsxs)(b_,{title:t(`kinds.model`),id:`model`,children:[(0,J.jsx)($,{specs:Vh,base:i,values:r}),(0,J.jsx)($,{specs:Hh,base:Hg(e.id,`animation`),values:e.animation})]});case`generator`:{let r=pa(`generators`,e.generator);return(0,J.jsxs)(b_,{title:t(`kinds.generator`),id:`generator`,children:[(0,J.jsx)(Q,{label:t(`inspector.type`),children:(0,J.jsx)(v_,{value:e.generator,options:na.map(e=>({value:e.id,label:Xy(e.id)})),onChange:t=>n(Hg(e.id,`generator`),t,!0,e.params?[{op:`remove`,path:Hg(e.id,`params`)}]:[]),ariaLabel:t(`inspector.type`)})}),r&&(0,J.jsx)(`div`,{className:`px-3 pb-1 text-2xs leading-snug text-fg-faint`,children:r.description}),(0,J.jsx)(Q,{label:t(`inspector.seed`),children:(0,J.jsx)(Hv,{value:e.seed??1,integer:!0,placeholder:e.seed===void 0,onChange:(t,r)=>n(Hg(e.id,`seed`),t,r),ariaLabel:t(`inspector.seed`)})}),r&&(0,J.jsx)($,{specs:r.params,base:Hg(e.id,`params`),values:e.params})]})}case`particles`:return(0,J.jsx)(b_,{title:t(`kinds.particles`),id:`particles`,children:(0,J.jsx)($,{specs:Uh,base:i,values:r})});case`svg`:return(0,J.jsxs)(b_,{title:t(`kinds.svg`),id:`svg`,children:[(0,J.jsx)(Q,{label:`SVG`,align:`start`,children:(0,J.jsx)(__,{multiline:!0,mono:!0,value:e.src,onCommit:t=>n(Hg(e.id,`src`),t),ariaLabel:`SVG`})}),(0,J.jsx)($,{specs:Wh.map(t=>t.name===`keepColors`?{...t,default:!e.material}:t),base:i,values:r})]});case`photo`:return(0,J.jsx)(dS,{object:e});default:return null}}function gS({object:e}){let{t}=K(),n=tb(),r=Hg(e.id,``),i=e,a=e.outline,o=e.reveal;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(b_,{title:t(`kinds.text`),id:`text`,children:[(0,J.jsx)(Q,{label:t(`inspector.text`),align:`start`,children:(0,J.jsx)(__,{multiline:!0,value:e.text,onCommit:t=>n(Hg(e.id,`text`),t),ariaLabel:t(`inspector.text`)})}),(0,J.jsx)(Q,{label:t(`inspector.font`),overridden:e.font!==void 0,onReset:()=>n(Hg(e.id,`font`),void 0),children:(0,J.jsx)(Yx,{value:e.font??`sans-bold`,onChange:t=>n(Hg(e.id,`font`),t===`sans-bold`?void 0:t)})}),(0,J.jsx)($,{specs:Rh,base:r,values:i,skip:[`font`,`splitLetters`]})]}),(0,J.jsx)(b_,{title:t(`inspector.outline`),id:`text-outline`,defaultOpen:!!a,actions:(0,J.jsx)(y_,{checked:!!a,onChange:t=>n(Hg(e.id,`outline`),t?!0:void 0),ariaLabel:t(`inspector.outline`)}),children:a?(0,J.jsx)(rb,{specs:zh,path:Hg(e.id,`outline`),value:a,collapse:e=>!Object.keys(e).length||e}):(0,J.jsx)(`div`,{className:`px-3 text-2xs text-fg-faint`,children:t(`inspector.outlineHint`)})}),(0,J.jsx)(b_,{title:t(`inspector.reveal`),id:`text-reveal`,defaultOpen:!!o,actions:(0,J.jsx)(y_,{checked:!!o,onChange:t=>n(Hg(e.id,`reveal`),t?{effect:`rise`}:void 0),ariaLabel:t(`inspector.reveal`)}),children:o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{specs:Bh,base:Hg(e.id,`reveal`),values:o}),(0,J.jsx)(Q,{label:t(`inspector.ease`),overridden:o.ease!==void 0,onReset:()=>n(Hg(e.id,`reveal.ease`),void 0),children:(0,J.jsx)(Zv,{value:o.ease,placeholder:o.effect===`scale`||o.effect===`spin`?`outBack`:`outCubic`,onChange:t=>n(Hg(e.id,`reveal.ease`),t)})})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{label:Jy(`splitLetters`),hint:Rh.find(e=>e.name===`splitLetters`)?.description,children:(0,J.jsx)(y_,{checked:!!e.splitLetters,onChange:t=>n(Hg(e.id,`splitLetters`),t||void 0),ariaLabel:Jy(`splitLetters`)})}),(0,J.jsx)(`div`,{className:`px-3 text-2xs text-fg-faint`,children:t(`inspector.revealHint`)})]})})]})}function _S({object:e}){let{t}=K(),n=tb(),[r,i]=(0,C.useState)(!1),a=e.material??{},o=Hg(e.id,`material`),s=a.preset?ma(a.preset):void 0,c=e=>e.map(e=>s&&s.props[e.name]!==void 0?{...e,default:s.props[e.name]}:e),l=a.type===`shader`&&a.shader?pa(`shaders`,a.shader):void 0,u=a.type??s?.props.type??`standard`,d={...s?.props??{},...a},f=u===`physical`,p=u!==`shader`&&u!==`normal`,m=Uo.filter(e=>a[e]!==void 0||r),h=Uo.some(e=>d[e]!==void 0);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(b_,{title:t(`inspector.material`),id:`material`,children:[(0,J.jsx)(Q,{label:t(`inspector.preset`),children:(0,J.jsx)(sS,{value:a.preset,onChange:e=>n(`${o}.preset`,e)})}),s&&(0,J.jsx)(`div`,{className:`px-3 pb-1 text-2xs leading-snug text-fg-faint`,children:s.description}),(0,J.jsx)(eb,{spec:s?.props.type?{...eg,default:s.props.type}:eg,value:a.type,onChange:e=>n(`${o}.type`,e)}),a.type===`shader`&&(0,J.jsx)(Q,{label:t(`inspector.shader`),children:(0,J.jsx)(v_,{value:a.shader??``,placeholder:`—`,options:Yi.map(e=>({value:e.id,label:Xy(e.id)})),onChange:e=>n(`${o}.shader`,e||void 0),ariaLabel:t(`inspector.shader`)})}),l&&(0,J.jsx)($,{specs:l.params,base:`${o}.uniforms`,values:a.uniforms}),a.type!==`shader`&&(0,J.jsx)($,{specs:c(Yh),base:o,values:a}),u===`gradient`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(eb,{spec:{name:`gradient`,type:`colors`,description:`Vertical colour ramp.`,default:s?.props.gradient??[`#ff7eb3`,`#7afcff`]},value:a.gradient,onChange:e=>n(`${o}.gradient`,e)}),(0,J.jsx)(eb,{spec:{name:`gradientEmissive`,type:`boolean`,description:`The ramp drives the emissive glow too.`,default:s?.props.gradientEmissive??!1},value:a.gradientEmissive,onChange:e=>n(`${o}.gradientEmissive`,e)})]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`mx-3 mt-1 text-2xs text-fg-faint hover:text-fg`,children:t(r?`inspector.lessOptions`:`inspector.moreOptions`)}),r&&(0,J.jsx)($,{specs:c(Xh),base:o,values:a})]}),p&&(f||r)&&(0,J.jsxs)(b_,{title:t(`inspector.physicalLayers`),id:`material-physical`,defaultOpen:f,children:[!f&&(0,J.jsx)(`div`,{className:`px-3 pb-1 text-2xs text-fg-faint`,children:t(`inspector.physicalHint`)}),Zh.map(e=>{let n=e.specs.some(e=>typeof d[e.name]==`number`&&d[e.name]>0&&e.default===0);return(0,J.jsx)(vS,{title:t(`matgroup.${e.id}`),active:n,specs:c(e.specs),base:o,values:a},e.id)})]}),p&&(0,J.jsxs)(b_,{title:t(`inspector.textures`),id:`material-textures`,defaultOpen:h,children:[(r?Uo:m.length?m:[`map`,`normalMap`,`roughnessMap`]).map(e=>{let r=Qh[e],i=s?.props[e];return(0,J.jsxs)(`div`,{className:`px-1`,children:[(0,J.jsx)(uS,{slot:e,value:a[e],path:`${o}.${e}`,onChange:t=>n(`${o}.${e}`,t)}),a[e]===void 0&&i!==void 0&&(0,J.jsx)(`div`,{className:`px-3 pb-1 text-2xs text-fg-faint`,children:t(`inspector.fromPreset`,{v:typeof i==`string`?i:`procedural ${i.procedural}`})}),r&&d[e]!==void 0&&(0,J.jsx)(eb,{spec:c([r])[0],value:a[r.name],onChange:(e,t)=>n(`${o}.${r.name}`,e,t)})]},e)}),h&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{specs:c($h),base:o,values:a}),(0,J.jsxs)(Q,{label:Jy(`triplanar`),hint:t(`inspector.triplanarHint`),overridden:a.triplanar!==void 0,onReset:()=>n(`${o}.triplanar`,void 0),children:[(0,J.jsx)(y_,{checked:!!(a.triplanar??s?.props.triplanar),onChange:e=>n(`${o}.triplanar`,e?typeof s?.props.triplanar!=`number`||s.props.triplanar:!s?.props.triplanar&&void 0),ariaLabel:Jy(`triplanar`)}),typeof(a.triplanar??s?.props.triplanar)==`number`&&(0,J.jsx)(Hv,{value:Number(a.triplanar??s?.props.triplanar),min:.01,onChange:(e,t)=>n(`${o}.triplanar`,e,t),className:`w-[60px] flex-none`,ariaLabel:t(`ui.triplanarScale`)})]})]}),!r&&(0,J.jsx)(`div`,{className:`px-3 pt-1 text-2xs text-fg-faint`,children:t(`inspector.moreSlots`)})]})]})}function vS({title:e,active:t,specs:n,base:r,values:i}){let[a,o]=(0,C.useState)(t),s=n.some(e=>i[e.name]!==void 0);return(0,J.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-line/70`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-expanded":a,className:`flex h-6 w-full items-center gap-1.5 px-2 text-left text-2xs font-medium text-fg-muted hover:text-fg`,children:[(0,J.jsx)(`span`,{className:q(`h-1.5 w-1.5 rounded-full`,t||s?`bg-accent`:`bg-ink-4`)}),(0,J.jsx)(`span`,{className:`flex-1`,children:e}),(0,J.jsx)(`span`,{className:`text-fg-faint`,children:a?`−`:`+`})]}),a&&(0,J.jsx)(`div`,{className:`pb-1`,children:(0,J.jsx)($,{specs:n,base:r,values:i})})]})}function yS({object:e,pathBase:t}){let{t:n}=K(),{edit:r}=E_();D_();let i=e.behaviours??[],a=t??Hg(e.id,`behaviours`);return(0,J.jsxs)(b_,{title:(0,J.jsxs)(`span`,{children:[n(`inspector.behaviours`),` `,i.length>0&&(0,J.jsx)(`span`,{className:`font-normal text-fg-faint`,children:i.length})]}),id:`behaviours`,actions:(0,J.jsx)(Bx,{placeholder:n(`inspector.searchBehaviours`),items:ta.map(e=>({id:e.id,label:Xy(e.id),hint:e.description})),onPick:t=>{let n=pa(`behaviours`,t);e.id?r([{op:`addBehaviour`,id:e.id,behaviour:Zg(n)}]):r([{op:`set`,path:`${a}[${i.length}]`,value:Zg(n)}])},trigger:e=>(0,J.jsx)(Z,{label:n(`inspector.addBehaviour`),onClick:e,className:`h-6 w-6`,children:(0,J.jsx)(Kn,{size:13})})}),children:[!i.length&&(0,J.jsx)(`div`,{className:`px-3 text-2xs text-fg-faint`,children:n(`inspector.noBehaviours`)}),(0,J.jsx)(`div`,{className:`space-y-1.5 px-2`,children:i.map((e,t)=>(0,J.jsx)(bS,{behaviour:e,path:`${a}[${t}]`,onRemove:()=>r([{op:`remove`,path:`${a}[${t}]`}])},`${e.type}-${t}`))})]})}function bS({behaviour:e,path:t,onRemove:n}){let{t:r}=K(),i=tb(),a=pa(`behaviours`,e.type),[o,s]=(0,C.useState)(!0);return(0,J.jsxs)(`div`,{className:`rounded-md border border-line bg-ink-0/40`,children:[(0,J.jsxs)(`div`,{className:`flex h-7 items-center gap-1 pl-2 pr-1`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`min-w-0 flex-1 truncate text-left text-xs font-medium`,title:a?.description,children:Xy(e.type)}),(0,J.jsx)(`select`,{value:e.when??`always`,onChange:e=>i(`${t}.when`,e.target.value===`always`?void 0:e.target.value),"aria-label":r(`inspector.when`),className:`h-5 rounded bg-transparent px-1 text-2xs text-fg-muted outline-none hover:bg-ink-3`,children:Go.map(e=>(0,J.jsx)(`option`,{value:e,children:r(`when.${e}`)},e))}),(0,J.jsx)(Z,{label:r(`inspector.removeBehaviour`),onClick:n,className:`h-5 w-5`,children:(0,J.jsx)(vi,{size:11})})]}),o&&a&&(0,J.jsxs)(`div`,{className:`pb-1.5`,children:[(0,J.jsx)($,{specs:a.params,base:t,values:e}),(0,J.jsx)(eb,{spec:{name:`delay`,type:`number`,description:`Seconds before it starts.`,default:0,min:0},value:e.delay,onChange:(e,n)=>i(`${t}.delay`,e,n)})]}),!a&&(0,J.jsx)(`div`,{className:`px-2 pb-1.5 text-2xs text-danger`,children:r(`inspector.unknownBehaviour`)})]})}function xS({object:e}){let{t}=K(),n=tb(),r=Hg(e.id,`body`),i=e.body,a=i,o=i?.shape??`box`,s=tg.filter(e=>e.name===`size`?o===`box`:e.name===`radius`?o===`sphere`||o===`cylinder`||o===`capsule`:e.name!==`height`||o===`cylinder`||o===`capsule`),c=i?.type===`dynamic`,l=Object.keys(D_().scene?.physics?.materials??{}),u=ng.map(e=>e.name===`material`&&l.length?{...e,type:`enum`,options:[``,...l],default:``}:e);return(0,J.jsx)(b_,{title:t(`inspector.physics`),id:`body`,defaultOpen:!!i,children:i?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{specs:s,base:r,values:a}),o===`compound`&&(0,J.jsx)(SS,{list:i.shapes??[],path:`${r}.shapes`}),(o===`trimesh`||o===`heightfield`)&&c&&(0,J.jsx)(`div`,{className:`mx-3 my-1 rounded bg-danger/10 px-2 py-1 text-2xs text-danger`,children:t(`inspector.staticOnlyShape`)}),(0,J.jsx)(`div`,{className:`mx-3 mb-1 mt-1.5 text-2xs font-medium uppercase tracking-wide text-fg-faint`,children:t(`inspector.bodyMotion`)}),(0,J.jsx)($,{specs:u.filter(e=>c||![`mass`,`linearDamping`,`angularDamping`,`gravityScale`,`velocity`,`angularVelocity`].includes(e.name)||a?.[e.name]!==void 0),base:r,values:a}),(0,J.jsx)($,{specs:rg,base:r,values:a}),(0,J.jsx)(Q,{label:Jy(`collidesWith`),hint:t(`inspector.collidesWithHint`),overridden:i.collidesWith!==void 0,onReset:()=>n(`${r}.collidesWith`,void 0),children:(0,J.jsx)(__,{value:(i.collidesWith??[]).join(`, `),placeholder:t(`inspector.allLayers`),onCommit:e=>n(`${r}.collidesWith`,e.trim()?e.split(/[\s,]+/).filter(Boolean):void 0),ariaLabel:Jy(`collidesWith`)})}),(0,J.jsx)(`div`,{className:`px-3 pt-1`,children:(0,J.jsxs)(g_,{size:`xs`,variant:`ghost`,onClick:()=>n(r,void 0),children:[(0,J.jsx)(Kr,{size:11}),` `,t(`inspector.removeBody`)]})})]}):(0,J.jsxs)(`div`,{className:`flex gap-1 px-3`,children:[(0,J.jsxs)(g_,{size:`xs`,onClick:()=>n(r,{type:`static`}),children:[(0,J.jsx)(Kn,{size:11}),` `,t(`inspector.addStaticBody`)]}),(0,J.jsxs)(g_,{size:`xs`,onClick:()=>n(r,{type:`dynamic`,mass:1}),children:[(0,J.jsx)(Kn,{size:11}),` `,t(`inspector.addDynamicBody`)]})]})})}function SS({list:e,path:t}){let{t:n}=K(),{edit:r}=E_();return(0,J.jsxs)(`div`,{className:`space-y-1 px-2 py-1`,children:[e.map((e,i)=>{let a=ig.filter(t=>t.name===`size`?e.shape===`box`:t.name===`radius`?e.shape!==`box`:t.name!==`height`||e.shape===`cylinder`||e.shape===`capsule`);return(0,J.jsxs)(`div`,{className:`rounded-md border border-line bg-ink-0/40 pb-1`,children:[(0,J.jsxs)(`div`,{className:`flex h-6 items-center gap-1 pl-2 pr-1 text-2xs text-fg-muted`,children:[(0,J.jsx)(`span`,{className:`flex-1`,children:n(`inspector.collider`,{n:i+1})}),(0,J.jsx)(Z,{label:n(`inspector.removeCollider`),className:`h-5 w-5`,onClick:()=>r([{op:`remove`,path:`${t}[${i}]`}]),children:(0,J.jsx)(vi,{size:11})})]}),(0,J.jsx)($,{specs:a,base:`${t}[${i}]`,values:e})]},i)}),(0,J.jsxs)(g_,{size:`xs`,variant:`ghost`,onClick:()=>r([{op:`set`,path:`${t}[${e.length}]`,value:{shape:`box`,size:[1,1,1]}}]),children:[(0,J.jsx)(Kn,{size:11}),` `,n(`inspector.addCollider`)]})]})}function CS(){let{library:e}=E_();return(0,C.useMemo)(()=>{let t=new Set(e.assets.map(e=>e.id));return e.assets.filter(e=>e.kind===`hdri`&&/\.(hdr|exr)$/i.test(e.id)).map(e=>{let n=e.id.replace(/\.(hdr|exr)$/i,`.jpg`);return{id:e.id,ref:`library:${e.id}`,name:e.id.replace(/^hdri\//,``).replace(/\.\w+$/,``),preview:t.has(n)?n:null,description:e.description,tags:e.tags??[]}})},[e])}function wS({value:e,onChange:t}){let{t:n}=K(),r=sx(),i=CS(),a=i.find(t=>t.ref===e||t.ref.replace(/\.hdr$/,``)===e);return(0,J.jsx)(qv,{width:320,trigger:(t,n)=>(0,J.jsxs)(Jv,{onClick:t,open:n,ariaLabel:`HDRI`,children:[a?.preview&&r?(0,J.jsx)(`img`,{src:cx(r,a.preview),alt:``,className:`h-4 w-7 shrink-0 rounded-sm object-cover`}):(0,J.jsx)(Sn,{size:12,className:`text-fg-faint`}),(0,J.jsx)(`span`,{className:`truncate`,children:a?.name??e.split(`/`).pop()})]}),children:o=>(0,J.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,J.jsx)(`div`,{className:`grid grid-cols-3 gap-1.5`,children:i.map(e=>(0,J.jsxs)(`button`,{type:`button`,title:e.description,"aria-pressed":a?.id===e.id,onClick:()=>{t(e.ref),o()},className:q(`group relative overflow-hidden rounded-md text-left ring-1`,a?.id===e.id?`ring-accent`:`ring-line hover:ring-fg-faint`),children:[e.preview&&r?(0,J.jsx)(`img`,{src:cx(r,e.preview),alt:``,loading:`lazy`,className:`block aspect-[2/1] w-full object-cover`}):(0,J.jsx)(`div`,{className:`aspect-[2/1] w-full bg-ink-3`}),(0,J.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/80 to-transparent px-1.5 pb-0.5 pt-2 text-[10px] text-white`,children:e.name}),a?.id===e.id&&(0,J.jsx)(ve,{size:11,className:`absolute right-1 top-1 text-white drop-shadow`})]},e.id))}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-2xs text-fg-faint`,children:n(`env.hdriPath`)}),(0,J.jsx)(__,{value:e,onCommit:e=>e.trim()&&t(e.trim()),mono:!0,ariaLabel:n(`env.hdriPath`)})]})]})})}var TS=e=>e,ES=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function DS(e){return e===`transparent`?`transparent`:typeof e==`string`?`color`:`gradient`in e?`gradient`:`radial`in e?`radial`:`meshGradient`in e?`meshGradient`:`sky`in e?e.sky.physical||e.sky.preset?`physicalSky`:`sky`:`hdri`}var OS={color:`#15171c`,gradient:{gradient:[`#141e30`,`#243b55`],angle:0},radial:{radial:[`#2b3350`,`#0d0f16`]},meshGradient:{meshGradient:[`#ff6ec4`,`#7873f5`,`#4adede`,`#ffd86f`],speed:.2},sky:{sky:{top:`#3a7bd5`,horizon:`#f6d5a8`,bottom:`#d1d7e0`}},physicalSky:{sky:{preset:`golden-hour`}},hdri:{hdri:`library:hdri/studio.hdr`,blur:.5},transparent:`transparent`},kS={sunrise:[`#f8b878`,`#8fb6e8`],morning:[`#dfeaf5`,`#6fa3dc`],noon:[`#cfe6ff`,`#3d82d6`],afternoon:[`#f3e2c4`,`#5b93d1`],"golden-hour":[`#ffb56b`,`#6e8fc9`],sunset:[`#ff7a45`,`#4b4f8f`],dusk:[`#b26a8a`,`#1f2550`]};function AS({scene:e}){let{t}=K(),n=tb(),r=e.environment??{background:`#000000`},i=r.background,a=DS(i),o=`environment.background`,s=ES(i)&&`sky`in i?i.sky:{};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(b_,{title:t(`scene.environment`),id:`environment`,children:[(0,J.jsx)(Q,{label:t(`scene.background`),children:(0,J.jsx)(v_,{value:a,options:Object.keys(OS).map(e=>({value:e,label:t(`bg.${e}`)})),onChange:e=>n(o,OS[e]),ariaLabel:t(`scene.background`)})}),a===`color`&&(0,J.jsx)(Q,{label:t(`scene.color`),children:(0,J.jsx)(oy,{value:i,onChange:(e,t)=>n(o,e,t)})}),(a===`gradient`||a===`radial`||a===`meshGradient`)&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{label:t(`scene.colors`),children:(0,J.jsx)(sy,{value:TS(i)?.[a]??[],onChange:(e,t)=>n(`${o}.${a}`,e,t)})}),a===`gradient`&&(0,J.jsx)($,{specs:[{name:`angle`,type:`number`,description:`Degrees, 0 = bottom → top.`,default:0,min:-180,max:180},{name:`grain`,type:`number`,description:`Film grain.`,default:0,min:0,max:1}],base:o,values:TS(i)}),a===`radial`&&(0,J.jsx)($,{specs:[{name:`center`,type:`vec2`,description:`0..1 (default centre).`,default:[.5,.5]},{name:`radius`,type:`number`,description:``,default:1,min:.05,max:3},{name:`grain`,type:`number`,description:`Film grain.`,default:0,min:0,max:1}],base:o,values:TS(i)}),a===`meshGradient`&&(0,J.jsx)($,{specs:vg,base:o,values:TS(i)})]}),a===`sky`&&(0,J.jsx)($,{specs:pg,base:`${o}.sky`,values:TS(s)}),a===`physicalSky`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`grid grid-cols-4 gap-1 px-3 py-1`,role:`radiogroup`,"aria-label":t(`env.skyPreset`),children:Ho.map(e=>{let[t,r]=kS[e]??[`#888`,`#444`],i=s.preset===e;return(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":i,title:Xy(e),onClick:()=>n(`${o}.sky.preset`,e),className:q(`overflow-hidden rounded-md text-left ring-1 transition`,i?`ring-accent`:`ring-line hover:ring-fg-faint`),children:[(0,J.jsx)(`span`,{className:`block h-6 w-full`,style:{background:`linear-gradient(0deg, ${t}, ${r})`}}),(0,J.jsx)(`span`,{className:q(`block truncate px-1 py-0.5 text-[10px]`,i?`text-accent`:`text-fg-muted`),children:Xy(e)})]},e)})}),(0,J.jsx)(`div`,{className:`mx-3 mb-0.5 mt-1.5 text-2xs font-medium uppercase tracking-wide text-fg-faint`,children:t(`env.sun`)}),s.sun===!1?(0,J.jsx)(Q,{label:t(`env.sun`),children:(0,J.jsx)(y_,{checked:!1,onChange:()=>n(`${o}.sky.sun`,void 0),ariaLabel:t(`env.sun`)})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(rb,{specs:hg,path:`${o}.sky.sun`,value:s.sun,collapse:e=>Object.keys(e).length?e:void 0}),(0,J.jsx)(Q,{label:t(`env.noSun`),children:(0,J.jsx)(y_,{checked:!1,onChange:()=>n(`${o}.sky.sun`,!1),ariaLabel:t(`env.noSun`)})})]}),(0,J.jsx)(`div`,{className:`mx-3 mb-0.5 mt-1.5 text-2xs font-medium uppercase tracking-wide text-fg-faint`,children:t(`env.atmosphere`)}),(0,J.jsx)($,{specs:mg,base:`${o}.sky`,values:TS(s),skip:[`preset`]})]}),a===`hdri`&&ES(i)&&`hdri`in i&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{label:`HDRI`,children:(0,J.jsx)(wS,{value:i.hdri,onChange:e=>n(`${o}.hdri`,e)})}),(0,J.jsx)($,{specs:gg,base:o,values:TS(i)}),(0,J.jsx)(Q,{label:t(`env.groundProjection`),hint:t(`env.groundProjectionHint`),children:(0,J.jsx)(y_,{checked:!!i.groundProjection,onChange:e=>n(`${o}.groundProjection`,e||void 0),ariaLabel:t(`env.groundProjection`)})}),i.groundProjection&&(0,J.jsx)(rb,{specs:_g,path:`${o}.groundProjection`,value:i.groundProjection,collapse:e=>!Object.keys(e).length||e})]})]}),(0,J.jsx)(jS,{env:r}),(0,J.jsx)(MS,{env:r}),(0,J.jsx)(NS,{env:r})]})}function jS({env:e}){let{t}=K(),n=tb(),r=ES(e.lighting)?`hdri`:e.lighting??`none`,i=e.rig,a=typeof i==`string`?i:i?.preset,o=a?pa(`lightRigs`,a):void 0;return(0,J.jsxs)(b_,{title:t(`env.lighting`),id:`env-lighting`,children:[(0,J.jsx)(Q,{label:t(`scene.lighting`),hint:t(`scene.lightingHint`),children:(0,J.jsx)(v_,{value:r,options:[...Vo.map(e=>({value:e,label:t(`lighting.${e}`)})),{value:`hdri`,label:t(`lighting.hdri`)}],onChange:e=>n(`environment.lighting`,e===`hdri`?{hdri:`library:hdri/studio.hdr`}:e),ariaLabel:t(`scene.lighting`)})}),ES(e.lighting)&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{label:`HDRI`,children:(0,J.jsx)(wS,{value:e.lighting.hdri,onChange:e=>n(`environment.lighting.hdri`,e)})}),(0,J.jsx)($,{specs:Cg,base:`environment.lighting`,values:TS(e.lighting)})]}),(0,J.jsx)(Q,{label:t(`env.lightingIntensity`),hint:t(`scene.lightingHint`),overridden:e.lightingIntensity!==void 0,onReset:()=>n(`environment.lightingIntensity`,void 0),children:(0,J.jsx)(Gv,{value:e.lightingIntensity??1,min:0,max:4,placeholder:e.lightingIntensity===void 0,onChange:(e,t)=>n(`environment.lightingIntensity`,e===1?void 0:e,t),ariaLabel:t(`scene.intensity`)})}),(0,J.jsx)(Q,{label:t(`env.rig`),hint:t(`env.rigHint`),children:(0,J.jsx)(v_,{value:a??``,placeholder:t(`scene.none`),options:$i.map(e=>({value:e.id,label:Xy(e.id)})),onChange:e=>n(`environment.rig`,e?ES(i)?{...i,preset:e}:e:void 0),ariaLabel:t(`env.rig`)})}),o&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`px-3 pb-1 text-2xs leading-snug text-fg-faint`,children:o.description}),(0,J.jsx)(rb,{specs:o.params,path:`environment.rig`,value:i,expand:e=>({preset:e}),collapse:e=>Object.keys(e).length===1?e.preset:e})]})]})}function MS({env:e}){let{t}=K(),n=tb(),r=e.contactShadows;return(0,J.jsxs)(b_,{title:t(`env.shadows`),id:`env-shadows`,defaultOpen:!!r||!!e.shadows,children:[(0,J.jsx)(Q,{label:t(`env.contactShadows`),hint:t(`env.contactShadowsHint`),children:(0,J.jsx)(y_,{checked:!!r,onChange:e=>n(`environment.contactShadows`,e||void 0),ariaLabel:t(`env.contactShadows`)})}),r&&(0,J.jsx)(rb,{specs:yg,path:`environment.contactShadows`,value:r,collapse:e=>!Object.keys(e).length||e}),(0,J.jsx)(Q,{label:t(`env.shadowQuality`),hint:t(`env.shadowQualityHint`),children:(0,J.jsx)(y_,{checked:!!e.shadows,onChange:e=>n(`environment.shadows`,e?{type:`vsm`,softness:4}:void 0),ariaLabel:t(`env.shadowQuality`)})}),e.shadows&&(0,J.jsx)($,{specs:bg,base:`environment.shadows`,values:TS(e.shadows)})]})}function NS({env:e}){let{t}=K(),n=tb(),r=e.fog,i=r?`density`in r?`height`in r&&r.height!==void 0?`height`:`exp`:`linear`:`off`;return(0,J.jsxs)(b_,{title:t(`env.atmosphereGround`),id:`env-fog`,defaultOpen:!!r||!!e.ground,children:[(0,J.jsx)(Q,{label:t(`scene.fog`),children:(0,J.jsx)(v_,{value:i,options:[{value:`off`,label:t(`scene.off`)},{value:`linear`,label:t(`scene.fogLinear`)},{value:`exp`,label:t(`scene.fogDensity`)},{value:`height`,label:t(`env.fogHeight`)}],onChange:e=>n(`environment.fog`,e===`off`?void 0:e===`linear`?{color:r?.color??`#a0b4c8`,near:10,far:40}:e===`exp`?{color:r?.color??`#a0b4c8`,density:.03}:{color:r?.color??`#c8d2dc`,density:.06,height:.5,falloff:.6}),ariaLabel:t(`scene.fog`)})}),r&&(0,J.jsx)($,{specs:`density`in r?Sg.filter(e=>i===`height`||e.name!==`height`&&e.name!==`falloff`):xg,base:`environment.fog`,values:TS(r)}),(0,J.jsx)(Q,{label:t(`scene.ground`),children:(0,J.jsx)(y_,{checked:!!e.ground,onChange:e=>n(`environment.ground`,e?{y:0,shadowOnly:!0}:void 0),ariaLabel:t(`scene.ground`)})}),e.ground&&(0,J.jsx)($,{specs:wg,base:`environment.ground`,values:TS(e.ground)})]})}var PS=e=>e,FS={axis:[`hinge`],distance:[`distance`],restLength:[`spring`],stiffness:[`spring`],damping:[`spring`]};function IS({scene:e}){let{t}=K(),n=tb(),{edit:r}=E_(),i=e.physics,a=[];V(e.objects,e=>void(e.body&&a.push(e.id)));let o=i?.joints??[],s=i?.materials??{};return(0,J.jsx)(b_,{title:t(`scene.physics`),id:`physics`,defaultOpen:!!i,children:i?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{specs:Tg,base:`physics`,values:PS(i)}),(0,J.jsx)(Q,{label:t(`physics.layers`),hint:t(`physics.layersHint`),overridden:i.layers!==void 0,onReset:()=>n(`physics.layers`,void 0),children:(0,J.jsx)(__,{value:(i.layers??[]).join(`, `),placeholder:`default, player, enemies`,onCommit:e=>n(`physics.layers`,e.trim()?e.split(/[\s,]+/).filter(Boolean):void 0),ariaLabel:t(`physics.layers`)})}),(0,J.jsxs)(`div`,{className:`mx-3 mb-0.5 mt-2 flex items-center text-2xs font-medium uppercase tracking-wide text-fg-faint`,children:[(0,J.jsx)(`span`,{className:`flex-1`,children:t(`physics.materials`)}),(0,J.jsx)(Z,{label:t(`physics.addMaterial`),className:`h-5 w-5`,onClick:()=>{let e=1;for(;s[`surface${e}`];)e++;n(`physics.materials`,{...s,[`surface${e}`]:{friction:.5,restitution:0}})},children:(0,J.jsx)(Kn,{size:11})})]}),Object.entries(s).map(([e,t])=>(0,J.jsx)(LS,{name:e,m:t,onRename:t=>t&&t!==e&&!s[t]&&n(`physics.materials`,Object.fromEntries(Object.entries(s).map(([n,r])=>[n===e?t:n,r]))),onRemove:()=>{let t={...s};delete t[e],n(`physics.materials`,Object.keys(t).length?t:void 0)}},e)),!Object.keys(s).length&&(0,J.jsx)(`div`,{className:`px-3 text-2xs text-fg-faint`,children:t(`physics.noMaterials`)}),(i.contacts!==void 0||Object.keys(s).length>1)&&(0,J.jsx)(Q,{label:t(`physics.contacts`),hint:t(`physics.contactsHint`),align:`start`,children:(0,J.jsx)($y,{value:i.contacts??[],rows:2,onCommit:e=>n(`physics.contacts`,Array.isArray(e)&&e.length?e:void 0)})}),(0,J.jsxs)(`div`,{className:`mx-3 mb-0.5 mt-2 flex items-center text-2xs font-medium uppercase tracking-wide text-fg-faint`,children:[(0,J.jsxs)(`span`,{className:`flex-1`,children:[t(`physics.joints`),` `,o.length>0&&(0,J.jsx)(`span`,{className:`font-normal`,children:o.length})]}),(0,J.jsx)(Z,{label:t(`physics.addJoint`),className:`h-5 w-5`,disabled:!a.length,onClick:()=>r([{op:`set`,path:`physics.joints[${o.length}]`,value:{type:`hinge`,a:a[0],...a[1]?{b:a[1]}:{}}}]),children:(0,J.jsx)(Kn,{size:11})})]}),(0,J.jsx)(`div`,{className:`space-y-1 px-2`,children:o.map((e,t)=>(0,J.jsx)(RS,{joint:e,index:t,bodies:a,onRemove:()=>r(o.length===1?[{op:`remove`,path:`physics.joints`}]:[{op:`remove`,path:`physics.joints[${t}]`}])},t))}),!o.length&&(0,J.jsx)(`div`,{className:`px-3 text-2xs text-fg-faint`,children:a.length?t(`physics.noJoints`):t(`physics.noBodies`)}),(0,J.jsx)(`div`,{className:`px-3 pt-2`,children:(0,J.jsxs)(g_,{size:`xs`,variant:`ghost`,onClick:()=>n(`physics`,void 0),children:[(0,J.jsx)(Kr,{size:11}),` `,t(`scene.disable`)]})})]}):(0,J.jsx)(`div`,{className:`px-3`,children:(0,J.jsxs)(g_,{size:`xs`,onClick:()=>n(`physics`,{gravity:[0,-9.81,0]}),children:[(0,J.jsx)(Kn,{size:11}),` `,t(`scene.enablePhysics`)]})})})}function LS({name:e,m:t,onRename:n,onRemove:r}){let{t:i}=K(),a=tb(),o=`physics.materials.${e}`;return(0,J.jsxs)(`div`,{className:`flex items-center gap-1 px-3 py-[3px]`,children:[(0,J.jsx)(__,{value:e,onCommit:e=>n(e.trim()),className:`w-[84px] flex-none font-mono text-xs`,ariaLabel:i(`physics.materialName`)}),(0,J.jsx)(Hv,{label:`μ`,value:t.friction??.5,min:0,max:2,placeholder:t.friction===void 0,onChange:(e,t)=>a(`${o}.friction`,e,t),ariaLabel:Jy(`friction`)}),(0,J.jsx)(Hv,{label:`e`,value:t.restitution??0,min:0,max:1,placeholder:t.restitution===void 0,onChange:(e,t)=>a(`${o}.restitution`,e,t),ariaLabel:Jy(`restitution`)}),(0,J.jsx)(Z,{label:i(`physics.removeMaterial`),className:`h-5 w-5`,onClick:r,children:(0,J.jsx)(vi,{size:11})})]})}function RS({joint:e,index:t,bodies:n,onRemove:r}){let{t:i}=K(),a=tb(),o=`physics.joints[${t}]`,s=ag.filter(t=>t.name!==`type`&&(!FS[t.name]||FS[t.name].includes(e.type)));return(0,J.jsxs)(`div`,{className:`rounded-md border border-line bg-ink-0/40 pb-1`,children:[(0,J.jsxs)(`div`,{className:`flex h-7 items-center gap-1 pl-2 pr-1`,children:[(0,J.jsx)(v_,{value:e.type,options:ag[0].options.map(e=>({value:e,label:Xy(e)})),onChange:e=>a(`${o}.type`,e),className:`w-[92px] flex-none`,ariaLabel:i(`physics.jointType`)}),(0,J.jsxs)(`span`,{className:`flex-1 truncate font-mono text-2xs text-fg-faint`,children:[e.a,` ↔ `,e.b??i(`physics.world`)]}),(0,J.jsx)(Z,{label:i(`physics.removeJoint`),className:`h-5 w-5`,onClick:r,children:(0,J.jsx)(vi,{size:11})})]}),(0,J.jsx)(Q,{label:`A`,children:(0,J.jsx)(v_,{value:e.a,options:n,onChange:e=>a(`${o}.a`,e),ariaLabel:`a`})}),(0,J.jsx)(Q,{label:`B`,children:(0,J.jsx)(v_,{value:e.b??``,placeholder:i(`physics.world`),options:n.filter(t=>t!==e.a),onChange:e=>a(`${o}.b`,e||void 0),ariaLabel:`b`})}),(0,J.jsx)($,{specs:s,base:o,values:PS(e)}),e.type===`hinge`&&(0,J.jsxs)(Q,{label:i(`physics.motor`),hint:i(`physics.motorHint`),overridden:e.motor!==void 0,onReset:()=>a(`${o}.motor`,void 0),children:[(0,J.jsx)(Hv,{label:`°/s`,value:e.motor?.speed??0,placeholder:!e.motor,onChange:(t,n)=>a(`${o}.motor`,t?{...e.motor??{},speed:t}:void 0,n),ariaLabel:i(`physics.motor`)}),(0,J.jsx)(Hv,{label:`F`,value:e.motor?.maxForce??1e6,min:0,placeholder:e.motor?.maxForce===void 0,onChange:(t,n)=>e.motor&&a(`${o}.motor.maxForce`,t,n),ariaLabel:Jy(`maxForce`)})]})]})}function zS(e){let t=e.findIndex(e=>e.type===`look`);if(t<0)return null;let n=e[t];return{index:t,preset:typeof n.preset==`string`?n.preset:void 0,intensity:typeof n.intensity==`number`?n.intensity:void 0}}function BS(e,t){let n=zS(e),r=e.filter(e=>e.type!==`look`);return t?[{type:`look`,preset:t,...n?.intensity===void 0?{}:{intensity:n.intensity}},...r]:r}function VS(e,t,n){if(t===n||t<0||t>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return r.splice(Math.max(0,Math.min(r.length,n)),0,i),r}function HS(e,t){return e.filter((e,n)=>n!==t)}function US(e,t){return[...e,{type:t}]}var WS={low:`bg-agent/15 text-agent`,medium:`bg-warn/15 text-warn`,high:`bg-danger/15 text-danger`};function GS({scene:e}){let{t}=K(),{edit:n}=E_(),r=tb(),i=e.postfx??[],a=zS(i),o=e=>n(e.length?[{op:`set`,path:`postfx`,value:e}]:i.length?[{op:`remove`,path:`postfx`}]:[]),s=$a(i),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(null),f=i.map((e,t)=>({fx:e,i:t})).filter(e=>e.fx.type!==`look`);return(0,J.jsxs)(b_,{title:(0,J.jsxs)(`span`,{children:[t(`scene.postfx`),` `,f.length>0&&(0,J.jsx)(`span`,{className:`font-normal text-fg-faint`,children:f.length})]}),id:`postfx`,defaultOpen:i.length>0,actions:(0,J.jsx)(Bx,{placeholder:t(`scene.searchEffects`),items:la.filter(e=>e.id!==`look`).map(e=>({id:e.id,label:Xy(e.id),hint:e.description})),onPick:e=>o(US(i,e)),trigger:e=>(0,J.jsx)(Z,{label:t(`scene.addEffect`),onClick:e,className:`h-6 w-6`,children:(0,J.jsx)(Kn,{size:13})})}),children:[(0,J.jsx)(Q,{label:t(`postfx.look`),hint:t(`postfx.lookHint`),children:(0,J.jsx)(v_,{value:a?.preset??``,placeholder:t(`scene.none`),options:R.map(e=>({value:e,label:Xy(e)})),onChange:e=>o(BS(i,e||null)),ariaLabel:t(`postfx.look`)})}),a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`px-3 pb-1 text-2xs leading-snug text-fg-faint`,children:[ca[a.preset]?.description,` `,(0,J.jsx)(`span`,{className:`text-fg-muted`,children:ca[a.preset]?.effects.map(e=>e.type).join(` · `)})]}),(0,J.jsx)(Q,{label:t(`scene.intensity`),overridden:a.intensity!==void 0,onReset:()=>r(`postfx[${a.index}].intensity`,void 0),children:(0,J.jsx)(Gv,{value:a.intensity??1,min:0,max:1,placeholder:a.intensity===void 0,onChange:(e,t)=>r(`postfx[${a.index}].intensity`,e===1?void 0:e,t),ariaLabel:t(`scene.intensity`)})})]}),(0,J.jsxs)(`div`,{className:`space-y-1 px-2 pt-1`,onDragOver:e=>e.preventDefault(),children:[f.map(({fx:e,i:t})=>(0,J.jsx)(KS,{fx:e,index:t,first:t===f[0]?.i,last:t===f[f.length-1]?.i,dropTarget:u===t&&c!==null&&c!==t,onMove:e=>o(VS(i,t,e)),onRemove:()=>o(HS(i,t)),onDragStart:()=>l(t),onDragEnter:()=>d(t),onDrop:()=>{c!==null&&c!==t&&o(VS(i,c,t)),l(null),d(null)},onDragEnd:()=>{l(null),d(null)}},`${e.type}-${t}`)),!i.length&&(0,J.jsx)(`div`,{className:`px-1 text-2xs text-fg-faint`,children:t(`scene.noEffects`)})]}),i.length>0&&(0,J.jsxs)(`div`,{className:`mx-3 mt-1.5 flex items-center gap-1.5 text-2xs text-fg-faint`,title:t(`postfx.costHint`),children:[(0,J.jsx)(`span`,{className:q(`rounded px-1 font-medium`,s.level===`heavy`?WS.high:s.level===`moderate`?WS.medium:WS.low),children:t(`postfx.level.${s.level}`)}),t(`postfx.passes`,{n:s.passes}),s.dropped.low.length>0&&(0,J.jsxs)(`span`,{className:`truncate`,children:[`· `,t(`postfx.droppedLow`,{list:s.dropped.low.join(`, `)})]})]})]})}function KS(e){let{t}=K(),{fx:n,index:r}=e,i=pa(`postfx`,n.type),[a,o]=(0,C.useState)(!0),s=(0,C.useRef)(!1),c=qa(n.type);return(0,J.jsxs)(`div`,{draggable:!0,onDragStart:t=>{if(!s.current)return t.preventDefault();t.dataTransfer.effectAllowed=`move`,e.onDragStart()},onDragEnter:e.onDragEnter,onDrop:e.onDrop,onDragEnd:()=>{s.current=!1,e.onDragEnd()},className:q(`rounded-md border bg-ink-0/40 pb-0.5 transition-colors`,e.dropTarget?`border-accent`:`border-line`),children:[(0,J.jsxs)(`div`,{className:`flex h-7 items-center gap-0.5 pl-0.5 pr-1`,children:[(0,J.jsx)(`span`,{onPointerDown:()=>s.current=!0,onPointerUp:()=>s.current=!1,className:`flex h-6 w-4 cursor-grab items-center justify-center text-fg-faint hover:text-fg`,title:t(`postfx.drag`),children:(0,J.jsx)(Nt,{size:12})}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-expanded":a,className:`flex min-w-0 flex-1 items-center gap-1 text-left text-xs font-medium`,title:i?.description,children:[a?(0,J.jsx)(be,{size:11,className:`text-fg-faint`}):(0,J.jsx)(Ce,{size:11,className:`text-fg-faint`}),(0,J.jsx)(`span`,{className:`truncate`,children:Xy(n.type)})]}),(0,J.jsx)(`span`,{className:q(`rounded px-1 text-[10px]`,WS[c]),title:t(`postfx.gpuHint`),children:t(`postfx.gpu.${c}`)}),(0,J.jsx)(Z,{label:t(`postfx.up`),className:`h-5 w-5`,disabled:e.first,onClick:()=>e.onMove(r-1),children:(0,J.jsx)(Te,{size:11})}),(0,J.jsx)(Z,{label:t(`postfx.down`),className:`h-5 w-5`,disabled:e.last,onClick:()=>e.onMove(r+1),children:(0,J.jsx)(be,{size:11})}),(0,J.jsx)(Z,{label:t(`scene.removeEffect`),className:`h-5 w-5`,onClick:e.onRemove,children:(0,J.jsx)(vi,{size:11})})]}),a&&i&&i.params.length>0&&(0,J.jsx)($,{specs:i.params,base:`postfx[${r}]`,values:n}),a&&i&&!i.params.length&&(0,J.jsx)(`div`,{className:`px-3 pb-1 text-2xs text-fg-faint`,children:i.description}),!i&&(0,J.jsx)(`div`,{className:`px-3 pb-1 text-2xs text-danger`,children:t(`postfx.unknown`)})]})}var qS=(e,t,n,r,i)=>({name:e,type:`number`,description:t,default:n,min:r,max:i}),JS=(e,t)=>({name:e,type:`vec3`,description:t}),YS=qS(`fov`,`Field of view to reach (degrees).`,void 0,1,179),XS={dolly:[qS(`distance`,`Units along the view axis (+ = forward).`,void 0),YS],pushIn:[qS(`distance`,`Units closer (default: 25 % of the distance).`,void 0,0),YS],pullOut:[qS(`distance`,`Units back (default: 33 % of the distance).`,void 0,0),YS],truck:[qS(`distance`,`Units sideways (+ = right).`,1),YS],pedestal:[qS(`distance`,`Units up (- = down); the target follows.`,1),YS],crane:[qS(`height`,`Rise (units) while the target stays.`,2),qS(`distance`,`Units toward the target.`,void 0),YS],orbit:[qS(`angle`,`Yaw around the target (degrees).`,90,-720,720),qS(`elevation`,`Elevation change (degrees).`,0,-89,89),qS(`distance`,`Distance change (units).`,void 0),YS],zoom:[{...YS,required:!0}],move:[JS(`position`,`Camera position to reach.`),JS(`target`,`Look-at point to reach.`),YS],path:[qS(`lookAhead`,`Look ahead along the path (0..0.5).`,.05,0,.5),YS],lookAt:[JS(`target`,`Point to pan to (or pick an object).`),YS],focus:[qS(`focus`,`Focus distance (or pick an object).`,void 0,0)]},ZS={lookAt:`object`,focus:`object`,path:`lookAt`};function QS(e,t,n){let r=(e.camera.shots??[]).reduce((e,t)=>Math.max(e,(t.at??0)+(t.duration??0)),0),i={type:t,at:Math.round((n??r)*100)/100,duration:2},a=e.camera.position;switch(t){case`zoom`:i.fov=Math.max(10,(e.camera.fov??45)-15);break;case`move`:i.position=[a[0]+2,a[1]+1,a[2]];break;case`path`:i.points=[[a[0]+2,a[1]+.5,a[2]-1],[a[0]+3,a[1]+1,a[2]-3]];break;case`lookAt`:i.target=e.camera.target??[0,0,0];break;case`focus`:i.focus=5}return i}function $S(e){return(e??[]).reduce((e,t)=>Math.max(e,(t.at??0)+(t.duration??0)),0)}var eC=[`#7c8cff`,`#f2b654`,`#4fd1a5`,`#f26d9b`,`#6fc3ff`,`#c39bff`];function tC({scene:e}){let{t}=K(),{edit:n,player:r}=E_(),i=e.camera.shots??[],[a,o]=(0,C.useState)(0);(0,C.useEffect)(()=>r.onTime(o),[r]);let s=Math.max(e.timeline?.duration??0,$S(i),1),c=e=>n(e.length?[{op:`set`,path:`camera.shots`,value:e}]:[{op:`remove`,path:`camera.shots`}]);return(0,J.jsxs)(b_,{title:(0,J.jsxs)(`span`,{children:[t(`shots.title`),` `,i.length>0&&(0,J.jsx)(`span`,{className:`font-normal text-fg-faint`,children:i.length})]}),id:`camera-shots`,defaultOpen:i.length>0,actions:(0,J.jsx)(Bx,{placeholder:t(`shots.search`),items:lo.map(e=>({id:e,label:Xy(e),hint:t(`shots.type.${e}`)})),onPick:t=>c([...i,QS(e,t)]),trigger:e=>(0,J.jsx)(Z,{label:t(`shots.add`),onClick:e,className:`h-6 w-6`,children:(0,J.jsx)(Kn,{size:13})})}),children:[i.length>0&&(0,J.jsxs)(`div`,{className:`relative mx-3 mb-1.5 h-5 overflow-hidden rounded bg-ink-0`,title:t(`shots.laneHint`),children:[i.map((e,t)=>(0,J.jsx)(`button`,{type:`button`,onClick:()=>void r.seek(e.at),className:`absolute top-0.5 h-4 rounded-sm text-left text-[9px] leading-4 text-ink-0`,style:{left:`${e.at/s*100}%`,width:`${Math.max(1.5,e.duration/s*100)}%`,background:eC[t%eC.length],opacity:.85},children:(0,J.jsx)(`span`,{className:`block truncate px-1`,children:Xy(e.type)})},t)),(0,J.jsx)(`div`,{className:`pointer-events-none absolute bottom-0 top-0 w-px bg-white`,style:{left:`${Math.min(1,a/s)*100}%`}})]}),(0,J.jsx)(`div`,{className:`space-y-1 px-2`,children:i.map((t,n)=>(0,J.jsx)(nC,{scene:e,shot:t,index:n,hue:eC[n%eC.length],time:a,onRemove:()=>c(i.filter((e,t)=>t!==n))},n))}),!i.length&&(0,J.jsx)(`div`,{className:`px-3 text-2xs text-fg-faint`,children:t(`shots.empty`)})]})}function nC({scene:e,shot:t,index:n,hue:r,time:i,onRemove:a}){let{t:o}=K(),{player:s}=E_(),c=tb(),l=`camera.shots[${n}]`,u=ZS[t.type],d=Bc(e),f=i>=t.at&&i<=t.at+t.duration,p=t.duration>0?Math.min(1,Math.max(0,(i-t.at)/t.duration)):0,m=typeof t.lookAt==`string`?t.lookAt:``;return(0,J.jsxs)(`div`,{className:q(`rounded-md border bg-ink-0/40 pb-1`,f?`border-accent/50`:`border-line`),children:[(0,J.jsxs)(`div`,{className:`flex h-7 items-center gap-1 pl-2 pr-1`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-sm`,style:{background:r}}),(0,J.jsx)(v_,{value:t.type,options:lo.map(e=>({value:e,label:Xy(e)})),onChange:n=>c(l,{type:n,at:t.at,duration:t.duration,...t.ease?{ease:t.ease}:{},...rC(e,n)}),className:`w-[96px] flex-none`,ariaLabel:o(`shots.typeLabel`)}),(0,J.jsx)(`span`,{className:`flex-1 truncate text-2xs text-fg-faint`,children:o(`shots.type.${t.type}`)}),(0,J.jsx)(Z,{label:o(`shots.play`),className:`h-5 w-5`,onClick:async()=>{await s.seek(t.at),s.play()},children:(0,J.jsx)(Wn,{size:10})}),(0,J.jsx)(Z,{label:o(`shots.remove`),className:`h-5 w-5`,onClick:a,children:(0,J.jsx)(vi,{size:11})})]}),(0,J.jsxs)(Q,{label:o(`shots.timing`),children:[(0,J.jsx)(Hv,{label:`@`,value:t.at,min:0,step:.05,suffix:`s`,onChange:(e,t)=>c(`${l}.at`,e,t),ariaLabel:o(`shots.at`)}),(0,J.jsx)(Hv,{label:`↔`,value:t.duration,min:.05,step:.05,suffix:`s`,onChange:(e,t)=>c(`${l}.duration`,e,t),ariaLabel:o(`shots.duration`)})]}),(0,J.jsx)(Q,{label:o(`inspector.ease`),overridden:t.ease!==void 0,onReset:()=>c(`${l}.ease`,void 0),children:(0,J.jsx)(Zv,{value:t.ease,placeholder:`inOutCubic`,onChange:e=>c(`${l}.ease`,e)})}),(0,J.jsx)($,{specs:XS[t.type].map(n=>n.name===`fov`&&t.type!==`zoom`?{...n,default:e.camera.fov??45}:n),base:l,values:t}),u&&(0,J.jsx)(Q,{label:o(`shots.object`),hint:o(`shots.objectHint`),children:(0,J.jsx)(v_,{value:u===`object`?t.object??``:m,placeholder:`—`,options:d,onChange:e=>c(`${l}.${u}`,e||void 0),ariaLabel:o(`shots.object`)})}),t.type===`path`&&(0,J.jsx)(Q,{label:o(`shots.points`),align:`start`,children:(0,J.jsx)($y,{value:t.points??[],rows:3,onCommit:e=>Array.isArray(e)&&c(`${l}.points`,e)})}),(0,J.jsx)(Q,{label:o(`shots.preview`),hint:o(`shots.previewHint`),children:(0,J.jsx)(`input`,{type:`range`,min:0,max:1,step:.01,value:f?p:0,onChange:e=>void s.seek(t.at+Number(e.target.value)*t.duration),"aria-label":o(`shots.preview`),className:`slider h-5 w-full cursor-pointer appearance-none rounded-full bg-ink-3`})})]})}function rC(e,t){let{type:n,at:r,duration:i,...a}=QS(e,t);return a}var iC=e=>e;function aC(){let{t:e}=K(),t=D_().scene,n=tb();return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`border-b border-line px-3 py-2.5`,children:[(0,J.jsx)(`div`,{className:`text-sm font-semibold`,children:e(`scene.title`)}),(0,J.jsx)(`div`,{className:`text-2xs text-fg-faint`,children:e(`scene.subtitle`)})]}),(0,J.jsx)(b_,{title:e(`scene.meta`),id:`meta`,children:(0,J.jsx)($,{specs:Og,base:``,values:iC(t)})}),(0,J.jsxs)(b_,{title:e(`scene.target`),id:`target`,children:[(0,J.jsx)(Q,{label:e(`scene.kind`),children:(0,J.jsx)(v_,{value:t.target.kind,options:Lo,onChange:e=>n(`target`,{...t.target,kind:e,aspect:Jo[e]??t.target.aspect}),ariaLabel:e(`scene.kind`)})}),(0,J.jsx)($,{specs:cg,base:`target`,values:iC(t.target)})]}),(0,J.jsx)(b_,{title:e(`scene.camera`),id:`camera`,children:(0,J.jsx)($,{specs:lg.filter(e=>t.camera.type===`orthographic`?e.name!==`fov`:e.name!==`zoom`),base:`camera`,values:iC(t.camera)})}),(0,J.jsx)(tC,{scene:t}),(0,J.jsx)(AS,{scene:t}),(0,J.jsx)(oC,{scene:t}),(0,J.jsx)(GS,{scene:t}),(0,J.jsx)(IS,{scene:t}),(0,J.jsx)(cC,{scene:t}),(0,J.jsx)(lC,{scene:t})]})}function oC({scene:e}){let{t}=K(),{edit:n,ui:r}=E_(),i=e.lights??[],a=O_(e=>e.lightSel),o=(0,C.useRef)(new Map);return(0,C.useEffect)(()=>{a&&o.current.get(a.id)?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[a]),(0,J.jsx)(b_,{title:(0,J.jsxs)(`span`,{children:[t(`scene.lights`),` `,(0,J.jsx)(`span`,{className:`font-normal text-fg-faint`,children:i.length})]}),id:`lights`,actions:(0,J.jsx)(Bx,{placeholder:t(`scene.lightType`),items:Object.keys(ug).map(e=>({id:e,label:Xy(e)})),onPick:t=>{let r={id:zi(t,Gg(e)),type:t,intensity:t===`ambient`||t===`hemisphere`?.6:2,...t===`ambient`||t===`hemisphere`?{}:{position:[3,5,4]}};n([{op:`set`,path:`lights[${i.length}]`,value:r}])},trigger:e=>(0,J.jsx)(Z,{label:t(`scene.addLight`),onClick:e,className:`h-6 w-6`,children:(0,J.jsx)(Kn,{size:13})})}),children:(0,J.jsxs)(`div`,{className:`space-y-1.5 px-2`,children:[i.map((e,i)=>{let s=xx[e.type]??xx.point,c=e.id?`lights#${e.id}`:`lights[${i}]`,l=e.id??`light${i}`,u=a?.id===l,d=e.type!==`ambient`&&e.type!==`hemisphere`;return(0,J.jsxs)(`div`,{ref:e=>{e?o.current.set(l,e):o.current.delete(l)},className:q(`rounded-md border bg-ink-0/40 pb-1`,u?`border-accent/70`:`border-line`),children:[(0,J.jsxs)(`div`,{className:q(`flex h-7 items-center gap-1.5 pl-2 pr-1`,d&&`cursor-pointer`),onClick:d?()=>r.set({lightSel:u?null:{id:l,part:`position`}}):void 0,children:[(0,J.jsx)(s,{size:12,className:`text-key`}),(0,J.jsx)(`span`,{className:`flex-1 truncate text-xs font-medium`,children:e.id??`${e.type} ${i+1}`}),(0,J.jsx)(`span`,{className:`text-2xs text-fg-faint`,children:e.type}),(0,J.jsx)(Z,{label:t(`scene.removeLight`),className:`h-5 w-5`,onClick:e=>{e.stopPropagation(),n([{op:`remove`,path:`lights[${i}]`}])},children:(0,J.jsx)(vi,{size:11})})]}),(0,J.jsx)($,{specs:ug[e.type]??[],base:c,values:iC(e)}),(0,J.jsx)(sC,{light:e,path:c})]},`${e.id??i}`)}),!i.length&&(0,J.jsx)(`div`,{className:`px-1 text-2xs text-fg-faint`,children:t(`scene.noLights`)})]})})}function sC({light:e,path:t}){let{t:n}=K(),r=tb(),[i,a]=(0,C.useState)(!!e.shadow),o=e.castShadow&&(e.type===`directional`||e.type===`spot`||e.type===`point`);return(0,J.jsxs)(J.Fragment,{children:[e.type===`spot`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{label:n(`lights.volumetric`),hint:n(`lights.volumetricHint`),children:(0,J.jsx)(y_,{checked:!!e.volumetric,onChange:e=>r(`${t}.volumetric`,e||void 0),ariaLabel:n(`lights.volumetric`)})}),e.volumetric&&(0,J.jsx)(rb,{specs:fg,path:`${t}.volumetric`,value:e.volumetric,collapse:e=>!Object.keys(e).length||e})]}),o&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`mx-3 mt-0.5 text-2xs text-fg-faint hover:text-fg`,children:[i?`−`:`+`,` `,n(`lights.shadow`),e.shadow&&(0,J.jsx)(`span`,{className:`ml-1 text-accent`,children:`•`})]}),i&&(0,J.jsx)(rb,{specs:dg,path:`${t}.shadow`,value:e.shadow,collapse:e=>Object.keys(e).length?e:void 0})]})]})}function cC({scene:e}){let{t}=K(),n=tb(),r=e.audio,i=r?.music,a=da.filter(e=>/music|loop|pad/.test(e.description.toLowerCase())||e.id.includes(`loop`)||e.id.includes(`pad`));return(0,J.jsxs)(b_,{title:t(`scene.audio`),id:`audio`,defaultOpen:!!r,children:[(0,J.jsx)(Q,{label:t(`scene.music`),children:(0,J.jsx)(v_,{value:i?.preset??``,placeholder:t(`scene.none`),options:a.map(e=>e.id),onChange:e=>n(`audio.music`,e?{preset:e,volume:i?.volume??.5,loop:!0}:void 0),ariaLabel:t(`scene.music`)})}),i&&(0,J.jsx)(Q,{label:t(`scene.volume`),children:(0,J.jsx)(Hv,{value:i.volume??1,min:0,max:1,onChange:(e,t)=>n(`audio.music.volume`,e,t),ariaLabel:t(`scene.volume`)})}),(0,J.jsx)(Q,{label:t(`scene.muted`),children:(0,J.jsx)(y_,{checked:r?.muted??!0,onChange:e=>n(`audio.muted`,e),ariaLabel:t(`scene.muted`)})}),r?.sounds&&(0,J.jsx)(`div`,{className:`px-3 text-2xs text-fg-faint`,children:t(`scene.sounds`,{list:Object.keys(r.sounds).join(`, `)})})]})}function lC({scene:e}){let{t}=K(),{edit:n}=E_(),r=e.ui?.elements??[];return(0,J.jsxs)(b_,{title:(0,J.jsxs)(`span`,{children:[t(`scene.hud`),` `,r.length>0&&(0,J.jsx)(`span`,{className:`font-normal text-fg-faint`,children:r.length})]}),id:`ui`,defaultOpen:r.length>0,actions:(0,J.jsx)(Z,{label:t(`scene.addHud`),className:`h-6 w-6`,onClick:()=>{let t=zi(`label`,Gg(e));n(e.ui?[{op:`set`,path:`ui.elements[${r.length}]`,value:{id:t,type:`text`,text:`Hello`,anchor:`top-left`}}]:[{op:`set`,path:`ui`,value:{elements:[{id:t,type:`text`,text:`Hello`,anchor:`top-left`}]}}])},children:(0,J.jsx)(Kn,{size:13})}),children:[e.ui&&(0,J.jsx)($,{specs:Eg,base:`ui`,values:iC(e.ui)}),(0,J.jsx)(`div`,{className:`space-y-1.5 px-2 pt-1`,children:r.map((e,r)=>(0,J.jsxs)(`div`,{className:`rounded-md border border-line bg-ink-0/40 pb-1`,children:[(0,J.jsxs)(`div`,{className:`flex h-7 items-center gap-1 pl-2 pr-1`,children:[(0,J.jsx)(`span`,{className:`flex-1 truncate font-mono text-2xs`,children:e.id}),(0,J.jsx)(Z,{label:t(`scene.removeHud`),className:`h-5 w-5`,onClick:()=>n([{op:`remove`,path:`ui.elements[${r}]`}]),children:(0,J.jsx)(vi,{size:11})})]}),(0,J.jsx)($,{specs:Dg,base:`ui.elements[${r}]`,values:iC(e)})]},e.id))})]})}function uC(){let e=D_(),t=e.selection&&e.scene?Ic(e.scene.objects,e.selection):null;return(0,J.jsx)(`aside`,{className:`flex w-[300px] shrink-0 flex-col border-l border-line bg-ink-1`,children:(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overflow-x-hidden`,children:t?(0,J.jsx)(pS,{object:t.object},t.object.id):(0,J.jsx)(aC,{})})})}var dC=class{persist;snap={scene:null,selection:null,issues:[],save:{state:`saved`},canUndo:!1,canRedo:!1,revision:0,source:`load`};listeners=new Set;past=[];future=[];pendingOps=[];needsFull=!1;timer=null;chain=Promise.resolve();lastCoalesce=null;opts;constructor(e,t={}){this.persist=e,this.opts={debounceMs:300,historyLimit:100,coalesceMs:1e3,now:()=>Date.now(),validate:Ps,...t}}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.snap;emit(e){this.snap={...this.snap,...e,canUndo:this.past.length>0,canRedo:this.future.length>0},this.listeners.forEach(e=>e())}setScene(e,t,n={}){let r=this.snap.selection&&Ic(e.objects,this.snap.selection)?this.snap.selection:null;this.emit({scene:e,source:t,selection:r,issues:this.opts.validate(e),revision:this.snap.revision+1,...n})}pushHistory(e){this.past.push(e),this.past.length>this.opts.historyLimit&&this.past.shift(),this.future=[]}load(e){this.past=[],this.future=[],this.pendingOps=[],this.needsFull=!1,this.lastCoalesce=null,this.setScene(e,`load`,{save:{state:`saved`}})}select(e){e!==this.snap.selection&&this.emit({selection:e})}edit(e,t={}){let n=this.snap.scene;if(!n||!e.length)return null;let r;try{r=gm(n,e)}catch(e){return e.message}let i=this.opts.now();t.coalesce&&this.lastCoalesce?.key===t.coalesce&&i-this.lastCoalesce.at<this.opts.coalesceMs||this.pushHistory(n),this.lastCoalesce=t.coalesce?{key:t.coalesce,at:i}:null;for(let t of e)this.queue(t);return this.setScene(r,`edit`,{save:{state:`pending`},...t.select===void 0?{}:{selection:t.select}}),this.schedule(),null}queue(e){let t=this.pendingOps[this.pendingOps.length-1];t&&t.op===`set`&&e.op===`set`&&t.path===e.path||t&&t.op===`addTrack`&&e.op===`addTrack`&&t.track.target===e.track.target?this.pendingOps[this.pendingOps.length-1]=e:this.pendingOps.push(e)}replace(e){let t=this.snap.scene;t&&Ef(t,e)||(t&&this.pushHistory(t),this.lastCoalesce=null,this.needsFull=!0,this.pendingOps=[],this.setScene(e,`replace`,{save:{state:`pending`}}),this.schedule(0))}undo(){let e=this.past.pop();e&&this.snap.scene&&(this.future.push(this.snap.scene),this.historyMove(e))}redo(){let e=this.future.pop();e&&this.snap.scene&&(this.past.push(this.snap.scene),this.historyMove(e))}historyMove(e){this.lastCoalesce=null,this.needsFull=!0,this.pendingOps=[],this.setScene(e,`history`,{save:{state:`pending`}}),this.schedule(0)}external(e){let t=this.snap.scene;if(t&&Ef(t,e))return!1;let n=e;if(this.pendingOps.length&&!this.needsFull)try{n=gm(e,this.pendingOps)}catch{this.pendingOps=[]}else this.pendingOps=[],this.needsFull=!1;return t&&this.pushHistory(t),this.lastCoalesce=null,this.setScene(n,`external`,{save:this.pendingOps.length?this.snap.save:{state:`saved`}}),!0}schedule(e=this.opts.debounceMs){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null,this.flush()},e)}get dirty(){return this.needsFull||this.pendingOps.length>0}flush(){return this.timer&&=(clearTimeout(this.timer),null),this.chain=this.chain.then(()=>this.sendOnce()),this.chain}async sendOnce(){let e=this.snap.scene;if(!e||!this.dirty)return;let t=this.needsFull?{kind:`apply`,scene:e}:{kind:`patch`,ops:this.pendingOps};this.pendingOps=[],this.needsFull=!1,this.emit({save:{state:`saving`}});try{let e=await this.persist(t);if(e.status===`refused`){this.needsFull=!0;let t=(e.issues??[]).filter(e=>e.severity===`error`);this.emit({save:{state:`error`,message:t[0]?.message??e.hint,issues:t}})}else this.dirty?this.emit({save:{state:`pending`}}):this.emit({save:{state:`saved`}})}catch(e){this.needsFull=!0,this.emit({save:{state:`error`,message:e.message}})}}};function fC(){let e=Sh(`panel`),t=Sh(`dialog`),n=Sh(`device`);return{bottom:e===`timeline`||e===`interactions`||e===`json`||e===`check`?e:null,bottomHeight:248,assistant:Sh(`assistant`)===`1`,device:n===`tablet`||n===`phone`?n:`desktop`,helpers:!0,interact:!1,gizmo:`translate`,space:`world`,snap:!1,view:Sh(`view`)===`camera`?`camera`:`editor`,lightSel:null,dialog:t===`export`||t===`render`||t===`shortcuts`?t:null,flash:null,agentPulse:0,check:null,checkRunning:!1,addTab:Sh(`add`)??`primitives`}}var pC=e=>{let t=e.target;return!!t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)};function mC({backend:e,onClose:t}){let[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(null);return(0,C.useEffect)(()=>{let n=!1,i=new dC(t=>e.call(t.kind===`patch`?`scene_patch`:`scene_apply`,t.kind===`patch`?{ops:t.ops}:{scene:t.scene})),o=new Lb,s=C_(fC()),c=async()=>void 0;(async()=>{try{let[a,l,u]=await Promise.all([e.loadScene(),e.tools().catch(()=>[]),e.library().catch(()=>({assets:[]}))]);if(n)return;i.load(a);let d=Sh(`select`);d&&i.select(d),r({backend:e,store:i,player:o,ui:s,tools:l,library:u,edit(e,t){let n=i.edit(e,t);n&&kh({tone:`error`,title:xh(`edit.failed`),detail:n})},async runCheck(){s.set({checkRunning:!0,bottom:`check`});try{await i.flush();let t=await e.call(`check`,{});s.set({check:{...t,at:Date.now()}})}catch(e){kh({tone:`error`,title:xh(`check.failed`),detail:e.message})}finally{s.set({checkRunning:!1})}},reloadScene:e=>c(e),closeProject(){i.flush().then(t)}})}catch(e){n||a(e.message)}})();let l=async(t={})=>{let n=await e.loadScene(),r=i.getSnapshot().scene;if(!i.external(n))return;let a=um(r,n),o=[...a.objects.added,...a.objects.changed.map(e=>e.id),...a.objects.moved.map(e=>e.id)];s.set(e=>({flash:{ids:o,at:Date.now()},agentPulse:e.agentPulse+1})),t.toast!==!1&&kh({tone:`agent`,title:xh(`external.title`),detail:a.summary,action:{label:xh(`external.undo`),run:()=>i.undo()}},6e3)};c=l;let u=Sh(`events`)===`0`?()=>void 0:e.onChange(e=>{e.includes(`scene.json`)?l().catch(()=>void 0):e.some(e=>e.startsWith(`assets/`)||e.startsWith(`scripts/`))&&(s.set(e=>({agentPulse:e.agentPulse+1})),kh({tone:`agent`,title:xh(`external.files`),detail:e.slice(0,4).join(`, `)}))}),d=e=>{i.dirty&&(i.flush(),e.preventDefault())};return window.addEventListener(`beforeunload`,d),()=>{n=!0,u(),window.removeEventListener(`beforeunload`,d),i.flush(),o.dispose()}},[e,t]),i?(0,J.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 text-center`,children:[(0,J.jsx)(`div`,{className:`text-base font-medium`,children:xh(`app.loadFailed`)}),(0,J.jsx)(`div`,{className:`max-w-md text-sm text-fg-muted`,children:i})]}):n?(0,J.jsx)(T_.Provider,{value:n,children:(0,J.jsx)(hC,{})}):(0,J.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-fg-muted`,children:[(0,J.jsx)(gn,{size:16,className:`animate-spin`}),` `,xh(`app.loadingScene`)]})}function hC(){let e=O_(e=>e.assistant),t=O_(e=>e.dialog);return vC(),(0,J.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,J.jsx)(Tx,{}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,J.jsx)(wx,{}),(0,J.jsxs)(`div`,{className:`relative flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(Lx,{}),(0,J.jsx)(xb,{}),(0,J.jsx)(Mh,{})]}),(0,J.jsx)(uC,{}),e&&(0,J.jsx)(J_,{})]}),t===`export`&&(0,J.jsx)(Jb,{}),t===`render`&&(0,J.jsx)(Yb,{}),t===`shortcuts`&&(0,J.jsx)($b,{})]})}function gC(e){return(0,C.useMemo)(()=>t=>{let n=t.metaKey||t.ctrlKey,{store:r,ui:i,player:a}=e;if(n&&t.key.toLowerCase()===`z`){if(pC(t))return;t.preventDefault(),t.shiftKey?r.redo():r.undo();return}if(n&&t.key.toLowerCase()===`y`){if(pC(t))return;t.preventDefault(),r.redo();return}if(n&&t.key.toLowerCase()===`s`){t.preventDefault(),r.flush();return}if(pC(t))return;let o=r.getSnapshot(),s=o.selection;if(n&&t.key.toLowerCase()===`d`&&s&&o.scene){t.preventDefault();let n=Yg(o.scene,s);n&&e.edit(n.ops,{select:n.newId})}else if(!n)switch(t.key){case` `:t.preventDefault(),a.toggle(),i.set({});break;case`Escape`:r.select(null),i.set({lightSel:null});break;case`Delete`:case`Backspace`:{let n=i.get().lightSel;if(s)t.preventDefault(),e.edit([{op:`removeObject`,id:s}]);else if(n&&o.scene){let r=u_(o.scene,n.id);r>=0&&(t.preventDefault(),e.edit([{op:`remove`,path:`lights[${r}]`}]),i.set({lightSel:null}))}break}case`w`:case`e`:case`r`:i.set({gizmo:t.key===`w`?`translate`:t.key===`e`?`rotate`:`scale`,interact:!1});break;case`q`:i.set({interact:!1});break;case`x`:i.set(e=>({space:e.space===`world`?`local`:`world`}));break;case`c`:i.set(e=>({view:e.view===`editor`?`camera`:`editor`,interact:!1}));break;case`g`:i.set(e=>({helpers:!e.helpers}));break;case`f`:i.get().view===`camera`&&i.set({view:`editor`,interact:!1}),a.sceneEditor?.frameSelection();break;case`h`:if(s&&o.scene){let t=o.scene.objects&&_C(o.scene,s);e.edit(t===!1?[{op:`remove`,path:`objects#${s}.visible`}]:[{op:`set`,path:`objects#${s}.visible`,value:!1}])}break;case`t`:i.set(e=>({bottom:e.bottom===`timeline`?null:`timeline`}));break;case`j`:i.set(e=>({bottom:e.bottom===`json`?null:`json`}));break;case`a`:i.set(e=>({assistant:!e.assistant}));break;case`i`:i.set(e=>({interact:!e.interact}));break;case`?`:i.set({dialog:`shortcuts`})}},[e])}function _C(e,t){let n=!0,r=e=>{for(let i of e)i.id===t&&(n=i.visible!==!1),i.children&&r(i.children)};return r(e.objects),n}function vC(){let e=gC(E_());(0,C.useEffect)(()=>(window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)),[e])}var yC={banner:`linear-gradient(120deg,#1d2b64,#7c8cff 60%,#f8cdda)`,hero:`radial-gradient(circle at 30% 40%,#ff7eb3,#7a5cff 45%,#141629 80%)`,card:`linear-gradient(160deg,#2b2e3a,#545a6e 50%,#e9dccb)`,square:`conic-gradient(from 210deg at 50% 50%,#38f9ff,#7c8cff,#ff7eb3,#38f9ff)`,fullscreen:`linear-gradient(180deg,#5aa9e6 0%,#f6d5a8 55%,#4f8a4b 56%,#2d5a2a 100%)`,inline:`linear-gradient(135deg,#232526,#414345)`,game:`linear-gradient(135deg,#0f2027,#2c5364 60%,#f2b654)`},bC=[`banner`,`hero`,`card`,`square`,`fullscreen`,`game`];function xC({src:e,kind:t,aspect:n}){let[r,i]=(0,C.useState)(!e),[a,o]=n.split(`:`).map(Number);return(0,J.jsxs)(`div`,{className:`relative aspect-[16/10] overflow-hidden rounded-md bg-ink-2`,children:[!r&&e?(0,J.jsx)(`img`,{src:e,alt:``,className:`h-full w-full object-cover`,onError:()=>i(!0)}):(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,style:{background:yC[t]??yC.inline},children:(0,J.jsx)(`div`,{className:`rounded-[3px] border border-white/40 bg-white/10 shadow-lg backdrop-blur-sm`,style:{width:a>=o?`70%`:`${70*a/o/1.6}%`,aspectRatio:`${a} / ${o}`}})}),(0,J.jsxs)(`span`,{className:`absolute bottom-1.5 left-1.5 rounded bg-black/55 px-1.5 py-0.5 text-2xs font-medium text-white/90 backdrop-blur`,children:[t,` · `,n]})]})}function SC({backend:e,onOpened:t}){let{t:n}=K(),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(null),[d,f]=(0,C.useState)(`all`);(0,C.useEffect)(()=>{e.templates().then(i),e.recent().then(o)},[e]);let p=async(r,i)=>{if(e.mode!==`cli`||!e.hasProject()||window.confirm(n(`start.replaceConfirm`,{dir:e.location??``}))){c(r),u(null);try{await e.createProject({name:i.title,title:i.title,template:i.template,kind:i.kind}),t()}catch(e){u(e.message)}finally{c(null)}}},m=[`all`,...new Set((r??[]).map(e=>e.kind))],h=(r??[]).filter(e=>d===`all`||e.kind===d),g=e.canCreate();return(0,J.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,J.jsxs)(`div`,{className:`mx-auto max-w-[1180px] px-8 py-10`,children:[(0,J.jsxs)(`header`,{className:`mb-10 flex items-end justify-between gap-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(Dx,{size:34}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-[22px] font-semibold leading-tight tracking-tight`,children:`Agent3D Studio`}),(0,J.jsx)(`p`,{className:`mt-0.5 max-w-xl text-sm text-fg-muted`,children:n(`start.tagline`)})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.hasProject()&&(0,J.jsxs)(`button`,{type:`button`,onClick:t,className:`flex h-8 items-center gap-1.5 rounded-md bg-accent px-3 text-sm font-medium text-ink-0 hover:bg-accent/90`,children:[(0,J.jsx)(yt,{size:14}),` `,n(`start.continue`,{title:e.projectTitle()})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-line px-2.5 py-1.5 text-xs text-fg-muted`,children:[e.mode===`cli`?(0,J.jsx)(Lt,{size:12}):(0,J.jsx)(ze,{size:12}),e.mode===`cli`?n(`start.cliMode`,{v:e.version??``}):n(`start.localMode`)]})]})]}),!g&&(0,J.jsxs)(`div`,{className:`mb-8 flex gap-3 rounded-lg border border-line bg-ink-1 p-4`,children:[(0,J.jsx)(Wr,{size:16,className:`mt-0.5 shrink-0 text-accent`}),(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium`,children:n(`start.noFolderTitle`)}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n(`start.noFolderBody`)}),(0,J.jsxs)(`pre`,{className:`mt-2 rounded bg-ink-0 px-2 py-1.5 font-mono text-2xs text-fg`,children:[`agent3d new my-banner --template `,r?.[0]?.id??`<id>`,`
|
|
479
|
+
`,`agent3d studio --project my-banner`]})]})]}),l&&(0,J.jsx)(`div`,{className:`mb-6 rounded-md bg-danger/10 px-3 py-2 text-sm text-danger`,children:l}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[1fr_260px] gap-10`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 space-y-10`,children:[(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:n(`start.starters`)}),(0,J.jsx)(`span`,{className:`text-xs text-fg-faint`,children:n(`start.startersHint`)})]}),(0,J.jsx)(`div`,{className:`grid grid-cols-3 gap-3 xl:grid-cols-6`,children:bC.map(e=>(0,J.jsxs)(`button`,{type:`button`,disabled:!g||!!s,onClick:()=>void p(`kind:${e}`,{kind:e,title:n(`start.untitled.${e}`)}),className:`group rounded-lg p-1.5 text-left transition-colors hover:bg-ink-2 disabled:opacity-50`,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(xC,{src:null,kind:e,aspect:Jo[e]}),(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100`,children:(0,J.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-ink-0/80 text-fg`,children:s===`kind:${e}`?(0,J.jsx)(gn,{size:14,className:`animate-spin`}):(0,J.jsx)(Kn,{size:15})})})]}),(0,J.jsx)(`div`,{className:`mt-1.5 text-sm font-medium capitalize`,children:e}),(0,J.jsx)(`div`,{className:`text-2xs text-fg-faint`,children:n(`start.kinds.${e}`)})]},e))})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:n(`start.templates`)}),m.length>2&&(0,J.jsx)(`div`,{className:`flex gap-1`,children:m.map(e=>(0,J.jsx)(`button`,{type:`button`,onClick:()=>f(e),className:q(`rounded-md px-2 py-0.5 text-xs capitalize`,d===e?`bg-ink-3 text-fg`:`text-fg-muted hover:text-fg`),children:e===`all`?n(`start.all`):e},e))})]}),r===null?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,J.jsx)(gn,{size:14,className:`animate-spin`}),` `,n(`app.loading`)]}):h.length?(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-4 lg:grid-cols-3`,children:h.map(t=>(0,J.jsxs)(`button`,{type:`button`,disabled:!g||!!s,onClick:()=>void p(t.id,{template:t.id,title:t.title}),className:`group rounded-lg p-2 text-left transition-colors hover:bg-ink-2 disabled:opacity-60`,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(xC,{src:e.templatePreview(t.id),kind:t.kind,aspect:t.aspect??Jo[t.kind]??`16:9`}),s===t.id&&(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/40`,children:(0,J.jsx)(gn,{size:18,className:`animate-spin`})})]}),(0,J.jsx)(`div`,{className:`mt-2 text-sm font-medium`,children:t.title}),(0,J.jsx)(`div`,{className:`line-clamp-2 text-xs text-fg-muted`,children:t.description}),!!t.tags?.length&&(0,J.jsx)(`div`,{className:`mt-1 truncate text-2xs text-fg-faint`,children:t.tags.join(`, `)})]},t.id))}):(0,J.jsx)(`div`,{className:`rounded-lg border border-dashed border-line px-4 py-6 text-center text-xs text-fg-faint`,children:e.mode===`cli`?n(`start.noTemplates`):n(`start.noTemplatesLocal`)})]})]}),(0,J.jsxs)(`aside`,{children:[(0,J.jsx)(`h2`,{className:`mb-3 text-base font-semibold`,children:n(`start.recent`)}),a.length?(0,J.jsx)(`ul`,{className:`space-y-0.5`,children:a.map(r=>(0,J.jsxs)(`li`,{className:`group flex items-center gap-1`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:async()=>{e.mode===`cli`?r.id===e.location&&e.hasProject()&&t():(await e.open(r.id),t())},className:q(`flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-ink-2`,e.mode===`cli`&&r.id!==e.location&&`cursor-default opacity-60`),title:e.mode===`cli`&&r.id!==e.location?n(`start.otherFolder`,{dir:r.id}):r.id,children:[(0,J.jsx)(yt,{size:13,className:`shrink-0 text-fg-faint`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`truncate text-sm`,children:r.title}),(0,J.jsx)(`div`,{className:`truncate text-2xs text-fg-faint`,children:e.mode===`cli`?r.id:r.updatedAt?new Date(r.updatedAt).toLocaleString():``})]})]}),e.remove&&(0,J.jsx)(`button`,{type:`button`,"aria-label":n(`start.remove`),title:n(`start.remove`),onClick:async()=>(await e.remove(r.id),o(await e.recent())),className:`rounded p-1 text-fg-faint opacity-0 hover:text-danger group-hover:opacity-100`,children:(0,J.jsx)(Kr,{size:12})})]},r.id))}):(0,J.jsx)(`p`,{className:`text-xs text-fg-faint`,children:n(`start.noRecent`)}),(0,J.jsxs)(`div`,{className:`mt-8 rounded-lg border border-line p-3 text-xs leading-relaxed text-fg-muted`,children:[(0,J.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:n(`start.agentTitle`)}),n(`start.agentBody`)]})]})]})]})})}function CC(){let{t:e}=K(),[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(0);(0,C.useEffect)(()=>{let e=!1;return(async()=>{let t=await ah(),r;if(t)r=new sh(t);else{let e=new rh;await e.init();let t=Sh(`project`);t&&await e.open(t).catch(()=>void 0),r=e}e||(n(r),i(r.hasProject()&&Sh(`start`)!==`1`))})(),()=>{e=!0}},[]);let s=(0,C.useCallback)(()=>{o(e=>e+1),i(!0)},[]);return t?r?(0,J.jsx)(mC,{backend:t,onClose:()=>i(!1)},a):(0,J.jsx)(SC,{backend:t,onOpened:s}):(0,J.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-fg-muted`,children:[(0,J.jsx)(gn,{size:16,className:`animate-spin`}),` `,e(`app.loading`)]})}document.documentElement.lang=_h(),(0,xi.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(C.StrictMode,{children:(0,J.jsx)(CC,{})}));export{na as C,Yi as D,Ji as E,Zi as O,Da as S,$i as T,Ha as _,l_ as a,Ua as b,t_ as c,c_ as d,lf as f,Ja as g,Gl as h,s_ as i,Ti as k,r_ as l,sf as m,e_ as n,o_ as o,of as p,a_ as r,i_ as s,Tv as t,n_ as u,Ka as v,qi as w,Ba as x,Ga as y};
|