Files
glitch-bubble-simulator/dist/bubble-feedback.iife.js
T
2026-06-10 11:48:40 +02:00

9 lines
24 KiB
JavaScript

(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('._wrapper_cbum2_1{--gc-bg: var(--color-bg, #0a0a0f);--gc-bg-secondary: var(--color-bg-secondary, #12121a);--gc-text: var(--color-text, #e8e8ec);--gc-text-muted: var(--color-text-muted, #9999a8);--gc-primary: var(--color-primary, #6366f1);--gc-accent: var(--color-accent, #22d3ee);--gc-border: var(--color-border, #2a2a3a);--gc-font-main: var(--font-main, system-ui, sans-serif);--gc-font-display: var(--font-display, var(--gc-font-main));--gc-font-mono: var(--font-mono, monospace);--gc-shell-padding: clamp(8px, 2vw, 18px);width:100%;min-height:100dvh;display:grid;place-items:center;padding:var(--gc-shell-padding);box-sizing:border-box}._wrapper_cbum2_1 *,._wrapper_cbum2_1 *:before,._wrapper_cbum2_1 *:after{box-sizing:inherit}._frame_cbum2_27{position:relative;width:min(100%,calc((100dvh - (var(--gc-shell-padding) * 2)) * 16 / 9));max-height:calc(100dvh - (var(--gc-shell-padding) * 2));aspect-ratio:16 / 9;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:.65em;overflow:hidden;padding:1em;color:var(--gc-text);font-family:var(--gc-font-main);font-size:clamp(10px,1.08cqw,18px);line-height:1.2;background:radial-gradient(circle at 16% 12%,color-mix(in srgb,var(--bubble-color) 22%,transparent),transparent 28%),radial-gradient(circle at 82% 16%,color-mix(in srgb,var(--gc-accent) 18%,transparent),transparent 30%),linear-gradient(145deg,var(--gc-bg),var(--gc-bg-secondary));border:1px solid color-mix(in srgb,var(--gc-border) 74%,transparent);box-shadow:inset 0 0 0 1px #ffffff0a,0 18px 48px #00000057;container-type:inline-size}._header_cbum2_52,._controls_cbum2_53,._loopHeader_cbum2_54,._footer_cbum2_55,._cycleReadout_cbum2_56{display:flex;align-items:center}._header_cbum2_52,._loopHeader_cbum2_54,._footer_cbum2_55{justify-content:space-between;gap:1em}._header_cbum2_52 h2{margin:.1em 0 0;font-family:var(--gc-font-display);font-size:1.42em;line-height:1;letter-spacing:0}._kicker_cbum2_76{display:block;color:color-mix(in srgb,var(--gc-accent) 78%,white);font-family:var(--gc-font-mono);font-size:.62em;font-weight:700;letter-spacing:.12em;text-transform:uppercase}._controls_cbum2_53{gap:.45em}._iconButton_cbum2_90,._modeButton_cbum2_91,._completeButton_cbum2_92{border:1px solid color-mix(in srgb,var(--gc-border) 78%,transparent);color:var(--gc-text);font:inherit;font-family:var(--gc-font-mono);font-size:.66em;font-weight:700;letter-spacing:.08em;text-transform:uppercase;cursor:pointer;transition:transform .12s ease,border-color .12s ease,background-color .12s ease}._iconButton_cbum2_90:hover,._modeButton_cbum2_91:hover,._completeButton_cbum2_92:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--gc-accent) 62%,var(--gc-border))}._iconButton_cbum2_90{min-width:3.5em;min-height:2.6em;background:#0a0e18b8}._modeButton_cbum2_91{min-height:2.6em;padding:0 .8em;background:#0a0e1894}._modeActive_cbum2_124{color:#090b10;background:linear-gradient(90deg,var(--bubble-color),color-mix(in srgb,var(--gc-accent) 42%,var(--bubble-color)));border-color:#ffffff8f}._stageGrid_cbum2_130{min-height:0;display:grid;grid-template-columns:minmax(0,1.32fr) minmax(12em,.68fr);gap:.65em}._loopPanel_cbum2_137,._eventPanel_cbum2_138{min-width:0;min-height:0;border:1px solid color-mix(in srgb,var(--gc-border) 76%,transparent);background:#0509128f}._loopPanel_cbum2_137{display:grid;grid-template-rows:auto minmax(0,1fr);gap:.3em;padding:.75em}._loopHeader_cbum2_54 strong{display:block;margin-top:.2em;font-size:.86em;font-weight:650}._cycleReadout_cbum2_56{align-items:flex-end;flex-direction:column;gap:.16em;color:var(--gc-text-muted);font-family:var(--gc-font-mono);font-size:.66em;letter-spacing:.08em;text-transform:uppercase}._cycleReadout_cbum2_56 strong{color:var(--bubble-color);font-family:var(--gc-font-display);font-size:2.1em;line-height:.9;letter-spacing:0}._loop_cbum2_54{position:relative;width:min(100%,34em);aspect-ratio:1;align-self:center;justify-self:center}._ring_cbum2_186{position:absolute;inset:18%;border:.28em solid color-mix(in srgb,var(--bubble-color) 44%,transparent);border-radius:50%;box-shadow:inset 0 0 1.7em #ffffff0d,0 0 1.6em color-mix(in srgb,var(--bubble-color) 28%,transparent)}._ring_cbum2_186:after{content:"";position:absolute;inset:-.55em;border-radius:50%;border:1px dashed color-mix(in srgb,var(--gc-text) 24%,transparent)}._pulse_cbum2_204{position:absolute;inset:50%;width:1.05em;height:1.05em;border-radius:50%;background:var(--gc-accent);box-shadow:0 0 0 .4em color-mix(in srgb,var(--gc-accent) 14%,transparent),0 0 1.4em color-mix(in srgb,var(--gc-accent) 80%,transparent);transform:rotate(var(--rotation)) translateY(-10.7em) translate(-50%,-50%);transform-origin:0 0}._core_cbum2_218{position:absolute;inset:34%;overflow:hidden;border:1px solid color-mix(in srgb,var(--gc-border) 78%,transparent);border-radius:50%;background:#070b11e0;text-align:center}._coreOverlay_cbum2_228{position:absolute;inset:auto 12% 13%;display:flex;align-items:flex-end;justify-content:space-between;gap:.5em;pointer-events:none}._coreOverlay_cbum2_228 span{max-width:9em;color:color-mix(in srgb,var(--gc-text-muted) 88%,white);font-family:var(--gc-font-mono);font-size:.58em;font-weight:700;letter-spacing:.1em;line-height:1.1;text-align:left;text-transform:uppercase}._coreOverlay_cbum2_228 strong{color:var(--bubble-color);font-family:var(--gc-font-display);font-size:1.28em;line-height:.9}._canvas_cbum2_257{display:block;width:100%;height:100%;border:0;background:linear-gradient(90deg,color-mix(in srgb,var(--bubble-color) 8%,transparent),transparent 40%),#070b11c7}._loopStation_cbum2_267{position:absolute;z-index:2;width:0;height:0;transform:translate(-50%,-50%)}._loopNode_cbum2_275{position:absolute;left:0;top:0;width:2.4em;height:2.4em;display:grid;place-items:center;border:1px solid color-mix(in srgb,var(--gc-border) 80%,transparent);border-radius:50%;background:#090d16f0;color:var(--gc-text-muted);font-family:var(--gc-font-mono);font-size:.78em;font-weight:800;transform:translate(-50%,-50%);transition:color .16s ease,border-color .16s ease,background-color .16s ease,box-shadow .16s ease}._nodeActive_cbum2_294{color:#071018;background:var(--bubble-color);border-color:#ffffffb8;box-shadow:0 0 1.2em color-mix(in srgb,var(--bubble-color) 54%,transparent)}._stationLabel_cbum2_301{position:absolute;left:0;top:0;width:12.4em;max-height:4.6em;overflow:hidden;margin:0;padding:.48em .58em;border:1px solid color-mix(in srgb,var(--gc-border) 72%,transparent);background:#050912d1;color:color-mix(in srgb,var(--gc-text-muted) 86%,white);font-size:.62em;line-height:1.14;transform:translate(calc(-50% + var(--label-x)),calc(-50% + var(--label-y)));transition:color .16s ease,border-color .16s ease,background-color .16s ease,box-shadow .16s ease}._labelActive_cbum2_319{border-color:color-mix(in srgb,var(--bubble-color) 70%,var(--gc-border));background:color-mix(in srgb,var(--bubble-color) 18%,rgb(5 9 18));color:var(--gc-text);box-shadow:0 0 1.1em color-mix(in srgb,var(--bubble-color) 26%,transparent)}._eventPanel_cbum2_138{display:flex;flex-direction:column;justify-content:space-between;gap:1em;padding:.9em}._eventPanel_cbum2_138 h3{margin:0;color:var(--gc-text);font-family:var(--gc-font-display);font-size:1.18em;line-height:1.04;letter-spacing:0}._nextEvent_cbum2_343{padding-top:.75em;border-top:1px solid color-mix(in srgb,var(--gc-border) 72%,transparent)}._nextEvent_cbum2_343 span,._definition_cbum2_349 span{color:var(--bubble-color);font-family:var(--gc-font-mono);font-size:.62em;font-weight:800;letter-spacing:.1em;text-transform:uppercase}._nextEvent_cbum2_343 p,._definition_cbum2_349 p{margin:.35em 0 0;color:color-mix(in srgb,var(--gc-text-muted) 86%,white);font-size:.8em;line-height:1.22}._definition_cbum2_349{padding-top:.75em;border-top:1px solid color-mix(in srgb,var(--gc-border) 72%,transparent)}._footer_cbum2_55{display:grid;grid-template-columns:minmax(0,1fr) auto;padding:.62em .8em;border:1px solid color-mix(in srgb,var(--gc-border) 76%,transparent);background:#0509128a}._footer_cbum2_55 input{width:100%;accent-color:var(--bubble-color)}._completeButton_cbum2_92{min-width:3em;min-height:2.35em;padding:0 .8em;background:color-mix(in srgb,var(--gc-primary) 28%,rgb(5 9 18))}._completeButton_cbum2_92:disabled{cursor:default;opacity:.68;transform:none}@media(orientation:portrait){._frame_cbum2_27{width:min(100%,calc((100dvh - (var(--gc-shell-padding) * 2)) / 2));aspect-ratio:1 / 2;grid-template-rows:auto minmax(0,1fr) auto;font-size:clamp(10px,3.15cqw,16px)}._header_cbum2_52{align-items:flex-start;flex-direction:column;gap:.55em}._header_cbum2_52 h2{font-size:1.2em}._controls_cbum2_53{width:100%;display:grid;grid-template-columns:3.4em repeat(2,minmax(0,1fr))}._stageGrid_cbum2_130{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto}._loop_cbum2_54{width:min(100%,29em)}._pulse_cbum2_204{transform:rotate(var(--rotation)) translateY(-9.2em) translate(-50%,-50%)}._eventPanel_cbum2_138{padding:.75em}._eventPanel_cbum2_138 h3{font-size:.96em}._nextEvent_cbum2_343 p{display:none}._stationLabel_cbum2_301{width:10.8em;max-height:3.9em;font-size:.54em}}')),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
var GlitchComponent=(function(z,b){"use strict";var H={exports:{}},F={};var ne;function ce(){if(ne)return F;ne=1;var r=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function g(i,d,v){var p=null;if(v!==void 0&&(p=""+v),d.key!==void 0&&(p=""+d.key),"key"in d){v={};for(var m in d)m!=="key"&&(v[m]=d[m])}else v=d;return d=v.ref,{$$typeof:r,type:i,key:p,ref:d!==void 0?d:null,props:v}}return F.Fragment=u,F.jsx=g,F.jsxs=g,F}var Y={};var re;function le(){return re||(re=1,process.env.NODE_ENV!=="production"&&(function(){function r(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===J?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case A:return"Fragment";case _:return"Profiler";case O:return"StrictMode";case G:return"Suspense";case N:return"SuspenseList";case U:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case P:return"Portal";case C:return e.displayName||"Context";case y:return(e._context.displayName||"Context")+".Consumer";case l:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case D:return n=e.displayName||null,n!==null?n:r(e.type)||"Memo";case W:n=e._payload,e=e._init;try{return r(e(n))}catch{}}return null}function u(e){return""+e}function g(e){try{u(e);var n=!1}catch{n=!0}if(n){n=console;var c=n.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),u(e)}}function i(e){if(e===A)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===W)return"<...>";try{var n=r(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function d(){var e=L.A;return e===null?null:e.getOwner()}function v(){return Error("react-stack-top-frame")}function p(e){if(X.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function m(e,n){function c(){K||(K=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function R(){var e=r(this.type);return Z[e]||(Z[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function o(e,n,c,f,I,ee){var h=c.ref;return e={$$typeof:T,type:e,key:n,props:c,_owner:f},(h!==void 0?h:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:R}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ee}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function E(e,n,c,f,I,ee){var h=n.children;if(h!==void 0)if(f)if(V(h)){for(f=0;f<h.length;f++)x(h[f]);Object.freeze&&Object.freeze(h)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else x(h);if(X.call(n,"key")){h=r(e);var B=Object.keys(n).filter(function(be){return be!=="key"});f=0<B.length?"{key: someKey, "+B.join(": ..., ")+": ...}":"{key: someKey}",S[h+f]||(B=0<B.length?"{"+B.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,f,h,B,h),S[h+f]=!0)}if(h=null,c!==void 0&&(g(c),h=""+c),p(n)&&(g(n.key),h=""+n.key),"key"in n){c={};for(var te in n)te!=="key"&&(c[te]=n[te])}else c=n;return h&&m(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),o(e,h,c,d(),I,ee)}function x(e){k(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===W&&(e._payload.status==="fulfilled"?k(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function k(e){return typeof e=="object"&&e!==null&&e.$$typeof===T}var j=b,T=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),C=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),J=Symbol.for("react.client.reference"),L=j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,V=Array.isArray,w=console.createTask?console.createTask:function(){return null};j={react_stack_bottom_frame:function(e){return e()}};var K,Z={},Q=j.react_stack_bottom_frame.bind(j,v)(),s=w(i(v)),S={};Y.Fragment=A,Y.jsx=function(e,n,c){var f=1e4>L.recentlyCreatedOwnerStacks++;return E(e,n,c,!1,f?Error("react-stack-top-frame"):Q,f?w(i(e)):s)},Y.jsxs=function(e,n,c){var f=1e4>L.recentlyCreatedOwnerStacks++;return E(e,n,c,!0,f?Error("react-stack-top-frame"):Q,f?w(i(e)):s)}})()),Y}var oe;function ie(){return oe||(oe=1,process.env.NODE_ENV==="production"?H.exports=ce():H.exports=le()),H.exports}var t=ie();const a={wrapper:"_wrapper_cbum2_1",frame:"_frame_cbum2_27",header:"_header_cbum2_52",controls:"_controls_cbum2_53",loopHeader:"_loopHeader_cbum2_54",footer:"_footer_cbum2_55",cycleReadout:"_cycleReadout_cbum2_56",kicker:"_kicker_cbum2_76",iconButton:"_iconButton_cbum2_90",modeButton:"_modeButton_cbum2_91",completeButton:"_completeButton_cbum2_92",modeActive:"_modeActive_cbum2_124",stageGrid:"_stageGrid_cbum2_130",loopPanel:"_loopPanel_cbum2_137",eventPanel:"_eventPanel_cbum2_138",loop:"_loop_cbum2_54",ring:"_ring_cbum2_186",pulse:"_pulse_cbum2_204",core:"_core_cbum2_218",coreOverlay:"_coreOverlay_cbum2_228",canvas:"_canvas_cbum2_257",loopStation:"_loopStation_cbum2_267",loopNode:"_loopNode_cbum2_275",nodeActive:"_nodeActive_cbum2_294",stationLabel:"_stationLabel_cbum2_301",labelActive:"_labelActive_cbum2_319",nextEvent:"_nextEvent_cbum2_343",definition:"_definition_cbum2_349"},ue=[{key:"ai-stock",title:"AI Stock Bubble",shortLabel:"AI STOCK",subject:"Market price becomes evidence",outputLabel:"price",chartLabel:"price expectation",color:"#f0c45c",events:["Stock price rises because people buy","Stronger financial position lets the company borrow more","Borrowing more results in larger AI investment","Larger AI investment increases AI race winning probability","AI race winning increases future earnings expectation"]},{key:"string-theory",title:"String Theory Field Bubble",shortLabel:"STRING",subject:"Activity becomes evidence",outputLabel:"field activity",chartLabel:"field promise",color:"#74d6ff",events:["People choose String Theory for doctoral theses because of job opportunities","String Theory gets lots of new researchers","Researchers publish research and cite other string theorists","Activity and citations become proxy for how promising a research field is","Promising translates to successful grants","Grants become open positions"]}],M=(r,u,g)=>Math.min(g,Math.max(u,r)),$=(r,u)=>typeof r=="number"?r:u,de=(r,u)=>!Array.isArray(r.events)||r.events.length<2?null:{key:r.key??`custom-${u}`,title:r.title??`Custom Loop ${u+1}`,shortLabel:r.shortLabel??`LOOP ${u+1}`,subject:r.subject??"Output becomes input",outputLabel:r.outputLabel??"output",chartLabel:r.chartLabel??"amplification",color:r.color??"#8ee6a8",events:r.events},me=r=>{const u=Array.isArray(r.scenarios)?r.scenarios.map(de).filter(g=>!!g):[];return u.length>0?u:ue},ae=(r,u,g)=>{const i=r*Math.max(.02,u-.52)*.22,d=Math.exp(r*Math.max(0,u-.86)*.11),v=Math.sin(r*1.38)*g*.42;return M(.1+i+d*.18-v,.08,2.7)};function fe(r,u,g,i,d){const v=r.getBoundingClientRect(),p=window.devicePixelRatio||1,m=v.width,R=v.height;r.width=Math.floor(m*p),r.height=Math.floor(R*p);const o=r.getContext("2d");if(!o)return;o.setTransform(p,0,0,p,0,0),o.clearRect(0,0,m,R);const E=m*.08,x=R*.14,k=m-E*2,j=R-x*2;o.lineWidth=1,o.strokeStyle=d.grid;for(let _=0;_<=4;_+=1){const y=x+_/4*j;o.beginPath(),o.moveTo(E,y),o.lineTo(m-E,y),o.stroke()}const T=80,P=Array.from({length:T},(_,y)=>{const C=Math.max(0,u-7+y/(T-1)*7),l=ae(C,g,i);return{x:E+y/(T-1)*k,y:x+j-l/2.7*j}}),A=o.createLinearGradient(0,x,0,R-x);A.addColorStop(0,d.scenario),A.addColorStop(1,"rgba(255, 255, 255, 0)"),o.beginPath(),P.forEach((_,y)=>{y===0?o.moveTo(_.x,_.y):o.lineTo(_.x,_.y)}),o.lineTo(m-E,R-x),o.lineTo(E,R-x),o.closePath(),o.fillStyle=A,o.globalAlpha=.22,o.fill(),o.globalAlpha=1,o.beginPath(),P.forEach((_,y)=>{y===0?o.moveTo(_.x,_.y):o.lineTo(_.x,_.y)}),o.strokeStyle=d.scenario,o.lineWidth=Math.max(2,m*.006),o.stroke();const O=P[P.length-1];o.beginPath(),o.arc(O.x,O.y,Math.max(5,m*.014),0,Math.PI*2),o.fillStyle=d.accent,o.fill()}function se({config:r,onComplete:u,onProgress:g,theme:i,className:d,host:v}){const p=r.params,m=b.useMemo(()=>me(p),[p]),[R,o]=b.useState(()=>String(p.scenario??m[0].key)),[E,x]=b.useState(!0),[k,j]=b.useState(0),[T,P]=b.useState(!1),A=b.useRef(null),O=b.useRef(0),_=M($(p.animationSpeed,1),.25,3),y=M($(p.feedbackStrength,1.18),.55,1.8),C=M($(p.correctionPressure,.18),0,.65),l=m.find(s=>s.key===R)??m[0],G=k%1,N=Math.floor(G*l.events.length)%l.events.length,D=(N+1)%l.events.length,W=ae(k,y,C),U=Math.round(M(W/2.7*100,0,100)),J=Math.round(M(k/12*100,0,100)),L=b.useMemo(()=>({accent:i?.accent??"#22d3ee",text:i?.text??"#e8e8ec",muted:i?.textMuted??"#9999a8",grid:"rgba(232, 232, 236, 0.13)",scenario:l.color}),[l.color,i?.accent,i?.text,i?.textMuted]),X=b.useMemo(()=>({"--gc-primary":i?.primary,"--gc-accent":i?.accent,"--gc-bg":i?.bg,"--gc-bg-secondary":i?.bgSecondary,"--gc-text":i?.text,"--gc-text-muted":i?.textMuted,"--gc-border":i?.border,"--bubble-color":l.color,"--rotation":`${G*360}deg`}),[G,l.color,i]),V=b.useCallback(()=>{A.current&&fe(A.current,k,y,C,L)},[C,k,y,L]);b.useEffect(()=>{o(String(p.scenario??m[0].key))},[p.scenario,m]),b.useEffect(()=>{j(0)},[R]),b.useEffect(()=>{g?.(J)},[g,J]),b.useEffect(()=>{V();const s=A.current;if(!s)return;const S=new ResizeObserver(V);return S.observe(s),()=>S.disconnect()},[V]),b.useEffect(()=>{let s=0;const S=e=>{const n=34/_;E&&e-O.current>n&&(j(c=>c>=12?0:c+.0125),O.current=e),s=window.requestAnimationFrame(S)};return s=window.requestAnimationFrame(S),()=>window.cancelAnimationFrame(s)},[_,E]);const w=b.useCallback(s=>{v?.playSound?.("ui.button_click",{target:s,component:r.name})},[r.name,v]),K=b.useCallback(s=>{w(s),x(!0),o(s)},[w]),Z=b.useCallback(()=>{T||(P(!0),w("complete"),u({success:!0,score:100,data:{scenario:l.key,cycle:k,pressure:U,activeEvent:l.events[N],nextEvent:l.events[D],definition:"A bubble is a self-amplifying feedback loop: output becomes input.",configId:r.id,completedAt:new Date().toISOString()}}))},[T,r.id,k,N,D,u,w,U,l]),Q=d?`${a.wrapper} ${d}`:a.wrapper;return t.jsx("section",{className:Q,style:X,"aria-label":"Bubble feedback simulator",children:t.jsxs("div",{className:a.frame,children:[t.jsxs("header",{className:a.header,children:[t.jsxs("div",{children:[t.jsx("span",{className:a.kicker,children:"Feedback loop"}),t.jsx("h2",{children:"A bubble is output used as input"})]}),t.jsxs("div",{className:a.controls,"aria-label":"Simulation controls",children:[t.jsx("button",{className:a.iconButton,type:"button",onClick:()=>x(s=>!s),children:E?"II":">"}),m.map(s=>t.jsx("button",{className:`${a.modeButton} ${s.key===l.key?a.modeActive:""}`,type:"button",onClick:()=>K(s.key),children:s.shortLabel},s.key))]})]}),t.jsxs("main",{className:a.stageGrid,children:[t.jsxs("section",{className:a.loopPanel,"aria-label":`${l.title} loop`,children:[t.jsxs("div",{className:a.loopHeader,children:[t.jsxs("div",{children:[t.jsx("span",{className:a.kicker,children:l.title}),t.jsx("strong",{children:l.subject})]}),t.jsxs("div",{className:a.cycleReadout,children:[t.jsx("span",{children:"cycle"}),t.jsx("strong",{children:k.toFixed(1)})]})]}),t.jsxs("div",{className:a.loop,children:[t.jsx("div",{className:a.ring,"aria-hidden":"true"}),t.jsx("div",{className:a.pulse,"aria-hidden":"true"}),t.jsxs("div",{className:a.core,children:[t.jsx("canvas",{ref:A,className:a.canvas,"aria-label":`${l.chartLabel} chart`}),t.jsxs("div",{className:a.coreOverlay,children:[t.jsx("span",{children:l.chartLabel}),t.jsxs("strong",{children:[U,"%"]})]})]}),l.events.map((s,S)=>{const e=S/l.events.length*Math.PI*2-Math.PI/2,n=50+Math.cos(e)*32,c=50+Math.sin(e)*32,f=Math.cos(e)*5.4,I=Math.sin(e)*4.5;return t.jsxs("div",{className:a.loopStation,style:{left:`${n}%`,top:`${c}%`,"--label-x":`${f}em`,"--label-y":`${I}em`},children:[t.jsx("div",{className:`${a.loopNode} ${S===N?a.nodeActive:""}`,children:t.jsx("span",{children:S+1})}),t.jsx("p",{className:`${a.stationLabel} ${S===N?a.labelActive:""}`,children:s})]},s)})]})]}),t.jsxs("aside",{className:a.eventPanel,children:[t.jsx("span",{className:a.kicker,children:"Now feeding back"}),t.jsx("h3",{children:l.events[N]}),t.jsxs("div",{className:a.nextEvent,children:[t.jsx("span",{children:"next"}),t.jsx("p",{children:l.events[D]})]}),t.jsxs("div",{className:a.definition,children:[t.jsx("span",{children:"definition"}),t.jsx("p",{children:"A bubble is a self-amplifying feedback loop: output becomes input."})]})]})]}),t.jsxs("footer",{className:a.footer,children:[t.jsx("input",{"aria-label":"Loop cycle",type:"range",min:0,max:12,step:.05,value:k,onChange:s=>{w("cycle"),x(!1),j(Number(s.currentTarget.value))}}),t.jsx("button",{className:a.completeButton,type:"button",onClick:Z,disabled:T,children:T?"OK":"✓"})]})]})})}const q={name:"bubble-feedback",displayName:"Bubble Feedback",version:"1.0.0",paramSchema:{scenario:{type:"select",label:"Scenario",default:"ai-stock",options:[{value:"ai-stock",label:"AI Stock Bubble"},{value:"string-theory",label:"String Theory Field Bubble"}]},animationSpeed:{type:"range",label:"Animation Speed",default:1,min:.25,max:3,step:.25},feedbackStrength:{type:"range",label:"Feedback Strength",default:1.18,min:.55,max:1.8,step:.05},correctionPressure:{type:"range",label:"Correction Pressure",default:.18,min:0,max:.65,step:.05}},defaultParams:{scenario:"ai-stock",animationSpeed:1,feedbackStrength:1.18,correctionPressure:.18}};return typeof window<"u"&&(window.GlitchComponents??={},window.GlitchComponents[q.name]={default:se,metadata:q}),z.default=se,z.metadata=q,Object.defineProperties(z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),z})({},React);
//# sourceMappingURL=bubble-feedback.iife.js.map