sigurd-startup 2.2.2

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.
Files changed (104) hide show
  1. package/README.md +203 -0
  2. package/dist/assets/bomb/bomb1.png +0 -0
  3. package/dist/assets/bomb/bomb2.png +0 -0
  4. package/dist/assets/complete/complete1.png +0 -0
  5. package/dist/assets/complete/complete2.png +0 -0
  6. package/dist/assets/complete/complete3.png +0 -0
  7. package/dist/assets/complete/complete4.png +0 -0
  8. package/dist/assets/complete/complete5.png +0 -0
  9. package/dist/assets/float/float1.png +0 -0
  10. package/dist/assets/float-dir/float-dir1.png +0 -0
  11. package/dist/assets/ghost-Idle/ghost-idle1.png +0 -0
  12. package/dist/assets/ghost-Idle/ghost-idle2.png +0 -0
  13. package/dist/assets/ghost-Idle/ghost-idle3.png +0 -0
  14. package/dist/assets/ghost-Idle/ghost-idle4.png +0 -0
  15. package/dist/assets/ghost-Idle/ghost-idle5.png +0 -0
  16. package/dist/assets/ghost-Idle/ghost-idle6.png +0 -0
  17. package/dist/assets/ghost-float/ghost-float1.png +0 -0
  18. package/dist/assets/ghost-float/ghost-float2.png +0 -0
  19. package/dist/assets/ghost-jump/ghost-jump1.png +0 -0
  20. package/dist/assets/ghost-jump/ghost-jump2.png +0 -0
  21. package/dist/assets/ghost-jump/ghost-jump3.png +0 -0
  22. package/dist/assets/ghost-landing/ghost-landing1.png +0 -0
  23. package/dist/assets/ghost-landing/ghost-landing2.png +0 -0
  24. package/dist/assets/ghost-landing/ghost-landing3.png +0 -0
  25. package/dist/assets/ghost-map-complete/ghost-map-complete1.png +0 -0
  26. package/dist/assets/ghost-map-complete/ghost-map-complete2.png +0 -0
  27. package/dist/assets/ghost-map-complete/ghost-map-complete3.png +0 -0
  28. package/dist/assets/ghost-map-complete/ghost-map-complete4.png +0 -0
  29. package/dist/assets/ghost-walk/ghost-walk1.png +0 -0
  30. package/dist/assets/ghost-walk/ghost-walk2.png +0 -0
  31. package/dist/assets/ghost-walk/ghost-walk3.png +0 -0
  32. package/dist/assets/ghost-walk/ghost-walk4.png +0 -0
  33. package/dist/assets/ghost-walk/ghost-walk5.png +0 -0
  34. package/dist/assets/ghost-walk/ghost-walk6.png +0 -0
  35. package/dist/assets/ghost-walk/ghost-walk7.png +0 -0
  36. package/dist/assets/ghost-walk/ghost-walk8.png +0 -0
  37. package/dist/assets/jumping/jump1.png +0 -0
  38. package/dist/assets/jumping/jump2.png +0 -0
  39. package/dist/assets/jumping/jump3.png +0 -0
  40. package/dist/assets/landing/landing1.png +0 -0
  41. package/dist/assets/map-images/future-city/1.png +0 -0
  42. package/dist/assets/map-images/future-city/2.png +0 -0
  43. package/dist/assets/map-images/future-city/3.png +0 -0
  44. package/dist/assets/map-images/future-city/4.png +0 -0
  45. package/dist/assets/map-images/future-city/5.png +0 -0
  46. package/dist/assets/map-images/future-city/6.png +0 -0
  47. package/dist/assets/map-images/future-city/7.png +0 -0
  48. package/dist/assets/map-images/future-city/8.png +0 -0
  49. package/dist/assets/map-images/future-city/9.png +0 -0
  50. package/dist/assets/map-images/future-city-2/1.png +0 -0
  51. package/dist/assets/map-images/future-city-2/2.png +0 -0
  52. package/dist/assets/map-images/future-city-2/3.png +0 -0
  53. package/dist/assets/map-images/future-city-2/4.png +0 -0
  54. package/dist/assets/map-images/future-city-2/5.png +0 -0
  55. package/dist/assets/map-images/future-city-2/6.png +0 -0
  56. package/dist/assets/map-images/future-city-2/7.png +0 -0
  57. package/dist/assets/map-images/future-city-2/8.png +0 -0
  58. package/dist/assets/map-images/future-city-2/9.png +0 -0
  59. package/dist/assets/map-images/mountain/1.png +0 -0
  60. package/dist/assets/map-images/mountain/2.png +0 -0
  61. package/dist/assets/map-images/mountain/3.png +0 -0
  62. package/dist/assets/map-images/mountain/4.png +0 -0
  63. package/dist/assets/map-images/mountain/5.png +0 -0
  64. package/dist/assets/map-images/mountain/6.png +0 -0
  65. package/dist/assets/map-images/mountain/7.png +0 -0
  66. package/dist/assets/map-images/mountain/8.png +0 -0
  67. package/dist/assets/map-images/mountain/9.png +0 -0
  68. package/dist/assets/map-images/ocean/1.png +0 -0
  69. package/dist/assets/map-images/ocean/2.png +0 -0
  70. package/dist/assets/map-images/ocean/3.png +0 -0
  71. package/dist/assets/map-images/ocean/4.png +0 -0
  72. package/dist/assets/map-images/taco-street/1.png +0 -0
  73. package/dist/assets/map-images/taco-street/2.png +0 -0
  74. package/dist/assets/map-images/taco-street/3.png +0 -0
  75. package/dist/assets/map-images/taco-street/4.png +0 -0
  76. package/dist/assets/map-images/taco-street/5.png +0 -0
  77. package/dist/assets/map-images/taco-street/6.png +0 -0
  78. package/dist/assets/map-images/valley/1.png +0 -0
  79. package/dist/assets/map-images/valley/2.png +0 -0
  80. package/dist/assets/map-images/valley/3.png +0 -0
  81. package/dist/assets/maps-bg-images/alltinn-norge.png +0 -0
  82. package/dist/assets/maps-bg-images/innovasjon-norge.png +0 -0
  83. package/dist/assets/maps-bg-images/kommunehuset.png +0 -0
  84. package/dist/assets/maps-bg-images/nav.png +0 -0
  85. package/dist/assets/maps-bg-images/silicone-vally.png +0 -0
  86. package/dist/assets/maps-bg-images/skatteetaten.png +0 -0
  87. package/dist/assets/maps-bg-images/startup-lab.png +0 -0
  88. package/dist/assets/react.svg +1 -0
  89. package/dist/assets/running/run1.png +0 -0
  90. package/dist/assets/running/run2.png +0 -0
  91. package/dist/assets/running/run3.png +0 -0
  92. package/dist/assets/sigurd-idle/sigurd-idle1.png +0 -0
  93. package/dist/assets/sigurd-idle/sigurd-idle2.png +0 -0
  94. package/dist/assets/sigurd-idle/sigurd-idle3.png +0 -0
  95. package/dist/assets/sigurd-idle/sigurd-idle4.png +0 -0
  96. package/dist/audio/background-music.wav +0 -0
  97. package/dist/index.d.ts +1 -0
  98. package/dist/sigurd-startup.css +1 -0
  99. package/dist/sigurd-startup.es.js +6492 -0
  100. package/dist/sigurd-startup.es.js.map +1 -0
  101. package/dist/sigurd-startup.umd.js +31 -0
  102. package/dist/sigurd-startup.umd.js.map +1 -0
  103. package/dist/vite.svg +1 -0
  104. package/package.json +84 -0
