@descix/frqtl-web 0.7.0-p2 → 0.7.0-p3
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/CLAUDE.md +4 -4
- package/README.md +1 -1
- package/dist/dist-manifest.json +12 -9
- package/dist/notebooks/aim-mailman-small-tensor.html +253 -0
- package/dist/notebooks/doo-same-bits-any-order.html +488 -0
- package/dist/notebooks/notebooks.json +12 -0
- package/dist/sdk.html +1 -1
- package/dist/shim/engine/router.js +2 -2
- package/dist/shim/host/device.js +3 -1
- package/dist/shim/host/host-auth.js +176 -0
- package/dist/shim/registry/studio-landing.js +21 -18
- package/dist/studio/app-assets/{SceneCodeEditor-Ck982ITn.js → SceneCodeEditor-DnAM0Uhi.js} +1 -1
- package/dist/studio/app-assets/index-YDj5QEI1.js +173 -0
- package/dist/studio/app.html +1 -1
- package/llms.txt +5 -5
- package/package.json +1 -1
- package/dist/studio/app-assets/index-DX5L-7-w.js +0 -173
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
var gO=Object.defineProperty;var vO=(e,t,n)=>t in e?gO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Z=(e,t,n)=>vO(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function yO(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var o0={exports:{}},Td={},s0={exports:{}},ze={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Kl=Symbol.for("react.element"),bO=Symbol.for("react.portal"),xO=Symbol.for("react.fragment"),wO=Symbol.for("react.strict_mode"),_O=Symbol.for("react.profiler"),kO=Symbol.for("react.provider"),SO=Symbol.for("react.context"),EO=Symbol.for("react.forward_ref"),OO=Symbol.for("react.suspense"),CO=Symbol.for("react.memo"),jO=Symbol.for("react.lazy"),sy=Symbol.iterator;function RO(e){return e===null||typeof e!="object"?null:(e=sy&&e[sy]||e["@@iterator"],typeof e=="function"?e:null)}var a0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},l0=Object.assign,c0={};function oa(e,t,n){this.props=e,this.context=t,this.refs=c0,this.updater=n||a0}oa.prototype.isReactComponent={};oa.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};oa.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function u0(){}u0.prototype=oa.prototype;function Tm(e,t,n){this.props=e,this.context=t,this.refs=c0,this.updater=n||a0}var Dm=Tm.prototype=new u0;Dm.constructor=Tm;l0(Dm,oa.prototype);Dm.isPureReactComponent=!0;var ay=Array.isArray,d0=Object.prototype.hasOwnProperty,Im={current:null},f0={key:!0,ref:!0,__self:!0,__source:!0};function h0(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)d0.call(t,r)&&!f0.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:Kl,type:e,key:o,ref:s,props:i,_owner:Im.current}}function LO(e,t){return{$$typeof:Kl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Fm(e){return typeof e=="object"&&e!==null&&e.$$typeof===Kl}function AO(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var ly=/\/+/g;function zf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?AO(""+e.key):t.toString(36)}function cu(e,t,n,r,i){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(o){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Kl:case bO:s=!0}}if(s)return s=e,i=i(s),e=r===""?"."+zf(s,0):r,ay(i)?(n="",e!=null&&(n=e.replace(ly,"$&/")+"/"),cu(i,t,n,"",function(c){return c})):i!=null&&(Fm(i)&&(i=LO(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(ly,"$&/")+"/")+e)),t.push(i)),1;if(s=0,r=r===""?".":r+":",ay(e))for(var a=0;a<e.length;a++){o=e[a];var l=r+zf(o,a);s+=cu(o,t,n,l,i)}else if(l=RO(e),typeof l=="function")for(e=l.call(e),a=0;!(o=e.next()).done;)o=o.value,l=r+zf(o,a++),s+=cu(o,t,n,l,i);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function vc(e,t,n){if(e==null)return e;var r=[],i=0;return cu(e,r,"","",function(o){return t.call(n,o,i++)}),r}function PO(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Rn={current:null},uu={transition:null},MO={ReactCurrentDispatcher:Rn,ReactCurrentBatchConfig:uu,ReactCurrentOwner:Im};function p0(){throw Error("act(...) is not supported in production builds of React.")}ze.Children={map:vc,forEach:function(e,t,n){vc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return vc(e,function(){t++}),t},toArray:function(e){return vc(e,function(t){return t})||[]},only:function(e){if(!Fm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ze.Component=oa;ze.Fragment=xO;ze.Profiler=_O;ze.PureComponent=Tm;ze.StrictMode=wO;ze.Suspense=OO;ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=MO;ze.act=p0;ze.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=l0({},e.props),i=e.key,o=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,s=Im.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)d0.call(t,l)&&!f0.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:Kl,type:e.type,key:i,ref:o,props:r,_owner:s}};ze.createContext=function(e){return e={$$typeof:SO,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:kO,_context:e},e.Consumer=e};ze.createElement=h0;ze.createFactory=function(e){var t=h0.bind(null,e);return t.type=e,t};ze.createRef=function(){return{current:null}};ze.forwardRef=function(e){return{$$typeof:EO,render:e}};ze.isValidElement=Fm;ze.lazy=function(e){return{$$typeof:jO,_payload:{_status:-1,_result:e},_init:PO}};ze.memo=function(e,t){return{$$typeof:CO,type:e,compare:t===void 0?null:t}};ze.startTransition=function(e){var t=uu.transition;uu.transition={};try{e()}finally{uu.transition=t}};ze.unstable_act=p0;ze.useCallback=function(e,t){return Rn.current.useCallback(e,t)};ze.useContext=function(e){return Rn.current.useContext(e)};ze.useDebugValue=function(){};ze.useDeferredValue=function(e){return Rn.current.useDeferredValue(e)};ze.useEffect=function(e,t){return Rn.current.useEffect(e,t)};ze.useId=function(){return Rn.current.useId()};ze.useImperativeHandle=function(e,t,n){return Rn.current.useImperativeHandle(e,t,n)};ze.useInsertionEffect=function(e,t){return Rn.current.useInsertionEffect(e,t)};ze.useLayoutEffect=function(e,t){return Rn.current.useLayoutEffect(e,t)};ze.useMemo=function(e,t){return Rn.current.useMemo(e,t)};ze.useReducer=function(e,t,n){return Rn.current.useReducer(e,t,n)};ze.useRef=function(e){return Rn.current.useRef(e)};ze.useState=function(e){return Rn.current.useState(e)};ze.useSyncExternalStore=function(e,t,n){return Rn.current.useSyncExternalStore(e,t,n)};ze.useTransition=function(){return Rn.current.useTransition()};ze.version="18.3.1";s0.exports=ze;var j=s0.exports;const Ze=yO(j);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var TO=j,DO=Symbol.for("react.element"),IO=Symbol.for("react.fragment"),FO=Object.prototype.hasOwnProperty,NO=TO.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,zO={key:!0,ref:!0,__self:!0,__source:!0};function m0(e,t,n){var r,i={},o=null,s=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)FO.call(t,r)&&!zO.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:DO,type:e,key:o,ref:s,props:i,_owner:NO.current}}Td.Fragment=IO;Td.jsx=m0;Td.jsxs=m0;o0.exports=Td;var y=o0.exports,g0={exports:{}},nr={},v0={exports:{}},y0={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(B,ee){var ce=B.length;B.push(ee);e:for(;0<ce;){var ve=ce-1>>>1,ke=B[ve];if(0<i(ke,ee))B[ve]=ee,B[ce]=ke,ce=ve;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var ee=B[0],ce=B.pop();if(ce!==ee){B[0]=ce;e:for(var ve=0,ke=B.length,je=ke>>>1;ve<je;){var ie=2*(ve+1)-1,me=B[ie],xe=ie+1,ge=B[xe];if(0>i(me,ce))xe<ke&&0>i(ge,me)?(B[ve]=ge,B[xe]=ce,ve=xe):(B[ve]=me,B[ie]=ce,ve=ie);else if(xe<ke&&0>i(ge,ce))B[ve]=ge,B[xe]=ce,ve=xe;else break e}}return ee}function i(B,ee){var ce=B.sortIndex-ee.sortIndex;return ce!==0?ce:B.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],u=1,d=null,f=3,h=!1,v=!1,m=!1,x=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(B){for(var ee=n(c);ee!==null;){if(ee.callback===null)r(c);else if(ee.startTime<=B)r(c),ee.sortIndex=ee.expirationTime,t(l,ee);else break;ee=n(c)}}function E(B){if(m=!1,k(B),!v)if(n(l)!==null)v=!0,re(C);else{var ee=n(c);ee!==null&&pe(E,ee.startTime-B)}}function C(B,ee){v=!1,m&&(m=!1,b(L),L=-1),h=!0;var ce=f;try{for(k(ee),d=n(l);d!==null&&(!(d.expirationTime>ee)||B&&!G());){var ve=d.callback;if(typeof ve=="function"){d.callback=null,f=d.priorityLevel;var ke=ve(d.expirationTime<=ee);ee=e.unstable_now(),typeof ke=="function"?d.callback=ke:d===n(l)&&r(l),k(ee)}else r(l);d=n(l)}if(d!==null)var je=!0;else{var ie=n(c);ie!==null&&pe(E,ie.startTime-ee),je=!1}return je}finally{d=null,f=ce,h=!1}}var S=!1,M=null,L=-1,T=5,V=-1;function G(){return!(e.unstable_now()-V<T)}function N(){if(M!==null){var B=e.unstable_now();V=B;var ee=!0;try{ee=M(!0,B)}finally{ee?te():(S=!1,M=null)}}else S=!1}var te;if(typeof g=="function")te=function(){g(N)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,Y=W.port2;W.port1.onmessage=N,te=function(){Y.postMessage(null)}}else te=function(){x(N,0)};function re(B){M=B,S||(S=!0,te())}function pe(B,ee){L=x(function(){B(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_continueExecution=function(){v||h||(v=!0,re(C))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(B){switch(f){case 1:case 2:case 3:var ee=3;break;default:ee=f}var ce=f;f=ee;try{return B()}finally{f=ce}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,ee){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ce=f;f=B;try{return ee()}finally{f=ce}},e.unstable_scheduleCallback=function(B,ee,ce){var ve=e.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?ve+ce:ve):ce=ve,B){case 1:var ke=-1;break;case 2:ke=250;break;case 5:ke=1073741823;break;case 4:ke=1e4;break;default:ke=5e3}return ke=ce+ke,B={id:u++,callback:ee,priorityLevel:B,startTime:ce,expirationTime:ke,sortIndex:-1},ce>ve?(B.sortIndex=ce,t(c,B),n(l)===null&&B===n(c)&&(m?(b(L),L=-1):m=!0,pe(E,ce-ve))):(B.sortIndex=ke,t(l,B),v||h||(v=!0,re(C))),B},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(B){var ee=f;return function(){var ce=f;f=ee;try{return B.apply(this,arguments)}finally{f=ce}}}})(y0);v0.exports=y0;var BO=v0.exports;/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var UO=j,tr=BO;function q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var b0=new Set,pl={};function Xo(e,t){qs(e,t),qs(e+"Capture",t)}function qs(e,t){for(pl[e]=t,e=0;e<t.length;e++)b0.add(t[e])}var hi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jh=Object.prototype.hasOwnProperty,HO=/^[: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]*$/,cy={},uy={};function WO(e){return Jh.call(uy,e)?!0:Jh.call(cy,e)?!1:HO.test(e)?uy[e]=!0:(cy[e]=!0,!1)}function VO(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function qO(e,t,n,r){if(t===null||typeof t>"u"||VO(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ln(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var sn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){sn[e]=new Ln(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];sn[t]=new Ln(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){sn[e]=new Ln(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){sn[e]=new Ln(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){sn[e]=new Ln(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){sn[e]=new Ln(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){sn[e]=new Ln(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){sn[e]=new Ln(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){sn[e]=new Ln(e,5,!1,e.toLowerCase(),null,!1,!1)});var Nm=/[\-:]([a-z])/g;function zm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Nm,zm);sn[t]=new Ln(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Nm,zm);sn[t]=new Ln(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Nm,zm);sn[t]=new Ln(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){sn[e]=new Ln(e,1,!1,e.toLowerCase(),null,!1,!1)});sn.xlinkHref=new Ln("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){sn[e]=new Ln(e,1,!1,e.toLowerCase(),null,!0,!0)});function Bm(e,t,n,r){var i=sn.hasOwnProperty(t)?sn[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(qO(t,n,i,r)&&(n=null),r||i===null?WO(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var bi=UO.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,yc=Symbol.for("react.element"),vs=Symbol.for("react.portal"),ys=Symbol.for("react.fragment"),Um=Symbol.for("react.strict_mode"),Xh=Symbol.for("react.profiler"),x0=Symbol.for("react.provider"),w0=Symbol.for("react.context"),Hm=Symbol.for("react.forward_ref"),Qh=Symbol.for("react.suspense"),Zh=Symbol.for("react.suspense_list"),Wm=Symbol.for("react.memo"),Oi=Symbol.for("react.lazy"),_0=Symbol.for("react.offscreen"),dy=Symbol.iterator;function ma(e){return e===null||typeof e!="object"?null:(e=dy&&e[dy]||e["@@iterator"],typeof e=="function"?e:null)}var Lt=Object.assign,Bf;function Ta(e){if(Bf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Bf=t&&t[1]||""}return`
|
|
34
|
-
`+Bf+e}var Uf=!1;function Hf(e,t){if(!e||Uf)return"";Uf=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
|
|
35
|
-
`),o=r.stack.split(`
|
|
36
|
-
`),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(s!==1||a!==1)do if(s--,a--,0>a||i[s]!==o[a]){var l=`
|
|
37
|
-
`+i[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Uf=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ta(e):""}function $O(e){switch(e.tag){case 5:return Ta(e.type);case 16:return Ta("Lazy");case 13:return Ta("Suspense");case 19:return Ta("SuspenseList");case 0:case 2:case 15:return e=Hf(e.type,!1),e;case 11:return e=Hf(e.type.render,!1),e;case 1:return e=Hf(e.type,!0),e;default:return""}}function ep(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ys:return"Fragment";case vs:return"Portal";case Xh:return"Profiler";case Um:return"StrictMode";case Qh:return"Suspense";case Zh:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w0:return(e.displayName||"Context")+".Consumer";case x0:return(e._context.displayName||"Context")+".Provider";case Hm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Wm:return t=e.displayName||null,t!==null?t:ep(e.type)||"Memo";case Oi:t=e._payload,e=e._init;try{return ep(e(t))}catch{}}return null}function KO(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ep(t);case 8:return t===Um?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ji(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function k0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function YO(e){var t=k0(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function bc(e){e._valueTracker||(e._valueTracker=YO(e))}function S0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=k0(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Fu(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}}function tp(e,t){var n=t.checked;return Lt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function fy(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ji(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function E0(e,t){t=t.checked,t!=null&&Bm(e,"checked",t,!1)}function np(e,t){E0(e,t);var n=Ji(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?rp(e,t.type,n):t.hasOwnProperty("defaultValue")&&rp(e,t.type,Ji(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function hy(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function rp(e,t,n){(t!=="number"||Fu(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Da=Array.isArray;function Ds(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ji(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function ip(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(q(91));return Lt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function py(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(q(92));if(Da(n)){if(1<n.length)throw Error(q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ji(n)}}function O0(e,t){var n=Ji(t.value),r=Ji(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function my(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function C0(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function op(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?C0(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var xc,j0=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(xc=xc||document.createElement("div"),xc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=xc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ml(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ga={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},GO=["Webkit","ms","Moz","O"];Object.keys(Ga).forEach(function(e){GO.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ga[t]=Ga[e]})});function R0(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ga.hasOwnProperty(e)&&Ga[e]?(""+t).trim():t+"px"}function L0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=R0(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var JO=Lt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function sp(e,t){if(t){if(JO[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(q(62))}}function ap(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 lp=null;function Vm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var cp=null,Is=null,Fs=null;function gy(e){if(e=Jl(e)){if(typeof cp!="function")throw Error(q(280));var t=e.stateNode;t&&(t=zd(t),cp(e.stateNode,e.type,t))}}function A0(e){Is?Fs?Fs.push(e):Fs=[e]:Is=e}function P0(){if(Is){var e=Is,t=Fs;if(Fs=Is=null,gy(e),t)for(e=0;e<t.length;e++)gy(t[e])}}function M0(e,t){return e(t)}function T0(){}var Wf=!1;function D0(e,t,n){if(Wf)return e(t,n);Wf=!0;try{return M0(e,t,n)}finally{Wf=!1,(Is!==null||Fs!==null)&&(T0(),P0())}}function gl(e,t){var n=e.stateNode;if(n===null)return null;var r=zd(n);if(r===null)return null;n=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(n&&typeof n!="function")throw Error(q(231,t,typeof n));return n}var up=!1;if(hi)try{var ga={};Object.defineProperty(ga,"passive",{get:function(){up=!0}}),window.addEventListener("test",ga,ga),window.removeEventListener("test",ga,ga)}catch{up=!1}function XO(e,t,n,r,i,o,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var Ja=!1,Nu=null,zu=!1,dp=null,QO={onError:function(e){Ja=!0,Nu=e}};function ZO(e,t,n,r,i,o,s,a,l){Ja=!1,Nu=null,XO.apply(QO,arguments)}function eC(e,t,n,r,i,o,s,a,l){if(ZO.apply(this,arguments),Ja){if(Ja){var c=Nu;Ja=!1,Nu=null}else throw Error(q(198));zu||(zu=!0,dp=c)}}function Qo(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function I0(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 vy(e){if(Qo(e)!==e)throw Error(q(188))}function tC(e){var t=e.alternate;if(!t){if(t=Qo(e),t===null)throw Error(q(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return vy(i),e;if(o===r)return vy(i),t;o=o.sibling}throw Error(q(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s){for(a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s)throw Error(q(189))}}if(n.alternate!==r)throw Error(q(190))}if(n.tag!==3)throw Error(q(188));return n.stateNode.current===n?e:t}function F0(e){return e=tC(e),e!==null?N0(e):null}function N0(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=N0(e);if(t!==null)return t;e=e.sibling}return null}var z0=tr.unstable_scheduleCallback,yy=tr.unstable_cancelCallback,nC=tr.unstable_shouldYield,rC=tr.unstable_requestPaint,zt=tr.unstable_now,iC=tr.unstable_getCurrentPriorityLevel,qm=tr.unstable_ImmediatePriority,B0=tr.unstable_UserBlockingPriority,Bu=tr.unstable_NormalPriority,oC=tr.unstable_LowPriority,U0=tr.unstable_IdlePriority,Dd=null,Hr=null;function sC(e){if(Hr&&typeof Hr.onCommitFiberRoot=="function")try{Hr.onCommitFiberRoot(Dd,e,void 0,(e.current.flags&128)===128)}catch{}}var Or=Math.clz32?Math.clz32:cC,aC=Math.log,lC=Math.LN2;function cC(e){return e>>>=0,e===0?32:31-(aC(e)/lC|0)|0}var wc=64,_c=4194304;function Ia(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Uu(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=Ia(a):(o&=s,o!==0&&(r=Ia(o)))}else s=n&~i,s!==0?r=Ia(s):o!==0&&(r=Ia(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Or(t),i=1<<n,r|=e[n],t&=~i;return r}function uC(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function dC(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var s=31-Or(o),a=1<<s,l=i[s];l===-1?(!(a&n)||a&r)&&(i[s]=uC(a,t)):l<=t&&(e.expiredLanes|=a),o&=~a}}function fp(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function H0(){var e=wc;return wc<<=1,!(wc&4194240)&&(wc=64),e}function Vf(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Yl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Or(t),e[t]=n}function fC(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Or(n),o=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~o}}function $m(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Or(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var nt=0;function W0(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var V0,Km,q0,$0,K0,hp=!1,kc=[],Bi=null,Ui=null,Hi=null,vl=new Map,yl=new Map,ji=[],hC="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function by(e,t){switch(e){case"focusin":case"focusout":Bi=null;break;case"dragenter":case"dragleave":Ui=null;break;case"mouseover":case"mouseout":Hi=null;break;case"pointerover":case"pointerout":vl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":yl.delete(t.pointerId)}}function va(e,t,n,r,i,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},t!==null&&(t=Jl(t),t!==null&&Km(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function pC(e,t,n,r,i){switch(t){case"focusin":return Bi=va(Bi,e,t,n,r,i),!0;case"dragenter":return Ui=va(Ui,e,t,n,r,i),!0;case"mouseover":return Hi=va(Hi,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return vl.set(o,va(vl.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,yl.set(o,va(yl.get(o)||null,e,t,n,r,i)),!0}return!1}function Y0(e){var t=Oo(e.target);if(t!==null){var n=Qo(t);if(n!==null){if(t=n.tag,t===13){if(t=I0(n),t!==null){e.blockedOn=t,K0(e.priority,function(){q0(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function du(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pp(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);lp=r,n.target.dispatchEvent(r),lp=null}else return t=Jl(n),t!==null&&Km(t),e.blockedOn=n,!1;t.shift()}return!0}function xy(e,t,n){du(e)&&n.delete(t)}function mC(){hp=!1,Bi!==null&&du(Bi)&&(Bi=null),Ui!==null&&du(Ui)&&(Ui=null),Hi!==null&&du(Hi)&&(Hi=null),vl.forEach(xy),yl.forEach(xy)}function ya(e,t){e.blockedOn===t&&(e.blockedOn=null,hp||(hp=!0,tr.unstable_scheduleCallback(tr.unstable_NormalPriority,mC)))}function bl(e){function t(i){return ya(i,e)}if(0<kc.length){ya(kc[0],e);for(var n=1;n<kc.length;n++){var r=kc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Bi!==null&&ya(Bi,e),Ui!==null&&ya(Ui,e),Hi!==null&&ya(Hi,e),vl.forEach(t),yl.forEach(t),n=0;n<ji.length;n++)r=ji[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<ji.length&&(n=ji[0],n.blockedOn===null);)Y0(n),n.blockedOn===null&&ji.shift()}var Ns=bi.ReactCurrentBatchConfig,Hu=!0;function gC(e,t,n,r){var i=nt,o=Ns.transition;Ns.transition=null;try{nt=1,Ym(e,t,n,r)}finally{nt=i,Ns.transition=o}}function vC(e,t,n,r){var i=nt,o=Ns.transition;Ns.transition=null;try{nt=4,Ym(e,t,n,r)}finally{nt=i,Ns.transition=o}}function Ym(e,t,n,r){if(Hu){var i=pp(e,t,n,r);if(i===null)eh(e,t,r,Wu,n),by(e,r);else if(pC(i,e,t,n,r))r.stopPropagation();else if(by(e,r),t&4&&-1<hC.indexOf(e)){for(;i!==null;){var o=Jl(i);if(o!==null&&V0(o),o=pp(e,t,n,r),o===null&&eh(e,t,r,Wu,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else eh(e,t,r,null,n)}}var Wu=null;function pp(e,t,n,r){if(Wu=null,e=Vm(r),e=Oo(e),e!==null)if(t=Qo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=I0(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Wu=e,null}function G0(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(iC()){case qm:return 1;case B0:return 4;case Bu:case oC:return 16;case U0:return 536870912;default:return 16}default:return 16}}var Ai=null,Gm=null,fu=null;function J0(){if(fu)return fu;var e,t=Gm,n=t.length,r,i="value"in Ai?Ai.value:Ai.textContent,o=i.length;for(e=0;e<n&&t[e]===i[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===i[o-r];r++);return fu=i.slice(e,1<r?1-r:void 0)}function hu(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 Sc(){return!0}function wy(){return!1}function rr(e){function t(n,r,i,o,s){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(o):o[a]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Sc:wy,this.isPropagationStopped=wy,this}return Lt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Sc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Sc)},persist:function(){},isPersistent:Sc}),t}var sa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jm=rr(sa),Gl=Lt({},sa,{view:0,detail:0}),yC=rr(Gl),qf,$f,ba,Id=Lt({},Gl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xm,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!==ba&&(ba&&e.type==="mousemove"?(qf=e.screenX-ba.screenX,$f=e.screenY-ba.screenY):$f=qf=0,ba=e),qf)},movementY:function(e){return"movementY"in e?e.movementY:$f}}),_y=rr(Id),bC=Lt({},Id,{dataTransfer:0}),xC=rr(bC),wC=Lt({},Gl,{relatedTarget:0}),Kf=rr(wC),_C=Lt({},sa,{animationName:0,elapsedTime:0,pseudoElement:0}),kC=rr(_C),SC=Lt({},sa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),EC=rr(SC),OC=Lt({},sa,{data:0}),ky=rr(OC),CC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jC={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"},RC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LC(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=RC[e])?!!t[e]:!1}function Xm(){return LC}var AC=Lt({},Gl,{key:function(e){if(e.key){var t=CC[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?jC[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xm,charCode:function(e){return e.type==="keypress"?hu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),PC=rr(AC),MC=Lt({},Id,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sy=rr(MC),TC=Lt({},Gl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xm}),DC=rr(TC),IC=Lt({},sa,{propertyName:0,elapsedTime:0,pseudoElement:0}),FC=rr(IC),NC=Lt({},Id,{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}),zC=rr(NC),BC=[9,13,27,32],Qm=hi&&"CompositionEvent"in window,Xa=null;hi&&"documentMode"in document&&(Xa=document.documentMode);var UC=hi&&"TextEvent"in window&&!Xa,X0=hi&&(!Qm||Xa&&8<Xa&&11>=Xa),Ey=" ",Oy=!1;function Q0(e,t){switch(e){case"keyup":return BC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Z0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var bs=!1;function HC(e,t){switch(e){case"compositionend":return Z0(t);case"keypress":return t.which!==32?null:(Oy=!0,Ey);case"textInput":return e=t.data,e===Ey&&Oy?null:e;default:return null}}function WC(e,t){if(bs)return e==="compositionend"||!Qm&&Q0(e,t)?(e=J0(),fu=Gm=Ai=null,bs=!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 X0&&t.locale!=="ko"?null:t.data;default:return null}}var VC={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 Cy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!VC[e.type]:t==="textarea"}function e_(e,t,n,r){A0(r),t=Vu(t,"onChange"),0<t.length&&(n=new Jm("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Qa=null,xl=null;function qC(e){d_(e,0)}function Fd(e){var t=_s(e);if(S0(t))return e}function $C(e,t){if(e==="change")return t}var t_=!1;if(hi){var Yf;if(hi){var Gf="oninput"in document;if(!Gf){var jy=document.createElement("div");jy.setAttribute("oninput","return;"),Gf=typeof jy.oninput=="function"}Yf=Gf}else Yf=!1;t_=Yf&&(!document.documentMode||9<document.documentMode)}function Ry(){Qa&&(Qa.detachEvent("onpropertychange",n_),xl=Qa=null)}function n_(e){if(e.propertyName==="value"&&Fd(xl)){var t=[];e_(t,xl,e,Vm(e)),D0(qC,t)}}function KC(e,t,n){e==="focusin"?(Ry(),Qa=t,xl=n,Qa.attachEvent("onpropertychange",n_)):e==="focusout"&&Ry()}function YC(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Fd(xl)}function GC(e,t){if(e==="click")return Fd(t)}function JC(e,t){if(e==="input"||e==="change")return Fd(t)}function XC(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Lr=typeof Object.is=="function"?Object.is:XC;function wl(e,t){if(Lr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Jh.call(t,i)||!Lr(e[i],t[i]))return!1}return!0}function Ly(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ay(e,t){var n=Ly(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ly(n)}}function r_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?r_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function i_(){for(var e=window,t=Fu();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Fu(e.document)}return t}function Zm(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")}function QC(e){var t=i_(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&r_(n.ownerDocument.documentElement,n)){if(r!==null&&Zm(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Ay(n,o);var s=Ay(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var ZC=hi&&"documentMode"in document&&11>=document.documentMode,xs=null,mp=null,Za=null,gp=!1;function Py(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;gp||xs==null||xs!==Fu(r)||(r=xs,"selectionStart"in r&&Zm(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}),Za&&wl(Za,r)||(Za=r,r=Vu(mp,"onSelect"),0<r.length&&(t=new Jm("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=xs)))}function Ec(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ws={animationend:Ec("Animation","AnimationEnd"),animationiteration:Ec("Animation","AnimationIteration"),animationstart:Ec("Animation","AnimationStart"),transitionend:Ec("Transition","TransitionEnd")},Jf={},o_={};hi&&(o_=document.createElement("div").style,"AnimationEvent"in window||(delete ws.animationend.animation,delete ws.animationiteration.animation,delete ws.animationstart.animation),"TransitionEvent"in window||delete ws.transitionend.transition);function Nd(e){if(Jf[e])return Jf[e];if(!ws[e])return e;var t=ws[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in o_)return Jf[e]=t[n];return e}var s_=Nd("animationend"),a_=Nd("animationiteration"),l_=Nd("animationstart"),c_=Nd("transitionend"),u_=new Map,My="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ro(e,t){u_.set(e,t),Xo(t,[e])}for(var Xf=0;Xf<My.length;Xf++){var Qf=My[Xf],ej=Qf.toLowerCase(),tj=Qf[0].toUpperCase()+Qf.slice(1);ro(ej,"on"+tj)}ro(s_,"onAnimationEnd");ro(a_,"onAnimationIteration");ro(l_,"onAnimationStart");ro("dblclick","onDoubleClick");ro("focusin","onFocus");ro("focusout","onBlur");ro(c_,"onTransitionEnd");qs("onMouseEnter",["mouseout","mouseover"]);qs("onMouseLeave",["mouseout","mouseover"]);qs("onPointerEnter",["pointerout","pointerover"]);qs("onPointerLeave",["pointerout","pointerover"]);Xo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Xo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Xo("onBeforeInput",["compositionend","keypress","textInput","paste"]);Xo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Xo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Xo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fa="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(" "),nj=new Set("cancel close invalid load scroll toggle".split(" ").concat(Fa));function Ty(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,eC(r,t,void 0,e),e.currentTarget=null}function d_(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==o&&i.isPropagationStopped())break e;Ty(i,a,c),o=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==o&&i.isPropagationStopped())break e;Ty(i,a,c),o=l}}}if(zu)throw e=dp,zu=!1,dp=null,e}function gt(e,t){var n=t[wp];n===void 0&&(n=t[wp]=new Set);var r=e+"__bubble";n.has(r)||(f_(t,e,2,!1),n.add(r))}function Zf(e,t,n){var r=0;t&&(r|=4),f_(n,e,r,t)}var Oc="_reactListening"+Math.random().toString(36).slice(2);function _l(e){if(!e[Oc]){e[Oc]=!0,b0.forEach(function(n){n!=="selectionchange"&&(nj.has(n)||Zf(n,!1,e),Zf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Oc]||(t[Oc]=!0,Zf("selectionchange",!1,t))}}function f_(e,t,n,r){switch(G0(t)){case 1:var i=gC;break;case 4:i=vC;break;default:i=Ym}n=i.bind(null,t,n,e),i=void 0,!up||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function eh(e,t,n,r,i){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;s=s.return}for(;a!==null;){if(s=Oo(a),s===null)return;if(l=s.tag,l===5||l===6){r=o=s;continue e}a=a.parentNode}}r=r.return}D0(function(){var c=o,u=Vm(n),d=[];e:{var f=u_.get(e);if(f!==void 0){var h=Jm,v=e;switch(e){case"keypress":if(hu(n)===0)break e;case"keydown":case"keyup":h=PC;break;case"focusin":v="focus",h=Kf;break;case"focusout":v="blur",h=Kf;break;case"beforeblur":case"afterblur":h=Kf;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=_y;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=xC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=DC;break;case s_:case a_:case l_:h=kC;break;case c_:h=FC;break;case"scroll":h=yC;break;case"wheel":h=zC;break;case"copy":case"cut":case"paste":h=EC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Sy}var m=(t&4)!==0,x=!m&&e==="scroll",b=m?f!==null?f+"Capture":null:f;m=[];for(var g=c,k;g!==null;){k=g;var E=k.stateNode;if(k.tag===5&&E!==null&&(k=E,b!==null&&(E=gl(g,b),E!=null&&m.push(kl(g,E,k)))),x)break;g=g.return}0<m.length&&(f=new h(f,v,null,n,u),d.push({event:f,listeners:m}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&n!==lp&&(v=n.relatedTarget||n.fromElement)&&(Oo(v)||v[pi]))break e;if((h||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,h?(v=n.relatedTarget||n.toElement,h=c,v=v?Oo(v):null,v!==null&&(x=Qo(v),v!==x||v.tag!==5&&v.tag!==6)&&(v=null)):(h=null,v=c),h!==v)){if(m=_y,E="onMouseLeave",b="onMouseEnter",g="mouse",(e==="pointerout"||e==="pointerover")&&(m=Sy,E="onPointerLeave",b="onPointerEnter",g="pointer"),x=h==null?f:_s(h),k=v==null?f:_s(v),f=new m(E,g+"leave",h,n,u),f.target=x,f.relatedTarget=k,E=null,Oo(u)===c&&(m=new m(b,g+"enter",v,n,u),m.target=k,m.relatedTarget=x,E=m),x=E,h&&v)t:{for(m=h,b=v,g=0,k=m;k;k=ls(k))g++;for(k=0,E=b;E;E=ls(E))k++;for(;0<g-k;)m=ls(m),g--;for(;0<k-g;)b=ls(b),k--;for(;g--;){if(m===b||b!==null&&m===b.alternate)break t;m=ls(m),b=ls(b)}m=null}else m=null;h!==null&&Dy(d,f,h,m,!1),v!==null&&x!==null&&Dy(d,x,v,m,!0)}}e:{if(f=c?_s(c):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var C=$C;else if(Cy(f))if(t_)C=JC;else{C=YC;var S=KC}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=GC);if(C&&(C=C(e,c))){e_(d,C,n,u);break e}S&&S(e,f,c),e==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&rp(f,"number",f.value)}switch(S=c?_s(c):window,e){case"focusin":(Cy(S)||S.contentEditable==="true")&&(xs=S,mp=c,Za=null);break;case"focusout":Za=mp=xs=null;break;case"mousedown":gp=!0;break;case"contextmenu":case"mouseup":case"dragend":gp=!1,Py(d,n,u);break;case"selectionchange":if(ZC)break;case"keydown":case"keyup":Py(d,n,u)}var M;if(Qm)e:{switch(e){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else bs?Q0(e,n)&&(L="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(L="onCompositionStart");L&&(X0&&n.locale!=="ko"&&(bs||L!=="onCompositionStart"?L==="onCompositionEnd"&&bs&&(M=J0()):(Ai=u,Gm="value"in Ai?Ai.value:Ai.textContent,bs=!0)),S=Vu(c,L),0<S.length&&(L=new ky(L,e,null,n,u),d.push({event:L,listeners:S}),M?L.data=M:(M=Z0(n),M!==null&&(L.data=M)))),(M=UC?HC(e,n):WC(e,n))&&(c=Vu(c,"onBeforeInput"),0<c.length&&(u=new ky("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=M))}d_(d,t)})}function kl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Vu(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=gl(e,n),o!=null&&r.unshift(kl(e,o,i)),o=gl(e,t),o!=null&&r.push(kl(e,o,i))),e=e.return}return r}function ls(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Dy(e,t,n,r,i){for(var o=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=gl(n,o),l!=null&&s.unshift(kl(n,l,a))):i||(l=gl(n,o),l!=null&&s.push(kl(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var rj=/\r\n?/g,ij=/\u0000|\uFFFD/g;function Iy(e){return(typeof e=="string"?e:""+e).replace(rj,`
|
|
38
|
-
`).replace(ij,"")}function Cc(e,t,n){if(t=Iy(t),Iy(e)!==t&&n)throw Error(q(425))}function qu(){}var vp=null,yp=null;function bp(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var xp=typeof setTimeout=="function"?setTimeout:void 0,oj=typeof clearTimeout=="function"?clearTimeout:void 0,Fy=typeof Promise=="function"?Promise:void 0,sj=typeof queueMicrotask=="function"?queueMicrotask:typeof Fy<"u"?function(e){return Fy.resolve(null).then(e).catch(aj)}:xp;function aj(e){setTimeout(function(){throw e})}function th(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),bl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);bl(t)}function Wi(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==="$?")break;if(t==="/$")return null}}return e}function Ny(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var aa=Math.random().toString(36).slice(2),Ur="__reactFiber$"+aa,Sl="__reactProps$"+aa,pi="__reactContainer$"+aa,wp="__reactEvents$"+aa,lj="__reactListeners$"+aa,cj="__reactHandles$"+aa;function Oo(e){var t=e[Ur];if(t)return t;for(var n=e.parentNode;n;){if(t=n[pi]||n[Ur]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ny(e);e!==null;){if(n=e[Ur])return n;e=Ny(e)}return t}e=n,n=e.parentNode}return null}function Jl(e){return e=e[Ur]||e[pi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function _s(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(q(33))}function zd(e){return e[Sl]||null}var _p=[],ks=-1;function io(e){return{current:e}}function vt(e){0>ks||(e.current=_p[ks],_p[ks]=null,ks--)}function ft(e,t){ks++,_p[ks]=e.current,e.current=t}var Xi={},xn=io(Xi),Bn=io(!1),Bo=Xi;function $s(e,t){var n=e.type.contextTypes;if(!n)return Xi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Un(e){return e=e.childContextTypes,e!=null}function $u(){vt(Bn),vt(xn)}function zy(e,t,n){if(xn.current!==Xi)throw Error(q(168));ft(xn,t),ft(Bn,n)}function h_(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(q(108,KO(e)||"Unknown",i));return Lt({},n,r)}function Ku(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Xi,Bo=xn.current,ft(xn,e),ft(Bn,Bn.current),!0}function By(e,t,n){var r=e.stateNode;if(!r)throw Error(q(169));n?(e=h_(e,t,Bo),r.__reactInternalMemoizedMergedChildContext=e,vt(Bn),vt(xn),ft(xn,e)):vt(Bn),ft(Bn,n)}var Zr=null,Bd=!1,nh=!1;function p_(e){Zr===null?Zr=[e]:Zr.push(e)}function uj(e){Bd=!0,p_(e)}function oo(){if(!nh&&Zr!==null){nh=!0;var e=0,t=nt;try{var n=Zr;for(nt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Zr=null,Bd=!1}catch(i){throw Zr!==null&&(Zr=Zr.slice(e+1)),z0(qm,oo),i}finally{nt=t,nh=!1}}return null}var Ss=[],Es=0,Yu=null,Gu=0,ur=[],dr=0,Uo=null,ni=1,ri="";function _o(e,t){Ss[Es++]=Gu,Ss[Es++]=Yu,Yu=e,Gu=t}function m_(e,t,n){ur[dr++]=ni,ur[dr++]=ri,ur[dr++]=Uo,Uo=e;var r=ni;e=ri;var i=32-Or(r)-1;r&=~(1<<i),n+=1;var o=32-Or(t)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,ni=1<<32-Or(t)+i|n<<i|r,ri=o+e}else ni=1<<o|n<<i|r,ri=e}function eg(e){e.return!==null&&(_o(e,1),m_(e,1,0))}function tg(e){for(;e===Yu;)Yu=Ss[--Es],Ss[Es]=null,Gu=Ss[--Es],Ss[Es]=null;for(;e===Uo;)Uo=ur[--dr],ur[dr]=null,ri=ur[--dr],ur[dr]=null,ni=ur[--dr],ur[dr]=null}var er=null,Zn=null,xt=!1,_r=null;function g_(e,t){var n=fr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Uy(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,er=e,Zn=Wi(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,er=e,Zn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Uo!==null?{id:ni,overflow:ri}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=fr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,er=e,Zn=null,!0):!1;default:return!1}}function kp(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Sp(e){if(xt){var t=Zn;if(t){var n=t;if(!Uy(e,t)){if(kp(e))throw Error(q(418));t=Wi(n.nextSibling);var r=er;t&&Uy(e,t)?g_(r,n):(e.flags=e.flags&-4097|2,xt=!1,er=e)}}else{if(kp(e))throw Error(q(418));e.flags=e.flags&-4097|2,xt=!1,er=e}}}function Hy(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;er=e}function jc(e){if(e!==er)return!1;if(!xt)return Hy(e),xt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!bp(e.type,e.memoizedProps)),t&&(t=Zn)){if(kp(e))throw v_(),Error(q(418));for(;t;)g_(e,t),t=Wi(t.nextSibling)}if(Hy(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Zn=Wi(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Zn=null}}else Zn=er?Wi(e.stateNode.nextSibling):null;return!0}function v_(){for(var e=Zn;e;)e=Wi(e.nextSibling)}function Ks(){Zn=er=null,xt=!1}function ng(e){_r===null?_r=[e]:_r.push(e)}var dj=bi.ReactCurrentBatchConfig;function xa(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(q(309));var r=n.stateNode}if(!r)throw Error(q(147,e));var i=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(s){var a=i.refs;s===null?delete a[o]:a[o]=s},t._stringRef=o,t)}if(typeof e!="string")throw Error(q(284));if(!n._owner)throw Error(q(290,e))}return e}function Rc(e,t){throw e=Object.prototype.toString.call(t),Error(q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Wy(e){var t=e._init;return t(e._payload)}function y_(e){function t(b,g){if(e){var k=b.deletions;k===null?(b.deletions=[g],b.flags|=16):k.push(g)}}function n(b,g){if(!e)return null;for(;g!==null;)t(b,g),g=g.sibling;return null}function r(b,g){for(b=new Map;g!==null;)g.key!==null?b.set(g.key,g):b.set(g.index,g),g=g.sibling;return b}function i(b,g){return b=Ki(b,g),b.index=0,b.sibling=null,b}function o(b,g,k){return b.index=k,e?(k=b.alternate,k!==null?(k=k.index,k<g?(b.flags|=2,g):k):(b.flags|=2,g)):(b.flags|=1048576,g)}function s(b){return e&&b.alternate===null&&(b.flags|=2),b}function a(b,g,k,E){return g===null||g.tag!==6?(g=ch(k,b.mode,E),g.return=b,g):(g=i(g,k),g.return=b,g)}function l(b,g,k,E){var C=k.type;return C===ys?u(b,g,k.props.children,E,k.key):g!==null&&(g.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Oi&&Wy(C)===g.type)?(E=i(g,k.props),E.ref=xa(b,g,k),E.return=b,E):(E=xu(k.type,k.key,k.props,null,b.mode,E),E.ref=xa(b,g,k),E.return=b,E)}function c(b,g,k,E){return g===null||g.tag!==4||g.stateNode.containerInfo!==k.containerInfo||g.stateNode.implementation!==k.implementation?(g=uh(k,b.mode,E),g.return=b,g):(g=i(g,k.children||[]),g.return=b,g)}function u(b,g,k,E,C){return g===null||g.tag!==7?(g=To(k,b.mode,E,C),g.return=b,g):(g=i(g,k),g.return=b,g)}function d(b,g,k){if(typeof g=="string"&&g!==""||typeof g=="number")return g=ch(""+g,b.mode,k),g.return=b,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case yc:return k=xu(g.type,g.key,g.props,null,b.mode,k),k.ref=xa(b,null,g),k.return=b,k;case vs:return g=uh(g,b.mode,k),g.return=b,g;case Oi:var E=g._init;return d(b,E(g._payload),k)}if(Da(g)||ma(g))return g=To(g,b.mode,k,null),g.return=b,g;Rc(b,g)}return null}function f(b,g,k,E){var C=g!==null?g.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return C!==null?null:a(b,g,""+k,E);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case yc:return k.key===C?l(b,g,k,E):null;case vs:return k.key===C?c(b,g,k,E):null;case Oi:return C=k._init,f(b,g,C(k._payload),E)}if(Da(k)||ma(k))return C!==null?null:u(b,g,k,E,null);Rc(b,k)}return null}function h(b,g,k,E,C){if(typeof E=="string"&&E!==""||typeof E=="number")return b=b.get(k)||null,a(g,b,""+E,C);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case yc:return b=b.get(E.key===null?k:E.key)||null,l(g,b,E,C);case vs:return b=b.get(E.key===null?k:E.key)||null,c(g,b,E,C);case Oi:var S=E._init;return h(b,g,k,S(E._payload),C)}if(Da(E)||ma(E))return b=b.get(k)||null,u(g,b,E,C,null);Rc(g,E)}return null}function v(b,g,k,E){for(var C=null,S=null,M=g,L=g=0,T=null;M!==null&&L<k.length;L++){M.index>L?(T=M,M=null):T=M.sibling;var V=f(b,M,k[L],E);if(V===null){M===null&&(M=T);break}e&&M&&V.alternate===null&&t(b,M),g=o(V,g,L),S===null?C=V:S.sibling=V,S=V,M=T}if(L===k.length)return n(b,M),xt&&_o(b,L),C;if(M===null){for(;L<k.length;L++)M=d(b,k[L],E),M!==null&&(g=o(M,g,L),S===null?C=M:S.sibling=M,S=M);return xt&&_o(b,L),C}for(M=r(b,M);L<k.length;L++)T=h(M,b,L,k[L],E),T!==null&&(e&&T.alternate!==null&&M.delete(T.key===null?L:T.key),g=o(T,g,L),S===null?C=T:S.sibling=T,S=T);return e&&M.forEach(function(G){return t(b,G)}),xt&&_o(b,L),C}function m(b,g,k,E){var C=ma(k);if(typeof C!="function")throw Error(q(150));if(k=C.call(k),k==null)throw Error(q(151));for(var S=C=null,M=g,L=g=0,T=null,V=k.next();M!==null&&!V.done;L++,V=k.next()){M.index>L?(T=M,M=null):T=M.sibling;var G=f(b,M,V.value,E);if(G===null){M===null&&(M=T);break}e&&M&&G.alternate===null&&t(b,M),g=o(G,g,L),S===null?C=G:S.sibling=G,S=G,M=T}if(V.done)return n(b,M),xt&&_o(b,L),C;if(M===null){for(;!V.done;L++,V=k.next())V=d(b,V.value,E),V!==null&&(g=o(V,g,L),S===null?C=V:S.sibling=V,S=V);return xt&&_o(b,L),C}for(M=r(b,M);!V.done;L++,V=k.next())V=h(M,b,L,V.value,E),V!==null&&(e&&V.alternate!==null&&M.delete(V.key===null?L:V.key),g=o(V,g,L),S===null?C=V:S.sibling=V,S=V);return e&&M.forEach(function(N){return t(b,N)}),xt&&_o(b,L),C}function x(b,g,k,E){if(typeof k=="object"&&k!==null&&k.type===ys&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case yc:e:{for(var C=k.key,S=g;S!==null;){if(S.key===C){if(C=k.type,C===ys){if(S.tag===7){n(b,S.sibling),g=i(S,k.props.children),g.return=b,b=g;break e}}else if(S.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Oi&&Wy(C)===S.type){n(b,S.sibling),g=i(S,k.props),g.ref=xa(b,S,k),g.return=b,b=g;break e}n(b,S);break}else t(b,S);S=S.sibling}k.type===ys?(g=To(k.props.children,b.mode,E,k.key),g.return=b,b=g):(E=xu(k.type,k.key,k.props,null,b.mode,E),E.ref=xa(b,g,k),E.return=b,b=E)}return s(b);case vs:e:{for(S=k.key;g!==null;){if(g.key===S)if(g.tag===4&&g.stateNode.containerInfo===k.containerInfo&&g.stateNode.implementation===k.implementation){n(b,g.sibling),g=i(g,k.children||[]),g.return=b,b=g;break e}else{n(b,g);break}else t(b,g);g=g.sibling}g=uh(k,b.mode,E),g.return=b,b=g}return s(b);case Oi:return S=k._init,x(b,g,S(k._payload),E)}if(Da(k))return v(b,g,k,E);if(ma(k))return m(b,g,k,E);Rc(b,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,g!==null&&g.tag===6?(n(b,g.sibling),g=i(g,k),g.return=b,b=g):(n(b,g),g=ch(k,b.mode,E),g.return=b,b=g),s(b)):n(b,g)}return x}var Ys=y_(!0),b_=y_(!1),Ju=io(null),Xu=null,Os=null,rg=null;function ig(){rg=Os=Xu=null}function og(e){var t=Ju.current;vt(Ju),e._currentValue=t}function Ep(e,t,n){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===n)break;e=e.return}}function zs(e,t){Xu=e,rg=Os=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(zn=!0),e.firstContext=null)}function mr(e){var t=e._currentValue;if(rg!==e)if(e={context:e,memoizedValue:t,next:null},Os===null){if(Xu===null)throw Error(q(308));Os=e,Xu.dependencies={lanes:0,firstContext:e}}else Os=Os.next=e;return t}var Co=null;function sg(e){Co===null?Co=[e]:Co.push(e)}function x_(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,sg(t)):(n.next=i.next,i.next=n),t.interleaved=n,mi(e,r)}function mi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ci=!1;function ag(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function w_(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function li(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Vi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ke&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,mi(e,n)}return i=r.interleaved,i===null?(t.next=t,sg(r)):(t.next=i.next,i.next=t),r.interleaved=t,mi(e,n)}function pu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$m(e,n)}}function Vy(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Qu(e,t,n,r){var i=e.updateQueue;Ci=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?o=c:s.next=c,s=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==s&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(o!==null){var d=i.baseState;s=0,u=c=l=null,a=o;do{var f=a.lane,h=a.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=e,m=a;switch(f=t,h=n,m.tag){case 1:if(v=m.payload,typeof v=="function"){d=v.call(h,d,f);break e}d=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=m.payload,f=typeof v=="function"?v.call(h,d,f):v,f==null)break e;d=Lt({},d,f);break e;case 2:Ci=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=h,l=d):u=u.next=h,s|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do s|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);Wo|=s,e.lanes=s,e.memoizedState=d}}function qy(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(q(191,i));i.call(r)}}}var Xl={},Wr=io(Xl),El=io(Xl),Ol=io(Xl);function jo(e){if(e===Xl)throw Error(q(174));return e}function lg(e,t){switch(ft(Ol,t),ft(El,e),ft(Wr,Xl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:op(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=op(t,e)}vt(Wr),ft(Wr,t)}function Gs(){vt(Wr),vt(El),vt(Ol)}function __(e){jo(Ol.current);var t=jo(Wr.current),n=op(t,e.type);t!==n&&(ft(El,e),ft(Wr,n))}function cg(e){El.current===e&&(vt(Wr),vt(El))}var Ct=io(0);function Zu(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var rh=[];function ug(){for(var e=0;e<rh.length;e++)rh[e]._workInProgressVersionPrimary=null;rh.length=0}var mu=bi.ReactCurrentDispatcher,ih=bi.ReactCurrentBatchConfig,Ho=0,Rt=null,$t=null,Qt=null,ed=!1,el=!1,Cl=0,fj=0;function dn(){throw Error(q(321))}function dg(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Lr(e[n],t[n]))return!1;return!0}function fg(e,t,n,r,i,o){if(Ho=o,Rt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,mu.current=e===null||e.memoizedState===null?gj:vj,e=n(r,i),el){o=0;do{if(el=!1,Cl=0,25<=o)throw Error(q(301));o+=1,Qt=$t=null,t.updateQueue=null,mu.current=yj,e=n(r,i)}while(el)}if(mu.current=td,t=$t!==null&&$t.next!==null,Ho=0,Qt=$t=Rt=null,ed=!1,t)throw Error(q(300));return e}function hg(){var e=Cl!==0;return Cl=0,e}function Nr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?Rt.memoizedState=Qt=e:Qt=Qt.next=e,Qt}function gr(){if($t===null){var e=Rt.alternate;e=e!==null?e.memoizedState:null}else e=$t.next;var t=Qt===null?Rt.memoizedState:Qt.next;if(t!==null)Qt=t,$t=e;else{if(e===null)throw Error(q(310));$t=e,e={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},Qt===null?Rt.memoizedState=Qt=e:Qt=Qt.next=e}return Qt}function jl(e,t){return typeof t=="function"?t(e):t}function oh(e){var t=gr(),n=t.queue;if(n===null)throw Error(q(311));n.lastRenderedReducer=e;var r=$t,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var a=s=null,l=null,c=o;do{var u=c.lane;if((Ho&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=d,s=r):l=l.next=d,Rt.lanes|=u,Wo|=u}c=c.next}while(c!==null&&c!==o);l===null?s=r:l.next=a,Lr(r,t.memoizedState)||(zn=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do o=i.lane,Rt.lanes|=o,Wo|=o,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function sh(e){var t=gr(),n=t.queue;if(n===null)throw Error(q(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=e(o,s.action),s=s.next;while(s!==i);Lr(o,t.memoizedState)||(zn=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function k_(){}function S_(e,t){var n=Rt,r=gr(),i=t(),o=!Lr(r.memoizedState,i);if(o&&(r.memoizedState=i,zn=!0),r=r.queue,pg(C_.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||Qt!==null&&Qt.memoizedState.tag&1){if(n.flags|=2048,Rl(9,O_.bind(null,n,r,i,t),void 0,null),en===null)throw Error(q(349));Ho&30||E_(n,t,i)}return i}function E_(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Rt.updateQueue,t===null?(t={lastEffect:null,stores:null},Rt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function O_(e,t,n,r){t.value=n,t.getSnapshot=r,j_(t)&&R_(e)}function C_(e,t,n){return n(function(){j_(t)&&R_(e)})}function j_(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Lr(e,n)}catch{return!0}}function R_(e){var t=mi(e,1);t!==null&&Cr(t,e,1,-1)}function $y(e){var t=Nr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:jl,lastRenderedState:e},t.queue=e,e=e.dispatch=mj.bind(null,Rt,e),[t.memoizedState,e]}function Rl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Rt.updateQueue,t===null?(t={lastEffect:null,stores:null},Rt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function L_(){return gr().memoizedState}function gu(e,t,n,r){var i=Nr();Rt.flags|=e,i.memoizedState=Rl(1|t,n,void 0,r===void 0?null:r)}function Ud(e,t,n,r){var i=gr();r=r===void 0?null:r;var o=void 0;if($t!==null){var s=$t.memoizedState;if(o=s.destroy,r!==null&&dg(r,s.deps)){i.memoizedState=Rl(t,n,o,r);return}}Rt.flags|=e,i.memoizedState=Rl(1|t,n,o,r)}function Ky(e,t){return gu(8390656,8,e,t)}function pg(e,t){return Ud(2048,8,e,t)}function A_(e,t){return Ud(4,2,e,t)}function P_(e,t){return Ud(4,4,e,t)}function M_(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function T_(e,t,n){return n=n!=null?n.concat([e]):null,Ud(4,4,M_.bind(null,t,e),n)}function mg(){}function D_(e,t){var n=gr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&dg(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function I_(e,t){var n=gr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&dg(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function F_(e,t,n){return Ho&21?(Lr(n,t)||(n=H0(),Rt.lanes|=n,Wo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,zn=!0),e.memoizedState=n)}function hj(e,t){var n=nt;nt=n!==0&&4>n?n:4,e(!0);var r=ih.transition;ih.transition={};try{e(!1),t()}finally{nt=n,ih.transition=r}}function N_(){return gr().memoizedState}function pj(e,t,n){var r=$i(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},z_(e))B_(t,n);else if(n=x_(e,t,n,r),n!==null){var i=jn();Cr(n,e,r,i),U_(n,t,r)}}function mj(e,t,n){var r=$i(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(z_(e))B_(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,Lr(a,s)){var l=t.interleaved;l===null?(i.next=i,sg(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=x_(e,t,i,r),n!==null&&(i=jn(),Cr(n,e,r,i),U_(n,t,r))}}function z_(e){var t=e.alternate;return e===Rt||t!==null&&t===Rt}function B_(e,t){el=ed=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function U_(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$m(e,n)}}var td={readContext:mr,useCallback:dn,useContext:dn,useEffect:dn,useImperativeHandle:dn,useInsertionEffect:dn,useLayoutEffect:dn,useMemo:dn,useReducer:dn,useRef:dn,useState:dn,useDebugValue:dn,useDeferredValue:dn,useTransition:dn,useMutableSource:dn,useSyncExternalStore:dn,useId:dn,unstable_isNewReconciler:!1},gj={readContext:mr,useCallback:function(e,t){return Nr().memoizedState=[e,t===void 0?null:t],e},useContext:mr,useEffect:Ky,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,gu(4194308,4,M_.bind(null,t,e),n)},useLayoutEffect:function(e,t){return gu(4194308,4,e,t)},useInsertionEffect:function(e,t){return gu(4,2,e,t)},useMemo:function(e,t){var n=Nr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Nr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=pj.bind(null,Rt,e),[r.memoizedState,e]},useRef:function(e){var t=Nr();return e={current:e},t.memoizedState=e},useState:$y,useDebugValue:mg,useDeferredValue:function(e){return Nr().memoizedState=e},useTransition:function(){var e=$y(!1),t=e[0];return e=hj.bind(null,e[1]),Nr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Rt,i=Nr();if(xt){if(n===void 0)throw Error(q(407));n=n()}else{if(n=t(),en===null)throw Error(q(349));Ho&30||E_(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Ky(C_.bind(null,r,o,e),[e]),r.flags|=2048,Rl(9,O_.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Nr(),t=en.identifierPrefix;if(xt){var n=ri,r=ni;n=(r&~(1<<32-Or(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Cl++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=fj++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},vj={readContext:mr,useCallback:D_,useContext:mr,useEffect:pg,useImperativeHandle:T_,useInsertionEffect:A_,useLayoutEffect:P_,useMemo:I_,useReducer:oh,useRef:L_,useState:function(){return oh(jl)},useDebugValue:mg,useDeferredValue:function(e){var t=gr();return F_(t,$t.memoizedState,e)},useTransition:function(){var e=oh(jl)[0],t=gr().memoizedState;return[e,t]},useMutableSource:k_,useSyncExternalStore:S_,useId:N_,unstable_isNewReconciler:!1},yj={readContext:mr,useCallback:D_,useContext:mr,useEffect:pg,useImperativeHandle:T_,useInsertionEffect:A_,useLayoutEffect:P_,useMemo:I_,useReducer:sh,useRef:L_,useState:function(){return sh(jl)},useDebugValue:mg,useDeferredValue:function(e){var t=gr();return $t===null?t.memoizedState=e:F_(t,$t.memoizedState,e)},useTransition:function(){var e=sh(jl)[0],t=gr().memoizedState;return[e,t]},useMutableSource:k_,useSyncExternalStore:S_,useId:N_,unstable_isNewReconciler:!1};function xr(e,t){if(e&&e.defaultProps){t=Lt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Op(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Lt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Hd={isMounted:function(e){return(e=e._reactInternals)?Qo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=jn(),i=$i(e),o=li(r,i);o.payload=t,n!=null&&(o.callback=n),t=Vi(e,o,i),t!==null&&(Cr(t,e,i,r),pu(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=jn(),i=$i(e),o=li(r,i);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Vi(e,o,i),t!==null&&(Cr(t,e,i,r),pu(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=jn(),r=$i(e),i=li(n,r);i.tag=2,t!=null&&(i.callback=t),t=Vi(e,i,r),t!==null&&(Cr(t,e,r,n),pu(t,e,r))}};function Yy(e,t,n,r,i,o,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,s):t.prototype&&t.prototype.isPureReactComponent?!wl(n,r)||!wl(i,o):!0}function H_(e,t,n){var r=!1,i=Xi,o=t.contextType;return typeof o=="object"&&o!==null?o=mr(o):(i=Un(t)?Bo:xn.current,r=t.contextTypes,o=(r=r!=null)?$s(e,i):Xi),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Hd,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function Gy(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Hd.enqueueReplaceState(t,t.state,null)}function Cp(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},ag(e);var o=t.contextType;typeof o=="object"&&o!==null?i.context=mr(o):(o=Un(t)?Bo:xn.current,i.context=$s(e,o)),i.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Op(e,t,o,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Hd.enqueueReplaceState(i,i.state,null),Qu(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Js(e,t){try{var n="",r=t;do n+=$O(r),r=r.return;while(r);var i=n}catch(o){i=`
|
|
39
|
-
Error generating stack: `+o.message+`
|
|
40
|
-
`+o.stack}return{value:e,source:t,stack:i,digest:null}}function ah(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function jp(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var bj=typeof WeakMap=="function"?WeakMap:Map;function W_(e,t,n){n=li(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rd||(rd=!0,Np=r),jp(e,t)},n}function V_(e,t,n){n=li(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){jp(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){jp(e,t),typeof r!="function"&&(qi===null?qi=new Set([this]):qi.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Jy(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new bj;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Mj.bind(null,e,t,n),t.then(e,e))}function Xy(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Qy(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=li(-1,1),t.tag=2,Vi(n,t,1))),n.lanes|=1),e)}var xj=bi.ReactCurrentOwner,zn=!1;function Cn(e,t,n,r){t.child=e===null?b_(t,null,n,r):Ys(t,e.child,n,r)}function Zy(e,t,n,r,i){n=n.render;var o=t.ref;return zs(t,i),r=fg(e,t,n,r,o,i),n=hg(),e!==null&&!zn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,gi(e,t,i)):(xt&&n&&eg(t),t.flags|=1,Cn(e,t,r,i),t.child)}function eb(e,t,n,r,i){if(e===null){var o=n.type;return typeof o=="function"&&!kg(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,q_(e,t,o,r,i)):(e=xu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&i)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:wl,n(s,r)&&e.ref===t.ref)return gi(e,t,i)}return t.flags|=1,e=Ki(o,r),e.ref=t.ref,e.return=t,t.child=e}function q_(e,t,n,r,i){if(e!==null){var o=e.memoizedProps;if(wl(o,r)&&e.ref===t.ref)if(zn=!1,t.pendingProps=r=o,(e.lanes&i)!==0)e.flags&131072&&(zn=!0);else return t.lanes=e.lanes,gi(e,t,i)}return Rp(e,t,n,r,i)}function $_(e,t,n){var r=t.pendingProps,i=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ft(js,Gn),Gn|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ft(js,Gn),Gn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,ft(js,Gn),Gn|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,ft(js,Gn),Gn|=r;return Cn(e,t,i,n),t.child}function K_(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Rp(e,t,n,r,i){var o=Un(n)?Bo:xn.current;return o=$s(t,o),zs(t,i),n=fg(e,t,n,r,o,i),r=hg(),e!==null&&!zn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,gi(e,t,i)):(xt&&r&&eg(t),t.flags|=1,Cn(e,t,n,i),t.child)}function tb(e,t,n,r,i){if(Un(n)){var o=!0;Ku(t)}else o=!1;if(zs(t,i),t.stateNode===null)vu(e,t),H_(t,n,r),Cp(t,n,r,i),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=mr(c):(c=Un(n)?Bo:xn.current,c=$s(t,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&Gy(t,s,r,c),Ci=!1;var f=t.memoizedState;s.state=f,Qu(t,r,s,i),l=t.memoizedState,a!==r||f!==l||Bn.current||Ci?(typeof u=="function"&&(Op(t,n,u,r),l=t.memoizedState),(a=Ci||Yy(t,n,a,r,f,l,c))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,w_(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:xr(t.type,a),s.props=c,d=t.pendingProps,f=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=mr(l):(l=Un(n)?Bo:xn.current,l=$s(t,l));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==d||f!==l)&&Gy(t,s,r,l),Ci=!1,f=t.memoizedState,s.state=f,Qu(t,r,s,i);var v=t.memoizedState;a!==d||f!==v||Bn.current||Ci?(typeof h=="function"&&(Op(t,n,h,r),v=t.memoizedState),(c=Ci||Yy(t,n,c,r,f,v,l)||!1)?(u||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,v,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,v,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=v),s.props=r,s.state=v,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Lp(e,t,n,r,o,i)}function Lp(e,t,n,r,i,o){K_(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return i&&By(t,n,!1),gi(e,t,o);r=t.stateNode,xj.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Ys(t,e.child,null,o),t.child=Ys(t,null,a,o)):Cn(e,t,a,o),t.memoizedState=r.state,i&&By(t,n,!0),t.child}function Y_(e){var t=e.stateNode;t.pendingContext?zy(e,t.pendingContext,t.pendingContext!==t.context):t.context&&zy(e,t.context,!1),lg(e,t.containerInfo)}function nb(e,t,n,r,i){return Ks(),ng(i),t.flags|=256,Cn(e,t,n,r),t.child}var Ap={dehydrated:null,treeContext:null,retryLane:0};function Pp(e){return{baseLanes:e,cachePool:null,transitions:null}}function G_(e,t,n){var r=t.pendingProps,i=Ct.current,o=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),ft(Ct,i&1),e===null)return Sp(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,o?(r=t.mode,o=t.child,s={mode:"hidden",children:s},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=qd(s,r,0,null),e=To(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Pp(n),t.memoizedState=Ap,e):gg(t,s));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return wj(e,t,s,r,a,i,n);if(o){o=r.fallback,s=t.mode,i=e.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Ki(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?o=Ki(a,o):(o=To(o,s,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,s=e.child.memoizedState,s=s===null?Pp(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=e.childLanes&~n,t.memoizedState=Ap,r}return o=e.child,e=o.sibling,r=Ki(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function gg(e,t){return t=qd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Lc(e,t,n,r){return r!==null&&ng(r),Ys(t,e.child,null,n),e=gg(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function wj(e,t,n,r,i,o,s){if(n)return t.flags&256?(t.flags&=-257,r=ah(Error(q(422))),Lc(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,i=t.mode,r=qd({mode:"visible",children:r.children},i,0,null),o=To(o,i,s,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&Ys(t,e.child,null,s),t.child.memoizedState=Pp(s),t.memoizedState=Ap,o);if(!(t.mode&1))return Lc(e,t,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,o=Error(q(419)),r=ah(o,r,void 0),Lc(e,t,s,r)}if(a=(s&e.childLanes)!==0,zn||a){if(r=en,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,mi(e,i),Cr(r,e,i,-1))}return _g(),r=ah(Error(q(421))),Lc(e,t,s,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Tj.bind(null,e),i._reactRetry=t,null):(e=o.treeContext,Zn=Wi(i.nextSibling),er=t,xt=!0,_r=null,e!==null&&(ur[dr++]=ni,ur[dr++]=ri,ur[dr++]=Uo,ni=e.id,ri=e.overflow,Uo=t),t=gg(t,r.children),t.flags|=4096,t)}function rb(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ep(e.return,t,n)}function lh(e,t,n,r,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function J_(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Cn(e,t,r.children,n),r=Ct.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&rb(e,n,t);else if(e.tag===19)rb(e,n,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}r&=1}if(ft(Ct,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Zu(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),lh(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Zu(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}lh(t,!0,n,null,o);break;case"together":lh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function vu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function gi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(q(153));if(t.child!==null){for(e=t.child,n=Ki(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ki(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function _j(e,t,n){switch(t.tag){case 3:Y_(t),Ks();break;case 5:__(t);break;case 1:Un(t.type)&&Ku(t);break;case 4:lg(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;ft(Ju,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ft(Ct,Ct.current&1),t.flags|=128,null):n&t.child.childLanes?G_(e,t,n):(ft(Ct,Ct.current&1),e=gi(e,t,n),e!==null?e.sibling:null);ft(Ct,Ct.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return J_(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ft(Ct,Ct.current),r)break;return null;case 22:case 23:return t.lanes=0,$_(e,t,n)}return gi(e,t,n)}var X_,Mp,Q_,Z_;X_=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Mp=function(){};Q_=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,jo(Wr.current);var o=null;switch(n){case"input":i=tp(e,i),r=tp(e,r),o=[];break;case"select":i=Lt({},i,{value:void 0}),r=Lt({},r,{value:void 0}),o=[];break;case"textarea":i=ip(e,i),r=ip(e,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=qu)}sp(n,r);var s;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(pl.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(o||(o=[]),o.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(o=o||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(pl.hasOwnProperty(c)?(l!=null&&c==="onScroll"&>("scroll",e),o||a===l||(o=[])):(o=o||[]).push(c,l))}n&&(o=o||[]).push("style",n);var c=o;(t.updateQueue=c)&&(t.flags|=4)}};Z_=function(e,t,n,r){n!==r&&(t.flags|=4)};function wa(e,t){if(!xt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function fn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function kj(e,t,n){var r=t.pendingProps;switch(tg(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fn(t),null;case 1:return Un(t.type)&&$u(),fn(t),null;case 3:return r=t.stateNode,Gs(),vt(Bn),vt(xn),ug(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(jc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,_r!==null&&(Up(_r),_r=null))),Mp(e,t),fn(t),null;case 5:cg(t);var i=jo(Ol.current);if(n=t.type,e!==null&&t.stateNode!=null)Q_(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(q(166));return fn(t),null}if(e=jo(Wr.current),jc(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Ur]=t,r[Sl]=o,e=(t.mode&1)!==0,n){case"dialog":gt("cancel",r),gt("close",r);break;case"iframe":case"object":case"embed":gt("load",r);break;case"video":case"audio":for(i=0;i<Fa.length;i++)gt(Fa[i],r);break;case"source":gt("error",r);break;case"img":case"image":case"link":gt("error",r),gt("load",r);break;case"details":gt("toggle",r);break;case"input":fy(r,o),gt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},gt("invalid",r);break;case"textarea":py(r,o),gt("invalid",r)}sp(n,o),i=null;for(var s in o)if(o.hasOwnProperty(s)){var a=o[s];s==="children"?typeof a=="string"?r.textContent!==a&&(o.suppressHydrationWarning!==!0&&Cc(r.textContent,a,e),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&Cc(r.textContent,a,e),i=["children",""+a]):pl.hasOwnProperty(s)&&a!=null&&s==="onScroll"&>("scroll",r)}switch(n){case"input":bc(r),hy(r,o,!0);break;case"textarea":bc(r),my(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=qu)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=C0(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Ur]=t,e[Sl]=r,X_(e,t,!1,!1),t.stateNode=e;e:{switch(s=ap(n,r),n){case"dialog":gt("cancel",e),gt("close",e),i=r;break;case"iframe":case"object":case"embed":gt("load",e),i=r;break;case"video":case"audio":for(i=0;i<Fa.length;i++)gt(Fa[i],e);i=r;break;case"source":gt("error",e),i=r;break;case"img":case"image":case"link":gt("error",e),gt("load",e),i=r;break;case"details":gt("toggle",e),i=r;break;case"input":fy(e,r),i=tp(e,r),gt("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Lt({},r,{value:void 0}),gt("invalid",e);break;case"textarea":py(e,r),i=ip(e,r),gt("invalid",e);break;default:i=r}sp(n,i),a=i;for(o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="style"?L0(e,l):o==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&j0(e,l)):o==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&ml(e,l):typeof l=="number"&&ml(e,""+l):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(pl.hasOwnProperty(o)?l!=null&&o==="onScroll"&>("scroll",e):l!=null&&Bm(e,o,l,s))}switch(n){case"input":bc(e),hy(e,r,!1);break;case"textarea":bc(e),my(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ji(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Ds(e,!!r.multiple,o,!1):r.defaultValue!=null&&Ds(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=qu)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return fn(t),null;case 6:if(e&&t.stateNode!=null)Z_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(q(166));if(n=jo(Ol.current),jo(Wr.current),jc(t)){if(r=t.stateNode,n=t.memoizedProps,r[Ur]=t,(o=r.nodeValue!==n)&&(e=er,e!==null))switch(e.tag){case 3:Cc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Cc(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ur]=t,t.stateNode=r}return fn(t),null;case 13:if(vt(Ct),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(xt&&Zn!==null&&t.mode&1&&!(t.flags&128))v_(),Ks(),t.flags|=98560,o=!1;else if(o=jc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(q(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(q(317));o[Ur]=t}else Ks(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;fn(t),o=!1}else _r!==null&&(Up(_r),_r=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ct.current&1?Yt===0&&(Yt=3):_g())),t.updateQueue!==null&&(t.flags|=4),fn(t),null);case 4:return Gs(),Mp(e,t),e===null&&_l(t.stateNode.containerInfo),fn(t),null;case 10:return og(t.type._context),fn(t),null;case 17:return Un(t.type)&&$u(),fn(t),null;case 19:if(vt(Ct),o=t.memoizedState,o===null)return fn(t),null;if(r=(t.flags&128)!==0,s=o.rendering,s===null)if(r)wa(o,!1);else{if(Yt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Zu(e),s!==null){for(t.flags|=128,wa(o,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,s=o.alternate,s===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,o.type=s.type,e=s.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ft(Ct,Ct.current&1|2),t.child}e=e.sibling}o.tail!==null&&zt()>Xs&&(t.flags|=128,r=!0,wa(o,!1),t.lanes=4194304)}else{if(!r)if(e=Zu(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),wa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!xt)return fn(t),null}else 2*zt()-o.renderingStartTime>Xs&&n!==1073741824&&(t.flags|=128,r=!0,wa(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=zt(),t.sibling=null,n=Ct.current,ft(Ct,r?n&1|2:n&1),t):(fn(t),null);case 22:case 23:return wg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Gn&1073741824&&(fn(t),t.subtreeFlags&6&&(t.flags|=8192)):fn(t),null;case 24:return null;case 25:return null}throw Error(q(156,t.tag))}function Sj(e,t){switch(tg(t),t.tag){case 1:return Un(t.type)&&$u(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gs(),vt(Bn),vt(xn),ug(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return cg(t),null;case 13:if(vt(Ct),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(q(340));Ks()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vt(Ct),null;case 4:return Gs(),null;case 10:return og(t.type._context),null;case 22:case 23:return wg(),null;case 24:return null;default:return null}}var Ac=!1,yn=!1,Ej=typeof WeakSet=="function"?WeakSet:Set,ue=null;function Cs(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Tt(e,t,r)}else n.current=null}function Tp(e,t,n){try{n()}catch(r){Tt(e,t,r)}}var ib=!1;function Oj(e,t){if(vp=Hu,e=i_(),Zm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(a=s+i),d!==o||r!==0&&d.nodeType!==3||(l=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++c===i&&(a=s),f===o&&++u===r&&(l=s),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(yp={focusedElem:e,selectionRange:n},Hu=!1,ue=t;ue!==null;)if(t=ue,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ue=e;else for(;ue!==null;){t=ue;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var m=v.memoizedProps,x=v.memoizedState,b=t.stateNode,g=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:xr(t.type,m),x);b.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var k=t.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(E){Tt(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,ue=e;break}ue=t.return}return v=ib,ib=!1,v}function tl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&Tp(t,n,o)}i=i.next}while(i!==r)}}function Wd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Dp(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function ek(e){var t=e.alternate;t!==null&&(e.alternate=null,ek(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ur],delete t[Sl],delete t[wp],delete t[lj],delete t[cj])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function tk(e){return e.tag===5||e.tag===3||e.tag===4}function ob(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||tk(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.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 Ip(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qu));else if(r!==4&&(e=e.child,e!==null))for(Ip(e,t,n),e=e.sibling;e!==null;)Ip(e,t,n),e=e.sibling}function Fp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Fp(e,t,n),e=e.sibling;e!==null;)Fp(e,t,n),e=e.sibling}var rn=null,wr=!1;function _i(e,t,n){for(n=n.child;n!==null;)nk(e,t,n),n=n.sibling}function nk(e,t,n){if(Hr&&typeof Hr.onCommitFiberUnmount=="function")try{Hr.onCommitFiberUnmount(Dd,n)}catch{}switch(n.tag){case 5:yn||Cs(n,t);case 6:var r=rn,i=wr;rn=null,_i(e,t,n),rn=r,wr=i,rn!==null&&(wr?(e=rn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):rn.removeChild(n.stateNode));break;case 18:rn!==null&&(wr?(e=rn,n=n.stateNode,e.nodeType===8?th(e.parentNode,n):e.nodeType===1&&th(e,n),bl(e)):th(rn,n.stateNode));break;case 4:r=rn,i=wr,rn=n.stateNode.containerInfo,wr=!0,_i(e,t,n),rn=r,wr=i;break;case 0:case 11:case 14:case 15:if(!yn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Tp(n,t,s),i=i.next}while(i!==r)}_i(e,t,n);break;case 1:if(!yn&&(Cs(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Tt(n,t,a)}_i(e,t,n);break;case 21:_i(e,t,n);break;case 22:n.mode&1?(yn=(r=yn)||n.memoizedState!==null,_i(e,t,n),yn=r):_i(e,t,n);break;default:_i(e,t,n)}}function sb(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ej),t.forEach(function(r){var i=Dj.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function yr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=e,s=t,a=s;e:for(;a!==null;){switch(a.tag){case 5:rn=a.stateNode,wr=!1;break e;case 3:rn=a.stateNode.containerInfo,wr=!0;break e;case 4:rn=a.stateNode.containerInfo,wr=!0;break e}a=a.return}if(rn===null)throw Error(q(160));nk(o,s,i),rn=null,wr=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Tt(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)rk(t,e),t=t.sibling}function rk(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(yr(t,e),Tr(e),r&4){try{tl(3,e,e.return),Wd(3,e)}catch(m){Tt(e,e.return,m)}try{tl(5,e,e.return)}catch(m){Tt(e,e.return,m)}}break;case 1:yr(t,e),Tr(e),r&512&&n!==null&&Cs(n,n.return);break;case 5:if(yr(t,e),Tr(e),r&512&&n!==null&&Cs(n,n.return),e.flags&32){var i=e.stateNode;try{ml(i,"")}catch(m){Tt(e,e.return,m)}}if(r&4&&(i=e.stateNode,i!=null)){var o=e.memoizedProps,s=n!==null?n.memoizedProps:o,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&o.type==="radio"&&o.name!=null&&E0(i,o),ap(a,s);var c=ap(a,o);for(s=0;s<l.length;s+=2){var u=l[s],d=l[s+1];u==="style"?L0(i,d):u==="dangerouslySetInnerHTML"?j0(i,d):u==="children"?ml(i,d):Bm(i,u,d,c)}switch(a){case"input":np(i,o);break;case"textarea":O0(i,o);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var h=o.value;h!=null?Ds(i,!!o.multiple,h,!1):f!==!!o.multiple&&(o.defaultValue!=null?Ds(i,!!o.multiple,o.defaultValue,!0):Ds(i,!!o.multiple,o.multiple?[]:"",!1))}i[Sl]=o}catch(m){Tt(e,e.return,m)}}break;case 6:if(yr(t,e),Tr(e),r&4){if(e.stateNode===null)throw Error(q(162));i=e.stateNode,o=e.memoizedProps;try{i.nodeValue=o}catch(m){Tt(e,e.return,m)}}break;case 3:if(yr(t,e),Tr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{bl(t.containerInfo)}catch(m){Tt(e,e.return,m)}break;case 4:yr(t,e),Tr(e);break;case 13:yr(t,e),Tr(e),i=e.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(bg=zt())),r&4&&sb(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(yn=(c=yn)||u,yr(t,e),yn=c):yr(t,e),Tr(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(ue=e,u=e.child;u!==null;){for(d=ue=u;ue!==null;){switch(f=ue,h=f.child,f.tag){case 0:case 11:case 14:case 15:tl(4,f,f.return);break;case 1:Cs(f,f.return);var v=f.stateNode;if(typeof v.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(m){Tt(r,n,m)}}break;case 5:Cs(f,f.return);break;case 22:if(f.memoizedState!==null){lb(d);continue}}h!==null?(h.return=f,ue=h):lb(d)}u=u.sibling}e:for(u=null,d=e;;){if(d.tag===5){if(u===null){u=d;try{i=d.stateNode,c?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=d.stateNode,l=d.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=R0("display",s))}catch(m){Tt(e,e.return,m)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(m){Tt(e,e.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:yr(t,e),Tr(e),r&4&&sb(e);break;case 21:break;default:yr(t,e),Tr(e)}}function Tr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(tk(n)){var r=n;break e}n=n.return}throw Error(q(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(ml(i,""),r.flags&=-33);var o=ob(e);Fp(e,o,i);break;case 3:case 4:var s=r.stateNode.containerInfo,a=ob(e);Ip(e,a,s);break;default:throw Error(q(161))}}catch(l){Tt(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cj(e,t,n){ue=e,ik(e)}function ik(e,t,n){for(var r=(e.mode&1)!==0;ue!==null;){var i=ue,o=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||Ac;if(!s){var a=i.alternate,l=a!==null&&a.memoizedState!==null||yn;a=Ac;var c=yn;if(Ac=s,(yn=l)&&!c)for(ue=i;ue!==null;)s=ue,l=s.child,s.tag===22&&s.memoizedState!==null?cb(i):l!==null?(l.return=s,ue=l):cb(i);for(;o!==null;)ue=o,ik(o),o=o.sibling;ue=i,Ac=a,yn=c}ab(e)}else i.subtreeFlags&8772&&o!==null?(o.return=i,ue=o):ab(e)}}function ab(e){for(;ue!==null;){var t=ue;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:yn||Wd(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!yn)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:xr(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&qy(t,o,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}qy(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&bl(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(q(163))}yn||t.flags&512&&Dp(t)}catch(f){Tt(t,t.return,f)}}if(t===e){ue=null;break}if(n=t.sibling,n!==null){n.return=t.return,ue=n;break}ue=t.return}}function lb(e){for(;ue!==null;){var t=ue;if(t===e){ue=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ue=n;break}ue=t.return}}function cb(e){for(;ue!==null;){var t=ue;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Wd(4,t)}catch(l){Tt(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(l){Tt(t,i,l)}}var o=t.return;try{Dp(t)}catch(l){Tt(t,o,l)}break;case 5:var s=t.return;try{Dp(t)}catch(l){Tt(t,s,l)}}}catch(l){Tt(t,t.return,l)}if(t===e){ue=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ue=a;break}ue=t.return}}var jj=Math.ceil,nd=bi.ReactCurrentDispatcher,vg=bi.ReactCurrentOwner,pr=bi.ReactCurrentBatchConfig,Ke=0,en=null,Ht=null,on=0,Gn=0,js=io(0),Yt=0,Ll=null,Wo=0,Vd=0,yg=0,nl=null,Fn=null,bg=0,Xs=1/0,Qr=null,rd=!1,Np=null,qi=null,Pc=!1,Pi=null,id=0,rl=0,zp=null,yu=-1,bu=0;function jn(){return Ke&6?zt():yu!==-1?yu:yu=zt()}function $i(e){return e.mode&1?Ke&2&&on!==0?on&-on:dj.transition!==null?(bu===0&&(bu=H0()),bu):(e=nt,e!==0||(e=window.event,e=e===void 0?16:G0(e.type)),e):1}function Cr(e,t,n,r){if(50<rl)throw rl=0,zp=null,Error(q(185));Yl(e,n,r),(!(Ke&2)||e!==en)&&(e===en&&(!(Ke&2)&&(Vd|=n),Yt===4&&Ri(e,on)),Hn(e,r),n===1&&Ke===0&&!(t.mode&1)&&(Xs=zt()+500,Bd&&oo()))}function Hn(e,t){var n=e.callbackNode;dC(e,t);var r=Uu(e,e===en?on:0);if(r===0)n!==null&&yy(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&yy(n),t===1)e.tag===0?uj(ub.bind(null,e)):p_(ub.bind(null,e)),sj(function(){!(Ke&6)&&oo()}),n=null;else{switch(W0(r)){case 1:n=qm;break;case 4:n=B0;break;case 16:n=Bu;break;case 536870912:n=U0;break;default:n=Bu}n=fk(n,ok.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ok(e,t){if(yu=-1,bu=0,Ke&6)throw Error(q(327));var n=e.callbackNode;if(Bs()&&e.callbackNode!==n)return null;var r=Uu(e,e===en?on:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=od(e,r);else{t=r;var i=Ke;Ke|=2;var o=ak();(en!==e||on!==t)&&(Qr=null,Xs=zt()+500,Mo(e,t));do try{Aj();break}catch(a){sk(e,a)}while(!0);ig(),nd.current=o,Ke=i,Ht!==null?t=0:(en=null,on=0,t=Yt)}if(t!==0){if(t===2&&(i=fp(e),i!==0&&(r=i,t=Bp(e,i))),t===1)throw n=Ll,Mo(e,0),Ri(e,r),Hn(e,zt()),n;if(t===6)Ri(e,r);else{if(i=e.current.alternate,!(r&30)&&!Rj(i)&&(t=od(e,r),t===2&&(o=fp(e),o!==0&&(r=o,t=Bp(e,o))),t===1))throw n=Ll,Mo(e,0),Ri(e,r),Hn(e,zt()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(q(345));case 2:ko(e,Fn,Qr);break;case 3:if(Ri(e,r),(r&130023424)===r&&(t=bg+500-zt(),10<t)){if(Uu(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){jn(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=xp(ko.bind(null,e,Fn,Qr),t);break}ko(e,Fn,Qr);break;case 4:if(Ri(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var s=31-Or(r);o=1<<s,s=t[s],s>i&&(i=s),r&=~o}if(r=i,r=zt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*jj(r/1960))-r,10<r){e.timeoutHandle=xp(ko.bind(null,e,Fn,Qr),r);break}ko(e,Fn,Qr);break;case 5:ko(e,Fn,Qr);break;default:throw Error(q(329))}}}return Hn(e,zt()),e.callbackNode===n?ok.bind(null,e):null}function Bp(e,t){var n=nl;return e.current.memoizedState.isDehydrated&&(Mo(e,t).flags|=256),e=od(e,t),e!==2&&(t=Fn,Fn=n,t!==null&&Up(t)),e}function Up(e){Fn===null?Fn=e:Fn.push.apply(Fn,e)}function Rj(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!Lr(o(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ri(e,t){for(t&=~yg,t&=~Vd,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Or(t),r=1<<n;e[n]=-1,t&=~r}}function ub(e){if(Ke&6)throw Error(q(327));Bs();var t=Uu(e,0);if(!(t&1))return Hn(e,zt()),null;var n=od(e,t);if(e.tag!==0&&n===2){var r=fp(e);r!==0&&(t=r,n=Bp(e,r))}if(n===1)throw n=Ll,Mo(e,0),Ri(e,t),Hn(e,zt()),n;if(n===6)throw Error(q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ko(e,Fn,Qr),Hn(e,zt()),null}function xg(e,t){var n=Ke;Ke|=1;try{return e(t)}finally{Ke=n,Ke===0&&(Xs=zt()+500,Bd&&oo())}}function Vo(e){Pi!==null&&Pi.tag===0&&!(Ke&6)&&Bs();var t=Ke;Ke|=1;var n=pr.transition,r=nt;try{if(pr.transition=null,nt=1,e)return e()}finally{nt=r,pr.transition=n,Ke=t,!(Ke&6)&&oo()}}function wg(){Gn=js.current,vt(js)}function Mo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,oj(n)),Ht!==null)for(n=Ht.return;n!==null;){var r=n;switch(tg(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&$u();break;case 3:Gs(),vt(Bn),vt(xn),ug();break;case 5:cg(r);break;case 4:Gs();break;case 13:vt(Ct);break;case 19:vt(Ct);break;case 10:og(r.type._context);break;case 22:case 23:wg()}n=n.return}if(en=e,Ht=e=Ki(e.current,null),on=Gn=t,Yt=0,Ll=null,yg=Vd=Wo=0,Fn=nl=null,Co!==null){for(t=0;t<Co.length;t++)if(n=Co[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var s=o.next;o.next=i,r.next=s}n.pending=r}Co=null}return e}function sk(e,t){do{var n=Ht;try{if(ig(),mu.current=td,ed){for(var r=Rt.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ed=!1}if(Ho=0,Qt=$t=Rt=null,el=!1,Cl=0,vg.current=null,n===null||n.return===null){Yt=1,Ll=t,Ht=null;break}e:{var o=e,s=n.return,a=n,l=t;if(t=on,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=Xy(s);if(h!==null){h.flags&=-257,Qy(h,s,a,o,t),h.mode&1&&Jy(o,c,t),t=h,l=c;var v=t.updateQueue;if(v===null){var m=new Set;m.add(l),t.updateQueue=m}else v.add(l);break e}else{if(!(t&1)){Jy(o,c,t),_g();break e}l=Error(q(426))}}else if(xt&&a.mode&1){var x=Xy(s);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Qy(x,s,a,o,t),ng(Js(l,a));break e}}o=l=Js(l,a),Yt!==4&&(Yt=2),nl===null?nl=[o]:nl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var b=W_(o,l,t);Vy(o,b);break e;case 1:a=l;var g=o.type,k=o.stateNode;if(!(o.flags&128)&&(typeof g.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(qi===null||!qi.has(k)))){o.flags|=65536,t&=-t,o.lanes|=t;var E=V_(o,a,t);Vy(o,E);break e}}o=o.return}while(o!==null)}ck(n)}catch(C){t=C,Ht===n&&n!==null&&(Ht=n=n.return);continue}break}while(!0)}function ak(){var e=nd.current;return nd.current=td,e===null?td:e}function _g(){(Yt===0||Yt===3||Yt===2)&&(Yt=4),en===null||!(Wo&268435455)&&!(Vd&268435455)||Ri(en,on)}function od(e,t){var n=Ke;Ke|=2;var r=ak();(en!==e||on!==t)&&(Qr=null,Mo(e,t));do try{Lj();break}catch(i){sk(e,i)}while(!0);if(ig(),Ke=n,nd.current=r,Ht!==null)throw Error(q(261));return en=null,on=0,Yt}function Lj(){for(;Ht!==null;)lk(Ht)}function Aj(){for(;Ht!==null&&!nC();)lk(Ht)}function lk(e){var t=dk(e.alternate,e,Gn);e.memoizedProps=e.pendingProps,t===null?ck(e):Ht=t,vg.current=null}function ck(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Sj(n,t),n!==null){n.flags&=32767,Ht=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Yt=6,Ht=null;return}}else if(n=kj(n,t,Gn),n!==null){Ht=n;return}if(t=t.sibling,t!==null){Ht=t;return}Ht=t=e}while(t!==null);Yt===0&&(Yt=5)}function ko(e,t,n){var r=nt,i=pr.transition;try{pr.transition=null,nt=1,Pj(e,t,n,r)}finally{pr.transition=i,nt=r}return null}function Pj(e,t,n,r){do Bs();while(Pi!==null);if(Ke&6)throw Error(q(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(q(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(fC(e,o),e===en&&(Ht=en=null,on=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Pc||(Pc=!0,fk(Bu,function(){return Bs(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=pr.transition,pr.transition=null;var s=nt;nt=1;var a=Ke;Ke|=4,vg.current=null,Oj(e,n),rk(n,e),QC(yp),Hu=!!vp,yp=vp=null,e.current=n,Cj(n),rC(),Ke=a,nt=s,pr.transition=o}else e.current=n;if(Pc&&(Pc=!1,Pi=e,id=i),o=e.pendingLanes,o===0&&(qi=null),sC(n.stateNode),Hn(e,zt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(rd)throw rd=!1,e=Np,Np=null,e;return id&1&&e.tag!==0&&Bs(),o=e.pendingLanes,o&1?e===zp?rl++:(rl=0,zp=e):rl=0,oo(),null}function Bs(){if(Pi!==null){var e=W0(id),t=pr.transition,n=nt;try{if(pr.transition=null,nt=16>e?16:e,Pi===null)var r=!1;else{if(e=Pi,Pi=null,id=0,Ke&6)throw Error(q(331));var i=Ke;for(Ke|=4,ue=e.current;ue!==null;){var o=ue,s=o.child;if(ue.flags&16){var a=o.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(ue=c;ue!==null;){var u=ue;switch(u.tag){case 0:case 11:case 15:tl(8,u,o)}var d=u.child;if(d!==null)d.return=u,ue=d;else for(;ue!==null;){u=ue;var f=u.sibling,h=u.return;if(ek(u),u===c){ue=null;break}if(f!==null){f.return=h,ue=f;break}ue=h}}}var v=o.alternate;if(v!==null){var m=v.child;if(m!==null){v.child=null;do{var x=m.sibling;m.sibling=null,m=x}while(m!==null)}}ue=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,ue=s;else e:for(;ue!==null;){if(o=ue,o.flags&2048)switch(o.tag){case 0:case 11:case 15:tl(9,o,o.return)}var b=o.sibling;if(b!==null){b.return=o.return,ue=b;break e}ue=o.return}}var g=e.current;for(ue=g;ue!==null;){s=ue;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,ue=k;else e:for(s=g;ue!==null;){if(a=ue,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Wd(9,a)}}catch(C){Tt(a,a.return,C)}if(a===s){ue=null;break e}var E=a.sibling;if(E!==null){E.return=a.return,ue=E;break e}ue=a.return}}if(Ke=i,oo(),Hr&&typeof Hr.onPostCommitFiberRoot=="function")try{Hr.onPostCommitFiberRoot(Dd,e)}catch{}r=!0}return r}finally{nt=n,pr.transition=t}}return!1}function db(e,t,n){t=Js(n,t),t=W_(e,t,1),e=Vi(e,t,1),t=jn(),e!==null&&(Yl(e,1,t),Hn(e,t))}function Tt(e,t,n){if(e.tag===3)db(e,e,n);else for(;t!==null;){if(t.tag===3){db(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(qi===null||!qi.has(r))){e=Js(n,e),e=V_(t,e,1),t=Vi(t,e,1),e=jn(),t!==null&&(Yl(t,1,e),Hn(t,e));break}}t=t.return}}function Mj(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=jn(),e.pingedLanes|=e.suspendedLanes&n,en===e&&(on&n)===n&&(Yt===4||Yt===3&&(on&130023424)===on&&500>zt()-bg?Mo(e,0):yg|=n),Hn(e,t)}function uk(e,t){t===0&&(e.mode&1?(t=_c,_c<<=1,!(_c&130023424)&&(_c=4194304)):t=1);var n=jn();e=mi(e,t),e!==null&&(Yl(e,t,n),Hn(e,n))}function Tj(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),uk(e,n)}function Dj(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(q(314))}r!==null&&r.delete(t),uk(e,n)}var dk;dk=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Bn.current)zn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return zn=!1,_j(e,t,n);zn=!!(e.flags&131072)}else zn=!1,xt&&t.flags&1048576&&m_(t,Gu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;vu(e,t),e=t.pendingProps;var i=$s(t,xn.current);zs(t,n),i=fg(null,t,r,e,i,n);var o=hg();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Un(r)?(o=!0,Ku(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ag(t),i.updater=Hd,t.stateNode=i,i._reactInternals=t,Cp(t,r,e,n),t=Lp(null,t,r,!0,o,n)):(t.tag=0,xt&&o&&eg(t),Cn(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(vu(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Fj(r),e=xr(r,e),i){case 0:t=Rp(null,t,r,e,n);break e;case 1:t=tb(null,t,r,e,n);break e;case 11:t=Zy(null,t,r,e,n);break e;case 14:t=eb(null,t,r,xr(r.type,e),n);break e}throw Error(q(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:xr(r,i),Rp(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:xr(r,i),tb(e,t,r,i,n);case 3:e:{if(Y_(t),e===null)throw Error(q(387));r=t.pendingProps,o=t.memoizedState,i=o.element,w_(e,t),Qu(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Js(Error(q(423)),t),t=nb(e,t,r,n,i);break e}else if(r!==i){i=Js(Error(q(424)),t),t=nb(e,t,r,n,i);break e}else for(Zn=Wi(t.stateNode.containerInfo.firstChild),er=t,xt=!0,_r=null,n=b_(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ks(),r===i){t=gi(e,t,n);break e}Cn(e,t,r,n)}t=t.child}return t;case 5:return __(t),e===null&&Sp(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,bp(r,i)?s=null:o!==null&&bp(r,o)&&(t.flags|=32),K_(e,t),Cn(e,t,s,n),t.child;case 6:return e===null&&Sp(t),null;case 13:return G_(e,t,n);case 4:return lg(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ys(t,null,r,n):Cn(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:xr(r,i),Zy(e,t,r,i,n);case 7:return Cn(e,t,t.pendingProps,n),t.child;case 8:return Cn(e,t,t.pendingProps.children,n),t.child;case 12:return Cn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,ft(Ju,r._currentValue),r._currentValue=s,o!==null)if(Lr(o.value,s)){if(o.children===i.children&&!Bn.current){t=gi(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=li(-1,n&-n),l.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ep(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(q(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Ep(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Cn(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,zs(t,n),i=mr(i),r=r(i),t.flags|=1,Cn(e,t,r,n),t.child;case 14:return r=t.type,i=xr(r,t.pendingProps),i=xr(r.type,i),eb(e,t,r,i,n);case 15:return q_(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:xr(r,i),vu(e,t),t.tag=1,Un(r)?(e=!0,Ku(t)):e=!1,zs(t,n),H_(t,r,i),Cp(t,r,i,n),Lp(null,t,r,!0,e,n);case 19:return J_(e,t,n);case 22:return $_(e,t,n)}throw Error(q(156,t.tag))};function fk(e,t){return z0(e,t)}function Ij(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fr(e,t,n,r){return new Ij(e,t,n,r)}function kg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fj(e){if(typeof e=="function")return kg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Hm)return 11;if(e===Wm)return 14}return 2}function Ki(e,t){var n=e.alternate;return n===null?(n=fr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function xu(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")kg(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case ys:return To(n.children,i,o,t);case Um:s=8,i|=8;break;case Xh:return e=fr(12,n,t,i|2),e.elementType=Xh,e.lanes=o,e;case Qh:return e=fr(13,n,t,i),e.elementType=Qh,e.lanes=o,e;case Zh:return e=fr(19,n,t,i),e.elementType=Zh,e.lanes=o,e;case _0:return qd(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case x0:s=10;break e;case w0:s=9;break e;case Hm:s=11;break e;case Wm:s=14;break e;case Oi:s=16,r=null;break e}throw Error(q(130,e==null?e:typeof e,""))}return t=fr(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function To(e,t,n,r){return e=fr(7,e,r,t),e.lanes=n,e}function qd(e,t,n,r){return e=fr(22,e,r,t),e.elementType=_0,e.lanes=n,e.stateNode={isHidden:!1},e}function ch(e,t,n){return e=fr(6,e,null,t),e.lanes=n,e}function uh(e,t,n){return t=fr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Nj(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vf(0),this.expirationTimes=Vf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Sg(e,t,n,r,i,o,s,a,l){return e=new Nj(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=fr(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ag(o),e}function zj(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:vs,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function hk(e){if(!e)return Xi;e=e._reactInternals;e:{if(Qo(e)!==e||e.tag!==1)throw Error(q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Un(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(q(171))}if(e.tag===1){var n=e.type;if(Un(n))return h_(e,n,t)}return t}function pk(e,t,n,r,i,o,s,a,l){return e=Sg(n,r,!0,e,i,o,s,a,l),e.context=hk(null),n=e.current,r=jn(),i=$i(n),o=li(r,i),o.callback=t??null,Vi(n,o,i),e.current.lanes=i,Yl(e,i,r),Hn(e,r),e}function $d(e,t,n,r){var i=t.current,o=jn(),s=$i(i);return n=hk(n),t.context===null?t.context=n:t.pendingContext=n,t=li(o,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Vi(i,t,s),e!==null&&(Cr(e,i,s,o),pu(e,i,s)),s}function sd(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function fb(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Eg(e,t){fb(e,t),(e=e.alternate)&&fb(e,t)}function Bj(){return null}var mk=typeof reportError=="function"?reportError:function(e){console.error(e)};function Og(e){this._internalRoot=e}Kd.prototype.render=Og.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(q(409));$d(e,t,null,null)};Kd.prototype.unmount=Og.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Vo(function(){$d(null,e,null,null)}),t[pi]=null}};function Kd(e){this._internalRoot=e}Kd.prototype.unstable_scheduleHydration=function(e){if(e){var t=$0();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ji.length&&t!==0&&t<ji[n].priority;n++);ji.splice(n,0,e),n===0&&Y0(e)}};function Cg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Yd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function hb(){}function Uj(e,t,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var c=sd(s);o.call(c)}}var s=pk(t,r,e,0,null,!1,!1,"",hb);return e._reactRootContainer=s,e[pi]=s.current,_l(e.nodeType===8?e.parentNode:e),Vo(),s}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=sd(l);a.call(c)}}var l=Sg(e,0,!1,null,null,!1,!1,"",hb);return e._reactRootContainer=l,e[pi]=l.current,_l(e.nodeType===8?e.parentNode:e),Vo(function(){$d(t,l,n,r)}),l}function Gd(e,t,n,r,i){var o=n._reactRootContainer;if(o){var s=o;if(typeof i=="function"){var a=i;i=function(){var l=sd(s);a.call(l)}}$d(t,s,e,i)}else s=Uj(n,t,e,i,r);return sd(s)}V0=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ia(t.pendingLanes);n!==0&&($m(t,n|1),Hn(t,zt()),!(Ke&6)&&(Xs=zt()+500,oo()))}break;case 13:Vo(function(){var r=mi(e,1);if(r!==null){var i=jn();Cr(r,e,1,i)}}),Eg(e,1)}};Km=function(e){if(e.tag===13){var t=mi(e,134217728);if(t!==null){var n=jn();Cr(t,e,134217728,n)}Eg(e,134217728)}};q0=function(e){if(e.tag===13){var t=$i(e),n=mi(e,t);if(n!==null){var r=jn();Cr(n,e,t,r)}Eg(e,t)}};$0=function(){return nt};K0=function(e,t){var n=nt;try{return nt=e,t()}finally{nt=n}};cp=function(e,t,n){switch(t){case"input":if(np(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=zd(r);if(!i)throw Error(q(90));S0(r),np(r,i)}}}break;case"textarea":O0(e,n);break;case"select":t=n.value,t!=null&&Ds(e,!!n.multiple,t,!1)}};M0=xg;T0=Vo;var Hj={usingClientEntryPoint:!1,Events:[Jl,_s,zd,A0,P0,xg]},_a={findFiberByHostInstance:Oo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Wj={bundleType:_a.bundleType,version:_a.version,rendererPackageName:_a.rendererPackageName,rendererConfig:_a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:bi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=F0(e),e===null?null:e.stateNode},findFiberByHostInstance:_a.findFiberByHostInstance||Bj,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Mc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Mc.isDisabled&&Mc.supportsFiber)try{Dd=Mc.inject(Wj),Hr=Mc}catch{}}nr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hj;nr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cg(t))throw Error(q(200));return zj(e,t,null,n)};nr.createRoot=function(e,t){if(!Cg(e))throw Error(q(299));var n=!1,r="",i=mk;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Sg(e,1,!1,null,null,n,!1,r,i),e[pi]=t.current,_l(e.nodeType===8?e.parentNode:e),new Og(t)};nr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(q(188)):(e=Object.keys(e).join(","),Error(q(268,e)));return e=F0(t),e=e===null?null:e.stateNode,e};nr.flushSync=function(e){return Vo(e)};nr.hydrate=function(e,t,n){if(!Yd(t))throw Error(q(200));return Gd(null,e,t,!0,n)};nr.hydrateRoot=function(e,t,n){if(!Cg(e))throw Error(q(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",s=mk;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=pk(t,null,e,1,n??null,i,!1,o,s),e[pi]=t.current,_l(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Kd(t)};nr.render=function(e,t,n){if(!Yd(t))throw Error(q(200));return Gd(null,e,t,!1,n)};nr.unmountComponentAtNode=function(e){if(!Yd(e))throw Error(q(40));return e._reactRootContainer?(Vo(function(){Gd(null,null,e,!1,function(){e._reactRootContainer=null,e[pi]=null})}),!0):!1};nr.unstable_batchedUpdates=xg;nr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Yd(n))throw Error(q(200));if(e==null||e._reactInternals===void 0)throw Error(q(38));return Gd(e,t,n,!1,r)};nr.version="18.3.1-next-f1338f8080-20240426";function gk(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gk)}catch(e){console.error(e)}}gk(),g0.exports=nr;var Vj=g0.exports,jg,pb=Vj;jg=pb.createRoot,pb.hydrateRoot;var po=Object.create(null);const Ee={on:function(e,t){po[e]||(po[e]=[]),po[e].push(t)},off:function(e,t){po[e]&&(po[e]=po[e].filter(function(n){return n!==t}))},emit:function(e,t){var n=po[e];if(!(!n||!n.length))for(var r=n.slice(),i=0;i<r.length;i++)try{r[i](t)}catch(o){typeof console<"u"&&console.error&&console.error('[Bus] handler error on "'+e+'":',o)}},once:function(e,t){var n=this,r=function(i){n.off(e,r),t(i)};this.on(e,r)}},qj=Object.freeze(["id","fromBigInt","fromRational","fromRationalStr","toCanonicalStr","add","subtract","multiply","divide","normalDivide","mod","equals","compare","pow","sqrt","exp2","log2","ppfEncodeInteger","ppfDecodeInteger","fromPPF","getIntegerBitLength","breakSymbolicToApproximateBigInt","breakSymbolicToApproximateJSNumber","breakSymbolicToString","toPrimeAtoms","fromAtomVec","toAtomRoot","fromAtomRoot","gcd","lcm","modPow","polyAdd","polyMul","polyDiv","polyForwardTransform","polyInverseTransform","polyEvaluateAt","polyGcd","isHandle"]);class Tc extends Error{constructor(t){super(t),this.name="MathBackendRegistrationError"}}class $j extends Error{constructor(t){super(`MathBackendProvider: '${t}' is not registered. Load the provider module before calling select(). Do not fall back to js-reference — request wasm explicitly only when wasm is loaded.`),this.name="MathBackendNotAvailableError",this.requestedId=t}}class Kj{constructor(){this._providers=new Map,this._activeId=null,this._listeners=new Set}subscribe(t){return this._listeners.add(t),()=>{this._listeners.delete(t)}}_notify(){for(const t of this._listeners)try{t()}catch(n){console.error("[MathBackendRegistry] subscriber threw:",n)}}register(t){if(!t||typeof t!="object")throw new Tc("MathBackendProvider.register: provider must be a plain object.");const n=t.id;if(typeof n!="string"||!n)throw new Tc("MathBackendProvider.register: provider.id must be a non-empty string.");const r=[];for(const i of qj)i!=="id"&&typeof t[i]!="function"&&r.push(i);if(r.length>0)throw new Tc(`MathBackendProvider.register('${n}'): missing required method(s): ${r.join(", ")}. Every provider must implement the full op surface (README.md §1).`);if(this._providers.has(n)){if(this._providers.get(n)===t)return;throw new Tc(`MathBackendProvider.register('${n}'): a DIFFERENT provider object is already registered under '${n}' — two math provider bundles were evaluated in one realm. One realm holds one provider per id: find the second module instance (a second bundle of the provider module, or a second copy of the registry it was built against).`)}this._providers.set(n,t),this._activeId===null&&(this._activeId=n),this._notify()}select(t){if(!this._providers.has(t))throw new $j(t);this._activeId=t,this._notify()}active(){if(this._activeId===null||!this._providers.has(this._activeId))throw new Error("MathBackendProvider: no active provider. Two doors: import the JS reference barrel (lib/egpt/js/model/index.browser.js, which registers js-reference — or, below the barrel, lib/egpt/js/model/backend/JsReferenceMathBackendProvider.js), or register a provider (MathBackendRegistry.register; in a realm, Runtime.ensureMath registers the math sdk's sdk.mathBackendProvider).");return this._providers.get(this._activeId)}activeId(){return this.active().id}registeredIds(){return[...this._providers.keys()]}resetScope(){if(this._activeId!==null&&this._providers.has(this._activeId)){const t=this._providers.get(this._activeId);typeof t.resetScope=="function"&&t.resetScope()}}}const st=new Kj,mb=Object.freeze({parts:"parts/index.js",app:"objects/FrqtlApp.js",recipe:"objects/RecipeContext.js",engine:"compat/engine.js",display:"compat/renderer/display-slot.js",QuantumEmitter:"objects/objects/QuantumEmitter.js",Box:"objects/objects/Box.js",CircuitGate:"objects/objects/CircuitGate.js",CircuitProbe:"objects/objects/CircuitProbe.js"});function vk(e){if(!e||typeof e.resolve!="function")return Promise.reject(new Error("[engine-stack-boot] ensureEngineStack requires a router (an engineRouter() instance with .resolve, not a bare resolve function). (FAIL-LOUD.)"));function t(n){return new URL(e.resolve(n),document.baseURI).href}return Promise.all([import(t("experiments/_shared/boot.js")),import(t("experiments/_shared/page-door.js"))]).then(function(n){return n[1].refuseRetiredGlobals(),n[0].bootRealm()}).then(function(){var n=Object.keys(mb);return Promise.all(n.map(function(r){return import(t(mb[r]))})).then(function(r){var i={};return n.forEach(function(o,s){i[o]=r[s]}),Object.freeze(i)})})}const gb={"gallery-wave-interference":{spec:"setupWaveInterference",knob:{label:"Particles",param:"quanta",min:100,max:2e3,step:100,defaultValue:800}}};var Yj={quanta:"quantumLimit"},Gj=function(){for(var e=Object.create(null),t=Object.keys(gb),n=0;n<t.length;n++){var r=gb[t[n]];if(!(!r||!r.spec||!r.knob)){if(e[r.spec])throw new Error('[notebook/knob] duplicate knob spec "'+r.spec+'" across notebooks ('+t[n]+" collides with an earlier entry). (FAIL-LOUD.)");e[r.spec]=r.knob}}return e}();function Jj(e){if(!e)return null;var t=String(e).split(",").pop().trim();return Gj[t]||null}function Xj(e,t){var n=t?Object.keys(t):[];if(n.length===0)return{};var r=Jj(e);if(!r)throw new Error('[notebook/knob] cell spec "'+e+'" defines NO knob, but opts declares '+JSON.stringify(n)+". (FAIL-LOUD — no silent ignore.)");for(var i={},o=0;o<n.length;o++){var s=n[o];if(s!==r.param)throw new Error('[notebook/knob] unknown knob key "'+s+'" for spec "'+e+'" — the only knob is "'+r.param+'". (FAIL-LOUD; not silently ignored.)');var a=t[s];if(typeof a!="number"||!isFinite(a))throw new Error('[notebook/knob] knob "'+s+'" value is not a finite number: '+JSON.stringify(a)+". (FAIL-LOUD.)");if(a<r.min||a>r.max)throw new Error('[notebook/knob] knob "'+s+'"='+a+" is out of range ["+r.min+", "+r.max+'] for spec "'+e+'". (FAIL-LOUD.)');var l=Yj[s];if(!l)throw new Error('[notebook/knob] knob param "'+s+'" has NO factory-option wire in PARAM_TO_FACTORY_OPTION — a hint-only knob is forbidden. (FAIL-LOUD.)');i[l]=a}return i}function qo(e){for(var t=String(e).split("/"),n=[],r=0;r<t.length;r++){var i=t[r];if(!(i===""||i===".")){if(i===".."){n.pop();continue}n.push(i)}}return n.join("/")}function yk(e,t){var n=qo(t).split("/");n.pop();var r=n.join("/"),i=r?r+"/"+e:e;return qo(i)}function Qj(e){return/(^|\n)\s*import\s/.test(String(e))}function Zj(e){for(var t=String(e).split(`
|
|
41
|
-
`),n=[],r=0,i=!1,o=0;o<t.length;o++){var s=t[o].replace(/^\s+/,"");if(i){n.push(t[o]),r=o+1,(/from\s+['"][^'"]+['"]/.test(t[o])||/;\s*$/.test(t[o]))&&(i=!1);continue}if(s===""){n.push(t[o]),r=o+1;continue}if(/^\/\//.test(s)||/^\/\*.*\*\/\s*$/.test(s)){n.push(t[o]),r=o+1;continue}if(/^import\s/.test(s)){n.push(t[o]),r=o+1,!/from\s+['"][^'"]+['"]/.test(t[o])&&!/;\s*$/.test(t[o])&&(i=!0);continue}break}return{imports:n.join(`
|
|
42
|
-
`),body:t.slice(r).join(`
|
|
43
|
-
`)}}function bk(e,t,n){function r(o){var s=yk(o,t),a=n[s];if(!a)throw new Error('[module-resolver] relative import "'+o+'" (from "'+t+'") resolves to "'+s+'", which is NOT a notebook-local module cell. Add a <cell type="module" name="'+o+'">, or fix the path. (FAIL-LOUD — never an HTTP sibling fetch.)');return a}var i=String(e).replace(/from\s+(['"])([^'"]+)\1/g,function(o,s,a){return a.charAt(0)!=="."?o:"from "+s+r(a)+s});return i=i.replace(/import\(\s*(['"])([^'"]+)\1\s*\)/g,function(o,s,a){return a.charAt(0)!=="."?o:"import("+s+r(a)+s+")"}),i}function eR(e,t){var n=[];return String(t).replace(/from\s+(['"])([^'"]+)\1/g,function(r,i,o){return o.charAt(0)==="."&&n.push(yk(o,e)),r}),n}function tR(e,t){if(typeof t!="function")throw new Error("[module-resolver] buildModuleClosure requires a mintBlobUrl(source) function.");for(var n=Object.create(null),r=Object.keys(e||{}),i=0;i<r.length;i++)n[qo(r[i])]={name:r[i],source:e[r[i]]};for(var o=Object.create(null),s=[],a=Object.keys(n),l=0;a.length>0;){if(l++>1e5)throw new Error("[module-resolver] module closure did not converge (cycle?). (FAIL-LOUD.)");for(var c=!1,u=[],d=0;d<a.length;d++){for(var f=a[d],h=n[f],v=eR(h.name,h.source),m=!0,x=0;x<v.length;x++)if(!o[v[x]]){if(!n[v[x]])throw new Error('[module-resolver] module "'+h.name+'" imports "'+v[x]+'" which is not in the notebook module set. (FAIL-LOUD.)');m=!1;break}if(!m){u.push(f);continue}var b=bk(h.source,h.name,o),g=t(b);o[f]=g,s.push(g),c=!0}if(a=u,!c&&a.length>0)throw new Error("[module-resolver] unresolvable module closure (dependency cycle among "+a.join(", ")+"). (FAIL-LOUD.)")}return{blobUrlByKey:o,created:s}}function nR(e,t,n){var r=bk(e,t,n),i=Zj(r);return i.imports+`
|
|
44
|
-
export default async (caps, inputs) => {
|
|
45
|
-
`+i.body+`
|
|
46
|
-
};
|
|
47
|
-
`}var ii=null,Rs=null,Li="",Na="",Ls="",As=null,Hp=null,wu=null,Dc=null,jt={log:function(e,t){Ee.emit("console:write",{level:e||"info",text:String(t)})},print:function(e){Ee.emit("console:write",{level:"info",text:String(e)})},warn:function(e){Ee.emit("console:write",{level:"warn",text:String(e)})},error:function(e){Ee.emit("console:write",{level:"error",text:String(e)})},clear:function(){Ee.emit("console:clear",{})}},Jd={frame:function(e){Ee.emit("render:frame",{universe:e,tickData:e})},start:function(){Ee.emit("render:frame",{cmd:"start"})},stop:function(){Ee.emit("render:frame",{cmd:"stop"})}},xk=Object.freeze({FrqtlApp:["app","FrqtlApp"],RecipeContext:["recipe","RecipeContext"],PointSource:["parts","PointSource"],LargeObject:["parts","LargeObject"],Wall:["parts","Wall"],SlitScreen:["parts","SlitScreen"],SlitLightSource:["parts","SlitLightSource"],DetectorWall:["parts","DetectorWall"],OvenBox:["parts","OvenBox"],Rectangle:["parts","Rectangle"],CollisionTypes:["parts","CollisionTypes"],CollisionActions:["parts","CollisionActions"],QuantumEmitter:["QuantumEmitter","QuantumEmitter"],Box:["Box","Box"],CircuitGate:["CircuitGate","CircuitGate"],CircuitProbe:["CircuitProbe","CircuitProbe"],Frame:["engine","Frame"],Charge:["engine","Charge"],Universe:["engine","EGPTUniverse"]});function _u(e){var t=xk[e];if(!t)throw new Error('[frqtl] caps.frqtl has no member "'+e+'". (FAIL-LOUD.)');if(!wu)throw new Error('[frqtl] "'+e+'" is not available — the engine/game layer is not booted yet. A builder cell must `await frqtl.ensureEngine()` before it reads caps.frqtl (or before it calls a setup module that does). (FAIL-LOUD.)');var n=t[0]==="engine"?wu.engine.engine()[t[1]]:wu[t[0]][t[1]];if(n==null)throw new Error('[frqtl] the realm module for "'+e+'" exports no '+t[1]+". (FAIL-LOUD.)");return n}var Qs={FrqtlApp:function(e){return new(_u("FrqtlApp"))(e)},carryFactoryStatics:function(e,t){return _u("FrqtlApp").carryFactoryStatics(e,t)},RecipeContext:function(e){return new(_u("RecipeContext"))(e)},ensureEngine:function(){return Hp?vk(Hp).then(function(e){wu=e}):Promise.reject(new Error("[frqtl] ensureEngine unavailable: Runtime.init did not thread a router (_router). (FAIL-LOUD.)"))},knob:function(e,t){return Xj(e,t||{})}};Object.keys(xk).forEach(function(e){Object.prototype.hasOwnProperty.call(Qs,e)||Object.defineProperty(Qs,e,{enumerable:!0,get:function(){return _u(e)}})});function rR(e){e=e||{},Li=e.mathSdkUrl||typeof window<"u"&&window._egptMathSdkUrl||e._routerMathSdkUrl||"",Na=e.mathWasmUrl||e._routerMathWasmUrl||"",Ls=e.mathWasmModuleUrl||e._routerMathWasmModuleUrl||"",e.engine;var t=e.mathBackend||e._routerMathBackend||null;t==="wasm"&&(t="wasm-math"),As=t,e._router&&typeof e._router.resolve=="function"&&(Hp=e._router);var n=null,r=null;if(ii)try{kk(ii)}catch(o){pR(o),n=o}else As&&As!=="js-reference"&&(r=Xd());Dc&&Ee.off("run:request",Dc),Dc=function(o){wk({source:o.source,code:o.code,fileId:o.fileId,sourceUrl:o.sourceUrl||null})},Ee.on("run:request",Dc);var i=n?Promise.reject(n):Promise.resolve();return r?Promise.all([i,r.catch(function(o){throw console.error('[Runtime] eager math SDK load for backend "'+As+'" failed:',o),o})]).then(function(){}):i}function wk(e){e=e||{};var t=e.source||"frqtl",n=e.code||"",r=e.fileId||"_editor",i=e.sourceUrl||null;jt.clear(),jt.log("info","--- run:"+t+" ("+r+") ---"),t==="math"?oR(n,r,i):(Wp(),iR(n))}function Wp(){var e;try{e=st.active().id}catch{e="none"}jt.log("info","backend: "+e)}function iR(e,t){try{var n=new Function("frqtl","math","console","render",e);n(Qs,ii,jt,Jd),Ee.emit("run:result",{source:"frqtl",ok:!0})}catch(i){var r=i&&i.message?i.message:String(i);jt.error(r),Ee.emit("run:result",{source:"frqtl",ok:!1,error:r})}}function oR(e,t,n){Xd().then(function(r){if(Wp(),sR(e))return lR(e,r,n).then(function(){Ee.emit("run:result",{source:"math",ok:!0})}).catch(function(s){var a=s&&s.message?s.message:String(s);jt.error(a),Ee.emit("run:result",{source:"math",ok:!1,error:a})});try{var i=new Function("frqtl","math","console","render",e);i(Qs,r,jt,Jd),Ee.emit("run:result",{source:"math",ok:!0})}catch(s){var o=s&&s.message?s.message:String(s);jt.error(o),Ee.emit("run:result",{source:"math",ok:!1,error:o})}},function(r){Wp();var i="Math SDK init failed: "+(r&&r.message?r.message:String(r));jt.error(i),Ee.emit("run:result",{source:"math",ok:!1,error:i})}).finally(function(){_k()})}function _k(){st.resetScope()}function sR(e){return/^\s*(import|export)\s/m.test(e)}function aR(e,t,n,r){return e.replace(/from\s+(['"])([^'"]+)\1/g,function(i,o,s){return/^(https?:|blob:|data:)/.test(s)?i:s==="node:test"?"from '"+new URL("./shims/node-test.js",n).toString()+"'":s==="node:assert"?"from '"+new URL("./shims/node-assert.js",n).toString()+"'":s==="./EGPTTestSuite.js"?"from '"+new URL("./shims/test-framework.js",n).toString()+"'":s.indexOf("/core/")!==-1||s.indexOf("/stat/")!==-1||s.indexOf("/spaces/log/")!==-1||s.indexOf("/translators/")!==-1||/\/index\.js$/.test(s)?"from '"+t+"'":s.indexOf("./")===0&&r?"from '"+new URL(s,r).toString()+"'":"from '"+new URL(s,n).toString()+"'"})}function lR(e,t,n){var r=new URL(Li,window.location.href).toString(),i=new URL(Li.replace(/\/index\.js$/,"/editor/"),window.location.href).toString(),o=n?new URL("./",new URL(n,window.location.href)).toString():null,s=aR(e,r,i,o),a=new Blob([s],{type:"application/javascript"}),l=URL.createObjectURL(a),c=console.log,u=!1;return console.log=function(){if(u){c.apply(console,arguments);return}u=!0;try{var d=Array.prototype.map.call(arguments,function(f){try{return typeof f=="object"?JSON.stringify(f):String(f)}catch{return String(f)}});jt.print(d.join(" "))}finally{u=!1}c.apply(console,arguments)},import(l).then(function(d){if(typeof d.run!="function"){jt.print("(module executed on import — no run(sdk) export)");return}return d.run(t)}).then(function(d){d!==void 0&&jt.print(typeof d=="object"?JSON.stringify(d,null,2):String(d))}).finally(function(){console.log=c,URL.revokeObjectURL(l)})}function cR(e,t,n){var r={};if(!n||!n.length)return r;for(var i=t&&typeof t=="object"?t:{},o=0;o<n.length;o++){var s=n[o];if(!Object.prototype.hasOwnProperty.call(i,s))throw new Error('[Runtime.runCell] cell "'+e+'" declares output "'+s+'" but its returned object does not contain that key. A js cell must `return { '+s+": …, … }` for every declared out — never silently write undefined into a binding (FAIL-LOUD).");r[s]=i[s]}return r}function uR(e,t,n){var r=n||function(i){try{jt.print(typeof i=="object"?JSON.stringify(i,null,2):String(i))}catch{jt.print(String(i))}};return e==="frqtl"?{frqtl:Qs,render:Jd,math:t,console:jt,display:r}:{math:t,console:jt,display:r}}function dR(){var e={log:console.log,warn:console.warn,error:console.error},t=!1;function n(i){return Array.prototype.map.call(i,function(o){try{return typeof o=="object"?JSON.stringify(o):String(o)}catch{return String(o)}}).join(" ")}function r(i,o){return function(){if(t){e[i].apply(console,arguments);return}t=!0;try{o(n(arguments))}finally{t=!1}e[i].apply(console,arguments)}}return console.log=r("log",function(i){jt.print(i)}),console.warn=r("warn",function(i){jt.warn(i)}),console.error=r("error",function(i){jt.error(i)}),function(){console.log=e.log,console.warn=e.warn,console.error=e.error}}function vb(e){var t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function fR(e,t,n,r,i){var o=tR(n,vb),s="__cell__-"+t+".js",a=nR(e,s,o.blobUrlByKey),l=vb(a),c=o.created.concat([l]);function u(){for(var d=0;d<c.length;d++)try{URL.revokeObjectURL(c[d])}catch{}}return import(l).then(function(d){if(typeof d.default!="function")throw new Error('[Runtime.runCell] cell-as-module: compiled entry for cell "'+t+'" has no default export wrapper (internal). (FAIL-LOUD.)');return d.default(r,i)}).finally(u)}function hR(e){e=e||{};var t=e.lane||"math",n=e.code||"",r=e.id||"_cell",i=e.inputs||{},o=e.declaredOutputs||[],s=e.display||null,a=e.modules||{},l=!!e.forceModulePath;return Xd().then(function(c){var u=dR();return Promise.resolve().then(function(){var d=uR(t,c,s);if(l||Qj(n))return fR(n,r,a,d,i);var f=`return (async (caps, inputs) => {
|
|
48
|
-
`+n+`
|
|
49
|
-
})(caps, inputs);`,h=new Function("caps","inputs",f);return h(d,i)}).then(function(d){var f=cR(r,d,o);return{outputs:f,ok:!0,error:null}}).catch(function(d){var f=d&&d.message?d.message:String(d);return jt.error(f),{outputs:{},ok:!1,error:f}}).finally(function(){u()})}).catch(function(c){var u="Math SDK init failed: "+(c&&c.message?c.message:String(c));return jt.error(u),{outputs:{},ok:!1,error:u}})}function Xd(e){if(e=e||{},ii)return Promise.resolve(ii);if(!Li&&e.mathSdkUrl&&(Li=e.mathSdkUrl),!Na&&e.mathWasmUrl&&(Na=e.mathWasmUrl),!Ls&&e.mathWasmModuleUrl&&(Ls=e.mathWasmModuleUrl),!ii&&e.mathBackend){var t=e.mathBackend;t==="wasm"&&(t="wasm-math"),As=t}if(Rs)return Rs;if(!Li&&(typeof window>"u"||!window.createEgptMathSdk))return Promise.reject(new Error("[Runtime] Math SDK unavailable: no mathSdkUrl resolved from engineRouter profile or window._egptMathSdkUrl, and no window.createEgptMathSdk. Ensure Runtime.init() is called with a router that defines __mathSdkUrl."));var n=typeof window<"u"&&window.createEgptMathSdk?window.createEgptMathSdk({wasmUrl:Na||void 0,wasmModuleUrl:Ls||void 0}):import(Li).then(function(r){var i=r.createEgptMathSdk;if(typeof i!="function")throw new Error("createEgptMathSdk not exported from "+Li);return i({wasmUrl:Na||void 0,wasmModuleUrl:Ls||void 0})});return Rs=n.then(function(r){return mR(r),kk(),ii=r,r}),Rs}function pR(e){ii=null,Rs=Promise.reject(e),Rs.catch(function(){})}function mR(e){var t=e&&e.mathBackendProvider;!t||typeof t!="object"||typeof t.id!="string"||st.register(t)}function kk(e){var t=As;if(t)try{st.select(t),console.log("[Runtime] Math backend selected: "+t)}catch(i){var n="";t==="wasm-math"&&!Ls&&(n=" No wasmModuleUrl was configured — the engineRouter profile __mathWasmModuleUrl is empty or was not threaded into Runtime.");var r='[Runtime] Math backend selection FAILED for id="'+t+'": '+(i&&i.message?i.message:String(i))+"."+n+" Never falls back silently to js-reference (FAIL-LOUD).";throw jt.error(r),new Error(r,{cause:i})}}const ci={init:rR,run:wk,runCell:hR,resetMathScope:_k,ensureMath:Xd,get frqtl(){return Qs},get math(){return ii},get console(){return jt},get render(){return Jd}};var ku=Object.freeze(["data-egpt-boot-phase","data-egpt-boot-progress"]),Sk="#root",Ps=Object.freeze({OK:"ok",PENDING:"pending",CROSS_ORIGIN:"cross-origin",SPA_SHELL:"spa-shell",NOT_EXPERIMENT:"not-an-experiment-page"}),Ek=1e4;function gR(e){var t=e||{},n=t.src||"(unknown src)",r=typeof t.href=="string"?t.href:"",i=Array.isArray(t.markers)?t.markers:[],o=typeof t.timeoutMs=="number"?t.timeoutMs:Ek,s=typeof t.elapsedMs=="number"?t.elapsedMs:0;if(t.sameOrigin===!1)return Ms(Ps.CROSS_ORIGIN,!1,!0,`the experiment frame is CROSS-ORIGIN, so the host cannot verify what loaded.
|
|
50
|
-
requested: `+n+`
|
|
51
|
-
Experiment pages must be served from the host's own origin (the /frqtl mount).`);if(r===""||r==="about:blank")return yb(s,o,n,"the frame is still on about:blank — it never navigated to the requested URL.");var a=ku.filter(function(l){return i.indexOf(l)===-1});return a.length===0?Ms(Ps.OK,!0,!0,"experiment page booted: "+n):t.hasHostShellRoot===!0?Ms(Ps.SPA_SHELL,!1,!0,`THE FALSE-200 TRAP: the request returned HTTP 200 text/html, but the document is the
|
|
52
|
-
HOST'S OWN SPA SHELL (it has `+Sk+` and none of the experiment-page
|
|
53
|
-
boot markers [`+ku.join(", ")+`]).
|
|
54
|
-
requested: `+n+`
|
|
55
|
-
loaded: `+r+`
|
|
56
|
-
The dev server answers an UNKNOWN path with its SPA fallback, so a MISSING experiment id
|
|
57
|
-
looks like a successful load and this host ends up embedding ITSELF, recursively.
|
|
58
|
-
Fix the id at its single declaration site — do not add a fallback id here.`):t.readyState==="complete"?Ms(Ps.NOT_EXPERIMENT,!1,!0,`the frame finished loading but it is NOT a canonical experiment page.
|
|
59
|
-
requested: `+n+`
|
|
60
|
-
loaded: `+r+`
|
|
61
|
-
missing boot markers: [`+a.join(", ")+`]
|
|
62
|
-
A canonical experiment page boots through _shared/boot.js, whose boot record writes all of
|
|
63
|
-
[`+ku.join(", ")+"] on its <html> as the boot begins."):yb(s,o,n,"missing boot markers: ["+a.join(", ")+"] (document readyState="+(t.readyState||"unknown")+").")}function Ms(e,t,n,r){return{verdict:e,ok:t,done:n,message:"[experiment-frame] "+r}}function yb(e,t,n,r){return e>=t?Ms(Ps.NOT_EXPERIMENT,!1,!0,"the frame never became a canonical experiment page within "+t+`ms.
|
|
64
|
-
requested: `+n+`
|
|
65
|
-
`+r):Ms(Ps.PENDING,!1,!1,"waiting for "+n+" — "+r)}function vR(e,t){var n=t||{},r={src:e&&e.src?e.src:"",href:"",sameOrigin:!0,readyState:void 0,markers:[],hasHostShellRoot:!1,elapsedMs:n.elapsedMs,timeoutMs:n.timeoutMs},i=null;try{if(i=e&&e.contentWindow,!i)return r;r.href=i.location&&i.location.href||"";var o=i.document;r.readyState=o?o.readyState:void 0;var s=o&&o.documentElement;r.markers=ku.filter(function(a){return!!(s&&s.hasAttribute&&s.hasAttribute(a))}),r.hasHostShellRoot=!!(o&&o.querySelector&&o.querySelector(Sk))}catch{r.sameOrigin=!1}return r}function yR(e,t){var n=e||(typeof document<"u"?document.body:null);if(!n)return null;var r=n.querySelector&&n.querySelector('[data-role="experiment-frame-error"]');r&&r.parentNode.removeChild(r);var i=n.ownerDocument.createElement("div");return i.setAttribute("data-role","experiment-frame-error"),i.style.cssText="position:absolute;inset:0;z-index:9999;padding:16px;overflow:auto;white-space:pre-wrap;background:#1a0000;color:#ff6b6b;border:2px solid #b6161c;font:12px/1.55 ui-monospace,Menlo,Consolas,monospace;",i.textContent=t,n.style&&(!n.style.position||n.style.position==="static")&&(n.style.position="relative"),n.appendChild(i),i}function bR(e,t){var n=t||{},r=typeof n.timeoutMs=="number"?n.timeoutMs:Ek,i=typeof n.pollMs=="number"?n.pollMs:150,o=Date.now(),s=!1,a=setInterval(l,i);l();function l(){if(!s){var u=vR(e,{elapsedMs:Date.now()-o,timeoutMs:r}),d=gR(u);if(d.done){if(c(),d.ok){typeof n.onOk=="function"&&n.onOk(e.contentWindow);return}typeof console<"u"&&console.error&&console.error(d.message),yR(n.overlayHost||e&&e.parentNode,d.message),typeof n.onError=="function"&&n.onError(d)}}}function c(){s||(s=!0,clearInterval(a))}return c}const xR="pub",ad="data-frqtl-site-build",bb=/^[0-9a-f]{8}$/,xb=Object.freeze([Object.freeze({package:"@descix/frqtl-web",dir:""}),Object.freeze({package:"@descix/egpt-math-sdk",dir:"egpt-math-sdk"})]);var ld={__frqtlRoot:"/","assets/models/":"/frqtl/assets/models/","experiments/":"/frqtl/experiments/",__mathSdkUrl:"/egpt-src/index.js",__mathWasmUrl:"/egpt-src/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:"/egpt-src/wasm/egpt_math_sdk_wasm.js",__mathBackend:"js-reference",__notebookBase:"/notebooks",__vendorBase:"/vendor"};function wR(e){if(/\/$/.test(e))throw new Error('[engineRouter] buildDistProfile(base) takes a relative dist-root path with no trailing slash (e.g. "../.."), got '+JSON.stringify(e)+".");return{__frqtlRoot:e+"/","assets/models/":e+"/js/models/","experiments/":e+"/experiments/",__mathSdkUrl:e+"/../egpt-math-sdk/index.js",__mathWasmUrl:e+"/../egpt-math-sdk/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:e+"/../egpt-math-sdk/wasm/egpt_math_sdk_wasm.js",__mathBackend:"wasm-math",__notebookBase:e+"/../egpt-math-sdk/notebooks",__vendorBase:e+"/../egpt-math-sdk/vendor"}}var Vp=wR("../.."),qp="0.7.0-p2",_R="0.3.3-p2.1";function Ok(e){if(typeof e!="string"||!e)throw new Error("[engineRouter] cdnDistBaseFor(version): a published @descix/frqtl-web version (got "+JSON.stringify(e)+").");return"https://cdn.jsdelivr.net/npm/@descix/frqtl-web@"+e+"/dist"}var Ck=Ok(qp),Ic="https://cdn.jsdelivr.net/npm/@descix/egpt-math-sdk@"+_R+"/dist";function kR(e){var t=typeof e=="string"&&e!==""&&!/\/$/.test(e);if(t)try{new URL(e)}catch{t=!1}if(!t)throw new Error(`[engineRouter] mode:"cdn" opts.base must be the absolute URL of a copy of the package's dist/ directory, with no trailing slash (e.g. "https://example.org/vendor/frqtl-web/dist"); got `+JSON.stringify(e)+". From a page: new URL('./vendor/frqtl-web/dist', location.href).href. (FAIL-LOUD.)");return e}function jk(e){return kR(e),{__frqtlRoot:e+"/","assets/models/":e+"/js/models/","experiments/":e+"/experiments/",__mathSdkUrl:Ic+"/index.js",__mathWasmUrl:Ic+"/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:Ic+"/wasm/egpt_math_sdk_wasm.js",__mathBackend:"wasm-math",__notebookBase:Ic+"/notebooks",__vendorBase:e+"/vendor"}}var $p=jk(Ck),SR="@descix/frqtl-web",ER="@descix/egpt-math-sdk";function wb(e,t){var n=xb.find(function(r){return r.package===t});if(!n)throw new Error("[engineRouter] no site-graph.js::SITE_PLACEMENTS row places "+t+" (rows: "+xb.map(function(r){return r.package}).join(", ")+").");return n.dir?e+"/"+n.dir:e}function Kp(e,t){if(!e||!t)throw new Error("[engineRouter] buildStaticProfile(graphBase, entryBase) needs both bases (got "+JSON.stringify(e)+", "+JSON.stringify(t)+") — the graph and the entry pages are anchored separately; a co-served host passes the same base twice.");var n=wb(e,SR),r=wb(e,ER);return{__frqtlRoot:n+"/","assets/models/":n+"/js/models/","experiments/":t+"/experiments/",__mathSdkUrl:r+"/index.js",__mathWasmUrl:r+"/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:r+"/wasm/egpt_math_sdk_wasm.js",__mathBackend:"wasm-math",__notebookBase:n+"/notebooks",__vendorBase:n+"/vendor"}}var Qd="./"+xR;function Rk(e){if(typeof e!="string"||!bb.test(e))throw new Error("[engineRouter] the static site build id must match "+bb+" (the bundle's <html "+ad+">), got "+JSON.stringify(e)+".");return e}function Rg(e){return Qd+"/"+Rk(e)}function Lg(e){if(!e)throw new Error('[engineRouter] mode:"static" resolves against the document — no document.baseURI here. Outside a browser pass opts.documentBaseURI (the URL of the directory serving the static site).');return e}function OR(e,t){return new URL(Rg(t),Lg(e)).href}function CR(e){return new URL(Qd,Lg(e)).href}function jR(){var e=typeof document<"u"&&document.documentElement&&typeof document.documentElement.getAttribute=="function"?document.documentElement.getAttribute(ad):null;if(!e)throw new Error('[engineRouter] mode:"static": this document carries no build stamp (<html '+ad+">) — only the assembled bundle's pages can resolve the stamped graph (make static-deploy).");return Rk(e)}var RR="app-assets",LR=RR+"/host-view.js";(function(){var e=Kp(Rg("00000000"),Qd),t=Object.keys(ld).filter(function(o){return o.indexOf("__")!==0}).sort(),n=Object.keys(Vp).filter(function(o){return o.indexOf("__")!==0}).sort(),r=Object.keys($p).filter(function(o){return o.indexOf("__")!==0}).sort(),i=Object.keys(e).filter(function(o){return o.indexOf("__")!==0}).sort();if(t.join(",")!==n.join(",")||t.join(",")!==r.join(",")||t.join(",")!==i.join(","))throw new Error(`[engineRouter] Profile parity FAIL: dev/dist/cdn/static profiles have different path keys.
|
|
66
|
-
dev: `+t.join(", ")+`
|
|
67
|
-
dist: `+n.join(", ")+`
|
|
68
|
-
cdn: `+r.join(", ")+`
|
|
69
|
-
static: `+i.join(", "));if(!ld.__vendorBase||!Vp.__vendorBase||!$p.__vendorBase||!e.__vendorBase)throw new Error("[engineRouter] Profile parity FAIL: __vendorBase must be defined in ALL FOUR profiles.");return!0})();function AR(e){var t=!!(e.documentRelative||e.documentBaseURI);if(t&&e.build===void 0)throw new Error('[engineRouter] mode:"static" outside a browser needs opts.build — the site build id the stamped graph directory is named by (scripts/site-build.mjs siteBuildId()).');if(!t&&e.build!==void 0)throw new Error('[engineRouter] mode:"static" in a browser reads the build from <html '+ad+">; remove opts.build:"+JSON.stringify(e.build)+".");if(e.documentRelative)return Kp(Rg(e.build),Qd);var n=Lg(e.documentBaseURI||(typeof document<"u"?document.baseURI:"")),r=t?e.build:jR();return Kp(OR(n,r),CR(n))}var _b=Object.freeze(["assets/vendor/","compat/","objects/","parts/","experiments/_shared/","shim/"]),kb=Object.freeze({"scenes/":"a scene is a roster row, not a package path: its URL is sceneUrlOf(roster, row) (lib/shim/registry/roster.js) on the roster a host loads"});function PR(e,t){Object.keys(kb).forEach(function(s){if(t.indexOf(s)===0)throw new Error('[engineRouter] "'+t+'" is under the retired prefix "'+s+'": '+kb[s]+". (FAIL-LOUD.)")});for(var n=0;n<_b.length;n++)if(t.indexOf(_b[n])===0)return e.__frqtlRoot+(t.indexOf("shim/")===0?t:"frqtl/"+t);for(var r=Object.keys(e).filter(function(s){return s.indexOf("__")!==0}),i=0;i<r.length;i++){var o=r[i];if(t===o||t.indexOf(o)===0)return e[o]+t.slice(o.length)}return null}function Ag(e){e=e||{};var t=e.mode||"dev-core",n=e.engine||"wasm";if(n==="js")throw new Error('[engineRouter] JS reference engine archived — FRQTL is WASM-only. Remove engine:"js"; the only FRQTL physics engine is the compiled Rust/WASM engine.');if(t==="static"&&e.base)throw new Error('[engineRouter] mode:"static" takes no opts.base — the static base is derived from the document (STATIC_SDK_DIR against document.baseURI). Remove base:'+JSON.stringify(e.base)+".");if(e.documentRelative&&t!=="static")throw new Error('[engineRouter] opts.documentRelative applies only to mode:"static" (got mode:"'+t+'").');if(e.documentRelative&&e.documentBaseURI)throw new Error("[engineRouter] opts.documentRelative and opts.documentBaseURI are exclusive — a document-relative router is anchored at no document.");if(e.build!==void 0&&t!=="static")throw new Error('[engineRouter] opts.build applies only to mode:"static" (got mode:"'+t+'").');var r=t==="dist"?Vp:t==="cdn"?e.base!==void 0?jk(e.base):$p:t==="static"?AR(e):ld;function i(f){var h=r.__distOmit;if(h&&Array.isArray(h)){for(var v=0;v<h.length;v++)if(f===h[v])return""}var m=PR(r,f);if(m!==null)return m;if(r!==ld)throw new Error('[engineRouter] mode:"'+t+'" has no profile prefix for "'+f+'". Add the prefix to every profile in lib/shim/engine/router.js (profile parity).');return"/frqtl/"+f}var o=e.mathSdkUrl||typeof window<"u"&&window._egptMathSdkUrl||r.__mathSdkUrl||"",s=e.mathWasmUrl||typeof window<"u"&&window._egptMathWasmUrl||r.__mathWasmUrl||"",a=e.mathWasmModuleUrl||typeof window<"u"&&window._egptMathWasmModuleUrl||r.__mathWasmModuleUrl||"",l="";if(typeof window<"u"&&typeof URLSearchParams<"u")try{l=new URLSearchParams(window.location.search).get("mathBackend")||""}catch{}var c=e.mathBackend||l||r.__mathBackend;c==="wasm"&&(c="wasm-math");var u=r.__notebookBase||"/notebooks",d=r.__vendorBase||"/vendor";return{resolve:i,frqtlRoot:function(){return r.__frqtlRoot},engine:n,mathSdkUrl:o,mathWasmUrl:s,mathWasmModuleUrl:a,mathBackend:c,notebookBase:u,vendorBase:d,distBase:t==="cdn"?e.base||Ck:null}}const Sb=Object.freeze(["markdown","js","module","canvas","chart","view"]),Pg="</cell>",Lk="</cell>";function MR(e){return String(e).split(Pg).join(Lk)}function TR(e){return String(e).split(Lk).join(Pg)}function Yp(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function DR(e){return String(e).replace(/"/g,'"').replace(/'/g,"'").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function Eb(e){const t=Object.create(null);if(!e)return t;const n=/([a-zA-Z_][\w-]*)\s*=\s*("([^"]*)"|'([^']*)')/g;let r;for(;(r=n.exec(e))!==null;){const i=r[1],o=r[3]!==void 0?r[3]:r[4]!==void 0?r[4]:"";t[i]=DR(o)}return t}function dh(e){return e?String(e).split(",").map(function(t){return t.trim()}).filter(function(t){return t.length>0}):[]}function IR(e){return!e||!e.length?"":e.join(", ")}function Ob(e){var t={};return e&&String(e).split(",").forEach(function(n){var r=n.trim();if(r){var i=r.indexOf("=");if(i!==-1){var o=r.slice(0,i).trim(),s=r.slice(i+1).trim();if(o){var a=Number(s);t[o]=s!==""&&isFinite(a)?a:s}}}}),t}function FR(e){if(!e)return"";var t=Object.keys(e);return t.length?t.map(function(n){return n+"="+e[n]}).join(","):""}const Su=[{key:"type",kind:"string"},{key:"lane",kind:"string"},{key:"id",kind:"string"},{key:"name",kind:"string"},{key:"in",kind:"names"},{key:"out",kind:"names"},{key:"bind",kind:"string"},{key:"spec",kind:"string"},{key:"realm",kind:"string"},{key:"module",kind:"string"},{key:"subscribe",kind:"string"},{key:"setup",kind:"string"},{key:"shape",kind:"string"},{key:"stage",kind:"string"},{key:"seed",kind:"string"},{key:"render3d",kind:"bool"},{key:"renderOptions",kind:"opts"},{key:"cameraPreset",kind:"string"},{key:"produces",kind:"names"},{key:"produceVia",kind:"string"},{key:"produceAfter",kind:"string"},{key:"liveChart",kind:"string"},{key:"liveChartKind",kind:"string"},{key:"opts",kind:"opts"},{key:"collapsed",kind:"bool"}];function NR(e){const t=e||{},n={};for(const{key:r,kind:i}of Su){const o=t[r];i==="names"?n[r]=Array.isArray(o)?o.slice():[]:i==="opts"?n[r]=o&&typeof o=="object"&&!Array.isArray(o)?o:{}:i==="bool"?n[r]=!!o:n[r]=typeof o=="string"?o:o==null?"":String(o)}return n}function zR(e,t){const n=(Array.isArray(e)?e:[]).slice(),r=Array.isArray(t)?t:[];for(let i=0;i<r.length;i++)n.indexOf(r[i])===-1&&n.push(r[i]);return n}function Fc(e){return e.title?'notebook "'+e.title+'"':"untitled notebook"}function BR(e){if(typeof e!="string")throw new Error("[notebook/format] parse() requires an HTML string; got "+typeof e);const t=/<frqtl-notebook\b([^>]*)>([\s\S]*?)<\/frqtl-notebook>/i.exec(e);if(!t)throw new Error("[notebook/format] no <frqtl-notebook>…</frqtl-notebook> root found — not a FRQTL native notebook (FAIL-LOUD).");const n=Eb(t[1]),r=t[2],i=[],o=/<cell\b/gi,s=/<\/cell>/gi;let a;for(;(a=o.exec(r))!==null;){const l=i.length,c=r.indexOf(">",a.index);if(c===-1)throw new Error("[notebook/format] "+Fc(n)+": cell #"+l+" open tag `<cell` has no closing `>` (FAIL-LOUD).");const u=r.slice(a.index,c+1);s.lastIndex=c+1;const d=s.exec(r);if(d===null)throw new Error("[notebook/format] "+Fc(n)+": cell #"+l+" "+u+" has no </cell> closer — the rest of the notebook would be one cell body (FAIL-LOUD).");o.lastIndex=d.index+d[0].length;const f=Eb(r.slice(a.index+a[0].length,c)),h=r.slice(c+1,d.index);if(Sb.indexOf(f.type)===-1)throw new Error("[notebook/format] "+Fc(n)+": cell #"+l+" has "+(f.type===void 0?"no type attribute":'unknown type="'+f.type+'"')+" — legal types (CELL_TYPES): "+Sb.join(", ")+" (FAIL-LOUD).");const v=dh(f.produces),m=zR(dh(f.out),v),x={type:f.type,lane:f.lane||"",id:f.id||"",name:f.name||"",in:dh(f.in),out:m,bind:f.bind||"",spec:f.spec||"",realm:f.realm||"",module:f.module||"",subscribe:f.subscribe||"",setup:f.setup||"",shape:f.shape||"",stage:f.stage||"",seed:f.seed||"",render3d:f.render3d==="true",renderOptions:Ob(f.renderOptions),cameraPreset:f.cameraPreset||"",produces:v,produceVia:f.produceVia||"",produceAfter:f.produceAfter||"",liveChart:f.liveChart||"",liveChartKind:f.liveChartKind||"",opts:Ob(f.opts),collapsed:f.collapsed==="true"};i.push({...NR(x),body:TR(h)})}if(i.length===0)throw new Error("[notebook/format] "+Fc(n)+" has zero <cell> elements — nothing to render, run or scan (FAIL-LOUD).");return{title:n.title||"",version:n.version||"1",cells:i}}function UR(e){const t=Array.isArray(e.produces)?e.produces:[],r=(Array.isArray(e.out)?e.out:[]).filter(function(o){return t.indexOf(o)===-1});let i="<cell";for(let o=0;o<Su.length;o++){const s=Su[o].key,a=Su[o].kind;if(a==="bool"){e[s]&&(i+=" "+s+'="true"');continue}let l;a==="names"?l=IR(s==="out"?r:s==="produces"?t:e[s]):a==="opts"?l=FR(e[s]):l=typeof e[s]=="string"?e[s]:"",l&&(i+=" "+s+'="'+Yp(l)+'"')}return i+=">",i}function HR(e){if(!e||typeof e!="object")throw new Error("[notebook/format] serialize() requires a notebook object.");if(!Array.isArray(e.cells))throw new Error("[notebook/format] notebook.cells must be an array.");const t=e.version||"1",n=e.title||"",r=[];r.push('<frqtl-notebook version="'+Yp(t)+'"'+(n?' title="'+Yp(n)+'"':"")+">"),r.push("");for(let i=0;i<e.cells.length;i++){const o=e.cells[i],s=MR(o.body==null?"":o.body);r.push(UR(o)+s+Pg),r.push("")}return r.push("</frqtl-notebook>"),r.push(""),r.join(`
|
|
70
|
-
`)}var Ir={IDLE:"idle",RUNNING:"running",OK:"ok",ERROR:"error",STALE:"stale"};class WR{constructor(t,n){if(n=n||{},!t||!Array.isArray(t.cells))throw new Error("[NotebookKernel] requires a notebook object with a cells[] array.");this._runtime=n.runtime||ci,this._bus=n.bus||Ee;var r=["runCell","resetMathScope"].filter(function(f){return typeof this._runtime[f]!="function"},this);if(r.length)throw new Error("[NotebookKernel] the injected runtime does not satisfy the kernel's contract — missing: "+r.join(", ")+". Pass lib/shim/runtime/index.js's `Runtime` (Runtime.runCell, Runtime.resetMathScope), or a stub that implements both.");this._disposed=!1,this._cells=t.cells.slice(),this._cellById=new Map;for(var i=0;i<this._cells.length;i++){var o=this._cells[i];o.id&&this._cellById.set(o.id,o)}this.bindings=new Map,this.cellState=new Map;for(var s=0;s<this._cells.length;s++){var a=this._cells[s];a.id&&this.cellState.set(a.id,{status:Ir.IDLE,lastRunInputVersions:{},outputs:{}})}this._consumersOfName=new Map;for(var l=0;l<this._cells.length;l++){var c=this._cells[l];if(!(!c.id||!Array.isArray(c.in)))for(var u=0;u<c.in.length;u++){var d=c.in[u];this._consumersOfName.has(d)||this._consumersOfName.set(d,new Set),this._consumersOfName.get(d).add(c.id)}}}resetScope(){this.bindings.clear(),this._runtime.resetMathScope()}moduleSet(){for(var t={},n=0;n<this._cells.length;n++){var r=this._cells[n];r.type==="module"&&r.name&&(t[r.name]=r.body==null?"":String(r.body))}return t}_setStatus(t,n){if(!this._disposed){var r=this.cellState.get(t);r&&(r.status=n,this._bus.emit("notebook:cellstate",{cellId:t,status:n}))}}runCell(t,n){if(n=n||{},this._disposed)return Promise.reject(new Error('[NotebookKernel] disposed; cannot run cell "'+t+'".'));var r=this._cellById.get(t);if(!r)return Promise.reject(new Error('[NotebookKernel] no cell with id "'+t+'".'));for(var i=this,o={},s=Array.isArray(r.in)?r.in:[],a={},l=0;l<s.length;l++){var c=s[l];if(!i.bindings.has(c)){var u=i._findProducerCellId(c),d=u?"run cell "+u+" first.":"no cell in this notebook declares it as an output.",f=new Error('[NotebookKernel] cell "'+t+'" declares input "'+c+'", not yet produced — '+d+" (FAIL-LOUD; upstream is NOT auto-run.)");i._setStatus(t,Ir.ERROR);var h=i.cellState.get(t);return h&&(h.outputs={}),Promise.reject(f)}var v=i.bindings.get(c);o[c]=v.value,a[c]=v.version}return i._setStatus(t,Ir.RUNNING),i._runtime.runCell({lane:r.lane||"math",code:r.body||"",id:t,inputs:o,modules:i.moduleSet(),declaredOutputs:Array.isArray(r.out)?r.out:[],display:n.display||null}).then(function(m){if(i._disposed)return m;var x=i.cellState.get(t);if(m&&m.ok){for(var b=Array.isArray(r.out)?r.out:[],g=0;g<b.length;g++){var k=b[g],E=i.bindings.get(k),C=E?E.version+1:1;i.bindings.set(k,{value:m.outputs[k],version:C,producerCellId:t}),i._markConsumersStale(k,t)}x&&(x.outputs=m.outputs||{},x.lastRunInputVersions=a),i._setStatus(t,Ir.OK)}else x&&(x.outputs={}),i._setStatus(t,Ir.ERROR);return m})}commitViewOutputs(t,n){if(!this._disposed){for(var r=this.cellState.get(t),i=n&&typeof n=="object"?n:{},o=Object.keys(i),s=0;s<o.length;s++){var a=o[s],l=this.bindings.get(a),c=l?l.version+1:1;this.bindings.set(a,{value:i[a],version:c,producerCellId:t}),this._markConsumersStale(a,t)}r&&(r.outputs=i),this._setStatus(t,Ir.OK)}}runOrder(){for(var t={js:!0,canvas:!0,chart:!0,view:!0},n=[],r=0;r<this._cells.length;r++){var i=this._cells[r];i.id&&t[i.type]&&n.push(i)}for(var o=new Map,s=new Map,a=new Map,l=0;l<n.length;l++)o.set(n[l].id,l),s.set(n[l].id,0),a.set(n[l].id,new Set);for(var c=0;c<n.length;c++)for(var u=n[c],d=Array.isArray(u.in)?u.in:[],f=0;f<d.length;f++){var h=this._findProducerCellId(d[f]);if(h&&h!==u.id&&s.has(h)){var v=a.get(h);v.has(u.id)||(v.add(u.id),s.set(u.id,s.get(u.id)+1))}}for(var m=[],x=0;x<n.length;x++)s.get(n[x].id)===0&&m.push(n[x].id);for(var b=[],g=this._cellById;m.length>0;){m.sort(function(E,C){return o.get(E)-o.get(C)});var k=m.shift();b.push(g.get(k)),a.get(k).forEach(function(E){s.set(E,s.get(E)-1),s.get(E)===0&&m.push(E)})}if(b.length!==n.length)throw new Error("[NotebookKernel] runAll cannot order cells: a dependency CYCLE exists among declared in/out bindings. (FAIL-LOUD — no safe linear run order.)");return b}runAll(t){if(t=t||{},this._disposed)return Promise.reject(new Error("[NotebookKernel] disposed; cannot runAll."));var n=this,r;try{r=n.runOrder()}catch(f){return Promise.reject(f)}n.resetScope();var i=r.length,o=typeof t.displayFor=="function"?t.displayFor:null,s=typeof t.onProgress=="function"?t.onProgress:null,a=typeof t.runner=="function"?t.runner:null,l=[];function c(f,h,v){var m={index:f,total:i,cellId:h,phase:v};n._disposed||n._bus.emit("notebook:runall",m),s&&s(m)}var u=Promise.resolve(),d={ok:!0,failedCellId:null,error:null,ran:0};return r.forEach(function(f,h){u=u.then(function(){if(!(n._disposed||!d.ok)){c(h+1,f.id,"running");var v=a?a(f):null;if(v&&typeof v.then=="function")return v.then(function(x){l.push({cellId:f.id,result:x}),d.ran+=1,!x||!x.ok?(d.ok=!1,d.failedCellId=f.id,d.error=x&&x.error?x.error:'cell "'+f.id+'" did not complete ok.',c(h+1,f.id,"error")):c(h+1,f.id,"ok")},function(x){l.push({cellId:f.id,result:{ok:!1,error:x&&x.message?x.message:String(x)}}),d.ran+=1,d.ok=!1,d.failedCellId=f.id,d.error=x&&x.message?x.message:String(x),c(h+1,f.id,"error")});var m=o?{display:o(f.id)}:{};return n.runCell(f.id,m).then(function(x){l.push({cellId:f.id,result:x}),d.ran+=1,!x||!x.ok?(d.ok=!1,d.failedCellId=f.id,d.error=x&&x.error?x.error:'cell "'+f.id+'" did not complete ok.',c(h+1,f.id,"error")):c(h+1,f.id,"ok")},function(x){l.push({cellId:f.id,result:{ok:!1,error:x&&x.message?x.message:String(x)}}),d.ran+=1,d.ok=!1,d.failedCellId=f.id,d.error=x&&x.message?x.message:String(x),c(h+1,f.id,"error")})}})}),u.then(function(){return{total:i,ran:d.ran,ok:d.ok,failedCellId:d.failedCellId,error:d.error,results:l}})}_markConsumersStale(t,n){var r=this._consumersOfName.get(t);if(r){var i=this;r.forEach(function(o){if(o!==n){var s=i.cellState.get(o);s&&(s.status===Ir.OK||s.status===Ir.ERROR)&&i._setStatus(o,Ir.STALE)}})}}_findProducerCellId(t){for(var n=0;n<this._cells.length;n++){var r=this._cells[n];if(r.id&&Array.isArray(r.out)&&r.out.indexOf(t)!==-1)return r.id}return null}getCellState(t){return this.cellState.get(t)||null}getBinding(t){return this.bindings.get(t)||null}dispose(){this._disposed=!0,this.resetScope(),this.cellState.clear(),this._cellById.clear(),this._consumersOfName.clear(),this._cells=[]}}var Mg=Object.create(null);function VR(e){return typeof e=="string"&&e.length>0&&/^[a-z][a-z0-9-]*$/.test(e)}function Ak(e,t){if(!VR(e))throw new Error('[realm-registry] register: invalid realm name "'+String(e)+'" (expect lowercase-kebab, e.g. "frqtl"). (FAIL-LOUD.)');if(!t||typeof t.boot!="function")throw new Error('[realm-registry] register("'+e+'"): descriptor must have a boot(hostEl, transport) function. (FAIL-LOUD.)');Mg[e]=t}function qR(e){var t=Mg[e];if(!t)throw new Error('[realm-registry] get: no realm registered for "'+String(e)+'". Registered: ['+$R().join(", ")+"]. (Blessed realms register at import; a BYO realm must register() first.) (FAIL-LOUD.)");return t}function $R(){return Object.keys(Mg)}function cd(e,t){var n=t||"data-plane payload";if(typeof structuredClone!="function"){try{JSON.parse(JSON.stringify(e))}catch(r){throw new TypeError("[view-handle] "+n+" is not serializable (JSON fallback): "+(r&&r.message?r.message:String(r))+" (VETO-CLASS #1 — the data plane must be structured-clone-serializable so a marshalling host is not a fork.)")}return e}try{structuredClone(e)}catch(r){throw new TypeError("[view-handle] "+n+" is not structured-clone-serializable: "+(r&&r.message?r.message:String(r))+" (VETO-CLASS #1 — never pass a live object ref/function/DOM node across the handle data plane; a marshalling host cannot carry it.)")}return e}function cs(e,t){try{return Promise.resolve(e.apply(null,t))}catch(n){return Promise.reject(n)}}function Pk(e){if(!e||typeof e.inject!="function"||typeof e.call!="function"||typeof e.on!="function"||typeof e.dispose!="function")throw new Error("[view-handle] makeViewHandle requires an impl with inject/call/on/dispose (start/stop/step optional but recommended). (FAIL-LOUD.)");var t={transport:e._transport||"in-app",inject:function(n,r){if(typeof n!="string"||!n)return Promise.reject(new Error("[view-handle] inject: name must be a non-empty string."));try{cd(r,'inject("'+n+'") payload')}catch(i){return Promise.reject(i)}return cs(e.inject,[n,r])},call:function(n,r){return cs(e.call,[n,r])},on:function(n,r){if(typeof r!="function")throw new Error('[view-handle] on("'+String(n)+'"): cb must be a function.');var i=function(s){cd(s,'on("'+String(n)+'") event payload'),r(s)},o=e.on(n,i);return typeof o=="function"?o:function(){}},start:function(){return e.start?cs(e.start,[]):Promise.resolve()},stop:function(){return e.stop?cs(e.stop,[]):Promise.resolve()},step:function(){return e.step?cs(e.step,[]):Promise.resolve()},dispose:function(){return cs(e.dispose,[])}};return Object.freeze(t)}function KR(){var e=[];return{kind:"in-app",isInApp:function(){return!0},post:function(t){for(var n=0;n<e.length;n++)try{e[n](t)}catch{}},subscribe:function(t){if(typeof t!="function")throw new Error("[realm-transport:in-app] subscribe requires a function.");return e.push(t),function(){var n=e.indexOf(t);n!==-1&&e.splice(n,1)}}}}const YR=Object.freeze([Object.freeze({specifier:"@descix/frqtl-web/parts",libPath:"frqtl/parts/index.js",why:"the parts barrel",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/parts/",libPath:"frqtl/parts/",why:"one part = one file",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/shim/controls/registry.js",libPath:"shim/controls/registry.js",why:"knob registration (registerControls): a scene declares its own sliders and toggles",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/shim/render/sun-look.js",libPath:"shim/render/sun-look.js",why:"the one owner of the sun's FX bag (SunLook)",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/compat/renderer/display-slot.js",libPath:"frqtl/compat/renderer/display-slot.js",why:"the booted display name a dual-mode scene reads before its co-init call",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/compat/renderer/orbit-bag.js",libPath:"frqtl/compat/renderer/orbit-bag.js",why:"hasAngularPose, THE 3D-ness predicate of a camera pose",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/objects/setup/_collisionMatrixLanes.js",libPath:"frqtl/objects/setup/_collisionMatrixLanes.js",why:"the one collision-lane table (density lanes of a collision scene)",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/compat/engine.js",libPath:"frqtl/compat/engine.js",why:"the engine accessor (a scene that builds its frames by hand)",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/kinds",libPath:"frqtl/objects/kinds-entry.js",why:"the kind registry: a composed fork registers its renamed class (registerKind, kindNamed, kindOf, registeredKinds)",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/tagger.js",libPath:"frqtl/objects/objects/tagger.js",why:"imported by DetectorWall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/schema/index.js",libPath:"frqtl/objects/schema/index.js",why:"imported by DetectorWall, SlitScreen, Wall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/shim/render/heat-colormap.js",libPath:"shim/render/heat-colormap.js",why:"imported by GraphingDetectorWall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/schema/valueNormalizer.js",libPath:"frqtl/objects/schema/valueNormalizer.js",why:"imported by LiveChart, Wall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/Box.js",libPath:"frqtl/objects/objects/Box.js",why:"imported by OvenBox — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/QuantumEmitter.js",libPath:"frqtl/objects/objects/QuantumEmitter.js",why:"imported by OvenBox — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/shim/expr/ast-schema.js",libPath:"shim/expr/ast-schema.js",why:"imported by OvenBox, Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/actionCompiler.js",libPath:"frqtl/objects/objects/actionCompiler.js",why:"imported by OvenBox, Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/v1-replacements.js",libPath:"frqtl/objects/v1-replacements.js",why:"imported by SlitLightSource — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/slitLinerScatter.js",libPath:"frqtl/objects/objects/slitLinerScatter.js",why:"imported by SlitScreen, Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/setup/setupSphereEmitter3D.js",libPath:"frqtl/objects/setup/setupSphereEmitter3D.js",why:"imported by SphereEmitter — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/directedRedirectProgram.js",libPath:"frqtl/objects/objects/directedRedirectProgram.js",why:"imported by Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/compat/renderer/lo-drawn-center.js",libPath:"frqtl/compat/renderer/lo-drawn-center.js",why:"imported by Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/setup/setupTunnelPointExit.js",libPath:"frqtl/objects/setup/setupTunnelPointExit.js",why:"imported by Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/constants/WallBehaviors.js",libPath:"frqtl/objects/constants/WallBehaviors.js",why:"imported by Wall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/absorbRadiation.js",libPath:"frqtl/objects/objects/absorbRadiation.js",why:"imported by Wall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/geometry/SlabFace.js",libPath:"frqtl/objects/geometry/SlabFace.js",why:"imported by Wall — a forked copy imports it",tier:"part-internal"})]),Mk=Object.freeze({specifier:"@descix/frqtl-web/boot",libPath:"frqtl/experiments/_shared/doors.js",why:"the scene doors (bootScene, bootProject)"}),GR=Object.freeze([Mk,Object.freeze({specifier:"@descix/frqtl-web/registry",libPath:"shim/registry/index.js",why:"the roster contract and its readers (normalizeRoster, sceneGroups, showcaseCard, showcaseHref), the roster loader (loadRoster), projectOf + emptyProjectOf, STUDIO's deep-link landing record"}),Object.freeze({specifier:"@descix/frqtl-web/project",libPath:"shim/project/index.js",why:"the specifier table, the link site, sketchProject and the project identity"}),Object.freeze({specifier:"@descix/frqtl-web/host-view",libPath:"shim/host/index.js",why:"the DeSciX host-view declarer: a page declares its own view"}),Object.freeze({specifier:"@descix/frqtl-web/site-graph",libPath:"shim/engine/site-graph.js",why:"the static site's shape: the graph directory, the build-stamp attribute, the build id pattern, the IDE entry page, the host-provided attribute"})]);function JR(e){if(/^(\/|\.\/|\.\.\/)/.test(e))return!0;try{return new URL(e),!0}catch{return!1}}function XR(e){if(typeof e!="string"||!e.endsWith("/"))throw new TypeError('[specifiers] importMapFor(libRootUrl): the lib-identity root URL as seen from the page, ending in "/" (got '+JSON.stringify(e)+"). (FAIL-LOUD.)");if(!JR(e))throw new TypeError("[specifiers] importMapFor(libRootUrl): "+JSON.stringify(e)+' is neither an absolute URL nor a path starting with "/", "./" or "../", so a browser reads every row built on it as a bare specifier and ignores it. Write it as '+JSON.stringify("./"+e)+" (relative to the page) or "+JSON.stringify("/"+e)+" (from the origin root). (FAIL-LOUD.)");const t={};for(const n of YR)t[n.specifier]=e+n.libPath;return{imports:t}}function QR(e){const t=XR(e);for(const n of GR)t.imports[n.specifier]=e+n.libPath;return t}var fh=Object.freeze({SEED:"seed",RENDERER:"renderer",ENGINE:"engine"}),Tk=Object.freeze([Object.freeze({key:fh.SEED,reader:"lib/frqtl/experiments/empty/index.html",forward:!0}),Object.freeze({key:fh.RENDERER,reader:"lib/frqtl/experiments/_shared/boot.js",forward:!0}),Object.freeze({key:fh.ENGINE,reader:"lib/frqtl/experiments/_shared/boot.js",forward:!1,why:"the host's own physics-engine selector (e.g. the GYM's Benchmark/Compare engine dropdown) is the SOLE authority for this axis; forwarding an outer ?engine= would let it silently override an explicit host choice, which is exactly the engine-sniffing-from-above-the-shim class of bug this codebase forbids elsewhere"})]),ZR=Object.freeze([Object.freeze({key:"chrome",appliedBy:"lib/frqtl/experiments/_shared/boot.js",forward:!1,acceptedValues:Object.freeze(["canvas"]),why:`chrome is a HOST-COMPOSITION decision (whether the experiment's own control chrome DOM renders), never a per-experiment physics/render parameter; forwarding it from an outer host URL into an embedded iframe would reintroduce the hidden-experiment-chrome bug (the GYM must always show the experiment's own full chrome, never chrome=canvas — see the "WHEN should a host set chrome=canvas" doc above for the general criterion, not just the GYM's specific answer to it)`})]),eL=Object.freeze(Tk.filter(function(e){return e.forward}).map(function(e){return e.key}));const Dk=/\b(TODO|TBD|FIXME|XXX|placeholder|lorem)\b/i,tL=/^(#|$)|example\.(com|org|net)|localhost|127\.0\.0\.1/i,Gp=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function Zs(e,t){if(typeof e!="string"||e.trim()==="")throw new Error(t+" must be non-empty text (got "+JSON.stringify(e)+").");if(Dk.test(e))throw new Error(t+": placeholder text in shipped copy: "+JSON.stringify(e));return e}function nL(e,t){if(typeof e=="string"){Zs(e,t);return}if(!e||typeof e!="object"||typeof e.text!="string")throw new Error(t+": a segment is neither a string nor { text, href } (got "+JSON.stringify(e)+").");if(Zs(e.text,t),!Gp(e,"href")||e.href!==null&&typeof e.href!="string")throw new Error(t+": link segment "+JSON.stringify(e.text)+" must declare href as a URL or null (not-yet-known link), got "+JSON.stringify(e.href)+".");if(Gp(e,"em")&&e.em!==!0)throw new Error(t+": segment "+JSON.stringify(e.text)+" declares em as "+JSON.stringify(e.em)+" — em is true (emphasis) or absent.");if(typeof e.href=="string"&&(tL.test(e.href)||!/^https:\/\//.test(e.href)))throw new Error(t+": placeholder or non-https href "+JSON.stringify(e.href)+" — a link not yet known is declared null, never a stand-in URL.")}function Ik(e,t){if(typeof e=="string"){if(Dk.test(e))throw new Error(t+": placeholder text in shipped copy: "+JSON.stringify(e));return}e&&typeof e=="object"&&Object.keys(e).forEach(n=>Ik(e[n],t))}function Do(e,t,n){if(!n||typeof n.table!="boolean")throw new TypeError("copy-gate: assertCopyParagraphs("+t+") needs { table: true|false }.");if(!Array.isArray(e)||e.length===0)throw new Error(t+" must be a non-empty array of paragraphs (got "+JSON.stringify(e)+").");return e.forEach((r,i)=>{const o=t+" paragraph "+i;if(Array.isArray(r)){if(r.length===0)throw new Error(o+" is an empty segment array.");r.forEach(s=>nL(s,o));return}if(r&&typeof r=="object"&&Gp(r,"table")){if(!n.table)throw new Error(o+" is a table paragraph — a table is allowed only in a showcase intro (roster.js ROSTER_KEYS.intro); this copy is plain paragraphs.");Ik(r.table,o);return}throw new Error(o+" is neither a segment array nor a table paragraph (got "+JSON.stringify(r)+").")}),e}const at={compare:"compare",author:"author",ide:"ide",codec:"codec",bench:"bench"},rL=Object.freeze([at.author,at.compare]);function Fk(e){if(!Object.prototype.hasOwnProperty.call(at,e)||at[e]!==e)throw new Error("[presets] readsRoster(preset): "+JSON.stringify(e)+" is not a live preset — PRESETS: "+Object.keys(at).join(", ")+". (FAIL-LOUD.)");return rL.indexOf(e)!==-1}const Cb={notebooks:"ide",notebook:"ide",sim:"ide"};function iL(e){return e?Cb[e]?Cb[e]:at[e]?e:"ide":"ide"}const Nk=["bench"],jb=Object.freeze(["internal","public"]);function Zd(e){if(e===void 0)return"internal";if(jb.indexOf(e)===-1)throw new Error("[presets] unknown audience "+JSON.stringify(e)+" — AUDIENCES: "+jb.join(", ")+".");return e}function Tg(e){return Zd(e)==="internal"?Object.keys(at):Object.keys(at).filter(function(t){return Nk.indexOf(t)===-1})}function zk(e,t){var n=iL(e);return Zd(t)==="public"&&Nk.indexOf(n)!==-1?"ide":n}const oL=at.author;function sL(e,t){return zk(e===void 0?oL:e,t)}function Dg(e,t,n,r){var i=e+"/"+encodeURIComponent(t)+"/index.html?engine="+encodeURIComponent(n),o=new URLSearchParams(r||"");return eL.forEach(function(s){var a=o.get(s);a!==null&&a!==""&&(i+="&"+s+"="+encodeURIComponent(a))}),i}function aL(e,t){var n=ZR.filter(function(i){return i.key==="chrome"})[0];if(!n||!Array.isArray(n.acceptedValues))throw new Error('[presets] withHostChrome: lib/shim/page-params HOST_TOKENS has no "chrome" entry with acceptedValues — contract module out of date. (FAIL-LOUD.)');if(n.acceptedValues.indexOf(t)===-1)throw new Error("[presets] withHostChrome: invalid chrome token "+JSON.stringify(t)+" — accepted values: ["+n.acceptedValues.join(", ")+"]. (FAIL-LOUD.)");var r=typeof e=="string"&&e.indexOf("?")===-1?"?":"&";return e+r+"chrome="+encodeURIComponent(t)}const Al={ide:"FAT",compare:"Gym",bench:"Math Bench",author:"Studio",codec:"Rosetta"},lL="https://godsworld.ai",cL=null,uL=null,dL="https://github.com/Jolieabadir/workshop",hh="https://egpt.descix.net/prod/egpt/site/10_PAPERS/Address_Is_The_Map/Address_Is_The_Map.pdf",fL=null,ud=Object.freeze(["This is a work in development: developers are encouraged to contribute at the ",Object.freeze({text:"EGPT FRQTL SDK repo",href:cL}),", check out the ",Object.freeze({text:"GitHub issues",href:uL}),", and earn EGPT tokens for accepted PRs."]);function Ig(e){return"preset-"+e}function hL(e){return Zd(e)==="public"}function Nc(e,t){return Object.freeze({title:Al[e],seenKey:Ig(e),paragraphs:Object.freeze(t.map(Object.freeze).concat([ud]))})}const Fg=Object.freeze({compare:Nc("compare",[['GYM is a testing ground for new "sugar" objects. Think of FRQTL experiments like actual fractals: you can start a Koch Snowflake at iteration 0 and wait a long time to get to 1 million, or you can build composite sugar objects in FRQTL that start the emergent physics at later iterations by doing a statistical packaging of the earlier iterations into sugar objects (like 3DEmitter, which can be turned into a Laser, etc.). GYM is where you test your proposed sugar object.']]),author:Nc("author",[["STUDIO is the basis of the Tony Stark JARVIS-like interface that Maxi (",{text:"GodsWorld.ai",href:lL},") embodies."],["The designer explores 3D drag-and-drop as a human-machine interface and is a follow-up to ",{text:"Jolie's workshop repo",href:dL},"."]]),ide:Nc("ide",[['FAT provides a notebook programming environment in which both the FRQTL (frame and quantum language) non-algebraic language and the traditionally understood transform approach can be used by way of FAT, the "Faster Abadir Transform" (compare the fast Fourier transform).'],["FAT is built on an algebraic mathematical language, EGPT Math (compare Matlab, Mathematica, or Lean), but the native mathematical objects like EGPTReal are strictly constructive. That is, EGPT Math's EGPTReal is constructively bijective to standard mathematical Real numbers."]]),codec:Nc("codec",[[`ROSETTA is the mathematical formalization of the AS operator (not just AND, OR, and NOT) per Rota's "Barrier of Meaning" and Ulam's concept. At an intuitive level, "AS" is formalized in the concept of "`,{text:"The Address ",href:hh},{text:"is",href:hh,em:!0},{text:" The Map",href:hh},'", or the address ',{text:"as",href:null,em:!0}," the map. It is formalized in the canonical bijections of the EGPT number hierarchy to the Lean Standard types of Nat, Rat, Real and beth staircase, and also in the Lean translation bijections for N to GEMM and CNF, etc."],["ROSETTA is an exploration of a completely new approach to building transform codecs. In EGPT, which is bijectively equivalent to standard mathematics, ",{text:'there is no "proving"; there is only translating a mathematical object from one form to another',href:fL},"."],["The EGPT Lean proofs show bijective equivalence between a number N and GEMM, and CNF form, etc. With that in place, entirely new and exponentially more efficient approaches to LLMs are possible: for example, deterministic and lossless Strassen can be used at any floating-point precision, and all calculations can be kept on low-energy integer units in the CPU or deterministically reconstructibly parallelized on GPUs."]])});function pL(e){var t=Tg("public");t.forEach(function(n){if(!Object.prototype.hasOwnProperty.call(e,n))throw new Error('[presets] PRESET_EXPLAINERS has no explainer for public preset "'+n+'".')}),Object.keys(e).forEach(function(n){if(t.indexOf(n)===-1)throw new Error('[presets] PRESET_EXPLAINERS names "'+n+'", which is not a public preset ('+t.join(", ")+").");var r=e[n];if(r.title!==Al[n])throw new Error("[presets] PRESET_EXPLAINERS."+n+".title must be PRESET_LABELS."+n+".");if(r.seenKey!==Ig(n))throw new Error("[presets] PRESET_EXPLAINERS."+n+'.seenKey must be presetExplainerKey("'+n+'").');if(!Array.isArray(r.paragraphs)||r.paragraphs.length<2)throw new Error("[presets] PRESET_EXPLAINERS."+n+" needs its own copy followed by DEVELOPER_NOTICE.");var i=r.paragraphs.length-1;if(r.paragraphs[i]!==ud)throw new Error("[presets] PRESET_EXPLAINERS."+n+" must END with the shared DEVELOPER_NOTICE (by reference — a pasted copy drifts).");r.paragraphs.forEach(function(o,s){if(s!==i&&o===ud)throw new Error("[presets] PRESET_EXPLAINERS."+n+" repeats DEVELOPER_NOTICE.");if(!Array.isArray(o)||o.length===0)throw new Error("[presets] PRESET_EXPLAINERS."+n+": paragraph "+s+" is not a non-empty segment array.")}),Do(r.paragraphs,"[presets] PRESET_EXPLAINERS."+n,{table:!1})})}pL(Fg);const Jp=Object.freeze({desktop:Object.freeze([Object.freeze(["The controls, from the top: Run and Pause start and stop the scene, Restart builds it again from its first tick, and Rec records what you see as a video."]),Object.freeze(["The tools on the left: the Hand picks up an object and moves it, the Dropper places a new object from the Palette, and the Pencil lets you edit all of an object's settings."]),Object.freeze(["The camera: the sliders at the top left turn it and set its distance. In a 3D scene the MOVE and LOOK pads at the bottom steer it."])]),phone:Object.freeze([Object.freeze(["The controls at the top: Run and Pause start and stop the scene, Restart builds it again from its first tick, and Rec records what you see as a video."]),Object.freeze(["On the scene: drag one finger to turn a 3D scene, pinch to zoom, twist two fingers to roll it, drag two fingers to slide it, and double tap to put the camera back."]),Object.freeze(["HAND, at the bottom, picks up objects: with it on, one finger moves an object, and two fingers on it twist it or resize it. In a 3D scene the MOVE and LOOK pads on either side of it steer the camera."])])});Object.keys(Jp).forEach(function(e){Do(Jp[e],"[presets] STUDIO_CONTROLS."+e,{table:!1})});function mL(e,t){var n=Fg[e];if(!n)throw new Error('[presets] presetExplainerFor: "'+e+'" has no PRESET_EXPLAINERS row (public presets: '+Tg("public").join(", ")+").");if(!t||typeof t.onPhone!="boolean")throw new TypeError("[presets] presetExplainerFor(id, { onPhone }): onPhone is isMobileDevice(window) (lib/shim/host/device.js), a boolean (got "+JSON.stringify(t)+").");if(e!==at.author)return n;var r=n.paragraphs.slice(0,n.paragraphs.length-1);return Object.freeze({title:n.title,seenKey:n.seenKey,paragraphs:Object.freeze(r.concat(Jp[t.onPhone?"phone":"desktop"],[ud]))})}const gL="(pointer: coarse) and (max-width: 932px)";function Bk(e){if(!e||typeof e.matchMedia!="function")throw new TypeError("[device] isMobileDevice(win) needs the window the page is laid out in (a matchMedia function); got "+(e===null?"null":typeof e)+". (FAIL-LOUD.)");return e.matchMedia(gL).matches===!0}var Uk=null,Ng=null,dd=Object.freeze(["files","projects"]),vL=Object.freeze({files:'the project folder (lib/shim/storage/folders.js, namespace "project-folders") for a STUDIO save, the codec chain (lib/shim/storage/codec-chains.js, namespace "codec-chains") for a ROSETTA save',projects:'the project folder (lib/shim/storage/folders.js, namespace "project-folders")'});function la(e,t){if(typeof e!="string"||e.length===0)throw new Error("[StorageProvider] "+t+" is a non-empty string (got "+JSON.stringify(e)+"). (FAIL-LOUD.)");if(e.indexOf("/")!==-1)throw new Error("[StorageProvider] "+t+" "+JSON.stringify(e)+' contains "/" — "/" is reserved in a storage key; name it without one. (FAIL-LOUD.)')}function yL(e){return Object.freeze({get:function(t,n){return e.get(t,n)},put:function(t,n,r){if(dd.indexOf(t)!==-1)throw new Error('[StorageProvider] a write into the retired namespace "'+t+'" (key '+JSON.stringify(n)+") is refused — that save format is retired; "+vL[t]+" replaced it. (FAIL-LOUD.)");return e.put(t,n,r)},delete:function(t,n){return e.delete(t,n)},list:function(t){return e.list(t)}})}var Rb=["get","put","delete","list"];function bL(e){if(!e||typeof e!="object")throw new Error("[StorageProvider] provider must be a non-null object; got "+typeof e);for(var t=0;t<Rb.length;t++){var n=Rb[t];if(typeof e[n]!="function")throw new Error('[StorageProvider] provider is missing required method "'+n+'"')}}function xL(e){bL(e),Uk=e,Ng=yL(e)}function gn(){if(!Uk)throw new Error("[StorageProvider] no active provider has been set. Call bootLocalStorage() (lib/shim/storage/boot.js) during app boot, or setActiveProvider(<provider>) for a non-browser driver.");return Ng}function wL(){return Ng}const Hk="explainers",Wk=Object.freeze([{id:"shown-first-visit",shows:!0,means:"storage answered and holds no seen record for this key: the card shows; Continue writes the record"},{id:"suppressed-seen",shows:!1,means:"storage holds a seen record for this key: the card does not show"},{id:"storage-unavailable-shown",shows:!0,means:"no storage provider, or the provider threw on read or on the Continue write: the card shows and nothing is remembered; data-run-once-detail names what failed"},{id:"not-offered-audience",shows:!1,notOffered:!0,means:"the host does not offer this card to its audience: nothing is read, written or shown; data-run-once-detail names the audience (recordRunOnceNotOffered)"},{id:"not-offered-no-roster-row",shows:!1,notOffered:!0,means:"the scene has no showcase-roster row, so it has no card: nothing is read, written or shown; data-run-once-detail names the scene (recordRunOnceNotOffered)"}].map(Object.freeze)),Vk=new Map(Wk.map(e=>[e.id,e]));function _L(){return{seenAt:new Date().toISOString()}}function Xp(e){return e&&e.message?String(e.message):String(e)}function Ts(e,t){const n=Vk.get(e);if(!n)throw new Error(`run-once-card: '${e}' is not a RUN_ONCE_OUTCOMES row`);return t===void 0?{row:e,shows:n.shows}:{row:e,shows:n.shows,detail:t}}function ef(e){if(typeof e!="string"||e==="")throw new TypeError(`run-once-card: seenKey must be a non-empty string (got ${JSON.stringify(e)})`)}async function qk(e){ef(e);let t;try{t=gn()}catch(r){return Ts("storage-unavailable-shown",`no storage provider: ${Xp(r)}`)}let n;try{n=await t.get(Hk,e)}catch(r){return Ts("storage-unavailable-shown",`read failed: ${Xp(r)}`)}return n==null?Ts("shown-first-visit"):Ts("suppressed-seen")}async function $k(e,t){if(ef(e),t.row==="storage-unavailable-shown")return t;try{await gn().put(Hk,e,_L())}catch(n){return Ts("storage-unavailable-shown",`write failed: ${Xp(n)}`)}return t}function Io(e,t,n){e.dataset.runOnceKey=t,e.dataset.runOnceOutcome=n.row,n.detail===void 0?delete e.dataset.runOnceDetail:e.dataset.runOnceDetail=n.detail}function zg(e){delete e.dataset.runOnceKey,delete e.dataset.runOnceOutcome,delete e.dataset.runOnceDetail}function fd(e,t){if(!e||!e.dataset||!e.ownerDocument)throw new TypeError("run-once-card: hostEl must be a DOM element");if(!t||typeof t!="object")throw new TypeError("run-once-card: spec bag required");if(ef(t.seenKey),typeof t.title!="string"||t.title==="")throw new TypeError(`run-once-card: title must be a non-empty string (${t.seenKey})`);if(!Array.isArray(t.paragraphs)||t.paragraphs.length===0)throw new TypeError(`run-once-card: paragraphs must be a non-empty array (${t.seenKey})`);if(t.paragraphs.forEach(n=>{if(n&&!Array.isArray(n)&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"table")){kL(n,t.seenKey);return}if(!Array.isArray(n))throw new TypeError(`run-once-card: a paragraph is neither a segment array nor { table } (${t.seenKey})`);n.forEach(r=>{if(typeof r!="string"&&(!r||typeof r.text!="string"||!Object.prototype.hasOwnProperty.call(r,"href")||r.href!==null&&typeof r.href!="string"||Object.prototype.hasOwnProperty.call(r,"em")&&r.em!==!0))throw new TypeError(`run-once-card: segment ${JSON.stringify(r)} is neither a string nor { text, href: string|null, em?: true } (${t.seenKey})`)})}),t.onContinue!==void 0&&typeof t.onContinue!="function")throw new TypeError(`run-once-card: onContinue must be a function when given (${t.seenKey})`);t.progress!==void 0&&SL(t.progress,t.seenKey)}function kL(e,t){const n=o=>{throw new TypeError(`run-once-card: table paragraph ${o} (${t})`)};Object.keys(e).length!==1&&n("has fields beside table: "+Object.keys(e).join(", "));const r=e.table;(!r||typeof r!="object"||Array.isArray(r))&&n("needs table: { caption, head, rows }");const i=Object.keys(r).filter(o=>o!=="caption"&&o!=="head"&&o!=="rows");i.length&&n("has unknown field(s) "+i.join(", ")+" — fields: caption, head, rows"),(typeof r.caption!="string"||r.caption.trim()==="")&&n("needs a non-empty caption"),(!Array.isArray(r.head)||r.head.length===0)&&n("needs a non-empty head"),(!Array.isArray(r.rows)||r.rows.length===0)&&n("needs a non-empty rows array"),r.head.forEach(o=>{typeof o!="string"&&n("head cell "+JSON.stringify(o)+" is not a string")}),r.rows.forEach((o,s)=>{(!Array.isArray(o)||o.length!==r.head.length)&&n("row "+s+" is not "+r.head.length+" cells long (the head's length)"),o.forEach(a=>{typeof a!="string"&&n("row "+s+" cell "+JSON.stringify(a)+" is not a string")})})}function SL(e,t){if(!e||typeof e!="object")throw new TypeError(`run-once-card: progress must be a { phases, current, subscribe } bag (${t})`);const{phases:n}=e;if(!Array.isArray(n)||n.length===0)throw new TypeError(`run-once-card: progress.phases must be a non-empty array (${t})`);const r=new Set;if(n.forEach(i=>{if(!i||typeof i.id!="string"||i.id===""||typeof i.means!="string"||r.has(i.id))throw new TypeError(`run-once-card: progress phase ${JSON.stringify(i)} is not a unique { id, means } (${t})`);r.add(i.id)}),typeof e.current!="function"||typeof e.subscribe!="function")throw new TypeError(`run-once-card: progress needs current() and subscribe(cb) functions (${t})`);Kk(e.current(),n)}function Kk(e,t){const n=t.map(i=>i.id),r=(i,o)=>{throw new Error(`run-once-card: progress ${o} '${i}' is not one of its phases — ${n.join(", ")}`)};if(!e||typeof e!="object")throw new TypeError("run-once-card: progress snapshot must be an object");return n.includes(e.phase)||r(e.phase,"phase"),e.failed!==null&&e.failed!==void 0&&!n.includes(e.failed)&&r(e.failed,"failed"),Object.keys(e.phases||{}).forEach(i=>{n.includes(i)||r(i,"phases key")}),e}function EL(e,t){const n=e.phases&&e.phases[t];return n?n.complete?1:n.total>0?Math.min(1,n.done/n.total):0:0}function OL({scrollHeight:e,clientHeight:t,scrollTop:n}){return e-t>1&&n+t<e-1}function CL(e,t){const n=e.createElement("div");n.dataset.runOnceProgress="",n.style.cssText="flex:none;margin:0 0 12px;";const r=e.createElement("div");r.style.cssText="display:flex;gap:3px;height:4px;";const i=new Map;t.phases.forEach(l=>{const c=e.createElement("div");c.dataset.bootPhase=l.id,c.title=l.means,c.style.cssText="flex:1 1 0;background:#262a33;border-radius:2px;overflow:hidden;";const u=e.createElement("div");u.style.cssText="height:100%;width:0%;background:#2d6cdf;",c.appendChild(u),r.appendChild(c),i.set(l.id,{seg:c,fill:u})});const o=e.createElement("div");o.dataset.runOnceProgressCaption="",o.style.cssText="margin-top:6px;font-size:12px;color:#8a919c;",n.appendChild(r),n.appendChild(o);function s(l){Kk(l,t.phases),t.phases.forEach(u=>{const d=EL(l,u.id),{seg:f,fill:h}=i.get(u.id);h.style.width=(d*100).toFixed(1)+"%",f.dataset.fill=String(d),l.failed===u.id&&(f.dataset.failed="",h.style.background="#b6161c",h.style.width="100%")});const c=t.phases.find(u=>u.id===(l.failed||l.phase));o.textContent=l.failed?`Failed: ${c.means}`:c.means,n.dataset.runOnceProgressPhase=l.failed||l.phase}s(t.current());const a=t.subscribe(s);if(typeof a!="function")throw new TypeError("run-once-card: progress.subscribe(cb) must return an unsubscribe function");return{el:n,unsubscribe:a}}function jL(e,t){const n=e.createElement("div");n.style.cssText="margin:0 0 12px;overflow-x:auto;";const r=e.createElement("table");r.dataset.runOnceTable="",r.style.cssText="border-collapse:collapse;width:100%;font-size:12px;line-height:1.4;";const i=e.createElement("caption");i.appendChild(e.createTextNode(t.caption)),i.style.cssText="caption-side:top;text-align:left;font-weight:700;margin:0 0 6px;color:#d8dbe0;",r.appendChild(i);const o=(c,u)=>{const d=e.createElement(c);return d.appendChild(e.createTextNode(u)),d.style.cssText="border:1px solid #2c313a;padding:4px 6px;text-align:left;vertical-align:top;"+(c==="th"?"color:#8fb8ff;font-weight:600;":""),d},s=e.createElement("thead"),a=e.createElement("tr");t.head.forEach(c=>a.appendChild(o("th",c))),s.appendChild(a),r.appendChild(s);const l=e.createElement("tbody");return t.rows.forEach(c=>{const u=e.createElement("tr");c.forEach(d=>u.appendChild(o("td",d))),l.appendChild(u)}),r.appendChild(l),n.appendChild(r),n}function Yk(e,t,n){for(;t.firstChild;)t.removeChild(t.firstChild);n.forEach(r=>{if(!Array.isArray(r)){t.appendChild(jL(e,r.table));return}const i=e.createElement("p");i.style.cssText="margin:0 0 12px;",r.forEach(o=>{if(typeof o=="string"){i.appendChild(e.createTextNode(o));return}let s=e.createTextNode(o.text);if(o.em===!0){const l=e.createElement("em");l.appendChild(s),s=l}if(o.href===null){i.appendChild(s);return}const a=e.createElement("a");a.href=o.href,a.target="_blank",a.rel="noopener noreferrer",a.appendChild(s),a.style.cssText="color:#7cc4ff;",i.appendChild(a)}),t.appendChild(i)})}function Gk(e,t,n,r,i){const o=e.ownerDocument,s=o.defaultView;if(!s||!s.ResizeObserver)throw new Error(`run-once-card: the host window has no ResizeObserver (the scroll cue re-measures on resize) (${t.seenKey})`);const a="run-once-title-"+t.seenKey,l=o.createElement("div");l.dataset.runOnceCard=t.seenKey,l.style.cssText=i===null?"position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:12px;box-sizing:border-box;background:rgba(0,0,0,0.6);pointer-events:auto;":(i==="flow"?"position:relative;":"position:absolute;left:0;right:0;top:0;")+"display:flex;justify-content:center;padding:8px;box-sizing:border-box;pointer-events:none;";const c=o.createElement("div");c.setAttribute("role","dialog"),c.setAttribute("aria-modal",i===null?"true":"false"),c.setAttribute("aria-labelledby",a),c.style.cssText="box-sizing:border-box;width:100%;max-width:"+(i===null?"560px;max-height:100%;":"440px;max-height:45vh;pointer-events:auto;")+'overflow:hidden;display:flex;flex-direction:column;background:#15171c;color:#d8dbe0;border:1px solid #2c313a;border-radius:8px;padding:20px 22px 16px;box-shadow:0 12px 40px rgba(0,0,0,0.5);font:14px/1.55 system-ui,-apple-system,"Segoe UI",sans-serif;';const u=o.createElement("h2");u.id=a,u.textContent=t.title,u.style.cssText="margin:0 0 12px;font-size:13px;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:#8fb8ff;flex:none;",c.appendChild(u);let d=null;t.progress&&(d=CL(o,t.progress),c.appendChild(d.el));const f=o.createElement("div");f.style.cssText="position:relative;flex:1 1 auto;min-height:0;display:flex;flex-direction:column;";const h=o.createElement("div");h.dataset.runOnceText="",h.style.cssText="flex:1 1 auto;min-height:0;overflow:auto;",h.tabIndex=0,f.appendChild(h);const v=o.createElement("div");v.dataset.runOnceScrollCue="",v.setAttribute("aria-hidden","true"),v.style.cssText="position:absolute;left:0;right:0;bottom:0;height:44px;box-sizing:border-box;padding-top:24px;text-align:center;font-size:12px;line-height:18px;color:#8a919c;pointer-events:none;background:linear-gradient(to bottom, rgba(21,23,28,0), #15171c 70%);",v.textContent="Scroll for more ↓",v.hidden=!0,f.appendChild(v),c.appendChild(f),Yk(o,h,t.paragraphs);const m=o.createElement("div");m.style.cssText="display:flex;justify-content:flex-end;margin-top:4px;flex:none;";const x=o.createElement("button");x.type="button",x.dataset.runOnceContinue="",x.textContent=n,x.style.cssText="background:#2d6cdf;color:#fff;border:0;border-radius:5px;padding:8px 18px;font:600 13px system-ui,sans-serif;cursor:pointer;",x.addEventListener("click",r),m.appendChild(x),c.appendChild(m),l.addEventListener("keydown",C=>{if(i!==null||C.key!=="Tab")return;const S=o.activeElement;!C.shiftKey&&S===x?(C.preventDefault(),h.focus({preventScroll:!0})):C.shiftKey&&S===h&&(C.preventDefault(),x.focus({preventScroll:!0}))}),l.appendChild(c),e.appendChild(l);const b=()=>{v.hidden=!OL({scrollHeight:h.scrollHeight,clientHeight:h.clientHeight,scrollTop:h.scrollTop})};b(),h.addEventListener("scroll",b,{passive:!0});const g=new s.ResizeObserver(b);g.observe(h);const k=d?d.unsubscribe:null;function E(){k&&k(),g.disconnect()}return{overlay:l,panel:c,body:h,row:m,continueBtn:x,teardown:E,measure:b}}function Us(e,t,n,r){if(!e||!e.dataset)throw new TypeError("run-once-card: hostEl must be a DOM element");ef(t);const i=Vk.get(n);if(!i||i.notOffered!==!0)throw new Error(`run-once-card: recordRunOnceNotOffered row ${JSON.stringify(n)} is not a not-offered row — `+Wk.filter(o=>o.notOffered).map(o=>o.id).join(", ")+".");if(typeof r!="string"||r==="")throw new TypeError(`run-once-card: recordRunOnceNotOffered needs a non-empty reason (${t})`);return Io(e,t,Ts(n,r)),{close(){zg(e)}}}const Qp=new Set;function Zp(e){for(let t=e;t;t=t.parentNode)if(t.inert===!0)return!0;return!1}const Lb=["covers"];function Jk(e,t,n){if(t===void 0)return{};if(!t||typeof t!="object")throw new TypeError(`run-once-card: options must be a { covers } bag when given (${n})`);const r=Object.keys(t).filter(o=>!Lb.includes(o));if(r.length)throw new TypeError(`run-once-card: unknown option(s) ${r.join(", ")} — options: ${Lb.join(", ")} (${n})`);const i=t.covers;if(i!==void 0){if(!i||i.ownerDocument!==e.ownerDocument||!("inert"in i))throw new TypeError(`run-once-card: covers must be an element of the host's document (${n})`);if(i===e||Xk(i,e))throw new Error(`run-once-card: covers contains the card's own host — the card would cover itself (${n})`)}return{covers:i}}function Xk(e,t){for(let n=t.parentNode;n;n=n.parentNode)if(n===e)return!0;return!1}function Qk(e,t,n,r){const i=e.ownerDocument,o=i.defaultView;if(n&&n.inert===!0)throw new Error(`run-once-card: '${t.seenKey}' covers an element that is already inert — one cover has one owner (another card, or the host, already holds it)`);let s=null,a=null,l=null;const c={seenKey:t.seenKey,doc:i,btn:null};function u(){a&&!Zp(a)&&a.focus({preventScroll:!0})}const d=()=>{o.setTimeout(u,0)};function f(){if(s===null)return;const v=i.activeElement===null||i.activeElement===i.body||Xk(s,i.activeElement);if(l&&(l(),l=null),s.parentNode&&s.parentNode.removeChild(s),n&&(n.inert=!1,o.removeEventListener("blur",d)),Qp.delete(c),s=null,a=null,v&&!LL(i)){const m=r.returnFocusTo;m&&m!==i.body&&m.isConnected!==!1&&typeof m.focus=="function"&&!Zp(m)&&m.focus({preventScroll:!0})}}const h=Gk(e,t,r.dismissLabel,r.onDismiss,null);return s=h.overlay,r.reopened&&(s.dataset.runOnceReopened=""),a=h.continueBtn,l=h.teardown,c.btn=a,Qp.add(c),n&&(n.inert=!0,o.addEventListener("blur",d)),u(),{remove:f,focus:u}}function Zk(e,t,n){const r=e.ownerDocument.defaultView;if(t&&(!r||typeof r.addEventListener!="function"))throw new Error(`run-once-card: covers needs the host document's window for the blur reclaim (${n})`)}function Pl(e,t,n){fd(e,t);const{covers:r}=Jk(e,n,t.seenKey);Zk(e,r,t.seenKey);let i=!1,o=null;return{ready:qk(t.seenKey).then(a=>i?a:a.shows?(o=Qk(e,t,r,{dismissLabel:"Continue",reopened:!1,returnFocusTo:null,onDismiss:()=>{o.remove(),$k(t.seenKey,a).then(l=>{i||Io(e,t.seenKey,l)}),t.onContinue&&t.onContinue()}}),Io(e,t.seenKey,a),a):(Io(e,t.seenKey,a),a)),close(){i=!0,o&&o.remove(),zg(e)},focus(){o&&o.focus()}}}function RL(e,t,n){fd(e,t);for(const s of["onContinue","progress"])if(t[s]!==void 0)throw new TypeError(`run-once-card: a reopened card gates nothing — '${s}' is refused (${t.seenKey})`);const{covers:r}=Jk(e,n,t.seenKey);Zk(e,r,t.seenKey);const i=e.ownerDocument;let o=null;return o=Qk(e,t,r,{dismissLabel:"Close",reopened:!0,returnFocusTo:i.activeElement,onDismiss:()=>{o.remove()}}),{close(){o.remove()},focus:o.focus}}function LL(e){const t=[...Qp].filter(n=>n.doc===e&&!Zp(n.btn));if(t.length>1)throw new Error("run-once-card: "+t.length+" cards show uncovered at once ("+t.map(n=>n.seenKey).join(", ")+") — a stacked card must cover the one beneath it");return t.length===1?(t[0].btn.focus({preventScroll:!0}),!0):!1}const Ab=Object.freeze(["top","flow"]),AL=4e3;function PL(e,t,n){fd(e,t);for(const m of["onContinue","progress"])if(t[m]!==void 0)throw new TypeError(`run-once-card: a task is ended by the act or by Skip — '${m}' is refused (${t.seenKey})`);const r=n&&typeof n=="object"?Object.keys(n).filter(m=>m!=="dock"):[];if(!n||typeof n!="object"||r.length||Ab.indexOf(n.dock)===-1)throw new TypeError(`run-once-card: openRunOnceTask options are { dock: ${Ab.join(" | ")} } (got ${JSON.stringify(n)}) (${t.seenKey})`);const i=e.ownerDocument,o=i.defaultView;let s=!1,a=null,l=null,c=!1,u=null,d=null;function f(){u!==null&&(o.clearTimeout(u),u=null),a!==null&&(a.teardown(),a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),a=null,l=null)}function h(){return $k(t.seenKey,d).then(m=>(s||Io(e,t.seenKey,m),m))}return{ready:qk(t.seenKey).then(m=>(d=m,s?m:m.shows?(a=Gk(e,t,"Skip",()=>{const x=c;f(),x||h()},n.dock),a.overlay.dataset.runOnceTask="asked",l=i.createElement("div"),l.dataset.runOnceTaskStatus="",l.style.cssText="flex:none;margin:0 0 8px;font-size:13px;color:#9ad0a0;",l.hidden=!0,a.panel.insertBefore(l,a.row),Io(e,t.seenKey,m),m):(Io(e,t.seenKey,m),m))),status(m){if(typeof m!="string")throw new TypeError(`run-once-card: task status(text) takes a string (${t.seenKey})`);l===null||c||(l.textContent=m,l.hidden=m==="")},complete(m){if(a===null)throw new Error(`run-once-card: complete() on the task '${t.seenKey}', which is not showing (never shown, skipped or closed) — the host watches only a task that shows. (FAIL-LOUD.)`);return fd(e,{seenKey:t.seenKey,title:t.title,paragraphs:m}),c?Promise.resolve(d):(c=!0,Yk(i,a.body,m),a.measure(),l.hidden=!0,a.continueBtn.textContent="Close",a.overlay.dataset.runOnceTask="done",u=o.setTimeout(f,AL),h())},showing(){return a!==null},close(){s=!0,f(),zg(e)}}}var eS="frqtl";function ph(e,t){return eS+":"+e+":"+t}function ML(e){return eS+":"+e+":"}function mo(e,t){if(typeof e!="string"||e.length===0)throw new Error("[LocalStorageProvider] "+t+" must be a non-empty string; got: "+JSON.stringify(e));if(e.indexOf("/")!==-1)throw new Error("[LocalStorageProvider] "+t+' must not contain "/"; got: '+JSON.stringify(e))}class TL{constructor(){if(typeof window>"u"||typeof window.localStorage>"u"||window.localStorage===null)throw new Error("[LocalStorageProvider] window.localStorage is not available in this environment. Use a different StorageProvider (e.g. a server-backed RemoteStorageProvider) or ensure the page is served in a context where localStorage is permitted.");try{var t="__frqtl_storage_probe__";window.localStorage.setItem(t,"1"),window.localStorage.removeItem(t)}catch(n){throw new Error("[LocalStorageProvider] window.localStorage is present but write-blocked (private browsing with strict storage restrictions?). Error: "+(n&&n.message?n.message:String(n)))}this._ls=window.localStorage}get(t,n){mo(t,"namespace"),mo(n,"key");var r=this._ls.getItem(ph(t,n));if(r===null)return null;try{return JSON.parse(r)}catch(i){throw new Error('[LocalStorageProvider] stored value for "'+t+"/"+n+'" is not valid JSON. Storage may be corrupted. Error: '+(i&&i.message?i.message:String(i)))}}put(t,n,r){mo(t,"namespace"),mo(n,"key");var i;try{i=JSON.stringify(r)}catch(o){throw new Error('[LocalStorageProvider] value for "'+t+"/"+n+'" is not JSON-serialisable: '+(o&&o.message?o.message:String(o)))}try{this._ls.setItem(ph(t,n),i)}catch(o){throw new Error('[LocalStorageProvider] localStorage.setItem failed for "'+t+"/"+n+'" — storage may be full (QuotaExceededError) or blocked. Error: '+(o&&o.message?o.message:String(o)))}}delete(t,n){mo(t,"namespace"),mo(n,"key"),this._ls.removeItem(ph(t,n))}list(t){mo(t,"namespace");for(var n=ML(t),r=[],i=this._ls,o=i.length,s=0;s<o;s++){var a=i.key(s);if(a!==null&&a.indexOf(n)===0){var l=a.slice(n.length),c=i.getItem(a),u=null;try{u=JSON.parse(c)}catch(h){console.warn('[LocalStorageProvider] skipping malformed entry "'+a+'": '+(h&&h.message?h.message:String(h)));continue}var d={key:l};if(u!==null&&typeof u=="object"&&!Array.isArray(u))for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&f!=="key"&&(d[f]=u[f]);r.push(d)}}return r}}const DL=Object.freeze([{id:"installed",means:"a LocalStorageProvider was constructed and is now the active provider"},{id:"already-active",means:"a provider was already active (a host set its own, or boot ran before); left as is"},{id:"unavailable",means:"localStorage is absent or write-blocked: no provider is set; detail is the reason"}].map(Object.freeze));function IL(){if(wL())return{row:"already-active"};let e;try{e=new TL}catch(t){return{row:"unavailable",detail:t&&t.message?String(t.message):String(t)}}return xL(e),{row:"installed"}}const mh=Object.freeze({row:"data-storage-boot",detail:"data-storage-boot-detail"}),FL=new Set(DL.map(e=>e.id));function NL(e,t){if(!e||typeof e.setAttribute!="function"||typeof e.removeAttribute!="function")throw new TypeError("storage boot: recordStorageBoot needs a DOM element");if(!t||!FL.has(t.row))throw new Error("storage boot: "+JSON.stringify(t&&t.row)+" is not a STORAGE_BOOT_OUTCOMES row");e.setAttribute(mh.row,t.row),t.detail===void 0?e.removeAttribute(mh.detail):e.setAttribute(mh.detail,t.detail)}const vi=Object.freeze([Object.freeze({key:"preset",prop:"initialPreset"}),Object.freeze({key:"module",prop:"initialModule",surfaces:Object.freeze([at.codec]),remedy:"a saved STUDIO project is ?project=<name>"}),Object.freeze({key:"project",prop:"initialProject",surfaces:Object.freeze([at.author])}),Object.freeze({key:"notebook",prop:"initialNotebook",surfaces:Object.freeze([at.ide])}),Object.freeze({key:"walkthrough",prop:"initialWalkthrough",surfaces:Object.freeze([at.author,at.compare])}),Object.freeze({key:"mode",prop:"initialWalkthroughMode",surfaces:Object.freeze([at.author,at.compare])}),Object.freeze({key:"scene",prop:"initialScene",surfaces:Object.freeze([at.author])}),Object.freeze({key:"renderer",prop:"initialSceneRenderer",surfaces:Object.freeze([at.author])})]);var zL=Tk.map(function(e){return e.key});function tS(e,t){return zL.indexOf(e.key)!==-1&&e.surfaces.indexOf(t)===-1}const tf=Object.freeze([Object.freeze({key:"experiment",prop:"refusedExperiment",refusal:"?experiment= is gone: the experiment pages were deleted — a scene opens by ?walkthrough=<id> (a saved one by ?project=<name>)"})]);function BL(e){return tf.some(function(t){return t.prop===e})}function nS(e){var t=e instanceof URLSearchParams?e:new URLSearchParams(e||""),n={};return vi.concat(tf).forEach(function(r){var i=t.get(r.key);i&&(n[r.prop]=i)}),n}function UL(e){if(!e)return"";var t=vi.map(function(r){return r.key});Object.keys(e).forEach(function(r){if(t.indexOf(r)===-1)throw new Error('[deep-link] unknown deep-link key "'+r+'" — DEEP_LINK_PARAMS declares: ['+t.join(", ")+"].")});var n=new URLSearchParams;return vi.forEach(function(r){e[r.key]&&n.set(r.key,e[r.key])}),n.toString()}var rS=vi.filter(function(e){return e.key==="preset"})[0].prop;function hd(e,t){return sL(e?e[rS]:void 0,t)}function iS(e,t){var n=Object.assign({},e||{});return n[rS]=t,n}function gh(e){if(!e)return"";var t={};vi.forEach(function(r){t[r.prop]=r.key});var n={};return Object.keys(e).forEach(function(r){if(!BL(r)){if(!Object.prototype.hasOwnProperty.call(t,r))throw new Error('[deep-link] unknown deep-link prop "'+r+'" — DEEP_LINK_PARAMS declares: ['+Object.keys(t).join(", ")+"].");n[t[r]]=e[r]}}),UL(n)}function HL(e){var t=vi.concat(tf).map(function(r){return r.prop}),n={};return Object.keys(e||{}).forEach(function(r){if(t.indexOf(r)===-1)throw new Error('[deep-link] unknown FraqtlIde prop "'+r+'" — neither a named FraqtlIde prop nor a DEEP_LINK_PARAMS prop: ['+t.join(", ")+"].");e[r]&&(n[r]=e[r])}),n}function Ml(e){return vi.filter(function(t){return t.surfaces&&t.surfaces.indexOf(e)!==-1})}function oS(e){var t={};return Object.keys(at).forEach(function(n){var r={};Ml(at[n]).forEach(function(i){e&&e[i.prop]&&(r[i.prop]=e[i.prop])}),t[at[n]]=r}),t}function WL(e,t){if(!e)return null;var n=function(o){return(Al[o]||o)+" ("+o+")"},r=tf.filter(function(o){return e[o.prop]}).map(function(o){return o.refusal}),i=r.concat(vi.filter(function(o){return o.surfaces&&e[o.prop]&&o.surfaces.indexOf(t)===-1&&!tS(o,t)}).map(function(o){return o.key+'="'+e[o.prop]+'" is not a deep-link key of '+n(t)+" — it belongs to "+o.surfaces.map(n).join(", ")+(o.remedy?"; "+o.remedy:"")}));return i.length?"Deep link error: "+i.join(" · ")+".":null}function VL(e,t,n,r){var i=Ml(t).filter(function(a){return a.key===n})[0];if(!i)throw new Error('[deep-link] surface "'+t+'" has no deep-link key "'+n+'" — DEEP_LINK_PARAMS gives it: ['+Ml(t).map(function(a){return a.key}).join(", ")+"].");var o=Object.assign({},e&&e[t]||{});r?o[i.prop]=String(r):delete o[i.prop];var s=Object.assign({},e||{});return s[t]=o,s}function qL(e,t){var n=Ml(e);return Object.keys(t||{}).forEach(function(r){if(!n.some(function(i){return i.key===r}))throw new Error('[deep-link] surface "'+e+'" has no deep-link key "'+r+'" — DEEP_LINK_PARAMS gives it: ['+n.map(function(i){return i.key}).join(", ")+"].")}),n.map(function(r){var i=t&&t[r.key];return[r.key,i?String(i):""]})}function $L(e,t,n){var r=Ml(t).filter(function(a){return a.surfaces.indexOf(n)!==-1});if(!r.length)throw new Error('[deep-link] surfaces "'+t+'" and "'+n+'" share no deep-link key — DEEP_LINK_PARAMS gives no selection to hand off.');var i=e&&e[t]||{},o={};r.forEach(function(a){i[a.prop]&&(o[a.prop]=i[a.prop])});var s=Object.assign({},e||{});return s[n]=o,s}function KL(e,t,n){var r=new URLSearchParams(e instanceof URLSearchParams?e:String(e||"").replace(/^\?/,"")),i=gh(t);if(gh(Pb(nS(r),n))===gh(Pb(t,n)))return null;var o=hd(t,n);vi.forEach(function(a){a.surfaces&&tS(a,o)||r.delete(a.key)});var s=r.toString();return i+(i&&s?"&":"")+s}function Pb(e,t){var n=hd(e,t);return iS(oS(e)[n],n)}function il(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}var vh=1,Mb=Object.freeze([{key:"version",normalize:function(e){if(e===void 0||e===vh)return vh;throw new Error("[render-state] renderState.version "+JSON.stringify(e)+" — this owner reads version "+vh+" only. (FAIL-LOUD.)")}},{key:"renderer",normalize:function(e){return typeof e=="string"&&e.length>0?e:null}},{key:"engine",normalize:function(e){return typeof e=="string"&&e.length>0?e:null}},{key:"seed",normalize:function(e){return e!=null&&e!==""?String(e):null}},{key:"backdropVisible",normalize:function(e){return typeof e=="boolean"?e:null}},{key:"camera",normalize:function(e){return il(e)?{orbit:il(e.orbit)?e.orbit:null,preset:typeof e.preset=="string"?e.preset:null}:null}},{key:"render",normalize:function(e){return Array.isArray(e)?e.filter(function(t){return il(t)&&typeof t.key=="string"&&t.key.length>0}):[]}}].map(Object.freeze));function yi(e){if(e!==null&&!il(e))throw new Error("[render-state] a renderState is a bag (a plain object) or null for none — got "+(e===void 0?"undefined":Array.isArray(e)?"an array":typeof e)+". (FAIL-LOUD.)");var t=e||{};if(Object.prototype.hasOwnProperty.call(t,"pageControls")){var n=Array.isArray(t.pageControls)?t.pageControls:[];throw new Error("[render-state] this saved project carries page controls (renderState.pageControls: "+(n.map(function(o){return il(o)?String(o.id):"?"}).join(", ")||"an empty list")+") — page controls are declared in the sketch's own code; move them into the sketch and save again. (FAIL-LOUD.)")}var r=Mb.map(function(o){return o.key});Object.keys(t).forEach(function(o){if(r.indexOf(o)===-1)throw new Error('[render-state] renderState has no key "'+o+'" — its keys (RENDER_STATE_KEYS): '+r.join(", ")+". (FAIL-LOUD.)")});var i={};return Mb.forEach(function(o){i[o.key]=o.normalize(t[o.key])}),i}function sS(e,t){if(typeof e!="string"||!t)return e;if(Object.prototype.hasOwnProperty.call(t,"egpt3D"))throw new Error("[render-state] applySavedUrlOverrides: `egpt3D` is DELETED — 3D-ness is the scene's co-init call (exp.createScene), and the display is `renderer` (three IS the 3D display). (FAIL-LOUD.)");var n=e.indexOf("?"),r=n===-1?e:e.slice(0,n),i=n===-1?"":e.slice(n+1),o=new URLSearchParams(i);t.renderer&&o.set("renderer",t.renderer),t.seed!==void 0&&t.seed!==null&&t.seed!==""&&o.set("seed",String(t.seed));var s=o.toString();return s?r+"?"+s:r}const em=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Bg=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),zc=e=>e.map(t=>typeof t=="string"?t:t.text).join("");function Ql(e){return e&&typeof e=="object"&&!Object.isFrozen(e)&&(Object.freeze(e),Object.keys(e).forEach(t=>Ql(e[t]))),e}const nf=e=>Ql(structuredClone(e));function Dt(e,t){throw new Error("[roster] "+e+" "+t+" (FAIL-LOUD.)")}function lr(e,t){return(typeof e!="string"||e.trim()==="")&&Dt(t,"must be non-empty text (got "+JSON.stringify(e)+")."),e}const ki=e=>(t,n,r)=>t===null?null:e(t,n,r),Si=(e,t)=>Zs(e,"[roster] "+t);function Tb(e,t){return Do([e],"[roster] "+t,{table:!1}),e.every(n=>typeof n=="string")||Dt(t,"is a plain paragraph: strings only (no links)."),nf(e)}function YL(e,t){return(!Bg(e)||Object.keys(e).length===0)&&Dt(t,"must be a non-empty setOrbit patch (got "+JSON.stringify(e)+")."),Object.keys(e).forEach(n=>{(typeof e[n]!="number"||!Number.isFinite(e[n]))&&Dt(t+"."+n,"must be a finite number (got "+String(e[n])+").")}),nf(e)}function GL(e,t){return(!Number.isInteger(e)||e<1)&&Dt(t,"must be an integer >= 1 (got "+JSON.stringify(e)+")."),e}function aS(e,t){Bg(e)||Dt(t,"must be a renderState bag (got "+JSON.stringify(e)+").");try{return Ql(yi(structuredClone(e)))}catch(n){throw new Error("[roster] "+t+": "+n.message)}}function JL(e,t){return aS(e,t),nf(e)}function XL(e,t){lr(e,t);let n=null;try{n=new URL(e)}catch{Dt(t,"must be an absolute origin such as https://host (got "+JSON.stringify(e)+").")}return(n.protocol!=="https:"&&n.protocol!=="http:"||n.origin!==e)&&Dt(t,"must be an absolute http(s) origin with no path and no trailing slash (got "+JSON.stringify(e)+"; its origin is "+JSON.stringify(n.origin)+")."),e}function QL(e,t){return Do(e,"[roster] "+t,{table:!0}),nf(e)}function ZL(e,t){if(typeof e!="string"||e==="")return"must be a relative URL ending .js (got "+JSON.stringify(e)+")";if(/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e))return JSON.stringify(e)+" is absolute; a scene source is relative to the roster, so every scene sits under its directory";if(e[0]==="/"||e[0]==="\\")return JSON.stringify(e)+" starts with a slash; a scene source is relative to the roster's directory";if(e.split(/[/\\]/).indexOf("..")!==-1)return JSON.stringify(e)+` has a ".." segment; a scene source never leaves the roster's directory`;if(!/\.js$/.test(e))return JSON.stringify(e)+" does not end .js; a scene is one sketch file";const n=new URL("./",t).href,r=new URL(e,t);return r.href.indexOf(n)!==0||r.search||r.hash?JSON.stringify(e)+" resolves to "+r.href+", outside the roster's directory "+n:null}function eA(e,t,n){const r=ZL(e,n.href);return r&&Dt(t,r+"."),e}function qt(e,t,n,r){return Object.freeze(Object.assign({key:e,type:t,required:!0,default:void 0,child:null,many:!1,check:n},r))}function Yr(e,t,n,r){return Object.freeze({key:e,type:t,required:!1,default:Ql(n),child:null,many:!1,check:r})}function us(e,t,n,r,i){return Object.freeze({key:e,type:t+(r?"[]":" | null"),required:n,default:Ql(i),child:t,many:r,check:null})}const tA=Object.freeze({roster:Object.freeze([us("rows","scene",!0,!0,void 0),Yr("firstContact","scene id | null (null: the Empty Universe)",null,ki(lr)),us("showcase","showcase",!1,!1,null)]),scene:Object.freeze([qt("id","id (unique)",lr),qt("title","text",lr),qt("group","text",lr,{missing:"every scene names its group; the package owns no default group"}),qt("source","relative URL ending .js (no scheme, no leading /, no ..)",eA),Yr("prose","text | null",null,ki(lr)),Yr("renderState","renderState bag",yi({}),aS),us("modes","mode",!1,!0,[])]),mode:Object.freeze([qt("id","id (unique in its scene)",lr),qt("label","text",lr),Yr("renderState","renderState delta | null",null,ki(JL))]),showcase:Object.freeze([qt("group","text",lr),qt("siteOrigin","absolute http(s) origin, no path",XL),us("rows","card",!0,!0,void 0),us("intro","intro",!1,!1,null),Yr("invite","plain paragraph | null",null,ki(Tb)),Yr("throughLine","plain paragraph | null",null,ki(Tb))]),card:Object.freeze([qt("id","scene id",lr),Yr("mode","mode id | null (null: the scene's default mode)",null,ki(lr)),qt("title","copy text",Si),qt("tile","copy text",Si),qt("what","copy text",Si),qt("why","copy text",Si),qt("how","copy text",Si),Yr("controls","copy text | null",null,ki(Si)),us("still","still",!1,!1,null)]),still:Object.freeze([qt("tick","integer >= 1",GL),qt("alt","copy text",Si),Yr("pose","setOrbit patch | null",null,ki(YL))]),intro:Object.freeze([qt("seenKey","text",lr),qt("title","copy text",Si),qt("paragraphs","copy paragraphs (table paragraphs allowed)",QL)])}),yh=Object.freeze({roster:{href:"href is a load fact: pass it as normalizeRoster(json, href), never in the JSON"},scene:{is3D:"is3D is derived: walkthroughIs3D(roster, id, mode)",kind:"a scene has no kind",order:"the order is the array index"},card:{kind:"a card names its scene row by id; it has no kind",order:"the order is the array index",is3D:"is3D is derived: walkthroughIs3D(roster, id, mode)"},showcase:{app:"the app serving a site is the host's fact, not the roster's"}}),lS=new WeakSet,cS=new WeakMap;function tm(e,t,n,r){const i=tA[e],o=i.map(a=>a.key);Bg(t)||Dt(n,"is a "+e+": a JSON object (got "+JSON.stringify(t)+")."),Object.keys(t).forEach(a=>{if(o.indexOf(a)!==-1)return;const l=yh[e]&&em(yh[e],a)?yh[e][a]+". ":"";Dt(n,'has no key "'+a+'" — '+l+e+" keys (ROSTER_KEYS."+e+"): "+o.join(", ")+".")});const s={};return i.forEach(a=>{const l=n+"."+a.key;if(!em(t,a.key)){a.required&&Dt(n,'is missing required key "'+a.key+'" ('+a.type+")"+(a.missing?": "+a.missing:"")+" — "+e+" keys (ROSTER_KEYS."+e+"): "+o.join(", ")+"."),s[a.key]=a.default;return}const c=t[a.key];if(!a.child){s[a.key]=a.check(c,l,r);return}a.many?(Array.isArray(c)||Dt(l,"must be a list of "+a.child+" (got "+JSON.stringify(c)+")."),s[a.key]=Object.freeze(c.map((u,d)=>tm(a.child,u,l+"["+d+"]",r)))):s[a.key]=c===null?null:tm(a.child,c,l,r)}),Object.freeze(s)}function uS(e,t,n){const r=e.modes.map(o=>o.id),i=t??(r.length>0?r[0]:null);return i!==null&&r.indexOf(i)===-1&&Dt(n,'names mode "'+i+'" of scene "'+e.id+'", which declares ['+r.join(", ")+"]."),r.length>1?i:null}function nA(e,t){const n=Hg(t);if(n)throw new Error("[roster] normalizeRoster(json, href): "+n+" (FAIL-LOUD.)");const r=tm("roster",e,"roster",{href:t}),i=new Map;r.rows.forEach((a,l)=>{i.has(a.id)&&Dt("roster.rows["+l+"].id",'"'+a.id+'" is declared twice; a scene id is unique.'),i.set(a.id,a);const c=new Set;a.modes.forEach((u,d)=>{c.has(u.id)&&Dt("roster.rows["+l+"].modes["+d+"].id",'"'+u.id+'" is declared twice in scene "'+a.id+'".'),c.add(u.id)})}),r.firstContact!==null&&!i.has(r.firstContact)&&Dt("roster.firstContact",'"'+r.firstContact+'" is not a declared scene id — declared: ['+[...i.keys()].join(", ")+"].");let o=r.showcase;if(o!==null){const a=new Set,l=o.invite===null?null:zc(o.invite),c=o.intro===null?[]:o.intro.paragraphs;if(o.throughLine!==null){const d=zc(o.throughLine);c.forEach((f,h)=>{Array.isArray(f)&&zc(f).indexOf(d)!==-1&&Dt("roster.showcase.intro.paragraphs["+h+"]","pastes showcase.throughLine — the through-line has one place.")})}const u=o.rows.map((d,f)=>{const h="roster.showcase.rows["+f+"]",v=i.get(d.id);v||Dt(h+".id",'"'+d.id+'" is not a declared scene id — declared: ['+[...i.keys()].join(", ")+"].");const m=uS(v,d.mode,h+".mode"),x=d.id+":"+m;return a.has(x)&&Dt(h,"repeats the card "+x+"; a scene and mode have one card."),a.add(x),["what","why","how","controls"].forEach(b=>{const g=d[b];g!==null&&(l!==null&&g.indexOf(l)!==-1&&Dt(h+"."+b,"pastes showcase.invite — the card appends it by reference."),c.forEach((k,E)=>{Array.isArray(k)&&g.indexOf(zc(k))!==-1&&Dt(h+"."+b,"pastes showcase.intro paragraph "+E+" — the intro's text has one place.")}))}),Object.freeze(Object.assign({},d,{mode:m}))});o=Object.freeze(Object.assign({},o,{rows:Object.freeze(u)}))}const s=Object.freeze(Object.assign({},r,{showcase:o,href:t}));return lS.add(s),s.rows.forEach(a=>cS.set(a,s)),s}function Ug(e){return e===void 0?"undefined":typeof e=="string"?"the string "+JSON.stringify(e):e===null||typeof e!="object"?String(e):"an object that normalizeRoster did not return"}function Jt(e,t){if(!lS.has(e))throw new Error("[roster] "+t+" takes a roster bag first (normalizeRoster(json, href), or loadRoster from roster-link.js); got "+Ug(e)+". (FAIL-LOUD.)");return e}function rf(e,t,n){const r=cS.get(e);if(!r||r.rows.indexOf(e)===-1||n&&r!==n)throw new Error("[roster] "+t+" takes a scene row of "+(n?"that":"a normalized")+" roster bag (walkthroughById(roster, id)); got "+Ug(e)+". (FAIL-LOUD.)");return e}function rA(e,t,n){if(e.showcase===null||e.showcase.rows.indexOf(t)===-1)throw new Error("[roster] "+n+" takes a card of roster.showcase.rows from the same bag (exhibitFor(roster, scene)); got "+JSON.stringify(t&&{id:t.id,mode:t.mode})+". (FAIL-LOUD.)");return t}function Hg(e){if(typeof e!="string"||e==="")return"a roster href is an absolute URL string (got "+JSON.stringify(e)+").";let t=null;try{t=new URL(e)}catch{t=null}return t===null?"roster href "+JSON.stringify(e)+" is relative; it must be absolute (https://…): inside the DeSciX store shell (descix.net) a relative or root-relative href such as /assets/… resolves against the daita app, not this app's media.":t.protocol!=="https:"&&t.protocol!=="http:"&&t.protocol!=="file:"?"roster href "+JSON.stringify(e)+" has scheme "+t.protocol+"; a roster is read over http(s), or file: in node.":e.indexOf("?")!==-1||e.indexOf("#")!==-1?"roster href "+JSON.stringify(e)+" carries a query or a hash; a roster URL is a plain file URL.":null}function iA(e,t){return Jt(e,"sceneUrlOf(roster, row)"),rf(t,"sceneUrlOf(roster, row)",e),new URL(t.source,e.href).href}function Kt(e,t){Jt(e,"walkthroughById(roster, id)");for(let n=0;n<e.rows.length;n++)if(e.rows[n].id===t)return e.rows[n];return null}function Tl(e){return rf(e,"walkthroughModes(row)").modes}function Ro(e){const t=rf(e,"defaultWalkthroughModeId(row)").modes;return t.length>0?t[0].id:null}function Qi(e,t){const n=rf(e,"effectiveRenderState(row, modeId)").modes;let r=null;if(t==null)r=n.length>0?n[0]:null;else if(r=n.find(a=>a.id===t)||null,!r)throw new Error('[roster] scene "'+e.id+'" has no mode "'+t+'" — declared modes: ['+n.map(a=>a.id).join(", ")+"]. (FAIL-LOUD.)");const i=e.renderState,o=r&&r.renderState||{},s=Object.assign({},i,o);return s.render=i.render.concat(Array.isArray(o.render)?o.render:[]),yi(s)}function oA(e,t,n){Jt(e,"walkthroughIs3D(roster, id, modeId)");const r=Kt(e,t);return r===null?!1:Qi(r,n).renderer==="three"}function sA(e){return Jt(e,"firstContactOf(roster)"),e.firstContact===null?null:Kt(e,e.firstContact)}function dS(e){Jt(e,"sceneGroups(roster)");const t=[];e.showcase!==null&&t.push({label:e.showcase.group,rows:e.showcase.rows.map(r=>({id:r.id,title:r.title}))});const n=t.length;return e.rows.forEach(r=>{let i=t[t.length-1];(t.length===n||i.label!==r.group)&&(t.push({label:r.group,rows:[]}),i=t[t.length-1]),i.rows.push({id:r.id,title:r.title})}),t}const aA=Object.freeze([Object.freeze(["Move and Look: this scene is 3D. Drag the MOVE pad (bottom left) to walk the camera forward, back and sideways, and the LOOK pad (bottom right) to turn it. Both pads take a finger on a phone or the mouse on a desktop; on a keyboard, W/A/S/D move and the arrow keys look."])]);function fS(e,t,n){if(Jt(e,n),!t||typeof t!="object")throw new Error("[roster] "+n+" takes a scene { id, modeId? }; got "+Ug(t)+". (FAIL-LOUD.)");if(em(t,"kind"))throw new Error("[roster] "+n+": a scene has no kind — pass { id, modeId? }. (FAIL-LOUD.)");const r=Kt(e,t.id);if(!r)throw new Error("[roster] "+n+': "'+t.id+'" is not a declared scene — declared: ['+e.rows.map(i=>i.id).join(", ")+"]. (FAIL-LOUD.)");return uS(r,t.modeId,n+" modeId")}function hS(e,t){const n=fS(e,t,"exhibitFor(roster, scene)");return e.showcase===null?null:e.showcase.rows.find(r=>r.id===t.id&&r.mode===n)||null}function ea(e,t){const n=fS(e,t,"sceneKey(roster, scene)");return"scene-rung-"+t.id+(n?"-"+n:"")}function pS(e,t){Jt(e,"showcaseCard(roster, card)"),rA(e,t,"showcaseCard(roster, card)");const n=oA(e,t.id,t.mode);let r=["what","why","how"].map(i=>Object.freeze([t[i]]));return t.controls!==null&&(r=r.concat([Object.freeze([t.controls])])),n&&(r=r.concat(aA)),e.showcase.invite!==null&&(r=r.concat([e.showcase.invite])),Object.freeze({id:t.id,modeId:t.mode,seenKey:ea(e,{id:t.id,modeId:t.mode}),title:t.title,paragraphs:Object.freeze(r),is3D:n})}function mS(e){return Jt(e,"showcaseIntro(roster)"),e.showcase===null?null:e.showcase.intro}new TextEncoder;function ka(e){throw new Error("[identity] "+e+" (FAIL-LOUD.)")}function gS(e){e||ka("a project file has an empty path."),(e.startsWith("/")||/^[a-z][a-z0-9+.-]*:/i.test(e))&&ka('"'+e+'" is absolute — a project path is root-relative.'),e.startsWith("./")&&ka('"'+e+'" starts with "./" — a project path carries no leading "./".'),e.indexOf("\\")!==-1&&ka('"'+e+'" uses "\\" — a project path is "/"-separated.'),e.split("/").some(t=>t===""||t==="."||t==="..")&&ka('"'+e+'" has an empty, "." or ".." segment — a project path names one file under the root.')}const Ge="frqtl.json";function Qn(e){throw new Error("["+Ge+"] "+e+" (FAIL-LOUD.)")}function Db(){return pd.map(function(e){return e.key}).join(", ")}const pd=Object.freeze([Object.freeze({key:"name",type:"string",required:!0,rule:"a non-empty string — the project's name",check:function(e){e.length===0&&Qn(`"name" is empty — a project's name is a non-empty string.`)}}),Object.freeze({key:"kind",type:"string",required:!0,rule:'"scene" (a notebook project, "notebook", comes with P5)',check:function(e){e==="notebook"&&Qn('"kind": "notebook" — a notebook project comes with P5 (notebooks on projects); a project today is "kind": "scene".'),e!=="scene"&&Qn('"kind": '+JSON.stringify(e)+' is not a project kind — "scene", or "notebook" (P5).')}}),Object.freeze({key:"entry",type:"string",required:!0,rule:'a root-relative project path ending ".js" — the module whose default export is buildExperiment(exp)',check:function(e){try{gS(e)}catch(t){Qn('"entry": '+String(t&&t.message||t))}e.endsWith(".js")||Qn('"entry": '+JSON.stringify(e)+' does not end ".js" — the entry is the project module whose default export is buildExperiment(exp).')}}),Object.freeze({key:"version",type:"string",required:!1,rule:"the author's own string, never interpreted (optional)",check:function(){}})]);function Wg(e){(!e||typeof e!="object"||Array.isArray(e))&&Qn("a manifest is an object { "+Db()+" } (got "+(Array.isArray(e)?"an array":e===null?"null":typeof e)+").");const t=pd.map(function(i){return i.key}),n=Object.keys(e).filter(function(i){return t.indexOf(i)===-1});n.length&&Qn("unknown key"+(n.length>1?"s ":" ")+n.map(function(i){return JSON.stringify(i)}).join(", ")+" — a manifest holds exactly MANIFEST_KEYS (lib/shim/project/manifest.js): "+Db()+". How a host boots the folder (display, seed, camera, render rows) is its renderState, kept beside the folder.");const r={};for(const i of pd){const o=e[i.key];if(o===void 0){i.required&&Qn('"'+i.key+'" is REQUIRED — '+i.rule+".");continue}typeof o!==i.type&&Qn('"'+i.key+'" is '+(o===null?"null":typeof o)+" — "+i.rule+"."),i.check(o),r[i.key]=o}return Object.freeze(r)}function Zo(e){typeof e!="string"&&Qn("parseManifest(text): the text of "+Ge+" (got "+typeof e+").");let t;try{t=JSON.parse(e)}catch(n){Qn("is not valid JSON: "+String(n&&n.message||n)+".")}return Wg(t)}function Vg(e){return JSON.stringify(Wg(e),null,2)+`
|
|
71
|
-
`}function vS(e){(!e||typeof e!="object")&&Qn("manifestFor({ name, entry }) (got "+(e===null?"null":typeof e)+").");const t=Object.keys(e).filter(function(n){return n!=="name"&&n!=="entry"});return t.length&&Qn("manifestFor({ name, entry }) takes the name and the entry only (got "+t.join(", ")+') — a fresh project is kind "scene" with no version; any other bag goes through normalizeManifest.'),Wg({name:e.name,kind:"scene",entry:e.entry})}new URL("../../",import.meta.url).href;new TextDecoder("utf-8",{fatal:!0});function lA(e){throw new Error("[link] "+e+" (FAIL-LOUD.)")}function cA(e,t){return t?t.entry:(lA("entryOf: no entry — the project carries no "+Ge+' (manifest.js; manifestFor({ name, entry }) writes one) and no `entry` was given (a one-string sketch: { files: { "sketch.js": text }, entry: "sketch.js" }).'),e)}function $o(e,t){const n=e&&Object.prototype.hasOwnProperty.call(e,Ge);return cA(t,n?Zo(e[Ge]):null)}const Ib="sketch.js";function qg(e,t){return Promise.resolve().then(function(){if(typeof e!="string"||!e)throw new TypeError("readText(url): a URL string (got "+JSON.stringify(e)+")");if(e.indexOf("file:")===0){var n=typeof process<"u"&&process.getBuiltinModule?process.getBuiltinModule:null;if(typeof n!="function")throw new Error(e+" is a file: URL; reading one needs node's process.getBuiltinModule (Node 20.16+ / 22.3+). In a page, serve the package over http");var r=n("node:fs"),i=n("node:url").fileURLToPath;return r.promises.readFile(i(e),"utf8").catch(function(s){throw new Error("reading "+e+" failed: "+(s&&s.message))})}var o=t&&t.fetch||(typeof fetch=="function"?fetch:null);if(!o)throw new Error("no fetch available to load "+e);return Promise.resolve(o(e)).then(function(s){if(!s||!s.ok)throw new Error("GET "+e+" answered "+(s?s.status:"nothing"));return s.text()})})}const of="empty",Fb="experiments/_shared/empty-sketch.js",Bc="projectOf(roster, id, { fetch, mode })",Nb="emptyProjectOf({ router, fetch })";function yS(e,t,n){const r=e===void 0?{}:e;if(r===null||typeof r!="object"||Array.isArray(r))throw new Error("[scene-source] "+n+": options are an object (got "+JSON.stringify(e)+"). (FAIL-LOUD.)");return Object.keys(r).forEach(i=>{if(t.indexOf(i)===-1)throw new Error("[scene-source] "+n+' has no option "'+i+'" — options: '+t.join(", ")+(i==="router"?"; a roster scene's URL is sceneUrlOf(roster, row), not a router path":"")+". (FAIL-LOUD.)")}),r}function bS(e,t,n,r,i){return qg(t,{fetch:r.fetch}).catch(o=>{throw new Error("[scene-source] "+n+" — "+(o&&o.message||o)+". (FAIL-LOUD.)")}).then(o=>{if(typeof o!="string"||!o.trim())throw new Error("[scene-source] "+n+" — "+t+" has an empty body. (FAIL-LOUD.)");const s=vS({name:e,entry:Ib}),a={};return a[Ge]=Vg(s),a[Ib]=o,{manifest:s,files:a,renderState:i}})}function md(e,t,n){return Promise.resolve().then(()=>{Jt(e,Bc);const r=yS(n,["fetch","mode"],Bc);if(typeof t!="string"||t==="")throw new Error("[scene-source] "+Bc+" takes a scene id string (got "+JSON.stringify(t)+"). (FAIL-LOUD.)");const i=Kt(e,t);if(!i)throw new Error("[scene-source] "+Bc+': "'+t+'" is not a declared scene — declared: ['+e.rows.map(s=>s.id).join(", ")+"]. (FAIL-LOUD.)");const o=Qi(i,r.mode);return bS(i.id,iA(e,i),'scene "'+i.id+'"',r,o)})}function xS(e){return Promise.resolve().then(()=>{const t=yS(e,["router","fetch"],Nb);if(!t.router||typeof t.router.resolve!="function")throw new Error("[scene-source] "+Nb+" needs the host's engineRouter (lib/shim/engine/router.js) to resolve "+Fb+". (FAIL-LOUD.)");const n=t.router.resolve(Fb);return bS(of,n,"the Empty Universe",t,yi({}))})}var zb=Object.freeze({roster:"roster",edited:"edited"});function Zl(e,t){if(typeof e!="string")throw new Error("[scene-buffer] "+t+" must be the scene text (a string), got "+typeof e+". (FAIL-LOUD.)");return e}function es(e){if(!e||typeof e.file!="string"||typeof e.text!="string"||!("override"in e))throw new Error("[scene-buffer] not a scene buffer — make one with seedBuffer(fileText). (FAIL-LOUD.)");return e}function sf(e,t,n){return Object.freeze({file:e,text:t,override:n})}function Dl(e){if(arguments.length>1)throw new Error("[scene-buffer] seedBuffer(fileText) takes the text only — the scene's text is its sketch file. (FAIL-LOUD.)");var t=Zl(e,"seedBuffer(fileText)");return sf(t,t,null)}function nm(e,t){return es(e),sf(e.file,Zl(t,"editBuffer(b, text)"),e.override)}function wS(e,t){es(e);var n=Zl(t,"runBuffer(b, text)");return sf(e.file,n,n===e.file?null:n)}var rm="Run your code edits first — the editor holds text the canvas has not run, and a hand edit is written into the code the canvas runs (the writer never merges a text edit).";function uA(e,t){es(e);var n=Zl(t,"adoptSketch(b, text)");if($g(e))throw new Error("[scene-buffer] adoptSketch: "+rm+" (FAIL-LOUD.)");return sf(e.file,n,n===e.file?null:n)}function _S(e){return e?es(e).override:null}function af(e){return es(e),e.override!==null?e.override:e.file}function dA(e){return _S(e)!==null?zb.edited:zb.roster}function $g(e){return es(e).text!==af(e)}function fA(e){return e?(es(e),e.override!==null||e.text!==e.file?"Open in STUDIO opens the roster scene file, not these edits — Reset to the file first (edits in this editor live for this session only).":null):null}function kS(e){var t=e&&typeof e.stack=="string"?e.stack:"",n=/(?:blob:|data:text\/javascript)[^\n]*?:(\d+):(\d+)\)?[ \t]*$/m.exec(t);return n?{line:Number(n[1]),col:Number(n[2])}:null}function lf(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("[scene-buffer] "+t+" takes the folder's files ({ path: text }). (FAIL-LOUD.)");return Object.keys(e).forEach(function(n){Zl(e[n],t+' — files["'+n+'"]')}),e}function xi(e){if(!e||typeof e.entry!="string"||typeof e.active!="string"||!e.files||typeof e.files!="object")throw new Error("[scene-buffer] not a project buffer — make one with seedProject(files). (FAIL-LOUD.)");return e}function ec(e,t,n){return Object.freeze({entry:e,active:t,files:Object.freeze(n)})}function Kg(e,t,n){if(!Object.prototype.hasOwnProperty.call(e.files,t))throw new Error("[scene-buffer] "+n+': "'+t+'" is not a file of this project (files: '+Object.keys(e.files).join(", ")+"). (FAIL-LOUD.)");return t}function ms(e){return!(e===Ge||/\.m?js$/.test(e))}function hA(e){lf(e,"seedProject(files)");var t=$o(e),n={};return Object.keys(e).forEach(function(r){n[r]=Dl(e[r])}),ec(t,t,n)}function SS(e){xi(e);function t(n){return n===e.entry?0:n===Ge?1:n.indexOf("parts/")===0?2:3}return Object.keys(e.files).sort(function(n,r){return t(n)-t(r)||(n<r?-1:n>r?1:0)})}function Dr(e){return xi(e).active}function Bb(e,t){return xi(e),ec(e.entry,Kg(e,t,"selectFile"),Object.assign({},e.files))}function Sa(e,t){return xi(e),e.files[Kg(e,t,"bufferOf")]}function Ub(e,t,n){if(xi(e),Kg(e,t,"editFile"),ms(t))throw new Error('[scene-buffer] editFile: "'+t+'" is read-only in the drawer (a module or '+Ge+" is editable). (FAIL-LOUD.)");var r=Object.assign({},e.files);return r[t]=nm(e.files[t],n),ec(e.entry,e.active,r)}function pA(e,t){xi(e),lf(t,"runProject(p, files)");var n={};Object.keys(t).forEach(function(i){n[i]=Object.prototype.hasOwnProperty.call(e.files,i)?wS(e.files[i],t[i]):Dl(t[i])});var r=$o(t);return ec(r,Object.prototype.hasOwnProperty.call(n,e.active)?e.active:r,n)}function ES(e,t){xi(e),lf(t,"adoptFiles(p, files)");var n=Object.assign({},e.files);return Object.keys(t).forEach(function(r){n[r]=Object.prototype.hasOwnProperty.call(e.files,r)?uA(e.files[r],t[r]):Dl(t[r])}),ec(e.entry,e.active,n)}function Hb(e,t){lf(t,"adoptWritten(p, files)");var n={};return Object.keys(t).forEach(function(r){r!==Ge&&(n[r]=t[r])}),ES(e,n)}function mA(e){xi(e);var t={};return Object.keys(e.files).forEach(function(n){t[n]=af(e.files[n])}),t}function bh(e){xi(e);var t={};return Object.keys(e.files).forEach(function(n){t[n]=e.files[n].text}),t}function Eu(e){return SS(e).filter(function(t){return $g(e.files[t])})}function xh(e){return Eu(e).length>0}const gA="modulepreload",vA=function(e,t){return new URL(e,t).href},Wb={},OS=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){const s=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=vA(c,r),c in Wb)return;Wb[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!r)for(let v=s.length-1;v>=0;v--){const m=s[v];if(m.href===c&&(!u||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":gA,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((v,m)=>{h.addEventListener("load",v),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return i.then(s=>{for(const a of s||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};var CS=j.lazy(function(){return OS(()=>import("./SceneCodeEditor-Ck982ITn.js"),[],import.meta.url)});const tc=Object.freeze([{id:"modules",means:"Loading the scene objects"},{id:"engine-ready",means:"Starting the WASM engine"},{id:"renderer",means:"Loading the renderer"},{id:"sketch",means:"Building the scene"}].map(Object.freeze)),yA=Object.freeze(tc.map(e=>e.id)),ol="frqtl:boot-phase";function gd(e){const t=tc.find(n=>n.id===e);if(!t)throw new Error(`boot-phases: "${e}" is not a boot phase — ${yA.join(", ")}.`);return t}const bA=Object.freeze(tc.map(({id:e,means:t})=>Object.freeze({id:e,means:t}))),xA=tc[0].id;function im(){return{phase:xA,done:0,total:0,phases:{},failed:null}}function om(e){const t=e&&e.documentElement,n=t&&t.getAttribute("data-egpt-boot-progress");if(!n)return im();const r=JSON.parse(n),i=t.getAttribute("data-egpt-boot-phase");gd(i);const o=t.getAttribute("data-egpt-boot-failed")||null;o&&gd(o);const s=r[i]||{done:0,total:0};return{phase:i,done:s.done,total:s.total,phases:r,failed:o}}function Vb(e){return e.failed?"Failed: "+gd(e.failed).means:tc.every(n=>e.phases[n.id]&&e.phases[n.id].complete)?null:gd(e.phase).means}function qb(e){let t;try{t=e.contentDocument}catch(n){throw new Error("watchFrameBootPhases: the frame's document is not readable ("+n.message+") — the boot record is a same-origin contract.")}if(t===null)throw new Error("watchFrameBootPhases: frame.contentDocument is null — the frame is cross-origin or detached; the boot record is a same-origin contract.");return t}function wA(e){if(!e||typeof e.addEventListener!="function")throw new TypeError("watchFrameBootPhases(frameEl): frameEl must be an <iframe> element");let t=om(qb(e));const n=new Set,r=()=>{n.forEach(s=>s(t))};function i(s){t=s.detail,r()}function o(){t=om(qb(e)),r()}return e.addEventListener(ol,i),e.addEventListener("load",o),{phases:bA,current:()=>t,subscribe(s){if(typeof s!="function")throw new TypeError("watchFrameBootPhases: subscribe(cb) needs a function");return n.add(s),()=>{n.delete(s)}},close(){n.clear(),e.removeEventListener(ol,i),e.removeEventListener("load",o)}}}var Il="project-folders",wh=Object.freeze(["files","renderState"]),vd="index.html";function kr(e){throw new Error("[folders] "+e+" (FAIL-LOUD.)")}function _h(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Zi(e){_h(e)||kr("a project folder row is { "+wh.join(", ")+" } (got "+(e===null?"null":Array.isArray(e)?"an array":typeof e)+").");var t=Object.keys(e).filter(function(o){return wh.indexOf(o)===-1});t.length&&kr("unknown key "+t.map(function(o){return JSON.stringify(o)}).join(", ")+" — a project folder row holds exactly FOLDER_ROW_KEYS (lib/shim/storage/folders.js): "+wh.join(", ")+".");var n=e.files;(!_h(n)||Object.keys(n).length===0)&&kr('"files" is the folder { path: text } with at least '+Ge+" (got "+(_h(n)?"an empty map":typeof n)+").");var r={};Object.keys(n).forEach(function(o){gS(o),o===vd&&kr('"'+vd+'" at the folder root is reserved — the Export generates it (the host page that carries the boot bag); a project folder never holds one.'),typeof n[o]!="string"&&kr('"'+o+'" is not text (got '+(n[o]instanceof Uint8Array?"bytes":typeof n[o])+") — a project folder holds text files only."),r[o]=n[o]}),typeof r[Ge]!="string"&&kr("the folder carries no "+Ge+" — a project folder is named and entered by its manifest (lib/shim/project/manifest.js manifestFor({ name, entry }) writes one).");var i=Zo(r[Ge]).name;return la(i,'a project folder name (frqtl.json "name")'),Object.freeze({files:Object.freeze(r),renderState:yi(e.renderState)})}function $b(e){return Zo(Zi(e).files[Ge]).name}function jS(e){return{files:Object.assign({},e.files),renderState:e.renderState}}function Kb(e,t){var n=Zi(t),r=Zo(n.files[Ge]).name;return e.put(Il,r,jS(n)),r}function sm(e,t,n){la(n,"a project folder name");var r=Zi(t);e.get(Il,n)!==null&&kr('a project named "'+n+'" is already saved — Save As takes a name no saved project has (choose another, or delete the saved one first).');var i=Object.assign({},r.files);i[Ge]=Vg(Object.assign({},Zo(r.files[Ge]),{name:n}));var o=Zi({files:i,renderState:r.renderState});return e.put(Il,n,jS(o)),n}function kh(e,t){la(t,"a project folder name");var n=e.get(Il,t);if(n==null)return null;var r;try{r=Zi(n)}catch(o){kr('the saved project "'+t+'" is not a project folder row: '+(o&&o.message||o))}var i=Zo(r.files[Ge]).name;return i!==t&&kr('the saved project under "'+t+'" names itself "'+i+'" in '+Ge+" — a folder is keyed by its manifest name."),r}function _A(e){return e.list(Il).map(function(t){return t.key}).sort().map(function(t){return{name:t}})}function kA(e){var t=[];return dd.forEach(function(n){e.list(n).forEach(function(r){t.push({namespace:n,key:r.key})})}),t}function SA(e,t){return Array.isArray(t)||kr("deleteRetiredSaves(provider, saves): saves is retiredSaves(provider)'s list."),t.forEach(function(n){(!n||dd.indexOf(n.namespace)===-1||typeof n.key!="string")&&kr("deleteRetiredSaves deletes only retired saves ({ namespace in ["+dd.join(", ")+"], key }) — got "+JSON.stringify(n)+".")}),t.forEach(function(n){e.delete(n.namespace,n.key)}),t.length}const sl=Object.freeze({parts:Object.freeze({path:"parts/index.js",name:null}),ObjectSchema:Object.freeze({path:"objects/schema/index.js",name:"ObjectSchema"}),ObjectFactory:Object.freeze({path:"objects/ObjectFactory.js",name:"ObjectFactory"}),MakeControlsForObject:Object.freeze({path:"objects/objects/makeControlsForObject.js",name:"MakeControlsForObject"}),MakeControlsForRenderSurface:Object.freeze({path:"objects/objects/makeControlsForRenderSurface.js",name:"MakeControlsForRenderSurface"}),ControlBind:Object.freeze({path:"objects/objects/controlBind.js",name:"ControlBind"}),FrqtlControlSlider:Object.freeze({path:"objects/objects/frqtl-control-slider.js",name:"FrqtlControlSlider"}),FrqtlControlWriteQueue:Object.freeze({path:"objects/objects/frqtl-control-write-queue.js",name:"FrqtlControlWriteQueue"}),FrqtlControlsPanel:Object.freeze({path:"parts/FrqtlControlsPanel.js",name:"FrqtlControlsPanel"}),CameraControls:Object.freeze({path:"parts/CameraControls.js",name:"CameraControls"}),Filters:Object.freeze({path:"compat/renderer/Filters.js",name:"Filters"}),OrbitBag:Object.freeze({path:"compat/renderer/orbit-bag.js",name:null}),LoDrawnCenter:Object.freeze({path:"compat/renderer/lo-drawn-center.js",name:null}),ShimRpc:Object.freeze({path:"shim/rpc/index.js",name:null}),ControlRegistry:Object.freeze({path:"shim/controls/registry.js",name:null}),RenderState:Object.freeze({path:"shim/render-state/apply.js",name:null})}),Yb=Object.keys(sl).map(function(e){return sl[e].path}),Ea=new WeakMap,RS=new WeakMap;function EA(e){if(!e||typeof e.resolve!="function")throw new TypeError("[frame-modules] a router (engineRouter() instance) is required — the frame's module URLs come from the ONE path authority. (FAIL-LOUD.)")}function OA(e,t,n){return new Promise(function(r,i){if(!e||!e.document)throw new TypeError("[frame-modules] frameImport(cw, …): cw is the frame's contentWindow. (FAIL-LOUD.)");if(Yb.indexOf(t)===-1)throw new Error('[frame-modules] "'+t+'" is not a frame module — the table is lib/features/ide/frame-modules.js FRAME_MODULES ('+Yb.join(", ")+"). (FAIL-LOUD.)");EA(n);const o=new URL(n.resolve(t),document.baseURI).href;let s;try{s=new e.Function("u","return import(u)")}catch(a){throw new Error("[frame-modules] the frame refused to evaluate its module-import door ("+(a&&a.message||a)+") — a content-security policy without 'unsafe-eval' blocks frameImport (lib/features/ide/frame-modules.js); this host cannot drive a frame's modules. (FAIL-LOUD.)")}r(s(o).catch(function(a){throw new Error("[frame-modules] the frame could not import "+t+" from "+o+" (frame "+e.location.href+"): "+(a&&a.message||a)+". (FAIL-LOUD.)")}))})}function CA(e,t){const n=e&&e.document;if(!n)return Promise.reject(new TypeError("[frame-modules] loadFrameModules(cw, router): cw is the frame's contentWindow. (FAIL-LOUD.)"));if(Ea.has(n))return Ea.get(n);const r=Object.keys(sl),i=Promise.all(r.map(function(o){return OA(e,sl[o].path,t)})).then(function(o){const s={};r.forEach(function(l,c){const u=sl[l],d=u.name===null?o[c]:o[c][u.name];if(d===void 0)throw new Error("[frame-modules] "+u.path+" exports no "+u.name+". (FAIL-LOUD.)");s[l]=d});const a=Object.freeze(s);return RS.set(n,a),a});return Ea.set(n,i),i.catch(function(){Ea.get(n)===i&&Ea.delete(n)}),i}function nc(e){const t=e&&e.document;return t&&RS.get(t)||null}function jA(e,t){if(!t||typeof t.envelopeOf!="function")throw new Error("[project-design] computeEntityBboxForDesign needs the live runner (its envelopeOf is the ONE envelope of a declared object). (FAIL-LOUD.)");var n=t.envelopeOf(e);return n?{left:Math.round(n.left),top:Math.round(n.top),width:Math.round(n.w),height:Math.round(n.h)}:null}function RA(e,t,n,r,i,o){if(arguments.length>6)throw new Error('[project-design] buildObject("'+e+`"): takes (kind, runner, cw, x, y, overrideProps) — a world size is not an argument; the builder reads runner.canvas_rect, written by the scene's exp.createCanvas(w, h, cfg) / exp.createScene(w, h, d, cfg). (FAIL-LOUD.)`);if(!t||!n)throw new Error('[project-design] buildObject("'+e+'"): '+(t?"no iframe scope (cw)":"no runner")+" — a palette drop needs the live runner and the canvas iframe window. (FAIL-LOUD.)");var s=nc(n);if(!s)throw new Error('[project-design] buildObject("'+e+`"): the frame's modules are not loaded — loadFrameModules(cw, router) (lib/features/ide/frame-modules.js) runs before a runner is taken. (FAIL-LOUD.)`);var a=s.ObjectFactory;return a.create(e,o,{runner:t,cw:n,x:r,y:i,fromPalette:!0})}const LA="data-frqtl-studio-landing",LS=Object.freeze([{id:"refused-key",runs:!1,means:"the link carries a key STUDIO does not own, or a deleted key (deep-link.js deepLinkRefusalOf): the refusal is on the deep-link strip and the opening scene opens"},{id:"conflict",runs:!1,means:"the link names more than one scene source (two of walkthrough, project and scene), or a renderer beside a walkthrough or a project, which carry their own: nothing opens"},{id:"mode-without-walkthrough",runs:!1,means:"the link names a mode and no walkthrough: nothing opens"},{id:"renderer-without-scene",runs:!1,means:"the link names a renderer and no scene; a renderer is chosen only for a scene link: nothing opens"},{id:"unknown-walkthrough",runs:!1,means:"the linked walkthrough is not a scene of the loaded roster (walkthroughById(roster, id)): nothing opens"},{id:"unknown-mode",runs:!1,means:"the linked mode is not one the linked scene declares (walkthroughModes): nothing opens"},{id:"scene-refused-origin",runs:!1,means:"the linked scene URL is on neither the page's origin nor the roster's (roster-link.js sceneOriginRefusalOf): the strip names the rule and both origins; nothing opens"},{id:"scene-unreadable",runs:!1,means:"the linked scene URL is allowed but its read failed (a non-200, an empty body, or not a .js sketch): nothing opens"},{id:"project-unreadable",runs:!1,means:"the linked saved project is present but its folder is refused by the load: nothing opens"},{id:"project-not-found",runs:!1,means:"no saved project of the linked name in this browser: nothing opens"},{id:"ok",runs:!0,means:"the linked walkthrough (in the linked mode, else its default), saved project or scene resolved and was handed to STUDIO's selection path; the scene starts on load"},{id:"first-contact",runs:!1,means:"no STUDIO deep link: the roster's first-contact scene (firstContactOf(roster)) opens"},{id:"first-contact-empty",runs:!1,means:"no STUDIO deep link and the roster declares no first contact: the Empty Universe opens"}].map(Object.freeze)),Gb=new Set(LS.map(e=>e.id));function AS(e,t){if(!Gb.has(t))throw new Error("[studio-landing] '"+t+"' is not a STUDIO_LANDING_OUTCOMES row — declared: ["+[...Gb].join(", ")+"]. (FAIL-LOUD.)");return e&&e.setAttribute(LA,t),t}const PS="frqtl-roster",AA=3e5,Sh='<link rel="'+PS+'" href="https://…">';function PA(e){if(!e||typeof e.querySelectorAll!="function")throw new Error("[roster-link] rosterHrefOf(doc) takes a document; got "+String(e)+". (FAIL-LOUD.)");const t=Array.from(e.querySelectorAll('link[rel~="'+PS+'"]'));if(t.length===0)throw new Error("[roster-link] this document has no "+Sh+" — STUDIO and the GYM read their scene list from the roster it names; the host writes the link into the page. (FAIL-LOUD.)");if(t.length>1)throw new Error("[roster-link] this document has "+t.length+" "+Sh+" links; a document names exactly one roster. (FAIL-LOUD.)");const n=t[0].getAttribute("href"),r=Hg(n);if(r)throw new Error("[roster-link] "+Sh+": "+r+" (FAIL-LOUD.)");return n}function MA(e,t){const n=Hg(e);if(n)throw new Error("[roster-link] rosterRequestUrl(href, now): "+n+" (FAIL-LOUD.)");if(!Number.isFinite(t))throw new Error("[roster-link] rosterRequestUrl(href, now): now is epoch milliseconds (got "+String(t)+"). (FAIL-LOUD.)");return new URL(e).protocol==="file:"?e:e+"?b="+Math.floor(t/AA)}function TA(e,t){return Promise.resolve().then(()=>{const n=t||{},r=MA(e,n.now===void 0?Date.now():n.now);return qg(r,{fetch:n.fetch}).then(i=>{if(i.trim()==="")throw new Error("[roster-link] roster "+r+" is empty. (FAIL-LOUD.)");let o=null;try{o=JSON.parse(i)}catch(s){throw new Error("[roster-link] roster "+r+" is not JSON: "+s.message+" (FAIL-LOUD.)")}return nA(o,e)},i=>{throw new Error("[roster-link] loading the roster failed: "+i.message+" (FAIL-LOUD.)")})})}function DA(e,t){const n=t||{};if(Jt(n.roster,"sceneOriginRefusalOf(url, { pageOrigin, roster })"),typeof n.pageOrigin!="string"||n.pageOrigin==="")throw new Error("[roster-link] sceneOriginRefusalOf(url, { pageOrigin, roster }): pageOrigin is the page's location.origin (got "+JSON.stringify(n.pageOrigin)+"). (FAIL-LOUD.)");const r=new URL(n.roster.href).origin;let i=null;try{i=new URL(e).origin}catch{i=null}return i!==null&&i!=="null"&&(i===n.pageOrigin||i===r)?null:"a scene opens from this page's origin ("+n.pageOrigin+") or its roster's origin ("+r+"); "+JSON.stringify(e)+" is "+(i===null?"not an absolute URL":"on "+i)+"."}var IA=new TextEncoder,FA=new TextDecoder;function am(e){return IA.encode(e==null?"":String(e))}function NA(e){return FA.decode(e)}var zA=function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var n=t,r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e}();function MS(e){for(var t=4294967295,n=0;n<e.length;n++)t=t>>>8^zA[(t^e[n])&255];return(t^4294967295)>>>0}function Ot(e){return[e&255,e>>>8&255]}function Kn(e){return e=e>>>0,[e&255,e>>>8&255,e>>>16&255,e>>>24&255]}function ds(e){var t=0,n;for(n=0;n<e.length;n++)t+=e[n].length;var r=new Uint8Array(t),i=0;for(n=0;n<e.length;n++)r.set(e[n],i),i+=e[n].length;return r}function go(e,t){return e[t]|e[t+1]<<8}function vo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var TS=67324752,DS=33639248,IS=101010256;function BA(e){if(!Array.isArray(e))throw new Error("[bundle/zip] zipStore(entries): entries must be an array.");for(var t=[],n=[],r=0,i=0;i<e.length;i++){var o=e[i];if(!o||typeof o.name!="string"||!(o.bytes instanceof Uint8Array))throw new Error("[bundle/zip] zipStore: entry "+i+" must be {name:string, bytes:Uint8Array}.");var s=am(o.name),a=o.bytes,l=MS(a),c=a.length,u=ds([new Uint8Array(Kn(TS)),new Uint8Array(Ot(20)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Kn(l)),new Uint8Array(Kn(c)),new Uint8Array(Kn(c)),new Uint8Array(Ot(s.length)),new Uint8Array(Ot(0)),s,a]);t.push(u);var d=ds([new Uint8Array(Kn(DS)),new Uint8Array(Ot(20)),new Uint8Array(Ot(20)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Kn(l)),new Uint8Array(Kn(c)),new Uint8Array(Kn(c)),new Uint8Array(Ot(s.length)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Kn(0)),new Uint8Array(Kn(r)),s]);n.push(d),r+=u.length}var f=ds(t),h=ds(n),v=ds([new Uint8Array(Kn(IS)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(e.length)),new Uint8Array(Ot(e.length)),new Uint8Array(Kn(h.length)),new Uint8Array(Kn(f.length)),new Uint8Array(Ot(0))]);return ds([f,h,v])}function UA(e){if(!(e instanceof Uint8Array))throw new Error("[bundle/zip] unzipStore(bytes): bytes must be a Uint8Array.");for(var t=-1,n=e.length-22;n>=0;n--)if(vo(e,n)===IS){t=n;break}if(t===-1)throw new Error("[bundle/zip] unzipStore: End Of Central Directory record not found (not a ZIP).");for(var r=go(e,t+10),i=vo(e,t+16),o=[],s=i,a=0;a<r;a++){if(vo(e,s)!==DS)throw new Error("[bundle/zip] unzipStore: bad central directory signature at record "+a+".");var l=go(e,s+10),c=vo(e,s+16),u=vo(e,s+20),d=go(e,s+28),f=go(e,s+30),h=go(e,s+32),v=vo(e,s+42),m=NA(e.subarray(s+46,s+46+d));if(l!==0)throw new Error('[bundle/zip] unzipStore: entry "'+m+'" uses compression method '+l+" — this reader is STORE-only (method 0).");if(vo(e,v)!==TS)throw new Error('[bundle/zip] unzipStore: bad local header signature for "'+m+'".');var x=go(e,v+26),b=go(e,v+28),g=v+30+x+b,k=e.slice(g,g+u),E=MS(k);if(E!==c)throw new Error('[bundle/zip] unzipStore: CRC-32 mismatch for "'+m+'" (stored '+c+", computed "+E+").");o.push({name:m,bytes:k}),s+=46+d+f+h}return o}var Yg="frqtl-boot",Ou='<script type="application/json" id="'+Yg+'">',FS="<\/script>";function HA(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Jb(e){return JSON.stringify(e??null).replace(/</g,"\\u003c")}function WA(e){if(e=e||{},typeof e.sdkVersion!="string"||e.sdkVersion.length===0)throw new Error("[bundle/indexHtml] buildIndexHtml: args.sdkVersion is REQUIRED (the CDN pin). (FAIL-LOUD.)");if(typeof e.name!="string"||e.name.length===0)throw new Error("[bundle/indexHtml] buildIndexHtml: args.name is the project's frqtl.json name. (FAIL-LOUD.)");var t=Jb(QR(Ok(e.sdkVersion)+"/"));return["<!DOCTYPE html>",'<html lang="en">',"<head>",' <meta charset="UTF-8">',' <meta name="viewport" content="width=device-width, initial-scale=1">'," <title>"+HA(e.name)+" — FRQTL</title>"," <style>"," html,body{margin:0;height:100%;background:#0b0b0f;color:#ddd;"," font:14px/1.5 ui-sans-serif,system-ui,sans-serif;}"," #frqtl-mount{position:relative;width:100vw;height:100vh;}"," #frqtl-err{position:absolute;inset:0;padding:16px;white-space:pre-wrap;"," font:12px/1.5 ui-monospace,Menlo,Consolas,monospace;color:#ff6b6b;"," background:#1a0000;display:none;overflow:auto;}"," </style>","</head>","<body>",' <div id="frqtl-mount"></div>',' <pre id="frqtl-err"></pre>'," "+Ou+Jb(e.renderState)+FS,' <script type="importmap">'+t+"<\/script>",' <script type="module">'," import { bootProject } from "+JSON.stringify(Mk.specifier)+";"," const renderState = JSON.parse(document.getElementById("+JSON.stringify(Yg)+").textContent);",' const mount = document.getElementById("frqtl-mount");',' const errBox = document.getElementById("frqtl-err");'," function fail(title, detail){",' errBox.style.display = "block";',' errBox.textContent = title + "\\n\\n" + detail;'," }",' if (location.protocol === "file:") {',' fail("Serve this folder over http", "e.g. `npx serve` — a file:// page cannot fetch the project files.");'," } else {",' bootProject(mount, { url: new URL("./", location.href).href }, { renderState: renderState })',' .catch((e) => fail("FRQTL project boot failed", String(e && e.stack || e)));'," }"," <\/script>","</body>","</html>",""].join(`
|
|
72
|
-
`)}function VA(e){if(typeof e!="string")throw new Error("[bundle/indexHtml] readBootBag(html): the page text (got "+typeof e+"). (FAIL-LOUD.)");var t=e.indexOf(Ou);if(t===-1)throw new Error('[bundle/indexHtml] the index.html carries no boot bag (<script type="application/json" id="'+Yg+'">) — it is not the page an Export writes. (FAIL-LOUD.)');if(e.indexOf(Ou,t+1)!==-1)throw new Error("[bundle/indexHtml] the index.html carries two boot bags — an Export writes one. (FAIL-LOUD.)");var n=t+Ou.length,r=e.indexOf(FS,n);if(r===-1)throw new Error("[bundle/indexHtml] the boot bag element is not closed. (FAIL-LOUD.)");try{return JSON.parse(e.slice(n,r))}catch(i){throw new Error("[bundle/indexHtml] the boot bag is not valid JSON: "+(i&&i.message||i)+". (FAIL-LOUD.)")}}var qA=Object.freeze(["experiment.js","manifest.json"]),NS="this is the retired export format; the project folder replaced it (frqtl.json + sketch.js)",Xb="sketch.js",$A=new TextDecoder("utf-8",{fatal:!0});function hr(e){throw new Error("[bundle] "+e+" (FAIL-LOUD.)")}function KA(e,t,n){var r=Zi({files:e,renderState:t}),i=n&&n.sdkVersion,o=Zo(r.files[Ge]).name,s=Object.keys(r.files).map(function(a){return{name:a,bytes:am(r.files[a])}});return s.push({name:vd,bytes:am(WA({name:o,sdkVersion:i,renderState:r.renderState}))}),BA(s)}function YA(e){return e.length>=4&&e[0]===80&&e[1]===75&&(e[2]===3&&e[3]===4||e[2]===5&&e[3]===6)}function zS(e,t){try{return $A.decode(e)}catch{hr(t+" is not UTF-8 text — a project folder holds text files only.")}}function BS(e){var t=String(e).split(/[\\/]/).pop();return t}function GA(e){var t=UA(e).filter(function(a){return!/\/$/.test(a.name)}),n=t.map(function(a){return a.name}),r=qA.filter(function(a){return n.indexOf(a)!==-1});if(r.length&&hr("the archive carries "+r.join(" and ")+": "+NS+"."),n.indexOf(Ge)===-1){var i=n.map(function(a){return a.split("/")[0]}).filter(function(a,l,c){return c.indexOf(a)===l});i.length===1&&n.indexOf(i[0]+"/"+Ge)!==-1&&n.every(function(a){return a.indexOf(i[0]+"/")===0})&&hr("the archive carries no "+Ge+" at its root — the archive holds the folder `"+i[0]+"/` rather than its contents — zip the folder's CONTENTS ("+Ge+" at the root), as an Export writes it."),hr("the archive carries no "+Ge+" at its root — a project archive is the folder zipped (frqtl.json + sketch.js + …), as an Export writes it.")}var o={},s=null;return t.forEach(function(a){var l=zS(a.bytes,'"'+a.name+'"');if(a.name===vd){s=VA(l);return}o[a.name]=l}),Zi({files:o,renderState:s})}function JA(e){var t;try{t=JSON.parse(e)}catch{hr("the file is neither a project archive (.zip) nor a sketch (.js), and not valid JSON either.")}t&&typeof t=="object"&&("schemaVersion"in t||"scripts"in t)&&"source"in t&&hr("the file is a v4 module envelope: "+NS+"."),hr("the JSON file is not a project — Import takes a project archive (.zip) or one sketch (.js).")}function XA(e,t){var n=BS(t),r=n.replace(/\.js$/,"");r||hr('the sketch file "'+n+'" has no name before ".js".');var i={};return i[Ge]=Vg(vS({name:r,entry:Xb})),i[Xb]=e,Zi({files:i,renderState:null})}function US(e,t){if(e instanceof Uint8Array||hr("importArchive(bytes, fileName): bytes is a Uint8Array."),(typeof t!="string"||t.length===0)&&hr("importArchive(bytes, fileName): the file's name."),YA(e))return GA(e);var n=BS(t);if(/\.mjs$/i.test(n)){var r=pd.filter(function(o){return o.key==="entry"})[0].rule;hr('"'+n+`" is a .mjs module — a one-file Import takes a .js sketch, because a project's entry is `+r+" (frqtl.json, lib/shim/project/manifest.js MANIFEST_KEYS). Rename it to .js and import it again.")}var i=zS(e,'"'+n+'"');if(/\.js$/.test(n))return XA(i,n);if(/\.json$/i.test(n)||/^\s*\{/.test(i))return JA(i);hr('"'+n+'" is not a project — Import takes a project archive (.zip, as an Export writes it) or one sketch (.js).')}var Mi="_empty",Lo="scene:";function QA(e,t,n){if(!e||e===Mi)return"Empty Universe (New)";if(e.indexOf(Lo)===0){var r=e.slice(Lo.length);return"Scene draft: "+decodeURIComponent(r.split("?")[0].split("/").pop()||r)}if(e.indexOf("walkthrough:")===0){var i=e.slice(12),o=n&&n.find(function(l){return l.id===i});return o?o.title:i}if(e.indexOf("project:")===0){var s=e.slice(8),a=t&&t.find(function(l){return l.id===s});return a?a.name:s}return e}function HS(e){return e&&typeof e.label=="string"&&e.label?e.label:e.name}function WS(e){if(!e||e.type!=="number")return null;var t=e.constraint||{},n=e.widgetConfig||{},r=function(i){return typeof i=="number"&&isFinite(i)};return!r(t.min)||!r(t.max)||!r(n.step)||n.step<=0||t.max<=t.min?null:{min:t.min,max:t.max,step:n.step}}function Eh(e){if(!Array.isArray(e))throw new TypeError("[author-ux-utils] declaredLayerRows takes runner.declared (an array). (FAIL-LOUD.)");return e.map(function(t){return{ref:t,name:t.name||t._schemaKind,schemaKind:t._schemaKind,visible:t.visible!==!1}})}var Oa="studioLandingOf(link, { roster, loadProject, pageOrigin, baseURI, fetch? })";function On(e,t,n){var r=LS.find(function(i){return i.id===AS(null,e)});return{id:e,err:t||null,select:n||null,run:r.runs}}function Qb(e){var t=sA(e);return t?{value:"walkthrough:"+t.id,mode:null,opts:{quiet:!0}}:{value:Mi,mode:null,opts:{quiet:!0}}}function ZA(e){if(!e||typeof e!="object")throw new Error("[studio-landing-of] "+Oa+": deps is an object. (FAIL-LOUD.)");if(typeof e.walkthroughById=="function"||typeof e.walkthroughModes=="function")throw new Error("[studio-landing-of] "+Oa+": deps carry the loaded roster bag, never the registry readers (walkthroughById/walkthroughModes) — the resolver reads the roster itself. (FAIL-LOUD.)");if(Jt(e.roster,Oa),typeof e.loadProject!="function")throw new Error("[studio-landing-of] "+Oa+": deps.loadProject is the saved-project loader. (FAIL-LOUD.)");["pageOrigin","baseURI"].forEach(function(t){if(typeof e[t]!="string"||e[t]==="")throw new Error("[studio-landing-of] "+Oa+": deps."+t+" is the page's "+(t==="pageOrigin"?"location.origin":"document.baseURI")+" (got "+JSON.stringify(e[t])+"). (FAIL-LOUD.)")})}function eP(e,t){var n=null;try{n=new URL(e.scene,t.baseURI).href}catch{n=null}var r=n===null?JSON.stringify(e.scene)+" is not a URL":DA(n,{pageOrigin:t.pageOrigin,roster:t.roster});if(r)return Promise.resolve(On("scene-refused-origin","Deep link error: scene refused — "+r));var i=null;e.renderer&&(i=yi({renderer:e.renderer}).renderer);var o=function(s){return On("scene-unreadable",'Deep link error: scene "'+e.scene+'" — '+s)};return qg(n,{fetch:t.fetch}).then(function(s){if(!s.trim())return o(n+" has an empty body.");var a=decodeURIComponent(new URL(n).pathname.split("/").pop()||""),l;try{l=US(new TextEncoder().encode(s),a)}catch(d){return o(d&&d.message?d.message:String(d))}var c=i===null?l.renderState:yi(Object.assign({},l.renderState,{renderer:i})),u={scene:e.scene};return e.renderer&&(u.renderer=e.renderer),On("ok",null,{value:Lo+n,mode:null,opts:{folder:{files:Object.assign({},l.files),renderState:c},link:u}})},function(s){return o(s&&s.message?s.message:String(s))})}function tP(e,t){return Promise.resolve().then(function(){ZA(t);var n=e||{},r=t.roster;if(n.refusal)return On("refused-key",n.refusal,Qb(r));var i=["walkthrough","project","scene"].filter(function(c){return n[c]});if(i.length>1)return On("conflict","Deep link error: "+i.map(function(c){return c+'="'+n[c]+'"'}).join(" conflicts with ")+" — a deep link selects ONE scene; keep one of them.");if(n.renderer&&(n.walkthrough||n.project))return On("conflict",'Deep link error: renderer="'+n.renderer+'" conflicts with '+(n.walkthrough?'walkthrough="'+n.walkthrough+'"':'project="'+n.project+'"')+" — that scene carries its own renderer; renderer= is for a ?scene= draft only.");if(n.mode&&!n.walkthrough)return On("mode-without-walkthrough",'Deep link error: mode="'+n.mode+'" needs walkthrough=<scene id> — a mode belongs to a roster scene.');if(n.renderer&&!n.scene)return On("renderer-without-scene",'Deep link error: renderer="'+n.renderer+'" needs scene=<url> — a renderer is chosen only for a scene draft.');if(n.walkthrough){var o=Kt(r,n.walkthrough);if(!o)return On("unknown-walkthrough",'Deep link error: unknown walkthrough "'+n.walkthrough+`" — not a scene of this site's roster.`);if(n.mode){var s=Tl(o).map(function(c){return c.id});if(s.indexOf(n.mode)===-1)return On("unknown-mode",'Deep link error: unknown mode "'+n.mode+'" for walkthrough "'+o.id+'" — declared modes: ['+s.join(", ")+"].")}return On("ok",null,{value:"walkthrough:"+o.id,mode:n.mode||null})}if(n.scene)return eP(n,t);if(n.project){var a;try{a=t.loadProject(n.project)}catch(c){return On("project-unreadable",'Deep link error: saved project "'+n.project+'" — '+(c&&c.message?c.message:c))}return a?On("ok",null,{value:"project:"+n.project,mode:null}):On("project-not-found",'Deep link error: saved project "'+n.project+'" not found.')}var l=Qb(r);return On(l.value===Mi?"first-contact-empty":"first-contact",null,l)})}const nP=4,rP=200,iP=[{scene:{id:"cl1d-mirror-route",modeId:"3d"},part:"m6",homes:"starPoints",title:"Try it: put the mirror back",ask:{desktop:[["One mirror is out of place: the cyan one, standing inside the ring. Pick the Hand (the hand icon under Tools, on the left), then drag the cyan mirror out into its empty slot in the ring."]],phone:[["One mirror is out of place: the cyan one, standing inside the ring. Tap HAND at the bottom, then drag the cyan mirror with one finger out into its empty slot in the ring."]]},done:[["Done: the cyan mirror is back in its slot."]],status:function(e){return"It is "+e+" px from its slot."}}];function oP(e,t){var n="[studio-try-it] row "+t;if(!e.scene||typeof e.scene.id!="string"||e.scene.id==="")throw new Error(n+": scene is { id, modeId }.");if(["part","homes"].forEach(function(r){if(typeof e[r]!="string"||e[r]==="")throw new Error(n+": "+r+" is a non-empty name.")}),Zs(e.title,n+".title"),Do(e.ask.desktop,n+".ask.desktop",{table:!1}),Do(e.ask.phone,n+".ask.phone",{table:!1}),Do(e.done,n+".done",{table:!1}),typeof e.status!="function")throw new Error(n+": status(px) words the live distance.");return Zs(e.status(67),n+".status"),Object.freeze(e)}const za=Object.freeze(iP.map(oP));function sP(e,t){Jt(e,"tryItFor(roster, scene)");for(var n=ea(e,t),r=0;r<za.length;r++)if(Kt(e,za[r].scene.id)&&ea(e,za[r].scene)===n)return za[r];return null}function cf(e){if(za.indexOf(e)===-1)throw new Error("[studio-try-it] not a try-it row — pass tryItFor(scene)'s answer. (FAIL-LOUD.)")}function aP(e,t){return Jt(e,"tryItKey(roster, row)"),cf(t),"tryit-"+ea(e,t.scene)}function lP(e,t,n){if(Jt(e,"tryItBag(roster, row, { onPhone })"),cf(t),!n||typeof n.onPhone!="boolean")throw new TypeError("[studio-try-it] tryItBag(roster, row, { onPhone }): onPhone is isMobileDevice(window) (lib/shim/host/device.js). (FAIL-LOUD.)");return{seenKey:aP(e,t),title:t.title,paragraphs:t.ask[n.onPhone?"phone":"desktop"]}}function cP(e,t){cf(e);var n=t&&t[e.homes],r=n&&n[e.part];if(!Array.isArray(r)||typeof r[0]!="number"||typeof r[1]!="number")throw new Error("[studio-try-it] the scene "+e.scene.id+" does not export "+e.homes+"."+e.part+" as [x, y] — the try-it reads where "+e.part+" belongs from the scene file. (FAIL-LOUD.)");return r}function uP(e,t){return Math.hypot(e.left+e.w/2-t[0],e.top+e.h/2-t[1])}function dP(e,t,n,r){Jt(t,"watchTryIt(hostEl, roster, row, how)"),cf(n),["runnerOf","exportsOf","onError"].forEach(function(d){if(!r||typeof r[d]!="function")throw new TypeError("[studio-try-it] watchTryIt(hostEl, roster, row, how): how."+d+" is a function. (FAIL-LOUD.)")});var i=PL(e,lP(t,n,{onPhone:r.onPhone}),{dock:r.dock}),o=e.ownerDocument.defaultView,s=null,a=!1,l=!1;function c(){s!==null&&(o.clearInterval(s),s=null)}function u(){if(!i.showing()){c();return}var d;try{var f=r.runnerOf(),h=r.exportsOf();if(!f||!h)return;var v=f.declared.find(function(x){return x.name===n.part});if(!v)throw new Error('[studio-try-it] the running scene declares no "'+n.part+'" — the try-it has nothing to watch. (FAIL-LOUD.)');var m=f.envelopeOf(v);if(!m)throw new Error('[studio-try-it] "'+n.part+'" has no envelope to read. (FAIL-LOUD.)');d=uP(m,cP(n,h))}catch(x){l=!0,c(),i.status(""),r.onError(x&&x.message?x.message:String(x));return}if(d<=nP){l=!0,c(),e.dataset.tryItOffPx=d.toFixed(2),i.complete(n.done);return}e.dataset.tryItOffPx=d.toFixed(2),i.status(Zs(n.status(Math.round(d)),"[studio-try-it] status"))}return i.ready.then(function(d){a||!d.shows||(u(),l||(s=o.setInterval(u,rP)))}),{ready:i.ready,close:function(){a=!0,c(),delete e.dataset.tryItOffPx,i.close()}}}const VS=Object.freeze({slopPx:8,longPressMs:500,doubleTapMs:350,doubleTapPx:32,pinchOn:.06,twistOnDeg:8,panOnPx:12,orbitDegPerView:180}),fP=Object.freeze({orbit:Object.freeze(["azimuth","elevation"]),zoom:Object.freeze(["distance"]),roll:Object.freeze(["roll"]),pan:Object.freeze(["target"])});function Gg(e){var t=(e%360+360)%360;return t>180?t-360:t}function hP(e,t,n,r){var i=Math.hypot(t.x-e.x,t.y-e.y),o=Math.hypot(r.x-n.x,r.y-n.y),s=Math.atan2(t.y-e.y,t.x-e.x)*180/Math.PI,a=Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI;return{scale:i>0?o/i:1,twistDeg:Gg(a-s),centroid:{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}}function pP(e,t,n,r){if(!(n>0))throw new Error("[canvas-gestures] orbitDelta needs the canvas width (got "+String(n)+"). (FAIL-LOUD.)");var i=(r||0)*Math.PI/180,o=e*Math.cos(i)-t*Math.sin(i),s=e*Math.sin(i)+t*Math.cos(i),a=VS.orbitDegPerView/n;return{dAz:a*o,dEl:-a*s}}function Ba(e,t){if(!Array.isArray(e))throw new Error("[canvas-gestures] the camera publishes no poseFields array — every camera handle declares its axes (RENDERER_CONTRACT §1a.2). (FAIL-LOUD.)");for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.name===t){var i=r.constraint||{};return{min:typeof i.min=="number"?i.min:-1/0,max:typeof i.max=="number"?i.max:1/0,wrap:typeof i.wrap=="number"?i.wrap:null}}}return null}function qS(e,t){return Math.min(t.max,Math.max(t.min,e))}function Oh(e,t){if(!t.wrap)return qS(e,t);var n=isFinite(t.min)?t.min:-t.wrap/2;return((e-n)%t.wrap+t.wrap)%t.wrap+n}function mP(e,t){return fP[t].filter(function(n){return!Ba(e,n)})}function gP(e,t,n,r){var i={},o=[];function s(c){var u=mP(n,c);return u.length?(o.push({gesture:c,axes:u}),!1):!0}if(t.fingers===1){if((t.dx||t.dy)&&s("orbit")){var a=pP(t.dx,t.dy,r,e.roll);i.azimuth=Oh(e.azimuth+a.dAz,Ba(n,"azimuth")),i.elevation=Oh(e.elevation+a.dEl,Ba(n,"elevation"))}return{patch:i,refused:o}}var l=t.active||{};return l.zoom&&s("zoom")&&(i.distance=qS(e.distance/t.scale,Ba(n,"distance"))),l.roll&&s("roll")&&(i.roll=Oh(e.roll-t.twistDeg,Ba(n,"roll"))),l.pan&&s("pan"),{patch:i,refused:o}}function vP(e,t,n){var r=50;function i(a){var l=a*Math.PI/180,c=e([t[0],t[1],t[2]||0]),u=e([t[0]+r*Math.cos(l),t[1]+r*Math.sin(l),t[2]||0]);return!c||!u?null:Math.atan2(u[1]-c[1],u[0]-c[0])*180/Math.PI}var o=i(n),s=i(n+5);if(o===null||s===null)throw new Error("[canvas-gestures] the object's centre is not on screen from this view, so its turning sense cannot be read. (FAIL-LOUD.)");return Gg(s-o)>=0?1:-1}function yP(e,t,n){var r=e+n*t;return(r%360+360)%360}function bP(e){if(!e||typeof e.hitTest!="function"||typeof e.handArmed!="function"||typeof e.emit!="function")throw new Error("[canvas-gestures] createGestureReader({ hitTest, handArmed, emit }) needs all three functions. (FAIL-LOUD.)");var t=Object.assign({},VS,e.tuning||{}),n=e.timers||{set:function(g,k){return setTimeout(g,k)},clear:function(g){clearTimeout(g)}},r=e.emit,i=new Map,o=null,s=null,a=null,l=null,c=null;function u(){l!==null&&(n.clear(l),l=null)}function d(g){var k=[];i.forEach(function(S,M){k.length<2&&k.push(M)});var E=i.get(k[0]),C=i.get(k[1]);a={ids:k,a0:{x:E.x,y:E.y},b0:{x:C.x,y:C.y},lastCentroid:{x:(E.x+C.x)/2,y:(E.y+C.y)/2},base:{scale:1,twist:0,centroid:{x:(E.x+C.x)/2,y:(E.y+C.y)/2}},active:g?{resize:!1,rotate:!1}:{zoom:!1,roll:!1,pan:!1},target:g||null},r(g?{kind:"object",phase:"begin",target:g}:{kind:"world",phase:"begin",fingers:2})}function f(){var g=i.get(a.ids[0]),k=i.get(a.ids[1]);if(!(!g||!k)){var E=hP(a.a0,a.b0,g,k),C=a.active,S=a.base,M=a.target?"resize":"zoom",L=a.target?"rotate":"roll";!C[M]&&Math.abs(E.scale-1)>t.pinchOn&&(C[M]=!0,S.scale=E.scale),!C[L]&&Math.abs(E.twistDeg)>t.twistOnDeg&&(C[L]=!0,S.twist=E.twistDeg);var T=C[M]?E.scale/S.scale:1,V=C[L]?Gg(E.twistDeg-S.twist):0;if(a.target){r({kind:"object",phase:"update",target:a.target,scale:T,twistDeg:V,active:{resize:C.resize,rotate:C.rotate}});return}var G=null;!C.pan&&Math.hypot(E.centroid.x-S.centroid.x,E.centroid.y-S.centroid.y)>t.panOnPx&&(C.pan=!0,a.lastCentroid={x:S.centroid.x,y:S.centroid.y}),C.pan&&(G={from:a.lastCentroid,to:{x:E.centroid.x,y:E.centroid.y}},a.lastCentroid={x:E.centroid.x,y:E.centroid.y}),r({kind:"world",phase:"update",fingers:2,scale:T,twistDeg:V,pan:G,active:{zoom:C.zoom,roll:C.roll,pan:C.pan}})}}function h(){a&&(a.target?r({kind:"object",phase:"end",target:a.target}):r({kind:"world",phase:"end",fingers:2}),a=null)}function v(g){if(g.type==="mouse"){if(g.button!==void 0&&g.button!==0)return;o="mouse",r({kind:"press",x:g.x,y:g.y});return}if(i.set(g.id,{x:g.x,y:g.y}),i.size===1){var k=e.hitTest(g.x,g.y)||null;s={id:g.id,x0:g.x,y0:g.y,t0:g.t,hit:k},k&&e.handArmed()?(o="pending-object",l=n.set(function(){l=null,o==="pending-object"&&(o="held",r({kind:"hold",x:s.x0,y:s.y0}))},t.longPressMs)):o="pending-world";return}if(i.size===2&&(o==="pending-object"||o==="object-drag"||o==="pending-world"||o==="world-1")){u();var E=e.hitTest(g.x,g.y)||null,C=o==="pending-object"||o==="object-drag";o==="object-drag"&&r({kind:"release"}),o==="world-1"&&r({kind:"world",phase:"end",fingers:1}),C&&E&&E===s.hit?(o="object-2",d(s.hit)):(o="world-2",d(null));return}}function m(g){if(g.type==="mouse"){r(o==="mouse"?{kind:"drag",x:g.x,y:g.y}:{kind:"hover",x:g.x,y:g.y});return}if(i.has(g.id)){if(i.set(g.id,{x:g.x,y:g.y}),o==="world-2"||o==="object-2"){f();return}if(!(!s||g.id!==s.id)){var k=Math.hypot(g.x-s.x0,g.y-s.y0)>t.slopPx,E=o==="held"&&k&&typeof g.t=="number"&&typeof s.t0=="number"&&g.t-s.t0<t.longPressMs;(o==="pending-object"||E)&&k?(u(),o="object-drag",r({kind:"press",x:s.x0,y:s.y0}),r({kind:"drag",x:g.x,y:g.y})):o==="object-drag"?r({kind:"drag",x:g.x,y:g.y}):o==="pending-world"&&k?(o="world-1",r({kind:"world",phase:"begin",fingers:1}),r({kind:"world",phase:"update",fingers:1,dx:g.x-s.x0,dy:g.y-s.y0})):o==="world-1"&&r({kind:"world",phase:"update",fingers:1,dx:g.x-s.x0,dy:g.y-s.y0})}}}function x(g,k){if(g.type==="mouse"){o==="mouse"&&(o=null,r({kind:"release"}));return}if(i.has(g.id)){if(i.delete(g.id),u(),o==="pending-object")k||(r({kind:"press",x:s.x0,y:s.y0}),r({kind:"release"})),o=null;else if(o==="pending-world"){if(!k){var E=!s.hit,C=E&&c&&s.t0-c.t<=t.doubleTapMs&&Math.hypot(s.x0-c.x,s.y0-c.y)<=t.doubleTapPx;C?(c=null,r({kind:"reset",x:s.x0,y:s.y0})):(r({kind:"press",x:s.x0,y:s.y0}),r({kind:"release"}),c=E?{t:g.t,x:s.x0,y:s.y0}:null)}o=null}else o==="object-drag"?(r({kind:"release"}),o=null):o==="world-1"?(r({kind:"world",phase:"end",fingers:1}),o=null):o==="world-2"||o==="object-2"?(h(),o="spent"):o==="held"&&(o="spent");i.size===0&&(o=null,s=null,a=null)}}function b(){u(),(o==="mouse"||o==="object-drag")&&r({kind:"release"}),o==="world-1"&&r({kind:"world",phase:"end",fingers:1}),(o==="world-2"||o==="object-2")&&h(),i.clear(),o=null,s=null,a=null}return{down:v,move:m,up:function(g){x(g,!1)},cancel:function(g){x(g,!0)},reset:b,mode:function(){return o}}}function xP(e,t){if(!e||typeof e.addEventListener!="function")throw new Error("[canvas-gestures] bindCanvasGestures(el, reader) needs an element. (FAIL-LOUD.)");e.style.touchAction="none";function n(l){var c=e.getBoundingClientRect();return{id:l.pointerId,type:l.pointerType||"mouse",x:l.clientX-c.left,y:l.clientY-c.top,t:typeof l.timeStamp=="number"?l.timeStamp:Date.now(),button:l.button}}function r(l){l.pointerType==="mouse"&&l.button!==0||(t.down(n(l)),l.preventDefault())}function i(l){t.move(n(l)),t.mode()!==null&&l.preventDefault()}function o(l){t.up(n(l)),l.preventDefault()}function s(l){t.cancel(n(l))}function a(l){l.pointerType==="mouse"&&t.up(n(l))}return e.addEventListener("pointerdown",r),e.addEventListener("pointermove",i),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",a),function(){e.removeEventListener("pointerdown",r),e.removeEventListener("pointermove",i),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",a),t.reset()}}function wP(e,t){var n=nc(e);if(!n)throw new Error("[save-state] the STUDIO frame's modules are not loaded — loadFrameModules(cw, router) (lib/features/ide/frame-modules.js) runs before a runner is taken. (FAIL-LOUD.)");return n.RenderState.backdropOf(t)}function _P(e){return e?e.visible!==!1:null}function kP(e){if(!Array.isArray(e))return[];for(var t=[],n=0;n<e.length;n++){var r=e[n];r&&r.bind&&typeof r.bind.prop=="string"&&r.bind.prop.length>0&&t.push({key:r.bind.prop,value:r.value})}return t}function SP(e,t){return e!==t}function $S(e,t){if(typeof e!="string"||!e)throw new TypeError("[share-file] downloadBlob(filename, blob): filename must be a non-empty string. (FAIL-LOUD.)");if(!t||typeof t.size!="number"||typeof t.type!="string")throw new TypeError("[share-file] downloadBlob(filename, blob): blob must be a Blob. (FAIL-LOUD.)");var n=URL.createObjectURL(t);try{var r=document.createElement("a");r.href=n,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}finally{setTimeout(function(){URL.revokeObjectURL(n)},0)}}function KS(e,t){if(!e||typeof e!="object")throw new TypeError("[share-file] "+t+"(nav, …): nav is the window's navigator. (FAIL-LOUD.)")}function YS(e,t){return KS(e,"canShareFile"),typeof e.canShare!="function"||typeof e.share!="function"?!1:e.canShare({files:[t]})===!0}function EP(e,t,n){if(KS(e,"shareFile"),!YS(e,t))throw new Error("[share-file] shareFile: this browser's Web Share does not take this file ("+(t&&t.type)+") — offer the download instead (canShareFile gates the Share action). (FAIL-LOUD.)");return e.share({files:[t],title:n})}function OP(e,t,n){$S(e,new Blob([t],{type:"application/zip"}))}function CP(e){return e.arrayBuffer().then(function(t){return new Uint8Array(t)})}function jP(e){return typeof window<"u"&&typeof window.__FRQTL_SDK_VERSION__=="string"&&window.__FRQTL_SDK_VERSION__.length>0?Promise.resolve(window.__FRQTL_SDK_VERSION__):qp.length>0?Promise.resolve(qp):Promise.reject(new Error("[bundle-export] deriveSdkVersion: the router CDN_SDK_VERSION authority is empty — pass an explicit version or set window.__FRQTL_SDK_VERSION__. (Never fabricate a CDN pin.)"))}function Zb(e){throw new Error("[capture-envelope] "+e+" (FAIL-LOUD.)")}function RP(e){typeof e!="string"&&Zb("base64ToBytes expects the base64 string of encoded.bytes, got "+typeof e),typeof atob!="function"&&Zb("base64ToBytes needs a global atob (every browser, and node >= 16)");for(var t=atob(e),n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function LP(e){if(!e||typeof e!="object")throw new TypeError("[studio-recorder] recordUnavailableReason(win): win is the experiment frame's window. (FAIL-LOUD.)");return typeof e.VideoEncoder!="function"?"this browser has no WebCodecs VideoEncoder (or the page is not a secure context), and the one recorder, FrqtlVision.record (lib/frqtl/parts/FrqtlVision.js), encodes with it — the Record button is hidden":null}var ex=Object.freeze({"video/mp4":"mp4","video/webm":"webm"});function Uc(e){return(e<10?"0":"")+e}function AP(e,t,n){var r=ex[n];if(!r)throw new Error("[studio-recorder] recordingFileName: no file extension for mime "+JSON.stringify(n)+" (known: "+Object.keys(ex).join(", ")+"). (FAIL-LOUD.)");var i=String(e).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(!i)throw new Error("[studio-recorder] recordingFileName: the scene has no name to put in the file name (got "+JSON.stringify(e)+"). (FAIL-LOUD.)");var o=t.getFullYear()+Uc(t.getMonth()+1)+Uc(t.getDate())+"-"+Uc(t.getHours())+Uc(t.getMinutes());return"frqtl-"+i+"-"+o+"."+r}function PP(e,t,n){var r=e.encoded.mime;return new File([RP(e.encoded.bytes)],AP(t,n,r),{type:r})}var tx="#6a9ad0",nx="#cfcfcf",rx="#a08060";function MP({value:e,roster:t,savedProjects:n,onChange:r,disabled:i}){Jt(t,"ExperimentDropdown({ value, roster, savedProjects, onChange, disabled })");var[o,s]=j.useState(!1),a=j.useRef(null);j.useEffect(function(){if(!o)return;function f(h){a.current&&!a.current.contains(h.target)&&s(!1)}return document.addEventListener("mousedown",f),function(){document.removeEventListener("mousedown",f)}},[o]),j.useEffect(function(){if(!o)return;function f(h){h.key==="Escape"&&s(!1)}return document.addEventListener("keydown",f),function(){document.removeEventListener("keydown",f)}},[o]);function l(f){s(!1),f!==e&&r&&r(f)}var c=QA(e,n,t.rows),u=!e||e===Mi?rx:e.indexOf("walkthrough:")===0?tx:nx,d=!e||e===Mi;return y.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[y.jsxs("button",{disabled:!!i,style:TP(!!i),onClick:function(){i||s(function(f){return!f})},title:"Switch experiment or open saved project","aria-haspopup":"listbox","aria-expanded":o,children:[y.jsx("span",{style:{color:u,fontStyle:d?"italic":"normal",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:c}),y.jsx("span",{style:{color:"#555",marginLeft:"5px",fontSize:"0.55rem",flexShrink:0},children:o?"▲":"▼"})]}),o&&y.jsxs("div",{style:DP,role:"listbox","aria-label":"Select experiment",children:[y.jsx(Ch,{val:Mi,selected:e===Mi,onSelect:l,hoverBg:"#2a2200",children:y.jsx("span",{style:{fontStyle:"italic",color:rx},children:"Empty Universe (New)"})}),dS(t).map(function(f,h){return y.jsxs(Ze.Fragment,{children:[y.jsx(ix,{scene:!0,children:f.label}),f.rows.map(function(v){var m="walkthrough:"+v.id,x=Kt(t,v.id);return y.jsx(Ch,{val:m,selected:e===m,onSelect:l,hoverBg:"#16222f",title:x?x.prose:void 0,children:y.jsx("span",{style:{color:tx},children:v.title})},h+":"+m)})]},h+":"+f.label)}),n&&n.length>0&&y.jsxs(y.Fragment,{children:[y.jsx(ix,{children:"Saved Projects"}),n.map(function(f){var h="project:"+f.id;return y.jsx(Ch,{val:h,selected:e===h,onSelect:l,hoverBg:"#1e1e1e",children:y.jsx("span",{style:{color:nx},children:f.name})},h)})]})]})]})}function ix({children:e,scene:t}){return y.jsx("div",{"data-scene-group":t?"":void 0,style:{fontSize:"0.55rem",letterSpacing:"1px",textTransform:"uppercase",color:"#444",padding:"5px 8px 2px",borderTop:"1px solid #222",userSelect:"none"},children:e})}function Ch({val:e,selected:t,onSelect:n,hoverBg:r,children:i,title:o}){var[s,a]=j.useState(!1);return y.jsx("div",{role:"option","data-value":e,"aria-selected":t,title:o||void 0,style:{padding:"5px 8px",cursor:"pointer",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",background:s?r:t?"#26323f":"transparent",userSelect:"none",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},onClick:function(){n(e)},onMouseEnter:function(){a(!0)},onMouseLeave:function(){a(!1)},children:i})}function TP(e){return{display:"flex",alignItems:"center",gap:"4px",maxWidth:"200px",minWidth:"120px",background:"#1a1a1a",border:"1px solid #333",color:"#ccc",padding:"3px 6px",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",cursor:e?"not-allowed":"pointer",borderRadius:"3px",opacity:e?.5:1,outline:"none"}}var DP={position:"absolute",top:"100%",left:0,zIndex:9999,background:"#151515",border:"1px solid #333",borderRadius:"3px",minWidth:"200px",maxWidth:"300px",maxHeight:"320px",overflowY:"auto",boxShadow:"0 4px 16px rgba(0,0,0,0.6)",marginTop:"2px"};function Ko(e){return!e||typeof e!="object"?!1:Object.prototype.toString.call(e)==="[object Map]"?!0:typeof e.get=="function"&&typeof e.entries=="function"&&typeof e.forEach=="function"&&typeof e.size=="number"}function GS(e){var t=[],n=[];if(e&&typeof e=="object"&&Array.isArray(e.cells)){for(var r=0;r<e.cells.length;r++)n.push(Number(e.cells[r].v)||0);return{labels:t,values:n,cells:e.cells,maxV:Number(e.maxV)||0}}if(Ko(e)){var i=Array.from(e.entries());i.sort(function(l,c){return Number(l[0])-Number(c[0])});for(var o=0;o<i.length;o++)t.push(String(i[o][0])),n.push(Number(i[o][1]))}else if(Array.isArray(e))for(var s=0;s<e.length;s++){var a=e[s];a&&typeof a=="object"?(t.push(String(a.x!=null?a.x:s)),n.push(Number(a.y!=null?a.y:a.count!=null?a.count:0))):(t.push(String(s)),n.push(Number(a)))}else e&&typeof e=="object"&&Object.keys(e).forEach(function(l){t.push(l),n.push(Number(e[l]))});return{labels:t,values:n}}function IP(e,t){if(!e||typeof e.render!="function"||typeof e.destroy!="function")throw new Error("[realm-chart] makeChartHandle requires a chart-env with render()/destroy(). (FAIL-LOUD.)");var n=null;function r(o){var s=o&&o.kind||"bar",a=o&&o.label||"series",l=GS(o&&o.data);return n=Object.assign({kind:s,label:a},l),e.render(n),n}var i={_transport:t&&t.kind||"in-app",inject:function(o,s){return o==="chart"?!s||typeof s.data>"u"||s.data===null?Promise.reject(new Error('[realm-chart] inject("chart") needs { data } (the bound value to plot) — binding not yet produced. (FAIL-LOUD.)')):(r(s),Promise.resolve()):Promise.reject(new Error('[realm-chart] inject: unknown name "'+o+'" (expect "chart"). (FAIL-LOUD.)'))},call:function(o){if(o==="lastData")return n;throw new Error('[realm-chart] call: unknown fn "'+o+'" (expect "lastData"). (FAIL-LOUD.)')},on:function(){return function(){}},start:function(){n&&e.render(n)},stop:function(){},step:function(){return n&&e.render(n),n},dispose:function(){n=null,e.destroy()},_chartEnv:e};return{handle:Pk(i),impl:i}}const yd=["detectorHistogram","absorberStats","liveCount","detectorSurface"],Jg=100;function FP(e,t,n){var r=typeof n=="number"?n:Jg;return t-e>=r}function lm(e){e=e||{};var t=e.handle,n=e.chartEnv,r=e.projector||"detectorHistogram",i=e.kind==="line"?"line":"bar",o=e.label||r;function s(){var x=typeof o=="function"?o():o;return x==null||x===""?r:String(x)}var a=typeof e.now=="function"?e.now:function(){return Date.now()},l=typeof e.throttleMs=="number"?e.throttleMs:Jg,c=e.orientation;function u(){var x=typeof c=="function"?c():c;if(x!=null)return String(x)==="90"?90:0}if(!t||typeof t.on!="function"||typeof t.call!="function")throw new Error("[live-chart-controller] requires a view-handle with on()/call(). (FAIL-LOUD.)");if(!n||typeof n.render!="function"||typeof n.destroy!="function")throw new Error("[live-chart-controller] requires a chart-env with render()/destroy(). (FAIL-LOUD.)");if(yd.indexOf(r)===-1)throw new Error('[live-chart-controller] unknown liveChart projector "'+r+'" (expect one of ['+yd.join(", ")+"]). (FAIL-LOUD.)");var d=-1/0,f=null,h=!1;function v(){var x;try{x=Promise.resolve(t.call(r))}catch(b){return Promise.reject(b)}return x.then(function(b){var g=GS(b);n.render({kind:i,label:s(),labels:g.labels,values:g.values,cells:g.cells,maxV:g.maxV,orientation:u()})})}function m(){FP(d,a(),l)&&(d=a(),v())}return{start:function(){h||f||(f=t.on("tick",m))},stop:function(){if(!h){if(f){try{f()}catch{}f=null}return v()}},dispose:function(){if(!h){if(f){try{f()}catch{}f=null}try{v().catch(function(){})}catch{}h=!0,n.destroy()}}}}var jh=null;function ox(){return jh||(jh=OS(()=>Promise.resolve().then(()=>rz),void 0,import.meta.url).then(function(e){return e.makeChartEnv})),jh}function NP(e){return e?Ko(e.combined)?e.combined:(Ko(e),e):{}}var sx={detectorHistogram:{method:"getCollisionHistogram",drain:!0,project:function(e){return NP(e.getCollisionHistogram())}},absorberStats:{method:"getAbsorbStats",drain:!1,project:function(e){var t=e.getAbsorbStats()||{};return{stored:Number(t.stored)||0,absorbed:Number(t.absorbedTotal)||0,radiated:Number(t.radiatedTotal)||0}}},liveCount:{method:"getLiveCount",drain:!0,project:function(e){return{live:Number(e.getLiveCount())||0}}},detectorSurface:{method:"getCollisionHistogram",drain:!0,project:function(e){return zP(e.getCollisionHistogram())}}},Hc=12;function zP(e){var t=[],n=0,r=e&&e.grid;if(!Ko(r))return{cells:t,maxV:n};var i=new Map;return r.forEach(function(o,s){if(Ko(o)){var a=Math.floor(Number(s)/Hc)*Hc;o.forEach(function(l,c){var u=Math.floor(Number(c)/Hc)*Hc,d=a+","+u;i.set(d,(i.get(d)||0)+(Number(l)||0))})}}),i.forEach(function(o,s){var a=s.split(",");o>n&&(n=o),t.push({x:Number(a[1]),y:Number(a[0]),v:o})}),{cells:t,maxV:n}}function JS(e){var t=e||"detectorHistogram",n=sx[t];if(!n)throw new Error('[live-chart-wiring] unknown liveChart projector "'+t+'" — must be one of ['+Object.keys(sx).join(", ")+"]. (FAIL-LOUD.)");return n}function BP(e,t){var n=JS(t.projector).method;return t.sourceHandle&&typeof t.sourceHandle[n]=="function"?t.sourceHandle:typeof t.source=="string"&&t.source&&e?e.getObjectByName(t.source,function(r){return typeof r[n]=="function"}):null}function XS(e,t){if(!e||!t||typeof t.name!="string"||!t.name)return null;function n(o){return!!(o&&o.gateCounter===t.name&&typeof o.emissionCap=="number")}for(var r=e.declared||[],i=0;i<r.length;i++)if(n(r[i]))return r[i];return null}function UP(e,t){var n=XS(e,t);return n?n.emissionCap:null}function HP(e,t){var n=[];return{on:function(r,i){if(r!=="tick")throw new Error('[live-chart-wiring] adapter only supports the "tick" event. (FAIL-LOUD.)');return n.push(i),function(){var o=n.indexOf(i);o!==-1&&n.splice(o,1)}},call:function(){return t.project(e)},_emitTick:function(){for(var r=0;r<n.length;r++)try{n[r]({})}catch{}}}}function WP(e,t){var n=e.createElement("div"),r=t.rect&&t.rect.w||200,i=t.rect&&t.rect.h||140;n.style&&(n.style.position="absolute",n.style.left="-100000px",n.style.top="0",n.style.width=r+"px",n.style.height=i+"px",n.style.pointerEvents="none"),n.setAttribute("data-role","live-chart-offscreen");var o=e.body||e.documentElement||null;return o&&typeof o.appendChild=="function"&&o.appendChild(n),n}async function QS(e,t){if(t=t||{},!e||!Array.isArray(e.largeObjects)||typeof e.addTickListener!="function")throw new Error("[live-chart-wiring] mountLiveCharts requires a runner with largeObjects and addTickListener(). (FAIL-LOUD.)");var n=t.document||(typeof document<"u"?document:null),r=typeof t.now=="function"?t.now:typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return Date.now()},i=typeof t.makeChartEnv=="function"?t.makeChartEnv:null,o=!1;function s(){i||o||(o=!0,ox().then(function(f){i=f}).catch(function(f){o=!1,typeof console<"u"&&console.error&&console.error("[live-chart-wiring] chart-env factory load failed:",f)}))}var a=[];function l(f,h,v){if(!n||typeof n.createElement!="function")throw new Error("[live-chart-wiring] a DOM document is required to host the offscreen chart canvas. (FAIL-LOUD.)");var m=f.chartSpec,x=WP(n,f),b=i(x),g=HP(h,v),k=lm({handle:g,chartEnv:b,projector:m.projector||"detectorHistogram",kind:m.kind||"bar",label:function(){var E=f.label!=null&&f.label!==""?f.label:m.label||"detector",C=UP(e,h);return C!=null?E+" (cap "+C+")":E},now:r,throttleMs:typeof m.refreshMs=="number"?m.refreshMs:100,orientation:function(){var E=f.orientation!=null?f.orientation:m.orientation;return String(E)==="90"?90:0}});(function(E){f.liveCanvas=function(){return E&&typeof E.querySelector=="function"?E.querySelector("canvas"):null}})(x),k.start(),a.push({lo:f,source:h,desc:v,controller:k,host:x,adapter:g})}function c(){for(var f=0,h=e.largeObjects||[],v=0;v<h.length;v++){var m=h[v];if(!(!m||!m.chartSpec||m._liveChartWired||m._liveChartWireFailed)){var x=JS(m.chartSpec.projector),b=BP(e,m.chartSpec);if(b){try{b[x.method]()}catch(g){throw m._liveChartWireFailed=!0,g}if(!i){s();continue}l(m,b,x),m._liveChartWired=!0,f++}}}return f}var u=function(f){c();for(var h=0;h<a.length;h++){var v=a[h];v.desc.drain&&v.source[v.desc.method](f),v.adapter._emitTick()}},d=e.addTickListener(u);return c(),o&&!i&&(i=await ox(),o=!1,c()),{charts:a,rescan:c,dispose:function(){try{d&&d()}catch{}for(var f=0;f<a.length;f++){var h=a[f];try{h.controller.dispose()}catch{}try{h.host&&h.host.parentNode&&typeof h.host.parentNode.removeChild=="function"&&h.host.parentNode.removeChild(h.host)}catch{}try{h.lo._liveChartWired=!1}catch{}try{h.lo.liveCanvas=null}catch{}}a.length=0}}}function ax(e){var t=e.field||{},n=t.widgetConfig||{},r=t.constraint||{},i=n.min!=null?n.min:r.min!=null?r.min:0,o=n.max!=null?n.max:r.max!=null?r.max:100,s=n.step!=null?n.step:r.integer?1:.1,a=e.value!=null&&e.value!==""?e.value:i;function l(c){var u=r.integer?parseInt(c.target.value,10):parseFloat(c.target.value);isNaN(u)||e.commit(u)}return Ze.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1}},Ze.createElement("input",{type:"range",min:i,max:o,step:s,value:a,style:{flex:1,accentColor:"#7ec8e3"},onChange:l}),Ze.createElement("span",{style:{minWidth:"42px",textAlign:"right",color:"#7ec8e3",font:"11px ui-monospace,Menlo,Consolas,monospace"}},String(a)))}function VP(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function qP(e){if(!e||!Array.isArray(e))return"#888888";function t(n){return("0"+Math.max(0,Math.min(255,Math.round(n))).toString(16)).slice(-2)}return"#"+t(e[0])+t(e[1])+t(e[2])}function $P(e){return Ze.createElement("input",{type:"color",value:qP(Array.isArray(e.value)?e.value:null),style:{width:44,height:22,border:"none",background:"none",cursor:"pointer",padding:0},onChange:function(t){e.commit(VP(t.target.value))}})}var KP={width:"100%",background:"#1a1a1a",color:"#ccc",border:"1px solid #333",padding:"4px",fontSize:"0.62rem"};function YP(e){var t=e.obj||{},n=e.value!=null&&e.value!==""?Math.round(Number(e.value)):0,r=typeof t.getFundamentalDimension=="function"?t.getFundamentalDimension():n;(typeof r!="number"||isNaN(r))&&(r=n);for(var i=Math.max(n,r)+4,o=[],s=0;s<=i;s++)o.push(s);o.indexOf(n)===-1&&(o.push(n),o.sort(function(l,c){return l-c}));function a(l){var c=l===r?" — fundamental":l<r?" — below floor (ratchet)":" — above (slower/redder)";return"Dim "+l+c}return Ze.createElement("select",{value:String(n),style:KP,onChange:function(l){e.commit(parseInt(l.target.value,10))}},o.map(function(l){return Ze.createElement("option",{key:l,value:String(l)},a(l))}))}function GP(e){return Ze.createElement("input",{type:"checkbox",checked:!!e.value,style:{accentColor:"#7ec8e3",cursor:"pointer"},onChange:function(t){e.commit(t.target.checked)}})}var Rh=[{id:"dimension-select",match:function(e,t){return t.widgetHint==="dimension-select"},Component:YP},{id:"oven-temperature",match:function(e,t){return e==="OvenBox"&&t.name==="temperature"},Component:ax},{id:"slider",match:function(e,t){return t.type==="number"&&t.widgetHint==="slider"},Component:ax},{id:"rgb-color-picker",match:function(e,t){return t.type==="rgb"},Component:$P},{id:"boolean-checkbox",match:function(e,t){return t.type==="boolean"},Component:GP}];function JP(e,t){if(!t)return null;for(var n=0;n<Rh.length;n++)if(Rh[n].match(e,t))return Rh[n];return null}var Ca=8,XP=10,QP="rgba(74, 122, 191, 0.85)",ZP="rgba(74, 122, 191, 0.30)",eM="rgba(138, 180, 248, 0.90)",tM="rgba(255, 255, 255, 0.95)",nM="rgba(74, 122, 191, 1.0)";function Ua(e,t){return jA(e,t)}function rM(e,t,n,r,i){if(e){if(typeof i!="function")throw new Error("[author-bbox-overlay] paintAuthorOverlay needs the host's world→overlay map (toOverlay) — there is no camera-blind default. (FAIL-LOUD.)");e.clearRect(0,0,e.canvas.width,e.canvas.height);for(var o=0;o<t.length;o++){var s=t[o],a=s.ref;if(a){var l=Ua(a,r);if(l){var c=i(l);if(!(!c||c.width<=0||c.height<=0)){var u=a===n;e.fillStyle=ZP,e.fillRect(c.left,c.top,c.width,c.height),e.strokeStyle=u?eM:QP,e.lineWidth=u?2:1,e.setLineDash([4,3]),e.strokeRect(c.left,c.top,c.width,c.height),e.setLineDash([]),u&&iM(e,c)}}}}}}function iM(e,t){var n=XP,r=n/2,i=t.left+t.width/2,o=t.top+t.height/2,s=[{x:t.left,y:t.top},{x:t.left+t.width,y:t.top},{x:t.left,y:t.top+t.height},{x:t.left+t.width,y:t.top+t.height},{x:i,y:t.top},{x:i,y:t.top+t.height},{x:t.left,y:o},{x:t.left+t.width,y:o}];e.fillStyle=tM,e.strokeStyle=nM,e.lineWidth=1.5;for(var a=0;a<s.length;a++){var l=s[a];e.fillRect(l.x-r,l.y-r,n,n),e.strokeRect(l.x-r,l.y-r,n,n)}}function Lh(e,t){if(!e)return null;var n=e,r=t.x,i=t.y;if(r<n.left-Ca||r>n.left+n.width+Ca||i<n.top-Ca||i>n.top+n.height+Ca)return null;var o=Ca,s=n.left+n.width/2,a=n.top+n.height/2,l=n.width<2*o||n.height<2*o;if(!l){if(hn(r,n.left,o)&&hn(i,n.top,o))return"scale-tl";if(hn(r,n.left+n.width,o)&&hn(i,n.top,o))return"scale-tr";if(hn(r,n.left,o)&&hn(i,n.top+n.height,o))return"scale-bl";if(hn(r,n.left+n.width,o)&&hn(i,n.top+n.height,o))return"scale-br";if(hn(r,s,o)&&hn(i,n.top,o))return"scale-t";if(hn(r,s,o)&&hn(i,n.top+n.height,o))return"scale-b";if(hn(r,n.left,o)&&hn(i,a,o))return"scale-l";if(hn(r,n.left+n.width,o)&&hn(i,a,o))return"scale-r"}return r>=n.left&&r<=n.left+n.width&&i>=n.top&&i<=n.top+n.height?"move":null}function hn(e,t,n){return Math.abs(e-t)<=n}function lx(e){return!e||e==="move"?"grab":e==="scale-tl"||e==="scale-br"?"nwse-resize":e==="scale-tr"||e==="scale-bl"?"nesw-resize":e==="scale-t"||e==="scale-b"?"ns-resize":e==="scale-l"||e==="scale-r"?"ew-resize":"default"}function oM(e,t,n){var r=Object.assign({},e),i=n.x,o=n.y;return t==="scale-tl"?(r.left+=i,r.top+=o,r.width-=i,r.height-=o):t==="scale-tr"?(r.top+=o,r.width+=i,r.height-=o):t==="scale-bl"?(r.left+=i,r.width-=i,r.height+=o):t==="scale-br"?(r.width+=i,r.height+=o):t==="scale-t"?(r.top+=o,r.height-=o):t==="scale-b"?r.height+=o:t==="scale-l"?(r.left+=i,r.width-=i):t==="scale-r"&&(r.width+=i),r.width<4&&(r.width=4),r.height<4&&(r.height=4),r}var sM={loading:"The scene is loading",paused:"Run the scene to record it","rate-unmeasured":"Record waits for the scene's measured tick rate (about a second after Run)"};function aM(e){var t=sM[e.reason];if(!t)throw new Error('[AuthorView] FrqtlVision.recordRefusal gave reason "'+e.reason+'", which the Record button has no title for — add it to REC_REFUSAL_TITLES. (FAIL-LOUD.)');return t}function ot(e){var t=nc(e);if(!t)throw new Error("[AuthorView] the STUDIO frame's modules are not loaded — loadFrameModules(cw, router) (lib/features/ide/frame-modules.js) runs in grab() before a runner is taken. (FAIL-LOUD.)");return t}function cr(e){return!!(e&&nc(e))}function Ha(e,t){return e&&e.FrqtlPage?e.FrqtlPage[t]:null}var Wc=Mi,ZS="empty",lM="data-frqtl-renderer";function cx(e){var t=e&&e.document&&e.document.documentElement;return t&&t.getAttribute(lM)||null}function cM(e,t){var n=function(o){return!!(o&&o.phases&&o.phases.renderer&&o.phases.renderer.complete)};if(n(om(e.document)))return t(),function(){};var r=e.frameElement;if(!r)return function(){};var i=function(o){n(o.detail)&&(r.removeEventListener(ol,i),t())};return r.addEventListener(ol,i),function(){r.removeEventListener(ol,i)}}function ux(e){return e&&Array.isArray(e.presets)?e.presets:[]}function dx(e){return e&&Array.isArray(e.poseFields)?e.poseFields:[]}var fx="▶ Run",hx="▌▌ Pause",px="● Rec",mx="Saving…";function uM(e){var t=Math.max(0,Math.floor(e/1e3));return Math.floor(t/60)+":"+(t%60<10?"0":"")+t%60}function gx(e){return"■ Stop ● "+uM(e)}var Vc={hand:"grab",dropper:"crosshair",pencil:"default"},dM=4,or="design",sr="run";function vx(e){var t=j.useRef(null),[n,r]=j.useState(null);j.useLayoutEffect(function(){var o=t.current;if(o){for(var s=0,a=0;a<o.children.length;a++)s=Math.max(s,o.children[a].getBoundingClientRect().width);var l=Math.ceil(s);l>0&&l!==n&&r(l)}});var i=Object.assign({},e);return delete i.labels,delete i.style,delete i.children,y.jsxs(Ze.Fragment,{children:[y.jsx("button",{...i,style:Object.assign({},e.style,n?{width:n+"px",boxSizing:"border-box",textAlign:"center",whiteSpace:"nowrap"}:null),children:e.children}),y.jsx("span",{ref:t,"aria-hidden":"true",style:{position:"absolute",left:"-10000px",top:0,visibility:"hidden",pointerEvents:"none"},children:e.labels.map(function(o){return y.jsx("span",{style:Object.assign({},e.style,{display:"inline-block",boxSizing:"border-box",whiteSpace:"nowrap",width:"auto"}),children:o},o)})})]})}function qc(e){var t=e.kind,n={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto"}};return t==="hand"?y.jsxs("svg",{...n,children:[y.jsx("path",{d:"M18 11V6a2 2 0 0 0-4 0v5"}),y.jsx("path",{d:"M14 10V4a2 2 0 0 0-4 0v6"}),y.jsx("path",{d:"M10 10.5V6a2 2 0 0 0-4 0v8"}),y.jsx("path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"})]}):t==="dropper"?y.jsxs("svg",{...n,children:[y.jsx("path",{d:"m2 22 1-4 11-11 3 3L6 21z"}),y.jsx("path",{d:"m14 7 3 3"}),y.jsx("path",{d:"M17 4a2.83 2.83 0 0 1 4 4l-2 2-4-4z"})]}):y.jsxs("svg",{...n,children:[y.jsx("path",{d:"M12 20h9"}),y.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z"})]})}var fM=["emitter","boundary","composite","measurement","circuit"],hM={emitter:"Emitters",boundary:"Boundaries",composite:"Composite",measurement:"Measurement",circuit:"Circuit"};function fs(e,t){var n=ZS,r=typeof window<"u"&&window.location?window.location.search:"",i=Dg(e,n,"wasm",r);return i=sS(i,t),aL(i,"canvas")}function pM(e){var t=j.useRef(null),n=j.useRef(null),r=j.useRef(e.onChange);return r.current=e.onChange,j.useEffect(function(){var i=e.cw,o=t.current;if(!(!cr(i)||!o)){var s=Object.assign({},e.control,{onChange:function(l){r.current(l)}}),a=ot(i).FrqtlControlSlider.mount(o,{descriptor:s});return n.current=a,function(){a.dispose(),n.current=null}}},[e.cw,e.control.id]),j.useEffect(function(){if(n.current){var i=typeof e.control.fmt=="function"?e.control.fmt(e.control.value):String(e.control.value);n.current.setValue(e.control.value,i)}},[e.control.value]),y.jsx("div",{ref:t,style:{flex:1}})}function mM(e){var t=e.ready,n=e.ctxRef,r=e.reloadKey,[i,o]=j.useState(null),[s,a]=j.useState(null),l=j.useRef(null);j.useEffect(function(){if(o(null),a(null),l.current&&(l.current.dispose(),l.current=null),!!t){var u=n.current.cw;if(!cr(u)){o([]);return}var d=Ha(u,"controls"),f=d&&typeof d.controlNames=="function"?d.controlNames():[];if(f.length===0){o([]);return}var h=f[0];a(h);var v=ot(u).ShimRpc.makeInAppRpc(function(m,x){return ot(u).FrqtlControlsPanel.dispatch(d,m,x)});return l.current=v,v.call("listControls",[h]).then(function(m){o(m)}).catch(function(){o([])}),function(){v.dispose()}}},[t,r]);function c(u,d){if(!(!l.current||!s)){var f=n.current.writeQueue,h=function(){l.current.call("setControlValue",[s,u,d]).then(function(v){o(function(m){return(m||[]).map(function(x){return x.id===u?Object.assign({},x,v):x})})}).catch(function(v){window.console&&console.error&&console.error("[AuthorView PageControls] setControlValue failed:",v)})};f&&typeof f.write=="function"?f.write(s+"."+u,h):h()}}return i===null?y.jsx("div",{style:bd,children:"Loading page controls…"}):i.length===0?y.jsx("div",{style:bd,children:"No page-level controls declared by this experiment."}):y.jsx("div",{children:i.map(function(u){var d=typeof u.min=="number"&&typeof u.max=="number";return y.jsxs("div",{style:cm,"data-page-control":u.id,children:[y.jsx("div",{style:um,title:u.label,children:u.label}),d?y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1},children:[y.jsx("input",{type:"range",min:u.min,max:u.max,step:u.step,value:u.value,style:{flex:1,accentColor:"#7ec8e3"},onChange:function(f){c(u.id,parseFloat(f.target.value))}}),y.jsx("span",{style:{minWidth:42,textAlign:"right",color:"#7ec8e3",font:"11px ui-monospace,Menlo,Consolas,monospace"},children:u.valueText})]}):y.jsx("span",{style:dm,children:u.valueText})]},u.id)})})}var bd={color:"#6a6a6a",fontSize:"0.62rem"},cm={display:"flex",alignItems:"center",gap:"6px",padding:"3px 0"},um={flex:"0 0 40%",color:"#9a9a9a",fontSize:"0.64rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},dm={color:"#ccc",fontSize:"0.64rem"};function gM(e){var t=e.ready,n=e.ctxRef,r=e.reloadKey,[i,o]=j.useState(null),s=e.retained||[];function a(){var u=n.current.cw,d=n.current.runner;if(!cr(u)||!d){o([]);return}var f;try{f=ot(u).MakeControlsForRenderSurface.makeControlsForRenderSurface({runner:d})}catch(h){window.console&&console.error&&console.error("[AuthorView RenderControls] makeControlsForRenderSurface failed:",h),o([]);return}o(f.controls.map(function(h){return Object.assign({},h,{valueText:typeof h.fmt=="function"?h.fmt(h.value):String(h.value)})}))}j.useEffect(function(){if(o(null),!!t){a();var u=n.current.runner;if(!u||typeof u.addRenderOptionsListener!="function")throw new Error("[AuthorView RenderControls] runner.addRenderOptionsListener is missing — the runner announces every applied render-option write; the panel reads back on it. (FAIL-LOUD.)");return u.addRenderOptionsListener(function(){a()})}},[t,r]);function l(u,d){var f=n.current.cw,h=n.current.runner;if(!(!f||!h)){var v=n.current.writeQueue,m=function(){try{ot(f).ControlBind.resolveBind(u.bind,{runner:h},"render").set(d)}catch(x){window.console&&console.error&&console.error("[AuthorView RenderControls] write failed:",x)}};v&&typeof v.write=="function"?v.write("render."+u.id,m):m()}}if(i===null)return y.jsx("div",{style:bd,children:"Loading render controls…"});var c=s.map(function(u){return y.jsxs("div",{style:cm,"data-role":"studio-render-retained",children:[y.jsx("div",{style:um,title:u.key,children:u.key}),y.jsxs("span",{style:dm,children:[String(u.value)," — not available on ",e.rendererName||"this renderer"]})]},"retained:"+u.key)});return i.length===0?y.jsxs("div",{children:[y.jsx("div",{style:bd,children:"The active renderer declares no render controls."}),c]}):y.jsxs("div",{children:[i.map(function(u){var d=u.kind==="scalar"&&u.min===0&&u.max===1&&u.step===1,f=u.kind==="scalar"&&!d;return y.jsxs("div",{style:cm,"data-render-row":u.id,children:[y.jsx("div",{style:um,title:u.label,children:u.label}),d?y.jsx("input",{type:"checkbox",checked:!!u.value,onChange:function(h){l(u,h.target.checked?1:0)},style:{accentColor:"#7ec8e3"}}):f?y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1},children:[y.jsx("input",{type:"range",min:u.min,max:u.max,step:u.step,value:u.value,style:{flex:1,accentColor:"#7ec8e3"},onChange:function(h){l(u,parseFloat(h.target.value))}}),y.jsx("span",{style:{minWidth:42,textAlign:"right",color:"#7ec8e3",font:"11px ui-monospace,Menlo,Consolas,monospace"},children:u.valueText})]}):u.kind==="enum"?y.jsx("select",{value:u.value,style:{flex:1,background:"#1a1a1a",color:"#ccc",border:"1px solid #2a2a2a",borderRadius:"2px",font:"11px ui-monospace,Menlo,Consolas,monospace"},onChange:function(h){l(u,h.target.value)},children:u.values.map(function(h){return y.jsx("option",{value:h,children:h},h)})}):y.jsx("span",{style:dm,children:u.valueText})]},u.id)}),c]})}function vM({experimentBase:e,monacoBaseUrl:t,initialProject:n,deepLinkRefusal:r,roster:i,initialWalkthrough:o,initialWalkthroughMode:s,initialScene:a,initialSceneRenderer:l,resolveScript:c,onLinkSelect:u}){if(!e||typeof c!="function")throw new Error("[AuthorView] experimentBase and resolveScript are required — mount AuthorView through FraqtlIde (lib/features/ide/index.jsx), the only mounter, which derives both from its engineRouter.");Jt(i,"AuthorView({ experimentBase, roster, resolveScript, … })");var d=j.useRef(null),f=j.useRef(null),h=j.useRef(null),v=j.useRef(null),m=j.useRef(null),x=j.useRef(null),b=j.useRef(null),g=j.useRef(null),k=j.useRef(null),E=j.useRef(null),C=j.useRef(null),S=j.useRef({runner:null,backdrop:null,Filters:null,cw:null,tool:null,dropType:null,controlsRegistry:null,controlsNameByObject:null,controlsNameCounters:null}),M=j.useRef({active:!1,lo:null,startX:0,startY:0,zone:null,origBbox:null}),[L,T]=j.useState({projectId:null,name:Wc,dirty:!1}),[V,G]=j.useState([]),[N,te]=j.useState([]),[W,Y]=j.useState(null),[re,pe]=j.useState([]),B=j.useRef([]),[ee,ce]=j.useState(null),ve=j.useRef(null),[ke,je]=j.useState(function(){return fs(e)}),[ie,me]=j.useState(or),xe=j.useRef(or),[ge,kt]=j.useState(!1),[ut,_n]=j.useState(null),[tn,ir]=j.useState(null),ht=tn?tn.text:null;function ye(p,w){ir(p==null?null:{source:w||"general",text:String(p)})}function St(p){ir(function(w){return w&&w.source===p?null:w})}var[ln,Wn]=j.useState(null),An=j.useRef(!1),Pn=j.useRef(null),[Mn,vr]=j.useState({particles:!0,backdrop:!1}),[Xt,Pt]=j.useState([]),[Ut,Et]=j.useState(null),De=j.useRef(null),Tn=j.useRef(null),[I,de]=j.useState(null),[fe,Ie]=j.useState({fpsLimit:0,tpsLimit:0}),[Ft,cn]=j.useState(null),[Xe,un]=j.useState(null),[Pe,Mt]=j.useState({phase:"idle"}),[Wt,Dn]=j.useState(0),lt=j.useRef(null),we=j.useRef(null),[pt,_]=j.useState(null),[R,P]=j.useState(null),$=j.useRef(null),U=j.useRef(null),[H,he]=j.useState(null),[Ae,Ve]=j.useState(0),[Qe]=j.useState(function(){return Bk(window)}),[Be,Ce]=j.useState(!Qe),[qe,nn]=j.useState(!Qe),[F,K]=j.useState(null),[We,kn]=j.useState({}),[Nt,Sn]=j.useState(null),[bt,ct]=j.useState(null),[$r,lo]=j.useState([]),[wE,yv]=j.useState([]),[_E,bv]=j.useState(null),[Pr,kE]=j.useState(null),[SE,ac]=j.useState(!1),[bf,xv]=j.useState(""),[co,ua]=j.useState(null),[uo,xf]=j.useState(!1),wv=j.useRef(null),[_v,EE]=j.useState(0);j.useEffect(function(){var p=wv.current,w=p?p.offsetWidth:0;w!==_v&&EE(w)});var lc=j.useRef({host:null,frame:null,frameCw:null});function cc(){var p=S.current.cw,w=S.current.runner;w&&p&&Ha(p,"runner")===w?Vt(w,S.current.backdrop,De.current):Ef()}j.useEffect(function(){var p=f.current&&f.current.parentElement;if(!p||typeof ResizeObserver!="function")throw new Error("[AuthorView] the canvas region (or ResizeObserver) is missing — the overlay is re-measured when the region's box changes. (FAIL-LOUD.)");var w=new ResizeObserver(function(){cc()});return w.observe(p),window.addEventListener("resize",cc),lc.current.host=w,function(){w.disconnect(),window.removeEventListener("resize",cc);var O=lc.current.frame;if(O)try{O.disconnect()}catch{}lc.current={host:null,frame:null,frameCw:null}}},[]);function kv(p){var w=lc.current;if(w.frameCw!==p){if(w.frame)try{w.frame.disconnect()}catch{}if(typeof p.ResizeObserver!="function")throw new Error("[AuthorView] the experiment frame has no ResizeObserver — the overlay follows the frame's canvas box through it. (FAIL-LOUD.)");w.frame=new p.ResizeObserver(function(){cc()}),w.frameCw=p}var O=p.document.getElementById("canvas-wrapper");O&&w.frame.observe(O);for(var A=p.document.querySelectorAll("canvas"),D=0;D<A.length;D++)w.frame.observe(A[D])}var[wf,Sv]=j.useState(!1),[Vn,OE]=j.useState(null),rt=j.useRef(null),[CE,uc]=j.useState(null),ns=j.useRef("seed"),_f=j.useRef(!1);function Mr(p){var w=typeof p=="function"?p(rt.current):p;rt.current=w,OE(w)}function da(){var p=Ha(S.current.cw,"experiment");return p&&typeof p.toSketch=="function"?p:null}function fa(){return rt.current?mA(rt.current):null}function Ev(p){if(typeof p[$o(fa())]!="string")throw new Error("the facade wrote no entry sketch (files: "+Object.keys(p).join(", ")+")");Mr(Hb(rt.current,p))}function kf(p){return rm+" (unrun: "+Eu(p).join(", ")+")"}function Ov(p){Mr(function(w){var O=Dr(w);return ms(O)||Sa(w,O).text===p?w:Ub(w,O,p)})}function jE(p){var w=Eu(p);return y.jsx("div",{style:_e.filePickerRow,children:y.jsx("select",{"data-role":"studio-file-picker",value:Dr(p),style:_e.filePicker,onChange:function(O){var A=O.target.value;Mr(function(D){return Bb(D,A)})},children:SS(p).map(function(O){return y.jsx("option",{value:O,children:O+(ms(O)?" (read-only)":"")+(w.indexOf(O)!==-1?" (edited)":"")},O)})})})}function Kr(p){var w=rt.current,O=da();return!w||!O?(ye(p+" is not written into code — the scene's sketch text has not loaded, so a hand moves the running scene only.","hand"),Promise.resolve()):xh(w)?(ye(p+" refused — "+kf(w),"hand"),Promise.resolve()):O.toSketch().then(function(A){Ev(A.files),A.refused.length?ye(p+" — not written: "+A.refused.map(function(D){return D.reason}).join(" "),"hand"):St("hand")}).catch(function(A){ye(p+" could not be written into the code: "+(A&&A.message?A.message:A),"hand")})}j.useEffect(function(){xe.current=ie},[ie]),j.useEffect(function(){S.current.tool=pt,Av()},[pt]),j.useEffect(function(){S.current.dropType=R},[R]),j.useEffect(function(){De.current=Ut},[Ut]),j.useEffect(function(){rs()},[]),j.useEffect(function(){var p=!0;return tP({refusal:r,walkthrough:o,mode:s,project:n,scene:a,renderer:l},{roster:i,pageOrigin:window.location.origin,baseURI:document.baseURI,loadProject:function(w){return kh(gn(),w)}}).then(function(w){p&&(w.select&&ho(w.select.value,w.select.mode,w.select.opts),An.current=w.run,w.err&&Wn(w.err),AS(document.documentElement,w.id),w.id==="ok"&&w.select&&w.select.value.indexOf("walkthrough:")===0&&_n({id:w.select.value.slice(12),modeId:w.select.mode}))},function(w){p&&ye("STUDIO could not resolve its deep link: "+(w&&w.message?w.message:w))}),function(){p=!1}},[]),j.useEffect(function(){var p=g.current,w=b.current;if(!ut||!p||!w)return;var O=hS(i,ut),A=mS(i);if(!O){var D=ea(i,ut),z=D+" has no showcase-roster row",oe=Us(p,D,"not-offered-no-roster-row",z),Q=Us(w,A?A.seenKey:D,"not-offered-no-roster-row",z);return function(){oe.close(),Q.close()}}var J=pS(i,O),ne=sP(i,ut),Fe=null;function Me(){Fe||(Fe=dP(C.current,i,ne,{onPhone:Qe,dock:Qe?"top":"flow",runnerOf:function(){return S.current.runner},exportsOf:function(){var Ue=da();return Ue&&Ue.world?Ue.sceneExports:null},onError:function(Ue){ye(Ue,"tryit")}}))}var it={seenKey:J.seenKey,title:J.title,paragraphs:J.paragraphs};ne&&(it.onContinue=Me);var le=Pl(p,it,{covers:E.current});ne&&le.ready.then(function(Ue){Ue.shows||Me()});var Oe=A?Pl(w,A,{covers:k.current}):Us(w,J.seenKey,"not-offered-no-roster-row",J.seenKey+": the roster has no showcase intro");return function(){Oe.close(),le.close(),Fe&&Fe.close()}},[ut]),j.useEffect(function(){!ge||!An.current||(An.current=!1,qv())},[ge]);function rs(){var p;try{p=gn()}catch{G([]),te([]);return}G(_A(p).map(function(w){return{id:w.name,name:w.name}})),te(kA(p))}function RE(){var p=N;if(p.length&&window.confirm("Delete "+p.length+" save"+(p.length===1?"":"s")+" in the retired project format? They cannot be opened, and this cannot be undone.")){try{SA(gn(),p)}catch(w){ye("Delete retired saves failed: "+(w&&w.message?w.message:w),"retired")}rs()}}function Cv(){var p=S.current.runner,w=S.current.cw,O=S.current.backdrop;if(!p||!w)return null;var A=cx(w),D=null,z=null;try{var oe=new URLSearchParams(w.location.search);D=oe.get("engine"),z=oe.get("seed")}catch{}var Q=ot(w).MakeControlsForRenderSurface.makeControlsForRenderSurface({runner:p}),J=kP(Q.controls).concat(B.current),ne=p.cameraControl||null,Fe=ne?{orbit:ne.getOrbit(),preset:bt||ve.current||null}:null,Me=_P(O);return yi({version:1,renderer:A,engine:D,seed:z,backdropVisible:Me,camera:Fe,render:J})}function LE(p,w,O){if(!(!O||!p||!w)){if(!p.FrqtlPage||typeof p.FrqtlPage.applyRenderState!="function")throw new Error("the STUDIO frame has no FrqtlPage.applyRenderState — a saved render state is replayed only on the blank universe page (experiments/empty/index.html). (FAIL-LOUD.)");var A=p.FrqtlPage.applyRenderState(O);B.current=A.retained,pe(A.retained);var D=A.camera==="retained"?A.preset:null;return ve.current=D,ce(D),(A.camera==="preset"||A.camera==="orbit")&&(Sn(w.cameraControl.getOrbit()),ct(A.preset),Af(w)),A.backdrop!==null&&vr(function(z){return Object.assign({},z,{backdrop:A.backdrop})}),A}}function jv(p){var w;try{w=Cv()}catch(O){return ye(p+" refused — "+(O&&O.message?O.message:O)),{ok:!1}}return!w&&L.walkthroughId&&(w=Qi(Kt(i,L.walkthroughId),L.walkthroughMode)),{ok:!0,state:w}}function Rv(p,w){window._egptPendingFolder=Object.assign({},p),Y(null),ns.current="run",window._egptPendingRenderState=w;var O=w?{renderer:w.renderer,seed:w.seed}:null;uc(null),kt(!1),ye(null),Et(null),De.current=null,Pt([]),me(or),je(fs(e,O)+"&_r="+Date.now())}function AE(p){if(!(typeof p!="string"||!rt.current)){var w=Dr(rt.current);!ms(w)&&p!==Sa(rt.current,w).text&&Mr(Ub(rt.current,w,p));var O=jv("Run");O.ok&&(T(function(A){return Object.assign({},A,{dirty:!0})}),Rv(bh(rt.current),O.state))}}function Lv(){var p=rt.current?Dr(rt.current):null,w=rt.current?$o(fa()):null;return L.walkthroughId?p===w?Kt(i,L.walkthroughId).source:L.walkthroughId+"/"+p:L.projectId&&p?L.projectId+"/"+p:L.sceneUrl?L.name+"/"+(p||w):of+"/"+(p||w)}function PE(){if(uc(null),L.walkthroughId){ho("walkthrough:"+L.walkthroughId,L.walkthroughMode);return}if(L.projectId){ho("project:"+L.projectId);return}if(L.sceneUrl&&Pn.current){ho(Lo+L.sceneUrl,null,{quiet:!0,folder:Pn.current.folder,link:Pn.current.link});return}ho(Wc)}function dc(p){return rt.current?!1:(ye(p+" refused — this scene has no sketch text (the scene has not finished loading)."),!0)}function Av(){var p=S.current.cw;try{var w=p&&p.document.querySelector("canvas");w&&(w.style.cursor=Vc[S.current.tool]||"default")}catch{}}var qn=j.useCallback(function(p){Pt(p?Eh(p.declared):[])},[]),Vt=j.useCallback(function(p,w,O,A){var D=f.current;if(D){var z=D.getContext("2d");if(z){var oe=A??xe.current;if(Ef(),!p){z.clearRect(0,0,D.width,D.height);return}if(is(p)){z.clearRect(0,0,D.width,D.height);return}var Q=Eh(p.declared);if(oe===sr){if(!O){z.clearRect(0,0,D.width,D.height);return}Q=Q.filter(function(J){return J&&J.ref===O})}rM(z,Q,O||null,p,fc)}}},[]);function is(p){var w=S.current.cw;if(!w)throw new Error("[AuthorView] no experiment frame is grabbed — OrbitBag.hasAngularPose, the ONE 3D-ness predicate (lib/frqtl/compat/renderer/orbit-bag.js), is read off the frame's modules. (FAIL-LOUD.)");return ot(w).OrbitBag.hasAngularPose(p?p.cameraControl:null)}function os(p,w,O){var A=S.current.runner,D=A&&A.renderer;if(!D||typeof D.screenToWorld!="function")throw new Error("[AuthorView] the active renderer provider has no screenToWorld capability (RENDERER_CONTRACT) — STUDIO maps the canvas only through the camera's own screenToWorld. (FAIL-LOUD.)");var z=f.current;return D.screenToWorld(p,w,z.width,z.height,O)}function ME(p,w){return ot(S.current.cw).LoDrawnCenter.drawnCenter(p.envelopeOf(w))[2]}function Pv(p,w){var O=f.current,A=S.current.runner.screenPointOf([p,w,0],O.width,O.height);return A?{x:A[0],y:A[1]}:null}function fc(p){if(!p)return null;var w=Pv(p.left,p.top),O=Pv(p.left+p.width,p.top+p.height);return!w||!O?null:{left:w.x,top:w.y,width:O.x-w.x,height:O.y-w.y}}function Sf(){if(Qe){var p=d.current,w=f.current,O=w&&w.parentElement,A=null;try{A=p&&p.contentDocument}catch{A=null}var D=A?A.querySelectorAll('[data-role="camera-joystick"]'):[],z=null;if(O&&D.length===2){var oe=D[0].getBoundingClientRect(),Q=D[1].getBoundingClientRect(),J=p.getBoundingClientRect(),ne=O.getBoundingClientRect(),Fe=oe.left<Q.left?oe:Q,Me=oe.left<Q.left?Q:oe;z={x:J.left-ne.left+(Fe.right+Me.left)/2,y:J.top-ne.top+(Fe.top+Fe.bottom)/2}}K(function(it){return it===z||it&&z&&it.x===z.x&&it.y===z.y?it:z})}}function Ef(){Sf();var p=f.current;if(p){var w=d.current,O=null;try{if(w&&w.contentDocument){for(var A=w.contentDocument.querySelectorAll("canvas"),D=0;D<A.length;D++){var z=A[D].getBoundingClientRect();if(z.width>0&&z.height>0){O=A[D];break}}!O&&A.length&&(O=A[0])}}catch{}if(!O){var oe=p.parentElement;oe&&(p.style.left="0",p.style.top="0",p.style.width="100%",p.style.height="100%",p.style.right="",p.style.bottom="",p.width=oe.clientWidth,p.height=oe.clientHeight);return}var Q=O.getBoundingClientRect(),J=w.getBoundingClientRect(),ne=p.parentElement?p.parentElement.getBoundingClientRect():J,Fe=J.left-ne.left+Q.left,Me=J.top-ne.top+Q.top,it=Q.width,le=Q.height,Oe=Math.round(it),Ue=Math.round(le);p.width!==Oe&&(p.width=Oe),p.height!==Ue&&(p.height=Ue),kE(function(X){return X&&X.left===Fe&&X.top===Me&&X.width===it&&X.height===le?X:{left:Fe,top:Me,width:it,height:le}})}}function Of(p,w,O){if(p.controlsNameByObject||(p.controlsNameByObject=new WeakMap),p.controlsNameByObject.has(O))return p.controlsNameByObject.get(O);p.controlsNameCounters||(p.controlsNameCounters={}),p.controlsNameCounters[w]=(p.controlsNameCounters[w]||0)+1;for(var A=O&&typeof O.name=="string"&&O.name?O.name:w+"#"+p.controlsNameCounters[w],D=A,z=1;p.controlsRegistry&&p.controlsRegistry.hasObject(D);)D=A+"_"+ ++z;return p.controlsNameByObject.set(O,D),D}function Mv(p,w){var O=S.current.cw,A=S.current.runner,D=S.current.controlsRegistry;if(!(!O||!A||!D||!p)){var z=Of(S.current,w,p);if(!D.hasObject(z)){var oe;try{oe=ot(O).MakeControlsForObject.makeControlsForObject(p,{},{kind:w,name:z})}catch(J){window.console&&console.error&&console.error("[AuthorView] makeControlsForObject failed for "+w+' "'+z+'":',J);return}var Q=oe.controls.map(function(J){return Object.assign({},J,{onChange:function(ne){A.updateObjectProperty(p,J.bind.prop,ne),Kr("Knob")}})});D.registerObject(z,p,w),D.registerControls(z,Q)}}}function TE(p){var w=S.current.controlsRegistry;if(!(!w||!p||!S.current.controlsNameByObject)){var O=S.current.controlsNameByObject.get(p);O&&(w.hasControls(O)&&w.unregisterControls(O),w.hasObject(O)&&w.unregisterObject(O))}}function Cf(){var p=S.current.runner;p&&p.declared.forEach(function(w){Mv(w,w._schemaKind)})}function jf(p,w,O,A,D,z){p.updateObjectProperty(w,"rect",ot(S.current.cw).LoDrawnCenter.snapRectPosition([O,A,D,z]))}function Tv(p){var w=S.current.cw;if(!cr(w)||!p)return null;var O=ot(w).ObjectSchema;try{return O.ux(p._schemaKind)}catch{return null}}function Dv(p,w){if(!w||w==="move")return w;var O=Tv(p);return O&&(O.resizable===!1||Array.isArray(O.handles)&&O.handles.indexOf(w)===-1)?"move":w}function DE(p,w,O){for(var A=ot(p).ObjectSchema.placeableCatalog(),D=0;D<A.length;D++)if(A[D].kind===w&&A[D].defaultProps&&Object.prototype.hasOwnProperty.call(A[D].defaultProps,"is2D"))return{is2D:!O};return null}function Iv(p,w,O){var A=S.current.cw,D=S.current.runner,z=S.current.backdrop,oe,Q;Promise.resolve().then(function(){if(!A||!D)throw new Error("the canvas frame has no "+[!A&&"window (ctx.cw)",!D&&"experiment runner (FrqtlPage.runner)"].filter(Boolean).join(" and no ")+" — nothing to place into.");var J=IE(w,O);oe=J.x,Q=J.y;var ne=DE(A,p,is(D));return ne}).then(function(J){var ne=RA(p,D,A,oe,Q,J);Mv(ne,ne._schemaKind),qn(D,z),Et(ne),De.current=ne,fo(D),Vt(D,z,ne),T(function(Fe){return Object.assign({},Fe,{dirty:!0})}),Kr("Drop"),Fv(),St("drop")}).catch(function(J){window.console&&console.error&&console.error("[AuthorView] place "+p+" failed:",J),Fv(),ye("Place "+p+" failed: "+(J&&J.message?J.message:J),"drop")})}function IE(p,w){var O=os(p,w,0);if(!O)throw new Error("that canvas point does not meet the drop plane (z = 0) from this camera view — drop where the scene is visible.");return O}function Fv(){_("hand"),P(null),S.current.tool="hand",S.current.dropType=null}function FE(){var p=f.current;if(!p||p.__egptOverlayHandlers)return;p.__egptOverlayHandlers=!0;var w=bP({hitTest:function(X,Se){var se=S.current.runner,ae=se?Rf(se,X,Se):null;return ae?ae.ref:null},handArmed:function(){return S.current.tool==="hand"},emit:function(X){X.kind==="press"?O(X.x,X.y):X.kind==="drag"?D(X.x,X.y):X.kind==="hover"?oe(X.x,X.y):X.kind==="release"?Q():X.kind==="hold"?J(X.x,X.y):X.kind==="reset"?VE():X.kind==="world"?Fe(X):X.kind==="object"&&Ue(X)}});xP(p,w);function O(X,Se){var se=S.current.runner;if(se){var ae=S.current.backdrop,be=S.current.tool;if(be){if(be==="dropper"){S.current.dropType&&Iv(S.current.dropType,X,Se);return}var $e=is(se),Je=Rf(se,X,Se);if(Je){var mt=Je.ref;if(Et(mt),De.current=mt,qn(se,ae),Vt(se,ae,mt),be==="pencil"){$e&&(p.style.cursor="default");return}A(se,mt,Je.zone,X,Se)}else Et(null),De.current=null,Vt(se,ae,null),M.current.active=!1,$e&&(p.style.cursor="default")}}}function A(X,Se,se,ae,be){if(!X.positionAuthorityOf(Se)){ye("Not moved: "+X.noPositionAuthorityMessage(Se),"drag"),p.style.cursor="not-allowed";return}St("drag");var $e=Ua(Se,X),Je=ME(X,Se),mt=os(ae,be,Je);if(!mt){p.style.cursor="not-allowed";return}M.current={active:!0,lo:Se,startX:mt.x,startY:mt.y,planeZ:Je,zone:se,origBbox:$e?Object.assign({},$e):null},p.style.cursor=lx(se)}function D(X,Se){var se=S.current.runner;if(se){var ae=S.current.backdrop,be=M.current;if(!(!be.active||!be.lo)){var $e=os(X,Se,be.planeZ);if($e){var Je={x:$e.x-be.startX,y:$e.y-be.startY};if(be.moved=!0,be.origBbox){var mt=be.origBbox;if(be.zone==="move"||!be.zone){var gc=se.envelopeOf(be.lo);jf(se,be.lo,mt.left+Je.x,mt.top+Je.y,gc.w,gc.h)}else{var wi=oM(mt,be.zone,Je);jf(se,be.lo,wi.left,wi.top,wi.width,wi.height)}}z(se,ae,be.lo)}}}}function z(X,Se,se){qn(X,Se),Vt(X,Se,se);try{X.repaint()}catch(ae){window.console&&console.warn&&console.warn("[AuthorView] hand: repaint() failed:",ae)}T(function(ae){return Object.assign({},ae,{dirty:!0})})}function oe(X,Se){var se=S.current.runner;if(se){var ae=De.current;if(ae&&!is(se)){var be=Ua(ae,se);if(be){var $e=fc(be),Je=Dv(ae,Lh($e,{x:X,y:Se}));p.style.cursor=Je?lx(Je):Vc[S.current.tool]||"default";return}}p.style.cursor=Vc[S.current.tool]||"default"}}function Q(){if(M.current.active){var X=!!M.current.moved;M.current={active:!1,lo:null,startX:0,startY:0,zone:null,origBbox:null},p&&(p.style.cursor=Vc[S.current.tool]||"default"),X&&Kr("Move")}}function J(X,Se){var se=S.current.runner;if(se){var ae=Rf(se,X,Se);ae&&(Et(ae.ref),De.current=ae.ref,qn(se,S.current.backdrop),Vt(se,S.current.backdrop,ae.ref))}}var ne=null;function Fe(X){var Se=S.current.runner,se=Se&&Se.cameraControl;if(X.phase==="begin"){ne=se?{pose:se.getOrbit(),refusedSaid:{}}:{pose:null,refusedSaid:{}},se||Me(ne,"camera","this scene's renderer publishes no camera handle (getCameraControl).");return}if(X.phase==="end"){ne=null;return}if(!(!ne||!ne.pose||!se)){var ae=gP(ne.pose,X,se.poseFields,p.width);ae.refused.forEach(function(Je){Me(ne,Je.gesture,"this camera declares no "+Je.axes.join("/")+" axis (its poseFields: "+se.poseFields.map(function(mt){return mt.name}).join(", ")+").")});var be=ae.patch;if(X.fingers===2&&X.pan&&!ae.refused.some(function(Je){return Je.gesture==="pan"})){var $e=it(Se,se,X.pan.from,X.pan.to);$e&&(be.target=$e)}Object.keys(be).length&&Lf(be)}}function Me(X,Se,se){X.refusedSaid[Se]||(X.refusedSaid[Se]=!0,console.error("[AuthorView] touch "+Se+" refused: "+se+" (FAIL-LOUD.)"))}function it(X,Se,se,ae){var be=le(Se),$e=os(se.x,se.y,be.z),Je=os(ae.x,ae.y,be.z);return!$e||!Je?null:{x:be.x-(Je.x-$e.x),y:be.y-(Je.y-$e.y),z:be.z}}function le(X){var Se=X.getOrbit();if(Se.target)return{x:Se.target.x,y:Se.target.y,z:Se.target.z||0};if(typeof X.worldFromCameraOffset=="function"){var se=X.worldFromCameraOffset({right:0,up:0,forward:Se.distance});return{x:se[0],y:se[1],z:se[2]}}if(is(S.current.runner))throw new Error("[AuthorView] the angular camera has no worldFromCameraOffset, so its orbit centre cannot be read for a pan. (FAIL-LOUD.)");var ae=os(p.width/2,p.height/2,0);return{x:ae.x,y:ae.y,z:0}}var Oe=null;function Ue(X){var Se=S.current.runner;if(Se){if(X.phase==="begin"){var se=X.target;Et(se),De.current=se;var ae=Se.envelopeOf(se),be=Tv(se),$e=ot(S.current.cw).ObjectSchema.get(se._schemaKind).fields,Je=$e.some(function(Nf){return Nf.name==="orientationDeg"}),mt=Je?typeof se.orientationDeg=="number"?se.orientationDeg:0:null,gc=ot(S.current.cw).LoDrawnCenter.drawnCenter(ae);Oe={handle:se,env:Object.assign({},ae),orientation:mt,resizable:!!(be&&be.resizable===!0),handedness:Je?vP(function(Nf){return Se.screenPointOf(Nf,p.width,p.height)},gc,mt):null,refusedSaid:{}};return}if(X.phase==="end"){Oe&&Oe.wrote&&Kr(Oe.wrote),Oe=null;return}if(Oe){var wi=!1;if(X.active.rotate&&(Oe.orientation===null?Me(Oe,"rotate",Oe.handle._schemaKind+" declares no orientationDeg field."):(Se.updateObjectProperty(Oe.handle,"orientationDeg",yP(Oe.orientation,X.twistDeg,Oe.handedness)),wi=!0,Oe.wrote="Rotate")),X.active.resize)if(!Oe.resizable)Me(Oe,"resize",Oe.handle._schemaKind+" does not declare itself resizable (ux.resizable).");else{var as=Oe.env,iy=Math.max(1,as.w*X.scale),oy=Math.max(1,as.h*X.scale);jf(Se,Oe.handle,as.left+(as.w-iy)/2,as.top+(as.h-oy)/2,iy,oy),wi=!0,Oe.wrote=Oe.wrote==="Rotate"?"Rotate":"Resize"}wi&&z(Se,S.current.backdrop,Oe.handle)}}}}function Rf(p,w,O){if(is(p)){var A=f.current,D=typeof p.pickObjectAtScreen=="function"?p.pickObjectAtScreen(w,O,A.width,A.height):null;return D?{ref:D,zone:"move"}:null}var z=De.current;if(z){var oe=Ua(z,p);if(oe){var Q=Dv(z,Lh(fc(oe),{x:w,y:O}));if(Q)return{ref:z,zone:Q}}}for(var J=Eh(p.declared),ne=J.length-1;ne>=0;ne--)if(p.isPointable(J[ne].ref)){var Fe=Ua(J[ne].ref,p);if(Fe&&Lh(fc(Fe),{x:w,y:O}))return{ref:J[ne].ref,zone:"move"}}return null}function NE(p){typeof p.setDesignMode=="function"&&p.setDesignMode(!0),p.stop(),p.step()}function fo(p){if(!(!p||typeof p.repaint!="function"))try{p.repaint()}catch(w){window.console&&console.warn&&console.warn("[AuthorView] repaint() after a scene mutation failed:",w)}}function zE(p,w,O){if(O.__studioScenePreApplied){O.__studioScenePreApplied=!1;try{Cf(),qn(p,w),Vt(p,w,null),fo(p)}catch(A){ye("Recipe load failed: "+(A&&A.message?A.message:A)),window.console&&console.error&&console.error("[AuthorView] _consumePendingModule failed:",A)}}}function BE(p){if(!(!p||!p.FrqtlPage||typeof p.FrqtlPage.isReady!="function"||!p.FrqtlPage.isReady())&&!p.__studioSceneApplying){p.__studioSceneApplying=!0;var w=window._egptPendingFolder;window._egptPendingFolder=void 0;var O=ns.current;ns.current="seed";var A=w||xS({router:{resolve:c}}).then(function(z){return z.files}),D=null;Promise.resolve(A).then(function(z){return D=z,O==="seed"||!rt.current?Mr(hA(z)):O==="run"&&Mr(pA(rt.current,z)),p.FrqtlPage.applyModuleSource({files:z})}).then(function(){p.__studioScenePreApplied=!0}).catch(function(z){var oe=z&&z.message?z.message:String(z);if(ye("Scene load failed: "+oe),O==="run"&&D!==null){var Q=kS(z);uc({message:oe,line:Q?Q.line:void 0,col:Q?Q.col:void 0}),Sv(!0),xf(!0)}})}}var Nv=j.useCallback(function(){var p=d.current,w=p&&p.contentWindow;if(!w)return!1;if(!Ha(w,"runner")){try{(!p.src||!w.location||w.location.href===p.src)&&BE(w)}catch{}return!1}try{if(p.src&&w.location&&w.location.href!==p.src)return!1}catch{}if(!nc(w))return CA(w,{resolve:c}).catch(function(le){ye("STUDIO cannot drive this frame: "+(le&&le.message?le.message:le)),window.console&&console.error&&console.error("[AuthorView] frame modules not loaded:",le)}),!1;var O=Ha(w,"runner"),A=wP(w,O),D=ot(w).Filters,z=SP(S.current.runner,O);if(S.current.writeQueue&&typeof S.current.writeQueue.dispose=="function"&&S.current.writeQueue.dispose(),S.current={runner:O,backdrop:A,Filters:D,cw:w,tool:S.current.tool,dropType:S.current.dropType,controlsRegistry:ot(w).ControlRegistry.makeControlRegistry(),controlsNameByObject:new WeakMap,controlsNameCounters:{},writeQueue:ot(w).FrqtlControlWriteQueue.makeControlWriteQueue()},typeof O=="object"&&O&&(O._onObjectMoved=function(){var le=S.current.runner;le&&(typeof le.getGrabbedObject=="function"&&le.getGrabbedObject()&&(_f.current=!0),qn(le,S.current.backdrop),Vt(le,S.current.backdrop,De.current))}),Promise.resolve().then(Cf).catch(function(le){window.console&&console.error&&console.error("[AuthorView] scene controls not registered:",le),ye("Scene controls not registered: "+(le&&le.message?le.message:le))}),z&&O&&!O._liveChartsMounted){O._liveChartsMounted=!0;var oe=!1;w.addEventListener("pagehide",function(){oe=!0,O._liveChartsMount&&(O._liveChartsMount.dispose(),O._liveChartsMount=null)},{once:!0});try{QS(O,{document:w.document}).then(function(le){if(oe){le.dispose();return}O._liveChartsMount=le}).catch(function(le){window.console&&console.error&&console.error("[AuthorView] mountLiveCharts failed:",le)})}catch(le){window.console&&console.error&&console.error("[AuthorView] mountLiveCharts threw:",le)}}var Q=O._renderOptions||{};vr({particles:Q.renderBaseCanvas!==!1,backdrop:A?A.visible!==!1:!1}),typeof O.getRateLimits=="function"&&Ie(O.getRateLimits());var J=O.cameraControl||null;if(z&&ct(null),Sn(J?J.getOrbit():null),lo(ux(J)),yv(dx(J)),bv(!!(O.renderer&&typeof O.renderer.screenToWorld=="function")),z&&Hv(),J||cM(w,function(){var le=S.current.runner;if(le===O){var Oe=le.cameraControl||null;Oe&&(Sn(Oe.getOrbit()),lo(ux(Oe)),yv(dx(Oe)),bv(!!(le.renderer&&typeof le.renderer.screenToWorld=="function")),Uv(w,le),Pf(le,xe.current,S.current.tool),m.current||(m.current={orbit:Oe.getOrbit(),preset:null}),kv(w),Sf())}}),qn(O,A),Ef(),kv(w),FE(),Av(),z){NE(O),me(or);var ne=x.current;if(!ne)throw new Error("[AuthorView] the control host element is not mounted — STUDIO hands it to the runner (runner.controlHost) so a scene knob is reachable above the overlay. (FAIL-LOUD.)");for(;ne.firstChild;)ne.removeChild(ne.firstChild);O.controlHost=ne}if(zE(O,A,w),Uv(w,O),Sf(),z&&typeof O.addAimListener=="function"){Tn.current&&Tn.current();var Fe=null;Tn.current=O.addAimListener(function(le){if(S.current.runner===O){if(le.state!=="grabbed"&&_f.current&&(_f.current=!1,Kr("Carry")),le.state==="grabbed"){var Oe=O.getGrabbedObject();Oe&&Oe!==De.current&&(De.current=Oe,Et(Oe),qn(O,S.current.backdrop))}le.error&&le.error!==Fe&&ye("Not held: "+le.error,"aim"),le.error||St("aim"),Fe=le.error}})}z&&(B.current=[],pe([]),ve.current=null,ce(null)),z&&(m.current=null);var Me=null;if(window._egptPendingRenderState!==void 0){var it=window._egptPendingRenderState;window._egptPendingRenderState=void 0;try{Me=LE(w,O,it)}catch(le){throw ye("Saved render state could not be applied: "+(le&&le.message?le.message:le)),le}}return z&&O.cameraControl&&(m.current={orbit:O.cameraControl.getOrbit(),preset:Me&&Me.camera==="preset"?Me.preset:null}),Vt(O,A,De.current,z?or:xe.current),kt(!0),!0},[qn,Vt]);j.useEffect(function(){var p=0,w=null,O=!1;function A(){if(!O&&!Nv()){if(++p>120){ye("Timed out waiting for the experiment runner.");return}w=setTimeout(A,150)}}var D=d.current;function z(){p=0,kt(!1),ye(null),A()}return D&&D.addEventListener("load",z),A(),function(){O=!0,D&&D.removeEventListener("load",z),w&&clearTimeout(w)}},[Nv,ke]),j.useEffect(function(){return function(){Hv(),Tn.current&&(Tn.current(),Tn.current=null)}},[]),j.useEffect(function(){if(ge){var p=setInterval(function(){var w=S.current.runner;if(w){typeof w.getRates=="function"&&de(w.getRates()),typeof w.getRateLimits=="function"&&Ie(w.getRateLimits());var O=w.isRunning?sr:or;xe.current!==O&&me(O)}},1e3);return function(){clearInterval(p)}}},[ge]);function zv(p,w){var O=S.current.runner;if(!(!O||typeof O.setRateLimits!="function")){var A=w==="Inf"?1/0:Number(w);if(!(isNaN(A)||A<0))try{var D={};D[p]=A,O.setRateLimits(D),Ie(O.getRateLimits())}catch(z){window.console&&console.warn&&console.warn("[AuthorView] setRateLimits failed:",z&&z.message?z.message:z)}}}function UE(p){var w=S.current.runner;w&&w.setRenderOption("renderBaseCanvas",p),vr(function(O){return Object.assign({},O,{particles:p})}),T(function(O){return Object.assign({},O,{dirty:!0})})}function Bv(p){var w=S.current.runner,O=S.current.backdrop;w&&O&&w.updateObjectProperty(O,"visible",p),vr(function(A){return Object.assign({},A,{backdrop:p})}),T(function(A){return Object.assign({},A,{dirty:!0})})}function HE(p,w){var O=S.current.runner;try{O.updateObjectProperty(p.ref,"visible",w)}catch(A){ye("Visibility not changed: "+(A&&A.message?A.message:A));return}qn(O),fo(O),Kr("Visibility")}function WE(p){var w=cr(S.current.cw)?ot(S.current.cw).ObjectSchema.get(p):null;return!!(w&&w.fields.some(function(O){return O.name==="visible"}))}function Uv(p,w){if(!(!p||!w)&&!(v.current&&v.current.cw===p)){var O=p.document&&p.document.getElementById("canvas-wrapper");if(O&&!p.document.querySelector('[data-role="camera-joystick"]')){var A=ot(p).CameraControls.attach(w,O);A&&A.mounted&&(v.current={handle:A,cw:p})}}}function Hv(){var p=v.current;if(p&&p.handle&&typeof p.handle.dispose=="function")try{p.handle.dispose()}catch{}v.current=null}function Lf(p){var w=S.current.runner;!w||!w.cameraControl||(w.cameraControl.setOrbit(p),Sn(w.cameraControl.getOrbit()),ct(null),Af(w))}function Af(p){fo(p),Vt(p,S.current.backdrop,De.current)}function VE(){var p=S.current.runner;if(!p||!p.cameraControl){console.error("[AuthorView] touch reset refused: this scene's renderer publishes no camera handle (getCameraControl). (FAIL-LOUD.)");return}var w=m.current;if(!w)throw new Error("[AuthorView] the scene's opening camera was never read, so a double tap has no view to return to. (FAIL-LOUD.)");w.preset?Wv(w.preset):Lf(w.orbit)}function Wv(p){var w=S.current.runner;!w||!w.cameraControl||typeof w.cameraControl.setPreset!="function"||(w.cameraControl.setPreset(p),Sn(w.cameraControl.getOrbit()),ct(p),ve.current=null,ce(null),Af(w))}function Vv(){var p=S.current.runner,w=De.current;!p||!w||(TE(w),p.removeObject(w),Et(null),De.current=null,qn(p,S.current.backdrop),Vt(p,S.current.backdrop,null),T(function(O){return Object.assign({},O,{dirty:!0})}),Kr("Delete"))}j.useEffect(function(){var p=S.current.runner;p&&typeof p.setSelectHighlight=="function"&&(p.setSelectHighlight(Ut||null),fo(p))},[Ut]);function Pf(p,w,O){if(!(!p||typeof p.setAimArmed!="function")){var A=w===or&&!!O;A!==p.isAimArmed()&&(p.setAimArmed(A),fo(p))}}j.useEffect(function(){ge&&Pf(S.current.runner,ie,pt)},[ge,ie,pt]),j.useEffect(function(){function p(w){if(De.current){var O=w.target;if(!(O&&O.closest&&O.closest("[data-selection-safe]"))){Et(null),De.current=null;var A=S.current.runner;A&&Vt(A,S.current.backdrop,null)}}}return document.addEventListener("mousedown",p,!0),function(){document.removeEventListener("mousedown",p,!0)}},[]),j.useEffect(function(){function p(w){if(!(w.key!=="Delete"&&w.key!=="Backspace")&&De.current){var O=S.current.cw,A=cr(O)?ot(O).CameraControls:null;if(!A)throw new Error("[AuthorView] CameraControls.isTypingTarget is unreachable in the experiment frame — it is the ONE typing predicate (lib/frqtl/parts/CameraControls.js). (FAIL-LOUD.)");A.isTypingTarget(w,document)||(w.preventDefault(),Vv())}}return window.addEventListener("keydown",p),function(){window.removeEventListener("keydown",p)}},[]);function qE(p,w){if(p.button!==0||!ge)return;var O=p.currentTarget,A=p.pointerId,D={kind:w.kind,label:w.displayName,x0:p.clientX,y0:p.clientY,dragging:!1,suppressClick:!1};$.current=D;try{O.setPointerCapture(A)}catch{}function z(ne){if(!D.dragging){if(Math.abs(ne.clientX-D.x0)+Math.abs(ne.clientY-D.y0)<dM)return;D.dragging=!0,D.prevCursor=document.body.style.cursor,D.prevSelect=document.body.style.userSelect,document.body.style.cursor="copy",document.body.style.userSelect="none",he({label:D.label,x:ne.clientX,y:ne.clientY})}var Fe=U.current;Fe&&(Fe.style.left=ne.clientX+12+"px",Fe.style.top=ne.clientY+12+"px")}function oe(ne,Fe){O.removeEventListener("pointermove",z),O.removeEventListener("pointerup",Q),O.removeEventListener("pointercancel",J);try{O.releasePointerCapture(A)}catch{}if(D.dragging&&(D.suppressClick=!0,setTimeout(function(){D.suppressClick=!1},0),document.body.style.cursor=D.prevCursor||"",document.body.style.userSelect=D.prevSelect||"",he(null),!!Fe)){var Me=f.current;if(!(!Me||document.elementFromPoint(ne.clientX,ne.clientY)!==Me)){var it=Me.getBoundingClientRect();Iv(D.kind,ne.clientX-it.left,ne.clientY-it.top)}}}function Q(ne){oe(ne,!0)}function J(ne){oe(ne,!1)}O.addEventListener("pointermove",z),O.addEventListener("pointerup",Q),O.addEventListener("pointercancel",J)}function $E(p){var w=$.current;w&&w.kind===p.kind&&w.suppressClick||KE(p.kind)}function KE(p){St("drop"),P(p),_("dropper")}function hc(p){if(St("drop"),pt===p){_(null),P(null),Et(null),De.current=null;var w=S.current.runner;w&&Vt(w,S.current.backdrop,null);return}_(p),p!=="dropper"&&P(null)}function YE(){var p=S.current.runner;p&&(p.stop(),typeof p.setDesignMode=="function"&&p.setDesignMode(!0),p.step(),me(or),Vt(p,S.current.backdrop,De.current,or))}function qv(){var p=S.current.runner;p&&(typeof p.setDesignMode=="function"&&p.setDesignMode(!1),Pf(p,sr,S.current.tool),p.start(),me(sr),Vt(p,S.current.backdrop,De.current,sr))}function GE(){xe.current===sr?YE():qv()}function JE(){if(!dc("Restart")){var p=bh(rt.current),w=jv("Restart");if(w.ok){var O=w.state;if(L.projectId)try{Kb(gn(),{files:p,renderState:O}),T(function(A){return Object.assign({},A,{dirty:!1})}),rs()}catch(A){ye("Restart: the save failed — "+(A&&A.message?A.message:A),"save")}Rv(p,O)}}}function $v(p,w,O){T({projectId:null,walkthroughId:p.id,walkthroughMode:w||null,name:p.title,dirty:!1}),O?(window._egptPendingFolder=Object.assign({},O),ns.current="keep"):(window._egptPendingFolder=md(i,p.id).then(function(z){return z.files}),ns.current="seed",Mr(null));var A=Qi(p,w);window._egptPendingRenderState=A;var D={renderer:A.renderer,seed:A.seed};je(fs(e,D)+"&_r="+Date.now())}function XE(p){var w=Kt(i,L.walkthroughId);if(w&&p!==(L.walkthroughMode||Ro(w))&&!dc("Switching mode")){var O=fa();window._egptPendingFolder=void 0,window._egptPendingRenderState=void 0,kt(!1),ye(null),Et(null),De.current=null,Pt([]),me(or),$v(w,p,O),ss(Kv(w,p))}}function ss(p){typeof u=="function"&&qL(at.author,p).forEach(function(w){u(w[0],w[1])})}function Kv(p,w){return{walkthrough:p.id,mode:Tl(p).length>1?w||Ro(p):""}}function ho(p,w,O){var A=!!(O&&O.quiet);if(An.current=!1,window._egptPendingFolder=void 0,Y(null),window._egptPendingRenderState=void 0,ns.current="seed",Mr(null),uc(null),kt(!1),ye(null),Wn(null),Et(null),De.current=null,Pt([]),me(or),p===Wc){T({projectId:null,name:"Empty Universe",dirty:!1}),A||ss({}),je(fs(e)+"&_r="+Date.now());return}if(p.indexOf("walkthrough:")===0){var D=p.slice(12),z=Kt(i,D);if(!z){ye("Walk-through rung not found: "+D);return}$v(z,w||Ro(z)),A||ss(Kv(z,w));return}if(p.indexOf(Lo)===0){var oe=O&&O.folder;if(!oe||!oe.files||!oe.renderState){ye("Scene draft refused — a scene: selection carries its folder (studio-landing-of.js). (FAIL-LOUD.)");return}var Q=p.slice(Lo.length);Pn.current={folder:oe,link:O&&O.link||{scene:Q}},T({projectId:null,sceneUrl:Q,name:decodeURIComponent(Q.split("/").pop()),dirty:!1}),A||ss(Pn.current.link),window._egptPendingFolder=Object.assign({},oe.files),window._egptPendingRenderState=oe.renderState,je(fs(e,{renderer:oe.renderState.renderer,seed:oe.renderState.seed})+"&_r="+Date.now());return}if(p.indexOf("project:")===0){var J=p.slice(8);try{var ne=kh(gn(),J);if(!ne){ye("Project not found: "+J);return}T({projectId:J,name:J,dirty:!1}),A||ss({project:J}),window._egptPendingFolder=Object.assign({},ne.files),window._egptPendingRenderState=ne.renderState;var Fe={renderer:ne.renderState.renderer,seed:ne.renderState.seed};je(fs(e,Fe)+"&_r="+Date.now())}catch(Me){ye("Load project failed: "+(Me&&Me.message?Me.message:Me))}return}}function Mf(p,w,O){if(dc(p))return Promise.resolve(null);if(!fa())return ye(p+" refused — the canvas has no project folder yet (it has not finished loading).",w),Promise.resolve(null);var A;try{A=Cv()}catch(z){return ye(p+" refused — "+(z&&z.message?z.message:z),w),Promise.resolve(null)}if(xh(rt.current))return O?Promise.resolve({files:bh(rt.current),renderState:A,unrun:!0}):(ye(p+" refused — "+kf(rt.current),w),Promise.resolve(null));var D=da();return D?D.toSketch().then(function(z){return z.refused.length&&ye(p+" — hands not written: "+z.refused.map(function(oe){return oe.reason}).join(" "),"hand"),Ev(z.files),{files:fa(),renderState:A,unrun:!1}}):(ye(p+" refused — the canvas has no scene facade to write the sketch from (it has not finished loading).",w),Promise.resolve(null))}var Yv="Saved your code; the canvas still runs the previous text — Run to see it.";function Gv(p){if(!(!p||!p.trim())){ac(!1);var w=p.trim();if(rt.current&&Eu(rt.current).indexOf(Ge)!==-1){ye("Save As refused — "+rm+" (unrun: "+Ge+", which Save As renames)","save");return}Mf("Save As","save",!0).then(function(O){if(O){var A=gn();sm(A,{files:O.files,renderState:O.renderState},w);var D={};D[Ge]=kh(A,w).files[Ge],Mr(ES(rt.current,D)),St("save"),Y(O.unrun?Yv:'Saved as "'+w+'".'),T({projectId:w,name:w,dirty:!1}),ss({project:w}),rs()}}).catch(function(O){ye("Save As failed: "+(O&&O.message?O.message:O),"save")})}}function Tf(p){dc("Save As")||(xv(p),ac(!0))}function QE(){if(!L.projectId){Tf(L.name||"");return}Mf("Save","save",!0).then(function(p){p&&(Kb(gn(),{files:p.files,renderState:p.renderState}),St("save"),Y(p.unrun?Yv:'Saved "'+L.projectId+'".'),T(function(w){return Object.assign({},w,{dirty:!1})}),rs())}).catch(function(p){ye("Save failed: "+(p&&p.message?p.message:p),"save")})}j.useEffect(function(){if(!(!ge||!S.current.cw)){var p=LP(S.current.cw);p&&we.current!==p&&(we.current=p,console.error("[AuthorView] Record unavailable: "+p+". (FAIL-LOUD.)")),p||un(ot(S.current.cw).parts.FrqtlVision.RECORD_DEFAULTS.seconds),cn(p||!1)}},[ge]),j.useEffect(function(){ge||!lt.current||(lt.current.stop(),lt.current=null,Mt({phase:"idle"}))},[ge]),j.useEffect(function(){if(Pe.phase==="recording"){Dn(Date.now());var p=setInterval(function(){Dn(Date.now())},250);return function(){clearInterval(p)}}},[Pe.phase]);var ha=ge&&S.current.runner&&cr(S.current.cw)?ot(S.current.cw).parts.FrqtlVision.recordRefusal(S.current.runner):{reason:"loading"},Jv=Pe.phase==="encoding"||Pe.phase!=="recording"&&!!ha;function ZE(){return L.walkthroughId||L.name||ZS}function eO(){if(Pe.phase==="recording"){lt.current&<.current.stop(),Mt({phase:"encoding"});return}var p=S.current.cw,w=S.current.runner,O=new AbortController,A,D=ZE(),z=new Date;try{A=ot(p).parts.FrqtlVision.attach(w).record({signal:O.signal})}catch(Q){ye("Record failed: "+(Q&&Q.message?Q.message:Q),"record"),console.error("[AuthorView] Record failed to start:",Q);return}var oe={};lt.current={stop:function(){O.abort()},token:oe},St("record"),Mt({phase:"recording",startedMs:Date.now()}),A.then(function(Q){if(!(!lt.current||lt.current.token!==oe)){var J=PP(Q,D,z);lt.current=null,Mt({phase:"ready",file:J,frames:Q.track.frames.length,everyTicks:Q.track.ticksPerFrame,atLimit:!Q.truncated,canShare:YS(navigator,J)})}}).catch(function(Q){!lt.current||lt.current.token!==oe||(lt.current=null,Mt({phase:"idle"}),ye("Recording failed: "+(Q&&Q.message?Q.message:Q),"record"),console.error("[AuthorView] Recording failed:",Q))})}function tO(){EP(navigator,Pe.file,Pe.file.name).then(function(){St("record")},function(p){p&&p.name==="AbortError"||(ye("Share failed: "+(p&&p.message?p.message:p)+" — use Save instead.","record"),console.error("[AuthorView] Share failed:",p))})}function nO(){$S(Pe.file.name,Pe.file),St("record")}var Df=j.useRef(null);function rO(){Mf("Export","export",!1).then(function(p){return p?jP().then(function(w){var O=KA(p.files,p.renderState,{sdkVersion:w});OP($b({files:p.files,renderState:p.renderState})+".zip",O),St("export")}):null}).catch(function(p){ye("Export failed: "+(p&&p.message?p.message:p),"export")})}function iO(p){var w=p.target.files&&p.target.files[0];p.target.value="",w&&CP(w).then(function(O){var A=US(O,w.name),D=$b(A);sm(gn(),A,D),St("import"),rs(),ho("project:"+D)}).catch(function(O){ye("Import failed: "+(O&&O.message?O.message:O),"import")})}function Xv(p){var w=da();return!w||!rt.current?"the scene's sketch text has not loaded":typeof w.forkRefusal!="function"?"this page's facade has no fork door":xh(rt.current)?kf(rt.current):w.forkRefusal(p)}function Qv(p,w){ua(null);var O=(w||"").trim();if(O){var A=Xv(p);if(A){ye("Fork refused — "+A,"fork");return}da().fork(p,O,{by:"human"}).then(function(D){Mr(Bb(Hb(rt.current,D.files),D.file)),T(function(Q){return Object.assign({},Q,{dirty:!0})}),St("fork"),Y("Forked "+D.from+" into "+D.file+" — edit it in the code drawer, then Run.");var z=S.current.runner;Cf(),qn(z,S.current.backdrop);var oe=z.declared.filter(function(Q){return Q.name===p})[0]||null;Et(oe),De.current=oe,Vt(z,S.current.backdrop,oe),fo(z)}).catch(function(D){ye("Fork failed: "+(D&&D.message?D.message:D),"fork")})}}function Zv(p,w,O,A){if(!cr(p)||!w)return null;var D;try{D=ot(p).MakeControlsForObject.makeControlsForObject(w,{},{kind:O,name:A})}catch(Q){return window.console&&console.error&&console.error("[AuthorView Inspector] makeControlsForObject failed:",Q),null}var z={},oe={};return D.controls.forEach(function(Q){z[Q.id]=Q}),D.display.forEach(function(Q){oe[Q.id]=Q}),{objectName:A,display:D.display,controlsById:z,displayById:oe}}function ey(p,w,O,A,D,z){function oe(Ue){z(O.name,Ue)}var Q=A?A.objectName+"."+O.name:null,J=A&&Q?A.controlsById[Q]:null,ne=A&&Q?A.displayById[Q]:null,Fe=JP(p,O);if(Fe){var Me=J?J.value:ne?ne.value:w?w[O.name]:void 0;return Ze.createElement(Fe.Component,{obj:w,field:O,value:Me,commit:oe})}if(J){if(J.kind==="scalar")return y.jsx(pM,{cw:D,control:J,onChange:oe});if(J.kind==="enum")return y.jsx("select",{value:J.value,style:_e.select,onChange:function(Ue){oe(Ue.target.value)},children:J.values.map(function(Ue){return y.jsx("option",{value:Ue,children:Ue},Ue)})});if(J.kind==="flags")return y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:J.values.map(function(Ue){var X=J.value.indexOf(Ue)!==-1;return y.jsxs("label",{style:Object.assign({},_e.sub,{display:"flex",gap:"5px",cursor:"pointer"}),children:[y.jsx("input",{type:"checkbox",checked:X,onChange:function(Se){var se=J.value.slice();Se.target.checked?se.indexOf(Ue)===-1&&se.push(Ue):se=se.filter(function(ae){return ae!==Ue}),oe(se)}})," ",Ue]},Ue)})});if(J.kind==="vector"){var it=J.value.length===4?["left","top","w","h"]:J.value.length===6?["left","top","z","w","h","d"]:J.value.map(function(Ue,X){return String(X)});return y.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px"},children:it.map(function(Ue,X){return y.jsxs("label",{style:Object.assign({},_e.sub,{display:"flex",gap:"3px",alignItems:"center"}),children:[Ue,y.jsx("input",{type:"number",value:Math.round(J.value[X]||0),step:"1",style:Object.assign({},_e.numInput,{width:48}),onChange:function(Se){var se=parseInt(Se.target.value,10);if(!isNaN(se)){var ae=J.value.slice();ae[X]=se,oe(ae)}}})]},Ue)})})}}if(O.type==="rect-array"){var le=A&&A.display?A.display.filter(function(Ue){return Ue.id.indexOf(Q+"[")===0}):[];return y.jsx("span",{style:_e.fieldVal,children:le.length?le.length+" rect(s)":"—"})}if(ne){var Oe=ne.value;return y.jsx("span",{style:_e.fieldVal,children:Oe!=null?typeof Oe=="object"?JSON.stringify(Oe):String(Oe):"—"})}return y.jsx("span",{style:_e.fieldVal,children:"—"})}function pa(p){return!We[p]}function oO(p){kn(function(w){var O=Object.assign({},w);return O[p]=!w[p],O})}function pc(p){var w=pa(p);return y.jsxs("div",{style:Object.assign({},_e.h,{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",userSelect:"none"}),"data-selection-safe":!0,title:w?"Collapse section":"Expand section",onClick:function(){oO(p)},children:[y.jsx("span",{children:p}),y.jsx("span",{style:{color:"#6a7a8a",fontSize:"0.6rem"},children:w?"▾":"▸"})]})}function sO(){if(!Ut)return y.jsx("div",{style:_e.sub,children:"Select an object (Pencil) to edit."});var p=S.current.cw,w=S.current.runner,O=cr(p)?ot(p).ObjectSchema:null,A=Ut,D=A._schemaKind,z=O?O.get(D):null;if(!z)return y.jsxs("div",{children:[y.jsx("div",{style:{marginBottom:"6px",color:"#ccc",fontSize:"0.68rem"},children:Ut.name||D}),y.jsx("div",{style:Object.assign({},_e.sub,{marginTop:"6px"}),children:"Schema loading — try again in a moment."})]});function oe(ae,be,$e){var Je=S.current.writeQueue,mt=ae+"."+be;Je&&typeof Je.write=="function"?Je.write(mt,$e):$e()}function Q(ae){var be=cr(p)?ot(p).MakeControlsForObject.NULL_ENUM_SENTINEL:void 0;return be!==void 0&&ae===be?null:ae}var J=Of(S.current,D,A),ne=Zv(p,A,D,J);function Fe(ae,be){if(w){if(be=Q(be),ae==="leafDimension"&&typeof A.getFundamentalDimension=="function"){var $e=A.getFundamentalDimension();if(typeof $e=="number"&&typeof be=="number"&&be<$e&&typeof window<"u"&&typeof window.confirm=="function"){var Je=window.confirm("Emit Dimension "+be+" is BELOW the current fundamental ("+$e+"). This self-lowers the universe floor GLOBALLY and is a ONE-WAY RATCHET (there is no removeDimension). Continue?");if(!Je)return}}oe(J,ae,function(){try{w.updateObjectProperty(A,ae,be),Ve(function(mt){return mt+1}),Kr("Inspector edit"),qn(w,S.current.backdrop),Vt(w,S.current.backdrop,De.current),T(function(mt){return Object.assign({},mt,{dirty:!0})})}catch(mt){console.error("[AuthorView inspector] "+mt.message)}})}}var Me=w?XS(w,A):null,it=Me?Me._schemaKind||"QuantumEmitter":null,le=null;if(Me&&O){var Oe=null;try{Oe=O.get(it)}catch{Oe=null}le=(Oe&&Oe.fields||[]).filter(function(ae){return ae.name==="emissionCap"})[0]||null}var Ue=Me?Of(S.current,it,Me):null,X=Me&&le?Zv(p,Me,it,Ue):null;function Se(ae,be){!w||!Me||oe(Ue,ae,function(){try{w.updateObjectProperty(Me,ae,be),Ve(function($e){return $e+1}),Kr("Inspector edit"),T(function($e){return Object.assign({},$e,{dirty:!0})})}catch($e){console.error("[AuthorView inspector] "+$e.message)}})}var se=Xv(A.name);return y.jsxs("div",{children:[y.jsx("div",{style:{marginBottom:"6px"},children:y.jsx("button",{"data-role":"studio-fork-part",disabled:!!se,title:se||"Copy "+D+"'s part file into this project as parts/My"+D+".js and use it here",style:Object.assign({},$n(!1),se?{opacity:.45,cursor:"not-allowed"}:null),onClick:function(){se||ua({name:A.name,value:"My"+D})},children:"Fork into project"})}),z.description&&y.jsx("div",{style:{marginBottom:"8px",color:"#7a8a9a",fontSize:"0.62rem",lineHeight:1.5,borderBottom:"1px solid #1c1c1c",paddingBottom:"6px"},children:z.description}),y.jsxs("div",{style:{marginBottom:"6px",color:"#ccc",fontSize:"0.68rem",display:"flex",alignItems:"center",gap:"6px"},children:[y.jsxs("span",{style:{flex:1},children:[A.name||D,y.jsxs("span",{style:Object.assign({},_e.sub,{marginLeft:"6px"}),children:["(",D,")"]})]}),y.jsx("button",{type:"button",title:"Delete (Del/Backspace)",onClick:Vv,style:{background:"#2a1414",border:"1px solid #5a2a2a",color:"#e08080",borderRadius:"3px",fontSize:"0.62rem",padding:"2px 7px",cursor:"pointer"},children:"Delete"})]}),z.fields.filter(function(ae){if(ae.internal===!0)return!1;var be=cr(p)?ot(p).MakeControlsForObject.evalVisibleWhen:null;return!(ae.visibleWhen&&be&&!be(ae,A))}).map(function(ae){return y.jsxs("div",{style:_e.fieldRow,"data-role":"studio-inspector-field","data-field":ae.name,children:[y.jsxs("div",{style:_e.fieldLabel,title:ae.description||ae.name,children:[ae.label||ae.name,ae.description&&y.jsx("span",{style:{color:"#4a5a6a",marginLeft:"3px"},title:ae.description,children:"?"})]}),y.jsx("div",{style:{flex:1,minWidth:0},children:ey(D,A,ae,ne,p,Fe)})]},ae.name)}),Me&&le&&y.jsxs("div",{"data-role":"population-gate",style:{marginTop:"10px",borderTop:"1px solid #2a2a2a",paddingTop:"8px"},children:[y.jsx("div",{style:_e.h,children:"Population Gate"}),y.jsx("div",{style:{marginBottom:"6px",color:"#7a8a9a",fontSize:"0.62rem",lineHeight:1.5},children:"This counter is the population authority for an emission gate — the knob writes the gating emitter's live emission cap (applies next tick; emission pauses at the limit and resumes below it)."}),y.jsxs("div",{"data-role":"population-gate-cap",style:_e.fieldRow,children:[y.jsx("div",{style:_e.fieldLabel,title:le.description||le.name,children:le.label||le.name}),y.jsx("div",{style:{flex:1,minWidth:0},children:ey(it,Me,le,X,p,Se)})]})]})]})}function aO(){var p=S.current.cw,w=cr(p)?ot(p).ObjectSchema:null,O=w?w.placeableCatalog():[];if(O.length===0)return y.jsx("span",{style:{opacity:.6,fontSize:11},children:"palette unavailable — ObjectSchema not loaded in the canvas frame"});for(var A={},D=0;D<O.length;D++){var z=O[D],oe=z.category||"other";A[oe]||(A[oe]=[]),A[oe].push(z)}var Q=[];return fM.forEach(function(J){!A[J]||A[J].length===0||(Q.push(y.jsx("div",{style:Object.assign({},_e.h,{marginTop:"8px"}),children:hM[J]||J},J)),A[J].forEach(function(ne){Q.push(y.jsx("button",{style:lO(ne.kind),disabled:!ge,onPointerDown:function(Fe){qE(Fe,ne)},onClick:function(){$E(ne)},title:ne.description,children:ne.displayName},ne.kind))}))}),Q}var _e={root:{display:"flex",flexDirection:"column",height:"100%",background:"#0d0d0d",color:"#cfcfcf",font:"12px ui-monospace,Menlo,Consolas,monospace"},topbar:{display:"flex",alignItems:"center",gap:"6px",padding:"5px 8px",background:"#111",borderBottom:"1px solid #222",flexShrink:0,flexWrap:"wrap"},body:{display:"flex",flex:1,minHeight:0},col:{display:"flex",flexDirection:"column",minWidth:0},palette:{width:172,borderRight:"1px solid #222",padding:"8px",flex:"0 0 auto",overflowY:"auto"},center:{flex:1,display:"flex",flexDirection:"column",background:"#000",minWidth:0,minHeight:0},canvasRegion:{position:"relative",flex:"1 1 0",minHeight:0},filePickerRow:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",background:"#111",borderBottom:"1px solid #222",flexShrink:0},filePicker:{background:"#1a1a1a",color:"#7ec8e3",border:"1px solid #333",borderRadius:"3px",font:"11px ui-monospace,Menlo,Consolas,monospace",padding:"2px 4px"},readOnlyFile:{flex:1,margin:0,padding:"8px 12px",overflow:"auto",color:"#aaa",font:"11px ui-monospace,Menlo,Consolas,monospace",whiteSpace:"pre-wrap"},right:{width:240,borderLeft:"1px solid #222",display:"flex",flexDirection:"column",flex:"0 0 auto",overflowY:"auto"},h:{fontSize:"0.62rem",letterSpacing:"1px",color:"#5a5a5a",textTransform:"uppercase",margin:"4px 0 6px"},toolRow:{display:"flex",gap:"6px",marginBottom:"8px"},chip:{display:"flex",alignItems:"center",gap:"6px",width:"100%",textAlign:"left",background:"#1a1a1a",border:"1px solid #333",color:"#ccc",padding:"6px 8px",marginBottom:"4px",cursor:"pointer",borderRadius:"3px",fontSize:"0.62rem"},row:{display:"flex",alignItems:"center",gap:"7px",padding:"4px 2px"},sect:{padding:"10px",borderBottom:"1px solid #1c1c1c"},iframe:{position:"absolute",inset:0,width:"100%",height:"100%",border:0},overlay:{position:"absolute",left:0,top:0,pointerEvents:"auto",background:"transparent"},sel:{background:"#26323f"},sub:{color:"#7a7a7a",fontSize:"0.62rem"},fieldRow:{display:"flex",alignItems:"flex-start",gap:"5px",padding:"3px 0",borderBottom:"1px solid #141414"},fieldLabel:{color:"#7a7a7a",fontSize:"0.6rem",flex:"0 0 80px",paddingTop:"3px",wordBreak:"break-all"},fieldVal:{color:"#aaa",fontSize:"0.62rem"},numInput:{width:60,background:"#1a1a1a",color:"#ccc",border:"1px solid #333",padding:"2px 4px",fontSize:"0.62rem"},textInput:{width:"100%",background:"#1a1a1a",color:"#ccc",border:"1px solid #333",padding:"2px 4px",fontSize:"0.62rem"},select:{width:"100%",background:"#1a1a1a",color:"#ccc",border:"1px solid #333",padding:"4px",fontSize:"0.62rem"},hint:{color:"#4a4a4a",fontSize:"0.6rem",lineHeight:1.5,marginTop:"10px",whiteSpace:"pre-wrap"}};function If(p){var w=pt===p;return{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0",cursor:"pointer",borderRadius:"4px",background:w?"#2a3a4a":"#1a1a1a",border:"1px solid "+(w?"#4a7abf":"#333"),boxShadow:w?"inset 0 -3px 0 #8ab4f8":"none",color:w?"#8ab4f8":"#777"}}function Ff(p,w){return{role:"button","aria-label":w,"aria-pressed":pt===p?"true":"false","data-tool":p}}function lO(p){var w=R===p;return Object.assign({},_e.chip,w?{borderColor:"#4a7abf",color:"#8ab4f8",background:"#22303f"}:null)}function cO(p){var w=ie===p,O={design:{bg:"#2a2a18",border:"#8a8a30",text:"#c8c84a"},run:{bg:"#182a18",border:"#308a30",text:"#4ac84a"},pause:{bg:"#2a1818",border:"#8a3030",text:"#c84a4a"}},A=O[p]||{};return{padding:"3px 9px",cursor:"pointer",borderRadius:"3px",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",letterSpacing:"0.5px",background:w?A.bg:"#1a1a1a",border:"1px solid "+(w?A.border:"#333"),color:w?A.text:"#999"}}function ty(){return{padding:"3px 9px",cursor:"pointer",borderRadius:"3px",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",letterSpacing:"0.5px",background:"#1a1a1a",border:"1px solid #333",color:"#999"}}function $n(p){return{padding:"3px 9px",cursor:"pointer",borderRadius:"3px",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",background:p?"#1a2a1a":"#1a1a1a",border:"1px solid "+(p?"#4a8a4a":"#333"),color:p?"#6aaa6a":"#888"}}function ny(p,w,O,A){return y.jsxs("label",{style:_e.row,children:[y.jsx("input",{type:"checkbox",checked:w,onChange:function(D){O(D.target.checked)},style:{accentColor:A},disabled:!ge}),p]})}var uO=L.projectId?"project:"+L.projectId:L.walkthroughId?"walkthrough:"+L.walkthroughId:L.sceneUrl?Lo+L.sceneUrl:Wc,dO=ie===sr?"running":"design",fO=ie===sr?"#6aaa6a":"#c8c84a",mc=L.walkthroughId?Kt(i,L.walkthroughId):null,ry=mc?Tl(mc):[],hO=mc?L.walkthroughMode||Ro(mc):null,pO=Object.assign({position:"absolute",left:0,top:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:1},Pr?{left:Pr.left+"px",top:Pr.top+"px",width:Pr.width+"px",height:Pr.height+"px"}:{}),mO=Object.assign({},_e.overlay,Pr?{left:Pr.left+"px",top:Pr.top+"px",width:Pr.width+"px",height:Pr.height+"px"}:{},{pointerEvents:"auto"});return y.jsxs("div",{style:_e.root,children:[y.jsxs("div",{ref:k,"data-role":"studio-showcase-covered",style:{display:"contents"},children:[y.jsxs("div",{ref:E,"data-role":"studio-scene-covered",style:{display:"contents"},children:[H&&y.jsx("div",{ref:U,"data-role":"palette-drag-ghost","aria-hidden":"true",style:Object.assign({},_e.chip,{position:"fixed",left:H.x+12+"px",top:H.y+12+"px",width:"auto",zIndex:1e3,pointerEvents:"none",opacity:.9,borderColor:"#4a7abf",color:"#8ab4f8",background:"#22303f"}),children:H.label}),co&&y.jsx("div",{"data-role":"studio-fork-prompt",style:{position:"absolute",inset:0,zIndex:999,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:y.jsxs("div",{style:{background:"#1a1a1a",border:"1px solid #333",borderRadius:"6px",padding:"20px",minWidth:"280px"},children:[y.jsxs("div",{style:{marginBottom:"10px",fontSize:"0.75rem",color:"#ccc"},children:['Fork "',co.name,'" into a new part class (parts/<Name>.js):']}),y.jsx("input",{type:"text",value:co.value,autoFocus:!0,"data-role":"studio-fork-name",style:Object.assign({},_e.textInput,{marginBottom:"12px",display:"block"}),onChange:function(p){var w=p.target.value;ua(function(O){return O&&Object.assign({},O,{value:w})})},onKeyDown:function(p){p.key==="Enter"&&Qv(co.name,co.value),p.key==="Escape"&&ua(null)}}),y.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[y.jsx("button",{style:$n(!1),onClick:function(){ua(null)},children:"Cancel"}),y.jsx("button",{style:$n(!0),"data-role":"studio-fork-commit",onClick:function(){Qv(co.name,co.value)},children:"Fork"})]})]})}),SE&&y.jsx("div",{"data-role":"studio-save-as-prompt",style:{position:"absolute",inset:0,zIndex:999,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:y.jsxs("div",{style:{background:"#1a1a1a",border:"1px solid #333",borderRadius:"6px",padding:"20px",minWidth:"280px"},children:[y.jsx("div",{style:{marginBottom:"10px",fontSize:"0.75rem",color:"#ccc"},children:"Save project as:"}),y.jsx("input",{type:"text",value:bf,autoFocus:!0,style:Object.assign({},_e.textInput,{marginBottom:"12px",display:"block"}),onChange:function(p){xv(p.target.value)},onKeyDown:function(p){p.key==="Enter"&&Gv(bf),p.key==="Escape"&&ac(!1)}}),y.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[y.jsx("button",{style:$n(!1),onClick:function(){ac(!1)},children:"Cancel"}),y.jsx("button",{style:$n(!0),onClick:function(){Gv(bf)},children:"Save"})]})]})}),y.jsxs("div",{style:_e.topbar,children:[y.jsx("span",{style:{color:"#5a5a5a",fontSize:"0.62rem",letterSpacing:"0.5px",textTransform:"uppercase"},children:"Experiment"}),y.jsx(MP,{value:uO,roster:i,savedProjects:V,onChange:ho,disabled:!ge&&!ht}),ry.length>1&&y.jsx("div",{"data-role":"studio-mode-strip",style:{display:"inline-flex",alignItems:"center",gap:"0",border:"1px solid #333",borderRadius:"4px",overflow:"hidden"},title:"Switch this walk-through between its declared modes (reloads the scene)",children:ry.map(function(p,w){var O=p.id===hO;return y.jsx("button",{"data-role":"studio-mode-segment","data-mode-id":p.id,"data-active":O?"true":"false",disabled:!ge&&!ht,onClick:function(){XE(p.id)},style:{padding:"3px 10px",cursor:"pointer",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",border:"none",borderLeft:w===0?"none":"1px solid #333",background:O?"#16323c":"#141414",color:O?"#7ec8e3":"#777"},children:p.label},p.id)})}),y.jsxs("span",{style:{color:"#5a5a5a",fontSize:"0.62rem",maxWidth:"120px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[L.name,L.dirty?" *":""]}),y.jsx("div",{style:{flex:"0 0 6px"}}),y.jsxs("span",{"data-role":"studio-scene-controls",style:{display:"inline-flex",alignItems:"center",gap:"6px",flexWrap:"nowrap"},children:[y.jsx("span",{style:{color:"#5a5a5a",fontSize:"0.62rem",letterSpacing:"0.5px",textTransform:"uppercase"},children:"Mode"}),y.jsx(vx,{style:cO(ie===sr?or:sr),disabled:!ge,labels:[fx,hx],onClick:GE,"data-selection-safe":!0,title:ie===sr?"Pause — freeze the field, edit objects (Design)":"Run the simulation",children:ie===sr?hx:fx}),y.jsx("button",{style:ty(),disabled:!ge&&!ht,onClick:JE,"data-selection-safe":!0,title:"Restart — save current design, reload from tick 0",children:"↻ Restart"}),Ft===!1&&y.jsx("span",{"data-role":"studio-record","data-phase":Pe.phase,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:y.jsx(vx,{"data-role":"studio-record-toggle","data-selection-safe":!0,labels:[px,mx,gx((Xe||0)*1e3)],style:Object.assign(ty(),Pe.phase==="recording"?{background:"#2a1414",border:"1px solid #c84a4a",color:"#ff6a6a"}:{color:"#d88"},Jv?{opacity:.45,cursor:"not-allowed"}:null),disabled:Jv,"data-refusal":Pe.phase!=="recording"&&ha?ha.reason:void 0,onClick:eO,title:Pe.phase==="recording"?"Stop recording":ha?aM(ha):"Record the scene as a video (up to "+Xe+" s)",children:Pe.phase==="recording"?gx(Wt-Pe.startedMs):Pe.phase==="encoding"?mx:px})})]}),Ft===!1&&Pe.phase==="ready"&&y.jsxs("span",{"data-role":"studio-record-result","data-name":Pe.file.name,"data-mime":Pe.file.type,"data-bytes":Pe.file.size,"data-frames":Pe.frames,"data-at-limit":Pe.atLimit?"true":"false","data-can-share":Pe.canShare?"true":"false",style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[Pe.atLimit&&y.jsx("span",{style:{color:"#c8c84a",fontSize:"0.6rem"},title:"The recording stopped itself at the "+Xe+" s limit",children:Xe+" s limit"}),Pe.canShare&&y.jsx("button",{"data-role":"studio-record-share","data-selection-safe":!0,style:$n(!0),onClick:tO,title:"Share the recording — save it to Photos or post it",children:"Share video"}),y.jsx("button",{"data-role":"studio-record-save","data-selection-safe":!0,style:$n(!Pe.canShare),onClick:nO,title:"Download "+Pe.file.name,children:"Save video"})]}),y.jsx("div",{style:{flex:"0 0 6px"}}),y.jsx("button",{style:{padding:"3px 9px",fontSize:"0.66rem",cursor:"pointer",borderRadius:"4px",border:"1px solid "+(uo?"#7ec8e3":"#333"),background:uo?"#16323c":"#1a1a1a",color:uo?"#7ec8e3":"#bbb"},"data-role":"studio-scene-code",onClick:function(){Sv(!0),xf(function(p){return!p})},title:"Show the scene's code — the file it was built from (Cmd/Ctrl+Enter runs it)",children:"</> Code"}),y.jsx("div",{style:{flex:"0 0 6px"}}),L.projectId?y.jsxs(y.Fragment,{children:[y.jsx("button",{style:$n(!0),disabled:!ge,onClick:QE,title:"Save — overwrite current project",children:"Save"}),y.jsx("button",{style:$n(!1),disabled:!ge,onClick:function(){Tf(L.name+" copy")},title:"Save As — create a new project",children:"Save As"})]}):y.jsx("button",{style:$n(!0),disabled:!ge,onClick:function(){Tf(L.name||"")},title:"Save As — name and save a new project",children:"Save As"}),y.jsx("button",{style:$n(!1),disabled:!ge,onClick:rO,title:"Export — download this project's folder as a .zip (its files + an index.html that boots it)",children:"Export"}),y.jsx("button",{style:$n(!1),onClick:function(){Df.current&&Df.current.click()},title:"Import — a project .zip (as Export writes it) or one sketch .js, saved and opened",children:"Import"}),y.jsx("input",{ref:Df,type:"file",accept:".zip,application/zip,.js,text/javascript",style:{display:"none"},onChange:iO,"data-role":"bundle-import-input"}),y.jsx("div",{style:{flex:1}}),ge&&y.jsx("span",{style:{fontSize:"0.6rem",color:fO,letterSpacing:"0.5px"},children:dO})]}),N.length>0&&y.jsxs("div",{"data-role":"studio-retired-saves","data-count":N.length,style:{display:"flex",alignItems:"center",gap:"10px",padding:"4px 10px",background:"#2a2410",color:"#d8c070",fontSize:"0.66rem",borderBottom:"1px solid #3a3418",flexShrink:0},children:[y.jsx("span",{children:N.length+" save"+(N.length===1?"":"s")+" in the retired project format cannot be opened (the project folder replaced it)."}),y.jsx("button",{style:$n(!1),onClick:RE,"data-role":"studio-delete-retired",title:"Delete exactly these retired saves (asks first)",children:"Delete retired saves"})]}),y.jsxs("div",{style:_e.body,children:[y.jsxs("div",{style:Object.assign({},_e.col,_e.palette,Be?null:{width:20,minWidth:20,padding:"4px 2px"}),children:[y.jsx("div",{"data-selection-safe":!0,title:Be?"Hide panel":"Show Tools / Palette",onClick:function(){Ce(!Be)},style:{cursor:"pointer",textAlign:Be?"right":"center",color:"#6a7a8a",fontSize:"0.72rem",marginBottom:"4px",userSelect:"none"},children:Be?"◂":"▸"}),Be&&y.jsxs(Ze.Fragment,{children:[y.jsx("div",{style:_e.h,children:"Tools"}),y.jsxs("div",{style:_e.toolRow,children:[y.jsx("div",{style:If("hand"),...Ff("hand","Hand"),"data-selection-safe":!0,title:"Hand — drag to move (click again for unobstructed view)",onClick:function(){hc("hand")},children:y.jsx(qc,{kind:"hand"})}),y.jsx("div",{style:If("dropper"),...Ff("dropper","Dropper"),"data-selection-safe":!0,title:"Dropper — click canvas to place (click again for unobstructed view)",onClick:function(){hc("dropper")},children:y.jsx(qc,{kind:"dropper"})}),y.jsx("div",{style:If("pencil"),...Ff("pencil","Pencil"),"data-selection-safe":!0,title:"Pencil — click object to edit (click again for unobstructed view)",onClick:function(){hc("pencil")},children:y.jsx(qc,{kind:"pencil"})})]}),y.jsx("div",{style:_e.h,children:"Palette"}),aO(),y.jsx("div",{style:Object.assign({},_e.h,{marginTop:"10px"}),children:"Effects"}),y.jsxs("button",{style:_e.chip,onClick:function(){Bv(!Mn.backdrop)},disabled:!ge,title:"Toggle pond backdrop",children:["□ Backdrop ",y.jsx("span",{style:_e.sub,children:"(pond)"})]}),y.jsxs("div",{style:_e.hint,children:[!pt&&`Unobstructed running view.
|
|
73
|
-
Pick a tool to edit.`,pt==="hand"&&`Drag bbox interior to move.
|
|
74
|
-
Drag edge/corner to scale.`,pt==="dropper"&&(R?`Click canvas to place:
|
|
75
|
-
`+R+".":`Pick a palette item,
|
|
76
|
-
then click the canvas.`),pt==="pencil"&&`Click an object to edit
|
|
77
|
-
all its fields.`]})]})]}),y.jsxs("div",{style:_e.center,children:[y.jsxs("div",{"data-role":"studio-canvas-region",style:_e.canvasRegion,children:[y.jsx("iframe",{ref:d,src:ke,style:_e.iframe,title:"frqtl-canvas"}),y.jsx("canvas",{ref:f,style:mO,"data-selection-safe":!0,title:_E===!1?"Canvas editing unavailable — the active renderer has no screenToWorld capability (the Layers panel still selects).":void 0}),y.jsx("div",{ref:x,"data-role":"studio-control-host","data-selection-safe":!0,style:pO}),Qe&&ge&&y.jsxs("div",{"data-role":"studio-phone-hand","data-selection-safe":!0,"aria-pressed":pt==="hand",role:"button",title:"Hand — touch an object to move it (tap again for unobstructed view)",onClick:function(){hc("hand")},style:Object.assign({position:"absolute",zIndex:3,width:"64px",height:"64px",borderRadius:"50%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"2px",cursor:"pointer",userSelect:"none",touchAction:"manipulation",font:"10px sans-serif",boxSizing:"border-box",border:"2px solid "+(pt==="hand"?"#7ec8e3":"rgba(126,200,227,0.35)"),background:pt==="hand"?"rgba(39,66,79,0.92)":"rgba(10,20,30,0.75)",color:pt==="hand"?"#7ec8e3":"rgba(126,200,227,0.85)"},F?{left:F.x+"px",top:F.y+"px",transform:"translate(-50%, -50%)"}:{left:"50%",bottom:"16px",transform:"translateX(-50%)"}),children:[y.jsx(qc,{kind:"hand"}),y.jsx("span",{children:"HAND"})]}),Nt&&y.jsxs("div",{"data-role":"studio-camera-controls","data-selection-safe":!0,style:{position:"absolute",top:"6px",left:"8px",maxWidth:"calc(100% - "+(_v+24)+"px)",flexWrap:"wrap",background:"rgba(0,0,0,0.72)",color:"#7ec8e3",font:"11px ui-monospace,Menlo,Consolas,monospace",padding:"4px 8px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"8px",zIndex:2,pointerEvents:"auto"},children:[y.jsx("span",{title:"Camera — driven via the experiment's sugar cameraControl handle (BYO renderer capability); the sliders are the axes the camera declares",children:"📷"}),wE.map(function(p){var w=WS(p);return w?y.jsxs(Ze.Fragment,{children:[y.jsx("span",{style:{color:"#557"},title:p.description,children:HS(p)}),y.jsx("input",{style:{width:"64px",cursor:"pointer",accentColor:"#7ec8e3"},type:"range",min:w.min,max:w.max,step:w.step,value:Math.round(Nt[p.name]),onChange:function(O){var A={};A[p.name]=Number(O.target.value),Lf(A)}})]},p.name):null}),ee&&y.jsx("span",{"data-role":"studio-camera-retained",style:{color:"#a88"},title:"A saved camera preset this camera does not offer — kept in the project, not applied",children:"preset "+ee+" — not offered by this camera"}),$r.map(function(p){var w=bt===p;return y.jsx("button",{style:{padding:"1px 6px",fontSize:"0.62rem",cursor:"pointer",borderRadius:"2px",border:"1px solid "+(w?"#7ec8e3":"#2a3a4a"),background:w?"#27424f":"#1a2a3a",color:w?"#7ec8e3":"#8af"},onClick:function(){Wv(p)},children:p},p)})]}),ge&&y.jsxs("div",{ref:wv,"data-role":"studio-rate-panel",style:{position:"absolute",top:"6px",right:"8px",background:"rgba(0,0,0,0.72)",color:"#8ab4f8",font:"11px ui-monospace,Menlo,Consolas,monospace",padding:"4px 8px",borderRadius:"4px",pointerEvents:"auto",userSelect:"none",letterSpacing:"0.5px",zIndex:2,display:"flex",flexDirection:"column",gap:"4px"},children:[y.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[y.jsxs("span",{title:"Frames per second: actual / limit (0 = display refresh)",children:["FPS ",y.jsx("span",{style:{color:I&&I.fps>0?"#8ab4f8":"#555"},children:I&&I.fps>0?I.fps:"—"}),y.jsx("span",{style:{color:"#4a5a6a"},children:"/"+(fe.fpsLimit>0?fe.fpsLimit:"∞")})]}),y.jsxs("span",{title:"Ticks per second: actual / limit",children:["TPS ",y.jsx("span",{style:{color:I&&I.tps>0?"#8ab4f8":"#555"},children:I&&I.tps>0?I.tps:"—"}),y.jsx("span",{style:{color:"#4a5a6a"},children:"/"+(fe.tpsLimit===1/0?"∞":fe.tpsLimit>0?fe.tpsLimit:"1:1")})]})]}),y.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[y.jsx("label",{style:{color:"#4a5a6a",fontSize:"10px"},children:"FPS cap"}),y.jsxs("select",{value:fe.fpsLimit>0?String(fe.fpsLimit):"0",style:{background:"#1a1a1a",color:"#8ab4f8",border:"1px solid #333",borderRadius:"2px",padding:"1px 3px",fontSize:"10px",fontFamily:"ui-monospace,Menlo,Consolas,monospace"},onChange:function(p){zv("fpsLimit",p.target.value)},children:[y.jsx("option",{value:"0",children:"display"}),y.jsx("option",{value:"60",children:"60"}),y.jsx("option",{value:"30",children:"30"}),y.jsx("option",{value:"24",children:"24"})]}),y.jsx("label",{style:{color:"#4a5a6a",fontSize:"10px"},children:"TPS cap"}),y.jsxs("select",{value:fe.tpsLimit===1/0?"Inf":fe.tpsLimit>0?String(fe.tpsLimit):"0",style:{background:"#1a1a1a",color:"#8ab4f8",border:"1px solid #333",borderRadius:"2px",padding:"1px 3px",fontSize:"10px",fontFamily:"ui-monospace,Menlo,Consolas,monospace"},onChange:function(p){zv("tpsLimit",p.target.value)},children:[y.jsx("option",{value:"0",children:"1:1 (lock)"}),y.jsx("option",{value:"60",children:"60"}),y.jsx("option",{value:"120",children:"120"}),y.jsx("option",{value:"240",children:"240"}),y.jsx("option",{value:"Inf",children:"unbounded"})]})]})]}),!ge&&!ht&&y.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",color:"#555",pointerEvents:"none",zIndex:1},children:"booting canvas…"}),Qe&&y.jsx("div",{ref:C,"data-role":"studio-tryit-host",style:{position:"absolute",inset:0,zIndex:4,pointerEvents:"none"}}),(W||ht||ln)&&y.jsxs("div",{style:{position:"absolute",left:0,right:0,bottom:0,zIndex:3,display:"flex",flexDirection:"column"},children:[W&&y.jsx("div",{"data-studio-notice":!0,style:{background:"#0f1a12",color:"#9ad0a0",padding:"8px"},children:W}),(ht||ln)&&y.jsx("div",{"data-studio-error":!0,style:{background:"#1a0000",color:"#ff8080",padding:"8px"},children:[ht,ln].filter(Boolean).join(" — ")})]})]}),!Qe&&y.jsx("div",{ref:C,"data-role":"studio-tryit-host",style:{flex:"0 0 auto"}}),y.jsxs("div",{"data-role":"studio-scene-editor","data-open":uo?"1":"0",style:{position:"relative",flex:uo?"0 0 45%":"0 0 0px",visibility:uo?"visible":"hidden",background:"#1e1e1e",borderTop:uo?"1px solid #333":0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[wf&&Vn&&jE(Vn),wf&&Vn&&ms(Dr(Vn))&&y.jsx("pre",{"data-role":"studio-readonly-file",style:_e.readOnlyFile,children:Sa(Vn,Dr(Vn)).text}),wf&&Vn&&!ms(Dr(Vn))&&y.jsx(j.Suspense,{fallback:y.jsx("div",{style:{padding:"8px",color:"#886",font:"11px ui-monospace,Menlo,Consolas,monospace"},children:"Loading the editor…"}),children:y.jsx(CS,{fileName:Lv(),language:Dr(Vn)===Ge?"json":"javascript",source:Sa(Vn,Dr(Vn)).text,appliedSource:af(Sa(Vn,Dr(Vn))),monacoBaseUrl:t,onRun:AE,onReset:PE,onClose:function(p){Ov(p),xf(!1)},onChange:Ov,error:CE},Lv())})]})]}),y.jsxs("div",{ref:h,"data-selection-safe":!0,style:Object.assign({},_e.col,_e.right,qe?null:{width:20,minWidth:20}),children:[y.jsx("div",{"data-selection-safe":!0,title:qe?"Hide panel":"Show Layers / Inspector",onClick:function(){nn(!qe)},style:{cursor:"pointer",textAlign:qe?"left":"center",color:"#6a7a8a",fontSize:"0.72rem",padding:"4px",userSelect:"none"},children:qe?"▸":"◂"}),qe&&y.jsxs(Ze.Fragment,{children:[y.jsxs("div",{style:_e.sect,children:[pc("Layers"),pa("Layers")&&y.jsxs(Ze.Fragment,{children:[ny("Particles",Mn.particles,UE,"#c586c0"),ny("Backdrop",Mn.backdrop,Bv,"#6a8caa"),Xt.map(function(p,w){return y.jsxs("div",{"data-role":"studio-layer-row","data-name":p.name,style:Object.assign({},_e.row,Ut===p.ref?_e.sel:null),children:[y.jsx("input",{type:"checkbox",checked:p.visible,disabled:!WE(p.schemaKind),onChange:function(O){HE(p,O.target.checked)},style:{accentColor:"#d08a4a"}}),y.jsx("span",{style:{flex:1,cursor:"pointer"},onClick:function(){Et(p.ref),De.current=p.ref,_("pencil"),Vt(S.current.runner,S.current.backdrop,p.ref)},children:p.name}),y.jsx("span",{style:_e.sub,children:p.schemaKind})]},w)})]})]}),y.jsxs("div",{style:_e.sect,children:[pc("Page Controls"),pa("Page Controls")&&y.jsx(mM,{ready:ge,ctxRef:S,reloadKey:ke})]}),y.jsxs("div",{style:_e.sect,"data-role":"studio-render-controls",children:[pc("Render Controls"),pa("Render Controls")&&y.jsx(gM,{ready:ge,ctxRef:S,reloadKey:ke,retained:re,rendererName:cx(S.current.cw)})]}),y.jsxs("div",{style:_e.sect,children:[pc("Inspector"),pa("Inspector")&&y.jsx("div",{children:sO()},Ae+"_"+(Ut?Ut.name||"":"none"))]})]})]})]})]}),y.jsx("div",{ref:g,"data-role":"studio-scene-card-host",style:{position:"absolute",inset:0,zIndex:1e4,pointerEvents:"none"}})]}),y.jsx("div",{ref:b,"data-role":"studio-intro-host",style:{position:"absolute",inset:0,zIndex:1e4,pointerEvents:"none"}})]})}var yM="/editor/examples-manifest.json";function bM(e){if(!e)throw new Error("[math-sdk-utils] mathSdkUrl is required — ensure FraqtlIde threads the router profile mathSdkUrl (DEV_CORE_PROFILE.__mathSdkUrl or DIST_PROFILE.__mathSdkUrl) into the mathSdkUrl prop.");if(!e.endsWith("/index.js"))throw new Error('[math-sdk-utils] mathSdkUrl must end with /index.js — got: "'+e+'"');return e.slice(0,-9)}function xM(e,t){var n=new URL(e+"/editor/",window.location.href);return new URL(t,n).href}function wM(e){var t=e+yM;return fetch(t).then(function(n){if(!n.ok)throw new Error("[math-sdk-utils] examples-manifest.json fetch failed ("+n.status+"): "+t);return n.json()}).then(function(n){if(!n||!Array.isArray(n.examples))throw new Error("[math-sdk-utils] examples-manifest.json has unexpected shape (no .examples array): "+t);return n})}async function yx(e){const t=[],n={active:!0};function r(s){n.active&&t.push(String(s.text||""))}Ee.on("console:write",r);let i="unknown",o=null;try{try{i=st.active().id}catch{}o=await e()}finally{n.active=!1,Ee.off("console:write",r)}return{lines:t,backendId:i,ok:!(o&&o.ok===!1)}}function bx(e,t){return new Promise(function(n,r){var i;try{i=xM(e,t.path)}catch(o){r(new Error('[BenchView] cannot resolve URL for "'+t.path+'": '+o.message));return}fetch(i).then(function(o){if(!o.ok)throw new Error("[BenchView] source fetch failed ("+o.status+"): "+i);return o.text()}).then(function(o){function s(a){Ee.off("run:result",s),n(a)}Ee.on("run:result",s),Ee.emit("run:request",{source:"math",code:o,fileId:t.id+".js",sourceUrl:i})}).catch(function(o){r(o)})})}function xx(e,t){var n=!1,r=e.map(function(i){var o=i;return t.forEach(function(s){s&&o.indexOf(s)!==-1&&(n=!0,o=o.split(s).join("«backend»"))}),o});return{lines:r,normalized:n}}function wx(e){var t=!1,n=e.map(function(r){if(r.indexOf("TIMING:")===0)return t=!0,"«timing-excluded»";var i=r.replace(/elapsed_ms\s*=\s*\d+/g,function(){return t=!0,"elapsed_ms = «ms»"});return i=i.replace(/"elapsed_ms"\s*:\s*\d+/g,function(){return t=!0,'"elapsed_ms": «ms»'}),i=i.replace(/\b(\d+)ms\b/g,function(){return t=!0,"«ms»ms"}),i});return{lines:n,normalized:t}}function _M(e,t){for(var n=Math.max(e.length,t.length),r=0;r<n;r++){var i=e[r]!==void 0?e[r]:"<missing>",o=t[r]!==void 0?t[r]:"<missing>";if(i!==o)return{match:!1,firstDiffLine:r,jsLine:i,wasmLine:o}}return{match:!0}}function kM({mathSdkUrl:e,mathWasmUrl:t,mathWasmModuleUrl:n,mathBackend:r,deepLinkRefusal:i}){const[o,s]=j.useState(null),[a,l]=j.useState(null),[c,u]=j.useState({}),[d,f]=j.useState(null),[h,v]=j.useState(!1),[m,x]=j.useState(null),b=j.useRef(null);j.useEffect(function(){if(!e){l("[BenchView] mathSdkUrl not provided — cannot load catalog");return}var W;try{W=bM(e)}catch(Y){l(Y.message);return}b.current=W,wM(W).then(function(Y){s(Y);var re={};Y&&Array.isArray(Y.examples)&&Y.examples.forEach(function(pe){re[pe.id]=!0}),u(re)}).catch(function(Y){l(Y.message)})},[]),j.useSyncExternalStore(j.useCallback(function(W){return st.subscribe(W)},[]),j.useCallback(function(){let W="none";try{W=st.active().id}catch{}return st.registeredIds().join("|")+"@"+W},[]),j.useCallback(function(){let W="none";try{W=st.active().id}catch{}return st.registeredIds().join("|")+"@"+W},[]));const k=st.registeredIds().includes("wasm-math"),E=function(){try{return st.active().id}catch{return"none"}}(),C=j.useCallback(async function(){if(!b.current){x("SDK base not initialized — wait for catalog load");return}if(!o||!Array.isArray(o.examples)){x("Catalog not loaded");return}v(!0),x(null),f(null);try{await ci.ensureMath({mathSdkUrl:e,mathWasmUrl:t,mathWasmModuleUrl:n,mathBackend:r})}catch(pe){x("Math SDK unavailable: "+String(pe)),v(!1);return}if(!st.registeredIds().includes("wasm-math")){x("wasm-math provider not registered: no math WASM bridge URL reached the SDK (engineRouter __mathWasmUrl / __mathWasmModuleUrl). This bench requires both providers."),v(!1);return}const W=o.examples.filter(function(pe){return c[pe.id]});if(W.length===0){x("No entries selected"),v(!1);return}const Y=function(){try{return st.active().id}catch{return"js-reference"}}(),re=[];try{for(const pe of W){st.select("js-reference");let B;try{B=await yx(function(){return bx(b.current,pe)})}catch(tn){B={lines:["[FETCH ERROR] "+String(tn)],backendId:"js-reference",ok:!1}}st.select("wasm-math");let ee;try{ee=await yx(function(){return bx(b.current,pe)})}catch(tn){ee={lines:["[FETCH ERROR] "+String(tn)],backendId:"wasm-math",ok:!1}}const ce=B.backendId!==ee.backendId,ve=!ce&&B.backendId==="js-reference"&&ee.backendId==="js-reference",ke=st.registeredIds(),je=xx(B.lines,ke),ie=xx(ee.lines,ke),me=je.normalized||ie.normalized,xe=wx(je.lines),ge=wx(ie.lines),kt=xe.normalized||ge.normalized,ut=B.ok===!1&&ee.ok===!1,_n=ce?_M(xe.lines,ge.lines):{match:!1,firstDiffLine:-1,jsLine:"STAMP SAME: "+B.backendId,wasmLine:ee.backendId};re.push({entry:pe,jsLines:B.lines,wasmLines:ee.lines,jsBackendId:B.backendId,wasmBackendId:ee.backendId,stampsDiffer:ce,coveragePartial:ve,stampsNormalized:me,timingNormalized:kt,bothFailed:ut,cmp:_n})}}finally{try{st.select(Y)}catch{}v(!1)}f(re)},[o,c,e,t,n,r]);function S(W){u(function(Y){var re=Object.assign({},Y);return re[W]=!Y[W],re})}function M(){if(o){var W={};o.examples.forEach(function(Y){W[Y.id]=!0}),u(W)}}function L(){u({})}const T={root:{display:"flex",flexDirection:"row",height:"100%",overflow:"hidden",background:"#111",fontFamily:"ui-monospace,Menlo,Consolas,monospace",fontSize:"0.75rem",color:"#ccc"},sidebar:{width:"220px",flexShrink:0,borderRight:"1px solid #222",display:"flex",flexDirection:"column",overflowY:"auto"},sideTop:{padding:"8px",borderBottom:"1px solid #1a1a1a",flexShrink:0},sideTitle:{font:"700 10px ui-monospace,Menlo,Consolas,monospace",color:"#555",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:"6px"},selBtn:{padding:"2px 6px",font:"9px ui-monospace,Menlo,Consolas,monospace",background:"#1a1a1a",border:"1px solid #2a2a2a",color:"#666",borderRadius:"2px",cursor:"pointer",marginRight:"4px"},entryList:{flex:1,overflowY:"auto"},entryItem:{display:"flex",alignItems:"center",padding:"3px 8px",borderBottom:"1px solid #1a1a1a",cursor:"pointer",userSelect:"none"},entryChk:{marginRight:"6px",flexShrink:0},entryLbl:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#777"},main:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},header:{padding:"8px 12px",borderBottom:"1px solid #222",flexShrink:0},title:{fontSize:"0.85rem",fontWeight:700,color:"#eee",marginBottom:"4px"},subtitle:{color:"#555",marginBottom:"8px",fontSize:"0.7rem"},badge:{display:"inline-block",padding:"2px 6px",borderRadius:"3px",fontSize:"0.65rem",background:"#1a2a3a",color:"#4af",marginRight:"6px"},badgeOff:{background:"#2a1a1a",color:"#a44"},runBtn:{padding:"4px 12px",background:"#1a2a3a",color:"#8af",border:"1px solid #2a3a4a",borderRadius:"3px",cursor:"pointer",fontSize:"0.75rem",marginTop:"8px"},results:{flex:1,overflowY:"auto"},table:{width:"100%",borderCollapse:"collapse"},th:{textAlign:"left",padding:"4px 8px",color:"#555",borderBottom:"1px solid #222",fontSize:"0.65rem",position:"sticky",top:0,background:"#111"},td:{padding:"4px 8px",borderBottom:"1px solid #1a1a1a",verticalAlign:"top",fontSize:"0.7rem"},match:{color:"#4a8",fontWeight:600},partial:{color:"#aa6",fontWeight:600},diverge:{color:"#a44",fontWeight:600},stampBad:{color:"#f84",fontWeight:600},diffLine:{color:"#f84",fontStyle:"italic",fontSize:"0.65rem"},errBanner:{background:"#2a1111",color:"#cc4444",padding:"6px 12px",borderBottom:"1px solid #3a1111",fontSize:"0.7rem",flexShrink:0}};var V=[];if(o&&Array.isArray(o.examples)){var G={},N=[];o.examples.forEach(function(W){var Y=W.group||"Other";G[Y]||(G[Y]=[],N.push(Y)),G[Y].push(W)}),V=N.map(function(W){return{name:W,entries:G[W]}})}const te=Object.values(c).filter(Boolean).length;return y.jsxs("div",{style:T.root,children:[y.jsxs("div",{style:T.sidebar,children:[y.jsxs("div",{style:T.sideTop,children:[y.jsx("div",{style:T.sideTitle,children:"Catalog"}),i&&y.jsx("div",{"data-role":"bench-deep-link-error",style:{color:"#a44",fontSize:"0.65rem",marginBottom:"4px"},children:i}),a&&y.jsx("div",{style:{color:"#a44",fontSize:"0.65rem",marginBottom:"4px"},children:a}),!o&&!a&&y.jsx("div",{style:{color:"#444",fontSize:"0.65rem"},children:"loading…"}),y.jsxs("div",{children:[y.jsx("button",{style:T.selBtn,onClick:M,children:"All"}),y.jsx("button",{style:T.selBtn,onClick:L,children:"None"})]})]}),y.jsx("div",{style:T.entryList,children:V.map(function(W){return y.jsxs("div",{children:[y.jsx("div",{style:{font:"9px ui-monospace",color:"#444",padding:"4px 8px 2px",textTransform:"uppercase",letterSpacing:"0.3px"},children:W.name}),W.entries.map(function(Y){return y.jsxs("div",{style:T.entryItem,onClick:function(){S(Y.id)},children:[y.jsx("input",{type:"checkbox",style:T.entryChk,checked:!!c[Y.id],onChange:function(){S(Y.id)},onClick:function(re){re.stopPropagation()}}),y.jsx("span",{style:T.entryLbl,title:Y.id,children:Y.title||Y.id})]},Y.id)})]},W.name)})})]}),y.jsxs("div",{style:T.main,children:[y.jsxs("div",{style:T.header,children:[y.jsx("div",{style:T.title,children:"Math Twin-Engines Bench"}),y.jsx("div",{style:T.subtitle,children:"Runs catalog entries under js-reference then wasm-math via the canonical runtime lane. Comparator = exact Bus console:write output equality. coverage:partial = both legs ran js-reference (pre-M5 op routing)."}),y.jsxs("div",{children:[y.jsxs("span",{style:Object.assign({},T.badge,{background:"#1a3a1a",color:"#4a8"}),children:["js-reference",E==="js-reference"?" (active)":""]}),y.jsxs("span",{style:Object.assign({},T.badge,k?{}:T.badgeOff),children:["wasm-math",k?E==="wasm-math"?" (active)":" (registered)":" (not loaded)"]}),!k&&y.jsx("span",{style:{color:"#555",marginLeft:"6px",fontSize:"0.65rem"},children:"— run Math SDK first or use ?mathBackend=wasm"})]}),y.jsx("div",{children:y.jsx("button",{style:T.runBtn,onClick:C,disabled:h||!o||te===0,children:h?"Running…":"Run "+(te>0?te+" selected":"(select entries)")})})]}),m&&y.jsxs("div",{style:T.errBanner,children:["BENCH ERROR: ",m]}),y.jsxs("div",{style:T.results,children:[d&&y.jsxs("table",{style:T.table,children:[y.jsx("thead",{children:y.jsxs("tr",{children:[y.jsx("th",{style:T.th,children:"Entry"}),y.jsx("th",{style:T.th,children:"JS stamp"}),y.jsx("th",{style:T.th,children:"WASM stamp"}),y.jsx("th",{style:T.th,children:"Result"})]})}),y.jsx("tbody",{children:d.map(function(W,Y){var re=W.stampsNormalized||W.timingNormalized?y.jsxs("span",{style:{color:"#667",fontStyle:"italic",fontSize:"0.6rem"},children:[" ","—",W.stampsNormalized?" backend-stamps normalized":"",W.timingNormalized?" timing normalized":""]}):null,pe;return W.stampsDiffer?W.cmp.match&&W.bothFailed?pe=y.jsxs("span",{children:[y.jsx("span",{style:T.partial,children:"MATCH (both legs failed)"}),re]}):W.cmp.match?pe=y.jsxs("span",{children:[y.jsx("span",{style:T.match,children:"MATCH"}),re]}):pe=y.jsxs("span",{children:[y.jsx("span",{style:T.diverge,children:"DIVERGENCE"}),re,y.jsx("br",{}),y.jsxs("span",{style:T.diffLine,children:["line ",W.cmp.firstDiffLine,': js="',W.cmp.jsLine,'"']}),y.jsx("br",{}),y.jsxs("span",{style:T.diffLine,children:["line ",W.cmp.firstDiffLine,': wasm="',W.cmp.wasmLine,'"']})]}):pe=y.jsx("span",{style:W.coveragePartial?T.partial:T.stampBad,children:W.coveragePartial?"coverage:partial (both js-reference, pre-M5)":"STAMP SAME: "+W.jsBackendId+" — wasm-math select had no effect"}),y.jsxs("tr",{children:[y.jsx("td",{style:T.td,title:W.entry.id,children:W.entry.title||W.entry.id}),y.jsx("td",{style:Object.assign({},T.td,{color:"#4a8",fontSize:"0.65rem"}),children:W.jsBackendId}),y.jsx("td",{style:Object.assign({},T.td,{color:"#4af",fontSize:"0.65rem"}),children:W.wasmBackendId}),y.jsx("td",{style:T.td,children:pe})]},Y)})})]}),d&&d.length>0&&function(){var W=d.filter(function(B){return B.cmp.match&&B.stampsDiffer&&!B.bothFailed}).length,Y=d.filter(function(B){return B.cmp.match&&B.stampsDiffer&&B.bothFailed}).length,re=d.filter(function(B){return B.coveragePartial}).length,pe=d.filter(function(B){return!B.cmp.match&&B.stampsDiffer&&!B.coveragePartial}).length;return y.jsxs("div",{style:{padding:"8px 12px",fontSize:"0.7rem"},children:[W>0&&y.jsxs("span",{style:T.match,children:[W," MATCH "]}),Y>0&&y.jsxs("span",{style:T.partial,children:[Y," MATCH (both legs failed) "]}),re>0&&y.jsxs("span",{style:T.partial,children:[re," partial "]}),pe>0&&y.jsxs("span",{style:T.diverge,children:[pe," DIVERGENCE — wasm bugs to fix, not tolerances to add"]})]})}()]})]})]})}var Fl="codec-chains",Ah=Object.freeze(["name","source"]);function Hs(e){throw new Error("[codec-chains] "+e+" (FAIL-LOUD.)")}function Xg(e){(!e||typeof e!="object"||Array.isArray(e))&&Hs("a codec chain row is { "+Ah.join(", ")+" } (got "+(e===null?"null":typeof e)+").");var t=Object.keys(e).filter(function(n){return Ah.indexOf(n)===-1});return t.length&&Hs("unknown key "+t.map(function(n){return JSON.stringify(n)}).join(", ")+" — a codec chain row holds exactly CODEC_CHAIN_KEYS: "+Ah.join(", ")+"."),la(e.name,"a codec chain name"),(typeof e.source!="string"||e.source.length===0)&&Hs(`"source" is the chain's module text, a non-empty string.`),Object.freeze({name:e.name,source:e.source})}function SM(e,t){var n=Xg(t);return e.put(Fl,n.name,{name:n.name,source:n.source}),n.name}function EM(e,t,n){la(n,"a codec chain name");var r=Xg(Object.assign({},t,{name:n}));return e.get(Fl,n)!==null&&Hs('a codec chain named "'+n+'" is already saved — Save As takes a name no saved chain has.'),e.put(Fl,r.name,{name:r.name,source:r.source}),r.name}function e1(e,t){la(t,"a codec chain name");var n=e.get(Fl,t);if(n==null)return null;var r;try{r=Xg(n)}catch(i){Hs('the saved chain "'+t+'" is not a codec chain row: '+(i&&i.message||i))}return r.name!==t&&Hs('the saved chain under "'+t+'" names itself "'+r.name+'".'),r}function OM(e){return e.list(Fl).map(function(t){return t.key}).sort().map(function(t){return{name:t}})}const CM={};var jM="../../assets/vendor/monaco/vs",$c=null,rc=!1;function RM(e){return rc?Promise.resolve(!0):$c||($c=new Promise(function(t,n){var r=e+"/loader.js";if(typeof require=="function"&&typeof require.config=="function"){_x(e,t,n);return}var i=document.createElement("script");i.src=r,i.onload=function(){_x(e,t,n)},i.onerror=function(){var o="[CodeEditorPane] Failed to load Monaco loader from: "+r;console.error(o),n(new Error(o))},document.head.appendChild(i)}),$c)}function _x(e,t,n){try{require.config({paths:{vs:e}}),require(["vs/editor/editor.main"],function(){if(typeof monaco>"u"||!monaco.editor){n(new Error("[CodeEditorPane] monaco.editor not available after require"));return}rc=!0,t(!0)})}catch(r){n(r)}}var kx=!1;function LM(e){if(!kx&&(kx=!0,!(import.meta&&CM))){var t=AM(),n=document.createElement("link");n.rel="stylesheet",n.href=t,document.head.appendChild(n)}}function AM(){for(var e=document.querySelectorAll("script[src]"),t=0;t<e.length;t++){var n=e[t].getAttribute("src");if(n&&n.indexOf("code-editor")!==-1&&n.indexOf("index.js")!==-1)return n.replace("index.js","code-editor.css")}return"/lib/components/code-editor/code-editor.css"}function PM(e){if(typeof e=="number")return e===1||e===2||e===4||e===8?e:e<=1?1:e<=2?4:8;if(typeof e=="string"){var t=e.toLowerCase();if(t==="error")return 8;if(t==="warning"||t==="warn")return 4;if(t==="info")return 2;if(t==="hint")return 1}return 8}var MM='<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><polygon points="5 3 19 12 5 21 5 3"/></svg>';function At(e){e=e||{},this._mountEl=e.mountEl||null,this._monacoBaseUrl=e.monacoBaseUrl||jM,this._emitBusRun=e.emitBusRun!==!1,this._showRun=e.showRun!==!1,this._fileMap=Object.create(null),this._activeId=null,this._runCb=null,this._runAdvanceCb=null,this._runAdvanceChordsRegistered=!1,this._editor=null,this._resizeObserver=null,this._pendingMarkers=[],LM(this._monacoBaseUrl),this._buildDom();var t=this;RM(this._monacoBaseUrl).then(function(){t._onMonacoReady()}).catch(function(n){t._showError("Monaco failed to load: "+(n&&n.message?n.message:String(n)))})}At.prototype._buildDom=function(){var e=this._mountEl;if(e){var t=document.createElement("div");t.className="cep-root",e.appendChild(t),this._rootEl=t;var n=document.createElement("div");n.className="cep-toolbar",t.appendChild(n),this._toolbarEl=n;var r=document.createElement("div");r.className="cep-tabs",n.appendChild(r),this._tabsEl=r;var i=this;if(this._showRun){var o=document.createElement("div");o.className="cep-run-area",n.appendChild(o);var s=document.createElement("span");s.className="cep-run-hint",s.textContent=navigator.platform&&navigator.platform.indexOf("Mac")!==-1?"⌘↩":"Ctrl+↩",o.appendChild(s);var a=document.createElement("button");a.className="cep-run-btn",a.type="button",a.innerHTML=MM+" Run",a.title="Run current file (Cmd/Ctrl+Enter)",a.disabled=!0,a.addEventListener("click",function(){i._triggerRun()}),o.appendChild(a),this._runBtnEl=a}var l=document.createElement("div");l.className="cep-editor-host",t.appendChild(l),this._hostEl=l;var c=document.createElement("div");c.className="cep-loading",c.innerHTML='<div class="cep-loading-spinner"></div><span>Loading Monaco editor…</span>',l.appendChild(c),this._loadingEl=c;var u=document.createElement("div");u.className="cep-empty hidden",u.textContent="No file open — call openFile() to begin.",l.appendChild(u),this._emptyEl=u}};At.prototype._onMonacoReady=function(){if(this._hostEl){this._loadingEl.classList.add("hidden");var e=this;if(this._editor=monaco.editor.create(this._hostEl,{model:null,theme:"vs-dark",language:"javascript",minimap:{enabled:!1},automaticLayout:!1,fontSize:13,lineHeight:20,scrollBeyondLastLine:!1,tabSize:4,renderWhitespace:"selection",wordWrap:"off",folding:!0,glyphMargin:!0,renderValidationDecorations:"on"}),this._editor.addCommand(monaco.KeyMod.CtrlCmd|monaco.KeyCode.Enter,function(){e._triggerRun()}),this._runAdvanceCb&&this._registerRunAdvanceChords(),this._editor.onDidChangeModelContent(function(){var a=e._activeId;if(!(!a||!e._fileMap[a])){var l=e._fileMap[a],c=e._editor.getValue();l.dirty=c!==l._initialValue,e._refreshTabs()}}),this._contentChangeCbs&&this._contentChangeCbs.length){for(var t=0;t<this._contentChangeCbs.length;t++)this._editor.onDidChangeModelContent(this._contentChangeCbs[t]);this._contentChangeCbs=[]}for(var n=Object.keys(this._fileMap),r=0;r<n.length;r++){var i=this._fileMap[n[r]];i.model||(i.model=monaco.editor.createModel(i._pendValue!==void 0?i._pendValue:"",i.language),delete i._pendValue)}for(var o=0;o<this._pendingMarkers.length;o++){var s=this._pendingMarkers[o];this._applyMarkers(s.fileId,s.markers)}this._pendingMarkers=[],this._activeId&&this._fileMap[this._activeId]?(this._editor.setModel(this._fileMap[this._activeId].model),this._runBtnEl&&(this._runBtnEl.disabled=!1),this._emptyEl.classList.add("hidden")):this._emptyEl.classList.remove("hidden"),this._editor.layout(),this._installResizeObserver(),console.log("[CodeEditorPane] Monaco ready, base:",this._monacoBaseUrl)}};At.prototype._installResizeObserver=function(){if(!(this._resizeObserver||typeof ResizeObserver>"u"||!this._hostEl)){var e=this;this._resizeObserver=new ResizeObserver(function(){e._editor&&e._editor.layout()}),this._resizeObserver.observe(this._hostEl)}};At.prototype._showError=function(e){console.error("[CodeEditorPane]",e),this._loadingEl&&(this._loadingEl.innerHTML='<span style="color:#f44336;padding:8px;">'+TM(e)+"</span>")};At.prototype._refreshTabs=function(){if(this._tabsEl){var e=this;this._tabsEl.innerHTML="";for(var t=Object.keys(this._fileMap),n=0;n<t.length;n++)(function(r){var i=e._fileMap[r],o=document.createElement("div");o.className="cep-tab"+(r===e._activeId?" active":""),o.title=r;var s=document.createElement("span");s.className="cep-tab-kind cep-tab-kind-"+i.kind,s.textContent=i.kind==="frqtl"?"F":"M",o.appendChild(s);var a=document.createElement("span");if(a.textContent=r,o.appendChild(a),i.dirty){var l=document.createElement("span");l.className="cep-tab-dirty",l.title="Unsaved changes",o.appendChild(l)}o.addEventListener("click",function(){e._activateFile(r)}),e._tabsEl.appendChild(o)})(t[n])}};At.prototype._activateFile=function(e){this._fileMap[e]&&(this._activeId=e,this._editor&&(this._editor.setModel(this._fileMap[e].model),this._runBtnEl&&(this._runBtnEl.disabled=!1),this._emptyEl.classList.add("hidden")),this._refreshTabs())};At.prototype._applyMarkers=function(e,t){if(!(!rc||!this._fileMap[e])){var n=this._fileMap[e].model;if(n){var r=(t||[]).map(function(i){return{startLineNumber:i.startLineNumber||1,startColumn:i.startColumn||1,endLineNumber:i.endLineNumber||i.startLineNumber||1,endColumn:i.endColumn||i.startColumn||1,message:i.message||"",severity:PM(i.severity)}});monaco.editor.setModelMarkers(n,"cep-owner",r)}}};At.prototype.openFile=function(e){if(!e||!e.id)throw new Error("[CodeEditorPane] openFile: id is required");var t=e.id,n=e.language||"javascript",r=e.kind||"frqtl",i=e.value!==void 0?e.value:"";if(this._fileMap[t]){this._activateFile(t);return}var o={id:t,language:n,kind:r,model:null,dirty:!1,_initialValue:i,_pendValue:i};rc&&(o.model=monaco.editor.createModel(i,n),delete o._pendValue),this._fileMap[t]=o,this._activateFile(t),this._refreshTabs()};At.prototype.setFileValue=function(e,t){var n=this._fileMap[e];return n?(n.model?n.model.getValue()!==t&&n.model.setValue(t):(n._pendValue=t,n._initialValue=t),!0):!1};At.prototype.setBaseline=function(e,t){var n=this._fileMap[e];if(!n)return!1;if(typeof t!="string")throw new Error("[CodeEditorPane] setBaseline("+e+"): value must be a string. (FAIL-LOUD.)");n._initialValue=t;var r=n.model?n.model.getValue():n._pendValue,i=r!==t;return i!==n.dirty&&(n.dirty=i,this._refreshTabs()),!0};At.prototype.activeFile=function(){var e=this._activeId;if(!e||!this._fileMap[e])return null;var t=this._fileMap[e],n;return this._editor&&t.model?n=this._editor.getValue():n=t._pendValue!==void 0?t._pendValue:"",{id:e,value:n,kind:t.kind}};At.prototype.files=function(){return Object.keys(this._fileMap).map(function(e){var t=this._fileMap[e];return{id:t.id,kind:t.kind,dirty:t.dirty}},this)};At.prototype.onRun=function(e){this._runCb=typeof e=="function"?e:null};At.prototype.onRunAdvance=function(e){this._runAdvanceCb=typeof e=="function"?e:null,this._runAdvanceCb&&this._editor&&this._registerRunAdvanceChords()};At.prototype._registerRunAdvanceChords=function(){if(!(this._runAdvanceChordsRegistered||!this._editor)){var e=this,t=window.monaco;t&&(this._editor.addCommand(t.KeyMod.Shift|t.KeyCode.Enter,function(){e._triggerRunAdvance("advance")}),this._editor.addCommand(t.KeyMod.Alt|t.KeyCode.Enter,function(){e._triggerRunAdvance("insert")}),this._runAdvanceChordsRegistered=!0)}};At.prototype._triggerRunAdvance=function(e){var t=this.activeFile();if(t){if(typeof this._runAdvanceCb=="function"){try{this._runAdvanceCb(t,e)}catch(n){console.error("[CodeEditorPane] onRunAdvance callback threw:",n)}return}this._triggerRun()}};At.prototype._triggerRun=function(){var e=this.activeFile();if(e){if(typeof this._runCb=="function")try{this._runCb(e)}catch(t){console.error("[CodeEditorPane] onRun callback threw:",t)}this._emitBusRun&&Ee&&typeof Ee.emit=="function"&&Ee.emit("run:request",{source:e.kind,code:e.value,fileId:e.id})}};At.prototype.setMarkers=function(e,t){if(e){if(!rc){this._pendingMarkers.push({fileId:e,markers:t||[]});return}this._applyMarkers(e,t)}};At.prototype.layout=function(){this._editor&&this._editor.layout()};At.prototype.dispose=function(){if(this._resizeObserver){try{this._resizeObserver.disconnect()}catch{}this._resizeObserver=null}for(var e=Object.keys(this._fileMap),t=0;t<e.length;t++){var n=this._fileMap[e[t]];if(n&&n.model&&typeof n.model.dispose=="function")try{n.model.dispose()}catch{}}if(this._fileMap=Object.create(null),this._editor&&typeof this._editor.dispose=="function")try{this._editor.dispose()}catch{}this._editor=null};At.prototype.onContentChange=function(e){typeof e=="function"&&(this._editor?this._editor.onDidChangeModelContent(e):(this._contentChangeCbs||(this._contentChangeCbs=[]),this._contentChangeCbs.push(e)))};function TM(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}typeof window<"u"&&(window.CodeEditorPane=At);var Nl=220,xd=96,DM=64;function IM(e,t){return t?t.ok?"verified":"failed":(e&&e.invertible===!0,"pending")}function FM(e,t,n){if(!e||!t)return{nodes:[],edges:[]};n=n||{};var r=e.snapshots||[],i=e.trace?e.trace.entries||[]:[],o=t.steps||[],s=n.roundTrips||[],a=r.map(function(c,u){var d=c&&c.constructor&&c.constructor.kind?c.constructor.kind:"?",f=u===0?"input":u===r.length-1?"output":"intermediate";return{id:"card-"+u,type:"card",position:{x:u*(Nl+DM),y:0},data:{index:u,kind:d,encoding:c,describe:c&&typeof c.describe=="function"?c.describe():null,role:f},width:Nl,height:xd}}),l=o.map(function(c,u){var d=c.constructor,f=i[u]||{};return{id:"edge-"+u,source:"card-"+u,target:"card-"+(u+1),type:"connector",data:{transformName:d.name,transformUiLabel:d.uiLabel||d.name,transformLetterCode:d.letterCode||"?",provenance:d.provenance||{tier:"structural",claim:"",leanCitation:""},opCount:f.opCount||0,elapsedMs:f.elapsedMs||0,bijection:IM(d,s[u]),inputKind:d.inputKind,outputKind:d.outputKind}}});return{nodes:a,edges:l}}function NM(e){if(!e.length)return{x:0,y:0,width:Nl,height:xd};for(var t=1/0,n=1/0,r=-1/0,i=-1/0,o=0;o<e.length;o++){var s=e[o],a=s.width||Nl,l=s.height||xd;s.position.x<t&&(t=s.position.x),s.position.y<n&&(n=s.position.y),s.position.x+a>r&&(r=s.position.x+a),s.position.y+l>i&&(i=s.position.y+l)}return{x:t,y:n,width:r-t,height:i-n}}var t1=Object.freeze({width:Nl,height:xd}),Cu=t1.width,fm=t1.height,zM={input:"#3a8a3a",output:"#3a5a8a",intermediate:"#4a3a5a"},BM={"lean-backed":"#7ec8e3",structural:"#a0a070",classical:"#888"},UM={verified:"#3a8a3a",pending:"#888",failed:"#cc4444"};function HM(e){return zM[e]||"#4a4a4a"}function WM(e){return BM[e]||"#888"}function VM(e){return UM[e]||"#888"}function qM(e){var t=e.node,n=t.data||{},r=HM(n.role),i=n.describe?String(n.describe).slice(0,80):"";return Ze.createElement("div",{key:t.id,style:{position:"absolute",left:t.position.x+"px",top:t.position.y+"px",width:Cu+"px",height:fm+"px",boxSizing:"border-box",border:"1px solid "+r,borderRadius:"4px",background:"#1a1a1a",padding:"6px 8px",cursor:e.onSelect?"pointer":"default",userSelect:"none"},onClick:e.onSelect?function(){e.onSelect(t.id)}:void 0},[Ze.createElement("div",{key:"kind",style:{font:"700 11px ui-monospace,Menlo,Consolas,monospace",color:"#ccc",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.kind||"?"),i?Ze.createElement("div",{key:"desc",style:{font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#666",marginTop:"3px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},i):null,Ze.createElement("div",{key:"role",style:{position:"absolute",right:"6px",bottom:"5px",font:"9px ui-monospace,Menlo,Consolas,monospace",color:r,textTransform:"uppercase",letterSpacing:"0.5px"}},n.role||"")])}function $M(e){var t=e.x,n=e.y,r=e.data||{},i=VM(r.bijection),o=WM(r.provenance&&r.provenance.tier);return Ze.createElement("div",{style:{position:"absolute",left:t-56+"px",top:n-22+"px",width:"112px",textAlign:"center",pointerEvents:"none",userSelect:"none"}},[Ze.createElement("div",{key:"lbl",style:{font:"700 9px ui-monospace,Menlo,Consolas,monospace",color:"#aaa",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"1.2"}},(r.transformLetterCode||"?")+" "+(r.transformUiLabel||"")),Ze.createElement("div",{key:"chips",style:{display:"flex",justifyContent:"center",gap:"3px",marginTop:"2px"}},[Ze.createElement("span",{key:"bij",style:{font:"8px ui-monospace,Menlo,Consolas,monospace",color:i,border:"1px solid "+i,borderRadius:"2px",padding:"0 3px",lineHeight:"1.4"}},r.bijection||"pending"),r.provenance&&r.provenance.tier?Ze.createElement("span",{key:"tier",style:{font:"8px ui-monospace,Menlo,Consolas,monospace",color:o,border:"1px solid "+o,borderRadius:"2px",padding:"0 3px",lineHeight:"1.4"}},r.provenance.tier):null])])}function KM(e){var t=e.nodes||[],n=e.edges||[],r=e.onSelect||null;if(!t.length)return Ze.createElement("div",{style:{flex:"1",display:"flex",alignItems:"center",justifyContent:"center",color:"#444",font:"11px ui-monospace,Menlo,Consolas,monospace"}},"No chain to display.");for(var i=NM(t),o=80,s=60+fm,a=i.width+2*o,l=i.height+2*s,c=o-i.x,u=s-i.y,d={},f=0;f<t.length;f++){var h=t[f];d[h.id]={x:h.position.x+c+Cu/2,y:h.position.y+u+fm/2}}for(var v=[],m=[],x=0;x<n.length;x++){var b=n[x],g=d[b.source],k=d[b.target];if(!(!g||!k)){var E=g.x+Cu/2,C=g.y,S=k.x-Cu/2,M=k.y,L=(E+S)/2,T="M "+E+" "+C+" C "+L+" "+C+", "+L+" "+M+", "+S+" "+M,V=b.data&&b.data.bijection==="failed"?"#cc4444":"#3a3a5a";v.push(Ze.createElement("path",{key:"p-"+b.id,d:T,stroke:V,strokeWidth:1.5,fill:"none"})),m.push({x:L,y:(C+M)/2,data:b.data})}}var G=t.map(function(N){return Object.assign({},N,{position:{x:N.position.x+c,y:N.position.y+u}})});return Ze.createElement("div",{style:{flex:"1",overflow:"auto",position:"relative",minHeight:"0"}},Ze.createElement("svg",{width:a,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},xmlns:"http://www.w3.org/2000/svg"},v),G.map(function(N){return Ze.createElement(qM,{key:N.id,node:N,onSelect:r})}),m.map(function(N,te){return Ze.createElement($M,{key:"el-"+te,x:N.x,y:N.y,data:N.data})}))}function Ph(e,t){if(!e||typeof e!="object")return"null";var n=Object.keys(e);if(!n.length)return"{}";for(var r=[],i=0;i<n.length;i++){var o=n[i],s=e[o],a=i<n.length-1?",":"";r.push(t+" "+JSON.stringify(o)+": "+JSON.stringify(s)+a)}return`{
|
|
78
|
-
`+r.join(`
|
|
79
|
-
`)+`
|
|
80
|
-
`+t+"}"}function YM(e){if(!e||!e.constructor)return null;var t=e.constructor.kind||"?",n={format:e.format||void 0};Array.isArray(e.payload)&&(n.payload=e.payload),Array.isArray(e.samples)&&(n.samples=e.samples),Array.isArray(e.values)&&(n.values=e.values);for(var r={},i=Object.keys(n),o=0;o<i.length;o++)n[i[o]]!==void 0&&(r[i[o]]=n[i[o]]);return{kind:t,config:r}}function GM(e,t){if(!e)throw new Error("[chainToModule] codec is required");var n=[],r=" ";n.push("// Generated by FRQTL codec codegen — "+new Date().toISOString()),n.push("// Edit this file to customise the chain."),n.push("export function buildCodec(cdc) {");var i=t&&t.snapshots&&t.snapshots[0]?t.snapshots[0]:null,o=i||e._inputEncoding||null;if(o){var s=YM(o);if(s){var a=Object.keys(s.config).length?", "+Ph(s.config,r):"";n.push(r+"cdc.input("+JSON.stringify(s.kind)+a+");")}}for(var l=e.steps||[],c=0;c<l.length;c++){var u=l[c],d=u.constructor,f=d.name||"?",h=u.params&&Object.keys(u.params).length?u.params:null;h?n.push(r+"cdc.push("+JSON.stringify(f)+", "+Ph(h,r)+");"):n.push(r+"cdc.push("+JSON.stringify(f)+");")}for(var v=e._claims||[],m=0;m<v.length;m++){var x=v[m],b=x.name||"?",g=x.config&&Object.keys(x.config).length?x.config:null;g?n.push(r+"cdc.claim("+JSON.stringify(b)+", "+Ph(g,r)+");"):n.push(r+"cdc.claim("+JSON.stringify(b)+");")}return n.push("}"),n.join(`
|
|
81
|
-
`)+`
|
|
82
|
-
`}const JM=`// QFT order finding — the quantum benchmark's computation as a lens-train.
|
|
83
|
-
// Signal: f(k) = 2^k mod 15 for k = 0..7. Its period IS the order r = 4
|
|
84
|
-
// (2^4 = 16 ≡ 1 mod 15) — the value the #quantum benchmark reports.
|
|
85
|
-
// Edit this file to customise the chain.
|
|
86
|
-
export function buildCodec(cdc) {
|
|
87
|
-
cdc.input("HostFloats", {
|
|
88
|
-
"format": "fp64",
|
|
89
|
-
"payload": [1, 2, 4, 8, 1, 2, 4, 8]
|
|
90
|
-
});
|
|
91
|
-
cdc.push("HostFloatsToEGPTReal");
|
|
92
|
-
cdc.push("EGPTRealToPolynomial");
|
|
93
|
-
cdc.push("PolynomialToFFT");
|
|
94
|
-
cdc.push("FFTToPolynomial");
|
|
95
|
-
cdc.push("PolynomialToEGPTReal");
|
|
96
|
-
cdc.push("EGPTRealToHostFloats", {
|
|
97
|
-
"format": "fp64"
|
|
98
|
-
});
|
|
99
|
-
cdc.claim("round-trip-exact", {
|
|
100
|
-
"tolerance": "exact"
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
`,Ws=[{id:"qft-order-finding",name:"QFT order finding (2 mod 15)",kind:"math",builtin:!0,language:"javascript",source:JM}],n1=`// No chain defined yet.
|
|
104
|
-
// Use the palette to add transforms.
|
|
105
|
-
export function buildCodec(cdc) {
|
|
106
|
-
}
|
|
107
|
-
`,Sx=Object.freeze({name:"New chain",source:n1});function Qg(e){if(typeof e!="string"||!e)return null;for(let t=0;t<Ws.length;t++)if(Ws[t].id===e)return Ws[t];return null}const hm="qft-order-finding";if(!Qg(hm))throw new Error('[codec-recipes] FIRST_CONTACT_CODEC_RECIPE_ID "'+hm+'" is not a built-in recipe — declared ids: ['+Ws.map(function(e){return e.id}).join(", ")+"]. (FAIL-LOUD.)");function XM(e){var t=Qg(e);if(t)return{source:t.source,project:{projectId:null,builtinId:t.id,name:t.name,dirty:!1}};try{var n=e1(gn(),e);if(n)return{source:n.source,project:{projectId:n.name,builtinId:null,name:n.name,dirty:!1}}}catch(r){return{error:'[CodecView] Failed to load module "'+e+'": '+(r&&r.message?r.message:String(r))}}return{error:'[CodecView] Unknown module id "'+e+'" — not a built-in recipe and not in saved chains. Known built-ins: '+Ws.map(function(r){return r.id}).join(", ")}}function Ex(e){return e.builtinId||e.projectId||""}function QM({mathSdkUrl:e,mathWasmUrl:t,mathWasmModuleUrl:n,mathBackend:r,monacoBaseUrl:i,initialModule:o,onLinkSelect:s,deepLinkRefusal:a}){var[l,c]=j.useState(!1),[u,d]=j.useState(null),f=j.useRef(null),[h,v]=j.useState([]),[m,x]=j.useState(null),[b,g]=j.useState([]),[k,E]=j.useState(null),[C,S]=j.useState([]),[M,L]=j.useState([]),[T,V]=j.useState([]),[G,N]=j.useState(!1),[te,W]=j.useState(""),[Y,re]=j.useState(!1),[pe,B]=j.useState(""),[ee,ce]=j.useState(0);function ve(){ce(function(I){return I+1})}var ke=j.useRef(null),je=j.useRef(null),ie=j.useRef(null);j.useEffect(function(){ci.ensureMath({mathSdkUrl:e,mathWasmUrl:t,mathWasmModuleUrl:n,mathBackend:r}).then(function(I){if(!I.codec){d("[CodecView] Math SDK loaded but sdk.codec is missing. Ensure the SDK bundle was built with the V1 codec surface.");return}f.current=I.codec,c(!0)}).catch(function(I){var de="[CodecView] Math SDK unavailable: "+(I&&I.message?I.message:String(I));d(de),Ee.emit("console:write",{level:"error",text:de})})},[]),j.useEffect(function(){ir()},[]),j.useEffect(function(){function I(fe){fe&&fe.source==="math"&&fe.code&&ln(fe.code)}function de(fe){fe&&fe.source==="math"&&fe.ok===!1&&fe.error&&ut("Run failed: "+fe.error)}return Ee.on("run:request",I),Ee.on("run:result",de),function(){Ee.off("run:request",I),Ee.off("run:result",de)}},[]);var me=j.useRef(null);me.current===null&&(me.current=XM(o||hm));var[xe,ge]=j.useState(function(){return me.current.project||{projectId:null,builtinId:null,name:"",dirty:!1}}),[kt,ut]=j.useState(function(){return a||me.current.error||null}),_n=j.useRef(!1);j.useEffect(function(){var I=me.current.project;I&&typeof s=="function"&&s("module",Ex(I))},[]),j.useEffect(function(){var I=me.current;!I.source||!l||_n.current||(_n.current=!0,ln(I.source),ie.current=I.source,ge(I.project))},[l]);function tn(I,de){ln(I),ie.current=I,ge(de),typeof s=="function"&&s("module",Ex(de))}function ir(){try{V(OM(gn()).map(function(I){return{id:I.name,name:I.name}}))}catch{V([])}}var ht=j.useCallback(function(I,de,fe){if(!de||!I.length){E(null),S([]),L([]),ut(null);return}var Ie=f.current;if(!Ie){ut("[CodecView] Math SDK not yet acquired — try again in a moment.");return}try{var Ft=Ie.buildCodecDsl(Ie.registry,Ie.Codec,Ie.EncodingClasses),cn=Ft.dsl;cn.input(de.kind,de.payload);for(var Xe=0;Xe<I.length;Xe++)cn.push(I[Xe].name,I[Xe].opts);for(var un=fe||[],Pe=0;Pe<un.length;Pe++)cn.claim(un[Pe].name,un[Pe].opts);var Mt=cn.build(),Wt=Mt.codec;Wt.claimMeta==null&&Wt.claim("round-trip-exact",{reference:"round-trip-exact",tolerance:"exact"});var Dn=Mt.headEncoding,lt=Wt.run(Dn);E(lt),ut(null);for(var we=[],pt=lt.snapshots||[],_=Wt.steps||[],R=0;R<_.length;R++){var P=_[R].constructor;if(!P.invertible||!pt[R]){we.push(null);continue}try{var $=new Ie.Codec(P.inputKind).push(_[R]),U=$.roundTripCheck(pt[R]);we.push({ok:U.ok===!0})}catch(he){window.console&&console.error&&console.error("[CodecView] round-trip check failed at step "+R+":",he),we.push({ok:!1})}}var H=FM(lt,Wt,{roundTrips:we});S(H.nodes),L(H.edges)}catch(he){ut(he&&he.message?he.message:String(he)),E(null),S([]),L([])}},[]);function ye(){if(!m||!h.length)return n1;var I=f.current;if(!I)return`// Math SDK not yet acquired.
|
|
108
|
-
export function buildCodec(cdc) {
|
|
109
|
-
}
|
|
110
|
-
`;try{var de=I.buildCodecDsl(I.registry,I.Codec,I.EncodingClasses),fe=de.dsl;fe.input(m.kind,m.payload);for(var Ie=0;Ie<h.length;Ie++)fe.push(h[Ie].name,h[Ie].opts);for(var Ft=0;Ft<b.length;Ft++)fe.claim(b[Ft].name,b[Ft].opts);var cn=fe.build();return GM(cn.codec,k)}catch(Xe){return"// codegen error: "+(Xe&&Xe.message?Xe.message:String(Xe))+`
|
|
111
|
-
export function buildCodec(cdc) {
|
|
112
|
-
}
|
|
113
|
-
`}}function St(I){var de=je.current;!de||typeof I!="string"||de.setFileValue&&de.setFileValue("chain.js",I)||de.openFile({id:"chain.js",language:"javascript",value:I,kind:"math"})}function ln(I){if(!(typeof I!="string"||!I.trim())){var de=f.current;if(!de){ut("[CodecView] Math SDK not yet acquired — cannot apply code.");return}try{var fe=I.replace(/^export\s+/m,""),Ie=new Function(fe+`
|
|
114
|
-
return buildCodec;`),Ft=Ie();if(typeof Ft!="function"){ut("Recipe must define `export function buildCodec(cdc) { ... }`");return}var cn=de.buildCodecDsl(de.registry,de.Codec,de.EncodingClasses),Xe=cn.dsl,un=!1,Pe=Object.assign({},Xe,{input:function(){return un=!0,Xe.input.apply(Xe,arguments)}});if(Ft(Pe),!un){v([]),x(null),g([]),ge(function(_){return Object.assign({},_,{dirty:!0})}),ht([],null,[]);return}var Mt=Xe.build(),Wt=(Mt.codec.steps||[]).map(function(_){return{name:_.constructor.name,opts:_.params||{}}}),Dn=(Mt.codec._claims||[]).map(function(_){return{name:_.name,opts:_.config||{}}}),lt=Mt.headEncoding,we=Mt.headKind||(lt&<.constructor&<.constructor.kind?lt.constructor.kind:"?"),pt={kind:we,payload:Mt.headPayload||{}};v(Wt),x(pt),g(Dn),ge(function(_){return Object.assign({},_,{dirty:!0})}),ht(Wt,pt,Dn)}catch(_){ut("Apply failed: "+(_&&_.message?_.message:String(_)))}}}j.useEffect(function(){if(G){var I=ke.current;if(I){je.current||(je.current=new At({mountEl:I,monacoBaseUrl:i}),je.current.onRun(function(Xe){var un=Xe&&Xe.value,Pe=Xe&&Xe.id||"chain.js";typeof un=="string"&&un.trim()&&Ee.emit("run:request",{source:"math",code:un,fileId:Pe})}));var de=null;try{var fe=je.current.activeFile();de=fe&&fe.value}catch{}var Ie=ie.current;ie.current=null;var Ft=Ie&&Ie.trim()?Ie:de&&de.trim()?de:ye();St(Ft);var cn=setTimeout(function(){try{je.current.layout()}catch{}},60);return function(){clearTimeout(cn)}}}},[G]),j.useEffect(function(){if(!(!G||!je.current)){var I=ye(),de=null;try{var fe=je.current.activeFile();de=fe&&fe.value}catch{}de!==I&&St(I)}},[h,m,b,k,ee]);function Wn(I){var de=f.current;if(de){var fe=de.registry.byName(I);if(!fe){ut('[CodecView] dropTransform: no transform "'+I+'" in registry');return}var Ie=h.concat([{name:I,opts:{}}]);v(Ie),ge(function(Ft){return Object.assign({},Ft,{dirty:!0})}),ht(Ie,m,b),ve()}}function An(I){var de=h.filter(function(fe,Ie){return Ie!==I});v(de),ge(function(fe){return Object.assign({},fe,{dirty:!0})}),ht(de,m,b),ve()}function Pn(I,de){var fe={kind:I,payload:de||{}};x(fe),ge(function(Ie){return Object.assign({},Ie,{dirty:!0})}),ht(h,fe,b),ve()}function Mn(I){if(!(!I||!I.trim())){re(!1);var de=I.trim();try{if(Qg(de))throw new Error('"'+de+'" is a built-in recipe id — a saved chain takes another name.');EM(gn(),{name:de,source:ye()},de),ge({projectId:de,builtinId:null,name:de,dirty:!1}),ir(),typeof s=="function"&&s("module",de)}catch(fe){ut("Save failed: "+(fe&&fe.message?fe.message:String(fe)))}}}function vr(){if(!xe.projectId){re(!0),B(xe.name||"");return}try{SM(gn(),{name:xe.projectId,source:ye()}),ge(function(I){return Object.assign({},I,{dirty:!1})}),ir()}catch(I){ut("Save failed: "+(I&&I.message?I.message:String(I)))}}var Xt=f.current&&f.current.registry,Pt=null;if(Xt&&m&&m.kind&&(Pt=m.kind,h.length>0)){var Ut=h[h.length-1],Et=Xt.byName(Ut.name);Et&&Et.outputKind&&(Pt=Et.outputKind)}var De=Xt?Pt?Xt.outgoing?Xt.outgoing(Pt):Xt.allTransforms():Xt.allTransforms?Xt.allTransforms():[]:[],Tn=te?De.filter(function(I){return I.name.toLowerCase().indexOf(te.toLowerCase())!==-1}):De;return y.jsxs("div",{style:Te.root,children:[u&&y.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"#111",zIndex:10},children:y.jsx("div",{style:Te.errBanner,children:u})}),!l&&!u&&y.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"#111",zIndex:10},children:y.jsx("div",{style:Te.emptyMsg,children:"Acquiring Math SDK…"})}),y.jsxs("div",{style:Te.palette,children:[y.jsx("div",{style:Te.panelTitle,children:"Transforms"}),y.jsx("input",{type:"text",placeholder:"filter…",value:te,onChange:function(I){W(I.target.value)},style:Te.filterInput}),y.jsxs("div",{style:Te.paletteSection,children:[y.jsx("div",{style:Te.sectionLabel,children:"Input"}),y.jsx("button",{style:Object.assign({},Te.paletteItem,m?Te.paletteItemActive:{}),onClick:function(){Pn("HostFloats",{format:"fp64",payload:[1,.5,.25,.125]})},title:"Set HostFloats input",children:"HostFloats (sample)"})]}),y.jsxs("div",{style:Te.paletteSection,children:[y.jsx("div",{style:Te.sectionLabel,children:"Add Transform"}),Tn.length===0?y.jsx("div",{style:Te.emptyMsg,children:"no matches"}):Tn.map(function(I){return y.jsx("button",{style:Te.paletteItem,onClick:function(){Wn(I.name)},title:I.provenance&&I.provenance.claim?I.provenance.claim:I.name,children:I.uiLabel||I.name},I.name)})]})]}),y.jsxs("div",{style:Te.center,children:[y.jsxs("div",{style:Te.centerToolbar,children:[y.jsxs("span",{style:Te.projectName,"data-role":"codec-chain-name",children:[xe.name||"Untitled chain",xe.dirty?" *":""]}),y.jsx("button",{style:Te.toolBtn,onClick:function(){re(!0),B(xe.name||"")},children:"Save As"}),xe.projectId&&y.jsx("button",{style:Te.toolBtn,onClick:vr,children:"Save"}),y.jsxs("button",{style:Object.assign({},Te.toolBtn,G?Te.toolBtnActive:{}),onClick:function(){N(function(I){return!I})},children:["</>"," Code"]})]}),kt&&y.jsx("div",{style:Te.errBanner,children:kt}),h.length>0&&y.jsxs("div",{style:Te.stepsList,children:[m&&y.jsx("span",{style:Te.stepChip,children:m.kind}),h.map(function(I,de){return y.jsxs("span",{style:Te.stepChip,"data-role":"codec-step",children:["→ ",I.name,y.jsx("button",{style:Te.removeBtn,onClick:function(){An(de)},title:"Remove",children:"×"})]},de)})]}),y.jsx("div",{style:Te.flowArea,children:y.jsx(KM,{nodes:C,edges:M})}),G&&y.jsx("div",{style:Te.codeDrawer,ref:ke})]}),y.jsxs("div",{style:Te.rightPanel,children:[y.jsx("div",{style:Te.panelTitle,children:"Built-in recipes"}),y.jsx("button",{style:Te.projectItem,onClick:function(){tn(Sx.source,{projectId:null,builtinId:null,name:"",dirty:!1})},title:"Start an empty chain","data-role":"codec-new-chain",children:Sx.name}),Ws.map(function(I){return y.jsx("button",{style:Object.assign({},Te.projectItem,I.id===xe.builtinId?Te.projectItemActive:{}),onClick:function(){tn(I.source,{projectId:null,builtinId:I.id,name:I.name,dirty:!1})},title:I.id,"data-role":"codec-module","data-active":I.id===xe.builtinId?"1":void 0,children:I.name},I.id)}),y.jsx("div",{style:Te.panelTitle,children:"Saved chains"}),T.length===0?y.jsx("div",{style:Te.emptyMsg,children:"none saved"}):T.map(function(I){return y.jsx("button",{style:Object.assign({},Te.projectItem,I.id===xe.projectId?Te.projectItemActive:{}),title:I.id,"data-role":"codec-module","data-active":I.id===xe.projectId?"1":void 0,onClick:function(){try{var de=e1(gn(),I.id);de&&tn(de.source,{projectId:de.name,builtinId:null,name:de.name,dirty:!1})}catch(fe){ut("Load failed: "+(fe&&fe.message?fe.message:String(fe)))}},children:I.name},I.id)})]}),Y&&y.jsx("div",{style:Te.dialogOverlay,children:y.jsxs("div",{style:Te.dialog,children:[y.jsx("div",{style:{color:"#ccc",marginBottom:"8px",font:"12px sans-serif"},children:"Save chain as:"}),y.jsx("input",{autoFocus:!0,type:"text",value:pe,onChange:function(I){B(I.target.value)},onKeyDown:function(I){I.key==="Enter"&&Mn(pe),I.key==="Escape"&&re(!1)},style:Te.saveAsInput}),y.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"8px"},children:[y.jsx("button",{style:Te.toolBtn,onClick:function(){Mn(pe)},children:"Save"}),y.jsx("button",{style:Te.toolBtn,onClick:function(){re(!1)},children:"Cancel"})]})]})})]})}var Te={root:{display:"flex",flexDirection:"row",height:"100%",overflow:"hidden",background:"#111",color:"#aaa",fontFamily:"ui-monospace,Menlo,Consolas,monospace"},palette:{width:"180px",flexShrink:0,borderRight:"1px solid #222",display:"flex",flexDirection:"column",overflow:"hidden"},panelTitle:{font:"700 10px ui-monospace,Menlo,Consolas,monospace",color:"#555",padding:"8px 8px 4px",textTransform:"uppercase",letterSpacing:"0.5px"},filterInput:{margin:"0 6px 4px",padding:"3px 5px",font:"10px ui-monospace,Menlo,Consolas,monospace",background:"#181818",border:"1px solid #2a2a2a",color:"#aaa",borderRadius:"2px",outline:"none"},paletteSection:{flex:1,overflowY:"auto",padding:"0 0 4px"},sectionLabel:{font:"9px ui-monospace,Menlo,Consolas,monospace",color:"#444",padding:"4px 8px 2px",textTransform:"uppercase"},paletteItem:{display:"block",width:"100%",textAlign:"left",padding:"4px 8px",font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#888",background:"none",border:"none",borderBottom:"1px solid #1a1a1a",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},paletteItemActive:{color:"#7ec8e3"},center:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:0},centerToolbar:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",borderBottom:"1px solid #222",flexShrink:0,background:"#111"},projectName:{font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#555",flex:1},toolBtn:{padding:"2px 8px",font:"10px ui-monospace,Menlo,Consolas,monospace",background:"#1a1a1a",border:"1px solid #2a2a2a",color:"#888",borderRadius:"2px",cursor:"pointer"},toolBtnActive:{color:"#7ec8e3",borderColor:"#3a3a5a"},errBanner:{background:"#2a1111",color:"#cc4444",font:"10px ui-monospace,Menlo,Consolas,monospace",padding:"4px 8px",borderBottom:"1px solid #3a1111",flexShrink:0},stepsList:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"3px",padding:"4px 8px",borderBottom:"1px solid #1a1a1a",flexShrink:0,overflowX:"auto"},stepChip:{font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#888",background:"#1a1a1a",border:"1px solid #2a2a2a",borderRadius:"2px",padding:"1px 5px",display:"inline-flex",alignItems:"center",gap:"3px"},removeBtn:{font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#555",background:"none",border:"none",cursor:"pointer",padding:"0 1px",lineHeight:1},flowArea:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},codeDrawer:{height:"200px",flexShrink:0,borderTop:"1px solid #222"},rightPanel:{width:"160px",flexShrink:0,borderLeft:"1px solid #222",display:"flex",flexDirection:"column",overflow:"hidden"},emptyMsg:{font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#333",padding:"6px 8px",fontStyle:"italic"},projectItem:{display:"block",width:"100%",textAlign:"left",padding:"4px 8px",font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#666",background:"none",border:"none",borderBottom:"1px solid #1a1a1a",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},projectItemActive:{color:"#7ec8e3"},dialogOverlay:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},dialog:{background:"#1a1a1a",border:"1px solid #333",borderRadius:"4px",padding:"16px",minWidth:"260px"},saveAsInput:{width:"100%",padding:"4px 6px",boxSizing:"border-box",font:"11px ui-monospace,Menlo,Consolas,monospace",background:"#111",border:"1px solid #333",color:"#ccc",borderRadius:"2px",outline:"none"}},uf="empty";function wd(e,t){return t??Ro(e)}function ZM(e,t,n,r){var i=Qi(t,wd(t,n)),o=Dg(e,uf,"wasm",r);return sS(o,{renderer:i.renderer,seed:i.seed})}function Zg(e){var t=e&&e.FrqtlPage;if(!t||typeof t.applyModuleSource!="function")throw new Error("[rung-frame] the frame has no FrqtlPage.applyModuleSource — it is not the blank-universe page (experiments/"+uf+"/index.html). (FAIL-LOUD.)");return t}function eT(e,t,n,r,i){return Promise.resolve().then(function(){return Jt(t,"applyRungSource(frameWindow, roster, rung, modeId, override)"),Qi(n,wd(n,r)),Zg(e),md(t,n.id,{mode:wd(n,r)})}).then(function(o){var s=Object.assign({},o.files);return i!=null&&(s[$o(s)]=i),tT(e,s,n,r)})}function tT(e,t,n,r){return Promise.resolve().then(function(){var i=Qi(n,wd(n,r));return r1(e,t,i,'scene "'+n.id+'"')})}function nT(e,t){return Dg(e,uf,"wasm",t)}function rT(e,t){return Promise.resolve().then(function(){return Zg(e),xS({router:t})}).then(function(n){return r1(e,n.files,yi(n.renderState),"the Empty Universe")})}function r1(e,t,n,r){return Promise.resolve(Zg(e).applyModuleSource({files:t})).then(function(){var i=e.FrqtlPage.runner;if(!i)throw new Error("[rung-frame] "+r+" applied but the frame has no FrqtlPage.runner. (FAIL-LOUD.)");i.stop();var o=e.FrqtlPage;if(typeof o.applyRenderState!="function")throw new Error("[rung-frame] the frame has no FrqtlPage.applyRenderState — it is not the blank-universe page (experiments/"+uf+"/index.html). (FAIL-LOUD.)");var s=o.applyRenderState(n);if(s.camera==="retained")throw new Error("[rung-frame] "+r+' declares camera preset "'+s.preset+'", which the booted camera does not offer. (FAIL-LOUD.)');return i})}const iT=Object.freeze([{id:"unsupported",means:'document.fullscreenEnabled is not true or the element has no requestFullscreen (iOS Safari; a frame without allow="fullscreen"): nothing is requested, the control is disabled with the reason as its title'},{id:"entered",means:"requestFullscreen() resolved: the element fills the screen"},{id:"exited",means:"the element left fullscreen — exitFullscreen() resolved, or the viewer/browser ended it"},{id:"denied",means:"requestFullscreen() or exitFullscreen() rejected; recorded as denied:<DOMException.name>"}].map(Object.freeze)),oT=new Set(iT.map(e=>e.id));function gs(e,t,{suffix:n="",detail:r}={}){if(!oT.has(t))throw new Error(`fullscreen: '${t}' is not a FULLSCREEN_OUTCOMES row`);const i=t+n;return e.dataset.frqtlFullscreen=i,r===void 0?delete e.dataset.frqtlFullscreenDetail:e.dataset.frqtlFullscreenDetail=r,r===void 0?{row:t,record:i}:{row:t,record:i,detail:r}}function i1(e){if(!e)return{supported:!1,reason:"no document"};if(e.fullscreenEnabled!==!0)return{supported:!1,reason:"Fullscreen is not available here (document.fullscreenEnabled is "+String(e.fullscreenEnabled)+' — an embedding frame without allow="fullscreen", or a browser without element fullscreen)'};const t=e.documentElement;return!t||typeof t.requestFullscreen!="function"?{supported:!1,reason:"Fullscreen is not available here (no Element.requestFullscreen)"}:{supported:!0,reason:null}}function o1(e){if(!e||!e.dataset||!e.ownerDocument)throw new TypeError("fullscreen: the target must be a DOM element")}async function sT(e){o1(e);const t=e.ownerDocument,n=i1(t);if(!n.supported)return gs(e,"unsupported",{detail:n.reason});if(t.fullscreenElement===e){try{await t.exitFullscreen()}catch(r){return gs(e,"denied",{suffix:":"+(r&&r.name||"Error"),detail:r&&r.message||String(r)})}return gs(e,"exited")}try{await e.requestFullscreen()}catch(r){return gs(e,"denied",{suffix:":"+(r&&r.name||"Error"),detail:r&&r.message||String(r)})}return gs(e,"entered")}function aT(e){return o1(e),e.ownerDocument.fullscreenElement!==e&&e.dataset.frqtlFullscreen==="entered"?gs(e,"exited"):null}const pm='[data-role="gym-root"]',Ox="frqtl-gym-fullscreen-css",lT=pm+":fullscreen{background:#0b0d10;width:100%;height:100%;overflow:auto;}";function cT(e){if(e.getElementById(Ox))return;const t=e.createElement("style");t.id=Ox,t.textContent=lT,e.head.appendChild(t)}function Cx(e){const t=e&&e.closest(pm);if(!t)throw new Error("GymFullscreenButton: no ancestor matches "+pm+' — put data-role="gym-root" on the element the GYM puts in fullscreen.');return t}function uT({style:e}){const t=j.useRef(null),[n,r]=j.useState({supported:!1,reason:"checking"}),[i,o]=j.useState(null);j.useEffect(function(){const u=t.current,d=Cx(u),f=u.ownerDocument;cT(f),r(i1(f));function h(){const v=aT(d);v&&o(v)}return f.addEventListener("fullscreenchange",h),function(){f.removeEventListener("fullscreenchange",h)}},[]);function s(){sT(Cx(t.current)).then(o)}const a=i&&i.row==="entered",l=i&&i.row==="denied",c=n.supported?l?"Fullscreen was refused: "+i.record+(i.detail?" — "+i.detail:""):a?"Leave fullscreen":"Fullscreen":n.reason;return y.jsx("button",{ref:t,type:"button","data-role":"gym-fullscreen","data-fullscreen-record":i?i.record:void 0,style:e,title:c,disabled:!n.supported,onClick:s,children:a?"Exit fullscreen":l?"Fullscreen (refused)":"Fullscreen"})}function jx(e,t){const n=j.useRef(null),r=j.useCallback(function(){const o=n.current;n.current=null,o&&o.close()},[]),i=j.useCallback(function(o){n.current=RL(e.current,{seenKey:o.seenKey,title:o.title,paragraphs:o.paragraphs},{covers:t.current})},[e,t]);return j.useEffect(function(){return r},[r]),{open:i,close:r}}var df="walkthrough:",dT=Object.freeze({kind:"empty",id:of,mode:null});function Rx(e){return e&&e.kind==="rung"?df+e.id:""}function fT(e,t){for(var n=e.showcase?e.showcase.rows:[],r=0;r<n.length;r++)if(df+n[r].id===t)return n[r];return null}function s1(e,t){var n=fT(e,t),r=Kt(e,t.slice(df.length));return{kind:"rung",id:r.id,mode:n&&n.mode||Ro(r)}}function a1(e){return dS(e).map(function(t){return{label:t.label,rows:t.rows.map(function(n){return{value:df+n.id,title:n.title}})}})}function hT(e,t,n){if(n&&!t)return{scene:null,error:"Deep link error: ?mode="+n+" without a ?walkthrough= — a mode belongs to a roster scene. (FAIL-LOUD.)"};if(t){var r=Kt(e,t);if(!r)return{scene:null,error:'Deep link error: unknown walkthrough "'+t+`" — this site's roster declares: `+e.rows.map(function(s){return s.id}).join(", ")+"."};var i=n||Ro(r);try{Qi(r,i)}catch(s){return{scene:null,error:"Deep link error: "+(s&&s.message?s.message:String(s))}}return{scene:{kind:"rung",id:r.id,mode:i},error:null}}var o=a1(e);return{scene:o.length>0?s1(e,o[0].rows[0].value):dT,error:null}}var Lx=45e3,pT=250;function mT({experimentBase:e,router:t,roster:n,initialWalkthrough:r,initialWalkthroughMode:i,onLinkSelect:o,monacoBaseUrl:s,onOpenInStudio:a,deepLinkRefusal:l}){if(Jt(n,"CompareView({ experimentBase, router, roster, … })"),!e)throw new Error("[CompareView] experimentBase is required — mount CompareView through FraqtlIde (lib/features/ide/index.jsx), the only mounter, which derives it from its engineRouter.");if(!s)throw new Error("[CompareView] monacoBaseUrl is required — FraqtlIde ferries its router-resolved Monaco base (the code editor's); mount CompareView through lib/features/ide/index.jsx.");var c=e;const[u]=j.useState(function(){return l?{scene:null,error:l}:hT(n,r,i)}),[d,f]=j.useState(u.scene),[h,v]=j.useState(0),[m,x]=j.useState(null),[b,g]=j.useState(!1),[k,E]=j.useState(null),[C,S]=j.useState(null),[M,L]=j.useState(null),T=j.useRef(null);T.current=_S(m);var V=d?d.id:null,G=d?d.kind+":"+d.id+":"+d.mode:null,N=j.useMemo(function(){return d&&d.kind==="rung"?{id:d.id,modeId:d.mode}:null},[G]),te=j.useMemo(function(){return N?hS(n,N):null},[N]),W=j.useMemo(function(){return te?pS(n,te):null},[te]),Y=mS(n),re=N?ea(n,N):"scene-"+of;function pe(){return d.kind==="empty"?nT(c,window.location.search):ZM(c,Kt(n,d.id),d.mode,window.location.search)}function B(F){var K=F&&F.contentWindow;if(!K)return null;try{if(F.src&&K.location&&K.location.href!==F.src)return null}catch{}return K}function ee(F){var K=B(F);return!!(K&&K.FrqtlPage&&typeof K.FrqtlPage.isReady=="function"&&K.FrqtlPage.isReady())}const ce=j.useRef(null),ve=j.useRef(null),ke=j.useRef(null),[je,ie]=j.useState(""),[me,xe]=j.useState("60"),[ge,kt]=j.useState({fps:0,tps:0,tick:0,alive:0}),[ut,_n]=j.useState(!1),tn=j.useRef(!1),ir=j.useRef(null),ht=j.useRef(null),ye=j.useRef(null),St=j.useRef(null),ln=j.useRef(null),Wn=j.useRef(null),An=jx(ht,ye),Pn=jx(ir,St),[Mn,vr]=j.useState(!1),[Xt,Pt]=j.useState(null),Ut=j.useRef(null),[Et,De]=j.useState(im()),[Tn,I]=j.useState(null),[de,fe]=j.useState(null),[Ie,Ft]=j.useState([]),[cn,Xe]=j.useState([]),un=j.useCallback(function(F){var K=ve.current;!K||!K.cameraControl||(K.cameraControl.setOrbit(F),I(K.cameraControl.getOrbit()),fe(null))},[]),Pe=j.useCallback(function(F){var K=ve.current;!K||!K.cameraControl||typeof K.cameraControl.setPreset!="function"||(K.cameraControl.setPreset(F),I(K.cameraControl.getOrbit()),fe(F))},[]),Mt=j.useCallback(function(){var F=je===""||je==null?0:Number(je),K=me===""||me==null?1/0:Number(me);return(isNaN(F)||F<0)&&(F=0),(typeof K!="number"||isNaN(K)||K<0)&&(K=1/0),{fpsLimit:F,tpsLimit:K}},[je,me]),Wt=j.useCallback(function(){var F=ve.current;if(F){var K=F.isRunning,We=F.getRates();_n(K),kt({fps:K?We.fps:0,tps:K?We.tps:0,tick:F.worldTick,alive:F.universe.activeQuanta})}},[]);function Dn(){var F=ve.current;F&&(tn.current=F.isRunning),v(function(K){return K+1})}j.useEffect(function(){if(vr(!1),Pt(null),kt({fps:0,tps:0,tick:0,alive:0}),_n(!1),I(null),ve.current=null,ke.current&&(clearInterval(ke.current),ke.current=null),!V)return;var F=bR(ce.current,{onError:function(bt){Pt(bt.message)}}),K=!1,We=!1,kn=Date.now(),Nt=setInterval(function(){if(!K){if(!We&&ee(ce.current)){We=!0,clearInterval(Nt);var bt=T.current;(d.kind==="empty"?rT(ce.current.contentWindow,t):eT(ce.current.contentWindow,n,Kt(n,d.id),d.mode,bt)).then(function(ct){K||Sn(ct)},function(ct){if(!K){var $r=ct&&ct.message?ct.message:String(ct);if(Pt('[GYM] scene "'+d.id+'" failed to load'+(bt!==null?" (edited code)":"")+": "+$r),bt!==null){var lo=kS(ct);E({message:$r,line:lo?lo.line:void 0,col:lo?lo.col:void 0}),g(!0)}}});return}Date.now()-kn>Lx&&(clearInterval(Nt),Pt("[Benchmark] Boot timeout — the WASM frame was not ready after "+Lx/1e3+"s (see the pane for a fail-loud overlay)."))}},100);function Sn(bt){ve.current=bt,fe(null);try{if(typeof bt.isRunning!="boolean"||typeof bt.getRates!="function"||!bt.universe||!("worldTick"in bt))throw new Error("the runner does not publish the readout contract — a boolean isRunning (FrqtlApp.prototype.isRunning), getRates() (FrqtlApp.prototype.getRates), worldTick (FrqtlApp.prototype.worldTick) and its universe (FrqtlApp.universe: activeQuanta). The GYM reads the run state and the readout from the runner, never from a copy or a guess.");var ct=bt.cameraControl||null;ct&&(me===""||me==null)?bt.setRateLimits({fpsLimit:Mt().fpsLimit,tpsLimit:120}):bt.setRateLimits(Mt()),tn.current?bt.start():bt.stop(),vr(!0),I(ct?ct.getOrbit():null),Ft(ct&&Array.isArray(ct.presets)?ct.presets:[]),Xe(ct&&Array.isArray(ct.poseFields)?ct.poseFields:[])}catch($r){Pt("[Benchmark] "+($r&&$r.message?$r.message:String($r)));return}Wt(),ke.current=setInterval(Wt,pT)}return function(){K=!0,F(),clearInterval(Nt),ke.current&&(clearInterval(ke.current),ke.current=null),ve.current=null}},[G,h]),j.useEffect(function(){var F=ce.current;if(De(im()),!F){Ut.current=null;return}var K=wA(F);Ut.current=K,De(K.current());var We=K.subscribe(De);return function(){We(),K.close(),Ut.current===K&&(Ut.current=null)}},[G,h]),j.useEffect(function(){var F=ve.current;if(F&&typeof F.setRateLimits=="function")try{F.setRateLimits(Mt())}catch{}},[je,me,Mt]),j.useEffect(function(){var F=ir.current;if(!(!d||!F)){if(!te){var K=re,We=Us(F,K,"not-offered-no-roster-row",K+" has no showcase-roster row");return function(){Pn.close(),We.close()}}var kn=function(){tn.current=!0;var bt=ve.current;if(bt)try{bt.start(),Wt()}catch(ct){Pt("[GYM] "+(ct&&ct.message?ct.message:String(ct)))}},Nt=W,Sn=Pl(F,{seenKey:Nt.seenKey,title:Nt.title,paragraphs:Nt.paragraphs,onContinue:kn,progress:Ut.current||void 0},{covers:St.current});return ln.current=Sn,Sn.ready.then(function(bt){bt.shows||kn()}),function(){Pn.close(),ln.current=null,Sn.close()}}},[G]),j.useEffect(function(){var F=ht.current;if(!(!d||!F)){if(!te||!Y){var K=Us(F,Y?Y.seenKey:re,"not-offered-no-roster-row",re+(te?": the roster has no showcase intro":" has no showcase-roster row"));return function(){An.close(),K.close()}}var We=Pl(F,Y,{covers:ye.current});return Wn.current=We,function(){An.close(),Wn.current=null,We.close()}}},[G]),j.useEffect(function(){Xt&&(Pn.close(),An.close(),ln.current&&(ln.current.close(),ln.current=null),Wn.current&&(Wn.current.close(),Wn.current=null))},[Xt]);const lt=j.useCallback(function(){var F=ve.current;if(F)try{F.isRunning?F.stop():F.start(),Wt()}catch(K){Pt("[Benchmark] "+(K&&K.message?K.message:String(K)))}},[]),we={root:{position:"relative",display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",background:"#111",fontFamily:"ui-monospace,Menlo,Consolas,monospace",fontSize:"0.75rem",color:"#ccc"},toolbar:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",borderBottom:"1px solid #222",flexShrink:0,flexWrap:"wrap"},label:{color:"#555",fontSize:"0.65rem"},select:{padding:"2px 6px",background:"#1a1a1a",border:"1px solid #2a2a2a",color:"#ccc",borderRadius:"2px",font:"11px ui-monospace",outline:"none"},num:{width:"52px",padding:"2px 6px",background:"#1a1a1a",border:"1px solid #2a2a2a",color:"#ccc",borderRadius:"2px",font:"11px ui-monospace",outline:"none"},btn:{padding:"2px 10px",background:"#1a2a3a",color:"#8af",border:"1px solid #2a3a4a",borderRadius:"3px",cursor:"pointer",fontSize:"0.7rem"},btnStop:{background:"#2a1a1a",color:"#f84",border:"1px solid #3a2a2a"},readBar:{display:"flex",alignItems:"center",gap:"18px",padding:"4px 12px",borderBottom:"1px solid #1a1a1a",flexShrink:0,fontSize:"0.7rem"},metric:{color:"#888"},metricBig:{color:"#6c9",fontWeight:700,fontSize:"0.95rem"},paneRow:{display:"flex",flex:1,overflow:"hidden",gap:"1px",background:"#222"},paneWrap:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",background:"#111"},paneTitle:{padding:"3px 8px",borderBottom:"1px solid #1a1a1a",flexShrink:0,fontSize:"0.65rem",color:"#555",textTransform:"uppercase",letterSpacing:"0.5px"},frame:{flex:1,border:0,width:"100%",height:"100%",background:"#000"},errBanner:{background:"#2a1111",color:"#cc4444",padding:"6px 12px",fontSize:"0.7rem",flexShrink:0},hint:{padding:"2px 12px",fontSize:"0.6rem",color:"#333",flexShrink:0}};function pt(F){typeof o=="function"&&(o("walkthrough",F.id),o("mode",Tl(Kt(n,F.id)).length>1?F.mode:""))}function _(F){tn.current=!1;var K=!!(d&&F&&F.id===d.id);K||(x(null),g(!1),E(null),S(null),L(null)),f(F),pt(F)}var R=d&&d.kind==="rung"?Kt(n,d.id):null;function P(){return md(n,R.id).then(function(F){return F.files[$o(F.files)]}).catch(function(F){throw Pt("[GYM] the code behind could not be read: "+(F&&F.message?F.message:String(F))),F})}function $(F){var K=(F||"").trim();if(K){var We=$g(m),kn=m.text;md(n,R.id,{mode:d.mode}).then(function(Nt){var Sn=Object.assign({},Nt.files);Sn[$o(Sn)]=kn,sm(gn(),{files:Sn,renderState:Nt.renderState},K),S(null),L({ok:!0,text:We?'Saved your code as "'+K+'"; the frame still runs the previous text — Run to see it.':'Saved as "'+K+'" — it opens in STUDIO under Saved projects.'})}).catch(function(Nt){L({ok:!1,text:"Save As failed: "+(Nt&&Nt.message?Nt.message:String(Nt))})})}}function U(){if(m){g(!0);return}P().then(function(F){x(Dl(F)),g(!0)},function(){})}function H(F){x(wS(m,F)),E(null),Pt(null),g(!1),Dn()}function he(){P().then(function(F){x(Dl(F)),E(null),Pt(null),Dn()},function(){})}function Ae(F){x(nm(m,F)),g(!1)}var Ve=fA(m),Qe=a1(n),Be=y.jsxs("select",{style:we.select,value:Rx(d),disabled:Qe.length===0,"data-role":"gym-experiment-select",onChange:function(F){_(s1(n,F.target.value))},children:[(!d||d.kind==="empty")&&y.jsx("option",{value:"",disabled:!0,children:d?"Empty Universe":"— pick a scene —"}),Qe.map(function(F,K){return y.jsx("optgroup",{label:F.label,children:F.rows.map(function(We){return y.jsx("option",{value:We.value,children:We.title},K+":"+We.value)})},K+":"+F.label)})]}),Ce=d&&d.kind==="rung"?Tl(Kt(n,d.id)):[],qe=Ce.length>1?y.jsx("span",{"data-role":"gym-mode-strip",style:{display:"inline-flex",gap:"4px"},children:Ce.map(function(F){var K=F.id===d.mode;return y.jsx("button",{"data-mode":F.id,"data-active":K?"1":"0",style:Object.assign({},we.btn,K?{background:"#27424f",color:"#7ec8e3",borderColor:"#7ec8e3"}:{}),onClick:function(){K||_({kind:"rung",id:d.id,mode:F.id})},children:F.label},F.id)})}):null,nn=d?null:u.error;return y.jsxs("div",{style:we.root,"data-role":"gym-root","data-scene":Rx(d),"data-scene-source":dA(m),"data-scene-mode":d&&d.mode||"","data-booted":Mn?"1":"0",children:[y.jsxs("div",{ref:ye,"data-role":"gym-covered",style:{display:"contents"},children:[y.jsxs("div",{ref:St,"data-role":"gym-scene-covered",style:{display:"contents"},children:[y.jsxs("div",{style:we.toolbar,children:[y.jsx("span",{style:we.label,children:"Scene:"}),Be,qe,y.jsx("span",{style:we.label,title:"Render frames/sec cap. Blank = display refresh (draw every animation frame).",children:"FPS:"}),y.jsx("input",{style:we.num,type:"number",min:"0",placeholder:"max",value:je,onChange:function(F){ie(F.target.value)}}),y.jsx("span",{style:we.label,title:"Physics ticks/sec cap. Blank = unbounded (as many ticks per frame as the budget allows).",children:"TPS:"}),y.jsx("input",{style:we.num,type:"number",min:"0",placeholder:"∞",value:me,onChange:function(F){xe(F.target.value)}}),ut?y.jsx("button",{style:Object.assign({},we.btn,we.btnStop),onClick:lt,disabled:!Mn,children:"Pause"}):y.jsx("button",{style:we.btn,onClick:lt,disabled:!Mn,children:"Run"}),y.jsx("button",{style:we.btn,onClick:Dn,children:"Reset"}),y.jsx(uT,{style:we.btn}),y.jsx("button",{style:Object.assign({},we.btn,R?{}:{opacity:.45,cursor:"not-allowed"}),"data-role":"gym-scene-code",disabled:!R,title:R?"See and edit this scene's code — "+R.source:"No scene is showing.",onClick:U,children:"Code behind"}),y.jsxs("span",{"data-role":"gym-reopen",style:{display:"inline-flex",gap:"4px"},children:[y.jsx("button",{type:"button",style:Object.assign({},we.btn,Y?{}:{opacity:.45,cursor:"not-allowed"}),"data-role":"gym-reopen-intro",disabled:!Y,title:Y?Y.title:"This site's roster has no showcase intro.",onClick:function(){An.open(Y)},children:"Why impossible"}),y.jsx("button",{type:"button",style:Object.assign({},we.btn,W?{}:{opacity:.45,cursor:"not-allowed"}),"data-role":"gym-reopen-scene",disabled:!W,title:W?W.title:"This scene has no showcase card.",onClick:function(){Pn.open(W)},children:"About this scene"})]}),!Mn&&!Xt&&Vb(Et)&&y.jsx("span",{"data-role":"gym-boot-caption",style:{color:"#886",fontSize:"0.65rem"},children:Vb(Et)})]}),y.jsxs("div",{style:we.readBar,children:[y.jsxs("span",{style:we.metric,children:["TPS ",y.jsx("span",{style:we.metricBig,"data-gym-metric":"tps",children:ge.tps})]}),y.jsxs("span",{style:we.metric,children:["FPS ",y.jsx("span",{style:we.metricBig,"data-gym-metric":"fps",children:ge.fps})]}),y.jsxs("span",{style:we.metric,children:["tick ",y.jsx("code",{style:{color:"#aaa"},"data-gym-metric":"tick",children:ge.tick})]}),y.jsxs("span",{style:we.metric,children:["alive ",y.jsx("code",{style:{color:"#aaa"},"data-gym-metric":"alive",children:ge.alive})]}),y.jsxs("span",{style:{color:"#445"},children:[me===""||me==null?"TPS unbounded":"TPS≤"+me," ·",je===""||je==null?" FPS=display-refresh":" FPS≤"+je]})]}),Tn&&y.jsxs("div",{style:we.toolbar,"data-role":"bench-camera-controls",children:[y.jsx("span",{style:we.label,title:"3D orbit camera — driven via the experiment's sugar cameraControl handle (BYO renderer capability)",children:"📷 camera"}),cn.map(function(F){var K=WS(F);return K?y.jsxs(Ze.Fragment,{children:[y.jsx("span",{style:we.label,title:F.description,children:HS(F)}),y.jsx("input",{style:{width:"90px",cursor:"pointer",accentColor:"#7ec8e3"},type:"range",min:K.min,max:K.max,step:K.step,value:Math.round(Tn[F.name]),onChange:function(We){var kn={};kn[F.name]=Number(We.target.value),un(kn)}})]},F.name):null}),y.jsx("span",{style:we.label,children:"view"}),Ie.map(function(F){var K=de===F;return y.jsx("button",{style:Object.assign({},we.btn,K?{background:"#27424f",color:"#7ec8e3",borderColor:"#7ec8e3"}:{}),onClick:function(){Pe(F)},children:F},F)})]}),y.jsx("div",{style:we.hint,children:"Single-engine (WASM) throughput. Cadence owned by the sugar FrqtlApp (decoupled _tickHz/_drawHz via a fixed-timestep accumulator); the engine just runs doTick(). Cap FPS to paint slower than physics ticks; leave blank for max."}),(nn||Xt)&&y.jsx("div",{style:Object.assign({},we.errBanner,{whiteSpace:"pre-wrap"}),children:nn||Xt}),y.jsx("div",{style:we.paneRow,children:y.jsxs("div",{style:we.paneWrap,children:[y.jsx("div",{style:we.paneTitle,children:"WASM engine — benchmark"}),V&&y.jsx("iframe",{ref:ce,style:we.frame,title:"WASM Engine",src:pe()},"bench-wasm-"+G+"-"+h)]})}),m&&R&&y.jsxs("div",{"data-role":"gym-scene-editor","data-open":b?"1":"0",style:{position:"absolute",inset:0,zIndex:9e3,display:b?"block":"none"},children:[y.jsx(j.Suspense,{fallback:y.jsx("div",{style:{padding:"12px",color:"#886"},children:"Loading the editor…"}),children:y.jsx(CS,{fileName:R.source,source:m.text,appliedSource:af(m),monacoBaseUrl:s,onRun:H,onReset:he,onClose:Ae,onChange:function(F){x(function(K){return nm(K,F)})},error:k,extraActions:[{id:"save-as",label:"Save As",title:"Save this code as a project (it opens in STUDIO)",onClick:function(){L(null),S(R.id+" copy")}},{id:"open-in-studio",label:"Open in STUDIO",disabled:!!Ve||typeof a!="function",title:Ve||"Open this scene in STUDIO (palette, inspector, Save)",onClick:function(){a()}}]})}),C!==null&&y.jsxs("form",{"data-role":"gym-save-as-prompt",style:{position:"absolute",top:"40px",right:"12px",zIndex:2,display:"flex",gap:"6px",padding:"8px",background:"#1a1a1a",border:"1px solid #333",borderRadius:"4px"},onSubmit:function(F){F.preventDefault(),$(C)},children:[y.jsx("input",{type:"text",value:C,autoFocus:!0,"aria-label":"Project name",onChange:function(F){S(F.target.value)},style:we.select}),y.jsx("button",{type:"submit",style:we.btn,children:"Save"}),y.jsx("button",{type:"button",style:we.btn,onClick:function(){S(null)},children:"Cancel"})]}),M&&y.jsx("div",{"data-role":"gym-save-notice","data-ok":M.ok?"1":"0",style:{position:"absolute",left:0,right:0,bottom:0,zIndex:2,padding:"6px 12px",fontSize:"0.7rem",background:M.ok?"#0f1a12":"#2a1111",color:M.ok?"#9ad0a0":"#cc4444"},children:M.text})]})]}),y.jsx("div",{ref:ir,"data-role":"gym-scene-card-host",style:{position:"absolute",inset:0,zIndex:1e4,pointerEvents:"none"}})]}),y.jsx("div",{ref:ht,"data-role":"gym-intro-host",style:{position:"absolute",inset:0,zIndex:1e4,pointerEvents:"none"}})]})}function gT(e,t){var n={},r=null;return{load:function(i){return Fk(i)?(r===null&&(r=Promise.resolve().then(function(){return TA(PA(e),{fetch:n.fetch})})),r):null}}}function vT(e){const t=e&&typeof e.querySelector=="function"?e.querySelector('link[rel="home"]'):null;if(!t)return null;const n=t.getAttribute("href");if(!n)throw new Error('home-link: <link rel="home"> carries no href — the declaration is malformed');return n}function yT(e){if(!e||!Array.isArray(e.notebooks))throw new Error("[notebook catalog] no notebooks[] array — cannot resolve the first-contact notebook.");var t=e.firstContact;if(typeof t!="string"||t==="")throw new Error('[notebook catalog] notebooks.json declares no "firstContact" notebook id — FAT has nothing to open with no ?notebook= (lib/notebooks/notebooks.json).');for(var n=0;n<e.notebooks.length;n++)if(e.notebooks[n].id===t)return e.notebooks[n];throw new Error('[notebook catalog] firstContact "'+t+'" is not in the catalog — listed ids: ['+e.notebooks.map(function(r){return r.id}).join(", ")+"].")}function bT(e,t){if(t!=="factory"&&t!=="recipe")throw new Error('[setup-builder] parseSetupDeclaration(setup, shape): shape is "factory" or "recipe" (got '+JSON.stringify(t)+") — the `setup` grammar depends on it. (FAIL-LOUD.)");if(typeof e!="string"||!e.trim())throw new Error("[setup-builder] a declared canvas requires a `setup` attribute — "+(t==="recipe"?'`setup="<module-name>"`':'`setup="<module-name>#<factoryName>"`')+" (got: "+JSON.stringify(e)+"). (FAIL-LOUD.)");var n=e.trim(),r=n.indexOf("#"),i=r===-1?n:n.slice(0,r),o=r===-1?"":n.slice(r+1);if(i=i.trim(),o=o.trim(),!i)throw new Error('[setup-builder] `setup` declaration "'+e+'" has no module name before the "#". Expected "<module-name>#<exportName>". (FAIL-LOUD.)');if(t==="recipe"&&r!==-1)throw new Error('[setup-builder] a recipe canvas names no export: `setup="'+e+'"` carries "#'+o+'", but a recipe is the module\'s DEFAULT export (`export default function buildExperiment(exp)`) — write setup="'+i+'". (FAIL-LOUD.)');if(t==="factory"&&!o)throw new Error('[setup-builder] a factory canvas names its factory: `setup="'+e+'"` has no "#<factoryName>" — a setup module exports its factory by name; write setup="'+i+'#<factoryName>". (FAIL-LOUD.)');return{moduleName:i,exportName:o}}function l1(e){for(var t=String(e??"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/(^|[^:])\/\/[^\n]*/g,"$1"),n=[],r=/\bexport\s+(?:async\s+)?(?:function\*?|const|let|var|class)\s+([A-Za-z_$][\w$]*)/g,i;(i=r.exec(t))!==null;)n.push(i[1]);for(var o=/\bexport\s*\{([^}]*)\}/g,s;(s=o.exec(t))!==null;){var a=s[1];a.split(",").forEach(function(d){var f=d.trim();if(f){var h=/\bas\s+([A-Za-z_$][\w$]*)\s*$/.exec(f);if(h){n.push(h[1]);return}var v=/^([A-Za-z_$][\w$]*)$/.exec(f);v&&n.push(v[1])}})}for(var l=Object.create(null),c=[],u=0;u<n.length;u++)n[u]!=="default"&&(l[n[u]]||(l[n[u]]=!0,c.push(n[u])));return c}function xT(e,t){var n=t||{};if(Object.prototype.hasOwnProperty.call(n,e))return n[e];for(var r=qo(e),i=Object.keys(n),o=0;o<i.length;o++)if(qo(i[o])===r)return n[i[o]];throw new Error('[setup-builder] declared setup module "'+e+'" is not a `type="module"` cell in this notebook (known modules: ['+i.join(", ")+"]). (FAIL-LOUD — the declared canvas references an editable in-notebook module cell, never an opaque by-name load.)")}function wT(e,t,n){var r=l1(n);if(r.indexOf(t)===-1)throw new Error('[setup-builder] declared setup export "'+t+'" is not exported by module "'+e+'" (its exports: ['+r.join(", ")+"]). (FAIL-LOUD.)");return t}function _T(e){if(e==null||e==="")return null;var t=/^(\d+)\s*[x×]\s*(\d+)$/.exec(String(e).trim());if(!t)throw new Error('[setup-builder] `stage` must be "<W>x<H>" (e.g. "480x480"); got '+JSON.stringify(e)+". (FAIL-LOUD.)");return{canvasW:parseInt(t[1],10),canvasH:parseInt(t[2],10)}}function kT(e){if(e==null||e==="")return null;var t=Number(String(e).trim());if(!Number.isInteger(t))throw new Error("[setup-builder] `seed` must be an integer; got "+JSON.stringify(e)+". (FAIL-LOUD.)");return t}function ST(e){e=e||{};var t=e.shape==null||e.shape===""?"factory":String(e.shape).trim();if(t!=="factory"&&t!=="recipe")throw new Error('[setup-builder] unknown canvas `shape` "'+e.shape+'" — expected "factory" (a `fn(frqtl, universe, options)` setup export) or "recipe" (a `buildExperiment(exp)` RecipeContext recipe). (FAIL-LOUD — never guess.)');var n=bT(e.setup,t),r=xT(n.moduleName,e.modules),i=_T(e.stage),o=kT(e.seed),s=e.outName||"_run",a=String(s).replace(/[^A-Za-z0-9_$]/g,"_");/^[0-9]/.test(a)&&(a="_"+a);var l=JSON.stringify(e.opts||{}),c=[];i&&(c.push("canvasW: "+i.canvasW),c.push("canvasH: "+i.canvasH)),o!==null&&c.push("seed: "+o);var u=e.render3d?c.concat(["is3D: true"]):c,d="{ "+u.join(", ")+" }",f="",h=e.renderOptions||{};Object.keys(h).forEach(function(k){f+="runner.setRenderOption("+JSON.stringify(k)+", "+JSON.stringify(h[k])+`);
|
|
115
|
-
`});var v="";e.cameraPreset&&(v=`if (runner.cameraControl && typeof runner.cameraControl.setPreset === 'function') {
|
|
116
|
-
runner.cameraControl.setPreset(`+JSON.stringify(e.cameraPreset)+`);
|
|
117
|
-
}
|
|
118
|
-
`);var m,x;if(t==="recipe"){if(m="default",e.opts&&Object.keys(e.opts).length>0)throw new Error('[setup-builder] a recipe-shape canvas ("'+n.moduleName+'") takes NO `opts` — `buildExperiment(exp)` receives a single RecipeContext, not a knob bag (got opts '+JSON.stringify(e.opts)+'). Remove the `opts` attr or use shape="factory". (FAIL-LOUD.)');if(i)throw new Error('[setup-builder] a recipe-shape canvas ("'+n.moduleName+'") takes NO `stage` — the recipe states its world, size included, in its exp.createCanvas(w, h, cfg) / exp.createScene(w, h, d, cfg) call; a stage here would be a second size. (FAIL-LOUD.)');var b=c.slice();b.push("deferCanvas: true");var g="{ "+b.join(", ")+" }";x=`const { frqtl } = caps;
|
|
119
|
-
await frqtl.ensureEngine();
|
|
120
|
-
const buildExperiment = (await import('`+n.moduleName+`')).default;
|
|
121
|
-
if (typeof buildExperiment !== 'function') {
|
|
122
|
-
throw new Error('[setup-builder] recipe module "`+n.moduleName+"\" has no default export function — a recipe-shape canvas runs `export default function buildExperiment(exp)` (a classic `window.buildExperiment` tail defines no export). (FAIL-LOUD.)');\n}\nconst exp = frqtl.RecipeContext("+g+`);
|
|
123
|
-
exp.build(buildExperiment);
|
|
124
|
-
const runner = exp.runner;
|
|
125
|
-
`+f+v+"return { "+a+`: runner };
|
|
126
|
-
`}else{if(m=wT(n.moduleName,n.exportName,r),!i)throw new Error('[setup-builder] a factory-shape canvas ("'+n.moduleName+'") needs `stage="<W>x<H>"` — the runner has no default world size. (FAIL-LOUD.)');x=`const { frqtl } = caps;
|
|
127
|
-
await frqtl.ensureEngine();
|
|
128
|
-
const { `+m+" } = await import('"+n.moduleName+`');
|
|
129
|
-
const opts = frqtl.knob('`+m+"', "+l+`);
|
|
130
|
-
const runner = frqtl.FrqtlApp(`+d+`);
|
|
131
|
-
runner.setup(frqtl.carryFactoryStatics((universe, o) => `+m+"(frqtl, universe, o), "+m+`), opts);
|
|
132
|
-
`+f+v+"return { "+a+`: runner };
|
|
133
|
-
`}return{builderCode:x,outName:a,moduleName:n.moduleName,exportName:m,shape:t,usesModulePath:!0}}function ET(e){if(typeof e!="string"||!e.trim())throw new Error('[view-builder] a `view` cell requires a `module="<module-name>#<exportName>"` attribute (got: '+JSON.stringify(e)+"). (FAIL-LOUD.)");var t=e.trim(),n=t.indexOf("#"),r=n===-1?t:t.slice(0,n),i=n===-1?"":t.slice(n+1);if(r=r.trim(),i=i.trim(),!r)throw new Error('[view-builder] `module` declaration "'+e+'" has no module name before the "#". Expected "<module-name>#<exportName>". (FAIL-LOUD.)');return{moduleName:r,exportName:i}}function OT(e,t){var n=t||{};if(Object.prototype.hasOwnProperty.call(n,e))return n[e];for(var r=qo(e),i=Object.keys(n),o=0;o<i.length;o++)if(qo(i[o])===r)return n[i[o]];throw new Error('[view-builder] declared view module "'+e+'" is not a `type="module"` cell in this notebook (known modules: ['+i.join(", ")+"]). (FAIL-LOUD — the `view` cell references an editable in-notebook module cell, never an opaque by-name load.)")}function CT(e,t,n){var r=l1(n);if(t){if(r.indexOf(t)===-1)throw new Error('[view-builder] declared view export "'+t+'" is not exported by module "'+e+'" (its exports: ['+r.join(", ")+"]). (FAIL-LOUD.)");return t}if(r.length===1)return r[0];throw r.length===0?new Error('[view-builder] view module "'+e+'" has NO named export — declare `module="'+e+'#<exportName>"` once the module exports a render function. (FAIL-LOUD — never guess.)'):new Error('[view-builder] view module "'+e+'" has MULTIPLE exports ['+r.join(", ")+'] — the `#export` part of `module` is required to pick one (e.g. module="'+e+"#"+r[0]+'"). (FAIL-LOUD — never guess.)')}function jT(e){e=e||{};var t=ET(e.module),n=OT(t.moduleName,e.modules),r=CT(t.moduleName,t.exportName,n),i=e.outName||"_view",o=String(i).replace(/[^A-Za-z0-9_$]/g,"_");/^[0-9]/.test(o)&&(o="_"+o);var s="import { "+r+" } from '"+t.moduleName+`';
|
|
134
|
-
return { `+o+": "+r+` };
|
|
135
|
-
`;return{entryCode:s,outName:o,moduleName:t.moduleName,exportName:r}}function RT(e){e=e||{};var t=e.mount,n=e.handle;if(!n||typeof n.on!="function"||typeof n.call!="function")throw new Error("[view-ctx] requires a frozen ViewHandle with on()/call(). (FAIL-LOUD.)");var r=e.bindings||{},i=typeof e.getBinding=="function"?e.getBinding:function(a){return Object.prototype.hasOwnProperty.call(r,a)?r[a]:void 0},o=typeof e.commit=="function"?e.commit:null;function s(a,l){if(typeof a!="string"||!a)throw new Error("[view-ctx] commit: name must be a non-empty string. (FAIL-LOUD.)");if(!o)throw new Error('[view-ctx] commit("'+a+'"): no commit sink wired for this view (declare a `produces` binding + supply a host commit callback). (FAIL-LOUD.)');cd(l,'view commit("'+a+'") value'),o(a,l)}return{mount:t,handle:n,on:function(a,l){return n.on(a,l)},call:function(a,l){return n.call(a,l)},getBinding:i,commit:s,imports:e.imports||{}}}function LT(e){e=e||{};var t=e.id||"(unnamed)",n=Array.isArray(e.produces)?e.produces:[],r=Array.isArray(e.out)?e.out:[],i=Array.isArray(e.in)?e.in:[];if(e.spec)throw new Error('[frqtl] canvas cell "'+t+'" carries a `spec` ("'+e.spec+'", an opaque factory name) — that path is RETIRED. Declare `setup="<module>#<export>"` on the canvas instead. (FAIL-LOUD.)');var o=r.filter(function(a){return n.indexOf(a)===-1}),s=!!e.bind||i.length>0||o.length>0;if(!e.setup)throw new Error('[frqtl] canvas cell "'+t+'" declares no `setup="<module>#<export>"` '+(s?"but carries a legacy `bind=`/`in=`/`out=` runner reference — that authored builder path is DELETED. Convert it to a declarative canvas. ":"— nothing to render. ")+"(FAIL-LOUD — one developer-facing way: module + declarative canvas.)");if(s)throw new Error('[frqtl] canvas cell "'+t+'" declares `setup` AND carries a legacy `bind=`/`in=`/`out=` runner reference ('+(e.bind?'bind="'+e.bind+'" ':"")+(i.length?"in=["+i.join(", ")+"] ":"")+(o.length?"out=["+o.join(", ")+"] not in produces ":"")+"). A declared canvas needs ONLY `setup`/`opts`/`stage`/`seed` (+ optional `produces`/`produceVia`). The authored runner-building builder is RETIRED. (FAIL-LOUD — never silently prefer one authority.)");return{produces:n.slice()}}var AT="detectorHistogram";async function PT(e,t,n){var r=Array.isArray(t)?t:[];if(!r.length)return[];if(!e||typeof e.call!="function")throw new Error("[produced-bindings] deriveProducedBindings requires a frozen view-handle with call(). (FAIL-LOUD.)");for(var i=typeof n=="string"&&n?n:AT,o=[],s=0;s<r.length;s++){var a=r[s],l=await e.call(i,[]);cd(l,'produces("'+a+'") from realm canvas'),o.push({name:a,value:l})}return o}var MT=600,TT=1e5;function DT(e,t){if(e==null||e==="")return t;var n=typeof e=="number"?e:Number(String(e).trim());if(!Number.isInteger(n)||n<0)throw new Error('[warmup] produceAfter must be a non-negative integer tick count; got "'+e+'". (FAIL-LOUD — a malformed warmup count would silently empty the produced histogram.)');return n}async function IT(e,t,n,r){if(!e||typeof e.step!="function")throw new Error("[warmup] warmUpRealm requires a frozen view-handle with step(). (FAIL-LOUD.)");for(var i=DT(t,n),o=isFinite(r)?r:1/0,s=Math.min(i,o),a=0;a<s;a++)await e.step();return s}function FT(e){return!!(e&&e.querySelector&&e.querySelector("[data-egpt-boot-error]"))}function Ax(e){var t=String(e??"").replace(/\r\n/g,`
|
|
136
|
-
`).split(`
|
|
137
|
-
`),n=[],r=!1;function i(f){return f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function o(f){return f=i(f),f=f.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)"<>]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),f=f.replace(/`([^`]+)`/g,"<code>$1</code>"),f=f.replace(/\*\*([^*]+)\*\*/g,"<b>$1</b>"),f=f.replace(/\*([^*]+)\*/g,"<i>$1</i>"),f}for(var s=0;s<t.length;s++){var a=t[s].replace(/^\s+/,function(f){return f.length>8?f.slice(0,8):f}),l=a.trim();if(!l){r&&(n.push("</ul>"),r=!1);continue}var c=/^(#{1,6})\s+(.*)$/.exec(l);if(c){r&&(n.push("</ul>"),r=!1);var u=c[1].length;n.push("<h"+u+">"+o(c[2])+"</h"+u+">");continue}var d=/^[-*]\s+(.*)$/.exec(l);if(d){r||(n.push("<ul>"),r=!0),n.push("<li>"+o(d[1])+"</li>");continue}r&&(n.push("</ul>"),r=!1),n.push("<p>"+o(l)+"</p>")}return r&&n.push("</ul>"),n.join(`
|
|
138
|
-
`)}var Jn={EDIT:"edit",COMMAND_MODE:"command-mode",SELECT_PREV:"select-prev",SELECT_NEXT:"select-next",RUN_ADVANCE:"run-advance",RUN_INPLACE:"run-inplace"};function NT(e,t){if(!e||typeof e.key!="string")return null;var n=e.key,r=!!e.shiftKey,i=!!(e.metaKey||e.ctrlKey);return t?n==="Escape"?Jn.COMMAND_MODE:null:n==="Enter"?i?Jn.RUN_INPLACE:r?Jn.RUN_ADVANCE:Jn.EDIT:n==="Escape"?Jn.COMMAND_MODE:n==="ArrowUp"?Jn.SELECT_PREV:n==="ArrowDown"?Jn.SELECT_NEXT:null}function zT(e,t,n){if(typeof e!="number"||e<0)return 0;if(n==="inplace")return e;var r=e+1;return r>=t?Math.max(0,t-1):r}var Ti={JS:"js",REALM:"realm",MARKDOWN_RENDER:"markdown-render",MODULE_ADVANCE:"module-advance"};function BT(e){return e==="markdown"?{leaf:Ti.MARKDOWN_RENDER,executes:!1}:e==="module"?{leaf:Ti.MODULE_ADVANCE,executes:!1}:e==="canvas"||e==="chart"||e==="view"?{leaf:Ti.REALM,executes:!0}:{leaf:Ti.JS,executes:!0}}var UT=2e3,mm=["info","warn","error","pass","fail"],gm={info:"log-info",warn:"log-warn",error:"log-error",pass:"log-test-pass",fail:"log-test-fail"},c1={info:"INFO",warn:"WARN",error:"ERR",pass:"PASS",fail:"FAIL"},Mh=typeof window<"u"&&window.console?{log:window.console.log.bind(window.console),warn:window.console.warn.bind(window.console),error:window.console.error.bind(window.console)}:null,Px=!1;function HT(){if(!Px){Px=!0;var e=WT("console.css");if(e){var t=document.createElement("link");t.rel="stylesheet",t.href=e,document.head.appendChild(t)}else{var n=document.createElement("style");n.textContent=VT,document.head.appendChild(n)}}}function WT(e){for(var t=document.querySelectorAll("script[src]"),n=0;n<t.length;n++){var r=t[n].getAttribute("src")||"";if(r.indexOf("console-output/index.js")!==-1||r.indexOf("console-output\\index.js")!==-1){var i=r.substring(0,r.lastIndexOf("/")+1);return i+e}}return null}var VT=[".egpt-console{display:flex;flex-direction:column;height:100%;background:#1e1e1e;","color:#d4d4d4;font-family:ui-monospace,Menlo,Consolas,monospace;overflow:hidden}",".egpt-console__toolbar{flex:0 0 auto;display:flex;align-items:center;gap:4px;","padding:4px 8px;background:#2d2d2d;border-bottom:1px solid #444}",".egpt-console__title{font-size:11px;font-weight:bold;text-transform:uppercase;","color:#aaa;margin-right:8px}",".egpt-console__logs{flex:1 1 auto;overflow-y:auto;padding:8px 12px;","font-size:13px;line-height:1.55}",".log-line{display:flex;gap:8px;margin-bottom:3px;white-space:pre-wrap;word-break:break-all}",".log-line.egpt-hidden{display:none}",".log-line__ts{flex:0 0 auto;color:#555;font-size:11px;line-height:1.7}",".log-line__badge{flex:0 0 auto;font-size:10px;font-weight:bold;padding:1px 4px;","border-radius:2px;line-height:1.9;text-transform:uppercase}",".log-line__text{flex:1 1 auto}",".log-info .log-line__text{color:#d4d4d4}",".log-warn .log-line__text{color:#cca700}",".log-error .log-line__text,.log-test-fail .log-line__text{color:#f44336;font-weight:bold}",".log-test-pass .log-line__text{color:#4caf50;font-weight:bold}",".egpt-console__filter-btn,.egpt-console__clear-btn{padding:1px 7px;font-size:11px;","border:1px solid #555;border-radius:3px;background:transparent;color:#aaa;","cursor:pointer;font-family:inherit;line-height:1.6}",".egpt-console__filter-btn.active,.egpt-console__filter-btn:hover,",".egpt-console__clear-btn:hover{background:#3a3a3a;color:#d4d4d4}"].join("");function qT(){var e=new Date,t=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),r=String(e.getSeconds()).padStart(2,"0");return t+":"+n+":"+r}function so(e){e=e||{},this._mountEl=e.mountEl||null,this._logsEl=null,this._lineCount=0,this._domLineCount=0,this._busHandlers=null,this._activeFilters={};for(var t=0;t<mm.length;t++)this._activeFilters[mm[t]]=!0;HT(),this._build()}so.prototype._build=function(){var e=this._mountEl;if(e){e.innerHTML="",e.className=(e.className?e.className+" ":"")+"egpt-console";var t=document.createElement("div");t.className="egpt-console__toolbar";var n=document.createElement("span");n.className="egpt-console__title",n.textContent="Output / Console",t.appendChild(n);var r=document.createElement("div");r.className="egpt-console__filters";var i=this;mm.forEach(function(d){var f=document.createElement("button");f.className="egpt-console__filter-btn active",f.setAttribute("data-level",d),f.setAttribute("title","Toggle "+d+" messages"),f.textContent=c1[d]||d.toUpperCase(),f.addEventListener("click",function(){i._toggleFilter(d,f)}),r.appendChild(f)}),t.appendChild(r);var o=document.createElement("span");o.className="egpt-console__spacer",t.appendChild(o);var s=document.createElement("button");s.className="egpt-console__clear-btn",s.setAttribute("title","Clear console"),s.textContent="Clear",s.addEventListener("click",function(){i.clear()}),t.appendChild(s),e.appendChild(t);var a=document.createElement("div");a.className="egpt-console__logs",e.appendChild(a),this._logsEl=a,this._toolbar=t,this._filterBtns={};for(var l=r.querySelectorAll(".egpt-console__filter-btn"),c=0;c<l.length;c++){var u=l[c].getAttribute("data-level");this._filterBtns[u]=l[c]}}};so.prototype._toggleFilter=function(e,t){var n=!this._activeFilters[e];this._activeFilters[e]=n,n?t.classList.add("active"):t.classList.remove("active");for(var r=gm[e]||"log-"+e,i=this._logsEl?this._logsEl.querySelectorAll("."+r):[],o=0;o<i.length;o++)n?i[o].classList.remove("egpt-hidden"):i[o].classList.add("egpt-hidden")};so.prototype._pruneIfNeeded=function(){if(this._logsEl)for(;this._domLineCount>UT;){var e=this._logsEl.firstChild;if(!e)break;this._logsEl.removeChild(e),this._domLineCount--}};so.prototype.log=function(e,t){typeof e!="string"&&(e="info"),typeof t!="string"&&(t=String(t));var n=gm[e]?e:"info",r=gm[n];this._lineCount++;var i=document.createElement("div");i.className="log-line "+r;var o=document.createElement("span");o.className="log-line__ts",o.textContent=qT(),i.appendChild(o);var s=document.createElement("span");s.className="log-line__badge",s.textContent=c1[n]||n.toUpperCase(),i.appendChild(s);var a=document.createElement("span");if(a.className="log-line__text",a.textContent=t,i.appendChild(a),this._activeFilters[n]||i.classList.add("egpt-hidden"),this._logsEl){this._logsEl.appendChild(i),this._domLineCount++,this._pruneIfNeeded();var l=this._logsEl,c=l.scrollHeight-l.scrollTop-l.clientHeight<40;c&&(l.scrollTop=l.scrollHeight)}var u=n==="error"||n==="fail"?"error":n==="warn"?"warn":"log";Mh&&Mh[u]&&Mh[u]("[ConsolePane]["+n+"]",t)};so.prototype.clear=function(){this._logsEl&&(this._logsEl.innerHTML="",this._domLineCount=0),this._lineCount=0};so.prototype.subscribe=function(e){var t=e||Ee,n=this;if(!t){window.console&&window.console.warn&&window.console.warn("[ConsolePane] subscribe() called but no bus available");return}this._busHandlers&&(t.off("console:write",this._busHandlers.write),t.off("console:clear",this._busHandlers.clear),t.off("run:result",this._busHandlers.result),t.off("engine:error",this._busHandlers.engErr)),this._busHandlers={write:function(r){var i=r&&r.level?r.level:"info",o=r&&r.text!=null?String(r.text):"";n.log(i,o)},clear:function(){n.clear()},result:function(r){var i=r&&r.source?r.source:"?";if(r&&r.ok)n.log("pass","["+i+"] Run completed OK.");else{var o=r&&r.error?r.error:"unknown error";n.log("fail","["+i+"] Run failed: "+o)}},engErr:function(r){var i=r&&r.message?r.message:String(r);n.log("error","[engine] "+i)}},t.on("console:write",this._busHandlers.write),t.on("console:clear",this._busHandlers.clear),t.on("run:result",this._busHandlers.result),t.on("engine:error",this._busHandlers.engErr)};typeof window<"u"&&(window.ConsolePane=so);/*!
|
|
139
|
-
* @kurkle/color v0.3.4
|
|
140
|
-
* https://github.com/kurkle/color#readme
|
|
141
|
-
* (c) 2024 Jukka Kurkela
|
|
142
|
-
* Released under the MIT License
|
|
143
|
-
*/function ic(e){return e+.5|0}const Di=(e,t,n)=>Math.max(Math.min(e,n),t);function Wa(e){return Di(ic(e*2.55),0,255)}function Yi(e){return Di(ic(e*255),0,255)}function ei(e){return Di(ic(e/2.55)/100,0,1)}function Mx(e){return Di(ic(e*100),0,100)}const ar={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},vm=[..."0123456789ABCDEF"],$T=e=>vm[e&15],KT=e=>vm[(e&240)>>4]+vm[e&15],Kc=e=>(e&240)>>4===(e&15),YT=e=>Kc(e.r)&&Kc(e.g)&&Kc(e.b)&&Kc(e.a);function GT(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&ar[e[1]]*17,g:255&ar[e[2]]*17,b:255&ar[e[3]]*17,a:t===5?ar[e[4]]*17:255}:(t===7||t===9)&&(n={r:ar[e[1]]<<4|ar[e[2]],g:ar[e[3]]<<4|ar[e[4]],b:ar[e[5]]<<4|ar[e[6]],a:t===9?ar[e[7]]<<4|ar[e[8]]:255})),n}const JT=(e,t)=>e<255?t(e):"";function XT(e){var t=YT(e)?$T:KT;return e?"#"+t(e.r)+t(e.g)+t(e.b)+JT(e.a,t):void 0}const QT=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function u1(e,t,n){const r=t*Math.min(n,1-n),i=(o,s=(o+e/30)%12)=>n-r*Math.max(Math.min(s-3,9-s,1),-1);return[i(0),i(8),i(4)]}function ZT(e,t,n){const r=(i,o=(i+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function eD(e,t,n){const r=u1(e,1,.5);let i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)r[i]*=1-t-n,r[i]+=t;return r}function tD(e,t,n,r,i){return e===i?(t-n)/r+(t<n?6:0):t===i?(n-e)/r+2:(e-t)/r+4}function ev(e){const n=e.r/255,r=e.g/255,i=e.b/255,o=Math.max(n,r,i),s=Math.min(n,r,i),a=(o+s)/2;let l,c,u;return o!==s&&(u=o-s,c=a>.5?u/(2-o-s):u/(o+s),l=tD(n,r,i,u,o),l=l*60+.5),[l|0,c||0,a]}function tv(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(Yi)}function nv(e,t,n){return tv(u1,e,t,n)}function nD(e,t,n){return tv(eD,e,t,n)}function rD(e,t,n){return tv(ZT,e,t,n)}function d1(e){return(e%360+360)%360}function iD(e){const t=QT.exec(e);let n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?Wa(+t[5]):Yi(+t[5]));const i=d1(+t[2]),o=+t[3]/100,s=+t[4]/100;return t[1]==="hwb"?r=nD(i,o,s):t[1]==="hsv"?r=rD(i,o,s):r=nv(i,o,s),{r:r[0],g:r[1],b:r[2],a:n}}function oD(e,t){var n=ev(e);n[0]=d1(n[0]+t),n=nv(n),e.r=n[0],e.g=n[1],e.b=n[2]}function sD(e){if(!e)return;const t=ev(e),n=t[0],r=Mx(t[1]),i=Mx(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${i}%, ${ei(e.a)})`:`hsl(${n}, ${r}%, ${i}%)`}const Tx={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Dx={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function aD(){const e={},t=Object.keys(Dx),n=Object.keys(Tx);let r,i,o,s,a;for(r=0;r<t.length;r++){for(s=a=t[r],i=0;i<n.length;i++)o=n[i],a=a.replace(o,Tx[o]);o=parseInt(Dx[s],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let Yc;function lD(e){Yc||(Yc=aD(),Yc.transparent=[0,0,0,0]);const t=Yc[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const cD=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function uD(e){const t=cD.exec(e);let n=255,r,i,o;if(t){if(t[7]!==r){const s=+t[7];n=t[8]?Wa(s):Di(s*255,0,255)}return r=+t[1],i=+t[3],o=+t[5],r=255&(t[2]?Wa(r):Di(r,0,255)),i=255&(t[4]?Wa(i):Di(i,0,255)),o=255&(t[6]?Wa(o):Di(o,0,255)),{r,g:i,b:o,a:n}}}function dD(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${ei(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const Th=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,hs=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function fD(e,t,n){const r=hs(ei(e.r)),i=hs(ei(e.g)),o=hs(ei(e.b));return{r:Yi(Th(r+n*(hs(ei(t.r))-r))),g:Yi(Th(i+n*(hs(ei(t.g))-i))),b:Yi(Th(o+n*(hs(ei(t.b))-o))),a:e.a+n*(t.a-e.a)}}function Gc(e,t,n){if(e){let r=ev(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=nv(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function f1(e,t){return e&&Object.assign(t||{},e)}function Ix(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Yi(e[3]))):(t=f1(e,{r:0,g:0,b:0,a:1}),t.a=Yi(t.a)),t}function hD(e){return e.charAt(0)==="r"?uD(e):iD(e)}class zl{constructor(t){if(t instanceof zl)return t;const n=typeof t;let r;n==="object"?r=Ix(t):n==="string"&&(r=GT(t)||lD(t)||hD(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var t=f1(this._rgb);return t&&(t.a=ei(t.a)),t}set rgb(t){this._rgb=Ix(t)}rgbString(){return this._valid?dD(this._rgb):void 0}hexString(){return this._valid?XT(this._rgb):void 0}hslString(){return this._valid?sD(this._rgb):void 0}mix(t,n){if(t){const r=this.rgb,i=t.rgb;let o;const s=n===o?.5:n,a=2*s-1,l=r.a-i.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,r.r=255&c*r.r+o*i.r+.5,r.g=255&c*r.g+o*i.g+.5,r.b=255&c*r.b+o*i.b+.5,r.a=s*r.a+(1-s)*i.a,this.rgb=r}return this}interpolate(t,n){return t&&(this._rgb=fD(this._rgb,t._rgb,n)),this}clone(){return new zl(this.rgb)}alpha(t){return this._rgb.a=Yi(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=ic(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Gc(this._rgb,2,t),this}darken(t){return Gc(this._rgb,2,-t),this}saturate(t){return Gc(this._rgb,1,t),this}desaturate(t){return Gc(this._rgb,1,-t),this}rotate(t){return oD(this._rgb,t),this}}/*!
|
|
144
|
-
* Chart.js v4.5.1
|
|
145
|
-
* https://www.chartjs.org
|
|
146
|
-
* (c) 2025 Chart.js Contributors
|
|
147
|
-
* Released under the MIT License
|
|
148
|
-
*/function Gr(){}const pD=(()=>{let e=0;return()=>e++})();function Ne(e){return e==null}function wt(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function He(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function It(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Yn(e,t){return It(e)?e:t}function Le(e,t){return typeof e>"u"?t:e}const mD=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,h1=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function dt(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function tt(e,t,n,r){let i,o,s;if(wt(e))for(o=e.length,i=0;i<o;i++)t.call(n,e[i],i);else if(He(e))for(s=Object.keys(e),o=s.length,i=0;i<o;i++)t.call(n,e[s[i]],s[i])}function _d(e,t){let n,r,i,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,r=e.length;n<r;++n)if(i=e[n],o=t[n],i.datasetIndex!==o.datasetIndex||i.index!==o.index)return!1;return!0}function kd(e){if(wt(e))return e.map(kd);if(He(e)){const t=Object.create(null),n=Object.keys(e),r=n.length;let i=0;for(;i<r;++i)t[n[i]]=kd(e[n[i]]);return t}return e}function p1(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function gD(e,t,n,r){if(!p1(e))return;const i=t[e],o=n[e];He(i)&&He(o)?Bl(i,o,r):t[e]=kd(o)}function Bl(e,t,n){const r=wt(t)?t:[t],i=r.length;if(!He(e))return e;n=n||{};const o=n.merger||gD;let s;for(let a=0;a<i;++a){if(s=r[a],!He(s))continue;const l=Object.keys(s);for(let c=0,u=l.length;c<u;++c)o(l[c],e,s,n)}return e}function al(e,t){return Bl(e,t,{merger:vD})}function vD(e,t,n){if(!p1(e))return;const r=t[e],i=n[e];He(r)&&He(i)?al(r,i):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=kd(i))}const Fx={"":e=>e,x:e=>e.x,y:e=>e.y};function yD(e){const t=e.split("."),n=[];let r="";for(const i of t)r+=i,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function bD(e){const t=yD(e);return n=>{for(const r of t){if(r==="")break;n=n&&n[r]}return n}}function eo(e,t){return(Fx[t]||(Fx[t]=bD(t)))(e)}function rv(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Ul=e=>typeof e<"u",to=e=>typeof e=="function",Nx=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function xD(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const Ye=Math.PI,yt=2*Ye,wD=yt+Ye,Sd=Number.POSITIVE_INFINITY,_D=Ye/180,Bt=Ye/2,yo=Ye/4,zx=Ye*2/3,Ii=Math.log10,Vr=Math.sign;function ll(e,t,n){return Math.abs(e-t)<n}function Bx(e){const t=Math.round(e);e=ll(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(Ii(e))),r=e/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function kD(e){const t=[],n=Math.sqrt(e);let r;for(r=1;r<n;r++)e%r===0&&(t.push(r),t.push(e/r));return n===(n|0)&&t.push(n),t.sort((i,o)=>i-o).pop(),t}function SD(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function ta(e){return!SD(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function ED(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function m1(e,t,n){let r,i,o;for(r=0,i=e.length;r<i;r++)o=e[r][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Er(e){return e*(Ye/180)}function iv(e){return e*(180/Ye)}function Ux(e){if(!It(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function g1(e,t){const n=t.x-e.x,r=t.y-e.y,i=Math.sqrt(n*n+r*r);let o=Math.atan2(r,n);return o<-.5*Ye&&(o+=yt),{angle:o,distance:i}}function ym(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function OD(e,t){return(e-t+wD)%yt-Ye}function vn(e){return(e%yt+yt)%yt}function Hl(e,t,n,r){const i=vn(e),o=vn(t),s=vn(n),a=vn(o-i),l=vn(s-i),c=vn(i-o),u=vn(i-s);return i===o||i===s||r&&o===s||a>l&&c<u}function Zt(e,t,n){return Math.max(t,Math.min(n,e))}function CD(e){return Zt(e,-32768,32767)}function oi(e,t,n,r=1e-6){return e>=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function ov(e,t,n){n=n||(s=>e[s]<t);let r=e.length-1,i=0,o;for(;r-i>1;)o=i+r>>1,n(o)?i=o:r=o;return{lo:i,hi:r}}const si=(e,t,n,r)=>ov(e,n,r?i=>{const o=e[i][t];return o<n||o===n&&e[i+1][t]===n}:i=>e[i][t]<n),jD=(e,t,n)=>ov(e,n,r=>e[r][t]>=n);function RD(e,t,n){let r=0,i=e.length;for(;r<i&&e[r]<t;)r++;for(;i>r&&e[i-1]>n;)i--;return r>0||i<e.length?e.slice(r,i):e}const v1=["push","pop","shift","splice","unshift"];function LD(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),v1.forEach(n=>{const r="_onData"+rv(n),i=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const s=i.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),s}})})}function Hx(e,t){const n=e._chartjs;if(!n)return;const r=n.listeners,i=r.indexOf(t);i!==-1&&r.splice(i,1),!(r.length>0)&&(v1.forEach(o=>{delete e[o]}),delete e._chartjs)}function y1(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const b1=function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame}();function x1(e,t){let n=[],r=!1;return function(...i){n=i,r||(r=!0,b1.call(window,()=>{r=!1,e.apply(t,n)}))}}function AD(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}const sv=e=>e==="start"?"left":e==="end"?"right":"center",pn=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,PD=(e,t,n,r)=>e===(r?"left":"right")?n:e==="center"?(t+n)/2:t;function w1(e,t,n){const r=t.length;let i=0,o=r;if(e._sorted){const{iScale:s,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=s.axis,{min:d,max:f,minDefined:h,maxDefined:v}=s.getUserBounds();if(h){if(i=Math.min(si(l,u,d).lo,n?r:si(t,u,s.getPixelForValue(d)).lo),c){const m=l.slice(0,i+1).reverse().findIndex(x=>!Ne(x[a.axis]));i-=Math.max(0,m)}i=Zt(i,0,r-1)}if(v){let m=Math.max(si(l,s.axis,f,!0).hi+1,n?0:si(t,u,s.getPixelForValue(f),!0).hi+1);if(c){const x=l.slice(m-1).findIndex(b=>!Ne(b[a.axis]));m+=Math.max(0,x)}o=Zt(m,i,r)-i}else o=r-i}return{start:i,count:o}}function _1(e){const{xScale:t,yScale:n,_scaleRanges:r}=e,i={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!r)return e._scaleRanges=i,!0;const o=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==n.min||r.ymax!==n.max;return Object.assign(r,i),o}const Jc=e=>e===0||e===1,Wx=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*yt/n)),Vx=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*yt/n)+1,cl={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Bt)+1,easeOutSine:e=>Math.sin(e*Bt),easeInOutSine:e=>-.5*(Math.cos(Ye*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Jc(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Jc(e)?e:Wx(e,.075,.3),easeOutElastic:e=>Jc(e)?e:Vx(e,.075,.3),easeInOutElastic(e){return Jc(e)?e:e<.5?.5*Wx(e*2,.1125,.45):.5+.5*Vx(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-cl.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?cl.easeInBounce(e*2)*.5:cl.easeOutBounce(e*2-1)*.5+.5};function av(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function qx(e){return av(e)?e:new zl(e)}function Dh(e){return av(e)?e:new zl(e).saturate(.5).darken(.1).hexString()}const MD=["x","y","borderWidth","radius","tension"],TD=["color","borderColor","backgroundColor"];function DD(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:TD},numbers:{type:"number",properties:MD}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function ID(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const $x=new Map;function FD(e,t){t=t||{};const n=e+JSON.stringify(t);let r=$x.get(n);return r||(r=new Intl.NumberFormat(e,t),$x.set(n,r)),r}function oc(e,t,n){return FD(t,n).format(e)}const k1={values(e){return wt(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const r=this.chart.options.locale;let i,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(i="scientific"),o=ND(e,n)}const s=Ii(Math.abs(o)),a=isNaN(s)?1:Math.max(Math.min(-1*Math.floor(s),20),0),l={notation:i,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),oc(e,r,l)},logarithmic(e,t,n){if(e===0)return"0";const r=n[t].significand||e/Math.pow(10,Math.floor(Ii(e)));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?k1.numeric.call(this,e,t,n):""}};function ND(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var ff={formatters:k1};function zD(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ff.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Yo=Object.create(null),bm=Object.create(null);function ul(e,t){if(!t)return e;const n=t.split(".");for(let r=0,i=n.length;r<i;++r){const o=n[r];e=e[o]||(e[o]=Object.create(null))}return e}function Ih(e,t,n){return typeof t=="string"?Bl(ul(e,t),n):Bl(ul(e,""),t)}class BD{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=r=>r.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(r,i)=>Dh(i.backgroundColor),this.hoverBorderColor=(r,i)=>Dh(i.borderColor),this.hoverColor=(r,i)=>Dh(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return Ih(this,t,n)}get(t){return ul(this,t)}describe(t,n){return Ih(bm,t,n)}override(t,n){return Ih(Yo,t,n)}route(t,n,r,i){const o=ul(this,t),s=ul(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=s[i];return He(l)?Object.assign({},c,l):Le(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var _t=new BD({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[DD,ID,zD]);function UD(e){return!e||Ne(e.size)||Ne(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function Ed(e,t,n,r,i){let o=t[i];return o||(o=t[i]=e.measureText(i).width,n.push(i)),o>r&&(r=o),r}function HD(e,t,n,r){r=r||{};let i=r.data=r.data||{},o=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(i=r.data={},o=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let s=0;const a=n.length;let l,c,u,d,f;for(l=0;l<a;l++)if(d=n[l],d!=null&&!wt(d))s=Ed(e,i,o,s,d);else if(wt(d))for(c=0,u=d.length;c<u;c++)f=d[c],f!=null&&!wt(f)&&(s=Ed(e,i,o,s,f));e.restore();const h=o.length/2;if(h>n.length){for(l=0;l<h;l++)delete i[o[l]];o.splice(0,h)}return s}function bo(e,t,n){const r=e.currentDevicePixelRatio,i=n!==0?Math.max(n/2,.5):0;return Math.round((t-i)*r)/r+i}function Kx(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function xm(e,t,n,r){S1(e,t,n,r,null)}function S1(e,t,n,r,i){let o,s,a,l,c,u,d,f;const h=t.pointStyle,v=t.rotation,m=t.radius;let x=(v||0)*_D;if(h&&typeof h=="object"&&(o=h.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,r),e.rotate(x),e.drawImage(h,-h.width/2,-h.height/2,h.width,h.height),e.restore();return}if(!(isNaN(m)||m<=0)){switch(e.beginPath(),h){default:i?e.ellipse(n,r,i/2,m,0,0,yt):e.arc(n,r,m,0,yt),e.closePath();break;case"triangle":u=i?i/2:m,e.moveTo(n+Math.sin(x)*u,r-Math.cos(x)*m),x+=zx,e.lineTo(n+Math.sin(x)*u,r-Math.cos(x)*m),x+=zx,e.lineTo(n+Math.sin(x)*u,r-Math.cos(x)*m),e.closePath();break;case"rectRounded":c=m*.516,l=m-c,s=Math.cos(x+yo)*l,d=Math.cos(x+yo)*(i?i/2-c:l),a=Math.sin(x+yo)*l,f=Math.sin(x+yo)*(i?i/2-c:l),e.arc(n-d,r-a,c,x-Ye,x-Bt),e.arc(n+f,r-s,c,x-Bt,x),e.arc(n+d,r+a,c,x,x+Bt),e.arc(n-f,r+s,c,x+Bt,x+Ye),e.closePath();break;case"rect":if(!v){l=Math.SQRT1_2*m,u=i?i/2:l,e.rect(n-u,r-l,2*u,2*l);break}x+=yo;case"rectRot":d=Math.cos(x)*(i?i/2:m),s=Math.cos(x)*m,a=Math.sin(x)*m,f=Math.sin(x)*(i?i/2:m),e.moveTo(n-d,r-a),e.lineTo(n+f,r-s),e.lineTo(n+d,r+a),e.lineTo(n-f,r+s),e.closePath();break;case"crossRot":x+=yo;case"cross":d=Math.cos(x)*(i?i/2:m),s=Math.cos(x)*m,a=Math.sin(x)*m,f=Math.sin(x)*(i?i/2:m),e.moveTo(n-d,r-a),e.lineTo(n+d,r+a),e.moveTo(n+f,r-s),e.lineTo(n-f,r+s);break;case"star":d=Math.cos(x)*(i?i/2:m),s=Math.cos(x)*m,a=Math.sin(x)*m,f=Math.sin(x)*(i?i/2:m),e.moveTo(n-d,r-a),e.lineTo(n+d,r+a),e.moveTo(n+f,r-s),e.lineTo(n-f,r+s),x+=yo,d=Math.cos(x)*(i?i/2:m),s=Math.cos(x)*m,a=Math.sin(x)*m,f=Math.sin(x)*(i?i/2:m),e.moveTo(n-d,r-a),e.lineTo(n+d,r+a),e.moveTo(n+f,r-s),e.lineTo(n-f,r+s);break;case"line":s=i?i/2:Math.cos(x)*m,a=Math.sin(x)*m,e.moveTo(n-s,r-a),e.lineTo(n+s,r+a);break;case"dash":e.moveTo(n,r),e.lineTo(n+Math.cos(x)*(i?i/2:m),r+Math.sin(x)*m);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function ai(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function hf(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function pf(e){e.restore()}function WD(e,t,n,r,i){if(!t)return e.lineTo(n.x,n.y);if(i==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else i==="after"!=!!r?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function VD(e,t,n,r){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(r?t.cp1x:t.cp2x,r?t.cp1y:t.cp2y,r?n.cp2x:n.cp1x,r?n.cp2y:n.cp1y,n.x,n.y)}function qD(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),Ne(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function $D(e,t,n,r,i){if(i.strikethrough||i.underline){const o=e.measureText(r),s=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=i.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=i.decorationWidth||2,e.moveTo(s,u),e.lineTo(a,u),e.stroke()}}function KD(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Go(e,t,n,r,i,o={}){const s=wt(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=i.string,qD(e,o),l=0;l<s.length;++l)c=s[l],o.backdrop&&KD(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),Ne(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,r,o.maxWidth)),e.fillText(c,n,r,o.maxWidth),$D(e,n,r,c,o),r+=Number(i.lineHeight);e.restore()}function Wl(e,t){const{x:n,y:r,w:i,h:o,radius:s}=t;e.arc(n+s.topLeft,r+s.topLeft,s.topLeft,1.5*Ye,Ye,!0),e.lineTo(n,r+o-s.bottomLeft),e.arc(n+s.bottomLeft,r+o-s.bottomLeft,s.bottomLeft,Ye,Bt,!0),e.lineTo(n+i-s.bottomRight,r+o),e.arc(n+i-s.bottomRight,r+o-s.bottomRight,s.bottomRight,Bt,0,!0),e.lineTo(n+i,r+s.topRight),e.arc(n+i-s.topRight,r+s.topRight,s.topRight,0,-Bt,!0),e.lineTo(n+s.topLeft,r)}const YD=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,GD=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function JD(e,t){const n=(""+e).match(YD);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const XD=e=>+e||0;function lv(e,t){const n={},r=He(t),i=r?Object.keys(t):t,o=He(e)?r?s=>Le(e[s],e[t[s]]):s=>e[s]:()=>e;for(const s of i)n[s]=XD(o(s));return n}function E1(e){return lv(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Fo(e){return lv(e,["topLeft","topRight","bottomLeft","bottomRight"])}function wn(e){const t=E1(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Gt(e,t){e=e||{},t=t||_t.font;let n=Le(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let r=Le(e.style,t.style);r&&!(""+r).match(GD)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const i={family:Le(e.family,t.family),lineHeight:JD(Le(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:Le(e.weight,t.weight),string:""};return i.string=UD(i),i}function Va(e,t,n,r){let i,o,s;for(i=0,o=e.length;i<o;++i)if(s=e[i],s!==void 0&&s!==void 0)return s}function QD(e,t,n){const{min:r,max:i}=e,o=h1(t,(i-r)/2),s=(a,l)=>n&&a===0?0:a+l;return{min:s(r,-Math.abs(o)),max:s(i,o)}}function ao(e,t){return Object.assign(Object.create(e),t)}function cv(e,t=[""],n,r,i=()=>e[0]){const o=n||e;typeof r>"u"&&(r=R1("_fallback",e));const s={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:r,_getTarget:i,override:a=>cv([a,...e],t,o,r)};return new Proxy(s,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return C1(a,l,()=>sI(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return Gx(a).includes(l)},ownKeys(a){return Gx(a)},set(a,l,c){const u=a._storage||(a._storage=i());return a[l]=u[l]=c,delete a._keys,!0}})}function na(e,t,n,r){const i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:O1(e,r),setContext:o=>na(e,o,n,r),override:o=>na(e.override(o),t,n,r)};return new Proxy(i,{deleteProperty(o,s){return delete o[s],delete e[s],!0},get(o,s,a){return C1(o,s,()=>eI(o,s,a))},getOwnPropertyDescriptor(o,s){return o._descriptors.allKeys?Reflect.has(e,s)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,s)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,s){return Reflect.has(e,s)},ownKeys(){return Reflect.ownKeys(e)},set(o,s,a){return e[s]=a,delete o[s],!0}})}function O1(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:r,isScriptable:to(n)?n:()=>n,isIndexable:to(r)?r:()=>r}}const ZD=(e,t)=>e?e+rv(t):t,uv=(e,t)=>He(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function C1(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const r=n();return e[t]=r,r}function eI(e,t,n){const{_proxy:r,_context:i,_subProxy:o,_descriptors:s}=e;let a=r[t];return to(a)&&s.isScriptable(t)&&(a=tI(t,a,e,n)),wt(a)&&a.length&&(a=nI(t,a,e,s.isIndexable)),uv(t,a)&&(a=na(a,i,o&&o[t],s)),a}function tI(e,t,n,r){const{_proxy:i,_context:o,_subProxy:s,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,s||r);return a.delete(e),uv(e,l)&&(l=dv(i._scopes,i,e,l)),l}function nI(e,t,n,r){const{_proxy:i,_context:o,_subProxy:s,_descriptors:a}=n;if(typeof o.index<"u"&&r(e))return t[o.index%t.length];if(He(t[0])){const l=t,c=i._scopes.filter(u=>u!==l);t=[];for(const u of l){const d=dv(c,i,e,u);t.push(na(d,o,s&&s[e],a))}}return t}function j1(e,t,n){return to(e)?e(t,n):e}const rI=(e,t)=>e===!0?t:typeof e=="string"?eo(t,e):void 0;function iI(e,t,n,r,i){for(const o of t){const s=rI(n,o);if(s){e.add(s);const a=j1(s._fallback,n,i);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(s===!1&&typeof r<"u"&&n!==r)return null}return!1}function dv(e,t,n,r){const i=t._rootScopes,o=j1(t._fallback,n,r),s=[...e,...i],a=new Set;a.add(r);let l=Yx(a,s,n,o||n,r);return l===null||typeof o<"u"&&o!==n&&(l=Yx(a,s,o,l,r),l===null)?!1:cv(Array.from(a),[""],i,o,()=>oI(t,n,r))}function Yx(e,t,n,r,i){for(;n;)n=iI(e,t,n,r,i);return n}function oI(e,t,n){const r=e._getTarget();t in r||(r[t]={});const i=r[t];return wt(i)&&He(n)?n:i||{}}function sI(e,t,n,r){let i;for(const o of t)if(i=R1(ZD(o,e),n),typeof i<"u")return uv(e,i)?dv(n,r,e,i):i}function R1(e,t){for(const n of t){if(!n)continue;const r=n[e];if(typeof r<"u")return r}}function Gx(e){let t=e._keys;return t||(t=e._keys=aI(e._scopes)),t}function aI(e){const t=new Set;for(const n of e)for(const r of Object.keys(n).filter(i=>!i.startsWith("_")))t.add(r);return Array.from(t)}function L1(e,t,n,r){const{iScale:i}=e,{key:o="r"}=this._parsing,s=new Array(r);let a,l,c,u;for(a=0,l=r;a<l;++a)c=a+n,u=t[c],s[a]={r:i.parse(eo(u,o),c)};return s}const lI=Number.EPSILON||1e-14,ra=(e,t)=>t<e.length&&!e[t].skip&&e[t],A1=e=>e==="x"?"y":"x";function cI(e,t,n,r){const i=e.skip?t:e,o=t,s=n.skip?t:n,a=ym(o,i),l=ym(s,o);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const d=r*c,f=r*u;return{previous:{x:o.x-d*(s.x-i.x),y:o.y-d*(s.y-i.y)},next:{x:o.x+f*(s.x-i.x),y:o.y+f*(s.y-i.y)}}}function uI(e,t,n){const r=e.length;let i,o,s,a,l,c=ra(e,0);for(let u=0;u<r-1;++u)if(l=c,c=ra(e,u+1),!(!l||!c)){if(ll(t[u],0,lI)){n[u]=n[u+1]=0;continue}i=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(i,2)+Math.pow(o,2),!(a<=9)&&(s=3/Math.sqrt(a),n[u]=i*s*t[u],n[u+1]=o*s*t[u])}}function dI(e,t,n="x"){const r=A1(n),i=e.length;let o,s,a,l=ra(e,0);for(let c=0;c<i;++c){if(s=a,a=l,l=ra(e,c+1),!a)continue;const u=a[n],d=a[r];s&&(o=(u-s[n])/3,a[`cp1${n}`]=u-o,a[`cp1${r}`]=d-o*t[c]),l&&(o=(l[n]-u)/3,a[`cp2${n}`]=u+o,a[`cp2${r}`]=d+o*t[c])}}function fI(e,t="x"){const n=A1(t),r=e.length,i=Array(r).fill(0),o=Array(r);let s,a,l,c=ra(e,0);for(s=0;s<r;++s)if(a=l,l=c,c=ra(e,s+1),!!l){if(c){const u=c[t]-l[t];i[s]=u!==0?(c[n]-l[n])/u:0}o[s]=a?c?Vr(i[s-1])!==Vr(i[s])?0:(i[s-1]+i[s])/2:i[s-1]:i[s]}uI(e,i,o),dI(e,o,t)}function Xc(e,t,n){return Math.max(Math.min(e,n),t)}function hI(e,t){let n,r,i,o,s,a=ai(e[0],t);for(n=0,r=e.length;n<r;++n)s=o,o=a,a=n<r-1&&ai(e[n+1],t),o&&(i=e[n],s&&(i.cp1x=Xc(i.cp1x,t.left,t.right),i.cp1y=Xc(i.cp1y,t.top,t.bottom)),a&&(i.cp2x=Xc(i.cp2x,t.left,t.right),i.cp2y=Xc(i.cp2y,t.top,t.bottom)))}function pI(e,t,n,r,i){let o,s,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")fI(e,i);else{let c=r?e[e.length-1]:e[0];for(o=0,s=e.length;o<s;++o)a=e[o],l=cI(c,a,e[Math.min(o+1,s-(r?0:1))%s],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&hI(e,n)}function fv(){return typeof window<"u"&&typeof document<"u"}function hv(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Od(e,t,n){let r;return typeof e=="string"?(r=parseInt(e,10),e.indexOf("%")!==-1&&(r=r/100*t.parentNode[n])):r=e,r}const mf=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function mI(e,t){return mf(e).getPropertyValue(t)}const gI=["top","right","bottom","left"];function No(e,t,n){const r={};n=n?"-"+n:"";for(let i=0;i<4;i++){const o=gI[i];r[o]=parseFloat(e[t+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const vI=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function yI(e,t){const n=e.touches,r=n&&n.length?n[0]:e,{offsetX:i,offsetY:o}=r;let s=!1,a,l;if(vI(i,o,e.target))a=i,l=o;else{const c=t.getBoundingClientRect();a=r.clientX-c.left,l=r.clientY-c.top,s=!0}return{x:a,y:l,box:s}}function So(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:r}=t,i=mf(n),o=i.boxSizing==="border-box",s=No(i,"padding"),a=No(i,"border","width"),{x:l,y:c,box:u}=yI(e,n),d=s.left+(u&&a.left),f=s.top+(u&&a.top);let{width:h,height:v}=t;return o&&(h-=s.width+a.width,v-=s.height+a.height),{x:Math.round((l-d)/h*n.width/r),y:Math.round((c-f)/v*n.height/r)}}function bI(e,t,n){let r,i;if(t===void 0||n===void 0){const o=e&&hv(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const s=o.getBoundingClientRect(),a=mf(o),l=No(a,"border","width"),c=No(a,"padding");t=s.width-c.width-l.width,n=s.height-c.height-l.height,r=Od(a.maxWidth,o,"clientWidth"),i=Od(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:r||Sd,maxHeight:i||Sd}}const Fi=e=>Math.round(e*10)/10;function xI(e,t,n,r){const i=mf(e),o=No(i,"margin"),s=Od(i.maxWidth,e,"clientWidth")||Sd,a=Od(i.maxHeight,e,"clientHeight")||Sd,l=bI(e,t,n);let{width:c,height:u}=l;if(i.boxSizing==="content-box"){const f=No(i,"border","width"),h=No(i,"padding");c-=h.width+f.width,u-=h.height+f.height}return c=Math.max(0,c-o.width),u=Math.max(0,r?c/r:u-o.height),c=Fi(Math.min(c,s,l.maxWidth)),u=Fi(Math.min(u,a,l.maxHeight)),c&&!u&&(u=Fi(c/2)),(t!==void 0||n!==void 0)&&r&&l.height&&u>l.height&&(u=l.height,c=Fi(Math.floor(u*r))),{width:c,height:u}}function Jx(e,t,n){const r=t||1,i=Fi(e.height*r),o=Fi(e.width*r);e.height=Fi(e.height),e.width=Fi(e.width);const s=e.canvas;return s.style&&(n||!s.style.height&&!s.style.width)&&(s.style.height=`${e.height}px`,s.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||s.height!==i||s.width!==o?(e.currentDevicePixelRatio=r,s.height=i,s.width=o,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}const wI=function(){let e=!1;try{const t={get passive(){return e=!0,!1}};fv()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e}();function Xx(e,t){const n=mI(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function Eo(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function _I(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:r==="middle"?n<.5?e.y:t.y:r==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function kI(e,t,n,r){const i={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},s=Eo(e,i,n),a=Eo(i,o,n),l=Eo(o,t,n),c=Eo(s,a,n),u=Eo(a,l,n);return Eo(c,u,n)}const SI=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},EI=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Vs(e,t,n){return e?SI(t,n):EI()}function P1(e,t){let n,r;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=r)}function M1(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function T1(e){return e==="angle"?{between:Hl,compare:OD,normalize:vn}:{between:oi,compare:(t,n)=>t-n,normalize:t=>t}}function Qx({start:e,end:t,count:n,loop:r,style:i}){return{start:e%n,end:t%n,loop:r&&(t-e+1)%n===0,style:i}}function OI(e,t,n){const{property:r,start:i,end:o}=n,{between:s,normalize:a}=T1(r),l=t.length;let{start:c,end:u,loop:d}=e,f,h;if(d){for(c+=l,u+=l,f=0,h=l;f<h&&s(a(t[c%l][r]),i,o);++f)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:d,style:e.style}}function D1(e,t,n){if(!n)return[e];const{property:r,start:i,end:o}=n,s=t.length,{compare:a,between:l,normalize:c}=T1(r),{start:u,end:d,loop:f,style:h}=OI(e,t,n),v=[];let m=!1,x=null,b,g,k;const E=()=>l(i,k,b)&&a(i,k)!==0,C=()=>a(o,b)===0||l(o,k,b),S=()=>m||E(),M=()=>!m||C();for(let L=u,T=u;L<=d;++L)g=t[L%s],!g.skip&&(b=c(g[r]),b!==k&&(m=l(b,i,o),x===null&&S()&&(x=a(b,i)===0?L:T),x!==null&&M()&&(v.push(Qx({start:x,end:L,loop:f,count:s,style:h})),x=null),T=L,k=b));return x!==null&&v.push(Qx({start:x,end:d,loop:f,count:s,style:h})),v}function I1(e,t){const n=[],r=e.segments;for(let i=0;i<r.length;i++){const o=D1(r[i],e.points,t);o.length&&n.push(...o)}return n}function CI(e,t,n,r){let i=0,o=t-1;if(n&&!r)for(;i<t&&!e[i].skip;)i++;for(;i<t&&e[i].skip;)i++;for(i%=t,n&&(o+=i);o>i&&e[o%t].skip;)o--;return o%=t,{start:i,end:o}}function jI(e,t,n,r){const i=e.length,o=[];let s=t,a=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%i];c.skip||c.stop?a.skip||(r=!1,o.push({start:t%i,end:(l-1)%i,loop:r}),t=s=c.stop?l:null):(s=l,a.skip&&(t=l)),a=c}return s!==null&&o.push({start:t%i,end:s%i,loop:r}),o}function RI(e,t){const n=e.points,r=e.options.spanGaps,i=n.length;if(!i)return[];const o=!!e._loop,{start:s,end:a}=CI(n,i,o,r);if(r===!0)return Zx(e,[{start:s,end:a,loop:o}],n,t);const l=a<s?a+i:a,c=!!e._fullLoop&&s===0&&a===i-1;return Zx(e,jI(n,s,l,c),n,t)}function Zx(e,t,n,r){return!r||!r.setContext||!n?t:LI(e,t,n,r)}function LI(e,t,n,r){const i=e._chart.getContext(),o=ew(e.options),{_datasetIndex:s,options:{spanGaps:a}}=e,l=n.length,c=[];let u=o,d=t[0].start,f=d;function h(v,m,x,b){const g=a?-1:1;if(v!==m){for(v+=l;n[v%l].skip;)v-=g;for(;n[m%l].skip;)m+=g;v%l!==m%l&&(c.push({start:v%l,end:m%l,loop:x,style:b}),u=b,d=m%l)}}for(const v of t){d=a?d:v.start;let m=n[d%l],x;for(f=d+1;f<=v.end;f++){const b=n[f%l];x=ew(r.setContext(ao(i,{type:"segment",p0:m,p1:b,p0DataIndex:(f-1)%l,p1DataIndex:f%l,datasetIndex:s}))),AI(x,u)&&h(d,f-1,v.loop,u),m=b,u=x}d<f-1&&h(d,f-1,v.loop,u)}return c}function ew(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function AI(e,t){if(!t)return!1;const n=[],r=function(i,o){return av(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,r)!==JSON.stringify(t,r)}function Qc(e,t,n){return e.options.clip?e[n]:t[n]}function PI(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:Qc(n,t,"left"),right:Qc(n,t,"right"),top:Qc(r,t,"top"),bottom:Qc(r,t,"bottom")}:t}function F1(e,t){const n=t._clip;if(n.disabled)return!1;const r=PI(t,e.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:r.bottom+(n.bottom===!0?0:n.bottom)}}/*!
|
|
149
|
-
* Chart.js v4.5.1
|
|
150
|
-
* https://www.chartjs.org
|
|
151
|
-
* (c) 2025 Chart.js Contributors
|
|
152
|
-
* Released under the MIT License
|
|
153
|
-
*/class MI{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,r,i){const o=n.listeners[i],s=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:s,currentStep:Math.min(r-n.start,s)}))}_refresh(){this._request||(this._running=!0,this._request=b1.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,i)=>{if(!r.running||!r.items.length)return;const o=r.items;let s=o.length-1,a=!1,l;for(;s>=0;--s)l=o[s],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(t),a=!0):(o[s]=o[o.length-1],o.pop());a&&(i.draw(),this._notify(i,r,t,"progress")),o.length||(r.running=!1,this._notify(i,r,t,"complete"),r.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,i)=>Math.max(r,i._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let i=r.length-1;for(;i>=0;--i)r[i].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Jr=new MI;const tw="transparent",TI={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=qx(e||tw),i=r.valid&&qx(t||tw);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class DI{constructor(t,n,r,i){const o=n[r];i=Va([t.to,i,o,t.from]);const s=Va([t.from,o,i]);this._active=!0,this._fn=t.fn||TI[t.type||typeof s],this._easing=cl[t.easing]||cl.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=s,this._to=i,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const i=this._target[this._prop],o=r-this._start,s=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Va([t.to,n,i,t.from]),this._from=Va([t.from,i,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,i=this._prop,o=this._from,s=this._loop,a=this._to;let l;if(this._active=o!==a&&(s||n<r),!this._active){this._target[i]=a,this._notify(!0);return}if(n<0){this._target[i]=o;return}l=n/r%2,l=s&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let i=0;i<r.length;i++)r[i][n]()}}class N1{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!He(t))return;const n=Object.keys(_t.animation),r=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const o=t[i];if(!He(o))return;const s={};for(const a of n)s[a]=o[a];(wt(o.properties)&&o.properties||[i]).forEach(a=>{(a===i||!r.has(a))&&r.set(a,s)})})}_animateOptions(t,n){const r=n.options,i=FI(t,r);if(!i)return[];const o=this._createAnimations(i,r);return r.$shared&&II(t.options.$animations,r).then(()=>{t.options=r},()=>{}),o}_createAnimations(t,n){const r=this._properties,i=[],o=t.$animations||(t.$animations={}),s=Object.keys(n),a=Date.now();let l;for(l=s.length-1;l>=0;--l){const c=s[l];if(c.charAt(0)==="$")continue;if(c==="options"){i.push(...this._animateOptions(t,n));continue}const u=n[c];let d=o[c];const f=r.get(c);if(d)if(f&&d.active()){d.update(f,u,a);continue}else d.cancel();if(!f||!f.duration){t[c]=u;continue}o[c]=d=new DI(f,t,c,u),i.push(d)}return i}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return Jr.add(this._chart,r),!0}}function II(e,t){const n=[],r=Object.keys(t);for(let i=0;i<r.length;i++){const o=e[r[i]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function FI(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function nw(e,t){const n=e&&e.options||{},r=n.reverse,i=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:r?o:i,end:r?i:o}}function NI(e,t,n){if(n===!1)return!1;const r=nw(e,n),i=nw(t,n);return{top:i.end,right:r.end,bottom:i.start,left:r.start}}function zI(e){let t,n,r,i;return He(e)?(t=e.top,n=e.right,r=e.bottom,i=e.left):t=n=r=i=e,{top:t,right:n,bottom:r,left:i,disabled:e===!1}}function z1(e,t){const n=[],r=e._getSortedDatasetMetas(t);let i,o;for(i=0,o=r.length;i<o;++i)n.push(r[i].index);return n}function rw(e,t,n,r={}){const i=e.keys,o=r.mode==="single";let s,a,l,c;if(t===null)return;let u=!1;for(s=0,a=i.length;s<a;++s){if(l=+i[s],l===n){if(u=!0,r.all)continue;break}c=e.values[l],It(c)&&(o||t===0||Vr(t)===Vr(c))&&(t+=c)}return!u&&!r.all?0:t}function BI(e,t){const{iScale:n,vScale:r}=t,i=n.axis==="x"?"x":"y",o=r.axis==="x"?"x":"y",s=Object.keys(e),a=new Array(s.length);let l,c,u;for(l=0,c=s.length;l<c;++l)u=s[l],a[l]={[i]:u,[o]:e[u]};return a}function Fh(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function UI(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function HI(e){const{min:t,max:n,minDefined:r,maxDefined:i}=e.getUserBounds();return{min:r?t:Number.NEGATIVE_INFINITY,max:i?n:Number.POSITIVE_INFINITY}}function WI(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function iw(e,t,n,r){for(const i of t.getMatchingVisibleMetas(r).reverse()){const o=e[i.index];if(n&&o>0||!n&&o<0)return i.index}return null}function ow(e,t){const{chart:n,_cachedMeta:r}=e,i=n._stacks||(n._stacks={}),{iScale:o,vScale:s,index:a}=r,l=o.axis,c=s.axis,u=UI(o,s,r),d=t.length;let f;for(let h=0;h<d;++h){const v=t[h],{[l]:m,[c]:x}=v,b=v._stacks||(v._stacks={});f=b[c]=WI(i,u,m),f[a]=x,f._top=iw(f,s,!0,r.type),f._bottom=iw(f,s,!1,r.type);const g=f._visualValues||(f._visualValues={});g[a]=x}}function Nh(e,t){const n=e.scales;return Object.keys(n).filter(r=>n[r].axis===t).shift()}function VI(e,t){return ao(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function qI(e,t,n){return ao(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function ja(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const i of t){const o=i._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const zh=e=>e==="reset"||e==="none",sw=(e,t)=>t?e:Object.assign({},e),$I=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:z1(n,!0),values:null};class jr{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Fh(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ja(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),i=(d,f,h,v)=>d==="x"?f:d==="r"?v:h,o=n.xAxisID=Le(r.xAxisID,Nh(t,"x")),s=n.yAxisID=Le(r.yAxisID,Nh(t,"y")),a=n.rAxisID=Le(r.rAxisID,Nh(t,"r")),l=n.indexAxis,c=n.iAxisID=i(l,o,s,a),u=n.vAxisID=i(l,s,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(s),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Hx(this._data,this),t._stacked&&ja(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(He(n)){const i=this._cachedMeta;this._data=BI(n,i)}else if(r!==n){if(r){Hx(r,this);const i=this._cachedMeta;ja(i),i._parsed=[]}n&&Object.isExtensible(n)&&LD(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let i=!1;this._dataCheck();const o=n._stacked;n._stacked=Fh(n.vScale,n),n.stack!==r.stack&&(i=!0,ja(n),n.stack=r.stack),this._resyncElements(t),(i||o!==n._stacked)&&(ow(this,n._parsed),n._stacked=Fh(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:i}=this,{iScale:o,_stacked:s}=r,a=o.axis;let l=t===0&&n===i.length?!0:r._sorted,c=t>0&&r._parsed[t-1],u,d,f;if(this._parsing===!1)r._parsed=i,r._sorted=!0,f=i;else{wt(i[t])?f=this.parseArrayData(r,i,t,n):He(i[t])?f=this.parseObjectData(r,i,t,n):f=this.parsePrimitiveData(r,i,t,n);const h=()=>d[a]===null||c&&d[a]<c[a];for(u=0;u<n;++u)r._parsed[u+t]=d=f[u],l&&(h()&&(l=!1),c=d);r._sorted=l}s&&ow(this,f)}parsePrimitiveData(t,n,r,i){const{iScale:o,vScale:s}=t,a=o.axis,l=s.axis,c=o.getLabels(),u=o===s,d=new Array(i);let f,h,v;for(f=0,h=i;f<h;++f)v=f+r,d[f]={[a]:u||o.parse(c[v],v),[l]:s.parse(n[v],v)};return d}parseArrayData(t,n,r,i){const{xScale:o,yScale:s}=t,a=new Array(i);let l,c,u,d;for(l=0,c=i;l<c;++l)u=l+r,d=n[u],a[l]={x:o.parse(d[0],u),y:s.parse(d[1],u)};return a}parseObjectData(t,n,r,i){const{xScale:o,yScale:s}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(i);let u,d,f,h;for(u=0,d=i;u<d;++u)f=u+r,h=n[f],c[u]={x:o.parse(eo(h,a),f),y:s.parse(eo(h,l),f)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,r){const i=this.chart,o=this._cachedMeta,s=n[t.axis],a={keys:z1(i,!0),values:n._stacks[t.axis]._visualValues};return rw(a,s,o.index,{mode:r})}updateRangeFromParsed(t,n,r,i){const o=r[n.axis];let s=o===null?NaN:o;const a=i&&r._stacks[n.axis];i&&a&&(i.values=a,s=rw(i,o,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,n){const r=this._cachedMeta,i=r._parsed,o=r._sorted&&t===r.iScale,s=i.length,a=this._getOtherScale(t),l=$I(n,r,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=HI(a);let f,h;function v(){h=i[f];const m=h[a.axis];return!It(h[t.axis])||u>m||d<m}for(f=0;f<s&&!(!v()&&(this.updateRangeFromParsed(c,t,h,l),o));++f);if(o){for(f=s-1;f>=0;--f)if(!v()){this.updateRangeFromParsed(c,t,h,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let i,o,s;for(i=0,o=n.length;i<o;++i)s=n[i][t.axis],It(s)&&r.push(s);return r}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,r=n.iScale,i=n.vScale,o=this.getParsed(t);return{label:r?""+r.getLabelForValue(o[r.axis]):"",value:i?""+i.getLabelForValue(o[i.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=zI(Le(this.options.clip,NI(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,r=this._cachedMeta,i=r.data||[],o=n.chartArea,s=[],a=this._drawStart||0,l=this._drawCount||i.length-a,c=this.options.drawActiveElementsOnTop;let u;for(r.dataset&&r.dataset.draw(t,o,a,l),u=a;u<a+l;++u){const d=i[u];d.hidden||(d.active&&c?s.push(d):d.draw(t,o))}for(u=0;u<s.length;++u)s[u].draw(t,o)}getStyle(t,n){const r=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(t||0,r)}getContext(t,n,r){const i=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const s=this._cachedMeta.data[t];o=s.$context||(s.$context=qI(this.getContext(),t,s)),o.parsed=this.getParsed(t),o.raw=i.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=VI(this.chart.getContext(),this.index)),o.dataset=i,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=r,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",r){const i=n==="active",o=this._cachedDataOpts,s=t+"-"+n,a=o[s],l=this.enableOptionSharing&&Ul(r);if(a)return sw(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),d=i?[`${t}Hover`,"hover",t,""]:[t,""],f=c.getOptionScopes(this.getDataset(),u),h=Object.keys(_t.elements[t]),v=()=>this.getContext(r,i,n),m=c.resolveNamedOptions(f,h,v,d);return m.$shared&&(m.$shared=l,o[s]=Object.freeze(sw(m,l))),m}_resolveAnimations(t,n,r){const i=this.chart,o=this._cachedDataOpts,s=`animation-${n}`,a=o[s];if(a)return a;let l;if(i.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,n),f=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(f,this.getContext(t,r,n))}const c=new N1(i,l&&l.animations);return l&&l._cacheable&&(o[s]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||zh(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),i=this._sharedOptions,o=this.getSharedOptions(r),s=this.includeOptions(n,o)||o!==i;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:s}}updateElement(t,n,r,i){zh(i)?Object.assign(t,r):this._resolveAnimations(n,i).update(t,r)}updateSharedOptions(t,n,r){t&&!zh(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,i){t.active=i;const o=this.getStyle(n,i);this._resolveAnimations(n,r,i).update(t,{options:!i&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const i=r.length,o=n.length,s=Math.min(o,i);s&&this.parse(0,s),o>i?this._insertElements(i,o-i,t):o<i&&this._removeElements(o,i-o)}_insertElements(t,n,r=!0){const i=this._cachedMeta,o=i.data,s=t+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=s;a--)c[a]=c[a-n]};for(l(o),a=t;a<s;++a)o[a]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(t,n),r&&this.updateElements(o,t,n,"reset")}updateElements(t,n,r,i){}_removeElements(t,n){const r=this._cachedMeta;if(this._parsing){const i=r._parsed.splice(t,n);r._stacked&&ja(r,i)}r.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,r,i]=t;this[n](r,i)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",t,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}Z(jr,"defaults",{}),Z(jr,"datasetElementType",null),Z(jr,"dataElementType",null);function KI(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let r=[];for(let i=0,o=n.length;i<o;i++)r=r.concat(n[i].controller.getAllParsedValues(e));e._cache.$bar=y1(r.sort((i,o)=>i-o))}return e._cache.$bar}function YI(e){const t=e.iScale,n=KI(t,e.type);let r=t._length,i,o,s,a;const l=()=>{s===32767||s===-32768||(Ul(a)&&(r=Math.min(r,Math.abs(s-a)||r)),a=s)};for(i=0,o=n.length;i<o;++i)s=t.getPixelForValue(n[i]),l();for(a=void 0,i=0,o=t.ticks.length;i<o;++i)s=t.getPixelForTick(i),l();return r}function GI(e,t,n,r){const i=n.barThickness;let o,s;return Ne(i)?(o=t.min*n.categoryPercentage,s=n.barPercentage):(o=i*r,s=1),{chunk:o/r,ratio:s,start:t.pixels[e]-o/2}}function JI(e,t,n,r){const i=t.pixels,o=i[e];let s=e>0?i[e-1]:null,a=e<i.length-1?i[e+1]:null;const l=n.categoryPercentage;s===null&&(s=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-s);const c=o-(o-Math.min(s,a))/2*l;return{chunk:Math.abs(a-s)/2*l/r,ratio:n.barPercentage,start:c}}function XI(e,t,n,r){const i=n.parse(e[0],r),o=n.parse(e[1],r),s=Math.min(i,o),a=Math.max(i,o);let l=s,c=a;Math.abs(s)>Math.abs(a)&&(l=a,c=s),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:i,end:o,min:s,max:a}}function B1(e,t,n,r){return wt(e)?XI(e,t,n,r):t[n.axis]=n.parse(e,r),t}function aw(e,t,n,r){const i=e.iScale,o=e.vScale,s=i.getLabels(),a=i===o,l=[];let c,u,d,f;for(c=n,u=n+r;c<u;++c)f=t[c],d={},d[i.axis]=a||i.parse(s[c],c),l.push(B1(f,d,o,c));return l}function Bh(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function QI(e,t,n){return e!==0?Vr(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function ZI(e){let t,n,r,i,o;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.base<e.y,n="bottom",r="top"),t?(i="end",o="start"):(i="start",o="end"),{start:n,end:r,reverse:t,top:i,bottom:o}}function e2(e,t,n,r){let i=t.borderSkipped;const o={};if(!i){e.borderSkipped=o;return}if(i===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:s,end:a,reverse:l,top:c,bottom:u}=ZI(e);i==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?i=c:(n._bottom||0)===r?i=u:(o[lw(u,s,a,l)]=!0,i=c)),o[lw(i,s,a,l)]=!0,e.borderSkipped=o}function lw(e,t,n,r){return r?(e=t2(e,t,n),e=cw(e,n,t)):e=cw(e,t,n),e}function t2(e,t,n){return e===t?n:e===n?t:e}function cw(e,t,n){return e==="start"?t:e==="end"?n:e}function n2(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class ju extends jr{parsePrimitiveData(t,n,r,i){return aw(t,n,r,i)}parseArrayData(t,n,r,i){return aw(t,n,r,i)}parseObjectData(t,n,r,i){const{iScale:o,vScale:s}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?a:l,u=s.axis==="x"?a:l,d=[];let f,h,v,m;for(f=r,h=r+i;f<h;++f)m=n[f],v={},v[o.axis]=o.parse(eo(m,c),f),d.push(B1(eo(m,u),v,s,f));return d}updateRangeFromParsed(t,n,r,i){super.updateRangeFromParsed(t,n,r,i);const o=r._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:r,vScale:i}=n,o=this.getParsed(t),s=o._custom,a=Bh(s)?"["+s.start+", "+s.end+"]":""+i.getLabelForValue(o[i.axis]);return{label:""+r.getLabelForValue(o[r.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,r,i){const o=i==="reset",{index:s,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:f}=this._getSharedOptions(n,i);for(let h=n;h<n+r;h++){const v=this.getParsed(h),m=o||Ne(v[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(h),x=this._calculateBarIndexPixels(h,u),b=(v._stacks||{})[a.axis],g={horizontal:c,base:m.base,enableBorderRadius:!b||Bh(v._custom)||s===b._top||s===b._bottom,x:c?m.head:x.center,y:c?x.center:m.head,height:c?x.size:Math.abs(m.size),width:c?Math.abs(m.size):x.size};f&&(g.options=d||this.resolveDataElementOptions(h,t[h].active?"active":i));const k=g.options||t[h].options;e2(g,k,b,s),n2(g,k,u.ratio),this.updateElement(t[h],h,g,i)}}_getStacks(t,n){const{iScale:r}=this._cachedMeta,i=r.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),o=r.options.stacked,s=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=u=>{const d=u._parsed.find(h=>h[r.axis]===l),f=d&&d[u.vScale.axis];if(Ne(f)||isNaN(f))return!0};for(const u of i)if(!(n!==void 0&&c(u))&&((o===!1||s.indexOf(u.stack)===-1||o===void 0&&u.stack===void 0)&&s.push(u.stack),u.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(r=>t[r].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)t[Le(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,r){const i=this._getStacks(t,r),o=n!==void 0?i.indexOf(n):-1;return o===-1?i.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,r=n.iScale,i=[];let o,s;for(o=0,s=n.data.length;o<s;++o)i.push(r.getPixelForValue(this.getParsed(o)[r.axis],o));const a=t.barThickness;return{min:a||YI(n),pixels:i,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:r,index:i},options:{base:o,minBarLength:s}}=this,a=o||0,l=this.getParsed(t),c=l._custom,u=Bh(c);let d=l[n.axis],f=0,h=r?this.applyStack(n,l,r):d,v,m;h!==d&&(f=h-d,h=d),u&&(d=c.barStart,h=c.barEnd-c.barStart,d!==0&&Vr(d)!==Vr(c.barEnd)&&(f=0),f+=d);const x=!Ne(o)&&!u?o:f;let b=n.getPixelForValue(x);if(this.chart.getDataVisibility(t)?v=n.getPixelForValue(f+h):v=b,m=v-b,Math.abs(m)<s){m=QI(m,n,a)*s,d===a&&(b-=m/2);const g=n.getPixelForDecimal(0),k=n.getPixelForDecimal(1),E=Math.min(g,k),C=Math.max(g,k);b=Math.max(Math.min(b,C),E),v=b+m,r&&!u&&(l._stacks[n.axis]._visualValues[i]=n.getValueForPixel(v)-n.getValueForPixel(b))}if(b===n.getPixelForValue(a)){const g=Vr(m)*n.getLineWidthForValue(a)/2;b+=g,m-=g}return{size:m,base:b,head:v,center:v+m/2}}_calculateBarIndexPixels(t,n){const r=n.scale,i=this.options,o=i.skipNull,s=Le(i.maxBarThickness,1/0);let a,l;const c=this._getAxisCount();if(n.grouped){const u=o?this._getStackCount(t):n.stackCount,d=i.barThickness==="flex"?JI(t,n,i,u*c):GI(t,n,i,u*c),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,h=this._getAxis().indexOf(Le(f,this.getFirstScaleIdForIndexAxis())),v=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+h;a=d.start+d.chunk*v+d.chunk/2,l=Math.min(s,d.chunk*d.ratio)}else a=r.getPixelForValue(this.getParsed(t)[r.axis],t),l=Math.min(s,n.min*n.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,n=t.vScale,r=t.data,i=r.length;let o=0;for(;o<i;++o)this.getParsed(o)[n.axis]!==null&&!r[o].hidden&&r[o].draw(this._ctx)}}Z(ju,"id","bar"),Z(ju,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),Z(ju,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class Ru extends jr{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,r,i){const o=super.parsePrimitiveData(t,n,r,i);for(let s=0;s<o.length;s++)o[s]._custom=this.resolveDataElementOptions(s+r).radius;return o}parseArrayData(t,n,r,i){const o=super.parseArrayData(t,n,r,i);for(let s=0;s<o.length;s++){const a=n[r+s];o[s]._custom=Le(a[2],this.resolveDataElementOptions(s+r).radius)}return o}parseObjectData(t,n,r,i){const o=super.parseObjectData(t,n,r,i);for(let s=0;s<o.length;s++){const a=n[r+s];o[s]._custom=Le(a&&a.r&&+a.r,this.resolveDataElementOptions(s+r).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let n=0;for(let r=t.length-1;r>=0;--r)n=Math.max(n,t[r].size(this.resolveDataElementOptions(r))/2);return n>0&&n}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:i,yScale:o}=n,s=this.getParsed(t),a=i.getLabelForValue(s.x),l=o.getLabelForValue(s.y),c=s._custom;return{label:r[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,r,i){const o=i==="reset",{iScale:s,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(n,i),u=s.axis,d=a.axis;for(let f=n;f<n+r;f++){const h=t[f],v=!o&&this.getParsed(f),m={},x=m[u]=o?s.getPixelForDecimal(.5):s.getPixelForValue(v[u]),b=m[d]=o?a.getBasePixel():a.getPixelForValue(v[d]);m.skip=isNaN(x)||isNaN(b),c&&(m.options=l||this.resolveDataElementOptions(f,h.active?"active":i),o&&(m.options.radius=0)),this.updateElement(h,f,m,i)}}resolveDataElementOptions(t,n){const r=this.getParsed(t);let i=super.resolveDataElementOptions(t,n);i.$shared&&(i=Object.assign({},i,{$shared:!1}));const o=i.radius;return n!=="active"&&(i.radius=0),i.radius+=Le(r&&r._custom,o),i}}Z(Ru,"id","bubble"),Z(Ru,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),Z(Ru,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function r2(e,t,n){let r=1,i=1,o=0,s=0;if(t<yt){const a=e,l=a+t,c=Math.cos(a),u=Math.sin(a),d=Math.cos(l),f=Math.sin(l),h=(k,E,C)=>Hl(k,a,l,!0)?1:Math.max(E,E*n,C,C*n),v=(k,E,C)=>Hl(k,a,l,!0)?-1:Math.min(E,E*n,C,C*n),m=h(0,c,d),x=h(Bt,u,f),b=v(Ye,c,d),g=v(Ye+Bt,u,f);r=(m-b)/2,i=(x-g)/2,o=-(m+b)/2,s=-(x+g)/2}return{ratioX:r,ratioY:i,offsetX:o,offsetY:s}}class Ao extends jr{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,i=this._cachedMeta;if(this._parsing===!1)i._parsed=r;else{let o=l=>+r[l];if(He(r[t])){const{key:l="value"}=this._parsing;o=c=>+eo(r[c],l)}let s,a;for(s=t,a=t+n;s<a;++s)i._parsed[s]=o(s)}}_getRotation(){return Er(this.options.rotation-90)}_getCircumference(){return Er(this.options.circumference)}_getRotationExtents(){let t=yt,n=-yt;for(let r=0;r<this.chart.data.datasets.length;++r)if(this.chart.isDatasetVisible(r)&&this.chart.getDatasetMeta(r).type===this._type){const i=this.chart.getDatasetMeta(r).controller,o=i._getRotation(),s=i._getCircumference();t=Math.min(t,o),n=Math.max(n,o+s)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:r}=n,i=this._cachedMeta,o=i.data,s=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(r.width,r.height)-s)/2,0),l=Math.min(mD(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:f,ratioY:h,offsetX:v,offsetY:m}=r2(d,u,l),x=(r.width-s)/f,b=(r.height-s)/h,g=Math.max(Math.min(x,b)/2,0),k=h1(this.options.radius,g),E=Math.max(k*l,0),C=(k-E)/this._getVisibleDatasetWeightTotal();this.offsetX=v*k,this.offsetY=m*k,i.total=this.calculateTotal(),this.outerRadius=k-C*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-C*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const r=this.options,i=this._cachedMeta,o=this._getCircumference();return n&&r.animation.animateRotate||!this.chart.getDataVisibility(t)||i._parsed[t]===null||i.data[t].hidden?0:this.calculateCircumference(i._parsed[t]*o/yt)}updateElements(t,n,r,i){const o=i==="reset",s=this.chart,a=s.chartArea,c=s.options.animation,u=(a.left+a.right)/2,d=(a.top+a.bottom)/2,f=o&&c.animateScale,h=f?0:this.innerRadius,v=f?0:this.outerRadius,{sharedOptions:m,includeOptions:x}=this._getSharedOptions(n,i);let b=this._getRotation(),g;for(g=0;g<n;++g)b+=this._circumference(g,o);for(g=n;g<n+r;++g){const k=this._circumference(g,o),E=t[g],C={x:u+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+k,circumference:k,outerRadius:v,innerRadius:h};x&&(C.options=m||this.resolveDataElementOptions(g,E.active?"active":i)),b+=k,this.updateElement(E,g,C,i)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let r=0,i;for(i=0;i<n.length;i++){const o=t._parsed[i];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(i)&&!n[i].hidden&&(r+=Math.abs(o))}return r}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?yt*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,i=r.data.labels||[],o=oc(n._parsed[t],r.options.locale);return{label:i[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const r=this.chart;let i,o,s,a,l;if(!t){for(i=0,o=r.data.datasets.length;i<o;++i)if(r.isDatasetVisible(i)){s=r.getDatasetMeta(i),t=s.data,a=s.controller;break}}if(!t)return 0;for(i=0,o=t.length;i<o;++i)l=a.resolveDataElementOptions(i),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let r=0,i=t.length;r<i;++r){const o=this.resolveDataElementOptions(r);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let r=0;r<t;++r)this.chart.isDatasetVisible(r)&&(n+=this._getRingWeight(r));return n}_getRingWeight(t){return Math.max(Le(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}Z(Ao,"id","doughnut"),Z(Ao,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),Z(Ao,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),Z(Ao,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:r,textAlign:i,color:o,useBorderRadius:s,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const d=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:i,pointStyle:r,borderRadius:s&&(a||d.borderRadius),index:c}}):[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});class Lu extends jr{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:r,data:i=[],_dataset:o}=n,s=this.chart._animationsDisabled;let{start:a,count:l}=w1(n,i,s);this._drawStart=a,this._drawCount=l,_1(n)&&(a=0,l=i.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!o._decimated,r.points=i;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!s,options:c},t),this.updateElements(i,a,l,t)}updateElements(t,n,r,i){const o=i==="reset",{iScale:s,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(n,i),f=s.axis,h=a.axis,{spanGaps:v,segment:m}=this.options,x=ta(v)?v:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||i==="none",g=n+r,k=t.length;let E=n>0&&this.getParsed(n-1);for(let C=0;C<k;++C){const S=t[C],M=b?S:{};if(C<n||C>=g){M.skip=!0;continue}const L=this.getParsed(C),T=Ne(L[h]),V=M[f]=s.getPixelForValue(L[f],C),G=M[h]=o||T?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,L,l):L[h],C);M.skip=isNaN(V)||isNaN(G)||T,M.stop=C>0&&Math.abs(L[f]-E[f])>x,m&&(M.parsed=L,M.raw=c.data[C]),d&&(M.options=u||this.resolveDataElementOptions(C,S.active?"active":i)),b||this.updateElement(S,C,M,i),E=L}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,i=t.data||[];if(!i.length)return r;const o=i[0].size(this.resolveDataElementOptions(0)),s=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(r,o,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Z(Lu,"id","line"),Z(Lu,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),Z(Lu,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class dl extends jr{constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,i=r.data.labels||[],o=oc(n._parsed[t].r,r.options.locale);return{label:i[t]||"",value:o}}parseObjectData(t,n,r,i){return L1.bind(this)(t,n,r,i)}update(t){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){const t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((r,i)=>{const o=this.getParsed(i).r;!isNaN(o)&&this.chart.getDataVisibility(i)&&(o<n.min&&(n.min=o),o>n.max&&(n.max=o))}),n}_updateRadius(){const t=this.chart,n=t.chartArea,r=t.options,i=Math.min(n.right-n.left,n.bottom-n.top),o=Math.max(i/2,0),s=Math.max(r.cutoutPercentage?o/100*r.cutoutPercentage:1,0),a=(o-s)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,n,r,i){const o=i==="reset",s=this.chart,l=s.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,d=c.yCenter,f=c.getIndexAngle(0)-.5*Ye;let h=f,v;const m=360/this.countVisibleElements();for(v=0;v<n;++v)h+=this._computeAngle(v,i,m);for(v=n;v<n+r;v++){const x=t[v];let b=h,g=h+this._computeAngle(v,i,m),k=s.getDataVisibility(v)?c.getDistanceFromCenterForValue(this.getParsed(v).r):0;h=g,o&&(l.animateScale&&(k=0),l.animateRotate&&(b=g=f));const E={x:u,y:d,innerRadius:0,outerRadius:k,startAngle:b,endAngle:g,options:this.resolveDataElementOptions(v,x.active?"active":i)};this.updateElement(x,v,E,i)}}countVisibleElements(){const t=this._cachedMeta;let n=0;return t.data.forEach((r,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&n++}),n}_computeAngle(t,n,r){return this.chart.getDataVisibility(t)?Er(this.resolveDataElementOptions(t,n).angle||r):0}}Z(dl,"id","polarArea"),Z(dl,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),Z(dl,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:r,color:i}}=t.legend.options;return n.labels.map((o,s)=>{const l=t.getDatasetMeta(0).controller.getStyle(s);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:i,lineWidth:l.borderWidth,pointStyle:r,hidden:!t.getDataVisibility(s),index:s}})}return[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class wm extends Ao{}Z(wm,"id","pie"),Z(wm,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class Au extends jr{getLabelAndValue(t){const n=this._cachedMeta.vScale,r=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(r[n.axis])}}parseObjectData(t,n,r,i){return L1.bind(this)(t,n,r,i)}update(t){const n=this._cachedMeta,r=n.dataset,i=n.data||[],o=n.iScale.getLabels();if(r.points=i,t!=="resize"){const s=this.resolveDatasetElementOptions(t);this.options.showLine||(s.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===i.length,options:s};this.updateElement(r,void 0,a,t)}this.updateElements(i,0,i.length,t)}updateElements(t,n,r,i){const o=this._cachedMeta.rScale,s=i==="reset";for(let a=n;a<n+r;a++){const l=t[a],c=this.resolveDataElementOptions(a,l.active?"active":i),u=o.getPointPositionForValue(a,this.getParsed(a).r),d=s?o.xCenter:u.x,f=s?o.yCenter:u.y,h={x:d,y:f,angle:u.angle,skip:isNaN(d)||isNaN(f),options:c};this.updateElement(l,a,h,i)}}}Z(Au,"id","radar"),Z(Au,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),Z(Au,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class Pu extends jr{getLabelAndValue(t){const n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:i,yScale:o}=n,s=this.getParsed(t),a=i.getLabelForValue(s.x),l=o.getLabelForValue(s.y);return{label:r[t]||"",value:"("+a+", "+l+")"}}update(t){const n=this._cachedMeta,{data:r=[]}=n,i=this.chart._animationsDisabled;let{start:o,count:s}=w1(n,r,i);if(this._drawStart=o,this._drawCount=s,_1(n)&&(o=0,s=r.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:l}=n;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=r;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!i,options:c},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(r,o,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,r,i){const o=i==="reset",{iScale:s,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(n,i),d=this.getSharedOptions(u),f=this.includeOptions(i,d),h=s.axis,v=a.axis,{spanGaps:m,segment:x}=this.options,b=ta(m)?m:Number.POSITIVE_INFINITY,g=this.chart._animationsDisabled||o||i==="none";let k=n>0&&this.getParsed(n-1);for(let E=n;E<n+r;++E){const C=t[E],S=this.getParsed(E),M=g?C:{},L=Ne(S[v]),T=M[h]=s.getPixelForValue(S[h],E),V=M[v]=o||L?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[v],E);M.skip=isNaN(T)||isNaN(V)||L,M.stop=E>0&&Math.abs(S[h]-k[h])>b,x&&(M.parsed=S,M.raw=c.data[E]),f&&(M.options=d||this.resolveDataElementOptions(E,C.active?"active":i)),g||this.updateElement(C,E,M,i),k=S}this.updateSharedOptions(d,i,u)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let a=0;for(let l=n.length-1;l>=0;--l)a=Math.max(a,n[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const r=t.dataset,i=r.options&&r.options.borderWidth||0;if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,s)/2}}Z(Pu,"id","scatter"),Z(Pu,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),Z(Pu,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var i2=Object.freeze({__proto__:null,BarController:ju,BubbleController:Ru,DoughnutController:Ao,LineController:Lu,PieController:wm,PolarAreaController:dl,RadarController:Au,ScatterController:Pu});function xo(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class pv{constructor(t){Z(this,"options");this.options=t||{}}static override(t){Object.assign(pv.prototype,t)}init(){}formats(){return xo()}parse(){return xo()}format(){return xo()}add(){return xo()}diff(){return xo()}startOf(){return xo()}endOf(){return xo()}}var o2={_date:pv};function s2(e,t,n,r){const{controller:i,data:o,_sorted:s}=e,a=i._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&s&&o.length){const c=a._reversePixels?jD:si;if(r){if(i._sharedOptions){const u=o[0],d=typeof u.getRange=="function"&&u.getRange(t);if(d){const f=c(o,t,n-d),h=c(o,t,n+d);return{lo:f.lo,hi:h.hi}}}}else{const u=c(o,t,n);if(l){const{vScale:d}=i._cachedMeta,{_parsed:f}=e,h=f.slice(0,u.lo+1).reverse().findIndex(m=>!Ne(m[d.axis]));u.lo-=Math.max(0,h);const v=f.slice(u.hi).findIndex(m=>!Ne(m[d.axis]));u.hi+=Math.max(0,v)}return u}}return{lo:0,hi:o.length-1}}function gf(e,t,n,r,i){const o=e.getSortedVisibleDatasetMetas(),s=n[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:u}=o[a],{lo:d,hi:f}=s2(o[a],t,s,i);for(let h=d;h<=f;++h){const v=u[h];v.skip||r(v,c,h)}}}function a2(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(r,i){const o=t?Math.abs(r.x-i.x):0,s=n?Math.abs(r.y-i.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}function Uh(e,t,n,r,i){const o=[];return!i&&!e.isPointInArea(t)||gf(e,n,t,function(a,l,c){!i&&!ai(a,e.chartArea,0)||a.inRange(t.x,t.y,r)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function l2(e,t,n,r){let i=[];function o(s,a,l){const{startAngle:c,endAngle:u}=s.getProps(["startAngle","endAngle"],r),{angle:d}=g1(s,{x:t.x,y:t.y});Hl(d,c,u)&&i.push({element:s,datasetIndex:a,index:l})}return gf(e,n,t,o),i}function c2(e,t,n,r,i,o){let s=[];const a=a2(n);let l=Number.POSITIVE_INFINITY;function c(u,d,f){const h=u.inRange(t.x,t.y,i);if(r&&!h)return;const v=u.getCenterPoint(i);if(!(!!o||e.isPointInArea(v))&&!h)return;const x=a(t,v);x<l?(s=[{element:u,datasetIndex:d,index:f}],l=x):x===l&&s.push({element:u,datasetIndex:d,index:f})}return gf(e,n,t,c),s}function Hh(e,t,n,r,i,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!r?l2(e,t,n,i):c2(e,t,n,r,i,o)}function uw(e,t,n,r,i){const o=[],s=n==="x"?"inXRange":"inYRange";let a=!1;return gf(e,n,t,(l,c,u)=>{l[s]&&l[s](t[n],i)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,i))}),r&&!a?[]:o}var u2={modes:{index(e,t,n,r){const i=So(t,e),o=n.axis||"x",s=n.includeInvisible||!1,a=n.intersect?Uh(e,i,o,r,s):Hh(e,i,o,!1,r,s),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,r){const i=So(t,e),o=n.axis||"xy",s=n.includeInvisible||!1;let a=n.intersect?Uh(e,i,o,r,s):Hh(e,i,o,!1,r,s);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,n,r){const i=So(t,e),o=n.axis||"xy",s=n.includeInvisible||!1;return Uh(e,i,o,r,s)},nearest(e,t,n,r){const i=So(t,e),o=n.axis||"xy",s=n.includeInvisible||!1;return Hh(e,i,o,n.intersect,r,s)},x(e,t,n,r){const i=So(t,e);return uw(e,i,"x",n.intersect,r)},y(e,t,n,r){const i=So(t,e);return uw(e,i,"y",n.intersect,r)}}};const U1=["left","top","right","bottom"];function Ra(e,t){return e.filter(n=>n.pos===t)}function dw(e,t){return e.filter(n=>U1.indexOf(n.pos)===-1&&n.box.axis===t)}function La(e,t){return e.sort((n,r)=>{const i=t?r:n,o=t?n:r;return i.weight===o.weight?i.index-o.index:i.weight-o.weight})}function d2(e){const t=[];let n,r,i,o,s,a;for(n=0,r=(e||[]).length;n<r;++n)i=e[n],{position:o,options:{stack:s,stackWeight:a=1}}=i,t.push({index:n,box:i,pos:o,horizontal:i.isHorizontal(),weight:i.weight,stack:s&&o+s,stackWeight:a});return t}function f2(e){const t={};for(const n of e){const{stack:r,pos:i,stackWeight:o}=n;if(!r||!U1.includes(i))continue;const s=t[r]||(t[r]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=o}return t}function h2(e,t){const n=f2(e),{vBoxMaxWidth:r,hBoxMaxHeight:i}=t;let o,s,a;for(o=0,s=e.length;o<s;++o){a=e[o];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*r:l&&t.availableWidth,a.height=i):(a.width=r,a.height=u?u*i:l&&t.availableHeight)}return n}function p2(e){const t=d2(e),n=La(t.filter(c=>c.box.fullSize),!0),r=La(Ra(t,"left"),!0),i=La(Ra(t,"right")),o=La(Ra(t,"top"),!0),s=La(Ra(t,"bottom")),a=dw(t,"x"),l=dw(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:i.concat(l).concat(s).concat(a),chartArea:Ra(t,"chartArea"),vertical:r.concat(i).concat(l),horizontal:o.concat(s).concat(a)}}function fw(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function H1(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function m2(e,t,n,r){const{pos:i,box:o}=n,s=e.maxPadding;if(!He(i)){n.size&&(e[i]-=n.size);const d=r[n.stack]||{size:0,count:1};d.size=Math.max(d.size,n.horizontal?o.height:o.width),n.size=d.size/d.count,e[i]+=n.size}o.getPadding&&H1(s,o.getPadding());const a=Math.max(0,t.outerWidth-fw(s,e,"left","right")),l=Math.max(0,t.outerHeight-fw(s,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function g2(e){const t=e.maxPadding;function n(r){const i=Math.max(t[r]-e[r],0);return e[r]+=i,i}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function v2(e,t){const n=t.maxPadding;function r(i){const o={left:0,top:0,right:0,bottom:0};return i.forEach(s=>{o[s]=Math.max(t[s],n[s])}),o}return r(e?["left","right"]:["top","bottom"])}function qa(e,t,n,r){const i=[];let o,s,a,l,c,u;for(o=0,s=e.length,c=0;o<s;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,v2(a.horizontal,t));const{same:d,other:f}=m2(t,n,a,r);c|=d&&i.length,u=u||f,l.fullSize||i.push(a)}return c&&qa(i,t,n,r)||u}function Zc(e,t,n,r,i){e.top=n,e.left=t,e.right=t+r,e.bottom=n+i,e.width=r,e.height=i}function hw(e,t,n,r){const i=n.padding;let{x:o,y:s}=t;for(const a of e){const l=a.box,c=r[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const d=t.w*u,f=c.size||l.height;Ul(c.start)&&(s=c.start),l.fullSize?Zc(l,i.left,s,n.outerWidth-i.right-i.left,f):Zc(l,t.left+c.placed,s,d,f),c.start=s,c.placed+=d,s=l.bottom}else{const d=t.h*u,f=c.size||l.width;Ul(c.start)&&(o=c.start),l.fullSize?Zc(l,o,i.top,f,n.outerHeight-i.bottom-i.top):Zc(l,o,t.top+c.placed,f,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=s}var bn={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;const i=wn(e.options.layout.padding),o=Math.max(t-i.width,0),s=Math.max(n-i.height,0),a=p2(e.boxes),l=a.vertical,c=a.horizontal;tt(e.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const u=l.reduce((m,x)=>x.box.options&&x.box.options.display===!1?m:m+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:o,availableHeight:s,vBoxMaxWidth:o/2/u,hBoxMaxHeight:s/2}),f=Object.assign({},i);H1(f,wn(r));const h=Object.assign({maxPadding:f,w:o,h:s,x:i.left,y:i.top},i),v=h2(l.concat(c),d);qa(a.fullSize,h,d,v),qa(l,h,d,v),qa(c,h,d,v)&&qa(l,h,d,v),g2(h),hw(a.leftAndTop,h,d,v),h.x+=h.w,h.y+=h.h,hw(a.rightAndBottom,h,d,v),e.chartArea={left:h.left,top:h.top,right:h.left+h.w,bottom:h.top+h.h,height:h.h,width:h.w},tt(a.chartArea,m=>{const x=m.box;Object.assign(x,e.chartArea),x.update(h.w,h.h,{left:0,top:0,right:0,bottom:0})})}};class W1{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,i){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,i?Math.floor(n/i):r)}}isAttached(t){return!0}updateConfig(t){}}class y2 extends W1{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Mu="$chartjs",b2={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},pw=e=>e===null||e==="";function x2(e,t){const n=e.style,r=e.getAttribute("height"),i=e.getAttribute("width");if(e[Mu]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",pw(i)){const o=Xx(e,"width");o!==void 0&&(e.width=o)}if(pw(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=Xx(e,"height");o!==void 0&&(e.height=o)}return e}const V1=wI?{passive:!0}:!1;function w2(e,t,n){e&&e.addEventListener(t,n,V1)}function _2(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,V1)}function k2(e,t){const n=b2[e.type]||e.type,{x:r,y:i}=So(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:i!==void 0?i:null}}function Cd(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function S2(e,t,n){const r=e.canvas,i=new MutationObserver(o=>{let s=!1;for(const a of o)s=s||Cd(a.addedNodes,r),s=s&&!Cd(a.removedNodes,r);s&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function E2(e,t,n){const r=e.canvas,i=new MutationObserver(o=>{let s=!1;for(const a of o)s=s||Cd(a.removedNodes,r),s=s&&!Cd(a.addedNodes,r);s&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}const Vl=new Map;let mw=0;function q1(){const e=window.devicePixelRatio;e!==mw&&(mw=e,Vl.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function O2(e,t){Vl.size||window.addEventListener("resize",q1),Vl.set(e,t)}function C2(e){Vl.delete(e),Vl.size||window.removeEventListener("resize",q1)}function j2(e,t,n){const r=e.canvas,i=r&&hv(r);if(!i)return;const o=x1((a,l)=>{const c=i.clientWidth;n(a,l),c<i.clientWidth&&n()},window),s=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return s.observe(i),O2(e,o),s}function Wh(e,t,n){n&&n.disconnect(),t==="resize"&&C2(e)}function R2(e,t,n){const r=e.canvas,i=x1(o=>{e.ctx!==null&&n(k2(o,e))},e);return w2(r,t,i),i}class L2 extends W1{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(x2(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[Mu])return!1;const r=n[Mu].initial;["height","width"].forEach(o=>{const s=r[o];Ne(s)?n.removeAttribute(o):n.setAttribute(o,s)});const i=r.style||{};return Object.keys(i).forEach(o=>{n.style[o]=i[o]}),n.width=n.width,delete n[Mu],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const i=t.$proxies||(t.$proxies={}),s={attach:S2,detach:E2,resize:j2}[n]||R2;i[n]=s(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),i=r[n];if(!i)return;({attach:Wh,detach:Wh,resize:Wh}[n]||_2)(t,n,i),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,i){return xI(t,n,r,i)}isAttached(t){const n=t&&hv(t);return!!(n&&n.isConnected)}}function A2(e){return!fv()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?y2:L2}class Ar{constructor(){Z(this,"x");Z(this,"y");Z(this,"active",!1);Z(this,"options");Z(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return ta(this.x)&&ta(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const i={};return t.forEach(o=>{i[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),i}}Z(Ar,"defaults",{}),Z(Ar,"defaultRoutes");function P2(e,t){const n=e.options.ticks,r=M2(e),i=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?D2(t):[],s=o.length,a=o[0],l=o[s-1],c=[];if(s>i)return I2(t,c,o,s/i),c;const u=T2(o,t,i);if(s>0){let d,f;const h=s>1?Math.round((l-a)/(s-1)):null;for(eu(t,c,u,Ne(h)?0:a-h,a),d=0,f=s-1;d<f;d++)eu(t,c,u,o[d],o[d+1]);return eu(t,c,u,l,Ne(h)?t.length:l+h),c}return eu(t,c,u),c}function M2(e){const t=e.options.offset,n=e._tickSize(),r=e._length/n+(t?0:1),i=e._maxLength/n;return Math.floor(Math.min(r,i))}function T2(e,t,n){const r=F2(e),i=t.length/n;if(!r)return Math.max(i,1);const o=kD(r);for(let s=0,a=o.length-1;s<a;s++){const l=o[s];if(l>i)return l}return Math.max(i,1)}function D2(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function I2(e,t,n,r){let i=0,o=n[0],s;for(r=Math.ceil(r),s=0;s<e.length;s++)s===o&&(t.push(e[s]),i++,o=n[i*r])}function eu(e,t,n,r,i){const o=Le(r,0),s=Math.min(Le(i,e.length),e.length);let a=0,l,c,u;for(n=Math.ceil(n),i&&(l=i-r,n=l/Math.floor(l/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<s;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function F2(e){const t=e.length;let n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}const N2=e=>e==="left"?"right":e==="right"?"left":e,gw=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,vw=(e,t)=>Math.min(t||e,e);function yw(e,t){const n=[],r=e.length/t,i=e.length;let o=0;for(;o<i;o+=r)n.push(e[Math.floor(o)]);return n}function z2(e,t,n){const r=e.ticks.length,i=Math.min(t,r-1),o=e._startPixel,s=e._endPixel,a=1e-6;let l=e.getPixelForTick(i),c;if(!(n&&(r===1?c=Math.max(l-o,s-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(i-1))/2,l+=i<t?c:-c,l<o-a||l>s+a)))return l}function B2(e,t){tt(e,n=>{const r=n.gc,i=r.length/2;let o;if(i>t){for(o=0;o<i;++o)delete n.data[r[o]];r.splice(0,i)}})}function Aa(e){return e.drawTicks?e.tickLength:0}function bw(e,t){if(!e.display)return 0;const n=Gt(e.font,t),r=wn(e.padding);return(wt(e.text)?e.text.length:1)*n.lineHeight+r.height}function U2(e,t){return ao(e,{scale:t,type:"scale"})}function H2(e,t,n){return ao(e,{tick:n,index:t,type:"tick"})}function W2(e,t,n){let r=sv(e);return(n&&t!=="right"||!n&&t==="right")&&(r=N2(r)),r}function V2(e,t,n,r){const{top:i,left:o,bottom:s,right:a,chart:l}=e,{chartArea:c,scales:u}=l;let d=0,f,h,v;const m=s-i,x=a-o;if(e.isHorizontal()){if(h=pn(r,o,a),He(n)){const b=Object.keys(n)[0],g=n[b];v=u[b].getPixelForValue(g)+m-t}else n==="center"?v=(c.bottom+c.top)/2+m-t:v=gw(e,n,t);f=a-o}else{if(He(n)){const b=Object.keys(n)[0],g=n[b];h=u[b].getPixelForValue(g)-x+t}else n==="center"?h=(c.left+c.right)/2-x+t:h=gw(e,n,t);v=pn(r,s,i),d=n==="left"?-Bt:Bt}return{titleX:h,titleY:v,maxWidth:f,rotation:d}}class ts extends Ar{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:r,_suggestedMax:i}=this;return t=Yn(t,Number.POSITIVE_INFINITY),n=Yn(n,Number.NEGATIVE_INFINITY),r=Yn(r,Number.POSITIVE_INFINITY),i=Yn(i,Number.NEGATIVE_INFINITY),{min:Yn(t,r),max:Yn(n,i),minDefined:It(t),maxDefined:It(n)}}getMinMax(t){let{min:n,max:r,minDefined:i,maxDefined:o}=this.getUserBounds(),s;if(i&&o)return{min:n,max:r};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)s=a[l].controller.getMinMax(this,t),i||(n=Math.min(n,s.min)),o||(r=Math.max(r,s.max));return n=o&&n>r?r:n,r=i&&n>r?n:r,{min:Yn(n,Yn(r,n)),max:Yn(r,Yn(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){dt(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:i,grace:o,ticks:s}=this.options,a=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=QD(this,o,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?yw(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||s.source==="auto")&&(this.ticks=P2(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,t=!t),this._startPixel=n,this._endPixel=r,this._reversePixels=t,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){dt(this.options.afterUpdate,[this])}beforeSetDimensions(){dt(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){dt(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),dt(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){dt(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let r,i,o;for(r=0,i=t.length;r<i;r++)o=t[r],o.label=dt(n.callback,[o.value,r,t],this)}afterTickToLabelConversion(){dt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){dt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,r=vw(this.ticks.length,t.ticks.maxTicksLimit),i=n.minRotation||0,o=n.maxRotation;let s=i,a,l,c;if(!this._isVisible()||!n.display||i>=o||r<=1||!this.isHorizontal()){this.labelRotation=i;return}const u=this._getLabelSizes(),d=u.widest.width,f=u.highest.height,h=Zt(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/r:h/(r-1),d+6>a&&(a=h/(r-(t.offset?.5:1)),l=this.maxHeight-Aa(t.grid)-n.padding-bw(t.title,this.chart.options.font),c=Math.sqrt(d*d+f*f),s=iv(Math.min(Math.asin(Zt((u.highest.height+6)/a,-1,1)),Math.asin(Zt(l/c,-1,1))-Math.asin(Zt(f/c,-1,1)))),s=Math.max(i,Math.min(o,s))),this.labelRotation=s}afterCalculateLabelRotation(){dt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){dt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:i,grid:o}}=this,s=this._isVisible(),a=this.isHorizontal();if(s){const l=bw(i,n.options.font);if(a?(t.width=this.maxWidth,t.height=Aa(o)+l):(t.height=this.maxHeight,t.width=Aa(o)+l),r.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:f}=this._getLabelSizes(),h=r.padding*2,v=Er(this.labelRotation),m=Math.cos(v),x=Math.sin(v);if(a){const b=r.mirror?0:x*d.width+m*f.height;t.height=Math.min(this.maxHeight,t.height+b+h)}else{const b=r.mirror?0:m*d.width+x*f.height;t.width=Math.min(this.maxWidth,t.width+b+h)}this._calculatePadding(c,u,x,m)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,i){const{ticks:{align:o,padding:s},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,h=0;l?c?(f=i*t.width,h=r*n.height):(f=r*t.height,h=i*n.width):o==="start"?h=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,h=n.width/2),this.paddingLeft=Math.max((f-u+s)*this.width/(this.width-u),0),this.paddingRight=Math.max((h-d+s)*this.width/(this.width-d),0)}else{let u=n.height/2,d=t.height/2;o==="start"?(u=0,d=t.height):o==="end"&&(u=n.height,d=0),this.paddingTop=u+s,this.paddingBottom=d+s}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){dt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n<r;n++)Ne(t[n].label)&&(t.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=yw(r,n)),this._labelSizes=t=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,r){const{ctx:i,_longestTextCache:o}=this,s=[],a=[],l=Math.floor(n/vw(n,r));let c=0,u=0,d,f,h,v,m,x,b,g,k,E,C;for(d=0;d<n;d+=l){if(v=t[d].label,m=this._resolveTickFontOptions(d),i.font=x=m.string,b=o[x]=o[x]||{data:{},gc:[]},g=m.lineHeight,k=E=0,!Ne(v)&&!wt(v))k=Ed(i,b.data,b.gc,k,v),E=g;else if(wt(v))for(f=0,h=v.length;f<h;++f)C=v[f],!Ne(C)&&!wt(C)&&(k=Ed(i,b.data,b.gc,k,C),E+=g);s.push(k),a.push(E),c=Math.max(k,c),u=Math.max(E,u)}B2(o,n);const S=s.indexOf(c),M=a.indexOf(u),L=T=>({width:s[T]||0,height:a[T]||0});return{first:L(0),last:L(n-1),widest:L(S),highest:L(M),widths:s,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return CD(this._alignToPixels?bo(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const r=n[t];return r.$context||(r.$context=H2(this.getContext(),t,r))}return this.$context||(this.$context=U2(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Er(this.labelRotation),r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),o=this._getLabelSizes(),s=t.autoSkipPadding||0,a=o?o.widest.width+s:0,l=o?o.highest.height+s:0;return this.isHorizontal()?l*r>a*i?a/r:l/i:l*i<a*r?l/r:a/i}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,r=this.chart,i=this.options,{grid:o,position:s,border:a}=i,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),f=Aa(o),h=[],v=a.setContext(this.getContext()),m=v.display?v.width:0,x=m/2,b=function(re){return bo(r,re,m)};let g,k,E,C,S,M,L,T,V,G,N,te;if(s==="top")g=b(this.bottom),M=this.bottom-f,T=g-x,G=b(t.top)+x,te=t.bottom;else if(s==="bottom")g=b(this.top),G=t.top,te=b(t.bottom)-x,M=g+x,T=this.top+f;else if(s==="left")g=b(this.right),S=this.right-f,L=g-x,V=b(t.left)+x,N=t.right;else if(s==="right")g=b(this.left),V=t.left,N=b(t.right)-x,S=g+x,L=this.left+f;else if(n==="x"){if(s==="center")g=b((t.top+t.bottom)/2+.5);else if(He(s)){const re=Object.keys(s)[0],pe=s[re];g=b(this.chart.scales[re].getPixelForValue(pe))}G=t.top,te=t.bottom,M=g+x,T=M+f}else if(n==="y"){if(s==="center")g=b((t.left+t.right)/2);else if(He(s)){const re=Object.keys(s)[0],pe=s[re];g=b(this.chart.scales[re].getPixelForValue(pe))}S=g-x,L=S-f,V=t.left,N=t.right}const W=Le(i.ticks.maxTicksLimit,d),Y=Math.max(1,Math.ceil(d/W));for(k=0;k<d;k+=Y){const re=this.getContext(k),pe=o.setContext(re),B=a.setContext(re),ee=pe.lineWidth,ce=pe.color,ve=B.dash||[],ke=B.dashOffset,je=pe.tickWidth,ie=pe.tickColor,me=pe.tickBorderDash||[],xe=pe.tickBorderDashOffset;E=z2(this,k,l),E!==void 0&&(C=bo(r,E,ee),c?S=L=V=N=C:M=T=G=te=C,h.push({tx1:S,ty1:M,tx2:L,ty2:T,x1:V,y1:G,x2:N,y2:te,width:ee,color:ce,borderDash:ve,borderDashOffset:ke,tickWidth:je,tickColor:ie,tickBorderDash:me,tickBorderDashOffset:xe}))}return this._ticksLength=d,this._borderValue=g,h}_computeLabelItems(t){const n=this.axis,r=this.options,{position:i,ticks:o}=r,s=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=o,f=Aa(r.grid),h=f+u,v=d?-u:h,m=-Er(this.labelRotation),x=[];let b,g,k,E,C,S,M,L,T,V,G,N,te="middle";if(i==="top")S=this.bottom-v,M=this._getXAxisLabelAlignment();else if(i==="bottom")S=this.top+v,M=this._getXAxisLabelAlignment();else if(i==="left"){const Y=this._getYAxisLabelAlignment(f);M=Y.textAlign,C=Y.x}else if(i==="right"){const Y=this._getYAxisLabelAlignment(f);M=Y.textAlign,C=Y.x}else if(n==="x"){if(i==="center")S=(t.top+t.bottom)/2+h;else if(He(i)){const Y=Object.keys(i)[0],re=i[Y];S=this.chart.scales[Y].getPixelForValue(re)+h}M=this._getXAxisLabelAlignment()}else if(n==="y"){if(i==="center")C=(t.left+t.right)/2-h;else if(He(i)){const Y=Object.keys(i)[0],re=i[Y];C=this.chart.scales[Y].getPixelForValue(re)}M=this._getYAxisLabelAlignment(f).textAlign}n==="y"&&(l==="start"?te="top":l==="end"&&(te="bottom"));const W=this._getLabelSizes();for(b=0,g=a.length;b<g;++b){k=a[b],E=k.label;const Y=o.setContext(this.getContext(b));L=this.getPixelForTick(b)+o.labelOffset,T=this._resolveTickFontOptions(b),V=T.lineHeight,G=wt(E)?E.length:1;const re=G/2,pe=Y.color,B=Y.textStrokeColor,ee=Y.textStrokeWidth;let ce=M;s?(C=L,M==="inner"&&(b===g-1?ce=this.options.reverse?"left":"right":b===0?ce=this.options.reverse?"right":"left":ce="center"),i==="top"?c==="near"||m!==0?N=-G*V+V/2:c==="center"?N=-W.highest.height/2-re*V+V:N=-W.highest.height+V/2:c==="near"||m!==0?N=V/2:c==="center"?N=W.highest.height/2-re*V:N=W.highest.height-G*V,d&&(N*=-1),m!==0&&!Y.showLabelBackdrop&&(C+=V/2*Math.sin(m))):(S=L,N=(1-G)*V/2);let ve;if(Y.showLabelBackdrop){const ke=wn(Y.backdropPadding),je=W.heights[b],ie=W.widths[b];let me=N-ke.top,xe=0-ke.left;switch(te){case"middle":me-=je/2;break;case"bottom":me-=je;break}switch(M){case"center":xe-=ie/2;break;case"right":xe-=ie;break;case"inner":b===g-1?xe-=ie:b>0&&(xe-=ie/2);break}ve={left:xe,top:me,width:ie+ke.width,height:je+ke.height,color:Y.backdropColor}}x.push({label:E,font:T,textOffset:N,options:{rotation:m,color:pe,strokeColor:B,strokeWidth:ee,textAlign:ce,textBaseline:te,translation:[C,S],backdrop:ve}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Er(this.labelRotation))return t==="top"?"left":"right";let i="center";return n.align==="start"?i="left":n.align==="end"?i="right":n.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:i,padding:o}}=this.options,s=this._getLabelSizes(),a=t+o,l=s.widest.width;let c,u;return n==="left"?i?(u=this.right+o,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?i?(u=this.left+o,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:i,width:o,height:s}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,i,o,s),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const i=this.ticks.findIndex(o=>o.value===t);return i>=0?n.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,s;const a=(l,c,u)=>{!u.width||!u.color||(r.save(),r.lineWidth=u.width,r.strokeStyle=u.color,r.setLineDash(u.borderDash||[]),r.lineDashOffset=u.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(o=0,s=i.length;o<s;++o){const l=i[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:r,grid:i}}=this,o=r.setContext(this.getContext()),s=r.display?o.width:0;if(!s)return;const a=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,d,f;this.isHorizontal()?(c=bo(t,this.left,s)-s/2,u=bo(t,this.right,a)+a/2,d=f=l):(d=bo(t,this.top,s)-s/2,f=bo(t,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,d),n.lineTo(u,f),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const r=this.ctx,i=this._computeLabelArea();i&&hf(r,i);const o=this.getLabelItems(t);for(const s of o){const a=s.options,l=s.font,c=s.label,u=s.textOffset;Go(r,c,0,u,l,a)}i&&pf(r)}drawTitle(){const{ctx:t,options:{position:n,title:r,reverse:i}}=this;if(!r.display)return;const o=Gt(r.font),s=wn(r.padding),a=r.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||He(n)?(l+=s.bottom,wt(r.text)&&(l+=o.lineHeight*(r.text.length-1))):l+=s.top;const{titleX:c,titleY:u,maxWidth:d,rotation:f}=V2(this,l,n,a);Go(t,r.text,0,0,o,{color:r.color,maxWidth:d,rotation:f,textAlign:W2(a,n,i),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,r=Le(t.grid&&t.grid.z,-1),i=Le(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==ts.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",i=[];let o,s;for(o=0,s=n.length;o<s;++o){const a=n[o];a[r]===this.id&&(!t||a.type===t)&&i.push(a)}return i}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return Gt(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class tu{constructor(t,n,r){this.type=t,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let r;K2(n)&&(r=this.register(n));const i=this.items,o=t.id,s=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in i||(i[o]=t,q2(t,s,r),this.override&&_t.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const n=this.items,r=t.id,i=this.scope;r in n&&delete n[r],i&&r in _t[i]&&(delete _t[i][r],this.override&&delete Yo[r])}}function q2(e,t,n){const r=Bl(Object.create(null),[n?_t.get(n):{},_t.get(t),e.defaults]);_t.set(t,r),e.defaultRoutes&&$2(t,e.defaultRoutes),e.descriptors&&_t.describe(t,e.descriptors)}function $2(e,t){Object.keys(t).forEach(n=>{const r=n.split("."),i=r.pop(),o=[e].concat(r).join("."),s=t[n].split("."),a=s.pop(),l=s.join(".");_t.route(o,i,l,a)})}function K2(e){return"id"in e&&"defaults"in e}class Y2{constructor(){this.controllers=new tu(jr,"datasets",!0),this.elements=new tu(Ar,"elements"),this.plugins=new tu(Object,"plugins"),this.scales=new tu(ts,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(i=>{const o=r||this._getRegistryForType(i);r||o.isForType(i)||o===this.plugins&&i.id?this._exec(t,o,i):tt(i,s=>{const a=r||this._getRegistryForType(s);this._exec(t,a,s)})})}_exec(t,n,r){const i=rv(t);dt(r["before"+i],[],r),n[t](r),dt(r["after"+i],[],r)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(t))return r}return this.plugins}_get(t,n,r){const i=n.get(t);if(i===void 0)throw new Error('"'+t+'" is not a registered '+r+".");return i}}var zr=new Y2;class G2{constructor(){this._init=void 0}notify(t,n,r,i){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=i?this._descriptors(t).filter(i):this._descriptors(t),s=this._notify(o,t,n,r);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),s}_notify(t,n,r,i){i=i||{};for(const o of t){const s=o.plugin,a=s[r],l=[n,i,o.options];if(dt(a,l,s)===!1&&i.cancelable)return!1}return!0}invalidate(){Ne(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const r=t&&t.config,i=Le(r.options&&r.options.plugins,{}),o=J2(r);return i===!1&&!n?[]:Q2(t,o,i,n)}_notifyStateChanges(t){const n=this._oldCache||[],r=this._cache,i=(o,s)=>o.filter(a=>!s.some(l=>a.plugin.id===l.plugin.id));this._notify(i(n,r),t,"stop"),this._notify(i(r,n),t,"start")}}function J2(e){const t={},n=[],r=Object.keys(zr.plugins.items);for(let o=0;o<r.length;o++)n.push(zr.getPlugin(r[o]));const i=e.plugins||[];for(let o=0;o<i.length;o++){const s=i[o];n.indexOf(s)===-1&&(n.push(s),t[s.id]=!0)}return{plugins:n,localIds:t}}function X2(e,t){return!t&&e===!1?null:e===!0?{}:e}function Q2(e,{plugins:t,localIds:n},r,i){const o=[],s=e.getContext();for(const a of t){const l=a.id,c=X2(r[l],i);c!==null&&o.push({plugin:a,options:Z2(e.config,{plugin:a,local:n[l]},c,s)})}return o}function Z2(e,{plugin:t,local:n},r,i){const o=e.pluginScopeKeys(t),s=e.getOptionScopes(r,o);return n&&t.defaults&&s.push(t.defaults),e.createResolver(s,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function _m(e,t){const n=_t.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function eF(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function tF(e,t){return e===t?"_index_":"_value_"}function xw(e){if(e==="x"||e==="y"||e==="r")return e}function nF(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function km(e,...t){if(xw(e))return e;for(const n of t){const r=n.axis||nF(n.position)||e.length>1&&xw(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function ww(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function rF(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return ww(e,"x",n[0])||ww(e,"y",n[0])}return{}}function iF(e,t){const n=Yo[e.type]||{scales:{}},r=t.scales||{},i=_m(e.type,t),o=Object.create(null);return Object.keys(r).forEach(s=>{const a=r[s];if(!He(a))return console.error(`Invalid scale configuration for scale: ${s}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${s}`);const l=km(s,a,rF(s,e),_t.scales[a.type]),c=tF(l,i),u=n.scales||{};o[s]=al(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(s=>{const a=s.type||e.type,l=s.indexAxis||_m(a,t),u=(Yo[a]||{}).scales||{};Object.keys(u).forEach(d=>{const f=eF(d,l),h=s[f+"AxisID"]||f;o[h]=o[h]||Object.create(null),al(o[h],[{axis:f},r[h],u[d]])})}),Object.keys(o).forEach(s=>{const a=o[s];al(a,[_t.scales[a.type],_t.scale])}),o}function $1(e){const t=e.options||(e.options={});t.plugins=Le(t.plugins,{}),t.scales=iF(e,t)}function K1(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function oF(e){return e=e||{},e.data=K1(e.data),$1(e),e}const _w=new Map,Y1=new Set;function nu(e,t){let n=_w.get(e);return n||(n=t(),_w.set(e,n),Y1.add(n)),n}const Pa=(e,t,n)=>{const r=eo(t,n);r!==void 0&&e.add(r)};class sF{constructor(t){this._config=oF(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=K1(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),$1(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return nu(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return nu(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return nu(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return nu(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let i=r.get(t);return(!i||n)&&(i=new Map,r.set(t,i)),i}getOptionScopes(t,n,r){const{options:i,type:o}=this,s=this._cachedScopes(t,r),a=s.get(n);if(a)return a;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(d=>Pa(l,t,d))),u.forEach(d=>Pa(l,i,d)),u.forEach(d=>Pa(l,Yo[o]||{},d)),u.forEach(d=>Pa(l,_t,d)),u.forEach(d=>Pa(l,bm,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Y1.has(n)&&s.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Yo[n]||{},_t.datasets[n]||{},{type:n},_t,bm]}resolveNamedOptions(t,n,r,i=[""]){const o={$shared:!0},{resolver:s,subPrefixes:a}=kw(this._resolverCache,t,i);let l=s;if(lF(s,n)){o.$shared=!1,r=to(r)?r():r;const c=this.createResolver(t,r,a);l=na(s,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,r=[""],i){const{resolver:o}=kw(this._resolverCache,t,r);return He(n)?na(o,n,void 0,i):o}}function kw(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const i=n.join();let o=r.get(i);return o||(o={resolver:cv(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(i,o)),o}const aF=e=>He(e)&&Object.getOwnPropertyNames(e).some(t=>to(e[t]));function lF(e,t){const{isScriptable:n,isIndexable:r}=O1(e);for(const i of t){const o=n(i),s=r(i),a=(s||o)&&e[i];if(o&&(to(a)||aF(a))||s&&wt(a))return!0}return!1}var cF="4.5.1";const uF=["top","bottom","left","right","chartArea"];function Sw(e,t){return e==="top"||e==="bottom"||uF.indexOf(e)===-1&&t==="x"}function Ew(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Ow(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),dt(n&&n.onComplete,[e],t)}function dF(e){const t=e.chart,n=t.options.animation;dt(n&&n.onProgress,[e],t)}function G1(e){return fv()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Tu={},Cw=e=>{const t=G1(e);return Object.values(Tu).filter(n=>n.canvas===t).pop()};function fF(e,t,n){const r=Object.keys(e);for(const i of r){const o=+i;if(o>=t){const s=e[i];delete e[i],(n>0||o>t)&&(e[o+n]=s)}}}function hF(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}class Sr{static register(...t){zr.add(...t),jw()}static unregister(...t){zr.remove(...t),jw()}constructor(t,n){const r=this.config=new sF(n),i=G1(t),o=Cw(i);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const s=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||A2(i)),this.platform.updateConfig(r);const a=this.platform.acquireContext(i,s.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=pD(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=s,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new G2,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=AD(d=>this.update(d),s.resizeDelay||0),this._dataChanges=[],Tu[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Jr.listen(this,"complete",Ow),Jr.listen(this,"progress",dF),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:i,_aspectRatio:o}=this;return Ne(t)?n&&o?o:i?r/i:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return zr}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Jx(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Kx(this.canvas,this.ctx),this}stop(){return Jr.stop(this),this}resize(t,n){Jr.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,i=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(i,t,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,Jx(this,a,!0)&&(this.notifyPlugins("resize",{size:s}),dt(r.onResize,[this,s],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};tt(n,(r,i)=>{r.id=i})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,i=Object.keys(r).reduce((s,a)=>(s[a]=!1,s),{});let o=[];n&&(o=o.concat(Object.keys(n).map(s=>{const a=n[s],l=km(s,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),tt(o,s=>{const a=s.options,l=a.id,c=km(l,a),u=Le(a.type,s.dtype);(a.position===void 0||Sw(a.position,c)!==Sw(s.dposition))&&(a.position=s.dposition),i[l]=!0;let d=null;if(l in r&&r[l].type===u)d=r[l];else{const f=zr.getScale(u);d=new f({id:l,type:u,ctx:this.ctx,chart:this}),r[d.id]=d}d.init(a,t)}),tt(i,(s,a)=>{s||delete r[a]}),tt(r,s=>{bn.configure(this,s,s.options),bn.addBox(this,s)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((i,o)=>i.index-o.index),r>n){for(let i=n;i<r;++i)this._destroyDatasetMeta(i);t.splice(n,r-n)}this._sortedMetasets=t.slice(0).sort(Ew("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((r,i)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,i;for(this._removeUnreferencedMetasets(),r=0,i=n.length;r<i;r++){const o=n[r];let s=this.getDatasetMeta(r);const a=o.type||this.config.type;if(s.type&&s.type!==a&&(this._destroyDatasetMeta(r),s=this.getDatasetMeta(r)),s.type=a,s.indexAxis=o.indexAxis||_m(a,this.options),s.order=o.order||0,s.index=r,s.label=""+o.label,s.visible=this.isDatasetVisible(r),s.controller)s.controller.updateIndex(r),s.controller.linkScales();else{const l=zr.getController(a),{datasetElementType:c,dataElementType:u}=_t.datasets[a];Object.assign(l,{dataElementType:zr.getElement(u),datasetElementType:c&&zr.getElement(c)}),s.controller=new l(this,r),t.push(s.controller)}}return this._updateMetasets(),t}_resetElements(){tt(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:d}=this.getDatasetMeta(c),f=!i&&o.indexOf(d)===-1;d.buildOrUpdateElements(f),s=Math.max(+d.getMaxOverflow(),s)}s=this._minPadding=r.layout.autoPadding?s:0,this._updateLayout(s),i||tt(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ew("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){tt(this.scales,t=>{bn.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!Nx(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:i,count:o}of n){const s=r==="_removeElements"?-o:o;fF(t,i,s)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(t.filter(s=>s[0]===o).map((s,a)=>a+","+s.splice(1).join(","))),i=r(0);for(let o=1;o<n;o++)if(!Nx(i,r(o)))return;return Array.from(i).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;bn.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],tt(this.boxes,i=>{r&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,o)=>{i._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,to(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const r=this.getDatasetMeta(t),i={meta:r,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(r.controller._update(n),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Jr.has(this)?this.attached&&!Jr.running(this)&&Jr.start(this):(this.draw(),Ow({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:r,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,r=[];let i,o;for(i=0,o=n.length;i<o;++i){const s=n[i];(!t||s.visible)&&r.push(s)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r={meta:t,index:t.index,cancelable:!0},i=F1(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(i&&hf(n,i),t.controller.draw(),i&&pf(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return ai(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,i){const o=u2.modes[n];return typeof o=="function"?o(this,t,r,i):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let i=r.filter(o=>o&&o._dataset===n).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(i)),i}getContext(){return this.$context||(this.$context=ao(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const i=r?"show":"hide",o=this.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,i);Ul(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),s.update(o,{visible:r}),this.update(a=>a.datasetIndex===t?i:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Jr.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Kx(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Tu[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,r=(o,s)=>{n.addEventListener(this,o,s),t[o]=s},i=(o,s,a)=>{o.offsetX=s,o.offsetY=a,this._eventHandler(o)};tt(this.options.events,o=>r(o,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},i=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let s;const a=()=>{i("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",s)};s=()=>{this.attached=!1,i("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():s()}unbindEvents(){tt(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},tt(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const i=r?"set":"remove";let o,s,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+i+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){s=t[a];const c=s&&this.getDatasetMeta(s.datasetIndex).controller;c&&c[i+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],r=t.map(({datasetIndex:o,index:s})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[s],index:s}});!_d(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const i=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),s=o(n,t),a=r?t:o(t,n);s.length&&this.updateHoverStyle(s,i.mode,!1),a.length&&i.mode&&this.updateHoverStyle(a,i.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},i=s=>(s.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,i)===!1)return;const o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,i),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:i=[],options:o}=this,s=n,a=this._getActiveElements(t,i,r,s),l=xD(t),c=hF(t,this._lastEvent,r,l);r&&(this._lastEvent=null,dt(o.onHover,[t,a,this],this),l&&dt(o.onClick,[t,a,this],this));const u=!_d(a,i);return(u||n)&&(this._active=a,this._updateHoverStyles(a,i,n)),this._lastEvent=c,u}_getActiveElements(t,n,r,i){if(t.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,i)}}Z(Sr,"defaults",_t),Z(Sr,"instances",Tu),Z(Sr,"overrides",Yo),Z(Sr,"registry",zr),Z(Sr,"version",cF),Z(Sr,"getChart",Cw);function jw(){return tt(Sr.instances,e=>e._plugins.invalidate())}function pF(e,t,n){const{startAngle:r,x:i,y:o,outerRadius:s,innerRadius:a,options:l}=t,{borderWidth:c,borderJoinStyle:u}=l,d=Math.min(c/s,vn(r-n));if(e.beginPath(),e.arc(i,o,s-c/2,r+d/2,n-d/2),a>0){const f=Math.min(c/a,vn(r-n));e.arc(i,o,a+c/2,n-f/2,r+f/2,!0)}else{const f=Math.min(c/2,s*vn(r-n));if(u==="round")e.arc(i,o,f,n-Ye/2,r+Ye/2,!0);else if(u==="bevel"){const h=2*f*f,v=-h*Math.cos(n+Ye/2)+i,m=-h*Math.sin(n+Ye/2)+o,x=h*Math.cos(r+Ye/2)+i,b=h*Math.sin(r+Ye/2)+o;e.lineTo(v,m),e.lineTo(x,b)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function mF(e,t,n){const{startAngle:r,pixelMargin:i,x:o,y:s,outerRadius:a,innerRadius:l}=t;let c=i/a;e.beginPath(),e.arc(o,s,a,r-c,n+c),l>i?(c=i/l,e.arc(o,s,l,n+c,r-c,!0)):e.arc(o,s,i,n+Bt,r-Bt),e.closePath(),e.clip()}function gF(e){return lv(e,["outerStart","outerEnd","innerStart","innerEnd"])}function vF(e,t,n,r){const i=gF(e.options.borderRadius),o=(n-t)/2,s=Math.min(o,r*t/2),a=l=>{const c=(n-Math.min(o,l))*r/2;return Zt(l,0,Math.min(o,c))};return{outerStart:a(i.outerStart),outerEnd:a(i.outerEnd),innerStart:Zt(i.innerStart,0,s),innerEnd:Zt(i.innerEnd,0,s)}}function ps(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function jd(e,t,n,r,i,o){const{x:s,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+r+n-c,0),f=u>0?u+r+n+c:0;let h=0;const v=i-l;if(r){const Y=u>0?u-r:0,re=d>0?d-r:0,pe=(Y+re)/2,B=pe!==0?v*pe/(pe+r):v;h=(v-B)/2}const m=Math.max(.001,v*d-n/Ye)/d,x=(v-m)/2,b=l+x+h,g=i-x-h,{outerStart:k,outerEnd:E,innerStart:C,innerEnd:S}=vF(t,f,d,g-b),M=d-k,L=d-E,T=b+k/M,V=g-E/L,G=f+C,N=f+S,te=b+C/G,W=g-S/N;if(e.beginPath(),o){const Y=(T+V)/2;if(e.arc(s,a,d,T,Y),e.arc(s,a,d,Y,V),E>0){const ee=ps(L,V,s,a);e.arc(ee.x,ee.y,E,V,g+Bt)}const re=ps(N,g,s,a);if(e.lineTo(re.x,re.y),S>0){const ee=ps(N,W,s,a);e.arc(ee.x,ee.y,S,g+Bt,W+Math.PI)}const pe=(g-S/f+(b+C/f))/2;if(e.arc(s,a,f,g-S/f,pe,!0),e.arc(s,a,f,pe,b+C/f,!0),C>0){const ee=ps(G,te,s,a);e.arc(ee.x,ee.y,C,te+Math.PI,b-Bt)}const B=ps(M,b,s,a);if(e.lineTo(B.x,B.y),k>0){const ee=ps(M,T,s,a);e.arc(ee.x,ee.y,k,b-Bt,T)}}else{e.moveTo(s,a);const Y=Math.cos(T)*d+s,re=Math.sin(T)*d+a;e.lineTo(Y,re);const pe=Math.cos(V)*d+s,B=Math.sin(V)*d+a;e.lineTo(pe,B)}e.closePath()}function yF(e,t,n,r,i){const{fullCircles:o,startAngle:s,circumference:a}=t;let l=t.endAngle;if(o){jd(e,t,n,r,l,i);for(let c=0;c<o;++c)e.fill();isNaN(a)||(l=s+(a%yt||yt))}return jd(e,t,n,r,l,i),e.fill(),l}function bF(e,t,n,r,i){const{fullCircles:o,startAngle:s,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:f,borderRadius:h}=l,v=l.borderAlign==="inner";if(!c)return;e.setLineDash(d||[]),e.lineDashOffset=f,v?(e.lineWidth=c*2,e.lineJoin=u||"round"):(e.lineWidth=c,e.lineJoin=u||"bevel");let m=t.endAngle;if(o){jd(e,t,n,r,m,i);for(let x=0;x<o;++x)e.stroke();isNaN(a)||(m=s+(a%yt||yt))}v&&mF(e,t,m),l.selfJoin&&m-s>=Ye&&h===0&&u!=="miter"&&pF(e,t,m),o||(jd(e,t,n,r,m,i),e.stroke())}class $a extends Ar{constructor(n){super();Z(this,"circumference");Z(this,"endAngle");Z(this,"fullCircles");Z(this,"innerRadius");Z(this,"outerRadius");Z(this,"pixelMargin");Z(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,i){const o=this.getProps(["x","y"],i),{angle:s,distance:a}=g1(o,{x:n,y:r}),{startAngle:l,endAngle:c,innerRadius:u,outerRadius:d,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),h=(this.options.spacing+this.options.borderWidth)/2,v=Le(f,c-l),m=Hl(s,l,c)&&l!==c,x=v>=yt||m,b=oi(a,u+h,d+h);return x&&b}getCenterPoint(n){const{x:r,y:i,startAngle:o,endAngle:s,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:u}=this.options,d=(o+s)/2,f=(a+l+u+c)/2;return{x:r+Math.cos(d)*f,y:i+Math.sin(d)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:i}=this,o=(r.offset||0)/4,s=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=i>yt?Math.floor(i/yt):0,i===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(Ye,i||0)),u=o*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,yF(n,this,u,s,a),bF(n,this,u,s,a),n.restore()}}Z($a,"id","arc"),Z($a,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),Z($a,"defaultRoutes",{backgroundColor:"backgroundColor"}),Z($a,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function J1(e,t,n=t){e.lineCap=Le(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Le(n.borderDash,t.borderDash)),e.lineDashOffset=Le(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Le(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Le(n.borderWidth,t.borderWidth),e.strokeStyle=Le(n.borderColor,t.borderColor)}function xF(e,t,n){e.lineTo(n.x,n.y)}function wF(e){return e.stepped?WD:e.tension||e.cubicInterpolationMode==="monotone"?VD:xF}function X1(e,t,n={}){const r=e.length,{start:i=0,end:o=r-1}=n,{start:s,end:a}=t,l=Math.max(i,s),c=Math.min(o,a),u=i<s&&o<s||i>a&&o>a;return{count:r,start:l,loop:t.loop,ilen:c<l&&!u?r+c-l:c-l}}function _F(e,t,n,r){const{points:i,options:o}=t,{count:s,start:a,loop:l,ilen:c}=X1(i,n,r),u=wF(o);let{move:d=!0,reverse:f}=r||{},h,v,m;for(h=0;h<=c;++h)v=i[(a+(f?c-h:h))%s],!v.skip&&(d?(e.moveTo(v.x,v.y),d=!1):u(e,m,v,f,o.stepped),m=v);return l&&(v=i[(a+(f?c:0))%s],u(e,m,v,f,o.stepped)),!!l}function kF(e,t,n,r){const i=t.points,{count:o,start:s,ilen:a}=X1(i,n,r),{move:l=!0,reverse:c}=r||{};let u=0,d=0,f,h,v,m,x,b;const g=E=>(s+(c?a-E:E))%o,k=()=>{m!==x&&(e.lineTo(u,x),e.lineTo(u,m),e.lineTo(u,b))};for(l&&(h=i[g(0)],e.moveTo(h.x,h.y)),f=0;f<=a;++f){if(h=i[g(f)],h.skip)continue;const E=h.x,C=h.y,S=E|0;S===v?(C<m?m=C:C>x&&(x=C),u=(d*u+E)/++d):(k(),e.lineTo(E,C),v=S,d=0,m=x=C),b=C}k()}function Sm(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?kF:_F}function SF(e){return e.stepped?_I:e.tension||e.cubicInterpolationMode==="monotone"?kI:Eo}function EF(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),J1(e,t.options),e.stroke(i)}function OF(e,t,n,r){const{segments:i,options:o}=t,s=Sm(t);for(const a of i)J1(e,o,a.style),e.beginPath(),s(e,t,a,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const CF=typeof Path2D=="function";function jF(e,t,n,r){CF&&!t.options.segment?EF(e,t,n,r):OF(e,t,n,r)}class Ni extends Ar{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const i=r.spanGaps?this._loop:this._fullLoop;pI(this._points,r,t,i,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=RI(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,r=t.length;return r&&n[t[r-1].end]}interpolate(t,n){const r=this.options,i=t[n],o=this.points,s=I1(this,{property:n,start:i,end:i});if(!s.length)return;const a=[],l=SF(r);let c,u;for(c=0,u=s.length;c<u;++c){const{start:d,end:f}=s[c],h=o[d],v=o[f];if(h===v){a.push(h);continue}const m=Math.abs((i-h[n])/(v[n]-h[n])),x=l(h,v,m,r.stepped);x[n]=t[n],a.push(x)}return a.length===1?a[0]:a}pathSegment(t,n,r){return Sm(this)(t,this,n,r)}path(t,n,r){const i=this.segments,o=Sm(this);let s=this._loop;n=n||0,r=r||this.points.length-n;for(const a of i)s&=o(t,this,a,{start:n,end:n+r-1});return!!s}draw(t,n,r,i){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),jF(t,this,r,i),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}Z(Ni,"id","line"),Z(Ni,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),Z(Ni,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),Z(Ni,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function Rw(e,t,n,r){const i=e.options,{[n]:o}=e.getProps([n],r);return Math.abs(t-o)<i.radius+i.hitRadius}class Du extends Ar{constructor(n){super();Z(this,"parsed");Z(this,"skip");Z(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,r,i){const o=this.options,{x:s,y:a}=this.getProps(["x","y"],i);return Math.pow(n-s,2)+Math.pow(r-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(n,r){return Rw(this,n,"x",r)}inYRange(n,r){return Rw(this,n,"y",r)}getCenterPoint(n){const{x:r,y:i}=this.getProps(["x","y"],n);return{x:r,y:i}}size(n){n=n||this.options||{};let r=n.radius||0;r=Math.max(r,r&&n.hoverRadius||0);const i=r&&n.borderWidth||0;return(r+i)*2}draw(n,r){const i=this.options;this.skip||i.radius<.1||!ai(this,r,this.size(i)/2)||(n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.fillStyle=i.backgroundColor,xm(n,i,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}Z(Du,"id","point"),Z(Du,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),Z(Du,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Q1(e,t){const{x:n,y:r,base:i,width:o,height:s}=e.getProps(["x","y","base","width","height"],t);let a,l,c,u,d;return e.horizontal?(d=s/2,a=Math.min(n,i),l=Math.max(n,i),c=r-d,u=r+d):(d=o/2,a=n-d,l=n+d,c=Math.min(r,i),u=Math.max(r,i)),{left:a,top:c,right:l,bottom:u}}function zi(e,t,n,r){return e?0:Zt(t,n,r)}function RF(e,t,n){const r=e.options.borderWidth,i=e.borderSkipped,o=E1(r);return{t:zi(i.top,o.top,0,n),r:zi(i.right,o.right,0,t),b:zi(i.bottom,o.bottom,0,n),l:zi(i.left,o.left,0,t)}}function LF(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),i=e.options.borderRadius,o=Fo(i),s=Math.min(t,n),a=e.borderSkipped,l=r||He(i);return{topLeft:zi(!l||a.top||a.left,o.topLeft,0,s),topRight:zi(!l||a.top||a.right,o.topRight,0,s),bottomLeft:zi(!l||a.bottom||a.left,o.bottomLeft,0,s),bottomRight:zi(!l||a.bottom||a.right,o.bottomRight,0,s)}}function AF(e){const t=Q1(e),n=t.right-t.left,r=t.bottom-t.top,i=RF(e,n/2,r/2),o=LF(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:o},inner:{x:t.left+i.l,y:t.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,o.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(i.b,i.r))}}}}function Vh(e,t,n,r){const i=t===null,o=n===null,a=e&&!(i&&o)&&Q1(e,r);return a&&(i||oi(t,a.left,a.right))&&(o||oi(n,a.top,a.bottom))}function PF(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function MF(e,t){e.rect(t.x,t.y,t.w,t.h)}function qh(e,t,n={}){const r=e.x!==n.x?-t:0,i=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-r,s=(e.y+e.h!==n.y+n.h?t:0)-i;return{x:e.x+r,y:e.y+i,w:e.w+o,h:e.h+s,radius:e.radius}}class Iu extends Ar{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:r,backgroundColor:i}}=this,{inner:o,outer:s}=AF(this),a=PF(s.radius)?Wl:MF;t.save(),(s.w!==o.w||s.h!==o.h)&&(t.beginPath(),a(t,qh(s,n,o)),t.clip(),a(t,qh(o,-n,s)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),a(t,qh(o,n)),t.fillStyle=i,t.fill(),t.restore()}inRange(t,n,r){return Vh(this,t,n,r)}inXRange(t,n){return Vh(this,t,null,n)}inYRange(t,n){return Vh(this,null,t,n)}getCenterPoint(t){const{x:n,y:r,base:i,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+i)/2:n,y:o?r:(r+i)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}Z(Iu,"id","bar"),Z(Iu,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),Z(Iu,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var TF=Object.freeze({__proto__:null,ArcElement:$a,BarElement:Iu,LineElement:Ni,PointElement:Du});const Em=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Lw=Em.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function Z1(e){return Em[e%Em.length]}function eE(e){return Lw[e%Lw.length]}function DF(e,t){return e.borderColor=Z1(t),e.backgroundColor=eE(t),++t}function IF(e,t){return e.backgroundColor=e.data.map(()=>Z1(t++)),t}function FF(e,t){return e.backgroundColor=e.data.map(()=>eE(t++)),t}function NF(e){let t=0;return(n,r)=>{const i=e.getDatasetMeta(r).controller;i instanceof Ao?t=IF(n,t):i instanceof dl?t=FF(n,t):i&&(t=DF(n,t))}}function Aw(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function zF(e){return e&&(e.borderColor||e.backgroundColor)}function BF(){return _t.borderColor!=="rgba(0,0,0,0.1)"||_t.backgroundColor!=="rgba(0,0,0,0.1)"}var UF={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;const{data:{datasets:r},options:i}=e.config,{elements:o}=i,s=Aw(r)||zF(i)||o&&Aw(o)||BF();if(!n.forceOverride&&s)return;const a=NF(e);r.forEach(a)}};function HF(e,t,n,r,i){const o=i.samples||r;if(o>=n)return e.slice(t,t+n);const s=[],a=(n-2)/(o-2);let l=0;const c=t+n-1;let u=t,d,f,h,v,m;for(s[l++]=e[u],d=0;d<o-2;d++){let x=0,b=0,g;const k=Math.floor((d+1)*a)+1+t,E=Math.min(Math.floor((d+2)*a)+1,n)+t,C=E-k;for(g=k;g<E;g++)x+=e[g].x,b+=e[g].y;x/=C,b/=C;const S=Math.floor(d*a)+1+t,M=Math.min(Math.floor((d+1)*a)+1,n)+t,{x:L,y:T}=e[u];for(h=v=-1,g=S;g<M;g++)v=.5*Math.abs((L-x)*(e[g].y-T)-(L-e[g].x)*(b-T)),v>h&&(h=v,f=e[g],m=g);s[l++]=f,u=m}return s[l++]=e[c],s}function WF(e,t,n,r){let i=0,o=0,s,a,l,c,u,d,f,h,v,m;const x=[],b=t+n-1,g=e[t].x,E=e[b].x-g;for(s=t;s<t+n;++s){a=e[s],l=(a.x-g)/E*r,c=a.y;const C=l|0;if(C===u)c<v?(v=c,d=s):c>m&&(m=c,f=s),i=(o*i+a.x)/++o;else{const S=s-1;if(!Ne(d)&&!Ne(f)){const M=Math.min(d,f),L=Math.max(d,f);M!==h&&M!==S&&x.push({...e[M],x:i}),L!==h&&L!==S&&x.push({...e[L],x:i})}s>0&&S!==h&&x.push(e[S]),x.push(a),u=C,o=0,v=m=c,d=f=h=s}}return x}function tE(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Pw(e){e.data.datasets.forEach(t=>{tE(t)})}function VF(e,t){const n=t.length;let r=0,i;const{iScale:o}=e,{min:s,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(r=Zt(si(t,o.axis,s).lo,0,n-1)),c?i=Zt(si(t,o.axis,a).hi+1,r,n)-r:i=n-r,{start:r,count:i}}var qF={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){Pw(e);return}const r=e.width;e.data.datasets.forEach((i,o)=>{const{_data:s,indexAxis:a}=i,l=e.getDatasetMeta(o),c=s||i.data;if(Va([a,e.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const u=e.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||e.options.parsing)return;let{start:d,count:f}=VF(l,c);const h=n.threshold||4*r;if(f<=h){tE(i);return}Ne(s)&&(i._data=c,delete i.data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(m){this._data=m}}));let v;switch(n.algorithm){case"lttb":v=HF(c,d,f,r,n);break;case"min-max":v=WF(c,d,f,r);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}i._decimated=v})},destroy(e){Pw(e)}};function $F(e,t,n){const r=e.segments,i=e.points,o=t.points,s=[];for(const a of r){let{start:l,end:c}=a;c=vf(l,c,i);const u=Om(n,i[l],i[c],a.loop);if(!t.segments){s.push({source:a,target:u,start:i[l],end:i[c]});continue}const d=I1(t,u);for(const f of d){const h=Om(n,o[f.start],o[f.end],f.loop),v=D1(a,i,h);for(const m of v)s.push({source:m,target:f,start:{[n]:Mw(u,h,"start",Math.max)},end:{[n]:Mw(u,h,"end",Math.min)}})}}return s}function Om(e,t,n,r){if(r)return;let i=t[e],o=n[e];return e==="angle"&&(i=vn(i),o=vn(o)),{property:e,start:i,end:o}}function KF(e,t){const{x:n=null,y:r=null}=e||{},i=t.points,o=[];return t.segments.forEach(({start:s,end:a})=>{a=vf(s,a,i);const l=i[s],c=i[a];r!==null?(o.push({x:l.x,y:r}),o.push({x:c.x,y:r})):n!==null&&(o.push({x:n,y:l.y}),o.push({x:n,y:c.y}))}),o}function vf(e,t,n){for(;t>e;t--){const r=n[t];if(!isNaN(r.x)&&!isNaN(r.y))break}return t}function Mw(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function nE(e,t){let n=[],r=!1;return wt(e)?(r=!0,n=e):n=KF(e,t),n.length?new Ni({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function Tw(e){return e&&e.fill!==!1}function YF(e,t,n){let i=e[t].fill;const o=[t];let s;if(!n)return i;for(;i!==!1&&o.indexOf(i)===-1;){if(!It(i))return i;if(s=e[i],!s)return!1;if(s.visible)return i;o.push(i),i=s.fill}return!1}function GF(e,t,n){const r=ZF(e);if(He(r))return isNaN(r.value)?!1:r;let i=parseFloat(r);return It(i)&&Math.floor(i)===i?JF(r[0],t,i,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function JF(e,t,n,r){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=r?!1:n}function XF(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:He(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function QF(e,t,n){let r;return e==="start"?r=n:e==="end"?r=t.options.reverse?t.min:t.max:He(e)?r=e.value:r=t.getBaseValue(),r}function ZF(e){const t=e.options,n=t.fill;let r=Le(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function eN(e){const{scale:t,index:n,line:r}=e,i=[],o=r.segments,s=r.points,a=tN(t,n);a.push(nE({x:null,y:t.bottom},r));for(let l=0;l<o.length;l++){const c=o[l];for(let u=c.start;u<=c.end;u++)nN(i,s[u],a)}return new Ni({points:i,options:{}})}function tN(e,t){const n=[],r=e.getMatchingVisibleMetas("line");for(let i=0;i<r.length;i++){const o=r[i];if(o.index===t)break;o.hidden||n.unshift(o.dataset)}return n}function nN(e,t,n){const r=[];for(let i=0;i<n.length;i++){const o=n[i],{first:s,last:a,point:l}=rN(o,t,"x");if(!(!l||s&&a)){if(s)r.unshift(l);else if(e.push(l),!a)break}}e.push(...r)}function rN(e,t,n){const r=e.interpolate(t,n);if(!r)return{};const i=r[n],o=e.segments,s=e.points;let a=!1,l=!1;for(let c=0;c<o.length;c++){const u=o[c],d=s[u.start][n],f=s[u.end][n];if(oi(i,d,f)){a=i===d,l=i===f;break}}return{first:a,last:l,point:r}}class rE{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,r){const{x:i,y:o,radius:s}=this;return n=n||{start:0,end:yt},t.arc(i,o,s,n.end,n.start,!0),!r.bounds}interpolate(t){const{x:n,y:r,radius:i}=this,o=t.angle;return{x:n+Math.cos(o)*i,y:r+Math.sin(o)*i,angle:o}}}function iN(e){const{chart:t,fill:n,line:r}=e;if(It(n))return oN(t,n);if(n==="stack")return eN(e);if(n==="shape")return!0;const i=sN(e);return i instanceof rE?i:nE(i,r)}function oN(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function sN(e){return(e.scale||{}).getPointPositionForValue?lN(e):aN(e)}function aN(e){const{scale:t={},fill:n}=e,r=XF(n,t);if(It(r)){const i=t.isHorizontal();return{x:i?r:null,y:i?null:r}}return null}function lN(e){const{scale:t,fill:n}=e,r=t.options,i=t.getLabels().length,o=r.reverse?t.max:t.min,s=QF(n,t,o),a=[];if(r.grid.circular){const l=t.getPointPositionForValue(0,o);return new rE({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(s)})}for(let l=0;l<i;++l)a.push(t.getPointPositionForValue(l,s));return a}function $h(e,t,n){const r=iN(t),{chart:i,index:o,line:s,scale:a,axis:l}=t,c=s.options,u=c.fill,d=c.backgroundColor,{above:f=d,below:h=d}=u||{},v=i.getDatasetMeta(o),m=F1(i,v);r&&s.points.length&&(hf(e,n),cN(e,{line:s,target:r,above:f,below:h,area:n,scale:a,axis:l,clip:m}),pf(e))}function cN(e,t){const{line:n,target:r,above:i,below:o,area:s,scale:a,clip:l}=t,c=n._loop?"angle":t.axis;e.save();let u=o;o!==i&&(c==="x"?(Dw(e,r,s.top),Kh(e,{line:n,target:r,color:i,scale:a,property:c,clip:l}),e.restore(),e.save(),Dw(e,r,s.bottom)):c==="y"&&(Iw(e,r,s.left),Kh(e,{line:n,target:r,color:o,scale:a,property:c,clip:l}),e.restore(),e.save(),Iw(e,r,s.right),u=i)),Kh(e,{line:n,target:r,color:u,scale:a,property:c,clip:l}),e.restore()}function Dw(e,t,n){const{segments:r,points:i}=t;let o=!0,s=!1;e.beginPath();for(const a of r){const{start:l,end:c}=a,u=i[l],d=i[vf(l,c,i)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(u.x,n),e.lineTo(u.x,u.y)),s=!!t.pathSegment(e,a,{move:s}),s?e.closePath():e.lineTo(d.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function Iw(e,t,n){const{segments:r,points:i}=t;let o=!0,s=!1;e.beginPath();for(const a of r){const{start:l,end:c}=a,u=i[l],d=i[vf(l,c,i)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(n,u.y),e.lineTo(u.x,u.y)),s=!!t.pathSegment(e,a,{move:s}),s?e.closePath():e.lineTo(n,d.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function Kh(e,t){const{line:n,target:r,property:i,color:o,scale:s,clip:a}=t,l=$F(n,r,i);for(const{source:c,target:u,start:d,end:f}of l){const{style:{backgroundColor:h=o}={}}=c,v=r!==!0;e.save(),e.fillStyle=h,uN(e,s,a,v&&Om(i,d,f)),e.beginPath();const m=!!n.pathSegment(e,c);let x;if(v){m?e.closePath():Fw(e,r,f,i);const b=!!r.pathSegment(e,u,{move:m,reverse:!0});x=m&&b,x||Fw(e,r,d,i)}e.closePath(),e.fill(x?"evenodd":"nonzero"),e.restore()}}function uN(e,t,n,r){const i=t.chart.chartArea,{property:o,start:s,end:a}=r||{};if(o==="x"||o==="y"){let l,c,u,d;o==="x"?(l=s,c=i.top,u=a,d=i.bottom):(l=i.left,c=s,u=i.right,d=a),e.beginPath(),n&&(l=Math.max(l,n.left),u=Math.min(u,n.right),c=Math.max(c,n.top),d=Math.min(d,n.bottom)),e.rect(l,c,u-l,d-c),e.clip()}}function Fw(e,t,n,r){const i=t.interpolate(n,r);i&&e.lineTo(i.x,i.y)}var dN={id:"filler",afterDatasetsUpdate(e,t,n){const r=(e.data.datasets||[]).length,i=[];let o,s,a,l;for(s=0;s<r;++s)o=e.getDatasetMeta(s),a=o.dataset,l=null,a&&a.options&&a instanceof Ni&&(l={visible:e.isDatasetVisible(s),index:s,fill:GF(a,s,r),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,i.push(l);for(s=0;s<r;++s)l=i[s],!(!l||l.fill===!1)&&(l.fill=YF(i,s,n.propagate))},beforeDraw(e,t,n){const r=n.drawTime==="beforeDraw",i=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let s=i.length-1;s>=0;--s){const a=i[s].$filler;a&&(a.line.updateControlPoints(o,a.axis),r&&a.fill&&$h(e.ctx,a,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const r=e.getSortedVisibleDatasetMetas();for(let i=r.length-1;i>=0;--i){const o=r[i].$filler;Tw(o)&&$h(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const r=t.meta.$filler;!Tw(r)||n.drawTime!=="beforeDatasetDraw"||$h(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Nw=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},fN=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class zw extends Ar{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=dt(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,i)=>t.sort(r,i,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,i=Gt(r.font),o=i.size,s=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Nw(r,o);let c,u;n.font=i.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(s,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(s,i,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,i){const{ctx:o,maxWidth:s,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=i+a;let d=t;o.textAlign="left",o.textBaseline="middle";let f=-1,h=-u;return this.legendItems.forEach((v,m)=>{const x=r+n/2+o.measureText(v.text).width;(m===0||c[c.length-1]+x+2*a>s)&&(d+=u,c[c.length-(m>0?0:1)]=0,h+=u,f++),l[m]={left:0,top:h,row:f,width:x,height:i},c[c.length-1]+=x+a}),d}_fitCols(t,n,r,i){const{ctx:o,maxHeight:s,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=s-t;let d=a,f=0,h=0,v=0,m=0;return this.legendItems.forEach((x,b)=>{const{itemWidth:g,itemHeight:k}=hN(r,n,o,x,i);b>0&&h+k+2*a>u&&(d+=f+a,c.push({width:f,height:h}),v+=f+a,m++,f=h=0),l[b]={left:v,top:h,col:m,width:g,height:k},f=Math.max(f,g),h+=k+a}),d+=f,c.push({width:f,height:h}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:i},rtl:o}}=this,s=Vs(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=pn(r,this.left+i,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=pn(r,this.left+i,this.right-this.lineWidths[a])),c.top+=this.top+t+i,c.left=s.leftForLtr(s.x(l),c.width),l+=c.width+i}else{let a=0,l=pn(r,this.top+t+i,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=pn(r,this.top+t+i,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+i,c.left=s.leftForLtr(s.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;hf(t,this),this._draw(),pf(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:i}=this,{align:o,labels:s}=t,a=_t.color,l=Vs(t.rtl,this.left,this.width),c=Gt(s.font),{padding:u}=s,d=c.size,f=d/2;let h;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;const{boxWidth:v,boxHeight:m,itemHeight:x}=Nw(s,d),b=function(S,M,L){if(isNaN(v)||v<=0||isNaN(m)||m<0)return;i.save();const T=Le(L.lineWidth,1);if(i.fillStyle=Le(L.fillStyle,a),i.lineCap=Le(L.lineCap,"butt"),i.lineDashOffset=Le(L.lineDashOffset,0),i.lineJoin=Le(L.lineJoin,"miter"),i.lineWidth=T,i.strokeStyle=Le(L.strokeStyle,a),i.setLineDash(Le(L.lineDash,[])),s.usePointStyle){const V={radius:m*Math.SQRT2/2,pointStyle:L.pointStyle,rotation:L.rotation,borderWidth:T},G=l.xPlus(S,v/2),N=M+f;S1(i,V,G,N,s.pointStyleWidth&&v)}else{const V=M+Math.max((d-m)/2,0),G=l.leftForLtr(S,v),N=Fo(L.borderRadius);i.beginPath(),Object.values(N).some(te=>te!==0)?Wl(i,{x:G,y:V,w:v,h:m,radius:N}):i.rect(G,V,v,m),i.fill(),T!==0&&i.stroke()}i.restore()},g=function(S,M,L){Go(i,L.text,S,M+x/2,c,{strikethrough:L.hidden,textAlign:l.textAlign(L.textAlign)})},k=this.isHorizontal(),E=this._computeTitleHeight();k?h={x:pn(o,this.left+u,this.right-r[0]),y:this.top+u+E,line:0}:h={x:this.left+u,y:pn(o,this.top+E+u,this.bottom-n[0].height),line:0},P1(this.ctx,t.textDirection);const C=x+u;this.legendItems.forEach((S,M)=>{i.strokeStyle=S.fontColor,i.fillStyle=S.fontColor;const L=i.measureText(S.text).width,T=l.textAlign(S.textAlign||(S.textAlign=s.textAlign)),V=v+f+L;let G=h.x,N=h.y;l.setWidth(this.width),k?M>0&&G+V+u>this.right&&(N=h.y+=C,h.line++,G=h.x=pn(o,this.left+u,this.right-r[h.line])):M>0&&N+C>this.bottom&&(G=h.x=G+n[h.line].width+u,h.line++,N=h.y=pn(o,this.top+E+u,this.bottom-n[h.line].height));const te=l.x(G);if(b(te,N,S),G=PD(T,G+v+f,k?G+V:this.right,t.rtl),g(l.x(G),N,S),k)h.x+=V+u;else if(typeof S.text!="string"){const W=c.lineHeight;h.y+=iE(S,W)+u}else h.y+=C}),M1(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=Gt(n.font),i=wn(n.padding);if(!n.display)return;const o=Vs(t.rtl,this.left,this.width),s=this.ctx,a=n.position,l=r.size/2,c=i.top+l;let u,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),u=this.top+c,d=pn(t.align,d,this.right-f);else{const v=this.columnSizes.reduce((m,x)=>Math.max(m,x.height),0);u=c+pn(t.align,this.top,this.bottom-v-t.labels.padding-this._computeTitleHeight())}const h=pn(a,d,d+f);s.textAlign=o.textAlign(sv(a)),s.textBaseline="middle",s.strokeStyle=n.color,s.fillStyle=n.color,s.font=r.string,Go(s,n.text,h,u,r)}_computeTitleHeight(){const t=this.options.title,n=Gt(t.font),r=wn(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,i,o;if(oi(t,this.left,this.right)&&oi(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;r<o.length;++r)if(i=o[r],oi(t,i.left,i.left+i.width)&&oi(n,i.top,i.top+i.height))return this.legendItems[r]}return null}handleEvent(t){const n=this.options;if(!gN(t.type,n))return;const r=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const i=this._hoveredItem,o=fN(i,r);i&&!o&&dt(n.onLeave,[t,i,this],this),this._hoveredItem=r,r&&!o&&dt(n.onHover,[t,r,this],this)}else r&&dt(n.onClick,[t,r,this],this)}}function hN(e,t,n,r,i){const o=pN(r,e,t,n),s=mN(i,r,t.lineHeight);return{itemWidth:o,itemHeight:s}}function pN(e,t,n,r){let i=e.text;return i&&typeof i!="string"&&(i=i.reduce((o,s)=>o.length>s.length?o:s)),t+n.size/2+r.measureText(i).width}function mN(e,t,n){let r=e;return typeof t.text!="string"&&(r=iE(t,n)),r}function iE(e,t){const n=e.text?e.text.length:0;return t*n}function gN(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var vN={id:"legend",_element:zw,start(e,t,n){const r=e.legend=new zw({ctx:e.ctx,options:n,chart:e});bn.configure(e,r,n),bn.addBox(e,r)},stop(e){bn.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;bn.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:o,useBorderRadius:s,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=wn(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:s&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class mv extends Ar{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const i=wt(r.text)?r.text.length:1;this._padding=wn(r.padding);const o=i*Gt(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:r,bottom:i,right:o,options:s}=this,a=s.align;let l=0,c,u,d;return this.isHorizontal()?(u=pn(a,r,o),d=n+t,c=o-r):(s.position==="left"?(u=r+t,d=pn(a,i,n),l=Ye*-.5):(u=o-t,d=pn(a,n,i),l=Ye*.5),c=i-n),{titleX:u,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const r=Gt(n.font),o=r.lineHeight/2+this._padding.top,{titleX:s,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);Go(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:sv(n.align),textBaseline:"middle",translation:[s,a]})}}function yN(e,t){const n=new mv({ctx:e.ctx,options:t,chart:e});bn.configure(e,n,t),bn.addBox(e,n),e.titleBlock=n}var bN={id:"title",_element:mv,start(e,t,n){yN(e,n)},stop(e){const t=e.titleBlock;bn.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;bn.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ru=new WeakMap;var xN={id:"subtitle",start(e,t,n){const r=new mv({ctx:e.ctx,options:n,chart:e});bn.configure(e,r,n),bn.addBox(e,r),ru.set(e,r)},stop(e){bn.removeBox(e,ru.get(e)),ru.delete(e)},beforeUpdate(e,t,n){const r=ru.get(e);bn.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ka={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();r.add(l.x),i+=l.y,++o}}return o===0||r.size===0?!1:{x:[...r].reduce((a,l)=>a+l)/r.size,y:i/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=Number.POSITIVE_INFINITY,o,s,a;for(o=0,s=e.length;o<s;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=ym(t,c);u<i&&(i=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,r=l.y}return{x:n,y:r}}};function Fr(e,t){return t&&(wt(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Xr(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
|
|
154
|
-
`)>-1?e.split(`
|
|
155
|
-
`):e}function wN(e,t){const{element:n,datasetIndex:r,index:i}=t,o=e.getDatasetMeta(r).controller,{label:s,value:a}=o.getLabelAndValue(i);return{chart:e,label:s,parsed:o.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:a,dataset:o.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function Bw(e,t){const n=e.chart.ctx,{body:r,footer:i,title:o}=e,{boxWidth:s,boxHeight:a}=t,l=Gt(t.bodyFont),c=Gt(t.titleFont),u=Gt(t.footerFont),d=o.length,f=i.length,h=r.length,v=wn(t.padding);let m=v.height,x=0,b=r.reduce((E,C)=>E+C.before.length+C.lines.length+C.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const E=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=h*E+(b-h)*l.lineHeight+(b-1)*t.bodySpacing}f&&(m+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let g=0;const k=function(E){x=Math.max(x,n.measureText(E).width+g)};return n.save(),n.font=c.string,tt(e.title,k),n.font=l.string,tt(e.beforeBody.concat(e.afterBody),k),g=t.displayColors?s+2+t.boxPadding:0,tt(r,E=>{tt(E.before,k),tt(E.lines,k),tt(E.after,k)}),g=0,n.font=u.string,tt(e.footer,k),n.restore(),x+=v.width,{width:x,height:m}}function _N(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function kN(e,t,n,r){const{x:i,width:o}=r,s=n.caretSize+n.caretPadding;if(e==="left"&&i+o+s>t.width||e==="right"&&i-o-s<0)return!0}function SN(e,t,n,r){const{x:i,width:o}=n,{width:s,chartArea:{left:a,right:l}}=e;let c="center";return r==="center"?c=i<=(a+l)/2?"left":"right":i<=o/2?c="left":i>=s-o/2&&(c="right"),kN(c,e,t,n)&&(c="center"),c}function Uw(e,t,n){const r=n.yAlign||t.yAlign||_N(e,n);return{xAlign:n.xAlign||t.xAlign||SN(e,t,n,r),yAlign:r}}function EN(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function ON(e,t,n){let{y:r,height:i}=e;return t==="top"?r+=n:t==="bottom"?r-=i+n:r-=i/2,r}function Hw(e,t,n,r){const{caretSize:i,caretPadding:o,cornerRadius:s}=e,{xAlign:a,yAlign:l}=n,c=i+o,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:h}=Fo(s);let v=EN(t,a);const m=ON(t,l,c);return l==="center"?a==="left"?v+=c:a==="right"&&(v-=c):a==="left"?v-=Math.max(u,f)+i:a==="right"&&(v+=Math.max(d,h)+i),{x:Zt(v,0,r.width-t.width),y:Zt(m,0,r.height-t.height)}}function iu(e,t,n){const r=wn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function Ww(e){return Fr([],Xr(e))}function CN(e,t,n){return ao(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Vw(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const oE={beforeTitle:Gr,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:Gr,beforeBody:Gr,beforeLabel:Gr,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return Ne(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Gr,afterBody:Gr,beforeFooter:Gr,footer:Gr,afterFooter:Gr};function In(e,t,n,r){const i=e[t].call(n,r);return typeof i>"u"?oE[t].call(n,r):i}class Cm extends Ar{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,o=new N1(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=CN(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,i=In(r,"beforeTitle",this,t),o=In(r,"title",this,t),s=In(r,"afterTitle",this,t);let a=[];return a=Fr(a,Xr(i)),a=Fr(a,Xr(o)),a=Fr(a,Xr(s)),a}getBeforeBody(t,n){return Ww(In(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,i=[];return tt(t,o=>{const s={before:[],lines:[],after:[]},a=Vw(r,o);Fr(s.before,Xr(In(a,"beforeLabel",this,o))),Fr(s.lines,In(a,"label",this,o)),Fr(s.after,Xr(In(a,"afterLabel",this,o))),i.push(s)}),i}getAfterBody(t,n){return Ww(In(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,i=In(r,"beforeFooter",this,t),o=In(r,"footer",this,t),s=In(r,"afterFooter",this,t);let a=[];return a=Fr(a,Xr(i)),a=Fr(a,Xr(o)),a=Fr(a,Xr(s)),a}_createItems(t){const n=this._active,r=this.chart.data,i=[],o=[],s=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(wN(this.chart,n[l]));return t.filter&&(a=a.filter((u,d,f)=>t.filter(u,d,f,r))),t.itemSort&&(a=a.sort((u,d)=>t.itemSort(u,d,r))),tt(a,u=>{const d=Vw(t.callbacks,u);i.push(In(d,"labelColor",this,u)),o.push(In(d,"labelPointStyle",this,u)),s.push(In(d,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=s,this.dataPoints=a,a}update(t,n){const r=this.options.setContext(this.getContext()),i=this._active;let o,s=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{const a=Ka[r.position].call(this,i,this._eventPosition);s=this._createItems(r),this.title=this.getTitle(s,r),this.beforeBody=this.getBeforeBody(s,r),this.body=this.getBody(s,r),this.afterBody=this.getAfterBody(s,r),this.footer=this.getFooter(s,r);const l=this._size=Bw(this,r),c=Object.assign({},a,l),u=Uw(this.chart,r,c),d=Hw(r,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=s,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,i){const o=this.getCaretPosition(t,r,i);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:i,yAlign:o}=this,{caretSize:s,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=Fo(a),{x:f,y:h}=t,{width:v,height:m}=n;let x,b,g,k,E,C;return o==="center"?(E=h+m/2,i==="left"?(x=f,b=x-s,k=E+s,C=E-s):(x=f+v,b=x+s,k=E-s,C=E+s),g=x):(i==="left"?b=f+Math.max(l,u)+s:i==="right"?b=f+v-Math.max(c,d)-s:b=this.caretX,o==="top"?(k=h,E=k-s,x=b-s,g=b+s):(k=h+m,E=k+s,x=b+s,g=b-s),C=k),{x1:x,x2:b,x3:g,y1:k,y2:E,y3:C}}drawTitle(t,n,r){const i=this.title,o=i.length;let s,a,l;if(o){const c=Vs(r.rtl,this.x,this.width);for(t.x=iu(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",s=Gt(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=s.string,l=0;l<o;++l)n.fillText(i[l],c.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+a,l+1===o&&(t.y+=r.titleMarginBottom-a)}}_drawColorBox(t,n,r,i,o){const s=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:l,boxWidth:c}=o,u=Gt(o.bodyFont),d=iu(this,"left",o),f=i.x(d),h=l<u.lineHeight?(u.lineHeight-l)/2:0,v=n.y+h;if(o.usePointStyle){const m={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},x=i.leftForLtr(f,c)+c/2,b=v+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,xm(t,m,x,b),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,xm(t,m,x,b)}else{t.lineWidth=He(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const m=i.leftForLtr(f,c),x=i.leftForLtr(i.xPlus(f,1),c-2),b=Fo(s.borderRadius);Object.values(b).some(g=>g!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Wl(t,{x:m,y:v,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Wl(t,{x,y:v+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,v,c,l),t.strokeRect(m,v,c,l),t.fillStyle=s.backgroundColor,t.fillRect(x,v+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:i}=this,{bodySpacing:o,bodyAlign:s,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=r,d=Gt(r.bodyFont);let f=d.lineHeight,h=0;const v=Vs(r.rtl,this.x,this.width),m=function(L){n.fillText(L,v.x(t.x+h),t.y+f/2),t.y+=f+o},x=v.textAlign(s);let b,g,k,E,C,S,M;for(n.textAlign=s,n.textBaseline="middle",n.font=d.string,t.x=iu(this,x,r),n.fillStyle=r.bodyColor,tt(this.beforeBody,m),h=a&&x!=="right"?s==="center"?c/2+u:c+2+u:0,E=0,S=i.length;E<S;++E){for(b=i[E],g=this.labelTextColors[E],n.fillStyle=g,tt(b.before,m),k=b.lines,a&&k.length&&(this._drawColorBox(n,t,E,v,r),f=Math.max(d.lineHeight,l)),C=0,M=k.length;C<M;++C)m(k[C]),f=d.lineHeight;tt(b.after,m)}h=0,f=d.lineHeight,tt(this.afterBody,m),t.y-=o}drawFooter(t,n,r){const i=this.footer,o=i.length;let s,a;if(o){const l=Vs(r.rtl,this.x,this.width);for(t.x=iu(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",s=Gt(r.footerFont),n.fillStyle=r.footerColor,n.font=s.string,a=0;a<o;++a)n.fillText(i[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r.footerSpacing}}drawBackground(t,n,r,i){const{xAlign:o,yAlign:s}=this,{x:a,y:l}=t,{width:c,height:u}=r,{topLeft:d,topRight:f,bottomLeft:h,bottomRight:v}=Fo(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(a+d,l),s==="top"&&this.drawCaret(t,n,r,i),n.lineTo(a+c-f,l),n.quadraticCurveTo(a+c,l,a+c,l+f),s==="center"&&o==="right"&&this.drawCaret(t,n,r,i),n.lineTo(a+c,l+u-v),n.quadraticCurveTo(a+c,l+u,a+c-v,l+u),s==="bottom"&&this.drawCaret(t,n,r,i),n.lineTo(a+h,l+u),n.quadraticCurveTo(a,l+u,a,l+u-h),s==="center"&&o==="left"&&this.drawCaret(t,n,r,i),n.lineTo(a,l+d),n.quadraticCurveTo(a,l,a+d,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,i=r&&r.x,o=r&&r.y;if(i||o){const s=Ka[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=Bw(this,t),l=Object.assign({},s,this._size),c=Uw(n,t,l),u=Hw(t,l,c,n);(i._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=s.x,this.caretY=s.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const s=wn(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,i,n),P1(t,n.textDirection),o.y+=s.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),M1(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,i=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!_d(r,i),s=this._positionChanged(i,n);(o||s)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,o=this._active||[],s=this._getActiveElements(t,o,n,r),a=this._positionChanged(s,t),l=n||!_d(s,o)||a;return l&&(this._active=s,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,i){const o=this.options;if(t.type==="mouseout")return[];if(!i)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const s=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&s.reverse(),s}_positionChanged(t,n){const{caretX:r,caretY:i,options:o}=this,s=Ka[o.position].call(this,t,n);return s!==!1&&(r!==s.x||i!==s.y)}}Z(Cm,"positioners",Ka);var jN={id:"tooltip",_element:Cm,positioners:Ka,afterInit(e,t,n){n&&(e.tooltip=new Cm({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:oE},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},RN=Object.freeze({__proto__:null,Colors:UF,Decimation:qF,Filler:dN,Legend:vN,SubTitle:xN,Title:bN,Tooltip:jN});const LN=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function AN(e,t,n,r){const i=e.indexOf(t);if(i===-1)return LN(e,t,n,r);const o=e.lastIndexOf(t);return i!==o?n:i}const PN=(e,t)=>e===null?null:Zt(Math.round(e),0,t);function qw(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class jm extends ts{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:i,label:o}of n)r[i]===o&&r.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(Ne(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:AN(r,t,Le(n,t),this._addedLabels),PN(n,r.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(r=0),n||(i=this.getLabels().length-1)),this.min=r,this.max=i}buildTicks(){const t=this.min,n=this.max,r=this.options.offset,i=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let s=t;s<=n;s++)i.push({value:s});return i}getLabelForValue(t){return qw.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}Z(jm,"id","category"),Z(jm,"defaults",{ticks:{callback:qw}});function MN(e,t){const n=[],{bounds:i,step:o,min:s,max:a,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:f}=e,h=o||1,v=u-1,{min:m,max:x}=t,b=!Ne(s),g=!Ne(a),k=!Ne(c),E=(x-m)/(d+1);let C=Bx((x-m)/v/h)*h,S,M,L,T;if(C<1e-14&&!b&&!g)return[{value:m},{value:x}];T=Math.ceil(x/C)-Math.floor(m/C),T>v&&(C=Bx(T*C/v/h)*h),Ne(l)||(S=Math.pow(10,l),C=Math.ceil(C*S)/S),i==="ticks"?(M=Math.floor(m/C)*C,L=Math.ceil(x/C)*C):(M=m,L=x),b&&g&&o&&ED((a-s)/o,C/1e3)?(T=Math.round(Math.min((a-s)/C,u)),C=(a-s)/T,M=s,L=a):k?(M=b?s:M,L=g?a:L,T=c-1,C=(L-M)/T):(T=(L-M)/C,ll(T,Math.round(T),C/1e3)?T=Math.round(T):T=Math.ceil(T));const V=Math.max(Ux(C),Ux(M));S=Math.pow(10,Ne(l)?V:l),M=Math.round(M*S)/S,L=Math.round(L*S)/S;let G=0;for(b&&(f&&M!==s?(n.push({value:s}),M<s&&G++,ll(Math.round((M+G*C)*S)/S,s,$w(s,E,e))&&G++):M<s&&G++);G<T;++G){const N=Math.round((M+G*C)*S)/S;if(g&&N>a)break;n.push({value:N})}return g&&f&&L!==a?n.length&&ll(n[n.length-1].value,a,$w(a,E,e))?n[n.length-1].value=a:n.push({value:a}):(!g||L===a)&&n.push({value:L}),n}function $w(e,t,{horizontal:n,minRotation:r}){const i=Er(r),o=(n?Math.sin(i):Math.cos(i))||.001,s=.75*t*(""+e).length;return Math.min(t/o,s)}class Rd extends ts{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return Ne(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:o}=this;const s=l=>i=n?i:l,a=l=>o=r?o:l;if(t){const l=Vr(i),c=Vr(o);l<0&&c<0?a(0):l>0&&c>0&&s(0)}if(i===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||s(i-l)}this.min=i,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,i;return r?(i=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,s=MN(i,o);return t.bounds==="ticks"&&m1(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const i=(r-n)/Math.max(t.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return oc(t,this.chart.options.locale,this.options.ticks.format)}}class Rm extends Rd{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=It(t)?t:0,this.max=It(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=Er(this.options.ticks.minRotation),i=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/i))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Z(Rm,"id","linear"),Z(Rm,"defaults",{ticks:{callback:ff.formatters.numeric}});const ql=e=>Math.floor(Ii(e)),wo=(e,t)=>Math.pow(10,ql(e)+t);function Kw(e){return e/Math.pow(10,ql(e))===1}function Yw(e,t,n){const r=Math.pow(10,n),i=Math.floor(e/r);return Math.ceil(t/r)-i}function TN(e,t){const n=t-e;let r=ql(n);for(;Yw(e,t,r)>10;)r++;for(;Yw(e,t,r)<10;)r--;return Math.min(r,ql(e))}function DN(e,{min:t,max:n}){t=Yn(e.min,t);const r=[],i=ql(t);let o=TN(t,n),s=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=i>o?Math.pow(10,i):0,c=Math.round((t-l)*s)/s,u=Math.floor((t-l)/a/10)*a*10;let d=Math.floor((c-u)/Math.pow(10,o)),f=Yn(e.min,Math.round((l+u+d*Math.pow(10,o))*s)/s);for(;f<n;)r.push({value:f,major:Kw(f),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,s=o>=0?1:s),f=Math.round((l+u+d*Math.pow(10,o))*s)/s;const h=Yn(e.max,f);return r.push({value:h,major:Kw(h),significand:d}),r}class Lm extends ts{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const r=Rd.prototype.parse.apply(this,[t,n]);if(r===0){this._zero=!0;return}return It(r)&&r>0?r:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=It(t)?Math.max(0,t):null,this.max=It(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!It(this._userMin)&&(this.min=t===wo(this.min,0)?wo(this.min,-1):wo(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let r=this.min,i=this.max;const o=a=>r=t?r:a,s=a=>i=n?i:a;r===i&&(r<=0?(o(1),s(10)):(o(wo(r,-1)),s(wo(i,1)))),r<=0&&o(wo(i,-1)),i<=0&&s(wo(r,1)),this.min=r,this.max=i}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},r=DN(n,this);return t.bounds==="ticks"&&m1(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}getLabelForValue(t){return t===void 0?"0":oc(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ii(t),this._valueRange=Ii(this.max)-Ii(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ii(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}Z(Lm,"id","logarithmic"),Z(Lm,"defaults",{ticks:{callback:ff.formatters.logarithmic,major:{enabled:!0}}});function Am(e){const t=e.ticks;if(t.display&&e.display){const n=wn(t.backdropPadding);return Le(t.font&&t.font.size,_t.font.size)+n.height}return 0}function IN(e,t,n){return n=wt(n)?n:[n],{w:HD(e,t.string,n),h:n.length*t.lineHeight}}function Gw(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:e<r||e>i?{start:t-n,end:t}:{start:t,end:t+n}}function FN(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],i=[],o=e._pointLabels.length,s=e.options.pointLabels,a=s.centerPointLabels?Ye/o:0;for(let l=0;l<o;l++){const c=s.setContext(e.getPointLabelContext(l));i[l]=c.padding;const u=e.getPointPosition(l,e.drawingArea+i[l],a),d=Gt(c.font),f=IN(e.ctx,d,e._pointLabels[l]);r[l]=f;const h=vn(e.getIndexAngle(l)+a),v=Math.round(iv(h)),m=Gw(v,u.x,f.w,0,180),x=Gw(v,u.y,f.h,90,270);NN(n,t,h,m,x)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=UN(e,r,i)}function NN(e,t,n,r,i){const o=Math.abs(Math.sin(n)),s=Math.abs(Math.cos(n));let a=0,l=0;r.start<t.l?(a=(t.l-r.start)/o,e.l=Math.min(e.l,t.l-a)):r.end>t.r&&(a=(r.end-t.r)/o,e.r=Math.max(e.r,t.r+a)),i.start<t.t?(l=(t.t-i.start)/s,e.t=Math.min(e.t,t.t-l)):i.end>t.b&&(l=(i.end-t.b)/s,e.b=Math.max(e.b,t.b+l))}function zN(e,t,n){const r=e.drawingArea,{extra:i,additionalAngle:o,padding:s,size:a}=n,l=e.getPointPosition(t,r+i+s,o),c=Math.round(iv(vn(l.angle+Bt))),u=VN(l.y,a.h,c),d=HN(c),f=WN(l.x,a.w,d);return{visible:!0,x:l.x,y:u,textAlign:d,left:f,top:u,right:f+a.w,bottom:u+a.h}}function BN(e,t){if(!t)return!0;const{left:n,top:r,right:i,bottom:o}=e;return!(ai({x:n,y:r},t)||ai({x:n,y:o},t)||ai({x:i,y:r},t)||ai({x:i,y:o},t))}function UN(e,t,n){const r=[],i=e._pointLabels.length,o=e.options,{centerPointLabels:s,display:a}=o.pointLabels,l={extra:Am(o)/2,additionalAngle:s?Ye/i:0};let c;for(let u=0;u<i;u++){l.padding=n[u],l.size=t[u];const d=zN(e,u,l);r.push(d),a==="auto"&&(d.visible=BN(d,c),d.visible&&(c=d))}return r}function HN(e){return e===0||e===180?"center":e<180?"left":"right"}function WN(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function VN(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function qN(e,t,n){const{left:r,top:i,right:o,bottom:s}=n,{backdropColor:a}=t;if(!Ne(a)){const l=Fo(t.borderRadius),c=wn(t.backdropPadding);e.fillStyle=a;const u=r-c.left,d=i-c.top,f=o-r+c.width,h=s-i+c.height;Object.values(l).some(v=>v!==0)?(e.beginPath(),Wl(e,{x:u,y:d,w:f,h,radius:l}),e.fill()):e.fillRect(u,d,f,h)}}function $N(e,t){const{ctx:n,options:{pointLabels:r}}=e;for(let i=t-1;i>=0;i--){const o=e._pointLabelItems[i];if(!o.visible)continue;const s=r.setContext(e.getPointLabelContext(i));qN(n,s,o);const a=Gt(s.font),{x:l,y:c,textAlign:u}=o;Go(n,e._pointLabels[i],l,c+a.lineHeight/2,a,{color:s.color,textAlign:u,textBaseline:"middle"})}}function sE(e,t,n,r){const{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,yt);else{let o=e.getPointPosition(0,t);i.moveTo(o.x,o.y);for(let s=1;s<r;s++)o=e.getPointPosition(s,t),i.lineTo(o.x,o.y)}}function KN(e,t,n,r,i){const o=e.ctx,s=t.circular,{color:a,lineWidth:l}=t;!s&&!r||!a||!l||n<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(i.dash||[]),o.lineDashOffset=i.dashOffset,o.beginPath(),sE(e,n,s,r),o.closePath(),o.stroke(),o.restore())}function YN(e,t,n){return ao(e,{label:n,index:t,type:"pointLabel"})}class Ya extends Rd{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=wn(Am(this.options)/2),n=this.width=this.maxWidth-t.width,r=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+r/2+t.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=It(t)&&!isNaN(t)?t:0,this.max=It(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Am(this.options))}generateTickLabels(t){Rd.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,r)=>{const i=dt(this.options.pointLabels.callback,[n,r],this);return i||i===0?i:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const t=this.options;t.display&&t.pointLabels.display?FN(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,r,i){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((r-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,r,i))}getIndexAngle(t){const n=yt/(this._pointLabels.length||1),r=this.options.startAngle||0;return vn(t*n+Er(r))}getDistanceFromCenterForValue(t){if(Ne(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(Ne(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const r=n[t];return YN(this.getContext(),t,r)}}getPointPosition(t,n,r=0){const i=this.getIndexAngle(t)-Bt+r;return{x:Math.cos(i)*n+this.xCenter,y:Math.sin(i)*n+this.yCenter,angle:i}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:r,right:i,bottom:o}=this._pointLabelItems[t];return{left:n,top:r,right:i,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const r=this.ctx;r.save(),r.beginPath(),sE(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=t,r.fill(),r.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:r,grid:i,border:o}=n,s=this._pointLabels.length;let a,l,c;if(n.pointLabels.display&&$N(this,s),i.display&&this.ticks.forEach((u,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const f=this.getContext(d),h=i.setContext(f),v=o.setContext(f);KN(this,h,l,s,v)}}),r.display){for(t.save(),a=s-1;a>=0;a--){const u=r.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:f}=u;!f||!d||(t.lineWidth=f,t.strokeStyle=d,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const i=this.getIndexAngle(0);let o,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(i),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const c=r.setContext(this.getContext(l)),u=Gt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,s=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const d=wn(c.backdropPadding);t.fillRect(-s/2-d.left,-o-u.size/2-d.top,s+d.width,u.size+d.height)}Go(t,a.label,0,-o,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}Z(Ya,"id","radialLinear"),Z(Ya,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ff.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),Z(Ya,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),Z(Ya,"descriptors",{angleLines:{_fallback:"grid"}});const yf={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Nn=Object.keys(yf);function Jw(e,t){return e-t}function Xw(e,t){if(Ne(t))return null;const n=e._adapter,{parser:r,round:i,isoWeekday:o}=e._parseOpts;let s=t;return typeof r=="function"&&(s=r(s)),It(s)||(s=typeof r=="string"?n.parse(s,r):n.parse(s)),s===null?null:(i&&(s=i==="week"&&(ta(o)||o===!0)?n.startOf(s,"isoWeek",o):n.startOf(s,i)),+s)}function Qw(e,t,n,r){const i=Nn.length;for(let o=Nn.indexOf(e);o<i-1;++o){const s=yf[Nn[o]],a=s.steps?s.steps:Number.MAX_SAFE_INTEGER;if(s.common&&Math.ceil((n-t)/(a*s.size))<=r)return Nn[o]}return Nn[i-1]}function GN(e,t,n,r,i){for(let o=Nn.length-1;o>=Nn.indexOf(n);o--){const s=Nn[o];if(yf[s].common&&e._adapter.diff(i,r,s)>=t-1)return s}return Nn[n?Nn.indexOf(n):0]}function JN(e){for(let t=Nn.indexOf(e)+1,n=Nn.length;t<n;++t)if(yf[Nn[t]].common)return Nn[t]}function Zw(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:i}=ov(n,t),o=n[r]>=t?n[r]:n[i];e[o]=!0}}function XN(e,t,n,r){const i=e._adapter,o=+i.startOf(t[0].value,r),s=t[t.length-1].value;let a,l;for(a=o;a<=s;a=+i.add(a,1,r))l=n[a],l>=0&&(t[l].major=!0);return t}function e0(e,t,n){const r=[],i={},o=t.length;let s,a;for(s=0;s<o;++s)a=t[s],i[a]=s,r.push({value:a,major:!1});return o===0||!n?r:XN(e,r,i,n)}class $l extends ts{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const r=t.time||(t.time={}),i=this._adapter=new o2._date(t.adapters.date);i.init(n),al(r.displayFormats,i.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:Xw(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,r=t.time.unit||"day";let{min:i,max:o,minDefined:s,maxDefined:a}=this.getUserBounds();function l(c){!s&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!s||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=It(i)&&!isNaN(i)?i:+n.startOf(Date.now(),r),o=It(o)&&!isNaN(o)?o:+n.endOf(Date.now(),r)+1,this.min=Math.min(i,o-1),this.max=Math.max(i+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],r=t[t.length-1]),{min:n,max:r}}buildTicks(){const t=this.options,n=t.time,r=t.ticks,i=r.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const o=this.min,s=this.max,a=RD(i,o,s);return this._unit=n.unit||(r.autoSkip?Qw(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):GN(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:JN(this._unit),this.initOffsets(i),t.reverse&&a.reverse(),e0(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,r=0,i,o;this.options.offset&&t.length&&(i=this.getDecimalForValue(t[0]),t.length===1?n=1-i:n=(this.getDecimalForValue(t[1])-i)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=Zt(n,0,s),r=Zt(r,0,s),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,i=this.options,o=i.time,s=o.unit||Qw(o.minUnit,n,r,this._getLabelCapacity(n)),a=Le(i.ticks.stepSize,1),l=s==="week"?o.isoWeekday:!1,c=ta(l)||l===!0,u={};let d=n,f,h;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":s),t.diff(r,n,s)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+s);const v=i.ticks.source==="data"&&this.getDataTimestamps();for(f=d,h=0;f<r;f=+t.add(f,a,s),h++)Zw(u,f,v);return(f===r||i.bounds==="ticks"||h===1)&&Zw(u,f,v),Object.keys(u).sort(Jw).map(m=>+m)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const i=this.options.time.displayFormats,o=this._unit,s=n||i[o];return this._adapter.format(t,s)}_tickFormatFunction(t,n,r,i){const o=this.options,s=o.ticks.callback;if(s)return dt(s,[t,n,r],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],d=c&&a[c],f=r[n],h=c&&d&&f&&f.major;return this._adapter.format(t,i||(h?d:u))}generateTickLabels(t){let n,r,i;for(n=0,r=t.length;n<r;++n)i=t[n],i.label=this._tickFormatFunction(i.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,r=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,r=this.ctx.measureText(t).width,i=Er(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(i),s=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:r*o+a*s,h:r*s+a*o}}_getLabelCapacity(t){const n=this.options.time,r=n.displayFormats,i=r[n.unit]||r.millisecond,o=this._tickFormatFunction(t,0,e0(this,[t],this._majorUnit),i),s=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,r=i.length;n<r;++n)t=t.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,r;if(t.length)return t;const i=this.getLabels();for(n=0,r=i.length;n<r;++n)t.push(Xw(this,i[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return y1(t.sort(Jw))}}Z($l,"id","time"),Z($l,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function ou(e,t,n){let r=0,i=e.length-1,o,s,a,l;n?(t>=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=si(e,"pos",t)),{pos:o,time:a}=e[r],{pos:s,time:l}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=si(e,"time",t)),{time:o,pos:a}=e[r],{time:s,pos:l}=e[i]);const c=s-o;return c?a+(l-a)*(t-o)/c:a}class Pm extends $l{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=ou(n,this.min),this._tableRange=ou(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,i=[],o=[];let s,a,l,c,u;for(s=0,a=t.length;s<a;++s)c=t[s],c>=n&&c<=r&&i.push(c);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(s=0,a=i.length;s<a;++s)u=i[s+1],l=i[s-1],c=i[s],Math.round((u+l)/2)!==c&&o.push({time:c,pos:s/(a-1)});return o}_generate(){const t=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(t)||!r.length)&&r.splice(0,0,t),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((i,o)=>i-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(ou(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return ou(this._table,r*this._tableRange+this._minPos,!0)}}Z(Pm,"id","timeseries"),Z(Pm,"defaults",$l.defaults);var QN=Object.freeze({__proto__:null,CategoryScale:jm,LinearScale:Rm,LogarithmicScale:Lm,RadialLinearScale:Ya,TimeScale:$l,TimeSeriesScale:Pm});const ZN=[i2,TF,RN,QN];var su=Object.freeze([Object.freeze([12,24,70]),Object.freeze([20,130,190]),Object.freeze([40,190,120]),Object.freeze([235,210,60]),Object.freeze([235,70,45])]);function ez(e){var t=Number(e);isFinite(t)||(t=0);var n=t<0?0:t>1?1:t,r=n*(su.length-1),i=Math.min(su.length-2,Math.floor(r)),o=r-i,s=su[i],a=su[i+1];return[Math.round(s[0]+(a[0]-s[0])*o),Math.round(s[1]+(a[1]-s[1])*o),Math.round(s[2]+(a[2]-s[2])*o)]}function tz(e){var t=ez(e);return"rgb("+t[0]+","+t[1]+","+t[2]+")"}Sr.register.apply(Sr,ZN);function nz(e){for(var t=e.cells||[],n=Number(e.maxV)||0,r=[],i=[],o=0;o<t.length;o++)r.push({x:t[o].x,y:t[o].y}),i.push(tz(n>0?(Number(t[o].v)||0)/n:0));var s={color:"#9bb",font:{size:8},maxRotation:0,autoSkip:!0,maxTicksLimit:6},a={color:"#1c2836"};return{type:"scatter",data:{datasets:[{label:e.label||"topology",data:r,backgroundColor:i,borderWidth:0,pointStyle:"rect",pointRadius:7,hoverRadius:7}]},options:{responsive:!0,maintainAspectRatio:!1,animation:!1,plugins:{legend:{display:!0,labels:{color:"#cdd",font:{size:9},boxWidth:10}}},scales:{x:{ticks:s,grid:a,title:{display:!0,text:"z",color:"#7a8fa0",font:{size:8}}},y:{ticks:s,grid:a,reverse:!0,title:{display:!0,text:"y",color:"#7a8fa0",font:{size:8}}}}}}}function Ld(e){var t=null;return{render:function(n){e.innerHTML="";try{var r=(n.values||[]).reduce(function(u,d){return u+(Number(d)||0)},0);e.setAttribute("data-chart-sum",String(r))}catch{}var i=typeof document<"u"?document.createElement("canvas"):null;if(!i)throw new Error("[realm-chart] render requires a DOM (document) to host the canvas. (FAIL-LOUD.)");if(i.style.cssText="max-height:300px;",e.appendChild(i),t){try{t.destroy()}catch{}t=null}if(Array.isArray(n.cells)){t=new Sr(i,nz(n));return}var o=n.orientation===0||n.orientation===90,s=n.orientation===90,a;if(o){var l={color:"#9bb",font:{size:8},maxRotation:0,autoSkip:!0,maxTicksLimit:8},c={color:"#20303a"};a={responsive:!0,maintainAspectRatio:!1,indexAxis:s?"y":"x",plugins:{legend:{display:!0,labels:{color:"#cdd",font:{size:9},boxWidth:10}}},scales:{x:{ticks:l,grid:c},y:{ticks:l,grid:c,reverse:s}}}}else a={responsive:!0,plugins:{legend:{labels:{color:"#ccc"}}},scales:{x:{ticks:{color:"#888"},grid:{color:"#222"}},y:{ticks:{color:"#888"},grid:{color:"#222"}}}};t=new Sr(i,{type:n.kind==="line"?"line":"bar",data:{labels:n.labels,datasets:[{label:n.label,data:n.values,backgroundColor:"rgba(79,159,192,0.55)",borderColor:"rgba(79,159,192,1)",borderWidth:1}]},options:a})},destroy:function(){if(t){try{t.destroy()}catch{}t=null}e&&(e.innerHTML="")}}}function aE(e,t){if(!e)return Promise.reject(new Error("[realm-chart] boot requires a host element. (FAIL-LOUD.)"));var n=t&&t.kind||"in-app";if(n!=="in-app")return Promise.reject(new Error('[realm-chart] transport "'+n+'" is not supported by the chart realm (expect "in-app"). (FAIL-LOUD.)'));var r=Ld(e),i=IP(r,t||{kind:"in-app"});return Promise.resolve({handle:i.handle,impl:i.impl})}Ak("chart",{boot:aE});const rz=Object.freeze(Object.defineProperty({__proto__:null,bootChartRealm:aE,makeChartEnv:Ld},Symbol.toStringTag,{value:"Module"}));var iz=Ag({mode:"dev-core"});function an(e){e=e||{},this._mountEl=e.mountEl||null,this._engine=e.engine||"wasm",this._renderer=e.renderer||"p5",this._overlayHost=e.overlayHost||null,this._onTick=e.onTick||null,this._router=e.router||iz,this._runner=null,this._booted=!1,this._disposed=!1,this._tickCount=0,this._onRenderFrame=null,this._canvasWrapper=null,this._mountEl&&(this._mountEl.style.position="relative",this._mountEl.style.width="100%",this._mountEl.style.height="100%",this._mountEl.style.background="#0d0d0d",this._canvasWrapper=document.createElement("div"),this._canvasWrapper.id="gfx-canvas-wrapper-"+(Math.random()*1e9|0),this._canvasWrapper.style.cssText="width:100%;height:100%;",this._mountEl.appendChild(this._canvasWrapper),this._statusEl=document.createElement("div"),this._statusEl.style.cssText="position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;color:#555;font:13px ui-monospace,monospace;pointer-events:none;",this._statusEl.textContent="Booting engine ("+this._engine+")…",this._mountEl.appendChild(this._statusEl)),console.log("[GraphicsPane] constructed, engine:",this._engine)}an.prototype.boot=function(){var e=this;if(e._booted)return Promise.resolve();var t=new URL(e._router.resolve("experiments/_shared/boot.js"),document.baseURI).href,n=new URL(e._router.resolve("experiments/_shared/page-door.js"),document.baseURI).href;return Promise.all([import(t),import(n)]).then(function(r){var i=r[0];return r[1].refuseRetiredGlobals(),e._bootModule=i,i.bootPage({p5:"always",engine:e._engine,renderer:e._renderer,overlayHost:e._overlayHost,setup:function(){e._dispatchSetup()}}).ready.then(function(){return vk(e._router).then(function(o){e._realm=o})})},function(r){throw r.axis="engine",r}).then(function(){e._booted=!0,e._wireRenderFrameSubscription(),e._statusEl&&e._statusEl.parentNode&&(e._statusEl.parentNode.removeChild(e._statusEl),e._statusEl=null),console.log("[GraphicsPane] boot complete, engine:",e._engine)}).catch(function(r){var i=r&&r.message?r.message:String(r),o=r&&r.frqtlBootPainted?null:e._failLoud(i,r&&r.axis||"engine");return e._statusEl&&(e._statusEl.textContent="Engine boot failed.",e._statusEl.style.color="#ff6b6b"),Ee&&Ee.emit("engine:error",{message:i}),Promise.resolve(o).then(function(){throw r})})};an.prototype._failLoud=function(e,t){var n=t==="renderer"?"RENDERER":"ENGINE",r=n+` BOOT FAILED
|
|
156
|
-
|
|
157
|
-
`+e+`
|
|
158
|
-
|
|
159
|
-
The requested `+n.toLowerCase()+" is unavailable. No silent fallback.",i=this,o=t==="renderer"?"renderer":"engine";if(console.error("[GraphicsPane] FAIL-LOUD:",e),i._bootModule)return i._bootModule.paintBootFailure(o,r),Promise.resolve();var s=new URL(i._router.resolve("experiments/_shared/boot-failure.js"),document.baseURI).href;return import(s).then(function(a){i._overlayHost&&a.setBootOverlayHost(i._overlayHost),a.paintBootFailure(o,r)},function(a){console.error("[GraphicsPane] the boot-failure painter did not load either ("+s+"): "+String(a&&a.message||a))})};an.prototype._wireRenderFrameSubscription=function(){var e=this;e._onRenderFrame=function(t){if(t){if(t.cmd==="start"){e.start();return}if(t.cmd==="stop"){e.stop();return}if((t.universe||t.tickData)&&e._runner){var n=t.tickData||t.universe,r=e._runner.renderer;r&&r.renderTick&&r.renderTick(n,e._runner.largeObjects||[],e._runner._renderOptions)}}},Ee&&Ee.on("render:frame",e._onRenderFrame)};an.prototype.prepareExperiment=function(e,t){this._pendingExperiment={setupFn:e,opts:t||{}}};an.prototype._makePaneOnTick=function(e){var t=this;return function(n,r){t._tickCount++;var i=oz(n);Ee&&Ee.emit("engine:tick",{tick:t._tickCount,metrics:i}),t._onTick&&t._onTick(n,r),typeof e=="function"&&e(n,r)}};an.prototype._dispatchSetup=function(){var e=this;if(e._pendingMountRunner){var t=e._pendingMountRunner;if(e._pendingMountRunner=null,e._runner&&e._runner!==t&&e._runner.isRunning&&e._runner.stop(),e._canvasWrapper&&(t._canvasParentId=e._canvasWrapper.id),t._onTick=e._makePaneOnTick(t._onTick),e._runner=t,t.createCanvas(),t.start(),typeof e._setupResolve=="function"){var n=e._setupResolve;e._setupResolve=null,n(e._runner)}return}var r=e._pendingExperiment;if(!r||typeof r.setupFn!="function"){try{if(typeof createCanvas=="function"){var i=createCanvas(1,1);i&&i.elt&&i.elt.style&&(i.elt.style.display="none")}typeof noLoop=="function"&&noLoop()}catch{}return}if(!e._realm){var o="the realm modules (FrqtlApp, the display slot) are not loaded at p5 setup dispatch — boot() loads them (lib/shim/engine/engine-stack-boot.js) before it resolves; an experiment registered ahead of that must wait on boot() too.";throw e._failLoud(o,"engine"),new Error("[GraphicsPane] "+o)}var s=r.opts||{};e._runner&&e._runner.isRunning&&e._runner.stop();try{e._runner=new e._realm.app.FrqtlApp({canvasParentId:e._canvasWrapper?e._canvasWrapper.id:null,canvasW:s.canvasW,canvasH:s.canvasH,is3D:e._realm.display.name()==="three",seed:s.seed||42,stepsPerFrame:s.stepsPerFrame||1,onTick:e._makePaneOnTick(null)})}catch(c){if(e._failLoud(c.message,"engine"),typeof e._setupReject=="function"){var a=e._setupReject;e._setupResolve=null,e._setupReject=null,a(c)}throw c}if(e._runner.createCanvas(),e._runner.setup(r.setupFn,s),e._runner.start(),typeof e._setupResolve=="function"){var l=e._setupResolve;e._setupResolve=null,l(e._runner)}};an.prototype.loadExperiment=function(e,t){var n=this;return this._booted?typeof window.p5>"u"?(console.error("[GraphicsPane] p5 not available."),Promise.reject(new Error("[GraphicsPane] p5 not available"))):(n.prepareExperiment(e,t),n._driveP5Setup()):(console.warn("[GraphicsPane] loadExperiment called before boot() resolved. Call boot() first."),Promise.reject(new Error("[GraphicsPane] not booted")))};an.prototype.mountRunner=function(e){var t=this;return this._booted?typeof window.p5>"u"?(console.error("[GraphicsPane] p5 not available."),Promise.reject(new Error("[GraphicsPane] p5 not available"))):!e||typeof e.createCanvas!="function"||typeof e.start!="function"?Promise.reject(new Error("[GraphicsPane] mountRunner requires an FrqtlApp (got "+(e===null?"null":typeof e)+"). (FAIL-LOUD.)")):(t._pendingExperiment=null,t._pendingMountRunner=e,t._driveP5Setup()):(console.warn("[GraphicsPane] mountRunner called before boot() resolved. Call boot() first."),Promise.reject(new Error("[GraphicsPane] not booted")))};an.prototype._driveP5Setup=function(){var e=this;return new Promise(function(t,n){e._setupResolve=t,e._setupReject=n;try{e._p5Instance&&typeof e._p5Instance.remove=="function"&&e._p5Instance.remove()}catch{}try{e._p5Instance=new window.p5}catch(r){e._setupResolve=null,n(r);return}setTimeout(function(){e._setupResolve===t&&(e._setupResolve=null,n(new Error("[GraphicsPane] p5 setup did not fire within 8s")))},8e3)})};an.prototype.start=function(){if(!this._disposed){if(!this._runner){console.warn("[GraphicsPane] start() called with no experiment loaded.");return}this._runner.start()}};an.prototype.stop=function(){this._runner&&this._runner.stop()};an.prototype.step=function(){return this._disposed?null:this._runner?this._runner.step():(console.warn("[GraphicsPane] step() called with no experiment loaded."),null)};an.prototype.getRunner=function(){return this._runner};an.prototype.runFrqtlCode=function(e){ci.run({source:"frqtl",code:e,fileId:"_gfx-editor"})};an.prototype.dispose=function(){this.stop(),this._disposed=!0,this._onRenderFrame&&Ee&&(Ee.off("render:frame",this._onRenderFrame),this._onRenderFrame=null);try{this._p5Instance&&typeof this._p5Instance.remove=="function"&&this._p5Instance.remove()}catch{}this._p5Instance=null,this._runner&&this._runner.dispose(),this._runner=null,console.log("[GraphicsPane] disposed")};function oz(e,t){var n={};if(!e)return n;if(typeof e.tick_count=="number"&&(n.Tick=e.tick_count),e.dimensionData&&Array.isArray(e.dimensionData)){for(var r=0,i=0;i<e.dimensionData.length;i++){var o=e.dimensionData[i];o&&typeof o.frameCount=="number"&&(r+=o.frameCount)}n["Active Quanta"]=r}else e.frameData&&Array.isArray(e.frameData)&&(n["Active Quanta"]=e.frameData.length);return n}typeof window<"u"&&(window.GraphicsPane=an);function lE(e){var t=[];if(!e)return t;if(e.detectorWall&&typeof e.detectorWall.getCollisionHistogram=="function"&&t.push(e.detectorWall),Array.isArray(e.largeObjects))for(var n=0;n<e.largeObjects.length;n++){var r=e.largeObjects[n];r&&typeof r.getCollisionHistogram=="function"&&t.indexOf(r)===-1&&t.push(r)}return t}function sz(e,t){for(var n=lE(e),r=0;r<n.length;r++)n[r].getCollisionHistogram(t)}function az(e,t){e&&(Ko(e)?e.forEach(function(n,r){t[String(r)]=Number(n)}):Ko(e.combined)?e.combined.forEach(function(n,r){t[String(r)]=Number(n)}):typeof e=="object"&&Object.keys(e).forEach(function(n){t[String(n)]=Number(e[n])}))}function Yh(e){var t={};if(!e)return t;var n=typeof e.setupResult<"u"?e.setupResult:e._setupResult||null;if(!n)return t;for(var r=lE(n),i=0;i<r.length;i++)az(r[i].getCollisionHistogram(),t);return t}function lz(e,t){if(!e||typeof e.start!="function"||typeof e.dispose!="function")throw new Error("[realm-frqtl] makeFrqtlHandle requires a GraphicsPane-like object. (FAIL-LOUD.)");var n=[];e._onTick=function(i,o){if(sz(o,i),!!n.length)for(var s={tick:e._tickCount||0,detector:Yh(e.getRunner())},a=0;a<n.length;a++)try{n[a](s)}catch{}};var r={_transport:t&&t.kind||"in-app",inject:function(i){return Promise.reject(new Error('[realm-frqtl] inject("'+i+'") is retired — the opaque setup-factory recipe path was removed. Bind a lane=frqtl builder that `import`s an editable setup module; its live runner mounts via the host-side fast path, not the data plane. (FAIL-LOUD — no opaque setup-script load.)'))},call:function(i){if(i==="detectorHistogram")return Yh(e.getRunner());if(i==="tickCount")return e._tickCount||0;throw new Error('[realm-frqtl] call: unknown fn "'+i+'" (expect "detectorHistogram" | "tickCount"). (FAIL-LOUD.)')},on:function(i,o){if(i!=="tick")throw new Error('[realm-frqtl] on: unknown event "'+i+'" (expect "tick"). (FAIL-LOUD.)');return n.push(o),function(){var s=n.indexOf(o);s!==-1&&n.splice(s,1)}},start:function(){e.start()},stop:function(){e.stop()},step:function(){return e.step(),{tick:e._tickCount||0,detector:Yh(e.getRunner())}},dispose:function(){n.length=0,e._onTick=null,e.dispose()},_mountRunnerInProcess:function(i){return e.mountRunner(i)},_graphicsPane:e};return{handle:Pk(r),impl:r}}function cz(e,t,n){if(!e)return Promise.reject(new Error("[realm-frqtl] boot requires a host element. (FAIL-LOUD.)"));var r=t&&t.kind||"in-app";if(r!=="in-app")return Promise.reject(new Error('[realm-frqtl] transport "'+r+'" is not supported by the frqtl realm (expect "in-app"). (FAIL-LOUD.)'));var i=n&&n.engine||"wasm",o=n&&n.mode||"dev-core",s=Ag({mode:o,engine:i}),a=n&&n.render3d?"three":"p5",l=new an({mountEl:e,engine:s.engine,router:s,renderer:a,overlayHost:e});return l.boot().then(function(){var c=lz(l,t||{kind:"in-app"});return{handle:c.handle,impl:c.impl,pane:l}})}Ak("frqtl",{boot:cz});var uz=typeof window<"u"&&window.console?{log:window.console.log.bind(window.console),warn:window.console.warn.bind(window.console),error:window.console.error.bind(window.console)}:{log:function(){},warn:function(){},error:function(){}},br=Ir;function Re(e,t,n){var r=document.createElement(e);return t&&(r.style.cssText=t),n!=null&&(r.textContent=n),r}function dz(e){e=e||{};var t=e.mountEl;if(!t)throw new Error("[NotebookPane] mountEl is required");e.math;var n=e.frqtl||null,r=typeof e.onConsole=="function"?e.onConsole:null,i=e.monacoBaseUrl||null,o=e.markdownCssUrl||null,s=null,a=null,l=[],c=Object.create(null),u=null,d=!1,f=null,h=!1,v=[];function m(){if(!h){h=!0;for(var _=0;_<v.length;_++)try{v[_](!0)}catch{}}}var x=null,b=null,g=null,k=null,E=null,C=null,S=!1,M=null,L=null;function T(_,R){var P={mountEl:_,emitBusRun:!1};if(i&&(P.monacoBaseUrl=i),R)for(var $ in R)Object.prototype.hasOwnProperty.call(R,$)&&(P[$]=R[$]);return new window.CodeEditorPane(P)}function V(){if(!(typeof document>"u")){if(o&&!document.getElementById("frqtl-md-github-css")){var _=document.createElement("link");_.id="frqtl-md-github-css",_.rel="stylesheet",_.href=o,document.head.appendChild(_)}if(!document.getElementById("frqtl-md-overlay")){var R=document.createElement("style");R.id="frqtl-md-overlay",R.textContent=".markdown-body.frqtl-md{background:transparent;color:#cfcfcf;font-size:0.92rem;}.markdown-body.frqtl-md a{color:#7fc4ff;}.markdown-body.frqtl-md h1,.markdown-body.frqtl-md h2{border-bottom-color:#2a2a2a;}.markdown-body.frqtl-md code{background:#1c1c1c;padding:1px 5px;border-radius:3px;font-size:0.85em;}.markdown-body.frqtl-md h1{font-size:1.5rem;color:#fff;}.markdown-body.frqtl-md h2{font-size:1.25rem;color:#fff;}.markdown-body.frqtl-md h3{font-size:1.1rem;color:#fff;}.markdown-body.frqtl-md ul{padding-left:1.3em;}",document.head.appendChild(R)}}}V(),t.innerHTML="",t.style.cssText="display:flex;flex-direction:column;height:100%;overflow:auto;background:#0d0d0d;color:#ddd;";var G=Re("div","position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:10px;padding:8px 20px;background:#141414;border-bottom:1px solid #1d1d1d;");G.setAttribute("data-role","notebook-toolbar"),E=Re("button","padding:6px 16px;background:#1f6f3f;color:#fff;border:none;border-radius:4px;cursor:pointer;font:600 0.8rem/1 system-ui,sans-serif;","Run All"),E.setAttribute("data-role","notebook-run-all"),E.addEventListener("click",function(){Mt()}),G.appendChild(E),C=Re("span","font:0.72rem/1 ui-monospace,monospace;color:#888;",""),C.setAttribute("data-role","notebook-run-all-status"),G.appendChild(C),t.appendChild(G);var N=Re("div","flex:1;padding:16px 20px;font-size:0.9rem;line-height:1.5;max-width:960px;margin:0 auto;width:100%;box-sizing:border-box;");N.className="frqtl-notebook",t.appendChild(N);function te(){try{return st.active().id}catch{return null}}function W(){for(var _=te(),R=0;R<l.length;R++){var P=l[R];P.els&&P.els.backendBadge&&(_?(P.els.backendBadge.textContent=_,P.els.backendBadge.style.background="#13202b",P.els.backendBadge.style.color="#7fc4ff",P.els.backendBadge.style.display=""):(P.els.backendBadge.textContent="no backend",P.els.backendBadge.style.background="#3a1a1a",P.els.backendBadge.style.color="#ff8a8a",P.els.backendBadge.style.display=""))}}var Y={idle:"background:#222;color:#888;",running:"background:#1c3a55;color:#7fc4ff;",ok:"background:#0f2417;color:#7ee2a8;",error:"background:#2a0c0c;color:#ff8a8a;",stale:"background:#3a2c08;color:#ffd27f;"};function re(_,R){var P=c[_];if(!(!P||!P.els||!P.els.statusBadge)){var $=P.els.statusBadge;$.textContent=R,$.style.cssText="font:600 0.65rem/1 ui-monospace,monospace;padding:3px 7px;border-radius:3px;text-transform:uppercase;letter-spacing:0.04em;"+(Y[R]||Y.idle),P.els.runBtn&&(P.els.runBtn.style.outline=R===br.STALE?"1px solid #ffd27f":"none")}}var pe={CONSOLE:"console"};function B(_){var R=Re("div","min-height:8px;"),P=Re("div","padding:8px 10px;display:none;");_.appendChild(R),_.appendChild(P);var $=new so({mountEl:R}),U=!1;return{type:pe.CONSOLE,consoleHost:R,htmlHost:P,pane:$,line:function(H,he){var Ae=he==="error"?"error":he==="warn"?"warn":he==="log"||!he?"info":he;$.log(Ae,String(H)),U=!0},node:function(H){P.style.display="",P.appendChild(H)},hasOutput:function(){return U||P.childNodes.length>0},clear:function(){$.clear(),U=!1,P.innerHTML="",P.style.display="none"},dispose:function(){try{$.clear()}catch{}_.innerHTML=""}}}function ee(){g||(g=function(_){if(_){var R=L?c[L]:null;R&&R.output&&typeof R.output.line=="function"&&R.output.line(String(_.text),_.level)}},Ee.on("console:write",g))}function ce(){g&&(Ee.off("console:write",g),g=null)}function ve(_){if(_&&_.liveChart){try{_.liveChart.dispose()}catch{}_.liveChart=null}if(_&&_.viewController){try{_.viewController.dispose()}catch{}_.viewController=null}if(_&&_.realm&&_.realm.impl&&_.realm.impl._graphicsPane&&typeof _.realm.impl._graphicsPane.getRunner=="function")try{var R=_.realm.impl._graphicsPane.getRunner();R&&R._liveChartsMount&&(R._liveChartsMount.dispose(),R._liveChartsMount=null,R._liveChartsMounted=!1)}catch{}if(_&&_.realm){try{_.realm.handle.dispose()}catch{}_.realm=null}}function ke(){for(var _=0;_<l.length;_++)l[_].realm&&ve(l[_]);M=null}function je(){for(var _=0;_<l.length;_++){var R=l[_];if(R.cell&&R.cell.type==="module"&&R.editor){var P=R.editor.activeFile();P&&typeof P.value=="string"&&(R.cell.body=P.value)}}}function ie(_){if(!s)return Promise.resolve();var R=_.cell.id;if(_.editor){var P=_.editor.activeFile();P&&typeof P.value=="string"&&(_.cell.body=P.value)}je(),_.output&&_.output.clear(),L=R,ee();var $=function(U){_.output&&(U&&typeof U=="object"&&typeof U.nodeType=="number"?_.output.node(U):typeof U=="string"?_.output.line(U,"log"):_.output.line(me(U),"log"))};return s.runCell(R,{display:$}).then(function(U){if(U&&U.ok&&U.outputs&&_.output&&!_.output.hasOutput())for(var H=Object.keys(U.outputs),he=0;he<H.length;he++){var Ae=U.outputs[H[he]];_.output.line(H[he]+" = "+me(Ae),"log")}return U}).catch(function(U){_.output&&_.output.line(U&&U.message?U.message:String(U),"error"),re(R,br.ERROR)}).finally(function(){ce(),L=null})}function me(_){try{return typeof _=="object"?JSON.stringify(_):String(_)}catch{return String(_)}}var xe="2px solid #2d6cff";function ge(_){for(var R=0;R<l.length;R++)if(l[R].cell&&l[R].cell.id===_)return R;return-1}function kt(_){if(u!==_){var R=u?c[u]:null;R&&R.els&&R.els.card&&(R.els.card.style.outline="none"),u=_||null;var P=_?c[_]:null;if(P&&P.els&&P.els.card&&(P.els.card.style.outline=xe,P.els.card.style.outlineOffset="-1px",typeof P.els.card.scrollIntoView=="function"))try{P.els.card.scrollIntoView({block:"nearest"})}catch{}}}function ut(_){if(l.length){var R=Math.max(0,Math.min(l.length-1,_)),P=l[R];P&&P.cell&&kt(P.cell.id)}}function _n(_){var R=_&&_.els&&_.els.card;R&&(R.hasAttribute("tabindex")||R.setAttribute("tabindex","-1"),R.style.outline="none",R.addEventListener("mousedown",function(){_.cell&&kt(_.cell.id)}))}function tn(){var _=u?c[u]:null;if(!(!_||!_.cell)){if(_.cell.type==="markdown"){typeof _.openEditor=="function"&&_.openEditor();return}if(_.editor&&(d=!0,typeof _.editor.focus=="function"))try{_.editor.focus()}catch{}}}function ir(){var _=u?c[u]:null;if(d=!1,_&&_.cell&&_.cell.type==="markdown"&&typeof _.closeEditor=="function"&&_.closeEditor(),_&&_.els&&_.els.card&&typeof _.els.card.focus=="function")try{_.els.card.focus()}catch{}}function ht(_,R){if(!_||!_.cell)return Promise.resolve();R=R||"inplace";var P=_.cell,$=ge(P.id);function U(){d=!1;var Ae=zT($,l.length,R);ut(Ae)}var H=BT(P.type);function he(){R!=="inplace"&&U()}switch(H.leaf){case Ti.MARKDOWN_RENDER:return typeof _.closeEditor=="function"&&_.closeEditor(),he(),Promise.resolve();case Ti.MODULE_ADVANCE:return he(),Promise.resolve();case Ti.REALM:return Promise.resolve(Mn(_)).then(he);case Ti.JS:default:return Promise.resolve(ie(_)).then(he)}}function ye(){f||typeof document>"u"||(f=function(_){if(u){var R=c[u];if(R){var P=NT(_,d);if(P)switch(P){case Jn.EDIT:_.preventDefault(),tn();break;case Jn.COMMAND_MODE:_.preventDefault(),ir();break;case Jn.SELECT_PREV:_.preventDefault(),ut(ge(u)-1);break;case Jn.SELECT_NEXT:_.preventDefault(),ut(ge(u)+1);break;case Jn.RUN_ADVANCE:_.preventDefault(),ht(R,"advance");break;case Jn.RUN_INPLACE:_.preventDefault(),ht(R,"inplace");break}}}},document.addEventListener("keydown",f,!0))}function St(){f&&typeof document<"u"&&document.removeEventListener("keydown",f,!0),f=null}function ln(_){return _&&_.realm?_.realm:_&&_.type==="chart"?"chart":"frqtl"}function Wn(_){return ln(_)==="chart"}function An(_){return!!(_&&_.type==="view")}function Pn(_){var R=_.spec||"bar",P=R.split(":"),$=(P[0]||"bar").trim(),U=(P[1]||_.in&&_.in[0]||"").trim();if(!U)throw new Error('[chart] no binding name in spec ("'+R+'") or `in` — nothing to plot.');if(!s)throw new Error('[chart] no kernel — cannot resolve binding "'+U+'".');var H=s.getBinding(U);if(!H){var he=I(U),Ae=he?'run cell "'+he+'" first.':"no cell produces it.";throw new Error('[chart] input "'+U+'" not yet produced — '+Ae+" (FAIL-LOUD)")}var Ve=H.value;if(Ve instanceof Map){var Qe={};Ve.forEach(function(Be,Ce){Qe[String(Ce)]=Be}),Ve=Qe}return{kind:$,label:U,data:Ve}}function Mn(_){var R=_.cell.id,P=Wn(_.cell),$=An(_.cell);if(M&&M!==R){var U=c[M];U&&(ve(U),re(U.cell.id,br.IDLE))}ve(_);var H=null,he=null,Ae=null;if(P)try{he=Pn(_.cell)}catch(Ce){return De(_,Ce&&Ce.message?Ce.message:String(Ce)),re(R,br.ERROR),Promise.resolve()}else if($)try{Ae=Pt(_.cell)}catch(Ce){return De(_,Ce&&Ce.message?Ce.message:String(Ce)),re(R,br.ERROR),Promise.resolve()}else try{H=vr(_.cell)}catch(Ce){return De(_,Ce&&Ce.message?Ce.message:String(Ce)),re(R,br.ERROR),Promise.resolve()}re(R,br.RUNNING);var Ve=_.els.gfxHost||_.els.realmHost;Ve.innerHTML="";var Qe;try{Qe=qR(ln(_.cell))}catch(Ce){return De(_,Ce&&Ce.message?Ce.message:String(Ce)),re(R,br.ERROR),Promise.resolve()}var Be;return(n&&(n.engine||n.mode)||_.cell.render3d)&&(Be={},n&&n.engine&&(Be.engine=n.engine),n&&n.mode&&(Be.mode=n.mode),_.cell.render3d&&(Be.render3d=!0)),Promise.resolve(Qe.boot(Ve,KR(),Be)).then(function(Ce){return _.realm=Ce,M=R,P?Ce.handle.inject("chart",he):$?Ut(_,Ce,Ae):Xt(Ce,H)}).then(async function(){if(!P&&!$&&_.realm&&_.realm.handle&&s){var Ce=Array.isArray(_.cell.produces)?_.cell.produces:[];if(Ce.length){await Et(_.realm.handle,_.cell.produceAfter);for(var qe=await PT(_.realm.handle,Ce,_.cell.produceVia),nn=0;nn<qe.length;nn++){var F={};F[qe[nn].name]=qe[nn].value,s.commitViewOutputs(R,F)}}}if(!P&&!$&&_.cell.liveChart&&_.realm&&_.realm.handle&&_.els.liveChartHost){var K=_.cell.liveChart,We=_.cell.liveChartKind||"bar";if(yd.indexOf(K)===-1)throw new Error('[notebook-pane] liveChart="'+K+'" is not a blessed projector (expect one of ['+yd.join(", ")+"]). (FAIL-LOUD.)");if(We!=="bar"&&We!=="line")throw new Error('[notebook-pane] liveChartKind="'+We+'" must be "bar" | "line". (FAIL-LOUD.)');var kn=Ld(_.els.liveChartHost);_.liveChart=lm({handle:_.realm.handle,chartEnv:kn,projector:K,kind:We,label:K,now:function(){return typeof performance<"u"&&performance.now?performance.now():Date.now()},throttleMs:Jg}),_.liveChart.start()}re(R,br.OK),Tn(_)}).catch(function(Ce){var qe=Ce&&Ce.message?Ce.message:String(Ce);FT(Ve)||(Ve.innerHTML="",De(_,qe)),re(R,br.ERROR)})}function vr(_){return LT(_),ST({setup:_.setup,modules:s?s.moduleSet():{},opts:_.opts||{},shape:_.shape||"",stage:_.stage||"",seed:_.seed||"",render3d:!!_.render3d,renderOptions:_.renderOptions||{},cameraPreset:_.cameraPreset||"",outName:_.id+"_run"})}function Xt(_,R){if(!_||!_.impl||typeof _.impl._mountRunnerInProcess!="function")return Promise.reject(new Error("[frqtl] declared canvas requires the frqtl realm host-side mount seam (impl._mountRunnerInProcess). (FAIL-LOUD.)"));var P=R.outName;return ci.runCell({lane:"frqtl",code:R.builderCode,id:"_declared_synth",forceModulePath:R.usesModulePath,modules:s?s.moduleSet():{},inputs:{},declaredOutputs:[P]}).then(function($){if(!$||!$.ok)throw new Error("[frqtl] synthesized builder failed: "+($&&$.error?$.error:"unknown error")+" (FAIL-LOUD.)");var U=$.outputs?$.outputs[P]:null;if(!U)throw new Error('[frqtl] synthesized builder returned no runner for "'+P+'". (FAIL-LOUD.)');return Promise.resolve(_.impl._mountRunnerInProcess(U)).then(function(H){return U&&typeof U.addTickListener=="function"&&!U._liveChartsMounted&&(U._liveChartsMounted=!0,QS(U,{}).then(function(he){U._liveChartsMount=he}).catch(function(he){typeof console<"u"&&console.error&&console.error("[frqtl] mountLiveCharts failed:",he)})),H})})}function Pt(_){return jT({module:_.module,modules:s?s.moduleSet():{},outName:_.id+"_view"})}function Ut(_,R,P){var $=_.cell,U=P.outName;return ci.runCell({lane:"frqtl",code:P.entryCode,id:"_view_synth",modules:s?s.moduleSet():{},inputs:{},declaredOutputs:[U]}).then(function(H){if(!H||!H.ok)throw new Error("[view] view module failed: "+(H&&H.error?H.error:"unknown error")+" (FAIL-LOUD.)");var he=H.outputs?H.outputs[U]:null;if(typeof he!="function")throw new Error('[view] view module export "'+P.exportName+'" is not a function (got '+(he===null?"null":typeof he)+"). A view export must be `render(ctx)`. (FAIL-LOUD.)");for(var Ae={},Ve=Array.isArray($.in)?$.in:[],Qe=0;Qe<Ve.length;Qe++){var Be=Ve[Qe],Ce=s?s.getBinding(Be):null;if(!Ce){var qe=I(Be),nn=qe?'run cell "'+qe+'" first.':"no cell produces it.";throw new Error('[view] input "'+Be+'" not yet produced — '+nn+" (FAIL-LOUD)")}Ae[Be]=Ce.value}var F=_.els.viewMount||_.els.realmHost,K=RT({mount:F,handle:R.handle,bindings:Ae,commit:s?function(We,kn){var Nt={};Nt[We]=kn,s.commitViewOutputs($.id,Nt)}:void 0,imports:{makeChartEnv:Ld,makeLiveChartController:lm}});return Promise.resolve(he(K)).then(function(We){We&&typeof We.dispose=="function"&&(_.viewController=We)})})}function Et(_,R){return IT(_,R,MT,TT)}function De(_,R){var P=Re("pre","color:#ff6b6b;background:#1a0c0c;border:1px solid #3a1a1a;padding:8px 10px;border-radius:4px;font-size:0.8rem;white-space:pre-wrap;",R);_.els.realmHost&&_.els.realmHost.appendChild(P)}function Tn(_,R){_.els.stopBtn&&(_.els.stopBtn.disabled=!1),_.els.stepBtn&&(_.els.stepBtn.disabled=!1)}function I(_){for(var R=0;R<l.length;R++){var P=l[R].cell;if(P.out&&P.out.indexOf(_)!==-1||P.bind===_)return P.id}return null}function de(_){var R=Re("div","margin:14px 0;border:1px solid #1d1d1d;border-radius:6px;background:#111;overflow:hidden;");R.setAttribute("data-cell-id",_.id||""),R.setAttribute("data-cell-type",_.type||""),_.lane&&R.setAttribute("data-cell-lane",_.lane);var P=Re("div","display:flex;align-items:center;gap:8px;padding:6px 10px;background:#161616;border-bottom:1px solid #1d1d1d;"),$=Re("span","font:600 0.62rem/1 ui-monospace,monospace;color:#777;text-transform:uppercase;letter-spacing:0.06em;",_.type+(_.lane?"·"+_.lane:""));P.appendChild($),_.id&&P.appendChild(Re("span","font:0.62rem/1 ui-monospace,monospace;color:#555;",_.id));var U=Re("div","flex:1;");P.appendChild(U);var H=Re("span","","idle");return H.setAttribute("data-role","status-badge"),P.appendChild(H),R.appendChild(P),{card:R,header:P,statusBadge:H}}function fe(_,R){_._collapsibleEls=R||[];var P=Re("button","flex:0 0 auto;width:18px;height:18px;padding:0;line-height:1;background:transparent;border:none;color:#888;cursor:pointer;font:0.8rem/1 ui-monospace,monospace;","");return P.setAttribute("data-role","collapse-toggle"),P.title="collapse / expand cell",_.els.collapseBtn=P,P.addEventListener("click",function($){$.stopPropagation(),_.cell.collapsed=!_.cell.collapsed,Ie(_),m()}),P}function Ie(_){for(var R=!!_.cell.collapsed,P=_._collapsibleEls||[],$=0;$<P.length;$++)P[$]&&(P[$].style.display=R?"none":"");_.els.collapseBtn&&(_.els.collapseBtn.textContent=R?"▸":"▾"),_.els.card&&_.els.card.setAttribute("data-collapsed",R?"true":"false")}function Ft(_){var R=Re("button","padding:5px 14px;background:#1f6f3f;color:#fff;border:none;border-radius:4px;cursor:pointer;font:600 0.78rem/1 system-ui,sans-serif;",_);return R.setAttribute("data-role","cell-run"),R}function cn(_){var R={cell:_,els:{},editor:null,canvas:null,chart:null},P=Re("div","margin:10px 0;border:1px solid #1b1b1b;border-radius:6px;overflow:hidden;");P.setAttribute("data-cell-id",_.id||""),P.setAttribute("data-cell-type","markdown"),R.els.card=P;var $=Re("div","padding:2px 10px;");$.className="markdown-body frqtl-md",$.setAttribute("data-theme","dark"),$.setAttribute("data-role","md-view"),$.innerHTML=Ax(_.body),$.title="click or press Enter to edit",$.style.cursor="text";var U=Re("div","display:none;height:180px;margin:8px 10px;border:1px solid #222;border-radius:4px;overflow:hidden;"),H;function he(){if(R.editor){var qe=R.editor.activeFile();if(qe){var nn=_.body;_.body=qe.value,$.innerHTML=Ax(_.body),_.body!==nn&&m()}try{U.innerHTML=""}catch{}R.editor=null,U.style.display="none",$.style.display="",d=!1,H&&(H.innerHTML="✎ Edit",H.title="edit this markdown cell")}}function Ae(){if(!R.editor){R.cell.collapsed&&(R.cell.collapsed=!1,Ie(R)),kt(_.id),d=!0,$.style.display="none",U.style.display="",R.editor=T(U,{showRun:!1}),R.editor.openFile({id:_.id||"md-"+Math.random(),language:"markdown",kind:"math",value:_.body}),R.editor.onRunAdvance(function(qe,nn){if(qe){var F=_.body;_.body=qe.value,_.body!==F&&m()}ht(R,nn||"advance")});try{U.addEventListener("keydown",function(qe){qe.key==="Escape"&&(qe.stopPropagation(),he())})}catch{}H&&(H.innerHTML="✓ Done",H.title="finish editing (Esc)")}}R.openEditor=Ae,R.closeEditor=he,$.addEventListener("click",Ae),$.addEventListener("dblclick",Ae);var Ve=Re("div","display:flex;align-items:center;gap:8px;padding:5px 10px;background:#141414;border-bottom:1px solid #1b1b1b;"),Qe=Re("div","");Qe.appendChild($),Qe.appendChild(U);var Be=fe(R,[Qe]);Ve.appendChild(Be),Ve.appendChild(Re("span","font:600 0.62rem/1 ui-monospace,monospace;color:#777;text-transform:uppercase;letter-spacing:0.06em;","markdown"));var Ce=Re("div","flex:1;");return Ve.appendChild(Ce),H=Re("button","flex:0 0 auto;padding:3px 9px;background:#1e1e1e;color:#bbb;border:1px solid #333;border-radius:4px;cursor:pointer;font:0.7rem/1 system-ui,sans-serif;","✎ Edit"),H.setAttribute("data-role","md-edit"),H.title="edit this markdown cell",H.addEventListener("click",function(qe){qe.stopPropagation(),R.editor?he():Ae()}),Ve.appendChild(H),P.appendChild(Ve),P.appendChild(Qe),Ie(R),_n(R),R}function Xe(_){var R=de(_),P={cell:_,els:{card:R.card,statusBadge:R.statusBadge},editor:null,canvas:null,chart:null},$=Re("span","font:600 0.6rem/1 ui-monospace,monospace;padding:3px 7px;border-radius:3px;background:#13202b;color:#7fc4ff;display:none;");$.setAttribute("data-role","backend-badge"),R.header.insertBefore($,R.statusBadge),P.els.backendBadge=$;var U=Re("div","height:150px;border-bottom:1px solid #1d1d1d;");R.card.appendChild(U),P.editor=T(U),P.editor.openFile({id:_.id,language:"javascript",kind:_.lane==="frqtl"?"frqtl":"math",value:_.body});var H=Re("div","display:flex;align-items:center;gap:8px;padding:6px 10px;background:#0e0e0e;"),he=Ft("Run");he.addEventListener("click",function(){kt(_.id),ht(P,"inplace")}),H.appendChild(he),P.els.runBtn=he,_.in&&_.in.length&&H.appendChild(Re("span","font:0.68rem/1 ui-monospace,monospace;color:#777;","in: "+_.in.join(", "))),_.out&&_.out.length&&H.appendChild(Re("span","font:0.68rem/1 ui-monospace,monospace;color:#777;","out: "+_.out.join(", "))),R.card.appendChild(H);var Ae=Re("div","max-height:320px;overflow:auto;background:#0b0b0b;border-top:1px solid #1d1d1d;");P.els.output=Ae,R.card.appendChild(Ae),P.output=B(Ae),P.editor.onRun(function(){kt(_.id),ht(P,"inplace")}),P.editor.onRunAdvance(function(Ve,Qe){kt(_.id),ht(P,Qe||"advance")}),P.editor.onContentChange(m);try{U.addEventListener("focusin",function(){kt(_.id),d=!0}),U.addEventListener("focusout",function(){u===_.id&&(d=!1)})}catch{}return R.header.insertBefore(fe(P,[U,H,Ae]),R.header.firstChild),Ie(P),_n(P),P}function un(_){var R=de(_),P={cell:_,els:{card:R.card,statusBadge:R.statusBadge},editor:null,canvas:null,chart:null};if(_.name){var $=Re("span","font:0.62rem/1 ui-monospace,monospace;color:#7fc4ff;",_.name);R.header.insertBefore($,R.statusBadge)}R.statusBadge.textContent="module";var U=Re("div","height:220px;border-top:1px solid #1d1d1d;");return R.card.appendChild(U),P.editor=T(U),P.editor.openFile({id:_.name||_.id||"mod-"+Math.random(),language:"javascript",kind:"frqtl",value:_.body}),P.editor.onContentChange(m),R.header.insertBefore(fe(P,[U]),R.header.firstChild),Ie(P),_n(P),P}function Pe(_){var R=de(_),P={cell:_,els:{card:R.card,statusBadge:R.statusBadge},editor:null,realm:null,chart:null,liveChart:null,viewController:null},$=Wn(_),U=An(_),H=Re("div","display:flex;align-items:center;gap:8px;padding:6px 10px;background:#0e0e0e;"),he=Ft($||U?"Render":"Run");if(he.addEventListener("click",function(){kt(_.id),ht(P,"inplace")}),P.els.runBtn=he,H.appendChild(he),!$&&!U){var Ae=Re("button","padding:5px 14px;background:#2a2a2a;color:#ddd;border:1px solid #333;border-radius:4px;cursor:pointer;font:600 0.78rem/1 system-ui,sans-serif;","Stop");Ae.disabled=!0,Ae.addEventListener("click",function(){P.realm&&P.realm.handle.stop()}),P.els.stopBtn=Ae;var Ve=Re("button","padding:5px 14px;background:#2a2a2a;color:#ddd;border:1px solid #333;border-radius:4px;cursor:pointer;font:600 0.78rem/1 system-ui,sans-serif;","Step");Ve.disabled=!0,Ve.addEventListener("click",function(){P.realm&&P.realm.handle.step()}),P.els.stepBtn=Ve,H.appendChild(Ae),H.appendChild(Ve)}else $&&_.spec?H.appendChild(Re("span","font:0.68rem/1 ui-monospace,monospace;color:#777;","spec: "+_.spec)):U&&_.module&&H.appendChild(Re("span","font:0.68rem/1 ui-monospace,monospace;color:#777;","view: "+_.module));_.bind&&H.appendChild(Re("span","font:0.68rem/1 ui-monospace,monospace;color:#777;","binds: "+_.bind)),U&&_.in&&_.in.length&&H.appendChild(Re("span","font:0.68rem/1 ui-monospace,monospace;color:#777;","in: "+_.in.join(", "))),R.card.appendChild(H);var Qe=$||U?"padding:10px;background:#0b0b0b;":"width:480px;max-width:100%;height:480px;margin:0 auto;background:#000;",Be=Re("div",Qe);if(P.els.realmHost=Be,U){Be.setAttribute("style","display:flex;flex-direction:column;gap:6px;padding:10px;background:#0b0b0b;");var Ce=Re("div","width:100%;min-height:0;"),qe=Re("div","min-height:48px;background:#0b0b0b;");return qe.setAttribute("data-role","view-mount"),Be.appendChild(Ce),Be.appendChild(qe),P.els.gfxHost=Ce,P.els.viewMount=qe,R.card.appendChild(Be),R.header.insertBefore(fe(P,[H,Be]),R.header.firstChild),Ie(P),_n(P),P}var nn=!$&&!!_.liveChart;if(nn){Be.setAttribute("style","width:480px;max-width:100%;margin:0 auto;display:flex;flex-direction:column;background:#000;");var F=Re("div","width:480px;max-width:100%;height:480px;background:#000;"),K=Re("div","max-height:240px;padding:8px;background:#0b0b0b;");K.setAttribute("data-role","live-chart-host"),Be.appendChild(F),Be.appendChild(K),P.els.gfxHost=F,P.els.liveChartHost=K}else P.els.gfxHost=Be;return R.card.appendChild(Be),R.header.insertBefore(fe(P,[H,Be]),R.header.firstChild),Ie(P),_n(P),P}function Mt(){if(!s||S)return Promise.resolve(null);S=!0,E&&(E.disabled=!0),C&&(C.style.color="#888",C.textContent="running…");for(var _=0;_<l.length;_++){var R=l[_];if(R.editor&&R.cell&&R.cell.type==="js"){var P=R.editor.activeFile();P&&typeof P.value=="string"&&(R.cell.body=P.value)}}je();var $=function(H){var he=c[H];return function(Ae){!he||!he.output||(Ae&&typeof Ae=="object"&&typeof Ae.nodeType=="number"?he.output.node(Ae):typeof Ae=="string"?he.output.line(Ae,"log"):he.output.line(me(Ae),"log"))}},U=function(H){if(!H||H.type!=="canvas"&&H.type!=="chart"&&H.type!=="view")return null;var he=c[H.id];return he?Mn(he).then(function(){var Ae=s?s.getCellState(H.id):null,Ve=!Ae||Ae.status!==br.ERROR;return Ve?{ok:!0}:{ok:!1,error:'realm cell "'+H.id+'" failed to start.'}}):Promise.resolve({ok:!1,error:'no render record for realm cell "'+H.id+'"'})};return ee(),s.runAll({displayFor:$,runner:U}).then(function(H){return C&&(H&&H.ok?(C.style.color="#7ee2a8",C.textContent="all "+H.total+" cells OK"):H&&(C.style.color="#ff8a8a",C.textContent='STOPPED at cell "'+H.failedCellId+'" ('+H.ran+" of "+H.total+") — "+(H.error||"error"))),H}).catch(function(H){return C&&(C.style.color="#ff8a8a",C.textContent="Run All failed: "+(H&&H.message?H.message:String(H))),null}).finally(function(){ce(),L=null,S=!1,E&&(E.disabled=!1)})}function Wt(){ke(),ce(),St(),u=null,d=!1;var _=h;if(h=!1,_)for(var R=0;R<v.length;R++)try{v[R](!1)}catch{}if(x&&(Ee.off("notebook:cellstate",x),x=null),k&&(Ee.off("notebook:runall",k),k=null),b){try{b()}catch{}b=null}for(var P=0;P<l.length;P++){var $=l[P];if($.editor){if(typeof $.editor.dispose=="function")try{$.editor.dispose()}catch{}$.editor=null}if($.output&&typeof $.output.dispose=="function"){try{$.output.dispose()}catch{}$.output=null}}s&&(s.dispose(),s=null),a=null,l=[],c=Object.create(null),L=null,S=!1,E&&(E.disabled=!1),C&&(C.textContent=""),N.innerHTML=""}function Dn(_){var R=_&&_.message?_.message:String(_);uz.error("[NotebookPane] load failed: "+R),r&&r("error","notebook load failed: "+R),Wt();var P=Re("pre","margin:0;padding:12px 14px;background:#2a0c0c;color:#ff8a8a;border:1px solid #5a1a1a;border-radius:4px;font:12px/1.5 ui-monospace,Menlo,Consolas,monospace;white-space:pre-wrap;word-break:break-word;",`Notebook load failed — nothing from this document is shown.
|
|
160
|
-
|
|
161
|
-
`+R);return P.setAttribute("data-role","notebook-load-error"),N.appendChild(P),_}function lt(_){return new Promise(function(R,P){try{Wt();var $=BR(_);a=$,s=new WR($,{runtime:ci,bus:Ee}),$.cells.forEach(function(U){var H;switch(U.type){case"markdown":H=cn(U);break;case"js":H=Xe(U);break;case"module":H=un(U);break;case"canvas":H=Pe(U);break;case"chart":H=Pe(U);break;case"view":H=Pe(U);break;default:H={cell:U,els:{},editor:null,canvas:null,chart:null},H.els.card=Re("pre","color:#ff8a8a;padding:8px;",'[unknown cell type "'+U.type+'"]')}l.push(H),U.id&&(c[U.id]=H),N.appendChild(H.els.card)}),x=function(U){U&&U.cellId&&re(U.cellId,U.status)},Ee.on("notebook:cellstate",x),k=function(U){if(U&&U.phase==="running"){L=U.cellId;var H=c[U.cellId];H&&H.output&&typeof H.output.clear=="function"&&H.output.clear(),C&&S&&(C.style.color="#7fc4ff",C.textContent="running cell "+U.index+" of "+U.total+" ("+U.cellId+")")}},Ee.on("notebook:runall",k),b=st.subscribe(function(){W()}),W(),ye(),d=!1,l.length&&l[0].cell&&kt(l[0].cell.id),R()}catch(U){P(Dn(U))}})}function we(_){return fetch(_).then(function(R){if(!R.ok)throw new Error("[NotebookPane] failed to fetch notebook "+_+": HTTP "+R.status);return R.text()}).catch(function(R){throw Dn(R)}).then(function(R){return lt(R)})}function pt(){Wt(),v=[]}return{load:lt,loadUrl:we,destroy:pt,runAll:Mt,setMath:function(_){W()},getBinding:function(_){return s?s.getBinding(_):null},serialize:function(){if(!a)throw new Error("[NotebookPane] serialize() called before any notebook was loaded.");for(var _=0;_<l.length;_++){var R=l[_];if(R.editor){var P=R.editor.activeFile();P&&typeof P.value=="string"&&(R.cell.body=P.value)}}return HR(a)},isDirty:function(){return h},onDirtyChange:function(_){typeof _=="function"&&v.push(_)}}}typeof window<"u"&&(window.NotebookPane=dz);function fz({notebookBase:e,monacoBaseUrl:t,markdownCssUrl:n,mathUrls:r,initialNotebook:i,onLinkSelect:o,frqtlEngine:s,frqtlMode:a,audience:l,deepLinkRefusal:c}){var[u,d]=j.useState(null),[f,h]=j.useState(null),[v,m]=j.useState(null),[x,b]=j.useState(c||null),[g,k]=j.useState(""),E=j.useRef(null),C=j.useRef(null),S=j.useRef(null),M=j.useRef(e||"/notebooks");j.useEffect(function(){var N=e||"/notebooks";M.current=N;var te=N+"/notebooks.json";fetch(te).then(function(W){if(!W.ok)throw new Error("[NotebookBrowser] notebook index fetch failed ("+W.status+"): "+te);return W.json()}).then(function(W){if(!W||!Array.isArray(W.notebooks))throw new Error("[NotebookBrowser] notebooks.json has no notebooks[] array (FAIL-LOUD): "+te);d(W)}).catch(function(W){h(W.message)})},[]),j.useEffect(function(){var N=E.current;if(!(!N||C.current)){if(typeof window.NotebookPane>"u"){b("[NotebookBrowser] NotebookPane not loaded.");return}return C.current=new window.NotebookPane({mountEl:N,monacoBaseUrl:t,markdownCssUrl:n,frqtl:{engine:s||"wasm",mode:a},onConsole:function(te,W){k((te==="error"?"⚠ ":"")+W)}}),typeof window<"u"&&l!=="public"&&(window.__frqtlNotebookPane=C.current),ci.ensureMath({mathSdkUrl:r&&r.mathSdkUrl,mathWasmUrl:r&&r.mathWasmUrl,mathWasmModuleUrl:r&&r.mathWasmModuleUrl,mathBackend:r&&r.mathBackend}).then(function(te){S.current=te,C.current&&C.current.setMath(te)}).catch(function(te){b("[NotebookBrowser] math seam init failed: "+(te&&te.message?te.message:String(te)))}),function(){try{C.current&&C.current.destroy&&C.current.destroy()}catch{}C.current=null}}},[]),j.useEffect(function(){if(!(!u||v)&&!c){if(i){var N=u.notebooks.find(function(W){return W.id===i});if(N){L(N);return}b('Deep link error: unknown notebook "'+i+'" — not in the served notebook catalog (notebooks.json). Pick one from the sidebar.');return}var te;try{te=yT(u)}catch(W){console.error(W),b(W.message);return}L(te)}},[u]);function L(N){if(C.current){m(N.id),typeof o=="function"&&o("notebook",N.id),b(null),k(""),S.current&&C.current.setMath(S.current);var te=M.current+"/"+N.file;C.current.loadUrl(te)}}var T=[];if(u&&Array.isArray(u.notebooks)){var V={},G=[];u.notebooks.forEach(function(N){var te=N.group||"Other";V[te]||(V[te]=[],G.push(te)),V[te].push(N)}),T=G.map(function(N){return{name:N,entries:V[N]}})}return y.jsxs("div",{style:En.root,children:[y.jsxs("div",{style:En.sidebar,children:[y.jsx("div",{style:En.panelTitle,children:"Notebooks"}),f&&y.jsx("div",{style:En.errBanner,children:f}),!u&&!f&&y.jsx("div",{style:En.emptyMsg,children:"loading…"}),u&&T.map(function(N){return y.jsxs("div",{children:[y.jsx("div",{style:En.groupLabel,children:N.name}),N.entries.map(function(te){return y.jsx("button",{style:Object.assign({},En.catalogItem,te.id===v?En.catalogItemActive:{}),onClick:function(){L(te)},title:te.id,children:te.title},te.id)})]},N.name)})]}),y.jsxs("div",{style:En.notebookCol,children:[y.jsxs("div",{style:En.toolbar,children:[y.jsx("span",{style:En.projectName,children:v?(u&&u.notebooks.find(function(N){return N.id===v})||{}).title||v:"Select a notebook"}),g&&y.jsx("span",{style:En.statusLine,children:g})]}),x&&y.jsx("div",{style:En.errBanner,children:x}),!v&&!x&&y.jsx("div",{style:En.placeholder,children:"Pick a notebook from the sidebar. Each cell runs on demand — nothing auto-triggers on load."}),y.jsx("div",{style:En.paneHost,ref:E})]})]})}var En={root:{display:"flex",flexDirection:"row",height:"100%",overflow:"hidden",background:"#111",color:"#aaa",fontFamily:"ui-monospace,Menlo,Consolas,monospace"},sidebar:{width:"220px",flexShrink:0,borderRight:"1px solid #222",display:"flex",flexDirection:"column",overflowY:"auto"},panelTitle:{font:"700 10px ui-monospace,Menlo,Consolas,monospace",color:"#555",padding:"8px 8px 4px",textTransform:"uppercase",letterSpacing:"0.5px",flexShrink:0},groupLabel:{font:"9px ui-monospace,Menlo,Consolas,monospace",color:"#444",padding:"6px 8px 2px",textTransform:"uppercase",letterSpacing:"0.3px"},catalogItem:{display:"block",width:"100%",textAlign:"left",padding:"4px 8px",font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#777",background:"none",border:"none",borderBottom:"1px solid #1a1a1a",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},catalogItemActive:{color:"#7ec8e3",background:"#161622"},notebookCol:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:0},toolbar:{display:"flex",alignItems:"center",gap:"8px",padding:"4px 8px",borderBottom:"1px solid #222",flexShrink:0,background:"#111"},projectName:{font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#888",flexShrink:0},statusLine:{font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#555",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},errBanner:{background:"#2a1111",color:"#cc4444",font:"10px ui-monospace,Menlo,Consolas,monospace",padding:"4px 8px",borderBottom:"1px solid #3a1111",flexShrink:0},placeholder:{font:"11px ui-monospace,Menlo,Consolas,monospace",color:"#444",padding:"16px",fontStyle:"italic"},paneHost:{flex:1,overflow:"auto",minHeight:0},emptyMsg:{font:"10px ui-monospace,Menlo,Consolas,monospace",color:"#333",padding:"6px 8px",fontStyle:"italic"}},Po={TABS:"tabs",STACK:"stack",SPLIT2:"split-2",SPLIT3:"split-3"},au={IDE:"ide",SIM:"sim",NOTEBOOK:"notebook"},t0={ide:{editor:"left-top",console:"left-bot",graphics:"right-top",data:"right-bot"},sim:{"sim-nav":"full",graphics:"right-top",console:"right-bot",data:"right-bot",editor:"sidebar"},notebook:{notebook:"full",graphics:"right-top",console:"right-bot",data:"right-bot",editor:"sidebar"}},et=Object.create(null),mn=null,Ei=null,qr=null,sc=Po.TABS,gv=null,Ma=null,fl=null,Xn=null,Br=null,ui=null,ti=null,hl=null,di=null,zo=null,Gi=null,Rr=null,fi=null;function hz(e){if(mn&&mn.parentNode&&mn.parentNode.removeChild(mn),et=Object.create(null),fl=null,mn=document.createElement("div"),mn.id="pane-host-root",qr=document.createElement("div"),qr.className="ph-tabbar",mn.appendChild(qr),Ei=document.createElement("div"),Ei.className="ph-body",mn.appendChild(Ei),Xn=n0("left"),hl=lu("left-top"),zo=r0(),di=lu("left-bot"),Xn.appendChild(hl),Xn.appendChild(zo),Xn.appendChild(di),ui=pz(),Br=n0("right"),Gi=lu("right-top"),fi=r0(),Rr=lu("right-bot"),Br.appendChild(Gi),Br.appendChild(fi),Br.appendChild(Rr),Ei.appendChild(Xn),Ei.appendChild(ui),Ei.appendChild(Br),ti=document.createElement("div"),ti.className="ph-fs-overlay",ti.style.display="none",mn.appendChild(ti),e.appendChild(mn),Gh(ui,"horizontal",Xn,Br),Gh(zo,"vertical",hl,di),Gh(fi,"vertical",Gi,Rr),typeof ResizeObserver<"u"){var t=new ResizeObserver(wz);t.observe(Ei)}}function n0(e){var t=document.createElement("div");return t.className="ph-col ph-col--"+e,t}function lu(e){var t=document.createElement("div");return t.className="ph-row ph-row--"+e,t}function pz(){var e=document.createElement("div");return e.className="ph-divider ph-divider--v",e.setAttribute("role","separator"),e.setAttribute("aria-orientation","vertical"),e}function r0(){var e=document.createElement("div");return e.className="ph-divider ph-divider--h",e.setAttribute("role","separator"),e.setAttribute("aria-orientation","horizontal"),e}function mz(e){if(!e||!e.id)throw new Error("[PaneHost] register: opts.id required");if(!e.mount)throw new Error("[PaneHost] register: opts.mount required");if(et[e.id])throw new Error('[PaneHost] register: duplicate id "'+e.id+'"');var t=document.createElement("div");t.className="ph-pane-content ph-pane-content--"+e.id,t.setAttribute("data-pane-id",e.id);var n=document.createElement("div");n.className="ph-slot ph-slot--"+e.id,n.setAttribute("data-slot-pane-id",e.id),n.appendChild(t);var r={show:function(){no(e.id)},hide:function(){Ad(e.id)},resize:function(o,s){gE(e.id,o,s)}},i={id:e.id,title:e.title,kind:e.kind||null,opts:e,el:t,slotEl:n,tabBtn:null,handle:r,mounted:!1};et[e.id]=i,Jo(i,"right-top");try{e.mount(t),i.mounted=!0}catch(o){console.error('[PaneHost] mount("'+e.id+'") threw:',o)}return gz(i),r}function gz(e){var t=document.createElement("button");t.className="ph-tab",t.textContent=e.title,t.setAttribute("data-pane-id",e.id),t.setAttribute("type","button"),t.addEventListener("click",function(){hE(e.id)}),qr.appendChild(t),e.tabBtn=t}function cE(e){for(var t=Object.keys(et),n=0;n<t.length;n++){var r=et[t[n]];r.tabBtn&&r.tabBtn.classList.toggle("active",t[n]===e)}var i=document.getElementById("pane-host-tabbar");i&&i.querySelectorAll("[data-pane-id]").forEach(function(o){o.classList.toggle("active",o.getAttribute("data-pane-id")===e)})}function Jo(e,t){var n=vz(t);n&&e.slotEl.parentNode!==n&&n.appendChild(e.slotEl)}function vz(e){switch(e){case"left-top":return hl;case"left-bot":return di;case"right-top":return Gi;case"right-bot":return Rr;case"sidebar":return Xn;case"full":return Ei;default:return Gi}}function no(e){var t=et[e];t&&(t.slotEl.style.display="",gv=e,Md(t.opts.onShow),ca("pane:show",{paneId:e}),vv(e))}function Ad(e){var t=et[e];t&&(t.slotEl.style.display="none",Md(t.opts.onHide),ca("pane:hide",{paneId:e}))}function yz(e){sc=e,uE(),ca("pane:layout",{mode:e}),ia()}function uE(){switch(sc){case Po.TABS:i0();break;case Po.STACK:bz();break;case Po.SPLIT2:xz();break;case Po.SPLIT3:fE();break;default:i0()}}function i0(){mn.className="ph-mode-tabs",qr.style.display="",Xn.style.display="none",ui.style.display="none",Br.style.cssText="flex:1;",Rr.style.display="none",fi.style.display="none",Gi.style.cssText="flex:1;";for(var e=Object.keys(et),t=0;t<e.length;t++)Jo(et[e[t]],"right-top");var n=gv||(e.length?e[0]:null);n&&dE(n)}function dE(e){for(var t=Object.keys(et),n=0;n<t.length;n++)t[n]===e?no(t[n]):Ad(t[n]);gv=e,cE(e)}function bz(){mn.className="ph-mode-stack",qr.style.display="none",Xn.style.display="none",ui.style.display="none",Br.style.cssText="flex:1;flex-direction:column;",Gi.style.cssText="flex:1;",Rr.style.display="",fi.style.display="";for(var e=Object.keys(et),t=0;t<e.length;t++)Jo(et[e[t]],t<Math.ceil(e.length/2)?"right-top":"right-bot"),no(e[t])}function xz(){mn.className="ph-mode-split-2",qr.style.display="none",Xn.style.display="",Xn.style.cssText="flex:1;",ui.style.display="",Br.style.cssText="flex:1;",di.style.display="",zo.style.display="",Rr.style.display="",fi.style.display="";for(var e=Object.keys(et),t=0;t<e.length;t++){var n=Pd(e[t])||(t%2===0?"left-top":"right-top");Jo(et[e[t]],n),no(e[t])}}function fE(){mn.className="ph-mode-split-3",qr.style.display="none",Xn.style.display="",Xn.style.cssText="flex:0 0 38%;",ui.style.display="",Br.style.cssText="flex:1;",hl.style.cssText="flex:2;",di.style.display="",di.style.cssText="flex:1;max-height:220px;",zo.style.display="",Gi.style.cssText="flex:3;",Rr.style.display="",Rr.style.cssText="flex:1;max-height:200px;",fi.style.display="";for(var e=Object.keys(et),t=0;t<e.length;t++){var n=Pd(e[t])||"right-top";Jo(et[e[t]],n),no(e[t])}}function hE(e){et[e]&&(sc===Po.TABS?dE(e):(no(e),cE(e)),ca("pane:focus",{paneId:e}))}function pE(e,t){var n=et[e];if(n)if(t){Ma&&pE(Ma,!1),Ma=e;for(var r=Object.keys(et),i=0;i<r.length;i++)r[i]!==e&&(et[r[i]].slotEl.style.display="none");ti.innerHTML="",ti.appendChild(n.el),ti.style.display="",n.slotEl.style.display="none",Md(n.opts.onFullscreen,!0),vv(e)}else{if(Ma!==e)return;Ma=null,n.slotEl.appendChild(n.el),ti.style.display="none",ti.innerHTML="",uE(),Md(n.opts.onFullscreen,!1),ia()}}function mE(e){switch(fl=e,e){case au.IDE:sc=Po.SPLIT3,fE();break;case au.SIM:mn.className="ph-mode-sim",ui.style.display="none",di.style.display="none",zo.style.display="none",Rr.style.display="none",fi.style.display="none",qr.style.display="none";for(var t=Object.keys(et),n=0;n<t.length;n++){var r=t[n],i=Pd(r)||"right-top";Jo(et[r],i),i==="full"?(no(r),et[r].slotEl.style.cssText="position:absolute;inset:0;overflow:hidden;"):Ad(r)}break;case au.NOTEBOOK:mn.className="ph-mode-sim",ui.style.display="none",di.style.display="none",zo.style.display="none",Rr.style.display="none",fi.style.display="none",qr.style.display="none";for(var o=Object.keys(et),s=0;s<o.length;s++){var a=o[s],l=Pd(a)||"right-top";Jo(et[a],l),l==="full"?(no(a),et[a].slotEl.style.cssText="position:absolute;inset:0;overflow:hidden;"):Ad(a)}break;default:console.warn('[PaneHost] unknown preset "'+e+'" — using ide'),mE(au.IDE);return}ca("pane:layout",{mode:e}),ia()}function Pd(e){return!fl||!t0[fl]?null:t0[fl][e]||null}function gE(e,t,n){var r=et[e];if(r){if(typeof r.opts.onResize=="function")try{r.opts.onResize(t,n)}catch{}ca("pane:resize",{paneId:e,w:t,h:n})}}function vv(e){var t=et[e];if(!(!t||t.slotEl.style.display==="none")){var n=t.el.getBoundingClientRect();gE(e,Math.round(n.width),Math.round(n.height))}}function ia(){requestAnimationFrame(function(){for(var e=Object.keys(et),t=0;t<e.length;t++)vv(e[t])})}function wz(){ia()}function Gh(e,t,n,r){var i=!1,o=0,s=0,a=80;e.addEventListener("pointerdown",function(l){i=!0,o=t==="horizontal"?l.clientX:l.clientY,s=t==="horizontal"?n.getBoundingClientRect().width:n.getBoundingClientRect().height,e.setPointerCapture(l.pointerId),e.classList.add("dragging"),l.preventDefault()}),e.addEventListener("pointermove",function(l){if(i){var c=(t==="horizontal"?l.clientX:l.clientY)-o,u=Math.max(a,s+c),d=t==="horizontal"?"width":"height",f=n.parentNode,h=f?f.getBoundingClientRect():null;if(h){var v=t==="horizontal"?h.width:h.height,m=Math.max(a,v-u-e.getBoundingClientRect()[t==="horizontal"?"width":"height"]);n.style.flex="none",n.style[d]=u+"px",r.style.flex="none",r.style[d]=m+"px"}}}),e.addEventListener("pointerup",function(l){i&&(i=!1,e.classList.remove("dragging"),e.releasePointerCapture(l.pointerId),ia())}),e.addEventListener("pointercancel",function(){i=!1,e.classList.remove("dragging"),ia()})}function Md(e){if(typeof e=="function"){var t=Array.prototype.slice.call(arguments,1);try{e.apply(null,t)}catch{}}}function ca(e,t){Ee.emit(e,t)}var _z={_init:hz,register:mz,layout:yz,focus:hE,fullscreen:pE,preset:mE,_panes:function(){return et},_mode:function(){return sc}};typeof window<"u"&&(window.PaneHost=_z);function vE(){const e=j.useCallback(n=>st.subscribe(n),[]),t=j.useCallback(()=>{let n="none";try{n=st.active().id}catch{}return st.registeredIds().join("|")+"@"+n},[]);j.useSyncExternalStore(e,t,t)}function kz({onClick:e}){vE();const t=st.registeredIds(),n=(()=>{try{return st.active().id}catch{return"none"}})(),r=t.length>=2?t.map(i=>i===n?`[${i}]`:i).join(" | "):n;return y.jsx("button",{id:"frqtl-ide-engine-badge",className:"ph-toolbar-btn",type:"button",title:"Math backends: "+t.join(", ")+" — active: "+n+". Click to open Math Bench.",onClick:e,style:{fontSize:"0.62rem",color:"#3a3a3a",letterSpacing:"0.3px",cursor:"pointer"},children:r})}function Sz(){vE();const e=st.registeredIds(),t=(()=>{try{return st.active().id}catch{return"none"}})();function n(r){const i=r.target.value;if(!(!i||i===t))try{st.select(i)}catch(o){console.error("[FraqtlIde] Math backend switch failed:",o)}}return e.length<2?y.jsx("span",{id:"frqtl-ide-backend-selector",style:{fontSize:"0.62rem",color:"#3a3a3a",letterSpacing:"0.3px",padding:"2px 4px"},title:"Math backend (only js-reference loaded)",children:t}):y.jsx("select",{id:"frqtl-ide-backend-selector",className:"ph-toolbar-select",value:t,onChange:n,title:"Select math backend (internal IDE)",style:{background:"#1a1a1a",color:t==="wasm-math"?"#7ec8e3":"#888",border:"1px solid #2a2a2a",fontSize:"0.65rem",padding:"2px 4px",cursor:"pointer",borderRadius:"2px"},children:e.map(r=>y.jsx("option",{value:r,children:r},r))})}function Ez({engine:e="wasm",mode:t="dev-core",mathSdkUrl:n,onLinkChange:r,audience:i,...o}){const s=Zd(i),a=j.useRef(null),[l]=j.useState(IL);j.useEffect(function(){NL(a.current,l)},[l]);const[c]=j.useState(function(){return HL(o)}),[u,d]=j.useState(function(){return hd(c,s)}),[f,h]=j.useState(function(){return oS(c)}),[v,m]=j.useState(function(){return WL(c,hd(c,s))}),x=j.useRef(null),[b]=j.useState(function(){return gT(document)}),[g,k]=j.useState({bag:null,error:null}),E=j.useRef(!1);j.useEffect(function(){const ie=b.load(u);if(!ie)return;let me=!0;return ie.then(function(xe){me&&k({bag:xe,error:null})},function(xe){if(me&&k({bag:null,error:xe}),!E.current)throw E.current=!0,xe}),function(){me=!1}},[u,b]);const[C]=j.useState(function(){return Bk(window)}),S=j.useRef(null),M=j.useRef(null);M.current=f[at.compare]||null,j.useEffect(function(){const ie=x.current,me=M.current;if(u===at.compare&&me&&me.initialWalkthrough)return ie.dataset.runOnceDeferred="gym-scene-card",function(){delete ie.dataset.runOnceDeferred};if(!hL(s)){const ge=Us(ie,Ig(u),"not-offered-audience","audience "+s);return function(){ge.close()}}if(!Fg[u])throw new Error('[FraqtlIde] public audience reached preset "'+u+'", which has no PRESET_EXPLAINERS row — gateForAudience should make this unreachable.');const xe=Pl(ie,mL(u,{onPhone:C}),{covers:S.current});return function(){xe.close()}},[u,s,C]);const L=j.useCallback(function(ie,me){h(function(xe){return VL(xe,u,ie,me)})},[u]),T=j.useCallback(function(){h(function(ie){return $L(ie,at.compare,at.author)}),re(at.author)},[s]),V=j.useRef(r);V.current=r;const G=f[u];j.useEffect(function(){typeof V.current=="function"&&V.current(iS(G,u))},[u,G]);const N=j.useMemo(()=>Ag({mode:t,engine:e,mathSdkUrl:n}),[t,e,n]),te=N.resolve("experiments/").replace(/\/$/,""),W=N.resolve("assets/vendor/monaco/vs"),Y=N.resolve("assets/vendor/github-markdown-css/github-markdown.css");j.useEffect(()=>{if(!a.current)return;const ie=a.current.querySelector("#frqtl-ide-pane-body");!ie||!window.PaneHost||(window.PaneHost._init(ie),ci.init({engine:e,mathSdkUrl:n,_routerMathSdkUrl:N.mathSdkUrl,_routerMathWasmUrl:N.mathWasmUrl,_routerMathWasmModuleUrl:N.mathWasmModuleUrl,_routerMathBackend:N.mathBackend,_router:N}).then(function(){console.log("[FraqtlIde] Runtime initialized")}).catch(function(me){console.error("[FraqtlIde] Runtime init error:",me)}))},[]);function re(ie){const me=zk(ie,s);me!==u&&m(null),d(me)}function pe(ie){return g.error?{panelStyle:{display:"none"},overlay:y.jsx("div",{"data-role":"ide-roster-error","data-egpt-boot-error":"1",style:{position:"absolute",inset:0,background:"#1a0000",color:"#ff6b6b",font:"13px/1.55 ui-monospace,Menlo,Consolas,monospace",padding:"22px",whiteSpace:"pre-wrap",overflow:"auto",borderTop:"2px solid #b6161c"},children:"IDE BOOT FAILED — "+(Al[ie]||ie)+` reads this site's scene roster, and it did not load.
|
|
162
|
-
|
|
163
|
-
`+(g.error&&g.error.message?g.error.message:String(g.error))+`
|
|
164
|
-
|
|
165
|
-
The surface is intentionally not mounted.`})}:g.bag?null:{panelStyle:{display:"none"},overlay:y.jsx("div",{"data-role":"ide-roster-loading",style:{padding:"12px",color:"#886"},children:"Loading the scene roster…"})}}function B(ie){if(Fk(ie)){const me=pe(ie);if(me)return me}switch(ie){case"author":return{panelStyle:{display:"none"},overlay:y.jsx("div",{style:{position:"absolute",inset:0},children:y.jsx(vM,{experimentBase:te,monacoBaseUrl:W,resolveScript:N.resolve,roster:g.bag,...f[ie],onLinkSelect:L,deepLinkRefusal:v})})};case"codec":return{panelStyle:{display:"none"},overlay:y.jsx("div",{style:{position:"absolute",inset:0},children:y.jsx(QM,{mathSdkUrl:N.mathSdkUrl,mathWasmUrl:N.mathWasmUrl,mathWasmModuleUrl:N.mathWasmModuleUrl,mathBackend:N.mathBackend,monacoBaseUrl:W,...f[ie],deepLinkRefusal:v,onLinkSelect:L})})};case"ide":return{panelStyle:{display:"none"},overlay:y.jsx("div",{style:{position:"absolute",inset:0},children:y.jsx(fz,{notebookBase:N.notebookBase,monacoBaseUrl:W,markdownCssUrl:Y,mathUrls:{mathSdkUrl:N.mathSdkUrl,mathWasmUrl:N.mathWasmUrl,mathWasmModuleUrl:N.mathWasmModuleUrl,mathBackend:N.mathBackend},...f[ie],deepLinkRefusal:v,onLinkSelect:L,frqtlEngine:e,frqtlMode:t,audience:s})})};case"bench":return{panelStyle:{display:"none"},overlay:y.jsx("div",{style:{position:"absolute",inset:0},children:y.jsx(kM,{mathSdkUrl:N.mathSdkUrl,mathWasmUrl:N.mathWasmUrl,mathWasmModuleUrl:N.mathWasmModuleUrl,mathBackend:N.mathBackend,deepLinkRefusal:v})})};case"compare":return{panelStyle:{display:"none"},overlay:y.jsx("div",{style:{position:"absolute",inset:0},children:y.jsx(mT,{experimentBase:te,router:N,roster:g.bag,monacoBaseUrl:W,...f[ie],deepLinkRefusal:v,onLinkSelect:L,onOpenInStudio:T})})};default:throw new Error('[FraqtlIde] renderPresetSurface: unrecognized preset "'+ie+'" — normalizePreset() should make this unreachable. (FAIL-LOUD — no PaneHost fallback exists; add a case for this preset.)')}}const{panelStyle:ee,overlay:ce}=B(u),ve=typeof document<"u"?vT(document):null,[ke,je]=j.useState(!1);return y.jsxs("div",{id:"pane-host-app",ref:a,style:{display:"flex",flexDirection:"column",height:"100%",position:"relative"},children:[y.jsxs("div",{ref:S,"data-role":"ide-explainer-covered",style:{display:"contents"},children:[y.jsxs("div",{id:"frqtl-ide-toolbar",style:{display:"flex",alignItems:"center",padding:"4px 8px",background:"#111",borderBottom:"1px solid #222",flexShrink:0},children:[ve?y.jsx("a",{href:ve,"data-role":"frqtl-brand-home",title:"Home",onMouseEnter:()=>je(!0),onMouseLeave:()=>je(!1),onFocus:()=>je(!0),onBlur:()=>je(!1),style:{fontSize:"0.7rem",fontWeight:700,letterSpacing:"1px",marginRight:"6px",color:ke?"#7ec8e3":"#888",cursor:"pointer",textDecoration:"underline",textDecorationStyle:ke?"solid":"dotted",textUnderlineOffset:"3px"},children:"FRQTL"}):y.jsx("span",{"data-role":"frqtl-brand",style:{fontSize:"0.7rem",fontWeight:700,letterSpacing:"1px",color:"#444",marginRight:"6px"},children:"FRQTL"}),y.jsx("div",{className:"ph-toolbar-sep"}),Tg(s).map(ie=>y.jsx("button",{className:"ph-toolbar-btn"+(u===ie?" active":""),type:"button",onClick:()=>re(ie),children:Al[ie]||ie},ie)),y.jsx("div",{className:"ph-toolbar-sep"}),y.jsx("div",{style:{flex:1}}),s!=="public"&&y.jsxs(y.Fragment,{children:[y.jsx(Sz,{}),y.jsx("div",{className:"ph-toolbar-sep"}),y.jsx(kz,{onClick:()=>re("bench")})]})]}),y.jsx("div",{id:"pane-host-tabbar"}),y.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[y.jsx("div",{id:"frqtl-ide-pane-body",style:{position:"absolute",inset:0,overflow:"hidden",...ee}}),ce]})]}),y.jsx("div",{ref:x,"data-run-once-host":"",style:{position:"absolute",inset:0,zIndex:1e4,pointerEvents:"none"}})]})}function Oz({engine:e}){return y.jsx("div",{"data-role":"archived-engine-error","data-egpt-boot-error":"1",style:{position:"fixed",inset:0,zIndex:99999,background:"#1a0000",color:"#ff6b6b",font:"13px/1.55 ui-monospace,Menlo,Consolas,monospace",padding:"22px",whiteSpace:"pre-wrap",overflow:"auto",borderTop:"2px solid #b6161c"},children:"ENGINE BOOT FAILED — engine="+e+`
|
|
166
|
-
|
|
167
|
-
JS reference engine archived — FRQTL is WASM-only. Remove ?engine=`+e+` (the only FRQTL physics engine is the compiled Rust/WASM engine).
|
|
168
|
-
|
|
169
|
-
The IDE is intentionally not mounted. The requested engine is not a runtime
|
|
170
|
-
backend, and the shell did NOT fall back to a different engine.
|
|
171
|
-
|
|
172
|
-
Open this surface on the WASM engine instead (drop the ?engine= param, or use
|
|
173
|
-
?engine=wasm).`})}const yE=new URLSearchParams(window.location.search),Mm=yE.get("engine")||"wasm",bE={mode:"static",audience:"public"};import(new URL(LR,document.baseURI).href);const xE=document.getElementById("root");function Cz(e){var t=KL(window.location.search,e,bE.audience);t!==null&&window.history.replaceState(window.history.state,"",window.location.pathname+(t?"?"+t:"")+window.location.hash)}function jz(){jg(xE).render(y.jsx(Ez,{engine:Mm,...bE,...nS(yE),onLinkChange:Cz}))}Mm!=="wasm"?jg(xE).render(y.jsx(Oz,{engine:Mm})):jz();export{At as C,y as j,j as r};
|