@probnaya/057-cli 0.1.1 → 0.2.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 +2 -2
- package/dist/assets/index-BQEdszeO.js +658 -0
- package/dist/index.html +1 -1
- package/dist-server/057.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/index-BInsdRgV.js +0 -658
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))l(u);new MutationObserver(u=>{for(const c of u)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function s(u){const c={};return u.integrity&&(c.integrity=u.integrity),u.referrerPolicy&&(c.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?c.credentials="include":u.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function l(u){if(u.ep)return;u.ep=!0;const c=s(u);fetch(u.href,c)}})();var Tc={exports:{}},Js={};var Om;function vx(){if(Om)return Js;Om=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(l,u,c){var d=null;if(c!==void 0&&(d=""+c),u.key!==void 0&&(d=""+u.key),"key"in u){c={};for(var h in u)h!=="key"&&(c[h]=u[h])}else c=u;return u=c.ref,{$$typeof:n,type:l,key:d,ref:u!==void 0?u:null,props:c}}return Js.Fragment=i,Js.jsx=s,Js.jsxs=s,Js}var zm;function bx(){return zm||(zm=1,Tc.exports=vx()),Tc.exports}var v=bx(),Ac={exports:{}},pe={};var _m;function xx(){if(_m)return pe;_m=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),D=Symbol.iterator;function V(w){return w===null||typeof w!="object"?null:(w=D&&w[D]||w["@@iterator"],typeof w=="function"?w:null)}var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,k={};function K(w,N,X){this.props=w,this.context=N,this.refs=k,this.updater=X||L}K.prototype.isReactComponent={},K.prototype.setState=function(w,N){if(typeof w!="object"&&typeof w!="function"&&w!=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,w,N,"setState")},K.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function B(){}B.prototype=K.prototype;function F(w,N,X){this.props=w,this.context=N,this.refs=k,this.updater=X||L}var H=F.prototype=new B;H.constructor=F,z(H,K.prototype),H.isPureReactComponent=!0;var Z=Array.isArray;function de(){}var M={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function G(w,N,X){var P=X.ref;return{$$typeof:n,type:w,key:N,ref:P!==void 0?P:null,props:X}}function W(w,N){return G(w.type,N,w.props)}function te(w){return typeof w=="object"&&w!==null&&w.$$typeof===n}function le(w){var N={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(X){return N[X]})}var $e=/\/+/g;function he(w,N){return typeof w=="object"&&w!==null&&w.key!=null?le(""+w.key):N.toString(36)}function re(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(de,de):(w.status="pending",w.then(function(N){w.status==="pending"&&(w.status="fulfilled",w.value=N)},function(N){w.status==="pending"&&(w.status="rejected",w.reason=N)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function R(w,N,X,P,ue){var fe=typeof w;(fe==="undefined"||fe==="boolean")&&(w=null);var me=!1;if(w===null)me=!0;else switch(fe){case"bigint":case"string":case"number":me=!0;break;case"object":switch(w.$$typeof){case n:case i:me=!0;break;case x:return me=w._init,R(me(w._payload),N,X,P,ue)}}if(me)return ue=ue(w),me=P===""?"."+he(w,0):P,Z(ue)?(X="",me!=null&&(X=me.replace($e,"$&/")+"/"),R(ue,N,X,"",function(gn){return gn})):ue!=null&&(te(ue)&&(ue=W(ue,X+(ue.key==null||w&&w.key===ue.key?"":(""+ue.key).replace($e,"$&/")+"/")+me)),N.push(ue)),1;me=0;var Ze=P===""?".":P+":";if(Z(w))for(var De=0;De<w.length;De++)P=w[De],fe=Ze+he(P,De),me+=R(P,N,X,fe,ue);else if(De=V(w),typeof De=="function")for(w=De.call(w),De=0;!(P=w.next()).done;)P=P.value,fe=Ze+he(P,De++),me+=R(P,N,X,fe,ue);else if(fe==="object"){if(typeof w.then=="function")return R(re(w),N,X,P,ue);throw N=String(w),Error("Objects are not valid as a React child (found: "+(N==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":N)+"). If you meant to render a collection of children, use an array instead.")}return me}function Y(w,N,X){if(w==null)return w;var P=[],ue=0;return R(w,P,"","",function(fe){return N.call(X,fe,ue++)}),P}function ae(w){if(w._status===-1){var N=w._result;N=N(),N.then(function(X){(w._status===0||w._status===-1)&&(w._status=1,w._result=X)},function(X){(w._status===0||w._status===-1)&&(w._status=2,w._result=X)}),w._status===-1&&(w._status=0,w._result=N)}if(w._status===1)return w._result.default;throw w._result}var Ae=typeof reportError=="function"?reportError:function(w){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var N=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof w=="object"&&w!==null&&typeof w.message=="string"?String(w.message):String(w),error:w});if(!window.dispatchEvent(N))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",w);return}console.error(w)},Re={map:Y,forEach:function(w,N,X){Y(w,function(){N.apply(this,arguments)},X)},count:function(w){var N=0;return Y(w,function(){N++}),N},toArray:function(w){return Y(w,function(N){return N})||[]},only:function(w){if(!te(w))throw Error("React.Children.only expected to receive a single React element child.");return w}};return pe.Activity=b,pe.Children=Re,pe.Component=K,pe.Fragment=s,pe.Profiler=u,pe.PureComponent=F,pe.StrictMode=l,pe.Suspense=m,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,pe.__COMPILER_RUNTIME={__proto__:null,c:function(w){return M.H.useMemoCache(w)}},pe.cache=function(w){return function(){return w.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(w,N,X){if(w==null)throw Error("The argument must be a React element, but you passed "+w+".");var P=z({},w.props),ue=w.key;if(N!=null)for(fe in N.key!==void 0&&(ue=""+N.key),N)!E.call(N,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&N.ref===void 0||(P[fe]=N[fe]);var fe=arguments.length-2;if(fe===1)P.children=X;else if(1<fe){for(var me=Array(fe),Ze=0;Ze<fe;Ze++)me[Ze]=arguments[Ze+2];P.children=me}return G(w.type,ue,P)},pe.createContext=function(w){return w={$$typeof:d,_currentValue:w,_currentValue2:w,_threadCount:0,Provider:null,Consumer:null},w.Provider=w,w.Consumer={$$typeof:c,_context:w},w},pe.createElement=function(w,N,X){var P,ue={},fe=null;if(N!=null)for(P in N.key!==void 0&&(fe=""+N.key),N)E.call(N,P)&&P!=="key"&&P!=="__self"&&P!=="__source"&&(ue[P]=N[P]);var me=arguments.length-2;if(me===1)ue.children=X;else if(1<me){for(var Ze=Array(me),De=0;De<me;De++)Ze[De]=arguments[De+2];ue.children=Ze}if(w&&w.defaultProps)for(P in me=w.defaultProps,me)ue[P]===void 0&&(ue[P]=me[P]);return G(w,fe,ue)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(w){return{$$typeof:h,render:w}},pe.isValidElement=te,pe.lazy=function(w){return{$$typeof:x,_payload:{_status:-1,_result:w},_init:ae}},pe.memo=function(w,N){return{$$typeof:g,type:w,compare:N===void 0?null:N}},pe.startTransition=function(w){var N=M.T,X={};M.T=X;try{var P=w(),ue=M.S;ue!==null&&ue(X,P),typeof P=="object"&&P!==null&&typeof P.then=="function"&&P.then(de,Ae)}catch(fe){Ae(fe)}finally{N!==null&&X.types!==null&&(N.types=X.types),M.T=N}},pe.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},pe.use=function(w){return M.H.use(w)},pe.useActionState=function(w,N,X){return M.H.useActionState(w,N,X)},pe.useCallback=function(w,N){return M.H.useCallback(w,N)},pe.useContext=function(w){return M.H.useContext(w)},pe.useDebugValue=function(){},pe.useDeferredValue=function(w,N){return M.H.useDeferredValue(w,N)},pe.useEffect=function(w,N){return M.H.useEffect(w,N)},pe.useEffectEvent=function(w){return M.H.useEffectEvent(w)},pe.useId=function(){return M.H.useId()},pe.useImperativeHandle=function(w,N,X){return M.H.useImperativeHandle(w,N,X)},pe.useInsertionEffect=function(w,N){return M.H.useInsertionEffect(w,N)},pe.useLayoutEffect=function(w,N){return M.H.useLayoutEffect(w,N)},pe.useMemo=function(w,N){return M.H.useMemo(w,N)},pe.useOptimistic=function(w,N){return M.H.useOptimistic(w,N)},pe.useReducer=function(w,N,X){return M.H.useReducer(w,N,X)},pe.useRef=function(w){return M.H.useRef(w)},pe.useState=function(w){return M.H.useState(w)},pe.useSyncExternalStore=function(w,N,X){return M.H.useSyncExternalStore(w,N,X)},pe.useTransition=function(){return M.H.useTransition()},pe.version="19.2.8",pe}var Um;function cf(){return Um||(Um=1,Ac.exports=xx()),Ac.exports}var Q=cf(),Mc={exports:{}},er={},Dc={exports:{}},Rc={};var Nm;function Sx(){return Nm||(Nm=1,(function(n){function i(R,Y){var ae=R.length;R.push(Y);e:for(;0<ae;){var Ae=ae-1>>>1,Re=R[Ae];if(0<u(Re,Y))R[Ae]=Y,R[ae]=Re,ae=Ae;else break e}}function s(R){return R.length===0?null:R[0]}function l(R){if(R.length===0)return null;var Y=R[0],ae=R.pop();if(ae!==Y){R[0]=ae;e:for(var Ae=0,Re=R.length,w=Re>>>1;Ae<w;){var N=2*(Ae+1)-1,X=R[N],P=N+1,ue=R[P];if(0>u(X,ae))P<Re&&0>u(ue,X)?(R[Ae]=ue,R[P]=ae,Ae=P):(R[Ae]=X,R[N]=ae,Ae=N);else if(P<Re&&0>u(ue,ae))R[Ae]=ue,R[P]=ae,Ae=P;else break e}}return Y}function u(R,Y){var ae=R.sortIndex-Y.sortIndex;return ae!==0?ae:R.id-Y.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();n.unstable_now=function(){return d.now()-h}}var m=[],g=[],x=1,b=null,D=3,V=!1,L=!1,z=!1,k=!1,K=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function H(R){for(var Y=s(g);Y!==null;){if(Y.callback===null)l(g);else if(Y.startTime<=R)l(g),Y.sortIndex=Y.expirationTime,i(m,Y);else break;Y=s(g)}}function Z(R){if(z=!1,H(R),!L)if(s(m)!==null)L=!0,de||(de=!0,le());else{var Y=s(g);Y!==null&&re(Z,Y.startTime-R)}}var de=!1,M=-1,E=5,G=-1;function W(){return k?!0:!(n.unstable_now()-G<E)}function te(){if(k=!1,de){var R=n.unstable_now();G=R;var Y=!0;try{e:{L=!1,z&&(z=!1,B(M),M=-1),V=!0;var ae=D;try{t:{for(H(R),b=s(m);b!==null&&!(b.expirationTime>R&&W());){var Ae=b.callback;if(typeof Ae=="function"){b.callback=null,D=b.priorityLevel;var Re=Ae(b.expirationTime<=R);if(R=n.unstable_now(),typeof Re=="function"){b.callback=Re,H(R),Y=!0;break t}b===s(m)&&l(m),H(R)}else l(m);b=s(m)}if(b!==null)Y=!0;else{var w=s(g);w!==null&&re(Z,w.startTime-R),Y=!1}}break e}finally{b=null,D=ae,V=!1}Y=void 0}}finally{Y?le():de=!1}}}var le;if(typeof F=="function")le=function(){F(te)};else if(typeof MessageChannel<"u"){var $e=new MessageChannel,he=$e.port2;$e.port1.onmessage=te,le=function(){he.postMessage(null)}}else le=function(){K(te,0)};function re(R,Y){M=K(function(){R(n.unstable_now())},Y)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(R){R.callback=null},n.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<R?Math.floor(1e3/R):5},n.unstable_getCurrentPriorityLevel=function(){return D},n.unstable_next=function(R){switch(D){case 1:case 2:case 3:var Y=3;break;default:Y=D}var ae=D;D=Y;try{return R()}finally{D=ae}},n.unstable_requestPaint=function(){k=!0},n.unstable_runWithPriority=function(R,Y){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var ae=D;D=R;try{return Y()}finally{D=ae}},n.unstable_scheduleCallback=function(R,Y,ae){var Ae=n.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?Ae+ae:Ae):ae=Ae,R){case 1:var Re=-1;break;case 2:Re=250;break;case 5:Re=1073741823;break;case 4:Re=1e4;break;default:Re=5e3}return Re=ae+Re,R={id:x++,callback:Y,priorityLevel:R,startTime:ae,expirationTime:Re,sortIndex:-1},ae>Ae?(R.sortIndex=ae,i(g,R),s(m)===null&&R===s(g)&&(z?(B(M),M=-1):z=!0,re(Z,ae-Ae))):(R.sortIndex=Re,i(m,R),L||V||(L=!0,de||(de=!0,le()))),R},n.unstable_shouldYield=W,n.unstable_wrapCallback=function(R){var Y=D;return function(){var ae=D;D=Y;try{return R.apply(this,arguments)}finally{D=ae}}}})(Rc)),Rc}var km;function wx(){return km||(km=1,Dc.exports=Sx()),Dc.exports}var Cc={exports:{}},wt={};var Lm;function Ex(){if(Lm)return wt;Lm=1;var n=cf();function i(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)g+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var l={d:{f:s,r:function(){throw Error(i(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},u=Symbol.for("react.portal");function c(m,g,x){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:b==null?null:""+b,children:m,containerInfo:g,implementation:x}}var d=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,g){if(m==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,wt.createPortal=function(m,g){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(i(299));return c(m,g,null,x)},wt.flushSync=function(m){var g=d.T,x=l.p;try{if(d.T=null,l.p=2,m)return m()}finally{d.T=g,l.p=x,l.d.f()}},wt.preconnect=function(m,g){typeof m=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,l.d.C(m,g))},wt.prefetchDNS=function(m){typeof m=="string"&&l.d.D(m)},wt.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var x=g.as,b=h(x,g.crossOrigin),D=typeof g.integrity=="string"?g.integrity:void 0,V=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;x==="style"?l.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:D,fetchPriority:V}):x==="script"&&l.d.X(m,{crossOrigin:b,integrity:D,fetchPriority:V,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},wt.preinitModule=function(m,g){if(typeof m=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var x=h(g.as,g.crossOrigin);l.d.M(m,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&l.d.M(m)},wt.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var x=g.as,b=h(x,g.crossOrigin);l.d.L(m,x,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},wt.preloadModule=function(m,g){if(typeof m=="string")if(g){var x=h(g.as,g.crossOrigin);l.d.m(m,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else l.d.m(m)},wt.requestFormReset=function(m){l.d.r(m)},wt.unstable_batchedUpdates=function(m,g){return m(g)},wt.useFormState=function(m,g,x){return d.H.useFormState(m,g,x)},wt.useFormStatus=function(){return d.H.useHostTransitionStatus()},wt.version="19.2.8",wt}var jm;function Tx(){if(jm)return Cc.exports;jm=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Cc.exports=Ex(),Cc.exports}var Bm;function Ax(){if(Bm)return er;Bm=1;var n=wx(),i=cf(),s=Tx();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}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 u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function d(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 h(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 m(e){if(c(e)!==e)throw Error(l(188))}function g(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(l(188));return t!==e?null:e}for(var a=e,r=t;;){var o=a.return;if(o===null)break;var f=o.alternate;if(f===null){if(r=o.return,r!==null){a=r;continue}break}if(o.child===f.child){for(f=o.child;f;){if(f===a)return m(o),e;if(f===r)return m(o),t;f=f.sibling}throw Error(l(188))}if(a.return!==r.return)a=o,r=f;else{for(var p=!1,y=o.child;y;){if(y===a){p=!0,a=o,r=f;break}if(y===r){p=!0,r=o,a=f;break}y=y.sibling}if(!p){for(y=f.child;y;){if(y===a){p=!0,a=f,r=o;break}if(y===r){p=!0,r=f,a=o;break}y=y.sibling}if(!p)throw Error(l(189))}}if(a.alternate!==r)throw Error(l(190))}if(a.tag!==3)throw Error(l(188));return a.stateNode.current===a?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,D=Symbol.for("react.element"),V=Symbol.for("react.transitional.element"),L=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),F=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),de=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function le(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var $e=Symbol.for("react.client.reference");function he(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===$e?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case z:return"Fragment";case K:return"Profiler";case k:return"StrictMode";case Z:return"Suspense";case de:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case L:return"Portal";case F:return e.displayName||"Context";case B:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case M:return t=e.displayName||null,t!==null?t:he(e.type)||"Memo";case E:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}var re=Array.isArray,R=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},Ae=[],Re=-1;function w(e){return{current:e}}function N(e){0>Re||(e.current=Ae[Re],Ae[Re]=null,Re--)}function X(e,t){Re++,Ae[Re]=e.current,e.current=t}var P=w(null),ue=w(null),fe=w(null),me=w(null);function Ze(e,t){switch(X(fe,t),X(ue,e),X(P,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Jp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jp(t),e=em(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}N(P),X(P,e)}function De(){N(P),N(ue),N(fe)}function gn(e){e.memoizedState!==null&&X(me,e);var t=P.current,a=em(t,e.type);t!==a&&(X(ue,e),X(P,a))}function Jn(e){ue.current===e&&(N(P),N(ue)),me.current===e&&(N(me),Qs._currentValue=ae)}var Mt,Mn;function be(e){if(Mt===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Mt=t&&t[1]||"",Mn=-1<a.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Mt+e+Mn}var yn=!1;function fn(e,t){if(!e||yn)return"";yn=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(U){var _=U}Reflect.construct(e,[],I)}else{try{I.call()}catch(U){_=U}e.call(I.prototype)}}else{try{throw Error()}catch(U){_=U}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(U){if(U&&_&&typeof U.stack=="string")return[U.stack,_.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=r.DetermineComponentFrameRoot(),p=f[0],y=f[1];if(p&&y){var S=p.split(`
|
|
4
|
+
`),O=y.split(`
|
|
5
|
+
`);for(o=r=0;r<S.length&&!S[r].includes("DetermineComponentFrameRoot");)r++;for(;o<O.length&&!O[o].includes("DetermineComponentFrameRoot");)o++;if(r===S.length||o===O.length)for(r=S.length-1,o=O.length-1;1<=r&&0<=o&&S[r]!==O[o];)o--;for(;1<=r&&0<=o;r--,o--)if(S[r]!==O[o]){if(r!==1||o!==1)do if(r--,o--,0>o||S[r]!==O[o]){var j=`
|
|
6
|
+
`+S[r].replace(" at new "," at ");return e.displayName&&j.includes("<anonymous>")&&(j=j.replace("<anonymous>",e.displayName)),j}while(1<=r&&0<=o);break}}}finally{yn=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?be(a):""}function ee(e,t){switch(e.tag){case 26:case 27:case 5:return be(e.type);case 16:return be("Lazy");case 13:return e.child!==t&&t!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return fn(e.type,!1);case 11:return fn(e.type.render,!1);case 1:return fn(e.type,!0);case 31:return be("Activity");default:return""}}function J(e){try{var t="",a=null;do t+=ee(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
|
|
7
|
+
Error generating stack: `+r.message+`
|
|
8
|
+
`+r.stack}}var ye=Object.prototype.hasOwnProperty,Ce=n.unstable_scheduleCallback,Ke=n.unstable_cancelCallback,Qe=n.unstable_shouldYield,Xt=n.unstable_requestPaint,Ve=n.unstable_now,dn=n.unstable_getCurrentPriorityLevel,xt=n.unstable_ImmediatePriority,kt=n.unstable_UserBlockingPriority,Dn=n.unstable_NormalPriority,la=n.unstable_LowPriority,Rn=n.unstable_IdlePriority,zi=n.log,Tt=n.unstable_setDisableYieldValue,ft=null,He=null;function St(e){if(typeof zi=="function"&&Tt(e),He&&typeof He.setStrictMode=="function")try{He.setStrictMode(ft,e)}catch{}}var tt=Math.clz32?Math.clz32:ls,_i=Math.log,Ui=Math.LN2;function ls(e){return e>>>=0,e===0?32:31-(_i(e)/Ui|0)|0}var gr=256,yr=262144,vr=4194304;function Ni(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function br(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var o=0,f=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var y=r&134217727;return y!==0?(r=y&~f,r!==0?o=Ni(r):(p&=y,p!==0?o=Ni(p):a||(a=y&~e,a!==0&&(o=Ni(a))))):(y=r&~f,y!==0?o=Ni(y):p!==0?o=Ni(p):a||(a=r&~e,a!==0&&(o=Ni(a)))),o===0?0:t!==0&&t!==o&&(t&f)===0&&(f=o&-o,a=t&-t,f>=a||f===32&&(a&4194048)!==0)?t:o}function us(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function sv(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 Nf(){var e=vr;return vr<<=1,(vr&62914560)===0&&(vr=4194304),e}function fu(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function os(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rv(e,t,a,r,o,f){var p=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var y=e.entanglements,S=e.expirationTimes,O=e.hiddenUpdates;for(a=p&~a;0<a;){var j=31-tt(a),I=1<<j;y[j]=0,S[j]=-1;var _=O[j];if(_!==null)for(O[j]=null,j=0;j<_.length;j++){var U=_[j];U!==null&&(U.lane&=-536870913)}a&=~I}r!==0&&kf(e,r,0),f!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=f&~(p&~t))}function kf(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-tt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function Lf(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-tt(a),o=1<<r;o&t|e[r]&t&&(e[r]|=t),a&=~o}}function jf(e,t){var a=t&-t;return a=(a&42)!==0?1:du(a),(a&(e.suspendedLanes|t))!==0?0:a}function du(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 hu(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Bf(){var e=Y.p;return e!==0?e:(e=window.event,e===void 0?32:Em(e.type))}function Gf(e,t){var a=Y.p;try{return Y.p=e,t()}finally{Y.p=a}}var ei=Math.random().toString(36).slice(2),mt="__reactFiber$"+ei,Dt="__reactProps$"+ei,ua="__reactContainer$"+ei,pu="__reactEvents$"+ei,lv="__reactListeners$"+ei,uv="__reactHandles$"+ei,$f="__reactResources$"+ei,cs="__reactMarker$"+ei;function mu(e){delete e[mt],delete e[Dt],delete e[pu],delete e[lv],delete e[uv]}function oa(e){var t=e[mt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[ua]||a[mt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=lm(e);e!==null;){if(a=e[mt])return a;e=lm(e)}return t}e=a,a=e.parentNode}return null}function ca(e){if(e=e[mt]||e[ua]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function fs(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function fa(e){var t=e[$f];return t||(t=e[$f]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function dt(e){e[cs]=!0}var Vf=new Set,If={};function ki(e,t){da(e,t),da(e+"Capture",t)}function da(e,t){for(If[e]=t,e=0;e<t.length;e++)Vf.add(t[e])}var ov=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]*$"),Ff={},Hf={};function cv(e){return ye.call(Hf,e)?!0:ye.call(Ff,e)?!1:ov.test(e)?Hf[e]=!0:(Ff[e]=!0,!1)}function xr(e,t,a){if(cv(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){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,""+a)}}function Sr(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Cn(e,t,a,r){if(r===null)e.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+r)}}function Kt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function fv(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,f=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(p){a=""+p,f.call(this,p)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(p){a=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gu(e){if(!e._valueTracker){var t=qf(e)?"checked":"value";e._valueTracker=fv(e,t,""+e[t])}}function Yf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=qf(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function wr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var dv=/[\n"\\]/g;function Qt(e){return e.replace(dv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function yu(e,t,a,r,o,f,p,y){e.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.type=p:e.removeAttribute("type"),t!=null?p==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Kt(t)):e.value!==""+Kt(t)&&(e.value=""+Kt(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?vu(e,p,Kt(t)):a!=null?vu(e,p,Kt(a)):r!=null&&e.removeAttribute("value"),o==null&&f!=null&&(e.defaultChecked=!!f),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.name=""+Kt(y):e.removeAttribute("name")}function Xf(e,t,a,r,o,f,p,y){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||a!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){gu(e);return}a=a!=null?""+Kt(a):"",t=t!=null?""+Kt(t):a,y||t===e.value||(e.value=t),e.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=y?e.checked:!!r,e.defaultChecked=!!r,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),gu(e)}function vu(e,t,a){t==="number"&&wr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ha(e,t,a,r){if(e=e.options,t){t={};for(var o=0;o<a.length;o++)t["$"+a[o]]=!0;for(a=0;a<e.length;a++)o=t.hasOwnProperty("$"+e[a].value),e[a].selected!==o&&(e[a].selected=o),o&&r&&(e[a].defaultSelected=!0)}else{for(a=""+Kt(a),t=null,o=0;o<e.length;o++){if(e[o].value===a){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Kf(e,t,a){if(t!=null&&(t=""+Kt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Kt(a):""}function Qf(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(l(92));if(re(r)){if(1<r.length)throw Error(l(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=Kt(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),gu(e)}function pa(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var hv=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 Pf(e,t,a){var r=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,a):typeof a!="number"||a===0||hv.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Zf(e,t,a){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var o in t)r=t[o],t.hasOwnProperty(o)&&a[o]!==r&&Pf(e,o,r)}else for(var f in t)t.hasOwnProperty(f)&&Pf(e,f,t[f])}function bu(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 pv=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),mv=/^[\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 Er(e){return mv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function On(){}var xu=null;function Su(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ma=null,ga=null;function Wf(e){var t=ca(e);if(t&&(e=t.stateNode)){var a=e[Dt]||null;e:switch(e=t.stateNode,t.type){case"input":if(yu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Qt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var o=r[Dt]||null;if(!o)throw Error(l(90));yu(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&Yf(r)}break e;case"textarea":Kf(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&ha(e,!!a.multiple,t,!1)}}}var wu=!1;function Jf(e,t,a){if(wu)return e(t,a);wu=!0;try{var r=e(t);return r}finally{if(wu=!1,(ma!==null||ga!==null)&&(cl(),ma&&(t=ma,e=ga,ga=ma=null,Wf(t),e)))for(t=0;t<e.length;t++)Wf(e[t])}}function ds(e,t){var a=e.stateNode;if(a===null)return null;var r=a[Dt]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(l(231,t,typeof a));return a}var zn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Eu=!1;if(zn)try{var hs={};Object.defineProperty(hs,"passive",{get:function(){Eu=!0}}),window.addEventListener("test",hs,hs),window.removeEventListener("test",hs,hs)}catch{Eu=!1}var ti=null,Tu=null,Tr=null;function ed(){if(Tr)return Tr;var e,t=Tu,a=t.length,r,o="value"in ti?ti.value:ti.textContent,f=o.length;for(e=0;e<a&&t[e]===o[e];e++);var p=a-e;for(r=1;r<=p&&t[a-r]===o[f-r];r++);return Tr=o.slice(e,1<r?1-r:void 0)}function Ar(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 Mr(){return!0}function td(){return!1}function Rt(e){function t(a,r,o,f,p){this._reactName=a,this._targetInst=o,this.type=r,this.nativeEvent=f,this.target=p,this.currentTarget=null;for(var y in e)e.hasOwnProperty(y)&&(a=e[y],this[y]=a?a(f):f[y]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Mr:td,this.isPropagationStopped=td,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Mr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Mr)},persist:function(){},isPersistent:Mr}),t}var Li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dr=Rt(Li),ps=b({},Li,{view:0,detail:0}),gv=Rt(ps),Au,Mu,ms,Rr=b({},ps,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ru,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!==ms&&(ms&&e.type==="mousemove"?(Au=e.screenX-ms.screenX,Mu=e.screenY-ms.screenY):Mu=Au=0,ms=e),Au)},movementY:function(e){return"movementY"in e?e.movementY:Mu}}),nd=Rt(Rr),yv=b({},Rr,{dataTransfer:0}),vv=Rt(yv),bv=b({},ps,{relatedTarget:0}),Du=Rt(bv),xv=b({},Li,{animationName:0,elapsedTime:0,pseudoElement:0}),Sv=Rt(xv),wv=b({},Li,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ev=Rt(wv),Tv=b({},Li,{data:0}),id=Rt(Tv),Av={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Mv={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"},Dv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Rv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Dv[e])?!!t[e]:!1}function Ru(){return Rv}var Cv=b({},ps,{key:function(e){if(e.key){var t=Av[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ar(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Mv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ru,charCode:function(e){return e.type==="keypress"?Ar(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ar(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ov=Rt(Cv),zv=b({},Rr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ad=Rt(zv),_v=b({},ps,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ru}),Uv=Rt(_v),Nv=b({},Li,{propertyName:0,elapsedTime:0,pseudoElement:0}),kv=Rt(Nv),Lv=b({},Rr,{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}),jv=Rt(Lv),Bv=b({},Li,{newState:0,oldState:0}),Gv=Rt(Bv),$v=[9,13,27,32],Cu=zn&&"CompositionEvent"in window,gs=null;zn&&"documentMode"in document&&(gs=document.documentMode);var Vv=zn&&"TextEvent"in window&&!gs,sd=zn&&(!Cu||gs&&8<gs&&11>=gs),rd=" ",ld=!1;function ud(e,t){switch(e){case"keyup":return $v.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function od(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ya=!1;function Iv(e,t){switch(e){case"compositionend":return od(t);case"keypress":return t.which!==32?null:(ld=!0,rd);case"textInput":return e=t.data,e===rd&&ld?null:e;default:return null}}function Fv(e,t){if(ya)return e==="compositionend"||!Cu&&ud(e,t)?(e=ed(),Tr=Tu=ti=null,ya=!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 sd&&t.locale!=="ko"?null:t.data;default:return null}}var Hv={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 cd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Hv[e.type]:t==="textarea"}function fd(e,t,a,r){ma?ga?ga.push(r):ga=[r]:ma=r,t=yl(t,"onChange"),0<t.length&&(a=new Dr("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var ys=null,vs=null;function qv(e){Xp(e,0)}function Cr(e){var t=fs(e);if(Yf(t))return e}function dd(e,t){if(e==="change")return t}var hd=!1;if(zn){var Ou;if(zn){var zu="oninput"in document;if(!zu){var pd=document.createElement("div");pd.setAttribute("oninput","return;"),zu=typeof pd.oninput=="function"}Ou=zu}else Ou=!1;hd=Ou&&(!document.documentMode||9<document.documentMode)}function md(){ys&&(ys.detachEvent("onpropertychange",gd),vs=ys=null)}function gd(e){if(e.propertyName==="value"&&Cr(vs)){var t=[];fd(t,vs,e,Su(e)),Jf(qv,t)}}function Yv(e,t,a){e==="focusin"?(md(),ys=t,vs=a,ys.attachEvent("onpropertychange",gd)):e==="focusout"&&md()}function Xv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Cr(vs)}function Kv(e,t){if(e==="click")return Cr(t)}function Qv(e,t){if(e==="input"||e==="change")return Cr(t)}function Pv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Lt=typeof Object.is=="function"?Object.is:Pv;function bs(e,t){if(Lt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var o=a[r];if(!ye.call(t,o)||!Lt(e[o],t[o]))return!1}return!0}function yd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vd(e,t){var a=yd(e);e=0;for(var r;a;){if(a.nodeType===3){if(r=e+a.textContent.length,e<=t&&r>=t)return{node:a,offset:t-e};e=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=yd(a)}}function bd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?bd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=wr(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=wr(e.document)}return t}function _u(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 Zv=zn&&"documentMode"in document&&11>=document.documentMode,va=null,Uu=null,xs=null,Nu=!1;function Sd(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Nu||va==null||va!==wr(r)||(r=va,"selectionStart"in r&&_u(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}),xs&&bs(xs,r)||(xs=r,r=yl(Uu,"onSelect"),0<r.length&&(t=new Dr("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=va)))}function ji(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var ba={animationend:ji("Animation","AnimationEnd"),animationiteration:ji("Animation","AnimationIteration"),animationstart:ji("Animation","AnimationStart"),transitionrun:ji("Transition","TransitionRun"),transitionstart:ji("Transition","TransitionStart"),transitioncancel:ji("Transition","TransitionCancel"),transitionend:ji("Transition","TransitionEnd")},ku={},wd={};zn&&(wd=document.createElement("div").style,"AnimationEvent"in window||(delete ba.animationend.animation,delete ba.animationiteration.animation,delete ba.animationstart.animation),"TransitionEvent"in window||delete ba.transitionend.transition);function Bi(e){if(ku[e])return ku[e];if(!ba[e])return e;var t=ba[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in wd)return ku[e]=t[a];return e}var Ed=Bi("animationend"),Td=Bi("animationiteration"),Ad=Bi("animationstart"),Wv=Bi("transitionrun"),Jv=Bi("transitionstart"),eb=Bi("transitioncancel"),Md=Bi("transitionend"),Dd=new Map,Lu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Lu.push("scrollEnd");function hn(e,t){Dd.set(e,t),ki(t,[e])}var Or=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!==null&&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)},Pt=[],xa=0,ju=0;function zr(){for(var e=xa,t=ju=xa=0;t<e;){var a=Pt[t];Pt[t++]=null;var r=Pt[t];Pt[t++]=null;var o=Pt[t];Pt[t++]=null;var f=Pt[t];if(Pt[t++]=null,r!==null&&o!==null){var p=r.pending;p===null?o.next=o:(o.next=p.next,p.next=o),r.pending=o}f!==0&&Rd(a,o,f)}}function _r(e,t,a,r){Pt[xa++]=e,Pt[xa++]=t,Pt[xa++]=a,Pt[xa++]=r,ju|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Bu(e,t,a,r){return _r(e,t,a,r),Ur(e)}function Gi(e,t){return _r(e,null,null,t),Ur(e)}function Rd(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var o=!1,f=e.return;f!==null;)f.childLanes|=a,r=f.alternate,r!==null&&(r.childLanes|=a),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(o=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,o&&t!==null&&(o=31-tt(a),e=f.hiddenUpdates,r=e[o],r===null?e[o]=[t]:r.push(t),t.lane=a|536870912),f):null}function Ur(e){if(50<Is)throw Is=0,Ko=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Sa={};function tb(e,t,a,r){this.tag=e,this.key=a,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 jt(e,t,a,r){return new tb(e,t,a,r)}function Gu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _n(e,t){var a=e.alternate;return a===null?(a=jt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Cd(e,t){e.flags&=65011714;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Nr(e,t,a,r,o,f){var p=0;if(r=e,typeof e=="function")Gu(e)&&(p=1);else if(typeof e=="string")p=rx(e,a,P.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=jt(31,a,t,o),e.elementType=G,e.lanes=f,e;case z:return $i(a.children,o,f,t);case k:p=8,o|=24;break;case K:return e=jt(12,a,t,o|2),e.elementType=K,e.lanes=f,e;case Z:return e=jt(13,a,t,o),e.elementType=Z,e.lanes=f,e;case de:return e=jt(19,a,t,o),e.elementType=de,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case F:p=10;break e;case B:p=9;break e;case H:p=11;break e;case M:p=14;break e;case E:p=16,r=null;break e}p=29,a=Error(l(130,e===null?"null":typeof e,"")),r=null}return t=jt(p,a,t,o),t.elementType=e,t.type=r,t.lanes=f,t}function $i(e,t,a,r){return e=jt(7,e,r,t),e.lanes=a,e}function $u(e,t,a){return e=jt(6,e,null,t),e.lanes=a,e}function Od(e){var t=jt(18,null,null,0);return t.stateNode=e,t}function Vu(e,t,a){return t=jt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var zd=new WeakMap;function Zt(e,t){if(typeof e=="object"&&e!==null){var a=zd.get(e);return a!==void 0?a:(t={value:e,source:t,stack:J(t)},zd.set(e,t),t)}return{value:e,source:t,stack:J(t)}}var wa=[],Ea=0,kr=null,Ss=0,Wt=[],Jt=0,ni=null,vn=1,bn="";function Un(e,t){wa[Ea++]=Ss,wa[Ea++]=kr,kr=e,Ss=t}function _d(e,t,a){Wt[Jt++]=vn,Wt[Jt++]=bn,Wt[Jt++]=ni,ni=e;var r=vn;e=bn;var o=32-tt(r)-1;r&=~(1<<o),a+=1;var f=32-tt(t)+o;if(30<f){var p=o-o%5;f=(r&(1<<p)-1).toString(32),r>>=p,o-=p,vn=1<<32-tt(t)+o|a<<o|r,bn=f+e}else vn=1<<f|a<<o|r,bn=e}function Iu(e){e.return!==null&&(Un(e,1),_d(e,1,0))}function Fu(e){for(;e===kr;)kr=wa[--Ea],wa[Ea]=null,Ss=wa[--Ea],wa[Ea]=null;for(;e===ni;)ni=Wt[--Jt],Wt[Jt]=null,bn=Wt[--Jt],Wt[Jt]=null,vn=Wt[--Jt],Wt[Jt]=null}function Ud(e,t){Wt[Jt++]=vn,Wt[Jt++]=bn,Wt[Jt++]=ni,vn=t.id,bn=t.overflow,ni=e}var gt=null,Ie=null,Me=!1,ii=null,en=!1,Hu=Error(l(519));function ai(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ws(Zt(t,e)),Hu}function Nd(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[mt]=e,t[Dt]=r,a){case"dialog":Se("cancel",t),Se("close",t);break;case"iframe":case"object":case"embed":Se("load",t);break;case"video":case"audio":for(a=0;a<Hs.length;a++)Se(Hs[a],t);break;case"source":Se("error",t);break;case"img":case"image":case"link":Se("error",t),Se("load",t);break;case"details":Se("toggle",t);break;case"input":Se("invalid",t),Xf(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Se("invalid",t);break;case"textarea":Se("invalid",t),Qf(t,r.value,r.defaultValue,r.children)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||r.suppressHydrationWarning===!0||Zp(t.textContent,a)?(r.popover!=null&&(Se("beforetoggle",t),Se("toggle",t)),r.onScroll!=null&&Se("scroll",t),r.onScrollEnd!=null&&Se("scrollend",t),r.onClick!=null&&(t.onclick=On),t=!0):t=!1,t||ai(e,!0)}function kd(e){for(gt=e.return;gt;)switch(gt.tag){case 5:case 31:case 13:en=!1;return;case 27:case 3:en=!0;return;default:gt=gt.return}}function Ta(e){if(e!==gt)return!1;if(!Me)return kd(e),Me=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||oc(e.type,e.memoizedProps)),a=!a),a&&Ie&&ai(e),kd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ie=rm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ie=rm(e)}else t===27?(t=Ie,vi(e.type)?(e=pc,pc=null,Ie=e):Ie=t):Ie=gt?nn(e.stateNode.nextSibling):null;return!0}function Vi(){Ie=gt=null,Me=!1}function qu(){var e=ii;return e!==null&&(_t===null?_t=e:_t.push.apply(_t,e),ii=null),e}function ws(e){ii===null?ii=[e]:ii.push(e)}var Yu=w(null),Ii=null,Nn=null;function si(e,t,a){X(Yu,t._currentValue),t._currentValue=a}function kn(e){e._currentValue=Yu.current,N(Yu)}function Xu(e,t,a){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===a)break;e=e.return}}function Ku(e,t,a,r){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var f=o.dependencies;if(f!==null){var p=o.child;f=f.firstContext;e:for(;f!==null;){var y=f;f=o;for(var S=0;S<t.length;S++)if(y.context===t[S]){f.lanes|=a,y=f.alternate,y!==null&&(y.lanes|=a),Xu(f.return,a,e),r||(p=null);break e}f=y.next}}else if(o.tag===18){if(p=o.return,p===null)throw Error(l(341));p.lanes|=a,f=p.alternate,f!==null&&(f.lanes|=a),Xu(p,a,e),p=null}else p=o.child;if(p!==null)p.return=o;else for(p=o;p!==null;){if(p===e){p=null;break}if(o=p.sibling,o!==null){o.return=p.return,p=o;break}p=p.return}o=p}}function Aa(e,t,a,r){e=null;for(var o=t,f=!1;o!==null;){if(!f){if((o.flags&524288)!==0)f=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var p=o.alternate;if(p===null)throw Error(l(387));if(p=p.memoizedProps,p!==null){var y=o.type;Lt(o.pendingProps.value,p.value)||(e!==null?e.push(y):e=[y])}}else if(o===me.current){if(p=o.alternate,p===null)throw Error(l(387));p.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(Qs):e=[Qs])}o=o.return}e!==null&&Ku(t,e,a,r),t.flags|=262144}function Lr(e){for(e=e.firstContext;e!==null;){if(!Lt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Fi(e){Ii=e,Nn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return Ld(Ii,e)}function jr(e,t){return Ii===null&&Fi(e),Ld(e,t)}function Ld(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Nn===null){if(e===null)throw Error(l(308));Nn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Nn=Nn.next=t;return a}var nb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},ib=n.unstable_scheduleCallback,ab=n.unstable_NormalPriority,st={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qu(){return{controller:new nb,data:new Map,refCount:0}}function Es(e){e.refCount--,e.refCount===0&&ib(ab,function(){e.controller.abort()})}var Ts=null,Pu=0,Ma=0,Da=null;function sb(e,t){if(Ts===null){var a=Ts=[];Pu=0,Ma=ec(),Da={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Pu++,t.then(jd,jd),t}function jd(){if(--Pu===0&&Ts!==null){Da!==null&&(Da.status="fulfilled");var e=Ts;Ts=null,Ma=0,Da=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function rb(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(o){a.push(o)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var o=0;o<a.length;o++)(0,a[o])(t)},function(o){for(r.status="rejected",r.reason=o,o=0;o<a.length;o++)(0,a[o])(void 0)}),r}var Bd=R.S;R.S=function(e,t){Sp=Ve(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&sb(e,t),Bd!==null&&Bd(e,t)};var Hi=w(null);function Zu(){var e=Hi.current;return e!==null?e:Ge.pooledCache}function Br(e,t){t===null?X(Hi,Hi.current):X(Hi,t.pool)}function Gd(){var e=Zu();return e===null?null:{parent:st._currentValue,pool:e}}var Ra=Error(l(460)),Wu=Error(l(474)),Gr=Error(l(542)),$r={then:function(){}};function $d(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Vd(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(On,On),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Fd(e),e;default:if(typeof t.status=="string")t.then(On,On);else{if(e=Ge,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=r}},function(r){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Fd(e),e}throw Yi=t,Ra}}function qi(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Yi=a,Ra):a}}var Yi=null;function Id(){if(Yi===null)throw Error(l(459));var e=Yi;return Yi=null,e}function Fd(e){if(e===Ra||e===Gr)throw Error(l(483))}var Ca=null,As=0;function Vr(e){var t=As;return As+=1,Ca===null&&(Ca=[]),Vd(Ca,e,t)}function Ms(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ir(e,t){throw t.$$typeof===D?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Hd(e){function t(A,T){if(e){var C=A.deletions;C===null?(A.deletions=[T],A.flags|=16):C.push(T)}}function a(A,T){if(!e)return null;for(;T!==null;)t(A,T),T=T.sibling;return null}function r(A){for(var T=new Map;A!==null;)A.key!==null?T.set(A.key,A):T.set(A.index,A),A=A.sibling;return T}function o(A,T){return A=_n(A,T),A.index=0,A.sibling=null,A}function f(A,T,C){return A.index=C,e?(C=A.alternate,C!==null?(C=C.index,C<T?(A.flags|=67108866,T):C):(A.flags|=67108866,T)):(A.flags|=1048576,T)}function p(A){return e&&A.alternate===null&&(A.flags|=67108866),A}function y(A,T,C,$){return T===null||T.tag!==6?(T=$u(C,A.mode,$),T.return=A,T):(T=o(T,C),T.return=A,T)}function S(A,T,C,$){var oe=C.type;return oe===z?j(A,T,C.props.children,$,C.key):T!==null&&(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===E&&qi(oe)===T.type)?(T=o(T,C.props),Ms(T,C),T.return=A,T):(T=Nr(C.type,C.key,C.props,null,A.mode,$),Ms(T,C),T.return=A,T)}function O(A,T,C,$){return T===null||T.tag!==4||T.stateNode.containerInfo!==C.containerInfo||T.stateNode.implementation!==C.implementation?(T=Vu(C,A.mode,$),T.return=A,T):(T=o(T,C.children||[]),T.return=A,T)}function j(A,T,C,$,oe){return T===null||T.tag!==7?(T=$i(C,A.mode,$,oe),T.return=A,T):(T=o(T,C),T.return=A,T)}function I(A,T,C){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=$u(""+T,A.mode,C),T.return=A,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case V:return C=Nr(T.type,T.key,T.props,null,A.mode,C),Ms(C,T),C.return=A,C;case L:return T=Vu(T,A.mode,C),T.return=A,T;case E:return T=qi(T),I(A,T,C)}if(re(T)||le(T))return T=$i(T,A.mode,C,null),T.return=A,T;if(typeof T.then=="function")return I(A,Vr(T),C);if(T.$$typeof===F)return I(A,jr(A,T),C);Ir(A,T)}return null}function _(A,T,C,$){var oe=T!==null?T.key:null;if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return oe!==null?null:y(A,T,""+C,$);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case V:return C.key===oe?S(A,T,C,$):null;case L:return C.key===oe?O(A,T,C,$):null;case E:return C=qi(C),_(A,T,C,$)}if(re(C)||le(C))return oe!==null?null:j(A,T,C,$,null);if(typeof C.then=="function")return _(A,T,Vr(C),$);if(C.$$typeof===F)return _(A,T,jr(A,C),$);Ir(A,C)}return null}function U(A,T,C,$,oe){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return A=A.get(C)||null,y(T,A,""+$,oe);if(typeof $=="object"&&$!==null){switch($.$$typeof){case V:return A=A.get($.key===null?C:$.key)||null,S(T,A,$,oe);case L:return A=A.get($.key===null?C:$.key)||null,O(T,A,$,oe);case E:return $=qi($),U(A,T,C,$,oe)}if(re($)||le($))return A=A.get(C)||null,j(T,A,$,oe,null);if(typeof $.then=="function")return U(A,T,C,Vr($),oe);if($.$$typeof===F)return U(A,T,C,jr(T,$),oe);Ir(T,$)}return null}function ne(A,T,C,$){for(var oe=null,Oe=null,se=T,ve=T=0,Te=null;se!==null&&ve<C.length;ve++){se.index>ve?(Te=se,se=null):Te=se.sibling;var ze=_(A,se,C[ve],$);if(ze===null){se===null&&(se=Te);break}e&&se&&ze.alternate===null&&t(A,se),T=f(ze,T,ve),Oe===null?oe=ze:Oe.sibling=ze,Oe=ze,se=Te}if(ve===C.length)return a(A,se),Me&&Un(A,ve),oe;if(se===null){for(;ve<C.length;ve++)se=I(A,C[ve],$),se!==null&&(T=f(se,T,ve),Oe===null?oe=se:Oe.sibling=se,Oe=se);return Me&&Un(A,ve),oe}for(se=r(se);ve<C.length;ve++)Te=U(se,A,ve,C[ve],$),Te!==null&&(e&&Te.alternate!==null&&se.delete(Te.key===null?ve:Te.key),T=f(Te,T,ve),Oe===null?oe=Te:Oe.sibling=Te,Oe=Te);return e&&se.forEach(function(Ei){return t(A,Ei)}),Me&&Un(A,ve),oe}function ce(A,T,C,$){if(C==null)throw Error(l(151));for(var oe=null,Oe=null,se=T,ve=T=0,Te=null,ze=C.next();se!==null&&!ze.done;ve++,ze=C.next()){se.index>ve?(Te=se,se=null):Te=se.sibling;var Ei=_(A,se,ze.value,$);if(Ei===null){se===null&&(se=Te);break}e&&se&&Ei.alternate===null&&t(A,se),T=f(Ei,T,ve),Oe===null?oe=Ei:Oe.sibling=Ei,Oe=Ei,se=Te}if(ze.done)return a(A,se),Me&&Un(A,ve),oe;if(se===null){for(;!ze.done;ve++,ze=C.next())ze=I(A,ze.value,$),ze!==null&&(T=f(ze,T,ve),Oe===null?oe=ze:Oe.sibling=ze,Oe=ze);return Me&&Un(A,ve),oe}for(se=r(se);!ze.done;ve++,ze=C.next())ze=U(se,A,ve,ze.value,$),ze!==null&&(e&&ze.alternate!==null&&se.delete(ze.key===null?ve:ze.key),T=f(ze,T,ve),Oe===null?oe=ze:Oe.sibling=ze,Oe=ze);return e&&se.forEach(function(yx){return t(A,yx)}),Me&&Un(A,ve),oe}function Be(A,T,C,$){if(typeof C=="object"&&C!==null&&C.type===z&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case V:e:{for(var oe=C.key;T!==null;){if(T.key===oe){if(oe=C.type,oe===z){if(T.tag===7){a(A,T.sibling),$=o(T,C.props.children),$.return=A,A=$;break e}}else if(T.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===E&&qi(oe)===T.type){a(A,T.sibling),$=o(T,C.props),Ms($,C),$.return=A,A=$;break e}a(A,T);break}else t(A,T);T=T.sibling}C.type===z?($=$i(C.props.children,A.mode,$,C.key),$.return=A,A=$):($=Nr(C.type,C.key,C.props,null,A.mode,$),Ms($,C),$.return=A,A=$)}return p(A);case L:e:{for(oe=C.key;T!==null;){if(T.key===oe)if(T.tag===4&&T.stateNode.containerInfo===C.containerInfo&&T.stateNode.implementation===C.implementation){a(A,T.sibling),$=o(T,C.children||[]),$.return=A,A=$;break e}else{a(A,T);break}else t(A,T);T=T.sibling}$=Vu(C,A.mode,$),$.return=A,A=$}return p(A);case E:return C=qi(C),Be(A,T,C,$)}if(re(C))return ne(A,T,C,$);if(le(C)){if(oe=le(C),typeof oe!="function")throw Error(l(150));return C=oe.call(C),ce(A,T,C,$)}if(typeof C.then=="function")return Be(A,T,Vr(C),$);if(C.$$typeof===F)return Be(A,T,jr(A,C),$);Ir(A,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,T!==null&&T.tag===6?(a(A,T.sibling),$=o(T,C),$.return=A,A=$):(a(A,T),$=$u(C,A.mode,$),$.return=A,A=$),p(A)):a(A,T)}return function(A,T,C,$){try{As=0;var oe=Be(A,T,C,$);return Ca=null,oe}catch(se){if(se===Ra||se===Gr)throw se;var Oe=jt(29,se,null,A.mode);return Oe.lanes=$,Oe.return=A,Oe}}}var Xi=Hd(!0),qd=Hd(!1),ri=!1;function Ju(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eo(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 li(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ui(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(_e&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=Ur(e),Rd(e,null,a),t}return _r(e,r,t,a),Ur(e)}function Ds(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,Lf(e,a)}}function to(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var o=null,f=null;if(a=a.firstBaseUpdate,a!==null){do{var p={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};f===null?o=f=p:f=f.next=p,a=a.next}while(a!==null);f===null?o=f=t:f=f.next=t}else o=f=t;a={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:f,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var no=!1;function Rs(){if(no){var e=Da;if(e!==null)throw e}}function Cs(e,t,a,r){no=!1;var o=e.updateQueue;ri=!1;var f=o.firstBaseUpdate,p=o.lastBaseUpdate,y=o.shared.pending;if(y!==null){o.shared.pending=null;var S=y,O=S.next;S.next=null,p===null?f=O:p.next=O,p=S;var j=e.alternate;j!==null&&(j=j.updateQueue,y=j.lastBaseUpdate,y!==p&&(y===null?j.firstBaseUpdate=O:y.next=O,j.lastBaseUpdate=S))}if(f!==null){var I=o.baseState;p=0,j=O=S=null,y=f;do{var _=y.lane&-536870913,U=_!==y.lane;if(U?(Ee&_)===_:(r&_)===_){_!==0&&_===Ma&&(no=!0),j!==null&&(j=j.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var ne=e,ce=y;_=t;var Be=a;switch(ce.tag){case 1:if(ne=ce.payload,typeof ne=="function"){I=ne.call(Be,I,_);break e}I=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=ce.payload,_=typeof ne=="function"?ne.call(Be,I,_):ne,_==null)break e;I=b({},I,_);break e;case 2:ri=!0}}_=y.callback,_!==null&&(e.flags|=64,U&&(e.flags|=8192),U=o.callbacks,U===null?o.callbacks=[_]:U.push(_))}else U={lane:_,tag:y.tag,payload:y.payload,callback:y.callback,next:null},j===null?(O=j=U,S=I):j=j.next=U,p|=_;if(y=y.next,y===null){if(y=o.shared.pending,y===null)break;U=y,y=U.next,U.next=null,o.lastBaseUpdate=U,o.shared.pending=null}}while(!0);j===null&&(S=I),o.baseState=S,o.firstBaseUpdate=O,o.lastBaseUpdate=j,f===null&&(o.shared.lanes=0),hi|=p,e.lanes=p,e.memoizedState=I}}function Yd(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Xd(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Yd(a[e],t)}var Oa=w(null),Fr=w(0);function Kd(e,t){e=Hn,X(Fr,e),X(Oa,t),Hn=e|t.baseLanes}function io(){X(Fr,Hn),X(Oa,Oa.current)}function ao(){Hn=Fr.current,N(Oa),N(Fr)}var Bt=w(null),tn=null;function oi(e){var t=e.alternate;X(nt,nt.current&1),X(Bt,e),tn===null&&(t===null||Oa.current!==null||t.memoizedState!==null)&&(tn=e)}function so(e){X(nt,nt.current),X(Bt,e),tn===null&&(tn=e)}function Qd(e){e.tag===22?(X(nt,nt.current),X(Bt,e),tn===null&&(tn=e)):ci()}function ci(){X(nt,nt.current),X(Bt,Bt.current)}function Gt(e){N(Bt),tn===e&&(tn=null),N(nt)}var nt=w(0);function Hr(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||dc(a)||hc(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)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 Ln=0,ge=null,Le=null,rt=null,qr=!1,za=!1,Ki=!1,Yr=0,Os=0,_a=null,lb=0;function We(){throw Error(l(321))}function ro(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Lt(e[a],t[a]))return!1;return!0}function lo(e,t,a,r,o,f){return Ln=f,ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?_h:Eo,Ki=!1,f=a(r,o),Ki=!1,za&&(f=Zd(t,a,r,o)),Pd(e),f}function Pd(e){R.H=Us;var t=Le!==null&&Le.next!==null;if(Ln=0,rt=Le=ge=null,qr=!1,Os=0,_a=null,t)throw Error(l(300));e===null||lt||(e=e.dependencies,e!==null&&Lr(e)&&(lt=!0))}function Zd(e,t,a,r){ge=e;var o=0;do{if(za&&(_a=null),Os=0,za=!1,25<=o)throw Error(l(301));if(o+=1,rt=Le=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}R.H=Uh,f=t(a,r)}while(za);return f}function ub(){var e=R.H,t=e.useState()[0];return t=typeof t.then=="function"?zs(t):t,e=e.useState()[0],(Le!==null?Le.memoizedState:null)!==e&&(ge.flags|=1024),t}function uo(){var e=Yr!==0;return Yr=0,e}function oo(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function co(e){if(qr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}qr=!1}Ln=0,rt=Le=ge=null,za=!1,Os=Yr=0,_a=null}function At(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?ge.memoizedState=rt=e:rt=rt.next=e,rt}function it(){if(Le===null){var e=ge.alternate;e=e!==null?e.memoizedState:null}else e=Le.next;var t=rt===null?ge.memoizedState:rt.next;if(t!==null)rt=t,Le=e;else{if(e===null)throw ge.alternate===null?Error(l(467)):Error(l(310));Le=e,e={memoizedState:Le.memoizedState,baseState:Le.baseState,baseQueue:Le.baseQueue,queue:Le.queue,next:null},rt===null?ge.memoizedState=rt=e:rt=rt.next=e}return rt}function Xr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zs(e){var t=Os;return Os+=1,_a===null&&(_a=[]),e=Vd(_a,e,t),t=ge,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?_h:Eo),e}function Kr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return zs(e);if(e.$$typeof===F)return yt(e)}throw Error(l(438,String(e)))}function fo(e){var t=null,a=ge.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=ge.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Xr(),ge.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=W;return t.index++,a}function jn(e,t){return typeof t=="function"?t(e):t}function Qr(e){var t=it();return ho(t,Le,e)}function ho(e,t,a){var r=e.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=a;var o=e.baseQueue,f=r.pending;if(f!==null){if(o!==null){var p=o.next;o.next=f.next,f.next=p}t.baseQueue=o=f,r.pending=null}if(f=e.baseState,o===null)e.memoizedState=f;else{t=o.next;var y=p=null,S=null,O=t,j=!1;do{var I=O.lane&-536870913;if(I!==O.lane?(Ee&I)===I:(Ln&I)===I){var _=O.revertLane;if(_===0)S!==null&&(S=S.next={lane:0,revertLane:0,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null}),I===Ma&&(j=!0);else if((Ln&_)===_){O=O.next,_===Ma&&(j=!0);continue}else I={lane:0,revertLane:O.revertLane,gesture:null,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},S===null?(y=S=I,p=f):S=S.next=I,ge.lanes|=_,hi|=_;I=O.action,Ki&&a(f,I),f=O.hasEagerState?O.eagerState:a(f,I)}else _={lane:I,revertLane:O.revertLane,gesture:O.gesture,action:O.action,hasEagerState:O.hasEagerState,eagerState:O.eagerState,next:null},S===null?(y=S=_,p=f):S=S.next=_,ge.lanes|=I,hi|=I;O=O.next}while(O!==null&&O!==t);if(S===null?p=f:S.next=y,!Lt(f,e.memoizedState)&&(lt=!0,j&&(a=Da,a!==null)))throw a;e.memoizedState=f,e.baseState=p,e.baseQueue=S,r.lastRenderedState=f}return o===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function po(e){var t=it(),a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=e;var r=a.dispatch,o=a.pending,f=t.memoizedState;if(o!==null){a.pending=null;var p=o=o.next;do f=e(f,p.action),p=p.next;while(p!==o);Lt(f,t.memoizedState)||(lt=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),a.lastRenderedState=f}return[f,r]}function Wd(e,t,a){var r=ge,o=it(),f=Me;if(f){if(a===void 0)throw Error(l(407));a=a()}else a=t();var p=!Lt((Le||o).memoizedState,a);if(p&&(o.memoizedState=a,lt=!0),o=o.queue,yo(th.bind(null,r,o,e),[e]),o.getSnapshot!==t||p||rt!==null&&rt.memoizedState.tag&1){if(r.flags|=2048,Ua(9,{destroy:void 0},eh.bind(null,r,o,a,t),null),Ge===null)throw Error(l(349));f||(Ln&127)!==0||Jd(r,t,a)}return a}function Jd(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ge.updateQueue,t===null?(t=Xr(),ge.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function eh(e,t,a,r){t.value=a,t.getSnapshot=r,nh(t)&&ih(e)}function th(e,t,a){return a(function(){nh(t)&&ih(e)})}function nh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Lt(e,a)}catch{return!0}}function ih(e){var t=Gi(e,2);t!==null&&Ut(t,e,2)}function mo(e){var t=At();if(typeof e=="function"){var a=e;if(e=a(),Ki){St(!0);try{a()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:e},t}function ah(e,t,a,r){return e.baseState=a,ho(e,Le,typeof r=="function"?r:jn)}function ob(e,t,a,r,o){if(Wr(e))throw Error(l(485));if(e=t.action,e!==null){var f={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){f.listeners.push(p)}};R.T!==null?a(!0):f.isTransition=!1,r(f),a=t.pending,a===null?(f.next=t.pending=f,sh(t,f)):(f.next=a.next,t.pending=a.next=f)}}function sh(e,t){var a=t.action,r=t.payload,o=e.state;if(t.isTransition){var f=R.T,p={};R.T=p;try{var y=a(o,r),S=R.S;S!==null&&S(p,y),rh(e,t,y)}catch(O){go(e,t,O)}finally{f!==null&&p.types!==null&&(f.types=p.types),R.T=f}}else try{f=a(o,r),rh(e,t,f)}catch(O){go(e,t,O)}}function rh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){lh(e,t,r)},function(r){return go(e,t,r)}):lh(e,t,a)}function lh(e,t,a){t.status="fulfilled",t.value=a,uh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,sh(e,a)))}function go(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,uh(t),t=t.next;while(t!==r)}e.action=null}function uh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function oh(e,t){return t}function ch(e,t){if(Me){var a=Ge.formState;if(a!==null){e:{var r=ge;if(Me){if(Ie){t:{for(var o=Ie,f=en;o.nodeType!==8;){if(!f){o=null;break t}if(o=nn(o.nextSibling),o===null){o=null;break t}}f=o.data,o=f==="F!"||f==="F"?o:null}if(o){Ie=nn(o.nextSibling),r=o.data==="F!";break e}}ai(r)}r=!1}r&&(t=a[0])}}return a=At(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oh,lastRenderedState:t},a.queue=r,a=Ch.bind(null,ge,r),r.dispatch=a,r=mo(!1),f=wo.bind(null,ge,!1,r.queue),r=At(),o={state:t,dispatch:null,action:e,pending:null},r.queue=o,a=ob.bind(null,ge,o,f,a),o.dispatch=a,r.memoizedState=e,[t,a,!1]}function fh(e){var t=it();return dh(t,Le,e)}function dh(e,t,a){if(t=ho(e,t,oh)[0],e=Qr(jn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=zs(t)}catch(p){throw p===Ra?Gr:p}else r=t;t=it();var o=t.queue,f=o.dispatch;return a!==t.memoizedState&&(ge.flags|=2048,Ua(9,{destroy:void 0},cb.bind(null,o,a),null)),[r,f,e]}function cb(e,t){e.action=t}function hh(e){var t=it(),a=Le;if(a!==null)return dh(t,a,e);it(),t=t.memoizedState,a=it();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function Ua(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=ge.updateQueue,t===null&&(t=Xr(),ge.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function ph(){return it().memoizedState}function Pr(e,t,a,r){var o=At();ge.flags|=e,o.memoizedState=Ua(1|t,{destroy:void 0},a,r===void 0?null:r)}function Zr(e,t,a,r){var o=it();r=r===void 0?null:r;var f=o.memoizedState.inst;Le!==null&&r!==null&&ro(r,Le.memoizedState.deps)?o.memoizedState=Ua(t,f,a,r):(ge.flags|=e,o.memoizedState=Ua(1|t,f,a,r))}function mh(e,t){Pr(8390656,8,e,t)}function yo(e,t){Zr(2048,8,e,t)}function fb(e){ge.flags|=4;var t=ge.updateQueue;if(t===null)t=Xr(),ge.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function gh(e){var t=it().memoizedState;return fb({ref:t,nextImpl:e}),function(){if((_e&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function yh(e,t){return Zr(4,2,e,t)}function vh(e,t){return Zr(4,4,e,t)}function bh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function xh(e,t,a){a=a!=null?a.concat([e]):null,Zr(4,4,bh.bind(null,t,e),a)}function vo(){}function Sh(e,t){var a=it();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&ro(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function wh(e,t){var a=it();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&ro(t,r[1]))return r[0];if(r=e(),Ki){St(!0);try{e()}finally{St(!1)}}return a.memoizedState=[r,t],r}function bo(e,t,a){return a===void 0||(Ln&1073741824)!==0&&(Ee&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Ep(),ge.lanes|=e,hi|=e,a)}function Eh(e,t,a,r){return Lt(a,t)?a:Oa.current!==null?(e=bo(e,a,r),Lt(e,t)||(lt=!0),e):(Ln&42)===0||(Ln&1073741824)!==0&&(Ee&261930)===0?(lt=!0,e.memoizedState=a):(e=Ep(),ge.lanes|=e,hi|=e,t)}function Th(e,t,a,r,o){var f=Y.p;Y.p=f!==0&&8>f?f:8;var p=R.T,y={};R.T=y,wo(e,!1,t,a);try{var S=o(),O=R.S;if(O!==null&&O(y,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var j=rb(S,r);_s(e,t,j,It(e))}else _s(e,t,r,It(e))}catch(I){_s(e,t,{then:function(){},status:"rejected",reason:I},It())}finally{Y.p=f,p!==null&&y.types!==null&&(p.types=y.types),R.T=p}}function db(){}function xo(e,t,a,r){if(e.tag!==5)throw Error(l(476));var o=Ah(e).queue;Th(e,o,t,ae,a===null?db:function(){return Mh(e),a(r)})}function Ah(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:ae},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Mh(e){var t=Ah(e);t.next===null&&(t=e.alternate.memoizedState),_s(e,t.next.queue,{},It())}function So(){return yt(Qs)}function Dh(){return it().memoizedState}function Rh(){return it().memoizedState}function hb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=It();e=li(a);var r=ui(t,e,a);r!==null&&(Ut(r,t,a),Ds(r,t,a)),t={cache:Qu()},e.payload=t;return}t=t.return}}function pb(e,t,a){var r=It();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Wr(e)?Oh(t,a):(a=Bu(e,t,a,r),a!==null&&(Ut(a,e,r),zh(a,t,r)))}function Ch(e,t,a){var r=It();_s(e,t,a,r)}function _s(e,t,a,r){var o={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Wr(e))Oh(t,o);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var p=t.lastRenderedState,y=f(p,a);if(o.hasEagerState=!0,o.eagerState=y,Lt(y,p))return _r(e,t,o,0),Ge===null&&zr(),!1}catch{}if(a=Bu(e,t,o,r),a!==null)return Ut(a,e,r),zh(a,t,r),!0}return!1}function wo(e,t,a,r){if(r={lane:2,revertLane:ec(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Wr(e)){if(t)throw Error(l(479))}else t=Bu(e,a,r,2),t!==null&&Ut(t,e,2)}function Wr(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function Oh(e,t){za=qr=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function zh(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,Lf(e,a)}}var Us={readContext:yt,use:Kr,useCallback:We,useContext:We,useEffect:We,useImperativeHandle:We,useLayoutEffect:We,useInsertionEffect:We,useMemo:We,useReducer:We,useRef:We,useState:We,useDebugValue:We,useDeferredValue:We,useTransition:We,useSyncExternalStore:We,useId:We,useHostTransitionStatus:We,useFormState:We,useActionState:We,useOptimistic:We,useMemoCache:We,useCacheRefresh:We};Us.useEffectEvent=We;var _h={readContext:yt,use:Kr,useCallback:function(e,t){return At().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:mh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Pr(4194308,4,bh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Pr(4194308,4,e,t)},useInsertionEffect:function(e,t){Pr(4,2,e,t)},useMemo:function(e,t){var a=At();t=t===void 0?null:t;var r=e();if(Ki){St(!0);try{e()}finally{St(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=At();if(a!==void 0){var o=a(t);if(Ki){St(!0);try{a(t)}finally{St(!1)}}}else o=t;return r.memoizedState=r.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},r.queue=e,e=e.dispatch=pb.bind(null,ge,e),[r.memoizedState,e]},useRef:function(e){var t=At();return e={current:e},t.memoizedState=e},useState:function(e){e=mo(e);var t=e.queue,a=Ch.bind(null,ge,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:vo,useDeferredValue:function(e,t){var a=At();return bo(a,e,t)},useTransition:function(){var e=mo(!1);return e=Th.bind(null,ge,e.queue,!0,!1),At().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=ge,o=At();if(Me){if(a===void 0)throw Error(l(407));a=a()}else{if(a=t(),Ge===null)throw Error(l(349));(Ee&127)!==0||Jd(r,t,a)}o.memoizedState=a;var f={value:a,getSnapshot:t};return o.queue=f,mh(th.bind(null,r,f,e),[e]),r.flags|=2048,Ua(9,{destroy:void 0},eh.bind(null,r,f,a,t),null),a},useId:function(){var e=At(),t=Ge.identifierPrefix;if(Me){var a=bn,r=vn;a=(r&~(1<<32-tt(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Yr++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=lb++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:So,useFormState:ch,useActionState:ch,useOptimistic:function(e){var t=At();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=wo.bind(null,ge,!0,a),a.dispatch=t,[e,t]},useMemoCache:fo,useCacheRefresh:function(){return At().memoizedState=hb.bind(null,ge)},useEffectEvent:function(e){var t=At(),a={impl:e};return t.memoizedState=a,function(){if((_e&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},Eo={readContext:yt,use:Kr,useCallback:Sh,useContext:yt,useEffect:yo,useImperativeHandle:xh,useInsertionEffect:yh,useLayoutEffect:vh,useMemo:wh,useReducer:Qr,useRef:ph,useState:function(){return Qr(jn)},useDebugValue:vo,useDeferredValue:function(e,t){var a=it();return Eh(a,Le.memoizedState,e,t)},useTransition:function(){var e=Qr(jn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:zs(e),t]},useSyncExternalStore:Wd,useId:Dh,useHostTransitionStatus:So,useFormState:fh,useActionState:fh,useOptimistic:function(e,t){var a=it();return ah(a,Le,e,t)},useMemoCache:fo,useCacheRefresh:Rh};Eo.useEffectEvent=gh;var Uh={readContext:yt,use:Kr,useCallback:Sh,useContext:yt,useEffect:yo,useImperativeHandle:xh,useInsertionEffect:yh,useLayoutEffect:vh,useMemo:wh,useReducer:po,useRef:ph,useState:function(){return po(jn)},useDebugValue:vo,useDeferredValue:function(e,t){var a=it();return Le===null?bo(a,e,t):Eh(a,Le.memoizedState,e,t)},useTransition:function(){var e=po(jn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:zs(e),t]},useSyncExternalStore:Wd,useId:Dh,useHostTransitionStatus:So,useFormState:hh,useActionState:hh,useOptimistic:function(e,t){var a=it();return Le!==null?ah(a,Le,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:fo,useCacheRefresh:Rh};Uh.useEffectEvent=gh;function To(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Ao={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=It(),o=li(r);o.payload=t,a!=null&&(o.callback=a),t=ui(e,o,r),t!==null&&(Ut(t,e,r),Ds(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=It(),o=li(r);o.tag=1,o.payload=t,a!=null&&(o.callback=a),t=ui(e,o,r),t!==null&&(Ut(t,e,r),Ds(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=It(),r=li(a);r.tag=2,t!=null&&(r.callback=t),t=ui(e,r,a),t!==null&&(Ut(t,e,a),Ds(t,e,a))}};function Nh(e,t,a,r,o,f,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,f,p):t.prototype&&t.prototype.isPureReactComponent?!bs(a,r)||!bs(o,f):!0}function kh(e,t,a,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,r),t.state!==e&&Ao.enqueueReplaceState(t,t.state,null)}function Qi(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=b({},a));for(var o in e)a[o]===void 0&&(a[o]=e[o])}return a}function Lh(e){Or(e)}function jh(e){console.error(e)}function Bh(e){Or(e)}function Jr(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Gh(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Mo(e,t,a){return a=li(a),a.tag=3,a.payload={element:null},a.callback=function(){Jr(e,t)},a}function $h(e){return e=li(e),e.tag=3,e}function Vh(e,t,a,r){var o=a.type.getDerivedStateFromError;if(typeof o=="function"){var f=r.value;e.payload=function(){return o(f)},e.callback=function(){Gh(t,a,r)}}var p=a.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Gh(t,a,r),typeof o!="function"&&(pi===null?pi=new Set([this]):pi.add(this));var y=r.stack;this.componentDidCatch(r.value,{componentStack:y!==null?y:""})})}function mb(e,t,a,r,o){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&Aa(t,a,o,!0),a=Bt.current,a!==null){switch(a.tag){case 31:case 13:return tn===null?fl():a.alternate===null&&Je===0&&(Je=3),a.flags&=-257,a.flags|=65536,a.lanes=o,r===$r?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),Zo(e,r,o)),!1;case 22:return a.flags|=65536,r===$r?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([r]):a.add(r)),Zo(e,r,o)),!1}throw Error(l(435,a.tag))}return Zo(e,r,o),fl(),!1}if(Me)return t=Bt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,r!==Hu&&(e=Error(l(422),{cause:r}),ws(Zt(e,a)))):(r!==Hu&&(t=Error(l(423),{cause:r}),ws(Zt(t,a))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,r=Zt(r,a),o=Mo(e.stateNode,r,o),to(e,o),Je!==4&&(Je=2)),!1;var f=Error(l(520),{cause:r});if(f=Zt(f,a),Vs===null?Vs=[f]:Vs.push(f),Je!==4&&(Je=2),t===null)return!0;r=Zt(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=o&-o,a.lanes|=e,e=Mo(a.stateNode,r,e),to(a,e),!1;case 1:if(t=a.type,f=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(pi===null||!pi.has(f))))return a.flags|=65536,o&=-o,a.lanes|=o,o=$h(o),Vh(o,e,a,r),to(a,o),!1}a=a.return}while(a!==null);return!1}var Do=Error(l(461)),lt=!1;function vt(e,t,a,r){t.child=e===null?qd(t,null,a,r):Xi(t,e.child,a,r)}function Ih(e,t,a,r,o){a=a.render;var f=t.ref;if("ref"in r){var p={};for(var y in r)y!=="ref"&&(p[y]=r[y])}else p=r;return Fi(t),r=lo(e,t,a,p,f,o),y=uo(),e!==null&&!lt?(oo(e,t,o),Bn(e,t,o)):(Me&&y&&Iu(t),t.flags|=1,vt(e,t,r,o),t.child)}function Fh(e,t,a,r,o){if(e===null){var f=a.type;return typeof f=="function"&&!Gu(f)&&f.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=f,Hh(e,t,f,r,o)):(e=Nr(a.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!ko(e,o)){var p=f.memoizedProps;if(a=a.compare,a=a!==null?a:bs,a(p,r)&&e.ref===t.ref)return Bn(e,t,o)}return t.flags|=1,e=_n(f,r),e.ref=t.ref,e.return=t,t.child=e}function Hh(e,t,a,r,o){if(e!==null){var f=e.memoizedProps;if(bs(f,r)&&e.ref===t.ref)if(lt=!1,t.pendingProps=r=f,ko(e,o))(e.flags&131072)!==0&&(lt=!0);else return t.lanes=e.lanes,Bn(e,t,o)}return Ro(e,t,a,r,o)}function qh(e,t,a,r){var o=r.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|a:a,e!==null){for(r=t.child=e.child,o=0;r!==null;)o=o|r.lanes|r.childLanes,r=r.sibling;r=o&~f}else r=0,t.child=null;return Yh(e,t,f,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Br(t,f!==null?f.cachePool:null),f!==null?Kd(t,f):io(),Qd(t);else return r=t.lanes=536870912,Yh(e,t,f!==null?f.baseLanes|a:a,a,r)}else f!==null?(Br(t,f.cachePool),Kd(t,f),ci(),t.memoizedState=null):(e!==null&&Br(t,null),io(),ci());return vt(e,t,o,a),t.child}function Ns(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Yh(e,t,a,r,o){var f=Zu();return f=f===null?null:{parent:st._currentValue,pool:f},t.memoizedState={baseLanes:a,cachePool:f},e!==null&&Br(t,null),io(),Qd(t),e!==null&&Aa(e,t,r,!0),t.childLanes=o,null}function el(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 Xh(e,t,a){return Xi(t,e.child,null,a),e=el(t,t.pendingProps),e.flags|=2,Gt(t),t.memoizedState=null,e}function gb(e,t,a){var r=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Me){if(r.mode==="hidden")return e=el(t,r),t.lanes=536870912,Ns(null,e);if(so(t),(e=Ie)?(e=sm(e,en),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ni!==null?{id:vn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},a=Od(e),a.return=t,t.child=a,gt=t,Ie=null)):e=null,e===null)throw ai(t);return t.lanes=536870912,null}return el(t,r)}var f=e.memoizedState;if(f!==null){var p=f.dehydrated;if(so(t),o)if(t.flags&256)t.flags&=-257,t=Xh(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(lt||Aa(e,t,a,!1),o=(a&e.childLanes)!==0,lt||o){if(r=Ge,r!==null&&(p=jf(r,a),p!==0&&p!==f.retryLane))throw f.retryLane=p,Gi(e,p),Ut(r,e,p),Do;fl(),t=Xh(e,t,a)}else e=f.treeContext,Ie=nn(p.nextSibling),gt=t,Me=!0,ii=null,en=!1,e!==null&&Ud(t,e),t=el(t,r),t.flags|=4096;return t}return e=_n(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function tl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(l(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Ro(e,t,a,r,o){return Fi(t),a=lo(e,t,a,r,void 0,o),r=uo(),e!==null&&!lt?(oo(e,t,o),Bn(e,t,o)):(Me&&r&&Iu(t),t.flags|=1,vt(e,t,a,o),t.child)}function Kh(e,t,a,r,o,f){return Fi(t),t.updateQueue=null,a=Zd(t,r,a,o),Pd(e),r=uo(),e!==null&&!lt?(oo(e,t,f),Bn(e,t,f)):(Me&&r&&Iu(t),t.flags|=1,vt(e,t,a,f),t.child)}function Qh(e,t,a,r,o){if(Fi(t),t.stateNode===null){var f=Sa,p=a.contextType;typeof p=="object"&&p!==null&&(f=yt(p)),f=new a(r,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Ao,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=r,f.state=t.memoizedState,f.refs={},Ju(t),p=a.contextType,f.context=typeof p=="object"&&p!==null?yt(p):Sa,f.state=t.memoizedState,p=a.getDerivedStateFromProps,typeof p=="function"&&(To(t,a,p,r),f.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(p=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),p!==f.state&&Ao.enqueueReplaceState(f,f.state,null),Cs(t,r,f,o),Rs(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){f=t.stateNode;var y=t.memoizedProps,S=Qi(a,y);f.props=S;var O=f.context,j=a.contextType;p=Sa,typeof j=="object"&&j!==null&&(p=yt(j));var I=a.getDerivedStateFromProps;j=typeof I=="function"||typeof f.getSnapshotBeforeUpdate=="function",y=t.pendingProps!==y,j||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y||O!==p)&&kh(t,f,r,p),ri=!1;var _=t.memoizedState;f.state=_,Cs(t,r,f,o),Rs(),O=t.memoizedState,y||_!==O||ri?(typeof I=="function"&&(To(t,a,I,r),O=t.memoizedState),(S=ri||Nh(t,a,S,r,_,O,p))?(j||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=O),f.props=r,f.state=O,f.context=p,r=S):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{f=t.stateNode,eo(e,t),p=t.memoizedProps,j=Qi(a,p),f.props=j,I=t.pendingProps,_=f.context,O=a.contextType,S=Sa,typeof O=="object"&&O!==null&&(S=yt(O)),y=a.getDerivedStateFromProps,(O=typeof y=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(p!==I||_!==S)&&kh(t,f,r,S),ri=!1,_=t.memoizedState,f.state=_,Cs(t,r,f,o),Rs();var U=t.memoizedState;p!==I||_!==U||ri||e!==null&&e.dependencies!==null&&Lr(e.dependencies)?(typeof y=="function"&&(To(t,a,y,r),U=t.memoizedState),(j=ri||Nh(t,a,j,r,_,U,S)||e!==null&&e.dependencies!==null&&Lr(e.dependencies))?(O||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(r,U,S),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(r,U,S)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=U),f.props=r,f.state=U,f.context=S,r=j):(typeof f.componentDidUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),r=!1)}return f=r,tl(e,t),r=(t.flags&128)!==0,f||r?(f=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&r?(t.child=Xi(t,e.child,null,o),t.child=Xi(t,null,a,o)):vt(e,t,a,o),t.memoizedState=f.state,e=t.child):e=Bn(e,t,o),e}function Ph(e,t,a,r){return Vi(),t.flags|=256,vt(e,t,a,r),t.child}var Co={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Oo(e){return{baseLanes:e,cachePool:Gd()}}function zo(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Vt),e}function Zh(e,t,a){var r=t.pendingProps,o=!1,f=(t.flags&128)!==0,p;if((p=f)||(p=e!==null&&e.memoizedState===null?!1:(nt.current&2)!==0),p&&(o=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(Me){if(o?oi(t):ci(),(e=Ie)?(e=sm(e,en),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ni!==null?{id:vn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},a=Od(e),a.return=t,t.child=a,gt=t,Ie=null)):e=null,e===null)throw ai(t);return hc(e)?t.lanes=32:t.lanes=536870912,null}var y=r.children;return r=r.fallback,o?(ci(),o=t.mode,y=nl({mode:"hidden",children:y},o),r=$i(r,o,a,null),y.return=t,r.return=t,y.sibling=r,t.child=y,r=t.child,r.memoizedState=Oo(a),r.childLanes=zo(e,p,a),t.memoizedState=Co,Ns(null,r)):(oi(t),_o(t,y))}var S=e.memoizedState;if(S!==null&&(y=S.dehydrated,y!==null)){if(f)t.flags&256?(oi(t),t.flags&=-257,t=Uo(e,t,a)):t.memoizedState!==null?(ci(),t.child=e.child,t.flags|=128,t=null):(ci(),y=r.fallback,o=t.mode,r=nl({mode:"visible",children:r.children},o),y=$i(y,o,a,null),y.flags|=2,r.return=t,y.return=t,r.sibling=y,t.child=r,Xi(t,e.child,null,a),r=t.child,r.memoizedState=Oo(a),r.childLanes=zo(e,p,a),t.memoizedState=Co,t=Ns(null,r));else if(oi(t),hc(y)){if(p=y.nextSibling&&y.nextSibling.dataset,p)var O=p.dgst;p=O,r=Error(l(419)),r.stack="",r.digest=p,ws({value:r,source:null,stack:null}),t=Uo(e,t,a)}else if(lt||Aa(e,t,a,!1),p=(a&e.childLanes)!==0,lt||p){if(p=Ge,p!==null&&(r=jf(p,a),r!==0&&r!==S.retryLane))throw S.retryLane=r,Gi(e,r),Ut(p,e,r),Do;dc(y)||fl(),t=Uo(e,t,a)}else dc(y)?(t.flags|=192,t.child=e.child,t=null):(e=S.treeContext,Ie=nn(y.nextSibling),gt=t,Me=!0,ii=null,en=!1,e!==null&&Ud(t,e),t=_o(t,r.children),t.flags|=4096);return t}return o?(ci(),y=r.fallback,o=t.mode,S=e.child,O=S.sibling,r=_n(S,{mode:"hidden",children:r.children}),r.subtreeFlags=S.subtreeFlags&65011712,O!==null?y=_n(O,y):(y=$i(y,o,a,null),y.flags|=2),y.return=t,r.return=t,r.sibling=y,t.child=r,Ns(null,r),r=t.child,y=e.child.memoizedState,y===null?y=Oo(a):(o=y.cachePool,o!==null?(S=st._currentValue,o=o.parent!==S?{parent:S,pool:S}:o):o=Gd(),y={baseLanes:y.baseLanes|a,cachePool:o}),r.memoizedState=y,r.childLanes=zo(e,p,a),t.memoizedState=Co,Ns(e.child,r)):(oi(t),a=e.child,e=a.sibling,a=_n(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=a,t.memoizedState=null,a)}function _o(e,t){return t=nl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function nl(e,t){return e=jt(22,e,null,t),e.lanes=0,e}function Uo(e,t,a){return Xi(t,e.child,null,a),e=_o(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Wh(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xu(e.return,t,a)}function No(e,t,a,r,o,f){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:o,treeForkCount:f}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=r,p.tail=a,p.tailMode=o,p.treeForkCount=f)}function Jh(e,t,a){var r=t.pendingProps,o=r.revealOrder,f=r.tail;r=r.children;var p=nt.current,y=(p&2)!==0;if(y?(p=p&1|2,t.flags|=128):p&=1,X(nt,p),vt(e,t,r,a),r=Me?Ss:0,!y&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Wh(e,a,t);else if(e.tag===19)Wh(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"forwards":for(a=t.child,o=null;a!==null;)e=a.alternate,e!==null&&Hr(e)===null&&(o=a),a=a.sibling;a=o,a===null?(o=t.child,t.child=null):(o=a.sibling,a.sibling=null),No(t,!1,o,a,f,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Hr(e)===null){t.child=o;break}e=o.sibling,o.sibling=a,a=o,o=e}No(t,!0,a,null,f,r);break;case"together":No(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Bn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),hi|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Aa(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,a=_n(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=_n(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function ko(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Lr(e)))}function yb(e,t,a){switch(t.tag){case 3:Ze(t,t.stateNode.containerInfo),si(t,st,e.memoizedState.cache),Vi();break;case 27:case 5:gn(t);break;case 4:Ze(t,t.stateNode.containerInfo);break;case 10:si(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,so(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(oi(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Zh(e,t,a):(oi(t),e=Bn(e,t,a),e!==null?e.sibling:null);oi(t);break;case 19:var o=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(Aa(e,t,a,!1),r=(a&t.childLanes)!==0),o){if(r)return Jh(e,t,a);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),X(nt,nt.current),r)break;return null;case 22:return t.lanes=0,qh(e,t,a,t.pendingProps);case 24:si(t,st,e.memoizedState.cache)}return Bn(e,t,a)}function ep(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)lt=!0;else{if(!ko(e,a)&&(t.flags&128)===0)return lt=!1,yb(e,t,a);lt=(e.flags&131072)!==0}else lt=!1,Me&&(t.flags&1048576)!==0&&_d(t,Ss,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=qi(t.elementType),t.type=e,typeof e=="function")Gu(e)?(r=Qi(e,r),t.tag=1,t=Qh(null,t,e,r,a)):(t.tag=0,t=Ro(null,t,e,r,a));else{if(e!=null){var o=e.$$typeof;if(o===H){t.tag=11,t=Ih(null,t,e,r,a);break e}else if(o===M){t.tag=14,t=Fh(null,t,e,r,a);break e}}throw t=he(e)||e,Error(l(306,t,""))}}return t;case 0:return Ro(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,o=Qi(r,t.pendingProps),Qh(e,t,r,o,a);case 3:e:{if(Ze(t,t.stateNode.containerInfo),e===null)throw Error(l(387));r=t.pendingProps;var f=t.memoizedState;o=f.element,eo(e,t),Cs(t,r,null,a);var p=t.memoizedState;if(r=p.cache,si(t,st,r),r!==f.cache&&Ku(t,[st],a,!0),Rs(),r=p.element,f.isDehydrated)if(f={element:r,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Ph(e,t,r,a);break e}else if(r!==o){o=Zt(Error(l(424)),t),ws(o),t=Ph(e,t,r,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ie=nn(e.firstChild),gt=t,Me=!0,ii=null,en=!0,a=qd(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Vi(),r===o){t=Bn(e,t,a);break e}vt(e,t,r,a)}t=t.child}return t;case 26:return tl(e,t),e===null?(a=fm(t.type,null,t.pendingProps,null))?t.memoizedState=a:Me||(a=t.type,e=t.pendingProps,r=vl(fe.current).createElement(a),r[mt]=t,r[Dt]=e,bt(r,a,e),dt(r),t.stateNode=r):t.memoizedState=fm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return gn(t),e===null&&Me&&(r=t.stateNode=um(t.type,t.pendingProps,fe.current),gt=t,en=!0,o=Ie,vi(t.type)?(pc=o,Ie=nn(r.firstChild)):Ie=o),vt(e,t,t.pendingProps.children,a),tl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((o=r=Ie)&&(r=Xb(r,t.type,t.pendingProps,en),r!==null?(t.stateNode=r,gt=t,Ie=nn(r.firstChild),en=!1,o=!0):o=!1),o||ai(t)),gn(t),o=t.type,f=t.pendingProps,p=e!==null?e.memoizedProps:null,r=f.children,oc(o,f)?r=null:p!==null&&oc(o,p)&&(t.flags|=32),t.memoizedState!==null&&(o=lo(e,t,ub,null,null,a),Qs._currentValue=o),tl(e,t),vt(e,t,r,a),t.child;case 6:return e===null&&Me&&((e=a=Ie)&&(a=Kb(a,t.pendingProps,en),a!==null?(t.stateNode=a,gt=t,Ie=null,e=!0):e=!1),e||ai(t)),null;case 13:return Zh(e,t,a);case 4:return Ze(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Xi(t,null,r,a):vt(e,t,r,a),t.child;case 11:return Ih(e,t,t.type,t.pendingProps,a);case 7:return vt(e,t,t.pendingProps,a),t.child;case 8:return vt(e,t,t.pendingProps.children,a),t.child;case 12:return vt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,si(t,t.type,r.value),vt(e,t,r.children,a),t.child;case 9:return o=t.type._context,r=t.pendingProps.children,Fi(t),o=yt(o),r=r(o),t.flags|=1,vt(e,t,r,a),t.child;case 14:return Fh(e,t,t.type,t.pendingProps,a);case 15:return Hh(e,t,t.type,t.pendingProps,a);case 19:return Jh(e,t,a);case 31:return gb(e,t,a);case 22:return qh(e,t,a,t.pendingProps);case 24:return Fi(t),r=yt(st),e===null?(o=Zu(),o===null&&(o=Ge,f=Qu(),o.pooledCache=f,f.refCount++,f!==null&&(o.pooledCacheLanes|=a),o=f),t.memoizedState={parent:r,cache:o},Ju(t),si(t,st,o)):((e.lanes&a)!==0&&(eo(e,t),Cs(t,null,null,a),Rs()),o=e.memoizedState,f=t.memoizedState,o.parent!==r?(o={parent:r,cache:r},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),si(t,st,r)):(r=f.cache,si(t,st,r),r!==o.cache&&Ku(t,[st],a,!0))),vt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Gn(e){e.flags|=4}function Lo(e,t,a,r,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(Dp())e.flags|=8192;else throw Yi=$r,Wu}else e.flags&=-16777217}function tp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!gm(t))if(Dp())e.flags|=8192;else throw Yi=$r,Wu}function il(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Nf():536870912,e.lanes|=t,ja|=t)}function ks(e,t){if(!Me)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Fe(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var o=e.child;o!==null;)a|=o.lanes|o.childLanes,r|=o.subtreeFlags&65011712,r|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)a|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function vb(e,t,a){var r=t.pendingProps;switch(Fu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fe(t),null;case 1:return Fe(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),kn(st),De(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ta(t)?Gn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,qu())),Fe(t),null;case 26:var o=t.type,f=t.memoizedState;return e===null?(Gn(t),f!==null?(Fe(t),tp(t,f)):(Fe(t),Lo(t,o,null,r,a))):f?f!==e.memoizedState?(Gn(t),Fe(t),tp(t,f)):(Fe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Gn(t),Fe(t),Lo(t,o,e,r,a)),null;case 27:if(Jn(t),a=fe.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Gn(t);else{if(!r){if(t.stateNode===null)throw Error(l(166));return Fe(t),null}e=P.current,Ta(t)?Nd(t):(e=um(o,r,a),t.stateNode=e,Gn(t))}return Fe(t),null;case 5:if(Jn(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Gn(t);else{if(!r){if(t.stateNode===null)throw Error(l(166));return Fe(t),null}if(f=P.current,Ta(t))Nd(t);else{var p=vl(fe.current);switch(f){case 1:f=p.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:f=p.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":f=p.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":f=p.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":f=p.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof r.is=="string"?p.createElement("select",{is:r.is}):p.createElement("select"),r.multiple?f.multiple=!0:r.size&&(f.size=r.size);break;default:f=typeof r.is=="string"?p.createElement(o,{is:r.is}):p.createElement(o)}}f[mt]=t,f[Dt]=r;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)f.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=f;e:switch(bt(f,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Gn(t)}}return Fe(t),Lo(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Gn(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(l(166));if(e=fe.current,Ta(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,o=gt,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}e[mt]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Zp(e.nodeValue,a)),e||ai(t,!0)}else e=vl(e).createTextNode(r),e[mt]=t,t.stateNode=e}return Fe(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ta(t),a!==null){if(e===null){if(!r)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[mt]=t}else Vi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Fe(t),e=!1}else a=qu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Gt(t),t):(Gt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Fe(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Ta(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(l(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));o[mt]=t}else Vi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Fe(t),o=!1}else o=qu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Gt(t),t):(Gt(t),null)}return Gt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==o&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),il(t,t.updateQueue),Fe(t),null);case 4:return De(),e===null&&ac(t.stateNode.containerInfo),Fe(t),null;case 10:return kn(t.type),Fe(t),null;case 19:if(N(nt),r=t.memoizedState,r===null)return Fe(t),null;if(o=(t.flags&128)!==0,f=r.rendering,f===null)if(o)ks(r,!1);else{if(Je!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=Hr(e),f!==null){for(t.flags|=128,ks(r,!1),e=f.updateQueue,t.updateQueue=e,il(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Cd(a,e),a=a.sibling;return X(nt,nt.current&1|2),Me&&Un(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ve()>ul&&(t.flags|=128,o=!0,ks(r,!1),t.lanes=4194304)}else{if(!o)if(e=Hr(f),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,il(t,e),ks(r,!0),r.tail===null&&r.tailMode==="hidden"&&!f.alternate&&!Me)return Fe(t),null}else 2*Ve()-r.renderingStartTime>ul&&a!==536870912&&(t.flags|=128,o=!0,ks(r,!1),t.lanes=4194304);r.isBackwards?(f.sibling=t.child,t.child=f):(e=r.last,e!==null?e.sibling=f:t.child=f,r.last=f)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ve(),e.sibling=null,a=nt.current,X(nt,o?a&1|2:a&1),Me&&Un(t,r.treeForkCount),e):(Fe(t),null);case 22:case 23:return Gt(t),ao(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(Fe(t),t.subtreeFlags&6&&(t.flags|=8192)):Fe(t),a=t.updateQueue,a!==null&&il(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),e!==null&&N(Hi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),kn(st),Fe(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function bb(e,t){switch(Fu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kn(st),De(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Jn(t),null;case 31:if(t.memoizedState!==null){if(Gt(t),t.alternate===null)throw Error(l(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Gt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return N(nt),null;case 4:return De(),null;case 10:return kn(t.type),null;case 22:case 23:return Gt(t),ao(),e!==null&&N(Hi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return kn(st),null;case 25:return null;default:return null}}function np(e,t){switch(Fu(t),t.tag){case 3:kn(st),De();break;case 26:case 27:case 5:Jn(t);break;case 4:De();break;case 31:t.memoizedState!==null&&Gt(t);break;case 13:Gt(t);break;case 19:N(nt);break;case 10:kn(t.type);break;case 22:case 23:Gt(t),ao(),e!==null&&N(Hi);break;case 24:kn(st)}}function Ls(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var o=r.next;a=o;do{if((a.tag&e)===e){r=void 0;var f=a.create,p=a.inst;r=f(),p.destroy=r}a=a.next}while(a!==o)}}catch(y){ke(t,t.return,y)}}function fi(e,t,a){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var f=o.next;r=f;do{if((r.tag&e)===e){var p=r.inst,y=p.destroy;if(y!==void 0){p.destroy=void 0,o=t;var S=a,O=y;try{O()}catch(j){ke(o,S,j)}}}r=r.next}while(r!==f)}}catch(j){ke(t,t.return,j)}}function ip(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Xd(t,a)}catch(r){ke(e,e.return,r)}}}function ap(e,t,a){a.props=Qi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){ke(e,t,r)}}function js(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(o){ke(e,t,o)}}function xn(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(o){ke(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){ke(e,t,o)}else a.current=null}function sp(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(o){ke(e,e.return,o)}}function jo(e,t,a){try{var r=e.stateNode;Vb(r,e.type,a,t),r[Dt]=t}catch(o){ke(e,e.return,o)}}function rp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&vi(e.type)||e.tag===4}function Bo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rp(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&&vi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Go(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=On));else if(r!==4&&(r===27&&vi(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Go(e,t,a),e=e.sibling;e!==null;)Go(e,t,a),e=e.sibling}function al(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(r!==4&&(r===27&&vi(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(al(e,t,a),e=e.sibling;e!==null;)al(e,t,a),e=e.sibling}function lp(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);bt(t,r,a),t[mt]=e,t[Dt]=a}catch(f){ke(e,e.return,f)}}var $n=!1,ut=!1,$o=!1,up=typeof WeakSet=="function"?WeakSet:Set,ht=null;function xb(e,t){if(e=e.containerInfo,lc=Al,e=xd(e),_u(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var o=r.anchorOffset,f=r.focusNode;r=r.focusOffset;try{a.nodeType,f.nodeType}catch{a=null;break e}var p=0,y=-1,S=-1,O=0,j=0,I=e,_=null;t:for(;;){for(var U;I!==a||o!==0&&I.nodeType!==3||(y=p+o),I!==f||r!==0&&I.nodeType!==3||(S=p+r),I.nodeType===3&&(p+=I.nodeValue.length),(U=I.firstChild)!==null;)_=I,I=U;for(;;){if(I===e)break t;if(_===a&&++O===o&&(y=p),_===f&&++j===r&&(S=p),(U=I.nextSibling)!==null)break;I=_,_=I.parentNode}I=U}a=y===-1||S===-1?null:{start:y,end:S}}else a=null}a=a||{start:0,end:0}}else a=null;for(uc={focusedElem:e,selectionRange:a},Al=!1,ht=t;ht!==null;)if(t=ht,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ht=e;else for(;ht!==null;){switch(t=ht,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)o=e[a],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,a=t,o=f.memoizedProps,f=f.memoizedState,r=a.stateNode;try{var ne=Qi(a.type,o);e=r.getSnapshotBeforeUpdate(ne,f),r.__reactInternalSnapshotBeforeUpdate=e}catch(ce){ke(a,a.return,ce)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)fc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":fc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(l(163))}if(e=t.sibling,e!==null){e.return=t.return,ht=e;break}ht=t.return}}function op(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:In(e,a),r&4&&Ls(5,a);break;case 1:if(In(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(p){ke(a,a.return,p)}else{var o=Qi(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){ke(a,a.return,p)}}r&64&&ip(a),r&512&&js(a,a.return);break;case 3:if(In(e,a),r&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Xd(e,t)}catch(p){ke(a,a.return,p)}}break;case 27:t===null&&r&4&&lp(a);case 26:case 5:In(e,a),t===null&&r&4&&sp(a),r&512&&js(a,a.return);break;case 12:In(e,a);break;case 31:In(e,a),r&4&&dp(e,a);break;case 13:In(e,a),r&4&&hp(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Cb.bind(null,a),Qb(e,a))));break;case 22:if(r=a.memoizedState!==null||$n,!r){t=t!==null&&t.memoizedState!==null||ut,o=$n;var f=ut;$n=r,(ut=t)&&!f?Fn(e,a,(a.subtreeFlags&8772)!==0):In(e,a),$n=o,ut=f}break;case 30:break;default:In(e,a)}}function cp(e){var t=e.alternate;t!==null&&(e.alternate=null,cp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mu(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 qe=null,Ct=!1;function Vn(e,t,a){for(a=a.child;a!==null;)fp(e,t,a),a=a.sibling}function fp(e,t,a){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(ft,a)}catch{}switch(a.tag){case 26:ut||xn(a,t),Vn(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ut||xn(a,t);var r=qe,o=Ct;vi(a.type)&&(qe=a.stateNode,Ct=!1),Vn(e,t,a),Ys(a.stateNode),qe=r,Ct=o;break;case 5:ut||xn(a,t);case 6:if(r=qe,o=Ct,qe=null,Vn(e,t,a),qe=r,Ct=o,qe!==null)if(Ct)try{(qe.nodeType===9?qe.body:qe.nodeName==="HTML"?qe.ownerDocument.body:qe).removeChild(a.stateNode)}catch(f){ke(a,t,f)}else try{qe.removeChild(a.stateNode)}catch(f){ke(a,t,f)}break;case 18:qe!==null&&(Ct?(e=qe,im(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),qa(e)):im(qe,a.stateNode));break;case 4:r=qe,o=Ct,qe=a.stateNode.containerInfo,Ct=!0,Vn(e,t,a),qe=r,Ct=o;break;case 0:case 11:case 14:case 15:fi(2,a,t),ut||fi(4,a,t),Vn(e,t,a);break;case 1:ut||(xn(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&ap(a,t,r)),Vn(e,t,a);break;case 21:Vn(e,t,a);break;case 22:ut=(r=ut)||a.memoizedState!==null,Vn(e,t,a),ut=r;break;default:Vn(e,t,a)}}function dp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{qa(e)}catch(a){ke(t,t.return,a)}}}function hp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{qa(e)}catch(a){ke(t,t.return,a)}}function Sb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new up),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new up),t;default:throw Error(l(435,e.tag))}}function sl(e,t){var a=Sb(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var o=Ob.bind(null,e,r);r.then(o,o)}})}function Ot(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var o=a[r],f=e,p=t,y=p;e:for(;y!==null;){switch(y.tag){case 27:if(vi(y.type)){qe=y.stateNode,Ct=!1;break e}break;case 5:qe=y.stateNode,Ct=!1;break e;case 3:case 4:qe=y.stateNode.containerInfo,Ct=!0;break e}y=y.return}if(qe===null)throw Error(l(160));fp(f,p,o),qe=null,Ct=!1,f=o.alternate,f!==null&&(f.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)pp(t,e),t=t.sibling}var pn=null;function pp(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ot(t,e),zt(e),r&4&&(fi(3,e,e.return),Ls(3,e),fi(5,e,e.return));break;case 1:Ot(t,e),zt(e),r&512&&(ut||a===null||xn(a,a.return)),r&64&&$n&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var o=pn;if(Ot(t,e),zt(e),r&512&&(ut||a===null||xn(a,a.return)),r&4){var f=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,o=o.ownerDocument||o;t:switch(r){case"title":f=o.getElementsByTagName("title")[0],(!f||f[cs]||f[mt]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=o.createElement(r),o.head.insertBefore(f,o.querySelector("head > title"))),bt(f,r,a),f[mt]=e,dt(f),r=f;break e;case"link":var p=pm("link","href",o).get(r+(a.href||""));if(p){for(var y=0;y<p.length;y++)if(f=p[y],f.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&f.getAttribute("rel")===(a.rel==null?null:a.rel)&&f.getAttribute("title")===(a.title==null?null:a.title)&&f.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){p.splice(y,1);break t}}f=o.createElement(r),bt(f,r,a),o.head.appendChild(f);break;case"meta":if(p=pm("meta","content",o).get(r+(a.content||""))){for(y=0;y<p.length;y++)if(f=p[y],f.getAttribute("content")===(a.content==null?null:""+a.content)&&f.getAttribute("name")===(a.name==null?null:a.name)&&f.getAttribute("property")===(a.property==null?null:a.property)&&f.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&f.getAttribute("charset")===(a.charSet==null?null:a.charSet)){p.splice(y,1);break t}}f=o.createElement(r),bt(f,r,a),o.head.appendChild(f);break;default:throw Error(l(468,r))}f[mt]=e,dt(f),r=f}e.stateNode=r}else mm(o,e.type,e.stateNode);else e.stateNode=hm(o,r,e.memoizedProps);else f!==r?(f===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):f.count--,r===null?mm(o,e.type,e.stateNode):hm(o,r,e.memoizedProps)):r===null&&e.stateNode!==null&&jo(e,e.memoizedProps,a.memoizedProps)}break;case 27:Ot(t,e),zt(e),r&512&&(ut||a===null||xn(a,a.return)),a!==null&&r&4&&jo(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Ot(t,e),zt(e),r&512&&(ut||a===null||xn(a,a.return)),e.flags&32){o=e.stateNode;try{pa(o,"")}catch(ne){ke(e,e.return,ne)}}r&4&&e.stateNode!=null&&(o=e.memoizedProps,jo(e,o,a!==null?a.memoizedProps:o)),r&1024&&($o=!0);break;case 6:if(Ot(t,e),zt(e),r&4){if(e.stateNode===null)throw Error(l(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(ne){ke(e,e.return,ne)}}break;case 3:if(Sl=null,o=pn,pn=bl(t.containerInfo),Ot(t,e),pn=o,zt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{qa(t.containerInfo)}catch(ne){ke(e,e.return,ne)}$o&&($o=!1,mp(e));break;case 4:r=pn,pn=bl(e.stateNode.containerInfo),Ot(t,e),zt(e),pn=r;break;case 12:Ot(t,e),zt(e);break;case 31:Ot(t,e),zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 13:Ot(t,e),zt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ll=Ve()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 22:o=e.memoizedState!==null;var S=a!==null&&a.memoizedState!==null,O=$n,j=ut;if($n=O||o,ut=j||S,Ot(t,e),ut=j,$n=O,zt(e),r&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(a===null||S||$n||ut||Pi(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){S=a=t;try{if(f=S.stateNode,o)p=f.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{y=S.stateNode;var I=S.memoizedProps.style,_=I!=null&&I.hasOwnProperty("display")?I.display:null;y.style.display=_==null||typeof _=="boolean"?"":(""+_).trim()}}catch(ne){ke(S,S.return,ne)}}}else if(t.tag===6){if(a===null){S=t;try{S.stateNode.nodeValue=o?"":S.memoizedProps}catch(ne){ke(S,S.return,ne)}}}else if(t.tag===18){if(a===null){S=t;try{var U=S.stateNode;o?am(U,!0):am(S.stateNode,!1)}catch(ne){ke(S,S.return,ne)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,sl(e,a))));break;case 19:Ot(t,e),zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 30:break;case 21:break;default:Ot(t,e),zt(e)}}function zt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(rp(r)){a=r;break}r=r.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var o=a.stateNode,f=Bo(e);al(e,f,o);break;case 5:var p=a.stateNode;a.flags&32&&(pa(p,""),a.flags&=-33);var y=Bo(e);al(e,y,p);break;case 3:case 4:var S=a.stateNode.containerInfo,O=Bo(e);Go(e,O,S);break;default:throw Error(l(161))}}catch(j){ke(e,e.return,j)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function mp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;mp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function In(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)op(e,t.alternate,t),t=t.sibling}function Pi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:fi(4,t,t.return),Pi(t);break;case 1:xn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&ap(t,t.return,a),Pi(t);break;case 27:Ys(t.stateNode);case 26:case 5:xn(t,t.return),Pi(t);break;case 22:t.memoizedState===null&&Pi(t);break;case 30:Pi(t);break;default:Pi(t)}e=e.sibling}}function Fn(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,o=e,f=t,p=f.flags;switch(f.tag){case 0:case 11:case 15:Fn(o,f,a),Ls(4,f);break;case 1:if(Fn(o,f,a),r=f,o=r.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(O){ke(r,r.return,O)}if(r=f,o=r.updateQueue,o!==null){var y=r.stateNode;try{var S=o.shared.hiddenCallbacks;if(S!==null)for(o.shared.hiddenCallbacks=null,o=0;o<S.length;o++)Yd(S[o],y)}catch(O){ke(r,r.return,O)}}a&&p&64&&ip(f),js(f,f.return);break;case 27:lp(f);case 26:case 5:Fn(o,f,a),a&&r===null&&p&4&&sp(f),js(f,f.return);break;case 12:Fn(o,f,a);break;case 31:Fn(o,f,a),a&&p&4&&dp(o,f);break;case 13:Fn(o,f,a),a&&p&4&&hp(o,f);break;case 22:f.memoizedState===null&&Fn(o,f,a),js(f,f.return);break;case 30:break;default:Fn(o,f,a)}t=t.sibling}}function Vo(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Es(a))}function Io(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Es(e))}function mn(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)gp(e,t,a,r),t=t.sibling}function gp(e,t,a,r){var o=t.flags;switch(t.tag){case 0:case 11:case 15:mn(e,t,a,r),o&2048&&Ls(9,t);break;case 1:mn(e,t,a,r);break;case 3:mn(e,t,a,r),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Es(e)));break;case 12:if(o&2048){mn(e,t,a,r),e=t.stateNode;try{var f=t.memoizedProps,p=f.id,y=f.onPostCommit;typeof y=="function"&&y(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(S){ke(t,t.return,S)}}else mn(e,t,a,r);break;case 31:mn(e,t,a,r);break;case 13:mn(e,t,a,r);break;case 23:break;case 22:f=t.stateNode,p=t.alternate,t.memoizedState!==null?f._visibility&2?mn(e,t,a,r):Bs(e,t):f._visibility&2?mn(e,t,a,r):(f._visibility|=2,Na(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),o&2048&&Vo(p,t);break;case 24:mn(e,t,a,r),o&2048&&Io(t.alternate,t);break;default:mn(e,t,a,r)}}function Na(e,t,a,r,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,p=t,y=a,S=r,O=p.flags;switch(p.tag){case 0:case 11:case 15:Na(f,p,y,S,o),Ls(8,p);break;case 23:break;case 22:var j=p.stateNode;p.memoizedState!==null?j._visibility&2?Na(f,p,y,S,o):Bs(f,p):(j._visibility|=2,Na(f,p,y,S,o)),o&&O&2048&&Vo(p.alternate,p);break;case 24:Na(f,p,y,S,o),o&&O&2048&&Io(p.alternate,p);break;default:Na(f,p,y,S,o)}t=t.sibling}}function Bs(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,o=r.flags;switch(r.tag){case 22:Bs(a,r),o&2048&&Vo(r.alternate,r);break;case 24:Bs(a,r),o&2048&&Io(r.alternate,r);break;default:Bs(a,r)}t=t.sibling}}var Gs=8192;function ka(e,t,a){if(e.subtreeFlags&Gs)for(e=e.child;e!==null;)yp(e,t,a),e=e.sibling}function yp(e,t,a){switch(e.tag){case 26:ka(e,t,a),e.flags&Gs&&e.memoizedState!==null&&lx(a,pn,e.memoizedState,e.memoizedProps);break;case 5:ka(e,t,a);break;case 3:case 4:var r=pn;pn=bl(e.stateNode.containerInfo),ka(e,t,a),pn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Gs,Gs=16777216,ka(e,t,a),Gs=r):ka(e,t,a));break;default:ka(e,t,a)}}function vp(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 $s(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];ht=r,xp(r,e)}vp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)bp(e),e=e.sibling}function bp(e){switch(e.tag){case 0:case 11:case 15:$s(e),e.flags&2048&&fi(9,e,e.return);break;case 3:$s(e);break;case 12:$s(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,rl(e)):$s(e);break;default:$s(e)}}function rl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];ht=r,xp(r,e)}vp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:fi(8,t,t.return),rl(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,rl(t));break;default:rl(t)}e=e.sibling}}function xp(e,t){for(;ht!==null;){var a=ht;switch(a.tag){case 0:case 11:case 15:fi(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Es(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,ht=r;else e:for(a=e;ht!==null;){r=ht;var o=r.sibling,f=r.return;if(cp(r),r===a){ht=null;break e}if(o!==null){o.return=f,ht=o;break e}ht=f}}}var wb={getCacheForType:function(e){var t=yt(st),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return yt(st).controller.signal}},Eb=typeof WeakMap=="function"?WeakMap:Map,_e=0,Ge=null,xe=null,Ee=0,Ne=0,$t=null,di=!1,La=!1,Fo=!1,Hn=0,Je=0,hi=0,Zi=0,Ho=0,Vt=0,ja=0,Vs=null,_t=null,qo=!1,ll=0,Sp=0,ul=1/0,ol=null,pi=null,ct=0,mi=null,Ba=null,qn=0,Yo=0,Xo=null,wp=null,Is=0,Ko=null;function It(){return(_e&2)!==0&&Ee!==0?Ee&-Ee:R.T!==null?ec():Bf()}function Ep(){if(Vt===0)if((Ee&536870912)===0||Me){var e=yr;yr<<=1,(yr&3932160)===0&&(yr=262144),Vt=e}else Vt=536870912;return e=Bt.current,e!==null&&(e.flags|=32),Vt}function Ut(e,t,a){(e===Ge&&(Ne===2||Ne===9)||e.cancelPendingCommit!==null)&&(Ga(e,0),gi(e,Ee,Vt,!1)),os(e,a),((_e&2)===0||e!==Ge)&&(e===Ge&&((_e&2)===0&&(Zi|=a),Je===4&&gi(e,Ee,Vt,!1)),Sn(e))}function Tp(e,t,a){if((_e&6)!==0)throw Error(l(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||us(e,t),o=r?Mb(e,t):Po(e,t,!0),f=r;do{if(o===0){La&&!r&&gi(e,t,0,!1);break}else{if(a=e.current.alternate,f&&!Tb(a)){o=Po(e,t,!1),f=!1;continue}if(o===2){if(f=t,e.errorRecoveryDisabledLanes&f)var p=0;else p=e.pendingLanes&-536870913,p=p!==0?p:p&536870912?536870912:0;if(p!==0){t=p;e:{var y=e;o=Vs;var S=y.current.memoizedState.isDehydrated;if(S&&(Ga(y,p).flags|=256),p=Po(y,p,!1),p!==2){if(Fo&&!S){y.errorRecoveryDisabledLanes|=f,Zi|=f,o=4;break e}f=_t,_t=o,f!==null&&(_t===null?_t=f:_t.push.apply(_t,f))}o=p}if(f=!1,o!==2)continue}}if(o===1){Ga(e,0),gi(e,t,0,!0);break}e:{switch(r=e,f=o,f){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:gi(r,t,Vt,!di);break e;case 2:_t=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(o=ll+300-Ve(),10<o)){if(gi(r,t,Vt,!di),br(r,0,!0)!==0)break e;qn=t,r.timeoutHandle=tm(Ap.bind(null,r,a,_t,ol,qo,t,Vt,Zi,ja,di,f,"Throttled",-0,0),o);break e}Ap(r,a,_t,ol,qo,t,Vt,Zi,ja,di,f,null,-0,0)}}break}while(!0);Sn(e)}function Ap(e,t,a,r,o,f,p,y,S,O,j,I,_,U){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:On},yp(t,f,I);var ne=(f&62914560)===f?ll-Ve():(f&4194048)===f?Sp-Ve():0;if(ne=ux(I,ne),ne!==null){qn=f,e.cancelPendingCommit=ne(Up.bind(null,e,t,f,a,r,o,p,y,S,j,I,null,_,U)),gi(e,f,p,!O);return}}Up(e,t,f,a,r,o,p,y,S)}function Tb(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var o=a[r],f=o.getSnapshot;o=o.value;try{if(!Lt(f(),o))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;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 gi(e,t,a,r){t&=~Ho,t&=~Zi,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var o=t;0<o;){var f=31-tt(o),p=1<<f;r[f]=-1,o&=~p}a!==0&&kf(e,a,t)}function cl(){return(_e&6)===0?(Fs(0),!1):!0}function Qo(){if(xe!==null){if(Ne===0)var e=xe.return;else e=xe,Nn=Ii=null,co(e),Ca=null,As=0,e=xe;for(;e!==null;)np(e.alternate,e),e=e.return;xe=null}}function Ga(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Hb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),qn=0,Qo(),Ge=e,xe=a=_n(e.current,null),Ee=t,Ne=0,$t=null,di=!1,La=us(e,t),Fo=!1,ja=Vt=Ho=Zi=hi=Je=0,_t=Vs=null,qo=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var o=31-tt(r),f=1<<o;t|=e[o],r&=~f}return Hn=t,zr(),a}function Mp(e,t){ge=null,R.H=Us,t===Ra||t===Gr?(t=Id(),Ne=3):t===Wu?(t=Id(),Ne=4):Ne=t===Do?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,$t=t,xe===null&&(Je=1,Jr(e,Zt(t,e.current)))}function Dp(){var e=Bt.current;return e===null?!0:(Ee&4194048)===Ee?tn===null:(Ee&62914560)===Ee||(Ee&536870912)!==0?e===tn:!1}function Rp(){var e=R.H;return R.H=Us,e===null?Us:e}function Cp(){var e=R.A;return R.A=wb,e}function fl(){Je=4,di||(Ee&4194048)!==Ee&&Bt.current!==null||(La=!0),(hi&134217727)===0&&(Zi&134217727)===0||Ge===null||gi(Ge,Ee,Vt,!1)}function Po(e,t,a){var r=_e;_e|=2;var o=Rp(),f=Cp();(Ge!==e||Ee!==t)&&(ol=null,Ga(e,t)),t=!1;var p=Je;e:do try{if(Ne!==0&&xe!==null){var y=xe,S=$t;switch(Ne){case 8:Qo(),p=6;break e;case 3:case 2:case 9:case 6:Bt.current===null&&(t=!0);var O=Ne;if(Ne=0,$t=null,$a(e,y,S,O),a&&La){p=0;break e}break;default:O=Ne,Ne=0,$t=null,$a(e,y,S,O)}}Ab(),p=Je;break}catch(j){Mp(e,j)}while(!0);return t&&e.shellSuspendCounter++,Nn=Ii=null,_e=r,R.H=o,R.A=f,xe===null&&(Ge=null,Ee=0,zr()),p}function Ab(){for(;xe!==null;)Op(xe)}function Mb(e,t){var a=_e;_e|=2;var r=Rp(),o=Cp();Ge!==e||Ee!==t?(ol=null,ul=Ve()+500,Ga(e,t)):La=us(e,t);e:do try{if(Ne!==0&&xe!==null){t=xe;var f=$t;t:switch(Ne){case 1:Ne=0,$t=null,$a(e,t,f,1);break;case 2:case 9:if($d(f)){Ne=0,$t=null,zp(t);break}t=function(){Ne!==2&&Ne!==9||Ge!==e||(Ne=7),Sn(e)},f.then(t,t);break e;case 3:Ne=7;break e;case 4:Ne=5;break e;case 7:$d(f)?(Ne=0,$t=null,zp(t)):(Ne=0,$t=null,$a(e,t,f,7));break;case 5:var p=null;switch(xe.tag){case 26:p=xe.memoizedState;case 5:case 27:var y=xe;if(p?gm(p):y.stateNode.complete){Ne=0,$t=null;var S=y.sibling;if(S!==null)xe=S;else{var O=y.return;O!==null?(xe=O,dl(O)):xe=null}break t}}Ne=0,$t=null,$a(e,t,f,5);break;case 6:Ne=0,$t=null,$a(e,t,f,6);break;case 8:Qo(),Je=6;break e;default:throw Error(l(462))}}Db();break}catch(j){Mp(e,j)}while(!0);return Nn=Ii=null,R.H=r,R.A=o,_e=a,xe!==null?0:(Ge=null,Ee=0,zr(),Je)}function Db(){for(;xe!==null&&!Qe();)Op(xe)}function Op(e){var t=ep(e.alternate,e,Hn);e.memoizedProps=e.pendingProps,t===null?dl(e):xe=t}function zp(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Kh(a,t,t.pendingProps,t.type,void 0,Ee);break;case 11:t=Kh(a,t,t.pendingProps,t.type.render,t.ref,Ee);break;case 5:co(t);default:np(a,t),t=xe=Cd(t,Hn),t=ep(a,t,Hn)}e.memoizedProps=e.pendingProps,t===null?dl(e):xe=t}function $a(e,t,a,r){Nn=Ii=null,co(t),Ca=null,As=0;var o=t.return;try{if(mb(e,o,t,a,Ee)){Je=1,Jr(e,Zt(a,e.current)),xe=null;return}}catch(f){if(o!==null)throw xe=o,f;Je=1,Jr(e,Zt(a,e.current)),xe=null;return}t.flags&32768?(Me||r===1?e=!0:La||(Ee&536870912)!==0?e=!1:(di=e=!0,(r===2||r===9||r===3||r===6)&&(r=Bt.current,r!==null&&r.tag===13&&(r.flags|=16384))),_p(t,e)):dl(t)}function dl(e){var t=e;do{if((t.flags&32768)!==0){_p(t,di);return}e=t.return;var a=vb(t.alternate,t,Hn);if(a!==null){xe=a;return}if(t=t.sibling,t!==null){xe=t;return}xe=t=e}while(t!==null);Je===0&&(Je=5)}function _p(e,t){do{var a=bb(e.alternate,e);if(a!==null){a.flags&=32767,xe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){xe=e;return}xe=e=a}while(e!==null);Je=6,xe=null}function Up(e,t,a,r,o,f,p,y,S){e.cancelPendingCommit=null;do hl();while(ct!==0);if((_e&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=ju,rv(e,a,f,p,y,S),e===Ge&&(xe=Ge=null,Ee=0),Ba=t,mi=e,qn=a,Yo=f,Xo=o,wp=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,zb(Dn,function(){return Bp(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=R.T,R.T=null,o=Y.p,Y.p=2,p=_e,_e|=4;try{xb(e,t,a)}finally{_e=p,Y.p=o,R.T=r}}ct=1,Np(),kp(),Lp()}}function Np(){if(ct===1){ct=0;var e=mi,t=Ba,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=R.T,R.T=null;var r=Y.p;Y.p=2;var o=_e;_e|=4;try{pp(t,e);var f=uc,p=xd(e.containerInfo),y=f.focusedElem,S=f.selectionRange;if(p!==y&&y&&y.ownerDocument&&bd(y.ownerDocument.documentElement,y)){if(S!==null&&_u(y)){var O=S.start,j=S.end;if(j===void 0&&(j=O),"selectionStart"in y)y.selectionStart=O,y.selectionEnd=Math.min(j,y.value.length);else{var I=y.ownerDocument||document,_=I&&I.defaultView||window;if(_.getSelection){var U=_.getSelection(),ne=y.textContent.length,ce=Math.min(S.start,ne),Be=S.end===void 0?ce:Math.min(S.end,ne);!U.extend&&ce>Be&&(p=Be,Be=ce,ce=p);var A=vd(y,ce),T=vd(y,Be);if(A&&T&&(U.rangeCount!==1||U.anchorNode!==A.node||U.anchorOffset!==A.offset||U.focusNode!==T.node||U.focusOffset!==T.offset)){var C=I.createRange();C.setStart(A.node,A.offset),U.removeAllRanges(),ce>Be?(U.addRange(C),U.extend(T.node,T.offset)):(C.setEnd(T.node,T.offset),U.addRange(C))}}}}for(I=[],U=y;U=U.parentNode;)U.nodeType===1&&I.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<I.length;y++){var $=I[y];$.element.scrollLeft=$.left,$.element.scrollTop=$.top}}Al=!!lc,uc=lc=null}finally{_e=o,Y.p=r,R.T=a}}e.current=t,ct=2}}function kp(){if(ct===2){ct=0;var e=mi,t=Ba,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=R.T,R.T=null;var r=Y.p;Y.p=2;var o=_e;_e|=4;try{op(e,t.alternate,t)}finally{_e=o,Y.p=r,R.T=a}}ct=3}}function Lp(){if(ct===4||ct===3){ct=0,Xt();var e=mi,t=Ba,a=qn,r=wp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ct=5:(ct=0,Ba=mi=null,jp(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(pi=null),hu(a),t=t.stateNode,He&&typeof He.onCommitFiberRoot=="function")try{He.onCommitFiberRoot(ft,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=R.T,o=Y.p,Y.p=2,R.T=null;try{for(var f=e.onRecoverableError,p=0;p<r.length;p++){var y=r[p];f(y.value,{componentStack:y.stack})}}finally{R.T=t,Y.p=o}}(qn&3)!==0&&hl(),Sn(e),o=e.pendingLanes,(a&261930)!==0&&(o&42)!==0?e===Ko?Is++:(Is=0,Ko=e):Is=0,Fs(0)}}function jp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Es(t)))}function hl(){return Np(),kp(),Lp(),Bp()}function Bp(){if(ct!==5)return!1;var e=mi,t=Yo;Yo=0;var a=hu(qn),r=R.T,o=Y.p;try{Y.p=32>a?32:a,R.T=null,a=Xo,Xo=null;var f=mi,p=qn;if(ct=0,Ba=mi=null,qn=0,(_e&6)!==0)throw Error(l(331));var y=_e;if(_e|=4,bp(f.current),gp(f,f.current,p,a),_e=y,Fs(0,!1),He&&typeof He.onPostCommitFiberRoot=="function")try{He.onPostCommitFiberRoot(ft,f)}catch{}return!0}finally{Y.p=o,R.T=r,jp(e,t)}}function Gp(e,t,a){t=Zt(a,t),t=Mo(e.stateNode,t,2),e=ui(e,t,2),e!==null&&(os(e,2),Sn(e))}function ke(e,t,a){if(e.tag===3)Gp(e,e,a);else for(;t!==null;){if(t.tag===3){Gp(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(pi===null||!pi.has(r))){e=Zt(a,e),a=$h(2),r=ui(t,a,2),r!==null&&(Vh(a,r,t,e),os(r,2),Sn(r));break}}t=t.return}}function Zo(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Eb;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(a)||(Fo=!0,o.add(a),e=Rb.bind(null,e,t,a),t.then(e,e))}function Rb(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ge===e&&(Ee&a)===a&&(Je===4||Je===3&&(Ee&62914560)===Ee&&300>Ve()-ll?(_e&2)===0&&Ga(e,0):Ho|=a,ja===Ee&&(ja=0)),Sn(e)}function $p(e,t){t===0&&(t=Nf()),e=Gi(e,t),e!==null&&(os(e,t),Sn(e))}function Cb(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),$p(e,a)}function Ob(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(a=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(l(314))}r!==null&&r.delete(t),$p(e,a)}function zb(e,t){return Ce(e,t)}var pl=null,Va=null,Wo=!1,ml=!1,Jo=!1,yi=0;function Sn(e){e!==Va&&e.next===null&&(Va===null?pl=Va=e:Va=Va.next=e),ml=!0,Wo||(Wo=!0,Ub())}function Fs(e,t){if(!Jo&&ml){Jo=!0;do for(var a=!1,r=pl;r!==null;){if(e!==0){var o=r.pendingLanes;if(o===0)var f=0;else{var p=r.suspendedLanes,y=r.pingedLanes;f=(1<<31-tt(42|e)+1)-1,f&=o&~(p&~y),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(a=!0,Hp(r,f))}else f=Ee,f=br(r,r===Ge?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(f&3)===0||us(r,f)||(a=!0,Hp(r,f));r=r.next}while(a);Jo=!1}}function _b(){Vp()}function Vp(){ml=Wo=!1;var e=0;yi!==0&&Fb()&&(e=yi);for(var t=Ve(),a=null,r=pl;r!==null;){var o=r.next,f=Ip(r,t);f===0?(r.next=null,a===null?pl=o:a.next=o,o===null&&(Va=a)):(a=r,(e!==0||(f&3)!==0)&&(ml=!0)),r=o}ct!==0&&ct!==5||Fs(e),yi!==0&&(yi=0)}function Ip(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var p=31-tt(f),y=1<<p,S=o[p];S===-1?((y&a)===0||(y&r)!==0)&&(o[p]=sv(y,t)):S<=t&&(e.expiredLanes|=y),f&=~y}if(t=Ge,a=Ee,a=br(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Ne===2||Ne===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ke(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||us(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Ke(r),hu(a)){case 2:case 8:a=kt;break;case 32:a=Dn;break;case 268435456:a=Rn;break;default:a=Dn}return r=Fp.bind(null,e),a=Ce(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Ke(r),e.callbackPriority=2,e.callbackNode=null,2}function Fp(e,t){if(ct!==0&&ct!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(hl()&&e.callbackNode!==a)return null;var r=Ee;return r=br(e,e===Ge?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Tp(e,r,t),Ip(e,Ve()),e.callbackNode!=null&&e.callbackNode===a?Fp.bind(null,e):null)}function Hp(e,t){if(hl())return null;Tp(e,t,!0)}function Ub(){qb(function(){(_e&6)!==0?Ce(xt,_b):Vp()})}function ec(){if(yi===0){var e=Ma;e===0&&(e=gr,gr<<=1,(gr&261888)===0&&(gr=256)),yi=e}return yi}function qp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Er(""+e)}function Yp(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function Nb(e,t,a,r,o){if(t==="submit"&&a&&a.stateNode===o){var f=qp((o[Dt]||null).action),p=r.submitter;p&&(t=(t=p[Dt]||null)?qp(t.formAction):p.getAttribute("formAction"),t!==null&&(f=t,p=null));var y=new Dr("action","action",null,r,o);e.push({event:y,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(yi!==0){var S=p?Yp(o,p):new FormData(o);xo(a,{pending:!0,data:S,method:o.method,action:f},null,S)}}else typeof f=="function"&&(y.preventDefault(),S=p?Yp(o,p):new FormData(o),xo(a,{pending:!0,data:S,method:o.method,action:f},f,S))},currentTarget:o}]})}}for(var tc=0;tc<Lu.length;tc++){var nc=Lu[tc],kb=nc.toLowerCase(),Lb=nc[0].toUpperCase()+nc.slice(1);hn(kb,"on"+Lb)}hn(Ed,"onAnimationEnd"),hn(Td,"onAnimationIteration"),hn(Ad,"onAnimationStart"),hn("dblclick","onDoubleClick"),hn("focusin","onFocus"),hn("focusout","onBlur"),hn(Wv,"onTransitionRun"),hn(Jv,"onTransitionStart"),hn(eb,"onTransitionCancel"),hn(Md,"onTransitionEnd"),da("onMouseEnter",["mouseout","mouseover"]),da("onMouseLeave",["mouseout","mouseover"]),da("onPointerEnter",["pointerout","pointerover"]),da("onPointerLeave",["pointerout","pointerover"]),ki("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ki("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ki("onBeforeInput",["compositionend","keypress","textInput","paste"]),ki("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ki("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ki("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hs="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(" "),jb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Hs));function Xp(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],o=r.event;r=r.listeners;e:{var f=void 0;if(t)for(var p=r.length-1;0<=p;p--){var y=r[p],S=y.instance,O=y.currentTarget;if(y=y.listener,S!==f&&o.isPropagationStopped())break e;f=y,o.currentTarget=O;try{f(o)}catch(j){Or(j)}o.currentTarget=null,f=S}else for(p=0;p<r.length;p++){if(y=r[p],S=y.instance,O=y.currentTarget,y=y.listener,S!==f&&o.isPropagationStopped())break e;f=y,o.currentTarget=O;try{f(o)}catch(j){Or(j)}o.currentTarget=null,f=S}}}}function Se(e,t){var a=t[pu];a===void 0&&(a=t[pu]=new Set);var r=e+"__bubble";a.has(r)||(Kp(t,e,2,!1),a.add(r))}function ic(e,t,a){var r=0;t&&(r|=4),Kp(a,e,r,t)}var gl="_reactListening"+Math.random().toString(36).slice(2);function ac(e){if(!e[gl]){e[gl]=!0,Vf.forEach(function(a){a!=="selectionchange"&&(jb.has(a)||ic(a,!1,e),ic(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[gl]||(t[gl]=!0,ic("selectionchange",!1,t))}}function Kp(e,t,a,r){switch(Em(t)){case 2:var o=fx;break;case 8:o=dx;break;default:o=bc}a=o.bind(null,t,a,e),o=void 0,!Eu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,a,{capture:!0,passive:o}):e.addEventListener(t,a,!0):o!==void 0?e.addEventListener(t,a,{passive:o}):e.addEventListener(t,a,!1)}function sc(e,t,a,r,o){var f=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var p=r.tag;if(p===3||p===4){var y=r.stateNode.containerInfo;if(y===o)break;if(p===4)for(p=r.return;p!==null;){var S=p.tag;if((S===3||S===4)&&p.stateNode.containerInfo===o)return;p=p.return}for(;y!==null;){if(p=oa(y),p===null)return;if(S=p.tag,S===5||S===6||S===26||S===27){r=f=p;continue e}y=y.parentNode}}r=r.return}Jf(function(){var O=f,j=Su(a),I=[];e:{var _=Dd.get(e);if(_!==void 0){var U=Dr,ne=e;switch(e){case"keypress":if(Ar(a)===0)break e;case"keydown":case"keyup":U=Ov;break;case"focusin":ne="focus",U=Du;break;case"focusout":ne="blur",U=Du;break;case"beforeblur":case"afterblur":U=Du;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":U=nd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=vv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=Uv;break;case Ed:case Td:case Ad:U=Sv;break;case Md:U=kv;break;case"scroll":case"scrollend":U=gv;break;case"wheel":U=jv;break;case"copy":case"cut":case"paste":U=Ev;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=ad;break;case"toggle":case"beforetoggle":U=Gv}var ce=(t&4)!==0,Be=!ce&&(e==="scroll"||e==="scrollend"),A=ce?_!==null?_+"Capture":null:_;ce=[];for(var T=O,C;T!==null;){var $=T;if(C=$.stateNode,$=$.tag,$!==5&&$!==26&&$!==27||C===null||A===null||($=ds(T,A),$!=null&&ce.push(qs(T,$,C))),Be)break;T=T.return}0<ce.length&&(_=new U(_,ne,null,a,j),I.push({event:_,listeners:ce}))}}if((t&7)===0){e:{if(_=e==="mouseover"||e==="pointerover",U=e==="mouseout"||e==="pointerout",_&&a!==xu&&(ne=a.relatedTarget||a.fromElement)&&(oa(ne)||ne[ua]))break e;if((U||_)&&(_=j.window===j?j:(_=j.ownerDocument)?_.defaultView||_.parentWindow:window,U?(ne=a.relatedTarget||a.toElement,U=O,ne=ne?oa(ne):null,ne!==null&&(Be=c(ne),ce=ne.tag,ne!==Be||ce!==5&&ce!==27&&ce!==6)&&(ne=null)):(U=null,ne=O),U!==ne)){if(ce=nd,$="onMouseLeave",A="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(ce=ad,$="onPointerLeave",A="onPointerEnter",T="pointer"),Be=U==null?_:fs(U),C=ne==null?_:fs(ne),_=new ce($,T+"leave",U,a,j),_.target=Be,_.relatedTarget=C,$=null,oa(j)===O&&(ce=new ce(A,T+"enter",ne,a,j),ce.target=C,ce.relatedTarget=Be,$=ce),Be=$,U&&ne)t:{for(ce=Bb,A=U,T=ne,C=0,$=A;$;$=ce($))C++;$=0;for(var oe=T;oe;oe=ce(oe))$++;for(;0<C-$;)A=ce(A),C--;for(;0<$-C;)T=ce(T),$--;for(;C--;){if(A===T||T!==null&&A===T.alternate){ce=A;break t}A=ce(A),T=ce(T)}ce=null}else ce=null;U!==null&&Qp(I,_,U,ce,!1),ne!==null&&Be!==null&&Qp(I,Be,ne,ce,!0)}}e:{if(_=O?fs(O):window,U=_.nodeName&&_.nodeName.toLowerCase(),U==="select"||U==="input"&&_.type==="file")var Oe=dd;else if(cd(_))if(hd)Oe=Qv;else{Oe=Xv;var se=Yv}else U=_.nodeName,!U||U.toLowerCase()!=="input"||_.type!=="checkbox"&&_.type!=="radio"?O&&bu(O.elementType)&&(Oe=dd):Oe=Kv;if(Oe&&(Oe=Oe(e,O))){fd(I,Oe,a,j);break e}se&&se(e,_,O),e==="focusout"&&O&&_.type==="number"&&O.memoizedProps.value!=null&&vu(_,"number",_.value)}switch(se=O?fs(O):window,e){case"focusin":(cd(se)||se.contentEditable==="true")&&(va=se,Uu=O,xs=null);break;case"focusout":xs=Uu=va=null;break;case"mousedown":Nu=!0;break;case"contextmenu":case"mouseup":case"dragend":Nu=!1,Sd(I,a,j);break;case"selectionchange":if(Zv)break;case"keydown":case"keyup":Sd(I,a,j)}var ve;if(Cu)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else ya?ud(e,a)&&(Te="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Te="onCompositionStart");Te&&(sd&&a.locale!=="ko"&&(ya||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&ya&&(ve=ed()):(ti=j,Tu="value"in ti?ti.value:ti.textContent,ya=!0)),se=yl(O,Te),0<se.length&&(Te=new id(Te,e,null,a,j),I.push({event:Te,listeners:se}),ve?Te.data=ve:(ve=od(a),ve!==null&&(Te.data=ve)))),(ve=Vv?Iv(e,a):Fv(e,a))&&(Te=yl(O,"onBeforeInput"),0<Te.length&&(se=new id("onBeforeInput","beforeinput",null,a,j),I.push({event:se,listeners:Te}),se.data=ve)),Nb(I,e,O,a,j)}Xp(I,t)})}function qs(e,t,a){return{instance:e,listener:t,currentTarget:a}}function yl(e,t){for(var a=t+"Capture",r=[];e!==null;){var o=e,f=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||f===null||(o=ds(e,a),o!=null&&r.unshift(qs(e,o,f)),o=ds(e,t),o!=null&&r.push(qs(e,o,f))),e.tag===3)return r;e=e.return}return[]}function Bb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Qp(e,t,a,r,o){for(var f=t._reactName,p=[];a!==null&&a!==r;){var y=a,S=y.alternate,O=y.stateNode;if(y=y.tag,S!==null&&S===r)break;y!==5&&y!==26&&y!==27||O===null||(S=O,o?(O=ds(a,f),O!=null&&p.unshift(qs(a,O,S))):o||(O=ds(a,f),O!=null&&p.push(qs(a,O,S)))),a=a.return}p.length!==0&&e.push({event:t,listeners:p})}var Gb=/\r\n?/g,$b=/\u0000|\uFFFD/g;function Pp(e){return(typeof e=="string"?e:""+e).replace(Gb,`
|
|
9
|
+
`).replace($b,"")}function Zp(e,t){return t=Pp(t),Pp(e)===t}function je(e,t,a,r,o,f){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||pa(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&pa(e,""+r);break;case"className":Sr(e,"class",r);break;case"tabIndex":Sr(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Sr(e,a,r);break;case"style":Zf(e,r,f);break;case"data":if(t!=="object"){Sr(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Er(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(a==="formAction"?(t!=="input"&&je(e,t,"name",o.name,o,null),je(e,t,"formEncType",o.formEncType,o,null),je(e,t,"formMethod",o.formMethod,o,null),je(e,t,"formTarget",o.formTarget,o,null)):(je(e,t,"encType",o.encType,o,null),je(e,t,"method",o.method,o,null),je(e,t,"target",o.target,o,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Er(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=On);break;case"onScroll":r!=null&&Se("scroll",e);break;case"onScrollEnd":r!=null&&Se("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(l(61));if(a=r.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}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}a=Er(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+r):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":Se("beforetoggle",e),Se("toggle",e),xr(e,"popover",r);break;case"xlinkActuate":Cn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Cn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Cn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Cn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Cn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Cn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":xr(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=pv.get(a)||a,xr(e,a,r))}}function rc(e,t,a,r,o,f){switch(a){case"style":Zf(e,r,f);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(l(61));if(a=r.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"children":typeof r=="string"?pa(e,r):(typeof r=="number"||typeof r=="bigint")&&pa(e,""+r);break;case"onScroll":r!=null&&Se("scroll",e);break;case"onScrollEnd":r!=null&&Se("scrollend",e);break;case"onClick":r!=null&&(e.onclick=On);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!If.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(o=a.endsWith("Capture"),t=a.slice(2,o?a.length-7:void 0),f=e[Dt]||null,f=f!=null?f[a]:null,typeof f=="function"&&e.removeEventListener(t,f,o),typeof r=="function")){typeof f!="function"&&f!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,o);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):xr(e,a,r)}}}function bt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Se("error",e),Se("load",e);var r=!1,o=!1,f;for(f in a)if(a.hasOwnProperty(f)){var p=a[f];if(p!=null)switch(f){case"src":r=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:je(e,t,f,p,a,null)}}o&&je(e,t,"srcSet",a.srcSet,a,null),r&&je(e,t,"src",a.src,a,null);return;case"input":Se("invalid",e);var y=f=p=o=null,S=null,O=null;for(r in a)if(a.hasOwnProperty(r)){var j=a[r];if(j!=null)switch(r){case"name":o=j;break;case"type":p=j;break;case"checked":S=j;break;case"defaultChecked":O=j;break;case"value":f=j;break;case"defaultValue":y=j;break;case"children":case"dangerouslySetInnerHTML":if(j!=null)throw Error(l(137,t));break;default:je(e,t,r,j,a,null)}}Xf(e,f,y,S,O,p,o,!1);return;case"select":Se("invalid",e),r=p=f=null;for(o in a)if(a.hasOwnProperty(o)&&(y=a[o],y!=null))switch(o){case"value":f=y;break;case"defaultValue":p=y;break;case"multiple":r=y;default:je(e,t,o,y,a,null)}t=f,a=p,e.multiple=!!r,t!=null?ha(e,!!r,t,!1):a!=null&&ha(e,!!r,a,!0);return;case"textarea":Se("invalid",e),f=o=r=null;for(p in a)if(a.hasOwnProperty(p)&&(y=a[p],y!=null))switch(p){case"value":r=y;break;case"defaultValue":o=y;break;case"children":f=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(l(91));break;default:je(e,t,p,y,a,null)}Qf(e,r,o,f);return;case"option":for(S in a)a.hasOwnProperty(S)&&(r=a[S],r!=null)&&(S==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":je(e,t,S,r,a,null));return;case"dialog":Se("beforetoggle",e),Se("toggle",e),Se("cancel",e),Se("close",e);break;case"iframe":case"object":Se("load",e);break;case"video":case"audio":for(r=0;r<Hs.length;r++)Se(Hs[r],e);break;case"image":Se("error",e),Se("load",e);break;case"details":Se("toggle",e);break;case"embed":case"source":case"link":Se("error",e),Se("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(O in a)if(a.hasOwnProperty(O)&&(r=a[O],r!=null))switch(O){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:je(e,t,O,r,a,null)}return;default:if(bu(t)){for(j in a)a.hasOwnProperty(j)&&(r=a[j],r!==void 0&&rc(e,t,j,r,a,void 0));return}}for(y in a)a.hasOwnProperty(y)&&(r=a[y],r!=null&&je(e,t,y,r,a,null))}function Vb(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,f=null,p=null,y=null,S=null,O=null,j=null;for(U in a){var I=a[U];if(a.hasOwnProperty(U)&&I!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":S=I;default:r.hasOwnProperty(U)||je(e,t,U,null,r,I)}}for(var _ in r){var U=r[_];if(I=a[_],r.hasOwnProperty(_)&&(U!=null||I!=null))switch(_){case"type":f=U;break;case"name":o=U;break;case"checked":O=U;break;case"defaultChecked":j=U;break;case"value":p=U;break;case"defaultValue":y=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:U!==I&&je(e,t,_,U,r,I)}}yu(e,p,y,S,O,j,f,o);return;case"select":U=p=y=_=null;for(f in a)if(S=a[f],a.hasOwnProperty(f)&&S!=null)switch(f){case"value":break;case"multiple":U=S;default:r.hasOwnProperty(f)||je(e,t,f,null,r,S)}for(o in r)if(f=r[o],S=a[o],r.hasOwnProperty(o)&&(f!=null||S!=null))switch(o){case"value":_=f;break;case"defaultValue":y=f;break;case"multiple":p=f;default:f!==S&&je(e,t,o,f,r,S)}t=y,a=p,r=U,_!=null?ha(e,!!a,_,!1):!!r!=!!a&&(t!=null?ha(e,!!a,t,!0):ha(e,!!a,a?[]:"",!1));return;case"textarea":U=_=null;for(y in a)if(o=a[y],a.hasOwnProperty(y)&&o!=null&&!r.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:je(e,t,y,null,r,o)}for(p in r)if(o=r[p],f=a[p],r.hasOwnProperty(p)&&(o!=null||f!=null))switch(p){case"value":_=o;break;case"defaultValue":U=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(l(91));break;default:o!==f&&je(e,t,p,o,r,f)}Kf(e,_,U);return;case"option":for(var ne in a)_=a[ne],a.hasOwnProperty(ne)&&_!=null&&!r.hasOwnProperty(ne)&&(ne==="selected"?e.selected=!1:je(e,t,ne,null,r,_));for(S in r)_=r[S],U=a[S],r.hasOwnProperty(S)&&_!==U&&(_!=null||U!=null)&&(S==="selected"?e.selected=_&&typeof _!="function"&&typeof _!="symbol":je(e,t,S,_,r,U));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 ce in a)_=a[ce],a.hasOwnProperty(ce)&&_!=null&&!r.hasOwnProperty(ce)&&je(e,t,ce,null,r,_);for(O in r)if(_=r[O],U=a[O],r.hasOwnProperty(O)&&_!==U&&(_!=null||U!=null))switch(O){case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(l(137,t));break;default:je(e,t,O,_,r,U)}return;default:if(bu(t)){for(var Be in a)_=a[Be],a.hasOwnProperty(Be)&&_!==void 0&&!r.hasOwnProperty(Be)&&rc(e,t,Be,void 0,r,_);for(j in r)_=r[j],U=a[j],!r.hasOwnProperty(j)||_===U||_===void 0&&U===void 0||rc(e,t,j,_,r,U);return}}for(var A in a)_=a[A],a.hasOwnProperty(A)&&_!=null&&!r.hasOwnProperty(A)&&je(e,t,A,null,r,_);for(I in r)_=r[I],U=a[I],!r.hasOwnProperty(I)||_===U||_==null&&U==null||je(e,t,I,_,r,U)}function Wp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ib(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var o=a[r],f=o.transferSize,p=o.initiatorType,y=o.duration;if(f&&y&&Wp(p)){for(p=0,y=o.responseEnd,r+=1;r<a.length;r++){var S=a[r],O=S.startTime;if(O>y)break;var j=S.transferSize,I=S.initiatorType;j&&Wp(I)&&(S=S.responseEnd,p+=j*(S<y?1:(y-O)/(S-O)))}if(--r,t+=8*(f+p)/(o.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 lc=null,uc=null;function vl(e){return e.nodeType===9?e:e.ownerDocument}function Jp(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 em(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 oc(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 cc=null;function Fb(){var e=window.event;return e&&e.type==="popstate"?e===cc?!1:(cc=e,!0):(cc=null,!1)}var tm=typeof setTimeout=="function"?setTimeout:void 0,Hb=typeof clearTimeout=="function"?clearTimeout:void 0,nm=typeof Promise=="function"?Promise:void 0,qb=typeof queueMicrotask=="function"?queueMicrotask:typeof nm<"u"?function(e){return nm.resolve(null).then(e).catch(Yb)}:tm;function Yb(e){setTimeout(function(){throw e})}function vi(e){return e==="head"}function im(e,t){var a=t,r=0;do{var o=a.nextSibling;if(e.removeChild(a),o&&o.nodeType===8)if(a=o.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(o),qa(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")Ys(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ys(a);for(var f=a.firstChild;f;){var p=f.nextSibling,y=f.nodeName;f[cs]||y==="SCRIPT"||y==="STYLE"||y==="LINK"&&f.rel.toLowerCase()==="stylesheet"||a.removeChild(f),f=p}}else a==="body"&&Ys(e.ownerDocument.body);a=o}while(a);qa(t)}function am(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function fc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":fc(a),mu(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Xb(e,t,a,r){for(;e.nodeType===1;){var o=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[cs])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=nn(e.nextSibling),e===null)break}return null}function Kb(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=nn(e.nextSibling),e===null))return null;return e}function sm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=nn(e.nextSibling),e===null))return null;return e}function dc(e){return e.data==="$?"||e.data==="$~"}function hc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Qb(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function nn(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 pc=null;function rm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return nn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function lm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function um(e,t,a){switch(t=vl(a),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function Ys(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mu(e)}var an=new Map,om=new Set;function bl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Yn=Y.d;Y.d={f:Pb,r:Zb,D:Wb,C:Jb,L:ex,m:tx,X:ix,S:nx,M:ax};function Pb(){var e=Yn.f(),t=cl();return e||t}function Zb(e){var t=ca(e);t!==null&&t.tag===5&&t.type==="form"?Mh(t):Yn.r(e)}var Ia=typeof document>"u"?null:document;function cm(e,t,a){var r=Ia;if(r&&typeof t=="string"&&t){var o=Qt(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),om.has(o)||(om.add(o),e={rel:e,crossOrigin:a,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),bt(t,"link",e),dt(t),r.head.appendChild(t)))}}function Wb(e){Yn.D(e),cm("dns-prefetch",e,null)}function Jb(e,t){Yn.C(e,t),cm("preconnect",e,t)}function ex(e,t,a){Yn.L(e,t,a);var r=Ia;if(r&&e&&t){var o='link[rel="preload"][as="'+Qt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Qt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Qt(a.imageSizes)+'"]')):o+='[href="'+Qt(e)+'"]';var f=o;switch(t){case"style":f=Fa(e);break;case"script":f=Ha(e)}an.has(f)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),an.set(f,e),r.querySelector(o)!==null||t==="style"&&r.querySelector(Xs(f))||t==="script"&&r.querySelector(Ks(f))||(t=r.createElement("link"),bt(t,"link",e),dt(t),r.head.appendChild(t)))}}function tx(e,t){Yn.m(e,t);var a=Ia;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Qt(r)+'"][href="'+Qt(e)+'"]',f=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ha(e)}if(!an.has(f)&&(e=b({rel:"modulepreload",href:e},t),an.set(f,e),a.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ks(f)))return}r=a.createElement("link"),bt(r,"link",e),dt(r),a.head.appendChild(r)}}}function nx(e,t,a){Yn.S(e,t,a);var r=Ia;if(r&&e){var o=fa(r).hoistableStyles,f=Fa(e);t=t||"default";var p=o.get(f);if(!p){var y={loading:0,preload:null};if(p=r.querySelector(Xs(f)))y.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=an.get(f))&&mc(e,a);var S=p=r.createElement("link");dt(S),bt(S,"link",e),S._p=new Promise(function(O,j){S.onload=O,S.onerror=j}),S.addEventListener("load",function(){y.loading|=1}),S.addEventListener("error",function(){y.loading|=2}),y.loading|=4,xl(p,t,r)}p={type:"stylesheet",instance:p,count:1,state:y},o.set(f,p)}}}function ix(e,t){Yn.X(e,t);var a=Ia;if(a&&e){var r=fa(a).hoistableScripts,o=Ha(e),f=r.get(o);f||(f=a.querySelector(Ks(o)),f||(e=b({src:e,async:!0},t),(t=an.get(o))&&gc(e,t),f=a.createElement("script"),dt(f),bt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},r.set(o,f))}}function ax(e,t){Yn.M(e,t);var a=Ia;if(a&&e){var r=fa(a).hoistableScripts,o=Ha(e),f=r.get(o);f||(f=a.querySelector(Ks(o)),f||(e=b({src:e,async:!0,type:"module"},t),(t=an.get(o))&&gc(e,t),f=a.createElement("script"),dt(f),bt(f,"link",e),a.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},r.set(o,f))}}function fm(e,t,a,r){var o=(o=fe.current)?bl(o):null;if(!o)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Fa(a.href),a=fa(o).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Fa(a.href);var f=fa(o).hoistableStyles,p=f.get(e);if(p||(o=o.ownerDocument||o,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,p),(f=o.querySelector(Xs(e)))&&!f._p&&(p.instance=f,p.state.loading=5),an.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},an.set(e,a),f||sx(o,e,a,p.state))),t&&r===null)throw Error(l(528,""));return p}if(t&&r!==null)throw Error(l(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ha(a),a=fa(o).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Fa(e){return'href="'+Qt(e)+'"'}function Xs(e){return'link[rel="stylesheet"]['+e+"]"}function dm(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function sx(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),bt(t,"link",a),dt(t),e.head.appendChild(t))}function Ha(e){return'[src="'+Qt(e)+'"]'}function Ks(e){return"script[async]"+e}function hm(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Qt(a.href)+'"]');if(r)return t.instance=r,dt(r),r;var o=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),dt(r),bt(r,"style",o),xl(r,a.precedence,e),t.instance=r;case"stylesheet":o=Fa(a.href);var f=e.querySelector(Xs(o));if(f)return t.state.loading|=4,t.instance=f,dt(f),f;r=dm(a),(o=an.get(o))&&mc(r,o),f=(e.ownerDocument||e).createElement("link"),dt(f);var p=f;return p._p=new Promise(function(y,S){p.onload=y,p.onerror=S}),bt(f,"link",r),t.state.loading|=4,xl(f,a.precedence,e),t.instance=f;case"script":return f=Ha(a.src),(o=e.querySelector(Ks(f)))?(t.instance=o,dt(o),o):(r=a,(o=an.get(f))&&(r=b({},a),gc(r,o)),e=e.ownerDocument||e,o=e.createElement("script"),dt(o),bt(o,"link",r),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,xl(r,a.precedence,e));return t.instance}function xl(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,f=o,p=0;p<r.length;p++){var y=r[p];if(y.dataset.precedence===t)f=y;else if(f!==o)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function mc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function gc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Sl=null;function pm(e,t,a){if(Sl===null){var r=new Map,o=Sl=new Map;o.set(a,r)}else o=Sl,r=o.get(a),r||(r=new Map,o.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),o=0;o<a.length;o++){var f=a[o];if(!(f[cs]||f[mt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var p=f.getAttribute(t)||"";p=e+p;var y=r.get(p);y?y.push(f):r.set(p,[f])}}return r}function mm(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function rx(e,t,a){if(a===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;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!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 gm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function lx(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=Fa(r.href),f=t.querySelector(Xs(o));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=wl.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=f,dt(f);return}f=t.ownerDocument||t,r=dm(r),(o=an.get(o))&&mc(r,o),f=f.createElement("link"),dt(f);var p=f;p._p=new Promise(function(y,S){p.onload=y,p.onerror=S}),bt(f,"link",r),a.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=wl.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var yc=0;function ux(e,t){return e.stylesheets&&e.count===0&&Tl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Tl(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&yc===0&&(yc=62500*Ib());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Tl(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>yc?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Tl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var El=null;function Tl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,El=new Map,t.forEach(ox,e),El=null,wl.call(e))}function ox(e,t){if(!(t.state.loading&4)){var a=El.get(e);if(a)var r=a.get(null);else{a=new Map,El.set(e,a);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<o.length;f++){var p=o[f];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(a.set(p.dataset.precedence,p),r=p)}r&&a.set(null,r)}o=t.instance,p=o.getAttribute("data-precedence"),f=a.get(p)||r,f===r&&a.set(null,o),a.set(p,o),this.count++,r=wl.bind(this),o.addEventListener("load",r),o.addEventListener("error",r),f?f.parentNode.insertBefore(o,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var Qs={$$typeof:F,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function cx(e,t,a,r,o,f,p,y,S){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=fu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fu(0),this.hiddenUpdates=fu(null),this.identifierPrefix=r,this.onUncaughtError=o,this.onCaughtError=f,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=S,this.incompleteTransitions=new Map}function ym(e,t,a,r,o,f,p,y,S,O,j,I){return e=new cx(e,t,a,p,S,O,j,I,y),t=1,f===!0&&(t|=24),f=jt(3,null,null,t),e.current=f,f.stateNode=e,t=Qu(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:r,isDehydrated:a,cache:t},Ju(f),e}function vm(e){return e?(e=Sa,e):Sa}function bm(e,t,a,r,o,f){o=vm(o),r.context===null?r.context=o:r.pendingContext=o,r=li(t),r.payload={element:a},f=f===void 0?null:f,f!==null&&(r.callback=f),a=ui(e,r,t),a!==null&&(Ut(a,e,t),Ds(a,e,t))}function xm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function vc(e,t){xm(e,t),(e=e.alternate)&&xm(e,t)}function Sm(e){if(e.tag===13||e.tag===31){var t=Gi(e,67108864);t!==null&&Ut(t,e,67108864),vc(e,67108864)}}function wm(e){if(e.tag===13||e.tag===31){var t=It();t=du(t);var a=Gi(e,t);a!==null&&Ut(a,e,t),vc(e,t)}}var Al=!0;function fx(e,t,a,r){var o=R.T;R.T=null;var f=Y.p;try{Y.p=2,bc(e,t,a,r)}finally{Y.p=f,R.T=o}}function dx(e,t,a,r){var o=R.T;R.T=null;var f=Y.p;try{Y.p=8,bc(e,t,a,r)}finally{Y.p=f,R.T=o}}function bc(e,t,a,r){if(Al){var o=xc(r);if(o===null)sc(e,t,r,Ml,a),Tm(e,r);else if(px(o,e,t,a,r))r.stopPropagation();else if(Tm(e,r),t&4&&-1<hx.indexOf(e)){for(;o!==null;){var f=ca(o);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var p=Ni(f.pendingLanes);if(p!==0){var y=f;for(y.pendingLanes|=2,y.entangledLanes|=2;p;){var S=1<<31-tt(p);y.entanglements[1]|=S,p&=~S}Sn(f),(_e&6)===0&&(ul=Ve()+500,Fs(0))}}break;case 31:case 13:y=Gi(f,2),y!==null&&Ut(y,f,2),cl(),vc(f,2)}if(f=xc(r),f===null&&sc(e,t,r,Ml,a),f===o)break;o=f}o!==null&&r.stopPropagation()}else sc(e,t,r,null,a)}}function xc(e){return e=Su(e),Sc(e)}var Ml=null;function Sc(e){if(Ml=null,e=oa(e),e!==null){var t=c(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=d(t),e!==null)return e;e=null}else if(a===31){if(e=h(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ml=e,null}function Em(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(dn()){case xt:return 2;case kt:return 8;case Dn:case la:return 32;case Rn:return 268435456;default:return 32}default:return 32}}var wc=!1,bi=null,xi=null,Si=null,Ps=new Map,Zs=new Map,wi=[],hx="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 Tm(e,t){switch(e){case"focusin":case"focusout":bi=null;break;case"dragenter":case"dragleave":xi=null;break;case"mouseover":case"mouseout":Si=null;break;case"pointerover":case"pointerout":Ps.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zs.delete(t.pointerId)}}function Ws(e,t,a,r,o,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:f,targetContainers:[o]},t!==null&&(t=ca(t),t!==null&&Sm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function px(e,t,a,r,o){switch(t){case"focusin":return bi=Ws(bi,e,t,a,r,o),!0;case"dragenter":return xi=Ws(xi,e,t,a,r,o),!0;case"mouseover":return Si=Ws(Si,e,t,a,r,o),!0;case"pointerover":var f=o.pointerId;return Ps.set(f,Ws(Ps.get(f)||null,e,t,a,r,o)),!0;case"gotpointercapture":return f=o.pointerId,Zs.set(f,Ws(Zs.get(f)||null,e,t,a,r,o)),!0}return!1}function Am(e){var t=oa(e.target);if(t!==null){var a=c(t);if(a!==null){if(t=a.tag,t===13){if(t=d(a),t!==null){e.blockedOn=t,Gf(e.priority,function(){wm(a)});return}}else if(t===31){if(t=h(a),t!==null){e.blockedOn=t,Gf(e.priority,function(){wm(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=xc(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);xu=r,a.target.dispatchEvent(r),xu=null}else return t=ca(a),t!==null&&Sm(t),e.blockedOn=a,!1;t.shift()}return!0}function Mm(e,t,a){Dl(e)&&a.delete(t)}function mx(){wc=!1,bi!==null&&Dl(bi)&&(bi=null),xi!==null&&Dl(xi)&&(xi=null),Si!==null&&Dl(Si)&&(Si=null),Ps.forEach(Mm),Zs.forEach(Mm)}function Rl(e,t){e.blockedOn===t&&(e.blockedOn=null,wc||(wc=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,mx)))}var Cl=null;function Dm(e){Cl!==e&&(Cl=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Cl===e&&(Cl=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],o=e[t+2];if(typeof r!="function"){if(Sc(r||a)===null)continue;break}var f=ca(a);f!==null&&(e.splice(t,3),t-=3,xo(f,{pending:!0,data:o,method:a.method,action:r},r,o))}}))}function qa(e){function t(S){return Rl(S,e)}bi!==null&&Rl(bi,e),xi!==null&&Rl(xi,e),Si!==null&&Rl(Si,e),Ps.forEach(t),Zs.forEach(t);for(var a=0;a<wi.length;a++){var r=wi[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<wi.length&&(a=wi[0],a.blockedOn===null);)Am(a),a.blockedOn===null&&wi.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var o=a[r],f=a[r+1],p=o[Dt]||null;if(typeof f=="function")p||Dm(a);else if(p){var y=null;if(f&&f.hasAttribute("formAction")){if(o=f,p=f[Dt]||null)y=p.formAction;else if(Sc(o)!==null)continue}else y=p.action;typeof y=="function"?a[r+1]=y:(a.splice(r,3),r-=3),Dm(a)}}}function Rm(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(p){return o=p})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function Ec(e){this._internalRoot=e}Ol.prototype.render=Ec.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var a=t.current,r=It();bm(a,r,e,t,null,null)},Ol.prototype.unmount=Ec.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bm(e.current,2,null,e,null,null),cl(),t[ua]=null}};function Ol(e){this._internalRoot=e}Ol.prototype.unstable_scheduleHydration=function(e){if(e){var t=Bf();e={blockedOn:null,target:e,priority:t};for(var a=0;a<wi.length&&t!==0&&t<wi[a].priority;a++);wi.splice(a,0,e),a===0&&Am(e)}};var Cm=i.version;if(Cm!=="19.2.8")throw Error(l(527,Cm,"19.2.8"));Y.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=g(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var gx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var zl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zl.isDisabled&&zl.supportsFiber)try{ft=zl.inject(gx),He=zl}catch{}}return er.createRoot=function(e,t){if(!u(e))throw Error(l(299));var a=!1,r="",o=Lh,f=jh,p=Bh;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=ym(e,1,!1,null,null,a,r,null,o,f,p,Rm),e[ua]=t.current,ac(e),new Ec(t)},er.hydrateRoot=function(e,t,a){if(!u(e))throw Error(l(299));var r=!1,o="",f=Lh,p=jh,y=Bh,S=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(o=a.identifierPrefix),a.onUncaughtError!==void 0&&(f=a.onUncaughtError),a.onCaughtError!==void 0&&(p=a.onCaughtError),a.onRecoverableError!==void 0&&(y=a.onRecoverableError),a.formState!==void 0&&(S=a.formState)),t=ym(e,1,!0,t,a??null,r,o,S,f,p,y,Rm),t.context=vm(null),a=t.current,r=It(),r=du(r),o=li(r),o.callback=null,ui(a,o,r),a=r,t.current.lanes=a,os(t,a),Sn(t),e[ua]=t.current,ac(e),new Ol(t)},er.version="19.2.8",er}var Gm;function Mx(){if(Gm)return Mc.exports;Gm=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Mc.exports=Ax(),Mc.exports}var Dx=Mx();const Xe={interactions:"interactions",steps:"steps",errors:"errors",retries:"retries",cpuMs:"cpu.ms",tokensInput:"tokens.input",tokensOutput:"tokens.output",tokensCacheRead:"tokens.cacheRead",tokensReasoning:"tokens.reasoning"};function Tn(n,i){const s=n[i];return typeof s=="number"&&Number.isFinite(s)?s:void 0}function Pl(n,i){for(const[s,l]of Object.entries(i)){if(typeof l!="number"||!Number.isFinite(l))continue;const u=s;n[u]=(n[u]??0)+l}}const Rx=[Xe.tokensInput,Xe.tokensOutput,Xe.tokensCacheRead];function on(n){let i=0,s=!1;for(const l of Rx){const u=Tn(n,l);u!==void 0&&(s=!0,i+=u)}return s?i:void 0}function Wa(n){return{input:Tn(n,Xe.tokensInput)??0,output:Tn(n,Xe.tokensOutput)??0,cacheRead:Tn(n,Xe.tokensCacheRead)??0,reasoning:Tn(n,Xe.tokensReasoning)??0}}function k0(n){const i=on(n.measures);if(i!==void 0)return $m(i/1e3,200);const s=Tn(n.measures,Xe.cpuMs);if(s!==void 0)return $m(s/1e3,200)}function ln(n){return Tn(n.measures,Xe.interactions)}function ff(n){return Tn(n.measures,Xe.steps)??0}function ia(n){return Tn(n.measures,Xe.errors)??0}function Yc(n){return Tn(n.measures,Xe.retries)??0}function $m(n,i){return Math.min(1,Math.log1p(Math.max(0,n))/Math.log1p(i))}const Cx=new Set(["running","waiting"]);function L0(n){return Cx.has(n)}function Vl(n,i){return{now:n,dayStart:n,dayEnd:i,machines:new Map,sources:new Map,sessions:new Map,executions:new Map,processes:new Map,artifacts:new Map,transfers:new Map,relationships:[],active:new Set,seen:new Set}}const j0=9e4;function Vm(n,i){if(n.waitingSince===void 0)return;const s=n.waitingSince,l=Math.max(s,i);n.waitingMs+=l-s,n.waits.push({start:s,end:l})}function Ox(n,i){const s=`${i.source.id}:${i.source.instance}`;let l=n.sources.get(s);l||(l={id:i.source.id,instance:i.source.instance,origin:i.source.instance,firstSeenAt:i.occurredAt,lastSeenAt:i.occurredAt,events:0,strata:{}},n.sources.set(s,l)),l.events++,i.occurredAt<l.firstSeenAt&&(l.firstSeenAt=i.occurredAt),i.occurredAt>l.lastSeenAt&&(l.lastSeenAt=i.occurredAt),i.stratum&&(l.strata[i.stratum]=(l.strata[i.stratum]??0)+1);const u=i.provenance?.sourceVersion;u&&(l.sourceVersions?l.sourceVersions.includes(u)||l.sourceVersions.push(u):l.sourceVersions=[u])}function zx(n,i){if(n.seen.has(i.id))return;n.seen.add(i.id),i.occurredAt>n.now&&(n.now=i.occurredAt),Ox(n,i);const s=i.core??{},l=i.occurredAt;switch(i.subject.type){case"machine":{if(n.machines.has(i.subject.id))break;const u={id:i.subject.id,name:s.machineName??i.subject.id,kind:s.machineKind??"laptop",parentId:s.parentId,firstSeenAt:l};n.machines.set(u.id,u);break}case"session":{if(i.kind==="began"){const u=n.sessions.get(i.subject.id);if(u){u.parentId===void 0&&s.parentId&&(u.parentId=s.parentId);break}const c={id:i.subject.id,machineId:s.machineId??"",label:s.label,context:i.attrs?.context??s.label??"",executor:s.executor,model:s.model,startedAt:l,executionIds:[],parentId:s.parentId};n.sessions.set(c.id,c)}else if(i.kind==="ended"){const u=n.sessions.get(i.subject.id);u&&(u.endedAt=l)}break}case"execution":_x(n,i,l);break;case"process":Ux(n,i,l);break;case"artifact":{if(n.artifacts.has(i.subject.id))break;n.artifacts.set(i.subject.id,{id:i.subject.id,kind:"file",path:s.label??i.subject.id,firstSeenAt:l});break}}}function _x(n,i,s){const l=i.core??{},u=i.subject.id;if(i.kind==="began"){if(n.executions.has(u))return;const d={id:u,sessionId:l.sessionId??l.parentId??"",machineId:l.machineId??"",label:l.label??u,executor:l.executor??"unknown",model:l.model,status:"running",startedAt:s,lastActivityAt:s,measures:{},waitingMs:0,waits:[],parentId:l.parentId,depth:l.depth??0,startBasis:i.basis,boundsAssumption:i.assumption};l.measures&&Pl(d.measures,l.measures),n.executions.set(u,d),n.active.add(u),n.sessions.get(d.sessionId)?.executionIds.push(u);return}const c=n.executions.get(u);if(c)switch(i.kind){case"progressed":{l.measures&&Pl(c.measures,l.measures),c.lastActivityAt=s,c.status==="idle"&&(c.status="running",n.active.add(u));break}case"blocked":{if(!L0(c.status))break;c.status="waiting",c.waitingSince=s,c.waitReason=l.blockedOn??"input",c.lastActivityAt=s;break}case"resumed":{Vm(c,s),c.status="running",c.waitingSince=void 0,c.waitReason=void 0,c.lastActivityAt=s,n.active.add(u);break}case"ended":{const d=l.outcome==="error";c.status=d?"failed":"completed",c.endedAt=s,c.endBasis=i.basis,i.assumption&&!c.boundsAssumption&&(c.boundsAssumption=i.assumption),c.lastActivityAt=s,c.outcome=l.outcome??"completed",d&&(c.failure={code:l.failureCode??"ERROR",message:l.failureMessage??"Execution failed"}),Vm(c,s),c.waitingSince=void 0,c.waitReason=void 0,n.active.delete(u);break}case"observed":c.lastActivityAt=Math.max(c.lastActivityAt,s);break}}function Ux(n,i,s){const l=i.core??{},u=i.subject.id,c=Number(i.attrs?.["os.pid"]??0);if(i.kind==="began"){if(n.processes.has(u))return;const h={id:u,machineId:l.machineId??"",pid:c,ppid:typeof i.attrs?.["os.ppid"]=="number"?i.attrs["os.ppid"]:void 0,command:l.label??l.executor??String(c),startedAt:s,lastSeenAt:s,status:"running",measures:{}};l.measures&&Pl(h.measures,l.measures),n.processes.set(u,h);return}const d=n.processes.get(u);if(d)if(i.kind==="observed"||i.kind==="progressed"){if(d.lastSeenAt=Math.max(d.lastSeenAt,s),l.measures){const h=l.measures[Xe.cpuMs];typeof h=="number"&&(d.measures[Xe.cpuMs]=h);const{[Xe.cpuMs]:m,...g}=l.measures;Pl(d.measures,g)}}else i.kind==="ended"&&(d.endedAt=s,d.lastSeenAt=Math.max(d.lastSeenAt,s),d.status="exited",d.endInferred=i.basis==="inferred")}function Nx(n,i){for(let s=0;s<i.length;s++)zx(n,i[s])}function kx(n,i){if(!(i<=n.now)){n.now=i;for(const s of n.active){const l=n.executions.get(s);if(!l){n.active.delete(s);continue}l.status==="running"&&i-l.lastActivityAt>j0&&(l.status="idle")}}}const Ft=n=>({value:n,basis:"measured"}),_l=(n,i)=>({value:n,basis:"inferred",assumption:i});function df(n){if(n.length===0)return[];n.sort((s,l)=>s.start-l.start);const i=[{start:n[0].start,end:n[0].end}];for(let s=1;s<n.length;s++){const l=n[s],u=i[i.length-1];l.start<=u.end?l.end>u.end&&(u.end=l.end):i.push({start:l.start,end:l.end})}return i}function Im(n){let i=0;for(const s of n)i+=s.end-s.start;return i}function Lx(n,i){const s=[];let l=0,u=0;for(;l<n.length&&u<i.length;){const c=Math.max(n[l].start,i[u].start),d=Math.min(n[l].end,i[u].end);c<d&&s.push({start:c,end:d}),n[l].end<i[u].end?l++:u++}return s}function B0(n){if(n.length===0)return{peak:0,at:0};const i=[];for(const c of n)i.push({t:c.start,d:1}),i.push({t:c.end,d:-1});i.sort((c,d)=>c.t-d.t||c.d-d.d);let s=0,l=0,u=i[0].t;for(const c of i)s+=c.d,s>l&&(l=s,u=c.t);return{peak:l,at:u}}function jx(n){if(n.length===0)return;const i=[...n].sort((l,u)=>l-u),s=i.length>>1;return i.length%2?i[s]:(i[s-1]+i[s])/2}const G0=6e4;function Bx(n,i){return{start:n.startedAt,end:n.endedAt??i}}function Gx(n){const i=[];for(const s of n.executions.values()){s.depth===0&&i.push({start:s.startedAt-G0,end:s.startedAt});for(const l of s.waits)i.push({start:l.start,end:l.end});s.waitingSince!==void 0&&i.push({start:s.waitingSince,end:n.now})}return df(i)}function $0(n){const i=n.now,s=[...n.executions.values()];let l=0,u=0,c=0,d=0,h=0,m=0,g=0,x=0;const b=[],D=new Map;for(const Z of s){l+=ff(Z),u+=on(Z.measures)??0,c+=ln(Z)??0,Z.status==="completed"?d++:Z.status==="failed"?h++:Z.status==="waiting"?m++:Z.status==="idle"&&g++;const de=Bx(Z,i);b.push(de),x+=Z.waitingMs,Z.waitingSince!==void 0&&(x+=Math.max(0,i-Z.waitingSince));let M=D.get(Z.machineId);M||(M={machineId:Z.machineId,executions:0,tokens:0,computeTime:0},D.set(Z.machineId,M)),M.executions++,M.tokens+=on(Z.measures)??0,M.computeTime+=de.end-de.start}const V=df(b.map(Z=>({...Z}))),L=Gx(n),z=Im(Lx(V,L)),{peak:k,at:K}=B0(b),B=$x(n),F=Math.max(0,B.length-1);let H=null;for(const Z of B)(!H||Z.end-Z.start>H.end-H.start)&&(H=Z);return{requests:Ft(l),sessions:Ft(n.sessions.size),executions:Ft(s.length),tokens:Ft(u),toolCalls:Ft(c),autonomousCompute:_l(Im(V),"Wall-clock time during which at least one run was in flight, merged so parallel runs are not double-counted."),humanAgentOverlap:_l(z,`Compute time intersecting a window when you were plausibly present: the ${G0/1e3}s before you sent a message, and any approval from ask to answer.`),peakConcurrency:Ft(k),peakConcurrencyAt:Ft(K),contextSwitches:_l(F,"Transitions between working directories, ordered by time. A directory is the closest thing the source has to a project."),longestFocus:_l(H,"Longest unbroken stretch spent in one working directory."),waitingOnYou:Ft(x),completed:Ft(d),failed:Ft(h),waiting:Ft(m),idle:Ft(g),byMachine:D,contextSpans:B,transfers:Ft(n.transfers.size)}}function $x(n){const i=[];for(const l of n.executions.values()){const u=n.sessions.get(l.sessionId);u&&i.push({context:u.context,start:l.startedAt,end:l.endedAt??n.now})}i.sort((l,u)=>l.start-u.start);const s=[];for(const l of i){const u=s[s.length-1];u&&u.context===l.context&&l.start<=u.end?l.end>u.end&&(u.end=l.end):u&&u.context===l.context?l.start-u.end<=Vx?u.end=Math.max(u.end,l.end):s.push({context:l.context,start:l.start,end:l.end}):s.push({context:l.context,start:l.start,end:l.end})}return s}const Vx=15*6e4;function Ix(n){return{key:n,runs:0,tokens:0,tokenRuns:0,medianRuns:0,computeMs:0,failed:0,waitingMs:0,toolCalls:0}}function Oc(n,i){const s=new Map,l=new Map;for(const u of n.executions.values()){const c=i(u,n.sessions.get(u.sessionId));if(c===void 0)continue;let d=s.get(c);d||(d=Ix(c),s.set(c,d)),d.runs++;const h=on(u.measures);if(h!==void 0&&(d.tokens+=h,d.tokenRuns++,u.endedAt!==void 0)){let m=l.get(c);m||(m=[],l.set(c,m)),m.push(h)}d.computeMs+=(u.endedAt??n.now)-u.startedAt,d.waitingMs+=u.waitingMs,d.toolCalls+=ln(u)??0,u.status==="failed"&&d.failed++}for(const[u,c]of l){const d=s.get(u);d&&(d.medianTokens=jx(c),d.medianRuns=c.length)}return[...s.values()].sort((u,c)=>c.computeMs-u.computeMs)}function Fx(n){const i={input:0,output:0,cacheRead:0,reasoning:0,total:0};for(const s of n.executions.values()){const l=Wa(s.measures);i.input+=l.input,i.output+=l.output,i.cacheRead+=l.cacheRead,i.reasoning+=l.reasoning}return i.total=i.input+i.output+i.cacheRead+i.reasoning,i}function Hx(n){const i={count:0,totalMs:0,longestMs:0,openNow:0};for(const s of n.executions.values()){for(const l of s.waits){i.count++;const u=l.end-l.start;i.totalMs+=u,u>i.longestMs&&(i.longestMs=u)}if(s.waitingSince!==void 0){i.openNow++;const l=n.now-s.waitingSince;i.totalMs+=l,l>i.longestMs&&(i.longestMs=l)}}return i}function qx(n){const i={toolCalls:0,toolErrors:0,retries:0,failed:0,interrupted:0,completed:0};for(const s of n.executions.values())i.toolCalls+=ln(s)??0,i.toolErrors+=ia(s),i.retries+=Yc(s),s.status==="failed"?i.failed++:s.outcome==="interrupted"?i.interrupted++:s.outcome==="completed"&&i.completed++;return i}function Yx(n){const i=[];for(const c of n.executions.values())i.push({start:c.startedAt,end:c.endedAt??n.now});if(i.length===0)return[];const s=df(i.map(c=>({...c}))),l=new Date(n.dayStart);l.setMinutes(0,0,0);const u=[];for(let c=l.getTime();c<n.now;c+=36e5){const d=c+36e5;let h=0;for(const x of s){const b=Math.max(x.start,c),D=Math.min(x.end,d);D>b&&(h+=D-b)}let m=0;const g=[];for(const x of i)x.start<d&&x.end>c&&(m++,g.push({start:Math.max(x.start,c),end:Math.min(x.end,d)}));u.push({hour:new Date(c).getHours(),runs:m,computeMs:h,peak:B0(g).peak})}return u}const V0=1e3,Fm=60*V0;function Ye(n){if(!Number.isFinite(n)||n<=0)return"0m";if(n<Fm)return`${Math.max(1,Math.round(n/V0))}s`;const i=Math.round(n/Fm),s=Math.floor(i/60),l=i%60;return s===0?`${l}m`:l===0?`${s}h`:`${s}h ${l}m`}function ot(n){if(!Number.isFinite(n))return"—";const i=Math.abs(n);return i>=1e9?`${(n/1e9).toFixed(i>=1e10?0:2)}B`:i>=1e6?`${(n/1e6).toFixed(i>=1e7?0:2)}M`:i>=1e3?`${(n/1e3).toFixed(i>=1e4?0:1)}k`:String(Math.round(n))}function es(n,i="NOT OBSERVED"){return n===void 0?i:ot(n)}function Xx(n){return n===void 0||!Number.isFinite(n)?"—":n>=1e9?`${(n/1e9).toFixed(1)} GB`:n>=1e6?`${(n/1e6).toFixed(0)} MB`:n>=1e3?`${(n/1e3).toFixed(0)} KB`:`${n} B`}function Ja(n){const i=new Date(n);return`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`}function ur(n){const i=n.split("/").filter(Boolean);return i[i.length-1]??n}const Il=6e4,Kx=60*Il;function I0(n,i){const s=[],l=i.contextSpans,u=i.longestFocus.value,c=Math.max(1,n.now-n.dayStart),d=i.autonomousCompute.value/c;let h;if(i.executions.value===0)return{headline:"QUIET",clauses:["No computation observed in this window."]};if(i.peakConcurrency.value>=3?h="PARALLEL":l.length>=6?h="FRAGMENTED":u&&u.end-u.start>2*Kx?h="SUSTAINED":d<.15?h="SPARSE":h="SERIAL",i.peakConcurrency.value>=2?s.push(`Up to ${i.peakConcurrency.value} runs in flight at once; ${Ye(i.autonomousCompute.value)} of wall-clock time had computation running.`):s.push(`Runs happened one at a time, across ${Ye(i.autonomousCompute.value)} of wall-clock time.`),u&&s.push(`The longest unbroken stretch was ${Ye(u.end-u.start)} in ${ur(u.context)}.`),l.length>1){const m=new Set(l.map(g=>g.context)).size;s.push(`Attention moved ${i.contextSwitches.value} ${i.contextSwitches.value===1?"time":"times"} across ${m} ${m===1?"context":"contexts"}.`)}if(i.waitingOnYou.value>Il&&s.push(`${Ye(i.waitingOnYou.value)} was spent with a run waiting on your answer.`),i.humanAgentOverlap.value>Il){const m=Math.round(i.humanAgentOverlap.value/Math.max(1,i.autonomousCompute.value)*100);s.push(`About ${m}% of that computation overlapped a window when you were present; the rest ran without you.`)}else i.autonomousCompute.value>5*Il&&s.push("Computation ran almost entirely outside the moments you were present.");if(i.failed.value>0&&s.push(`${i.failed.value} of ${i.executions.value} runs ended in failure; ${i.completed.value} completed.`),i.byMachine.size>1){const m=[...i.byMachine.values()].sort((g,x)=>x.computeTime-g.computeTime).map(g=>`${n.machines.get(g.machineId)?.name??g.machineId} ${Ye(g.computeTime)}`);s.push(`Compute was split across ${m.join(", ")}.`)}return{headline:h,clauses:s}}function Qx(n){let i=2166136261;for(let s=0;s<n.length;s++)i^=n.charCodeAt(s),i=Math.imul(i,16777619);return i>>>0}function Zl(n,i=0){return Qx(n+"#"+i)%1e5/1e5}const zc=[{x:430,y:508,extentX:300,extentY:186},{x:838,y:322,extentX:186,extentY:116}];function Px(n){if(n<zc.length)return zc[n];const s=-.9+(n-zc.length)*1.15;return{x:620+Math.cos(s)*520,y:300+Math.sin(s)*250,extentX:150,extentY:94}}function Zx(n){const i=s=>s==="laptop"?0:s==="desktop"?1:2;return[...n].sort((s,l)=>i(s.kind)-i(l.kind)||s.firstSeenAt-l.firstSeenAt||(s.id<l.id?-1:s.id>l.id?1:0))}function Hm(n,i){const s=Zl(i,1),l=Zl(i,2),u=s*Math.PI*2+l*2.399963,c=.34+.46*Math.sqrt(l);return{x:n.x+Math.cos(u)*n.extentX*c,y:n.y+Math.sin(u)*n.extentY*c}}const wn={spanX:1160,strataTop:812,strataHeight:360},F0=3,Wx=4,qm=30,Jx=74;function H0(n){return qm+n*(Jx-qm)}function Ym(n,i,s){let l=null,u=1/0;for(const d of n.disturbances){const h=H0(d.extent),m=i-d.x,g=(s-d.y)*1.5,x=Math.hypot(m,g);x<h*1.3&&x<u&&(u=x,l={kind:"disturbance",id:d.id,x:d.x,y:d.y})}if(l)return l;for(const d of n.couplings){const h=n.masses.find(z=>z.id===d.fromMassId),m=n.masses.find(z=>z.id===d.toMassId);if(!h||!m)continue;const g=m.x-h.x,x=m.y-h.y,b=g*g+x*x;if(b===0)continue;const D=((i-h.x)*g+(s-h.y)*x)/b;if(D<.05||D>.95)continue;const V=h.x+g*D,L=h.y+x*D;if(Math.hypot(i-V,(s-L)*1.5)<50)return{kind:"coupling",id:d.id,x:V,y:L}}for(const d of n.masses){const h=(i-d.x)/d.extentX,m=(s-d.y)/d.extentY;if(h*h+m*m<1.1)return{kind:"mass",id:d.id,x:d.x,y:d.y}}const c=wn.strataTop;if(s>=c&&s<=c+wn.strataHeight){const d=Math.max(1,n.masses.length),h=wn.strataHeight/d,m=Math.min(d-1,Math.floor((s-c)/h)),g=i/wn.spanX;let x=null,b=1/0;const D=F0/wn.spanX,V=Wx/wn.spanX;for(const L of n.strata){if(L.lane!==m)continue;const z=Math.max(D,L.endFraction-L.startFraction);g<L.startFraction-V||g>L.startFraction+z+V||z<b&&(b=z,x={kind:"stratum",id:L.id,x:i,y:s})}if(x)return x}return null}const Xm=64,e1=8,t1=8,Km=16,Qm=.45;function n1(n,i){switch(n.status){case"running":{const s=i-n.lastActivityAt;return .55+.45*Math.exp(-s/45e3)}case"waiting":return .08;case"failed":return .9;case"completed":return 0;case"idle":return .03}}const Pm=.32;function i1(n){const i=k0(n),s=n.depth>0?.62:1;return i===void 0?Pm*s:Math.min(1,(Pm+.68*i)*s)}function a1(n,i){const s=Math.max(1,(n.endedAt??i)-n.startedAt),l=(ln(n)??0)/(s/6e4);return Math.min(1,.25+l/24)}function Zm(n){return(n.status==="failed"?3:n.status==="waiting"?2:n.status==="running"?1:0)*1e15+n.lastActivityAt}function s1(n){const i=new Set,s=new Set,l=new Map,u=new Map,c=(d,h,m)=>{const g=d.get(h);g?g.push(m):d.set(h,[m])};for(const d of n.relationships){const{from:h,to:m,kind:g}=d;g==="ran-as"?(h.type==="execution"&&i.add(h.id),m.type==="execution"&&i.add(m.id),h.type==="session"&&m.type==="process"&&s.add(h.id),m.type==="session"&&h.type==="process"&&s.add(m.id),h.type==="execution"&&m.type==="session"?l.set(h.id,m.id):h.type==="session"&&m.type==="execution"&&l.set(m.id,h.id)):g==="same-as"&&h.type==="execution"&&m.type==="execution"&&(i.add(h.id),i.add(m.id),c(u,h.id,m.id),c(u,m.id,h.id))}return{resolvedExecutions:i,sessionsWithProcess:s,runObservesSession:l,sameExecution:u}}function r1(n,i){const l=n.startBasis===void 0?.5:n.startBasis==="measured"?1:0,u=n.endBasis===void 0?.5:n.endBasis==="measured"?1:0,c=n.endedAt===void 0?l:(l+u)/2,d=k0(n)===void 0?0:1,h=i.resolvedExecutions.has(n.id)||i.sessionsWithProcess.has(n.sessionId)?1:0;return(1+c+d+h)/4}function Wm(n){let i=1;for(const s of n)i*=1-Math.min(1,Math.max(0,s));return 1-i}function Jm(n,i,s,l){const u=Math.max(n,s),c=Math.min(i,l);if(c<u)return 0;const d=Math.max(i,l)-Math.min(n,s);return d<=0?1:(c-u)/d}function l1(n){const i=n.now,s=Zx(n.machines.values()).slice(0,e1),l=new Map,u=[];let c=1;const d=new Map;for(const M of n.executions.values()){const E=(d.get(M.machineId)??0)+1;d.set(M.machineId,E),E>c&&(c=E)}s.forEach((M,E)=>{const G=Px(E);l.set(M.id,G),u.push({id:M.id,name:M.name,kind:M.kind,x:G.x,y:G.y,extentX:G.extentX,extentY:G.extentY,prominence:(d.get(M.id)??0)/c,seed:Zl(M.id,7)})});const h=45e3,m=[];for(const M of n.executions.values())(M.status==="completed"||M.status==="failed")&&i-(M.endedAt??i)>h||M.status==="idle"&&i-M.lastActivityAt>h*4||l.has(M.machineId)&&m.push(M);m.length>Xm&&(m.sort((M,E)=>Zm(E)-Zm(M)),m.length=Xm);const g=s1(n),x=M=>{const E=l.get(M.machineId),{x:G,y:W}=Hm(E,M.id);return{id:M.id,massId:M.machineId,sessionId:M.sessionId,x:G,y:W,extent:i1(M),energy:n1(M,i),rate:a1(M,i),phase:Zl(M.id,3)*Math.PI*2,status:M.status,label:M.label,statusSince:M.waitingSince??M.endedAt??M.startedAt,articulation:r1(M,g),shoulder:0,observers:1}},b=new Set(m.map(M=>M.id)),D=new Set,V=[],L=M=>[M.startedAt,M.endedAt??i];for(const M of[...m].sort((E,G)=>E.id<G.id?-1:1)){if(D.has(M.id))continue;const E=[M];D.add(M.id);for(let he=0;he<E.length;he++)for(const re of g.sameExecution.get(E[he].id)??[])!b.has(re)||D.has(re)||(D.add(re),E.push(n.executions.get(re)));if(E.length===1){V.push(x(M));continue}const G=E.map(x),W=G.reduce((he,re)=>re.articulation>he.articulation||re.articulation===he.articulation&&re.id<he.id?re:he);let te=1;const[le,$e]=L(n.executions.get(W.id));for(const he of E){const[re,R]=L(he);te=Math.min(te,Jm(le,$e,re,R))}V.push({...W,extent:Math.max(...G.map(he=>he.extent)),energy:Math.max(...G.map(he=>he.energy)),articulation:Wm(G.map(he=>he.articulation)),shoulder:Math.min(Qm,1-te),observers:E.length})}const z=new Map;for(const M of V){if(g.runObservesSession.has(M.id))continue;const E=z.get(M.sessionId);E?E.push(M):z.set(M.sessionId,[M])}const k=new Map,K=[];for(const M of V){const E=g.runObservesSession.get(M.id),G=E?z.get(E):void 0;if(!E||!G||G.length===0){if(K.push(M),E){const R=z.get(M.sessionId);R?R.push(M):z.set(M.sessionId,[M])}continue}const W=n.executions.get(M.id);let te=1/0,le=-1/0;for(const R of G){const[Y,ae]=L(n.executions.get(R.id));te=Math.min(te,Y),le=Math.max(le,ae)}const[$e,he]=L(W),re=k.get(E)??{articulations:[],coincidence:1};re.articulations.push(M.articulation),re.coincidence=Math.min(re.coincidence,Jm($e,he,te,le)),k.set(E,re)}const B=[];for(const M of[...z.keys()].sort()){const E=z.get(M),G=n.sessions.get(M);if(!G||E.length===0)continue;let W=0,te=0;for(const R of E)W+=R.x,te+=R.y;W/=E.length,te/=E.length;let le=0,$e=0;for(const R of E){const Y=H0(R.extent);le=Math.max(le,Math.abs(R.x-W)+Y*1.5),$e=Math.max($e,Math.abs(R.y-te)+Y)}const he=k.get(M),re=Math.max(...E.map(R=>R.articulation));B.push({id:M,massId:E[0].massId,x:W,y:te,extentX:Math.max(le,52),extentY:Math.max($e,36),presence:1,articulation:he?Wm([re,...he.articulations]):re,parentId:G.parentId,empty:!1,shoulder:he?Math.min(Qm,1-he.coincidence):0,observers:1+(he?.articulations.length??0),label:G.label??G.executor??M})}for(const M of[...n.sessions.values()].sort((E,G)=>E.id<G.id?-1:1)){if(M.executionIds.length>0||M.endedAt!==void 0&&i-M.endedAt>h)continue;const E=l.get(M.machineId);if(!E)continue;const{x:G,y:W}=Hm(E,`session-presence:${M.id}`);B.push({id:M.id,massId:M.machineId,x:G,y:W,extentX:64,extentY:42,presence:1,articulation:g.sessionsWithProcess.has(M.id)?.5:.25,parentId:M.parentId,empty:!0,shoulder:0,observers:1,label:M.label??M.executor??M.id})}if(B.length>Km){const M=E=>E.empty?0:z.get(E.id)?.length??0;B.sort((E,G)=>M(G)-M(E)||(E.id<G.id?-1:1)),B.length=Km}const F=[];for(const M of n.transfers.values())if(M.endedAt===void 0&&!(!l.has(M.fromMachineId)||!l.has(M.toMachineId))){if(F.length>=t1)break;F.push({id:M.id,fromMassId:M.fromMachineId,toMassId:M.toMachineId,energy:1,label:M.label})}const H=new Map;s.forEach((M,E)=>H.set(M.id,E));const Z=Math.max(1,n.dayEnd-n.dayStart),de=[];for(const M of n.executions.values()){const E=H.get(M.machineId);if(E===void 0)continue;const G=(M.startedAt-n.dayStart)/Z,W=((M.endedAt??i)-n.dayStart)/Z;de.push({id:M.id,massId:M.machineId,lane:E,startFraction:Math.max(0,Math.min(1,G)),endFraction:Math.max(0,Math.min(1,W)),status:M.status,label:M.label})}return{time:i,masses:u,disturbances:K,plinths:B,couplings:F,strata:de}}const Fl="synthetic";let u1=0;const Nt=(n,i,s,l)=>({id:`syn:${(u1++).toString(36)}`,source:{id:Fl,instance:"replay"},occurredAt:n,observedAt:n,clock:"wall",kind:i,subject:s,core:l,basis:"measured",stratum:"stored-semantics"});function o1(n){let i=n>>>0;return()=>{i=i+1831565813>>>0;let s=Math.imul(i^i>>>15,1|i);return s=s+Math.imul(s^s>>>7,61|s)^s,((s^s>>>14)>>>0)/4294967296}}const Xa=6e4,c1=60*Xa,eg=["~/atlas","~/harbour-cli","~/ledger","~/studio-site"],tg=[{id:"macbook",name:"MACBOOK",kind:"laptop",firstSeenAt:0},{id:"mini",name:"MINI-PC",kind:"desktop",firstSeenAt:0}];function ng(n,i){return{[Xe.tokensInput]:Math.round(400+i()*3e3*n),[Xe.tokensOutput]:Math.round(60+i()*500*n),[Xe.tokensCacheRead]:Math.round(1200+i()*9e3*n),[Xe.tokensReasoning]:Math.round(20+i()*300*n)}}function f1(n={}){const i=n.seed??57,s=n.dayStart??Date.parse("2026-08-29T07:00:00Z"),l=n.duration??15*c1,u=n.runCount??24,c=n.failureRate??.09,d=n.waitRate??.2,h=s+l,m=o1(i),g=[];for(const V of tg)g.push(Nt(s,"began",{type:"machine",id:V.id},{machineName:V.name,machineKind:V.kind}));const x=Math.max(1,Math.round(u/4));let b=0,D=0;for(let V=0;V<x;V++){const L=s+V/x*l+m()*20*Xa,z=2+Math.floor(m()*4);for(let k=0;k<z;k++){const K=tg[m()<.66?0:1],B=eg[Math.floor(m()*eg.length)],F=`syn-session-${b++}`,H=L+k*(2+m()*9)*Xa;if(H>h)continue;const Z=m()<.7?"deepseek-v4-flash":"deepseek-v4";g.push({...Nt(H,"began",{type:"session",id:F},{machineId:K.id,executor:Fl,model:Z}),attrs:{context:B}});const de=`syn-proc-${D++}`,M=B.split("/").pop().toUpperCase();g.push(Nt(H,"began",{type:"execution",id:de},{machineId:K.id,sessionId:F,label:M,executor:Fl,model:Z,depth:0}));const E=m()<.35,G=(E?25+m()*95:2+m()*14)*Xa,W=Math.max(1,Math.ceil(G/(j0*.6))),te=E?4:1;let le=H;const $e=G/W;for(let re=0;re<W&&(le+=$e,!(le>h));re++)g.push(Nt(le,"progressed",{type:"execution",id:de},{measures:{...ng(te,m),[Xe.interactions]:Math.floor(m()*4),[Xe.errors]:m()<.06?1:0,[Xe.steps]:1}}));if(m()<d){const re=H+G*(.35+m()*.3),R=re+(1+m()*18)*Xa;re<h&&(g.push(Nt(re,"blocked",{type:"execution",id:de},{blockedOn:"approval"})),R<h&&g.push(Nt(R,"resumed",{type:"execution",id:de})))}if(E&&m()<.5){const re=`syn-proc-${D++}`,R=H+G*.25,Y=R+G*.4;R<h&&g.push(Nt(R,"began",{type:"execution",id:re},{machineId:K.id,sessionId:F,label:`${M} · SUB`,executor:Fl,model:Z,parentId:de,depth:1}),Nt((R+Y)/2,"progressed",{type:"execution",id:re},{measures:{...ng(1,m),[Xe.interactions]:3,[Xe.steps]:4}}),Nt(Math.min(h,Y),"ended",{type:"execution",id:re},{outcome:"completed"}))}const he=Math.min(h,H+G);if(m()<c?g.push(Nt(he,"ended",{type:"execution",id:de},{outcome:"error",failureCode:"TRANSPORT",failureMessage:"Provider request failed"})):g.push(Nt(he,"ended",{type:"execution",id:de},{outcome:"completed"})),g.push(Nt(he,"ended",{type:"session",id:F})),K.id==="mini"&&m()<.3){const re=he+3e4,R=re+(1+m()*4)*Xa;if(R<h){const Y=`syn-xfer-${D}`;g.push({...Nt(re,"began",{type:"artifact",id:Y},{label:"ARTIFACT SYNC",machineId:"mini"}),attrs:{"syn.transfer":!0,"syn.from":"mini","syn.to":"macbook","syn.bytes":Math.round(2e8+m()*3e9)}},{...Nt(R,"ended",{type:"artifact",id:Y}),attrs:{"syn.transfer":!0}})}}}}return g.sort((V,L)=>V.occurredAt-L.occurredAt),{events:g,dayStart:s,dayEnd:h}}class d1{constructor(i={},s=180){this.timeScale=s;const l=f1(i);this.script=l.events,this.dayStart=l.dayStart,this.dayEnd=l.dayEnd,this.simNow=l.dayStart}timeScale;script;dayStart;dayEnd;cursor=0;simNow;timer=null;listener=null;batch=[];info(){return{id:"synthetic",name:"SYNTHETIC",kind:"synthetic",detail:`${this.script.length} events · ${this.timeScale}× replay`}}bounds(){return{dayStart:this.dayStart,dayEnd:this.dayEnd}}now(){return this.simNow}advanceTo(i){for(this.simNow=Math.max(this.simNow,i),this.batch.length=0;this.cursor<this.script.length&&this.script[this.cursor].occurredAt<=i;)this.batch.push(this.script[this.cursor++]);return this.batch.length&&this.listener&&this.listener(this.batch),this.batch}get exhausted(){return this.cursor>=this.script.length}subscribe(i){this.listener=i;const s=Date.now();return this.timer=setInterval(()=>{const l=this.dayStart+(Date.now()-s)*this.timeScale;this.advanceTo(l),this.exhausted&&this.timer&&(clearInterval(this.timer),this.timer=null)},250),()=>{this.timer&&clearInterval(this.timer),this.timer=null,this.listener=null}}simTimeAt(i,s){return this.dayStart+(s-i)*this.timeScale}}function ig(n){const i=Vl(n.dayStart,n.dayEnd);i.now=n.now;for(const s of n.machines)i.machines.set(s.id,s);for(const s of n.sources)i.sources.set(`${s.id}:${s.instance}`,s);for(const s of n.sessions)i.sessions.set(s.id,s);for(const s of n.executions)i.executions.set(s.id,s),L0(s.status)&&i.active.add(s.id);for(const s of n.processes)i.processes.set(s.id,s);return i.processTotals=n.processTotals,i.relationships=n.relationships,i}async function h1(){const n=await fetch("/api/state");if(!n.ok)throw new Error(`state failed: ${n.status}`);return n.json()}async function Xc(n,i){try{const s=await fetch(`/api/collect?from=${n}&to=${i}`),l=await s.json().catch(()=>({}));return{ok:s.ok,fault:l.fault,error:l.error}}catch(s){return{ok:!1,error:s instanceof Error?s.message:String(s)}}}async function Kc(n,i){const s=await fetch(`/api/world?from=${n}&to=${i}`);if(!s.ok)throw new Error(`world failed: ${s.status}`);return s.json()}async function p1(n,i){const s=await fetch(`/api/detail?type=${n}&id=${encodeURIComponent(i)}`);if(!s.ok)throw new Error(`detail failed: ${s.status}`);return s.json()}const m1=4e3,g1=3;class y1{constructor(i,s,l={}){this.initial=i,this.state=s,this.options=l,this.lastCollect=i.to}initial;state;options;timer=null;stopped=!1;lastCollect;generation=0;failures=0;trouble=null;get pollMs(){return this.options.pollMs??m1}get inFlight(){return this.running}running=!1;report(i){this.trouble?.kind===i?.kind&&this.trouble?.consecutiveFailures===i?.consecutiveFailures||(this.trouble=i,this.options.onTrouble?.(i))}info(){return{id:"capture",name:"CAPTURE",kind:"live",detail:this.state.store.bySource.filter(s=>s.source!=="host").map(s=>`${s.source} ${s.events}`).join(" · ")||"no sources have contributed yet"}}bounds(){return{dayStart:this.initial.from,dayEnd:this.initial.to}}now(){return Date.now()}relationships(){return this.initial.world.relationships}subscribe(i){queueMicrotask(()=>{this.stopped||i(ig(this.initial.world))});const s=async()=>{if(this.stopped)return;this.running=!0;const l=++this.generation;try{const u=Date.now(),c=await Xc(this.lastCollect,u);c.fault&&this.report({kind:"store-fault",message:c.fault.message,detail:c.fault.remedy,consecutiveFailures:0});const d=await Kc(this.initial.from,u);if(this.stopped||l!==this.generation)return;this.lastCollect=u,this.failures=0,c.fault||this.report(null),i(ig(d.world))}catch(u){this.failures++,this.failures>=g1&&this.report({kind:"capture-failing",message:`capture has failed ${this.failures} times in a row`,detail:u instanceof Error?u.message:String(u),consecutiveFailures:this.failures})}finally{this.running=!1,this.stopped||(this.timer=setTimeout(()=>{s()},this.pollMs))}};return this.timer=setTimeout(()=>{s()},this.pollMs),()=>{this.stopped=!0,this.timer&&clearTimeout(this.timer),this.timer=null}}}let hf=class extends Error{code;severity;fix;where;cause;detail;constructor(i){super(i.message,{cause:i.cause}),this.name="VGPUError",this.code=i.code,this.severity=i.severity??"error",this.fix=i.fix,this.where=i.where,this.cause=i.cause,this.detail=i.detail}};class cn extends hf{constructor(i){super({...i,severity:"error"}),this.name="ValidationError"}}function v1(n){return new hf({code:"VGPU-FEATURE-UNSUPPORTED",message:`Adapter does not support requested feature(s): ${n.map(i=>`"${i}"`).join(", ")}.`,fix:"Remove the unsupported name(s) from init({ requiredFeatures: [...] }) or run on an adapter that supports them; gate optional code paths on device.features after init.",where:"init"})}function b1(n,i){if(!n)return;const s=(i??[]).filter(l=>!n.has(l));if(s.length)throw v1(s)}const x1={map_read:1,map_write:2,copy_src:4,copy_dst:8,index:16,vertex:32,uniform:64,storage:128,indirect:256,query_resolve:512};function dr(n){const i=globalThis.GPUBufferUsage;return n.reduce((s,l)=>s|S1(l,i),0)}function S1(n,i){const s=n.toUpperCase();return i?.[s]??x1[n]}function ag(){return globalThis.GPUMapMode?.READ??1}const w1={copy_src:1,copy_dst:2,texture_binding:4,storage_binding:8,render_attachment:16};function E1(n){const i=globalThis.GPUTextureUsage;return n.reduce((s,l)=>s|T1(l,i),0)}function T1(n,i){const s=n.toUpperCase();return i?.[s]??w1[n]}function q0(n){return"__vgpuMockBytes"in n}function sg(n){return"__vgpuMockBytes"in n}let A1=1;function ru(n){return Object.freeze({kind:n,id:A1++})}class lu{callbacks=new Set;destroyed=!1;onDestroy(i,s){return this.destroyed?(s(i),()=>{}):(this.callbacks.add(s),()=>{this.callbacks.delete(s)})}emit(i){if(this.destroyed)return!1;this.destroyed=!0;const s=[...this.callbacks];this.callbacks.clear();for(const l of s)l(i);return!0}}class Ri{device;gpu;options;ownership;destroySignal=new lu;identity=ru("buffer");destroyed=!1;constructor(i,s,l,u="owned"){this.device=i,this.gpu=s,this.options=l,this.ownership=u,Object.defineProperty(this,"assertUsable",{value:c=>this.#e(c)})}get resourceIdentity(){return this.identity}onDestroy(i){return this.destroySignal.onDestroy(this,i)}#e(i="Buffer"){if(this.destroyed)throw new cn({code:"VGPU-BUFFER-DISPOSED",message:"Buffer is destroyed.",where:i,fix:"Wrap or create a live GPUBuffer before using it."});this.device.assertUsable(i)}write(i,s=0){this.#e("Buffer.write"),this.ownership==="external"&&this.validateExternalOperation("write",s,i.byteLength,"copy_dst");try{this.device.queue.writeBuffer(this.gpu,s,i)}catch(l){throw this.ownership!=="external"?l:Ul("Buffer.write","The external GPUBuffer rejected the write operation.",l)}}async read(i,s=0){this.#e("Buffer.read"),this.ownership==="external"&&this.validateExternalOperation("read",s,i,"copy_src");try{const l=await this.device.readback.read(this.gpu,i,s);return this.#e("Buffer.read"),l}catch(l){throw l instanceof cn||this.ownership!=="external"?l:Ul("Buffer.read","The external GPUBuffer rejected the read operation.",l)}}destroy(){this.destroyed||(this.destroyed=!0,this.destroySignal.emit(this),this.ownership==="owned"&&!q0(this.gpu)&&this.gpu.destroy())}dispose(){this.destroy()}validateExternalOperation(i,s,l,u){if(!(Number.isSafeInteger(s)&&s>=0&&s%4===0&&Number.isSafeInteger(l)&&l>=0&&l%4===0&&s<=this.options.size&&l<=this.options.size-s))throw Ul(`Buffer.${i}`,"External buffer offsets and lengths must be non-negative, 4-byte aligned, and within the buffer size.");if((this.gpu.usage&dr([u]))===0)throw Ul(`Buffer.${i}`,`External buffer is missing ${u.toUpperCase()} usage.`)}}function Ul(n,i,s){return new cn({code:"VGPU-EXTERNAL-BUFFER-VALIDATION",message:i,where:n,cause:s,fix:"Use a buffer with the required usage flags and an aligned in-range operation."})}function M1(n){if(C1(n))throw O1();const i={version:1,mappings:[]},s={version:1,modules:[{path:"<runtime>",text:n}],diagnostics:[],sourceMap:i,cacheKey:D1(n)};return{kind:"wgsl",wgsl:n,source:{text:n,path:"<runtime>",imports:[]},ast:s,sourceMap:i,diagnostics:[],cacheKey:s.cacheKey,entryPoints:R1(n),stats:{lines:n.split(/\r?\n/).length,bytes:new TextEncoder().encode(n).byteLength,bindGroups:0}}}function D1(n){let i=2166136261;for(let s=0;s<n.length;s++)i=Math.imul(i^n.charCodeAt(s),16777619);return{default:`vgpu-wgsl-1:${(i>>>0).toString(16).padStart(8,"0")}`}}function R1(n){const i=[],s=/@(vertex|fragment|compute)\s+fn\s+([A-Za-z_][A-Za-z0-9_]*)/g;for(const l of n.matchAll(s))i.push(l[2]);return i}function C1(n){const i=n.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").trimStart();return i.startsWith("import ")||i.startsWith("import{")}function O1(){const n=new Error("Runtime WGSL strings cannot contain import statements. Use a build-time loader or @vgpu/wgsl/runtime.");return n.name="VGPUWGSLRuntimeImportError",n.code="VGPU-WGSL-RUNTIME-IMPORT",n.severity="error",n.source="wgsl",n}const rg=dr(["copy_dst","map_read"]);class z1{device;constructor(i){this.device=i}async read(i,s,l){if(q0(i))return i.__vgpuMockBytes.slice(l,l+s).buffer;const u=this.device.createBuffer({size:s,usage:rg});try{const c=this.device.createCommandEncoder();c.copyBufferToBuffer(i,l,u,0,s),this.device.queue.submit([c.finish()]),await u.mapAsync(ag());const d=u.getMappedRange().slice(0);return lg(u),d}finally{ug(u)}}async readTexture(i,s,l){const[u,c]=s,d=Wl(l,"Readback.readTexture"),h=d.bytesPerPixel,m=_1(u*h,256),g=m*c,x=this.device.createBuffer({size:g,usage:rg});let b;try{const D=this.device.createCommandEncoder();D.copyTextureToBuffer({texture:i},{buffer:x,bytesPerRow:m,rowsPerImage:c},{width:u,height:c}),this.device.queue.submit([D.finish()]),await x.mapAsync(ag());const V=new Uint8Array(x.getMappedRange());b=new Uint8Array(u*c*h);for(let L=0;L<c;L++){const z=L*m,k=L*u*h;b.set(V.subarray(z,z+u*h),k)}lg(x)}finally{ug(x)}return d.swizzle==="bgra-to-rgba"&&Y0(b),b}destroy(){}}function lg(n){try{n.unmap()}catch{}}function ug(n){try{n.destroy()}catch{}}function _1(n,i){return Math.ceil(n/i)*i}const og={r8unorm:{bytesPerPixel:1,components:1,componentType:"unorm8"},rg8unorm:{bytesPerPixel:2,components:2,componentType:"unorm8"},rgba8unorm:{bytesPerPixel:4,components:4,componentType:"unorm8"},"rgba8unorm-srgb":{bytesPerPixel:4,components:4,componentType:"unorm8"},bgra8unorm:{bytesPerPixel:4,components:4,componentType:"unorm8",swizzle:"bgra-to-rgba"},"bgra8unorm-srgb":{bytesPerPixel:4,components:4,componentType:"unorm8",swizzle:"bgra-to-rgba"},r16float:{bytesPerPixel:2,components:1,componentType:"float16"},rg16float:{bytesPerPixel:4,components:2,componentType:"float16"},rgba16float:{bytesPerPixel:8,components:4,componentType:"float16"},r32float:{bytesPerPixel:4,components:1,componentType:"float32"},rg32float:{bytesPerPixel:8,components:2,componentType:"float32"},rgba32float:{bytesPerPixel:16,components:4,componentType:"float32"}};function Wl(n,i){const s=og[n];if(s)return s;throw new cn({code:"VGPU-CORE-UNSUPPORTED-FORMAT",message:`Texture.read does not support format ${n}. Supported formats: ${Object.keys(og).join(", ")}.`,where:i})}function U1(n,i,s="Texture.readFloats"){const l=Wl(i,s),u=l.bytesPerPixel/l.components,c=Math.floor(n.byteLength/u),d=new Float32Array(c),h=new DataView(n.buffer,n.byteOffset,n.byteLength);for(let m=0;m<c;m++)l.componentType==="unorm8"?d[m]=h.getUint8(m)/255:l.componentType==="float16"?d[m]=N1(h.getUint16(m*2,!0)):d[m]=h.getFloat32(m*4,!0);return d}function N1(n){const i=n&32768?-1:1,s=n>>10&31,l=n&1023;return s===0?i*l*2**-24:s===31?l===0?i*Number.POSITIVE_INFINITY:Number.NaN:i*(l+1024)*2**(s-25)}function k1(n,i,s){const l=n.slice(0,i[0]*i[1]*s.bytesPerPixel);return s.swizzle==="bgra-to-rgba"&&Y0(l),l}function Y0(n){for(let i=0;i<n.length;i+=4){const s=n[i];n[i]=n[i+2],n[i+2]=s}}function L1(n){return{size:n,usage:dr(["copy_src","copy_dst"])}}class j1{gpu;guard;constructor(i,s=()=>{}){this.gpu=i,this.guard=s}writeBuffer(i,s,l){this.guard("Queue.writeBuffer"),this.gpu.writeBuffer(i,s,l)}async flush(){this.guard("Queue.flush"),await this.gpu.onSubmittedWorkDone?.(),this.guard("Queue.flush")}}class B1{gpu;resolved;constructor(i,s){this.gpu=i,this.resolved=s}dispose(){}get kind(){return this.resolved.kind}get source(){return this.resolved.source}get code(){return this.resolved.wgsl}get entryPoints(){return this.resolved.entryPoints}get stats(){return this.resolved.stats}}const G1=Symbol.for("vgpu/Texture"),$1=Symbol.for("vgpu/Texture/resizeLock");class as{device;ownership;[G1]=!0;destroySignal=new lu;identity=ru("texture");currentGpu;currentOptions;defaultView=null;resizeLock;destroyed=!1;constructor(i,s,l,u="owned"){this.device=i,this.ownership=u,this.currentGpu=s,this.currentOptions=l,Object.defineProperty(this,$1,{value:c=>{this.resizeLock=c}})}get gpu(){return this.currentGpu}get options(){return this.currentOptions}get size(){return this.options.size}get format(){return this.options.format}get usage(){return this.options.usage}get mipLevelCount(){return this.options.mipLevelCount??1}get sampleCount(){return this.options.sampleCount??1}get dimension(){return this.options.dimension??"2d"}get viewFormats(){return this.options.viewFormats??[]}get label(){return this.options.label}get resourceIdentity(){return this.identity}onDestroy(i){return this.destroySignal.onDestroy(this,i)}get view(){return this.assertAlive(),this.defaultView??=this.createView(),this.defaultView}createView(i){return this.assertAlive("Texture.createView"),this.gpu.createView(i)}resize(i){if(this.assertAlive(),this.ownership==="external")throw new cn({code:"VGPU-CORE-EXTERNAL-TEXTURE",message:"Texture wraps an externally owned GPUTexture and cannot be resized.",where:"Texture.resize"});if(this.resizeLock)throw new cn({code:"VGPU-CORE-TEXTURE-RESIZE-LOCKED",message:this.resizeLock,where:"Texture.resize"});const s=this.options.size[2]??1,l=i[2]??s;if(this.options.size[0]===i[0]&&this.options.size[1]===i[1]&&s===l)return!1;const u=i[2]===void 0&&this.options.size[2]===void 0?[i[0],i[1]]:[i[0],i[1],l],c={...this.options,size:u},d=this.gpu;return this.currentGpu=this.device.gpu.createTexture(X0(c)),this.currentOptions=c,this.defaultView=null,d.destroy(),!0}async read(){this.assertAlive("Texture.read");const i=Wl(this.options.format,"Texture.read");if(sg(this.gpu))return k1(this.gpu.__vgpuMockBytes,this.options.size,i);const s=await this.device.readback.readTexture(this.gpu,this.options.size,this.options.format);return this.assertAlive("Texture.read"),s}async readFloats(){return Wl(this.options.format,"Texture.readFloats"),U1(await this.read(),this.options.format)}destroy(){this.destroyed||(this.destroyed=!0,this.defaultView=null,this.destroySignal.emit(this),this.ownership!=="external"&&(sg(this.gpu)||this.gpu.destroy()))}dispose(){this.destroy()}assertAlive(i="Texture"){if(this.destroyed)throw new cn({code:"VGPU-CORE-TEXTURE-DESTROYED",message:"Texture is destroyed",where:i});this.device.assertUsable?.(i)}}function X0(n){const i={label:n.label,size:{width:n.size[0],height:n.size[1],depthOrArrayLayers:n.size[2]??1},format:n.format,usage:E1(n.usage)};return n.mipLevelCount!==void 0&&(i.mipLevelCount=n.mipLevelCount),n.sampleCount!==void 0&&(i.sampleCount=n.sampleCount),n.dimension!==void 0&&(i.dimension=n.dimension),n.viewFormats!==void 0&&(i.viewFormats=[...n.viewFormats]),i}class V1{gpu;adapterInfo;queue;readback;isCompatibilityMode;scopes=[];ownership;state="alive";lossInfo;observeLoss=!0;constructor(i,s=null,l="owned",u={}){this.gpu=i,this.adapterInfo=s,Object.defineProperty(this,"assertUsable",{value:h=>this.#e(h)}),this.ownership=typeof l=="string"?l:"owned";const c=typeof l=="string"?u:l;this.isCompatibilityMode=c.isCompatibilityMode??!1,this.queue=new j1(i.queue,h=>this.#e(h)),this.readback=new z1(i);const d=i.lost;d&&typeof d.then=="function"&&Promise.resolve(d).then(h=>{!this.observeLoss||this.state!=="alive"||(this.lossInfo=h,this.state="lost")},()=>{})}get limits(){return this.#e("Device.limits"),this.gpu.limits}get features(){return this.#e("Device.features"),this.gpu.features}createShader(i){this.#e("Device.createShader");const s=typeof i=="string"?M1(i):i;return new B1(this.gpu.createShaderModule({code:s.wgsl}),s)}createTexture(i){return this.#e("Device.createTexture"),new as(this,this.gpu.createTexture(X0(i)),i)}createBuffer(i){this.#e("Device.createBuffer");const s=I1(i);s&&this.captureError(s);const l=s?L1(Math.max(4,i.size||4)):F1(i);return new Ri(this,this.gpu.createBuffer(l),i)}wrapBuffer(i){if(this.#e("Device.wrapBuffer"),!q1(i))throw new cn({code:"VGPU-EXTERNAL-BUFFER-INVALID",message:"Device.wrapBuffer requires a GPUBuffer with finite size and usage properties.",where:"Device.wrapBuffer",fix:"Pass a live GPUBuffer created for this GPUDevice."});const s={size:i.size,usage:X1(i.usage),...i.label?{label:i.label}:{}};return new Ri(this,i,s,"external")}pushErrorScope(i){this.#e("Device.pushErrorScope"),this.scopes.push([]),this.gpu.pushErrorScope?.(i)}async popErrorScope(){this.#e("Device.popErrorScope");const i=this.scopes.pop(),s=await this.gpu.popErrorScope?.();return this.#e("Device.popErrorScope"),i?.[0]??H1(s)??null}#e(i){if(this.state==="alive")return;if(this.state==="disposed")throw new cn({code:"VGPU-DEVICE-DISPOSED",message:"The GPU device wrapper has been disposed.",where:i,fix:"Create a new Gpu instance before performing more work."});const s=this.lossInfo?.reason,l=this.lossInfo?.message;throw new cn({code:"VGPU-DEVICE-LOST",message:`The GPU device was lost${s?` (${s})`:""}${l?`: ${l}`:"."}`,where:i,cause:this.lossInfo})}destroy(){if(this.state==="disposed")return;const i=this.state==="lost";this.state="disposed",this.observeLoss=!1,this.scopes.length=0,this.readback.destroy(),this.ownership==="owned"&&!i&&this.gpu.destroy()}dispose(){this.destroy()}captureError(i){const s=this.scopes.at(-1);if(s)s.push(i);else throw i}}function I1(n){return!Number.isFinite(n.size)||n.size<=0?cg("Buffer size must be greater than zero."):n.usage.length===0?cg("Buffer usage must not be empty."):null}function cg(n){return new cn({code:"VGPU-CORE-INVALID-USAGE",message:n,where:"Device.createBuffer"})}function F1(n){return{label:n.label,size:n.size,usage:dr(n.usage)}}function H1(n){return n?new cn({code:"VGPU-CORE-VALIDATION",message:n.message,where:"GPUDevice.popErrorScope",cause:n}):null}function q1(n){if(typeof n!="object"&&typeof n!="function"||n===null)return!1;const i=n;return Number.isSafeInteger(i.size)&&(i.size??-1)>=0&&Number.isSafeInteger(i.usage)&&(i.usage??-1)>=0&&typeof i.destroy=="function"}const Y1=["map_read","map_write","copy_src","copy_dst","index","vertex","uniform","storage","indirect","query_resolve"];function X1(n){return Y1.filter(i=>(n&dr([i]))!==0)}const K0=new WeakMap,K1=new WeakMap;function Q1(n,i){return K0.set(n,P1(i)),n}function rr(n){return K0.get(n)}function Q0(n){return K1.get(n)}function P1(n){return{entries:n.entries.map(i=>({...i}))}}let ie=class extends hf{};function Z1(n,i,s,l,u,c){const d=i==="vertex"?"Vertex":"Fragment",h=i==="vertex"?"VERTEX":"FRAGMENT",m=`maxStorageBuffersIn${d}Stage`;return new ie({code:`VGPU-LIMIT-STORAGE-${h}`,message:`${d} entry '${s}' in '${n}' uses ${l} storage buffer(s), but device limit ${m} is ${u}.`,fix:i==="vertex"?`Request init({ requiredLimits: { ${m}: ${l} } }) if the adapter supports it, or move vertex data to geometry(gpu, ...) vertex streams.`:`Request init({ requiredLimits: { ${m}: ${l} } }) if the adapter supports it, or reduce fragment storage buffers.`,where:`${n}.pipelineLayout`,detail:{stage:i,entryPoint:s,count:l,limit:u,bindings:c.map(({name:g,group:x,binding:b})=>({name:g,group:x,binding:b}))}})}function W1(n,i,s,l,u){return new ie({code:"VGPU-SET-TEXTURE-FILTERABILITY",message:`${l} (${s}) cannot satisfy filtering texture '${i.name}' @group(${i.group}) @binding(${i.binding}).`,fix:"Use a filterable format; request float32-filterable for rgba32float when supported; or use textureLoad without a sampler.",where:`${n}.set`,detail:{format:s,group:i.group,binding:i.binding,bindingName:i.name,resourceName:l,samplerName:u?.name,samplerGroup:u?.group,samplerBinding:u?.binding}})}function J1(n,i){const s=DS(n,i);return new ie({code:"VGPU-R1-BINDING-NEVER-SET",message:`Unset \`${i.name}\` @group(${i.group}) @binding(${i.binding}) in '${n}'. Fix: ${s}; or ${n}.group(${i.group}, bindGroup).`,where:`${n}.draw`})}function P0(n,i){const s=i==="lib"?"lib-owned by its first JS set()":"user-owned by its first resource set()",l=i==="lib"?`Fix: pass a resource from the start: wave.set({ ${n}: new Uniform(gpu.device, { size: 4 }) }).`:`Fix: pass JS values from the first set(): wave.set({ ${n}: jsValue }).`;return new ie({code:"VGPU-R1-OWNERSHIP-FLIP",message:`\`${n}\` is ${s}; ownership cannot change. ${l}`,where:"set"})}function eS(n,i){return new ie({code:"VGPU-R4-GROUP-CLAIMED",message:`group ${i} of '${n}' is claimed; set() cannot update it.`,fix:`Call set() first, or build from ${n}.layout(${i}); pass dynamic offsets to p.draw().`,where:`${n}.set`})}function tS(n,i,s,l){return new ie({code:"VGPU-R4-GROUP-INCOMPATIBLE",message:`claimed group ${i} in '${n}' is incompatible: ${s}.`,fix:`Build from ${n}.layout(${i}, { dynamicOffsets? }) then call ${n}.group(${i}, bindGroup).`,where:`${n}.group`,cause:l})}function is(n,i,s){return new ie({code:"VGPU-R4-GROUP-VALIDATION",message:`WebGPU rejected claimed group ${i} in '${n}'.`,fix:`Build from ${n}.layout(${i}); pass offsets via p.draw(draw, { offsets: { ${i}: [...] } }).`,where:`${n}.draw`,cause:s,detail:{drawLabel:n,group:i}})}function fg(n,i){return new ie({code:"VGPU-BLEND-INVALID",message:`Invalid blend '${String(i)}' in '${n}'.`,fix:'Use "alpha", "additive", "premultiplied", or { color, alpha? } components.',where:"draw"})}function dg(n,i){return new ie({code:"VGPU-BLEND-CONSTANT-INVALID",message:`Invalid blendConstant in '${n}': ${i}`,fix:'Use [r, g, b, a] finite numbers with a blend whose color or alpha uses "constant"/"one-minus-constant"; omit it to keep the pass default (0, 0, 0, 0).',where:"draw"})}function hg(n,i){return new ie({code:"VGPU-WRITEMASK-INVALID",message:`Invalid writeMask ${i} in '${n}'.`,fix:"Use an array of r/g/b/a; omit it for all channels.",where:"draw"})}function Qc(n,i,s="draw"){return new ie({code:"VGPU-COLORS-INVALID",message:`Invalid colors in '${n}': ${i}`,fix:"Use one { blend?, writeMask? } or null entry per color attachment of the target, aligned by index; omit colors to apply the top-level blend/writeMask to every attachment.",where:s})}function nS(n,i){return new ie({code:"VGPU-CULL-INVALID",message:`Invalid cull '${String(i)}' in '${n}'.`,fix:'Use "none", "front", or "back"; omit it for no culling.',where:"draw"})}function iS(n,i){return new ie({code:"VGPU-FRONTFACE-INVALID",message:`Invalid frontFace '${String(i)}' in '${n}'.`,fix:'Use "ccw" or "cw"; omit it for counter-clockwise.',where:"draw"})}function pg(n,i){return new ie({code:"VGPU-UNCLIPPED-DEPTH-INVALID",message:`Invalid unclippedDepth in '${n}': ${i}`,fix:'Use a boolean. unclippedDepth: true needs the "depth-clip-control" device feature — request it with init({ requiredFeatures: ["depth-clip-control"] }) on an adapter that supports it. Omit the option to keep depth clipping.',where:"draw"})}function Xn(n,i){return new ie({code:"VGPU-DEPTH-INVALID",message:`Invalid depth in '${n}': ${i}`,fix:'Use false or { write?, compare?, bias?, biasSlopeScale?, biasClamp? }; omit it for { write: true, compare: "less-equal" }.',where:"draw"})}function ts(n,i,s="draw"){return new ie({code:"VGPU-STENCIL-INVALID",message:`Invalid stencil in '${n}': ${i}`,fix:`Use { front?, back?, readMask?, writeMask?, ref? } with GPUCompareFunction/GPUStencilOperation faces and u32 masks, against a target whose depth format has a stencil aspect (depth: "depth24plus-stencil8"); omit it for WebGPU's pass-through defaults.`,where:s})}function Hl(n,i,s="draw"){return new ie({code:"VGPU-MULTISAMPLE-INVALID",message:`Invalid multisample in '${n}': ${i}`,fix:"Use { alphaToCoverage?, mask? }: alphaToCoverage needs a target created with msaa: true, and mask must be an integer in [0, 0xFFFFFFFF] (bits above the target's sampleCount are ignored). Omit multisample for full-coverage defaults.",where:s})}function Nl(n,i,s="draw"){return new ie({code:"VGPU-CONSTANTS-INVALID",message:`Invalid constants in '${n}': ${i}`,fix:"Key WGSL `override` constants by name, or by the decimal string of N when the declaration has @id(N); values are finite numbers or booleans, converted to the override's WGSL type (bool/i32/u32/f32/f16). Every override without a default value must be provided. Omit constants to keep the WGSL defaults.",where:s})}function ql(n,i,s="draw"){return new ie({code:"VGPU-ENTRY-INVALID",message:`Invalid entry in '${n}': ${i}`,fix:"Name an entry point declared in the shader with the matching stage — { vertex?, fragment? } strings for draw, one @compute name string for compute. Omit entry (or a field) to use the first entry point of that stage.",where:s})}function Ka(n,i,s){return new ie({code:"VGPU-INDIRECT-INVALID",message:`Invalid indirect in '${n}': ${i}`,fix:"Pass a storage buffer created with storage(gpu, bytes, { indirect: true }) — bare, or as { buffer, offset? } with a 4-aligned byte offset — sized so the GPU-read arguments fit: 16 bytes for drawIndirect, 20 for drawIndexedIndirect, 12 for dispatchWorkgroupsIndirect. Omit indirect to use CPU-side counts.",where:s})}function aS(){return new ie({code:"VGPU-PASS-PRESERVE-MSAA",message:"clear:false cannot preserve MSAA; use a non-MSAA target.",fix:"Use non-MSAA for accumulation.",where:"Frame.pass"})}function mg(n,i="expected a number in [0, 1].",s='Use 1 (default), or 0 with depth: { compare: "greater" } for reversed-Z.'){return new ie({code:"VGPU-PASS-CLEARDEPTH-INVALID",message:`clearDepth received ${String(n)}; ${i}`,fix:s,where:"Frame.pass"})}function Kn(n){return new ie({code:"VGPU-PASS-VIEWPORT-INVALID",message:`Invalid viewport: ${n}`,fix:"Use { x?, y?, width, height, minDepth?, maxDepth? } finite numbers within device limits; omit it for the full target.",where:"Frame.pass"})}function _c(n){return new ie({code:"VGPU-PASS-SCISSOR-INVALID",message:`Invalid scissor: ${n}`,fix:"Use [x, y, width, height] non-negative integers with x + width and y + height within the target's current pixel size; omit it for the full target.",where:"Frame.pass"})}function sS(){return new ie({code:"VGPU-PASS-PRESERVE-CLEARDEPTH",message:"clear:false preserves depth; clearDepth cannot apply.",fix:"Remove clearDepth, or let the pass clear.",where:"Frame.pass"})}function gg(n){return new ie({code:"VGPU-PASS-CLEARSTENCIL-INVALID",message:`clearStencil ${n}`,fix:`Use an integer in [0, 0xFFFFFFFF] on a target whose depth format has a stencil aspect, e.g. depth: "depth24plus-stencil8"; the value is masked to the stencil aspect's bit width.`,where:"Frame.pass"})}function rS(){return new ie({code:"VGPU-PASS-PRESERVE-CLEARSTENCIL",message:"clear:false preserves stencil; clearStencil cannot apply.",fix:"Remove clearStencil, or let the pass clear.",where:"Frame.pass"})}function na(n,i,s="Frame.pass"){return new ie({code:"VGPU-PASS-DEPTH-READONLY",message:`depthReadOnly ${n}`,fix:i,where:s})}function lS(){return new ie({code:"VGPU-PASS-DEPTH-READONLY-MSAA",message:`depthReadOnly cannot read an MSAA target's depth: multisampled depth is stored with storeOp "discard", so a read-only pass tests against discarded contents.`,fix:"Use a non-MSAA target for read-only depth, or drop depthReadOnly and let the pass own its depth.",where:"Frame.pass"})}function Qa(n,i,s="timer"){return new ie({code:"VGPU-TIMER-INVALID",message:`Invalid timer use: ${n}`,fix:i,where:s})}function uS(n,i){return new ie({code:"VGPU-TIMER-CAPACITY",message:`frame exceeds ${n} timed spans; a timer holds one timestamp query set and WebGPU createQuerySet requires count <= ${i} (2 queries per span).`,fix:"Time fewer passes per frame, or spread timing across frames.",where:"Frame.pass"})}function oS(n,i,s="visibility"){return new ie({code:"VGPU-VIS-INVALID",message:`Invalid visibility use: ${n}`,fix:i,where:s})}function cS(){return new ie({code:"VGPU-QUERY-NO-VISIBILITY",message:"occlusion() needs the pass to be opened with a visibility instance; the render pass has no occlusionQuerySet to write into.",fix:"Open the pass with f.pass({ target, visibility: vis }, ...) using the visibility(gpu) instance that created the query handle.",where:"FramePass.occlusion"})}function fS(){return new ie({code:"VGPU-QUERY-NESTED",message:"occlusion() cannot nest inside an active occlusion() body; WebGPU allows one active occlusion query per pass at a time.",fix:"Encode each occlusion scope sequentially: p.occlusion(a, ...); p.occlusion(b, ...).",where:"FramePass.occlusion"})}function Pc(n="Frame.pass"){return new ie({code:"VGPU-TARGET-REQUIRED",message:"Target required. Fix: pass surface(gpu, canvas) or target(gpu, { size }) as { target }.",where:n})}function dS(n,i,s,l){return new ie({code:n,message:`${n}: ${s}`,fix:l,where:i})}function pf(n,i){return dS("VGPU-MESH-RANGE-INVALID",n,i,"Use index ranges for indexed geometries, vertex ranges otherwise, within geometry counts.")}function hS(n){return new ie({code:"VGPU-PIPELINE-LAYOUT-GAP",message:`Pipeline bind group ${n} is missing.`,fix:"Use consecutive @group() indices starting at 0.",where:"pipeline layout"})}function tr(n,i,s){return new ie({code:"VGPU-COMPILE-FAILED",message:"WebGPU pipeline compilation failed.",fix:"Check WGSL, vertex layouts, and target signature.",where:n,cause:i,detail:s?{signature:s}:void 0})}function yg(n){return new ie({code:"VGPU-COMPILE-DISPOSED",message:"GPU disposed during pipeline compilation.",where:n})}function kl(n,i){return new ie({code:"VGPU-COMPILE-SIGNATURE-INVALID",message:`Invalid TargetSignature: ${i}`,fix:"Pass { colors, depth?, sampleCount?:1|4 } or a Target.",where:n})}function pS(n){return new ie({code:"VGPU-TARGET-DEPTH-STENCIL-ONLY",message:`depth received '${n}'; stencil-only depth targets are not supported yet.`,fix:'Use a format with a depth aspect such as "depth24plus" or "depth24plus-stencil8".',where:"target"})}function Z0(){return new ie({code:"VGPU-TARGET-SIZE-REQUIRED",message:"Target size required. Fix: target(gpu, { size: [w,h] }); update surface-derived targets in onResize.",where:"target"})}function W0(n){return new ie({code:"VGPU-SURFACE-NOT-IN-FRAME",message:"Surface targets are only available inside frame(gpu).",fix:"surface passes must run inside frame(gpu, ...); precompile against an offscreen target(gpu, ...) instead",where:n})}function mS(){return new ie({code:"VGPU-SURFACE-CONTEXT",message:"Canvas WebGPU context failed. Fix: check navigator.gpu and remove any existing 2d/webgl context.",where:"surface"})}function gS(n){return new ie({code:"VGPU-SURFACE-DUPLICATE",message:`Canvas already has surface${n?` '${n}'`:""}. Fix: reuse or dispose it.`,where:"surface"})}function yS(n){return new ie({code:"VGPU-SURFACE-DISPOSED",message:`Surface '${n??"surface"}' is disposed. Fix: call surface(gpu, canvas).`,where:"surface"})}function vS(){return new ie({code:"VGPU-SURFACE-AUTORESIZE-UNSUPPORTED",message:"autoResize needs clientWidth. Fix: call surface.resize([w,h]) for OffscreenCanvas; onResize still fires.",where:"surface"})}function bS(n){return new ie({code:"VGPU-SURFACE-RESIZE-REENTRANT",message:`Cannot resize this surface${n?` '${n}'`:""} in onResize. Fix: resize derived targets only.`,where:"surface.resize"})}function xS(n){return new ie({code:"VGPU-CLEAR-COLOR-INVALID",message:`Invalid ${n}: expected four finite numbers.`,fix:"Assign [r, g, b, a] or a GPUColor object ({ r, g, b, a }).",where:n})}function J0(){return new ie({code:"VGPU-FRAME-REENTRANT",message:"Nested frame(gpu) is invalid. Fix: queue work for the next frame.",where:"frame"})}function SS(n,i){return new ie({code:"VGPU-QUERY-READBACK",message:`${n} dropped a query readback: ${TS(i)}`,fix:"Usually a lost or destroyed device: recreate the gpu (and the timer/visibility instance) before reading queries again. Results resume on the next successful readback; the frame itself is unaffected.",where:"QueryRing.onSubmitted",cause:i})}function vg(n){return new ie({code:"VGPU-FRAME-CANCELED",message:"the frame was canceled; its command encoder was dropped and nothing more can be encoded or submitted on it.",fix:"Open a new frame(gpu) for further work; cancel() is the last operation on a frame.",where:n})}function wS(n){return new ie({code:"VGPU-FRAME-PASS-ACTIVE",message:"the frame cannot be canceled while a pass callback is active.",fix:"Return from the frame.pass(...) callback first, then call frame.cancel(); this keeps pass descriptor resources alive until the pass is closed.",where:n})}function ES(n){return new ie({code:"VGPU-FRAME-SUBMITTED",message:"the frame was already submitted; submitted GPU work cannot be canceled.",fix:"Call cancel() only on a frame you decided not to submit; the frame you did submit needs no cleanup.",where:n})}function Zn(n,i,s){return new ie({code:"VGPU-R1-BINDING-INCOMPATIBLE-RESOURCE",message:`binding \`${n.name}\` @group(${n.group}) @binding(${n.binding}) needs ${i}.`,fix:s,where:"set"})}function qt(n,i,s){return new ie({code:"VGPU-RING1-UNSUPPORTED",message:i,fix:s,where:n})}function Ll(n){return AS(n)&&n.version!==1?new ie({code:"VGPU-SHADER-SOURCE-INVALID",message:`VGPU-SHADER-SOURCE-INVALID: unsupported ShaderSource v${String(n.version)}; expected v1. Fix: update vgpu or regenerate it.`,where:"shader source"}):new ie({code:"VGPU-SHADER-SOURCE-INVALID",message:`VGPU-SHADER-SOURCE-INVALID: expected WGSL or { version, wgsl }, got ${MS(n)}. Fix: configure @vgpu/wgsl loader-vite or loader-webpack.`,where:"shader source"})}function TS(n){return n instanceof Error?`${n.name}: ${n.message}`:String(n)}function AS(n){return typeof n=="object"&&n!==null&&"version"in n}function MS(n){if(typeof n!="object"||n===null)return typeof n;try{const i=JSON.stringify(n);return i.length>80?`${i.slice(0,77)}...`:i}catch{return"object"}}function DS(n,i){switch(i.kind){case"sampler":return`${n}.set({${i.name}:sampler(gpu)})`;case"texture":return`${n}.set({${i.name}:scene.color})`;case"buffer":return i.addressSpace==="uniform"?`${n}.set({${i.name}:{ /* values */ }})`:`${n}.set({${i.name}:buffer})`;default:return`${n}.set({${i.name}:resource})`}}const bg=["scheduler","resource","service"];function uu(n){return{name:n}}const ey=new WeakMap;function RS(n){const i=ey.get(n);if(!i)throw new ie({code:"VGPU-GPU-FOREIGN",message:"This object was not created by init(); it has no vgpu kernel.",fix:"Pass the gpu returned by init() from vgpu, vgpu/node or vgpu/mock.",where:"gpu"});return i}class CS{device;#e=new Map;#t=new Map(bg.map(i=>[i,new Set]));#n=new Set;#i=new Set;#a=new Set;#s=!1;constructor(i){this.device=i}get disposed(){return this.#s}service(i,s){const l=this.#e.get(i);if(l!==void 0)return l;const u=s(this);return this.#e.set(i,u),u}peekService(i){return this.#e.get(i)}own(i,s){const l=this.#t.get(i);return l.add(s),()=>{l.delete(s)}}addErrorListener(i){return this.#n.add(i),()=>{this.#n.delete(i)}}reportError(i){if(this.#s)return Promise.resolve();const s=Promise.resolve().then(()=>{const l=[...this.#n];if(!l.length){console.error(i);return}for(const u of l)try{u(i)}catch(c){console.error(c)}});return this.trackDelivery(s)}trackDelivery(i){const s=Promise.resolve(i).then(()=>{},l=>{console.error(l)});return this.#i.add(s),s.finally(()=>this.#i.delete(s)),s}registerSettledSource(i){return this.#a.add(i),()=>{this.#a.delete(i)}}async settled(){const i=[...this.#i,...[...this.#a].flatMap(s=>s())];await Promise.allSettled(i)}dispose(){if(!this.#s){this.#s=!0;for(const i of bg){const s=this.#t.get(i);for(const l of[...s])l();s.clear()}this.#e.clear(),this.#a.clear(),this.#n.clear(),this.device.dispose()}}}function OS(n){const i=new CS(n),s={device:n,gpu:n.gpu,get disposed(){return i.disposed},onError:l=>i.addErrorListener(l),settled:()=>i.settled(),dispose:()=>{i.dispose()}};return ey.set(s,i),s}async function zS(n,i={},s){return OS(await _S(n,i,s))}async function _S(n,i,s){return i.adapter||s?(i.adapter??s()).requestDevice(i):US(i)}async function US(n){const s=await globalThis.navigator.gpu?.requestAdapter({powerPreference:n.powerPreference});if(!s)throw qt("init","navigator.gpu.requestAdapter() returned null.");b1(s.features,n.requiredFeatures);const l=await s.requestDevice({requiredFeatures:n.requiredFeatures,requiredLimits:n.requiredLimits});return new V1(l,s.info??null)}function pt(n,i){n.assertUsable(i)}function xg(n,i){n.assertUsable(i)}const ty=Symbol("vgpu.bindingResource");function NS(n){return typeof(typeof n=="object"&&n!==null?n[ty]:void 0)=="function"?n:void 0}const Zc=Symbol("vgpu.geometry.layoutResolver");function Wn(n,i){const s=RS(n);if(s.disposed)throw kS(i);return s}function kS(n){return new ie({code:"VGPU-GPU-DISPOSED",message:`${n}() ran after gpu.dispose(); the device and everything it owned are gone.`,fix:"Create resources before disposing the gpu, or init() a new one.",where:n})}function LS(n,i){let s=()=>{};const l=i({trackSettled:u=>{n.trackDelivery(u)},errorSink:u=>n.reportError(u),onDispose:()=>{s()}});return s=n.own("resource",()=>l.dispose()),l}function ny(n,i,s,l){const u=n.own("resource",()=>s(i));return l?.(u),i}class iy extends Error{code;line;column;severity;metadata;relatedDiagnostics;fix;where;cause;constructor(i,s,l=1,u=1,c="error"){super(s),this.name="VGPUError",this.code=i,this.line=l,this.column=u,this.severity=c}}function jS(n,i,s={}){const l=new iy(n,i,s.line??1,s.column??1,s.severity??"error");return s.fix!==void 0&&(l.fix=s.fix),s.where!==void 0&&(l.where=s.where),s.cause!==void 0&&(l.cause=s.cause),s.metadata!==void 0&&(l.metadata=s.metadata),l}function et(n,i,s=1,l=1){return new iy(n,i,s,l)}const BS=new Set(["fn","struct","const","alias","var","override"]);function GS(n){const i=[],s=[],l=[];let u=0,c=!1,d=0;for(;u<n.length;){const h=n[u];if(h.text==="{"){d++,u++;continue}if(h.text==="}"){d=Math.max(0,d-1),u++;continue}if(ay(h)){u++;continue}if(d>0){u++;continue}if(h.text==="import"){if(c)throw et("VGPU-WGSL-IMP-ORDER","Imports must precede declarations",h.line,h.column);const[b,D]=$S(n,u);i.push(b),u=D;continue}if(h.text==="export"&&n[u+1]?.text==="{")throw et("VGPU-WGSL-EXP-REEXPORT-CYCLE","Re-export cycles are not supported",h.line,h.column);if(h.text==="@"&&n[u+2]?.text==="export"&&n[u+3]?.text==="@")throw et("VGPU-WGSL-EXP-NOTDECL","Repeated export attributes",h.line,h.column);const m=h.text==="export"||h.text==="@"&&n[u+2]?.text==="export",g=m?VS(n,h.text==="export"?u+1:u+3):u,x=n[g];if(x&&BS.has(x.text)){const b=IS(n,g);s.push({name:b,localName:b,kind:x.text}),m&&l.push({name:b,localName:b,kind:x.text}),c=!0}u++}return{imports:i,exports:l,locals:s}}function $S(n,i){let s=i+1;const l=[];if(n[s]?.text==="{"){for(s++;n[s]&&n[s].text!=="}";){if(ay(n[s])){s++;continue}const d=Nc(n[s]);let h=d;s++,n[s]?.text==="as"&&(h=Nc(n[s+1]),s+=2),l.push({imported:d,local:h}),n[s]?.text===","&&s++}s++,Uc(n[s],"from"),s++}else if(n[s]?.text==="*")Uc(n[s+1],"as"),l.push({imported:"*",local:Nc(n[s+2]),namespace:!0}),s+=3,Uc(n[s],"from"),s++;else throw n[s]?.kind==="string"?et("VGPU-WGSL-IMP-SIDEEFFECT","Side-effect imports are not supported",n[s].line,n[s].column):et("VGPU-WGSL-IMP-DEFAULT","Default imports are not supported",n[s]?.line,n[s]?.column);const u=n[s];if(u?.kind!=="string")throw et("VGPU-WGSL-RES-NOTFOUND","Import path must be a string",u?.line,u?.column);const c=u.text.slice(1,-1);return s++,n[s]?.text===";"&&s++,[{from:c,bindings:l,start:n[i].start,end:n[s-1].end},s]}function VS(n,i){for(;n[i]?.text==="@";){if(i+=2,n[i]?.text==="(")for(;n[i]&&n[i].text!==")";)i++;n[i]?.text===")"&&i++}return i}function IS(n,i){let s=i+1;if(n[i]?.text==="var"&&n[s]?.text==="<")for(;n[s]&&n[s].text!==">";)s++;for(;s<n.length;s++)if(n[s].kind==="ident")return n[s].text;throw et("VGPU-WGSL-EXP-NOTDECL","Exported declaration has no name",n[i]?.line,n[i]?.column)}function Uc(n,i){if(n?.text!==i)throw et("VGPU-WGSL-IMP-DEFAULT",`Expected ${i}`,n?.line,n?.column)}function Nc(n){if(n?.kind!=="ident")throw et("VGPU-WGSL-IMP-DEFAULT","Expected identifier",n?.line,n?.column);return n.text}function ay(n){return n.kind==="lineComment"||n.kind==="blockComment"}function FS(n,i){return i==="uniform"||i==="storage"?"buffer":n.kind==="sampler"?"sampler":n.kind==="texture"?n.textureKind==="texture_external"?"externalTexture":"texture":"unknown"}function HS(n,i,s,l,u){if(n==="buffer")return qS(i,s,u);if(l.kind==="sampler")return YS(l);if(l.kind==="texture")return l.textureKind==="texture_external"?{kind:"externalTexture",externalTexture:{}}:l.textureKind.startsWith("texture_storage_")?XS(l):KS(l)}function qS(n,i,s){return{kind:"buffer",buffer:{type:n==="uniform"?"uniform":i==="read"?"read-only-storage":"storage",hasDynamicOffset:!1,minBindingSize:s?.size}}}function YS(n){return{kind:"sampler",sampler:{type:n.comparison?"comparison":"filtering"}}}function XS(n){return{kind:"storageTexture",storageTexture:{access:PS(n.access),format:n.texelFormat??"rgba8unorm",viewDimension:sy(n.dimension)}}}function KS(n){return{kind:"texture",texture:{sampleType:QS(n),viewDimension:sy(n.dimension),multisampled:n.dimension==="multisampled_2d"||n.dimension==="depth_multisampled_2d"}}}function QS(n){if(n.textureKind.startsWith("texture_depth_"))return"depth";const i=n.sampleType;return i?.kind==="scalar"&&i.name==="i32"?"sint":i?.kind==="scalar"&&i.name==="u32"?"uint":"unfilterable-float"}function sy(n){switch(n){case"1d":return"1d";case"2d_array":case"depth_2d_array":return"2d-array";case"cube":case"depth_cube":return"cube";case"cube_array":case"depth_cube_array":return"cube-array";case"3d":return"3d";default:return"2d"}}function PS(n){return n==="read"?"read-only":n==="read_write"?"read-write":"write-only"}const rn=(1n<<64n)-1n,ta=11400714785074694791n,ir=14029467366897019727n,Sg=1609587929392839161n,ry=9650029242287828579n,wg=2870177450012600261n;function ZS(n,i=0n){const s=new TextEncoder().encode(n);let l=0,u;if(s.length>=32){let c=i+ta+ir,d=i+ir,h=i,m=i-ta;const g=s.length-32;do c=Pa(c,nr(s,l)),l+=8,d=Pa(d,nr(s,l)),l+=8,h=Pa(h,nr(s,l)),l+=8,m=Pa(m,nr(s,l)),l+=8;while(l<=g);u=Di(c,1n)+Di(d,7n)+Di(h,12n)+Di(m,18n),u=jl(u,c),u=jl(u,d),u=jl(u,h),u=jl(u,m)}else u=i+wg;for(u=u+BigInt(s.length)&rn;l+8<=s.length;)u^=Pa(0n,nr(s,l)),u=Di(u,27n)*ta+ry&rn,l+=8;for(l+4<=s.length&&(u^=WS(s,l)*ta&rn,u=Di(u,23n)*ir+Sg&rn,l+=4);l<s.length;)u^=BigInt(s[l])*wg&rn,u=Di(u,11n)*ta&rn,l++;return u^=u>>33n,u=u*ir&rn,u^=u>>29n,u=u*Sg&rn,u^=u>>32n,u.toString(16).padStart(16,"0")}function Pa(n,i){return Di(n+i*ir&rn,31n)*ta&rn}function jl(n,i){return n^=Pa(0n,i),n*ta+ry&rn}function Di(n,i){return(n<<i|n>>64n-i)&rn}function nr(n,i){let s=0n;for(let l=7;l>=0;l--)s=(s<<8n)+BigInt(n[i+l]);return s}function WS(n,i){return BigInt(n[i])|BigInt(n[i+1])<<8n|BigInt(n[i+2])<<16n|BigInt(n[i+3])<<24n}function JS(n){return ZS(n)}function ew(n){return JS(n).slice(0,8)}function tw(n,i){return`_vgsl_${ew(n)}__${i}`}function Yt(n,i){const s=n.find(c=>c.name===i);if(!s)return;const l=s.args.map(c=>c.text).join(""),u=Number(l.replace(/[ui]$/,""));return Number.isFinite(u)?u:void 0}function mf(n){const i=[[]];let s=0,l=0;for(const u of n){if(u.text==="<"?s++:u.text===">"?s=Math.max(0,s-1):u.text==="("?l++:u.text===")"&&(l=Math.max(0,l-1)),u.text===","&&s===0&&l===0){i.push([]);continue}i[i.length-1].push(u)}return i.map(ly).filter(u=>u.length>0)}function ly(n){let i=0,s=n.length;for(;i<s&&n[i].text===",";)i++;for(;s>i&&n[s-1].text===",";)s--;return n.slice(i,s)}function nw(n){if(n!==void 0&&uy(n))return Number(n.replace(/[ui]$/,""))}function uy(n){return/^(0|[1-9][0-9]*)([ui])?$/.test(n)}function oy(n){if(n==="read"||n==="write"||n==="read_write")return n}function iw(n){return["f32","f16","i32","u32","bool"].find(i=>i===n)}function aw(n){return{kind:"scalar",name:n==="f"?"f32":n==="h"?"f16":n==="i"?"i32":"u32"}}function cy(n){return n==="f16"?2:4}function sa(n,i){return Math.ceil(i/n)*n}function En(n){const i=ly(n);if(i.length===0)throw et("VGPU-WGSL-REFLECT-TYPE","Expected WGSL type");const s=i.map(c=>c.text).join(""),l=sw(s);if(l)return l;if(i[1]?.text==="<"){const c=i[0].text,d=mf(i.slice(2,-1)),h=rw(c,d);if(h)return h}const u=lw(s);return u||uw(s)}function sw(n){const i=iw(n);if(i)return{kind:"scalar",name:i};const s=n.match(/^vec([234])([fiuh])$/);if(s)return{kind:"vector",width:Number(s[1]),element:aw(s[2])};const l=n.match(/^mat([234])x([234])([fh])$/);if(l){const u=l[3]==="h"?{kind:"scalar",name:"f16"}:{kind:"scalar",name:"f32"};return{kind:"matrix",columns:Number(l[1]),rows:Number(l[2]),element:u}}}function rw(n,i){if(n==="array"){const s=i[1]?.map(u=>u.text).join(""),l=s===void 0?void 0:nw(s);return{kind:"array",element:En(i[0]??[]),count:l,countExpression:s}}if(n==="atomic")return{kind:"atomic",element:En(i[0]??[])};if(n==="vec2"||n==="vec3"||n==="vec4")return{kind:"vector",width:Number(n.slice(3)),element:En(i[0]??[])};if(/^mat[234]x[234]$/.test(n))return{kind:"matrix",columns:Number(n[3]),rows:Number(n[5]),element:En(i[0]??[])};if(n==="ptr")return{kind:"ptr",addressSpace:i[0]?.map(s=>s.text).join("")??"",element:En(i[1]??[]),access:i[2]?.map(s=>s.text).join("")};if(n==="sampler")return{kind:"sampler",comparison:!1};if(n.startsWith("texture_storage_"))return{kind:"texture",textureKind:n,dimension:n.slice(16),texelFormat:i[0]?.map(s=>s.text).join(""),access:oy(i[1]?.map(s=>s.text).join(""))};if(n.startsWith("texture_"))return{kind:"texture",textureKind:n,dimension:n.slice(8),sampleType:i[0]?En(i[0]):void 0}}function lw(n){if(n==="sampler"||n==="sampler_comparison")return{kind:"sampler",comparison:n==="sampler_comparison"};if(n==="texture_external")return{kind:"texture",textureKind:n};if(n.startsWith("texture_depth_"))return{kind:"texture",textureKind:n,dimension:n.slice(8)};if(n.startsWith("texture_"))return{kind:"texture",textureKind:n,dimension:n.slice(8)}}function uw(n){return{kind:"identifier",name:n}}function Oi(n){if(n?.kind!=="ident"&&n?.kind!=="keyword")throw et("VGPU-WGSL-REFLECT-PARSE","Expected identifier",n?.line,n?.column);return n.text}function ra(n,i,s){for(let l=i;l<n.length;l++)if(n[l].text===s)return l;throw et("VGPU-WGSL-REFLECT-PARSE",`Expected ${s}`,n[i]?.line,n[i]?.column)}function ow(n,i,s,l){for(let u=i;u<s;u++)if(n[u].text===l)return u}function ou(n,i,s){let l=0;for(let u=i;u<n.length;u++)if((n[u].text==="{"||n[u].text==="(")&&l++,(n[u].text==="}"||n[u].text===")")&&(l=Math.max(0,l-1)),l===0&&n[u].text===s)return u;return n.length}function gf(n,i){const s=n[i].text,l=s==="("?")":s==="{"?"}":">";let u=0;for(let c=i;c<n.length;c++)if(n[c].text===s&&u++,n[c].text===l&&(u--,u===0))return c;throw et("VGPU-WGSL-REFLECT-PARSE",`Unclosed ${s}`,n[i]?.line,n[i]?.column)}function yf(n,i){const s=[];let l=i;for(;n[l]?.text==="@";){const u=n[l],c=Oi(n[l+1]);l+=2;let d=[];if(n[l]?.text==="("){const h=gf(n,l);d=n.slice(l+1,h),l=h+1}s.push({name:c,args:d,token:u})}return[s,l]}function ns(n){switch(n.kind){case"scalar":return n.name;case"identifier":return n.name;case"vector":return`vec${n.width}<${ns(n.element)}>`;case"matrix":return`mat${n.columns}x${n.rows}<${ns(n.element)}>`;case"array":return`array<${ns(n.element)}${n.count===void 0?"":`,${n.count}`}>`;default:return n.kind}}function cw(n){const i=n.find(l=>l.name==="workgroup_size");if(!i)return;const s=mf(i.args).map(l=>Number(l.map(u=>u.text).join("")));return[s[0]??1,s[1]??1,s[2]??1]}function fw(n,i){if(n[i]?.text!=="<")return{after:i};const s=ra(n,i,">"),l=mf(n.slice(i+1,s)).map(u=>u.map(c=>c.text).join(""));return{addressSpace:l[0],access:oy(l[1]),after:s+1}}function dw(n){const i=[],s=[],l=[],u=[],c=[],d=[],h=n.tokens.filter(x=>x.kind!=="lineComment"&&x.kind!=="blockComment");let m=0,g=0;for(;m<h.length;){const x=h[m];if(x.text==="{"){g++,m++;continue}if(x.text==="}"){g=Math.max(0,g-1),m++;continue}if(g>0){m++;continue}const b=m,[D,V]=yf(h,m);m=V,h[m]?.text==="export"&&m++;const L=h[m]?.text;if(L==="enable"){h[m+1]?.kind==="ident"&&d.push(h[m+1].text),m=ou(h,m,";")+1;continue}if(L==="struct"){const z=hw(n,h,m);z.item&&i.push(z.item),m=z.next;continue}if(L==="alias"){const z=pw(n,h,m);z.item&&s.push(z.item),m=z.next;continue}if(L==="var"){const z=mw(n,h,m,D);z.item&&l.push(z.item),m=z.next;continue}if(L==="fn"){const z=gw(n,h,m,D);z.item&&u.push(z.item),m=z.next;continue}if(L==="override"){const z=vw(h,m,D);z.item&&c.push(z.item),m=z.next;continue}m=Math.max(b+1,m+1)}return{structs:i,aliases:s,vars:l,entries:u,overrides:c,features:d}}function hw(n,i,s,l){const u=Oi(i[s+1]),c=ra(i,s+2,"{"),d=gf(i,c);return{item:{name:u,originalName:u,mangledName:vf(n,u,"struct"),members:bw(i.slice(c+1,d)),path:n.path},next:d+1}}function pw(n,i,s,l){const u=Oi(i[s+1]),c=ra(i,s+2,"="),d=ou(i,c+1,";");return{item:{name:u,originalName:u,mangledName:vf(n,u,"alias"),target:En(i.slice(c+1,d)),path:n.path},next:d+1}}function mw(n,i,s,l){const{addressSpace:u,access:c,after:d}=fw(i,s+1),h=Oi(i[d]),m=ra(i,d+1,":"),g=ou(i,m+1,";");return{item:{path:n.path,name:h,mangledName:xw(l)?h:vf(n,h,"var"),attrs:l,addressSpace:u,access:c,type:En(i.slice(m+1,g))},next:g+1}}function gw(n,i,s,l){const u=Oi(i[s+1]),c=l.find(m=>m.name==="vertex"||m.name==="fragment"||m.name==="compute")?.name;if(!c)return{item:void 0,next:s+1};const d=ra(i,s+2,"("),h=gf(i,d);return{item:{name:u,mangledName:u,stage:c,workgroupSize:cw(l),path:n.path,params:yw(i.slice(d+1,h))},next:h+1}}function yw(n){const i=[];let s=0;for(;s<n.length;){const[l,u]=yf(n,s);if(s=u,!n[s]||n[s].text===","){s++;continue}const c=Oi(n[s]),d=ra(n,s+1,":");let h=d+1,m=0;for(;h<n.length&&(n[h].text==="<"&&m++,n[h].text===">"&&(m=Math.max(0,m-1)),!(m===0&&n[h].text===","));)h++;i.push({name:c,attrs:l,type:En(n.slice(d+1,h))}),s=h+1}return i}function vw(n,i,s){const l=Oi(n[i+1]),u=ou(n,i+1,";"),c=ow(n,i+2,u,"=");return{item:{name:l,mangledName:l,id:Yt(s,"id"),defaultValue:c===void 0?void 0:n.slice(c+1,u).map(d=>d.text).join("")},next:u+1}}function bw(n){const i=[];let s=0;for(;s<n.length;){const[l,u]=yf(n,s);if(s=u,!n[s]||n[s].text===","||n[s].text===";"){s++;continue}const c=Oi(n[s]),d=ra(n,s+1,":");let h=d+1,m=0;for(;h<n.length&&(n[h].text==="<"&&m++,n[h].text===">"&&(m=Math.max(0,m-1)),!(m===0&&(n[h].text===","||n[h].text===";")));)h++;i.push({name:c,attrs:l,type:En(n.slice(d+1,h)),align:Yt(l,"align"),size:Yt(l,"size")}),s=h+1}return i}function vf(n,i,s){return s==="override"?i:tw(n.path,i)}function xw(n){return Yt(n,"group")!==void 0||Yt(n,"binding")!==void 0}const Sw="literal length required for auto layout; use draw.group(n, bg) manual binding",ww="VGPUError: `bool` is not host-shareable in uniform/storage. Fix: use `u32` (0 | 1) → struct Params { enabled: u32 }",fy="use a manual group claim (`draw.group(n, bg)`)";function Ew(n=1,i=1){return et("VGPU-WGSL-REFLECT-ARRAY-LENGTH",Sw,n,i)}function dy(n=1,i=1){return et("VGPU-WGSL-REFLECT-BOOL-HOST-SHAREABLE",ww,n,i)}function Jl(n,i,s=1,l=1){return et("VGPU-WGSL-REFLECT-UNKNOWN-TYPE",`type '${n}' is unknown in ${i}; ${fy}`,s,l)}function Eg(n,i,s=1,l=1){return et("VGPU-WGSL-REFLECT-NS-TYPE",`type '${n}' is a namespace-member import; use a named import or manual @group(1+) binding`,s,l)}function hy(n,i=1,s=1){return et("VGPU-WGSL-REFLECT-NON-HOST-SHAREABLE",`Type ${n} is not host-shareable; ${fy}`,i,s)}const ss="naga-standard";function Tw(n,i,s){const l=new Map;for(const d of i){const h=new Map;for(const m of[...d.structs,...d.aliases])h.set(m.originalName,{path:m.path,name:m.originalName,mangledName:m.mangledName,kind:"members"in m?"struct":"alias"});l.set(d.structs[0]?.path??d.aliases[0]?.path??d.vars[0]?.path??"",h)}const u=new Map(n.map(d=>[d.path,l.get(d.path)??new Map])),c=new Map;for(const d of n){const h=new Map(u.get(d.path));for(const m of d.parsed.imports)Aw(d,m,h,n,u);c.set(d.path,h)}return c}function Aw(n,i,s,l,u,c){const d=Dw(i,n.path,l),h=u.get(d);for(const m of i.bindings){if(m.namespace){s.set(m.local,{path:d,name:m.local,mangledName:m.local,kind:"namespace"});continue}const g=h?.get(m.imported);g&&s.set(m.local,g)}}function Mw(n,i){const s=new Map,l=new Map,u=new Map;for(const c of n){for(const d of c.structs){const h={name:d.name,mangledName:d.mangledName,members:d.members.map(m=>({name:m.name,type:aa(m.type,d.path,i),align:m.align,size:m.size}))};s.set(d.mangledName,h),u.set(d.mangledName,h)}for(const d of c.aliases){const h={name:d.name,mangledName:d.mangledName,target:aa(d.target,d.path,i)};l.set(d.mangledName,h),u.set(d.mangledName,h)}}return{structs:s,aliases:l,byMangled:u}}function aa(n,i,s,l){switch(n.kind){case"identifier":{const u=n.name.indexOf(".");if(u>0){const d=n.name.slice(0,u);if(s.get(i)?.get(d)?.kind==="namespace")throw Eg(n.name)}const c=s.get(i)?.get(n.name);if(c?.kind==="namespace")throw Eg(n.name);if(!c)throw Jl(n.name,i);return{kind:"identifier",name:c.name,mangledName:c.mangledName}}case"array":case"atomic":case"vector":case"matrix":case"ptr":return{...n,element:aa(n.element,i,s)};case"texture":return{...n,sampleType:n.sampleType?aa(n.sampleType,i,s):void 0};default:return n}}function rs(n,i){if(!i||n.kind!=="identifier")return n;const s=i.aliases.get(n.mangledName??n.name);return s?rs(s.target,i):n}function Wc(n,i){const s=rs(n,i);switch(s.kind){case"array":case"atomic":case"vector":case"matrix":case"ptr":return{...s,element:Wc(s.element,i)};case"texture":return{...s,sampleType:s.sampleType?Wc(s.sampleType,i):void 0};default:return s}}function Dw(n,i,s,l){const u=void 0;if(u!==void 0&&s.some(g=>g.path===u))return u;const c=n.from,d=i.slice(0,i.lastIndexOf("/")+1),h=c.startsWith("/")?c:Rw(`${d}${c}`);return[c,h].find(g=>s.some(x=>x.path===g))??u??h}function Rw(n){const i=n.startsWith("/"),s=[];for(const l of n.split("/"))!l||l==="."||(l===".."?s.pop():s.push(l));return`${i?"/":""}${s.join("/")}`}function hr(n,i,s=ns(n),l=s,u){const c=u?Wc(n,u):n;return Cw(c,i,s,l,u)}function Cw(n,i,s,l,u){switch(n.kind){case"scalar":return Ow(n,i,s,l);case"atomic":return zw(n,i,s,l);case"vector":return _w(n,i,s,l,u);case"matrix":return Uw(n,i,s,l,u);case"array":return Nw(n,i,s,l,u);case"identifier":return Lw(n,i,s,l,u);default:throw hy(ns(n))}}function Ow(n,i,s,l){const u=cy(n.name);if(n.name==="bool")throw dy();return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:u,size:u}}function zw(n,i,s,l){return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:4,size:4}}function _w(n,i,s,l,u){const d=hr(n.element,i,s,l,u).size??4,h=n.width===2?d*2:d*4;return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:h,size:d*n.width}}function Uw(n,i,s,l,u){const c={kind:"vector",width:n.rows,element:n.element},d=hr(c,i,`${s}[]`,`${l}[]`,u),h=sa(d.align,d.size??0);return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:d.align,size:h*n.columns,stride:h,element:d}}function Nw(n,i,s,l,u){kw(n.countExpression);const c=hr(n.element,i,`${s}[]`,`${l}[]`,u),d=sa(or(n.element,i,u),c.size??0);return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:or(n,i,u),size:n.count===void 0?void 0:d*n.count,stride:d,element:c,runtimeSized:n.count===void 0}}function kw(n){if(n!==void 0&&!uy(n))throw Ew()}function Lw(n,i,s,l,u){if(!u)throw Jl(n.name,"<unknown>");const c=u.structs.get(n.mangledName??n.name);if(!c)throw Jl(n.name,"<unknown>");const d=[];let h=0,m=1;for(const x of c.members){const b=jw(x,i,h,u);d.push(b.member),h=Bw(i,x.type,b.offset,b.member.size??0,u),m=Math.max(m,b.member.align)}const g=$w(i,m);return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:g,size:sa(g,h),members:d}}function jw(n,i,s,l){const u=hr(n.type,i,n.name,n.name,l),c=Math.max(or(n.type,i,l),n.align??1),d=Math.max(u.size??0,n.size??0),h=sa(c,s);return{member:{name:n.name,offset:h,align:c,size:d,type:n.type,layout:u,explicitAlign:n.align,explicitSize:n.size},offset:h}}function Bw(n,i,s,l,u){return s+(n==="uniform"&&Gw(i,u)?sa(16,l):l)}function Gw(n,i){const s=rs(n,i);return s.kind==="identifier"&&i.structs.has(s.mangledName??s.name)}function $w(n,i){return n==="uniform"?sa(16,i):i}function or(n,i,s){const l=s?rs(n,s):n,u=Yl(l,i,s);return i==="uniform"&&Vw(l,s)?sa(16,u):u}function Vw(n,i){return n.kind==="array"||n.kind==="identifier"&&!!i?.structs.get(n.mangledName??n.name)}function Yl(n,i,s){const l=s?rs(n,s):n;switch(l.kind){case"scalar":return Iw(l.name);case"atomic":return 4;case"vector":return l.width===2?Yl(l.element,i,s)*2:Yl(l.element,i,s)*4;case"matrix":return Yl({kind:"vector",width:l.rows,element:l.element},i,s);case"array":return or(l.element,i,s);case"identifier":return Fw(l,i,s);default:throw hy(ns(l))}}function Iw(n){if(n==="bool")throw dy();return cy(n)}function Fw(n,i,s){const l=s?.structs.get(n.mangledName??n.name);if(!l)throw Jl(n.name,"<unknown>");return Math.max(1,...l.members.map(u=>Math.max(or(u.type,i,s),u.align??1)))}const Hw=new Set(["alias","break","case","const","const_assert","continue","continuing","default","diagnostic","discard","else","enable","false","fn","for","if","let","loop","override","requires","return","struct","switch","true","var","while"]),qw=new Set(["import","export","from","as"]),py=new Set([...Hw,...qw]),Yw=new Set(["NULL","Self","abstract","active","alignas","alignof","as","asm","asm_fragment","async","attribute","auto","await","become","cast","catch","class","co_await","co_return","co_yield","coherent","column_major","common","compile","compile_fragment","concept","const_cast","consteval","constexpr","constinit","crate","debugger","decltype","delete","demote","demote_to_helper","do","dynamic_cast","enum","explicit","export","extends","extern","external","fallthrough","filter","final","finally","friend","from","fxgroup","get","goto","groupshared","highp","impl","implements","import","inline","instanceof","interface","layout","lowp","macro","macro_rules","match","mediump","meta","mod","module","move","mut","mutable","namespace","new","nil","noexcept","noinline","nointerpolation","non_coherent","noncoherent","noperspective","null","nullptr","of","operator","package","packoffset","partition","pass","patch","pixelfragment","precise","precision","premerge","priv","protected","pub","public","readonly","ref","regardless","register","reinterpret_cast","require","resource","restrict","self","set","shared","sizeof","smooth","snorm","static","static_assert","static_cast","std","subroutine","super","target","template","this","thread_local","throw","trait","try","type","typedef","typeid","typename","typeof","union","unless","unorm","unsafe","unsized","use","using","varying","virtual","volatile","wgsl","where","with","writeonly","yield"]),Xw=new Set(["binding_array"]),Kw=new Set(["array","atomic","bool","f16","f32","i32","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","ptr","sampler","sampler_comparison","texture_1d","texture_2d","texture_2d_array","texture_3d","texture_cube","texture_cube_array","texture_depth_2d","texture_depth_2d_array","texture_depth_cube","texture_depth_cube_array","texture_depth_multisampled_2d","texture_external","texture_multisampled_2d","texture_storage_1d","texture_storage_2d","texture_storage_2d_array","texture_storage_3d","u32","vec2","vec2f","vec2h","vec2i","vec2u","vec3","vec3f","vec3h","vec3i","vec3u","vec4","vec4f","vec4h","vec4i","vec4u"]),Qw=new Set(["abs","acos","acosh","all","any","arrayLength","asin","asinh","atan","atan2","atanh","ceil","clamp","cos","cosh","countLeadingZeros","countOneBits","countTrailingZeros","cross","degrees","determinant","distance","dot","dot4I8Packed","dot4U8Packed","dpdx","dpdxCoarse","dpdxFine","dpdy","dpdyCoarse","dpdyFine","exp","exp2","extractBits","faceForward","firstLeadingBit","firstTrailingBit","floor","fma","fract","frexp","fwidth","fwidthCoarse","fwidthFine","insertBits","inverseSqrt","ldexp","length","log","log2","max","min","mix","modf","normalize","pack2x16float","pack2x16snorm","pack2x16unorm","pack4x8snorm","pack4x8unorm","pack4xI8","pack4xU8","pack4xI8Clamp","pack4xU8Clamp","pow","quantizeToF16","radians","reflect","refract","reverseBits","round","saturate","select","sign","sin","sinh","smoothstep","sqrt","step","storageBarrier","tan","tanh","textureBarrier","textureDimensions","textureGather","textureGatherCompare","textureLoad","textureNumLayers","textureNumLevels","textureNumSamples","textureSample","textureSampleBaseClampToEdge","textureSampleBias","textureSampleCompare","textureSampleCompareLevel","textureSampleGrad","textureSampleLevel","textureStore","transpose","trunc","unpack2x16float","unpack2x16snorm","unpack2x16unorm","unpack4x8snorm","unpack4x8unorm","unpack4xI8","unpack4xU8","workgroupBarrier"]),Pw=new Set(["frag_depth","front_facing","global_invocation_id","instance_index","local_invocation_id","local_invocation_index","num_workgroups","position","sample_index","sample_mask","subgroup_invocation_id","subgroup_size","vertex_index","workgroup_id"]),Zw=new Set(["align","binding","blend_src","builtin","compute","diagnostic","fragment","group","id","interpolate","invariant","location","must_use","size","vertex","workgroup_size"]),Ww=new Set(["function","private","storage","uniform","workgroup"]),Jw=new Set(["read","read_write","write"]),e2=new Set(["bgra8unorm","r32float","r32sint","r32uint","rg32float","rg32sint","rg32uint","rgba16float","rgba16sint","rgba16uint","rgba32float","rgba32sint","rgba32uint","rgba8sint","rgba8snorm","rgba8uint","rgba8unorm"]);[...py,...Yw,...Xw,...Kw,...Qw,...Pw,...Zw,...Ww,...Jw,...e2];const t2="VGPU-WGSL-IDENT-NONASCII",n2="https://github.com/vercel-labs/vgpu/issues/294";function i2(n,i){const s=[];let l=0,u=1,c=1;const d=(m,g,x,b,D)=>s.push({kind:m,text:n.slice(g,x),start:g,end:x,line:b,column:D}),h=()=>{n[l]===`
|
|
10
|
+
`?(u++,c=1):c++,l++};for(;l<n.length;){const m=n[l];if(/\s/.test(m)){h();continue}const g=l,x=u,b=c;if(m==="/"&&n[l+1]==="/"){for(;l<n.length&&n[l]!==`
|
|
11
|
+
`;)h();d("lineComment",g,l,x,b);continue}if(m==="/"&&n[l+1]==="*"){let D=0;for(;l<n.length;){if(n[l]==="/"&&n[l+1]==="*"){D++,h(),h();continue}if(n[l]==="*"&&n[l+1]==="/"){if(D--,h(),h(),D===0){d("blockComment",g,l,x,b);break}continue}h()}if(D!==0)throw et("VGPU-WGSL-LEX-UNTERM-COMMENT","Unterminated block comment",x,b);continue}if(m==='"'||m==="'"){const D=m;for(h();l<n.length&&n[l]!==D;){if(n[l]===`
|
|
12
|
+
`)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",x,b);n[l]==="\\"&&h(),h()}if(l>=n.length)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",x,b);h(),d("string",g,l,x,b);continue}if(/[A-Za-z_]/.test(m)){for(;l<n.length&&/[A-Za-z0-9_]/.test(n[l]);)h();const D=n.slice(g,l);d(py.has(D)?"keyword":"ident",g,l,x,b);continue}if(/[0-9]/.test(m)||m==="."&&/[0-9]/.test(n[l+1]??"")){for(m==="."&&h();l<n.length;){const D=n[l];if(/[A-Za-z0-9_.]/.test(D)){h();continue}if((D==="+"||D==="-")&&s2(n[l-1])&&/[0-9]/.test(n[l+1]??"")){h();continue}break}d("number",g,l,x,b);continue}if(m.charCodeAt(0)>127)throw a2(n,l,u,c,i);h(),d("punct",g,l,x,b)}return s}function a2(n,i,s,l,u){let c=i;for(;c>0&&Tg(n[c-1]);)c--;let d=i+1;for(;d<n.length&&Tg(n[d]);)d++;const h=n.slice(c,d),m=l-(i-c),g=u===void 0?"":` in ${u}`,x=jS(t2,`Non-ASCII identifier '${h}'${g} at line ${s} column ${m}; vgpu's WGSL pipeline supports ASCII identifiers only`,{fix:`Rename '${h}' using ASCII letters, digits and '_'. Unicode (XID) identifiers are tracked in ${n2}`,line:s,column:m});return x.range={file:u,start:{line:s,column:m}},x}function Tg(n){return n.charCodeAt(0)>127||/[A-Za-z0-9_]/.test(n)}function s2(n){return n==="e"||n==="E"||n==="p"||n==="P"}const r2=/^_vgsl_[0-9a-f]{8,16}__[A-Za-z_][A-Za-z0-9_]*$/,l2=new Set(["fn","struct","const","alias","var","override"]);function my(n){return new u2(n).analyze()}class u2{tokens;scopes=[];declarations=[];references=[];functions=[];preserved=new Map;symbolsByScope=new Map;moduleFallbackReasons=[];pendingSymbols=[];moduleScopeId;constructor(i){this.tokens=i,this.moduleScopeId=this.createScope("module",void 0,void 0,0)}analyze(){this.collectTopLevel();for(const i of this.functions)this.walkFunction(i);return{tokens:this.tokens,scopes:this.scopes,declarations:this.declarations,references:this.references,functions:this.functions,preservedTokens:[...this.preserved.entries()].map(([i,s])=>({tokenIndex:i,reason:s})),fallback:{wholeModule:this.moduleFallbackReasons.length>0,reasons:this.moduleFallbackReasons}}}collectTopLevel(){let i=0;for(let s=0;s<this.tokens.length;s++){const l=this.tokens[s];if(!Qn(l)){if(l.text==="{"){i++;continue}if(l.text==="}"){i--,i<0&&(this.moduleFallback("unmatched top-level closing brace",s),i=0);continue}if(i===0){if(l.text==="@"){s=this.preserveAttribute(s);continue}if(l.text==="enable"||l.text==="requires"||l.text==="diagnostic"||l.text==="const_assert"){s=this.preserveStatement(s,"directive");continue}if(l.text!=="export"){if(l.text==="struct"){s=this.collectStruct(s);continue}if(l.text==="fn"){s=this.collectFunction(s);continue}if(l.text==="const"||l.text==="alias"||l.text==="var"||l.text==="override"){s=this.preserveGlobalDeclaration(s);continue}l.kind==="keyword"&&!l2.has(l.text)&&this.moduleFallback(`unexpected top-level keyword '${l.text}'`,s)}}}}i!==0&&this.moduleFallback("unclosed top-level brace",this.tokens.length-1),this.scopes[this.moduleScopeId].endToken=Math.max(0,this.tokens.length-1)}collectStruct(i){const s=this.nextSig(i);if(s===void 0||this.tokens[s]?.kind!=="ident")return this.moduleFallback("struct without name",i),i;this.preserveToken(s,"global");const l=this.nextSig(s);if(l===void 0||this.tokens[l]?.text!=="{")return this.moduleFallback("struct without body",i),s;const u=this.findMatching(l,"{","}");if(u===void 0)return this.moduleFallback("unclosed struct body",l),l;for(let c=l;c<=u;c++)this.tokens[c]?.kind==="ident"&&this.preserveToken(c,"struct");return u}collectFunction(i){const s=this.nextSig(i);if(s===void 0||this.tokens[s]?.kind!=="ident")return this.moduleFallback("function without name",i),i;const l=this.tokens[s].text,u=r2.test(l)&&!this.hasEntryAttributeBefore(i);this.addDeclaration(l,"function",s,this.moduleScopeId,void 0,u),u||this.preserveToken(s,"global");const c=this.nextSig(s);if(c===void 0||this.tokens[c]?.text!=="(")return this.moduleFallback("function without parameter list",s),s;const d=this.findMatching(c,"(",")");if(d===void 0)return this.moduleFallback("unclosed function parameter list",c),c;const h=this.findNextText(d+1,"{");if(h===void 0)return this.moduleFallback("function without body",d),d;this.preserveFunctionSignatureTail(d+1,h);const m=this.findMatching(h,"{","}");if(m===void 0)return this.moduleFallback("unclosed function body",h),h;const g=this.createScope("function",this.moduleScopeId,this.functions.length,c);return this.functions.push({id:this.functions.length,name:l,nameTokenIndex:s,scopeId:g,bodyStartToken:h,bodyEndToken:m,skipped:!1,fallbackReasons:[]}),this.collectParams(c,d,g,this.functions.length-1),this.scopes[g].endToken=m,m}collectParams(i,s,l,u){for(let c=i+1;c<s;c++){const d=this.tokens[c];if(!Qn(d)){if(d.text==="@"){c=this.preserveAttribute(c);continue}if(d.kind==="ident"&&this.nextSig(c)!==void 0&&this.tokens[this.nextSig(c)]?.text===":"){this.addDeclaration(d.text,"param",c,l,u,!0);const h=this.nextSig(c);c=this.preserveTypeFrom(h+1,[",",")"],s)}}}}preserveFunctionSignatureTail(i,s){for(let l=i;l<s;l++){const u=this.tokens[l];if(!Qn(u)){if(u.text==="@"){l=this.preserveAttribute(l);continue}u.kind==="ident"&&this.preserveToken(l,"type")}}}preserveGlobalDeclaration(i){let s=i+1;if(this.tokens[i]?.text==="var"){const c=this.nextSig(i);if(c!==void 0&&this.tokens[c]?.text==="<"){const d=this.findMatching(c,"<",">");if(d===void 0)return this.moduleFallback("unparseable top-level var template",c),c;this.preserveRange(c,d,"type"),s=d+1}}const l=this.findNextIdent(s);l!==void 0&&(this.preserveToken(l,"global"),this.addDeclaration(this.tokens[l].text,"global",l,this.moduleScopeId,void 0,!1));const u=this.findStatementEnd(i);for(let c=i;c<=u;c++)this.tokens[c]?.kind==="ident"&&this.preserveToken(c,"global");return u}walkFunction(i){const s=[this.moduleScopeId,i.scopeId],l=[],u=(h,m)=>{const g=this.createScope(h,s[s.length-1],i.id,m);return s.push(g),g},c=h=>{if(s.length<=2){this.functionFallback(i,"scope frame underflow",h);return}const m=s.pop();return this.scopes[m].endToken=h,m};u("block",i.bodyStartToken);let d=1;for(let h=i.bodyStartToken+1;h<i.bodyEndToken;h++){this.activatePendingSymbols(h);const m=this.tokens[h];if(Qn(m))continue;if(m.text==="@"){h=this.preserveAttribute(h);continue}if(m.text==="."){const x=this.nextSig(h);x!==void 0&&this.tokens[x]?.kind==="ident"&&this.preserveToken(x,"member");continue}if(m.text==="enable"||m.text==="requires"||m.text==="diagnostic"){h=this.preserveStatement(h,"directive");continue}if(m.text==="for"){const x=u("for-init",h),b=this.nextSig(h);(b===void 0||this.tokens[b]?.text!=="(")&&this.functionFallback(i,"for without parenthesized header",h),l.push({scopeId:x,headerDepth:0,awaitingBody:!1});continue}const g=l[l.length-1];if(g&&g.bodyDepth===void 0&&(m.text==="("&&g.headerDepth++,m.text===")"&&(g.headerDepth--,g.headerDepth<=0&&(g.awaitingBody=!0))),m.text==="{"){d++;const x=o2(l,b=>b.awaitingBody&&b.bodyDepth===void 0);x&&(x.bodyDepth=d),u("block",h);continue}if(m.text==="}"){const x=d;for(c(h),d--;l.length>0&&l[l.length-1].bodyDepth===x;)c(h),l.pop();d<0&&this.functionFallback(i,"unmatched closing brace",h);continue}if(m.text===":"){h=this.preserveTypeFrom(h+1,["=",";",",",")","{"],i.bodyEndToken);continue}if(m.text==="-"&&this.tokens[this.nextSig(h)??-1]?.text===">"){h=this.preserveTypeFrom((this.nextSig(h)??h)+1,["{"],i.bodyEndToken);continue}if(m.text==="let"||m.text==="const"||m.text==="var"){h=this.collectLocalDeclaration(h,s[s.length-1],i);continue}if(m.kind==="ident"&&!this.preserved.has(h)){const x=this.resolve(m.text,s);x!==void 0?this.references.push({name:m.text,tokenIndex:h,declarationId:x,scopeId:s[s.length-1],functionId:i.id}):this.preserveToken(h,"unknown")}}for(;s.length>2;)c(i.bodyEndToken)}collectLocalDeclaration(i,s,l){const u=this.tokens[i].text;let c=i+1;if(u==="var"){const m=this.nextSig(i);if(m!==void 0&&this.tokens[m]?.text==="<"){const g=this.findMatching(m,"<",">");if(g===void 0)return this.functionFallback(l,"unparseable var template",m),m;this.preserveRange(m,g,"type"),c=g+1}}const d=this.findNextIdent(c);if(d===void 0||d>=l.bodyEndToken)return this.functionFallback(l,`${u} without identifier`,i),i;this.addDeclaration(this.tokens[d].text,u,d,s,l.id,!0,this.findStatementEnd(i));const h=this.nextSig(d);return h!==void 0&&this.tokens[h]?.text===":"?this.preserveTypeFrom(h+1,["=",";",",",")"],l.bodyEndToken):d}addDeclaration(i,s,l,u,c,d,h){const m=this.declarations.length;return this.declarations.push({id:m,name:i,kind:s,tokenIndex:l,scopeId:u,functionId:c,safeToRename:d}),h!==void 0?this.pendingSymbols.push({name:i,id:m,scopeId:u,activateAfter:h}):this.activateSymbol(i,m,u),m}activatePendingSymbols(i){for(let s=this.pendingSymbols.length-1;s>=0;s--){const l=this.pendingSymbols[s];l.activateAfter>=i||(this.activateSymbol(l.name,l.id,l.scopeId),this.pendingSymbols.splice(s,1))}}activateSymbol(i,s,l){let u=this.symbolsByScope.get(l);u||(u=new Map,this.symbolsByScope.set(l,u)),u.has(i)||u.set(i,s)}resolve(i,s){for(let l=s.length-1;l>=0;l--){const u=this.symbolsByScope.get(s[l])?.get(i);if(u!==void 0)return u}}preserveAttribute(i){this.preserveToken(i,"attribute");const s=this.nextSig(i);if(s===void 0)return i;this.preserveToken(s,"attribute");const l=this.nextSig(s);if(l===void 0||this.tokens[l]?.text!=="(")return s;const u=this.findMatching(l,"(",")");return u===void 0?(this.preserveRange(l,l,"attribute"),l):(this.preserveRange(l,u,"attribute"),u)}preserveTypeFrom(i,s,l){let u=0,c=0,d=0,h=i-1;for(let m=i;m<l;m++){const g=this.tokens[m];if(!Qn(g)){if(u===0&&c===0&&d===0&&s.includes(g.text))return Math.max(i-1,m-1);if(g.text==="<")u++;else if(g.text===">")u=Math.max(0,u-1);else if(g.text==="(")c++;else if(g.text===")"){if(c===0&&s.includes(")"))return Math.max(i-1,m-1);c=Math.max(0,c-1)}else g.text==="["?d++:g.text==="]"&&(d=Math.max(0,d-1));g.kind==="ident"&&this.preserveToken(m,"type"),h=m}}return h}preserveStatement(i,s){const l=this.findStatementEnd(i);return this.preserveRange(i,l,s),l}preserveRange(i,s,l){for(let u=i;u<=s;u++)this.tokens[u]&&this.tokens[u].kind!=="lineComment"&&this.tokens[u].kind!=="blockComment"&&this.preserveToken(u,l)}preserveToken(i,s){this.preserved.has(i)||this.preserved.set(i,s)}createScope(i,s,l,u){const c=this.scopes.length;return this.scopes.push({id:c,kind:i,parentId:s,functionId:l,startToken:u}),c}nextSig(i){for(let s=i+1;s<this.tokens.length;s++)if(!Qn(this.tokens[s]))return s}findNextIdent(i){for(let s=i;s<this.tokens.length;s++){const l=this.tokens[s];if(!Qn(l)){if(l.kind==="ident")return s;if(l.text!=="@")return}}}findNextText(i,s){for(let l=i;l<this.tokens.length;l++)if(!Qn(this.tokens[l])&&this.tokens[l].text===s)return l}findStatementEnd(i){let s=0;for(let l=i;l<this.tokens.length;l++){const u=this.tokens[l].text;if(u==="(")s++;else if(u===")")s=Math.max(0,s-1);else if(s===0&&(u===";"||u==="{"||u==="}"))return l}return this.tokens.length-1}findMatching(i,s,l){let u=0;for(let c=i;c<this.tokens.length;c++){const d=this.tokens[c].text;if(d===s&&u++,d===l&&(u--,u===0))return c}}hasEntryAttributeBefore(i){for(let s=i-1;s>=0;s--){const l=this.tokens[s];if(!Qn(l)){if(l.text===")"||l.kind==="ident"||l.text==="@"){const u=l.text;if(u==="compute"||u==="vertex"||u==="fragment")return!0;continue}break}}return!1}moduleFallback(i,s){this.moduleFallbackReasons.push(`${i} at token ${s}`)}functionFallback(i,s,l){i.skipped=!0,i.fallbackReasons.push(`${s} at token ${l}`)}}function o2(n,i){for(let s=n.length-1;s>=0;s--)if(i(n[s]))return n[s]}function Qn(n){return n.kind==="lineComment"||n.kind==="blockComment"}const c2=new Set(["textureSample","textureSampleBias","textureSampleLevel","textureSampleGrad","textureGather","textureSampleBaseClampToEdge"]),f2=new Set(["textureSampleCompare","textureSampleCompareLevel","textureGatherCompare"]);function d2(n,i,s){const l=new Map;for(let u=0;u<n.length;u++){const c=n[u],d=i[u],h=my(c.tokens),m=new Map;for(const x of d.vars){const b=Yt(x.attrs,"group"),D=Yt(x.attrs,"binding"),V=h.declarations.find(L=>L.kind==="global"&&L.name===x.name);b!==void 0&&D!==void 0&&V&&m.set(V.id,{group:b,binding:D})}const g=new Map;for(const x of h.declarations){if(x.kind!=="function")continue;const b=h.functions.find(D=>D.nameTokenIndex===x.tokenIndex);b&&g.set(x.id,b.id)}for(const x of d.entries){const b=h.functions.find(z=>z.name===x.name),D=[];let V=h.fallback.wholeModule||!b;!V&&b&&(V=!gy(b.id,new Map,new Set,h,m,g,D));const L=b?y2(b.id,h,m,g):s.map(Jc);l.set(x,V?v2(s,L):b2(D))}}return l}function gy(n,i,s,l,u,c,d){const h=l.functions[n];if(!h||h.skipped)return!1;const m=`${n}|${[...i].map(([b,D])=>`${b}:${D.group}:${D.binding}`).join(",")}`;if(s.has(m))return!0;s.add(m);const g=l.references.filter(b=>b.functionId===n),x=new Map(g.map(b=>[b.tokenIndex,b]));for(let b=h.bodyStartToken+1;b<h.bodyEndToken;b++){const D=l.tokens[b]?.text,V=c2.has(D??"")?"filtering":f2.has(D??"")?"comparison":void 0,L=x.get(b),z=L&&c.get(L.declarationId);if(!V&&z===void 0)continue;const k=g2(l,b);if(k===void 0||l.tokens[k]?.text!=="(")continue;const K=m2(l,k);if(!K)return!1;const B=K.map(([F,H])=>h2(F,H,l,u,i));if(V){const F=D==="textureGather"&&!p2(K[0],l,u,i)?1:0,H=B[F],Z=B[F+1];if(!H||!Z)return!1;d.push({texture:H,sampler:Z,mode:V})}else{const F=l.declarations.filter(Z=>Z.kind==="param"&&Z.functionId===z).sort((Z,de)=>Z.tokenIndex-de.tokenIndex),H=new Map;for(let Z=0;Z<F.length;Z++)B[Z]&&H.set(F[Z].id,B[Z]);if(!gy(z,H,s,l,u,c,d))return!1}}return!0}function h2(n,i,s,l,u){for(const c of s.references){if(c.tokenIndex<n||c.tokenIndex>i)continue;const d=l.get(c.declarationId)??u.get(c.declarationId);if(d)return d}}function p2(n,i,s,l){const u=i.references.find(c=>c.tokenIndex>=n[0]&&c.tokenIndex<=n[1]);return u?.tokenIndex===n[0]?s.get(u.declarationId)??l.get(u.declarationId):void 0}function m2(n,i){const s=[];let l=1,u=0,c=0,d=0,h=i+1;for(let m=i+1;m<n.tokens.length;m++){const g=n.tokens[m].text;if(g==="(")l++;else if(g===")"){if(l--,l===0)return s.push([h,m-1]),s}else g==="["?u++:g==="]"?u--:g==="{"?c++:g==="}"?c--:g==="<"?d++:g===">"?d--:g===","&&l===1&&u===0&&c===0&&d===0&&(s.push([h,m-1]),h=m+1)}}function g2(n,i){for(let s=i+1;s<n.tokens.length;s++)if(n.tokens[s].kind!=="lineComment"&&n.tokens[s].kind!=="blockComment")return s}function y2(n,i,s,l){const u=[n],c=new Set,d=new Map;for(;u.length;){const h=u.pop();if(!c.has(h)){c.add(h);for(const m of i.references){if(m.functionId!==h)continue;const g=s.get(m.declarationId);g&&d.set(`${g.group}:${g.binding}`,g);const x=l.get(m.declarationId);x!==void 0&&u.push(x)}}}return[...d.values()]}function v2(n,i){const s=new Set(i.map(d=>`${d.group}:${d.binding}`)),l=n.filter(d=>s.has(`${d.group}:${d.binding}`)),u=l.filter(d=>d.bindingLayout?.kind==="texture"&&d.bindingLayout.texture.sampleType==="unfilterable-float"&&!d.bindingLayout.texture.multisampled),c=l.filter(d=>d.bindingLayout?.kind==="sampler"&&d.bindingLayout.sampler.type==="filtering");return u.flatMap(d=>c.map(h=>({texture:Jc(d),sampler:Jc(h),mode:"filtering"})))}function Jc(n){return{group:n.group,binding:n.binding}}function b2(n){const i=new Set;return n.filter(s=>{const l=`${s.texture.group}:${s.texture.binding}:${s.sampler.group}:${s.sampler.binding}:${s.mode}`;return i.has(l)?!1:(i.add(l),!0)})}function x2(n,i){const s=n.map(dw),l=Tw(n,s),u=Mw(s,l),c=[],d=[];for(const g of s)for(const x of g.vars){const b=Yt(x.attrs,"group"),D=Yt(x.attrs,"binding");if(b===void 0||D===void 0)continue;const V=aa(x.type,x.path,l),L=FS(V,x.addressSpace),z=x.addressSpace==="uniform"||x.addressSpace==="storage"?hr(V,x.addressSpace,x.name,x.mangledName,u):void 0;z&&d.push(z),c.push({group:b,binding:D,name:x.name,mangledName:x.mangledName,type:V,kind:L,addressSpace:x.addressSpace,access:x.access,struct:V.kind==="identifier"?u.structs.get(V.mangledName??V.name):void 0,layout:z,bindingLayout:HS(L,x.addressSpace,x.access,V,z)})}c.sort((g,x)=>g.group-x.group||g.binding-x.binding);const h=S2(n,s,c),m=d2(n,s,c);return{bindings:c,entryPoints:s.flatMap(g=>g.entries.map(x=>w2(x,s.flatMap(b=>b.structs),l,u,h.get(x)??c,m.get(x)??[]))),overrides:s.flatMap(g=>g.overrides),featuresRequired:[...new Set(s.flatMap(g=>g.features))],aliases:[...u.aliases.values()],structs:[...u.structs.values()],hostShareableLayouts:d}}function S2(n,i,s){const l=new Map;for(let u=0;u<n.length;u++){const c=n[u],d=i[u],h=my(c.tokens),m=h.fallback.wholeModule,g=new Map;for(const b of h.declarations){if(b.kind!=="function")continue;const D=h.functions.find(V=>V.nameTokenIndex===b.tokenIndex);D&&g.set(b.id,D.id)}const x=new Map;for(const b of d.vars){const D=Yt(b.attrs,"group"),V=Yt(b.attrs,"binding");if(D===void 0||V===void 0)continue;const L=h.declarations.find(z=>z.kind==="global"&&z.name===b.name);L&&x.set(L.id,{group:D,binding:V})}for(const b of d.entries){const D=h.functions.find(k=>k.name===b.name);if(m||!D){l.set(b,s);continue}const V=[D.id],L=new Set,z=new Map;for(;V.length;){const k=V.pop();if(!L.has(k)&&(L.add(k),!!h.functions[k]))for(const K of h.references){if(K.functionId!==k)continue;const B=x.get(K.declarationId);B&&z.set(`${B.group}:${B.binding}`,B);const F=g.get(K.declarationId);F!==void 0&&V.push(F)}}l.set(b,[...z.values()].sort((k,K)=>k.group-K.group||k.binding-K.binding))}}return l}function w2(n,i,s,l,u,c){return{name:n.name,mangledName:n.mangledName,stage:n.stage,...n.workgroupSize?{workgroupSize:n.workgroupSize}:{},bindings:u.map(({group:d,binding:h})=>({group:d,binding:h})),samplingPairs:c,...n.stage==="vertex"?{inputs:E2(n,i,s,l)}:{}}}function E2(n,i,s,l){const u=[];for(const c of n.params){if(Ag(c.attrs,"builtin"))continue;const d=aa(c.type,n.path,s),h=Yt(c.attrs,"location");if(h!==void 0){u.push({name:c.name,location:h,type:d});continue}const m=rs(d,l);if(m.kind!=="identifier")continue;const g=i.find(b=>b.mangledName===(m.mangledName??m.name)),x=l.structs.get(m.mangledName??m.name);if(g)for(let b=0;b<g.members.length;b++){const D=g.members[b];if(Ag(D.attrs,"builtin"))continue;const V=Yt(D.attrs,"location");V!==void 0&&u.push({name:D.name,location:V,type:x?.members[b]?.type??aa(D.type,g.path,s)})}}return u}function Ag(n,i){return n.some(s=>s.name===i)}function yy(n,i="<runtime>"){const s=i2(n,i),l=GS(s);if(l.imports.length>0)throw et("VGPU-WGSL-REFLECT-SOURCE-IMPORT","reflectSource() accepts a single raw WGSL string; use resolveShader() for WGSL import graphs.");return x2([{path:i,source:n,tokens:s,parsed:l}])}function vy(){const n=new Map;return{getOrCreate(i,s,l,u){const c=l.map(ef),d=`${i}:${s}:${c.join("|")}`,h=n.get(d);if(h)return h.bindGroup;const m=u();return n.set(d,{identities:c,bindGroup:m}),m},evictIdentity(i){const s=ef(i);for(const[l,u]of n)u.identities.includes(s)&&n.delete(l)},clearDraw(i){const s=`${i}:`;for(const l of n.keys())l.startsWith(s)&&n.delete(l)},dispose(){n.clear()}}}function ef(n){return typeof n=="string"||typeof n=="number"?String(n):`${n.kind}:${n.id}`}function eu(n,i,s){const l=n[i];if(!l)throw new ie({code:"VGPU-REFLECT-ENTRY-METADATA-MISSING",message:`Entry point '${n.name}' has no reflected ${i}.`,fix:"Pass the reflection from reflectSource()/resolveShader().",where:s});return l}const tu=new WeakMap;function lr(n,i){if(!n.gpu.pushErrorScope||!n.gpu.popErrorScope)return;n.gpu.pushErrorScope("validation");const s=tu.get(n.gpu);s?s.push(i):tu.set(n.gpu,[i])}function un(n){const i=tu.get(n.gpu);if(!i?.length||!n.gpu.popErrorScope)return;const s=i.pop();return i.length||tu.delete(n.gpu),{context:s,error:n.gpu.popErrorScope()}}function by(n){const i=[];let s=un(n);for(;s;)i.push(s),s=un(n);return i}function T2(n){const i=un(n);i&&xf(i)}function xy(n){for(const i of by(n))xf(i)}function Ht(n){for(const i of n)xf(i)}function bf(n){return n.gpu.queue.onSubmittedWorkDone?.()??Promise.resolve()}function Sy(n,i=[],s={}){return M2(n,i,s.errorSink??D2)}function nu(n,i){return{context:n.context,error:A2(n.error,i.error)}}async function A2(n,i){const s=await Promise.allSettled([n,i]);for(const u of s)if(u.status==="fulfilled"&&u.value)return u.value;const l=s.find(u=>u.status==="rejected");if(l?.status==="rejected")throw l.reason;return null}async function M2(n,i,s){await bf(n);for(const l of i)try{const u=await l.error;u&&await s(is(l.context.label,l.context.group,u))}catch(u){await s(is(l.context.label,l.context.group,u))}}function xf(n){n.error.catch(()=>{})}function D2(n){console.error(n)}function wy(n,i,s,l){try{i.end()}catch(u){const c=by(n);Ht(s),Ht(c),s.length=0;const d=c[0]?.context??l;throw d?is(d.label,d.group,u):u}}let R2=1;const Mg=new WeakMap;function C2(n){return n===null||typeof n!="object"||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||Array.isArray(n)?!0:n instanceof Ri||n instanceof as?!1:!Ty(n)}function tf(n){return typeof n!="object"||n===null||Array.isArray(n)||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||n instanceof Ri||n instanceof as?!1:!Ty(n)}function Dg(n,i,s){switch(n.bindingLayout?.kind){case"buffer":return O2(n,i,s);case"texture":return z2(n,i,s);case"sampler":return _2(n,i);case"storageTexture":throw Zn(n,"storage texture","Pass a storage-compatible texture.");case"externalTexture":throw Zn(n,"external texture","Pass a compatible GPUExternalTexture.");default:throw Zn(n,"reflected resource","Fix shader reflection bindingLayout.")}}function O2(n,i,s){const l=NS(i);if(l)return l[ty](n,s.sourceHint);if(i instanceof Ri)return xg(i,`${s.sourceHint}.set`),N2(n,i.options.usage),{resource:{buffer:i.gpu},identity:i.resourceIdentity,unsubscribe:u=>i.onDestroy(u)};if(L2(i))return xg(i.buffer,`${s.sourceHint}.set`),{resource:{buffer:i.gpu,offset:0,size:i.size},identity:i.buffer.resourceIdentity,unsubscribe:u=>i.buffer.onDestroy(u)};if(My(i))return{resource:i,identity:cr(i.buffer)};if(Sf(i))return{resource:{buffer:i},identity:cr(i)};throw Zn(n,"buffer",`Pass a compatible Buffer/Uniform: ${n.name}.set({ ${n.name}: gpu.device.createBuffer(...) }).`)}function z2(n,i,s){const l=Ey(i);if(l){const u=l.color;Rg(n,u,s);const c=l.onTexturesRecreated?.bind(l);return{resource:u.createView(),identity:u.resourceIdentity,unsubscribe:d=>l.onDestroy(d),onRecreate:c?d=>c(d):void 0}}if(i instanceof as)return k2(n,i.usage),Rg(n,i,s),{resource:i.createView(),identity:i.resourceIdentity,unsubscribe:u=>i.onDestroy(u)};if(Ay(i))return{resource:i.createView(),identity:i.resourceIdentity??cr(i)};if(typeof i=="object"&&i!==null)return{resource:i,identity:cr(i)};throw Zn(n,"texture/target",`Pass a Texture or Target: ${n.name}.set({ ${n.name}: scene.color }) or set({ ${n.name}: scene }).`)}function _2(n,i){if(U2(i))return{resource:i,identity:cr(i)};throw Zn(n,"sampler",`Use the cached sampler: set({ ${n.name}: sampler(gpu) }).`)}function U2(n){return typeof n!="object"||n===null||n instanceof Ri||n instanceof as?!1:!Sf(n)&&!My(n)&&!Ay(n)&&!Ey(n)}function N2(n,i){const s=n.bindingLayout?.kind==="buffer"?n.bindingLayout.buffer.type:void 0;if(s==="uniform"&&!i.includes("uniform"))throw Zn(n,"uniform buffer","Create with usage: ['uniform','copy_dst'].");if((s==="storage"||s==="read-only-storage")&&!i.includes("storage"))throw Zn(n,"storage buffer","Create with usage: ['storage','copy_dst'].")}function k2(n,i){if(!i.includes("texture_binding")&&!i.includes("render_attachment"))throw Zn(n,"sampled texture","Use texture_binding usage or a sampleable Target.")}function Rg(n,i,s){if(!(!s.filterableTexture||s.float32Filterable)&&(i.format==="r32float"||i.format==="rg32float"||i.format==="rgba32float"))throw W1(s.sourceHint,n,i.format,i.label??"texture",s.pairedSampler)}function Ey(n){if(typeof n!="object"||n===null)return;const i=n;if(!(!i.resourceIdentity||!i.color||typeof i.onDestroy!="function"))return i}function Ty(n){const i=n;return"gpu"in i||"bindGroup"in i||"createView"in i||"resourceIdentity"in i}function cr(n){if(typeof n!="object"||n===null)return`value:${String(n)}`;let i=Mg.get(n);return i||(i={kind:"external",id:R2++},Mg.set(n,i)),i}function L2(n){return typeof n=="object"&&n!==null&&"gpu"in n&&"size"in n&&"buffer"in n&&n.buffer instanceof Ri}function Ay(n){return typeof n=="object"&&n!==null&&typeof n.createView=="function"}function My(n){return typeof n=="object"&&n!==null&&"buffer"in n&&Sf(n.buffer)}function Sf(n){return typeof n=="object"&&n!==null&&"size"in n&&"usage"in n&&typeof n.destroy=="function"}function j2(n,i){B2(n);const s=new ArrayBuffer(n.size);return wf(new DataView(s),n,0,i),s}function B2(n){if(n.size===void 0)throw qt("set",`No se puede inferir byteLength para layout runtime-sized '${n.name}'.`)}function wf(n,i,s,l){if(i.members)return G2(n,i.members,s,l);$2(n,i,s,l)}function G2(n,i,s,l){const u=l;for(const c of i)wf(n,c.layout,s+c.offset,u?.[c.name])}function $2(n,i,s,l){switch(i.type.kind){case"scalar":return Ef(n,s,i.type.name,l);case"vector":return V2(n,s,i.type,l);case"matrix":return I2(n,i,s,l);case"array":return F2(n,i,s,l);default:throw qt("set",`No hay writer para layout ${i.type.kind}.`)}}function Ef(n,i,s,l){s==="f32"?n.setFloat32(i,Number(l??0),!0):s==="i32"?n.setInt32(i,Number(l??0),!0):s==="u32"||s==="bool"?n.setUint32(i,s==="bool"?l?1:0:Number(l??0),!0):n.setUint16(i,H2(Number(l??0)),!0)}function V2(n,i,s,l){const u=l,c=Dy(s.element);for(let d=0;d<s.width;d++)Ef(n,i+d*c,Tf(s.element),u?.[d]??0)}function I2(n,i,s,l){const u=i.type,c=l,d=Dy(u.element),h=i.stride??16;for(let m=0;m<u.columns;m++)for(let g=0;g<u.rows;g++)Ef(n,s+m*h+g*d,Tf(u.element),c?.[m*u.rows+g]??0)}function F2(n,i,s,l){const u=l,c=i.stride??i.element?.size??0;if(!i.element)throw qt("set","Array layout sin element layout.");for(let d=0;d<(u?.length??0);d++)wf(n,i.element,s+d*c,u[d])}function Dy(n){return Tf(n)==="f16"?2:4}function Tf(n){if(n.kind!=="scalar")throw qt("set",`Expected scalar, got ${n.kind}`);return n.name}function H2(n){const i=new Float32Array(1),s=new Uint32Array(i.buffer);i[0]=n;const l=s[0],u=l>>16&32768,c=l&8388607,d=l>>23&255;if(d===255)return u|(c?32256:31744);const h=d-127+15;return h>=31?u|31744:h<=0?h<-10?u:u|(c|8388608)>>1-h+13:u|h<<10|c>>13}const Cg=new WeakMap;function q2(n,i){const s=new Map,l=new Set;for(const c of i){const d=c.stage==="vertex"?1:c.stage==="fragment"?2:4;for(const h of eu(c,"bindings","visibility")){const m=`${h.group}:${h.binding}`;s.set(m,(s.get(m)??0)|d)}for(const h of eu(c,"samplingPairs","visibility"))h.mode==="filtering"&&l.add(`${h.texture.group}:${h.texture.binding}`)}const u=c=>s.get(`${c.group}:${c.binding}`)??0;return Object.defineProperty(u,"filterable",{value:l}),u}function Ry(n,i,s=Af){return n.flatMap(l=>{if(l.group!==i)return[];const u=s(l);return u===0?[]:[{binding:l.binding,visibility:u,...K2(l,s.filterable?.has(`${l.group}:${l.binding}`)??!1)}]})}function Y2(n,i,s,l=Af){const u=new Map,c=s.bindings.filter(h=>l(h)!==0).map(h=>h.group),d=Math.max(-1,...c);for(let h=0;h<=d;h++)u.set(h,X2(n,i,s,h,l));return u}function X2(n,i,s,l,u=Af){return Cy(n,`${i}.group${l}.bgl`,Ry(s.bindings,l,u))}function Cy(n,i,s){let l=Cg.get(n.gpu);l||(l=new Map,Cg.set(n.gpu,l));const u=JSON.stringify(s),c=l.get(u);if(c)return c;const d=Q1(n.gpu.createBindGroupLayout({label:i,entries:s}),{entries:s});return l.set(u,d),d}function K2(n,i){const s=n.bindingLayout;if(!s)throw qt("bindGroupLayout",`Binding '${n.name}' does not have a reflected bindingLayout.`);return i&&s.kind==="texture"&&s.texture.sampleType==="unfilterable-float"&&!s.texture.multisampled?{texture:{...s.texture,sampleType:"float"}}:Q2(s)}function Q2(n){switch(n.kind){case"buffer":return{buffer:{...n.buffer}};case"sampler":return{sampler:{...n.sampler}};case"texture":return{texture:{...n.texture}};case"storageTexture":return{storageTexture:{...n.storageTexture}};case"externalTexture":return{externalTexture:{}}}}function Af(n){const i=globalThis.GPUShaderStage,s=i?.VERTEX??1,l=i?.FRAGMENT??2,u=i?.COMPUTE??4;return n.kind==="buffer"?s|l|u:l|u}function P2(n){const i=Z2(n.reflection),s=[...n.bindGroupLayouts.keys()].sort((E,G)=>E-G),l=new Map;function u(E){const G=[];for(const[W,te]of Object.entries(E))G.push(...d(W,te));return G}function c(E){const G=n.bindGroupLayouts.get(E.info.group);return!!G&&!!rr(G)?.entries.some(W=>W.binding===E.info.binding)}function d(E,G){const W=i.get(E);if(W)return h(W,E,G);const te=W2(E,i,n.label);if(!te)throw qt(`${n.label}.set`,`Binding '${E}' does not exist in '${n.label}'.`);return m(te,E,G)}function h(E,G,W){Z(E.info.group);const te=Og(E.info,W);zg(E,G,te);const le=Xl(E.identity);return te==="lib"?g(E,nE(E.libValue,W)):b(E,W),c(E)?kc(E,le):[]}function m(E,G,W){Z(E.info.group);const te=Og(E.info,W);if(zg(E,G,te),J2(E,G,te),te!=="lib")throw qt(`${n.label}.set`,`Member '${G}' needs a JS value; set resource '${E.info.name}' instead.`);const le=Xl(E.identity);return g(E,{...iE(E.libValue),[G]:W}),c(E)?kc(E,le):[]}function g(E,G){const W=M(E);E.libValue=G;const te=j2(W,G);E.buffer||de(E,W.size),E.bytes=te,E.buffer.write(te,0)}function x(E){const G=rr(n.bindGroupLayouts.get(E.group))?.entries.find(le=>le.binding===E.binding),W=n.reflection.entryPoints.flatMap(le=>eu(le,"samplingPairs",n.label)).find(le=>le.mode==="filtering"&&le.texture.group===E.group&&le.texture.binding===E.binding),te=W&&n.reflection.bindings.find(le=>le.group===W.sampler.group&&le.binding===W.sampler.binding);return{sourceHint:n.label,filterableTexture:G?.texture?.sampleType==="float",float32Filterable:n.device.features.has("float32-filterable"),pairedSampler:te}}function b(E,G){const W=Dg(E.info,G,x(E.info));E.unsubscribe?.(),E.unsubscribeRecreate?.(),E.resource=W.resource,E.identity=W.identity,E.unsubscribe=W.unsubscribe?.(()=>{E.identity&&n.cache.evictIdentity(E.identity)}),E.unsubscribeRecreate=W.onRecreate?.(()=>D(E,G))}function D(E,G){const W=Xl(E.identity);E.identity&&n.cache.evictIdentity(E.identity);const te=Dg(E.info,G,x(E.info));if(E.unsubscribe?.(),E.unsubscribeRecreate?.(),E.resource=te.resource,E.identity=te.identity,E.unsubscribe=te.unsubscribe?.(()=>{E.identity&&n.cache.evictIdentity(E.identity)}),E.unsubscribeRecreate=te.onRecreate?.(()=>D(E,G)),c(E))for(const le of kc(E,W))n.onIdentityChange?.(le)}function V(E,G,W){L(E),eE(n.label,E,G,W);const te=l.has(E)?`claimed-group:${E}`:void 0;return l.set(E,G),te}function L(E){const G=n.bindGroupLayouts.get(E);if(!G)throw qt(`${n.label}.layout`,`@group(${E}) does not exist in '${n.label}'.`);return G}function z(){return s.map(k)}function k(E){const G=l.get(E);if(G)return{group:E,bindGroup:G,offsets:[],claimValidation:K(G,E)};const W=new Set(rr(L(E))?.entries.map(re=>re.binding)),te=n.reflection.bindings.filter(re=>re.group===E&&W.has(re.binding)),le=B(te),$e=F(te),he=n.cache.getOrCreate(n.drawId,E,$e,()=>n.device.gpu.createBindGroup({label:`${n.label}.group${E}`,layout:L(E),entries:le}));return{group:E,bindGroup:he,offsets:[]}}function K(E,G){return Q0(E)?void 0:{label:n.label,group:G}}function B(E){return E.map(G=>{const W=H(G);return{binding:G.binding,resource:W.resource}})}function F(E){return E.map(G=>H(G).identity)}function H(E){const G=i.get(E.name);if(!G?.resource||!G.identity)throw J1(n.label,E);return G}function Z(E){if(l.has(E))throw eS(n.label,E)}function de(E,G){E.buffer=n.device.createBuffer({size:G,usage:["uniform","copy_dst"],label:`${n.label}.${E.info.name}`}),E.resource={buffer:E.buffer.gpu,offset:0,size:G},E.identity=E.buffer.resourceIdentity,E.unsubscribe=E.buffer.onDestroy(()=>n.cache.evictIdentity(E.buffer.resourceIdentity))}function M(E){if(E.info.kind!=="buffer"||!E.info.layout?.size)throw qt(`${n.label}.set`,`Binding '${E.info.name}' needs a compatible resource, not JS.`);return E.info.layout}return{get groups(){return s},set:u,claimGroup:V,layout:L,bindGroups:z,bindingState(E){const G=i.get(E);if(!(!G?.ownership||!G.resource||!G.identity))return{info:G.info,ownership:G.ownership,resource:G.resource,identity:G.identity}}}}function Z2(n){return new Map(n.bindings.map(i=>[i.name,{info:i,memberOwnership:new Map}]))}function W2(n,i,s){let l;for(const u of i.values())if(u.info.layout?.members?.some(c=>c.name===n)){if(l)throw qt(`${s}.set`,`Binding member '${n}' is ambiguous in '${s}'; set the complete binding.`);l=u}return l}function Og(n,i){return n.bindingLayout?.kind==="buffer"&&C2(i)?"lib":"user"}function zg(n,i,s){if(n.ownership&&n.ownership!==s)throw P0(i,n.ownership);n.ownership??=s}function J2(n,i,s){const l=n.memberOwnership.get(i);if(l&&l!==s)throw P0(i,l);n.memberOwnership.set(i,s)}function eE(n,i,s,l){const u=Q0(s);if(!u)return;const c=rr(l);if(!c)return;const d=tE(c.entries,u.layout.entries);if(d)throw tS(n,i,d)}function tE(n,i){if(n.length!==i.length)return`expected ${n.length} bindings and received ${i.length}`;const s=_g(n),l=_g(i);for(const[u,c]of s){const d=l.get(u);if(!d)return`missing @binding(${u})`;if(Ug(c)!==Ug(d))return`@binding(${u}) does not match the reflected layout`}}function _g(n){return new Map(n.map(i=>[i.binding,i]))}function Ug(n){return JSON.stringify({binding:n.binding,visibility:n.visibility,buffer:n.buffer,sampler:n.sampler,texture:n.texture,storageTexture:n.storageTexture,externalTexture:n.externalTexture?{}:void 0})}function kc(n,i){const s=Xl(n.identity);return!s||i===s?[]:[{group:n.info.group,binding:n.info.binding,bindingName:n.info.name,bindingKind:n.info.kind,previousIdentity:i,newIdentity:s}]}function Xl(n){return n===void 0?void 0:ef(n)}function nE(n,i){return tf(n)&&tf(i)?{...n,...i}:i}function iE(n){return tf(n)?n:{}}const aE="rgba8unorm",Mf=Object.freeze([0,0,0,1]);function iu(n,i){const s=n,l=Array.isArray(n)?n:[s?.r,s?.g,s?.b,s?.a];if(l.length!==4||!l.every(u=>typeof u=="number"&&Number.isFinite(u)))throw xS(i);return Df(n)}function Df(n){const i=n;return Array.isArray(n)?[n[0],n[1],n[2],n[3]]:{r:i.r,g:i.g,b:i.b,a:i.a}}function Kl(n){return n.colors??[{format:n.format??aE}]}function Oy(n){return n.depth===!0?"depth24plus":n.depth||void 0}function zy(n){const i=n.msaa;if(i===!0||i===4)return 4;if(i===void 0||i===!1)return 1;const s=Z0();throw s.code="VGPU-TARGET-MSAA-INVALID",s.message=`msaa received ${i}; WebGPU 1|4; use true`,s}function sE(n,i){if(!n?.size)throw Z0();const s=Oy(n);if(s==="stencil8")throw pS(s);if(zy(n)===4)for(const l of Kl(n))rE(l.format,i)}function rE(n,i){if(i.isCompatibilityMode&&n==="rgba16float")throw qt("target","Dawn compatibility mode does not support rgba16float+msaa.","Use rgba8unorm for MSAA here, or disable msaa.")}function lE(n,i,s,l){const u={view:(i??n).createView(),resolveTarget:i?n.createView():void 0,loadOp:l?"load":"clear",storeOp:i?"discard":"store"};return l||(u.clearValue=_y(s)),u}function uE(n,i,s,l,u){if(u){const d={view:n.createView(),depthReadOnly:!0};return fr(n.format)&&(d.stencilReadOnly=!0),d}const c={view:n.createView(),depthLoadOp:i?"load":"clear",depthStoreOp:n.sampleCount>1?"discard":"store"};return i||(c.depthClearValue=s??1),n.format&&fr(n.format)&&(c.stencilLoadOp=i?"load":"clear",c.stencilStoreOp=n.sampleCount>1?"discard":"store",i||(c.stencilClearValue=l??0)),c}function fr(n){return!!n&&n.includes("stencil")}function _y(n){return Array.isArray(n)?{r:n[0],g:n[1],b:n[2],a:n[3]}:n}function Uy(n,i){return n[0]===i[0]&&n[1]===i[1]}function cu(n){return typeof n=="object"&&n!==null&&typeof n.renderPassDescriptor=="function"}let oE=1,cE=1;const fE=new WeakMap,dE=new WeakMap;function hE(n){return cu(n)?{colors:n.colors.map(i=>i.format),depth:n.depth?.format,sampleCount:n.sampleCount}:typeof n!="object"||n===null?{colors:[]}:{colors:Array.isArray(n.colors)?[...n.colors]:n.colors??[],depth:n.depth,sampleCount:n.sampleCount??1}}function Ny(n){return`${n.colors.join(",")}:${n.depth??"none"}:${n.sampleCount??1}`}function pE(n,i){if(!Array.isArray(n.colors)||n.colors.length===0)throw kl(i,"colors must be a non-empty array.");const s=n.colors.find(u=>typeof u!="string"||u.length===0);if(s!==void 0)throw kl(i,`colors must contain only GPUTextureFormat strings; received ${String(s)}.`);if(n.depth!==void 0&&(typeof n.depth!="string"||n.depth.length===0))throw kl(i,"depth must be a GPUTextureFormat string.");const l=n.sampleCount??1;if(l!==1&&l!==4)throw kl(i,`sampleCount must be 1 or 4; received ${String(l)}.`)}function mE(n){const i=`${jg(fE,n.module,()=>oE++)}|${jg(dE,n.pipelineLayout,()=>cE++)}|${SE(n.vertexBufferLayouts??[])}|${Ny(n.signature)}`,s=n.topology||n.stripIndexFormat?`${i}|${n.topology??"triangle-list"}|${n.stripIndexFormat??"none"}`:i,l=n.cullMode||n.frontFace?`${s}|${n.cullMode??"none"}|${n.frontFace??"ccw"}`:s,u=n.unclippedDepth?`${l}|unclipped`:l,c=n.depthKey?`${u}|${n.depthKey}`:u,d=n.stencilKey?`${c}|${n.stencilKey}`:c,h=n.multisampleKey?`${d}|${n.multisampleKey}`:d,m=n.constantsKey?`${h}|${n.constantsKey}`:h,g=n.entryKey?`${m}|${n.entryKey}`:m;return n.fragmentKey?`${g}|${n.fragmentKey}`:g}function Ng(n,i,s,l,u){if(l===void 0)return i.find(d=>d.stage===s);if(typeof l!="string")throw ql(n,`${s} received ${nf(l)}; expected an entry point name string.`,u);const c=i.find(d=>d.name===l);if(!c)throw ql(n,`"${l}" matches no entry point in the shader; available entry points: ${kg(i)}.`,u);if(c.stage!==s)throw ql(n,`"${l}" is a @${c.stage} entry point, not @${s}; available entry points: ${kg(i)}.`,u);return c}function kg(n){return n.length?n.map(i=>`"${i.name}" (@${i.stage})`).join(", "):"none"}function gE(n,i,s,l){if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw Nl(n,`received ${nf(i)}; expected { overrideNameOrId: number | boolean }.`,l);const u=new Map(s.map(d=>[Lg(d),d])),c={};for(const[d,h]of Object.entries(i??{})){if(!u.has(d))throw Nl(n,`"${d}" matches no override in the shader; available overrides: ${yE(s)}.`,l);if(typeof h=="boolean"){c[d]=h?1:0;continue}if(typeof h!="number"||!Number.isFinite(h))throw Nl(n,`"${d}" received ${nf(h)}; use a finite number or a boolean (WebGPU converts the value to the override's WGSL type, and NaN/Infinity fail that conversion).`,l);c[d]=h}for(const d of s){const h=Lg(d);if(d.defaultValue===void 0&&!(h in c))throw Nl(n,`override '${d.name}' has no default value and must be provided; add constants: { "${h}": value }.`,l)}return Object.keys(c).length===0?{}:{constants:c,constantsKey:vE(c)}}function Lg(n){return n.id!==void 0?String(n.id):n.name}function yE(n){return n.length?n.map(i=>i.id!==void 0?`"${i.id}" (@id of ${i.name})`:`"${i.name}"`).join(", "):"none"}function vE(n){return`cn~${Object.entries(n).sort(([i],[s])=>i<s?-1:i>s?1:0).map(([i,s])=>`${i}=${s}`).join("~")}`}function nf(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}function ky(n){const i=new Map;return{get(s,l){let u=i.get(s);return u||(u=n.gpu.createShaderModule({label:l,code:s}),i.set(s,u)),u},dispose(){i.clear()}}}function Ly(n){const i=new Map;return{get(s){const l=wE(s);let u=i.get(l);return u||(u=n.gpu.createPipelineLayout({bindGroupLayouts:EE(s)}),i.set(l,u)),u},dispose(){i.clear()}}}function jy(n,i={}){return new bE(n,i)}class bE{device;#e=new Map;#t=new Set;#n;#i;#a=!1;constructor(i,s){this.device=i,this.#n=s.errorSink??(()=>{}),this.#i=s.registerSettledSource?.(()=>[...this.#t])}getReady(i){return this.#e.get(i)?.pipeline}getSync(i,s,l){this.#u(l.where);const u=this.#e.get(i);if(u?.pipeline)return u.pipeline;const c=u??{};u||this.#e.set(i,c);const d=this.#s(i,c,s,l);if(!d){c.pending||this.#e.delete(i);return}return c.pipeline=d,c.pending?.resolve(d),c.pending=void 0,d}getAsync(i,s,l){this.#u(l.where);const u=this.#e.get(i);if(u?.pipeline)return Promise.resolve(u.pipeline);if(u?.pending)return u.pending.promise;const c={},d=xE();c.pending=d,this.#e.set(i,c);let h;try{h=s()}catch(m){const g=tr(l.where,m,l.signature);return d.reject(g),this.#e.delete(i),d.promise}return this.#o(h),h.then(m=>{this.#e.get(i)!==c||c.pipeline||c.pending!==d||(c.pipeline=m,c.pending=void 0,d.resolve(m))},m=>{this.#e.get(i)!==c||c.pipeline||c.pending!==d||(c.pending=void 0,this.#e.delete(i),d.reject(tr(l.where,m,l.signature)))}),d.promise}dispose(){if(this.#a)return;this.#a=!0;const i=yg("gpu.dispose");for(const s of this.#e.values())s.pending?.reject(i);this.#e.clear(),this.#t.clear(),this.#i?.()}#s(i,s,l,u){const c=this.device.gpu,d=typeof c.pushErrorScope=="function"&&typeof c.popErrorScope=="function";d&&c.pushErrorScope("validation");try{const h=l();return d&&this.#l(i,s,u),h}catch(h){d&&this.#c();const m=tr(u.where,h,u.signature);this.#n(m);return}}#l(i,s,l){const u=this.device.gpu.popErrorScope().then(c=>{if(!c)return;const d=tr(l.where,c,l.signature);return this.#e.get(i)===s&&this.#e.delete(i),this.#n(d)},c=>{const d=tr(l.where,c,l.signature);return this.#e.get(i)===s&&this.#e.delete(i),this.#n(d)});this.#o(u)}#c(){const i=this.device.gpu.popErrorScope?.();i&&i.catch(()=>{})}#u(i){if(this.#a)throw yg(i)}#o(i){this.#t.add(i),i.catch(()=>{}).then(()=>this.#t.delete(i),()=>this.#t.delete(i))}}function xE(){let n,i;const s=new Promise((l,u)=>{n=l,i=u});return s.catch(()=>{}),{promise:s,resolve:n,reject:i}}function jg(n,i,s){let l=n.get(i);return l||(l=s(),n.set(i,l)),l}function SE(n){return JSON.stringify(n.map(i=>({arrayStride:i.arrayStride,stepMode:i.stepMode??"vertex",attributes:[...i.attributes].map(s=>({shaderLocation:s.shaderLocation,offset:s.offset,format:s.format}))})))}function wE(n){return JSON.stringify([...n.entries()].map(([i,s])=>({group:i,entries:AE(s)})))}function EE(n){const i=Math.max(-1,...n.keys()),s=[];for(let l=0;l<=i;l++)s.push(TE(n,l));return s}function TE(n,i){const s=n.get(i);if(!s)throw hS(i);return s}function AE(n){return(rr(n)?.entries??[]).map(i=>({binding:i.binding,visibility:i.visibility,buffer:i.buffer?{...i.buffer}:void 0,sampler:i.sampler?{...i.sampler}:void 0,texture:i.texture?{...i.texture}:void 0,storageTexture:i.storageTexture?{...i.storageTexture}:void 0,externalTexture:i.externalTexture?{...i.externalTexture}:void 0}))}const ME=uu("frame-state");function By(n){return n.service(ME,DE)}function DE(){const n=new Set;let i=Bg(),s=!1,l=!1;const u={time:0,deltaTime:0,frameCount:0,advanceBy(c){u.deltaTime=c,u.time+=c,l=!0},tick(){if(s)throw J0();s=!0;try{const c=Bg();l?l=!1:(u.deltaTime=Math.max(0,(c-i)/1e3),u.time+=u.deltaTime),i=c,u.frameCount+=1;for(const d of[...n])d()}finally{s=!1}},onAdvance(c){return n.add(c),()=>{n.delete(c)}}};return u}function Bg(){return globalThis.performance?.now?.()??Date.now()}function RE(n,i,s={}){const l=Wn(n,"surface"),u=OE(l),c=u.get(i);if(c&&!c.disposed)throw gS(c.label);const d=new $y(l.device,i,s,g=>{u.get(g.canvas)===g&&u.delete(g.canvas),h(),m()}),h=By(l).onAdvance(()=>d.applyAutoResize()),m=l.own("resource",()=>d.dispose());return u.set(i,d),d}const CE=uu("surfaces");function OE(n){return n.service(CE,()=>new Map)}let ar=0,Rf=0;function zE(){return ar>0}function _E(){return Rf>0}function UE(){Rf+=1}function NE(){Rf-=1}function Gy(n){return n instanceof $y}class $y{device;canvas;options;unregister;resourceIdentity=ru("render-target");label;context;autoResize;layoutBacked;format;#e=new lu;#t=new Set;#n=new Set;#i;#a;#s=!1;#l=!1;constructor(i,s,l,u){this.device=i,this.canvas=s,this.options=l,this.unregister=u,this.label=l.label,this.#a=l.clearColor===void 0?Mf:iu(l.clearColor,"surface.clearColor");const c=s.getContext("webgpu");if(!c)throw mS();if(this.context=c,this.layoutBacked=kE(s),l.autoResize===!0&&!this.layoutBacked)throw vS();this.autoResize=l.autoResize??(l.size?!1:this.layoutBacked),this.#i=$g(l.dpr),this.format=l.format??jE();const d=LE(s,l,this.layoutBacked,this.#i);(l.size||this.layoutBacked)&&Gg(s,d),c.configure({device:i.gpu,format:this.format,alphaMode:l.alphaMode??"premultiplied",colorSpace:l.colorSpace??"srgb",usage:BE()})}get gpu(){return this.context}get size(){return this.#r(),Ql(this.canvas)}get texelSize(){const i=this.size;return[1/i[0],1/i[1]]}get color(){return this.#r(),new as(this.device,this.context.getCurrentTexture(),{size:this.size,format:this.format,usage:["render_attachment","texture_binding","copy_src"],label:this.options.label?`${this.options.label}.color`:"surface.color"},"external")}get colors(){return[this.color]}get depth(){this.#r()}get sampleCount(){return this.#r(),1}get dpr(){return this.#i}get clearColor(){return Df(this.#a)}set clearColor(i){this.#a=iu(i,"surface.clearColor")}get disposed(){return this.#s}resize(i){if(this.#r(),this.#l)throw bS(this.options.label);this.#c(au(i),this.#i,!0)}applyAutoResize(){if(this.#s||!this.autoResize||!this.layoutBacked)return;const i=$g(this.options.dpr),s=Vy(this.canvas,i);this.#c(s,i,!0)}onResize(i){this.#r(),this.#t.add(i),this.#l=!0,ar+=1;try{i(this.#f())}finally{ar-=1,this.#l=!1}return()=>{this.#t.delete(i)}}async read(){return this.#r(),this.color.read()}async readFloats(){return this.#r(),this.color.readFloats()}onDestroy(i){return this.#r(),this.#e.onDestroy(this,i)}onTexturesRecreated(i){return this.#r(),this.#n.add(i),()=>{this.#n.delete(i)}}renderPassDescriptor(i={}){const{clear:s=[0,0,0,1],preserve:l}=i;this.#r();const u={view:this.context.getCurrentTexture().createView(),loadOp:l?"load":"clear",storeOp:"store"};return l||(u.clearValue=_y(s)),{colorAttachments:[u]}}dispose(){if(!this.#s){this.#s=!0;try{this.context.unconfigure?.()}catch{}this.unregister(this),this.#t.clear(),this.#n.clear(),this.#e.emit(this)}}#c(i,s,l){const u=!Uy(Ql(this.canvas),i);this.#i=s,u&&(Gg(this.canvas,i),this.#u(),l&&this.#o())}#u(){for(const i of[...this.#n])i()}#o(){this.#l=!0,ar+=1;try{const i=this.#f();for(const s of[...this.#t])s(i)}finally{ar-=1,this.#l=!1}}#f(){const i=Ql(this.canvas);return{width:i[0],height:i[1],dpr:this.#i,surface:this}}#r(){if(this.#s)throw yS(this.options.label)}}function kE(n){return typeof n.clientWidth=="number"}function LE(n,i,s,l){return i.size?au(i.size):s?Vy(n,l):au(Ql(n))}function Vy(n,i){const s=n;return au([Math.round(s.clientWidth*i),Math.round(s.clientHeight*i)])}function Ql(n){const i=n;return[i.width,i.height]}function Gg(n,i){const s=n;s.width=i[0],s.height=i[1]}function au(n){return[Math.max(1,Math.floor(n[0])),Math.max(1,Math.floor(n[1]))]}function $g(n){const i=globalThis.devicePixelRatio??1;return Array.isArray(n)?Math.min(n[1],Math.max(n[0],i)):typeof n=="number"?n:i}function jE(){return globalThis.navigator?.gpu?.getPreferredCanvasFormat?.()??"bgra8unorm"}function BE(){const n=globalThis.GPUTextureUsage;return n?n.RENDER_ATTACHMENT|n.TEXTURE_BINDING|n.COPY_SRC:void 0}const GE={drawIndirect:{bytes:16,args:"4 u32 values: vertexCount, instanceCount, firstVertex, firstInstance"},drawIndexedIndirect:{bytes:20,args:"5 32-bit values: indexCount, instanceCount, firstIndex, baseVertex (signed), firstInstance"},dispatchWorkgroupsIndirect:{bytes:12,args:"3 u32 values: workgroupCountX, workgroupCountY, workgroupCountZ"}};function $E(n,i,s,l){const u=typeof s=="object"&&s!==null?s.buffer:void 0,c=Vg(s)?s:Vg(u)?u:void 0;if(!c)throw Ka(n,`received ${Ig(s)}; expected a StorageBuffer or { buffer, offset? }.`,i);const d=c===s?0:s.offset??0;if(typeof d!="number"||!Number.isInteger(d)||d<0)throw Ka(n,`offset must be an integer >= 0; received ${Ig(d)}.`,i);if(d%4!==0)throw Ka(n,`offset must be a multiple of 4 (WebGPU requires "indirectOffset is a multiple of 4"); received ${d}.`,i);if(!c.buffer.options.usage.includes("indirect"))throw Ka(n,`the buffer lacks the "indirect" usage (WebGPU requires "indirectBuffer.usage contains INDIRECT"); create it with storage(gpu, ${c.size}, { indirect: true }).`,i);const{bytes:h,args:m}=GE[l];if(d+h>c.size)throw Ka(n,`${l} reads ${h} bytes (${m}) at offset ${d}, but offset + ${h} = ${d+h} exceeds the buffer size ${c.size}.`,i);return{buffer:c.gpu,offset:d}}function Vg(n){return typeof n=="object"&&n!==null&&"gpu"in n&&"size"in n&&n.buffer instanceof Ri}function Ig(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}const su=Symbol("vgpu.frame.drawable");function VE(n){return n?.[su]}const IE=Symbol("vgpu.frame.bundle");function FE(n){return n?.[IE]}const Cf=Symbol("vgpu.frame.passAttachment");function HE(n){return typeof n?.[Cf]=="function"?n:void 0}function qE(n,i){return Of(Wn(n,"sampler")).sampler(i)}let Fg=1;function YE(n){const i=new Map,s=new WeakMap;return{sampler(l={}){const u=af(l);let c=i.get(u);return c||(c=n.gpu.createSampler(l),i.set(u,c),s.set(c,{kind:"sampler",id:Fg++})),c},identity(l){let u=s.get(l);return u||(u={kind:"sampler",id:Fg++},s.set(l,u)),u}}}function af(n){if(n===null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return`[${n.map(af).join(",")}]`;const i=n;return`{${Object.keys(i).sort().map(s=>`${JSON.stringify(s)}:${af(i[s])}`).join(",")}}`}const XE=uu("render-service");function Of(n){return n.service(XE,KE)}function KE(n){const i=n.device,s=vy(),l=jy(i,{errorSink:h=>n.reportError(h),registerSettledSource:h=>n.registerSettledSource(h)}),u=ky(i),c=Ly(i),d=YE(i);return n.own("service",()=>{l.dispose(),u.dispose(),c.dispose(),s.dispose()}),{binds:s,pipelines:l,shaderModules:u,pipelineLayouts:c,sampler:h=>d.sampler(h)}}function Iy(n){if(typeof n=="string")return n;if(!QE(n)||!("version"in n)||n.version!==1)throw Ll(n);const s=n.wgsl;if(typeof s!="string")throw Ll(n);return s}function QE(n){return typeof n=="object"&&n!==null}function Bl(n,i){const s=Wn(n,"draw"),l=Of(s),u=Iy(i.shader);return new Hy(s.device,u,{...i,shader:u},l.binds,void 0,l.pipelines,l.shaderModules,l.pipelineLayouts,c=>s.reportError(c),c=>{s.trackDelivery(c)})}let PE=1;const Fy=new WeakMap;class Hy{source;label;#e=new Map;constructor(i,s,l,u=vy(),c,d=jy(i),h=ky(i),m=Ly(i),g,x){this.source=s,pt(i,"Draw.constructor"),this.label=l.label??"draw";const b=PE++,D=yy(s,`${this.label}.wgsl`),V=sT(this.label,l.entry),L=Ng(this.label,D.entryPoints,"vertex",V.vertex,"draw"),z=Ng(this.label,D.entryPoints,"fragment",V.fragment,"draw"),k=rT(D,L,z),K=[L,z].filter(ae=>!!ae),B=q2(D.bindings,K);ZE(i,this.label,D.bindings,K,B);const F=l.geometry,H=L?eu(L,"inputs",this.label):[],Z=F&&Zc in F?F[Zc](H,`${this.label}.geometry`):F?.vertexBufferLayouts,de=new Map(Y2(i,this.label,D,B)),M=m.get(de),E=h.get(s,`${this.label}.shader`),G=ET(),W=eT(this.label,l),te=nT(this.label,l,W),le=lT(i,this.label,l),$e=fT(i,this.label,l),he=mT(this.label,l),re=yT(this.label,l),R=gE(this.label,l.constants,D.overrides,"draw"),Y=P2({device:i,label:this.label,drawId:b,reflection:D,bindGroupLayouts:de,cache:u,onIdentityChange:ae=>G.markStale({kind:"binding-identity",drawLabel:this.label,...ae})});Fy.set(this,{id:b,device:i,opts:l,vertexBufferLayouts:Z,cache:u,defaultTarget:c,reflection:D,visibility:B,vertexEntry:L?.name??"vs_main",fragmentEntry:z?.name??"fs_main",entryKey:k,setCore:Y,bindGroupLayouts:de,pipelineLayout:M,shaderModule:E,pipelineStore:d,pipelineLayouts:m,errorSink:g,trackSettled:x,resolvedPipelineKeys:new Set,recordedIn:G,...W,...te,...le,...$e,...he,...re,...R}),l.set&&this.set(l.set);for(const ae of l.targets??[])this.compileSync(ae)}get gpu(){const i=we(this);for(const s of i.resolvedPipelineKeys){const l=i.pipelineStore.getReady(s);if(l)return l}}get targets(){return we(this).opts.targets}get[su](){return this}writesDepth(){return xT(this)}stencilWritingOps(){return ST(this)}set(i){const s=we(this);pt(s.device,`${this.label}.set`);for(const l of s.setCore.set(i))s.recordedIn.markStale({kind:"binding-identity",drawLabel:this.label,...l});return this}group(i,s){const l=we(this);pt(l.device,`${this.label}.group`);const u=this.#e.get(i)??this.layout(i),c=l.setCore.claimGroup(i,s,u);return l.recordedIn.markStale({kind:"group-claim",drawLabel:this.label,group:i,previousIdentity:c,newIdentity:`claimed-group:${i}`}),this}layout(i,s={}){return pt(we(this).device,`${this.label}.layout`),s.dynamicOffsets?this.#t(i):we(this).setCore.layout(i)}#t(i){const s=we(this);s.setCore.layout(i);const l=this.#e.get(i);if(l)return l;const u=AT(this,i),c=Cy(s.device,`${this.label}.group${i}.dynamic.bgl`,u);return this.#e.set(i,c),s.bindGroupLayouts.set(i,c),s.pipelineLayout=s.pipelineLayouts.get(s.bindGroupLayouts),c}draw(i={}){pt(we(this).device,`${this.label}.draw`);const s=cu(i)?{target:i}:i,l=we(this),u=s.target??l.defaultTarget;if(!u)throw Pc(`${this.label}.draw`);i0(u,`${this.label}.draw`);const c=l.device.gpu.createCommandEncoder(),d=c.beginRenderPass(u.renderPassDescriptor()),h=[];try{this.encode(d,u,s,b=>h.push(b))}catch(b){Ht(h),xy(l.device);try{d.end()}catch{}throw b}wy(l.device,d,h,h[0]?.context);let m;const g=h[0]?.context;g&&lr(l.device,g);try{m=c.finish()}catch(b){const D=g?un(l.device):void 0;Ht(h),D&&Ht([D]);const V=D?.context??g;if(V){n0(l,V.label,V.group,b);return}throw b}if(g){const b=un(l.device);b&&(h[0]=h[0]?nu(b,h[0]):b)}const x=h[0]?.context;x&&lr(l.device,x);try{l.device.gpu.queue.submit([m])}catch(b){const D=x?un(l.device):void 0;Ht(h),D&&Ht([D]);const V=D?.context??x;if(V){n0(l,V.label,V.group,b);return}throw b}if(x){const b=un(l.device);b&&(h[0]=h[0]?nu(b,h[0]):b)}if(h.length){const b=Sy(l.device,h,{errorSink:l.errorSink});l.trackSettled?.(b)}}encode(i,s,l={},u){pt(we(this).device,`${this.label}.encode`);const c=this.pipelineFor(s,!0);if(!c)return;i.setPipeline(c);const d=we(this);d.blendConstant&&i.setBlendConstant(d.blendConstant),d.stencilRef!==void 0&&i.setStencilReference(d.stencilRef);for(const h of d.setCore.bindGroups())this.#n(i,h,l,u);this.#l(i,l)}#n(i,s,l,u){const c=TT(l.offsets,s.group,s.offsets);if(!s.claimValidation||!u){i.setBindGroup(s.group,s.bindGroup,c);return}lr(we(this).device,s.claimValidation);try{i.setBindGroup(s.group,s.bindGroup,c)}catch(h){throw T2(we(this).device),is(s.claimValidation.label,s.claimValidation.group,h)}const d=un(we(this).device);d&&u(d)}compile(i){pt(we(this).device,`${this.label}.compile`);const{key:s,signature:l,signatureKey:u}=this.#i(i,`${this.label}.compile`);return we(this).pipelineStore.getAsync(s,()=>this.#o(l),{where:`${this.label}.compile`,signature:u}).then(()=>(pt(we(this).device,`${this.label}.compile`),we(this).resolvedPipelineKeys.add(s),this))}compileSync(i){pt(we(this).device,`${this.label}.compileSync`);const{key:s,signature:l,signatureKey:u}=this.#i(i,`${this.label}.compileSync`);return we(this).pipelineStore.getSync(s,()=>this.#u(l),{where:`${this.label}.compileSync`,signature:u})&&we(this).resolvedPipelineKeys.add(s),this}pipelineFor(i,s=!1){pt(we(this).device,`${this.label}.pipelineFor`);const{key:l,signature:u,signatureKey:c}=this.#i(i,`${this.label}.pipelineFor`,s),d=we(this).pipelineStore.getSync(l,()=>this.#u(u),{where:`${this.label}.pipelineFor`,signature:c});return d&&we(this).resolvedPipelineKeys.add(l),d}pipelineForAsync(i){pt(we(this).device,`${this.label}.pipelineForAsync`);const{key:s,signature:l,signatureKey:u}=this.#i(i,`${this.label}.pipelineForAsync`);return we(this).pipelineStore.getAsync(s,()=>this.#o(l),{where:`${this.label}.pipelineForAsync`,signature:u}).then(d=>(pt(we(this).device,`${this.label}.pipelineForAsync`),we(this).resolvedPipelineKeys.add(s),d))}#i(i,s,l=!1){const u=this.#a(i,s,l),c=Ny(u);return{signature:u,signatureKey:c,key:this.#s(u)}}#a(i,s,l=!1){const u=we(this),c=i??u.defaultTarget;if(!c)throw Pc(s);l||i0(c,s);const d=hE(c);if(pE(d,s),u.colorStates&&u.colorStates.length!==d.colors.length)throw Qc(this.label,`expected one entry per color attachment; colors has ${u.colorStates.length}, but the target signature has ${d.colors.length}.`,s);if(u.multisampleState?.alphaToCoverageEnabled&&(d.sampleCount??1)<=1)throw Hl(this.label,`alphaToCoverage requires a multisampled target, but the target signature has sampleCount ${d.sampleCount??1}; create the target with msaa: true.`,s);if((u.stencilState||u.stencilRef!==void 0)&&!fr(d.depth))throw ts(this.label,`stencil requires a depth format with a stencil aspect, but the target signature has ${d.depth?`"${d.depth}"`:"no depth"}; create the target with depth: "depth24plus-stencil8".`,s);return d}#s(i){const s=we(this),l=s.opts.geometry;return mE({module:s.shaderModule,pipelineLayout:s.pipelineLayout,vertexBufferLayouts:s.vertexBufferLayouts,signature:i,fragmentKey:s.fragmentKey,topology:l?.topology,stripIndexFormat:qy(l),cullMode:s.cullMode,frontFace:s.frontFace,unclippedDepth:s.unclippedDepth,depthKey:s.depthKey,stencilKey:s.stencilKey,multisampleKey:s.multisampleKey,constantsKey:s.constantsKey,entryKey:s.entryKey})}#l(i,s={}){const l=we(this).opts.geometry;if(l?.vertexBuffers&&l.vertexBuffers.forEach((c,d)=>i.setVertexBuffer(d,c)),s.indirect!==void 0)return this.#c(i,l,s);const u=JE(this.label,l,we(this).opts,s);if(!l?.indexBuffer)return i.draw(u.vertexCount,u.instanceCount,u.firstVertex,u.firstInstance);i.setIndexBuffer(l.indexBuffer,l.indexFormat??"uint32"),i.drawIndexed(u.indexCount,u.instanceCount,u.firstIndex,u.baseVertex,u.firstInstance)}#c(i,s,l){const u=`${this.label}.draw`,c=WE.find(g=>l[g]!==void 0);if(c!==void 0)throw Ka(this.label,`indirect cannot be combined with ${c} in the same call; the GPU reads the draw arguments from the buffer, so the CPU-side value would be ignored.`,u);const d=!!s?.indexBuffer,{buffer:h,offset:m}=$E(this.label,u,l.indirect,d?"drawIndexedIndirect":"drawIndirect");if(!d)return i.drawIndirect(h,m);i.setIndexBuffer(s.indexBuffer,s.indexFormat??"uint32"),i.drawIndexedIndirect(h,m)}#u(i){const s=we(this);return s.device.gpu.createRenderPipeline({label:`${this.label}.pipeline`,layout:s.pipelineLayout,vertex:{module:s.shaderModule,entryPoint:s.vertexEntry,buffers:[...s.vertexBufferLayouts??[]],...s.constants?{constants:s.constants}:{}},fragment:{module:s.shaderModule,entryPoint:s.fragmentEntry,targets:Hg(i,s),...s.constants?{constants:s.constants}:{}},primitive:qg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:Zg(i,s),multisample:e0(i,s)})}#o(i){const s=we(this);return s.device.gpu.createRenderPipelineAsync({label:`${this.label}.pipeline`,layout:s.pipelineLayout,vertex:{module:s.shaderModule,entryPoint:s.vertexEntry,buffers:[...s.vertexBufferLayouts??[]],...s.constants?{constants:s.constants}:{}},fragment:{module:s.shaderModule,entryPoint:s.fragmentEntry,targets:Hg(i,s),...s.constants?{constants:s.constants}:{}},primitive:qg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:Zg(i,s),multisample:e0(i,s)})}}function ZE(n,i,s,l,u){const c=n.limits;for(const[d,h,m]of[["vertex",1,"maxStorageBuffersInVertexStage"],["fragment",2,"maxStorageBuffersInFragmentStage"]]){const g=l.find(D=>D.stage===d);if(!g)continue;const x=s.filter(D=>D.bindingLayout?.kind==="buffer"&&D.bindingLayout.buffer.type!=="uniform"&&u(D)&h),b=c[m]??c.maxStorageBuffersPerShaderStage;if(b!==void 0&&x.length>b)throw Z1(i,d,g.name,x.length,b,x)}}const WE=["vertices","indices","instances","firstVertex","firstIndex","baseVertex","firstInstance"];function Hg(n,i){return n.colors.map((s,l)=>{const u=i.colorStates?.[l],c=u?.blendState??i.blendState,d=u?.writeMask??i.writeMask,h={format:s};return c&&(h.blend=c),d!==void 0&&(h.writeMask=d),h})}function JE(n,i,s,l){Ai(n,"DrawOptions.instances",s.instances),Ai(n,"DrawOptions.vertices",s.vertices),Ai(n,"DrawOptions.firstInstance",s.firstInstance),Ai(n,"DrawCallOptions.instances",l.instances),Ti(n,"DrawCallOptions.vertices",l.vertices),Ti(n,"DrawCallOptions.indices",l.indices),Ti(n,"DrawCallOptions.firstVertex",l.firstVertex),Ti(n,"DrawCallOptions.firstIndex",l.firstIndex),Ti(n,"DrawCallOptions.baseVertex",l.baseVertex),Ai(n,"DrawCallOptions.firstInstance",l.firstInstance),Ai(n,"GeometryLike.vertexCount",i?.vertexCount),Ai(n,"GeometryLike.indexCount",i?.indexCount),Ai(n,"GeometryLike.instanceCount",i?.instanceCount),Ti(n,"GeometryLike.firstVertex",i?.firstVertex),Ti(n,"GeometryLike.firstIndex",i?.firstIndex),Ti(n,"GeometryLike.baseVertex",i?.baseVertex);const u=!!i?.indexBuffer,d=i?.geometry??(i&&Zc in i?i:void 0),h=l.firstVertex??i?.firstVertex??0,m=l.vertices??i?.vertexCount??s.vertices??3,g=l.firstIndex??i?.firstIndex??0,x=l.indices??i?.indexCount??0,b=l.baseVertex??i?.baseVertex??0;if(u)Yg(n,"index",g,x,d?.indexCount);else if(l.indices!==void 0||l.firstIndex!==void 0||l.baseVertex!==void 0)throw pf(`${n}.draw`,"Index range needs an indexed geometry.");return u||Yg(n,"vertex",h,m,d?.vertexCount),{instanceCount:l.instances??s.instances??i?.instanceCount??1,firstInstance:l.firstInstance??s.firstInstance??0,vertexCount:m,firstVertex:h,indexCount:x,firstIndex:g,baseVertex:b}}function qy(n){const i=n?.topology??"triangle-list";return n?.stripIndexFormat??(i.endsWith("strip")?n?.indexFormat:void 0)}function qg(n,i,s,l){const u=n?.topology??"triangle-list",c=qy(n),d=c?{topology:u,stripIndexFormat:c}:{topology:u};return i!==void 0&&(d.cullMode=i),s!==void 0&&(d.frontFace=s),l&&(d.unclippedDepth=!0),d}function Yg(n,i,s,l,u){if(!(u===void 0||s+l<=u))throw pf(`${n}.draw`,`${i} range [${s}, ${s+l}) exceeds parent geometry ${i} count ${u}.`)}function Ti(n,i,s){if(!(s===void 0||Number.isInteger(s)&&s>=0))throw pf(`${n}.draw`,`${i} must be an integer >= 0; received ${String(s)}.`)}function Ai(n,i,s){if(s!==void 0&&!(Number.isInteger(s)&&s>=0))throw new ie({code:"VGPU-R1-DRAW-COUNT",message:`${i} of '${n}' must be an integer >= 0; received ${String(s)}. Use 0 only when you want to issue a valid draw with no vertices/instances.`,where:`${n}.draw`})}function eT(n,i){const s=i.blend===void 0?void 0:Yy(n,i.blend),l=i.writeMask===void 0?void 0:Qy(n,i.writeMask),u=i.colors===void 0?void 0:tT(n,i.colors),c=u?`${t0(s,l)}@${u.map(bT).join("@")}`:s||l!==void 0?t0(s,l):void 0;return{blendState:s,writeMask:l,colorStates:u,fragmentKey:c}}function tT(n,i){if(!Array.isArray(i))throw Qc(n,`colors must be an array; received ${Pe(i)}.`);return i.map((s,l)=>{if(s==null)return null;if(typeof s!="object"||Array.isArray(s))throw Qc(n,`colors[${l}] must be null or { blend?, writeMask? }; received ${Pe(s)}.`);const u=s.blend===void 0?void 0:Yy(`${n}.colors[${l}]`,s.blend),c=s.writeMask===void 0?void 0:Qy(`${n}.colors[${l}]`,s.writeMask);return!u&&c===void 0?null:{blendState:u,writeMask:c}})}function Yy(n,i){if(i==="alpha")return Gl({src:"src-alpha",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="premultiplied")return Gl({src:"one",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="additive")return Gl({src:"one",dst:"one"},{src:"one",dst:"one"});if(typeof i!="object"||i===null||!Xg(i.color))throw fg(n,i);const s=i.color,l=i.alpha;if(l!==void 0&&!Xg(l))throw fg(n,i);return Gl(s,l??s)}function Xg(n){return typeof n=="object"&&n!==null&&typeof n.src=="string"&&typeof n.dst=="string"}function Gl(n,i){return{color:Kg(n),alpha:Kg(i)}}function Kg(n){return{srcFactor:n.src,dstFactor:n.dst,operation:n.op??"add"}}function nT(n,i,s){if(i.blendConstant===void 0)return{};const l=i.blendConstant;if(!Array.isArray(l)||l.length!==4||l.some(u=>typeof u!="number"||!Number.isFinite(u)))throw dg(n,`received ${Pe(l)}; expected [r, g, b, a] finite numbers.`);if(!iT(s).some(u=>u&&aT(u)))throw dg(n,`no color target's effective blend uses a "constant"/"one-minus-constant" factor (colors[i].blend replaces the top-level blend for that target), so blendConstant would have no effect.`);return{blendConstant:{r:l[0],g:l[1],b:l[2],a:l[3]}}}function iT(n){return n.colorStates?n.colorStates.map(i=>i?.blendState??n.blendState):[n.blendState]}function aT(n){return[n.color.srcFactor,n.color.dstFactor,n.alpha.srcFactor,n.alpha.dstFactor].some(i=>i==="constant"||i==="one-minus-constant")}function sT(n,i){if(i===void 0)return{};if(typeof i!="object"||i===null||Array.isArray(i))throw ql(n,`received ${Pe(i)}; expected { vertex?, fragment? } entry point names.`);return i}function rT(n,i,s){const l=n.entryPoints.find(c=>c.stage==="vertex"),u=n.entryPoints.find(c=>c.stage==="fragment");if(!(i===l&&s===u))return`en~${i?.name??""}~${s?.name??""}`}function lT(n,i,s){const l=s.cull===void 0?void 0:oT(i,s.cull),u=s.frontFace===void 0?void 0:cT(i,s.frontFace),c=s.unclippedDepth===void 0?void 0:uT(n,i,s.unclippedDepth);return{cullMode:l,frontFace:u,unclippedDepth:c}}function uT(n,i,s){if(typeof s!="boolean")throw pg(i,`received ${Pe(s)}; expected a boolean.`);if(s){if(!n.features.has("depth-clip-control"))throw pg(i,'the device lacks the "depth-clip-control" feature; request it at init: init({ requiredFeatures: ["depth-clip-control"] }) on an adapter that supports it.');return!0}}function oT(n,i){if(i==="none"||i==="front"||i==="back")return i;throw nS(n,i)}function cT(n,i){if(i==="ccw"||i==="cw")return i;throw iS(n,i)}const Xy={depthWriteEnabled:!0,depthCompare:"less-equal"},Ky=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],Qg=-2147483648,Pg=2147483647;function Zg(n,i){if(n.depth)return{format:n.depth,...i.depthState??Xy,...i.stencilState??{}}}function fT(n,i,s){if(s.depth===void 0)return{};const l=dT(n,i,s.depth,s.geometry?.topology??"triangle-list");return{depthState:l,depthKey:hT(l)}}function dT(n,i,s,l){if(s===!1)return{depthWriteEnabled:!1,depthCompare:"always"};if(typeof s!="object"||s===null)throw Xn(i,`received ${Pe(s)}.`);if(s.write!==void 0&&typeof s.write!="boolean")throw Xn(i,`write must be a boolean; received ${Pe(s.write)}.`);if(s.compare!==void 0&&!Ky.includes(s.compare))throw Xn(i,`compare must be a GPUCompareFunction; received ${Pe(s.compare)}.`);if(s.bias!==void 0&&!Number.isInteger(s.bias))throw Xn(i,`bias must be an integer (WebGPU depthBias is i32); received ${Pe(s.bias)}.`);if(s.bias!==void 0&&(s.bias<Qg||s.bias>Pg))throw Xn(i,`bias must fit in the i32 range [${Qg}, ${Pg}] (WebGPU depthBias is i32); received ${Pe(s.bias)}.`);if(s.biasSlopeScale!==void 0&&!Number.isFinite(s.biasSlopeScale))throw Xn(i,`biasSlopeScale must be a finite number; received ${Pe(s.biasSlopeScale)}.`);if(s.biasClamp!==void 0&&!Number.isFinite(s.biasClamp))throw Xn(i,`biasClamp must be a finite number; received ${Pe(s.biasClamp)}.`);const u=s.bias??0,c=s.biasSlopeScale??0,d=s.biasClamp??0;if((u!==0||c!==0||d!==0)&&!l.startsWith("triangle"))throw Xn(i,`bias, biasSlopeScale, and biasClamp must be 0 for "${l}" topology.`);if(d!==0&&n.isCompatibilityMode)throw Xn(i,`biasClamp must be 0 on a compatibility-mode device; received ${Pe(s.biasClamp)}.`);return{depthWriteEnabled:s.write??!0,depthCompare:s.compare??"less-equal",...u!==0?{depthBias:u}:{},...c!==0?{depthBiasSlopeScale:c}:{},...d!==0?{depthBiasClamp:d}:{}}}function hT(n){return`${n.depthWriteEnabled?1:0}~${n.depthCompare}~${n.depthBias??0}~${n.depthBiasSlopeScale??0}~${n.depthBiasClamp??0}`}const pT=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"];function mT(n,i){if(i.stencil===void 0)return{};const s=i.stencil;if(typeof s!="object"||s===null||Array.isArray(s))throw ts(n,`received ${Pe(s)}; expected { front?, back?, readMask?, writeMask?, ref? }.`);const l=s.front===void 0?void 0:Wg(n,"front",s.front),u=s.back===void 0?void 0:Wg(n,"back",s.back);Lc(n,"readMask",s.readMask),Lc(n,"writeMask",s.writeMask),Lc(n,"ref",s.ref);const c={...l?{stencilFront:l}:{},...u??l?{stencilBack:u??{...l}}:{},...s.readMask!==void 0?{stencilReadMask:s.readMask}:{},...s.writeMask!==void 0?{stencilWriteMask:s.writeMask}:{}},d=c.stencilFront!==void 0||c.stencilBack!==void 0||c.stencilReadMask!==void 0||c.stencilWriteMask!==void 0;return!d&&s.ref===void 0?{}:{...d?{stencilState:c,stencilKey:gT(c)}:{},...s.ref!==void 0?{stencilRef:s.ref}:{}}}function Wg(n,i,s){if(typeof s!="object"||s===null||Array.isArray(s))throw ts(n,`${i} must be a { compare?, fail?, depthFail?, pass? } object; received ${Pe(s)}.`);if(s.compare!==void 0&&!Ky.includes(s.compare))throw ts(n,`${i}.compare must be a GPUCompareFunction; received ${Pe(s.compare)}.`);for(const[l,u]of[["fail",s.fail],["depthFail",s.depthFail],["pass",s.pass]])if(u!==void 0&&!pT.includes(u))throw ts(n,`${i}.${l} must be a GPUStencilOperation; received ${Pe(u)}.`);return{compare:s.compare??"always",failOp:s.fail??"keep",depthFailOp:s.depthFail??"keep",passOp:s.pass??"keep"}}function Lc(n,i,s){if(s!==void 0&&(typeof s!="number"||!Number.isInteger(s)||s<0||s>4294967295))throw ts(n,`${i} must be an integer in [0, 0xFFFFFFFF] (WebGPU GPUStencilValue is u32); received ${Pe(s)}.`)}function gT(n){return`st~${Jg(n.stencilFront)}~${Jg(n.stencilBack)}~${n.stencilReadMask??4294967295}~${n.stencilWriteMask??4294967295}`}function Jg(n){return n?`${n.compare},${n.failOp},${n.depthFailOp},${n.passOp}`:"default"}function e0(n,i){return{count:n.sampleCount??1,...i.multisampleState??{}}}function yT(n,i){if(i.multisample===void 0)return{};const s=i.multisample;if(typeof s!="object"||s===null||Array.isArray(s))throw Hl(n,`received ${Pe(s)}; expected { alphaToCoverage?, mask? }.`);if(s.alphaToCoverage!==void 0&&typeof s.alphaToCoverage!="boolean")throw Hl(n,`alphaToCoverage must be a boolean; received ${Pe(s.alphaToCoverage)}.`);if(s.mask!==void 0&&(typeof s.mask!="number"||!Number.isInteger(s.mask)||s.mask<0||s.mask>4294967295))throw Hl(n,`mask must be an integer in [0, 0xFFFFFFFF] (WebGPU GPUSampleMask is u32); received ${Pe(s.mask)}.`);const l={...s.alphaToCoverage!==void 0?{alphaToCoverageEnabled:s.alphaToCoverage}:{},...s.mask!==void 0?{mask:s.mask}:{}};return l.alphaToCoverageEnabled===void 0&&l.mask===void 0?{}:{multisampleState:l,multisampleKey:vT(l)}}function vT(n){return`ms~${n.alphaToCoverageEnabled?1:0}~${n.mask??4294967295}`}function Qy(n,i){if(!Array.isArray(i))throw hg(n,Pe(i));let s=0;for(const l of i)if(l==="r")s|=1;else if(l==="g")s|=2;else if(l==="b")s|=4;else if(l==="a")s|=8;else throw hg(n,Pe(l));return s}function t0(n,i){return`${Py(n)};${i??15}`}function Py(n){if(!n)return"none;none";const i=n.color,s=n.alpha;return`${i.srcFactor},${i.dstFactor},${i.operation};${s.srcFactor},${s.dstFactor},${s.operation}`}function bT(n){return n?`${n.blendState?Py(n.blendState):"inherit"};${n.writeMask??"inherit"}`:"inherit"}function Pe(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}function xT(n){return(we(n).depthState??Xy).depthWriteEnabled}function ST(n){const i=we(n),s=i.stencilState;if(!s||s.stencilWriteMask===0)return[];const l=i.cullMode??"none",u=[],c=(d,h)=>{if(h)for(const[m,g]of[["fail",h.failOp],["depthFail",h.depthFailOp],["pass",h.passOp]])g!==void 0&&g!=="keep"&&u.push(`${d}.${m}: "${g}"`)};return l!=="front"&&c("front",s.stencilFront),l!=="back"&&c("back",s.stencilBack),u}function wT(n,i,s,l={},u){n.encode(i,s,l,u)}function we(n){const i=Fy.get(n);if(!i)throw new TypeError("Invalid Draw instance");return i}function n0(n,i,s,l){const u=(async()=>{await bf(n.device),pt(n.device,`${i}.validation`);const c=is(i,s,l);n.errorSink?await n.errorSink(c):console.error(c)})();return n.trackSettled?.(u),u}function ET(){const n=new Set;return{add(i){n.add(i)},delete(i){n.delete(i)},list(){return[...n]},markStale(i){for(const s of n)s.markStale(i)}}}function TT(n,i,s){return n?Array.isArray(n)?n:n[i]??s:s}function AT(n,i){const s=we(n);return Ry(s.reflection.bindings,i,s.visibility).map(MT)}function MT(n){return n.buffer?{...n,buffer:{...n.buffer,hasDynamicOffset:!0}}:n}function i0(n,i){if(Gy(n)&&!_E())throw W0(i)}function a0(n,i,s={}){if("geometry"in s)throw qt("effect","effect() never accepts vertex buffers; use draw(gpu, { shader, geometry: geometry(gpu, descriptor) }).");const l=Wn(n,"effect"),u=Of(l);return new DT(l.device,Iy(i),s,u.binds,void 0,u.pipelines,u.shaderModules,u.pipelineLayouts,c=>l.reportError(c),c=>{l.trackDelivery(c)})}const Zy=new WeakMap;class DT{get gpu(){return Wi(this).gpu}constructor(i,s,l={},u,c,d,h,m,g,x){const b=RT(s),D=new Hy(i,b,{shader:b,set:l.set,label:l.label??"effect",blend:l.blend,writeMask:l.writeMask},u,c,d,h,m,g,x);Zy.set(this,D)}set(i){return Wi(this).set(i),this}draw(i={}){Wi(this).draw(cu(i)?{target:i}:i)}compile(i){return Wi(this).compile(i).then(()=>this)}compileSync(i){return Wi(this).compileSync(i),this}encode(i,s,l={},u){wT(Wi(this),i,s,l,u)}get[su](){return Wi(this)[su]}}function Wi(n){const i=Zy.get(n);if(!i)throw new TypeError("Invalid Effect instance");return i}function RT(n){return CT(n)?n:`
|
|
13
|
+
struct VgpuFullscreenVertexOut {
|
|
14
|
+
@builtin(position) position: vec4f,
|
|
15
|
+
@location(0) uv: vec2f,
|
|
16
|
+
};
|
|
17
|
+
@vertex fn vgpu_fullscreen_vs(@builtin(vertex_index) vi: u32) -> VgpuFullscreenVertexOut {
|
|
18
|
+
var pos = array<vec2f, 3>(vec2f(-1.0, -1.0), vec2f(3.0, -1.0), vec2f(-1.0, 3.0));
|
|
19
|
+
var uv = array<vec2f, 3>(vec2f(0.0, 1.0), vec2f(2.0, 1.0), vec2f(0.0, -1.0));
|
|
20
|
+
var out: VgpuFullscreenVertexOut;
|
|
21
|
+
out.position = vec4f(pos[vi], 0.0, 1.0);
|
|
22
|
+
out.uv = uv[vi];
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
${n}`}function CT(n){return yy(n,"effect.wgsl").entryPoints.some(i=>i.stage==="vertex")}function OT(n,i){return _T(Wn(n,"frame")).frame(i)}const zT=uu("frame-runner");function _T(n){return n.service(zT,i=>{const s=By(i);return new FT(()=>{let l=()=>{};const u=new UT(i.device,void 0,c=>i.reportError(c),c=>{i.trackDelivery(c)},()=>l());return l=i.own("scheduler",()=>u.cancel()),u},()=>s.tick(),l=>i.own("scheduler",()=>l.stop()))})}class UT{device;defaultTarget;errorSink;trackSettled;releaseLifecycle;done=Promise.resolve();#e;#t=[];#n=new Set;#i=new Set;#a=!1;#s=!1;#l=!1;constructor(i,s,l,u,c){this.device=i,this.defaultTarget=s,this.errorSink=l,this.trackSettled=u,this.releaseLifecycle=c,pt(i,"Frame.constructor"),this.#e=i.gpu.createCommandEncoder({label:"vgpu.frame"})}pass(i,s){if(this.#s)throw vg("Frame.pass");pt(this.device,"Frame.pass");const l=cu(i),u=typeof s=="function"?s:z=>z.draw(s),c=l?i:i.target??this.defaultTarget;if(!c)throw Pc("Frame.pass");if(Gy(c)&&this.#a)throw W0("Frame.pass");const d=l?void 0:i.clear,h=d===!1;if(h&&c.sampleCount===4)throw aS();const m=l?void 0:i.clearDepth;if(m!==void 0){if(typeof m!="number"||!(m>=0&&m<=1))throw mg(m);if(h)throw sS();if(!c.depth)throw mg(m,"but the target has no depth attachment, so clearDepth would have no effect.","Create the target with depth: true (or a depth format), or drop clearDepth.")}const g=l?void 0:i.clearStencil;if(g!==void 0){if(typeof g!="number"||!Number.isInteger(g)||g<0||g>4294967295)throw gg(`received ${String(g)}; expected an integer in [0, 0xFFFFFFFF] (WebGPU GPUStencilValue).`);if(h)throw rS();const z=c.depth?.format;if(!fr(z))throw gg(`received ${String(g)}, but the target's depth format ${z?`"${z}"`:"(none)"} has no stencil aspect, so clearStencil would have no effect.`)}const x=l?void 0:i.depthReadOnly;if(x!==void 0&&typeof x!="boolean")throw na(`received ${Ci(x)}; expected a boolean.`,"Pass depthReadOnly: true to open the pass with a read-only depth attachment, or omit it.");if(x){if(!c.depth)throw na("is set, but the target has no depth attachment, so there is nothing to make read-only.","Create the target with depth: true (or a depth format), or drop depthReadOnly.");if(c.sampleCount===4)throw lS();if(m!==void 0)throw na("cannot be combined with clearDepth; a read-only depth aspect omits its load/store ops and is never cleared.","Remove clearDepth, or drop depthReadOnly.");if(g!==void 0)throw na("cannot be combined with clearStencil; a read-only stencil aspect omits its load/store ops and is never cleared.","Remove clearStencil, or drop depthReadOnly.")}const b=l?void 0:$T(i.viewport,this.device.gpu.limits,c.size),D=l?void 0:VT(i.scissor,c.size),V=[];let L;try{const z=l||i.timer===void 0?void 0:this.#r(i.timer,c,V,BT),K=(l||i.visibility===void 0?void 0:this.#r(i.visibility,c,V,GT))?.occlusion;let B=c.renderPassDescriptor({clear:d===void 0||d===!0||d===!1?c.clearColor??Mf:d,preserve:h,clearDepth:m,clearStencil:g,depthReadOnly:x});z?.timestampWrites&&(B={...B,timestampWrites:z.timestampWrites}),K&&(B={...B,occlusionQuerySet:K.querySet}),L=this.#e.beginRenderPass(B),b&&L.setViewport(b.x,b.y,b.width,b.height,b.minDepth,b.maxDepth),D&&L.setScissorRect(D[0],D[1],D[2],D[3]),this.#l=!0;try{u(new NT(L,c,this.#t,x===!0,K,this,F=>{if(pt(this.device,F),this.#s)throw vg(F)}))}finally{this.#l=!1}}catch(z){this.#o(V),Ht(this.#t),this.#t.length=0,xy(this.device);try{L?.end()}catch{}throw z}wy(this.device,L,this.#t)}submit(){if(this.#a||this.#s)return;pt(this.device,"Frame.submit"),this.#a=!0,this.releaseLifecycle?.();for(const u of this.#f())u.finalizeFrame(this,this.#e);let i;const s=this.#t[0]?.context;s&&lr(this.device,s);try{i=this.#e.finish()}catch(u){this.#c(this.#u());const c=s?un(this.device):void 0;Ht(this.#t),c&&Ht([c]);const d=c?.context??s;if(!d)throw u;this.done=this.#h(this.#d(d.label,d.group,u));return}if(s){const u=un(this.device);u&&(this.#t[0]=this.#t[0]?nu(u,this.#t[0]):u)}const l=this.#t[0]?.context;l&&lr(this.device,l);try{this.device.gpu.queue.submit([i])}catch(u){this.#c(this.#u());const c=l?un(this.device):void 0;Ht(this.#t),c&&Ht([c]);const d=c?.context??l;if(!d)throw u;this.done=this.#h(this.#d(d.label,d.group,u));return}if(l){const u=un(this.device);u&&(this.#t[0]=this.#t[0]?nu(u,this.#t[0]):u)}for(const u of this.#f())u.frameSubmitted(this);this.#c(this.#i),this.done=this.#h(Sy(this.device,this.#t,{errorSink:this.errorSink}))}cancel(){if(!this.#s){if(this.#a)throw ES("Frame.cancel");if(this.#l)throw wS("Frame.cancel");this.#s=!0,this.releaseLifecycle?.(),this.#c(this.#u()),this.#n.clear(),this.#i.clear(),Ht(this.#t),this.#t.length=0}}#c(i){for(const s of[...i])s.frameAbandoned(this)}#u(){return[...this.#n,...this.#i]}#o(i){for(const s of[...i])this.#n.delete(s),this.#i.add(s)}#f(){return[...this.#n].filter(i=>!this.#i.has(i))}#r(i,s,l,u){const c=HE(i);if(!c)throw u(i);let d;try{d=c[Cf]({frame:this,device:this.device,target:s})}catch(h){throw this.#o(this.#n),h}return this.#n.add(d.owner),l.push(d.owner),d}async#d(i,s,l){await bf(this.device),pt(this.device,"Frame.validation");const u=is(i,s,l);this.errorSink?await this.errorSink(u):console.error(u)}#h(i){return this.trackSettled?.(i),i}}class NT{encoder;target;validations;depthReadOnly;occlusionSource;frame;assertFrameOpen;#e=!1;constructor(i,s,l,u=!1,c,d,h){this.encoder=i,this.target=s,this.validations=l,this.depthReadOnly=u,this.occlusionSource=c,this.frame=d,this.assertFrameOpen=h}draw(i,s={}){this.assertFrameOpen?.("FramePass.draw");const l=LT(i);this.depthReadOnly&&kT(l,this.target),l.encode(this.encoder,this.target,s,u=>this.validations.push(u))}occlusion(i,s){if(this.assertFrameOpen?.("FramePass.occlusion"),!this.occlusionSource)throw cS();if(this.#e)throw fS();const l=this.occlusionSource.beginQuery(i,this.frame);this.encoder.beginOcclusionQuery(l),this.#e=!0;try{typeof s=="function"?s():this.draw(s)}finally{this.#e=!1,this.encoder.endOcclusionQuery()}}bundles(...i){if(this.assertFrameOpen?.("FramePass.bundles"),this.depthReadOnly)throw na("pass cannot replay bundles: bundle records bundles with writable depth/stencil, and WebGPU only executes read-only-recorded bundles in a read-only pass.","Encode the draws directly with pass.draw(...) inside the depthReadOnly pass.","FramePass.bundles");const s=i.map(l=>FE(l)??jT());for(const l of s)l.assertReplayable(this.target);this.encoder.executeBundles(s.map(l=>l.gpu))}}function kT(n,i){if(n.writesDepth())throw na(`pass cannot encode draw '${n.label}': its depth state writes depth (the default is write: true). Give the draw depth: { write: false } (or depth: false to disable depth testing).`,"Use depth: { write: false } on the draw, or open the pass without depthReadOnly.","FramePass.draw");if(fr(i.depth?.format)){const s=n.stencilWritingOps();if(s.length)throw na(`pass cannot encode draw '${n.label}': its stencil ops can write (${s.join(", ")}), and the pass's stencil aspect is read-only too.`,'Use "keep" for those ops or stencil writeMask: 0, or open the pass without depthReadOnly.',"FramePass.draw")}}function LT(n){const i=VE(n);if(!i)throw new TypeError("Invalid Effect instance: pass.draw() expects a Draw or an Effect created by this library.");return i}function jT(){throw new ie({code:"VGPU-R3-BUNDLE-INVALID",message:"p.bundles() expected bundles created by bundle(gpu, { target }, cb).",where:"FramePass.bundles"})}function BT(n){return Qa(`FramePassOptions.timer received ${Ci(n)}; expected a TimerSpan from timer.span(name).`,'Create const passTimer = timer(gpu) once, then pass passTimer.span("name") per pass.',"Frame.pass")}function GT(n){return oS(`FramePassOptions.visibility received ${Ci(n)}; expected a Visibility from visibility(gpu).`,"Create const vis = visibility(gpu) once, then pass { target, visibility: vis } per pass.","Frame.pass")}function $T(n,i,s){if(n===void 0)return;if(typeof n!="object"||n===null||Array.isArray(n))throw Kn(`received ${Ci(n)}; expected { x?, y?, width, height, minDepth?, maxDepth? }.`);const{x:l=0,y:u=0,width:c,height:d,minDepth:h=0,maxDepth:m=1}=n;for(const[D,V]of[["x",l],["y",u],["width",c],["height",d],["minDepth",h],["maxDepth",m]])if(typeof V!="number"||!Number.isFinite(V))throw Kn(`${D} received ${Ci(V)}; expected a finite number.`);const g=i.maxTextureDimension2D,x=g*2,b=`target is ${s[0]}x${s[1]}px, device maxTextureDimension2D is ${g}`;if(!(c>=0&&c<=g))throw Kn(`width ${c} is outside [0, ${g}] (${b}).`);if(!(d>=0&&d<=g))throw Kn(`height ${d} is outside [0, ${g}] (${b}).`);if(!(l>=-x&&l+c<=x-1))throw Kn(`x ${l} with width ${c} is outside [${-x}, ${x-1}] (${b}).`);if(!(u>=-x&&u+d<=x-1))throw Kn(`y ${u} with height ${d} is outside [${-x}, ${x-1}] (${b}).`);if(!(h>=0&&h<=1))throw Kn(`minDepth ${h} is outside [0, 1].`);if(!(m>=0&&m<=1))throw Kn(`maxDepth ${m} is outside [0, 1].`);if(!(h<=m))throw Kn(`minDepth ${h} exceeds maxDepth ${m}.`);return{x:l,y:u,width:c,height:d,minDepth:h,maxDepth:m}}function VT(n,i){if(n===void 0)return;if(!Array.isArray(n)||n.length!==4)throw _c(`received ${Ci(n)}; expected [x, y, width, height].`);const[s,l,u,c]=n;for(const[m,g]of[["x",s],["y",l],["width",u],["height",c]])if(typeof g!="number"||!Number.isInteger(g)||g<0)throw _c(`${m} received ${Ci(g)}; expected a non-negative integer.`);const[d,h]=i;if(s+u>d||l+c>h)throw _c(`[${s}, ${l}, ${u}, ${c}] exceeds the target's current size ${d}x${h}px (x + width <= ${d}, y + height <= ${h}).`);return[s,l,u,c]}function Ci(n){return typeof n=="string"?`'${n}'`:Array.isArray(n)?`[${n.map(i=>Ci(i)).join(", ")}]`:typeof n=="object"&&n!==null?"an object":String(n)}function IT(n){const i=n?.code;return i==="VGPU-DEVICE-DISPOSED"||i==="VGPU-DEVICE-LOST"}class FT{createFrame;advance;trackLoop;#e=!1;constructor(i,s,l){this.createFrame=i,this.advance=s,this.trackLoop=l}frame(i){if(this.#e||zE())throw J0();this.#e=!0,UE();try{this.advance();const s=this.createFrame();if(i)try{i(s)}finally{try{s.submit()}catch(l){if(!IT(l))throw l}}return s}finally{NE(),this.#e=!1}}loop(i,s={}){let l=!1;const u=globalThis.requestAnimationFrame??(D=>setTimeout(()=>D(performance.now()),16)),c=globalThis.cancelAnimationFrame??(D=>clearTimeout(D)),d=s.fps&&s.fps>0?1e3/s.fps:0;let h,m=0;const g=D=>{l||(HT(D,h,d)&&(h=D,this.frame(i)),l||(m=u(g)))};m=u(g);let x;const b={stop(){l=!0,c(m),x?.(),x=void 0}};return x=this.trackLoop?.(b),b}}function HT(n,i,s){return i===void 0||s<=0?!0:n-i>=s}function s0(n,i){return new sf(Wn(n,"target").device,i)}class sf{device;options;resourceIdentity=ru("render-target");#e=new lu;#t=new Set;#n;#i;#a;#s;#l;constructor(i,s){this.device=i,this.options=s,sE(s,i),this.#l=s.clearColor===void 0?Mf:iu(s.clearColor,"target.clearColor"),this.#n=s.size,this.#i=this.#f(),this.#a=this.sampleCount===4?this.#r():void 0,this.#s=this.#d()}get gpu(){return this.color.gpu}get size(){return this.#n}get texelSize(){return[1/this.#n[0],1/this.#n[1]]}get color(){return this.#i[0]}get colors(){return this.#i}get depth(){return this.#s}get format(){return Kl(this.options)[0]?.format??"rgba8unorm"}get clearColor(){return Df(this.#l)}set clearColor(i){this.#l=iu(i,"target.clearColor")}get sampleCount(){return zy(this.options)}resize(i){Uy(this.#n,i)||this.#c(i)}async read(){return this.color.read()}async readFloats(){return this.color.readFloats()}onDestroy(i){return this.#e.onDestroy(this,i)}onTexturesRecreated(i){return this.#t.add(i),()=>{this.#t.delete(i)}}destroy(){this.#e.emit(this),this.#t.clear(),this.#o()}renderPassDescriptor(i={}){const{clear:s=[0,0,0,1],preserve:l,clearDepth:u,clearStencil:c,depthReadOnly:d}=i;return{colorAttachments:this.#i.map((h,m)=>lE(h,this.#a?.[m],s,l)),depthStencilAttachment:this.#s?uE(this.#s,l,u,c,d):void 0}}#c(i){this.#o(),this.#n=[i[0],i[1]],this.#i=this.#f(),this.#a=this.sampleCount===4?this.#r():void 0,this.#s=this.#d(),this.#u()}#u(){for(const i of[...this.#t])i()}#o(){for(const i of this.#i)i.destroy();for(const i of this.#a??[])i.destroy();this.#s?.destroy()}#f(){return Kl(this.options).map((i,s)=>this.device.createTexture({size:this.#n,format:i.format,usage:["render_attachment","texture_binding","copy_src"],sampleCount:1,label:this.options.label?`${this.options.label}.color${s}.resolve`:void 0}))}#r(){return Kl(this.options).map((i,s)=>this.device.createTexture({size:this.#n,format:i.format,usage:["render_attachment"],sampleCount:4,label:this.options.label?`${this.options.label}.color${s}`:void 0}))}#d(){const i=Oy(this.options);return i?this.device.createTexture({size:this.#n,format:i,usage:["render_attachment","texture_binding"],sampleCount:this.sampleCount,label:this.options.label?`${this.options.label}.depth`:void 0}):void 0}}function Ya(n,i,s="read-write"){const l=Wn(n,"storage"),u=typeof s=="string"?{access:s}:s,c=qT(l.device,i,u.access??"read-write",void 0,u.indirect??!1);return ny(l,c,d=>d.destroy(),d=>{c.onDestroy(d)})}class zf{size;access;buffer;constructor(i,s){this.buffer=i,this.access=s,this.size=i.options.size}static create(i,s,l,u,c=!1){const d=c?["storage","copy_dst","copy_src","indirect"]:["storage","copy_dst","copy_src"],h=i.createBuffer({size:s,usage:d,label:u});return new zf(h,l)}read(){return this.buffer.read(this.size)}write(i,s=0){this.buffer.write(YT(i),s)}get gpu(){return this.buffer.gpu}get resourceIdentity(){return this.buffer.resourceIdentity}onDestroy(i){return this.buffer.onDestroy(i)}destroy(){this.buffer.destroy()}}function qT(n,i,s,l,u=!1){return zf.create(n,i,s,l,u)}function YT(n){if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n;throw new TypeError("StorageBuffer.write() requires ArrayBuffer or ArrayBufferView.")}function XT(n,i,s,l={}){const u=Wn(n,"pingPong");return QT(u.device,i,s,l,c=>KT(u,c))}function KT(n,i){return ny(n,i,s=>s.destroy(),s=>{i.onDestroy(s)})}function QT(n,i,s,l={},u=PT){const c=[r0(i),r0(s)],d={...l,size:c},h=u(new sf(n,l0(d,l.label,"ping"))),m=u(new sf(n,l0(d,l.label,"pong")));return new ZT([h,m])}function PT(n){return n}class ZT{halves;#e=0;constructor(i){this.halves=i}get read(){return this.halves[this.#e]}get write(){return this.halves[this.#e^1]}swap(){this.#e^=1}}function r0(n){return Math.max(1,Math.floor(n))}function l0(n,i,s){return i?{...n,label:`${i}.${s}`}:n}const jc=8,WT=globalThis.GPUMapMode?.READ??1;function JT(n,i){return new eA(n,i)}class eA{querySet;capacity;#e;#t;#n;#i;#a;#s=0;#l=0;#c=-1;#u;#o=0;#f=0;#r=!1;#d=!1;constructor(i,s){this.capacity=s.capacity;const l=s.label??"vgpu.query-ring";this.#e=l;const u=s.capacity*jc;this.querySet=i.gpu.createQuerySet({type:s.type,count:s.capacity,label:l}),this.#t=i.createBuffer({size:u,usage:["query_resolve","copy_src"],label:`${l}.resolve`}),this.#n=Array.from({length:s.depth??3},(c,d)=>({buffer:i.createBuffer({size:u,usage:["map_read","copy_dst"],label:`${l}.staging${d}`}),mapPending:!1,retired:!1})),this.#i=s.trackSettled,this.#a=s.errorSink}encodeResolve(i,s){if(this.#u=void 0,this.#r||s<=0)return!1;const l=this.#h();if(!l)return!1;const u=Math.min(s,this.capacity);return i.resolveQuerySet(this.querySet,0,u,this.#t.gpu,0),i.copyBufferToBuffer(this.#t.gpu,0,l.buffer.gpu,0,u*jc),this.#u={staging:l,usedCount:u,seq:this.#l},this.#l+=1,this.#s+=1,!0}onSubmitted(i){const s=this.#u;if(this.#u=void 0,!s)return;s.staging.mapPending=!0,this.#o+=1;const l=s.staging.buffer.gpu.mapAsync(WT).then(()=>{const u=this.#m(s);s.seq<=this.#c||(this.#c=s.seq,i(u))}).catch(u=>{this.#y(u)}).finally(()=>{s.staging.mapPending=!1,this.#o-=1,this.#g()});this.#i?.(l)}#h(){for(let i=0;i<this.#n.length;i+=1){const s=this.#n[this.#s%this.#n.length];if(!s.retired)return s.mapPending?void 0:s;this.#s+=1}}#m(i){let s;try{s=new BigUint64Array(i.staging.buffer.gpu.getMappedRange().slice(0,i.usedCount*jc))}catch(l){throw this.#p(i.staging),l}try{i.staging.buffer.gpu.unmap()}catch(l){throw i.staging.retired=!0,l}return s}#p(i){try{i.buffer.gpu.unmap()}catch{i.retired=!0}}retain(){this.#f+=1}release(){this.#f>0&&(this.#f-=1),this.#g()}dispose(){this.#r||(this.#r=!0,this.#u=void 0,this.#g())}#g(){if(!(!this.#r||this.#d||this.#o>0||this.#f>0)){this.#d=!0,this.querySet.destroy(),this.#t.dispose();for(const i of this.#n)i.buffer.dispose()}}#y(i){const s=SS(this.#e,i),l=this.#a;if(!l){console.error(s);return}try{Promise.resolve(l(s)).catch(u=>{console.error(u)})}catch(u){console.error(u)}}}const u0=32,rf=4096,o0=rf/2,tA=1/1e6;class nA{name;owner;constructor(i,s){this.name=i,this.owner=s}[Cf](i){return{owner:this.owner,timestampWrites:this.owner.attachSpan(this,i.frame,i.device)}}}function iA(n){const i=Wn(n,"timer");return LS(i,s=>new aA(i.device,s))}class aA{#e;#t;#n=new Map;#i=new Set;#a;#s=u0*2;#l=u0*2;#c;#u=[];#o=new Set;#f=0;#r;#d=0;#h=-1;#m=new Map;#p=!1;constructor(i,s={}){if(!i.features.has("timestamp-query"))throw Qa('timer(gpu) needs the "timestamp-query" device feature — request it at init: init({ requiredFeatures: ["timestamp-query"] }).','Pass init({ requiredFeatures: ["timestamp-query"] }) on an adapter that supports it; gate optional timing on gpu.device.features.has("timestamp-query").');this.#e=i,this.#t=s,this.#a=this.#x()}span(i){if(this.#v("Timer.span"),typeof i!="string"||i.length===0)throw Qa(`span name received ${rA(i)}; expected a non-empty string.`,'Name each timed pass, e.g. timer.span("shadows").',"Timer.span");let s=this.#n.get(i);return s||(s=new nA(i,this),this.#n.set(i,s)),s}onResults(i){return this.#v("Timer.onResults"),this.#i.add(i),()=>{this.#i.delete(i)}}dispose(){this.#p||(this.#p=!0,this.#i.clear(),this.#n.clear(),this.#o.clear(),this.#u=[],this.#r=void 0,this.#a.dispose(),this.#t.onDispose?.())}attachSpan(i,s,l){if(this.#v("Frame.pass"),l!==this.#e)throw Qa(`span '${i.name}' belongs to a timer created on a different gpu; timestamp queries cannot cross devices.`,"Create one timer(gpu) per gpu and use its spans only with that gpu's frames.","Frame.pass");if(s!==this.#c&&this.#g(s),this.#o.has(i.name))throw Qa(`duplicate span '${i.name}' in one frame; each result key holds a single begin/end pair per frame.`,`Use one timer.span(name) per pass per frame, e.g. timer.span("${i.name}-2") for the second pass.`,"Frame.pass");if(this.#o.size>=o0)throw uS(o0,rf);this.#o.add(i.name);const u=this.#o.size*2-2;if(this.#l<u+2&&(this.#l=u+2),!(u+2>this.#a.capacity))return this.#f=u+2,this.#u.push({name:i.name,begin:u}),this.#S(s),{querySet:this.#a.querySet,beginningOfPassWriteIndex:u,endOfPassWriteIndex:u+1}}finalizeFrame(i,s){this.#r=void 0,!(this.#p||i!==this.#c||this.#f===0)&&this.#a.encodeResolve(s,this.#f)&&(this.#r=[...this.#u])}frameSubmitted(i){if(this.#b(i),i!==this.#c||this.#p)return;const s=this.#r;if(this.#r=void 0,!s||s.length===0)return;const l=this.#d;this.#d+=1,this.#a.onSubmitted(u=>{l<=this.#h||(this.#h=l,this.#y(s,u))})}frameAbandoned(i){i===this.#c&&(this.#r=void 0),this.#b(i)}#g(i){this.#l>this.#a.capacity&&(this.#a.dispose(),this.#s=Math.min(rf,sA(this.#l)),this.#a=this.#x()),this.#l=this.#s,this.#c=i,this.#u=[],this.#o.clear(),this.#f=0}#y(i,s){const l={};for(const{name:c,begin:d}of i){const h=s[d]??0n,m=s[d+1]??0n;l[c]=m>h?Number(m-h)*tA:0}const u=Object.freeze(l);for(const c of[...this.#i])try{c(u)}catch(d){console.error(d)}}#S(i){this.#m.has(i)||(this.#m.set(i,this.#a),this.#a.retain())}#b(i){const s=this.#m.get(i);s&&(this.#m.delete(i),s.release())}#x(){return JT(this.#e,{type:"timestamp",capacity:this.#s,label:"vgpu.timer",trackSettled:this.#t.trackSettled,errorSink:this.#t.errorSink})}#v(i){if(this.#p)throw Qa("the timer is disposed.","Create a new timer with timer(gpu).",i)}}function sA(n){let i=1;for(;i<n;)i*=2;return i}function rA(n){return typeof n=="string"?`'${n}'`:String(n)}function c0(n){return zS("browser",n)}const f0=8,d0=64,h0=8,lf=16,sr={x0:0,y0:0,x1:1160,y1:812},p0=256,pr=`
|
|
26
|
+
struct Params {
|
|
27
|
+
// visible world rect: x0, y0, x1, y1
|
|
28
|
+
rect : vec4f,
|
|
29
|
+
// viewportW, viewportH, scale (px per world unit), time (seconds)
|
|
30
|
+
view : vec4f,
|
|
31
|
+
// massCount, disturbanceCount, couplingCount, dt
|
|
32
|
+
counts : vec4f,
|
|
33
|
+
// rowsScreen, stepScreen, amp, alpha
|
|
34
|
+
layer : vec4f,
|
|
35
|
+
// lineWidth, dz, parallaxX, showResidue
|
|
36
|
+
layer2 : vec4f,
|
|
37
|
+
// columns, rows, laneCount, plinthCount
|
|
38
|
+
grid : vec4f,
|
|
39
|
+
fill : vec4f,
|
|
40
|
+
// padded field rect used by the field texture: x0, y0, x1, y1
|
|
41
|
+
fieldRect : vec4f,
|
|
42
|
+
// fill reach in rows (0 = every fill runs to the viewport bottom), unused, unused, unused
|
|
43
|
+
sheet : vec4f,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Storage rather than uniform: every array below is packed by hand into a Float32Array, and this
|
|
47
|
+
// keeps the whole parameter block on the same footing instead of splitting the packing across two
|
|
48
|
+
// binding conventions.
|
|
49
|
+
@group(0) @binding(0) var<storage, read> P : Params;
|
|
50
|
+
|
|
51
|
+
// masses: 3 vec4 each
|
|
52
|
+
// 0: pos.xy, extent.xy
|
|
53
|
+
// 1: depth, rim, pull, lobe
|
|
54
|
+
// 2: phase, tint.rgb
|
|
55
|
+
@group(0) @binding(1) var<storage, read> massData : array<vec4f>;
|
|
56
|
+
|
|
57
|
+
// disturbances: 3 vec4 each
|
|
58
|
+
// 0: x, y, radius, amplitude
|
|
59
|
+
// 1: frequency, phase, statusIndex, energy
|
|
60
|
+
// 2: articulation, shoulder, unused, unused
|
|
61
|
+
@group(0) @binding(2) var<storage, read> distData : array<vec4f>;
|
|
62
|
+
|
|
63
|
+
// couplings: 1 vec4 each — fromMassIndex, toMassIndex, energy, unused
|
|
64
|
+
@group(0) @binding(3) var<storage, read> coupData : array<vec4f>;
|
|
65
|
+
|
|
66
|
+
// WGSL's pow() is exp2(y * log2(x)) and returns NaN for a negative base. The approved material
|
|
67
|
+
// squares plenty of signed quantities — offsets from a rim, distances either side of a ridge — so
|
|
68
|
+
// every one of those must be a multiplication, not a pow. A single NaN propagates through the
|
|
69
|
+
// baked field texture and blanks the entire sheet.
|
|
70
|
+
fn sq(x: f32) -> f32 { return x * x; }
|
|
71
|
+
fn quad(x: f32) -> f32 { let s = x * x; return s * s; }
|
|
72
|
+
|
|
73
|
+
fn massPos(i: u32) -> vec2f { return massData[i * 3u].xy; }
|
|
74
|
+
fn massExtent(i: u32) -> vec2f { return massData[i * 3u].zw; }
|
|
75
|
+
fn massShape(i: u32) -> vec4f { return massData[i * 3u + 1u]; }
|
|
76
|
+
fn massPhase(i: u32) -> f32 { return massData[i * 3u + 2u].x; }
|
|
77
|
+
fn massTint(i: u32) -> vec3f { return massData[i * 3u + 2u].yzw; }
|
|
78
|
+
`,lA=`
|
|
79
|
+
${pr}
|
|
80
|
+
|
|
81
|
+
@group(0) @binding(4) var prevTex : texture_2d<f32>;
|
|
82
|
+
@group(0) @binding(5) var prevSamp : sampler;
|
|
83
|
+
|
|
84
|
+
const DEPOSIT_RATE : f32 = 0.02;
|
|
85
|
+
const DECAY_RATE : f32 = 0.05;
|
|
86
|
+
|
|
87
|
+
@fragment
|
|
88
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
89
|
+
let prev = textureSampleLevel(prevTex, prevSamp, uv, 0.0);
|
|
90
|
+
let dt = P.counts.w;
|
|
91
|
+
|
|
92
|
+
// Texel back to world space over the fixed residue rect.
|
|
93
|
+
let world = vec2f(
|
|
94
|
+
mix(P.fieldRect.x, P.fieldRect.z, uv.x),
|
|
95
|
+
mix(P.fieldRect.y, P.fieldRect.w, uv.y)
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
// --- process deposition -------------------------------------------------
|
|
99
|
+
var deposit = 0.0;
|
|
100
|
+
let dn = u32(P.counts.y);
|
|
101
|
+
for (var i = 0u; i < dn; i = i + 1u) {
|
|
102
|
+
let a = distData[i * 3u];
|
|
103
|
+
let b = distData[i * 3u + 1u];
|
|
104
|
+
let radius = a.z;
|
|
105
|
+
let energy = b.w;
|
|
106
|
+
if (energy <= 0.001) { continue; }
|
|
107
|
+
let d = length(vec2f(world.x - a.x, (world.y - a.y) * 1.5));
|
|
108
|
+
if (d > radius * 2.4) { continue; }
|
|
109
|
+
let falloff = exp(-sq(d / (radius * 1.7)));
|
|
110
|
+
deposit = deposit + energy * falloff;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// --- transfer deposition ------------------------------------------------
|
|
114
|
+
var coupleDeposit = 0.0;
|
|
115
|
+
let cn = u32(P.counts.z);
|
|
116
|
+
for (var i = 0u; i < cn; i = i + 1u) {
|
|
117
|
+
let c = coupData[i];
|
|
118
|
+
let a = massPos(u32(c.x));
|
|
119
|
+
let b = massPos(u32(c.y));
|
|
120
|
+
let v = b - a;
|
|
121
|
+
let l2 = dot(v, v);
|
|
122
|
+
if (l2 < 1.0) { continue; }
|
|
123
|
+
let u = dot(world - a, v) / l2;
|
|
124
|
+
if (u < -0.05 || u > 1.05) { continue; }
|
|
125
|
+
let proj = a + v * u;
|
|
126
|
+
let p = length(world - proj) / 44.0;
|
|
127
|
+
coupleDeposit = coupleDeposit + c.z * exp(-p * p * 1.4)
|
|
128
|
+
* exp(-quad((u - 0.5) / 0.5));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let r = prev.r + (deposit * DEPOSIT_RATE - prev.r * DECAY_RATE) * dt;
|
|
132
|
+
let g = prev.g + (coupleDeposit * DEPOSIT_RATE * 1.5 - prev.g * DECAY_RATE) * dt;
|
|
133
|
+
|
|
134
|
+
// Clamped so a pathological source can never drive residue unbounded.
|
|
135
|
+
return vec4f(clamp(r, 0.0, 4.0), clamp(g, 0.0, 4.0), 0.0, 1.0);
|
|
136
|
+
}
|
|
137
|
+
`,uA=`
|
|
138
|
+
${pr}
|
|
139
|
+
|
|
140
|
+
@group(0) @binding(4) var residueTex : texture_2d<f32>;
|
|
141
|
+
@group(0) @binding(5) var residueSamp : sampler;
|
|
142
|
+
|
|
143
|
+
// plinths: 3 vec4 each — session presence (FIELD-SPEC §15)
|
|
144
|
+
// 0: x, y, extentX, extentY
|
|
145
|
+
// 1: presence, articulation, parentIndex + 1 (0 = none), empty flag
|
|
146
|
+
// 2: shoulder, nested flag, unused, unused
|
|
147
|
+
@group(0) @binding(6) var<storage, read> plinthData : array<vec4f>;
|
|
148
|
+
|
|
149
|
+
const MAX_PLINTHS : u32 = ${lf}u;
|
|
150
|
+
|
|
151
|
+
const RES_X0 : f32 = ${sr.x0}.0;
|
|
152
|
+
const RES_Y0 : f32 = ${sr.y0}.0;
|
|
153
|
+
const RES_X1 : f32 = ${sr.x1}.0;
|
|
154
|
+
const RES_Y1 : f32 = ${sr.y1}.0;
|
|
155
|
+
|
|
156
|
+
fn residueAt(world: vec2f) -> vec2f {
|
|
157
|
+
let uv = vec2f(
|
|
158
|
+
(world.x - RES_X0) / (RES_X1 - RES_X0),
|
|
159
|
+
(world.y - RES_Y0) / (RES_Y1 - RES_Y0)
|
|
160
|
+
);
|
|
161
|
+
if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { return vec2f(0.0); }
|
|
162
|
+
return textureSampleLevel(residueTex, residueSamp, uv, 0.0).rg;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** FIELD-SPEC §7 — the sheet sags toward mass. */
|
|
166
|
+
fn shiftAt(world: vec2f, t: f32) -> f32 {
|
|
167
|
+
var dy = 0.0;
|
|
168
|
+
let mn = u32(P.counts.x);
|
|
169
|
+
for (var i = 0u; i < mn; i = i + 1u) {
|
|
170
|
+
let pos = massPos(i);
|
|
171
|
+
let ext = massExtent(i);
|
|
172
|
+
let n = (world - pos) / ext;
|
|
173
|
+
let g = exp(-dot(n, n) * 0.85);
|
|
174
|
+
dy = dy + massShape(i).z * n.y * g * 1.6;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Coupling flattens the sheet between two machines (FIELD-SPEC §8).
|
|
178
|
+
let cn = u32(P.counts.z);
|
|
179
|
+
let res = residueAt(world);
|
|
180
|
+
for (var i = 0u; i < cn; i = i + 1u) {
|
|
181
|
+
let c = coupData[i];
|
|
182
|
+
let a = massPos(u32(c.x));
|
|
183
|
+
let b = massPos(u32(c.y));
|
|
184
|
+
let v = b - a;
|
|
185
|
+
let l2 = dot(v, v);
|
|
186
|
+
if (l2 < 1.0) { continue; }
|
|
187
|
+
let u = dot(world - a, v) / l2;
|
|
188
|
+
if (u < -0.05 || u > 1.05) { continue; }
|
|
189
|
+
let proj = a + v * u;
|
|
190
|
+
let off = (world.y - proj.y) / 62.0;
|
|
191
|
+
let env = exp(-off * off) * exp(-quad((u - 0.5) / 0.55));
|
|
192
|
+
dy = dy - off * 62.0 * 0.42 * env * (0.7 + 0.3 * sin(t * 2.4 - u * 6.0)) * c.z;
|
|
193
|
+
dy = dy - off * 10.0 * env * res.g;
|
|
194
|
+
}
|
|
195
|
+
return dy;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** FIELD-SPEC §6 — the height field. */
|
|
199
|
+
fn heightAt(world: vec2f, t: f32) -> f32 {
|
|
200
|
+
let x = world.x;
|
|
201
|
+
let y = world.y;
|
|
202
|
+
|
|
203
|
+
// Base medium.
|
|
204
|
+
var v = 3.1 * sin(x * 0.021 + y * 0.013) * sin(y * 0.017 - x * 0.008)
|
|
205
|
+
+ 1.7 * sin(x * 0.045 - y * 0.031)
|
|
206
|
+
+ 1.1 * sin(y * 0.062 + x * 0.017);
|
|
207
|
+
|
|
208
|
+
// Mass: a lobed well with a raised rim. Permanent.
|
|
209
|
+
let mn = u32(P.counts.x);
|
|
210
|
+
for (var i = 0u; i < mn; i = i + 1u) {
|
|
211
|
+
let pos = massPos(i);
|
|
212
|
+
let ext = massExtent(i);
|
|
213
|
+
let shape = massShape(i);
|
|
214
|
+
let ph = massPhase(i);
|
|
215
|
+
let n = (world - pos) / ext;
|
|
216
|
+
let r = length(n);
|
|
217
|
+
let th = atan2(n.y, n.x);
|
|
218
|
+
let lobe = shape.w;
|
|
219
|
+
let wob = 1.0 + lobe * sin(3.0 * th + ph) * 0.5 + lobe * 0.3 * sin(5.0 * th - ph);
|
|
220
|
+
let rr = r / max(0.35, wob);
|
|
221
|
+
v = v - shape.x * exp(-rr * rr * 1.05);
|
|
222
|
+
v = v + shape.y * exp(-sq((rr - 1.02) / 0.42));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Activity: temporary, local, independent. Anisotropic — wider than tall.
|
|
226
|
+
//
|
|
227
|
+
// Articulation (FIELD-SPEC §16) is spent on definition only: it damps the ripple terms, softens
|
|
228
|
+
// and widens the collar so the rim stops closing, and — when co-observing sources disagree on
|
|
229
|
+
// extent — raises a faint doubled shoulder inside the object's own trough. The bulge amplitude
|
|
230
|
+
// itself is NEVER scaled by articulation: unknown stays heavy.
|
|
231
|
+
let dn = u32(P.counts.y);
|
|
232
|
+
for (var i = 0u; i < dn; i = i + 1u) {
|
|
233
|
+
let a = distData[i * 3u];
|
|
234
|
+
let b = distData[i * 3u + 1u];
|
|
235
|
+
let c = distData[i * 3u + 2u];
|
|
236
|
+
let amp = a.w;
|
|
237
|
+
if (amp <= 0.01) { continue; }
|
|
238
|
+
let radius = a.z;
|
|
239
|
+
let freq = b.x;
|
|
240
|
+
let phase = b.y;
|
|
241
|
+
let artic = c.x;
|
|
242
|
+
let rip = 0.15 + 0.85 * artic;
|
|
243
|
+
let d = length(vec2f(x - a.x, (y - a.y) * 1.5));
|
|
244
|
+
if (d > radius * 4.0) { continue; }
|
|
245
|
+
let e = exp(-sq(d / radius));
|
|
246
|
+
v = v + amp * e * (0.78 + 0.22 * sin(t * freq + phase) * rip);
|
|
247
|
+
v = v - amp * 0.34 * (0.25 + 0.75 * artic)
|
|
248
|
+
* exp(-sq((d - radius * 1.5) / (radius * 0.62 * (1.0 + (1.0 - artic) * 1.4))));
|
|
249
|
+
v = v + amp * 0.16 * rip * exp(-d / (radius * 2.1)) * sin(d * 0.13 - t * freq * 2.6 + phase);
|
|
250
|
+
if (c.y > 0.02) {
|
|
251
|
+
v = v + amp * 0.11 * exp(-sq((d - radius * (0.72 + c.y)) / (radius * 0.3)));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// SESSION PRESENCE (FIELD-SPEC §15): a flat-topped plinth per live session raises grouped
|
|
256
|
+
// executions onto one platform, so an existing contour closes around the set. A spawned child
|
|
257
|
+
// is a plinth growing out of the parent plinth. An empty-but-known session keeps only its rim.
|
|
258
|
+
let pn = min(u32(P.grid.w), MAX_PLINTHS);
|
|
259
|
+
var lv : array<f32, MAX_PLINTHS>;
|
|
260
|
+
for (var i = 0u; i < pn; i = i + 1u) {
|
|
261
|
+
let pa = plinthData[i * 3u];
|
|
262
|
+
let pb = plinthData[i * 3u + 1u];
|
|
263
|
+
let pc = plinthData[i * 3u + 2u];
|
|
264
|
+
let n = (world - pa.xy) / pa.zw;
|
|
265
|
+
let r2 = dot(n, n);
|
|
266
|
+
let presence = pb.x;
|
|
267
|
+
let plateau = 1.0 / (1.0 + pow(max(r2, 1e-5), 2.6));
|
|
268
|
+
lv[i] = plateau * presence;
|
|
269
|
+
if (pb.w > 0.5) {
|
|
270
|
+
// Presence without content: the rim of a session nothing ever ran in.
|
|
271
|
+
v = v + 4.5 * presence * exp(-sq((sqrt(r2) - 1.0) / 0.3));
|
|
272
|
+
} else {
|
|
273
|
+
let plinth = select(17.0, 13.0, pc.y > 0.5) * presence;
|
|
274
|
+
v = v + plinth * plateau;
|
|
275
|
+
if (pc.x > 0.02) {
|
|
276
|
+
// Co-observation shoulder: sources agree on the computation, not exactly on its extent.
|
|
277
|
+
// A concentric bench inside the plateau edge — never a separate closed rim.
|
|
278
|
+
v = v + plinth * 0.3 * pc.x * exp(-sq((sqrt(r2) - 0.78) / 0.13));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// THE KEEL: where two unrelated plateaus overlap, the ground between them drops — the same
|
|
284
|
+
// trough vocabulary already used around bulges, so contours cannot bridge it and proximity alone
|
|
285
|
+
// can never close a line. Parent and spawned child are exempt and still share a wall. Shallow by
|
|
286
|
+
// design: it must never read as a machine-level rift.
|
|
287
|
+
for (var i = 0u; i < pn; i = i + 1u) {
|
|
288
|
+
for (var j = i + 1u; j < pn; j = j + 1u) {
|
|
289
|
+
if (lv[i] < 0.02 || lv[j] < 0.02) { continue; }
|
|
290
|
+
let pi = u32(plinthData[i * 3u + 1u].z);
|
|
291
|
+
let pj = u32(plinthData[j * 3u + 1u].z);
|
|
292
|
+
if (pi == j + 1u || pj == i + 1u) { continue; }
|
|
293
|
+
let lo = min(lv[i], lv[j]);
|
|
294
|
+
let o = lo / max(lv[i], lv[j]);
|
|
295
|
+
v = v - 30.0 * o * sqrt(o) * lo;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Residue: what the field remembers. One texture read, not a walk through history.
|
|
300
|
+
if (P.layer2.w > 0.5) {
|
|
301
|
+
let res = residueAt(world);
|
|
302
|
+
v = v + 62.0 * 0.15 * res.r;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Coupling ridge.
|
|
306
|
+
let cn = u32(P.counts.z);
|
|
307
|
+
let resC = residueAt(world);
|
|
308
|
+
for (var i = 0u; i < cn; i = i + 1u) {
|
|
309
|
+
let c = coupData[i];
|
|
310
|
+
let a = massPos(u32(c.x));
|
|
311
|
+
let b = massPos(u32(c.y));
|
|
312
|
+
let vv = b - a;
|
|
313
|
+
let l2 = dot(vv, vv);
|
|
314
|
+
if (l2 < 1.0) { continue; }
|
|
315
|
+
let u = dot(world - a, vv) / l2;
|
|
316
|
+
if (u < -0.05 || u > 1.05) { continue; }
|
|
317
|
+
let proj = a + vv * u;
|
|
318
|
+
let p = length(world - proj) / 44.0;
|
|
319
|
+
let envc = exp(-p * p) * exp(-quad((u - 0.5) / 0.56));
|
|
320
|
+
v = v + 34.0 * envc * (0.5 + 0.5 * sin(u * 13.0 - t * 4.6)) * c.z;
|
|
321
|
+
v = v - 14.0 * exp(-sq(abs(p) - 1.5)) * envc * c.z;
|
|
322
|
+
v = v + 9.0 * resC.g * exp(-p * p * 1.4) * exp(-quad((u - 0.5) / 0.5));
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return v;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Local articulation (FIELD-SPEC §16): the sheet resolves coarser near unresolved objects, so line
|
|
330
|
+
* cadence carries the meaning. Weighted blend over disturbances and plinths, with a prior toward 1
|
|
331
|
+
* so the empty medium — and everything far from an observed object — keeps its full cadence.
|
|
332
|
+
*/
|
|
333
|
+
fn articAt(world: vec2f) -> f32 {
|
|
334
|
+
var num = 0.0;
|
|
335
|
+
var den = 0.35;
|
|
336
|
+
let dn = u32(P.counts.y);
|
|
337
|
+
for (var i = 0u; i < dn; i = i + 1u) {
|
|
338
|
+
let a = distData[i * 3u];
|
|
339
|
+
let b = distData[i * 3u + 1u];
|
|
340
|
+
if (b.w <= 0.001) { continue; }
|
|
341
|
+
let dx = (world.x - a.x) / (a.z * 2.0);
|
|
342
|
+
let dy = (world.y - a.y) * 1.5 / (a.z * 2.0);
|
|
343
|
+
let w = exp(-(dx * dx + dy * dy)) * b.w;
|
|
344
|
+
num = num + w * distData[i * 3u + 2u].x;
|
|
345
|
+
den = den + w;
|
|
346
|
+
}
|
|
347
|
+
let pn = min(u32(P.grid.w), MAX_PLINTHS);
|
|
348
|
+
for (var i = 0u; i < pn; i = i + 1u) {
|
|
349
|
+
let pa = plinthData[i * 3u];
|
|
350
|
+
let pb = plinthData[i * 3u + 1u];
|
|
351
|
+
if (pb.x <= 0.01) { continue; }
|
|
352
|
+
let dx = (world.x - pa.x) / (pa.z * 1.3);
|
|
353
|
+
let dy = (world.y - pa.y) / (pa.w * 1.3);
|
|
354
|
+
let w = exp(-(dx * dx + dy * dy)) * pb.x * 0.8;
|
|
355
|
+
num = num + w * pb.y;
|
|
356
|
+
den = den + w;
|
|
357
|
+
}
|
|
358
|
+
return clamp((num + 0.35) / den, 0.1, 1.0);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@fragment
|
|
362
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
363
|
+
let world = vec2f(
|
|
364
|
+
mix(P.fieldRect.x, P.fieldRect.z, uv.x),
|
|
365
|
+
mix(P.fieldRect.y, P.fieldRect.w, uv.y)
|
|
366
|
+
);
|
|
367
|
+
let t = P.view.w;
|
|
368
|
+
return vec4f(heightAt(world, t), shiftAt(world, t), articAt(world), 1.0);
|
|
369
|
+
}
|
|
370
|
+
`,m0=`
|
|
371
|
+
${pr}
|
|
372
|
+
|
|
373
|
+
@group(0) @binding(4) var fieldTex : texture_2d<f32>;
|
|
374
|
+
@group(0) @binding(5) var fieldSamp : sampler;
|
|
375
|
+
|
|
376
|
+
struct VOut {
|
|
377
|
+
@builtin(position) pos : vec4f,
|
|
378
|
+
@location(0) color : vec4f,
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
fn fieldSample(world: vec2f) -> vec3f {
|
|
382
|
+
let uv = vec2f(
|
|
383
|
+
(world.x - P.fieldRect.x) / (P.fieldRect.z - P.fieldRect.x),
|
|
384
|
+
(world.y - P.fieldRect.y) / (P.fieldRect.w - P.fieldRect.y)
|
|
385
|
+
);
|
|
386
|
+
// r: height, g: shift, b: local articulation.
|
|
387
|
+
return textureSampleLevel(fieldTex, fieldSamp, clamp(uv, vec2f(0.0), vec2f(1.0)), 0.0).rgb;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** FIELD-SPEC §10 — line colour is the base ink pulled toward nearby mass tints. */
|
|
391
|
+
fn tintMix(world: vec2f) -> vec3f {
|
|
392
|
+
var acc = vec3f(226.0, 223.0, 215.0);
|
|
393
|
+
var w = 1.0;
|
|
394
|
+
let mn = u32(P.counts.x);
|
|
395
|
+
for (var i = 0u; i < mn; i = i + 1u) {
|
|
396
|
+
let pos = massPos(i);
|
|
397
|
+
let ext = massExtent(i) * 1.5;
|
|
398
|
+
let n = (world - pos) / ext;
|
|
399
|
+
let k = exp(-dot(n, n)) * 0.85;
|
|
400
|
+
acc = acc + massTint(i) * k;
|
|
401
|
+
w = w + k;
|
|
402
|
+
}
|
|
403
|
+
return acc / w / 255.0;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** Screen-space y of the sheet at world x on the given row baseline. */
|
|
407
|
+
fn rowPoint(x: f32, by: f32, dzW: f32, ampF: f32) -> f32 {
|
|
408
|
+
let wy = by + dzW;
|
|
409
|
+
let sh = fieldSample(vec2f(x, wy)).g;
|
|
410
|
+
let yy = wy + sh * ampF;
|
|
411
|
+
let hv = fieldSample(vec2f(x, yy)).r * ampF;
|
|
412
|
+
let worldY = by - hv + sh * 0.55 * ampF;
|
|
413
|
+
return (worldY - P.rect.y) * P.view.z;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
@vertex
|
|
417
|
+
fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
|
|
418
|
+
let cols = u32(P.grid.x);
|
|
419
|
+
let isLine = ii & 1u;
|
|
420
|
+
let seg = ii >> 1u;
|
|
421
|
+
let row = seg / cols;
|
|
422
|
+
let col = seg % cols;
|
|
423
|
+
|
|
424
|
+
let k = P.view.z;
|
|
425
|
+
let stepW = P.layer.y / k;
|
|
426
|
+
let rowsW = P.layer.x / k;
|
|
427
|
+
let dzW = P.layer2.y / k;
|
|
428
|
+
// FIELD-SPEC §10 — amplitude compensation when zoomed in.
|
|
429
|
+
let ampF = P.layer.z * select(1.0, 1.6 / k, k > 1.0);
|
|
430
|
+
|
|
431
|
+
let x0 = P.rect.x - stepW * 2.0 + f32(col) * stepW;
|
|
432
|
+
let x1 = x0 + stepW;
|
|
433
|
+
let by = P.rect.y - rowsW * 0.6 + f32(row) * rowsW;
|
|
434
|
+
|
|
435
|
+
let sy0 = rowPoint(x0, by, dzW, ampF);
|
|
436
|
+
let sy1 = rowPoint(x1, by, dzW, ampF);
|
|
437
|
+
let sx0 = (x0 - P.rect.x) * k + P.layer2.z;
|
|
438
|
+
let sx1 = (x1 - P.rect.x) * k + P.layer2.z;
|
|
439
|
+
|
|
440
|
+
var p = vec2f(0.0);
|
|
441
|
+
var color = vec4f(0.0);
|
|
442
|
+
|
|
443
|
+
if (isLine == 0u) {
|
|
444
|
+
// Fill: from this segment down over the farther rows it occludes.
|
|
445
|
+
//
|
|
446
|
+
// ── Why the fill stops where it does ──────────────────────────────────────────────────────
|
|
447
|
+
// The approved material ran every fill to the bottom of the viewport. Composited far to near
|
|
448
|
+
// that is exactly the hidden-line algorithm, but it also means a pixel is written once per row
|
|
449
|
+
// above it: at the 9 px near-row spacing on a 914 px tall viewport, about 107 blended
|
|
450
|
+
// fragments per pixel across the three layers (measured; see the performance investigation),
|
|
451
|
+
// and that overdraw grows with width × height² × dpr². It was three quarters of the frame's
|
|
452
|
+
// GPU time on an M4 and dwarfs everything else the field draws.
|
|
453
|
+
//
|
|
454
|
+
// Below the next 'reach' rows' lines a fill can no longer be seen: the fills of those rows
|
|
455
|
+
// land on top of it, each at this layer's fill alpha, so whatever it contributed is scaled by
|
|
456
|
+
// (1 - alpha)^reach — below one 8-bit step for the reach chosen per layer in FILL_REACH. So
|
|
457
|
+
// the fill stops at the LOWEST of the next 'reach' rows' lines at each end of the segment, and
|
|
458
|
+
// the rows between it and there keep exactly the occlusion and haze they had. The bottom edge
|
|
459
|
+
// is straight between the two ends, which bounds the straight segments of those rows.
|
|
460
|
+
//
|
|
461
|
+
// Reach 0 restores the original geometry, and the last 'reach' rows keep it, so the sheet's
|
|
462
|
+
// edge against the strata band is untouched.
|
|
463
|
+
var bottom = P.view.y + 60.0;
|
|
464
|
+
let reach = u32(P.sheet.x);
|
|
465
|
+
let rows = u32(P.grid.y);
|
|
466
|
+
let isBottom = (vi == 2u) || (vi == 4u) || (vi == 5u);
|
|
467
|
+
if (isBottom && reach > 0u && row + reach < rows) {
|
|
468
|
+
let xb = select(x0, x1, vi != 5u);
|
|
469
|
+
var b = select(sy0, sy1, vi != 5u);
|
|
470
|
+
for (var j = 1u; j <= reach; j = j + 1u) {
|
|
471
|
+
b = max(b, rowPoint(xb, by + f32(j) * rowsW, dzW, ampF));
|
|
472
|
+
}
|
|
473
|
+
// Half a pixel of slack over the nearer rows' own vertex arithmetic.
|
|
474
|
+
bottom = b + 0.5;
|
|
475
|
+
}
|
|
476
|
+
switch (vi) {
|
|
477
|
+
case 0u: { p = vec2f(sx0, sy0); }
|
|
478
|
+
case 1u: { p = vec2f(sx1, sy1); }
|
|
479
|
+
case 2u: { p = vec2f(sx1, bottom); }
|
|
480
|
+
case 3u: { p = vec2f(sx0, sy0); }
|
|
481
|
+
case 4u: { p = vec2f(sx1, bottom); }
|
|
482
|
+
default: { p = vec2f(sx0, bottom); }
|
|
483
|
+
}
|
|
484
|
+
color = P.fill;
|
|
485
|
+
} else {
|
|
486
|
+
// Line: a quad along the segment, width and alpha from local slope (FIELD-SPEC §10).
|
|
487
|
+
let slope = min(1.0, abs(sy1 - sy0) / max(0.001, P.layer.y));
|
|
488
|
+
var bucketA = 0.17;
|
|
489
|
+
var bucketW = 0.75;
|
|
490
|
+
if (slope > 0.62) { bucketA = 0.98; bucketW = 1.80; }
|
|
491
|
+
else if (slope > 0.30) { bucketA = 0.60; bucketW = 1.35; }
|
|
492
|
+
else if (slope > 0.11) { bucketA = 0.32; bucketW = 1.00; }
|
|
493
|
+
|
|
494
|
+
// OBSERVATION RESOLUTION (FIELD-SPEC §16): near an unresolved object the sheet's own line
|
|
495
|
+
// cadence loosens — segments dash out, thin and dim. Never the height: mass stays, definition
|
|
496
|
+
// varies. The blend prior keeps the empty medium at full cadence, so a fully resolved field
|
|
497
|
+
// renders exactly as it did before articulation existed.
|
|
498
|
+
let art = fieldSample(vec2f((x0 + x1) * 0.5, by)).b;
|
|
499
|
+
if (art <= 0.85) {
|
|
500
|
+
let dash = (1.0 - art) * 9.0 + 1.5;
|
|
501
|
+
// World-anchored phase (scaled to screen), so the cadence sits still under panning.
|
|
502
|
+
let phase = fract(x0 * k * 0.7 / (dash * 2.2)) * dash * 2.2;
|
|
503
|
+
if (phase > dash * 1.15) {
|
|
504
|
+
var cut: VOut;
|
|
505
|
+
cut.pos = vec4f(-10.0, -10.0, 0.0, 1.0);
|
|
506
|
+
cut.color = vec4f(0.0);
|
|
507
|
+
return cut;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
let artA = 0.34 + 0.66 * art;
|
|
511
|
+
let artW = 0.7 + 0.3 * art;
|
|
512
|
+
|
|
513
|
+
let width = max(0.6, bucketW * artW * min(2.1, k) * P.layer2.x);
|
|
514
|
+
let dir = normalize(vec2f(sx1 - sx0, sy1 - sy0) + vec2f(0.0001, 0.0));
|
|
515
|
+
let nrm = vec2f(-dir.y, dir.x) * (width * 0.5);
|
|
516
|
+
|
|
517
|
+
switch (vi) {
|
|
518
|
+
case 0u: { p = vec2f(sx0, sy0) - nrm; }
|
|
519
|
+
case 1u: { p = vec2f(sx1, sy1) - nrm; }
|
|
520
|
+
case 2u: { p = vec2f(sx1, sy1) + nrm; }
|
|
521
|
+
case 3u: { p = vec2f(sx0, sy0) - nrm; }
|
|
522
|
+
case 4u: { p = vec2f(sx1, sy1) + nrm; }
|
|
523
|
+
default: { p = vec2f(sx0, sy0) + nrm; }
|
|
524
|
+
}
|
|
525
|
+
let rgb = tintMix(vec2f((x0 + x1) * 0.5, by));
|
|
526
|
+
color = vec4f(rgb, bucketA * artA * P.layer.w);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
var out: VOut;
|
|
530
|
+
out.pos = vec4f(p.x / P.view.x * 2.0 - 1.0, 1.0 - p.y / P.view.y * 2.0, 0.0, 1.0);
|
|
531
|
+
out.color = color;
|
|
532
|
+
return out;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
@fragment
|
|
536
|
+
fn fs_main(in: VOut) -> @location(0) vec4f {
|
|
537
|
+
return vec4f(in.color.rgb * in.color.a, in.color.a);
|
|
538
|
+
}
|
|
539
|
+
`,oA=`
|
|
540
|
+
${pr}
|
|
541
|
+
|
|
542
|
+
struct VOut {
|
|
543
|
+
@builtin(position) pos : vec4f,
|
|
544
|
+
@location(0) local : vec2f,
|
|
545
|
+
@location(1) color : vec3f,
|
|
546
|
+
@location(2) weight : f32,
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
fn statusColor(idx: f32) -> vec3f {
|
|
550
|
+
if (idx < 0.5) { return vec3f(240.0, 195.0, 116.0) / 255.0; } // running
|
|
551
|
+
if (idx < 1.5) { return vec3f(150.0, 175.0, 196.0) / 255.0; } // waiting
|
|
552
|
+
if (idx < 2.5) { return vec3f(206.0, 104.0, 90.0) / 255.0; } // failed
|
|
553
|
+
if (idx < 3.5) { return vec3f(180.0, 210.0, 175.0) / 255.0; } // completed
|
|
554
|
+
return vec3f(230.0, 227.0, 219.0) / 255.0; // idle
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
fn statusPulse(idx: f32, t: f32, freq: f32, phase: f32) -> f32 {
|
|
558
|
+
if (idx < 0.5) { return 0.55 + 0.35 * sin(t * freq * 2.0 + phase); }
|
|
559
|
+
if (idx < 1.5) { return 0.40 + 0.08 * sin(t * 0.6); }
|
|
560
|
+
if (idx < 2.5) { return 0.50 + 0.50 * sin(t * 30.0); }
|
|
561
|
+
if (idx < 3.5) { return 0.35; }
|
|
562
|
+
return 0.15;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
@vertex
|
|
566
|
+
fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
|
|
567
|
+
let a = distData[ii * 3u];
|
|
568
|
+
let b = distData[ii * 3u + 1u];
|
|
569
|
+
let k = P.view.z;
|
|
570
|
+
let t = P.view.w;
|
|
571
|
+
|
|
572
|
+
let statusIdx = b.z;
|
|
573
|
+
let failed = select(1.0, 1.3, statusIdx > 1.5 && statusIdx < 2.5);
|
|
574
|
+
let radius = max(2.4, 3.4 * k) * failed * 3.2;
|
|
575
|
+
|
|
576
|
+
let centre = vec2f((a.x - P.rect.x) * k, (a.y - P.rect.y) * k);
|
|
577
|
+
let corner = vec2f(
|
|
578
|
+
select(-1.0, 1.0, (vi == 1u) || (vi == 2u) || (vi == 4u)),
|
|
579
|
+
select(-1.0, 1.0, (vi == 2u) || (vi == 4u) || (vi == 5u))
|
|
580
|
+
);
|
|
581
|
+
let p = centre + corner * radius;
|
|
582
|
+
|
|
583
|
+
var out: VOut;
|
|
584
|
+
out.pos = vec4f(p.x / P.view.x * 2.0 - 1.0, 1.0 - p.y / P.view.y * 2.0, 0.0, 1.0);
|
|
585
|
+
out.local = corner;
|
|
586
|
+
out.color = statusColor(statusIdx);
|
|
587
|
+
// Articulation dims the core's confidence, never the field's mass (FIELD-SPEC §16).
|
|
588
|
+
let artic = distData[ii * 3u + 2u].x;
|
|
589
|
+
out.weight = statusPulse(statusIdx, t, b.x, b.y) * 0.9 * clamp(b.w, 0.0, 1.0)
|
|
590
|
+
* (0.22 + 0.78 * artic);
|
|
591
|
+
return out;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
@fragment
|
|
595
|
+
fn fs_main(in: VOut) -> @location(0) vec4f {
|
|
596
|
+
let d = length(in.local);
|
|
597
|
+
if (d > 1.0) { discard; }
|
|
598
|
+
// Radial falloff matching the design's gradient stops.
|
|
599
|
+
let a = (1.0 - d) * (1.0 - d) * in.weight;
|
|
600
|
+
return vec4f(in.color * a, a);
|
|
601
|
+
}
|
|
602
|
+
`,cA=`
|
|
603
|
+
${pr}
|
|
604
|
+
|
|
605
|
+
// per stratum: startFraction, endFraction, lane, statusIndex
|
|
606
|
+
@group(0) @binding(4) var<storage, read> strataData : array<vec4f>;
|
|
607
|
+
|
|
608
|
+
struct VOut {
|
|
609
|
+
@builtin(position) pos : vec4f,
|
|
610
|
+
@location(0) t : f32,
|
|
611
|
+
@location(1) color : vec3f,
|
|
612
|
+
@location(2) alpha : f32,
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
const STRATA_TOP : f32 = 812.0;
|
|
616
|
+
const STRATA_H : f32 = 360.0;
|
|
617
|
+
const SPAN_X : f32 = 1160.0;
|
|
618
|
+
const MIN_W : f32 = ${F0}.0;
|
|
619
|
+
|
|
620
|
+
@vertex
|
|
621
|
+
fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
|
|
622
|
+
let s = strataData[ii];
|
|
623
|
+
let laneCount = max(1.0, P.grid.z);
|
|
624
|
+
let laneH = STRATA_H / laneCount;
|
|
625
|
+
let top = STRATA_TOP + s.z * laneH;
|
|
626
|
+
|
|
627
|
+
let wx0 = s.x * SPAN_X;
|
|
628
|
+
let wx1 = max(wx0 + MIN_W, s.y * SPAN_X);
|
|
629
|
+
let k = P.view.z;
|
|
630
|
+
|
|
631
|
+
let sx0 = (wx0 - P.rect.x) * k;
|
|
632
|
+
let sx1 = (wx1 - P.rect.x) * k;
|
|
633
|
+
let sy0 = (top - P.rect.y) * k;
|
|
634
|
+
let sy1 = (top + laneH - P.rect.y) * k;
|
|
635
|
+
|
|
636
|
+
let right = (vi == 1u) || (vi == 2u) || (vi == 4u);
|
|
637
|
+
let lower = (vi == 2u) || (vi == 4u) || (vi == 5u);
|
|
638
|
+
let p = vec2f(select(sx0, sx1, right), select(sy0, sy1, lower));
|
|
639
|
+
|
|
640
|
+
// Failed runs read red; otherwise the lane's machine tint.
|
|
641
|
+
var col = massTint(u32(s.z)) / 255.0;
|
|
642
|
+
if (s.w > 1.5 && s.w < 2.5) { col = vec3f(206.0, 104.0, 90.0) / 255.0; }
|
|
643
|
+
|
|
644
|
+
var out: VOut;
|
|
645
|
+
out.pos = vec4f(p.x / P.view.x * 2.0 - 1.0, 1.0 - p.y / P.view.y * 2.0, 0.0, 1.0);
|
|
646
|
+
out.t = select(0.0, 1.0, right);
|
|
647
|
+
out.color = col;
|
|
648
|
+
out.alpha = 0.30;
|
|
649
|
+
return out;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
@fragment
|
|
653
|
+
fn fs_main(in: VOut) -> @location(0) vec4f {
|
|
654
|
+
// Left-to-right gradient to transparent, as in the approved design.
|
|
655
|
+
let a = in.alpha * (1.0 - in.t);
|
|
656
|
+
return vec4f(in.color * a, a);
|
|
657
|
+
}
|
|
658
|
+
`,Wy=.34,Jy=3.4,g0={zoom:1,cx:580,cy:406},fA=-260,dA=1420,hA=-260,pA=1300,mA=.58,gA=.72,uf=1.7,yA=1.45;function vA(n,i){return n==="strata"?i>gA?"environment":"strata":n==="proximity"?i<yA?"environment":"proximity":i<mA?"strata":i>uf?"proximity":"environment"}function bA(n){return n.width/wn.spanX}function An(n,i){return bA(i)*n.zoom}function mr(n){return n.zoom=Math.max(Wy,Math.min(Jy,n.zoom)),n.cx=Math.max(fA,Math.min(dA,n.cx)),n.cy=Math.max(hA,Math.min(pA,n.cy)),n}function xA(n,i,s){const l=An(n,i),u=i.width/l,c=i.height/l;return s.x0=n.cx-u/2,s.y0=n.cy-c/2,s.x1=n.cx+u/2,s.y1=n.cy+c/2,s}function of(n,i,s,l){const u=An(s,l),c=l.width/u,d=l.height/u;return[s.cx-c/2+n/u,s.cy-d/2+i/u]}function Bc(n,i,s,l){const u=An(s,l),c=l.width/u,d=l.height/u;return[(n-(s.cx-c/2))*u,(i-(s.cy-d/2))*u]}function Gc(n,i,s,l,u){const[c,d]=of(s,l,n,u);n.zoom=Math.max(Wy,Math.min(Jy,n.zoom*i));const h=An(n,u);n.cx=c-s/h+u.width/h/2,n.cy=d-l/h+u.height/h/2,mr(n)}function y0(n,i,s,l){const u=An(n,l);n.cx+=i/u,n.cy+=s/u,mr(n)}function SA(n,i,s,l=7){const u=1-Math.exp(-l*s),c=i.zoom-n.zoom,d=i.cx-n.cx,h=i.cy-n.cy;n.zoom+=c*u,n.cx+=d*u,n.cy+=h*u;const m=Math.abs(c)<.001&&Math.abs(d)<.4&&Math.abs(h)<.4;return m&&(n.zoom=i.zoom,n.cx=i.cx,n.cy=i.cy),m}function wA(n,i,s){return mr({zoom:s,cx:n,cy:i})}const $l=120,EA="field",TA=5,AA=2,v0=30;class MA{intervalMs=new Float32Array($l);cpuMs=new Float32Array($l);cursor=0;filled=0;lastFrameAt=0;frames=0;lastIntervalMs=0;lastCpuMs=0;gpuMs={};disturbances=0;fps=0;resolutionScale=1;get canAdapt(){return this.bakeSamples>0}lastEvalAt=0;pendingResize=!1;bakeSum=0;bakeSamples=0;sample(i,s,l){const u=this.gpuMs[EA];if(u!==void 0&&u>0&&(this.bakeSum+=u,this.bakeSamples++),this.lastFrameAt>0){const c=i-this.lastFrameAt;this.intervalMs[this.cursor]=c,this.cpuMs[this.cursor]=s,this.cursor=(this.cursor+1)%$l,this.filled<$l&&this.filled++,this.lastIntervalMs=c}this.lastFrameAt=i,this.lastCpuMs=s,this.frames++,this.disturbances=l,this.fps=this.averageInterval>0?1e3/this.averageInterval:0,this.maybeAdapt(i)}resetPacing(){this.lastFrameAt=0}get averageInterval(){if(this.filled===0)return 0;let i=0;for(let s=0;s<this.filled;s++)i+=this.intervalMs[s];return i/this.filled}get averageCpuMs(){if(this.filled===0)return 0;let i=0;for(let s=0;s<this.filled;s++)i+=this.cpuMs[s];return i/this.filled}get totalGpuMs(){let i=0;for(const s in this.gpuMs)i+=this.gpuMs[s];return i}bakeCost(){return this.bakeSamples<v0?0:this.bakeSum/this.bakeSamples}maybeAdapt(i){if(i-this.lastEvalAt<2e3||this.filled<45)return;const s=this.bakeCost();this.bakeSamples<v0||(this.lastEvalAt=i,this.bakeSum=0,this.bakeSamples=0,!(s<=0)&&(s>TA&&this.resolutionScale>.5?(this.resolutionScale=Math.max(.5,this.resolutionScale-.15),this.pendingResize=!0):s<AA&&this.resolutionScale<1&&(this.resolutionScale=Math.min(1,this.resolutionScale+.1),this.pendingResize=!0)))}wantsResize(){return this.pendingResize?(this.pendingResize=!1,!0):!1}snapshot(){return{fps:this.fps,intervalMs:this.averageInterval,cpuMs:this.averageCpuMs,gpuMs:this.totalGpuMs,frames:this.frames,scale:this.resolutionScale,disturbances:this.disturbances}}}const Pn=[{rows:22,step:11,amp:.5,alpha:.4,lw:.75,dz:-190,px:44,fill:[5,6,8,.9]},{rows:14,step:9,amp:.74,alpha:.72,lw:.9,dz:-92,px:18,fill:[5,6,8,.94]},{rows:9,step:7.5,amp:1,alpha:1,lw:1,dz:0,px:0,fill:[4,5,7,.965]}],b0={running:0,waiting:1,failed:2,completed:3,idle:4},x0={laptop:[214,176,116],desktop:[168,186,150],server:[150,190,175]},S0=512,DA=[3,2,2],w0=0,E0=1,Ji=2,T0=1,A0=2,RA=4,CA=1600,M0=.004;function OA(n){return n.msSinceInteraction<CA?T0:n.couplings>0||n.maxEnergy>M0?A0:n.maxSettling>M0?RA:n.dirty?T0:1/0}class zA{gpu;surf=null;output;residue;fieldTarget;gpuTimer=null;spans=null;layerSpans=[];probe=null;sheetVariants=new Map;linearSampler;residueFx;fieldFx;sheetDraw;coresDraw;strataDraw;paramsBufs=[];massBuf;distBuf;coupBuf;strataBuf;plinthBuf;params=new Float32Array(36);massArr=new Float32Array(f0*3*4);distArr=new Float32Array(d0*3*4);coupArr=new Float32Array(h0*4);strataArr=new Float32Array(S0*4);plinthArr=new Float32Array(lf*3*4);rect={x0:0,y0:0,x1:0,y1:0};landscape={time:0,masses:[],disturbances:[],plinths:[],couplings:[],strata:[]};massIndex=new Map;runtime=new Map;plinthRuntime=new Map;plinthStatics=new Map;frameSubscribers=new Set;generation=0;lastInstances=0;strataCount=0;disturbanceCount=0;couplingCount=0;massCount=0;plinthCount=0;raf=0;refreshCount=0;lastStride=1;lastDrawnAt=0;nextDrawAt=0;dirty=!0;running=!1;lastFrameAt=0;simTime=0;lastInteractionAt=0;disposed=!1;landscapeDirty=!0;perf=new MA;camera;canvas;headless;maxDpr;initGpu;view={width:1,height:1};constructor(i){if(this.canvas=i.canvas??null,this.headless=i.headless??null,this.camera=i.camera,this.maxDpr=i.maxDpr??1.25,this.initGpu=i.initGpu??(async()=>{try{return await c0({requiredFeatures:["timestamp-query"]})}catch{return await c0()}}),!this.canvas&&!this.headless)throw new Error("FieldRenderer needs either a canvas or a headless size")}async init(){this.gpu=await this.initGpu();try{const c=iA(this.gpu);this.gpuTimer=c,this.spans={residue:c.span("residue"),field:c.span("field"),sheet:c.span("sheet"),overlay:c.span("overlay")},this.layerSpans=[0,1,2].map(d=>c.span(`sheet${d}`)),c.onResults(d=>{this.perf.gpuMs=d,this.probe?.noteGpu(d)}),this.probe?.note("timestamp-query available")}catch(c){this.gpuTimer=null,this.spans=null,this.layerSpans=[],this.probe?.note(`timestamp-query unavailable: ${c instanceof Error?c.message:String(c)}`)}if(this.headless)this.output=s0(this.gpu,{size:[this.headless.width,this.headless.height],format:"rgba8unorm"});else{const c=this.canvas;await _A(c);const d=Math.min(this.maxDpr,globalThis.devicePixelRatio||1),[h,m]=this.cssSize();c.width=Math.round(h*d),c.height=Math.round(m*d),this.surf=RE(this.gpu,c,{dpr:d,autoResize:!0}),this.output=this.surf,this.view.width=h,this.view.height=m}this.residue=XT(this.gpu,p0,p0,{format:"rgba16float"});const[i,s]=this.fieldSize();this.fieldTarget=s0(this.gpu,{size:[i,s],format:"rgba16float"}),this.paramsBufs=Array.from({length:5},()=>Ya(this.gpu,this.params.byteLength,"read")),this.massBuf=Ya(this.gpu,this.massArr.byteLength,"read"),this.distBuf=Ya(this.gpu,this.distArr.byteLength,"read"),this.coupBuf=Ya(this.gpu,this.coupArr.byteLength,"read"),this.strataBuf=Ya(this.gpu,this.strataArr.byteLength,"read"),this.plinthBuf=Ya(this.gpu,this.plinthArr.byteLength,"read");const l=qE(this.gpu,{minFilter:"linear",magFilter:"linear"});this.linearSampler=l,this.residueFx=a0(this.gpu,lA,{set:{P:this.paramsBufs[w0],massData:this.massBuf,distData:this.distBuf,coupData:this.coupBuf,prevTex:this.residue.read,prevSamp:l}}),this.fieldFx=a0(this.gpu,uA,{set:{P:this.paramsBufs[E0],massData:this.massBuf,distData:this.distBuf,coupData:this.coupBuf,residueTex:this.residue.read,residueSamp:l,plinthData:this.plinthBuf}}),this.sheetDraw=Bl(this.gpu,{shader:m0,vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[Ji],massData:this.massBuf,fieldTex:this.fieldTarget,fieldSamp:l}}),this.coresDraw=Bl(this.gpu,{shader:oA,vertices:6,blend:"additive",set:{P:this.paramsBufs[Ji],distData:this.distBuf}}),this.strataDraw=Bl(this.gpu,{shader:cA,vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[Ji],massData:this.massBuf,strataData:this.strataBuf}});const u={colors:[this.output.format]};await Promise.all([this.residueFx.compile(this.residue.write),this.fieldFx.compile(this.fieldTarget),this.sheetDraw.compile(u),this.coresDraw.compile(u),this.strataDraw.compile(u)])}cssSize(){const i=this.canvas;if(!i)return[this.headless.width,this.headless.height];const s=i.parentElement,l=i.clientWidth||s?.clientWidth||1280,u=i.clientHeight||s?.clientHeight||720;return[Math.max(1,l),Math.max(1,u)]}fieldSize(){const i=this.perf.resolutionScale,s=this.headless?.width??this.canvas?.clientWidth??640,l=this.headless?.height??this.canvas?.clientHeight??480,u=Math.max(160,Math.round(Math.min(768,s)*i)),c=Math.max(120,Math.round(Math.min(576,l)*i));return[u,c]}attachProbe(i){this.probe=i}setLandscape(i){const s=this.probe?performance.now():0;this.landscape=i,this.landscapeDirty=!0,this.generation++,this.probe&&(this.probe.landscapes++,queueMicrotask(()=>this.probe?.landscapeMs.push(performance.now()-s)));const l=this.generation;for(const u of i.disturbances){let c=this.runtime.get(u.id);c||(c={energy:0,target:u.energy,status:u.status,statusSince:u.statusSince,seen:l,extent:u.extent,toExtent:u.extent},this.runtime.set(u.id,c)),c.target=u.energy,c.status=u.status,c.statusSince=u.statusSince,c.seen=l,c.toExtent=u.extent}for(const[u,c]of this.runtime)c.seen!==l&&(c.target=0,c.energy<.002&&this.runtime.delete(u));for(const u of i.plinths){let c=this.plinthRuntime.get(u.id);c||(c={presence:0,target:u.presence,x:u.x,y:u.y,extentX:u.extentX,extentY:u.extentY,toX:u.x,toY:u.y,toExtentX:u.extentX,toExtentY:u.extentY,seen:l},this.plinthRuntime.set(u.id,c)),c.target=u.presence,c.toX=u.x,c.toY=u.y,c.toExtentX=u.extentX,c.toExtentY=u.extentY,c.seen=l,this.plinthStatics.set(u.id,u)}for(const[u,c]of this.plinthRuntime)c.seen!==l&&(c.target=0,c.presence<.002&&(this.plinthRuntime.delete(u),this.plinthStatics.delete(u)))}noteInteraction(){this.lastInteractionAt=performance.now(),this.dirty=!0}onFrame(i){return this.frameSubscribers.add(i),()=>this.frameSubscribers.delete(i)}start(){if(this.running||this.disposed)return;this.running=!0,this.lastFrameAt=performance.now(),this.refreshCount=0,this.nextDrawAt=0;const i=s=>{if(!this.running)return;this.raf=requestAnimationFrame(i),this.refreshCount++;const l=this.currentStride(s);if(this.probe?.noteRefresh(s,l),l===1/0){this.perf.resetPacing(),this.lastDrawnAt=0,this.lastFrameAt=s,this.nextDrawAt=this.refreshCount+1;return}if(this.refreshCount<this.nextDrawAt)return;this.nextDrawAt=this.refreshCount+l;const u=s-this.lastFrameAt;this.lastFrameAt=s,this.lastStride=l;const c=this.probe?.debug.fixedDt??null,d=c!==null?c:Math.min(.1,u/1e3);this.renderFrame(d)};this.raf=requestAnimationFrame(i)}stop(){this.running=!1,this.raf&&cancelAnimationFrame(this.raf),this.raf=0}invalidate(){this.dirty=!0}currentStride(i){let s=0,l=0;for(const u of this.runtime.values()){u.energy>s&&(s=u.energy);const c=Math.abs(u.target-u.energy);c>l&&(l=c);const d=Math.abs(u.toExtent-u.extent);d>l&&(l=d)}for(const u of this.plinthRuntime.values()){const c=Math.abs(u.target-u.presence);c>l&&(l=c)}return OA({dirty:this.dirty||this.landscapeDirty,msSinceInteraction:i-this.lastInteractionAt,couplings:this.couplingCount,maxEnergy:s,maxSettling:l})}stepPhysics(i){const s=this.simTime;for(const l of this.runtime.values()){let u=l.target;if(l.status==="failed"){const d=Math.max(0,s-l.statusSince/1e3);d<1.4?u=l.target*(1+.45*Math.sin(d*44)):u=l.target*Math.max(0,1-(d-1.4)/2.2)*.22}const c=u>l.energy?2.6:1.1;l.energy+=(u-l.energy)*(1-Math.exp(-c*i)),l.energy<5e-4&&u===0&&(l.energy=0),l.extent+=(l.toExtent-l.extent)*(1-Math.exp(-3*i))}for(const l of this.plinthRuntime.values()){const u=l.target>l.presence?1.8:.9;l.presence+=(l.target-l.presence)*(1-Math.exp(-u*i)),l.presence<5e-4&&l.target===0&&(l.presence=0);const c=1-Math.exp(-3*i);l.x+=(l.toX-l.x)*c,l.y+=(l.toY-l.y)*c,l.extentX+=(l.toExtentX-l.extentX)*c,l.extentY+=(l.toExtentY-l.extentY)*c}}packStatics(){const{masses:i,couplings:s,strata:l}=this.landscape;this.massIndex.clear(),this.massArr.fill(0),this.massCount=Math.min(i.length,f0);for(let u=0;u<this.massCount;u++){const c=i[u];this.massIndex.set(c.id,u);const d=u*12;this.massArr[d+0]=c.x,this.massArr[d+1]=c.y,this.massArr[d+2]=c.extentX,this.massArr[d+3]=c.extentY;const h=c.extentX/300;this.massArr[d+4]=72*h,this.massArr[d+5]=27*h,this.massArr[d+6]=30*h,this.massArr[d+7]=.34+c.seed*.12,this.massArr[d+8]=c.seed*Math.PI*2;const m=x0[c.kind]??x0.laptop;this.massArr[d+9]=m[0],this.massArr[d+10]=m[1],this.massArr[d+11]=m[2]}this.massBuf.write(this.massArr),this.coupArr.fill(0),this.couplingCount=0;for(const u of s){if(this.couplingCount>=h0)break;const c=this.massIndex.get(u.fromMassId),d=this.massIndex.get(u.toMassId);if(c===void 0||d===void 0)continue;const h=this.couplingCount*4;this.coupArr[h+0]=c,this.coupArr[h+1]=d,this.coupArr[h+2]=u.energy,this.couplingCount++}this.coupBuf.write(this.coupArr),this.strataArr.fill(0),this.strataCount=Math.min(l.length,S0);for(let u=0;u<this.strataCount;u++){const c=l[u],d=u*4;this.strataArr[d+0]=c.startFraction,this.strataArr[d+1]=c.endFraction,this.strataArr[d+2]=Math.min(c.lane,this.massCount-1),this.strataArr[d+3]=b0[c.status]}this.strataBuf.write(this.strataArr)}packDisturbances(){this.distArr.fill(0);let i=0;for(const s of this.landscape.disturbances){if(i>=d0)break;const l=this.runtime.get(s.id),u=l?l.energy:s.energy;if(u<=5e-4)continue;const c=l?l.extent:s.extent,d=30+c*44,h=d*(.62+.22*c),m=i*12;this.distArr[m+0]=s.x,this.distArr[m+1]=s.y,this.distArr[m+2]=d,this.distArr[m+3]=h*u,this.distArr[m+4]=.9+s.rate*1.15,this.distArr[m+5]=s.phase,this.distArr[m+6]=b0[s.status],this.distArr[m+7]=u,this.distArr[m+8]=s.articulation,this.distArr[m+9]=s.shoulder,i++}this.disturbanceCount=i,this.distBuf.write(this.distArr)}packPlinths(){this.plinthArr.fill(0);const i=[];let s=0;for(const[l,u]of this.plinthRuntime){if(s>=lf)break;if(u.presence<=5e-4)continue;const c=this.plinthStatics.get(l);if(!c)continue;const d=s*12;this.plinthArr[d+0]=u.x,this.plinthArr[d+1]=u.y,this.plinthArr[d+2]=u.extentX,this.plinthArr[d+3]=u.extentY,this.plinthArr[d+4]=u.presence,this.plinthArr[d+5]=c.articulation,this.plinthArr[d+7]=c.empty?1:0,this.plinthArr[d+8]=c.shoulder,i.push({id:l,parentId:c.parentId}),s++}for(let l=0;l<i.length;l++){const u=i[l].parentId,c=u?i.findIndex(d=>d.id===u):-1;this.plinthArr[l*12+6]=c+1,this.plinthArr[l*12+9]=c>=0?1:0}this.plinthCount=s,this.plinthBuf.write(this.plinthArr)}packParams(i,s,l,u){const c=this.params,d=An(this.camera,this.view);c[0]=this.rect.x0,c[1]=this.rect.y0,c[2]=this.rect.x1,c[3]=this.rect.y1,c[4]=this.view.width,c[5]=this.view.height,c[6]=d,c[7]=this.simTime,c[8]=this.massCount,c[9]=this.disturbanceCount,c[10]=this.couplingCount,c[11]=s;const h=Pn[u]??Pn[0];c[12]=h.rows,c[13]=h.step,c[14]=h.amp,c[15]=h.alpha,c[16]=h.lw,c[17]=h.dz,c[18]=h.px,c[19]=1,c[20]=this.colsFor(h.step,d),c[21]=this.rowsFor(h.rows,d),c[22]=Math.max(1,this.massCount),c[23]=this.plinthCount,c[24]=h.fill[0]/255*h.fill[3],c[25]=h.fill[1]/255*h.fill[3],c[26]=h.fill[2]/255*h.fill[3],c[27]=h.fill[3],c[28]=l.x0,c[29]=l.y0,c[30]=l.x1,c[31]=l.y1;const m=i>=Ji?DA[u]??0:0;c[32]=this.probe?.debug.fillReach??m,c[33]=0,c[34]=0,c[35]=0,this.paramsBufs[i].write(c)}colsFor(i,s){const l=i/s,u=this.rect.x1-this.rect.x0+l*4;return Math.max(2,Math.min(1024,Math.ceil(u/l)))}rowsFor(i,s){const l=i/s,c=Math.min(this.rect.y1,832)+90/s-(this.rect.y0-l*.6);return Math.max(2,Math.min(512,Math.ceil(c/l)))}renderOnce(i){this.renderFrame(Math.min(.25,i))}async debugField(){const i=await this.fieldTarget.readFloats();let s=1/0,l=-1/0,u=0;for(let c=0;c<i.length;c+=4){const d=i[c];Number.isNaN(d)?u++:(d<s&&(s=d),d>l&&(l=d))}return{min:s,max:l,nan:u,sample:Array.from(i.slice(0,16))}}stats(){return{runtimeEntries:this.runtime.size,disturbances:this.disturbanceCount,plinths:this.plinthCount,strata:this.strataCount,couplings:this.couplingCount,instances:this.lastInstances}}renderFrame(i){if(this.disposed)return;const s=performance.now();if(this.simTime+=i,mr(this.camera),this.headless){const[z,k]=this.output.size;this.view.width=z,this.view.height=k}else{const z=this.canvas;if(z&&(z.clientWidth===0||z.clientHeight===0)){this.perf.resetPacing(),this.lastDrawnAt=0;return}const[k,K]=this.cssSize();if(k!==this.view.width||K!==this.view.height){this.view.width=k,this.view.height=K;const B=Math.min(this.maxDpr,globalThis.devicePixelRatio||1);this.canvas.width=Math.round(k*B),this.canvas.height=Math.round(K*B),this.surf?.resize([k,K]);const[F,H]=this.fieldSize();this.fieldTarget.resize([F,H]),this.probe&&(this.probe.canvasResizes++,this.probe.note(`canvas ${k}×${K} css → ${z?.width}×${z?.height}, field ${F}×${H}`))}}xA(this.camera,this.view,this.rect),this.stepPhysics(i),this.landscapeDirty&&(this.packStatics(),this.landscapeDirty=!1),this.packDisturbances(),this.packPlinths();const l=(this.rect.x1-this.rect.x0)*.12,u=(this.rect.y1-this.rect.y0)*.16,c={x0:this.rect.x0-l,y0:this.rect.y0-u,x1:this.rect.x1+l,y1:this.rect.y1+u},d=An(this.camera,this.view);this.packParams(w0,i,sr,0),this.packParams(E0,i,c,0);for(let z=0;z<Pn.length;z++)this.packParams(Ji+z,i,c,z);const h=this.probe?this.probe.debug:null,m=h&&(h.skipFill||h.skipLine)?this.sheetVariantDraw(h):this.sheetDraw,g=this.probe?performance.now():0;let x=0;const b=[];OT(this.gpu,z=>{h?.skipResidue||(this.residueFx.set({prevTex:this.residue.read}),z.pass(this.spans?{target:this.residue.write,clear:!1,timer:this.spans.residue}:{target:this.residue.write,clear:!1},this.residueFx),x++),h?.skipField||(this.fieldFx.set({residueTex:this.residue.write}),z.pass(this.spans?{target:this.fieldTarget,clear:!0,timer:this.spans.field}:{target:this.fieldTarget,clear:!0},this.fieldFx),x++);let k=0;const K=(F,H)=>{const Z=Pn[H],de=this.colsFor(Z.step,d),M=this.rowsFor(Z.rows,d),E=de*M*2;this.probe&&b.push({cols:de,rows:M,instances:E}),!(h&&!h.layers[H])&&(k+=E,m.set({P:this.paramsBufs[Ji+H]}),F.draw(m,{instances:E}))},B=[.024,.027,.035,1];if(h?.splitLayers&&this.layerSpans.length===Pn.length){for(let F=0;F<Pn.length;F++)z.pass(F===0?{target:this.output,clear:B,timer:this.layerSpans[F]}:{target:this.output,clear:!1,timer:this.layerSpans[F]},H=>K(H,F)),x++;z.pass(this.spans?{target:this.output,clear:!1,timer:this.spans.overlay}:{target:this.output,clear:!1},F=>{this.strataCount>0&&!h?.skipStrata&&F.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!h?.skipCores&&F.draw(this.coresDraw,{instances:this.disturbanceCount})}),x++}else z.pass(this.spans?{target:this.output,clear:B,timer:this.spans.sheet}:{target:this.output,clear:B},F=>{for(let H=0;H<Pn.length;H++)K(F,H);this.strataCount>0&&!h?.skipStrata&&F.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!h?.skipCores&&F.draw(this.coresDraw,{instances:this.disturbanceCount})}),x++;this.lastInstances=k+this.strataCount+this.disturbanceCount}),this.residue.swap(),this.dirty=!1;const D=this.probe?performance.now():0;if(!h?.skipSubscribers)for(const z of this.frameSubscribers)z(this.view);const V=performance.now(),L=this.lastDrawnAt>0?s-this.lastDrawnAt:0;if(this.lastDrawnAt=s,this.perf.sample(s,V-s,this.disturbanceCount),this.probe&&(this.probe.noteFrame({interval:L,stride:this.lastStride,prep:g-s,encode:D-g,post:V-D,total:V-s}),this.captureScene(x,b)),this.perf.wantsResize()){const[z,k]=this.fieldSize(),[K,B]=this.fieldTarget.size;(z!==K||k!==B)&&(this.fieldTarget.resize([z,k]),this.probe&&(this.probe.fieldResizes++,this.probe.note(`field texture ${K}×${B} → ${z}×${k} (scale ${this.perf.resolutionScale.toFixed(2)})`)))}}sheetVariantDraw(i){const s=`${i.skipFill?"F":""}${i.skipLine?"L":""}`;let l=this.sheetVariants.get(s);return!l&&this.probe&&(l=Bl(this.gpu,{shader:this.probe.sheetVariant(m0,{skipFill:i.skipFill,skipLine:i.skipLine}),vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[Ji],massData:this.massBuf,fieldTex:this.fieldTarget,fieldSamp:this.linearSampler}}),this.sheetVariants.set(s,l),this.probe.note(`sheet variant '${s}' compiled`)),l??this.sheetDraw}captureScene(i,s){if(!this.probe)return;const l=this.view.width,u=this.view.height,c=this.canvas?.width??this.output.size[0],d=this.canvas?.height??this.output.size[1],h=An(this.camera,this.view);let m=0;for(let x=0;x<Pn.length;x++){const D=Pn[x].rows/h,V=this.rect.y0-D*.6,L=s[x]?.rows??0;for(let z=0;z<L;z++){const k=(V+z*D-this.rect.y0)*h;k<u&&(m+=(u-Math.max(0,k))/u)}}let g=0;for(const x of s)g+=x.instances;this.probe.scene={cssW:l,cssH:u,canvasW:c,canvasH:d,dpr:this.surf?.dpr??1,devicePixelRatio:globalThis.devicePixelRatio??1,resolutionScale:this.perf.resolutionScale,fieldW:this.fieldTarget.size[0],fieldH:this.fieldTarget.size[1],zoom:this.camera.zoom,masses:this.massCount,disturbances:this.disturbanceCount,plinths:this.plinthCount,couplings:this.couplingCount,strata:this.strataCount,runtimeEntries:this.runtime.size,layers:s,instances:g+this.strataCount+this.disturbanceCount,passes:i,fillOverdraw:m,fillFragments:m*c*d}}dispose(){this.stop(),this.disposed=!0,this.runtime.clear(),this.plinthRuntime.clear(),this.plinthStatics.clear(),this.massIndex.clear(),this.frameSubscribers.clear(),this.gpuTimer?.dispose(),this.gpuTimer=null,this.probe?.dispose(),this.gpu?.dispose()}}function _A(n,i=2e3){return n.clientWidth>0&&n.clientHeight>0?Promise.resolve():new Promise(s=>{let l=!1;const u=()=>{l||(l=!0,c.disconnect(),clearTimeout(d),s())},c=new ResizeObserver(()=>{n.clientWidth>0&&n.clientHeight>0&&u()});c.observe(n);const d=setTimeout(u,i)})}const q={bg:"#050608",ink:"#e6e3db",accent:"#d9a441",accentBright:"#f0c374",hoverInk:"#f5cf8b",panel:"rgba(7,8,11,0.94)",panelBorder:"rgba(230,227,219,0.4)",hairline:"rgba(230,227,219,0.14)",chrome:"rgba(230,227,219,0.62)",chromeDim:"rgba(230,227,219,0.4)",chromeMid:"rgba(230,227,219,0.7)",chromeStrong:"rgba(230,227,219,0.82)",body:"rgba(230,227,219,0.88)"},at={running:"rgba(240,195,116,0.85)",waiting:"rgba(150,175,196,0.85)",failed:"rgba(206,104,90,0.9)",completed:"rgba(180,210,175,0.75)",idle:"rgba(230,227,219,0.62)"},Et="'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",Za="0 0 6px rgba(5,6,8,0.95)",UA={backgroundImage:"radial-gradient(rgba(230,227,219,0.05) 0.5px, rgba(0,0,0,0) 0.6px)",backgroundSize:"3px 3px"},NA={background:"radial-gradient(96% 82% at 44% 56%, rgba(0,0,0,0) 42%, rgba(3,3,5,0.9) 100%)"},kA={background:"linear-gradient(to bottom, rgba(6,8,11,0.7), rgba(6,8,11,0))"};let $c=Promise.resolve();function LA({landscape:n,onHover:i,onSelect:s,anchor:l,children:u,onBand:c,onReady:d,depth:h,overlay:m,inset:g,keepVisible:x,compact:b=!1}){const D=Q.useRef(null),V=Q.useRef(null),L=Q.useRef(null),z=Q.useRef({...g0}),k=Q.useRef(n),K=Q.useRef(new Map),B=Q.useRef(null),F=Q.useRef(null),H=Q.useRef(null),Z=Q.useRef(null),de=Q.useRef(null),M=Q.useRef(new Map),E=Q.useRef(null),G=Q.useRef({key:"",w:0,h:0,label:!1}),[W,te]=Q.useState("init"),[le,$e]=Q.useState(null),[he,re]=Q.useState("environment"),[R,Y]=Q.useState([]),[ae,Ae]=Q.useState("grab");k.current=n,Q.useEffect(()=>{const ee=V.current;if(!ee)return;let J=!1,ye=null;const Ce=$c.then(async()=>{if(!J){if(ye=new zA({canvas:ee,camera:z.current}),await ye.init(),J){ye.dispose(),ye=null;return}L.current=ye,ye.setLandscape(k.current),ye.start(),te("ready"),d?.(ye)}}).catch(Ke=>{J||($e(Ke instanceof Error?Ke.message:String(Ke)),te("failed"))});return $c=Ce,()=>{J=!0,L.current=null,$c=Ce.then(()=>{ye?.dispose(),ye=null})}},[]),Q.useEffect(()=>{L.current?.setLandscape(n)},[n]),Q.useEffect(()=>{const ee=[];for(const J of n.masses)ee.push({id:`mass:${J.id}`,wx:J.x,wy:J.y+J.extentY+26,text:J.name,color:"rgba(230,227,219,0.78)",size:10});if(he==="proximity"){for(const J of n.disturbances)J.energy<.02&&J.status!=="completed"||ee.push({id:`dist:${J.id}`,wx:J.x,wy:J.y-30-J.extent*40,text:`${J.label} · ${J.status}`,color:at[J.status],size:9});for(const J of n.plinths)ee.push({id:`plinth:${J.id}`,wx:J.x,wy:J.y-J.extentY-16,text:`${J.parentId?"└ ":""}${J.label}${J.observers>1?` · ${J.observers} obs`:""}`,color:`rgba(240,195,116,${(.16+.5*J.articulation).toFixed(2)})`,size:9})}Y(ee)},[n,he]),Q.useLayoutEffect(()=>{const ee=L.current;if(!ee)return;let J=0;const ye=Ce=>{const Ke=z.current,Qe=performance.now(),Xt=J===0?1/60:Math.min(.1,(Qe-J)/1e3);J=Qe,Z.current&&(SA(Ke,Z.current,Xt)&&(Z.current=null),ee.noteInteraction());const Ve=vA(Re.current,Ke.zoom);Ve!==Re.current&&(Re.current=Ve,re(Ve),c?.(Ve));for(const[Tt,ft]of K.current){const He=N.current.get(Tt);if(!He)continue;const[St,tt]=Bc(He.wx,He.wy,Ke,Ce),_i=St>-200&&St<Ce.width+200&&tt>-80&&tt<Ce.height+80;ft.style.visibility=_i?"visible":"hidden",ft.style.transform=`translate3d(${St}px, ${tt}px, 0) translate(-50%, -100%)`}const dn=B.current,xt=w.current;if(dn&&xt){const[Tt,ft]=Bc(xt.x,xt.y,Ke,Ce),He=dn.firstElementChild;He&&G.current.key!==xt.id&&(G.current={key:xt.id,w:He.offsetWidth,h:He.offsetHeight,label:He.dataset.anchorPlacement==="label"});const{w:St,h:tt,label:_i}=G.current;let Ui=_i?-St/2:18,ls=_i?-tt-14:-tt/2;!_i&&Tt+Ui+St>Ce.width-12&&(Ui=-St-18),Ui=Math.max(12-Tt,Ui),ls=Math.min(Math.max(12-ft,ls),Ce.height-12-tt-ft),dn.style.transform=`translate3d(${Tt+Ui}px, ${ft+ls}px, 0)`,dn.style.visibility=Tt>-300&&Tt<Ce.width+300&&ft>-300&&ft<Ce.height+300?"visible":"hidden"}const kt=Ke.cy+Ce.height/An(Ke,Ce)/2,Dn=kt>wn.strataTop+40,la=kt>wn.strataTop+wn.strataHeight*.7,Rn=F.current,zi=Rn?.querySelector("[data-depth-label]");if(zi){const Tt=Dn?la?"FIELD — TODAY":"FIELD — SURFACE + TODAY":"FIELD — LIVE";zi.textContent!==Tt&&(zi.textContent=Tt)}if(Rn){const Tt=Rn.querySelector("[data-depth-summary]"),ft=Rn.querySelector("[data-depth-deep]");if(Tt&&(Tt.style.display=Dn?"inline-flex":"none"),ft){const He=ft.dataset.depthSuppressed==="true";ft.style.display=la&&!He?"block":"none"}}};return ee.onFrame(ye)},[W,c]);const Re=Q.useRef("environment"),w=Q.useRef(null),N=Q.useRef(new Map);w.current=l,Q.useEffect(()=>{N.current=new Map(R.map(ee=>[ee.id,ee]))},[R]);const X=Q.useCallback(()=>{const ee=D.current;return{width:ee?.clientWidth??1,height:ee?.clientHeight??1}},[]),P=g?.right??0,ue=g?.bottom??0,fe=x?.id??null,me=x?.x??0,Ze=x?.y??0;Q.useEffect(()=>{const ee=L.current;if(!ee||!fe||P===0&&ue===0)return;const J=X(),ye={...Z.current??z.current},Ce=An(ye,J);if(Ce<=0)return;const[Ke,Qe]=Bc(me,Ze,ye,J);let Xt=!1;if(P>0){const Ve=J.width-P-40;Ke>Ve&&(ye.cx+=(Ke-(J.width-P)/2)/Ce,Xt=!0)}if(ue>0){const Ve=J.height-ue-40;Qe>Ve&&(ye.cy+=(Qe-(Ve-60))/Ce,Xt=!0)}Qe<70&&(ye.cy-=(110-Qe)/Ce,Xt=!0),Xt&&(Z.current=mr(ye),ee.noteInteraction())},[fe,me,Ze,P,ue,X]);const De=Q.useCallback(ee=>{const J=D.current.getBoundingClientRect();return[ee.clientX-J.left,ee.clientY-J.top]},[]),gn=Q.useCallback(ee=>{const J=L.current;if(!J)return;const[ye,Ce]=De(ee);Z.current=null,ee.ctrlKey||ee.metaKey?Gc(z.current,Math.exp(-ee.deltaY*.012),ye,Ce,X()):y0(z.current,ee.deltaX,ee.deltaY,X()),J.noteInteraction()},[De,X]);Q.useEffect(()=>{const ee=D.current;if(!ee)return;const J=ye=>ye.preventDefault();return ee.addEventListener("wheel",J,{passive:!1}),()=>ee.removeEventListener("wheel",J)},[]);const Jn=Q.useCallback(ee=>{const J=De(ee);ee.isPrimary&&M.current.clear(),M.current.set(ee.pointerId,J),Z.current=null;try{D.current?.setPointerCapture(ee.pointerId)}catch{}if(M.current.size===1)H.current={x:J[0],y:J[1],moved:!1},Ae("grabbing");else if(M.current.size===2){const[ye,Ce]=[...M.current.values()];E.current={distance:Math.hypot(ye[0]-Ce[0],ye[1]-Ce[1]),zoom:z.current.zoom},H.current=null}L.current?.noteInteraction()},[De]),Mt=Q.useCallback(ee=>{const J=L.current;if(!J)return;const ye=De(ee),Ce=M.current.has(ee.pointerId);Ce&&M.current.set(ee.pointerId,ye);const Ke=E.current;if(Ke&&M.current.size>=2){const[xt,kt]=[...M.current.values()],Dn=Math.hypot(xt[0]-kt[0],xt[1]-kt[1]),la=(xt[0]+kt[0])/2,Rn=(xt[1]+kt[1])/2,zi=Ke.zoom*(Dn/Math.max(12,Ke.distance));Gc(z.current,zi/z.current.zoom,la,Rn,X()),J.noteInteraction();return}const Qe=H.current;if(Ce&&Qe){const xt=ye[0]-Qe.x,kt=ye[1]-Qe.y;(Math.abs(xt)>4||Math.abs(kt)>4)&&(Qe.moved=!0),y0(z.current,-xt,-kt,X()),Qe.x=ye[0],Qe.y=ye[1],J.noteInteraction();return}if(ee.pointerType==="touch")return;const[Xt,Ve]=of(ye[0],ye[1],z.current,X()),dn=Ym(k.current,Xt,Ve);Ae(dn?"pointer":"grab"),(dn||de.current)&&J.noteInteraction(),de.current=dn,i(dn)},[De,i,X]),Mn=Q.useCallback(ee=>{const J=M.current.get(ee.pointerId)??De(ee);M.current.delete(ee.pointerId),M.current.size<2&&(E.current=null);const ye=H.current;if(H.current=null,Ae("grab"),!ye||ye.moved)return;const[Ce,Ke]=of(J[0],J[1],z.current,X()),Qe=Ym(k.current,Ce,Ke);if(s(Qe),Qe&&Qe.kind!=="stratum"){const Xt=Qe.kind==="mass"?uf:uf+.5;Z.current=wA(Qe.x,Qe.y,Math.max(z.current.zoom,Xt))}L.current?.noteInteraction()},[De,s,X]),be=Q.useCallback(()=>{H.current=null,E.current=null,M.current.clear(),Ae("grab")},[]),yn=Q.useCallback(()=>{Z.current={...g0},L.current?.noteInteraction(),s(null)},[s]),fn=Q.useCallback(ee=>{const J=X();Gc(z.current,ee,J.width/2,J.height/2,J),L.current?.noteInteraction()},[X]);return v.jsxs("div",{style:{position:"relative",flex:1,minHeight:0},children:[v.jsxs("div",{ref:D,onWheel:gn,onPointerDown:Jn,onPointerMove:Mt,onPointerUp:Mn,onPointerCancel:Mn,onLostPointerCapture:ee=>{M.current.delete(ee.pointerId),M.current.size<2&&(E.current=null)},onPointerLeave:ee=>{ee.pointerType!=="touch"&&(be(),i(null))},style:{position:"absolute",inset:0,overflow:"hidden",background:q.bg,cursor:ae},children:[v.jsx("canvas",{ref:V,style:{display:"block",width:"100%",height:"100%"}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...UA}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...NA}}),v.jsx("div",{style:{position:"absolute",left:0,right:0,top:0,height:"16%",pointerEvents:"none",...kA}}),v.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[R.map(ee=>v.jsx("div",{ref:J=>{J?K.current.set(ee.id,J):K.current.delete(ee.id)},style:{position:"absolute",left:0,top:0,willChange:"transform",visibility:"hidden",fontFamily:Et,fontSize:ee.size,letterSpacing:"0.22em",color:ee.color,whiteSpace:"nowrap",textTransform:"uppercase"},children:ee.text},ee.id)),l&&v.jsx("div",{ref:B,style:{position:"absolute",left:0,top:0,willChange:"transform",visibility:"hidden",pointerEvents:"auto"},children:u})]}),m&&v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:m}),h&&v.jsx("div",{ref:F,style:{position:"absolute",inset:0,pointerEvents:"none"},children:h}),W==="failed"&&v.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",fontFamily:Et,fontSize:11,letterSpacing:"0.18em",color:at.failed,textAlign:"center",padding:40},children:v.jsxs("div",{children:[v.jsx("div",{children:"FIELD UNAVAILABLE — WEBGPU DID NOT START"}),v.jsx("div",{style:{marginTop:10,color:q.chrome,letterSpacing:"0.08em"},children:le})]})})]}),v.jsx(jA,{onSurface:yn,onZoom:fn,compact:b})]})}function jA({onSurface:n,onZoom:i,compact:s}){if(s)return v.jsx("div",{style:{position:"absolute",right:14,bottom:18},children:v.jsx("button",{onClick:n,style:{width:52,height:52,borderRadius:"50%",background:"rgba(7,8,11,0.9)",border:"1px solid rgba(230,227,219,0.5)",color:q.ink,fontFamily:Et,fontSize:8.5,letterSpacing:"0.1em",cursor:"pointer"},children:"SURF"})});const l={background:"transparent",border:`1px solid ${q.chromeDim}`,color:q.chromeStrong,fontFamily:Et,fontSize:10,letterSpacing:"0.14em",padding:"7px 12px",cursor:"pointer"};return v.jsxs("div",{style:{position:"absolute",right:16,bottom:16,display:"flex",gap:8},children:[v.jsx("button",{style:l,onClick:()=>i(1.35),"aria-label":"Zoom in",children:"+"}),v.jsx("button",{style:l,onClick:()=>i(1/1.35),"aria-label":"Zoom out",children:"−"}),v.jsx("button",{style:l,onClick:n,children:"SURFACE"})]})}const D0="(no model)";function sn({name:n,value:i,measure:s,accent:l,note:u}){const c=s?.basis==="inferred";return v.jsxs("div",{title:c?s?.assumption:void 0,style:{display:"flex",flexDirection:"column",gap:5,padding:"12px 0",borderTop:`1px solid ${q.hairline}`,cursor:c?"help":"default"},children:[v.jsxs("div",{style:{fontSize:9.5,letterSpacing:"0.22em",color:q.chrome,display:"flex",alignItems:"baseline",gap:6},children:[n,c&&v.jsx("span",{style:{color:q.chromeDim,letterSpacing:"0.1em"},children:"inferred"})]}),v.jsx("div",{style:{fontSize:21,letterSpacing:"0.02em",color:l??q.ink,fontVariantNumeric:"tabular-nums"},children:i}),u&&v.jsx("div",{style:{fontSize:9.5,color:q.chromeDim},children:u})]})}function ea({title:n,children:i}){return v.jsxs("div",{style:{marginTop:40},children:[v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:q.chrome},children:n}),v.jsx("div",{style:{marginTop:12},children:i})]})}function ev({fraction:n,color:i}){return v.jsx("div",{style:{height:3,background:"rgba(230,227,219,0.08)",width:"100%"},children:v.jsx("div",{style:{height:"100%",width:`${Math.max(.5,Math.min(1,n)*100)}%`,background:i}})})}function BA(n){if(n.medianTokens===void 0)return{text:"no token accounting",title:"No run in this group reports token accounting, so there is no figure — not a figure of zero.",absent:!0};if(n.medianRuns===1)return{text:`single run ${ot(n.medianTokens)}`,title:"One eligible run, so this is that run's figure, not a median. Same window as the rest of TODAY.",absent:!1};const i=n.medianRuns===n.runs?`${n.runs}`:`${n.medianRuns} of ${n.runs}`;return{text:`median ${ot(n.medianTokens)} over ${i} runs`,title:`Median billed tokens per run, over the runs in this group that have ended and whose source reports token accounting — ${n.medianRuns} of ${n.runs} here. Runs still in flight are excluded: their totals are partial. Runs whose source persists no accounting are excluded: absence is not zero. Same window as the rest of TODAY.`,absent:!1}}function Vc({rows:n,max:i,label:s,color:l,median:u=!1}){return v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:n.map(c=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,fontSize:11,fontVariantNumeric:"tabular-nums"},children:[v.jsx("span",{style:{color:q.body},children:s(c.key)}),v.jsxs("span",{style:{color:q.chromeMid},children:[c.runs," ",c.runs===1?"run":"runs",c.tokenRuns>0?` · ${ot(c.tokens)} tok`:""," · ",Ye(c.computeMs),c.failed>0&&v.jsxs("span",{style:{color:at.failed},children:[" · ",c.failed," failed"]})]})]}),v.jsx(ev,{fraction:i>0?c.computeMs/i:0,color:l}),u&&(()=>{const d=BA(c);return v.jsx("div",{title:d.title,style:{fontSize:9.5,letterSpacing:"0.06em",color:d.absent?q.chromeDim:q.chrome,cursor:"help",fontVariantNumeric:"tabular-nums"},children:d.text})})()]},c.key))})}function GA({world:n}){const i=Q.useMemo(()=>$0(n),[n]),s=Q.useMemo(()=>I0(n,i),[n,i]),l=Q.useMemo(()=>Fx(n),[n]),u=Q.useMemo(()=>Hx(n),[n]),c=Q.useMemo(()=>qx(n),[n]),d=Q.useMemo(()=>Yx(n),[n]),h=Q.useMemo(()=>Oc(n,(B,F)=>F?.context),[n]),m=Q.useMemo(()=>Oc(n,B=>B.model??D0),[n]),g=Q.useMemo(()=>Oc(n,B=>B.machineId),[n]),x=Q.useMemo(()=>[...n.executions.values()].filter(B=>B.status==="failed").sort((B,F)=>F.startedAt-B.startedAt),[n]),b=i.longestFocus.value,D=Q.useMemo(()=>[...n.executions.values()].filter(B=>on(B.measures)===void 0).length,[n]),V=h[0]?.computeMs??0,L=m[0]?.computeMs??0,z=g[0]?.computeMs??0,k=d.reduce((B,F)=>F.computeMs>B.computeMs?F:B,d[0]),K=[...n.executions.values()].filter(B=>B.depth>0).length;return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"28px 48px 80px",fontFamily:Et,color:q.ink},children:[v.jsxs("div",{style:{marginBottom:34,maxWidth:900},children:[v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:q.chrome},children:"WORK SHAPE"}),v.jsx("div",{style:{fontSize:34,letterSpacing:"0.08em",marginTop:10,color:q.accentBright},children:s.headline}),v.jsx("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:7},children:s.clauses.map(B=>v.jsx("div",{style:{fontSize:12,lineHeight:1.65,color:q.body,letterSpacing:"0.02em"},children:B},B))})]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:"0 40px"},children:[v.jsx(sn,{name:"REQUESTS",value:ot(i.requests.value),measure:i.requests}),v.jsx(sn,{name:"RUNS",value:String(i.executions.value),measure:i.executions,note:K>0?`${K} of them sub-agents`:void 0}),v.jsx(sn,{name:"SESSIONS",value:String(i.sessions.value),measure:i.sessions}),v.jsx(sn,{name:"TOKENS",value:ot(i.tokens.value),measure:i.tokens,note:`${Math.round(l.cacheRead/Math.max(1,l.total)*100)}% cache reads`+(D>0?` · ${D} ${D===1?"run reports":"runs report"} no accounting`:"")}),v.jsx(sn,{name:"TOOL CALLS",value:ot(c.toolCalls),measure:i.toolCalls,note:c.toolErrors>0?`${c.toolErrors} failed`:void 0}),v.jsx(sn,{name:"AUTONOMOUS COMPUTE",value:Ye(i.autonomousCompute.value),measure:i.autonomousCompute}),v.jsx(sn,{name:"HUMAN + AGENT OVERLAP",value:Ye(i.humanAgentOverlap.value),measure:i.humanAgentOverlap,note:`${Math.round(i.humanAgentOverlap.value/Math.max(1,i.autonomousCompute.value)*100)}% of compute`}),v.jsx(sn,{name:"PEAK CONCURRENCY",value:i.peakConcurrency.value>0?`${i.peakConcurrency.value} · ${Ja(i.peakConcurrencyAt.value)}`:"0",measure:i.peakConcurrency}),v.jsx(sn,{name:"CONTEXT SWITCHES",value:String(i.contextSwitches.value),measure:i.contextSwitches,note:`across ${h.length} ${h.length===1?"context":"contexts"}`}),v.jsx(sn,{name:"LONGEST FOCUS",value:b?Ye(b.end-b.start):"—",measure:i.longestFocus,note:b?`${ur(b.context)} · ${Ja(b.start)}–${Ja(b.end)}`:void 0}),v.jsx(sn,{name:"WAITING ON YOU",value:Ye(i.waitingOnYou.value),measure:i.waitingOnYou,accent:i.waitingOnYou.value>0?at.waiting:void 0,note:u.count>0?`${u.count} ${u.count===1?"block":"blocks"} · longest ${Ye(u.longestMs)}`:void 0}),v.jsx(sn,{name:"FAILED",value:String(c.failed),accent:c.failed>0?at.failed:void 0,note:c.interrupted>0||c.retries>0?`${c.interrupted} stopped · ${c.retries} retries`:void 0})]}),d.length>0&&v.jsxs(ea,{title:"HOUR BY HOUR",children:[v.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:84},children:d.map((B,F)=>{const H=B.computeMs/36e5;return v.jsx("div",{title:`${String(B.hour).padStart(2,"0")}:00 — ${Ye(B.computeMs)} of compute, ${B.runs} runs, peak ${B.peak}`,style:{flex:1,minWidth:4,height:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-end"},children:v.jsx("div",{style:{height:`${Math.max(1,H*100)}%`,background:B.peak>1?"rgba(240,195,116,0.75)":"rgba(214,176,116,0.38)"}})},F)})}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:6,fontSize:9,letterSpacing:"0.16em",color:q.chromeDim},children:[v.jsxs("span",{children:[String(d[0].hour).padStart(2,"0"),":00"]}),v.jsxs("span",{children:["busiest ",String(k.hour).padStart(2,"0"),":00 · ",Ye(k.computeMs)," ","of that hour"]}),v.jsxs("span",{children:[String(d[d.length-1].hour).padStart(2,"0"),":00"]})]})]}),v.jsx(ea,{title:"WHERE THE TIME WENT",children:v.jsx(Vc,{rows:h,max:V,label:ur,color:"rgba(240,195,116,0.6)"})}),g.length>0&&v.jsx(ea,{title:"BY MACHINE",children:v.jsx(Vc,{rows:g,max:z,label:B=>n.machines.get(B)?.name??B,color:"rgba(168,186,150,0.6)"})}),m.length>0&&v.jsx(ea,{title:"BY MODEL",children:v.jsx(Vc,{rows:m,max:L,label:B=>B===D0?"model not observed":B,color:"rgba(150,175,196,0.6)",median:!0})}),v.jsxs(ea,{title:"TOKEN COMPOSITION",children:[v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[["CACHE READS",l.cacheRead,"rgba(150,175,196,0.6)"],["INPUT",l.input,"rgba(240,195,116,0.6)"],["OUTPUT",l.output,"rgba(180,210,175,0.7)"],["REASONING",l.reasoning,"rgba(214,176,116,0.5)"]].map(([B,F,H])=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:11,fontVariantNumeric:"tabular-nums"},children:[v.jsx("span",{style:{color:q.body},children:B}),v.jsxs("span",{style:{color:q.chromeMid},children:[ot(F)," · ",Math.round(F/Math.max(1,l.total)*100),"%"]})]}),v.jsx(ev,{fraction:F/Math.max(1,l.total),color:H})]},B))}),v.jsx("div",{style:{marginTop:12,fontSize:10,lineHeight:1.7,color:q.chromeDim},children:"Cache reads are context replayed into each request, not work generated. They dominate the total, which is why the headline token figure is much larger than it feels."})]}),x.length>0&&v.jsx(ea,{title:"FAILURES",children:v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:9},children:x.slice(0,12).map(B=>v.jsxs("div",{style:{display:"flex",gap:16,fontSize:11,borderTop:`1px solid ${q.hairline}`,paddingTop:8},children:[v.jsx("span",{style:{color:q.chromeMid,minWidth:46},children:Ja(B.startedAt)}),v.jsx("span",{style:{color:q.body,minWidth:160},children:B.label}),v.jsxs("span",{style:{color:at.failed},children:[B.failure?.code,": ",B.failure?.message]})]},B.id))})}),v.jsx($A,{})]})}function $A(){return v.jsx(ea,{title:"NOT AVAILABLE FROM THESE SOURCES",children:v.jsxs("div",{style:{maxWidth:760,fontSize:10.5,lineHeight:1.8,color:q.chromeDim},children:[v.jsx("div",{children:"COST — every source here reports tokens or CPU time; none reports money. Converting one to the other needs a price table 057 does not have, so no cost figure is shown anywhere."}),v.jsx("div",{style:{marginTop:8},children:"TOKENS, FROM SOME SOURCES — Cursor persists no usage and 0x2F records none; their runs read NOT OBSERVED rather than 0, and the token totals sum only the runs that report."}),v.jsx("div",{style:{marginTop:8},children:"MACHINE-TO-MACHINE TRANSFER — every observed source is single-host. Transfers are modelled and the field renders them, but no real adapter emits one; only the synthetic source does."}),v.jsx("div",{style:{marginTop:8},children:"PROCESS EXITS — the OS collector samples; an exit is inferred from disappearance between samples, never witnessed."}),v.jsx("div",{style:{marginTop:8},children:"OUTCOME QUALITY — the log records that a run completed, not whether the work was any good."})]})})}function VA(n,i,s){return n===void 0?i===void 0?0:1:i===void 0?-1:s==="asc"?n-i:i-n}const Ic=100,R0="58px minmax(180px,1.4fr) 104px 132px 84px 68px 76px 70px 56px",C0=4,IA=8,tv="rgba(230,227,219,0.09)",O0="rgba(230,227,219,0.55)",z0="rgba(230,227,219,0.22)",FA="Billed token volume. The rule beneath each figure places that volume on a fixed logarithmic scale from 10k to 100M; the ticks mark 100k, 1M and 10M. The scale never changes with filtering, sorting or the time window, so two runs are always comparable. A full rule with an end stop is 100M or more. An empty track is a total this source counted and found to be zero. No track at all means it reports no token accounting — which is not zero.";function HA(n){const i=(Math.log10(Math.max(n,1))-C0)/(IA-C0),s=Math.max(0,Math.min(1,i))*100;return{width:n>0?`max(2px, ${s.toFixed(1)}%)`:"0",over:i>1}}function qA({tokens:n}){const{width:i,over:s}=HA(n);return v.jsxs("div",{style:{marginTop:3,height:1,background:tv,position:"relative"},children:[v.jsx("div",{style:{height:1,width:i,background:O0}}),s&&v.jsx("div",{style:{position:"absolute",right:0,top:-2,width:1,height:5,background:O0}})]})}function YA(){return v.jsxs("div",{style:{marginTop:3,height:3,position:"relative"},children:[v.jsx("div",{style:{position:"absolute",left:0,right:0,top:1,height:1,background:tv}}),[0,25,50,75].map(n=>v.jsx("div",{style:{position:"absolute",left:`${n}%`,top:0,width:1,height:3,background:z0}},n)),v.jsx("div",{style:{position:"absolute",right:0,top:0,width:1,height:3,background:z0}})]})}function XA(n){return n.outcome==="interrupted"?"STOPPED":n.status}function KA(n){return n.outcome==="interrupted"?q.chromeMid:at[n.status]}function Mi({children:n,align:i="left",color:s}){return v.jsx("div",{style:{textAlign:i,color:s??q.chromeMid,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})}function QA({p:n,session:i,onShowInField:s}){const l=on(n.measures),u=n.startBasis==="inferred"||n.endBasis==="inferred",c=[["CONTEXT",i?i.context:"—"],["PROVIDER",n.executor],["MODEL",n.model??"not observed"],["STARTED",`${n.startBasis==="inferred"?"~":""}${new Date(n.startedAt).toLocaleTimeString()}`],["ENDED",n.endedAt?`${n.endBasis==="inferred"?"~":""}${new Date(n.endedAt).toLocaleTimeString()}`:"still open"],...l===void 0?[["TOKENS","not observed"]]:[["INPUT",ot(Wa(n.measures).input)],["OUTPUT",ot(Wa(n.measures).output)],["CACHE READ",ot(Wa(n.measures).cacheRead)],["REASONING",ot(Wa(n.measures).reasoning)]],["REQUESTS",String(ff(n))],["TOOL CALLS",es(ln(n),"not observed")]];return ia(n)>0&&c.push(["TOOL ERRORS",String(ia(n)),at.failed]),Yc(n)>0&&c.push(["PROVIDER RETRIES",String(Yc(n)),at.waiting]),(n.waits.length>0||n.waitingMs>0)&&c.push(["BLOCKED ON YOU",`${Ye(n.waitingMs)} across ${n.waits.length||1}`,at.waiting]),n.depth>0&&c.push(["SUB-AGENT",`depth ${n.depth}`]),v.jsxs("div",{style:{gridColumn:"1 / -1",display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"6px 28px",padding:"12px 0 14px 16px",borderLeft:`1px solid ${q.panelBorder}`,margin:"2px 0 6px",background:"rgba(230,227,219,0.02)"},children:[c.map(([d,h,m])=>v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12},children:[v.jsx("span",{style:{fontSize:9.5,letterSpacing:"0.16em",color:q.chrome},children:d}),v.jsx("span",{style:{fontSize:10.5,color:m??q.body,fontVariantNumeric:"tabular-nums",overflow:"hidden",textOverflow:"ellipsis"},children:h})]},d)),n.failure&&v.jsxs("div",{style:{gridColumn:"1 / -1",fontSize:10.5,color:at.failed},children:[n.failure.code,": ",n.failure.message]}),u&&n.boundsAssumption&&v.jsxs("div",{style:{gridColumn:"1 / -1",fontSize:9.5,color:q.chromeMid},children:["timing inferred — ",n.boundsAssumption]}),v.jsx("div",{style:{gridColumn:"1 / -1",marginTop:4},children:v.jsx("button",{onClick:d=>{d.stopPropagation(),s()},style:{background:"transparent",border:`1px solid ${q.hairline}`,color:q.chromeMid,fontFamily:Et,fontSize:9,letterSpacing:"0.16em",padding:"5px 10px",cursor:"pointer"},children:"SHOW IN FIELD →"})})]})}function PA({world:n,selectedId:i,onSelect:s}){const[l,u]=Q.useState("all"),[c,d]=Q.useState("time"),[h,m]=Q.useState(Ic),[g,x]=Q.useState(null),b=Q.useMemo(()=>{let k=[...n.executions.values()];l==="stopped"?k=k.filter(F=>F.outcome==="interrupted"):l!=="all"&&(k=k.filter(F=>F.status===l&&F.outcome!=="interrupted"));const K=F=>(F.endedAt??n.now)-F.startedAt,B={time:(F,H)=>H.startedAt-F.startedAt,duration:(F,H)=>K(H)-K(F),tokens:(F,H)=>VA(on(F.measures),on(H.measures),"desc"),tools:(F,H)=>(ln(H)??0)-(ln(F)??0),waited:(F,H)=>H.waitingMs-F.waitingMs};return k.sort(B[c])},[n,l,c]),D=Q.useMemo(()=>{const k={all:n.executions.size,stopped:0};for(const K of n.executions.values())K.outcome==="interrupted"?k.stopped++:k[K.status]=(k[K.status]??0)+1;return k},[n]),V=Q.useMemo(()=>{let k=0,K=0,B=0,F=0;for(const H of b)k+=on(H.measures)??0,K+=(H.endedAt??n.now)-H.startedAt,B+=ln(H)??0,F+=H.waitingMs;return{tokens:k,compute:K,tools:B,waited:F}},[b,n]),L=b.slice(0,h),z=(k,K,B="left")=>v.jsxs("div",{onClick:()=>d(k),style:{textAlign:B,cursor:"pointer",color:c===k?q.ink:q.chrome},children:[K,c===k?" ↓":""]});return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"24px 48px 80px",fontFamily:Et,color:q.ink},children:[v.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginBottom:14},children:["all","running","waiting","idle","completed","failed","stopped"].map(k=>{const K=l===k,B=D[k]??0;return v.jsxs("button",{onClick:()=>{u(k),m(Ic)},style:{background:"transparent",border:`1px solid ${K?"rgba(230,227,219,0.6)":q.hairline}`,color:K?q.ink:q.chromeMid,fontFamily:Et,fontSize:9.5,letterSpacing:"0.16em",padding:"6px 11px",cursor:"pointer",textTransform:"uppercase"},children:[k," ",B>0&&v.jsx("span",{style:{color:q.chromeDim},children:B})]},k)})}),v.jsxs("div",{style:{fontSize:10,letterSpacing:"0.12em",color:q.chromeDim,marginBottom:14,fontVariantNumeric:"tabular-nums"},children:[b.length," ",b.length===1?"run":"runs"," shown · ",ot(V.tokens)," tok ·"," ",Ye(V.compute)," of run time · ",ot(V.tools)," tool calls",V.waited>0&&` · ${Ye(V.waited)} blocked on you`]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:R0,gap:"0 14px",fontSize:9,letterSpacing:"0.18em",color:q.chrome,paddingBottom:8,borderBottom:`1px solid ${q.hairline}`,alignItems:"end"},children:[z("time","START"),v.jsx("div",{children:"RUN"}),v.jsx("div",{children:"CONTEXT"}),v.jsx("div",{children:"MODEL"}),v.jsx("div",{children:"STATUS"}),z("duration","DUR","right"),v.jsxs("div",{onClick:()=>d("tokens"),title:FA,style:{cursor:"help"},children:[v.jsxs("div",{style:{textAlign:"right",color:c==="tokens"?q.ink:q.chrome},children:["TOKENS",c==="tokens"?" ↓":""]}),v.jsx(YA,{})]}),z("waited","WAITED","right"),z("tools","TOOLS","right")]}),L.map(k=>{const K=n.sessions.get(k.sessionId),B=on(k.measures),F=k.id===i,H=g===k.id;return v.jsxs("div",{children:[v.jsxs("div",{onClick:()=>x(H?null:k.id),style:{display:"grid",gridTemplateColumns:R0,gap:"0 14px",fontSize:11,padding:"9px 0",borderBottom:"1px solid rgba(230,227,219,0.05)",cursor:"pointer",background:F||H?"rgba(240,195,116,0.07)":"transparent",fontVariantNumeric:"tabular-nums"},children:[v.jsx(Mi,{children:Ja(k.startedAt)}),v.jsxs(Mi,{color:F||H?q.accentBright:q.body,children:[k.depth>0&&v.jsx("span",{style:{color:q.chromeDim},children:"└ "}),k.label]}),v.jsx(Mi,{children:K?ur(K.context):"—"}),v.jsx(Mi,{color:k.model?void 0:q.chromeDim,children:k.model??"—"}),v.jsx("div",{style:{fontSize:9,letterSpacing:"0.14em",color:KA(k),textTransform:"uppercase"},children:XA(k)}),v.jsxs(Mi,{align:"right",children:[k.startBasis==="inferred"||k.endBasis==="inferred"?"~":"",Ye((k.endedAt??n.now)-k.startedAt)]}),v.jsxs("div",{children:[v.jsx(Mi,{align:"right",color:B===void 0?q.chromeDim:void 0,children:es(B,"—")}),B!==void 0&&v.jsx(qA,{tokens:B})]}),v.jsx(Mi,{align:"right",color:k.waitingMs>0?at.waiting:q.chromeDim,children:k.waitingMs>0?Ye(k.waitingMs):"—"}),v.jsxs(Mi,{align:"right",color:ln(k)===void 0?q.chromeDim:void 0,children:[es(ln(k),"—"),ia(k)>0&&v.jsxs("span",{style:{color:at.failed},children:[" /",ia(k)]})]})]}),H&&v.jsx(QA,{p:k,session:K,onShowInField:()=>s(k.id)})]},k.id)}),b.length===0&&v.jsx("div",{style:{padding:"28px 0",fontSize:11,color:q.chromeMid},children:"Nothing matching in this window."}),b.length>h&&v.jsxs("button",{onClick:()=>m(k=>k+Ic),style:{marginTop:18,background:"transparent",border:`1px solid ${q.hairline}`,color:q.chromeMid,fontFamily:Et,fontSize:9.5,letterSpacing:"0.16em",padding:"8px 14px",cursor:"pointer"},children:["SHOW MORE — ",b.length-h," REMAINING"]})]})}const Fc={display:"flex",flexDirection:"column",gap:5,background:q.panel,borderLeft:`1px solid ${q.panelBorder}`,padding:"9px 13px",minWidth:170,maxWidth:320,fontFamily:Et,backdropFilter:"blur(2px)"};function Ue({name:n,detail:i,color:s,title:l,tag:u}){return v.jsxs("div",{title:l,style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:16,fontSize:10.5,cursor:l?"help":void 0},children:[v.jsxs("span",{style:{color:q.chromeMid,letterSpacing:"0.1em",whiteSpace:"nowrap"},children:[n,u&&v.jsxs("span",{style:{color:q.chromeDim,letterSpacing:"0.06em"},children:[" ",u]})]}),v.jsx("span",{style:{fontSize:10,fontWeight:500,letterSpacing:"0.14em",color:s??q.chromeStrong,whiteSpace:"nowrap",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",maxWidth:190},children:i})]})}function Hc({text:n,onClose:i}){return v.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:14},children:[v.jsx("div",{style:{fontSize:10,letterSpacing:"0.18em",color:q.ink,textTransform:"uppercase"},children:n}),v.jsx("div",{onClick:i,role:"button",style:{fontSize:11,color:q.chromeMid,cursor:"pointer"},children:"×"})]})}function _f({label:n}){return v.jsx("div",{style:{marginTop:5,paddingTop:5,borderTop:"1px solid rgba(230,227,219,0.08)",fontSize:8.5,letterSpacing:"0.2em",color:q.chromeDim},children:n})}function ZA(n){if(n.basis==="measured")return{label:"recorded",grade:"recorded"};const i=n.via?.split("|")[0];return i==="agent.session"?{label:"session identity",grade:"identity"}:i==="os.process"?{label:"process identity",grade:"identity"}:i==="fs.cwd"?{label:"directory overlap",grade:"contextual"}:{label:"inferred",grade:"contextual"}}function WA(n,i){switch(i.type){case"process":{const s=n.processes.get(i.id);return s?`PID ${s.pid} · ${s.command}`:i.id}case"session":return n.sessions.get(i.id)?.label??i.id;case"execution":return n.executions.get(i.id)?.label??i.id;case"machine":return n.machines.get(i.id)?.name??i.id;default:return i.id}}const _0={"ran-as":"RAN AS","same-as":"SAME AS",spawned:"SPAWNED",contains:"CONTAINS",produced:"PRODUCED"};function U0({world:n,subject:i}){const s=n.relationships.filter(l=>l.from.type===i.type&&l.from.id===i.id||l.to.type===i.type&&l.to.id===i.id);return s.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(_f,{label:"RELATED"}),s.slice(0,6).map((l,u)=>{const c=l.from.type===i.type&&l.from.id===i.id,d=c?l.to:l.from,h=c?_0[l.kind]:l.kind==="spawned"?"SPAWNED BY":_0[l.kind],m=ZA(l);return v.jsx(Ue,{name:h,tag:m.grade==="contextual"?`${m.label} · inferred`:m.label,detail:WA(n,d),color:m.grade==="contextual"?q.chromeMid:void 0,title:l.assumption??(l.via?`via ${l.via}`:void 0)},`${l.kind}:${d.type}:${d.id}:${u}`)})]})}function JA({type:n,id:i}){const[s,l]=Q.useState(null);return Q.useEffect(()=>{let u=!1;l(null);const c=setTimeout(()=>{p1(n,i).then(({events:d})=>{u||l(eM(d))}).catch(()=>{u||l(null)})},180);return()=>{u=!0,clearTimeout(c)}},[n,i]),!s||s.facts.length===0&&!s.provenance?null:v.jsxs(v.Fragment,{children:[v.jsx(_f,{label:"NATIVE RECORD"}),s.facts.map(([u,c])=>v.jsx(Ue,{name:u,detail:c,color:q.chromeMid},u)),s.provenance&&v.jsxs("div",{title:s.provenance,style:{fontSize:8.5,letterSpacing:"0.04em",color:q.chromeDim,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"help"},children:["read from ",s.provenance]})]})}function eM(n){const i=new Map;let s;for(const u of n){for(const[c,d]of Object.entries(u.attrs??{}))!c.includes(".")||d===void 0||d===null||d===""||i.set(c,d);!s&&u.provenance?.path&&(s=u.provenance.path)}return{facts:[...i.entries()].slice(0,10).map(([u,c])=>[u,typeof c=="object"?JSON.stringify(c):String(c)]),provenance:s}}function tM({p:n,now:i}){const s=(n.endedAt??i)-n.startedAt,l=n.startBasis==="inferred",u=n.endBasis==="inferred",c=l||u;return v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"STARTED",tag:l?"inferred":void 0,detail:Ja(n.startedAt),title:l?n.boundsAssumption:void 0}),v.jsx(Ue,{name:"ELAPSED",tag:c?"inferred":void 0,detail:Ye(s),title:c?n.boundsAssumption:void 0})]})}function Uf({hit:n,world:i,landscape:s,band:l,density:u,onClose:c}){if(n.kind==="mass"){const L=i.machines.get(n.id);if(!L)return null;const z=[];let k=0,K;for(const H of i.executions.values()){if(H.machineId!==L.id)continue;const Z=on(H.measures);Z!==void 0&&(K=(K??0)+Z),H.status==="running"||H.status==="waiting"?z.push({id:H.id,label:H.label,status:H.status}):k++}const B=i.processTotals,F=new Set;for(const H of i.relationships)H.kind==="ran-as"&&(H.from.type==="process"&&F.add(H.from.id),H.to.type==="process"&&F.add(H.to.id));return v.jsxs("div",{style:Fc,children:[v.jsx(Hc,{text:L.name,onClose:c}),z.length===0?v.jsx("div",{style:{fontSize:10,color:q.chrome},children:"idle — nothing active"}):z.slice(0,8).map(H=>v.jsx(Ue,{name:H.label,detail:H.status.toUpperCase(),color:at[H.status]},H.id)),v.jsx("div",{style:{height:4}}),v.jsx(Ue,{name:"RAN TODAY",detail:String(k)}),v.jsx(Ue,{name:"TOKENS",detail:es(K),title:K===void 0?"No execution in this window reported token accounting.":void 0}),B&&v.jsxs(v.Fragment,{children:[v.jsx(_f,{label:"MACHINE STRATUM"}),v.jsx(Ue,{name:"PROCESSES OBSERVED",detail:String(B.observed)}),v.jsx(Ue,{name:"SEEN IN LAST 5 MIN",detail:String(B.recentlySeen),title:"Processes with a liveness observation in the last five minutes. The sampler only records a process when it is doing something, and never witnesses an exit — so recency is the honest liveness signal, not an unexpired status."}),v.jsx(Ue,{name:"ATTRIBUTED",detail:`${F.size} of ${B.observed}`,title:"Processes tied to a session or execution by resolved identity. The rest are machine activity with no known semantic identity — observed, not explained."}),B.exitsInferred>0&&v.jsx(Ue,{name:"EXITS",tag:"inferred",detail:String(B.exitsInferred),title:"An exit is never witnessed by the sampler; it is inferred from disappearance between samples."})]})]})}if(n.kind==="coupling"){const L=i.transfers.get(n.id);if(!L)return null;const z=i.machines.get(L.fromMachineId)?.name??L.fromMachineId,k=i.machines.get(L.toMachineId)?.name??L.toMachineId;return v.jsxs("div",{style:Fc,children:[v.jsx(Hc,{text:`${z} → ${k}`,onClose:c}),v.jsx(Ue,{name:"STATUS",detail:"TRANSFERRING",color:at.running}),v.jsx(Ue,{name:"WHAT",detail:L.label}),v.jsx(Ue,{name:"SIZE",detail:Xx(L.bytes)}),v.jsx(Ue,{name:"ELAPSED",detail:Ye(i.now-L.startedAt)})]})}const d=i.executions.get(n.id);if(!d)return null;const h=i.sessions.get(d.sessionId),m=i.machines.get(d.machineId),g=s.disturbances.find(L=>L.id===n.id),x=u==="full"||u!=="compact"&&(l==="proximity"||n.kind==="stratum"),b=x,D=on(d.measures),V=Wa(d.measures);return v.jsxs("div",{style:Fc,children:[v.jsx(Hc,{text:d.label,onClose:c}),v.jsx(Ue,{name:"STATUS",detail:d.status.toUpperCase(),color:at[d.status]}),v.jsx(Ue,{name:"MACHINE",detail:m?.name??d.machineId}),v.jsx(tM,{p:d,now:i.now}),b&&v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"TOKENS",detail:es(D),title:D===void 0?"This source does not persist token accounting.":void 0}),v.jsx(Ue,{name:"REQUESTS",detail:String(ff(d))}),v.jsx(Ue,{name:"TOOL CALLS",detail:es(ln(d)),title:ln(d)===void 0?"This source does not count discrete operations.":void 0})]}),x&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:{height:4}}),h&&v.jsx(Ue,{name:"CONTEXT",detail:ur(h.context)}),v.jsx(Ue,{name:"PROVIDER",detail:d.executor}),v.jsx(Ue,{name:"MODEL",detail:d.model??"NOT OBSERVED",color:d.model?void 0:q.chromeMid,title:d.model?void 0:"This source does not record the model."}),D!==void 0&&v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"CACHE READ",detail:ot(V.cacheRead)}),v.jsx(Ue,{name:"REASONING",detail:ot(V.reasoning)})]}),ia(d)>0&&v.jsx(Ue,{name:"TOOL ERRORS",detail:String(ia(d)),color:at.failed}),d.waitingMs>0&&v.jsx(Ue,{name:"WAITED ON YOU",detail:Ye(d.waitingMs),color:at.waiting}),d.depth>0&&v.jsx(Ue,{name:"SUB-AGENT",detail:`depth ${d.depth}`}),h?.parentId&&v.jsx(Ue,{name:"SESSION SPAWNED BY",tag:"recorded",detail:i.sessions.get(h.parentId)?.label??h.parentId,title:"The session's own runtime recorded which session started it."}),g&&v.jsx(Ue,{name:"FIELD ENERGY",detail:g.energy.toFixed(2)}),v.jsx(U0,{world:i,subject:{type:"execution",id:d.id}}),h&&v.jsx(U0,{world:i,subject:{type:"session",id:h.id}}),v.jsx(JA,{type:"execution",id:d.id})]}),d.failure&&v.jsxs("div",{style:{marginTop:4,fontSize:9.5,letterSpacing:"0.06em",color:at.failed,maxWidth:280},children:[d.failure.code,": ",d.failure.message]}),d.outcome==="interrupted"&&!d.failure&&v.jsx("div",{style:{marginTop:4,fontSize:9.5,color:q.chromeMid},children:"stopped before finishing"})]})}function nM({hit:n,world:i}){let s="",l="",u=q.chromeMid;if(n.kind==="mass")s=i.machines.get(n.id)?.name??n.id;else if(n.kind==="coupling"){const c=i.transfers.get(n.id),d=c?i.machines.get(c.fromMachineId)?.name??"":"",h=c?i.machines.get(c.toMachineId)?.name??"":"";s=`${d} → ${h}`,l="TRANSFERRING",u=at.running}else{const c=i.executions.get(n.id);if(!c)return null;s=c.label,l=c.status.toUpperCase(),u=at[c.status]}return v.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,pointerEvents:"none",whiteSpace:"nowrap",fontFamily:Et},children:[v.jsx("div",{style:{fontSize:10.5,fontWeight:500,letterSpacing:"0.18em",color:q.hoverInk,background:"rgba(5,6,8,0.88)",padding:"4px 9px"},children:s}),l&&v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.22em",color:u,textShadow:Za},children:l})]})}function iM(n){return[`${ot(n.requests.value)} REQ`,`${n.sessions.value} SESS`,`${Ye(n.autonomousCompute.value)}`,`${ot(n.tokens.value)} TOK`].join(" · ")}function aM(n){return[`${ot(n.requests.value)} REQUESTS`,`${n.sessions.value} SESSIONS`,`${Ye(n.autonomousCompute.value)} AUTONOMOUS`,`${Ye(n.humanAgentOverlap.value)} OVERLAP`,`PEAK ${n.peakConcurrency.value}`,`${n.contextSwitches.value} SWITCHES`,`${ot(n.tokens.value)} TOK`].join(" · ")}function sM({metrics:n,shape:i,compact:s=!1}){return v.jsxs("div",{style:{position:"absolute",left:20,bottom:16,right:s?82:236,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none",fontFamily:Et},children:[v.jsxs("div",{"data-depth-deep":!0,"data-depth-suppressed":s?"true":void 0,style:{display:"none",maxWidth:720,background:"linear-gradient(to right, rgba(5,6,8,0.92) 0%, rgba(5,6,8,0.86) 70%, rgba(5,6,8,0) 100%)",padding:"10px 42px 10px 0",margin:"0 0 -2px -6px",paddingLeft:6},children:[v.jsxs("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:q.chrome,textShadow:Za},children:["WORK SHAPE — ",i.headline]}),v.jsx("div",{style:{marginTop:6,display:"flex",flexDirection:"column",gap:3},children:i.clauses.slice(0,3).map(l=>v.jsx("div",{style:{fontSize:10.5,lineHeight:1.6,color:q.chromeMid,textShadow:Za},children:l},l))}),v.jsx("div",{style:{marginTop:7,fontSize:9.5,lineHeight:1.6,color:q.chromeDim,textShadow:Za,maxWidth:620},children:"NOT AVAILABLE FROM THESE SOURCES — cost (every source reports tokens or CPU time, none reports money) and machine-to-machine transfer (every observed source is single-host)."})]}),v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap",background:"linear-gradient(to right, rgba(5,6,8,0.92) 0%, rgba(5,6,8,0.86) 80%, rgba(5,6,8,0) 100%)",padding:"4px 42px 4px 6px",margin:"0 0 0 -6px"},children:[v.jsx("span",{"data-depth-label":!0,style:{fontSize:10.5,letterSpacing:"0.18em",color:"rgba(230,227,219,0.74)",textShadow:Za},children:"FIELD — LIVE"}),v.jsxs("span",{"data-depth-summary":!0,style:{display:"none",alignItems:"baseline",gap:10},children:[v.jsx("span",{style:{color:q.chromeDim},children:"·"}),v.jsx("span",{style:{fontSize:10.5,letterSpacing:"0.18em",color:"rgba(230,227,219,0.6)",textShadow:Za},children:s?iM(n):aM(n)})]})]})]})}const rM=560;function N0(n,i,s){return Math.min(n,i)<rM||s?i>=n?"portrait":"landscape":"desktop"}function lM(){const[n,i]=Q.useState(()=>typeof window>"u"?"desktop":N0(window.innerWidth,window.innerHeight,window.matchMedia("(pointer: coarse)").matches));return Q.useEffect(()=>{const s=window.matchMedia("(pointer: coarse)"),l=()=>i(N0(window.innerWidth,window.innerHeight,s.matches));return l(),window.addEventListener("resize",l),window.addEventListener("orientationchange",l),s.addEventListener("change",l),()=>{window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),s.removeEventListener("change",l)}},[]),n}const nv=250,iv=150;function uM(n,i,s,l){return i?n==="landscape"?{right:nv,bottom:0}:n==="portrait"?{right:0,bottom:s?Math.round(l*.6):iv}:{right:0,bottom:0}:{right:0,bottom:0}}const av={fontSize:9,letterSpacing:"0.16em",color:q.chromeMid};function oM(n){return v.jsxs("div",{style:{position:"absolute",right:0,top:0,bottom:0,width:nv,boxSizing:"border-box",background:q.panel,borderLeft:`1px solid ${q.panelBorder}`,padding:"16px 16px 14px",display:"flex",flexDirection:"column",gap:10,fontFamily:Et,pointerEvents:"auto"},children:[v.jsx(Uf,{...n,density:"full"}),v.jsx("div",{style:{marginTop:"auto",...av},children:"TAP FIELD TO DISMISS"})]})}function cM({detent:n,onToggleDetent:i,viewportHeight:s,...l}){const u=n==="expanded",c=u?Math.round(s*.6):iv;return v.jsxs("div",{style:{position:"absolute",left:0,right:0,bottom:0,height:c,boxSizing:"border-box",background:"rgba(7,8,11,0.96)",borderTop:`1px solid ${q.panelBorder}`,padding:"10px 18px 18px",display:"flex",flexDirection:"column",gap:10,fontFamily:Et,pointerEvents:"auto",transition:"height 180ms ease-out"},children:[v.jsx("button",{onClick:i,"aria-label":u?"Collapse":"Expand",style:{alignSelf:"center",width:44,height:4,borderRadius:2,border:"none",padding:0,background:"rgba(230,227,219,0.42)",cursor:"pointer",marginBottom:2,flexShrink:0}}),v.jsx("div",{style:{overflow:"hidden",flex:1,minHeight:0},children:v.jsx(Uf,{...l,density:u?"full":"compact"})}),v.jsx("div",{style:{marginTop:"auto",...av},children:u?"TAP HANDLE TO COLLAPSE":"TAP HANDLE FOR FULL TELEMETRY"})]})}function fM(){return"capture"}function dM(n){return`${n.message}. ${n.remedy} Nothing observed since this appeared has been saved.`}const qc={label:"TODAY",tone:"normal",detail:"Midnight to now."},hM={normal:q.chromeMid,warn:"rgba(240,195,116,0.9)",error:"rgba(206,104,90,0.9)"};function pM(){const n=Date.now(),i=new Date(n);return i.setHours(0,0,0,0),{start:i.getTime(),now:n}}const mM=250,gM={time:0,masses:[],disturbances:[],plinths:[],couplings:[],strata:[]};function yM(){const[n,i]=Q.useState(fM),[s,l]=Q.useState("field"),[u,c]=Q.useState(null),[d,h]=Q.useState(qc),[m,g]=Q.useState(gM),[x,b]=Q.useState(0),[D,V]=Q.useState(null),[L,z]=Q.useState(null),[k,K]=Q.useState("environment"),[B,F]=Q.useState(null),[H,Z]=Q.useState("peek"),de=lM(),M=Q.useRef(Vl(Date.now(),Date.now())),E=Q.useRef(null),G=Q.useRef(null),W=Q.useRef(!1);Q.useEffect(()=>{let w=!1,N=null;h(qc);async function X(){if(n==="synthetic"||n==="fixture"){let be;if(be=new d1({seed:57}),h({label:"REPLAY",tone:"normal",detail:"A deterministic synthetic day, replayed at speed. Not your telemetry."}),w)return;const yn=be.bounds();M.current=Vl(yn.dayStart,yn.dayEnd),E.current=be,c(be.info()),z(null),V(null),N=be.subscribe(fn=>{Nx(M.current,fn),W.current=!0}),W.current=!0;return}const{start:P,now:ue}=pM();await Xc(P,ue);const fe=await h1();let me=await Kc(P,ue);if(me.world.executions.length===0&&me.world.sessions.length===0){const be=ue-2592e5;await Xc(be,ue),me=await Kc(be,ue),(me.world.executions.length>0||me.world.sessions.length>0)&&h({label:"LAST 72H",tone:"warn",detail:"Nothing ran today, so the window was widened to the last 72 hours."})}const Ze=Object.entries(fe.observation??{}).flatMap(([be,yn])=>Object.entries(yn.strata).filter(([fn,ee])=>ee==="partial"||ee==="failed"&&fn!=="live-semantics").map(([fn,ee])=>`${be} ${fn} ${ee}`)),De=Object.entries(fe.sources).filter(([,be])=>(be.presence??(be.available?"observing":"not-installed"))==="failed").map(([be])=>be),gn=Object.entries(fe.sources).filter(([,be])=>be.presence==="not-installed").map(([be])=>be),Jn=fe.store.bySource.filter(be=>be.source!=="host"),Mt=fe.health;fe.fault?h({label:"STORE LOST",tone:"error",detail:dM(fe.fault)}):Mt&&!Mt.store.ok?h({label:"STORE DEGRADED",tone:"error",detail:Mt.store.remedy??"Some stored rows could not be read."}):Mt&&Mt.failingSources.length>0?h({label:"SOURCE FAILING",tone:"error",detail:`Installed and failing every collection round: ${Mt.failingSources.join(", ")}. `+(Mt.collection[Mt.failingSources[0]]?.lastError??"")+" Other sources and captured history are unaffected."}):fe.mode==="os-only"?h({label:"OS ONLY",tone:"normal",detail:"Observing this machine’s processes. No AI runtime state was found here"+(gn.length?` (looked for ${gn.join(", ")})`:"")+" — that is a valid mode, not a fault. Install or use one and its sessions appear here."}):Jn.length===0?h({label:"NOTHING YET",tone:"warn",detail:"Nothing has been captured yet. OS processes are sampled locally every few seconds; AI runtime state is read from each runtime’s own files when it exists."}):(De.length||Ze.length)&&h({label:"PARTIAL",tone:"warn",detail:[De.length?`Installed but unreadable: ${De.join(", ")}.`:"",Ze.length?`Reduced observation depth: ${Ze.join("; ")}. The computation is still observed; some semantics are not.`:"","Captured history is intact."].filter(Boolean).join(" ")});const Mn=new y1(me,fe,{onTrouble:be=>{if(!w){if(!be)return h(qc);h(be.kind==="store-fault"?{label:"STORE LOST",tone:"error",detail:`${be.message} ${be.detail}`}:{label:"CAPTURE FAILING",tone:"error",detail:`${be.message}. ${be.detail}. The field is showing the last world it received.`})}}});w||(M.current=Vl(me.from,me.to),E.current=Mn,c(Mn.info()),z(null),V(null),N=Mn.subscribe(be=>{M.current=be,W.current=!0}),W.current=!0)}return X().catch(P=>{w||h({label:"SOURCE FAILED",tone:"error",detail:P instanceof Error?P.message:String(P)})}),()=>{w=!0,E.current=null,N?.()}},[n]),Q.useEffect(()=>{const w=setInterval(()=>{const N=M.current,X=E.current?.now()??Date.now();if(kx(N,Math.max(N.now,X)),!W.current)return;W.current=!1;const P=l1(N);g(P),b(ue=>ue+1)},mM);return()=>clearInterval(w)},[]),Q.useEffect(()=>{const w=setInterval(()=>{const N=G.current?.perf.snapshot();N&&F({fps:N.fps,gpuMs:N.gpuMs,scale:N.scale})},1e3);return()=>clearInterval(w)},[]);const te=M.current,le=Q.useMemo(()=>$0(te),[x]),$e=Q.useMemo(()=>I0(te,le),[le]),he=Q.useCallback(w=>V(w),[]),re=Q.useCallback(w=>{const N=m.disturbances.find(P=>P.id===w),X=m.strata.find(P=>P.id===w);!N&&!X||(z({kind:N?"disturbance":"stratum",id:w,x:N?.x??0,y:N?.y??0}),l("field"))},[m]),R=L??D,Y=de!=="desktop",ae=typeof window>"u"?800:window.innerHeight,Ae=Q.useMemo(()=>uM(de,!!L,H==="expanded",ae),[de,L,H,ae]),Re=R&&(!L&&R.kind==="disturbance"?v.jsx("div",{"data-anchor-placement":"label",children:v.jsx(nM,{hit:R,world:te})}):v.jsx("div",{"data-anchor-placement":"panel",children:v.jsx(Uf,{hit:R,world:te,landscape:m,band:k,onClose:()=>z(null)})}));return v.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",flexDirection:"column",background:q.bg,color:q.ink,fontFamily:Et},children:[v.jsx(vM,{view:s,setView:l,feed:n,setFeed:i,sourceInfo:u,window:d}),s==="today"&&v.jsx(GA,{world:te}),s==="log"&&v.jsx(PA,{world:te,selectedId:L?.id??null,onSelect:re}),v.jsx("div",{style:{display:s==="field"?"contents":"none"},children:v.jsx(LA,{landscape:m,onHover:he,onSelect:z,anchor:Y?null:R,onBand:K,compact:Y,inset:Ae,keepVisible:L,overlay:Y&&L?de==="landscape"?v.jsx(oM,{hit:L,world:te,landscape:m,band:k,onClose:()=>z(null)}):v.jsx(cM,{hit:L,world:te,landscape:m,band:k,detent:H,onToggleDetent:()=>Z(w=>w==="peek"?"expanded":"peek"),viewportHeight:ae,onClose:()=>z(null)}):null,onReady:w=>{G.current=w},depth:v.jsx(sM,{metrics:le,shape:$e,compact:Y}),children:Re})}),v.jsx(bM,{view:s,perf:B,touch:Y})]})}function vM({view:n,setView:i,feed:s,setFeed:l,sourceInfo:u,window:c}){const d=(g,x)=>{const b=n===g;return v.jsx("button",{onClick:()=>i(g),style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:Et,letterSpacing:"0.22em",fontSize:b?12.5:9.5,color:b?q.ink:q.chromeDim},children:x},g)},h=s==="synthetic",m=[c.detail,u?.detail].filter(Boolean).join(" ");return v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"16px 24px 15px",borderBottom:`1px solid ${q.hairline}`,flexWrap:"nowrap",overflow:"hidden"},children:[v.jsx("div",{style:{fontSize:11,letterSpacing:"0.3em",color:"rgba(230,227,219,0.5)",flexShrink:0},children:"057"}),v.jsx("div",{className:"hdr-tagline",style:{fontSize:8.5,letterSpacing:"0.24em",color:q.chromeDim,flexShrink:0,whiteSpace:"nowrap"},children:"PERSONAL COMPUTATIONAL TELEMETRY"}),v.jsx("div",{className:"hdr-tagline",style:{width:1,height:12,background:"rgba(230,227,219,0.12)",flexShrink:0,margin:"0 10px"}}),v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:20,flexShrink:0},children:[d("field","FIELD"),d("today","TODAY"),d("log","PROCESS LOG")]}),v.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:22,minWidth:0},children:[v.jsxs("div",{title:m,style:{display:"flex",alignItems:"center",gap:9,flexShrink:0,cursor:"help"},children:[v.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:hM[c.tone],flexShrink:0}}),v.jsx("span",{style:{fontSize:10,letterSpacing:"0.2em",color:q.chromeStrong,whiteSpace:"nowrap"},children:c.label})]}),v.jsxs("button",{onClick:()=>l(h?"capture":"synthetic"),title:h?"Switch to CAPTURE":"Switch to SYNTHETIC",style:{background:"transparent",border:"none",padding:"3px 0",cursor:"pointer",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[v.jsx("span",{style:{fontSize:10,color:h?q.chromeDim:q.accent},children:h?"○":"●"}),v.jsx("span",{style:{fontSize:9.5,letterSpacing:"0.16em",color:q.chrome},children:h?"SYNTHETIC":"CAPTURE"})]})]})]})}function bM({view:n,perf:i,touch:s}){return v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:14,padding:"10px 24px 14px",borderTop:`1px solid ${q.hairline}`,fontSize:10.5,letterSpacing:"0.16em",color:q.chrome,flexWrap:"wrap"},children:[v.jsx("span",{children:n==="field"?s?"DRAG TO PAN · PINCH TO ZOOM · TAP TO INSPECT":"SCROLL TO PAN · ⌃SCROLL / PINCH TO ZOOM · CLICK TO INSPECT · ZOOM OUT FOR TODAY":n==="log"?v.jsxs(v.Fragment,{children:["CLICK A ROW FOR THE FULL RECORD · CLICK A COLUMN TO SORT",v.jsx("span",{style:{color:q.accentBright},children:" · TOKEN RULE: LOG 10k–100M"})]}):"HOVER AN INFERRED MEASURE FOR THE ASSUMPTION BEHIND IT"}),v.jsx("span",{style:{marginLeft:"auto",color:q.chromeDim,fontSize:9.5},children:n==="field"&&i&&i.fps>0?`${Math.round(i.fps)}FPS${i.gpuMs>0?` · ${i.gpuMs.toFixed(1)}MS GPU`:""}${i.scale<1?` · ${Math.round(i.scale*100)}%`:""}`:""})]})}Dx.createRoot(document.getElementById("root")).render(v.jsx(Q.StrictMode,{children:v.jsx(yM,{})}));
|