@@ -0,0 +1,31 @@
1
+ (function(j,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("react"),require("react-dom"),require("zustand"),require("@radix-ui/react-slot"),require("class-variance-authority"),require("clsx"),require("tailwind-merge"),require("lucide-react"),require("@radix-ui/react-tooltip")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","zustand","@radix-ui/react-slot","class-variance-authority","clsx","tailwind-merge","lucide-react","@radix-ui/react-tooltip"],O):(j=typeof globalThis<"u"?globalThis:j||self,O(j.SigurdStartup={},j.React,j.ReactDOM,j.Zustand,j.RadixUISlot,j.ClassVarianceAuthority,j.Clsx,j.TailwindMerge,j.LucideReact,j.RadixUITooltip))})(this,function(j,O,ye,ta,aa,ia,ra,sa,Y,Ze){"use strict";var Zi=Object.defineProperty;var qi=(j,O,ye)=>O in j?Zi(j,O,{enumerable:!0,configurable:!0,writable:!0,value:ye}):j[O]=ye;var b=(j,O,ye)=>qi(j,typeof O!="symbol"?O+"":O,ye);function ut(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ht=ut(O),Ae=ut(Ze);var qe={exports:{}},Pe={};/**
2
+ * @license React
3
+ * react-jsx-runtime.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 pt;function na(){if(pt)return Pe;pt=1;var r=O,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function n(o,c,h){var m,g={},p=null,y=null;h!==void 0&&(p=""+h),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(y=c.ref);for(m in c)a.call(c,m)&&!s.hasOwnProperty(m)&&(g[m]=c[m]);if(o&&o.defaultProps)for(m in c=o.defaultProps,c)g[m]===void 0&&(g[m]=c[m]);return{$$typeof:e,type:o,key:p,ref:y,props:g,_owner:i.current}}return Pe.Fragment=t,Pe.jsx=n,Pe.jsxs=n,Pe}var Ne={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.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 ft;function oa(){return ft||(ft=1,process.env.NODE_ENV!=="production"&&function(){var r=O,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),n=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),M=Symbol.iterator,T="@@iterator";function R(l){if(l===null||typeof l!="object")return null;var w=M&&l[M]||l[T];return typeof w=="function"?w:null}var G=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function L(l){{for(var w=arguments.length,S=new Array(w>1?w-1:0),E=1;E<w;E++)S[E-1]=arguments[E];U("error",l,S)}}function U(l,w,S){{var E=G.ReactDebugCurrentFrame,D=E.getStackAddendum();D!==""&&(w+="%s",S=S.concat([D]));var B=S.map(function(k){return String(k)});B.unshift("Warning: "+w),Function.prototype.apply.call(console[l],console,B)}}var W=!1,ae=!1,me=!1,yi=!1,xi=!1,Ot;Ot=Symbol.for("react.module.reference");function vi(l){return!!(typeof l=="string"||typeof l=="function"||l===a||l===s||xi||l===i||l===h||l===m||yi||l===y||W||ae||me||typeof l=="object"&&l!==null&&(l.$$typeof===p||l.$$typeof===g||l.$$typeof===n||l.$$typeof===o||l.$$typeof===c||l.$$typeof===Ot||l.getModuleId!==void 0))}function Si(l,w,S){var E=l.displayName;if(E)return E;var D=w.displayName||w.name||"";return D!==""?S+"("+D+")":S}function It(l){return l.displayName||"Context"}function he(l){if(l==null)return null;if(typeof l.tag=="number"&&L("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case a:return"Fragment";case t:return"Portal";case s:return"Profiler";case i:return"StrictMode";case h:return"Suspense";case m:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case o:var w=l;return It(w)+".Consumer";case n:var S=l;return It(S._context)+".Provider";case c:return Si(l,l.render,"ForwardRef");case g:var E=l.displayName||null;return E!==null?E:he(l.type)||"Memo";case p:{var D=l,B=D._payload,k=D._init;try{return he(k(B))}catch{return null}}}return null}var be=Object.assign,je=0,Rt,_t,Lt,kt,Dt,Bt,Ft;function jt(){}jt.__reactDisabledLog=!0;function Mi(){{if(je===0){Rt=console.log,_t=console.info,Lt=console.warn,kt=console.error,Dt=console.group,Bt=console.groupCollapsed,Ft=console.groupEnd;var l={configurable:!0,enumerable:!0,value:jt,writable:!0};Object.defineProperties(console,{info:l,log:l,warn:l,error:l,group:l,groupCollapsed:l,groupEnd:l})}je++}}function Ci(){{if(je--,je===0){var l={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:be({},l,{value:Rt}),info:be({},l,{value:_t}),warn:be({},l,{value:Lt}),error:be({},l,{value:kt}),group:be({},l,{value:Dt}),groupCollapsed:be({},l,{value:Bt}),groupEnd:be({},l,{value:Ft})})}je<0&&L("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var it=G.ReactCurrentDispatcher,rt;function Xe(l,w,S){{if(rt===void 0)try{throw Error()}catch(D){var E=D.stack.trim().match(/\n( *(at )?)/);rt=E&&E[1]||""}return`
18
+ `+rt+l}}var st=!1,We;{var Ti=typeof WeakMap=="function"?WeakMap:Map;We=new Ti}function Gt(l,w){if(!l||st)return"";{var S=We.get(l);if(S!==void 0)return S}var E;st=!0;var D=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var B;B=it.current,it.current=null,Mi();try{if(w){var k=function(){throw Error()};if(Object.defineProperty(k.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(k,[])}catch(J){E=J}Reflect.construct(l,[],k)}else{try{k.call()}catch(J){E=J}l.call(k.prototype)}}else{try{throw Error()}catch(J){E=J}l()}}catch(J){if(J&&E&&typeof J.stack=="string"){for(var _=J.stack.split(`
19
+ `),Z=E.stack.split(`
20
+ `),V=_.length-1,H=Z.length-1;V>=1&&H>=0&&_[V]!==Z[H];)H--;for(;V>=1&&H>=0;V--,H--)if(_[V]!==Z[H]){if(V!==1||H!==1)do if(V--,H--,H<0||_[V]!==Z[H]){var ie=`
21
+ `+_[V].replace(" at new "," at ");return l.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",l.displayName)),typeof l=="function"&&We.set(l,ie),ie}while(V>=1&&H>=0);break}}}finally{st=!1,it.current=B,Ci(),Error.prepareStackTrace=D}var Ee=l?l.displayName||l.name:"",we=Ee?Xe(Ee):"";return typeof l=="function"&&We.set(l,we),we}function Ei(l,w,S){return Gt(l,!1)}function Ai(l){var w=l.prototype;return!!(w&&w.isReactComponent)}function ze(l,w,S){if(l==null)return"";if(typeof l=="function")return Gt(l,Ai(l));if(typeof l=="string")return Xe(l);switch(l){case h:return Xe("Suspense");case m:return Xe("SuspenseList")}if(typeof l=="object")switch(l.$$typeof){case c:return Ei(l.render);case g:return ze(l.type,w,S);case p:{var E=l,D=E._payload,B=E._init;try{return ze(B(D),w,S)}catch{}}}return""}var Ge=Object.prototype.hasOwnProperty,$t={},Vt=G.ReactDebugCurrentFrame;function Ke(l){if(l){var w=l._owner,S=ze(l.type,l._source,w?w.type:null);Vt.setExtraStackFrame(S)}else Vt.setExtraStackFrame(null)}function Pi(l,w,S,E,D){{var B=Function.call.bind(Ge);for(var k in l)if(B(l,k)){var _=void 0;try{if(typeof l[k]!="function"){var Z=Error((E||"React class")+": "+S+" type `"+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof l[k]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Z.name="Invariant Violation",Z}_=l[k](w,k,E,S,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(V){_=V}_&&!(_ instanceof Error)&&(Ke(D),L("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",E||"React class",S,k,typeof _),Ke(null)),_ instanceof Error&&!(_.message in $t)&&($t[_.message]=!0,Ke(D),L("Failed %s type: %s",S,_.message),Ke(null))}}}var Ni=Array.isArray;function nt(l){return Ni(l)}function Oi(l){{var w=typeof Symbol=="function"&&Symbol.toStringTag,S=w&&l[Symbol.toStringTag]||l.constructor.name||"Object";return S}}function Ii(l){try{return Ut(l),!1}catch{return!0}}function Ut(l){return""+l}function Ht(l){if(Ii(l))return L("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Oi(l)),Ut(l)}var Yt=G.ReactCurrentOwner,Ri={key:!0,ref:!0,__self:!0,__source:!0},Xt,Wt;function _i(l){if(Ge.call(l,"ref")){var w=Object.getOwnPropertyDescriptor(l,"ref").get;if(w&&w.isReactWarning)return!1}return l.ref!==void 0}function Li(l){if(Ge.call(l,"key")){var w=Object.getOwnPropertyDescriptor(l,"key").get;if(w&&w.isReactWarning)return!1}return l.key!==void 0}function ki(l,w){typeof l.ref=="string"&&Yt.current}function Di(l,w){{var S=function(){Xt||(Xt=!0,L("%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://reactjs.org/link/special-props)",w))};S.isReactWarning=!0,Object.defineProperty(l,"key",{get:S,configurable:!0})}}function Bi(l,w){{var S=function(){Wt||(Wt=!0,L("%s: `ref` 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://reactjs.org/link/special-props)",w))};S.isReactWarning=!0,Object.defineProperty(l,"ref",{get:S,configurable:!0})}}var Fi=function(l,w,S,E,D,B,k){var _={$$typeof:e,type:l,key:w,ref:S,props:k,_owner:B};return _._store={},Object.defineProperty(_._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(_,"_self",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.defineProperty(_,"_source",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.freeze&&(Object.freeze(_.props),Object.freeze(_)),_};function ji(l,w,S,E,D){{var B,k={},_=null,Z=null;S!==void 0&&(Ht(S),_=""+S),Li(w)&&(Ht(w.key),_=""+w.key),_i(w)&&(Z=w.ref,ki(w,D));for(B in w)Ge.call(w,B)&&!Ri.hasOwnProperty(B)&&(k[B]=w[B]);if(l&&l.defaultProps){var V=l.defaultProps;for(B in V)k[B]===void 0&&(k[B]=V[B])}if(_||Z){var H=typeof l=="function"?l.displayName||l.name||"Unknown":l;_&&Di(k,H),Z&&Bi(k,H)}return Fi(l,_,Z,D,E,Yt.current,k)}}var ot=G.ReactCurrentOwner,zt=G.ReactDebugCurrentFrame;function Te(l){if(l){var w=l._owner,S=ze(l.type,l._source,w?w.type:null);zt.setExtraStackFrame(S)}else zt.setExtraStackFrame(null)}var lt;lt=!1;function ct(l){return typeof l=="object"&&l!==null&&l.$$typeof===e}function Kt(){{if(ot.current){var l=he(ot.current.type);if(l)return`
22
+
23
+ Check the render method of \``+l+"`."}return""}}function Gi(l){return""}var Zt={};function $i(l){{var w=Kt();if(!w){var S=typeof l=="string"?l:l.displayName||l.name;S&&(w=`
24
+
25
+ Check the top-level render call using <`+S+">.")}return w}}function qt(l,w){{if(!l._store||l._store.validated||l.key!=null)return;l._store.validated=!0;var S=$i(w);if(Zt[S])return;Zt[S]=!0;var E="";l&&l._owner&&l._owner!==ot.current&&(E=" It was passed a child from "+he(l._owner.type)+"."),Te(l),L('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',S,E),Te(null)}}function Jt(l,w){{if(typeof l!="object")return;if(nt(l))for(var S=0;S<l.length;S++){var E=l[S];ct(E)&&qt(E,w)}else if(ct(l))l._store&&(l._store.validated=!0);else if(l){var D=R(l);if(typeof D=="function"&&D!==l.entries)for(var B=D.call(l),k;!(k=B.next()).done;)ct(k.value)&&qt(k.value,w)}}}function Vi(l){{var w=l.type;if(w==null||typeof w=="string")return;var S;if(typeof w=="function")S=w.propTypes;else if(typeof w=="object"&&(w.$$typeof===c||w.$$typeof===g))S=w.propTypes;else return;if(S){var E=he(w);Pi(S,l.props,"prop",E,l)}else if(w.PropTypes!==void 0&&!lt){lt=!0;var D=he(w);L("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof w.getDefaultProps=="function"&&!w.getDefaultProps.isReactClassApproved&&L("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ui(l){{for(var w=Object.keys(l.props),S=0;S<w.length;S++){var E=w[S];if(E!=="children"&&E!=="key"){Te(l),L("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",E),Te(null);break}}l.ref!==null&&(Te(l),L("Invalid attribute `ref` supplied to `React.Fragment`."),Te(null))}}var Qt={};function ea(l,w,S,E,D,B){{var k=vi(l);if(!k){var _="";(l===void 0||typeof l=="object"&&l!==null&&Object.keys(l).length===0)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Z=Gi();Z?_+=Z:_+=Kt();var V;l===null?V="null":nt(l)?V="array":l!==void 0&&l.$$typeof===e?(V="<"+(he(l.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):V=typeof l,L("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",V,_)}var H=ji(l,w,S,D,B);if(H==null)return H;if(k){var ie=w.children;if(ie!==void 0)if(E)if(nt(ie)){for(var Ee=0;Ee<ie.length;Ee++)Jt(ie[Ee],l);Object.freeze&&Object.freeze(ie)}else L("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 Jt(ie,l)}if(Ge.call(w,"key")){var we=he(l),J=Object.keys(w).filter(function(Ki){return Ki!=="key"}),dt=J.length>0?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}";if(!Qt[we+dt]){var zi=J.length>0?"{"+J.join(": ..., ")+": ...}":"{}";L(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,dt,we,zi,we),Qt[we+dt]=!0}}return l===a?Ui(H):Vi(H),H}}function Hi(l,w,S){return ea(l,w,S,!0)}function Yi(l,w,S){return ea(l,w,S,!1)}var Xi=Yi,Wi=Hi;Ne.Fragment=a,Ne.jsx=Xi,Ne.jsxs=Wi}()),Ne}process.env.NODE_ENV==="production"?qe.exports=na():qe.exports=oa();var u=qe.exports,Oe={},Ie=ye;if(process.env.NODE_ENV==="production")Oe.createRoot=Ie.createRoot,Oe.hydrateRoot=Ie.hydrateRoot;else{var $e=Ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Oe.createRoot=function(r,e){$e.usingClientEntryPoint=!0;try{return Ie.createRoot(r,e)}finally{$e.usingClientEntryPoint=!1}},Oe.hydrateRoot=function(r,e,t){$e.usingClientEntryPoint=!0;try{return Ie.hydrateRoot(r,e,t)}finally{$e.usingClientEntryPoint=!1}}}const d={CANVAS_WIDTH:800,CANVAS_HEIGHT:600,PLAYER_HEIGHT:35,PLAYER_WIDTH:25,BOMB_SIZE:25,MONSTER_SIZE:25,PLATFORM_HEIGHT:25,COIN_SIZE:25,USE_SPRITES:!0,PARALLAX_ENABLED:!0,GRAVITY:.3,FLOAT_GRAVITY:.005,MOVE_SPEED:4,JUMP_POWER:8,SUPER_JUMP_POWER:12,COIN_BOUNCE_SPEED:3,COIN_BOUNCE_DAMPING:.8,COIN_GRAVITY:.1,MIN_JUMP_DURATION:50,MAX_JUMP_DURATION:300,TOTAL_BOMBS:23,STARTING_LIVES:3,POWER_COIN_SPAWN_INTERVAL:9,BONUS_COIN_SPAWN_INTERVAL:5e3,EXTRA_LIFE_COIN_RATIO:10,POWER_COIN_DURATION:7e3,POWER_COIN_POINTS:2e3,MONSTER_KILL_POINTS:100,BONUS_MULTIPLIER_COIN_POINTS:1e3,EXTRA_LIFE_COIN_POINTS:1e3,MULTIPLIER_THRESHOLDS:{1:0,2:1800,3:3600,4:5400,5:7200},MAX_MULTIPLIER:5,BOMB_POINTS:{NORMAL:100,FIREBOMB:200},BONUS_POINTS:{23:5e4,22:3e4,21:2e4,20:1e4}},gt={masterVolume:80,musicVolume:70,sfxVolume:90,masterMuted:!1,musicMuted:!1,sfxMuted:!1},q={ENABLED:!1,TARGET_STATE:"PLAYING",TARGET_LEVEL:6,MOCK_DATA:{score:15e3,lives:2,correctOrderCount:18,multiplier:2,multiplierScore:2600}};typeof window<"u"&&(window.__DEV_LOGGING_ENABLED__=q.ENABLED);const $={PLAYER:"#00FF00",BOMB:"#FFD700",BOMB_NEXT:"#FF0000",MONSTER:"#FF4444",MONSTER_FROZEN:"#4444FF",MONSTER_HORIZONTAL_PATROL:"#FF4444",MONSTER_VERTICAL_PATROL:"#44FF44",MONSTER_CHASER:"#FF8844",MONSTER_AMBUSHER:"#8844FF",MONSTER_FLOATER:"#44FFFF",PLATFORM:"#484744",BACKGROUND:"#262521"},mt=()=>({x:d.CANVAS_WIDTH/2,y:d.CANVAS_HEIGHT-100,width:d.PLAYER_WIDTH,height:d.PLAYER_HEIGHT,color:$.PLAYER,velocityX:0,velocityY:0,isGrounded:!1,isFloating:!1,isJumping:!1,jumpStartTime:0,moveSpeed:d.MOVE_SPEED,jumpPower:d.JUMP_POWER,gravity:d.GRAVITY,floatGravity:d.FLOAT_GRAVITY}),la=(r,e)=>({player:mt(),updatePlayer:t=>{r({player:{...e().player,...t}})},resetPlayer:()=>{r({player:mt()})},setPlayerPosition:(t,a)=>{r({player:{...e().player,x:t,y:a,velocityX:0,velocityY:0,isGrounded:!1,isFloating:!1,isJumping:!1,jumpStartTime:0}})}});var C=(r=>(r.MENU="MENU",r.COUNTDOWN="COUNTDOWN",r.PLAYING="PLAYING",r.PAUSED="PAUSED",r.BONUS="BONUS",r.VICTORY="VICTORY",r.GAME_OVER="GAME_OVER",r.MAP_CLEARED="MAP_CLEARED",r))(C||{}),A=(r=>(r.START="START",r.COUNTDOWN="COUNTDOWN",r.IN_GAME="IN_GAME",r.PAUSE="PAUSE",r.SETTINGS="SETTINGS",r.BONUS="BONUS",r.VICTORY="VICTORY",r.GAME_OVER="GAME_OVER",r.AUDIO_SETTINGS="AUDIO_SETTINGS",r))(A||{}),F=(r=>(r.HORIZONTAL_PATROL="HORIZONTAL_PATROL",r.VERTICAL_PATROL="VERTICAL_PATROL",r.CHASER="CHASER",r.AMBUSHER="AMBUSHER",r.FLOATER="FLOATER",r))(F||{}),P=(r=>(r.POWER="POWER",r.BONUS_MULTIPLIER="BONUS_MULTIPLIER",r.EXTRA_LIFE="EXTRA_LIFE",r.MONSTER_FREEZE="MONSTER_FREEZE",r))(P||{}),z=(r=>(r.GAME_START="GAME_START",r.LEVEL_COMPLETE="LEVEL_COMPLETE",r.PLAYER_DEATH="PLAYER_DEATH",r.GAME_OVER="GAME_OVER",r.BONUS_SCREEN="BONUS_SCREEN",r.BOMB_COLLECT="BOMB_COLLECT",r.MAP_CLEARED="MAP_CLEARED",r.BACKGROUND_MUSIC="BACKGROUND_MUSIC",r.MONSTER_HIT="MONSTER_HIT",r.COIN_COLLECT="COIN_COLLECT",r.POWER_COIN_ACTIVATE="POWER_COIN_ACTIVATE",r))(z||{});class ca{constructor(e=2){b(this,"logLevel",2);b(this,"lastLogTime",new Map);b(this,"logThrottle",new Map);switch("dataPassing".toLowerCase()){case"error":this.logLevel=0;break;case"warn":this.logLevel=1;break;case"info":this.logLevel=2;break;case"debug":this.logLevel=3;break;case"trace":this.logLevel=4;break;case"datapassing":this.logLevel=5;break;default:this.logLevel=e}}setLogLevel(e){this.logLevel=e}shouldLog(e,t=1e3){const a=Date.now(),i=this.lastLogTime.get(e)||0;return a-i>=t?(this.lastLogTime.set(e,a),!0):!1}game(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🎮 ${e}`,...t)}flow(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🌊 ${e}`,...t)}player(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`👤 ${e}`,...t)}monster(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`👹 ${e}`,...t)}coin(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🪙 ${e}`,...t)}bomb(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`💣 ${e}`,...t)}power(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`⚡ ${e}`,...t)}dataPassing(e,...t){this.logLevel===5&&console.log(`📡 ${e}`,...t)}pause(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&this.shouldLog("pause",500)&&console.log(`⏸️ ${e}`,...t)}scaling(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&this.shouldLog("scaling",2e3)&&console.log(`📈 ${e}`,...t)}debug(e,...t){(this.logLevel===3||this.logLevel===4)&&console.log(`🔧 ${e}`,...t)}audio(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🎵 ${e}`,...t)}error(e,...t){this.logLevel>=0&&console.error(`❌ ${e}`,...t)}warn(e,...t){this.logLevel>=1&&console.warn(`⚠️ ${e}`,...t)}info(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`ℹ️ ${e}`,...t)}trace(e,...t){this.logLevel===4&&console.log(`🔍 ${e}`,...t)}dev(e,...t){}score(e,...t){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`📊 ${e}`,...t)}clearThrottle(){this.lastLogTime.clear()}disable(){this.logLevel=0}enable(){this.logLevel=2}setLevel(e){this.logLevel=e}}const v=new ca,x={error:(r,...e)=>v.error(r,...e),warn:(r,...e)=>v.warn(r,...e),info:(r,...e)=>v.info(r,...e),debug:(r,...e)=>v.debug(r,...e),trace:(r,...e)=>v.trace(r,...e),game:(r,...e)=>v.game(r,...e),dev:(r,...e)=>v.dev(r,...e),audio:(r,...e)=>v.audio(r,...e),coin:(r,...e)=>v.coin(r,...e),bomb:(r,...e)=>v.bomb(r,...e),score:(r,...e)=>v.score(r,...e),dataPassing:(r,...e)=>v.dataPassing(r,...e)},da=(r,e,t,a,i)=>{const s={score:r,map:e,timestamp:Date.now(),level:t,lives:a,multiplier:i};x.dataPassing("Sending score to host:",s);const n=new CustomEvent("scoreUpdate",{detail:{score:r},bubbles:!0,composed:!0});window.dispatchEvent(n);const o=new CustomEvent("game:score-updated",{detail:s,bubbles:!0,composed:!0});window.dispatchEvent(o)},ua=()=>{x.dataPassing("Game ready signal sent to host");const r=new CustomEvent("game:ready",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0});window.dispatchEvent(r)},Ve=(r,e)=>{x.dataPassing("Game state update sent to host:",{state:r,map:e});const t=new CustomEvent("game:state-updated",{detail:{state:r,map:e,timestamp:Date.now()},bubbles:!0,composed:!0});window.dispatchEvent(t)},bt=r=>{x.dataPassing("Sending map completion data to host:",r);const e=new CustomEvent("game:map-completed",{detail:r,bubbles:!0,composed:!0});window.dispatchEvent(e)},ha=r=>{x.dataPassing("Sending game completion data to host:",r);const e=new CustomEvent("game:completed",{detail:r,bubbles:!0,composed:!0});window.dispatchEvent(e)},pa=(r,e,t,a,i,s,n)=>{const o=r.reduce((y,M)=>y+M.totalBombs,0),c=r.reduce((y,M)=>y+M.correctOrderCount,0),h=r.reduce((y,M)=>y+M.coinsCollected,0),m=r.reduce((y,M)=>y+M.powerModeActivations,0),g=n-s,p=r.length>0?g/r.length/1e3:0;return{totalBombs:o,totalCorrectOrders:c,totalCoinsCollected:h,totalPowerModeActivations:m,averageCompletionTime:Math.round(p),totalPlayTime:Math.round(g/1e3)}},fa=r=>{switch(r){case F.HORIZONTAL_PATROL:return $.MONSTER_HORIZONTAL_PATROL;case F.VERTICAL_PATROL:return $.MONSTER_VERTICAL_PATROL;case F.CHASER:return $.MONSTER_CHASER;case F.AMBUSHER:return $.MONSTER_AMBUSHER;case F.FLOATER:return $.MONSTER_FLOATER;default:return $.MONSTER}},Re=(r,e,t,a=1,i=0)=>({x:r,y:e,width:d.MONSTER_SIZE,height:d.MONSTER_SIZE,color:fa(t),type:t,speed:a,direction:1,isActive:!0,spawnDelay:i}),Q=(r,e,t,a="left",i=1,s=1,n,o=0)=>{const c=a==="left"?r:r+t-d.MONSTER_SIZE,h=e-d.MONSTER_SIZE,m=a==="left"?1:-1;return{...Re(c,h,F.HORIZONTAL_PATROL,s,o),patrolStartX:r,patrolEndX:r+t,direction:m,walkLengths:i}},ne=(r,e,t,a="left",i=1,s=1,n=0)=>{const o=a==="left"?r-d.MONSTER_SIZE:r+15;return{...Re(o,e,F.VERTICAL_PATROL,i,n),patrolStartY:e,patrolEndY:e+t,direction:s,patrolSide:a,targetPlatformX:r}},oe=(r,e,t=45,a=1,i=0)=>({...Re(r,e,F.FLOATER,a,i),startAngle:t,spawnTime:Date.now()}),xe=(r,e,t=.8,a=.2,i=200,s=0)=>({...Re(r,e,F.CHASER,t,s),direction:0,directness:a,chaseUpdateInterval:i}),ve=(r,e,t=.8,a=8e3,i=0)=>({...Re(r,e,F.AMBUSHER,t,i),ambushCooldown:0}),f=(r,e,t,a)=>({x:r,y:e,width:d.BOMB_SIZE,height:d.BOMB_SIZE,order:t,group:a,isCollected:!1,isBlinking:!1}),I=(r,e,t,a=$.PLATFORM,i="#000")=>({x:r,y:e,width:t.width,height:t.height,borderColor:i,color:a}),Se=(r,e,t,a=$.PLATFORM,i="#000")=>({x:r,y:e,width:15,height:t,borderColor:i,color:a,isVertical:!0}),le=r=>(d.CANVAS_WIDTH-r)/2,ce=r=>(d.CANVAS_HEIGHT-r)/2,Me=(r,e)=>({x:le(r),y:ce(e)}),ga={id:"level1",name:"startup lab",width:d.CANVAS_WIDTH,height:d.CANVAS_HEIGHT,playerStart:Me(d.PLAYER_WIDTH,d.PLAYER_HEIGHT),spawnIndicatorColor:"#00ffff",groupSequence:[1,2,3,4,5],ground:{x:0,y:d.CANVAS_HEIGHT-40,width:d.CANVAS_WIDTH,height:40,color:"#88a2bc"},platforms:[Se(96,220,150,"#abccee","#4f6a8f"),Se(684,220,150,"#abccee","#4f6a8f"),I(95,450,{width:200,height:15},"#abccee","#4f6a8f"),I(480,150,{width:200,height:15},"#abccee","#4f6a8f"),I(430,430,{width:200,height:15},"#abccee","#4f6a8f"),I(170,170,{width:200,height:15},"#abccee","#4f6a8f")],bombs:[f(440,400,1,1),f(490,400,2,1),f(540,400,3,1),f(590,400,4,1),f(180,140,5,2),f(230,140,6,2),f(280,140,7,2),f(330,140,8,2),f(710,230,9,3),f(710,280,10,3),f(710,330,11,3),f(130,470,12,4),f(180,470,13,4),f(230,470,14,4),f(520,70,15,5),f(570,70,16,5),f(620,70,17,5),f(120,230,18,6),f(120,280,19,6),f(120,330,20,6),f(130,420,21,7),f(180,420,22,7),f(230,420,23,7)],coinSpawnPoints:[{x:le(d.COIN_SIZE),y:ce(d.COIN_SIZE),type:P.POWER,spawnAngle:45},{x:570,y:50,type:P.POWER,spawnAngle:135},{x:200,y:75,type:P.BONUS_MULTIPLIER},{x:200,y:75,type:P.BONUS_MULTIPLIER},{x:200,y:75,type:P.EXTRA_LIFE},{x:200,y:75,type:P.EXTRA_LIFE}],monsterSpawnPoints:[{spawnDelay:4e3,createMonster:()=>Q(430,430,200,"left",1,1)},{spawnDelay:5e3,createMonster:()=>ve(500,500,1)}],monsters:[ne(105,220,220,"right"),ne(695,220,220,"right",2,1),Q(170,170,200,"left"),xe(250,300,1,.3,1e3)]},ma={id:"level2",name:"innovasjon norge",width:d.CANVAS_WIDTH,height:d.CANVAS_HEIGHT,playerStart:Me(d.PLAYER_WIDTH,d.PLAYER_HEIGHT),spawnIndicatorColor:"#ff6b6b",groupSequence:[1,2,3,4,5],ground:{x:0,y:d.CANVAS_HEIGHT-40,width:d.CANVAS_WIDTH,height:40,color:"#262335"},platforms:[I(165,475,{width:150,height:15},"#d4896a","#262335"),I(485,475,{width:150,height:15},"#d4896a","#262335"),I(300,380,{width:200,height:15},"#d4896a","#262335"),I(300,240,{width:200,height:15},"#d4896a","#262335"),I(165,130,{width:150,height:15},"#d4896a","#262335"),I(485,130,{width:150,height:15},"#d4896a","#262335")],bombs:[f(600,95,1,1),f(550,95,2,1),f(500,95,3,1),f(180,440,4,2),f(230,440,5,2),f(280,440,6,2),f(280,95,7,3),f(230,95,8,3),f(180,95,9,3),f(600,440,10,4),f(550,440,11,4),f(500,440,12,4),f(385,70,13,5),f(385,120,14,5),f(385,170,15,5),f(500,500,16,6),f(550,500,17,6),f(600,500,18,6),f(180,500,19,7),f(230,500,20,7),f(280,500,21,7),f(360,345,22,8),f(410,345,23,8)],coinSpawnPoints:[{x:400,y:d.CANVAS_HEIGHT-150,type:P.POWER,spawnAngle:60},{x:400,y:d.CANVAS_HEIGHT-250,type:P.POWER,spawnAngle:120},{x:520,y:100,type:P.BONUS_MULTIPLIER,spawnAngle:120},{x:180,y:100,type:P.BONUS_MULTIPLIER,spawnAngle:120},{x:520,y:100,type:P.EXTRA_LIFE,spawnAngle:120},{x:180,y:100,type:P.EXTRA_LIFE,spawnAngle:120}],monsterSpawnPoints:[{spawnDelay:7e3,createMonster:()=>xe(750,500,1)},{spawnDelay:15e3,createMonster:()=>ve(50,500,1)}],monsters:[Q(165,130,150,"left",0,.7),Q(485,130,150,"right",0,1),Q(300,240,200,"left",0,1),oe(50,300,45,1),oe(750,500,155,1)]},ba={id:"level3",name:"skatteetaten",width:d.CANVAS_WIDTH,height:d.CANVAS_HEIGHT,playerStart:Me(d.PLAYER_WIDTH,d.PLAYER_HEIGHT),spawnIndicatorColor:"#4ecdc4",groupSequence:[1,2,3,4,5,6,7],ground:{x:0,y:d.CANVAS_HEIGHT-40,width:d.CANVAS_WIDTH,height:40,color:"#3c4c56"},platforms:[I(150,490,{width:500,height:15},"#acc7d0","#556d7b"),I(100,400,{width:200,height:15},"#acc7d0","#556d7b"),I(500,400,{width:200,height:15},"#acc7d0","#556d7b"),I(100,250,{width:200,height:15},"#acc7d0","#556d7b"),I(500,250,{width:200,height:15},"#acc7d0","#556d7b"),I(150,130,{width:500,height:15},"#acc7d0","#556d7b")],bombs:[f(540,275,1,1),f(590,275,2,1),f(640,275,3,1),f(240,275,4,2),f(190,275,5,2),f(140,275,6,2),f(325,515,7,3),f(375,515,8,3),f(425,515,9,3),f(760,360,10,4),f(760,310,11,4),f(760,260,12,4),f(15,360,13,5),f(15,310,14,5),f(15,260,15,5),f(325,155,16,6),f(375,155,17,6),f(425,155,18,6),f(375,205,19,6),f(375,255,20,6),f(580,455,21,7),f(195,455,22,7),f(375,95,23,7)],coinSpawnPoints:[],monsters:[Q(150,490,500,"left",0,1),Q(150,130,500,"left",0,1),Q(150,130,500,"right",0,1),Q(100,400,200,"right",0,1),Q(500,400,200,"left",0,1),xe(200,200,1,.1,500)],monsterSpawnPoints:[{spawnDelay:3e3,createMonster:()=>oe(le(d.MONSTER_SIZE),ce(d.MONSTER_SIZE),150,1)},{spawnDelay:6e3,createMonster:()=>oe(le(d.MONSTER_SIZE),ce(d.MONSTER_SIZE),50,1)},{spawnDelay:5e3,createMonster:()=>ve(50,550,1,8e3)}]},wa={id:"level4",name:"nav",width:d.CANVAS_WIDTH,height:d.CANVAS_HEIGHT,playerStart:Me(d.PLAYER_WIDTH,d.PLAYER_HEIGHT),spawnIndicatorColor:"#ffe66d",groupSequence:[1,2,3,4,5],ground:{x:0,y:d.CANVAS_HEIGHT-40,width:d.CANVAS_WIDTH,height:40,color:"#586c5c"},platforms:[I(580,500,{width:150,height:15},"#586c5c","#202e32"),I(580,445,{width:150,height:15},"#586c5c","#202e32"),Se(500,245,150,"#586c5c","#202e32"),Se(555,245,150,"#586c5c","#202e32"),I(90,45,{width:150,height:15},"#586c5c","#202e32"),I(90,100,{width:150,height:15},"#586c5c","#202e32"),Se(240,160,150,"#586c5c","#202e32"),Se(295,160,150,"#586c5c","#202e32"),I(90,500,{width:200,height:15},"#586c5c","#202e32"),I(235,400,{width:150,height:15},"#586c5c","#202e32"),I(415,145,{width:150,height:15},"#586c5c","#202e32"),I(530,45,{width:200,height:15},"#586c5c","#202e32")],bombs:[f(595,467,1,1),f(645,467,2,1),f(695,467,3,1),f(522,255,4,2),f(522,305,5,2),f(522,355,6,2),f(130,467,7,3),f(180,467,8,3),f(230,467,9,3),f(250,367,10,4),f(300,367,11,4),f(350,367,12,4),f(263,170,13,5),f(263,220,14,5),f(263,270,15,5),f(100,67,16,6),f(150,67,17,6),f(200,67,18,6),f(430,113,19,7),f(480,113,20,7),f(530,113,21,7),f(630,68,22,8),f(680,68,23,8)],coinSpawnPoints:[],monsterSpawnPoints:[{spawnDelay:4e3,createMonster:()=>oe(le(d.MONSTER_SIZE),ce(d.MONSTER_SIZE),65,1)},{spawnDelay:6e3,createMonster:()=>oe(240,350,40,1)},{spawnDelay:2e3,createMonster:()=>ve(50,50,1.2,8e3)},{spawnDelay:4e3,createMonster:()=>ve(50,50,1.2,8e3)},{spawnDelay:4e3,createMonster:()=>xe(le(d.MONSTER_SIZE),ce(d.MONSTER_SIZE),3,.5)},{spawnDelay:9e3,createMonster:()=>xe(590,400,3,.5)}],monsters:[ne(500,170,350,"right"),ne(240,60,340,"right"),Q(90,500,200,"left"),Q(90,45,150,"right")]},ya={id:"level5",name:"kommunehuset",width:d.CANVAS_WIDTH,height:d.CANVAS_HEIGHT,playerStart:Me(d.PLAYER_WIDTH,d.PLAYER_HEIGHT),spawnIndicatorColor:"#a8e6cf",groupSequence:[1,2,3,4,5,6],ground:{x:0,y:d.CANVAS_HEIGHT-40,width:d.CANVAS_WIDTH,height:40,color:"#8d4fc9"},platforms:[I(375,300,{width:50,height:15},"#ff4700","#631b09"),I(88,300,{width:50,height:15},"#ff4700","#631b09"),I(667,300,{width:50,height:15},"#ff4700","#631b09")],bombs:[f(150,60,1,1),f(100,60,2,1),f(50,60,3,1),f(625,60,4,2),f(675,60,5,2),f(725,60,6,2),f(150,525,7,3),f(100,525,8,3),f(50,525,9,3),f(625,525,10,4),f(675,525,11,4),f(725,525,12,4),f(438,100,13,5),f(388,100,14,5),f(338,100,15,5),f(338,525,16,6),f(388,525,17,6),f(438,525,18,6),f(388,330,19,6),f(388,380,20,6),f(388,430,21,6),f(101,270,22,7),f(680,270,23,7)],monsters:[ne(520,200,350,"right"),ne(225,200,350,"right"),ne(520,20,350,"right"),ne(225,20,350,"right"),Q(0,550,800,"left")],monsterSpawnPoints:[{spawnDelay:5e3,createMonster:()=>ve(700,150)},{spawnDelay:7e3,createMonster:()=>oe(100,150)},{spawnDelay:1e4,createMonster:()=>xe(le(d.MONSTER_SIZE),ce(d.MONSTER_SIZE+200))},{spawnDelay:15e3,createMonster:()=>oe(le(d.MONSTER_SIZE),ce(d.MONSTER_SIZE-200))}],coinSpawnPoints:[{x:400,y:500,type:P.POWER,spawnAngle:46},{x:500,y:200,type:P.POWER,spawnAngle:45},{x:388,y:50,type:P.BONUS_MULTIPLIER},{x:388,y:50,type:P.EXTRA_LIFE},{x:101,y:50,type:P.BONUS_MULTIPLIER},{x:101,y:50,type:P.EXTRA_LIFE},{x:680,y:50,type:P.BONUS_MULTIPLIER},{x:680,y:50,type:P.EXTRA_LIFE}]};I(200,d.CANVAS_HEIGHT-120,{width:200,height:15},"#ebb185"),I(600,d.CANVAS_HEIGHT-110,{width:200,height:15},"#ebb185"),I(100,d.CANVAS_HEIGHT-180,{width:200,height:15},"#ebb185"),I(700,d.CANVAS_HEIGHT-180,{width:200,height:15},"#ebb185"),I(300,d.CANVAS_HEIGHT-240,{width:200,height:15},"#ebb185"),I(500,d.CANVAS_HEIGHT-240,{width:200,height:15},"#ebb185"),I(150,d.CANVAS_HEIGHT-300,{width:200,height:15},"#ebb185"),I(650,d.CANVAS_HEIGHT-300,{width:200,height:15},"#ebb185"),I(400,d.CANVAS_HEIGHT-370,{width:200,height:15},"#ebb185"),I(250,d.CANVAS_HEIGHT-420,{width:200,height:15},"#ebb185"),I(550,d.CANVAS_HEIGHT-420,{width:200,height:15},"#ebb185"),d.CANVAS_HEIGHT-70,d.MONSTER_SIZE,d.MONSTER_SIZE,$.MONSTER,F.HORIZONTAL_PATROL,d.CANVAS_HEIGHT-130,d.MONSTER_SIZE,d.MONSTER_SIZE,$.MONSTER,F.HORIZONTAL_PATROL,d.CANVAS_HEIGHT-170,d.MONSTER_SIZE,d.MONSTER_SIZE,$.MONSTER,F.HORIZONTAL_PATROL,d.CANVAS_HEIGHT-290,d.MONSTER_SIZE,d.MONSTER_SIZE,$.MONSTER,F.HORIZONTAL_PATROL,d.CANVAS_HEIGHT-350,d.MONSTER_SIZE,d.MONSTER_SIZE,$.MONSTER,F.HORIZONTAL_PATROL,d.CANVAS_HEIGHT-100,P.POWER,d.CANVAS_HEIGHT-140,P.POWER;const xa={id:"level7",name:"silicone vally",width:d.CANVAS_WIDTH,height:d.CANVAS_HEIGHT,playerStart:Me(d.PLAYER_WIDTH,d.PLAYER_HEIGHT),spawnIndicatorColor:"#feca57",groupSequence:[1,2,3,4,5],ground:{x:0,y:d.CANVAS_HEIGHT-40,width:d.CANVAS_WIDTH,height:40,color:"#46474c"},platforms:[],bombs:[f(440,530,1,1),f(490,530,2,1),f(540,530,3,1),f(590,530,4,1),f(760,530,5,2),f(760,480,6,2),f(760,430,7,2),f(760,380,8,2),f(590,330,9,3),f(540,330,10,3),f(490,330,11,3),f(440,330,12,3),f(290,530,13,4),f(240,530,14,4),f(190,530,15,4),f(140,530,16,4),f(15,530,17,5),f(15,480,18,5),f(15,430,19,5),f(15,380,20,5),f(190,330,21,6),f(240,330,22,6),f(290,330,23,6)],coinSpawnPoints:[],monsterSpawnPoints:[],monsters:[]},Ce=[ga,ma,ba,wa,ya,xa],va=(r,e)=>(x.info(`Initializing game state slice with ${d.STARTING_LIVES} lives`),{currentState:C.MENU,score:0,levelScore:0,lives:d.STARTING_LIVES,currentLevel:1,showMenu:A.START,previousMenu:null,isPaused:!1,bonusAnimationComplete:!1,setState:t=>{r({currentState:t,isPaused:t===C.PAUSED}),t===C.MENU?r({showMenu:A.START}):t===C.PLAYING&&r({showMenu:A.IN_GAME});const a=e(),i="currentMap"in a?a.currentMap:void 0;Ve(t,i?.name)},setMenuType:t=>{const a=e();t===A.SETTINGS?r({showMenu:t,previousMenu:a.showMenu}):r({showMenu:t})},setBonusAnimationComplete:t=>{r({bonusAnimationComplete:t})},loseLife:()=>{const{lives:t}=e(),a=t-1;x.info(`Losing life: ${t} → ${a}`),r({lives:a});const i=e(),s="currentMap"in i?i.currentMap:void 0;if(Ve(C.PLAYING,s?.name),a<=0){x.info(`GAME OVER triggered at ${a} lives`),r({currentState:C.GAME_OVER,showMenu:A.GAME_OVER});const n="currentMap"in i?i.currentMap:void 0;Ve(C.GAME_OVER,n?.name);const o="getLevelResults"in i?i.getLevelResults():[],c="multiplier"in i?i.multiplier:1,h="getGameStartTime"in i?i.getGameStartTime():Date.now(),m="getSessionId"in i?i.getSessionId():`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,g=pa(o,e().score,a,c,"failed",h,Date.now()),p={finalScore:e().score,totalLevels:Ce.length,completedLevels:o.length,timestamp:Date.now(),lives:a,multiplier:c,levelHistory:o,totalCoinsCollected:g.totalCoinsCollected,totalPowerModeActivations:g.totalPowerModeActivations,totalBombs:g.totalBombs,totalCorrectOrders:g.totalCorrectOrders,averageCompletionTime:g.averageCompletionTime,gameEndReason:"failed",sessionId:m,startTime:h,endTime:Date.now()};ha(p)}},addLife:()=>{const{lives:t}=e(),a=t+1;x.info(`Adding life: ${t} → ${a}`),r({lives:a})},nextLevel:()=>{const{currentLevel:t}=e();r({currentLevel:t+1}),r({levelScore:0});const a=e();"resetMultiplier"in a&&(x.debug("Resetting multiplier on level change..."),a.resetMultiplier());const i="currentMap"in a?a.currentMap:void 0;Ve(C.PLAYING,i?.name)},addScore:t=>{const{score:a,levelScore:i,currentLevel:s,lives:n}=e(),o=a+t;r({score:o,levelScore:i+t});const c=e(),h="multiplier"in c?c.multiplier:1,m="currentMap"in c?c.currentMap:void 0;da(o,m?.name||`Level ${s}`,s,n,h)},resetLevelScores:()=>{r({levelScore:0})},resetGameState:()=>{r({currentState:C.MENU,score:0,levelScore:0,lives:d.STARTING_LIVES,currentLevel:1,showMenu:A.START,previousMenu:null,isPaused:!1,bonusAnimationComplete:!1})}}),Sa=(r,e)=>{const t=r?d.BOMB_POINTS.FIREBOMB:d.BOMB_POINTS.NORMAL,a=t*e;return{basePoints:t,actualPoints:a,multiplier:e,isFirebomb:r}},Ma=r=>{const{actualPoints:e,isFirebomb:t,multiplier:a}=r;return`🎯 Score: +${e} (${t?"Firebomb":"Normal"} x${a})`},Ca=(r,e)=>{const{MULTIPLIER_THRESHOLDS:t,MAX_MULTIPLIER:a}=d;if(e>=a)return 1;const i=t[e],s=t[e+1];if(!s)return 1;const n=(r-i)/(s-i);return Math.max(0,Math.min(1,n))},Ta=(r,e)=>({bombs:[],collectedBombs:[],correctOrderCount:0,nextBombOrder:1,bombManager:null,collectBomb:t=>{const{bombs:a,bombManager:i}=e(),s=a.find(p=>p.order===t);if(!s||!i)return x.warn("Bomb or bomb manager not found"),{isValid:!1,isCorrect:!1};const n=i.handleBombClick(s.group,s.order);if(!n.isValid)return{isValid:!1,isCorrect:!1};const o=n.isCorrect,c=e(),h="multiplier"in c?c.multiplier:1,m=Sa(o,h);if("addScore"in c&&c.addScore(m.actualPoints),"addMultiplierScore"in c&&c.addMultiplierScore(m.actualPoints),"coinManager"in c&&c.coinManager&&c.coinManager.onPointsEarned(m.actualPoints,!1),(o||m.actualPoints>=400)&&x.score(Ma(m)),o&&"addFloatingText"in c){const p=a.find(y=>y.order===t);if(p){const y=`${m.actualPoints}`;c.addFloatingText(y,p.x+p.width/2,p.y+p.height/2,1e3,"#FFD700",15)}}const g=a.map(p=>{if(p.order===t)return{...p,isCollected:!0,isCorrect:n.isCorrect};const y=i.getActiveGroup(),M=i.getNextBombOrder(),T=y!==null&&M!==null&&p.group===y&&p.order===M&&!p.isCollected;return{...p,isBlinking:T}});return r({bombs:g,correctOrderCount:i.getCorrectOrderCount(),collectedBombs:Array.from(i.getCollectedBombs()).map(p=>{const[y,M]=p.split("-").map(Number);return M})}),{isValid:!0,isCorrect:n.isCorrect}},setBombs:t=>{r({bombs:t})},setBombManager:t=>{r({bombManager:t})},resetBombState:()=>{r({bombs:[],collectedBombs:[],correctOrderCount:0,nextBombOrder:1,bombManager:null})}});class Ea{constructor(e){b(this,"bombs",[]);b(this,"collectedBombs",new Set);b(this,"correctBombs",new Set);b(this,"activeGroup",null);b(this,"nextBombOrder",null);b(this,"gameStarted",!1);this.setBombs(e)}reset(){this.collectedBombs.clear(),this.correctBombs.clear(),this.activeGroup=null,this.nextBombOrder=null,this.gameStarted=!1}setBombs(e){this.bombs=e}handleBombClick(e,t){const a=`${e}-${t}`;if(this.collectedBombs.has(a))return{isValid:!1,isCorrect:!1,gameCompleted:!1};if(!this.gameStarted)return this.startGame(e,t),this.collectBomb(a,!0),this.updateNextBomb(),{isValid:!0,isCorrect:!0,gameCompleted:this.isGameCompleted()};const i=this.isValidBomb(e,t);return i?(this.collectBomb(a,!0),this.updateNextBomb()):this.collectBomb(a,!1),{isValid:!0,isCorrect:i,gameCompleted:this.isGameCompleted()}}startGame(e,t){this.gameStarted=!0,this.activeGroup=e,this.nextBombOrder=this.findLowestOrderInGroup(e)}isValidBomb(e,t){return this.activeGroup===null||this.nextBombOrder===null?!1:e===this.activeGroup&&t===this.nextBombOrder&&!this.collectedBombs.has(`${e}-${t}`)}collectBomb(e,t){this.collectedBombs.add(e),t&&this.correctBombs.add(e)}updateNextBomb(){if(this.activeGroup!==null)if(this.isGroupCompleted(this.activeGroup)){x.dev(`GROUP ${this.activeGroup} COMPLETED!`);const e=this.findNextAvailableGroup();if(e!==null)this.activeGroup=e,this.nextBombOrder=this.findLowestOrderInGroup(e);else{this.activeGroup=null,this.nextBombOrder=null;return}}else{const e=this.findNextAvailableOrderInGroup(this.activeGroup);e!==null&&(this.nextBombOrder=e)}}isGroupCompleted(e){return this.bombs.filter(a=>a.group===e).every(a=>{const i=`${a.group}-${a.order}`;return this.collectedBombs.has(i)})}findNextAvailableGroup(){const e=[...new Set(this.bombs.map(t=>t.group))].sort((t,a)=>t-a);for(const t of e)if(!this.isGroupCompleted(t))return t;return null}findLowestOrderInGroup(e){const a=this.bombs.filter(i=>i.group===e).filter(i=>{const s=`${i.group}-${i.order}`;return!this.collectedBombs.has(s)});return a.length>0?Math.min(...a.map(i=>i.order)):null}findNextAvailableOrderInGroup(e){return this.findLowestOrderInGroup(e)}isGameCompleted(){return this.collectedBombs.size===this.bombs.length}getCollectedBombs(){return new Set(this.collectedBombs)}getCorrectBombs(){return new Set(this.correctBombs)}getActiveGroup(){return this.activeGroup}getNextBombOrder(){return this.nextBombOrder}isGameStarted(){return this.gameStarted}getCorrectOrderCount(){return this.correctBombs.size}}const Aa=(r,e)=>({currentMap:null,levelStartTime:0,levelCompletionTime:null,monsters:[],platforms:[],ground:null,initializeLevel:t=>{const a=new Ea(t.bombs),s=[...t.bombs].sort((c,h)=>c.group-h.group||c.order-h.order)[0],n=c=>{switch(c){case F.HORIZONTAL_PATROL:return $.MONSTER;case F.VERTICAL_PATROL:return"#FF6B6B";case F.CHASER:return"#FFD93D";case F.AMBUSHER:return"#FF8800";case F.FLOATER:return"#4ECDC4";default:return $.MONSTER}},o=t.monsters.map(c=>({...c,color:c.color||n(c.type)}));return r({currentMap:t,platforms:t.platforms,ground:t.ground,monsters:o}),{bombManager:a,firstBomb:s}},updateMonsters:t=>{r({monsters:t})},resetLevelState:()=>{r({currentMap:null,levelStartTime:0,levelCompletionTime:null,monsters:[],platforms:[],ground:null})},sendLevelCompletionData:t=>{const{levelStartTime:a}=e(),i=Date.now()-a,s={...t,timestamp:Date.now(),completionTime:i};x.debug("Sending level completion data:",s),bt(s)}}),Pa=(r,e)=>({levelHistory:[],gameStartTime:0,sessionId:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,addLevelResult:t=>{r(a=>({levelHistory:[...a.levelHistory,{...t,completionTime:t.completionTime||0,timestamp:t.timestamp||Date.now(),lives:t.lives||0,multiplier:t.multiplier||1,totalBombs:t.totalBombs||0,correctOrderCount:t.correctOrderCount||0}]}))},getLevelResults:()=>e().levelHistory,resetLevelHistory:()=>{r({levelHistory:[],gameStartTime:Date.now(),sessionId:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`})},setGameStartTime:t=>{r({gameStartTime:t})},getGameStartTime:()=>e().gameStartTime,getSessionId:()=>e().sessionId}),Na=(r,e)=>({multiplier:1,multiplierScore:0,calculateMultiplier:t=>{const{MULTIPLIER_THRESHOLDS:a,MAX_MULTIPLIER:i}=d;for(let s=i;s>=1;s--)if(t>=a[s])return s;return 1},addMultiplierScore:t=>{const{multiplier:a,multiplierScore:i,calculateMultiplier:s}=e(),n=i+t,o=s(n),c=o>a;return r({multiplier:Math.max(a,o),multiplierScore:c?0:n}),{newMultiplier:Math.max(a,o),multiplierIncreased:c}},resetMultiplier:()=>{r({multiplier:1,multiplierScore:0})},setMultiplier:(t,a)=>{r({multiplier:t,multiplierScore:a})}}),Oa=(r,e)=>({audioSettings:gt,audioManager:null,updateAudioSettings:t=>{r({audioSettings:{...e().audioSettings,...t}});const a=e().audioManager;a&&a.updateVolumes&&a.updateVolumes()},resetAudioSettings:()=>{r({audioSettings:gt});const t=e().audioManager;t&&t.updateVolumes&&t.updateVolumes()},setAudioManager:t=>{r({audioManager:t})}}),Ia=(r,e)=>({coins:[],coinManager:null,activeEffects:{powerMode:!1,powerModeEndTime:0},firebombCount:0,totalCoinsCollected:0,totalPowerCoinsCollected:0,totalBonusMultiplierCoinsCollected:0,totalExtraLifeCoinsCollected:0,setCoins:t=>{r({coins:t})},setCoinManager:t=>{r({coinManager:t})},collectCoin:t=>{const{coinManager:a}=e();if(!a)return;a.collectCoin(t);const i=e().coins.map(y=>y===t?{...y,isCollected:!0}:y);let s=0;if(a.isPowerModeActive()&&t.type==="POWER"&&t.spawnTime!==void 0){const y=a.getPcoinColorForTime(t.spawnTime);s=Date.now()+y.duration}const n={powerMode:a.isPowerModeActive(),powerModeEndTime:s},o=e(),c=o.totalCoinsCollected+1,h=o.totalPowerCoinsCollected+(t.type==="POWER"?1:0),m=o.totalBonusMultiplierCoinsCollected+(t.type==="BONUS_MULTIPLIER"?1:0),g=o.totalExtraLifeCoinsCollected+(t.type==="EXTRA_LIFE"?1:0);r({coins:i,activeEffects:n,totalCoinsCollected:c,totalPowerCoinsCollected:h,totalBonusMultiplierCoinsCollected:m,totalExtraLifeCoinsCollected:g});const p=e();if(t.type==="POWER")"addScore"in p&&p.addScore(d.POWER_COIN_POINTS);else if(t.type==="BONUS_MULTIPLIER"){if("addScore"in p&&"multiplier"in p){const y=p.multiplier,M=1e3*y;if(p.addScore(M),y<d.MAX_MULTIPLIER&&"addMultiplierScore"in p&&"multiplierScore"in p){const{MULTIPLIER_THRESHOLDS:T}=d,R=T[y+1];if(R!==void 0){const G=R-p.multiplierScore;p.addMultiplierScore(G)}}}}else if(t.type==="EXTRA_LIFE"&&"addScore"in p&&"multiplier"in p&&"addLife"in p){const y=p.multiplier,M=d.EXTRA_LIFE_COIN_POINTS*y;p.addScore(M),p.addLife(),x.debug("Extra life added via coin slice!")}x.debug(`Coin collected: ${t.type} (Total: ${c}, Power: ${h}, Bonus: ${m})`)},onFirebombCollected:()=>{const{coinManager:t}=e();t&&(t.onFirebombCollected(),r({firebombCount:t.getFirebombCount(),coins:t.getCoins()}))},resetCoinState:()=>{const{coinManager:t}=e();t&&t.reset(),r({coins:[],activeEffects:{powerMode:!1,powerModeEndTime:0},firebombCount:0,totalCoinsCollected:0,totalPowerCoinsCollected:0,totalBonusMultiplierCoinsCollected:0,totalExtraLifeCoinsCollected:0})},getCoinStats:()=>{const t=e();return{totalCoinsCollected:t.totalCoinsCollected,totalPowerCoinsCollected:t.totalPowerCoinsCollected,totalBonusMultiplierCoinsCollected:t.totalBonusMultiplierCoinsCollected,totalExtraLifeCoinsCollected:t.totalExtraLifeCoinsCollected}},updateMonsterStates:t=>{const{coinManager:a}=e();if(!a)return;const i=e().activeEffects.powerMode,s=a.isPowerModeActive();i&&!s?t.forEach(o=>{o.isFrozen=!1}):a.updateMonsters(t);let n=0;s&&a&&(n=a.getPowerModeEndTime()),r({activeEffects:{powerMode:s,powerModeEndTime:n}})},resetEffects:()=>{const{coinManager:t}=e();t&&t.resetEffects(),r({activeEffects:{powerMode:!1,powerModeEndTime:0}})}}),Ra=(r,e)=>({floatingTexts:[],addFloatingText:(t,a,i,s=1e3,n="#FFFFFF",o=16)=>{const h={id:`floating-text-${Date.now()}-${Math.random()}`,text:t,x:a,y:i,startTime:Date.now(),duration:s,color:n,fontSize:o};r(m=>({floatingTexts:[...m.floatingTexts,h]}))},removeFloatingText:t=>{r(a=>({floatingTexts:a.floatingTexts.filter(i=>i.id!==t)}))},updateFloatingTexts:()=>{const t=Date.now();r(a=>({floatingTexts:a.floatingTexts.filter(i=>t-i.startTime<i.duration)}))},clearAllFloatingTexts:()=>{r({floatingTexts:[]})}}),fe=class fe{constructor(){b(this,"config");b(this,"globalPauseState");b(this,"monsterCache");b(this,"globalCache");b(this,"cacheTimeout",1e3);b(this,"globalStartTime",0);this.config=this.getDefaultConfig(),this.globalPauseState=this.createPauseState(),this.monsterCache=new Map,this.globalCache=null}static getInstance(){return fe.instance||(fe.instance=new fe),fe.instance}getDefaultConfig(){return{base:{ambusher:{ambushInterval:5e3,speed:2},chaser:{speed:1,directness:.3,updateInterval:200},floater:{speed:2,bounceAngle:.2},patrol:{speed:1}},scaling:{ambusher:{ambushInterval:-500,speed:.08},chaser:{speed:.2,directness:.08,updateInterval:-8},floater:{speed:.5,bounceAngle:.008},patrol:{speed:.2}},max:{ambusher:{ambushInterval:500,speed:10},chaser:{speed:5,directness:1,updateInterval:100},floater:{speed:5,bounceAngle:.5},patrol:{speed:5}}}}updateConfig(e){this.config={...this.config,...e},this.clearCache(),v.debug("ScalingManager: Configuration updated")}createPauseState(){return{isPaused:!1,pauseStartTime:0,totalPausedTime:0,pauseReasons:new Set}}pause(e="default"){this.globalPauseState.isPaused||(this.globalPauseState.isPaused=!0,this.globalPauseState.pauseStartTime=Date.now()),this.globalPauseState.pauseReasons.add(e),v.pause(`Scaling paused (${e})`)}resume(e="default"){if(this.globalPauseState.pauseReasons.delete(e),this.globalPauseState.pauseReasons.size===0&&this.globalPauseState.isPaused){const t=Date.now()-this.globalPauseState.pauseStartTime;this.globalPauseState.totalPausedTime+=t,this.globalPauseState.isPaused=!1,this.clearCache(),v.pause(`Scaling resumed (paused for ${(t/1e3).toFixed(1)}s)`)}}isPaused(){return this.globalPauseState.isPaused}getPauseReasons(){return Array.from(this.globalPauseState.pauseReasons)}getPauseStatus(){return{isPaused:this.globalPauseState.isPaused,pauseReasons:this.getPauseReasons(),totalPausedTime:this.globalPauseState.totalPausedTime,timeElapsed:this.getGlobalTimeElapsed(),globalStartTime:this.globalStartTime,currentTime:Date.now()}}startMap(){this.globalStartTime=Date.now(),this.globalPauseState=this.createPauseState(),this.clearCache(),v.flow("New map started - difficulty reset")}resetOnDeath(){this.globalStartTime=Date.now(),this.globalPauseState=this.createPauseState(),this.clearCache(),v.player("Player died - difficulty reset to base values")}getGlobalScaledValues(){const e=Date.now();if(this.globalCache&&e-this.globalCache.lastUpdate<this.cacheTimeout)return this.globalCache.values;const t=this.calculateScaledValues(this.getGlobalTimeElapsed());return this.globalCache={values:t,lastUpdate:e},t}getGlobalTimeElapsed(){return this.globalStartTime===0?0:(Date.now()-this.globalStartTime-this.globalPauseState.totalPausedTime)/1e3}pauseForPowerMode(){this.pause("power_mode"),v.power("Power mode activated - scaling paused")}resumeFromPowerMode(){this.resume("power_mode"),v.power("Power mode ended - scaling resumed")}isCurrentlyPausedByPowerMode(){return this.globalPauseState.pauseReasons.has("power_mode")}pauseAllMonsterScaling(){this.pause("monster_scaling"),this.globalPauseState.pauseReasons.size===1&&v.pause("All monster scaling paused")}resumeAllMonsterScaling(){this.resume("monster_scaling"),this.globalPauseState.pauseReasons.size===0&&v.pause("All monster scaling resumed")}getMonsterScaledValues(e){if(this.initializeMonster(e),e.individualScalingPaused||this.globalPauseState.isPaused)return this.config.base;const t=this.getMonsterCacheKey(e),a=Date.now(),i=this.monsterCache.get(t);if(i&&a-i.lastUpdate<this.cacheTimeout)return i.values;const s=i?.values||this.config.base,n=this.calculateScaledValues(this.getMonsterAge(e));return this.logScalingChanges(e,s,n),this.monsterCache.set(t,{values:n,lastUpdate:a}),n}initializeMonster(e){if(!e.individualSpawnTime){e.individualSpawnTime=Date.now(),e.individualScalingPaused=!1,e.spawnPauseTime=this.globalPauseState.totalPausedTime;const t=this.config.base;let a="";switch(e.type){case"AMBUSHER":a=`ambush interval: ${t.ambusher.ambushInterval}ms, speed: ${t.ambusher.speed.toFixed(2)}`;break;case"CHASER":a=`speed: ${t.chaser.speed.toFixed(2)}, directness: ${t.chaser.directness.toFixed(3)}, update interval: ${t.chaser.updateInterval}ms`;break;case"FLOATER":a=`speed: ${t.floater.speed.toFixed(2)}, bounce angle: ${t.floater.bounceAngle.toFixed(3)}`;break;case"HORIZONTAL_PATROL":case"VERTICAL_PATROL":a=`speed: ${t.patrol.speed.toFixed(2)}`;break;default:a="base values"}v.scaling(`${e.type} initialized with ${a}`)}}resetMonsterScaling(e){e.individualSpawnTime=Date.now(),e.individualScalingPaused=!1,e.spawnPauseTime=this.globalPauseState.totalPausedTime,this.monsterCache.delete(this.getMonsterCacheKey(e)),v.monster(`${e.type} scaling reset`)}pauseMonsterScaling(e){e.individualScalingPaused=!0,this.monsterCache.delete(this.getMonsterCacheKey(e))}resumeMonsterScaling(e){e.individualScalingPaused=!1,this.monsterCache.delete(this.getMonsterCacheKey(e))}getMonsterAge(e){if(!e.individualSpawnTime)return 0;const a=Date.now()-e.individualSpawnTime,i=this.globalPauseState.totalPausedTime-(e.spawnPauseTime||0),s=a-i,n=Math.max(0,s)/1e3;return this.globalPauseState.isPaused&&n>0&&v.debug(`Monster age: ${e.type} - Actual: ${(a/1e3).toFixed(1)}s, Paused: ${(i/1e3).toFixed(1)}s, Adjusted: ${n.toFixed(1)}s`),n}getMonsterCacheKey(e){const t=`${Math.round(e.x)}-${Math.round(e.y)}`;return`${e.type}-${t}-${e.individualSpawnTime||0}`}logScalingChanges(e,t,a){const i=this.getMonsterAge(e),s=Math.floor(i/5);if(s>0&&s%1===0){const n=[];switch(e.type){case"AMBUSHER":Math.abs(t.ambusher.speed-a.ambusher.speed)>.01&&n.push(`speed: ${t.ambusher.speed.toFixed(2)} → ${a.ambusher.speed.toFixed(2)}`),Math.abs(t.ambusher.ambushInterval-a.ambusher.ambushInterval)>50&&n.push(`ambush interval: ${t.ambusher.ambushInterval}ms → ${a.ambusher.ambushInterval}ms`);break;case"CHASER":Math.abs(t.chaser.speed-a.chaser.speed)>.01&&n.push(`speed: ${t.chaser.speed.toFixed(2)} → ${a.chaser.speed.toFixed(2)}`),Math.abs(t.chaser.directness-a.chaser.directness)>.01&&n.push(`directness: ${t.chaser.directness.toFixed(3)} → ${a.chaser.directness.toFixed(3)}`),Math.abs(t.chaser.updateInterval-a.chaser.updateInterval)>5&&n.push(`update interval: ${t.chaser.updateInterval}ms → ${a.chaser.updateInterval}ms`);break;case"FLOATER":Math.abs(t.floater.speed-a.floater.speed)>.01&&n.push(`speed: ${t.floater.speed.toFixed(2)} → ${a.floater.speed.toFixed(2)}`),Math.abs(t.floater.bounceAngle-a.floater.bounceAngle)>.001&&n.push(`bounce angle: ${t.floater.bounceAngle.toFixed(3)} → ${a.floater.bounceAngle.toFixed(3)}`);break;case"HORIZONTAL_PATROL":case"VERTICAL_PATROL":Math.abs(t.patrol.speed-a.patrol.speed)>.01&&n.push(`speed: ${t.patrol.speed.toFixed(2)} → ${a.patrol.speed.toFixed(2)}`);break}n.length>0&&v.scaling(`${e.type} scaling (${i.toFixed(1)}s, interval ${s}): ${n.join(", ")}`)}}calculateScaledValues(e){const t=Math.floor(e/5);return{ambusher:{ambushInterval:this.calculateScaledValue(this.config.base.ambusher.ambushInterval,this.config.scaling.ambusher.ambushInterval,this.config.max.ambusher.ambushInterval,t),speed:this.calculateScaledValue(this.config.base.ambusher.speed,this.config.scaling.ambusher.speed,this.config.max.ambusher.speed,t)},chaser:{speed:this.calculateScaledValue(this.config.base.chaser.speed,this.config.scaling.chaser.speed,this.config.max.chaser.speed,t),directness:this.calculateScaledValue(this.config.base.chaser.directness,this.config.scaling.chaser.directness,this.config.max.chaser.directness,t),updateInterval:this.calculateScaledValue(this.config.base.chaser.updateInterval,this.config.scaling.chaser.updateInterval,this.config.max.chaser.updateInterval,t)},floater:{speed:this.calculateScaledValue(this.config.base.floater.speed,this.config.scaling.floater.speed,this.config.max.floater.speed,t),bounceAngle:this.calculateScaledValue(this.config.base.floater.bounceAngle,this.config.scaling.floater.bounceAngle,this.config.max.floater.bounceAngle,t)},patrol:{speed:this.calculateScaledValue(this.config.base.patrol.speed,this.config.scaling.patrol.speed,this.config.max.patrol.speed,t)}}}calculateScaledValue(e,t,a,i){const s=e+t*i;return t>0?Math.min(s,a):Math.max(s,a)}clearCache(){this.monsterCache.clear(),this.globalCache=null}getBaseValues(){return{...this.config.base}}cleanup(){this.clearCache(),this.globalPauseState=this.createPauseState()}};b(fe,"instance");let K=fe;const Ue={POWER_MODE:{type:"POWER_MODE",duration:d.POWER_COIN_DURATION,points:d.POWER_COIN_POINTS,apply:(r,e)=>{let t=d.POWER_COIN_DURATION;if(e&&e.spawnTime!==void 0){const a=r.coinManager;if(a&&typeof a.getPcoinColorForTime=="function")try{t=a.getPcoinColorForTime(e.spawnTime).duration||d.POWER_COIN_DURATION}catch(i){console.warn("Failed to get P-coin color data, using default duration:",i)}}r.monsters&&Array.isArray(r.monsters)&&r.monsters.forEach(a=>{a.isFrozen=!0}),r.activeEffects.powerMode=!0,r.activeEffects.powerModeEndTime=Date.now()+t,r.coinManager&&r.coinManager.resetMonsterKillCount();try{K.getInstance().pauseForPowerMode()}catch{console.log("Could not pause difficulty scaling (ScalingManager not available)")}},remove:r=>{r.monsters&&Array.isArray(r.monsters)&&r.monsters.forEach(e=>{e.isFrozen=!1}),r.activeEffects.powerMode=!1;try{K.getInstance().resumeFromPowerMode()}catch{console.log("Could not resume difficulty scaling (ScalingManager not available)")}}},BONUS_MULTIPLIER:{type:"BONUS_MULTIPLIER",points:0,apply:r=>{const e=1e3*r.multiplier;r.addScore(e),r.multiplier<d.MAX_MULTIPLIER&&r.setMultiplier(r.multiplier+1,0)}},EXTRA_LIFE:{type:"EXTRA_LIFE",points:1e3,apply:r=>{r.lives+=1}}},_e={STANDARD:{hasGravity:!0,bounces:!0,reflects:!1},POWER:{hasGravity:!1,bounces:!1,reflects:!0},GRAVITY_ONLY:{hasGravity:!1,bounces:!1,reflects:!1,customUpdate:(r,e,t)=>{if((r.velocityY>0||r.velocityY===void 0)&&(r.velocityX=0,r.velocityY=2),t&&r.y+r.height>=t.y){r.y=t.y-r.height,r.velocityY=0,r.groundDirection||(r.groundDirection=Math.random()<.5?-1:1,r.velocityX=r.groundDirection*1),r.x+=r.velocityX,r.x<=0?(r.x=0,r.groundDirection=1,r.velocityX=1):r.x+r.width>=d.CANVAS_WIDTH&&(r.x=d.CANVAS_WIDTH-r.width,r.groundDirection=-1,r.velocityX=-1);return}let o=!1,c=null;for(const h of e){const m=r.y+r.height,g=h.y,p=m>=g&&m<=g+4,y=r.x<h.x+h.width&&r.x+r.width>h.x;if(p&&y){o=!0,c=h,r.y=g-r.height,r.velocityY=0,r.platformDirection||(r.platformDirection=Math.random()<.5?-1:1,r.velocityX=r.platformDirection*1);break}}o&&c?(r.x+=r.velocityX,(r.x+r.width<=c.x+0||r.x>=c.x+c.width-0)&&(r.platformDirection=null,r.velocityX=0,r.velocityY=2)):o||(r.platformDirection=null,r.velocityX=0,r.velocityY=2)}}},Le=[{color:"#3c82f6",points:100,name:"Blue",duration:3e3},{color:"#ef4444",points:200,name:"Red",duration:4e3},{color:"#a855f7",points:300,name:"Purple",duration:5e3},{color:"#22c55d",points:500,name:"Green",duration:6e3},{color:"#07b6d4",points:800,name:"Cyan",duration:7e3},{color:"#ebb305",points:1200,name:"Yellow",duration:8e3},{color:"#6b7280",points:2e3,name:"Gray",duration:1e4}],de={[P.POWER]:{type:P.POWER,color:"#FF0000",points:0,physics:_e.POWER,effects:[Ue.POWER_MODE],spawnCondition:r=>r.firebombCount%9===0,maxActive:1},[P.BONUS_MULTIPLIER]:{type:P.BONUS_MULTIPLIER,color:"#e9b300",points:d.BONUS_MULTIPLIER_COIN_POINTS,physics:_e.GRAVITY_ONLY,effects:[Ue.BONUS_MULTIPLIER],spawnCondition:r=>{const e=r.bombAndMonsterPoints||r.score||0;return e>0&&e%d.BONUS_COIN_SPAWN_INTERVAL===0},maxActive:1},[P.EXTRA_LIFE]:{type:P.EXTRA_LIFE,color:"#ef4444",points:d.EXTRA_LIFE_COIN_POINTS,physics:_e.GRAVITY_ONLY,effects:[Ue.EXTRA_LIFE],spawnCondition:r=>{const e=r.totalBonusMultiplierCoinsCollected||0;return e>0&&e%d.EXTRA_LIFE_COIN_RATIO===0},maxActive:1}};class ke{static updateCoin(e,t,a,i){e.isCollected||(i?(i.hasGravity&&(e.velocityY+=d.COIN_GRAVITY),e.x+=e.velocityX,e.y+=e.velocityY,i.reflects?this.handleReflectiveCollisions(e,t,a):i.bounces&&this.handleBouncingCollisions(e,t,a),i.customUpdate&&i.customUpdate(e,t,a)):this.updateStandardCoin(e,t,a))}static updateStandardCoin(e,t,a){this.updateCoin(e,t,a,_e.STANDARD)}static updatePowerCoin(e,t,a){this.updateCoin(e,t,a,_e.POWER)}static handleBouncingCollisions(e,t,a){this.handleBoundaryCollisions(e),this.handlePlatformCollisions(e,t),this.handleGroundCollisions(e,a)}static handleReflectiveCollisions(e,t,a){this.handlePowerCoinBoundaryCollisions(e),this.handlePowerCoinPlatformCollisions(e,t),this.handlePowerCoinGroundCollisions(e,a)}static handleBoundaryCollisions(e){e.x<=0?(e.x=0,e.velocityX=Math.abs(e.velocityX)*d.COIN_BOUNCE_DAMPING):e.x+e.width>=d.CANVAS_WIDTH&&(e.x=d.CANVAS_WIDTH-e.width,e.velocityX=-Math.abs(e.velocityX)*d.COIN_BOUNCE_DAMPING),e.y<=0&&(e.y=0,e.velocityY=Math.abs(e.velocityY)*d.COIN_BOUNCE_DAMPING)}static handlePowerCoinBoundaryCollisions(e){e.x<=0?(e.x=0,e.velocityX=Math.abs(e.velocityX)):e.x+e.width>=d.CANVAS_WIDTH&&(e.x=d.CANVAS_WIDTH-e.width,e.velocityX=-Math.abs(e.velocityX)),e.y<=0?(e.y=0,e.velocityY=Math.abs(e.velocityY)):e.y+e.height>=d.CANVAS_HEIGHT&&(e.y=d.CANVAS_HEIGHT-e.height,e.velocityY=-Math.abs(e.velocityY))}static handlePlatformCollisions(e,t){t.forEach(a=>{if(this.isColliding(e,a)){const i=e.x+e.width/2,s=e.y+e.height/2,n=a.x+a.width/2,o=a.y+a.height/2,c=i-n,h=s-o;Math.abs(c)>Math.abs(h)?c>0?(e.x=a.x+a.width,e.velocityX=Math.abs(e.velocityX)*d.COIN_BOUNCE_DAMPING):(e.x=a.x-e.width,e.velocityX=-Math.abs(e.velocityX)*d.COIN_BOUNCE_DAMPING):h>0?(e.y=a.y+a.height,e.velocityY=Math.abs(e.velocityY)*d.COIN_BOUNCE_DAMPING):(e.y=a.y-e.height,e.velocityY=-Math.abs(e.velocityY)*d.COIN_BOUNCE_DAMPING)}})}static handlePowerCoinPlatformCollisions(e,t){for(const a of t)if(this.isColliding(e,a)){const i=this.calculateCollisionNormal(e,a);Math.random()<.1&&x.debug(`P-coin platform collision - Normal: (${i.x.toFixed(2)}, ${i.y.toFixed(2)}), Velocity before: (${e.velocityX.toFixed(2)}, ${e.velocityY.toFixed(2)})`);const s=e.velocityX*i.x+e.velocityY*i.y;e.velocityX,e.velocityY,e.velocityX=e.velocityX-2*s*i.x,e.velocityY=e.velocityY-2*s*i.y,Math.random()<.1&&x.debug(`P-coin platform collision - Velocity after: (${e.velocityX.toFixed(2)}, ${e.velocityY.toFixed(2)})`),i.x!==0?i.x>0?e.x=a.x+a.width+1:e.x=a.x-e.width-1:i.y>0?e.y=a.y+a.height+1:e.y=a.y-e.height-1;break}}static handleGroundCollisions(e,t){this.isColliding(e,t)&&(e.y=t.y-e.height,e.velocityY=-Math.abs(e.velocityY)*d.COIN_BOUNCE_DAMPING,Math.abs(e.velocityY)<.5&&(e.velocityY=0))}static handlePowerCoinGroundCollisions(e,t){if(this.isColliding(e,t)){const a=this.calculateCollisionNormal(e,t),i=e.velocityX*a.x+e.velocityY*a.y;e.velocityX=e.velocityX-2*i*a.x,e.velocityY=e.velocityY-2*i*a.y,e.y=t.y-e.height-1}}static isColliding(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}static createInitialVelocity(){return{velocityX:(Math.random()-.5)*d.COIN_BOUNCE_SPEED*2,velocityY:-3}}static createPowerCoinVelocity(e){const t=d.COIN_BOUNCE_SPEED;if(e!==void 0){const s=e*Math.PI/180;return{velocityX:Math.cos(s)*t,velocityY:Math.sin(s)*t}}const i=Math.random()*360*Math.PI/180;return{velocityX:Math.cos(i)*t,velocityY:Math.sin(i)*t}}static calculateSurfaceNormal(e,t){const a=e.x+e.width/2,i=e.y+e.height/2,s=Math.max(t.x,Math.min(a,t.x+t.width)),n=Math.max(t.y,Math.min(i,t.y+t.height)),o=a-s,c=i-n,h=Math.sqrt(o*o+c*c);if(h>.1)return{x:o/h,y:c/h};{const m=e.x,g=e.x+e.width,p=e.y,y=e.y+e.height,M=t.x,T=t.x+t.width,R=t.y,G=t.y+t.height,L=Math.abs(g-M),U=Math.abs(m-T),W=Math.abs(y-R),ae=Math.abs(p-G),me=Math.min(L,U,W,ae);return me===L?{x:-1,y:0}:me===U?{x:1,y:0}:me===W?{x:0,y:-1}:{x:0,y:1}}}static reflectVelocity(e,t){const a=e.velocityX*t.x+e.velocityY*t.y,i=e.velocityX,s=e.velocityY;e.velocityX=e.velocityX-2*a*t.x,e.velocityY=e.velocityY-2*a*t.y;const n=Math.sqrt(i*i+s*s),o=Math.sqrt(e.velocityX*e.velocityX+e.velocityY*e.velocityY);if(o>.001){const c=n/o;e.velocityX*=c,e.velocityY*=c}}static moveCoinOutOfCollision(e,t){const a=e.x+e.width/2,i=e.y+e.height/2,s=Math.max(t.x,Math.min(a,t.x+t.width)),n=Math.max(t.y,Math.min(i,t.y+t.height)),o=a-s,c=i-n;Math.abs(o)>Math.abs(c)?e.x+=o>0?Math.abs(o):-Math.abs(o):e.y+=c>0?Math.abs(c):-Math.abs(c)}static moveCoinOutOfCollisionSimple(e,t){const a=e.x+e.width/2,i=e.y+e.height/2,s=t.x+t.width/2,n=t.y+t.height/2,o=Math.abs(a-s),c=Math.abs(i-n);o>c?a<s?e.x=t.x-e.width-1:e.x=t.x+t.width+1:i<n?e.y=t.y-e.height-1:e.y=t.y+t.height+1}static calculateCollisionNormal(e,t){const a=e.x+e.width/2,i=e.y+e.height/2,s=Math.max(t.x,Math.min(a,t.x+t.width)),n=Math.max(t.y,Math.min(i,t.y+t.height)),o=a-s,c=i-n,h=Math.sqrt(o*o+c*c);if(h>.1)return{x:o/h,y:c/h};{const m=Math.abs(e.x+e.width-t.x),g=Math.abs(e.x-(t.x+t.width)),p=Math.abs(e.y+e.height-t.y),y=Math.abs(e.y-(t.y+t.height)),M=Math.min(m,g,p,y);return M===m?{x:-1,y:0}:M===g?{x:1,y:0}:M===p?{x:0,y:-1}:{x:0,y:1}}}}class _a{constructor(e=[]){b(this,"coins",[]);b(this,"spawnPoints",[]);b(this,"firebombCount",0);b(this,"powerModeActive",!1);b(this,"powerModeEndTime",0);b(this,"activeEffects",new Map);b(this,"triggeredSpawnConditions",new Set);b(this,"lastProcessedScore",0);b(this,"lastScoreCheck",0);b(this,"bombAndMonsterPoints",0);b(this,"monsterKillCount",0);b(this,"pCoinColorIndex",0);this.spawnPoints=e,x.debug("CoinManager initialized")}reset(){this.coins=[],this.firebombCount=0,this.powerModeActive=!1,this.powerModeEndTime=0,this.activeEffects.clear(),this.triggeredSpawnConditions.clear(),this.lastProcessedScore=0,this.lastScoreCheck=0,this.bombAndMonsterPoints=0,this.monsterKillCount=0}update(e,t,a){this.coins.forEach(i=>{if(i.isCollected)return;const s=de[i.type];s?ke.updateCoin(i,e,t,s.physics):i.type===P.POWER?ke.updatePowerCoin(i,e,t):ke.updateCoin(i,e,t)}),this.checkEffectsEnd(a),this.coins=this.coins.filter(i=>!i.isCollected)}spawnCoin(e,t,a,i){const s=de[e];if(s?.maxActive){if(this.coins.filter(h=>h.type===e&&!h.isCollected).length>=s.maxActive){x.debug(`${e} coin limit reached (${s.maxActive}), skipping spawn`);return}}else if(this.coins.find(h=>h.type===e)){x.debug(`${e} coin already exists, skipping spawn`);return}let n;e===P.POWER?n=ke.createPowerCoinVelocity(i):n=ke.createInitialVelocity();const o={type:e,x:t,y:a,width:d.COIN_SIZE,height:d.COIN_SIZE,velocityX:n.velocityX,velocityY:n.velocityY,isCollected:!1,spawnX:t,spawnY:a};e===P.POWER&&(o.colorIndex=0,o.spawnTime=Date.now(),x.debug("Spawning P-coin with Blue color (100 points)")),this.coins.push(o),x.debug(`Spawned ${e} coin at (${t}, ${a}) with angle ${i||"random"}`)}onFirebombCollected(){this.firebombCount++,x.debug(`Firebomb count: ${this.firebombCount}`),this.checkSpawnConditionsOnFirebombChange()}onPointsEarned(e,t=!1){t||(this.bombAndMonsterPoints+=e,x.debug(`Points earned: ${e}, total bomb/monster points: ${this.bombAndMonsterPoints}`),this.checkBcoinSpawnConditions())}checkBcoinSpawnConditions(){const e=de.BONUS_MULTIPLIER;if(!e)return;const t=Math.floor(this.bombAndMonsterPoints/d.BONUS_COIN_SPAWN_INTERVAL)*d.BONUS_COIN_SPAWN_INTERVAL,a=Math.floor(this.lastScoreCheck/d.BONUS_COIN_SPAWN_INTERVAL)*d.BONUS_COIN_SPAWN_INTERVAL;if(t>a&&t>=d.BONUS_COIN_SPAWN_INTERVAL){const i=`${e.type}_${t}`;if(this.triggeredSpawnConditions.has(i)){x.debug(`B-coin spawn condition already triggered for threshold ${t}`);return}x.debug(`B-coin threshold crossed: ${a} -> ${t} (bomb/monster points: ${this.bombAndMonsterPoints})`),this.triggeredSpawnConditions.add(i),this.lastScoreCheck=this.bombAndMonsterPoints;const s=this.spawnPoints.filter(n=>n.type===e.type);if(s.length>0){const n=s[Math.floor(Math.random()*s.length)];this.spawnCoin(e.type,n.x,n.y,n.spawnAngle)}}}checkSpawnConditionsOnFirebombChange(){Object.values(de).forEach(e=>{if(e.spawnCondition&&e.spawnCondition.toString().includes("firebombCount")){const t={firebombCount:this.firebombCount};if(e.spawnCondition(t)){const a=`${e.type}_${this.firebombCount}`;if(this.triggeredSpawnConditions.has(a))return;x.debug(`P-coin spawn condition met (firebombCount: ${this.firebombCount}, key: ${a})`),this.triggeredSpawnConditions.add(a);const i=this.spawnPoints.filter(s=>s.type===e.type);if(i.length>0){const s=i[Math.floor(Math.random()*i.length)];this.spawnCoin(e.type,s.x,s.y,s.spawnAngle)}else{const s=400+(Math.random()-.5)*200,n=100+Math.random()*100;this.spawnCoin(e.type,s,n)}}}})}checkSpawnConditions(e){Object.values(de).forEach(t=>{if(t.spawnCondition&&!t.spawnCondition.toString().includes("firebombCount")&&t.type!=="POWER"){const a={...e,firebombCount:this.firebombCount,bombAndMonsterPoints:this.bombAndMonsterPoints};if(t.spawnCondition(a)){let i=`${t.type}`;if(t.spawnCondition.toString().includes("score")&&t.type==="BONUS_MULTIPLIER"){const n=Math.floor(this.bombAndMonsterPoints/d.BONUS_COIN_SPAWN_INTERVAL)*d.BONUS_COIN_SPAWN_INTERVAL,o=Math.floor(this.lastScoreCheck/d.BONUS_COIN_SPAWN_INTERVAL)*d.BONUS_COIN_SPAWN_INTERVAL;if(n>o&&n>=d.BONUS_COIN_SPAWN_INTERVAL)i=`${t.type}_${n}`,x.debug(`B-coin threshold crossed: ${o} -> ${n} (bomb/monster points: ${this.bombAndMonsterPoints})`);else return;this.lastScoreCheck=this.bombAndMonsterPoints}if(t.spawnCondition.toString().includes("totalBonusMultiplierCoinsCollected")){const n=e.totalBonusMultiplierCoinsCollected||0,o=Math.floor(n/d.EXTRA_LIFE_COIN_RATIO)*d.EXTRA_LIFE_COIN_RATIO;i=`${t.type}_${o}`}if(this.triggeredSpawnConditions.has(i))return;x.debug(`Spawn condition met for ${t.type} coin (key: ${i})`),this.triggeredSpawnConditions.add(i);const s=this.spawnPoints.filter(n=>n.type===t.type);if(s.length>0){const n=s[Math.floor(Math.random()*s.length)];this.spawnCoin(t.type,n.x,n.y,n.spawnAngle)}else{const n=400+(Math.random()-.5)*200;let o=50;t.physics.hasGravity&&!t.physics.bounces&&!t.physics.reflects?o=50:o=100+Math.random()*100,this.spawnCoin(t.type,n,o)}}}})}collectCoin(e,t){e.isCollected=!0,x.debug(`Collected ${e.type} coin`);const a=de[e.type];if(a&&t){let i=a.points;if(e.type===P.POWER){const s=e.spawnTime||Date.now(),n=this.getPcoinColorForTime(s),o=t.multiplier||1;i=n.points*o,x.debug(`P-coin collected: ${n.name} color, ${n.points} × ${o} = ${i} points`)}else if(e.type===P.BONUS_MULTIPLIER)i=1e3*(t.multiplier||1);else if(e.type===P.EXTRA_LIFE){const s=t.multiplier||1;i=a.points*s}if("addFloatingText"in t&&typeof t.addFloatingText=="function"){const s=i.toString();t.addFloatingText(s,e.x+e.width/2,e.y+e.height/2,1e3,"#fff",15)}a.effects.forEach(s=>{const n={...t,activeEffects:{powerMode:!1,powerModeEndTime:0,...t.activeEffects},coinManager:{resetMonsterKillCount:()=>this.resetMonsterKillCount(),getPcoinColorForTime:o=>this.getPcoinColorForTime(o),getPowerModeEndTime:()=>this.getPowerModeEndTime()},difficultyManager:{pause:()=>{K.getInstance().pause(),x.debug("Difficulty scaling paused (power mode active)")},resume:()=>{K.getInstance().resume(),x.debug("Difficulty scaling resumed (power mode ended)")}}};s.apply(n,e),s.duration&&this.activeEffects.set(s.type,{endTime:Date.now()+s.duration,effect:s})})}else e.type!==P.POWER&&e.type!==P.BONUS_MULTIPLIER&&e.type!==P.EXTRA_LIFE&&x.warn(`Unknown coin type: ${e.type}, using legacy behavior`),e.type===P.POWER&&this.activatePowerMode()}checkEffectsEnd(e){const t=Date.now(),a=[];this.activeEffects.forEach((i,s)=>{if(x.debug(`Checking effect: ${s}, endTime: ${i.endTime}, currentTime: ${t}, shouldEnd: ${t>=i.endTime}`),t>=i.endTime&&(a.push(s),i.effect.remove&&e)){const n={...e,activeEffects:{powerMode:!1,powerModeEndTime:0,...e.activeEffects},coinManager:{resetMonsterKillCount:()=>this.resetMonsterKillCount(),getPcoinColorForTime:o=>this.getPcoinColorForTime(o),getPowerModeEndTime:()=>this.getPowerModeEndTime()},difficultyManager:{pause:()=>{K.getInstance().pause(),x.debug("Difficulty scaling paused (power mode active)")},resume:()=>{K.getInstance().resumeFromPowerMode(),x.debug("Difficulty scaling resumed (power mode ended)")}}};i.effect.remove(n)}}),a.forEach(i=>{this.activeEffects.delete(i),i==="POWER_MODE"&&(this.powerModeActive=!1,x.debug("Power mode deactivated"))})}calculateMonsterKillPoints(e){this.monsterKillCount++;let t;switch(this.monsterKillCount){case 1:t=100;break;case 2:t=200;break;case 3:t=300;break;case 4:t=500;break;case 5:t=800;break;case 6:t=1200;break;case 7:t=1700;break;case 8:t=2300;break;case 9:t=3e3;break;case 10:t=4e3;break;default:t=4e3+(this.monsterKillCount-10)*1e3}const a=t*e;return x.debug(`Monster kill #${this.monsterKillCount}: ${t} × ${e} = ${a} points`),a}getPcoinColorForTime(e){const a=Date.now()-e,s=Math.floor(a/1e3)%Le.length;return{...Le[s],index:s}}getCurrentPcoinColor(){return Le[this.pCoinColorIndex]}getPcoinCurrentColor(e){return e.type===P.POWER&&e.spawnTime!==void 0?this.getPcoinColorForTime(e.spawnTime).color:Le[0].color}advancePcoinColor(){this.pCoinColorIndex=(this.pCoinColorIndex+1)%Le.length;const e=this.getCurrentPcoinColor();x.debug(`P-coin color advanced to: ${e.name} (${e.points} points)`)}resetMonsterKillCount(){this.monsterKillCount=0,x.debug("Monster kill count reset for new power mode session")}isPowerModeActive(){const e=this.activeEffects.get("POWER_MODE");if(e){const t=Date.now()<e.endTime;return t||(this.activeEffects.delete("POWER_MODE"),this.powerModeActive=!1),t}return this.powerModeActive}getCoins(){return this.coins.filter(e=>!e.isCollected)}getAllCoins(){return[...this.coins]}getFirebombCount(){return this.firebombCount}getBombAndMonsterPoints(){return this.bombAndMonsterPoints}updateMonsters(e){if(this.isPowerModeActive()||this.powerModeActive){let a=0;const i=this.activeEffects.get("POWER_MODE");i?a=i.endTime-Date.now():a=this.powerModeEndTime-Date.now();const s=a<=2e3&&a>0;e.forEach(n=>{n.isFrozen=!0,n.isBlinking=s})}else e.forEach(a=>{a.isFrozen=!1,a.isBlinking=!1})}unfreezeAllMonsters(e){e.forEach(t=>{t.isFrozen=!1,t.isBlinking=!1})}resetEffects(){this.powerModeActive=!1,this.powerModeEndTime=0,this.firebombCount=0,this.coins=[],this.activeEffects.clear(),this.bombAndMonsterPoints=0,this.monsterKillCount=0,x.debug("Coin effects reset")}getCoinConfig(e){return de[e]}isEffectActive(e){return this.activeEffects.has(e)}getPowerModeEndTime(){const e=this.activeEffects.get("POWER_MODE");return e?e.endTime:0}activatePowerMode(){this.powerModeActive=!0;let e=d.POWER_COIN_DURATION;const t=this.coins.find(a=>a.type===P.POWER&&a.spawnTime);t&&t.spawnTime&&(e=this.getPcoinColorForTime(t.spawnTime).duration),this.powerModeEndTime=Date.now()+e,this.resetMonsterKillCount(),this.activeEffects.set("POWER_MODE",{endTime:this.powerModeEndTime,effect:Ue.POWER_MODE}),x.debug(`Power mode timing - duration: ${e}ms, endTime: ${this.powerModeEndTime}, currentTime: ${Date.now()}`);try{K.getInstance().pauseForPowerMode(),x.debug("Difficulty scaling paused (power mode active)")}catch{x.debug("Could not pause difficulty scaling (ScalingManager not available)")}x.debug(`Power mode activated for ${e}ms (${e/1e3}s)`)}}const N=ta.create((r,e,t)=>{const a=la(r,e),i=va(r,e),s=Ta(r,e),n=Aa(r,e),o=Pa(r,e),c=Na(r,e),h=Oa(r,e),m=Ia(r,e),g=Ra(r);return{...a,...i,...s,...n,...o,...c,...h,...m,...g,resetGame:()=>{e().resetGameState(),e().resetPlayer(),e().resetBombState(),e().resetLevelState(),e().resetLevelHistory(),e().resetMultiplier(),e().resetAudioSettings(),e().resetCoinState(),e().resetEffects(),e().clearAllFloatingTexts()},initializeLevel:p=>{const{bombManager:y,firstBomb:M}=n.initializeLevel(p),T=p.bombs.map(G=>({...G,isBlinking:!1,isCollected:!1,isCorrect:!1}));e().setBombs(T),e().setBombManager(y);const R=new _a(p.coinSpawnPoints||[]);return e().setCoinManager(R),r({collectedBombs:[],correctOrderCount:0,nextBombOrder:1}),e().setPlayerPosition(p.playerStart.x,p.playerStart.y),{bombManager:y,firstBomb:M}},getLevelHistory:()=>o.getLevelResults(),getGameStartTime:()=>o.getGameStartTime(),getSessionId:()=>o.getSessionId()}});class La{constructor(){b(this,"keys",new Set);b(this,"keyPressTimes",new Map);b(this,"touchControls",{left:!1,right:!1,up:!1,float:!1});b(this,"boundKeyDownHandler");b(this,"boundKeyUpHandler");b(this,"boundPreventDefaultHandler");this.boundKeyDownHandler=this.handleKeyDown.bind(this),this.boundKeyUpHandler=this.handleKeyUp.bind(this),this.boundPreventDefaultHandler=e=>{["ArrowLeft","ArrowRight","ArrowUp","Space"," ","p","P"].includes(e.key)&&e.preventDefault()},this.bindEvents()}bindEvents(){document.addEventListener("keydown",this.boundKeyDownHandler),document.addEventListener("keyup",this.boundKeyUpHandler),document.addEventListener("keydown",this.boundPreventDefaultHandler)}isKeyPressed(e){return this.keys.has(e)||this.getTouchControl(e)}isShiftPressed(){return this.keys.has("Shift")}getKeyPressDuration(e){const t=this.keyPressTimes.get(e);return t&&this.keys.has(e)?Date.now()-t:0}getTouchControl(e){switch(e){case"ArrowLeft":return this.touchControls.left;case"ArrowRight":return this.touchControls.right;case"ArrowUp":return this.touchControls.up;case" ":case"Space":return this.touchControls.float;default:return!1}}handleKeyDown(e){this.keys.has(e.key)||this.keyPressTimes.set(e.key,Date.now()),this.keys.add(e.key)}handleKeyUp(e){this.keys.delete(e.key),this.keyPressTimes.delete(e.key)}setTouchControl(e,t){this.touchControls[e]=t}cleanup(){document.removeEventListener("keydown",this.boundKeyDownHandler),document.removeEventListener("keyup",this.boundKeyUpHandler),document.removeEventListener("keydown",this.boundPreventDefaultHandler)}}class ka{checkPlayerPlatformCollision(e,t){for(const a of t){const i=this.checkFullCollision(e,a);if(i.hasCollision)return i}return{hasCollision:!1}}checkPlayerGroundCollision(e,t){return this.checkFullCollision(e,t)}checkMonsterGroundCollision(e,t){return this.checkFullCollision(e,t)}checkPlayerCoinCollision(e,t){for(const a of t)if(!a.isCollected&&this.isColliding(e,a))return a;return null}checkFullCollision(e,t){const a=e.x+(e.velocityX||0),i=e.y+(e.velocityY||0);if(this.wouldCollide(a,i,e.width,e.height,t)){const s=e.x+e.width/2,n=e.y+e.height/2,o=t.x+t.width/2,c=t.y+t.height/2,h=s-o,m=n-c,g=(e.width+t.width)/2-Math.abs(h),p=(e.height+t.height)/2-Math.abs(m);return g<p?h>0?{hasCollision:!0,normal:{x:1,y:0},penetration:g}:{hasCollision:!0,normal:{x:-1,y:0},penetration:g}:m>0?{hasCollision:!0,normal:{x:0,y:1},penetration:p}:{hasCollision:!0,normal:{x:0,y:-1},penetration:p}}return{hasCollision:!1}}wouldCollide(e,t,a,i,s){return e<s.x+s.width&&e+a>s.x&&t<s.y+s.height&&t+i>s.y}checkPlayerBombCollision(e,t){for(const a of t)if(!a.isCollected&&this.isColliding(e,a))return a;return null}checkPlayerMonsterCollision(e,t){for(const a of t)if(a.isActive&&this.isColliding(e,a))return a;return null}checkBoundaryCollision(e,t){const a=e.x,i=e.y;return a<0?{hasCollision:!0,normal:{x:1,y:0},penetration:Math.abs(a)}:a+e.width>t.width?{hasCollision:!0,normal:{x:-1,y:0},penetration:a+e.width-t.width}:i<0?{hasCollision:!0,normal:{x:0,y:1},penetration:Math.abs(i)}:i+e.height>t.height?{hasCollision:!0,normal:{x:0,y:-1},penetration:i+e.height-t.height}:{hasCollision:!1}}resolveBoundaryCollision(e,t){const a=this.checkBoundaryCollision(e,t);if(!a.hasCollision||!a.normal||!a.penetration)return{player:e,fellOffScreen:!1};const i={...e},{normal:s,penetration:n}=a;if(s.x===1)i.x=0,i.velocityX=0;else if(s.x===-1)i.x=t.width-e.width,i.velocityX=0;else if(s.y===1)i.y=0,i.velocityY=0;else if(s.y===-1)return{player:i,fellOffScreen:!0};return{player:i,fellOffScreen:!1}}isColliding(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}}class wt{constructor(e,t){b(this,"animations");b(this,"currentAnimation");b(this,"currentFrameIndex",0);b(this,"frameTimer",0);this.animations=Object.fromEntries(e.map(a=>[a.name,a])),this.currentAnimation=this.animations[t]}setAnimation(e){this.currentAnimation.name!==e&&(this.currentAnimation=this.animations[e],this.currentFrameIndex=0,this.frameTimer=0)}setAnimationPreserveFrame(e){if(this.currentAnimation.name!==e){const t=this.animations[e];if(t){const a=Math.min(this.currentFrameIndex,t.frames.length-1);this.currentAnimation=t,this.currentFrameIndex=a}}}update(e){this.frameTimer+=e,this.frameTimer>this.currentAnimation.frameDuration&&(this.frameTimer=0,this.currentFrameIndex++,this.currentFrameIndex>=this.currentAnimation.frames.length&&(this.currentFrameIndex=this.currentAnimation.loop?0:this.currentAnimation.frames.length-1))}draw(e,t,a,i=1){const s=this.currentAnimation.frames[this.currentFrameIndex];if(s.complete){const n=d.PLAYER_WIDTH*2.5,o=d.PLAYER_HEIGHT*i,c=t-(n-d.PLAYER_WIDTH)/2.3;if(this.currentAnimation.name.includes("-left")){e.save(),e.scale(-1,1);const m=c+n/2.14;e.translate(-m*2,0),e.drawImage(s,c,a,n,o),e.restore()}else e.drawImage(s,c,a,n,o);e.save(),e.restore()}}}const ue={audio:"/dist/audio",images:"/dist/assets"},yt=r=>`${ue.images}/maps-bg-images/${r}.png`,X=r=>{const e=new Image;return e.src=`${ue.images}/${r}`,e},xt=[X("sigurd-idle/sigurd-idle1.png"),X("sigurd-idle/sigurd-idle2.png"),X("sigurd-idle/sigurd-idle3.png"),X("sigurd-idle/sigurd-idle4.png")],vt=[X("running/run1.png"),X("running/run2.png"),X("running/run3.png")],St=[X("jumping/jump1.png"),X("jumping/jump2.png"),X("jumping/jump3.png")],Da=[X("complete/complete1.png"),X("complete/complete2.png"),X("complete/complete3.png"),X("complete/complete4.png"),X("complete/complete5.png")],Ba=[X("float/float1.png")],Mt=[X("float-dir/float-dir1.png")],Ct=[X("landing/landing1.png")],Fa=[{name:"walk-right",frames:vt,frameDuration:100,loop:!0},{name:"walk-left",frames:vt,frameDuration:100,loop:!0},{name:"idle-right",frames:xt,frameDuration:1e3,loop:!0},{name:"idle-left",frames:xt,frameDuration:1e3,loop:!0},{name:"jump-right",frames:St,frameDuration:100,loop:!1},{name:"jump-left",frames:St,frameDuration:100,loop:!1},{name:"land-right",frames:Ct,frameDuration:500,loop:!1},{name:"land-left",frames:Ct,frameDuration:500,loop:!1},{name:"float-stationary",frames:Ba,frameDuration:100,loop:!0},{name:"float-right",frames:Mt,frameDuration:100,loop:!1},{name:"float-left",frames:Mt,frameDuration:100,loop:!0},{name:"ghost-complete",frames:Da,frameDuration:100,loop:!1}],De=new wt(Fa,"idle-left"),Je=r=>{const e=new Image;return e.src=`${ue.images}/${r}`,e},ja=[Je("bomb/bomb1.png")],Ga=[Je("bomb/bomb1.png"),Je("bomb/bomb2.png")],$a=[{name:"unlit",frames:ja,frameDuration:100,loop:!1},{name:"lit",frames:Ga,frameDuration:100,loop:!0}];class Tt extends wt{draw(e,t,a,i=1){const s=this.currentAnimation.frames[this.currentFrameIndex];if(s.complete){const n=d.BOMB_SIZE*i,o=d.BOMB_SIZE*i;e.drawImage(s,t,a,n,o)}}}const Qe=new Tt($a,"unlit"),Be={"startup lab":"startup-lab.png",nav:"nav.png",skatteetaten:"skatteetaten.png","innovasjon norge":"innovasjon-norge.png",kommunehuset:"kommunehuset.png","alltinn norge":"alltinn-norge.png","silicone vally":"silicone-vally.png",default:"startup-lab.png"};class Et{constructor(e,t){b(this,"currentBackground",null);b(this,"isLoading",!1);b(this,"canvasWidth");b(this,"canvasHeight");b(this,"currentMapName","");this.canvasWidth=e,this.canvasHeight=t}loadMapBackground(e){this.isLoading||(this.currentMapName=e,this.isLoading=!0,this.currentBackground&&(this.currentBackground.image.src="",this.currentBackground=null),this.loadBackgroundAsync(e).catch(t=>{console.error("BackgroundManager: Failed to load background:",t),this.isLoading=!1}))}async loadBackgroundAsync(e){try{const t=Be[e]||Be.default,a=await this.loadImage(`${ue.images}/maps-bg-images/${t}`);this.currentBackground={image:a,isLoaded:!0},this.isLoading=!1,v.flow(`Background loaded: ${e}`)}catch(t){console.error("BackgroundManager: Failed to load background image:",t),this.isLoading=!1}}loadImage(e){return new Promise((t,a)=>{const i=new Image;i.onload=()=>t(i),i.onerror=()=>a(new Error(`Failed to load image: ${e}`)),i.src=e})}update(e,t){}render(e){if(!this.currentBackground||!this.currentBackground.isLoaded){this.isLoading?this.renderLoading(e):this.renderFallback(e);return}const t=this.currentBackground.image,a=this.canvasWidth/t.width,i=this.canvasHeight/t.height,s=Math.max(a,i),n=t.width*s,o=t.height*s,c=(n-this.canvasWidth)/2,h=(o-this.canvasHeight)/2;e.drawImage(t,-c,-h,n,o)}renderLoading(e){const t=e.createLinearGradient(0,0,0,this.canvasHeight);t.addColorStop(0,"#262521"),t.addColorStop(1,"#484744"),e.fillStyle=t,e.fillRect(0,0,this.canvasWidth,this.canvasHeight),e.fillStyle="#ffffff",e.font="16px Arial",e.textAlign="center",e.fillText("Loading background...",this.canvasWidth/2,this.canvasHeight/2)}renderFallback(e){const t=e.createLinearGradient(0,0,0,this.canvasHeight);t.addColorStop(0,"#87CEEB"),t.addColorStop(1,"#4682B4"),e.fillStyle=t,e.fillRect(0,0,this.canvasWidth,this.canvasHeight)}isReady(){return this.currentBackground?.isLoaded||!1}isCurrentlyLoading(){return this.isLoading}getCurrentTheme(){return this.currentMapName}getCurrentMapName(){return this.currentMapName}static getAvailableBackgrounds(){return Object.values(Be)}static getMapNameMapping(){return{...Be}}static async preloadAllBackgrounds(){v.flow("Starting background preloading...");const e=Object.values(Be);let t=0;const a=e.map(async i=>{try{const s=new Image;await new Promise((n,o)=>{s.onload=n,s.onerror=o,s.src=`${ue.images}/maps-bg-images/${i}`}),t++,(t%2===0||t===e.length)&&v.flow(`Preloaded ${t}/${e.length} backgrounds`)}catch{v.warn(`Failed to preload background: ${i}`)}});await Promise.all(a),v.flow(`Background preloading complete! Loaded ${t}/${e.length} backgrounds.`)}}const ge=class ge{constructor(){b(this,"deadMonsters",[]);b(this,"respawnConfig");b(this,"scalingManager");b(this,"lastUpdateTime",0);b(this,"updateInterval",500);b(this,"paused",!1);this.respawnConfig=this.getDefaultRespawnConfig(),this.scalingManager=K.getInstance(),v.debug("Respawn manager initialized")}static getInstance(){return ge.instance||(ge.instance=new ge),ge.instance}getDefaultRespawnConfig(){return{ambusher:1e4,chaser:7e3,floater:15e3,patrol:8e3}}updateRespawnConfig(e){this.respawnConfig={...this.respawnConfig,...e},v.debug("OptimizedRespawnManager: Updated respawn configuration",this.respawnConfig)}getRespawnConfig(){return{...this.respawnConfig}}killMonster(e){if(e.isDead){v.debug(`Monster already dead, skipping kill: ${e.type}`);return}e.originalSpawnPoint||(e.originalSpawnPoint={x:e.x,y:e.y}),e.isDead=!0,e.isActive=!1,e.deathTime=Date.now(),e.respawnTime=e.deathTime+this.getRespawnDelay(e.type);const t={monster:e,respawnTime:e.respawnTime};this.insertSorted(t),v.monster(`${e.type} killed - respawning in ${this.getRespawnDelay(e.type)/1e3}s`)}insertSorted(e){let t=0,a=this.deadMonsters.length;for(;t<a;){const i=Math.floor((t+a)/2);this.deadMonsters[i].respawnTime<=e.respawnTime?t=i+1:a=i}this.deadMonsters.splice(t,0,e)}update(){const e=Date.now();if(e-this.lastUpdateTime<this.updateInterval)return[];if(this.lastUpdateTime=e,this.paused)return[];const t=[];for(;this.deadMonsters.length>0&&this.deadMonsters[0].respawnTime<=e;){const a=this.deadMonsters.shift(),i=this.respawnMonster(a.monster);t.push(i)}return t.length>0&&v.monster(`Respawning ${t.length} monsters: ${t.map(a=>a.type).join(", ")}`),t}pause(){this.paused=!0,v.pause("Respawn system paused")}resume(){this.paused=!1,v.pause("Respawn system resumed")}isPaused(){return this.paused}respawnMonster(e){const t=e.originalSpawnPoint;return this.resetMonsterState(e,t),this.scalingManager.resetMonsterScaling(e),v.monster(`${e.type} respawned`),e}resetMonsterState(e,t){e.isDead=!1,e.isActive=!0,e.x=t.x,e.y=t.y,e.isFrozen=!1,e.isBlinking=!1,e.velocityX=0,e.velocityY=0,e.isGrounded=!1,e.isFalling=!1,e.currentPlatform=null,e.behaviorState=void 0,e.lastDirectionChange=void 0,e.deathTime=void 0,e.respawnTime=void 0}getRespawnDelay(e){switch(e){case"AMBUSHER":return this.respawnConfig.ambusher;case"CHASER":return this.respawnConfig.chaser;case"FLOATER":return this.respawnConfig.floater;case"HORIZONTAL_PATROL":case"VERTICAL_PATROL":return this.respawnConfig.patrol;default:return v.warn(`Unknown monster type for respawn delay: ${e}, using default`),this.respawnConfig.patrol}}getDeadMonsterCount(){return this.deadMonsters.length}getDeadMonsters(){return this.deadMonsters.map(e=>e.monster)}getRespawnTimeRemaining(e){return!e.isDead||!e.respawnTime?0:Math.max(0,e.respawnTime-Date.now())}getNextRespawnTime(){return this.deadMonsters.length>0?this.deadMonsters[0].respawnTime:null}reset(){this.deadMonsters=[],this.lastUpdateTime=0,v.debug("OptimizedRespawnManager: Reset - cleared all dead monsters")}setUpdateInterval(e){this.updateInterval=e,v.debug(`OptimizedRespawnManager: Update interval set to ${e}ms`)}cleanup(){this.deadMonsters=[],this.lastUpdateTime=0}};b(ge,"instance");let He=ge;class Va{constructor(e){b(this,"canvas");b(this,"ctx");b(this,"lastTime",0);b(this,"backgroundManager");b(this,"bombSprites",new Map);b(this,"currentSpawnManager",null);b(this,"currentGameState",null);this.canvas=e,this.ctx=e.getContext("2d"),this.backgroundManager=new Et(e.width,e.height),x.debug("RenderManager initialized with canvas")}render(e,t,a,i,s,n=[],o=[],c,h,m,g){this.currentSpawnManager=h,this.currentGameState=g;const p=Date.now(),y=p-this.lastTime;this.lastTime=p,this.backgroundManager.update(e.x,e.y),this.renderBackground(),s&&this.renderGround(s),this.renderPlatforms(t),this.renderBombs(a),this.renderCoins(n,c),this.renderMonsters(i),this.renderPlayer(e),this.renderFloatingTexts(o,y)}clearCanvas(){this.ctx.fillStyle=$.BACKGROUND,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}renderBackground(){this.backgroundManager.render(this.ctx)}renderGround(e){this.ctx.fillStyle=e.color,this.ctx.fillRect(e.x,e.y,e.width,e.height)}renderPlayer(e){if(De&&d.USE_SPRITES){const t=e.height/d.PLAYER_HEIGHT;De.draw(this.ctx,e.x,e.y,t)}else this.ctx.fillStyle=e.color,this.ctx.fillRect(e.x,e.y,e.width,e.height)}renderPlatforms(e){e.forEach(t=>{this.ctx.fillStyle=t.color,this.ctx.strokeStyle=t.borderColor;const a=4,i=t.x,s=t.y,n=t.width,o=t.height;this.ctx.beginPath(),this.ctx.moveTo(i+a,s),this.ctx.lineTo(i+n-a,s),this.ctx.quadraticCurveTo(i+n,s,i+n,s+a),this.ctx.lineTo(i+n,s+o-a),this.ctx.quadraticCurveTo(i+n,s+o,i+n-a,s+o),this.ctx.lineTo(i+a,s+o),this.ctx.quadraticCurveTo(i,s+o,i,s+o-a),this.ctx.lineTo(i,s+a),this.ctx.quadraticCurveTo(i,s,i+a,s),this.ctx.closePath(),this.ctx.lineWidth=3,this.ctx.stroke(),this.ctx.fill()})}renderBombs(e){e.forEach(t=>{if(!t.isCollected)if(Qe&&d.USE_SPRITES){let a=this.bombSprites.get(t.order);if(!a){const n=[{name:"unlit",frames:Qe.animations.unlit.frames,frameDuration:50,loop:!1},{name:"lit",frames:Qe.animations.lit.frames,frameDuration:100,loop:!0}];a=new Tt(n,"unlit"),this.bombSprites.set(t.order,a)}const i=t.isBlinking?"lit":"unlit";a.setAnimation(i),a.update(16);const s=t.width/d.BOMB_SIZE;a.draw(this.ctx,t.x,t.y,s)}else this.ctx.fillStyle=t.isBlinking?$.BOMB_NEXT:$.BOMB,this.ctx.fillRect(t.x,t.y,t.width,t.height),this.ctx.fillStyle="#000000",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.fillText(t.order.toString(),t.x+t.width/2,t.y+t.height/2+4)})}renderCoins(e,t){e.forEach(a=>{if(a.isCollected)return;let s=de[a.type]?.color||"#FFD700";a.type==="POWER"&&t&&(s=t.getPcoinCurrentColor(a)),this.ctx.fillStyle=s,this.ctx.beginPath(),this.ctx.arc(a.x+a.width/2,a.y+a.height/2,a.width/2,0,2*Math.PI),this.ctx.fill(),this.ctx.fillStyle="#fff",this.ctx.font="14px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle";let n="C";a.type==="POWER"?(n="P",this.ctx.fillStyle="#000"):a.type==="BONUS_MULTIPLIER"?(n="B",this.ctx.fillStyle="#fff"):a.type==="EXTRA_LIFE"&&(n="M",this.ctx.fillStyle="#fff"),this.ctx.fillText(n,a.x+a.width/2,a.y+a.height/2+2)})}renderMonsters(e){e.forEach((t,a)=>{if(!t.isActive){x.debug(`Monster ${a} is not active, skipping`);return}let i=t.color;if(t.isBlinking){const s=Date.now();Math.floor(s/300)%2===0?i=$.MONSTER_FROZEN:i=t.color}else t.isFrozen&&(i=$.MONSTER_FROZEN);this.ctx.fillStyle=i,this.ctx.fillRect(t.x,t.y,t.width,t.height),this.ctx.fillStyle="#000",this.ctx.fillRect(t.x+2,t.y+2,2,2),this.ctx.fillRect(t.x+t.width-4,t.y+2,2,2)}),this.renderRespawnIndicators(e),this.renderSpawnIndicators(this.currentSpawnManager)}renderRespawnIndicators(e){const t=He.getInstance();e.forEach(a=>{if(a.isDead&&a.originalSpawnPoint){const i=t.getRespawnTimeRemaining(a),s=Math.ceil(i/1e3);if(i>0&&s<=3){const n=a.originalSpawnPoint,o=Math.sin(Date.now()/200)*.3+.7,c=a.color||"#ffffff";this.ctx.fillStyle=`${c}${Math.floor(o*1*255).toString(16).padStart(2,"0")}`,this.ctx.fillRect(n.x,n.y,a.width,a.height);const h=`${s}`,m=n.x+a.width/2,g=n.y+a.height/2+4;this.ctx.fillStyle="#ffffff",this.ctx.font="16px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(h,m,g)}}})}renderSpawnIndicators(e){if(e&&!(!this.currentGameState||this.currentGameState.currentState!=="PLAYING"))try{e.getPendingSpawns().forEach(a=>{const i=e.getSpawnTimeRemaining(a),s=Math.ceil(i/1e3);if(i>0&&s<=3){const n=a.spawnPoint.createMonster(),o=Math.sin(Date.now()/200)*.3+.7,c=n.color||"#ffffff";this.ctx.fillStyle=`${c}${Math.floor(o*1*255).toString(16).padStart(2,"0")}`,this.ctx.fillRect(n.x,n.y,n.width,n.height);const h=`${s}`,m=n.x+n.width/2,g=n.y+n.height/2;this.ctx.fillStyle="#ffffff",this.ctx.font="16px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(h,m,g)}})}catch{}}renderFloatingTexts(e,t){e.forEach(a=>{const i=Date.now()-a.startTime,s=Math.min(i/a.duration,1),o=a.y-50*s,c=1-s;this.ctx.globalAlpha=c,this.ctx.fillStyle=a.color,this.ctx.font=`${a.fontSize}px Arial`,this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(a.text,a.x,o),this.ctx.globalAlpha=1})}loadCityTheme(e){this.backgroundManager.loadMapBackground(e)}loadMapBackground(e){this.backgroundManager.loadMapBackground(e)}isParallaxReady(){return this.backgroundManager.isReady()}isParallaxLoading(){return this.backgroundManager.isCurrentlyLoading()}getCurrentMapName(){return this.backgroundManager.getCurrentMapName()}clearBombSprites(){this.bombSprites.clear()}}const At=r=>r.type==="HORIZONTAL_PATROL"||r.type==="VERTICAL_PATROL",Ua=r=>r.type==="CHASER",Ha=r=>r.type==="AMBUSHER";class ee{static checkMonsterPlatformCollision(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}static isMonsterOnPlatform(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&Math.abs(e.y+e.height-t.y)<=2}static findCurrentPlatform(e,t){for(const a of t)if(this.isMonsterOnPlatform(e,a))return a;return null}static isMonsterOnGround(e,t){return Math.abs(e.y+e.height-t.y)<=2}static applyGravity(e){e.velocityY||(e.velocityY=0),e.gravity||(e.gravity=d.GRAVITY),e.velocityY+=e.gravity,e.y+=e.velocityY}static isAtPlatformEdge(e,t,a){return a>0?e.x+e.width>=t.x+t.width-5:e.x<=t.x+5}static hasFallenOffPlatform(e,t){return e.x+e.width<t.x||e.x>t.x+t.width}static determineSpawnSide(e,t){const a=t.x+t.width/2;return e.x<a?"left":"right"}static shouldFall(e,t,a,i,s){return i>=s&&Math.abs(e.x-a)<=10}static isOutsideBoundaries(e,t,a){return t<=0||t+e.width>=d.CANVAS_WIDTH||a<=0||a+e.height>=d.CANVAS_HEIGHT}static clampToBoundaries(e){e.x=Math.max(0,Math.min(e.x,d.CANVAS_WIDTH-e.width)),e.y=Math.max(0,Math.min(e.y,d.CANVAS_HEIGHT-e.height))}static isMovementSafe(e,t,a,i){if(this.isOutsideBoundaries(e,t,a))return!1;for(const s of i)if(this.checkMonsterPlatformCollision({...e,x:t,y:a},s))return!1;return!0}static isMovementSafeWithGround(e,t,a,i,s){if(this.isOutsideBoundaries(e,t,a))return!1;for(const n of i)if(this.checkMonsterPlatformCollision({...e,x:t,y:a},n))return!1;return!(s&&this.checkMonsterPlatformCollision({...e,x:t,y:a},s))}}class Ya{update(e,t,a,i){if(a&&a.currentState!=="PLAYING")return;e.type==="HORIZONTAL_PATROL"?this.updateHorizontalPatrol(e,t,i):this.updateVerticalPatrol(e,t,i)}updateHorizontalPatrol(e,t,a){if(!At(e))return;const i=K.getInstance(),s=i.getMonsterScaledValues(e);i.getBaseValues();const n=i.getMonsterAge(e),o=s.patrol.speed;n<2&&v.debug(`Patrol scaling - Age: ${n.toFixed(1)}s, Speed: ${o.toFixed(2)}`);const c=a?o*(a/16.67):o,h=e.x+c*e.direction;h<e.patrolStartX||h+e.width>e.patrolEndX?(e.direction*=-1,e.lastDirectionChange=t):e.x=h;const m=N.getState(),g=m.platforms||[],p=ee.findCurrentPlatform(e,g);p?(e.y=p.y-e.height,e.velocityY=0,e.isGrounded=!0):this.handleGroundCollision(e,m.ground)}updateVerticalPatrol(e,t,a){if(!At(e))return;const i=K.getInstance(),s=i.getMonsterScaledValues(e);i.getBaseValues(),i.getMonsterAge(e);const n=s.patrol.speed;if(!e.originalSpawnX){const m=N.getState().platforms||[],g=e.patrolSide||"left",p=e.targetPlatformX,y=m.find(M=>M.isVertical&&Math.abs(M.x-p)<1);y&&(e.originalSpawnX=g==="left"?y.x-e.width-8:y.x+8+y.width,e.x=e.originalSpawnX)}const o=a?n*(a/16.67):n,c=e.y+o*e.direction;c<e.patrolStartY||c+e.height>e.patrolEndY?(e.direction*=-1,e.lastDirectionChange=t):e.y=c,e.originalSpawnX!==void 0?(e.x=e.originalSpawnX,e.velocityX=0,e.velocityY=0,e.isGrounded=!1):(e.velocityX=0,e.velocityY=0,e.isGrounded=!1)}handleGroundCollision(e,t){if(!t)return;e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y&&(e.y=t.y-e.height,e.velocityY=0,e.isGrounded=!0)}}class Xa{update(e,t,a,i){if(!Ua(e)||a.currentState!=="PLAYING")return;const s=a.player;if(!s)return;const n=K.getInstance(),o=n.getMonsterScaledValues(e);n.getBaseValues();const c=n.getMonsterAge(e);if(c<2&&v.debug(`Chaser scaling - Age: ${c.toFixed(1)}s, Speed: ${o.chaser.speed.toFixed(2)}`),!e.behaviorState){e.behaviorState="chasing",e.lastDirectionChange=t,e.chaseTargetX=s.x,e.chaseTargetY=s.y,e.updateIntervalMultiplier=.8+Math.random()*.4,e.directnessMultiplier=.85+Math.random()*.3,e.speedMultiplier=.9+Math.random()*.2;const L=(Math.random()-.5)*50,U=(Math.random()-.5)*50;e.chaseTargetX=s.x+L,e.chaseTargetY=s.y+U,e.lastDirectionChange=t+Math.random()*o.chaser.updateInterval}const h=a.platforms||[],m=o.chaser.directness*(e.directnessMultiplier||1),g=o.chaser.updateInterval*(e.updateIntervalMultiplier||1);if(t-(e.lastDirectionChange||t)>g){const L=e.chaseTargetX||e.x,U=e.chaseTargetY||e.y,W=Math.random()<.3,ae=W?(Math.random()-.5)*15:0,me=W?(Math.random()-.5)*15:0;e.chaseTargetX=L+(s.x+ae-L)*m,e.chaseTargetY=U+(s.y+me-U)*m,e.lastDirectionChange=t}const y=e.chaseTargetX||e.x,M=e.chaseTargetY||e.y,T=y-e.x,R=M-e.y,G=Math.sqrt(T*T+R*R);if(G>20){const L=o.chaser.speed*(e.speedMultiplier||1),U=i?L*(i/16.67):L,W=Math.sign(T)*U,ae=Math.sign(R)*U;this.applyMovement(e,W,ae,y,M,h,a.ground)}else if(G>5){const L=o.chaser.speed*(e.speedMultiplier||1)*.5,U=i?L*(i/16.67):L,W=Math.sign(T)*U,ae=Math.sign(R)*U;this.applyMovement(e,W,ae,y,M,h,a.ground)}}applyMovement(e,t,a,i,s,n,o){const c=e.x+t,h=e.y+a,m=ee.isMovementSafe(e,c,e.y,n),g=ee.isMovementSafe(e,e.x,h,n);m&&(e.x=c),g&&(e.y=h),this.handleGroundCollision(e,o),!m&&!g&&this.findAlternativePath(e,i,s,n)}findAlternativePath(e,t,a,i){const s=t-e.x,n=a-e.y,o=Math.random();if((Math.abs(s)>Math.abs(n)?o>.7?"vertical":"horizontal":o>.7?"horizontal":"vertical")==="horizontal"){const h=Math.random()>.5?[1,-1]:[-1,1];for(const y of h){const M=e.y+y*e.speed;let T=!0;for(const R of i)if(ee.checkMonsterPlatformCollision({...e,y:M},R)){T=!1;break}if(T){e.y=M;return}}const m=Math.sign(s)*-1,g=e.x+m*e.speed;let p=!0;for(const y of i)if(ee.checkMonsterPlatformCollision({...e,x:g},y)){p=!1;break}if(p){e.x=g;return}}else{const h=Math.random()>.5?[1,-1]:[-1,1];for(const y of h){const M=e.x+y*e.speed;let T=!0;for(const R of i)if(ee.checkMonsterPlatformCollision({...e,x:M},R)){T=!1;break}if(T){e.x=M;return}}const m=Math.sign(n)*-1,g=e.y+m*e.speed;let p=!0;for(const y of i)if(ee.checkMonsterPlatformCollision({...e,y:g},y)){p=!1;break}if(p){e.y=g;return}}this.tryRandomMovement(e,i)}handleGroundCollision(e,t){if(!t)return;e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y&&(e.y=t.y-e.height,e.velocityY=0,e.isGrounded=!0)}tryRandomMovement(e,t){const a=[{x:1,y:0},{x:-1,y:0},{x:0,y:1},{x:0,y:-1},{x:1,y:1},{x:-1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let i=a.length-1;i>0;i--){const s=Math.floor(Math.random()*(i+1));[a[i],a[s]]=[a[s],a[i]]}for(const i of a){const s=e.x+i.x*e.speed,n=e.y+i.y*e.speed;let o=!0;for(const c of t)if(ee.checkMonsterPlatformCollision({...e,x:s,y:n},c)){o=!1;break}if(o){e.x=s,e.y=n;return}}}}class Wa{update(e,t,a,i){if(!Ha(e)||a.currentState!=="PLAYING")return;const s=a.player;if(!s)return;const n=K.getInstance(),o=n.getMonsterScaledValues(e);n.getBaseValues();const c=n.getMonsterAge(e);c<2&&v.debug(`Ambusher scaling - Age: ${c.toFixed(1)}s, Speed: ${o.ambusher.speed.toFixed(2)}`),e.behaviorState||(e.behaviorState="wandering",e.lastDirectionChange=t,e.ambushCooldown=2e3);const h=a.platforms||[];if(e.behaviorState==="wandering"){(!e.targetX||!e.targetY)&&this.chooseNewWanderingDirection(e,t),t-(e.lastDirectionChange||t)>2e3+Math.random()*2e3&&this.chooseNewWanderingDirection(e,t);const g=o.ambusher.speed*.5,p=i?g*(i/16.67):g,y=e.targetX||e.x,M=e.targetY||e.y,T=y-e.x,R=M-e.y,G=Math.sqrt(T*T+R*R);if(G>5){const L=T/G,U=R/G,W=e.x+p*L,ae=e.y+p*U;ee.isMovementSafeWithGround(e,W,ae,h,a.ground)?(e.x=W,e.y=ae):this.chooseNewWanderingDirection(e,t)}else this.chooseNewWanderingDirection(e,t);e.ambushCooldown+=i||16,e.ambushCooldown>=o.ambusher.ambushInterval&&(e.behaviorState="ambushing",e.lastDirectionChange=t,e.ambushCooldown=0,e.ambushTargetX=s.x,e.ambushTargetY=s.y,v.debug(`Ambusher switching to ambush mode, targeting player at (${e.ambushTargetX}, ${e.ambushTargetY})`))}else if(e.behaviorState==="ambushing"){const m=o.ambusher.speed*3,g=i?m*(i/16.67):m,p=e.ambushTargetX||e.x,y=e.ambushTargetY||e.y,M=Math.sqrt((p-e.x)**2+(y-e.y)**2);if(M>5){const T=p-e.x,R=y-e.y,G=T/M,L=R/M,U=e.x+g*G,W=e.y+g*L;ee.isMovementSafeWithGround(e,U,W,h,a.ground)?(e.x=U,e.y=W):(e.behaviorState="wandering",e.lastDirectionChange=t,v.debug("Ambusher blocked, returning to wandering"))}else e.behaviorState="wandering",e.lastDirectionChange=t,v.debug("Ambusher reached target, returning to wandering")}}chooseNewWanderingDirection(e,t){const a=[{x:1,y:0},{x:-1,y:0},{x:0,y:1},{x:0,y:-1},{x:1,y:1},{x:-1,y:1},{x:1,y:-1},{x:-1,y:-1}],i=a[Math.floor(Math.random()*a.length)],s=50+Math.random()*100,n=Math.max(0,Math.min(e.x+i.x*s,d.CANVAS_WIDTH-e.width)),o=Math.max(0,Math.min(e.y+i.y*s,d.CANVAS_HEIGHT-e.height));e.targetX=n,e.targetY=o,e.lastDirectionChange=t}}class za{update(e,t,a,i){if(a&&a.currentState!=="PLAYING")return;const s=K.getInstance(),n=s.getMonsterScaledValues(e);s.getBaseValues();const o=s.getMonsterAge(e);o<2&&v.debug(`Floater scaling - Age: ${o.toFixed(1)}s, Speed: ${n.floater.speed.toFixed(2)}`),!e.velocityX&&!e.velocityY&&this.initializeVelocity(e,n.floater.speed);const c=Math.sqrt(e.velocityX*e.velocityX+e.velocityY*e.velocityY);if(c>0){const R=n.floater.speed/c;e.velocityX*=R,e.velocityY*=R}const h=i?i/16.67:1,m=e.x+e.velocityX*h,g=e.y+e.velocityY*h,p=N.getState(),y=p.platforms||[];let M=!0,T={x:0,y:0};for(const R of y)if(ee.checkMonsterPlatformCollision({...e,x:m,y:g},R)){M=!1,T=this.calculateCollisionNormal(e,R);break}(m<=0||m+e.width>=d.CANVAS_WIDTH||g<=0||g+e.height>=d.CANVAS_HEIGHT)&&(M=!1,T=this.calculateBoundaryCollisionNormal(e,m,g)),p.ground&&ee.checkMonsterPlatformCollision({...e,x:m,y:g},p.ground)&&(M=!1,T=this.calculateCollisionNormal(e,p.ground)),M?(e.x=m,e.y=g):this.bounceOffCollision(e,T,n.floater.bounceAngle)}initializeVelocity(e,t){if(e.type!=="FLOATER")return;const i=(e.startAngle||45)*Math.PI/180;e.velocityX=Math.cos(i)*t,e.velocityY=Math.sin(i)*t}calculateCollisionNormal(e,t){const a=e.x+e.width/2,i=e.y+e.height/2,s=Math.max(t.x,Math.min(a,t.x+t.width)),n=Math.max(t.y,Math.min(i,t.y+t.height)),o=a-s,c=i-n,h=Math.sqrt(o*o+c*c);if(h>.1)return{x:o/h,y:c/h};{const m=Math.abs(e.x+e.width-t.x),g=Math.abs(e.x-(t.x+t.width)),p=Math.abs(e.y+e.height-t.y),y=Math.abs(e.y-(t.y+t.height)),M=Math.min(m,g,p,y);return M===m?{x:-1,y:0}:M===g?{x:1,y:0}:M===p?{x:0,y:-1}:{x:0,y:1}}}calculateBoundaryCollisionNormal(e,t,a){return t<=0?{x:1,y:0}:t+e.width>=d.CANVAS_WIDTH?{x:-1,y:0}:a<=0?{x:0,y:1}:{x:0,y:-1}}bounceOffCollision(e,t,a){const i=e.velocityX*t.x+e.velocityY*t.y;e.velocityX=e.velocityX-2*i*t.x,e.velocityY=e.velocityY-2*i*t.y;const s=(Math.random()-.5)*a,n=Math.sqrt(e.velocityX*e.velocityX+e.velocityY*e.velocityY),c=Math.atan2(e.velocityY,e.velocityX)+s;e.velocityX=Math.cos(c)*n,e.velocityY=Math.sin(c)*n}}class Ka{constructor(){b(this,"patrolMovement");b(this,"chaserMovement");b(this,"ambusherMovement");b(this,"floaterMovement");this.patrolMovement=new Ya,this.chaserMovement=new Xa,this.ambusherMovement=new Wa,this.floaterMovement=new za}updateMonsterBehaviors(e,t,a){t.monsters&&t.monsters.forEach(i=>{if(!(!i.isActive||i.isFrozen)){switch(i.type){case F.HORIZONTAL_PATROL:case F.VERTICAL_PATROL:this.patrolMovement.update(i,e,t,a);break;case F.CHASER:this.chaserMovement.update(i,e,t,a);break;case F.AMBUSHER:this.ambusherMovement.update(i,e,t,a);break;case F.FLOATER:this.floaterMovement.update(i,e,t,a);break}ee.clampToBoundaries(i)}})}}class Za{constructor(){b(this,"levelStartTime",0);b(this,"scheduledSpawns",[]);b(this,"behaviorManager");b(this,"pauseState");b(this,"lastUpdateTime",0);b(this,"updateInterval",16);this.behaviorManager=new Ka,this.pauseState=this.createPauseState()}initializeLevel(e){this.levelStartTime=Date.now(),this.scheduledSpawns=this.createScheduledSpawns(e),this.resetPauseState(),v.flow(`Level initialized with ${e.length} spawn points`),this.scheduledSpawns.forEach((t,a)=>{const i=(t.scheduledTime-this.levelStartTime)/1e3;try{const s=t.spawnPoint.createMonster();v.debug(`Scheduled spawn ${a}: ${s.type} at ${i.toFixed(1)}s`)}catch(s){v.error(`Failed to create monster for spawn ${a}: ${s}`)}})}createScheduledSpawns(e){return e.map((t,a)=>({id:`spawn-${a}`,spawnPoint:t,scheduledTime:this.levelStartTime+t.spawnDelay,executed:!1}))}resetPauseState(){this.pauseState=this.createPauseState()}createPauseState(){return{isPaused:!1,pauseStartTime:0,totalPausedTime:0,pauseReasons:new Set}}update(e,t){if(this.pauseState.isPaused)return;const a=N.getState(),i=this.getAdjustedTime();Math.floor(i/5e3)!==Math.floor((i-16)/5e3)&&v.debug(`SpawnManager.update() called at ${(i/1e3).toFixed(1)}s, paused: ${this.pauseState.isPaused}, spawns: ${this.scheduledSpawns.length}`),this.processSpawns(e,a),a.monsters.some(s=>s.isActive)&&this.behaviorManager.updateMonsterBehaviors(e,a,t)}processSpawns(e,t){const a=this.getAdjustedTime(),i=this.getAdjustedAbsoluteTime(),s=[];if(Math.floor(a/5e3)!==Math.floor((a-16)/5e3)){const n=this.scheduledSpawns.filter(o=>!o.executed);v.info(`Spawn check at ${(a/1e3).toFixed(1)}s: ${n.length} pending spawns`),n.forEach(o=>{const c=(o.scheduledTime-i)/1e3;try{const h=o.spawnPoint.createMonster();v.info(` - ${h.type} in ${c.toFixed(1)}s (scheduled: ${o.scheduledTime}, current: ${i})`)}catch(h){v.error(` - Failed to create monster: ${h}`)}})}for(const n of this.scheduledSpawns)!n.executed&&i>=n.scheduledTime&&(s.push(n),v.info(`Spawn ready to execute: ${n.spawnPoint.createMonster().type} (scheduled at ${(n.scheduledTime/1e3).toFixed(1)}s, current time ${(a/1e3).toFixed(1)}s)`));s.length>0&&(v.info(`Executing ${s.length} spawns at ${(a/1e3).toFixed(1)}s`),this.executeSpawns(s,e,t))}executeSpawns(e,t,a){const i=[];for(const s of e)try{const n=this.createMonster(s.spawnPoint);i.push(n),s.executed=!0,v.monster(`Spawned ${n.type} at (${n.x}, ${n.y})`)}catch(n){v.error(`Failed to spawn monster: ${n}`)}i.length>0&&(this.addMonstersToGameState(i,a),v.debug(`Added ${i.length} monsters to game state`))}createMonster(e){const t=e.createMonster();return e.color&&(t.color=e.color),t.originalSpawnPoint||(t.originalSpawnPoint={x:t.x,y:t.y}),t}addMonstersToGameState(e,t){if(t.updateMonsters){const i=[...t.monsters||[],...e];t.updateMonsters(i)}else v.warn("Game state updateMonsters method is not available")}pause(e="default"){this.pauseState.isPaused||(this.pauseState.isPaused=!0,this.pauseState.pauseStartTime=Date.now()),this.pauseState.pauseReasons.add(e),v.pause(`Spawning paused (${e})`),v.debug(`SpawnManager pause state: ${this.pauseState.isPaused}, reasons: ${Array.from(this.pauseState.pauseReasons).join(", ")}`)}resume(e="default"){if(this.pauseState.pauseReasons.delete(e),this.pauseState.pauseReasons.size===0&&this.pauseState.isPaused){const t=Date.now()-this.pauseState.pauseStartTime;this.pauseState.totalPausedTime+=t,this.pauseState.isPaused=!1,v.pause(`Spawning resumed (paused for ${(t/1e3).toFixed(1)}s)`)}v.debug(`SpawnManager pause state: ${this.pauseState.isPaused}, reasons: ${Array.from(this.pauseState.pauseReasons).join(", ")}`)}isPaused(){return this.pauseState.isPaused}getPauseStatus(){return{isPaused:this.pauseState.isPaused,pauseReasons:Array.from(this.pauseState.pauseReasons),totalPausedTime:this.pauseState.totalPausedTime}}getAdjustedTime(){return Date.now()-this.levelStartTime-this.pauseState.totalPausedTime}getAdjustedAbsoluteTime(){return this.levelStartTime+this.getAdjustedTime()}removeMonster(e){e.isActive=!1;const t=N.getState();if(t.updateMonsters){const i=(t.monsters||[]).filter(s=>s!==e);t.updateMonsters(i)}}reset(){this.levelStartTime=Date.now(),this.scheduledSpawns.forEach(e=>e.executed=!1),this.resetPauseState(),this.lastUpdateTime=0}getSpawnStatus(){const e=this.scheduledSpawns.filter(i=>i.executed).length,t=this.scheduledSpawns.filter(i=>!i.executed).length,a=this.getAdjustedTime();return{totalSpawnPoints:this.scheduledSpawns.length,executedCount:e,pendingCount:t,isPaused:this.pauseState.isPaused,pauseReasons:Array.from(this.pauseState.pauseReasons),adjustedTime:a/1e3,levelStartTime:this.levelStartTime,totalPausedTime:this.pauseState.totalPausedTime}}getSpawnTimeRemaining(e){if(e.executed)return 0;const t=this.getAdjustedAbsoluteTime();return Math.max(0,e.scheduledTime-t)}getPendingSpawns(){return this.scheduledSpawns.filter(e=>!e.executed)}setUpdateInterval(e){this.updateInterval=e,v.debug(`OptimizedSpawnManager: Update interval set to ${e}ms`)}cleanup(){this.scheduledSpawns=[],this.resetPauseState(),this.lastUpdateTime=0}}class qa{constructor(){b(this,"audioContext",null);b(this,"backgroundMusicGain",null);b(this,"isBackgroundMusicPlaying",!1);b(this,"backgroundMusicBuffer",null);b(this,"backgroundMusicSource",null);this.initializeAudioContext(),this.loadBackgroundMusic()}initializeAudioContext(){try{this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.backgroundMusicGain=this.audioContext.createGain(),this.backgroundMusicGain.connect(this.audioContext.destination),this.updateAudioVolumes()}catch(e){x.warn("Web Audio API not supported:",e)}}async loadBackgroundMusic(){if(this.audioContext)try{const t=await(await fetch(`${ue.audio}/background-music.wav`)).arrayBuffer();this.backgroundMusicBuffer=await this.audioContext.decodeAudioData(t)}catch(e){x.warn("Failed to load background music:",e)}}ensureAudioContext(){this.audioContext?.state==="suspended"&&this.audioContext.resume()}playSound(e,t){switch(this.ensureAudioContext(),e){case z.BOMB_COLLECT:this.playBombCollectSound();break;case z.MONSTER_HIT:this.playMonsterHitSound();break;case z.MAP_CLEARED:this.playMapClearedSound();break;case z.BONUS_SCREEN:x.audio("Bonus sound"),this.playBonusSound();break;case z.COIN_COLLECT:this.playCoinCollectSound();break;case z.POWER_COIN_ACTIVATE:this.playPowerCoinActivateSound();break;case z.BACKGROUND_MUSIC:t===C.PLAYING&&this.startBackgroundMusic();break;default:x.debug(`Audio event ${e} not implemented yet`)}}stopBackgroundMusic(){if(this.isBackgroundMusicPlaying=!1,this.backgroundMusicSource){try{this.backgroundMusicSource.stop()}catch{}this.backgroundMusicSource=null}}playBombCollectSound(){if(!this.audioContext)return;const e=this.audioContext.createOscillator(),t=this.audioContext.createGain();e.connect(t),t.connect(this.audioContext.destination),e.type="square",e.frequency.setValueAtTime(800,this.audioContext.currentTime),e.frequency.exponentialRampToValueAtTime(1200,this.audioContext.currentTime+.1);const a=this.getSFXVolume();t.gain.setValueAtTime(.3*a,this.audioContext.currentTime),t.gain.exponentialRampToValueAtTime(.01,this.audioContext.currentTime+.2),e.start(),e.stop(this.audioContext.currentTime+.2)}playMonsterHitSound(){if(!this.audioContext)return;const e=this.audioContext.createOscillator(),t=this.audioContext.createGain();e.connect(t),t.connect(this.audioContext.destination),e.type="sawtooth",e.frequency.setValueAtTime(200,this.audioContext.currentTime),e.frequency.exponentialRampToValueAtTime(50,this.audioContext.currentTime+.3);const a=this.getSFXVolume();t.gain.setValueAtTime(.4*a,this.audioContext.currentTime),t.gain.exponentialRampToValueAtTime(.01,this.audioContext.currentTime+.3),e.start(),e.stop(this.audioContext.currentTime+.3)}playMapClearedSound(){if(!this.audioContext)return;const e=[523.25,587.33,659.25,698.46,783.99];let t=this.audioContext.currentTime;const a=this.getSFXVolume();e.forEach((i,s)=>{const n=this.audioContext.createOscillator(),o=this.audioContext.createGain();n.connect(o),o.connect(this.audioContext.destination),n.type="triangle",n.frequency.setValueAtTime(i,t),o.gain.setValueAtTime(.3*a,t),o.gain.exponentialRampToValueAtTime(.01,t+.3),n.start(t),n.stop(t+.3),t+=.15})}playBonusSound(){if(!this.audioContext)return;const e=[659.25,783.99,1046.5,783.99,1046.5];let t=this.audioContext.currentTime;const a=this.getSFXVolume();e.forEach((i,s)=>{const n=this.audioContext.createOscillator(),o=this.audioContext.createGain();n.connect(o),o.connect(this.audioContext.destination),n.type="sine",n.frequency.setValueAtTime(i,t),o.gain.setValueAtTime(.2*a,t),o.gain.exponentialRampToValueAtTime(.01,t+.4),n.start(t),n.stop(t+.4),t+=.2})}playCoinCollectSound(){if(!this.audioContext)return;const e=this.audioContext.createOscillator(),t=this.audioContext.createGain();e.connect(t),t.connect(this.audioContext.destination),e.type="sine",e.frequency.setValueAtTime(1e3,this.audioContext.currentTime),e.frequency.exponentialRampToValueAtTime(1500,this.audioContext.currentTime+.1);const a=this.getSFXVolume();t.gain.setValueAtTime(.3*a,this.audioContext.currentTime),t.gain.exponentialRampToValueAtTime(.01,this.audioContext.currentTime+.15),e.start(),e.stop(this.audioContext.currentTime+.15)}playPowerCoinActivateSound(){if(!this.audioContext)return;const e=this.audioContext.currentTime,t=this.getSFXVolume(),a=this.audioContext.createOscillator(),i=this.audioContext.createGain();a.connect(i),i.connect(this.audioContext.destination),a.type="square",a.frequency.setValueAtTime(200,e),a.frequency.exponentialRampToValueAtTime(400,e+.3),i.gain.setValueAtTime(.2*t,e),i.gain.exponentialRampToValueAtTime(.01,e+.5),a.start(e),a.stop(e+.5);const s=this.audioContext.createOscillator(),n=this.audioContext.createGain();s.connect(n),n.connect(this.audioContext.destination),s.type="sine",s.frequency.setValueAtTime(800,e),s.frequency.exponentialRampToValueAtTime(1200,e+.2),n.gain.setValueAtTime(.15*t,e),n.gain.exponentialRampToValueAtTime(.01,e+.3),s.start(e),s.stop(e+.3)}startBackgroundMusic(){!this.audioContext||this.isBackgroundMusicPlaying||!this.backgroundMusicBuffer||(this.isBackgroundMusicPlaying=!0,this.playBackgroundMusicFile())}playBackgroundMusicFile(){if(!(!this.audioContext||!this.backgroundMusicGain||!this.backgroundMusicBuffer||!this.isBackgroundMusicPlaying))try{this.backgroundMusicSource=this.audioContext.createBufferSource(),this.backgroundMusicSource.buffer=this.backgroundMusicBuffer,this.backgroundMusicSource.connect(this.backgroundMusicGain),this.backgroundMusicSource.loop=!0,this.backgroundMusicSource.onended=()=>{this.isBackgroundMusicPlaying&&setTimeout(()=>{this.isBackgroundMusicPlaying&&this.playBackgroundMusicFile()},100)},this.backgroundMusicSource.start()}catch(e){x.warn("Failed to play background music file:",e)}}cleanup(){this.stopBackgroundMusic(),this.audioContext&&this.audioContext.close()}updateAudioVolumes(){const e=N.getState().audioSettings;if(this.backgroundMusicGain){const t=e.masterMuted||e.musicMuted?0:e.masterVolume/100*(e.musicVolume/100);this.backgroundMusicGain.gain.value=t}}getSFXVolume(){const e=N.getState().audioSettings;return e.masterMuted||e.sfxMuted?0:e.masterVolume/100*(e.sfxVolume/100)}updateVolumes(){this.updateAudioVolumes()}}class Ja{constructor(e){b(this,"sprite");b(this,"currentState");b(this,"wasInAir",!1);b(this,"isLanding",!1);b(this,"isMapCleared",!1);b(this,"mapClearedFallComplete",!1);this.sprite=e,this.currentState={isGrounded:!0,isMoving:!1,isFloating:!1,gameState:"",moveDirection:"none",lastDirection:"right"}}update(e,t,a=!1,i=""){const s={isGrounded:e,isMoving:t!==0,isFloating:a,gameState:i,moveDirection:t>0?"right":t<0?"left":"none",lastDirection:this.getLastDirection()};i==="MAP_CLEARED"&&!this.isMapCleared&&(this.isMapCleared=!0,this.mapClearedFallComplete=!1,e&&(this.mapClearedFallComplete=!0)),this.isLanding&&this.sprite.currentAnimation.name.includes("land")&&this.sprite.currentFrameIndex>=this.sprite.currentAnimation.frames.length-1&&(this.isLanding=!1,this.isMapCleared&&(this.mapClearedFallComplete=!0));const n=this.wasInAir&&e;this.currentState=s,this.wasInAir=!e,n&&!this.isLanding&&this.isMapCleared?this.setLandingAnimation():n&&!this.isLanding?this.setLandingAnimation():this.isLanding||this.updateAnimation()}getLastDirection(){return this.sprite.currentAnimation.name.includes("right")?"right":"left"}updateAnimation(){const{isGrounded:e,isMoving:t,isFloating:a,gameState:i,moveDirection:s,lastDirection:n}=this.currentState;this.isMapCleared?this.mapClearedFallComplete?this.sprite.setAnimation("ghost-complete"):e?(this.mapClearedFallComplete=!0,this.sprite.setAnimation("ghost-complete")):this.handleAirAnimations(s,n):i==="MAP_CLEARED"?(this.isMapCleared=!0,this.mapClearedFallComplete=!1,this.handleAirAnimations(s,n)):a?this.handleFloatAnimations(s,n):e?t?this.handleWalkAnimations(s):this.handleIdleAnimations(n):this.handleAirAnimations(s,n)}handleAirAnimations(e,t){if(e==="right")this.sprite.setAnimationPreserveFrame("jump-right");else if(e==="left")this.sprite.setAnimationPreserveFrame("jump-left");else{const a=t==="right"?"jump-right":"jump-left";this.sprite.setAnimationPreserveFrame(a)}}handleFloatAnimations(e,t){e==="right"?this.sprite.setAnimation("float-right"):e==="left"?this.sprite.setAnimation("float-left"):this.sprite.setAnimation("float-stationary")}handleWalkAnimations(e){e==="right"?this.sprite.setAnimation("walk-right"):e==="left"&&this.sprite.setAnimation("walk-left")}handleIdleAnimations(e){const t=e==="right"?"idle-right":"idle-left";this.sprite.setAnimation(t)}setLandingAnimation(){const{lastDirection:e}=this.currentState,t=e==="right"?"land-right":"land-left";this.sprite.setAnimation(t),this.isLanding=!0}getCurrentState(){return{...this.currentState}}reset(){this.isMapCleared=!1,this.mapClearedFallComplete=!1,this.isLanding=!1,this.wasInAir=!1}}class Qa{constructor(e){b(this,"inputManager");b(this,"collisionManager");b(this,"renderManager");b(this,"monsterSpawnManager");b(this,"audioManager");b(this,"animationController");b(this,"scalingManager");b(this,"monsterRespawnManager");b(this,"animationFrameId",null);b(this,"lastTime",0);b(this,"isBackgroundMusicPlaying",!1);b(this,"previousGameState",null);b(this,"devModeInitialized",!1);b(this,"boundGameLoop");b(this,"wasGroundedWhenMapCleared",!1);b(this,"mapStartTime",0);this.inputManager=new La,this.collisionManager=new ka,this.renderManager=new Va(e),this.audioManager=new qa,this.animationController=new Ja(De),this.scalingManager=K.getInstance(),this.monsterRespawnManager=He.getInstance(),this.monsterSpawnManager=new Za,this.boundGameLoop=this.gameLoop.bind(this);const t=N.getState();"setAudioManager"in t&&t.setAudioManager(this.audioManager)}start(){{const e=N.getState();e.resetGame(),"setGameStartTime"in e&&e.setGameStartTime(Date.now()),this.loadCurrentLevel()}ua(),this.gameLoop(0)}initializeDevMode(){const e=N.getState();e.resetGameState(),e.addScore(q.MOCK_DATA.score);const t=e.lives,a=q.MOCK_DATA.lives;if(a<t){for(let s=0;s<t-a;s++)e.loseLife();e.setState(C.MENU)}const i=q.TARGET_LEVEL;{e.resetLevelState();for(let s=1;s<i;s++)e.nextLevel()}switch(this.loadCurrentLevel(),q.TARGET_STATE){case"START_MENU":e.setState(C.MENU),e.setMenuType(A.START);break;case"COUNTDOWN":e.setState(C.COUNTDOWN),e.setMenuType(A.COUNTDOWN);break;case"PLAYING":e.setState(C.PLAYING),e.setMenuType(A.IN_GAME);break;case"PAUSED":e.setState(C.PAUSED),e.setMenuType(A.PAUSE);break;case"SETTINGS":e.setState(C.MENU),e.setMenuType(A.SETTINGS);break;case"BONUS":e.setState(C.BONUS),e.setMenuType(A.BONUS),e.resetBombState();for(let s=0;s<q.MOCK_DATA.correctOrderCount;s++)e.collectBomb(s+1);break;case"VICTORY":e.setState(C.VICTORY),e.setMenuType(A.VICTORY);break;case"GAME_OVER":e.setState(C.GAME_OVER),e.setMenuType(A.GAME_OVER);break;default:x.warn(`Unknown DEV_MODE target state: ${q.TARGET_STATE}`),e.setState(C.MENU),e.setMenuType(A.START)}x.dev(`DEV_MODE: Setting multiplier to ${q.MOCK_DATA.multiplier}x with ${q.MOCK_DATA.multiplierScore} progress`),e.setMultiplier(q.MOCK_DATA.multiplier,q.MOCK_DATA.multiplierScore),x.dev(`DEV_MODE initialized with state: ${q.TARGET_STATE}, level: ${q.TARGET_LEVEL}`),this.devModeInitialized=!0}stop(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.audioManager.stopBackgroundMusic(),this.isBackgroundMusicPlaying=!1}loadCurrentLevel(){const e=N.getState(),t=e.currentLevel;if(t<=Ce.length){const a=Ce[t-1];if(e.initializeLevel(a),e.clearAllFloatingTexts(),this.animationController.reset(),this.scalingManager.startMap(),this.renderManager.loadMapBackground(a.name),a.monsterSpawnPoints?(x.info(`GameManager: Initializing MonsterSpawnManager with ${a.monsterSpawnPoints.length} spawn points`),this.monsterSpawnManager.initializeLevel(a.monsterSpawnPoints)):(x.info("GameManager: Initializing MonsterSpawnManager with no spawn points"),this.monsterSpawnManager.initializeLevel([])),this.monsterRespawnManager.reset(),a.monsters){const i=a.monsters.map(s=>({...s,originalSpawnPoint:{x:s.x,y:s.y}}));e.updateMonsters(i),x.debug(`Set up original spawn points for ${i.length} static monsters`)}e.resetCoinState(),x.debug("Coins reset when loading new level"),this.mapStartTime=Date.now()}}gameLoop(e){const t=e-this.lastTime;this.lastTime=e;const a=N.getState();if(this.handleBackgroundMusic(a.currentState),this.handleDifficultyPause(a.currentState),a.currentState===C.MENU&&!a.currentMap&&this.loadCurrentLevel(),a.currentState===C.BONUS&&a.bonusAnimationComplete&&(setTimeout(()=>{this.proceedToNextLevel()},2e3),a.setBonusAnimationComplete(!1)),a.currentState===C.PLAYING)this.update(t),De.update(t),this.handleCollisions(),this.checkWinCondition();else if(a.currentState===C.MAP_CLEARED){De.update(t);const i=a.player;if(!this.wasGroundedWhenMapCleared){const s={...i};s.velocityY+=i.gravity,s.y+=s.velocityY;const n=a.ground;if(n){const o=this.collisionManager.checkPlayerGroundCollision(s,n);o.hasCollision&&o.normal&&o.penetration&&o.normal.y===-1&&(s.y=s.y-o.penetration,s.velocityY=0,s.isGrounded=!0)}a.updatePlayer(s)}this.animationController.update(i.isGrounded,0,!1,a.currentState)}this.render(),this.animationFrameId=requestAnimationFrame(this.boundGameLoop)}handleDifficultyPause(e){e===C.PLAYING?(this.scalingManager.isCurrentlyPausedByPowerMode()||this.scalingManager.resume(),this.scalingManager.resumeAllMonsterScaling(),this.monsterSpawnManager.resume(),this.monsterRespawnManager.resume()):(this.scalingManager.pause(),this.scalingManager.pauseAllMonsterScaling(),this.monsterSpawnManager.pause(),this.monsterRespawnManager.pause())}handleBackgroundMusic(e){const t=e===C.PLAYING;this.previousGameState!==e&&x.audio(`Game state changed: ${this.previousGameState} -> ${e}`),t&&!this.isBackgroundMusicPlaying&&(x.audio("Starting background music"),this.audioManager.playSound(z.BACKGROUND_MUSIC,e),this.isBackgroundMusicPlaying=!0),!t&&this.isBackgroundMusicPlaying&&(x.audio("Stopping background music"),this.audioManager.stopBackgroundMusic(),this.isBackgroundMusicPlaying=!1),this.previousGameState=e}update(e){this.updatePlayer(e),this.updateMonsters(e),this.updateCoins(e)}updatePlayer(e){const t=N.getState();let a={...t.player};if(this.inputManager.isKeyPressed("p")||this.inputManager.isKeyPressed("P")){t.currentState===C.PLAYING&&(t.setState(C.PAUSED),t.setMenuType(A.PAUSE));return}let i=0;this.inputManager.isKeyPressed("ArrowLeft")&&(i=-a.moveSpeed),this.inputManager.isKeyPressed("ArrowRight")&&(i=a.moveSpeed),this.animationController.update(a.isGrounded,i,a.isFloating,t.currentState);const s=this.inputManager.isKeyPressed("ArrowUp"),n=this.inputManager.isShiftPressed(),o=this.inputManager.isKeyPressed(" ")||this.inputManager.isKeyPressed("Space");if(s&&a.isGrounded&&!a.isJumping){a.isJumping=!0,a.jumpStartTime=Date.now(),a.isGrounded=!1;const g=n?d.SUPER_JUMP_POWER:d.JUMP_POWER;a.velocityY=-g*.6}if(s&&a.isJumping&&a.velocityY<0){const g=Date.now()-a.jumpStartTime;if(g<=d.MAX_JUMP_DURATION){const p=Math.min(g/d.MAX_JUMP_DURATION,1),M=-(n?d.SUPER_JUMP_POWER:d.JUMP_POWER)*(.6+.4*p);a.velocityY>M&&(a.velocityY=M)}}(!s||Date.now()-a.jumpStartTime>d.MAX_JUMP_DURATION)&&a.isJumping&&(a.isJumping=!1),o&&!a.isGrounded?(a.isFloating||(a.velocityY=0),a.isFloating=!0):a.isFloating=!1,a.velocityX=i,a.x+=a.velocityX;const c=a.isFloating&&a.velocityY>=0?a.floatGravity:a.gravity;a.velocityY+=c,a.y+=a.velocityY;const h={width:d.CANVAS_WIDTH,height:d.CANVAS_HEIGHT},m=this.collisionManager.resolveBoundaryCollision(a,h);if(m.fellOffScreen){t.loseLife();return}a=m.player,a.isGrounded=!1,t.updatePlayer(a)}updateMonsters(e){const t=Date.now(),a=(t-this.mapStartTime)/1e3;Math.floor(a/5)!==Math.floor((a-e/1e3)/5)&&x.debug(`GameManager.updateMonsters() called at ${a.toFixed(1)}s`),this.monsterSpawnManager.update(t,e);const i=this.monsterRespawnManager.update(),s=N.getState();let n=s.monsters;i.length>0&&(n=[...n,...i],x.debug(`Added ${i.length} respawned monsters to active list: ${i.map(c=>c.type).join(", ")}`));const o=this.monsterRespawnManager.getDeadMonsterCount();o>0&&x.debug(`Respawn system: ${o} monsters waiting to respawn`),s.updateMonsters(n)}updateCoins(e){const t=N.getState(),a=t.currentMap?.platforms||[],i=t.currentMap?.ground,s=t.coinManager;i&&s&&(s.checkSpawnConditions(t),s.update(a,i,t),t.setCoins(s.getCoins()),t.updateMonsterStates(t.monsters)),t.updateFloatingTexts()}handleCollisions(){const e=N.getState(),{player:t,platforms:a,bombs:i,monsters:s,ground:n,coins:o}=e,c=this.collisionManager.checkPlayerPlatformCollision(t,a);if(c.hasCollision&&c.normal&&c.penetration){const p={...t};c.normal.y===-1?(p.y=p.y-c.penetration,p.velocityY=0,p.isGrounded=!0):c.normal.y===1?(p.y=p.y+c.penetration,p.velocityY=0):c.normal.x===1?(p.x=p.x+c.penetration,p.velocityX=0):c.normal.x===-1&&(p.x=p.x-c.penetration,p.velocityX=0),e.updatePlayer(p)}if(n){const p=this.collisionManager.checkPlayerGroundCollision(t,n);if(p.hasCollision&&p.normal&&p.penetration){const y={...t};p.normal.y===-1?(y.y=y.y-p.penetration,y.velocityY=0,y.isGrounded=!0):p.normal.y===1?(y.y=y.y+p.penetration,y.velocityY=0):p.normal.x===1?(y.x=y.x+p.penetration,y.velocityX=0):p.normal.x===-1&&(y.x=y.x-p.penetration,y.velocityX=0),e.updatePlayer(y)}}const h=this.collisionManager.checkPlayerBombCollision(t,i);if(h){this.audioManager.playSound(z.BOMB_COLLECT);const p=e.collectBomb(h.order);p&&p.isCorrect&&e.onFirebombCollected()}const m=this.collisionManager.checkPlayerCoinCollision(t,o);m&&(this.audioManager.playSound(z.COIN_COLLECT),e.collectCoin(m),m.type==="POWER"&&this.audioManager.playSound(z.POWER_COIN_ACTIVATE));const g=this.collisionManager.checkPlayerMonsterCollision(t,s);if(g)if(e.activeEffects.powerMode){const p=e.coinManager?.calculateMonsterKillPoints(e.multiplier)||d.MONSTER_KILL_POINTS*e.multiplier;if(e.addScore(p),e.addFloatingText){const y=p.toString();e.addFloatingText(y,g.x+g.width/2,g.y+g.height/2,1e3,"#fff",15)}e.coinManager&&e.coinManager.onPointsEarned(p,!1),x.debug(`Monster killed during power mode: ${p} points`),this.audioManager.playSound(z.COIN_COLLECT),this.monsterRespawnManager.killMonster(g)}else this.audioManager.playSound(z.MONSTER_HIT),this.handlePlayerDeath()}handlePlayerDeath(){const e=N.getState();e.lives<=1?e.loseLife():(e.loseLife(),this.respawnPlayer())}respawnPlayer(){const e=N.getState(),t=e.currentMap;if(t){e.clearAllFloatingTexts(),this.scalingManager.resetOnDeath(),x.debug("ScalingManager: Reset difficulty to base values after player death"),e.resetCoinState(),x.debug("Coins reset after player death"),e.setPlayerPosition(t.playerStart.x,t.playerStart.y);const a=t.monsters.map(i=>({...i,x:i.patrolStartX||i.x,direction:1}));e.updateMonsters(a),this.animationController.reset(),this.renderManager.loadMapBackground(t.name),e.setMenuType(A.COUNTDOWN),e.setState(C.COUNTDOWN),setTimeout(()=>{e.setState(C.PLAYING)},3e3)}}checkWinCondition(){const e=N.getState();e.collectedBombs.length===d.TOTAL_BOMBS&&(x.game("Level completed - proceeding to next phase"),this.wasGroundedWhenMapCleared=e.player.isGrounded,this.audioManager.playSound(z.MAP_CLEARED),e.setState(C.MAP_CLEARED),setTimeout(()=>{this.proceedAfterMapCleared()},3e3))}proceedAfterMapCleared(){const e=N.getState(),t=d.BONUS_POINTS[e.correctOrderCount]||0,a=Date.now()-this.mapStartTime,i=e.getCoinStats(),s=i.totalCoinsCollected,n=i.totalPowerCoinsCollected;if(e.clearAllFloatingTexts(),e.resetEffects(),e.resetCoinState(),x.debug("Coins reset when map is cleared"),e.currentMap){const o={level:e.currentLevel,mapName:e.currentMap.name,correctOrderCount:e.correctOrderCount,totalBombs:d.TOTAL_BOMBS,score:e.score,bonus:t,hasBonus:t>0,coinsCollected:s,powerModeActivations:n,completionTime:a,timestamp:Date.now(),lives:e.lives,multiplier:e.multiplier};e.addLevelResult(o);const c={mapName:e.currentMap.name,level:e.currentLevel,correctOrderCount:e.correctOrderCount,totalBombs:d.TOTAL_BOMBS,score:e.score,bonus:t,hasBonus:t>0,timestamp:Date.now(),lives:e.lives,multiplier:e.multiplier,completionTime:a,coinsCollected:s,powerModeActivations:n};bt(c)}t>0?(e.setMenuType(A.BONUS),e.setState(C.BONUS),this.audioManager.playSound(z.BONUS_SCREEN),e.addScore(t),e.coinManager&&e.coinManager.onPointsEarned(t,!0)):this.proceedToNextLevel()}proceedToNextLevel(){const e=N.getState();e.currentLevel+1<=Ce.length?(e.resetEffects(),e.resetCoinState(),x.debug("Coins reset when proceeding to next level"),e.nextLevel(),this.loadCurrentLevel(),e.setMenuType(A.COUNTDOWN),e.setState(C.COUNTDOWN),setTimeout(()=>{e.setState(C.PLAYING)},3e3)):(e.setState(C.VICTORY),e.setMenuType(A.VICTORY))}continueToNextLevel(){this.proceedToNextLevel()}calculateBonus(e){return d.BONUS_POINTS[e]||0}render(){const e=N.getState();this.renderManager.render(e.player,e.platforms,e.bombs,e.monsters,e.ground,e.coins,e.floatingTexts,e.coinManager,this.monsterSpawnManager,e.currentMap,e)}cleanup(){this.stop(),this.inputManager.cleanup(),this.audioManager.cleanup()}getPauseStatus(){return{gameState:N.getState().currentState,scalingManager:this.scalingManager.getPauseStatus(),spawnManager:this.monsterSpawnManager.getPauseStatus(),respawnManager:{isPaused:this.monsterRespawnManager.isPaused()}}}getSpawnStatus(){return this.monsterSpawnManager.getSpawnStatus()}getSpawnManager(){return this.monsterSpawnManager}}const Fe=()=>{const[r,e]=O.useState(!1),t=O.useCallback(c=>{const h=new CustomEvent("sigurd-startup-fullscreen-change",{detail:{isFullscreen:c,timestamp:Date.now(),gameId:"sigurd-startup-game"},bubbles:!0,cancelable:!0});window.dispatchEvent(h),document.dispatchEvent(h),x.debug(`Fullscreen event dispatched: ${c?"entered":"exited"}`)},[]),a=()=>!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled),i=()=>document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement,s=O.useCallback(async c=>{if(!a())return console.warn("Fullscreen is not supported in this browser"),!1;const h=c||document.documentElement;try{return h.requestFullscreen?await h.requestFullscreen():h.webkitRequestFullscreen?await h.webkitRequestFullscreen():h.mozRequestFullScreen?await h.mozRequestFullScreen():h.msRequestFullscreen&&await h.msRequestFullscreen(),!0}catch(m){return console.error("Error entering fullscreen:",m),!1}},[]),n=O.useCallback(async()=>{try{return document.exitFullscreen?await document.exitFullscreen():document.webkitExitFullscreen?await document.webkitExitFullscreen():document.mozCancelFullScreen?await document.mozCancelFullScreen():document.msExitFullscreen&&await document.msExitFullscreen(),!0}catch(c){return console.error("Error exiting fullscreen:",c),!1}},[]),o=O.useCallback(async c=>{r?await n()&&(e(!1),t(!1)):await s(c)&&(e(!0),t(!0))},[r,s,n,t]);return O.useEffect(()=>{const c=()=>{const m=!!i();m!==r&&(e(m),t(m))};return document.addEventListener("fullscreenchange",c),document.addEventListener("webkitfullscreenchange",c),document.addEventListener("mozfullscreenchange",c),document.addEventListener("MSFullscreenChange",c),c(),()=>{document.removeEventListener("fullscreenchange",c),document.removeEventListener("webkitfullscreenchange",c),document.removeEventListener("mozfullscreenchange",c),document.removeEventListener("MSFullscreenChange",c)}},[r,t]),{isFullscreen:r,isFullscreenSupported:a(),enterFullscreen:s,exitFullscreen:n,toggleFullscreen:o}},ei=({className:r=""})=>{const e=O.useRef(null),t=O.useRef(null),{isFullscreen:a}=Fe(),[i,s]=O.useState({});return O.useEffect(()=>{const n=e.current;if(n)return n.width=d.CANVAS_WIDTH,n.height=d.CANVAS_HEIGHT,t.current=new Qa(n),t.current.start(),()=>{t.current&&t.current.cleanup()}},[]),O.useEffect(()=>{const n=()=>{if(!a){s({imageRendering:"crisp-edges"});return}const o=d.CANVAS_WIDTH/d.CANVAS_HEIGHT,c=window.innerWidth,h=window.innerHeight,m=c/h;let g,p;m>o?(p=h*.9,g=p*o):(g=c*.9,p=g/o),s({width:`${g}px`,height:`${p}px`,imageRendering:"crisp-edges"})};return n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},[a]),u.jsx("div",{className:"relative",children:u.jsx("canvas",{ref:e,className:`shadow-black/10 shadow-lg rounded-lg ${r}`,style:i})})};function Pt(...r){return sa.twMerge(ra.clsx(r))}const ti=ia.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),te=ht.forwardRef(({className:r,variant:e,size:t,asChild:a=!1,...i},s)=>{const n=a?aa.Slot:"button";return u.jsx(n,{className:Pt(ti({variant:e,size:t,className:r})),ref:s,...i})});te.displayName="Button";const ai=Ae.Provider,et=Ae.Root,tt=Ae.Trigger,Ye=ht.forwardRef(({className:r,sideOffset:e=4,...t},a)=>u.jsx(Ae.Content,{ref:a,sideOffset:e,className:Pt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...t}));Ye.displayName=Ae.Content.displayName;const ii=()=>{const{setState:r,setMenuType:e}=N(),{isFullscreen:t,toggleFullscreen:a}=Fe(),i=O.useRef(null),s=()=>{e(A.COUNTDOWN),r(C.COUNTDOWN),setTimeout(()=>{r(C.PLAYING)},3e3)},n=()=>{e(A.SETTINGS)},o=()=>{const c=i.current?.closest("sigurd-startup");c?a(c):a()};return u.jsxs("div",{className:"flex flex-col items-center justify-center h-full rounded-lg",children:[u.jsx(ai,{children:u.jsxs(et,{children:[u.jsx(tt,{asChild:!0,children:u.jsx(te,{onClick:o,variant:"outline",className:"absolute top-4 right-4 bg-background-80 text-foreground backdrop-blur-sm border-none hover:bg-primary hover:text-black h-10 w-10",children:t?u.jsx(Y.Minimize,{className:"text-foreground hover:text-primary",size:24}):u.jsx(Y.Maximize,{className:"text-foreground hover:text-primary",size:24})})}),u.jsx(Ye,{children:t?"Avslutt fullskjerm (F11 eller F)":"Fullskjerm (F11 eller F)"})]})}),u.jsxs("div",{className:"text-center mb-8",children:[u.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"Sigurd Startup"}),u.jsx("p",{className:"text-muted-foreground",children:"Samle så mye finansiering som mulig!"})]}),u.jsxs("div",{className:"space-y-4 w-[70%]",children:[u.jsxs(te,{onClick:s,className:"w-full bg-primary hover:bg-primary-80 text-white font-bold py-3 text-lg transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[u.jsx(Y.Play,{size:20}),"Start"]}),u.jsxs(te,{onClick:n,variant:"outline",className:"w-full border-secondary text-muted-foreground hover:bg-secondary hover:text-white font-bold py-3 text-lg transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[u.jsx(Y.Settings,{size:20}),"Innstillinger"]})]})]})},ri=()=>{const[r,e]=O.useState(3),{currentMap:t}=N();return O.useEffect(()=>{{const a=setInterval(()=>{e(i=>i>1?i-1:0)},1e3);return()=>clearInterval(a)}},[]),r===0?null:u.jsx("div",{className:"text-center",children:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-8xl font-bold text-primary",children:r}),u.jsxs("div",{className:"flex items-center justify-center gap-2",children:[u.jsx("div",{className:"w-2 h-2 bg-white rounded-full p-1 animate-pulse"}),u.jsx("p",{className:"text-2xl text-white uppercase italic",children:t?.name}),u.jsx("div",{className:"w-2 h-2 bg-white rounded-full p-1 animate-pulse"})]})]})})},si=()=>{const{score:r,lives:e,currentLevel:t,setState:a,setMenuType:i,isPaused:s,multiplier:n,multiplierScore:o}=N(),c=O.useRef(null),{isFullscreen:h,toggleFullscreen:m}=Fe(),g=()=>{s?a(C.PLAYING):(a(C.PAUSED),i(A.PAUSE))},p=()=>{const M=c.current?.closest("sigurd-startup");M?m(M):m()},y=Ca(o,n);return u.jsxs("div",{ref:c,className:"flex justify-between items-center w-full h-full",children:[u.jsx("div",{className:"absolute top-4 left-1/2 transform -translate-x-1/2 z-10 bg-background-80 text-foreground px-4 py-2 rounded-lg backdrop-blur-sm pointer-events-auto",children:u.jsxs("div",{className:"flex items-center gap-4 text-sm font-mono",children:[u.jsx("div",{className:"text-center",children:u.jsxs("div",{className:"text-primary font-bold flex items-center gap-1",children:[u.jsx(Y.CircleDollarSign,{size:16}),r.toLocaleString()]})}),u.jsx("div",{className:"w-px h-8 bg-border"}),u.jsx("div",{className:"text-center",children:u.jsxs("div",{className:"text-primary font-bold flex items-center gap-1",children:[u.jsx(Y.Map,{size:16}),t.toLocaleString()]})}),u.jsx("div",{className:"w-px h-8 bg-border"}),u.jsxs("div",{className:"min-w-20 flex justify-center border border-primary p-1 rounded-lg relative overflow-hidden",children:[u.jsx("div",{className:"absolute inset-0 bg-primary-20 transition-all duration-300 ease-out",style:{width:`${y*100}%`}}),u.jsxs("div",{className:"text-primary text-center font-bold flex items-center gap-1 relative z-10",children:[u.jsx(Y.Zap,{size:16}),"x",n]})]})]})}),u.jsxs("div",{className:"flex items-center space-x-4 absolute right-4 top-4",children:[u.jsx(Ze.TooltipProvider,{children:u.jsxs(et,{children:[u.jsx(tt,{asChild:!0,children:u.jsx(te,{onClick:g,variant:"outline",className:"bg-background-80 text-foreground backdrop-blur-sm border-none hover:bg-primary hover:text-black h-10 w-10",children:s?u.jsx(Y.Play,{className:"text-white hover:text-primary",size:24}):u.jsx(Y.Pause,{className:"text-foreground hover:text-primary",size:24})})}),u.jsx(Ye,{children:"Pause Spill (P)"})]})}),u.jsx(Ze.TooltipProvider,{children:u.jsxs(et,{children:[u.jsx(tt,{asChild:!0,children:u.jsx(te,{onClick:p,variant:"outline",className:"bg-background-80 text-foreground backdrop-blur-sm border-none hover:bg-primary hover:text-black h-10 w-10",children:h?u.jsx(Y.Minimize,{className:"text-foreground hover:text-primary",size:24}):u.jsx(Y.Maximize,{className:"text-foreground hover:text-primary",size:24})})}),u.jsx(Ye,{children:h?"Avslutt fullskjerm (F11 eller F)":"Fullskjerm (F11 eller F)"})]})})]}),u.jsx("div",{className:`absolute left-3 bottom-2 ${h?"bottom-4":"bottom-2"}`,children:u.jsxs("div",{className:"text-xl font-bold text-red-400 flex items-center gap-1",children:[Array.from({length:3}).map((M,T)=>u.jsx(Y.Heart,{color:"#ff3143",size:h?25:20,fill:T<e?"#ff3143":"none"},T)),e>3?u.jsxs("p",{children:["+ ",e-3]}):""]})})]})},ni=()=>{const{setState:r,setMenuType:e,resetGame:t}=N(),a=()=>{e(A.COUNTDOWN),r(C.COUNTDOWN),setTimeout(()=>{r(C.PLAYING)},3e3)},i=()=>{e(A.SETTINGS)},s=()=>{t(),r(C.MENU),e(A.START)},n=()=>{const{resetBombState:o,resetPlayer:c,resetEffects:h,clearAllFloatingTexts:m,currentMap:g}=N.getState();if(o(),c(),h(),m(),g){const{initializeLevel:p}=N.getState();p(g)}r(C.MENU),e(A.COUNTDOWN),r(C.COUNTDOWN),setTimeout(()=>{r(C.PLAYING)},3e3)};return u.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs(te,{onClick:a,className:"w-full bg-primary hover:bg-primary-80 text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[u.jsx(Y.Play,{size:20}),"Fortsett"]}),u.jsxs(te,{onClick:i,variant:"outline",className:"w-full border-secondary text-muted-foreground bg-secondary hover:text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[u.jsx(Y.Settings,{size:20}),"Innstillinger"]}),u.jsxs(te,{onClick:n,variant:"outline",className:"w-full border-secondary text-muted-foreground bg-secondary hover:text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[u.jsx(Y.RotateCcw,{size:20}),"Start på nytt"]}),u.jsxs(te,{onClick:s,variant:"default",className:"w-full bg-red-600 hover:bg-red-600/80 text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[u.jsx(Y.Home,{size:20}),"hovedmeny"]})]})})},oi=()=>{const{setMenuType:r,previousMenu:e}=N(),t=N(g=>g.audioSettings),a=N(g=>g.updateAudioSettings),{masterVolume:i,musicVolume:s,sfxVolume:n,masterMuted:o,musicMuted:c,sfxMuted:h}=t||{masterVolume:80,musicVolume:70,sfxVolume:90,masterMuted:!1,musicMuted:!1,sfxMuted:!1},m=()=>{r(e||A.START)};return u.jsxs("div",{className:"flex flex-col items-center justify-center h-full w-full",children:[u.jsxs("div",{className:"flex items-center mb-6 w-[70%] gap-2",children:[u.jsx(te,{onClick:m,variant:"default",className:"bg-primary hover:bg-primary/80 text-white w-10 h-10",children:u.jsx(Y.ArrowLeft,{size:25})}),u.jsx("h2",{className:"text-2xl font-bold text-white uppercase",children:"Innstillinger"})]}),u.jsxs("div",{className:"space-y-2 w-[70%]",children:[u.jsxs("div",{className:"p-3 bg-card rounded-md",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-muted-foreground",children:"Master volum"}),u.jsx("button",{onClick:()=>a({masterMuted:!o}),className:`px-3 py-1 rounded text-sm font-mono ${o?"bg-red-600 text-white":"bg-secondary text-white"}`,children:o?"Muted":`${i}%`})]}),u.jsx("input",{type:"range",min:"0",max:"100",value:o?0:i,onChange:g=>a({masterVolume:Number(g.target.value)}),className:"w-full accent-primary",disabled:o})]}),u.jsxs("div",{className:"p-3 bg-card rounded-md",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-muted-foreground",children:"Musikk volum"}),u.jsx("button",{onClick:()=>a({musicMuted:!c}),className:`px-3 py-1 rounded text-sm font-mono ${c?"bg-red-600 text-white":"bg-secondary text-white"}`,children:c?"Muted":`${s}%`})]}),u.jsx("input",{type:"range",min:"0",max:"100",value:c?0:s,onChange:g=>a({musicVolume:Number(g.target.value)}),className:"w-full accent-primary",disabled:c})]}),u.jsxs("div",{className:"p-3 bg-card rounded-md",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-muted-foreground",children:"Lyd effekter"}),u.jsx("button",{onClick:()=>a({sfxMuted:!h}),className:`px-3 py-1 rounded text-sm font-mono ${h?"bg-red-600 text-white":"bg-secondary text-white"}`,children:h?"Muted":`${n}%`})]}),u.jsx("input",{type:"range",min:"0",max:"100",value:h?0:n,onChange:g=>a({sfxVolume:Number(g.target.value)}),className:"w-full accent-primary",disabled:h})]}),u.jsx("div",{className:"text-center text-sm text-gray-400",children:u.jsx("p",{children:"(Trykk på tallene for å mute lyd)"})})]})]})},li=(r,e={})=>{const{duration:t=3e3,steps:a=60,easing:i="ease-out",delay:s=0,onComplete:n}=e,[o,c]=O.useState(0),h=O.useRef(!1),m=O.useRef(r);return O.useEffect(()=>{if(r===0){c(0),h.current=!1;return}if(m.current!==r&&(h.current=!1,c(0),m.current=r),h.current){c(r);return}const g=setTimeout(()=>{const p=t/a;let y=0;const M=setInterval(()=>{y++;const T=y/a;let R;switch(i){case"linear":R=T;break;case"ease-out":R=1-(1-T)*(1-T);break;case"gentle-ease-out":R=1-Math.pow(1-T,1.5);break;case"ease-in":R=T*T;break;case"ease-in-out":R=T<.5?2*T*T:1-Math.pow(-2*T+2,2)/2;break;default:R=1-(1-T)*(1-T)}const G=r*R,L=Math.round(G);c(L),y>=a&&(c(r),h.current=!0,clearInterval(M),n&&n())},p);return()=>clearInterval(M)},s);return()=>clearTimeout(g)},[r,t,a,i,s,n]),o},ci=()=>{const{correctOrderCount:r,currentMap:e,currentLevel:t,nextLevel:a,setState:i,setMenuType:s,initializeLevel:n,setBonusAnimationComplete:o}=N(),c=d.BONUS_POINTS[r]||5e4,h=li(c,{duration:6e3,steps:120,easing:"gentle-ease-out",delay:200,onComplete:()=>o(!0)});return u.jsxs("div",{className:"text-center max-w-md",children:[u.jsxs("h1",{className:"text-4xl font-bold text-primary mb-4 uppercase",children:[e?.name," Fullført!"]}),u.jsx("div",{className:"text-white mb-6 space-y-4",children:c>0&&u.jsxs("div",{className:"flex flex-col items-center justify-center gap-5",children:[u.jsxs("div",{className:"text-2xl",children:["Bra jobba! Du samlet"," ",u.jsx("span",{className:"font-bold text-primary animate-pulse",children:r})," ","av 23 finansiering og unngikk byrokratet!"," "]}),u.jsxs("div",{className:"text-4xl font-bold animate-pulse",children:[h.toLocaleString()," kr"]}),u.jsx("div",{className:"text-sm text-gray-400 mt-2",children:Ce.length>t?`Fortsetter til ${Ce[t]?.name||"Neste nivå"}...`:""})]})})]})},di=()=>{const{score:r,resetGame:e}=N(),t=()=>{e()};return u.jsxs("div",{className:"text-center max-w-md flex flex-col items-center justify-center gap-4",children:[u.jsx("h1",{className:"text-2xl font-bold uppercase",children:"slutt"}),u.jsxs("div",{className:"text-white mb-6 space-y-4",children:[u.jsx("div",{className:"text-2xl text-primary",children:"Du har klart det umulige!"}),u.jsx("div",{className:"text-lg",children:"Du hjalp Sigurd med å unngå byrokratiske hindringer og samle finansiering."}),u.jsxs("div",{className:"text-2xl flex flex-col items-center justify-center gap-2",children:[u.jsx("div",{className:"text-foreground",children:"Total finansiering samlet:"}),u.jsx("div",{className:"font-bold text-3xl text-primary",children:r.toLocaleString()})]})]}),u.jsx("div",{className:"flex items-center justify-center gap-2",children:u.jsx("button",{onClick:t,className:"bg-primary text-white font-bold hover:bg-primary/80 rounded-lg py-1 px-3 text-lg transition-all duration-200 transform hover:scale-105 flex items-center justify-center gap-2",children:u.jsx(Y.Home,{className:"w-7 h-7",strokeWidth:2})})})]})},ui=()=>{const{score:r,resetGame:e,levelHistory:t}=N(),a=()=>{e()};return u.jsxs("div",{className:"bg-gradient-to-b rounded-lg text-center max-w-md",children:[u.jsx("h1",{className:"text-4xl font-bold text-red-400 mb-4 uppercase",children:"konkurs"}),u.jsxs("div",{className:"text-white mb-6 space-y-3",children:[u.jsx("div",{className:"text-2xl",children:u.jsxs("span",{className:"text-yellow-400",children:["Total finansiering:"," ",u.jsxs("span",{className:"font-bold text-white",children:[r.toLocaleString()," kr"]})]})}),t.length>0&&u.jsx("div",{className:"mt-6 border-t border-gray-600 pt-4",children:u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-sm",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"border-b border-gray-600",children:[u.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Bane"}),u.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Mynter"}),u.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Finansiering"}),u.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Bonus"})]})}),u.jsx("tbody",{children:t.map((i,s)=>u.jsxs("tr",{className:"border-b border-gray-700/50",children:[u.jsxs("td",{className:"py-2 px-2 text-gray-300",children:[i.level," (",i.mapName,")"]}),u.jsx("td",{className:"py-2 px-2 text-gray-300",children:i.coinsCollected}),u.jsx("td",{className:"py-2 px-2 text-gray-300",children:i.score.toLocaleString()}),u.jsx("td",{className:"py-2 px-2",children:i.bonus>0?u.jsxs("span",{className:"text-yellow-400 font-semibold",children:[i.bonus.toLocaleString()," kr"]}):u.jsx("span",{className:"text-gray-500",children:"-"})})]},s))})]})})})]}),u.jsx(te,{onClick:a,className:"bg-primary hover:bg-primary/80 text-white font-bold py-3 px-8 text-lg transition-all duration-200 transform hover:scale-105 uppercase",children:"prøv igjen"})]})},hi=()=>{const{setMenuType:r,previousMenu:e}=N(),t=N(g=>g.audioSettings),a=N(g=>g.updateAudioSettings),{masterVolume:i,musicVolume:s,sfxVolume:n,masterMuted:o,musicMuted:c,sfxMuted:h}=t||{masterVolume:80,musicVolume:70,sfxVolume:90,masterMuted:!1,musicMuted:!1,sfxMuted:!1},m=()=>{r(e||A.START)};return u.jsx("div",{className:"flex items-center justify-center h-full",children:u.jsxs("div",{className:"bg-card backdrop-blur-sm rounded-xl p-6 border border-secondary max-w-md w-full",children:[u.jsxs("div",{className:"flex items-center mb-6 gap-2",children:[u.jsx(te,{onClick:m,variant:"ghost",className:"text-muted-foreground hover:text-white p-1",children:u.jsx(Y.ArrowLeft,{size:20})}),u.jsx("h2",{className:"text-xl font-bold text-primary",children:"Lydinnstillinger"})]}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-muted-foreground",children:"Master Volume"}),u.jsx("button",{onClick:()=>a({masterMuted:!o}),className:`px-3 py-1 rounded text-sm font-mono ${o?"bg-red-600 text-white":"bg-secondary text-white"}`,children:o?"Muted":`${i}%`})]}),u.jsx("input",{type:"range",min:"0",max:"100",value:o?0:i,onChange:g=>a({masterVolume:Number(g.target.value)}),className:"w-full accent-primary",disabled:o})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-muted-foreground",children:"Music Volume"}),u.jsx("button",{onClick:()=>a({musicMuted:!c}),className:`px-3 py-1 rounded text-sm font-mono ${c?"bg-red-600 text-white":"bg-secondary text-white"}`,children:c?"Muted":`${s}%`})]}),u.jsx("input",{type:"range",min:"0",max:"100",value:c?0:s,onChange:g=>a({musicVolume:Number(g.target.value)}),className:"w-full accent-primary",disabled:c})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("span",{className:"text-muted-foreground",children:"Sound Effects"}),u.jsx("button",{onClick:()=>a({sfxMuted:!h}),className:`px-3 py-1 rounded text-sm font-mono ${h?"bg-red-600 text-white":"bg-secondary text-white"}`,children:h?"Muted":`${n}%`})]}),u.jsx("input",{type:"range",min:"0",max:"100",value:h?0:n,onChange:g=>a({sfxVolume:Number(g.target.value)}),className:"w-full accent-primary",disabled:h})]})]})]})})},re=({children:r,transparent:e})=>u.jsx("div",{className:`absolute inset-0 flex items-center justify-center z-50 rounded-lg ${e?"bg-transparent":"bg-menu backdrop-blur-sm"}`,children:r}),pi=r=>{const{currentState:e,setState:t,setMenuType:a,isPaused:i}=N();O.useEffect(()=>{const s=n=>{if(!(n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement))switch(n.key){case"F11":case"f":n.preventDefault(),r?.();break;case"Escape":document.fullscreenElement||document.webkitFullscreenElement?(n.preventDefault(),r?.()):e===C.PLAYING&&(n.preventDefault(),i?t(C.PLAYING):(t(C.PAUSED),a(A.PAUSE)));break;case"p":case"P":e===C.PLAYING&&(n.preventDefault(),i?t(C.PLAYING):(t(C.PAUSED),a(A.PAUSE)));break;case" ":e===C.PAUSED&&(n.preventDefault(),a(A.COUNTDOWN),t(C.COUNTDOWN),setTimeout(()=>{t(C.PLAYING)},3e3));break}};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[e,i,t,a,r])},fi=()=>{const[r,e]=O.useState(!0);return O.useEffect(()=>{Et.preloadAllBackgrounds().then(()=>{v.flow("All background images preloaded"),e(!1)}).catch(t=>{v.warn("Failed to preload some background images"),e(!1)})},[]),{isPreloading:r}},se={major:2,minor:2,patch:2,build:0,timestamp:1754650011612,hash:"86ANDO",full:"2.2.2"},at=se.full,pe=()=>({version:at,major:se.major,minor:se.minor,patch:se.patch,build:se.build,timestamp:se.timestamp,hash:se.hash}),Nt=()=>{console.log(`🎮 Sigurd Startup Game v${at} (Build ${se.build})`),console.log(`📦 Hash: ${se.hash}`),console.log(`⏰ Built: ${new Date(se.timestamp).toISOString()}`)},gi=()=>{const{currentState:r,showMenu:e}=N(),t=O.useRef(null),{toggleFullscreen:a}=Fe(),{isFullscreen:i}=Fe(),{isPreloading:s}=fi();return pi(()=>{const o=t.current?.closest("sigurd-startup");o?a(o):a()}),u.jsxs("div",{ref:t,className:"relative rounded-lg",children:[u.jsx(ei,{}),s&&u.jsx(re,{children:u.jsxs("div",{className:"text-white text-center",children:[u.jsx("div",{className:"text-lg font-bold mb-2",children:"Loading Backgrounds..."}),u.jsx("div",{className:"text-sm text-gray-300",children:"Please wait while we prepare your game"})]})}),q.ENABLED,u.jsxs("div",{className:`absolute bottom-3 right-3 ${i?"text-md":"text-xs"} text-muted-foreground z-40 ${i?"bottom-4":"bottom-3"}`,children:["v",at," (Build ",pe().build,")"]}),!s&&u.jsxs(u.Fragment,{children:[e===A.START&&u.jsx(re,{children:u.jsx(ii,{})}),e===A.COUNTDOWN&&u.jsx(re,{children:u.jsx(ri,{})}),e===A.PAUSE&&u.jsx(re,{children:u.jsx(ni,{})}),e===A.SETTINGS&&u.jsx(re,{children:u.jsx(oi,{})}),r===C.PLAYING&&u.jsx(re,{transparent:!0,children:u.jsx(si,{})}),e===A.BONUS&&u.jsx(re,{children:u.jsx(ci,{})}),e===A.VICTORY&&u.jsx(re,{children:u.jsx(di,{})}),e===A.GAME_OVER&&u.jsx(re,{children:u.jsx(ui,{})}),e===A.AUDIO_SETTINGS&&u.jsx(re,{children:u.jsx(hi,{})})]})]})},mi='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: #302e2b;--foreground: #ffffff;--card: #262521;--card-foreground: #ffffff;--popover: #262521;--popover-foreground: #ffffff;--primary: #81b64c;--primary-light: #94cc5b;--primary-dark: #6ca039;--primary-opacity-hover: #8bc2546f;--primary-foreground: #ffffff;--secondary: #484744;--secondary-light: #5a5956;--secondary-dark: #3a3936;--secondary-foreground: #ffffff;--muted: #343434;--muted-foreground: #cbcbca;--accent: #81b64c;--accent-foreground: #ffffff;--destructive: #ef4444;--destructive-foreground: #ffffff;--border: #484744;--input: #484744;--ring: #81b64c;--radius: .5rem;--menu-background: #262521c6;--sidebar-background: #262521;--sidebar-foreground: #ffffff;--sidebar-primary: #81b64c;--sidebar-primary-foreground: #ffffff;--sidebar-accent: #484744;--sidebar-accent-foreground: #ffffff;--sidebar-border: #484744;--sidebar-ring: #81b64c;--gradient-primary: linear-gradient(135deg, #94cc5b 0%, #436324 100%);--gradient-primary-hover: linear-gradient(135deg, #8bc254 0%, #7aa847 100%);--gradient-primary-subtle: linear-gradient( 135deg, #81b64c 0%, #7aa847 100% );--gradient-primary-radial: radial-gradient( circle at center, #81b64c 0%, #6a9a3d 100% )}.dark{--background: #302e2b;--foreground: #ffffff;--card: #262521;--card-foreground: #ffffff;--popover: #262521;--popover-foreground: #ffffff;--primary: #81b64c;--primary-light: #94cc5b;--primary-dark: #436324;--primary-opacity-hover: #8bc2546f;--primary-foreground: #ffffff;--secondary: #484744;--secondary-foreground: #ffffff;--muted: #262521;--muted-foreground: #cbcbca;--accent: #81b64c;--accent-foreground: #ffffff;--destructive: #dc2626;--destructive-foreground: #ffffff;--border: #484744;--input: #484744;--ring: #81b64c;--sidebar-background: #262521;--sidebar-foreground: #ffffff;--sidebar-primary: #81b64c;--sidebar-primary-foreground: #ffffff;--sidebar-accent: #484744;--sidebar-accent-foreground: #ffffff;--sidebar-border: #484744;--sidebar-ring: #81b64c;--gradient-primary: linear-gradient(135deg, #81b64c 0%, #6a9a3d 100%);--gradient-primary-hover: linear-gradient(135deg, #8bc254 0%, #7aa847 100%);--gradient-primary-subtle: linear-gradient( 135deg, #81b64c 0%, #7aa847 100% );--gradient-primary-radial: radial-gradient( circle at center, #81b64c 0%, #6a9a3d 100% )}*{border-color:var(--border)}body{background-color:var(--background);color:var(--foreground)}:fullscreen{background:var(--background)}:-webkit-full-screen{background:var(--background)}:-moz-full-screen{background:var(--background)}:-ms-fullscreen{background:var(--background)}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.bottom-2{bottom:.5rem}.bottom-3{bottom:.75rem}.bottom-4{bottom:1rem}.left-1{left:.25rem}.left-1\\/2{left:50%}.left-3{left:.75rem}.right-3{right:.75rem}.right-4{right:1rem}.top-1{top:.25rem}.top-4{top:1rem}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.float-right{float:right}.float-left{float:left}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mt-2{margin-top:.5rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-2{height:.5rem}.h-4{height:1rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-2{width:.5rem}.w-4{width:1rem}.w-7{width:1.75rem}.w-\\[70\\%\\]{width:70%}.w-full{width:100%}.w-px{width:1px}.min-w-20{min-width:5rem}.max-w-md{max-width:28rem}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.border-gray-700\\/50{border-color:#37415180}.border-input{border-color:var(--input)}.bg-background{background-color:var(--background)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-destructive{background-color:var(--destructive)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-menu{background-color:var(--menu-background)}.bg-popover{background-color:var(--popover)}.bg-primary{background-color:var(--primary)}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:JetBrains Mono,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-8xl{font-size:6rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-destructive-foreground{color:var(--destructive-foreground)}.text-foreground{color:var(--foreground)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:var(--popover-foreground)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:var(--secondary-foreground)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:var(--primary)}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\\/10{--tw-shadow-color: rgb(0 0 0 / .1);--tw-shadow: var(--tw-shadow-colored)}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: var(--background)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in{animation-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.running{animation-play-state:running}.paused{animation-play-state:paused}.bg-background-80{background-color:#302e2bcc}.bg-primary-20{background-color:#81b64c33}.text-muted-foreground{color:var(--muted-foreground)}.text-primary{color:var(--primary)}.border-primary{border-color:var(--primary)}.border-secondary{border-color:var(--secondary)}.hover\\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-primary:hover{background-color:var(--primary)}.hover\\:bg-red-600\\/80:hover{background-color:#dc2626cc}.hover\\:bg-secondary:hover{background-color:var(--secondary)}.hover\\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\\:text-black:hover{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.hover\\:text-blue-700:hover{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.hover\\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:bg-primary-80:hover{background-color:#81b64ccc}.hover\\:text-primary:hover{color:var(--primary)}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color: var(--ring)}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:opacity-50:disabled{opacity:.5}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:size-4 svg{width:1rem;height:1rem}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}';class bi extends HTMLElement{constructor(){super(...arguments);b(this,"root",null)}connectedCallback(){const t=this.attachShadow({mode:"open"}),a=document.createElement("div");t.appendChild(a);const i=document.createElement("style");i.textContent=mi,t.appendChild(i),this.root=Oe.createRoot(a),this.root.render(u.jsx(gi,{})),Nt(),this.setAttribute("data-version",pe().version),this.setAttribute("data-build",pe().build.toString())}disconnectedCallback(){this.root&&(this.root.unmount(),this.root=null)}getVersion(){return pe()}isCompatible(t){const a=pe(),[i,s,n]=a.version.split(".").map(Number),[o,c,h]=t.split(".").map(Number);return i>o?!0:i<o?!1:s>c?!0:s<c?!1:n>=h}}customElements.define("sigurd-startup",bi);const wi={getVersion:pe,ASSET_PATHS:ue,getBackgroundImagePath:yt};j.ASSET_PATHS=ue,j.default=wi,j.getBackgroundImagePath=yt,j.getVersion=pe,j.logVersion=Nt,Object.defineProperties(j,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
31
+ //# sourceMappingURL=sigurd-startup.umd.js.map