@puzzmo/sdk 1.0.72 → 1.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{createSimulator-C3cLppcW.cjs → createSimulator-Bb1LTB5P.cjs} +47 -47
- package/dist/{createSimulator-C3cLppcW.cjs.map → createSimulator-Bb1LTB5P.cjs.map} +1 -1
- package/dist/{createSimulator-C5RgI7Gg.js → createSimulator-CYo2KWWM.js} +425 -420
- package/dist/{createSimulator-C5RgI7Gg.js.map → createSimulator-CYo2KWWM.js.map} +1 -1
- package/dist/simulator/index.cjs +1 -1
- package/dist/simulator/index.js +1 -1
- package/dist/simulator/standalone.cjs +1 -1
- package/dist/simulator/standalone.js +1 -1
- package/dist/simulator/views/ThumbView.d.ts.map +1 -1
- package/dist/thumbnailMotion.cjs +5 -0
- package/dist/thumbnailMotion.cjs.map +1 -0
- package/dist/thumbnailMotion.d.ts +119 -0
- package/dist/thumbnailMotion.d.ts.map +1 -0
- package/dist/thumbnailMotion.js +480 -0
- package/dist/thumbnailMotion.js.map +1 -0
- package/dist/thumbnailMotion.spec.d.ts +2 -0
- package/dist/thumbnailMotion.spec.d.ts.map +1 -0
- package/package.json +6 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`),n=require(`./asyncToGenerator-Tjg_Hpik.cjs`),r=[{name:`Puzzmo (light)`,type:`light`,key:`#FFAAAC`,keyFG:`#000000`,keyStrong:`#F7868B`,keyLight:`#FFD2D3`,g_key:`#FFAAAC`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#98B389`,alt2:`#FAC16C`,alt3:`#D298FF`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#1B1D29`,alwaysLight:`#FFFFFF`,g_bg:`#FFFFFF`,g_bgAlt:`#EBEBEB`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#F2F2F2`,a_bgAlt:`#ECECEC`,a_puzmo:`#FFC000`,a_headerText:`#000000`,a_table:`#F9F9F9`,a_tableAlt:`#F6F4F4`,a_inlineTag:`#D9D9D9`,a_anchor:`#1F97EE`,a_infoBG:`#FFFFFF`},{name:`Puzzmo (dark)`,type:`dark`,key:`#FFAAAC`,keyFG:`#000000`,keyStrong:`#F7868B`,keyLight:`#FFD2D3`,g_key:`#FFAAAC`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,subBrand:`#FFC000`,subBrandFG:`#000000`,alt1:`#98B389`,alt2:`#FAC16C`,alt3:`#D298FF`,error:`#FF3C3C`,fg:`#ECECEC`,alwaysDark:`#1B1D29`,alwaysLight:`#FFFFFF`,g_bg:`#374351`,g_bgAlt:`#333D49`,g_bgDark:`#2C2F33`,g_textDark:`#F2F2F2`,g_textLight:`#20180E`,g_blank:`#000000`,g_unsolved:`#747474`,g_outline:`#646464`,a_bg:`#141620`,a_bgAlt:`#202433`,a_puzmo:`#FFC000`,a_headerText:`#A1BAD4`,a_table:`#303246`,a_tableAlt:`#393b52`,a_inlineTag:`#ECECEC`,a_anchor:`#1F97EE`,a_infoBG:`#282C3A`},{name:`Foshay`,type:`light`,key:`#98B389`,keyFG:`#313540`,keyStrong:`#87BD69`,keyLight:`#809B77`,g_key:`#98B389`,player:`#3EC0E5`,subBrand:`#FFC000`,subBrandFG:`#000000`,playerFG:`#292B35`,playerLight:`#A8B5D6`,alt1:`#D87DA4`,alt2:`#E3A54F`,alt3:`#D298FF`,error:`#FF3C3C`,fg:`#292B35`,alwaysDark:`#292B35`,alwaysLight:`#D1DBF2`,g_bg:`#949EBA`,g_bgAlt:`#8891AB`,g_bgDark:`#7B839B`,g_textDark:`#292B35`,g_textLight:`#FFFFFF`,g_blank:`#292B35`,g_unsolved:`#B6B7BA`,g_outline:`#676F83`,a_bg:`#828CA3`,a_bgAlt:`#7F889F`,a_puzmo:`#FFC000`,a_headerText:`#292B35`,a_table:`#7A8399`,a_tableAlt:`#767E94`,a_inlineTag:`#ECECEC`,a_anchor:`#56C9E9`,a_infoBG:`#767F95`},{name:`Bright white`,type:`light`,key:`#67ced2`,keyFG:`#000000`,keyStrong:`#26a0a5`,keyLight:`#ade6e9`,g_key:`#67ced2`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#d26767`,alt2:`#fac16c`,alt3:`#7580bd`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#111111`,alwaysLight:`#FFFFFF`,g_bg:`#f6f6f6`,g_bgAlt:`#F4F4F4`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#FFFFFF`,a_bgAlt:`#f8fbfc`,a_puzmo:`#FFC000`,a_headerText:`#000000`,a_table:`#EDEDED`,a_tableAlt:`#DBDBDB`,a_inlineTag:`#D9D9D9`,a_anchor:`#1F97EE`,a_infoBG:`#f6f6f6`},{name:`Submersible`,type:`dark`,key:`#CD6DC6`,keyFG:`#031698`,keyStrong:`#FF7ABC`,keyLight:`#B467CB`,g_key:`#CD6DC6`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#4AB1D1`,playerFG:`#071D47`,playerLight:`#3C99D7`,alt1:`#8BA964`,alt2:`#C69A58`,alt3:`#7644B5`,fg:`#FFEBFF`,error:`#FF3C3C`,alwaysDark:`#031698`,alwaysLight:`#FFEBFF`,g_bg:`#043BED`,g_bgAlt:`#0A31CC`,g_bgDark:`#0E2DA8`,g_textDark:`#031698`,g_textLight:`#FFEBFF`,g_blank:`#031698`,g_unsolved:`#3662F1`,g_outline:`#031698`,a_bg:`#043BED`,a_bgAlt:`#0A31CC`,a_puzmo:`#FFC000`,a_headerText:`#FFEBFF`,a_table:`#043BED`,a_tableAlt:`#0A31CC`,a_inlineTag:`#FF7ABC`,a_anchor:`#FF7ABC`,a_infoBG:`#0A31CC`},{name:`Hot Dog (beta)`,type:`light`,key:`#FFFF00`,keyFG:`#000000`,keyStrong:`#FFE600`,keyLight:`#FFEC44`,g_key:`#FFFF00`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#FF7A00`,playerFG:`#000000`,playerLight:`#FFA450`,alt1:`#3ABC5E`,alt2:`#5C3ABC`,alt3:`#BC3AAF`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#1B1D29`,alwaysLight:`#FFFFFF`,g_bg:`#EBFF00`,g_bgAlt:`#EBEBEB`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#FF0000`,a_bgAlt:`#E50000`,a_puzmo:`#FFC000`,a_headerText:`#FFFFFF`,a_table:`#E50000`,a_tableAlt:`#FF2525`,a_inlineTag:`#000000`,a_anchor:`#000000`,a_infoBG:`#C6C6C6`},{name:`Outlook Hayesy`,type:`light`,key:`#DAB98C`,keyFG:`#000000`,keyStrong:`#B99368`,keyLight:`#DAB98C`,subBrand:`#FFC000`,subBrandFG:`#000000`,g_key:`#DAB98C`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#5EC386`,alt2:`#5E93C3`,alt3:`#C35E5E`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#5E390F`,alwaysLight:`#FFF3E4`,g_bg:`#FFFFFF`,g_bgAlt:`#EBEBEB`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#FEF5E8`,a_bgAlt:`#ffffff`,a_puzmo:`#FAC7CE`,a_headerText:`#000000`,a_table:`#FAE8D3`,a_tableAlt:`#EED7BC`,a_inlineTag:`#D9D9D9`,a_anchor:`#B99368`,a_infoBG:`#FFFFFF`},{name:`Console (beta)`,type:`dark`,key:`#957df9`,keyFG:`#000000`,keyStrong:`#590FF5`,keyLight:`#590FF5`,subBrand:`#FFC000`,subBrandFG:`#000000`,g_key:`#FFFF00`,player:`#ffffff`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#590ff5`,alt2:`#00e200`,alt3:`#ff8a02`,fg:`#00e200`,error:`#FF3C3C`,alwaysDark:`#1B1D29`,alwaysLight:`#00e200`,g_bg:`#101428`,g_bgAlt:`#101428`,g_bgDark:`#00e200`,g_textDark:`#00e200`,g_textLight:`#590ff5`,g_blank:`#00e200`,g_unsolved:`#0000ff`,g_outline:`#00e200`,a_bg:`#000000`,a_bgAlt:`#112211`,a_puzmo:`#ffffff`,a_headerText:`#00e200`,a_table:`#000000`,a_tableAlt:`#002200`,a_inlineTag:`#D9D9D9`,a_anchor:`#957df9`,a_infoBG:`#001900`}];var i={collapsed:`simulator-collapsed`,tab:`simulator-tab`,theme:`simulator-theme`,fixtureCategory:`simulator-fixture-category`,fixturePuzzle:`simulator-fixture-puzzle`,renderHost:`simulator-render-host`,renderContext:`simulator-render-context`,previewKind:`simulator-preview-kind`,gameSettings:`simulator-game-settings`,hostContext:`simulator-host-context`,keyboardDocked:`simulator-keyboard-docked`},a=`simulator-override:`;function o(e){return`${a}${e}:${(window.location.pathname||`/`).replace(/\/index\.html$/,``).replace(/\/+$/,``)||`/`}`}function s(e){try{return localStorage.getItem(o(e))}catch(e){return null}}function c(e,t){try{return localStorage.setItem(o(e),t),!0}catch(e){return!1}}function l(e){try{localStorage.removeItem(o(e))}catch(e){}}function u(){l(`puzzle`),l(`input`)}function d(){let e=localStorage.getItem(i.hostContext);if(!e)return null;try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch(e){}return null}function f(e){localStorage.setItem(i.hostContext,JSON.stringify(e))}function p(){localStorage.removeItem(i.hostContext)}function m(){return localStorage.getItem(i.keyboardDocked)===`true`}function h(e){localStorage.setItem(i.keyboardDocked,String(e))}function g(){let e=localStorage.getItem(i.gameSettings);if(!e)return{};try{let t=JSON.parse(e);if(t&&typeof t==`object`)return t}catch(e){}return{}}function _(){let e=localStorage.getItem(i.theme);if(e){let t=r.find(t=>t.name===e);if(t)return t}return r[0]}function v(e){var t;let n=localStorage.getItem(i.tab);return n&&e.includes(n)?n:(t=e[0])==null?`ctrl`:t}function y(e){let t=localStorage.getItem(i.collapsed);return t===null?e:t===`true`}function b(){let e=localStorage.getItem(i.renderHost);return e&&[`game`,`app`,`opengraph`].includes(e)?e:`game`}function x(){return localStorage.getItem(i.previewKind)===`text`?`text`:`image`}function S(){let e=localStorage.getItem(i.renderContext);if(e&&[`preview`,`share`,`completed`,`timeline`].includes(e))return e}function ee(e,t,n){var r,a,o;let c=localStorage.getItem(i.fixtureCategory),l=localStorage.getItem(i.fixturePuzzle),u=d(),f=s(`puzzle`),p=s(`input`);return{hostContext:(r=u==null?e.hostContext:u)==null?[{type:`app`,layout:`desktop`,host:null}]:r,hostContextIsOverridden:u!==null,isCollapsed:y((a=e.collapsed)==null?!0:a),isPaused:!1,hasStarted:!1,activeTab:v(n),puzzleData:f,originalPuzzle:f==null?``:f,currentInputStr:p==null?``:p,userStorage:null,appliedPuzzleOverride:f,appliedInputOverride:p,completionData:null,selectedTheme:_(),selectedCategory:c&&t.includes(c)?c:(o=t[0])==null?null:o,selectedPuzzle:l==null?null:l,renderHost:b(),renderContext:S(),previewKind:x(),gameSettings:g(),keyboardDocked:m(),settingsComponents:null}}function C(e){localStorage.setItem(i.gameSettings,JSON.stringify(e))}function w(){localStorage.removeItem(i.gameSettings)}function te(e){localStorage.setItem(i.collapsed,String(e))}function ne(e){localStorage.setItem(i.tab,e)}function T(e){localStorage.setItem(i.theme,e)}function E(e){localStorage.setItem(i.fixtureCategory,e)}function D(e){localStorage.setItem(i.fixturePuzzle,e)}function O(){localStorage.removeItem(i.fixturePuzzle)}function k(e){e?localStorage.setItem(i.renderHost,e):localStorage.removeItem(i.renderHost)}function A(e){localStorage.setItem(i.previewKind,e)}function j(e){e?localStorage.setItem(i.renderContext,e):localStorage.removeItem(i.renderContext)}function re(e){let t=[];return{log(n,r,i){let a={type:n,data:r,time:new Date().toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),direction:i};t.push(a),t.length>100&&t.shift(),e==null||e(a)},clear(){t.length=0},getLog(){return t}}}function M(e,t,n){console.log(`Simulator sending:`,e,t),n==null||n.log(e,t,`out`),window.postMessage({type:e,data:t},`*`)}function N(e,t){let n=n=>{var r,i,a;if(!(!(n==null||(r=n.data)==null)&&r.type))return;let o=n.data.type,s=(i=(a=n.data.data)==null?n.data.json:a)==null?{}:i;[`TIMER_TICK`,`TIMER_SYNC`].includes(o)||t==null||t.log(o,s,`in`),e(o,s)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function ie(e){let t=new Map;console.log(`Simulator: Parsing fixtures`,Object.keys(e));for(let[o,s]of Object.entries(e)){var n,r,i,a;let e=o.split(`/`),c=(n=(r=e.pop())==null?void 0:r.replace(/\.[^.]+$/,``))==null?``:n,l=(i=e.pop())==null?`default`:i;t.has(l)||t.set(l,new Map);let u=(a=s.default)==null?s:a;t.get(l).set(c,u)}return t.forEach((e,n)=>{let r=new Map(Array.from(e.entries()).sort((e,t)=>{var n,r,i,a;return parseInt((n=(r=e[0].match(/\d+/))==null?void 0:r[0])==null?`0`:n)-parseInt((i=(a=t[0].match(/\d+/))==null?void 0:a[0])==null?`0`:i)}));t.set(n,r)}),t}function P(e,t){return e.length===0?``:`
|
|
1
|
+
const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`),n=require(`./asyncToGenerator-Tjg_Hpik.cjs`),r=require(`./thumbnailMotion.cjs`),i=[{name:`Puzzmo (light)`,type:`light`,key:`#FFAAAC`,keyFG:`#000000`,keyStrong:`#F7868B`,keyLight:`#FFD2D3`,g_key:`#FFAAAC`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#98B389`,alt2:`#FAC16C`,alt3:`#D298FF`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#1B1D29`,alwaysLight:`#FFFFFF`,g_bg:`#FFFFFF`,g_bgAlt:`#EBEBEB`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#F2F2F2`,a_bgAlt:`#ECECEC`,a_puzmo:`#FFC000`,a_headerText:`#000000`,a_table:`#F9F9F9`,a_tableAlt:`#F6F4F4`,a_inlineTag:`#D9D9D9`,a_anchor:`#1F97EE`,a_infoBG:`#FFFFFF`},{name:`Puzzmo (dark)`,type:`dark`,key:`#FFAAAC`,keyFG:`#000000`,keyStrong:`#F7868B`,keyLight:`#FFD2D3`,g_key:`#FFAAAC`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,subBrand:`#FFC000`,subBrandFG:`#000000`,alt1:`#98B389`,alt2:`#FAC16C`,alt3:`#D298FF`,error:`#FF3C3C`,fg:`#ECECEC`,alwaysDark:`#1B1D29`,alwaysLight:`#FFFFFF`,g_bg:`#374351`,g_bgAlt:`#333D49`,g_bgDark:`#2C2F33`,g_textDark:`#F2F2F2`,g_textLight:`#20180E`,g_blank:`#000000`,g_unsolved:`#747474`,g_outline:`#646464`,a_bg:`#141620`,a_bgAlt:`#202433`,a_puzmo:`#FFC000`,a_headerText:`#A1BAD4`,a_table:`#303246`,a_tableAlt:`#393b52`,a_inlineTag:`#ECECEC`,a_anchor:`#1F97EE`,a_infoBG:`#282C3A`},{name:`Foshay`,type:`light`,key:`#98B389`,keyFG:`#313540`,keyStrong:`#87BD69`,keyLight:`#809B77`,g_key:`#98B389`,player:`#3EC0E5`,subBrand:`#FFC000`,subBrandFG:`#000000`,playerFG:`#292B35`,playerLight:`#A8B5D6`,alt1:`#D87DA4`,alt2:`#E3A54F`,alt3:`#D298FF`,error:`#FF3C3C`,fg:`#292B35`,alwaysDark:`#292B35`,alwaysLight:`#D1DBF2`,g_bg:`#949EBA`,g_bgAlt:`#8891AB`,g_bgDark:`#7B839B`,g_textDark:`#292B35`,g_textLight:`#FFFFFF`,g_blank:`#292B35`,g_unsolved:`#B6B7BA`,g_outline:`#676F83`,a_bg:`#828CA3`,a_bgAlt:`#7F889F`,a_puzmo:`#FFC000`,a_headerText:`#292B35`,a_table:`#7A8399`,a_tableAlt:`#767E94`,a_inlineTag:`#ECECEC`,a_anchor:`#56C9E9`,a_infoBG:`#767F95`},{name:`Bright white`,type:`light`,key:`#67ced2`,keyFG:`#000000`,keyStrong:`#26a0a5`,keyLight:`#ade6e9`,g_key:`#67ced2`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#d26767`,alt2:`#fac16c`,alt3:`#7580bd`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#111111`,alwaysLight:`#FFFFFF`,g_bg:`#f6f6f6`,g_bgAlt:`#F4F4F4`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#FFFFFF`,a_bgAlt:`#f8fbfc`,a_puzmo:`#FFC000`,a_headerText:`#000000`,a_table:`#EDEDED`,a_tableAlt:`#DBDBDB`,a_inlineTag:`#D9D9D9`,a_anchor:`#1F97EE`,a_infoBG:`#f6f6f6`},{name:`Submersible`,type:`dark`,key:`#CD6DC6`,keyFG:`#031698`,keyStrong:`#FF7ABC`,keyLight:`#B467CB`,g_key:`#CD6DC6`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#4AB1D1`,playerFG:`#071D47`,playerLight:`#3C99D7`,alt1:`#8BA964`,alt2:`#C69A58`,alt3:`#7644B5`,fg:`#FFEBFF`,error:`#FF3C3C`,alwaysDark:`#031698`,alwaysLight:`#FFEBFF`,g_bg:`#043BED`,g_bgAlt:`#0A31CC`,g_bgDark:`#0E2DA8`,g_textDark:`#031698`,g_textLight:`#FFEBFF`,g_blank:`#031698`,g_unsolved:`#3662F1`,g_outline:`#031698`,a_bg:`#043BED`,a_bgAlt:`#0A31CC`,a_puzmo:`#FFC000`,a_headerText:`#FFEBFF`,a_table:`#043BED`,a_tableAlt:`#0A31CC`,a_inlineTag:`#FF7ABC`,a_anchor:`#FF7ABC`,a_infoBG:`#0A31CC`},{name:`Hot Dog (beta)`,type:`light`,key:`#FFFF00`,keyFG:`#000000`,keyStrong:`#FFE600`,keyLight:`#FFEC44`,g_key:`#FFFF00`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#FF7A00`,playerFG:`#000000`,playerLight:`#FFA450`,alt1:`#3ABC5E`,alt2:`#5C3ABC`,alt3:`#BC3AAF`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#1B1D29`,alwaysLight:`#FFFFFF`,g_bg:`#EBFF00`,g_bgAlt:`#EBEBEB`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#FF0000`,a_bgAlt:`#E50000`,a_puzmo:`#FFC000`,a_headerText:`#FFFFFF`,a_table:`#E50000`,a_tableAlt:`#FF2525`,a_inlineTag:`#000000`,a_anchor:`#000000`,a_infoBG:`#C6C6C6`},{name:`Outlook Hayesy`,type:`light`,key:`#DAB98C`,keyFG:`#000000`,keyStrong:`#B99368`,keyLight:`#DAB98C`,subBrand:`#FFC000`,subBrandFG:`#000000`,g_key:`#DAB98C`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#5EC386`,alt2:`#5E93C3`,alt3:`#C35E5E`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#5E390F`,alwaysLight:`#FFF3E4`,g_bg:`#FFFFFF`,g_bgAlt:`#EBEBEB`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#FEF5E8`,a_bgAlt:`#ffffff`,a_puzmo:`#FAC7CE`,a_headerText:`#000000`,a_table:`#FAE8D3`,a_tableAlt:`#EED7BC`,a_inlineTag:`#D9D9D9`,a_anchor:`#B99368`,a_infoBG:`#FFFFFF`},{name:`Console (beta)`,type:`dark`,key:`#957df9`,keyFG:`#000000`,keyStrong:`#590FF5`,keyLight:`#590FF5`,subBrand:`#FFC000`,subBrandFG:`#000000`,g_key:`#FFFF00`,player:`#ffffff`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#590ff5`,alt2:`#00e200`,alt3:`#ff8a02`,fg:`#00e200`,error:`#FF3C3C`,alwaysDark:`#1B1D29`,alwaysLight:`#00e200`,g_bg:`#101428`,g_bgAlt:`#101428`,g_bgDark:`#00e200`,g_textDark:`#00e200`,g_textLight:`#590ff5`,g_blank:`#00e200`,g_unsolved:`#0000ff`,g_outline:`#00e200`,a_bg:`#000000`,a_bgAlt:`#112211`,a_puzmo:`#ffffff`,a_headerText:`#00e200`,a_table:`#000000`,a_tableAlt:`#002200`,a_inlineTag:`#D9D9D9`,a_anchor:`#957df9`,a_infoBG:`#001900`}];var a={collapsed:`simulator-collapsed`,tab:`simulator-tab`,theme:`simulator-theme`,fixtureCategory:`simulator-fixture-category`,fixturePuzzle:`simulator-fixture-puzzle`,renderHost:`simulator-render-host`,renderContext:`simulator-render-context`,previewKind:`simulator-preview-kind`,gameSettings:`simulator-game-settings`,hostContext:`simulator-host-context`,keyboardDocked:`simulator-keyboard-docked`},o=`simulator-override:`;function s(e){return`${o}${e}:${(window.location.pathname||`/`).replace(/\/index\.html$/,``).replace(/\/+$/,``)||`/`}`}function c(e){try{return localStorage.getItem(s(e))}catch(e){return null}}function l(e,t){try{return localStorage.setItem(s(e),t),!0}catch(e){return!1}}function u(e){try{localStorage.removeItem(s(e))}catch(e){}}function d(){u(`puzzle`),u(`input`)}function f(){let e=localStorage.getItem(a.hostContext);if(!e)return null;try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch(e){}return null}function p(e){localStorage.setItem(a.hostContext,JSON.stringify(e))}function m(){localStorage.removeItem(a.hostContext)}function h(){return localStorage.getItem(a.keyboardDocked)===`true`}function g(e){localStorage.setItem(a.keyboardDocked,String(e))}function _(){let e=localStorage.getItem(a.gameSettings);if(!e)return{};try{let t=JSON.parse(e);if(t&&typeof t==`object`)return t}catch(e){}return{}}function v(){let e=localStorage.getItem(a.theme);if(e){let t=i.find(t=>t.name===e);if(t)return t}return i[0]}function y(e){var t;let n=localStorage.getItem(a.tab);return n&&e.includes(n)?n:(t=e[0])==null?`ctrl`:t}function b(e){let t=localStorage.getItem(a.collapsed);return t===null?e:t===`true`}function x(){let e=localStorage.getItem(a.renderHost);return e&&[`game`,`app`,`opengraph`].includes(e)?e:`game`}function S(){return localStorage.getItem(a.previewKind)===`text`?`text`:`image`}function C(){let e=localStorage.getItem(a.renderContext);if(e&&[`preview`,`share`,`completed`,`timeline`].includes(e))return e}function ee(e,t,n){var r,i,o;let s=localStorage.getItem(a.fixtureCategory),l=localStorage.getItem(a.fixturePuzzle),u=f(),d=c(`puzzle`),p=c(`input`);return{hostContext:(r=u==null?e.hostContext:u)==null?[{type:`app`,layout:`desktop`,host:null}]:r,hostContextIsOverridden:u!==null,isCollapsed:b((i=e.collapsed)==null?!0:i),isPaused:!1,hasStarted:!1,activeTab:y(n),puzzleData:d,originalPuzzle:d==null?``:d,currentInputStr:p==null?``:p,userStorage:null,appliedPuzzleOverride:d,appliedInputOverride:p,completionData:null,selectedTheme:v(),selectedCategory:s&&t.includes(s)?s:(o=t[0])==null?null:o,selectedPuzzle:l==null?null:l,renderHost:x(),renderContext:C(),previewKind:S(),gameSettings:_(),keyboardDocked:h(),settingsComponents:null}}function w(e){localStorage.setItem(a.gameSettings,JSON.stringify(e))}function T(){localStorage.removeItem(a.gameSettings)}function te(e){localStorage.setItem(a.collapsed,String(e))}function ne(e){localStorage.setItem(a.tab,e)}function E(e){localStorage.setItem(a.theme,e)}function D(e){localStorage.setItem(a.fixtureCategory,e)}function O(e){localStorage.setItem(a.fixturePuzzle,e)}function k(){localStorage.removeItem(a.fixturePuzzle)}function A(e){e?localStorage.setItem(a.renderHost,e):localStorage.removeItem(a.renderHost)}function j(e){localStorage.setItem(a.previewKind,e)}function M(e){e?localStorage.setItem(a.renderContext,e):localStorage.removeItem(a.renderContext)}function N(e){let t=[];return{log(n,r,i){let a={type:n,data:r,time:new Date().toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),direction:i};t.push(a),t.length>100&&t.shift(),e==null||e(a)},clear(){t.length=0},getLog(){return t}}}function P(e,t,n){console.log(`Simulator sending:`,e,t),n==null||n.log(e,t,`out`),window.postMessage({type:e,data:t},`*`)}function re(e,t){let n=n=>{var r,i,a;if(!(!(n==null||(r=n.data)==null)&&r.type))return;let o=n.data.type,s=(i=(a=n.data.data)==null?n.data.json:a)==null?{}:i;[`TIMER_TICK`,`TIMER_SYNC`].includes(o)||t==null||t.log(o,s,`in`),e(o,s)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function ie(e){let t=new Map;console.log(`Simulator: Parsing fixtures`,Object.keys(e));for(let[o,s]of Object.entries(e)){var n,r,i,a;let e=o.split(`/`),c=(n=(r=e.pop())==null?void 0:r.replace(/\.[^.]+$/,``))==null?``:n,l=(i=e.pop())==null?`default`:i;t.has(l)||t.set(l,new Map);let u=(a=s.default)==null?s:a;t.get(l).set(c,u)}return t.forEach((e,n)=>{let r=new Map(Array.from(e.entries()).sort((e,t)=>{var n,r,i,a;return parseInt((n=(r=e[0].match(/\d+/))==null?void 0:r[0])==null?`0`:n)-parseInt((i=(a=t[0].match(/\d+/))==null?void 0:a[0])==null?`0`:i)}));t.set(n,r)}),t}function F(e,t){return e.length===0?``:`
|
|
2
2
|
<div class="simulator-fixtures">
|
|
3
3
|
<div class="simulator-field">
|
|
4
4
|
<label class="simulator-label">Category</label>
|
|
@@ -11,7 +11,7 @@ const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`
|
|
|
11
11
|
<select class="simulator-select" id="simulator-fixture-puzzle"></select>
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
14
|
-
`}function
|
|
14
|
+
`}function I(e,t,n,r){let i=t.get(n);if(!i)return null;let a=Array.from(i.keys()),o=r;if(!r||!i.has(r)){var s;o=(s=a[0])==null?null:s}return e.innerHTML=a.map(e=>`<option value="${e}" ${e===o?`selected`:``}>${e}</option>`).join(``),o}function L(e,t,n){var r,i;return!t||!n||(r=(i=e.get(t))==null?void 0:i.get(n))==null?null:r}const ae=`puzzmo-simulator-dev-only-do-not-ship`;function oe(){return{id:`ctrl`,label:`Ctrl`,render(){return`
|
|
15
15
|
<div id="simulator-fixtures-container"></div>
|
|
16
16
|
<div id="simulator-status">
|
|
17
17
|
<span class="indicator waiting"></span>
|
|
@@ -24,7 +24,7 @@ const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`
|
|
|
24
24
|
<div class="simulator-row">
|
|
25
25
|
<button class="simulator-btn danger" id="simulator-retry" disabled>Retry</button>
|
|
26
26
|
</div>
|
|
27
|
-
`},bind(e){let t=e.getElement(`#simulator-start`),n=e.getElement(`#simulator-pause`),r=e.getElement(`#simulator-retry`),i=e.getElement(`#simulator-fixtures-container`);if(console.log(`Simulator: CtrlView.bind called`,{hasFixtures:!!e.fixtures,categories:e.fixtureCategories,selectedCategory:e.state.selectedCategory,selectedPuzzle:e.state.selectedPuzzle}),e.fixtures&&e.fixtureCategories.length>0&&i){i.innerHTML=
|
|
27
|
+
`},bind(e){let t=e.getElement(`#simulator-start`),n=e.getElement(`#simulator-pause`),r=e.getElement(`#simulator-retry`),i=e.getElement(`#simulator-fixtures-container`);if(console.log(`Simulator: CtrlView.bind called`,{hasFixtures:!!e.fixtures,categories:e.fixtureCategories,selectedCategory:e.state.selectedCategory,selectedPuzzle:e.state.selectedPuzzle}),e.fixtures&&e.fixtureCategories.length>0&&i){i.innerHTML=F(e.fixtureCategories,e.state.selectedCategory);let t=e.getElement(`#simulator-fixture-category`),n=e.getElement(`#simulator-fixture-puzzle`);if(t&&n&&e.state.selectedCategory){e.state.selectedPuzzle=I(n,e.fixtures,e.state.selectedCategory,e.state.selectedPuzzle);let r=L(e.fixtures,e.state.selectedCategory,e.state.selectedPuzzle);console.log(`Simulator: Loading fixture puzzle`,{category:e.state.selectedCategory,puzzle:e.state.selectedPuzzle,hasPuzzleData:!!r}),r&&(e.state.appliedPuzzleOverride===null&&(e.state.puzzleData=r,e.state.originalPuzzle=r),e.state.selectedCategory&&D(e.state.selectedCategory),e.state.selectedPuzzle&&O(e.state.selectedPuzzle)),t.addEventListener(`change`,()=>{console.log(`Simulator: Category changed, reloading...`,t.value),d(),D(t.value),k(),window.location.reload()}),n.addEventListener(`change`,()=>{console.log(`Simulator: Puzzle changed, reloading...`,n.value),d(),O(n.value),window.location.reload()})}}t==null||t.addEventListener(`click`,()=>{e.state.isPaused?(e.sendToGame(`RESUME_GAME`,{}),e.state.isPaused=!1,n&&(n.textContent=`Pause`),e.updateStatus(`Running`,`ready`)):(e.sendToGame(`START_GAME`,void 0),e.state.hasStarted=!0,n&&(n.disabled=!1),t&&(t.textContent=`Resume`),e.updateStatus(`Running`,`ready`))}),n==null||n.addEventListener(`click`,()=>{e.state.isPaused?(e.sendToGame(`RESUME_GAME`,{}),e.state.isPaused=!1,n.textContent=`Pause`,e.updateStatus(`Running`,`ready`)):(e.sendToGame(`PAUSE_GAME`,{}),e.state.isPaused=!0,n.textContent=`Resume`,e.updateStatus(`Paused`,`paused`))}),r==null||r.addEventListener(`click`,()=>{e.sendToGame(`RETRY_PUZZLE`,{}),e.state.hasStarted=!1,e.state.isPaused=!1,n&&(n.disabled=!0,n.textContent=`Pause`),t&&(t.textContent=`Start`),e.updateStatus(`Ready to retry`,`ready`)})},onMessage(e,t,n){let r=n.getElement(`#simulator-start`),i=n.getElement(`#simulator-pause`),a=n.getElement(`#simulator-retry`);e===`READY_GAME_LOADED`&&(r&&(r.disabled=!1),a&&(a.disabled=!1),n.updateStatus(`Ready`,`ready`)),e===`GAME_COMPLETED`&&(n.state.hasStarted=!1,i&&(i.disabled=!0),r&&(r.disabled=!0),n.updateStatus(`Completed!`,`complete`))}}}function R(e){var t;if(typeof e!=`string`)return e;let n=(t=z(e))==null?{width:800,height:800}:t;return{svg:e,width:n.width,height:n.height}}function z(e){var t,n,r,i;let a=e.indexOf(`<svg`);if(a===-1)return;let o=e.indexOf(`>`,a),s=o===-1?e.slice(a):e.slice(a,o+1),c=/viewBox\s*=\s*["']\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(s);if(c){let e=parseFloat(c[1]),t=parseFloat(c[2]);if(e>0&&t>0)return{width:e,height:t}}let l=parseFloat((t=(n=/\bwidth\s*=\s*["']\s*([\d.]+)(?:px)?\s*["']/i.exec(s))==null?void 0:n[1])==null?``:t),u=parseFloat((r=(i=/\bheight\s*=\s*["']\s*([\d.]+)(?:px)?\s*["']/i.exec(s))==null?void 0:i[1])==null?``:r);if(l>0&&u>0)return{width:l,height:u}}var B=`simulator-saved-states`;function se(){let e=globalThis;for(let t of Object.keys(e))if(t.endsWith(`Thumbnail`)&&typeof e[t]==`function`)return{name:t,fn:e[t]};return null}function V(e,t){let n=se();if(!n)return``;try{var r;let i=(r=e.state.puzzleData)==null?``:r,a={viewerIsOwner:!0,theme:e.state.selectedTheme,strict:!0,renderHost:`game`};return R(n.fn(i,t,a)).svg}catch(e){return``}}var H=[];function U(e,t=8){let n=14*t+8+4;e.style.height=`auto`;let r=Math.min(Math.max(e.scrollHeight,40),n);e.style.height=`${r}px`}function ce(){let e=``,t=``;return{id:`data`,label:`Data`,render(){return`
|
|
28
28
|
<div class="data-view-container">
|
|
29
29
|
<div class="data-subtabs">
|
|
30
30
|
<button class="data-subtab active" data-subtab="edit">Edit</button>
|
|
@@ -77,9 +77,9 @@ const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`
|
|
|
77
77
|
</div>
|
|
78
78
|
</div>
|
|
79
79
|
</div>
|
|
80
|
-
`},bind(n){let r=n.getElement(`.data-subtabs`);r==null||r.querySelectorAll(`.data-subtab`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.getAttribute(`data-subtab`);if(!t)return;r.querySelectorAll(`.data-subtab`).forEach(e=>e.classList.remove(`active`)),e.classList.add(`active`);let i=n.getElement(`.data-view-container`);i==null||i.querySelectorAll(`.data-subtab-content`).forEach(e=>{e.classList.toggle(`active`,e.id===`data-subtab-${t}`)}),t===`edit`?de(n):t===`history`?
|
|
80
|
+
`},bind(n){let r=n.getElement(`.data-subtabs`);r==null||r.querySelectorAll(`.data-subtab`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.getAttribute(`data-subtab`);if(!t)return;r.querySelectorAll(`.data-subtab`).forEach(e=>e.classList.remove(`active`)),e.classList.add(`active`);let i=n.getElement(`.data-view-container`);i==null||i.querySelectorAll(`.data-subtab-content`).forEach(e=>{e.classList.toggle(`active`,e.id===`data-subtab-${t}`)}),t===`edit`?de(n):t===`history`?W(n):t===`saves`&&G(n)})});let i=n.getElement(`#simulator-puzzle`),a=n.getElement(`#simulator-input`),o=n.getElement(`#simulator-puzzle-reset`),s=n.getElement(`#simulator-puzzle-apply`),c=n.getElement(`#simulator-input-reset`),d=n.getElement(`#simulator-input-apply`);setTimeout(()=>{i&&n.state.originalPuzzle&&document.activeElement!==i&&(i.value=n.state.originalPuzzle,e=n.state.originalPuzzle,U(i)),a&&n.state.currentInputStr&&document.activeElement!==a&&(a.value=n.state.currentInputStr,t=n.state.currentInputStr,U(a)),fe(n)},0),i==null||i.addEventListener(`input`,()=>{U(i);let t=i.value!==e;s&&(s.disabled=!t)}),a==null||a.addEventListener(`input`,()=>{U(a);let e=a.value!==t;d&&(d.disabled=!e)}),o==null||o.addEventListener(`click`,()=>{if(n.state.appliedPuzzleOverride!==null){u(`puzzle`),n.updateStatus(`Restoring fixture puzzle...`,`waiting`),window.location.reload();return}i&&(i.value=n.state.originalPuzzle,e=n.state.originalPuzzle,U(i),s&&(s.disabled=!0))}),s==null||s.addEventListener(`click`,()=>{if(i){if(!l(`puzzle`,i.value)){n.updateStatus(`Could not store puzzle — storage unavailable`,`paused`);return}u(`input`),s.disabled=!0,n.updateStatus(`Applying puzzle...`,`waiting`),window.location.reload()}}),c==null||c.addEventListener(`click`,()=>{if(n.state.appliedInputOverride!==null){u(`input`),n.updateStatus(`Clearing input...`,`waiting`),window.location.reload();return}a&&(a.value=t,U(a),d&&(d.disabled=!0))}),d==null||d.addEventListener(`click`,()=>{if(a){if(!l(`input`,a.value)){n.updateStatus(`Could not store input — storage unavailable`,`paused`);return}d.disabled=!0,n.updateStatus(`Applying input...`,`waiting`),window.location.reload()}});let f=n.getElement(`#simulator-history-clear`);f==null||f.addEventListener(`click`,()=>{H=[],W(n)});let p=n.getElement(`#simulator-save-name`),m=n.getElement(`#simulator-save-btn`);m==null||m.addEventListener(`click`,()=>{if(!p||!p.value.trim())return;let e=le(),t={name:p.value.trim(),puzzleStr:n.state.originalPuzzle,inputStr:n.state.currentInputStr,timestamp:Date.now()};e.push(t),localStorage.setItem(B,JSON.stringify(e)),p.value=``,G(n)}),G(n)},onActivate(n){e=n.state.originalPuzzle,t=n.state.currentInputStr,de(n),W(n)},onMessage(e,n,r){var i,a;let o=r.getElement(`#simulator-input`),s=r.getElement(`#simulator-input-apply`),c=(i=n==null||(a=n.input)==null?void 0:a.boardState)==null?n==null?void 0:n.boardState:i;if(e===`UPLOAD_NEW_GAME_STATE`&&c){if(r.state.currentInputStr=c,H.length===0||H[H.length-1].value!==c){H.push({value:c,timestamp:Date.now()}),H.length>100&&(H=H.slice(-100));let e=r.getElement(`#data-subtab-history`);e!=null&&e.classList.contains(`active`)&&W(r)}o&&document.activeElement!==o&&(o.value!==c&&(o.value=c,U(o)),t=c,s&&(s.disabled=!0))}}}}function le(){try{let e=localStorage.getItem(B);return e?JSON.parse(e):[]}catch(e){return[]}}function W(e){let t=e.getElement(`#simulator-history-list`);if(t){if(t.style.setProperty(`--history-thumb-bg`,e.state.selectedTheme.a_bg),H.length===0){t.innerHTML=`<div class="simulator-empty">No history yet</div>`;return}t.innerHTML=[...H].reverse().map((t,n)=>{let r=H.length-1-n,i=new Date(t.timestamp).toLocaleTimeString(),a=t.value.length>60?t.value.slice(0,60)+`...`:t.value;return`
|
|
81
81
|
<div class="history-item" data-history-idx="${r}">
|
|
82
|
-
<div class="history-item-thumb">${
|
|
82
|
+
<div class="history-item-thumb">${V(e,t.value)}</div>
|
|
83
83
|
<div class="history-item-content">
|
|
84
84
|
<div class="history-item-header">
|
|
85
85
|
<span class="history-item-num">#${r+1}</span>
|
|
@@ -89,7 +89,7 @@ const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`
|
|
|
89
89
|
<div class="history-item-preview">${ue(a)}</div>
|
|
90
90
|
</div>
|
|
91
91
|
</div>
|
|
92
|
-
`}).join(``),t.querySelectorAll(`.history-restore-btn`).forEach(t=>{t.addEventListener(`click`,t=>{let n=parseInt(t.target.getAttribute(`data-history-idx`)||`0`),r=
|
|
92
|
+
`}).join(``),t.querySelectorAll(`.history-restore-btn`).forEach(t=>{t.addEventListener(`click`,t=>{let n=parseInt(t.target.getAttribute(`data-history-idx`)||`0`),r=H[n];if(r){let t=e.getElement(`.data-subtab[data-subtab="edit"]`);t==null||t.click();let n=e.getElement(`#simulator-input`),i=e.getElement(`#simulator-input-apply`);n&&(n.value=r.value,U(n)),i&&(i.disabled=!1),e.updateStatus(`Input restored — press Apply to load it`,`ready`)}})})}}function G(e){let t=e.getElement(`#simulator-saves-list`);if(!t)return;let n=le();if(n.length===0){t.innerHTML=`<div class="simulator-empty">No saved states</div>`;return}t.innerHTML=[...n].reverse().map((e,t)=>{let r=n.length-1-t,i=new Date(e.timestamp).toLocaleDateString(),a=new Date(e.timestamp).toLocaleTimeString();return`
|
|
93
93
|
<div class="save-item">
|
|
94
94
|
<div class="save-item-header">
|
|
95
95
|
<span class="save-item-name">${ue(e.name)}</span>
|
|
@@ -100,7 +100,7 @@ const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`
|
|
|
100
100
|
<button class="simulator-btn tiny danger save-delete-btn" data-save-idx="${r}">Delete</button>
|
|
101
101
|
</div>
|
|
102
102
|
</div>
|
|
103
|
-
`}).join(``),t.querySelectorAll(`.save-load-btn`).forEach(t=>{t.addEventListener(`click`,t=>{let r=n[parseInt(t.target.getAttribute(`data-save-idx`)||`0`)];if(r){if(!
|
|
103
|
+
`}).join(``),t.querySelectorAll(`.save-load-btn`).forEach(t=>{t.addEventListener(`click`,t=>{let r=n[parseInt(t.target.getAttribute(`data-save-idx`)||`0`)];if(r){if(!l(`puzzle`,r.puzzleStr)||!l(`input`,r.inputStr)){d(),e.updateStatus(`Could not load "${r.name}" — storage unavailable`,`paused`);return}e.updateStatus(`Loading: ${r.name}`,`waiting`),window.location.reload()}})}),t.querySelectorAll(`.save-delete-btn`).forEach(t=>{t.addEventListener(`click`,t=>{let r=parseInt(t.target.getAttribute(`data-save-idx`)||`0`),i=n.filter((e,t)=>t!==r);localStorage.setItem(B,JSON.stringify(i)),G(e)})})}function ue(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function de(e){let t=e.getElement(`#simulator-puzzle`),n=e.getElement(`#simulator-input`),r=e.getElement(`#simulator-puzzle-apply`),i=e.getElement(`#simulator-input-apply`);t&&e.state.originalPuzzle&&(t.value=e.state.originalPuzzle,U(t),r&&(r.disabled=!0)),n&&(n.value=e.state.currentInputStr,U(n),i&&(i.disabled=!0)),fe(e)}function fe(e){let t=e.getElement(`#simulator-puzzle-override-tag`),n=e.getElement(`#simulator-input-override-tag`);t&&(t.hidden=e.state.appliedPuzzleOverride===null),n&&(n.hidden=e.state.appliedInputOverride===null)}function pe(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function me(){let e=0;return{id:`msgs`,label:`Msgs`,render(){return`
|
|
104
104
|
<div class="msgs-view-container">
|
|
105
105
|
<div class="msgs-header">
|
|
106
106
|
<span class="simulator-label">Message Log</span>
|
|
@@ -160,40 +160,40 @@ const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`
|
|
|
160
160
|
${r()}
|
|
161
161
|
</div>
|
|
162
162
|
</div>
|
|
163
|
-
`},bind(t){let n=t.getElement(`#simulator-checkpoints-clear`),i=t.getElement(`#simulator-checkpoints-list`);n==null||n.addEventListener(`click`,()=>{e=[],i&&(i.innerHTML=r()),t.updateBadge(`checkpoints`,0)})},onMessage(n,i,a){if(n!==`HIT_CHECKPOINT`)return;let o={checkpointName:i.checkpointName,augConfig:i.augConfig,time:t()};e.push(o),a.updateBadge(`checkpoints`,e.length);let s=a.getElement(`#simulator-checkpoints-list`);s&&(s.innerHTML=r(),s.scrollTop=s.scrollHeight)}}}var _e=e.t((e=>{var t={document:{}},n=Object.prototype.hasOwnProperty,r=function(e){return v(e)?e.toLowerCase():e},i=Array.isArray;function a(e){var t=Function.prototype.constructor;delete Function.prototype.constructor;var n=e();return Function.prototype.constructor=t,n}var o,s=Object.prototype.toString,c=Object.getPrototypeOf,l=O(`ng`);function u(e){if(e==null||x(e))return!1;if(i(e)||v(e)||o&&e instanceof o)return!0;var t=`length`in Object(e)&&e.length;return y(t)&&(t>=0&&(t-1 in e||e instanceof Array)||typeof e.item==`function`)}function d(e,t,r){var a,o;if(e)if(b(e))for(a in e)a!==`prototype`&&a!==`length`&&a!==`name`&&e.hasOwnProperty(a)&&t.call(r,e[a],a,e);else if(i(e)||u(e)){var s=typeof e!=`object`;for(a=0,o=e.length;a<o;a++)(s||a in e)&&t.call(r,e[a],a,e)}else if(e.forEach&&e.forEach!==d)e.forEach(t,r,e);else if(_(e))for(a in e)t.call(r,e[a],a,e);else if(typeof e.hasOwnProperty==`function`)for(a in e)e.hasOwnProperty(a)&&t.call(r,e[a],a,e);else for(a in e)n.call(e,a)&&t.call(r,e[a],a,e);return e}function f(e,t){t?e.$$hashKey=t:delete e.$$hashKey}function p(){}function m(e){return e===void 0}function h(e){return e!==void 0}function g(e){return typeof e==`object`&&!!e}function _(e){return typeof e==`object`&&!!e&&!c(e)}function v(e){return typeof e==`string`}function y(e){return typeof e==`number`}function b(e){return typeof e==`function`}function x(e){return e&&e.window===e}function S(e){return e&&e.$evalAsync&&e.$watch}var
|
|
164
|
-
http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.length;c++,s=`&`)a+=s+`p`+(c-n)+`=`+encodeURIComponent(D(r[c]));return new t(a)}}var k=O(`$parse`);function A(e){return e+``}var j=
|
|
165
|
-
`,f:`\f`,r:`\r`,t:` `,v:`\v`,"'":`'`,'"':`"`};function
|
|
166
|
-
`||e===`\v`||e===`\xA0`},isIdentifierStart:function(e){return this.options.isIdentifierStart?this.options.isIdentifierStart(e,this.codePointAt(e)):this.isValidIdentifierStart(e)},isValidIdentifierStart:function(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`||e===`$`},isIdentifierContinue:function(e){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(e,this.codePointAt(e)):this.isValidIdentifierContinue(e)},isValidIdentifierContinue:function(e,t){return this.isValidIdentifierStart(e,t)||this.isNumber(e)},codePointAt:function(e){return e.length===1?e.charCodeAt(0):(e.charCodeAt(0)<<10)+e.charCodeAt(1)-56613888},peekMultichar:function(){var e=this.text.charAt(this.index),t=this.peek();if(!t)return e;var n=e.charCodeAt(0),r=t.charCodeAt(0);return n>=55296&&n<=56319&&r>=56320&&r<=57343?e+t:e},isExpOperator:function(e){return e===`-`||e===`+`||this.isNumber(e)},throwError:function(e,t,n){throw n=n||this.index,k(`lexerr`,`Lexer Error: {0} at column{1} in expression [{2}].`,e,h(t)?`s `+t+`-`+this.index+` [`+this.text.substring(t,n)+`]`:` `+n,this.text)},readNumber:function(){for(var e=``,t=this.index;this.index<this.text.length;){var n=r(this.text.charAt(this.index));if(n===`.`||this.isNumber(n))e+=n;else{var i=this.peek();if(n===`e`&&this.isExpOperator(i))e+=n;else if(this.isExpOperator(n)&&i&&this.isNumber(i)&&e.charAt(e.length-1)===`e`)e+=n;else if(this.isExpOperator(n)&&(!i||!this.isNumber(i))&&e.charAt(e.length-1)===`e`)this.throwError(`Invalid exponent`);else break}this.index++}this.tokens.push({index:t,text:e,constant:!0,value:Number(e)})},readIdent:function(){var e=this.index;for(this.index+=this.peekMultichar().length;this.index<this.text.length;){var t=this.peekMultichar();if(!this.isIdentifierContinue(t))break;this.index+=t.length}this.tokens.push({index:e,text:this.text.slice(e,this.index),identifier:!0})},readString:function(e){var t=this.index;this.index++;for(var n=``,r=e,i=e==="`",a=!1;this.index<this.text.length;){var o=this.text.charAt(this.index);if(i&&o===`$`&&this.text.charAt(this.index+1)===`{`){this.tokens.push({index:t,text:r,constant:!0,value:n});var s=this.text.indexOf(`}`,this.index),c=this.text.substr(this.index+2,s-this.index-2);this.tokens.push({index:this.index,text:`+`,operator:!0});for(var l=new M(this.options).lex(c),u=0,d=l.length;u<d;u++)this.tokens.push(l[u]);this.tokens.push({index:this.index,text:`+`,operator:!0}),this.index=s,this.readString("`");return}if(r+=o,a){if(o===`u`){var f=this.text.substring(this.index+1,this.index+5);f.match(/[\da-f]{4}/i)||this.throwError(`Invalid unicode escape [\\u`+f+`]`),this.index+=4,n+=String.fromCharCode(parseInt(f,16))}else{var p=re[o];n+=p||o}a=!1}else if(o===`\\`)a=!0;else if(o===e){this.index++,this.tokens.push({index:t,text:r,constant:!0,value:n});return}else n+=o;this.index++}this.throwError(`Unterminated quote`,t)}};function N(e,t){this.lexer=e,this.options=t}N.Program=`Program`,N.ExpressionStatement=`ExpressionStatement`,N.AssignmentExpression=`AssignmentExpression`,N.ConditionalExpression=`ConditionalExpression`,N.LogicalExpression=`LogicalExpression`,N.BinaryExpression=`BinaryExpression`,N.UnaryExpression=`UnaryExpression`,N.CallExpression=`CallExpression`,N.MemberExpression=`MemberExpression`,N.Identifier=`Identifier`,N.Literal=`Literal`,N.ArrayExpression=`ArrayExpression`,N.Property=`Property`,N.ObjectExpression=`ObjectExpression`,N.ThisExpression=`ThisExpression`,N.LocalsExpression=`LocalsExpression`,N.NGValueParameter=`NGValueParameter`,N.prototype={ast:function(e){this.text=e,this.tokens=this.lexer.lex(e);var t=this.program();return this.tokens.length!==0&&this.throwError(`is an unexpected token`,this.tokens[0]),t},program:function(){for(var e=[];;)if(this.tokens.length>0&&!this.peek(`}`,`)`,`;`,`]`)&&e.push(this.expressionStatement()),!this.expect(`;`))return{type:N.Program,body:e}},expressionStatement:function(){return{type:N.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var e=this.expression();this.expect(`|`);)e=this.filter(e);return e},expression:function(){return this.assignment()},assignment:function(){var e=this.ternary();if(this.expect(`=`)){if(!oe(e))throw k(`lval`,`Trying to assign a value to a non l-value`);e={type:N.AssignmentExpression,left:e,right:this.assignment(),operator:`=`}}return e},ternary:function(){var e=this.nullishCoalescing(),t,n;return this.expect(`?`)&&(t=this.expression(),this.consume(`:`))?(n=this.expression(),{type:N.ConditionalExpression,test:e,alternate:t,consequent:n}):e},nullishCoalescing:function(){for(var e=this.logicalOR();this.expect(`??`);)e={type:N.LogicalExpression,operator:`??`,left:e,right:this.logicalOR()};return e},logicalOR:function(){for(var e=this.logicalAND();this.expect(`||`);)e={type:N.LogicalExpression,operator:`||`,left:e,right:this.logicalAND()};return e},logicalAND:function(){for(var e=this.equality();this.expect(`&&`);)e={type:N.LogicalExpression,operator:`&&`,left:e,right:this.equality()};return e},equality:function(){for(var e=this.relational(),t;t=this.expect(`==`,`!=`,`===`,`!==`);)e={type:N.BinaryExpression,operator:t.text,left:e,right:this.relational()};return e},relational:function(){for(var e=this.additive(),t;t=this.expect(`<`,`>`,`<=`,`>=`);)e={type:N.BinaryExpression,operator:t.text,left:e,right:this.additive()};return e},additive:function(){for(var e=this.multiplicative(),t;t=this.expect(`+`,`-`);)e={type:N.BinaryExpression,operator:t.text,left:e,right:this.multiplicative()};return e},multiplicative:function(){for(var e=this.unary(),t;t=this.expect(`*`,`/`,`%`);)e={type:N.BinaryExpression,operator:t.text,left:e,right:this.unary()};return e},unary:function(){var e;return(e=this.expect(`+`,`-`,`!`))?{type:N.UnaryExpression,operator:e.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var e;this.expect(`(`)?(e=this.filterChain(),this.consume(`)`)):this.expect(`[`)?e=this.arrayDeclaration():this.expect(`{`)?e=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?e=te(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:N.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?e=this.identifier():this.peek().constant?e=this.constant():this.throwError(`not a primary expression`,this.peek());for(var t;t=this.expect(`(`,`[`,`.`);)t.text===`(`?(e={type:N.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(`)`)):t.text===`[`?(e={type:N.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume(`]`)):t.text===`.`?e={type:N.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError(`IMPOSSIBLE`);return e},filter:function(e){for(var t=[e],n={type:N.CallExpression,callee:this.identifier(),arguments:t,filter:!0};this.expect(`:`);)t.push(this.expression());return n},parseArguments:function(){var e=[];if(this.peekToken().text!==`)`)do e.push(this.filterChain());while(this.expect(`,`));return e},identifier:function(){var e=this.consume();return e.identifier||this.throwError(`is not a valid identifier`,e),{type:N.Identifier,name:e.text}},constant:function(){return{type:N.Literal,value:this.consume().value}},arrayDeclaration:function(){var e=[];if(this.peekToken().text!==`]`)do{if(this.peek(`]`))break;e.push(this.expression())}while(this.expect(`,`));return this.consume(`]`),{type:N.ArrayExpression,elements:e}},object:function(){var e=[],t;if(this.peekToken().text!==`}`)do{if(this.peek(`}`))break;t={type:N.Property,kind:`init`},this.peek().constant?(t.key=this.constant(),t.computed=!1,this.consume(`:`),t.value=this.expression()):this.peek().identifier?(t.key=this.identifier(),t.computed=!1,this.peek(`:`)?(this.consume(`:`),t.value=this.expression()):t.value=t.key):this.peek(`[`)?(this.consume(`[`),t.key=this.expression(),this.consume(`]`),t.computed=!0,this.consume(`:`),t.value=this.expression()):this.throwError(`invalid key`,this.peek()),e.push(t)}while(this.expect(`,`));return this.consume(`}`),{type:N.ObjectExpression,properties:e}},throwError:function(e,t){throw k(`syntax`,`Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].`,t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(this.tokens.length===0)throw k(`ueoe`,`Unexpected end of expression: {0}`,this.text);var t=this.expect(e);return t||this.throwError(`is unexpected, expecting [`+e+`]`,this.peek()),t},peekToken:function(){if(this.tokens.length===0)throw k(`ueoe`,`Unexpected end of expression: {0}`,this.text);return this.tokens[0]},peek:function(e,t,n,r){return this.peekAhead(0,e,t,n,r)},peekAhead:function(e,t,n,r,i){if(this.tokens.length>e){var a=this.tokens[e],o=a.text;if(o===t||o===n||o===r||o===i||!t&&!n&&!r&&!i)return a}return!1},expect:function(e,t,n,r){var i=this.peek(e,t,n,r);return i?(this.tokens.shift(),i):!1}};function ie(e,t){return e===void 0?t:e}function P(e,t){return e===void 0?t:t===void 0?e:e+t}function F(e,t){var n=e(t);if(!n)throw Error(`Filter '`+t+`' is not defined`);return!n.$stateful}function I(e,t){var n,r,i;switch(e.type){case N.Program:n=!0,d(e.body,function(e){I(e.expression,t),n=n&&e.expression.constant}),e.constant=n;break;case N.Literal:e.constant=!0,e.toWatch=[];break;case N.UnaryExpression:I(e.argument,t),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case N.BinaryExpression:I(e.left,t),I(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case N.LogicalExpression:I(e.left,t),I(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case N.ConditionalExpression:I(e.test,t),I(e.alternate,t),I(e.consequent,t),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case N.Identifier:e.constant=!1,e.toWatch=[e];break;case N.MemberExpression:I(e.object,t),e.computed&&I(e.property,t),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=[e];break;case N.CallExpression:i=e.filter?F(t,e.callee.name):!1,n=i,r=[],d(e.arguments,function(e){I(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=i?r:[e];break;case N.AssignmentExpression:I(e.left,t),I(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case N.ArrayExpression:n=!0,r=[],d(e.elements,function(e){I(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=r;break;case N.ObjectExpression:n=!0,r=[],d(e.properties,function(e){I(e.value,t),n=n&&e.value.constant&&!e.computed,e.value.constant||r.push.apply(r,e.value.toWatch)}),e.constant=n,e.toWatch=r;break;case N.ThisExpression:e.constant=!1,e.toWatch=[];break;case N.LocalsExpression:e.constant=!1,e.toWatch=[];break}}function ae(e){if(e.length===1){var t=e[0].expression,n=t.toWatch;return n.length===1&&n[0]===t?void 0:n}}function oe(e){return e.type===N.Identifier||e.type===N.MemberExpression}function L(e){if(e.body.length===1&&oe(e.body[0].expression))return{type:N.AssignmentExpression,left:e.body[0].expression,right:{type:N.NGValueParameter},operator:`=`}}function R(e){return e.body.length===0||e.body.length===1&&(e.body[0].expression.type===N.Literal||e.body[0].expression.type===N.ArrayExpression||e.body[0].expression.type===N.ObjectExpression)}function z(e){return e.constant}function B(e,t){this.astBuilder=e,this.$filter=t}B.prototype={compile:function(e){var t=this,n=this.astBuilder.ast(e);this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},I(n,t.$filter);var r=``,i;if(this.stage=`assign`,i=L(n)){this.state.computing=`assign`;var o=this.nextId();this.recurse(i,o),this.return_(o),r=`fn.assign=`+this.generateFunction(`assign`,`s,v,l`)}var s=ae(n.body);t.stage=`inputs`,d(s,function(e,n){var r=`fn`+n;t.state[r]={vars:[],body:[],own:{}},t.state.computing=r;var i=t.nextId();t.recurse(e,i),t.return_(i),t.state.inputs.push(r),e.watchId=n}),this.state.computing=`fn`,this.stage=`main`,this.recurse(n);var c=`"`+this.USE+` `+this.STRICT+`";
|
|
167
|
-
`+this.filterPrefix()+`var fn=`+this.generateFunction(`fn`,`s,l,a,i`)+r+this.watchFns()+`return fn;`,l=Function(`$filter`,`getStringValue`,`ifDefined`,`plus`,c)(this.$filter,A,ie,P),u=function(e,t,n,r){return a(function(){return l(e,t,n,r)})};return u.assign=function(e,t,n){return a(function(){return l.assign(e,t,n)})},u.inputs=l.inputs,this.state=this.stage=void 0,u.ast=n,u.literal=R(n),u.constant=z(n),u},USE:`use`,STRICT:`strict`,watchFns:function(){var e=[],t=this.state.inputs,n=this;return d(t,function(t){e.push(`var `+t+`=`+n.generateFunction(t,`s`))}),t.length&&e.push(`fn.inputs=[`+t.join(`,`)+`];`),e.join(``)},generateFunction:function(e,t){return`function(`+t+`){`+this.varsPrefix(e)+this.body(e)+`};`},filterPrefix:function(){var e=[],t=this;return d(this.state.filters,function(n,r){e.push(n+`=$filter(`+t.escape(r)+`)`)}),e.length?`var `+e.join(`,`)+`;`:``},varsPrefix:function(e){return this.state[e].vars.length?`var `+this.state[e].vars.join(`,`)+`;`:``},body:function(e){return this.state[e].body.join(``)},recurse:function(e,t,n,r,i,a){var o,s,c=this,l,u,f;if(r=r||p,!a&&h(e.watchId)){t=t||this.nextId(),this.if_(`i`,this.lazyAssign(t,this.unsafeComputedMember(`i`,e.watchId)),this.lazyRecurse(e,t,n,r,i,!0));return}switch(e.type){case N.Program:d(e.body,function(t,n){c.recurse(t.expression,void 0,void 0,function(e){s=e}),n===e.body.length-1?c.return_(s):c.current().body.push(s,`;`)});break;case N.Literal:u=this.escape(e.value),this.assign(t,u),r(t||u);break;case N.UnaryExpression:this.recurse(e.argument,void 0,void 0,function(e){s=e}),u=e.operator+`(`+this.ifDefined(s,0)+`)`,this.assign(t,u),r(u);break;case N.BinaryExpression:this.recurse(e.left,void 0,void 0,function(e){o=e}),this.recurse(e.right,void 0,void 0,function(e){s=e}),u=e.operator===`+`?this.plus(o,s):e.operator===`-`?this.ifDefined(o,0)+e.operator+this.ifDefined(s,0):`(`+o+`)`+e.operator+`(`+s+`)`,this.assign(t,u),r(u);break;case N.LogicalExpression:t=t||this.nextId(),c.recurse(e.left,t),e.operator===`??`?c.if_(c.or_(c.isNull(t),`typeof `+t+` === 'undefined'`),c.lazyRecurse(e.right,t)):c.if_(e.operator===`&&`?t:c.not(t),c.lazyRecurse(e.right,t)),r(t);break;case N.ConditionalExpression:t=t||this.nextId(),c.recurse(e.test,t),c.if_(t,c.lazyRecurse(e.alternate,t),c.lazyRecurse(e.consequent,t)),r(t);break;case N.Identifier:t=t||this.nextId();var m=c.current().inAssignment;n&&(m?n.context=this.assign(this.nextId(),`s`):n.context=c.stage===`inputs`?`s`:this.assign(this.nextId(),this.getHasOwnProperty(`l`,e.name)+`?l:s`),n.computed=!1,n.name=e.name),c.if_(c.stage===`inputs`||c.not(c.getHasOwnProperty(`l`,e.name)),function(){c.if_(c.stage===`inputs`||`s`,function(){var n=c.nextId();c.assign(n,c.nonComputedMember(`s`,e.name)),c.if_(c.or_(c.isNull(n),c.hasOwnProperty_(`s`,e.name)),function(){i&&i!==1?(c.if_(c.isNull(n),c.lazyAssign(c.nonComputedMember(`s`,e.name),`{}`)),c.assign(t,c.nonComputedMember(`s`,e.name))):c.assign(t,n)})})},t&&function(){c.if_(c.hasOwnProperty_(`l`,e.name),c.lazyAssign(t,c.nonComputedMember(`l`,e.name)))}),r(t);break;case N.MemberExpression:o=n&&(n.context=this.nextId())||this.nextId(),t=t||this.nextId(),c.recurse(e.object,o,void 0,function(){var a=null,l=c.current().inAssignment;e.computed?(s=c.nextId(),a=l||c.state.computing===`assign`?c.unsafeComputedMember(o,s):c.computedMember(o,s)):(a=l||c.state.computing===`assign`?c.unsafeNonComputedMember(o,e.property.name):c.nonComputedMember(o,e.property.name),s=e.property.name),e.computed&&e.property.type===N.Literal&&c.recurse(e.property,s),c.if_(c.and_(c.notNull(o),c.or_(c.isNull(a),c.hasOwnProperty_(o,s,e.computed))),function(){e.computed?(e.property.type!==N.Literal&&c.recurse(e.property,s),i&&i!==1&&c.if_(c.not(a),c.lazyAssign(a,`{}`)),c.assign(t,a),n&&(n.computed=!0,n.name=s)):(i&&i!==1&&c.if_(c.isNull(a),c.lazyAssign(a,`{}`)),c.assign(t,a),n&&(n.computed=!1,n.name=e.property.name))},function(){c.assign(t,`undefined`)}),r(t)},!!i);break;case N.CallExpression:t=t||this.nextId(),e.filter?(s=c.filter(e.callee.name),l=[],d(e.arguments,function(e){var t=c.nextId();c.recurse(e,t),l.push(t)}),u=s+`.call(`+s+`,`+l.join(`,`)+`)`,c.assign(t,u),r(t)):(s=c.nextId(),o={},l=[],c.recurse(e.callee,s,o,function(){c.if_(c.notNull(s),function(){d(e.arguments,function(t){c.recurse(t,e.constant?void 0:c.nextId(),void 0,function(e){l.push(e)})}),u=o.name?`(`+c.member(o.context,o.name,o.computed)+` === null ? null : `+c.unsafeMember(o.context,o.name,o.computed)+`.call(`+[o.context].concat(l).join(`,`)+`))`:s+`(`+l.join(`,`)+`)`,c.assign(t,u)},function(){c.assign(t,`undefined`)}),r(t)}));break;case N.AssignmentExpression:s=this.nextId(),o={},c.current().inAssignment=!0,this.recurse(e.left,void 0,o,function(){c.if_(c.and_(c.notNull(o.context),c.or_(c.hasOwnProperty_(o.context,o.name),c.isNull(c.member(o.context,o.name,o.computed)))),function(){c.recurse(e.right,s),u=c.member(o.context,o.name,o.computed)+e.operator+s,c.assign(t,u),r(t||u)}),c.current().inAssignment=!1,c.recurse(e.right,s),c.current().inAssignment=!0},1),c.current().inAssignment=!1;break;case N.ArrayExpression:l=[],d(e.elements,function(t){c.recurse(t,e.constant?void 0:c.nextId(),void 0,function(e){l.push(e)})}),u=`[`+l.join(`,`)+`]`,this.assign(t,u),r(t||u);break;case N.ObjectExpression:l=[],f=!1,d(e.properties,function(e){e.computed&&(f=!0)}),f?(t=t||this.nextId(),this.assign(t,`{}`),d(e.properties,function(e){e.computed?(o=c.nextId(),c.recurse(e.key,o)):o=e.key.type===N.Identifier?e.key.name:``+e.key.value,s=c.nextId(),c.recurse(e.value,s),c.assign(c.unsafeMember(t,o,e.computed),s)})):(d(e.properties,function(t){c.recurse(t.value,e.constant?void 0:c.nextId(),void 0,function(e){l.push(c.escape(t.key.type===N.Identifier?t.key.name:``+t.key.value)+`:`+e)})}),u=`{`+l.join(`,`)+`}`,this.assign(t,u)),r(t||u);break;case N.ThisExpression:this.assign(t,`s`),r(t||`s`);break;case N.LocalsExpression:this.assign(t,`l`),r(t||`l`);break;case N.NGValueParameter:this.assign(t,`v`),r(t||`v`);break}},getHasOwnProperty:function(e,t){var n=e+`.`+t,r=this.current().own;return r.hasOwnProperty(n)||(r[n]=this.nextId(!1,e+`&&(`+this.escape(t)+` in `+e+`)`)),r[n]},assign:function(e,t){if(e)return this.current().body.push(e,`=`,t,`;`),e},filter:function(e){return n.call(this.state.filters,e)||(this.state.filters[e]=this.nextId(!0)),this.state.filters[e]},ifDefined:function(e,t){return`ifDefined(`+e+`,`+this.escape(t)+`)`},plus:function(e,t){return`plus(`+e+`,`+t+`)`},return_:function(e){this.current().body.push(`return `,e,`;`)},if_:function(e,t,n){if(e===!0)t();else{var r=this.current().body;r.push(`if(`,e,`){`),t(),r.push(`}`),n&&(r.push(`else{`),n(),r.push(`}`))}},or_:function(e,t){return`(`+e+`) || (`+t+`)`},hasOwnProperty_:function(e,t,n){return n?`(Object.prototype.hasOwnProperty.call(`+e+`,`+t+`))`:`(Object.prototype.hasOwnProperty.call(`+e+`,'`+t+`'))`},and_:function(e,t){return`(`+e+`) && (`+t+`)`},not:function(e){return`!(`+e+`)`},isNull:function(e){return e+`==null`},notNull:function(e){return e+`!=null`},nonComputedMember:function(e,t){var n=/^[$_a-zA-Z][$_a-zA-Z0-9]*$/,r=/[^$_a-zA-Z0-9]/g,i=``;return n.test(t)?i=e+`.`+t:(t=t.replace(r,this.stringEscapeFn),i=e+`["`+t+`"]`),i},unsafeComputedMember:function(e,t){return e+`[`+t+`]`},unsafeNonComputedMember:function(e,t){return this.nonComputedMember(e,t)},computedMember:function(e,t){return this.state.computing===`assign`?this.unsafeComputedMember(e,t):`(`+e+`.hasOwnProperty(`+t+`) ? `+e+`[`+t+`] : undefined)`},unsafeMember:function(e,t,n){return n?this.unsafeComputedMember(e,t):this.unsafeNonComputedMember(e,t)},member:function(e,t,n){return n?this.computedMember(e,t):this.nonComputedMember(e,t)},getStringValue:function(e){this.assign(e,`getStringValue(`+e+`)`)},lazyRecurse:function(e,t,n,r,i,a){var o=this;return function(){o.recurse(e,t,n,r,i,a)}},lazyAssign:function(e,t){var n=this;return function(){n.assign(e,t)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(e){return`\\u`+(`0000`+e.charCodeAt(0).toString(16)).slice(-4)},escape:function(e){if(v(e))return`'`+e.replace(this.stringEscapeRegex,this.stringEscapeFn)+`'`;if(y(e))return e.toString();if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e===void 0)return`undefined`;throw k(`esc`,`IMPOSSIBLE`)},nextId:function(e,t){var n=`v`+ this.state.nextId++;return e||this.current().vars.push(n+(t?`=`+t:``)),n},current:function(){return this.state[this.state.computing]}};function se(e,t){this.astBuilder=e,this.$filter=t}se.prototype={compile:function(e){var t=this,n=this.astBuilder.ast(e);I(n,t.$filter);var r,i;(r=L(n))&&(i=this.recurse(r));var o=ae(n.body),s;o&&(s=[],d(o,function(e,n){var r=t.recurse(e);e.input=r,s.push(r),e.watchId=n}));var c=[];d(n.body,function(e){c.push(t.recurse(e.expression))});var l=n.body.length===0?p:n.body.length===1?c[0]:function(e,t){var n;return d(c,function(r){n=r(e,t)}),n};i&&(l.assign=function(e,t,n){return i(e,n,t)});var u=function(e,t){return a(function(){return l(e,t)})};return u.assign=function(e,t,n){return a(function(){return l.assign(e,t,n)})},s&&(u.inputs=s),u.ast=n,u.literal=R(n),u.constant=z(n),u},recurse:function(e,t,n){var r,i,a=this,o;if(e.input)return this.inputs(e.input,e.watchId);switch(e.type){case N.Literal:return this.value(e.value,t);case N.UnaryExpression:return i=this.recurse(e.argument),this[`unary`+e.operator](i,t);case N.BinaryExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this[`binary`+e.operator](r,i,t);case N.LogicalExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this[`binary`+e.operator](r,i,t);case N.ConditionalExpression:return this[`ternary?:`](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case N.Identifier:return a.identifier(e.name,t,n);case N.MemberExpression:return r=this.recurse(e.object,!1,!!n),e.computed||(i=e.property.name),e.computed&&(i=this.recurse(e.property)),e.computed?this.computedMember(r,i,t,n):this.nonComputedMember(r,i,t,n);case N.CallExpression:return o=[],d(e.arguments,function(e){o.push(a.recurse(e))}),e.filter&&(i=this.$filter(e.callee.name)),e.filter||(i=this.recurse(e.callee,!0)),e.filter?function(e,n,r,a){for(var s=[],c=0;c<o.length;++c)s.push(o[c](e,n,r,a));var l=i.apply(void 0,s,a);return t?{context:void 0,name:void 0,value:l}:l}:function(e,n,r,a){var s=i(e,n,r,a),c;if(s.value!=null){for(var l=[],u=0;u<o.length;++u)l.push(o[u](e,n,r,a));c=s.value.apply(s.context,l)}return t?{value:c}:c};case N.AssignmentExpression:return r=this.recurse(e.left,!0,1),i=this.recurse(e.right),function(e,n,a,o){var s=r(e,!1,a,o),c=i(e,n,a,o);return s.context[s.name]=c,t?{value:c}:c};case N.ArrayExpression:return o=[],d(e.elements,function(e){o.push(a.recurse(e))}),function(e,n,r,i){for(var a=[],s=0;s<o.length;++s)a.push(o[s](e,n,r,i));return t?{value:a}:a};case N.ObjectExpression:return o=[],d(e.properties,function(e){e.computed?o.push({key:a.recurse(e.key),computed:!0,value:a.recurse(e.value)}):o.push({key:e.key.type===N.Identifier?e.key.name:``+e.key.value,computed:!1,value:a.recurse(e.value)})}),function(e,n,r,i){for(var a={},s=0;s<o.length;++s)o[s].computed?a[o[s].key(e,n,r,i)]=o[s].value(e,n,r,i):a[o[s].key]=o[s].value(e,n,r,i);return t?{value:a}:a};case N.ThisExpression:return function(e){return t?{value:e}:e};case N.LocalsExpression:return function(e,n){return t?{value:n}:n};case N.NGValueParameter:return function(e,n,r){return t?{value:r}:r}}},"unary+":function(e,t){return function(n,r,i,a){var o=e(n,r,i,a);return o=h(o)?+o:0,t?{value:o}:o}},"unary-":function(e,t){return function(n,r,i,a){var o=e(n,r,i,a);return o=h(o)?-o:-0,t?{value:o}:o}},"unary!":function(e,t){return function(n,r,i,a){var o=!e(n,r,i,a);return t?{value:o}:o}},"binary+":function(e,t,n){return function(r,i,a,o){var s=P(e(r,i,a,o),t(r,i,a,o));return n?{value:s}:s}},"binary-":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o),c=t(r,i,a,o),l=(h(s)?s:0)-(h(c)?c:0);return n?{value:l}:l}},"binary*":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)*t(r,i,a,o);return n?{value:s}:s}},"binary/":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)/t(r,i,a,o);return n?{value:s}:s}},"binary%":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)%t(r,i,a,o);return n?{value:s}:s}},"binary===":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)===t(r,i,a,o);return n?{value:s}:s}},"binary!==":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)!==t(r,i,a,o);return n?{value:s}:s}},"binary==":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)==t(r,i,a,o);return n?{value:s}:s}},"binary!=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)!=t(r,i,a,o);return n?{value:s}:s}},"binary<":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)<t(r,i,a,o);return n?{value:s}:s}},"binary>":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)>t(r,i,a,o);return n?{value:s}:s}},"binary<=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)<=t(r,i,a,o);return n?{value:s}:s}},"binary>=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)>=t(r,i,a,o);return n?{value:s}:s}},"binary&&":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)&&t(r,i,a,o);return n?{value:s}:s}},"binary||":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)||t(r,i,a,o);return n?{value:s}:s}},"binary??":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o),c=s!=null&&s!==void 0?s:t(r,i,a,o);return n?{value:c}:c}},"ternary?:":function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s)?t(i,a,o,s):n(i,a,o,s);return r?{value:c}:c}},value:function(e,t){return function(){return t?{context:void 0,name:void 0,value:e}:e}},identifier:function(e,t,r){return function(i,a){var o=a&&e in a?a:i;r&&r!==1&&o&&o[e]==null&&(o[e]={});var s;return o&&n.call(o,e)&&(s=o?o[e]:void 0),t?{context:o,name:e,value:s}:s}},computedMember:function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s),l,u;return c!=null&&(l=t(i,a,o,s),l=A(l),r&&r!==1&&c&&!c[l]&&(c[l]={}),Object.prototype.hasOwnProperty.call(c,l)&&(u=c[l])),n?{context:c,name:l,value:u}:u}},nonComputedMember:function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s);r&&r!==1&&c&&c[t]==null&&(c[t]={});var l=void 0;return c!=null&&Object.prototype.hasOwnProperty.call(c,t)&&(l=c[t]),n?{context:c,name:t,value:l}:l}},inputs:function(e,t){return function(n,r,i,a){return a?a[t]:e(n,r,i)}}};var V=function(e,t,n){this.lexer=e,this.$filter=t,n=n||{},n.handleThis=n.handleThis==null?!0:n.handleThis,this.options=n,this.ast=new N(e,n),this.ast.selfReferential={$locals:{type:N.LocalsExpression}},n.handleThis&&(this.ast.selfReferential.this={type:N.ThisExpression}),this.astCompiler=n.csp?new se(this.ast,t):new B(this.ast,t)};V.prototype={constructor:V,parse:function(e){return this.astCompiler.compile(e)}},e.Lexer=M,e.Parser=V})),ve=e.t((e=>{var t=_e(),n={},r=t.Lexer,i=t.Parser;function a(e){return e=e||{},e.filters&&(e.cache=e.cache||{}),e.cache=e.cache||s.cache,e.filters=e.filters||n,e}function o(e){return{handleThis:e.handleThis==null?!0:e.handleThis,csp:e.csp==null?!1:e.csp,literals:e.literals==null?{true:!0,false:!1,null:null,undefined:void 0}:e.literals}}function s(e,t){if(typeof e!=`string`)throw TypeError(`src must be a string, instead saw '`+typeof e+`'`);t=a(t);var n=t,s=o(t),c=new i(new r(n),function(e){return t.filters[e]},s);if(!t.cache)return c.parse(e);delete t.src;var l=JSON.stringify(Object.assign({src:e},t)),u=t.cache[l];return u||(u=t.cache[l]=c.parse(e)),u}s.cache=Object.create(null),e.compile=s}))();const ye=(e,t)=>{let n=[];e!==void 0&&!Array.isArray(e)&&n.push(`deeds is not an array, the host ignores it`);let r=[];for(let[i,a]of(Array.isArray(e)?e:[]).entries()){if(a==null||typeof a.id!=`string`){n.push(`deed ${i} has no string id, the host drops it`);continue}if(t===`checkpoint`){r.push({id:a.id,value:a.value});continue}a.value===void 0||a.value===null||r.push({id:a.id,value:typeof a.value==`number`?Math.floor(a.value):a.value,persist:a.persist===!0})}if(t===`checkpoint`)return{deeds:r,warnings:n};let i=r.filter(e=>e.persist),a=r.filter(e=>!e.persist),o=i.splice(3);return o.length&&n.push(`only 3 persisted deeds are kept, dropped: ${o.map(e=>e.id).join(`, `)}`),{deeds:[...i,...a].map(({id:e,value:t})=>({id:e,value:t})),warnings:n}},be=e=>{let t={};for(let n of e)n.value!==void 0&&(t[Ce(n.id)]=n.value);return t},xe=(e,t)=>{try{if(e.filterExp&&!(0,ve.compile)(e.filterExp)(t)||!e.incrementExp)return{complete:!1,value:0};let n=(0,ve.compile)(e.incrementExp)(t);if(typeof n==`boolean`&&(n=n?1:0),n===void 0&&(n=0),typeof n!=`number`||isNaN(n))throw Error(`incrementExp must return a number, undefined or boolean, got ${n}`);let r=Math.floor(n);return{complete:r>=(e.targetCount||1),value:r}}catch(e){return{complete:!1,value:0,error:e.message}}},Se=e=>{let{items:t,scope:n,mode:r}=e,i=Math.min(Math.max(e.index,0),t.length),a;for(;i<t.length&&(a=xe(t[i],n),!(!a.complete||r===`checkpoint`&&!t[i].liveUpdate));i++);return{index:i,head:i<t.length?a:void 0}};var Ce=e=>e.replace(/-./g,e=>e[1].toUpperCase());function we(e){let t=new Map,n=new Set,r=null,i=0,a,o=[],s=e=>{var t;return`simulator-checklist:${(t=r)==null?`game`:t}:${e}`},c=e=>{try{let t=Number(localStorage.getItem(s(e.stableID)))||0;return Math.min(Math.max(t,0),e.items.length)}catch(e){return 0}},l=(e,t)=>{try{t===0?localStorage.removeItem(s(e)):localStorage.setItem(s(e),String(t))}catch(e){}},u=(e,t,r,i)=>{var a;let o=r<i.index?`done`:r===i.index?`active`:`upcoming`,s=`${e.stableID}:${r}`,c=n.has(s),l=!!t.expandMD&&o!==`done`,u=t.targetCount||1,d=o===`active`&&i.head?`${Math.min(i.head.value,u)}/${u}`:``,f=[t.incrementExp&&`increment: ${t.incrementExp}`,t.filterExp&&`filter: ${t.filterExp}`,`target: ${u}`,t.liveUpdate?`liveUpdate: checkpoints + completion`:`completion only`].filter(Boolean).join(`
|
|
163
|
+
`},bind(t){let n=t.getElement(`#simulator-checkpoints-clear`),i=t.getElement(`#simulator-checkpoints-list`);n==null||n.addEventListener(`click`,()=>{e=[],i&&(i.innerHTML=r()),t.updateBadge(`checkpoints`,0)})},onMessage(n,i,a){if(n!==`HIT_CHECKPOINT`)return;let o={checkpointName:i.checkpointName,augConfig:i.augConfig,time:t()};e.push(o),a.updateBadge(`checkpoints`,e.length);let s=a.getElement(`#simulator-checkpoints-list`);s&&(s.innerHTML=r(),s.scrollTop=s.scrollHeight)}}}var _e=e.t((e=>{var t={document:{}},n=Object.prototype.hasOwnProperty,r=function(e){return v(e)?e.toLowerCase():e},i=Array.isArray;function a(e){var t=Function.prototype.constructor;delete Function.prototype.constructor;var n=e();return Function.prototype.constructor=t,n}var o,s=Object.prototype.toString,c=Object.getPrototypeOf,l=O(`ng`);function u(e){if(e==null||x(e))return!1;if(i(e)||v(e)||o&&e instanceof o)return!0;var t=`length`in Object(e)&&e.length;return y(t)&&(t>=0&&(t-1 in e||e instanceof Array)||typeof e.item==`function`)}function d(e,t,r){var a,o;if(e)if(b(e))for(a in e)a!==`prototype`&&a!==`length`&&a!==`name`&&e.hasOwnProperty(a)&&t.call(r,e[a],a,e);else if(i(e)||u(e)){var s=typeof e!=`object`;for(a=0,o=e.length;a<o;a++)(s||a in e)&&t.call(r,e[a],a,e)}else if(e.forEach&&e.forEach!==d)e.forEach(t,r,e);else if(_(e))for(a in e)t.call(r,e[a],a,e);else if(typeof e.hasOwnProperty==`function`)for(a in e)e.hasOwnProperty(a)&&t.call(r,e[a],a,e);else for(a in e)n.call(e,a)&&t.call(r,e[a],a,e);return e}function f(e,t){t?e.$$hashKey=t:delete e.$$hashKey}function p(){}function m(e){return e===void 0}function h(e){return e!==void 0}function g(e){return typeof e==`object`&&!!e}function _(e){return typeof e==`object`&&!!e&&!c(e)}function v(e){return typeof e==`string`}function y(e){return typeof e==`number`}function b(e){return typeof e==`function`}function x(e){return e&&e.window===e}function S(e){return e&&e.$evalAsync&&e.$watch}var C=/^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;function ee(e){return e&&y(e.length)&&C.test(s.call(e))}function w(e){return s.call(e)===`[object ArrayBuffer]`}function T(e,t){var r=[],a=[];if(t){if(ee(t)||w(t))throw l(`cpta`,`Can't copy! TypedArray destination cannot be mutated.`);if(e===t)throw l(`cpi`,`Can't copy! Source and destination are identical.`);return i(t)?t.length=0:d(t,function(e,n){n!==`$$hashKey`&&delete t[n]}),r.push(e),a.push(t),o(e,t)}return u(e);function o(e,t){var r=t.$$hashKey,a;if(i(e))for(var o=0,s=e.length;o<s;o++)t.push(u(e[o]));else if(_(e))for(a in e)t[a]=u(e[a]);else if(e&&typeof e.hasOwnProperty==`function`)for(a in e)e.hasOwnProperty(a)&&(t[a]=u(e[a]));else for(a in e)n.call(e,a)&&(t[a]=u(e[a]));return f(t,r),t}function u(e){if(!g(e))return e;var t=r.indexOf(e);if(t!==-1)return a[t];if(x(e)||S(e))throw l(`cpws`,`Can't copy! Making copies of Window or Scope instances is not supported.`);var n=!1,s=p(e);return s===void 0&&(s=i(e)?[]:Object.create(c(e)),n=!0),r.push(e),a.push(s),n?o(e,s):s}function p(e){switch(s.call(e)){case`[object Int8Array]`:case`[object Int16Array]`:case`[object Int32Array]`:case`[object Float32Array]`:case`[object Float64Array]`:case`[object Uint8Array]`:case`[object Uint8ClampedArray]`:case`[object Uint16Array]`:case`[object Uint32Array]`:return new e.constructor(u(e.buffer),e.byteOffset,e.length);case`[object ArrayBuffer]`:if(!e.slice){var t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}return e.slice(0);case`[object Boolean]`:case`[object Number]`:case`[object String]`:case`[object Date]`:return new e.constructor(e.valueOf());case`[object RegExp]`:var n=new RegExp(e.source,e.toString().match(/[^\/]*$/)[0]);return n.lastIndex=e.lastIndex,n;case`[object Blob]`:return new e.constructor([e],{type:e.type})}if(b(e.cloneNode))return e.cloneNode(!0)}}function te(e,n){var r=n;return typeof e==`string`&&e.charAt(0)===`$`&&e.charAt(1)===`$`?r=void 0:x(n)?r=`$WINDOW`:n&&t.document===n?r=`$DOCUMENT`:S(n)&&(r=`$SCOPE`),r}function ne(){return Object.create(null)}function E(e){var t=[];return JSON.stringify(e,function(e,n){if(n=te(e,n),g(n)){if(t.indexOf(n)>=0)return`...`;t.push(n)}return n})}function D(e){return typeof e==`function`?e.toString().replace(/ \{[\s\S]*$/,``):m(e)?`undefined`:typeof e==`string`?e:E(e)}function O(e,t){return t=t||Error,function(){var n=2,r=arguments,i=r[0],a=`[`+(e?e+`:`:``)+i+`] `,o=r[1],s,c;for(a+=o.replace(/\{\d+\}/g,function(e){var t=+e.slice(1,-1)+n;return t<r.length?D(r[t]):e}),a+=`
|
|
164
|
+
http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.length;c++,s=`&`)a+=s+`p`+(c-n)+`=`+encodeURIComponent(D(r[c]));return new t(a)}}var k=O(`$parse`);function A(e){return e+``}var j=ne();d(`+ - * / % === !== == != < > <= >= && || ?? ! = | ?`.split(` `),function(e){j[e]=!0});var M={n:`
|
|
165
|
+
`,f:`\f`,r:`\r`,t:` `,v:`\v`,"'":`'`,'"':`"`};function N(e){this.options=e||{}}N.prototype={constructor:N,lex:function(e){for(this.text=e,this.index=0,this.tokens=[];this.index<this.text.length;){var t=this.text.charAt(this.index);if(t===`"`||t===`'`||t==="`")this.readString(t);else if(this.isNumber(t)||t===`.`&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdentifierStart(this.peekMultichar()))this.readIdent();else if(this.is(t,`(){}[].,;:`))this.tokens.push({index:this.index,text:t}),this.index++;else if(this.isWhitespace(t))this.index++;else{var n=t+this.peek(),r=n+this.peek(2),i=j[t],a=j[n],o=j[r];if(i||a||o){var s=o?r:a?n:t;this.tokens.push({index:this.index,text:s,operator:!0}),this.index+=s.length}else this.throwError(`Unexpected next character `,this.index,this.index+1)}}return this.tokens},is:function(e,t){return t.indexOf(e)!==-1},peek:function(e){var t=e||1;return this.index+t<this.text.length?this.text.charAt(this.index+t):!1},isNumber:function(e){return e>=`0`&&e<=`9`&&typeof e==`string`},isWhitespace:function(e){return e===` `||e===`\r`||e===` `||e===`
|
|
166
|
+
`||e===`\v`||e===`\xA0`},isIdentifierStart:function(e){return this.options.isIdentifierStart?this.options.isIdentifierStart(e,this.codePointAt(e)):this.isValidIdentifierStart(e)},isValidIdentifierStart:function(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`||e===`$`},isIdentifierContinue:function(e){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(e,this.codePointAt(e)):this.isValidIdentifierContinue(e)},isValidIdentifierContinue:function(e,t){return this.isValidIdentifierStart(e,t)||this.isNumber(e)},codePointAt:function(e){return e.length===1?e.charCodeAt(0):(e.charCodeAt(0)<<10)+e.charCodeAt(1)-56613888},peekMultichar:function(){var e=this.text.charAt(this.index),t=this.peek();if(!t)return e;var n=e.charCodeAt(0),r=t.charCodeAt(0);return n>=55296&&n<=56319&&r>=56320&&r<=57343?e+t:e},isExpOperator:function(e){return e===`-`||e===`+`||this.isNumber(e)},throwError:function(e,t,n){throw n=n||this.index,k(`lexerr`,`Lexer Error: {0} at column{1} in expression [{2}].`,e,h(t)?`s `+t+`-`+this.index+` [`+this.text.substring(t,n)+`]`:` `+n,this.text)},readNumber:function(){for(var e=``,t=this.index;this.index<this.text.length;){var n=r(this.text.charAt(this.index));if(n===`.`||this.isNumber(n))e+=n;else{var i=this.peek();if(n===`e`&&this.isExpOperator(i))e+=n;else if(this.isExpOperator(n)&&i&&this.isNumber(i)&&e.charAt(e.length-1)===`e`)e+=n;else if(this.isExpOperator(n)&&(!i||!this.isNumber(i))&&e.charAt(e.length-1)===`e`)this.throwError(`Invalid exponent`);else break}this.index++}this.tokens.push({index:t,text:e,constant:!0,value:Number(e)})},readIdent:function(){var e=this.index;for(this.index+=this.peekMultichar().length;this.index<this.text.length;){var t=this.peekMultichar();if(!this.isIdentifierContinue(t))break;this.index+=t.length}this.tokens.push({index:e,text:this.text.slice(e,this.index),identifier:!0})},readString:function(e){var t=this.index;this.index++;for(var n=``,r=e,i=e==="`",a=!1;this.index<this.text.length;){var o=this.text.charAt(this.index);if(i&&o===`$`&&this.text.charAt(this.index+1)===`{`){this.tokens.push({index:t,text:r,constant:!0,value:n});var s=this.text.indexOf(`}`,this.index),c=this.text.substr(this.index+2,s-this.index-2);this.tokens.push({index:this.index,text:`+`,operator:!0});for(var l=new N(this.options).lex(c),u=0,d=l.length;u<d;u++)this.tokens.push(l[u]);this.tokens.push({index:this.index,text:`+`,operator:!0}),this.index=s,this.readString("`");return}if(r+=o,a){if(o===`u`){var f=this.text.substring(this.index+1,this.index+5);f.match(/[\da-f]{4}/i)||this.throwError(`Invalid unicode escape [\\u`+f+`]`),this.index+=4,n+=String.fromCharCode(parseInt(f,16))}else{var p=M[o];n+=p||o}a=!1}else if(o===`\\`)a=!0;else if(o===e){this.index++,this.tokens.push({index:t,text:r,constant:!0,value:n});return}else n+=o;this.index++}this.throwError(`Unterminated quote`,t)}};function P(e,t){this.lexer=e,this.options=t}P.Program=`Program`,P.ExpressionStatement=`ExpressionStatement`,P.AssignmentExpression=`AssignmentExpression`,P.ConditionalExpression=`ConditionalExpression`,P.LogicalExpression=`LogicalExpression`,P.BinaryExpression=`BinaryExpression`,P.UnaryExpression=`UnaryExpression`,P.CallExpression=`CallExpression`,P.MemberExpression=`MemberExpression`,P.Identifier=`Identifier`,P.Literal=`Literal`,P.ArrayExpression=`ArrayExpression`,P.Property=`Property`,P.ObjectExpression=`ObjectExpression`,P.ThisExpression=`ThisExpression`,P.LocalsExpression=`LocalsExpression`,P.NGValueParameter=`NGValueParameter`,P.prototype={ast:function(e){this.text=e,this.tokens=this.lexer.lex(e);var t=this.program();return this.tokens.length!==0&&this.throwError(`is an unexpected token`,this.tokens[0]),t},program:function(){for(var e=[];;)if(this.tokens.length>0&&!this.peek(`}`,`)`,`;`,`]`)&&e.push(this.expressionStatement()),!this.expect(`;`))return{type:P.Program,body:e}},expressionStatement:function(){return{type:P.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var e=this.expression();this.expect(`|`);)e=this.filter(e);return e},expression:function(){return this.assignment()},assignment:function(){var e=this.ternary();if(this.expect(`=`)){if(!ae(e))throw k(`lval`,`Trying to assign a value to a non l-value`);e={type:P.AssignmentExpression,left:e,right:this.assignment(),operator:`=`}}return e},ternary:function(){var e=this.nullishCoalescing(),t,n;return this.expect(`?`)&&(t=this.expression(),this.consume(`:`))?(n=this.expression(),{type:P.ConditionalExpression,test:e,alternate:t,consequent:n}):e},nullishCoalescing:function(){for(var e=this.logicalOR();this.expect(`??`);)e={type:P.LogicalExpression,operator:`??`,left:e,right:this.logicalOR()};return e},logicalOR:function(){for(var e=this.logicalAND();this.expect(`||`);)e={type:P.LogicalExpression,operator:`||`,left:e,right:this.logicalAND()};return e},logicalAND:function(){for(var e=this.equality();this.expect(`&&`);)e={type:P.LogicalExpression,operator:`&&`,left:e,right:this.equality()};return e},equality:function(){for(var e=this.relational(),t;t=this.expect(`==`,`!=`,`===`,`!==`);)e={type:P.BinaryExpression,operator:t.text,left:e,right:this.relational()};return e},relational:function(){for(var e=this.additive(),t;t=this.expect(`<`,`>`,`<=`,`>=`);)e={type:P.BinaryExpression,operator:t.text,left:e,right:this.additive()};return e},additive:function(){for(var e=this.multiplicative(),t;t=this.expect(`+`,`-`);)e={type:P.BinaryExpression,operator:t.text,left:e,right:this.multiplicative()};return e},multiplicative:function(){for(var e=this.unary(),t;t=this.expect(`*`,`/`,`%`);)e={type:P.BinaryExpression,operator:t.text,left:e,right:this.unary()};return e},unary:function(){var e;return(e=this.expect(`+`,`-`,`!`))?{type:P.UnaryExpression,operator:e.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var e;this.expect(`(`)?(e=this.filterChain(),this.consume(`)`)):this.expect(`[`)?e=this.arrayDeclaration():this.expect(`{`)?e=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?e=T(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:P.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?e=this.identifier():this.peek().constant?e=this.constant():this.throwError(`not a primary expression`,this.peek());for(var t;t=this.expect(`(`,`[`,`.`);)t.text===`(`?(e={type:P.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(`)`)):t.text===`[`?(e={type:P.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume(`]`)):t.text===`.`?e={type:P.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError(`IMPOSSIBLE`);return e},filter:function(e){for(var t=[e],n={type:P.CallExpression,callee:this.identifier(),arguments:t,filter:!0};this.expect(`:`);)t.push(this.expression());return n},parseArguments:function(){var e=[];if(this.peekToken().text!==`)`)do e.push(this.filterChain());while(this.expect(`,`));return e},identifier:function(){var e=this.consume();return e.identifier||this.throwError(`is not a valid identifier`,e),{type:P.Identifier,name:e.text}},constant:function(){return{type:P.Literal,value:this.consume().value}},arrayDeclaration:function(){var e=[];if(this.peekToken().text!==`]`)do{if(this.peek(`]`))break;e.push(this.expression())}while(this.expect(`,`));return this.consume(`]`),{type:P.ArrayExpression,elements:e}},object:function(){var e=[],t;if(this.peekToken().text!==`}`)do{if(this.peek(`}`))break;t={type:P.Property,kind:`init`},this.peek().constant?(t.key=this.constant(),t.computed=!1,this.consume(`:`),t.value=this.expression()):this.peek().identifier?(t.key=this.identifier(),t.computed=!1,this.peek(`:`)?(this.consume(`:`),t.value=this.expression()):t.value=t.key):this.peek(`[`)?(this.consume(`[`),t.key=this.expression(),this.consume(`]`),t.computed=!0,this.consume(`:`),t.value=this.expression()):this.throwError(`invalid key`,this.peek()),e.push(t)}while(this.expect(`,`));return this.consume(`}`),{type:P.ObjectExpression,properties:e}},throwError:function(e,t){throw k(`syntax`,`Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].`,t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(this.tokens.length===0)throw k(`ueoe`,`Unexpected end of expression: {0}`,this.text);var t=this.expect(e);return t||this.throwError(`is unexpected, expecting [`+e+`]`,this.peek()),t},peekToken:function(){if(this.tokens.length===0)throw k(`ueoe`,`Unexpected end of expression: {0}`,this.text);return this.tokens[0]},peek:function(e,t,n,r){return this.peekAhead(0,e,t,n,r)},peekAhead:function(e,t,n,r,i){if(this.tokens.length>e){var a=this.tokens[e],o=a.text;if(o===t||o===n||o===r||o===i||!t&&!n&&!r&&!i)return a}return!1},expect:function(e,t,n,r){var i=this.peek(e,t,n,r);return i?(this.tokens.shift(),i):!1}};function re(e,t){return e===void 0?t:e}function ie(e,t){return e===void 0?t:t===void 0?e:e+t}function F(e,t){var n=e(t);if(!n)throw Error(`Filter '`+t+`' is not defined`);return!n.$stateful}function I(e,t){var n,r,i;switch(e.type){case P.Program:n=!0,d(e.body,function(e){I(e.expression,t),n=n&&e.expression.constant}),e.constant=n;break;case P.Literal:e.constant=!0,e.toWatch=[];break;case P.UnaryExpression:I(e.argument,t),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case P.BinaryExpression:I(e.left,t),I(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case P.LogicalExpression:I(e.left,t),I(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case P.ConditionalExpression:I(e.test,t),I(e.alternate,t),I(e.consequent,t),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case P.Identifier:e.constant=!1,e.toWatch=[e];break;case P.MemberExpression:I(e.object,t),e.computed&&I(e.property,t),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=[e];break;case P.CallExpression:i=e.filter?F(t,e.callee.name):!1,n=i,r=[],d(e.arguments,function(e){I(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=i?r:[e];break;case P.AssignmentExpression:I(e.left,t),I(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case P.ArrayExpression:n=!0,r=[],d(e.elements,function(e){I(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=r;break;case P.ObjectExpression:n=!0,r=[],d(e.properties,function(e){I(e.value,t),n=n&&e.value.constant&&!e.computed,e.value.constant||r.push.apply(r,e.value.toWatch)}),e.constant=n,e.toWatch=r;break;case P.ThisExpression:e.constant=!1,e.toWatch=[];break;case P.LocalsExpression:e.constant=!1,e.toWatch=[];break}}function L(e){if(e.length===1){var t=e[0].expression,n=t.toWatch;return n.length===1&&n[0]===t?void 0:n}}function ae(e){return e.type===P.Identifier||e.type===P.MemberExpression}function oe(e){if(e.body.length===1&&ae(e.body[0].expression))return{type:P.AssignmentExpression,left:e.body[0].expression,right:{type:P.NGValueParameter},operator:`=`}}function R(e){return e.body.length===0||e.body.length===1&&(e.body[0].expression.type===P.Literal||e.body[0].expression.type===P.ArrayExpression||e.body[0].expression.type===P.ObjectExpression)}function z(e){return e.constant}function B(e,t){this.astBuilder=e,this.$filter=t}B.prototype={compile:function(e){var t=this,n=this.astBuilder.ast(e);this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},I(n,t.$filter);var r=``,i;if(this.stage=`assign`,i=oe(n)){this.state.computing=`assign`;var o=this.nextId();this.recurse(i,o),this.return_(o),r=`fn.assign=`+this.generateFunction(`assign`,`s,v,l`)}var s=L(n.body);t.stage=`inputs`,d(s,function(e,n){var r=`fn`+n;t.state[r]={vars:[],body:[],own:{}},t.state.computing=r;var i=t.nextId();t.recurse(e,i),t.return_(i),t.state.inputs.push(r),e.watchId=n}),this.state.computing=`fn`,this.stage=`main`,this.recurse(n);var c=`"`+this.USE+` `+this.STRICT+`";
|
|
167
|
+
`+this.filterPrefix()+`var fn=`+this.generateFunction(`fn`,`s,l,a,i`)+r+this.watchFns()+`return fn;`,l=Function(`$filter`,`getStringValue`,`ifDefined`,`plus`,c)(this.$filter,A,re,ie),u=function(e,t,n,r){return a(function(){return l(e,t,n,r)})};return u.assign=function(e,t,n){return a(function(){return l.assign(e,t,n)})},u.inputs=l.inputs,this.state=this.stage=void 0,u.ast=n,u.literal=R(n),u.constant=z(n),u},USE:`use`,STRICT:`strict`,watchFns:function(){var e=[],t=this.state.inputs,n=this;return d(t,function(t){e.push(`var `+t+`=`+n.generateFunction(t,`s`))}),t.length&&e.push(`fn.inputs=[`+t.join(`,`)+`];`),e.join(``)},generateFunction:function(e,t){return`function(`+t+`){`+this.varsPrefix(e)+this.body(e)+`};`},filterPrefix:function(){var e=[],t=this;return d(this.state.filters,function(n,r){e.push(n+`=$filter(`+t.escape(r)+`)`)}),e.length?`var `+e.join(`,`)+`;`:``},varsPrefix:function(e){return this.state[e].vars.length?`var `+this.state[e].vars.join(`,`)+`;`:``},body:function(e){return this.state[e].body.join(``)},recurse:function(e,t,n,r,i,a){var o,s,c=this,l,u,f;if(r=r||p,!a&&h(e.watchId)){t=t||this.nextId(),this.if_(`i`,this.lazyAssign(t,this.unsafeComputedMember(`i`,e.watchId)),this.lazyRecurse(e,t,n,r,i,!0));return}switch(e.type){case P.Program:d(e.body,function(t,n){c.recurse(t.expression,void 0,void 0,function(e){s=e}),n===e.body.length-1?c.return_(s):c.current().body.push(s,`;`)});break;case P.Literal:u=this.escape(e.value),this.assign(t,u),r(t||u);break;case P.UnaryExpression:this.recurse(e.argument,void 0,void 0,function(e){s=e}),u=e.operator+`(`+this.ifDefined(s,0)+`)`,this.assign(t,u),r(u);break;case P.BinaryExpression:this.recurse(e.left,void 0,void 0,function(e){o=e}),this.recurse(e.right,void 0,void 0,function(e){s=e}),u=e.operator===`+`?this.plus(o,s):e.operator===`-`?this.ifDefined(o,0)+e.operator+this.ifDefined(s,0):`(`+o+`)`+e.operator+`(`+s+`)`,this.assign(t,u),r(u);break;case P.LogicalExpression:t=t||this.nextId(),c.recurse(e.left,t),e.operator===`??`?c.if_(c.or_(c.isNull(t),`typeof `+t+` === 'undefined'`),c.lazyRecurse(e.right,t)):c.if_(e.operator===`&&`?t:c.not(t),c.lazyRecurse(e.right,t)),r(t);break;case P.ConditionalExpression:t=t||this.nextId(),c.recurse(e.test,t),c.if_(t,c.lazyRecurse(e.alternate,t),c.lazyRecurse(e.consequent,t)),r(t);break;case P.Identifier:t=t||this.nextId();var m=c.current().inAssignment;n&&(m?n.context=this.assign(this.nextId(),`s`):n.context=c.stage===`inputs`?`s`:this.assign(this.nextId(),this.getHasOwnProperty(`l`,e.name)+`?l:s`),n.computed=!1,n.name=e.name),c.if_(c.stage===`inputs`||c.not(c.getHasOwnProperty(`l`,e.name)),function(){c.if_(c.stage===`inputs`||`s`,function(){var n=c.nextId();c.assign(n,c.nonComputedMember(`s`,e.name)),c.if_(c.or_(c.isNull(n),c.hasOwnProperty_(`s`,e.name)),function(){i&&i!==1?(c.if_(c.isNull(n),c.lazyAssign(c.nonComputedMember(`s`,e.name),`{}`)),c.assign(t,c.nonComputedMember(`s`,e.name))):c.assign(t,n)})})},t&&function(){c.if_(c.hasOwnProperty_(`l`,e.name),c.lazyAssign(t,c.nonComputedMember(`l`,e.name)))}),r(t);break;case P.MemberExpression:o=n&&(n.context=this.nextId())||this.nextId(),t=t||this.nextId(),c.recurse(e.object,o,void 0,function(){var a=null,l=c.current().inAssignment;e.computed?(s=c.nextId(),a=l||c.state.computing===`assign`?c.unsafeComputedMember(o,s):c.computedMember(o,s)):(a=l||c.state.computing===`assign`?c.unsafeNonComputedMember(o,e.property.name):c.nonComputedMember(o,e.property.name),s=e.property.name),e.computed&&e.property.type===P.Literal&&c.recurse(e.property,s),c.if_(c.and_(c.notNull(o),c.or_(c.isNull(a),c.hasOwnProperty_(o,s,e.computed))),function(){e.computed?(e.property.type!==P.Literal&&c.recurse(e.property,s),i&&i!==1&&c.if_(c.not(a),c.lazyAssign(a,`{}`)),c.assign(t,a),n&&(n.computed=!0,n.name=s)):(i&&i!==1&&c.if_(c.isNull(a),c.lazyAssign(a,`{}`)),c.assign(t,a),n&&(n.computed=!1,n.name=e.property.name))},function(){c.assign(t,`undefined`)}),r(t)},!!i);break;case P.CallExpression:t=t||this.nextId(),e.filter?(s=c.filter(e.callee.name),l=[],d(e.arguments,function(e){var t=c.nextId();c.recurse(e,t),l.push(t)}),u=s+`.call(`+s+`,`+l.join(`,`)+`)`,c.assign(t,u),r(t)):(s=c.nextId(),o={},l=[],c.recurse(e.callee,s,o,function(){c.if_(c.notNull(s),function(){d(e.arguments,function(t){c.recurse(t,e.constant?void 0:c.nextId(),void 0,function(e){l.push(e)})}),u=o.name?`(`+c.member(o.context,o.name,o.computed)+` === null ? null : `+c.unsafeMember(o.context,o.name,o.computed)+`.call(`+[o.context].concat(l).join(`,`)+`))`:s+`(`+l.join(`,`)+`)`,c.assign(t,u)},function(){c.assign(t,`undefined`)}),r(t)}));break;case P.AssignmentExpression:s=this.nextId(),o={},c.current().inAssignment=!0,this.recurse(e.left,void 0,o,function(){c.if_(c.and_(c.notNull(o.context),c.or_(c.hasOwnProperty_(o.context,o.name),c.isNull(c.member(o.context,o.name,o.computed)))),function(){c.recurse(e.right,s),u=c.member(o.context,o.name,o.computed)+e.operator+s,c.assign(t,u),r(t||u)}),c.current().inAssignment=!1,c.recurse(e.right,s),c.current().inAssignment=!0},1),c.current().inAssignment=!1;break;case P.ArrayExpression:l=[],d(e.elements,function(t){c.recurse(t,e.constant?void 0:c.nextId(),void 0,function(e){l.push(e)})}),u=`[`+l.join(`,`)+`]`,this.assign(t,u),r(t||u);break;case P.ObjectExpression:l=[],f=!1,d(e.properties,function(e){e.computed&&(f=!0)}),f?(t=t||this.nextId(),this.assign(t,`{}`),d(e.properties,function(e){e.computed?(o=c.nextId(),c.recurse(e.key,o)):o=e.key.type===P.Identifier?e.key.name:``+e.key.value,s=c.nextId(),c.recurse(e.value,s),c.assign(c.unsafeMember(t,o,e.computed),s)})):(d(e.properties,function(t){c.recurse(t.value,e.constant?void 0:c.nextId(),void 0,function(e){l.push(c.escape(t.key.type===P.Identifier?t.key.name:``+t.key.value)+`:`+e)})}),u=`{`+l.join(`,`)+`}`,this.assign(t,u)),r(t||u);break;case P.ThisExpression:this.assign(t,`s`),r(t||`s`);break;case P.LocalsExpression:this.assign(t,`l`),r(t||`l`);break;case P.NGValueParameter:this.assign(t,`v`),r(t||`v`);break}},getHasOwnProperty:function(e,t){var n=e+`.`+t,r=this.current().own;return r.hasOwnProperty(n)||(r[n]=this.nextId(!1,e+`&&(`+this.escape(t)+` in `+e+`)`)),r[n]},assign:function(e,t){if(e)return this.current().body.push(e,`=`,t,`;`),e},filter:function(e){return n.call(this.state.filters,e)||(this.state.filters[e]=this.nextId(!0)),this.state.filters[e]},ifDefined:function(e,t){return`ifDefined(`+e+`,`+this.escape(t)+`)`},plus:function(e,t){return`plus(`+e+`,`+t+`)`},return_:function(e){this.current().body.push(`return `,e,`;`)},if_:function(e,t,n){if(e===!0)t();else{var r=this.current().body;r.push(`if(`,e,`){`),t(),r.push(`}`),n&&(r.push(`else{`),n(),r.push(`}`))}},or_:function(e,t){return`(`+e+`) || (`+t+`)`},hasOwnProperty_:function(e,t,n){return n?`(Object.prototype.hasOwnProperty.call(`+e+`,`+t+`))`:`(Object.prototype.hasOwnProperty.call(`+e+`,'`+t+`'))`},and_:function(e,t){return`(`+e+`) && (`+t+`)`},not:function(e){return`!(`+e+`)`},isNull:function(e){return e+`==null`},notNull:function(e){return e+`!=null`},nonComputedMember:function(e,t){var n=/^[$_a-zA-Z][$_a-zA-Z0-9]*$/,r=/[^$_a-zA-Z0-9]/g,i=``;return n.test(t)?i=e+`.`+t:(t=t.replace(r,this.stringEscapeFn),i=e+`["`+t+`"]`),i},unsafeComputedMember:function(e,t){return e+`[`+t+`]`},unsafeNonComputedMember:function(e,t){return this.nonComputedMember(e,t)},computedMember:function(e,t){return this.state.computing===`assign`?this.unsafeComputedMember(e,t):`(`+e+`.hasOwnProperty(`+t+`) ? `+e+`[`+t+`] : undefined)`},unsafeMember:function(e,t,n){return n?this.unsafeComputedMember(e,t):this.unsafeNonComputedMember(e,t)},member:function(e,t,n){return n?this.computedMember(e,t):this.nonComputedMember(e,t)},getStringValue:function(e){this.assign(e,`getStringValue(`+e+`)`)},lazyRecurse:function(e,t,n,r,i,a){var o=this;return function(){o.recurse(e,t,n,r,i,a)}},lazyAssign:function(e,t){var n=this;return function(){n.assign(e,t)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(e){return`\\u`+(`0000`+e.charCodeAt(0).toString(16)).slice(-4)},escape:function(e){if(v(e))return`'`+e.replace(this.stringEscapeRegex,this.stringEscapeFn)+`'`;if(y(e))return e.toString();if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e===void 0)return`undefined`;throw k(`esc`,`IMPOSSIBLE`)},nextId:function(e,t){var n=`v`+ this.state.nextId++;return e||this.current().vars.push(n+(t?`=`+t:``)),n},current:function(){return this.state[this.state.computing]}};function se(e,t){this.astBuilder=e,this.$filter=t}se.prototype={compile:function(e){var t=this,n=this.astBuilder.ast(e);I(n,t.$filter);var r,i;(r=oe(n))&&(i=this.recurse(r));var o=L(n.body),s;o&&(s=[],d(o,function(e,n){var r=t.recurse(e);e.input=r,s.push(r),e.watchId=n}));var c=[];d(n.body,function(e){c.push(t.recurse(e.expression))});var l=n.body.length===0?p:n.body.length===1?c[0]:function(e,t){var n;return d(c,function(r){n=r(e,t)}),n};i&&(l.assign=function(e,t,n){return i(e,n,t)});var u=function(e,t){return a(function(){return l(e,t)})};return u.assign=function(e,t,n){return a(function(){return l.assign(e,t,n)})},s&&(u.inputs=s),u.ast=n,u.literal=R(n),u.constant=z(n),u},recurse:function(e,t,n){var r,i,a=this,o;if(e.input)return this.inputs(e.input,e.watchId);switch(e.type){case P.Literal:return this.value(e.value,t);case P.UnaryExpression:return i=this.recurse(e.argument),this[`unary`+e.operator](i,t);case P.BinaryExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this[`binary`+e.operator](r,i,t);case P.LogicalExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this[`binary`+e.operator](r,i,t);case P.ConditionalExpression:return this[`ternary?:`](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case P.Identifier:return a.identifier(e.name,t,n);case P.MemberExpression:return r=this.recurse(e.object,!1,!!n),e.computed||(i=e.property.name),e.computed&&(i=this.recurse(e.property)),e.computed?this.computedMember(r,i,t,n):this.nonComputedMember(r,i,t,n);case P.CallExpression:return o=[],d(e.arguments,function(e){o.push(a.recurse(e))}),e.filter&&(i=this.$filter(e.callee.name)),e.filter||(i=this.recurse(e.callee,!0)),e.filter?function(e,n,r,a){for(var s=[],c=0;c<o.length;++c)s.push(o[c](e,n,r,a));var l=i.apply(void 0,s,a);return t?{context:void 0,name:void 0,value:l}:l}:function(e,n,r,a){var s=i(e,n,r,a),c;if(s.value!=null){for(var l=[],u=0;u<o.length;++u)l.push(o[u](e,n,r,a));c=s.value.apply(s.context,l)}return t?{value:c}:c};case P.AssignmentExpression:return r=this.recurse(e.left,!0,1),i=this.recurse(e.right),function(e,n,a,o){var s=r(e,!1,a,o),c=i(e,n,a,o);return s.context[s.name]=c,t?{value:c}:c};case P.ArrayExpression:return o=[],d(e.elements,function(e){o.push(a.recurse(e))}),function(e,n,r,i){for(var a=[],s=0;s<o.length;++s)a.push(o[s](e,n,r,i));return t?{value:a}:a};case P.ObjectExpression:return o=[],d(e.properties,function(e){e.computed?o.push({key:a.recurse(e.key),computed:!0,value:a.recurse(e.value)}):o.push({key:e.key.type===P.Identifier?e.key.name:``+e.key.value,computed:!1,value:a.recurse(e.value)})}),function(e,n,r,i){for(var a={},s=0;s<o.length;++s)o[s].computed?a[o[s].key(e,n,r,i)]=o[s].value(e,n,r,i):a[o[s].key]=o[s].value(e,n,r,i);return t?{value:a}:a};case P.ThisExpression:return function(e){return t?{value:e}:e};case P.LocalsExpression:return function(e,n){return t?{value:n}:n};case P.NGValueParameter:return function(e,n,r){return t?{value:r}:r}}},"unary+":function(e,t){return function(n,r,i,a){var o=e(n,r,i,a);return o=h(o)?+o:0,t?{value:o}:o}},"unary-":function(e,t){return function(n,r,i,a){var o=e(n,r,i,a);return o=h(o)?-o:-0,t?{value:o}:o}},"unary!":function(e,t){return function(n,r,i,a){var o=!e(n,r,i,a);return t?{value:o}:o}},"binary+":function(e,t,n){return function(r,i,a,o){var s=ie(e(r,i,a,o),t(r,i,a,o));return n?{value:s}:s}},"binary-":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o),c=t(r,i,a,o),l=(h(s)?s:0)-(h(c)?c:0);return n?{value:l}:l}},"binary*":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)*t(r,i,a,o);return n?{value:s}:s}},"binary/":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)/t(r,i,a,o);return n?{value:s}:s}},"binary%":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)%t(r,i,a,o);return n?{value:s}:s}},"binary===":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)===t(r,i,a,o);return n?{value:s}:s}},"binary!==":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)!==t(r,i,a,o);return n?{value:s}:s}},"binary==":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)==t(r,i,a,o);return n?{value:s}:s}},"binary!=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)!=t(r,i,a,o);return n?{value:s}:s}},"binary<":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)<t(r,i,a,o);return n?{value:s}:s}},"binary>":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)>t(r,i,a,o);return n?{value:s}:s}},"binary<=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)<=t(r,i,a,o);return n?{value:s}:s}},"binary>=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)>=t(r,i,a,o);return n?{value:s}:s}},"binary&&":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)&&t(r,i,a,o);return n?{value:s}:s}},"binary||":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)||t(r,i,a,o);return n?{value:s}:s}},"binary??":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o),c=s!=null&&s!==void 0?s:t(r,i,a,o);return n?{value:c}:c}},"ternary?:":function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s)?t(i,a,o,s):n(i,a,o,s);return r?{value:c}:c}},value:function(e,t){return function(){return t?{context:void 0,name:void 0,value:e}:e}},identifier:function(e,t,r){return function(i,a){var o=a&&e in a?a:i;r&&r!==1&&o&&o[e]==null&&(o[e]={});var s;return o&&n.call(o,e)&&(s=o?o[e]:void 0),t?{context:o,name:e,value:s}:s}},computedMember:function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s),l,u;return c!=null&&(l=t(i,a,o,s),l=A(l),r&&r!==1&&c&&!c[l]&&(c[l]={}),Object.prototype.hasOwnProperty.call(c,l)&&(u=c[l])),n?{context:c,name:l,value:u}:u}},nonComputedMember:function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s);r&&r!==1&&c&&c[t]==null&&(c[t]={});var l=void 0;return c!=null&&Object.prototype.hasOwnProperty.call(c,t)&&(l=c[t]),n?{context:c,name:t,value:l}:l}},inputs:function(e,t){return function(n,r,i,a){return a?a[t]:e(n,r,i)}}};var V=function(e,t,n){this.lexer=e,this.$filter=t,n=n||{},n.handleThis=n.handleThis==null?!0:n.handleThis,this.options=n,this.ast=new P(e,n),this.ast.selfReferential={$locals:{type:P.LocalsExpression}},n.handleThis&&(this.ast.selfReferential.this={type:P.ThisExpression}),this.astCompiler=n.csp?new se(this.ast,t):new B(this.ast,t)};V.prototype={constructor:V,parse:function(e){return this.astCompiler.compile(e)}},e.Lexer=N,e.Parser=V})),ve=e.t((e=>{var t=_e(),n={},r=t.Lexer,i=t.Parser;function a(e){return e=e||{},e.filters&&(e.cache=e.cache||{}),e.cache=e.cache||s.cache,e.filters=e.filters||n,e}function o(e){return{handleThis:e.handleThis==null?!0:e.handleThis,csp:e.csp==null?!1:e.csp,literals:e.literals==null?{true:!0,false:!1,null:null,undefined:void 0}:e.literals}}function s(e,t){if(typeof e!=`string`)throw TypeError(`src must be a string, instead saw '`+typeof e+`'`);t=a(t);var n=t,s=o(t),c=new i(new r(n),function(e){return t.filters[e]},s);if(!t.cache)return c.parse(e);delete t.src;var l=JSON.stringify(Object.assign({src:e},t)),u=t.cache[l];return u||(u=t.cache[l]=c.parse(e)),u}s.cache=Object.create(null),e.compile=s}))();const ye=(e,t)=>{let n=[];e!==void 0&&!Array.isArray(e)&&n.push(`deeds is not an array, the host ignores it`);let r=[];for(let[i,a]of(Array.isArray(e)?e:[]).entries()){if(a==null||typeof a.id!=`string`){n.push(`deed ${i} has no string id, the host drops it`);continue}if(t===`checkpoint`){r.push({id:a.id,value:a.value});continue}a.value===void 0||a.value===null||r.push({id:a.id,value:typeof a.value==`number`?Math.floor(a.value):a.value,persist:a.persist===!0})}if(t===`checkpoint`)return{deeds:r,warnings:n};let i=r.filter(e=>e.persist),a=r.filter(e=>!e.persist),o=i.splice(3);return o.length&&n.push(`only 3 persisted deeds are kept, dropped: ${o.map(e=>e.id).join(`, `)}`),{deeds:[...i,...a].map(({id:e,value:t})=>({id:e,value:t})),warnings:n}},be=e=>{let t={};for(let n of e)n.value!==void 0&&(t[Ce(n.id)]=n.value);return t},xe=(e,t)=>{try{if(e.filterExp&&!(0,ve.compile)(e.filterExp)(t)||!e.incrementExp)return{complete:!1,value:0};let n=(0,ve.compile)(e.incrementExp)(t);if(typeof n==`boolean`&&(n=n?1:0),n===void 0&&(n=0),typeof n!=`number`||isNaN(n))throw Error(`incrementExp must return a number, undefined or boolean, got ${n}`);let r=Math.floor(n);return{complete:r>=(e.targetCount||1),value:r}}catch(e){return{complete:!1,value:0,error:e.message}}},Se=e=>{let{items:t,scope:n,mode:r}=e,i=Math.min(Math.max(e.index,0),t.length),a;for(;i<t.length&&(a=xe(t[i],n),!(!a.complete||r===`checkpoint`&&!t[i].liveUpdate));i++);return{index:i,head:i<t.length?a:void 0}};var Ce=e=>e.replace(/-./g,e=>e[1].toUpperCase());function we(e){let t=new Map,n=new Set,r=null,i=0,a,o=[],s=e=>{var t;return`simulator-checklist:${(t=r)==null?`game`:t}:${e}`},c=e=>{try{let t=Number(localStorage.getItem(s(e.stableID)))||0;return Math.min(Math.max(t,0),e.items.length)}catch(e){return 0}},l=(e,t)=>{try{t===0?localStorage.removeItem(s(e)):localStorage.setItem(s(e),String(t))}catch(e){}},u=(e,t,r,i)=>{var a;let o=r<i.index?`done`:r===i.index?`active`:`upcoming`,s=`${e.stableID}:${r}`,c=n.has(s),l=!!t.expandMD&&o!==`done`,u=t.targetCount||1,d=o===`active`&&i.head?`${Math.min(i.head.value,u)}/${u}`:``,f=[t.incrementExp&&`increment: ${t.incrementExp}`,t.filterExp&&`filter: ${t.filterExp}`,`target: ${u}`,t.liveUpdate?`liveUpdate: checkpoints + completion`:`completion only`].filter(Boolean).join(`
|
|
168
168
|
`);return`${e.instructionsVisibleFromItemIndex===r&&r>0?`<div class="checklist-divider"><span>full instructions unlock</span></div>`:``}
|
|
169
|
-
<div class="checklist-item ${o}" title="${
|
|
169
|
+
<div class="checklist-item ${o}" title="${K(f)}">
|
|
170
170
|
<div class="checklist-row">
|
|
171
171
|
<span class="checklist-tick">${o===`done`?`■`:`□`}</span>
|
|
172
|
-
<span class="checklist-title">${
|
|
172
|
+
<span class="checklist-title">${K((a=t.title)==null?`Step ${r+1}`:a)}</span>
|
|
173
173
|
${d?`<span class="checklist-count">${d}</span>`:``}
|
|
174
|
-
${l?`<button class="checklist-help${c?` open`:``}" data-help="${
|
|
174
|
+
${l?`<button class="checklist-help${c?` open`:``}" data-help="${K(s)}">?</button>`:``}
|
|
175
175
|
</div>
|
|
176
|
-
${o===`active`&&t.subtitle?`<div class="checklist-subtitle">${
|
|
177
|
-
${l&&c?`<pre class="checklist-expand">${
|
|
176
|
+
${o===`active`&&t.subtitle?`<div class="checklist-subtitle">${K(t.subtitle)}</div>`:``}
|
|
177
|
+
${l&&c?`<pre class="checklist-expand">${K(t.expandMD)}</pre>`:``}
|
|
178
178
|
</div>`},d=e=>{var n,r,i,s;let c=(n=t.get(e.stableID))==null?{index:0}:n,l=e.items.length,d=c.index,f=((r=c.head)==null?void 0:r.error)&&`${(i=(s=e.items[c.index])==null?void 0:s.title)==null?`Step ${c.index+1}`:i}: ${c.head.error}`;return`
|
|
179
179
|
<div class="checklist-section">
|
|
180
180
|
<div class="checklist-header">
|
|
181
181
|
<span class="simulator-label">Checklist</span>
|
|
182
182
|
<span class="checklist-progress${d===l?` complete`:``}">${d}/${l}</span>
|
|
183
|
-
<button class="simulator-btn subtle small" data-reset="${
|
|
183
|
+
<button class="simulator-btn subtle small" data-reset="${K(e.stableID)}">Reset</button>
|
|
184
184
|
</div>
|
|
185
185
|
<div class="checklist-items">
|
|
186
186
|
${e.items.map((t,n)=>u(e,t,n,c)).join(``)}
|
|
187
187
|
</div>
|
|
188
|
-
${a?`<div class="checklist-footer">last eval: ${
|
|
189
|
-
${f?`<div class="checklist-error">${
|
|
190
|
-
${o.map(e=>`<div class="checklist-error">${
|
|
188
|
+
${a?`<div class="checklist-footer">last eval: ${K(a)}</div>`:``}
|
|
189
|
+
${f?`<div class="checklist-error">${K(f)}</div>`:``}
|
|
190
|
+
${o.map(e=>`<div class="checklist-error">${K(e)}</div>`).join(``)}
|
|
191
191
|
</div>`},f=()=>e.length===0?`<div class="simulator-empty">No checklists in puzzmo.json → integrations.checklists
|
|
192
192
|
<pre class="checklist-expand">"checklists": [{
|
|
193
193
|
"stableID": "my-game:tutorial",
|
|
194
194
|
"type": "tutorial",
|
|
195
195
|
"items": [{ "title": "Make a move", "incrementExp": "moves", "liveUpdate": true }]
|
|
196
|
-
}]</pre></div>`:e.map(d).join(``),p=e=>{let t=e.getElement(`#simulator-checklist-list`);t&&(t.innerHTML=f())},m=(n,r,s,c)=>{let u=0,d=ye(r,s),f=be(d.deeds);a=c,o=d.warnings;for(let n of e){var m,h;let e=(m=(h=t.get(n.stableID))==null?void 0:h.index)==null?0:m,r=Se({items:n.items,index:e,scope:f,mode:s});u+=r.index-e,t.set(n.stableID,r),r.index!==e&&l(n.stableID,r.index)}u>0&&(i+=u,n.updateBadge(`checklist`,i)),p(n)};return{id:`checklist`,label:`Cklst`,render(){return`<div id="simulator-checklist-list" class="checklist-view-container">${f()}</div>`},bind(s){var u;r=s.gameSlug;for(let n of e)t.set(n.stableID,{index:c(n)});p(s),(u=s.getElement(`#simulator-checklist-list`))==null||u.addEventListener(`click`,e=>{var r,c;let u=e.target,d=(r=u.closest(`[data-reset]`))==null?void 0:r.dataset.reset,f=(c=u.closest(`[data-help]`))==null?void 0:c.dataset.help;if(d)t.set(d,{index:0}),l(d,0),a=void 0,o=[],i=0,s.updateBadge(`checklist`,0);else if(f)n.has(f)?n.delete(f):n.add(f);else return;p(s)})},onActivate(){i=0},onMessage(e,t,n){var r,i,a;e===`HIT_CHECKPOINT`?m(n,t==null||(r=t.augConfig)==null?void 0:r.deeds,`checkpoint`,`checkpoint "${(i=t==null?void 0:t.checkpointName)==null?`?`:i}"`):e===`GAME_COMPLETED`&&m(n,t==null||(a=t.config)==null?void 0:a.deeds,`completion`,`completion`)}}}var
|
|
196
|
+
}]</pre></div>`:e.map(d).join(``),p=e=>{let t=e.getElement(`#simulator-checklist-list`);t&&(t.innerHTML=f())},m=(n,r,s,c)=>{let u=0,d=ye(r,s),f=be(d.deeds);a=c,o=d.warnings;for(let n of e){var m,h;let e=(m=(h=t.get(n.stableID))==null?void 0:h.index)==null?0:m,r=Se({items:n.items,index:e,scope:f,mode:s});u+=r.index-e,t.set(n.stableID,r),r.index!==e&&l(n.stableID,r.index)}u>0&&(i+=u,n.updateBadge(`checklist`,i)),p(n)};return{id:`checklist`,label:`Cklst`,render(){return`<div id="simulator-checklist-list" class="checklist-view-container">${f()}</div>`},bind(s){var u;r=s.gameSlug;for(let n of e)t.set(n.stableID,{index:c(n)});p(s),(u=s.getElement(`#simulator-checklist-list`))==null||u.addEventListener(`click`,e=>{var r,c;let u=e.target,d=(r=u.closest(`[data-reset]`))==null?void 0:r.dataset.reset,f=(c=u.closest(`[data-help]`))==null?void 0:c.dataset.help;if(d)t.set(d,{index:0}),l(d,0),a=void 0,o=[],i=0,s.updateBadge(`checklist`,0);else if(f)n.has(f)?n.delete(f):n.add(f);else return;p(s)})},onActivate(){i=0},onMessage(e,t,n){var r,i,a;e===`HIT_CHECKPOINT`?m(n,t==null||(r=t.augConfig)==null?void 0:r.deeds,`checkpoint`,`checkpoint "${(i=t==null?void 0:t.checkpointName)==null?`?`:i}"`):e===`GAME_COMPLETED`&&m(n,t==null||(a=t.config)==null?void 0:a.deeds,`completion`,`completion`)}}}var K=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`);function Te(){let e=globalThis;for(let t of Object.keys(e))if(t.endsWith(`Thumbnail`)&&typeof e[t]==`function`)return{name:t,fn:e[t]};return null}function Ee(){let e=globalThis.getShareString;return typeof e==`function`?e:null}function De(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function Oe(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function ke(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ae=`
|
|
197
197
|
<div class="simulator-share-missing">
|
|
198
198
|
<p>The app bundle doesn't export <code>getShareString</code>.</p>
|
|
199
199
|
<p>Add it to your app bundle to preview share strings here:</p>
|
|
@@ -201,7 +201,7 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
201
201
|
inputStr, title, { puzzleString, dateKey, gameplaySlug },
|
|
202
202
|
) => ({ str: \`\${title}: ...\` })</pre>
|
|
203
203
|
</div>
|
|
204
|
-
`;function je(){return{id:`thumb`,label:`Thumb`,render(){return`
|
|
204
|
+
`;function je(){let e,t,n=()=>{e==null||e.dispose(),e=void 0,t=void 0};return{id:`thumb`,label:`Thumb`,render(){return`
|
|
205
205
|
<div class="thumb-view-container">
|
|
206
206
|
<div class="thumb-header">
|
|
207
207
|
<span class="simulator-label">Preview</span>
|
|
@@ -234,18 +234,18 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
234
234
|
</select>
|
|
235
235
|
</div>
|
|
236
236
|
</div>
|
|
237
|
-
`},bind(e){let t=e.getElement(`#simulator-thumb-refresh`);t==null||t.addEventListener(`click`,()=>e.updateThumbnail());let n=e.getElement(`#simulator-render-host-select`),r=e.getElement(`#simulator-render-context-select`),i=e.getElement(`#simulator-render-host-field`),a=e.getElement(`#simulator-render-context-field`),o=e.getElement(`#simulator-preview-kind`),s=()=>{let t=e.state.previewKind!==`text`;i&&(i.style.display=t?`block`:`none`),a&&(a.style.display=t&&e.state.renderHost===`opengraph`?`block`:`none`)},c=()=>{o==null||o.querySelectorAll(`.simulator-segmented-btn`).forEach(t=>{let n=t.dataset.previewKind;t.classList.toggle(`active`,n===e.state.previewKind),t.setAttribute(`aria-selected`,n===e.state.previewKind?`true`:`false`)})};o==null||o.querySelectorAll(`.simulator-segmented-btn`).forEach(t=>{t.addEventListener(`click`,()=>{let n=t.dataset.previewKind;!n||n===e.state.previewKind||(e.state.previewKind=n,
|
|
237
|
+
`},bind(e){let t=e.getElement(`#simulator-thumb-refresh`);t==null||t.addEventListener(`click`,()=>e.updateThumbnail());let n=e.getElement(`#simulator-render-host-select`),r=e.getElement(`#simulator-render-context-select`),i=e.getElement(`#simulator-render-host-field`),a=e.getElement(`#simulator-render-context-field`),o=e.getElement(`#simulator-preview-kind`),s=()=>{let t=e.state.previewKind!==`text`;i&&(i.style.display=t?`block`:`none`),a&&(a.style.display=t&&e.state.renderHost===`opengraph`?`block`:`none`)},c=()=>{o==null||o.querySelectorAll(`.simulator-segmented-btn`).forEach(t=>{let n=t.dataset.previewKind;t.classList.toggle(`active`,n===e.state.previewKind),t.setAttribute(`aria-selected`,n===e.state.previewKind?`true`:`false`)})};o==null||o.querySelectorAll(`.simulator-segmented-btn`).forEach(t=>{t.addEventListener(`click`,()=>{let n=t.dataset.previewKind;!n||n===e.state.previewKind||(e.state.previewKind=n,j(n),c(),s(),e.updateThumbnail())})}),n&&(e.state.renderHost||(e.state.renderHost=`game`,A(e.state.renderHost)),n.value=e.state.renderHost||`game`,n.addEventListener(`change`,()=>{e.state.renderHost=n.value,A(e.state.renderHost),s(),e.updateThumbnail()})),r&&(e.state.renderContext||(e.state.renderContext=`preview`,M(e.state.renderContext)),r.value=e.state.renderContext||`preview`,r.addEventListener(`change`,()=>{e.state.renderContext=r.value,M(e.state.renderContext),e.updateThumbnail()})),c(),s()},onActivate(e){setTimeout(()=>e.updateThumbnail(),0)},updatePreview:i=>{let a=i.getElement(`#simulator-thumb-preview`),o=i.getElement(`#simulator-thumb-fn`);if(a==null||a.style.setProperty(`--sim-thumb-bg`,i.state.selectedTheme.g_bg),i.state.previewKind===`text`){n();let e=Ee();if(!e){a&&(a.innerHTML=Ae),o&&(o.textContent=``);return}o&&(o.textContent=`Using: getShareString()`);try{var s,c,l,u;let t=(s=i.gameSlug)==null?`game`:s,n=e((c=i.state.currentInputStr)==null?``:c,ke(t),{puzzleString:(l=i.state.puzzleData)==null?``:l,dateKey:Oe(),gameplaySlug:`simulator:${t}`}),r=(u=n==null?void 0:n.str)==null?``:u;a&&(a.innerHTML=`<pre class="simulator-share-preview" style="color: ${i.state.selectedTheme.fg}">${De(r)}</pre>`)}catch(e){console.error(`Simulator: Share string error`,e),a&&(a.innerHTML=`<span class="simulator-empty">Error: ${e}</span>`)}return}let d=Te();if(!d){n(),a&&(a.innerHTML=`<span class="simulator-empty">No thumbnail function found</span>`),o&&(o.textContent=``);return}o&&(o.textContent=`Using: ${d.name}()`);try{var f;let o=(f=i.state.puzzleData)==null?``:f,s={viewerIsOwner:!0,theme:i.state.selectedTheme,strict:!0,renderHost:i.state.renderHost,renderContext:i.state.renderContext},{svg:c}=R(d.fn(o,i.state.currentInputStr,s));a&&((!e||t!==a)&&(n(),a.innerHTML=``,e=r.createThumbnailMorpher(a),t=a),e.show(c))}catch(e){console.error(`Simulator: Thumbnail error`,e),n(),a&&(a.innerHTML=`<span class="simulator-empty">Error: ${e}</span>`)}}}}function Me(e){let t=[e.key,e.subBrand,e.player,e.alt1,e.alt2,e.alt3].map(e=>`<div class="simulator-theme-preview-cell" style="background: ${e}"></div>`).join(``);return`<div class="simulator-theme-preview" style="background: ${e.g_bg}">${t}</div>`}function Ne(){return{id:`theme`,label:`Theme`,render(){return`
|
|
238
238
|
<div class="theme-view-container">
|
|
239
239
|
<div class="theme-header">
|
|
240
240
|
<span class="simulator-label">Select Theme</span>
|
|
241
241
|
</div>
|
|
242
242
|
<div id="simulator-themes" class="simulator-themes"></div>
|
|
243
243
|
</div>
|
|
244
|
-
`},bind(e){let t=e.getElement(`#simulator-themes`);t&&
|
|
244
|
+
`},bind(e){let t=e.getElement(`#simulator-themes`);t&&i.forEach(n=>{let r=document.createElement(`div`);r.className=`simulator-theme-item${n.name===e.state.selectedTheme.name?` selected`:``}`,r.innerHTML=`
|
|
245
245
|
${Me(n)}
|
|
246
246
|
<div class="simulator-theme-name">${n.name}</div>
|
|
247
247
|
<div class="simulator-theme-type">${n.type}</div>
|
|
248
|
-
`,r.addEventListener(`click`,()=>{console.log(`Simulator: Theme changed, reloading...`,n.name),
|
|
248
|
+
`,r.addEventListener(`click`,()=>{console.log(`Simulator: Theme changed, reloading...`,n.name),E(n.name),window.location.reload()}),t.appendChild(r)})}}}var Pe=[{name:`app (desktop)`,context:[{type:`app`,layout:`desktop`,host:null}]},{name:`app (mobile)`,context:[{type:`app`,layout:`mobile`,host:null}]},{name:`app (ios)`,context:[{type:`app`,layout:`mobile`,host:`ios-app`}]},{name:`embed`,context:[{type:`embed`}]},{name:`embed (no UI)`,context:[{type:`embed`,noUI:!0}]},{name:`sandbox`,context:[{type:`sandbox`}]}];function Fe(e=[]){let t=[...Pe,...e];return{id:`host`,label:`Host`,render(){return`
|
|
249
249
|
<style>
|
|
250
250
|
#simulator-tab-host .host-note { opacity: 0.5; font-size: 10px; margin: 4px 0 8px; }
|
|
251
251
|
#simulator-tab-host .host-error { color: #f66; font-size: 11px; margin-top: 6px; white-space: pre-wrap; }
|
|
@@ -266,7 +266,7 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
266
266
|
</div>
|
|
267
267
|
<div class="host-error" id="host-error"></div>
|
|
268
268
|
</div>
|
|
269
|
-
`},bind(e){var n,r;let i=e.getElement(`#host-json`),a=e.getElement(`#host-presets`),o=e.getElement(`#host-error`),s=e.getElement(`#host-source`);!i||!a||!o||!s||(i.value=JSON.stringify(e.state.hostContext,null,2),s.textContent=e.state.hostContextIsOverridden?`Using this tab's override. Changes apply on restart.`:`Using the vite config / default context. Changes apply on restart.`,a.addEventListener(`change`,()=>{let e=t[Number(a.value)];e&&(i.value=JSON.stringify(e.context,null,2))}),(n=e.getElement(`#host-apply`))==null||n.addEventListener(`click`,()=>{let e;try{e=JSON.parse(i.value)}catch(e){o.textContent=`Invalid JSON: ${e.message}`;return}if(!Array.isArray(e)||!e.every(e=>e&&typeof e==`object`&&typeof e.type==`string`)){o.textContent=`hostContext must be an array of { type: string, ... } objects`;return}console.log(`Simulator: hostContext changed, reloading...`,e),
|
|
269
|
+
`},bind(e){var n,r;let i=e.getElement(`#host-json`),a=e.getElement(`#host-presets`),o=e.getElement(`#host-error`),s=e.getElement(`#host-source`);!i||!a||!o||!s||(i.value=JSON.stringify(e.state.hostContext,null,2),s.textContent=e.state.hostContextIsOverridden?`Using this tab's override. Changes apply on restart.`:`Using the vite config / default context. Changes apply on restart.`,a.addEventListener(`change`,()=>{let e=t[Number(a.value)];e&&(i.value=JSON.stringify(e.context,null,2))}),(n=e.getElement(`#host-apply`))==null||n.addEventListener(`click`,()=>{let e;try{e=JSON.parse(i.value)}catch(e){o.textContent=`Invalid JSON: ${e.message}`;return}if(!Array.isArray(e)||!e.every(e=>e&&typeof e==`object`&&typeof e.type==`string`)){o.textContent=`hostContext must be an array of { type: string, ... } objects`;return}console.log(`Simulator: hostContext changed, reloading...`,e),p(e),window.location.reload()}),(r=e.getElement(`#host-reset`))==null||r.addEventListener(`click`,()=>{m(),window.location.reload()}))}}}function Ie(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}var Le=`puzzmo_sim_api_mode`,Re=`http://localhost:8911`,ze=`https://api.puzzmo.com`,q=()=>localStorage.getItem(Le)===`dev`?`dev`:`prod`,Be=e=>{localStorage.setItem(Le,e)},J=null,Ve=function(){var e=n.t(function*(){if(J!==null)return J;try{let e=new AbortController,t=setTimeout(()=>e.abort(),1e3),n=yield fetch(`${Re}/healthz`,{signal:e.signal});return clearTimeout(t),J=n.ok,J}catch(e){return J=!1,!1}});return function(){return e.apply(this,arguments)}}(),He=()=>({apiURL:q()===`dev`?Re:ze,clientID:`protosdk:oauthclient`,redirectUri:`${window.location.origin}/oauth/callback`}),Ue=()=>{let e=new Uint8Array(32);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)},We=`puzzmo_sim_oauth_token`,Ge=`puzzmo_sim_oauth_refresh_token`,Ke=e=>localStorage.setItem(We,e),qe=e=>localStorage.setItem(Ge,e),Je=()=>{let e=localStorage.getItem(We);return e&&`${e.substring(0,20)}`,e},Ye=()=>localStorage.getItem(Ge),Xe=()=>{localStorage.removeItem(We),localStorage.removeItem(Ge)},Ze=()=>{let e=He(),t=Ue();sessionStorage.setItem(`oauth_state`,t),sessionStorage.setItem(`oauth_return_url`,window.location.href);let n=new URL(`${e.apiURL}/oauth/auth`);n.searchParams.set(`client_id`,e.clientID),n.searchParams.set(`response_type`,`code`),n.searchParams.set(`redirect_uri`,e.redirectUri),n.searchParams.set(`state`,t),window.location.href=n.toString()},Qe=e=>{try{let t=e.split(`.`);if(t.length!==3)return!0;let n=JSON.parse(atob(t[1])).exp;return n?Date.now()>=n*1e3-300*1e3:!0}catch(e){return!0}},$e=function(){var e=n.t(function*(){let e=Ye();if(!e)return!1;let t=He();try{let n=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:t.clientID}),r=yield fetch(`${t.apiURL}/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:n.toString()});if(!r.ok)return r.statusText,!1;let i=yield r.json(),a=i.access_token||i.accessToken;if(!a)return!1;Ke(a);let o=i.refresh_token||i.refreshToken;return o&&qe(o),!0}catch(e){return!1}});return function(){return e.apply(this,arguments)}}(),et=function(){var e=n.t(function*(e,t){let n=He(),r=sessionStorage.getItem(`oauth_state`);if(!r||r!==t)return null;sessionStorage.removeItem(`oauth_state`);try{let t=new URLSearchParams({grant_type:`authorization_code`,code:e,client_id:n.clientID,redirect_uri:n.redirectUri}),r=yield fetch(`${n.apiURL}/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t.toString()});return r.ok?yield r.json():(r.statusText,null)}catch(e){return null}});return function(t,n){return e.apply(this,arguments)}}(),tt=function(){var e=n.t(function*(e,t={}){let n=He(),r=Je();if(!r)throw Error(`Not authenticated`);if(Qe(r))if(yield $e()){if(r=Je(),!r)throw Error(`Token refresh succeeded but no token available`)}else throw Xe(),Error(`Session expired. Please log in again.`);let i=yield fetch(`${n.apiURL}/graphql`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`,"auth-provider":`custom`},body:JSON.stringify({query:e,variables:t})});if(!i.ok)throw Error(`API request failed: ${i.statusText}`);return i.json()});return function(t){return e.apply(this,arguments)}}(),nt=e=>{try{let t=e.split(`.`);return t.length,t.length===3?JSON.parse(atob(t[1])):null}catch(e){return null}};function rt(){let e=!1;return{id:`auth`,label:`Auth`,render(){let e=Je(),t=!!e,n=q(),r=n===`dev`?Re:ze,i=`<button class="simulator-btn tiny" id="auth-dev-toggle" style="display: none;">${n===`dev`?`Using Dev`:`Dev`}</button>`;if(t){let t=nt(e),n=t!=null&&t.exp?new Date(t.exp*1e3).toLocaleString():`Unknown`,a=!!Ye(),o=a?nt(Ye()):null,s=o!=null&&o.exp?new Date(o.exp*1e3).toLocaleString():null;return`
|
|
270
270
|
<div class="simulator-section">
|
|
271
271
|
<div class="simulator-section-title auth-title-row">
|
|
272
272
|
<span>Puzzmo Authentication</span>
|
|
@@ -304,14 +304,14 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
304
304
|
</div>
|
|
305
305
|
<p class="auth-description">
|
|
306
306
|
Login with your Puzzmo account to make authenticated API requests.
|
|
307
|
-
${n===`dev`?`<br><strong>Using local dev server:</strong> ${
|
|
307
|
+
${n===`dev`?`<br><strong>Using local dev server:</strong> ${Re}`:``}
|
|
308
308
|
</p>
|
|
309
309
|
<div class="simulator-row">
|
|
310
310
|
<button class="simulator-btn primary" id="auth-login">Login with Puzzmo</button>
|
|
311
311
|
</div>
|
|
312
312
|
<div id="auth-error" class="auth-error"></div>
|
|
313
313
|
</div>
|
|
314
|
-
`},bind(t){let r=t.getElement(`#auth-login`),i=t.getElement(`#auth-logout`),a=t.getElement(`#auth-refresh`),o=t.getElement(`#auth-test-api`),s=t.getElement(`#auth-api-result`),c=t.getElement(`#auth-dev-toggle`);e?J&&c&&(c.style.display=``,q()===`dev`&&c.classList.add(`active`)):(e=!0,
|
|
314
|
+
`},bind(t){let r=t.getElement(`#auth-login`),i=t.getElement(`#auth-logout`),a=t.getElement(`#auth-refresh`),o=t.getElement(`#auth-test-api`),s=t.getElement(`#auth-api-result`),c=t.getElement(`#auth-dev-toggle`);e?J&&c&&(c.style.display=``,q()===`dev`&&c.classList.add(`active`)):(e=!0,Ve().then(e=>{e&&c&&(c.style.display=``,q()===`dev`&&c.classList.add(`active`))})),c==null||c.addEventListener(`click`,()=>{Be(q()===`dev`?`prod`:`dev`),Xe(),window.location.reload()}),r==null||r.addEventListener(`click`,()=>{Ze()}),i==null||i.addEventListener(`click`,()=>{Xe(),window.location.reload()}),a==null||a.addEventListener(`click`,n.t(function*(){a.disabled=!0,a.textContent=`Refreshing...`,(yield $e())?window.location.reload():(a.textContent=`Refresh Failed`,a.disabled=!1)})),o==null||o.addEventListener(`click`,n.t(function*(){if(s){s.innerHTML=`<div class="loading">Loading...</div>`;try{let t=yield tt(`
|
|
315
315
|
query {
|
|
316
316
|
currentUser {
|
|
317
317
|
id
|
|
@@ -320,7 +320,7 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
320
320
|
name
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
`);if(t.errors){var e;s.innerHTML=`<div class="error">Error: ${((e=t.errors[0])==null?void 0:e.message)||`Unknown error`}</div>`}else s.innerHTML=`<pre>${JSON.stringify(t.data,null,2)}</pre>`}catch(e){s.innerHTML=`<div class="error">Error: ${e instanceof Error?e.message:`Unknown error`}</div>`}}}))},onActivate(e){return n.t(function*(){let t=new URLSearchParams(window.location.search),n=t.get(`code`),r=t.get(`state`),i=t.get(`error`);if(i){let t=e.getElement(`#auth-error`);t&&(t.innerHTML=`<div class="error">OAuth error: ${i}</div>`),window.history.replaceState({},``,window.location.pathname);return}if(n&&r){let t=e.getElement(`#auth-status`);t&&(t.innerHTML=`<span class="indicator waiting"></span><span>Exchanging code...</span>`);let i=yield
|
|
323
|
+
`);if(t.errors){var e;s.innerHTML=`<div class="error">Error: ${((e=t.errors[0])==null?void 0:e.message)||`Unknown error`}</div>`}else s.innerHTML=`<pre>${JSON.stringify(t.data,null,2)}</pre>`}catch(e){s.innerHTML=`<div class="error">Error: ${e instanceof Error?e.message:`Unknown error`}</div>`}}}))},onActivate(e){return n.t(function*(){let t=new URLSearchParams(window.location.search),n=t.get(`code`),r=t.get(`state`),i=t.get(`error`);if(i){let t=e.getElement(`#auth-error`);t&&(t.innerHTML=`<div class="error">OAuth error: ${i}</div>`),window.history.replaceState({},``,window.location.pathname);return}if(n&&r){let t=e.getElement(`#auth-status`);t&&(t.innerHTML=`<span class="indicator waiting"></span><span>Exchanging code...</span>`);let i=yield et(n,r);if(window.history.replaceState({},``,window.location.pathname),i){let e=i.access_token||i.accessToken;if(e){Ke(e);let t=i.refresh_token||i.refreshToken;t&&qe(t)}window.location.reload()}else{let t=e.getElement(`#auth-error`);t&&(t.innerHTML=`<div class="error">Failed to exchange code for token</div>`)}}})()}}}var it=`puzzmo_sim_api_mode`,at=`http://localhost:8911`,ot=`https://api.puzzmo.com`,st=`puzzmo_sim_oauth_token`,ct=`puzzmo_sim_oauth_refresh_token`,lt=()=>localStorage.getItem(it)===`dev`?`dev`:`prod`,ut=()=>localStorage.getItem(st),dt=()=>localStorage.getItem(ct),ft=e=>localStorage.setItem(st,e),pt=e=>localStorage.setItem(ct,e),mt=()=>{localStorage.removeItem(st),localStorage.removeItem(ct)},ht=e=>{try{let t=e.split(`.`);if(t.length!==3)return!0;let n=JSON.parse(atob(t[1])).exp;return n?Date.now()>=n*1e3-300*1e3:!0}catch(e){return!0}},gt=function(){var e=n.t(function*(){let e=dt();if(!e)return!1;let t=lt()===`dev`?at:ot;try{let n=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:`protosdk:oauthclient`}),r=yield fetch(`${t}/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:n.toString()});if(!r.ok)return!1;let i=yield r.json(),a=i.access_token||i.accessToken;if(!a)return!1;ft(a);let o=i.refresh_token||i.refreshToken;return o&&pt(o),!0}catch(e){return!1}});return function(){return e.apply(this,arguments)}}(),_t=function(){var e=n.t(function*(e,t={}){let n=lt()===`dev`?at:ot,r=ut();if(!r)throw Error(`Not authenticated`);if(ht(r))if(yield gt()){if(r=ut(),!r)throw Error(`Token refresh succeeded but no token available`)}else throw mt(),Error(`Session expired. Please log in again.`);let i=yield fetch(`${n}/graphql`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`,"auth-provider":`custom`},body:JSON.stringify({query:e,variables:t})});if(!i.ok)throw Error(`API request failed: ${i.statusText}`);return i.json()});return function(t){return e.apply(this,arguments)}}(),vt=`
|
|
324
324
|
query GameFeaturesQuery($slug: ID!) {
|
|
325
325
|
game(id: $slug) {
|
|
326
326
|
id
|
|
@@ -338,7 +338,7 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
`,
|
|
341
|
+
`,yt=`
|
|
342
342
|
mutation ToggleFeatureMutation($gameSlug: ID!, $input: UpdateGameInput!) {
|
|
343
343
|
updateGame(id: $gameSlug, input: $input) {
|
|
344
344
|
id
|
|
@@ -354,7 +354,7 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
`,
|
|
357
|
+
`,bt=(e,t)=>{let n=t-1,r=Math.floor(n/31),i=n%31,a=[...e];for(;a.length<=r;)a.push(0);return a[r]=a[r]^1<<i,a};const xt=()=>!!ut();function St(){let e=null,r=!1,i=null,a=function(){var t=n.t(function*(t){r=!0,i=null;try{var n;let r=yield _t(vt,{slug:t});if(r.errors){var a;i=((a=r.errors[0])==null?void 0:a.message)||`Unknown error`,e=null}else (n=r.data)!=null&&n.game?e=r.data.game:(i=`Game not found`,e=null)}catch(t){i=t instanceof Error?t.message:`Unknown error`,e=null}finally{r=!1}});return function(e){return t.apply(this,arguments)}}(),o=function(){var r=n.t(function*(n){if(!e)return;let r=bt(e.featuresArr,n);try{var i;let n=yield _t(yt,{gameSlug:e.slug,input:{featuresArr:r}});if(n.errors){var a;console.error(`Failed to toggle feature:`,(a=n.errors[0])==null?void 0:a.message)}else (i=n.data)!=null&&i.updateGame&&(e=t.t(t.t({},e),{},{featuresArr:n.data.updateGame.featuresArr,gameFeatures:n.data.updateGame.gameFeatures}))}catch(e){console.error(`Failed to toggle feature:`,e)}});return function(e){return r.apply(this,arguments)}}(),s=()=>{if(r)return`<div class="features-loading">Loading features...</div>`;if(i)return`<div class="features-error">${i}</div>`;if(!e)return`<div class="features-empty">Enter your game slug above to load features</div>`;let t=e.gameFeatures.map(e=>{let t=e.features.map(e=>{let t=e.isEnabled?`enabled`:`disabled`,n=e.isEnabled?`✓`:`✗`;return`
|
|
358
358
|
<div class="feature-item ${t}" data-feature-id="${e.featureID}">
|
|
359
359
|
<span class="feature-status">${n}</span>
|
|
360
360
|
<span class="feature-title">${e.title}</span>
|
|
@@ -367,7 +367,7 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
367
367
|
`}).join(``);return`
|
|
368
368
|
<div class="features-game-name">${e.displayName}</div>
|
|
369
369
|
${t}
|
|
370
|
-
`};return{id:`features`,label:`Features`,render(){return
|
|
370
|
+
`};return{id:`features`,label:`Features`,render(){return xt()?`
|
|
371
371
|
<div class="features-view-container">
|
|
372
372
|
<div class="simulator-section">
|
|
373
373
|
<div class="simulator-section-title">Game Features</div>
|
|
@@ -391,13 +391,13 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
391
391
|
</div>
|
|
392
392
|
</div>
|
|
393
393
|
</div>
|
|
394
|
-
`},bind(t){let r=t.getElement(`#features-load-btn`),i=t.getElement(`#features-game-slug`),c=t.getElement(`#features-content`),l=()=>{c&&(c.innerHTML=s(),u())},u=()=>{var e;let r=(e=t.getElement(`#features-content`))==null?void 0:e.querySelectorAll(`.feature-item`);r==null||r.forEach(e=>{e.addEventListener(`click`,n.t(function*(){let t=parseInt(e.getAttribute(`data-feature-id`)||`0`);t>0&&(e.classList.add(`updating`),yield o(t),l())}))})},d=function(){var e=n.t(function*(e){e&&(r&&(r.disabled=!0,r.textContent=`Loading...`),yield a(e),l(),r&&(r.disabled=!1,r.textContent=`Load`))});return function(t){return e.apply(this,arguments)}}();r==null||r.addEventListener(`click`,n.t(function*(){let e=i==null?void 0:i.value.trim();e&&(yield d(e))})),i==null||i.addEventListener(`keypress`,e=>{e.key===`Enter`&&(r==null||r.click())}),console.log(`[FeaturesView] bind called, ctx.gameSlug:`,t.gameSlug,`slugInput:`,i),t.gameSlug&&i&&(i.value=t.gameSlug,
|
|
394
|
+
`},bind(t){let r=t.getElement(`#features-load-btn`),i=t.getElement(`#features-game-slug`),c=t.getElement(`#features-content`),l=()=>{c&&(c.innerHTML=s(),u())},u=()=>{var e;let r=(e=t.getElement(`#features-content`))==null?void 0:e.querySelectorAll(`.feature-item`);r==null||r.forEach(e=>{e.addEventListener(`click`,n.t(function*(){let t=parseInt(e.getAttribute(`data-feature-id`)||`0`);t>0&&(e.classList.add(`updating`),yield o(t),l())}))})},d=function(){var e=n.t(function*(e){e&&(r&&(r.disabled=!0,r.textContent=`Loading...`),yield a(e),l(),r&&(r.disabled=!1,r.textContent=`Load`))});return function(t){return e.apply(this,arguments)}}();r==null||r.addEventListener(`click`,n.t(function*(){let e=i==null?void 0:i.value.trim();e&&(yield d(e))})),i==null||i.addEventListener(`keypress`,e=>{e.key===`Enter`&&(r==null||r.click())}),console.log(`[FeaturesView] bind called, ctx.gameSlug:`,t.gameSlug,`slugInput:`,i),t.gameSlug&&i&&(i.value=t.gameSlug,xt()&&!e&&d(t.gameSlug)),u()},onActivate(e){let t=e.getElement(`#simulator-tab-features`);t&&(t.innerHTML=this.render(),this.bind(e))}}}var Ct=200,wt=24;const Y=Ct+wt;var Tt=6,Et=2.5,Dt=100,Ot=(e,t)=>e?`14.7%`:t?`17.85%`:`9.75%`,X=(e,t)=>{let n=e.replace(`#`,``),r=n.length===3?[...n].map(e=>e+e).join(``):n,i=parseInt(r,16);return r.length!==6||Number.isNaN(i)?e:`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${t})`},kt=e=>e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`),At=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`);function jt(e){let{theme:t,sendToGame:n}=e,r=!1,i=null,a=null,o=document.createElement(`style`);o.id=`sim-docked-kbd-page-style`,o.textContent=`
|
|
395
395
|
html.sim-kbd-docked #simulator {
|
|
396
396
|
bottom: ${Y+4}px;
|
|
397
397
|
}
|
|
398
|
-
`;let s=()=>{var e;return(e=document.getElementById(`root`))==null?document.body.firstElementChild:e},c=null,l=()=>{let e=s();if(!e||c)return;let{height:t,maxHeight:n,position:r}=e.style;c=()=>{e.style.height=t,e.style.maxHeight=n,e.style.position=r,c=null},e.style.height=`calc(100% - ${Y}px)`,e.style.maxHeight=`calc(100% - ${Y}px)`,getComputedStyle(e).position===`static`&&(e.style.position=`relative`)},u=(e,n)=>{var r;let i=n.disabled.includes(e),a=n.highlight.includes(e);return[`display:flex`,`align-items:center`,`justify-content:center`,`width:100%`,`height:100%`,`box-sizing:border-box`,`border-radius:3px`,`overflow:hidden`,`background:transparent`,`pointer-events:none`,`border:${i?`1px dashed ${X(t.fg,.25)}`:a?`2px solid ${X(t.fg,.75)}`:`1px solid ${X(t.fg,.4)}`}`,Z((r=n.individualKeyStyles)==null||(r=r[e])==null?void 0:r.background)].filter(Boolean).join(`;`)},d=(e,n)=>{var r;return[`font:11px/1 Menlo, Monaco, Consolas, monospace`,`letter-spacing:0.5px`,`text-transform:uppercase`,`white-space:nowrap`,`color:${X(t.fg,n.disabled.includes(e)?.3:.65)}`,n.highlight.includes(e)?``:Z(n.keyStyles),Z((r=n.individualKeyStyles)==null||(r=r[e])==null?void 0:r.text)].filter(Boolean).join(`;`)},f=(e,t)=>{var n,r;let i=(n=t.symbols[e])==null?e:n,a=t.disabled.includes(e),o=(r=t.flexGrowSymbols)==null?void 0:r.includes(e),s=[`width:${
|
|
399
|
-
<div class="sim-docked-kbd-key-inner" style="${c}"><div style="${l}">${
|
|
400
|
-
</div>`},p=e=>{let n=e.layout.filter(e=>!!e),r=`calc(100% / ${n.length})`;return`${n.map((t,n)=>{var i,a;return`<div style="${`height:${r};display:flex;flex-direction:row;align-items:center;justify-content:${(i=(a=e.rowPositioning)==null?void 0:a[n])==null?`center`:i}`}">${[...t].map(t=>f(t,e)).join(``)}</div>`}).join(``)}${`<div id="sim-docked-kbd-cursor" style="position:absolute;inset:0;z-index:1;background:${X(t.fg,.12)};opacity:0;transition:opacity 0.1s ease-in-out;pointer-events:none"></div>`}`},m=!1,h=[0,0],g=null,_=0,v=null,y=null,b=e=>{let t=a==null?void 0:a.querySelector(`#sim-docked-kbd-cursor`);t&&(t.style.opacity=e?`0.5`:`0`)},x=()=>{m=!1,h=[0,0],g=null,_=0,v=null,y=null,b(!1)},S=e=>{var t,n;return(t=(n=document.elementFromPoint(e.clientX,e.clientY))==null||(n=n.closest(`.sim-docked-kbd-key`))==null?void 0:n.getAttribute(`data-key`))==null?null:t},
|
|
398
|
+
`;let s=()=>{var e;return(e=document.getElementById(`root`))==null?document.body.firstElementChild:e},c=null,l=()=>{let e=s();if(!e||c)return;let{height:t,maxHeight:n,position:r}=e.style;c=()=>{e.style.height=t,e.style.maxHeight=n,e.style.position=r,c=null},e.style.height=`calc(100% - ${Y}px)`,e.style.maxHeight=`calc(100% - ${Y}px)`,getComputedStyle(e).position===`static`&&(e.style.position=`relative`)},u=(e,n)=>{var r;let i=n.disabled.includes(e),a=n.highlight.includes(e);return[`display:flex`,`align-items:center`,`justify-content:center`,`width:100%`,`height:100%`,`box-sizing:border-box`,`border-radius:3px`,`overflow:hidden`,`background:transparent`,`pointer-events:none`,`border:${i?`1px dashed ${X(t.fg,.25)}`:a?`2px solid ${X(t.fg,.75)}`:`1px solid ${X(t.fg,.4)}`}`,Z((r=n.individualKeyStyles)==null||(r=r[e])==null?void 0:r.background)].filter(Boolean).join(`;`)},d=(e,n)=>{var r;return[`font:11px/1 Menlo, Monaco, Consolas, monospace`,`letter-spacing:0.5px`,`text-transform:uppercase`,`white-space:nowrap`,`color:${X(t.fg,n.disabled.includes(e)?.3:.65)}`,n.highlight.includes(e)?``:Z(n.keyStyles),Z((r=n.individualKeyStyles)==null||(r=r[e])==null?void 0:r.text)].filter(Boolean).join(`;`)},f=(e,t)=>{var n,r;let i=(n=t.symbols[e])==null?e:n,a=t.disabled.includes(e),o=(r=t.flexGrowSymbols)==null?void 0:r.includes(e),s=[`width:${Ot(t.l.includes(e),t.xl.includes(e))}`,`flex:${o?`1 0 auto`:`0 1 auto`}`,`height:100%`,`display:flex`,`align-items:center`,`justify-content:center`,`padding:0 3px 12px`,`position:relative`,a?`pointer-events:none`:``].filter(Boolean).join(`;`),c=u(e,t),l=d(e,t);return`<div class="sim-docked-kbd-key" data-key="${kt(e)}" style="${s}">
|
|
399
|
+
<div class="sim-docked-kbd-key-inner" style="${c}"><div style="${l}">${At(i)}</div></div>
|
|
400
|
+
</div>`},p=e=>{let n=e.layout.filter(e=>!!e),r=`calc(100% / ${n.length})`;return`${n.map((t,n)=>{var i,a;return`<div style="${`height:${r};display:flex;flex-direction:row;align-items:center;justify-content:${(i=(a=e.rowPositioning)==null?void 0:a[n])==null?`center`:i}`}">${[...t].map(t=>f(t,e)).join(``)}</div>`}).join(``)}${`<div id="sim-docked-kbd-cursor" style="position:absolute;inset:0;z-index:1;background:${X(t.fg,.12)};opacity:0;transition:opacity 0.1s ease-in-out;pointer-events:none"></div>`}`},m=!1,h=[0,0],g=null,_=0,v=null,y=null,b=e=>{let t=a==null?void 0:a.querySelector(`#sim-docked-kbd-cursor`);t&&(t.style.opacity=e?`0.5`:`0`)},x=()=>{m=!1,h=[0,0],g=null,_=0,v=null,y=null,b(!1)},S=e=>{var t,n;return(t=(n=document.elementFromPoint(e.clientX,e.clientY))==null||(n=n.closest(`.sim-docked-kbd-key`))==null?void 0:n.getAttribute(`data-key`))==null?null:t},C=e=>{y=S(e),a==null||a.setPointerCapture(e.pointerId)},ee=e=>{!(i!=null&&i.supportsDragCursor)||!y||g&&g.clientX===e.clientX&&g.clientY===e.clientY||(g&&g.pointerId!==e.pointerId&&(_=0,v=null),v||(v=Date.now()),m||(_+=1,_>=Tt&&Date.now()-v>=Dt&&(m=!0,b(!0))),m&&g&&(h=[h[0]+(e.clientX-g.clientX)*Et,h[1]+(e.clientY-g.clientY)*Et]),g={clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId},m&&n(`KEYBOARD_CURSOR_CHANGE`,{position:h}))},w=e=>{m?n(`KEYBOARD_CURSOR_END`,{}):y&&S(e)===y&&n(`KEYBOARD_KEY_PRESS`,{key:y}),x()},T=()=>{a||!i||(a=document.createElement(`div`),a.id=`sim-docked-kbd`,a.style.cssText=[`position:fixed`,`left:0`,`right:0`,`bottom:0`,`height:${Y}px`,`box-sizing:border-box`,`padding-top:8px`,`padding-bottom:${wt}px`,`display:flex`,`flex-direction:column`,`z-index:999998`,`touch-action:none`,`user-select:none`,`-webkit-user-select:none`,`background:${t.a_bg}`,`border-top:1px solid ${X(t.fg,.2)}`].join(`;`),a.innerHTML=p(i),a.addEventListener(`pointerdown`,C),a.addEventListener(`pointermove`,ee),a.addEventListener(`pointerup`,w),a.addEventListener(`pointercancel`,()=>x()),a.addEventListener(`contextmenu`,e=>e.preventDefault()),document.body.appendChild(a),o.isConnected||document.head.appendChild(o),document.documentElement.classList.add(`sim-kbd-docked`),l())},te=()=>{a&&(a.remove(),a=null,document.documentElement.classList.remove(`sim-kbd-docked`),c==null||c(),x())},ne=()=>{let e=i;!a||!e||a.querySelectorAll(`.sim-docked-kbd-key`).forEach(t=>{let n=t.getAttribute(`data-key`),r=t.firstElementChild,i=r==null?void 0:r.firstElementChild;!n||!r||!i||(r.style.cssText=u(n,e),i.style.cssText=d(n,e))})},E=()=>{if(!r||!i)return te();if(!a)return T();a.innerHTML=p(i),b(m)};return{setEnabled(e){r=e,E()},setConfig(e){let t=a&&e&&i&&Mt(e)===Mt(i);i=e,t?ne():E()}}}var Mt=e=>JSON.stringify([e.layout,e.symbols,e.highlight,e.disabled,e.xl,e.l,e.flexGrowSymbols,e.rowPositioning,e.keyStyles]);const Z=e=>Object.entries(e==null?{}:e).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${kt(String(t))}`).join(`;`);var Nt=(e,t)=>{var n,r,i,a;let o=(n=t.symbols[e])==null?e:n,s=t.disabled.includes(e),c=t.highlight.includes(e),l=t.xl.includes(e),u=t.l.includes(e),d=(r=t.flexGrowSymbols)==null?void 0:r.includes(e),f=[`sim-kb-key`,s?`disabled`:``,c?`highlight`:``,l?`xl`:``,u?`l`:``,d?`grow`:``].filter(Boolean).join(` `),p=Z((i=t.individualKeyStyles)==null||(i=i[e])==null?void 0:i.background),m=Z((a=t.individualKeyStyles)==null||(a=a[e])==null?void 0:a.text);return`<button class="${f}" data-key="${e}" style="${p}" ${s?`disabled`:``}><span style="${m}">${o}</span></button>`},Pt=e=>`<div class="sim-kb">${e.layout.filter(e=>e!=null).map(t=>`<div class="sim-kb-row">${[...t].map(t=>Nt(t,e)).join(``)}</div>`).join(``)}</div>`;function Ft(){let e=null,t=null,n=t=>e?t?`<div class="sim-kb-empty">Shown under the game at production size, taking ${Y}px off the bottom.<br>Uncheck to preview the layout here instead.</div>`:Pt(e):`<div class="sim-kb-empty">No keyboard config received from game yet.<br>The game calls <code>sdk.keyboard.show(config)</code> to display a keyboard.</div>`;return{id:`kbd`,label:`Kbd`,render(){return`
|
|
401
401
|
<div class="keyboard-view-container">
|
|
402
402
|
<div class="simulator-field">
|
|
403
403
|
<label class="sim-settings-row">
|
|
@@ -409,11 +409,11 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
409
409
|
${n(!1)}
|
|
410
410
|
</div>
|
|
411
411
|
</div>
|
|
412
|
-
`},bind(e){t!=null||(t=
|
|
412
|
+
`},bind(e){t!=null||(t=jt({theme:e.state.selectedTheme,sendToGame:e.sendToGame})),t.setEnabled(e.state.keyboardDocked);let n=e.getElement(`#sim-kb-dock`);n&&(n.checked=e.state.keyboardDocked,n.addEventListener(`change`,()=>{e.state.keyboardDocked=n.checked,g(n.checked),t==null||t.setEnabled(n.checked),r(e)})),It(e)},onMessage(n,i,a){var o;n===`KEYBOARD_UPDATE_CONFIG`&&(e=!(!(i==null||(o=i.layout)==null)&&o.length)||i.layout.every(e=>!e)?null:i,t==null||t.setConfig(e),r(a))}};function r(e){let t=e.getElement(`#sim-kb-content`);t&&(t.innerHTML=n(e.state.keyboardDocked),It(e))}}function It(e){var t;let n=(t=e.getElement(`#sim-kb-content`))==null?void 0:t.querySelectorAll(`.sim-kb-key`);n==null||n.forEach(t=>{t.addEventListener(`click`,()=>{let n=t.getAttribute(`data-key`);n&&e.sendToGame(`KEYBOARD_KEY_PRESS`,{key:n})})})}function Lt(){let e=e=>{let t=e.state.settingsComponents;return!t||t.length===0?`<div class="sim-settings-empty">No settings registered by the game yet.<br>The game calls <code>sdk.settings.initialize(components)</code> to describe its settings UI.</div>`:`<div class="sim-settings-form">${t.map(t=>Rt(t,e.state.gameSettings)).join(``)}</div><div class="sim-settings-actions"><button class="simulator-btn tiny" id="sim-settings-reset">Reset to defaults</button></div>`},n=t=>{let n=t.getElement(`#sim-settings-content`);n&&(n.innerHTML=e(t),i(t))},r=e=>{w(e.state.gameSettings),e.sendToGame(`SETTINGS_UPDATE`,e.state.gameSettings)},i=e=>{var i;let a=e.getElement(`#sim-settings-content`);a&&(a.querySelectorAll(`[data-setting]`).forEach(n=>{let i=n.getAttribute(`data-setting`),o=n.getAttribute(`data-setting-type`);n.addEventListener(`change`,()=>{let s;if(o===`multiselect`){let e=a.querySelectorAll(`input[data-multiselect="${i}"]`);s=Array.from(e).filter(e=>e.checked).map(e=>e.value)}else s=n instanceof HTMLInputElement&&n.type===`checkbox`?n.checked:o===`number`?Number(n.value):n.value;e.state.gameSettings=t.t(t.t({},e.state.gameSettings),{},{[i]:s}),r(e)})}),(i=a.querySelector(`#sim-settings-reset`))==null||i.addEventListener(`click`,()=>{var t;T(),e.state.gameSettings=Bt((t=e.state.settingsComponents)==null?[]:t),r(e),n(e)}))};return{id:`settings`,label:`Set`,render(){return`
|
|
413
413
|
<div class="settings-view-container">
|
|
414
414
|
<div id="sim-settings-content"></div>
|
|
415
415
|
</div>
|
|
416
|
-
`},bind(e){n(e)},onMessage(e,r,i){if(e===`INITIALIZE_SETTINGS`){var a;i.state.settingsComponents=(a=r==null?void 0:r.components)==null?[]:a,i.state.gameSettings=t.t(t.t({},r==null?void 0:r.settings),i.state.gameSettings),
|
|
416
|
+
`},bind(e){n(e)},onMessage(e,r,i){if(e===`INITIALIZE_SETTINGS`){var a;i.state.settingsComponents=(a=r==null?void 0:r.components)==null?[]:a,i.state.gameSettings=t.t(t.t({},r==null?void 0:r.settings),i.state.gameSettings),w(i.state.gameSettings),n(i);return}e===`UPDATE_SETTINGS_FROM_EMBED`&&(i.state.gameSettings=t.t(t.t({},i.state.gameSettings),r==null?void 0:r.settings),w(i.state.gameSettings),n(i))}}}function Rt(e,t){switch(e.type){case`title`:return`<div class="sim-settings-heading">${Q(e.value)}</div>`;case`subtitle`:return`<div class="sim-settings-subheading">${Q(e.value)}</div>`;case`paragraph`:return`<p class="sim-settings-paragraph">${Q(e.value)}</p>`;case`separator`:return`<div class="simulator-divider"></div>`;case`split`:return`<div class="sim-settings-split">${e.content.map(e=>Rt(e,t)).join(``)}</div>`;case`boolean`:{var n;let r=((n=t[e.name])==null?e.defaultValue:n)?`checked`:``,i=e.subtitle?`<div class="sim-settings-subtitle">${Q(e.subtitle)}</div>`:``;return`
|
|
417
417
|
<div class="simulator-field">
|
|
418
418
|
<label class="sim-settings-row">
|
|
419
419
|
<input type="checkbox" data-setting="${e.name}" ${r} />
|
|
@@ -422,7 +422,7 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
422
422
|
${i}
|
|
423
423
|
</div>`}case`enum`:{var r;let n=(r=t[e.name])==null?e.defaultValue:r,i=e.values.map((t,r)=>{var i;return`<option value="${Q(t)}" ${t===n?`selected`:``}>${Q((i=e.displays[r])==null?t:i)}</option>`}).join(``);return`
|
|
424
424
|
<div class="simulator-field">
|
|
425
|
-
${
|
|
425
|
+
${zt(e)}
|
|
426
426
|
<select class="simulator-select" data-setting="${e.name}">${i}</select>
|
|
427
427
|
</div>`}case`multiselect`:{var i;let n=(i=t[e.name])==null?e.defaultValue:i,r=Array.isArray(n)?n:[],a=e.values.map((t,n)=>{var i;return`
|
|
428
428
|
<label class="sim-settings-row">
|
|
@@ -430,17 +430,17 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
430
430
|
<span class="simulator-label">${Q((i=e.displays[n])==null?t:i)}</span>
|
|
431
431
|
</label>`}).join(``);return`
|
|
432
432
|
<div class="simulator-field">
|
|
433
|
-
${
|
|
433
|
+
${zt(e)}
|
|
434
434
|
${a}
|
|
435
435
|
</div>`}case`number`:{var a;let n=(a=t[e.name])==null?e.defaultValue:a,r=e.values.map(e=>`<option value="${e}" ${e===n?`selected`:``}>${e}</option>`).join(``);return`
|
|
436
436
|
<div class="simulator-field">
|
|
437
|
-
${
|
|
437
|
+
${zt(e)}
|
|
438
438
|
<select class="simulator-select" data-setting="${e.name}" data-setting-type="number">${r}</select>
|
|
439
439
|
</div>`}case`text`:{var o,s;let n=String((o=(s=t[e.name])==null?e.defaultValue:s)==null?``:o),r=e.textarea?`<textarea class="simulator-textarea" data-setting="${e.name}">${Q(n)}</textarea>`:`<input class="simulator-input" type="text" data-setting="${e.name}" value="${Q(n)}" />`;return`
|
|
440
440
|
<div class="simulator-field">
|
|
441
|
-
${
|
|
441
|
+
${zt(e)}
|
|
442
442
|
${r}
|
|
443
|
-
</div>`}default:return`<div class="sim-settings-unsupported">Unsupported component type: ${Q(e.type)}</div>`}}function
|
|
443
|
+
</div>`}default:return`<div class="sim-settings-unsupported">Unsupported component type: ${Q(e.type)}</div>`}}function zt(e){let t=e.subtitle?`<div class="sim-settings-subtitle">${Q(e.subtitle)}</div>`:``;return`<span class="simulator-label">${Q(e.title)}</span>${t}`}function Bt(e){let t={};for(let n of e)n.type===`split`?Object.assign(t,Bt(n.content)):`name`in n&&(t[n.name]=n.defaultValue);return t}function Q(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function Vt(){let e=[],t=!0,n=()=>e.length===0?`<div class="sound-empty">No cues yet. Play the game to hear from it.</div>`:e.map(e=>`<div class="sound-row"><span class="sound-id">${Ut(e.id)}</span>${e.haptic?`<span class="sound-haptic">${Ut(e.haptic)}</span>`:``}<span class="sound-time">${e.time}</span></div>`).join(``),r=t=>{let r=t.getElement(`#sound-events`);r&&(r.innerHTML=n()),t.updateBadge(`sound`,e.length)};return{id:`sound`,label:`Sound`,render(){return`
|
|
444
444
|
<style>
|
|
445
445
|
#simulator-tab-sound .sound-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-family: monospace; font-size: 11px; }
|
|
446
446
|
#simulator-tab-sound .sound-id { color: var(--accent, #6cf); }
|
|
@@ -458,7 +458,7 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
458
458
|
</div>
|
|
459
459
|
<div id="sound-events">${n()}</div>
|
|
460
460
|
</div>
|
|
461
|
-
`},bind(n){let i=n.getElement(`#sound-clear`);i==null||i.addEventListener(`click`,()=>{e.length=0,r(n)});let a=n.getElement(`#sound-enabled`);a==null||a.addEventListener(`change`,()=>{t=!!a.checked,n.sendToGame(`SOUND_ENABLED`,{enabled:t})}),n.sendToGame(`SOUND_ENABLED`,{enabled:t})},onMessage(n,i,a){var o;if(n===`READY_GAME_LOADED`){a.sendToGame(`SOUND_ENABLED`,{enabled:t});return}n===`SENSORY_EVENT`&&(e.unshift({id:(o=i==null?void 0:i.id)==null?JSON.stringify(i):o,haptic:i==null?void 0:i.haptic,time:
|
|
461
|
+
`},bind(n){let i=n.getElement(`#sound-clear`);i==null||i.addEventListener(`click`,()=>{e.length=0,r(n)});let a=n.getElement(`#sound-enabled`);a==null||a.addEventListener(`change`,()=>{t=!!a.checked,n.sendToGame(`SOUND_ENABLED`,{enabled:t})}),n.sendToGame(`SOUND_ENABLED`,{enabled:t})},onMessage(n,i,a){var o;if(n===`READY_GAME_LOADED`){a.sendToGame(`SOUND_ENABLED`,{enabled:t});return}n===`SENSORY_EVENT`&&(e.unshift({id:(o=i==null?void 0:i.id)==null?JSON.stringify(i):o,haptic:i==null?void 0:i.haptic,time:Ht()}),e.length>100&&e.pop(),r(a))}}}function Ht(){return new Date().toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function Ut(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}var $=null;function Wt(){return typeof window>`u`?!1:new URLSearchParams(window.location.search).has(`developer`)}var Gt={updateFixtures:()=>{},sendToGame:()=>{},loadPuzzle:function(){var e=n.t(function*(){return null});return function(){return e.apply(this,arguments)}}()};function Kt(e={}){var r,i,a,o,s;if(Wt())return console.log(`[Simulator] developer=true in URL — running inside the Puzzmo app, skipping simulator boot`),Gt;if(console.log(`[Simulator] createSimulator called with config:`,{slug:e.slug,hasFixtures:!!e.fixtures}),$)return e.fixtures&&(console.log(`[Simulator] Instance already exists, updating fixtures`),$.updateFixtures(e.fixtures)),$;let c=(r=e.autoStart)==null?!0:r,l=e.fixtures?ie(e.fixtures):null,u=l?Array.from(l.keys()).sort():[],d=me(),f=je(),p=[oe(),ce(),d,he(),ge(),we((i=(a=e.integrations)==null?void 0:a.checklists)==null?[]:i),f,Ne(),Fe(e.hostContextPresets),rt(),St(),Ft(),Lt(),Vt(),...(o=e.views)==null?[]:o],m=p.map(e=>e.id),h=ee(e,u,m),g={pause:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><rect x="1" y="1" width="3" height="8"/><rect x="6" y="1" width="3" height="8"/></svg>`,play:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><polygon points="2,1 9,5 2,9"/></svg>`,retry:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><path d="M5 1C2.8 1 1 2.8 1 5s1.8 4 4 4c1.8 0 3.3-1.2 3.8-2.8H7.5c-.4.9-1.3 1.5-2.5 1.5-1.5 0-2.7-1.2-2.7-2.7S3.5 2.3 5 2.3c.7 0 1.4.3 1.9.8L5.5 4.5H9V1L7.6 2.4C6.9 1.5 5.9 1 5 1z"/></svg>`,cog:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><path d="M9.5 5.8l-.8-.5c0-.2.1-.5.1-.8s0-.5-.1-.8l.8-.5c.1-.1.2-.2.1-.4l-.8-1.4c-.1-.1-.2-.2-.4-.1l-1 .3c-.3-.3-.7-.5-1.1-.6L6.1.2C6.1.1 6 0 5.8 0H4.2c-.2 0-.3.1-.3.2l-.2 1c-.4.1-.7.3-1.1.6l-1-.3c-.2 0-.3 0-.4.1l-.8 1.4c-.1.2 0 .3.1.4l.8.5c0 .2-.1.5-.1.8s0 .5.1.8l-.8.5c-.1.1-.2.2-.1.4l.8 1.4c.1.1.2.2.4.1l1-.3c.3.3.7.5 1.1.6l.2 1c0 .1.1.2.3.2h1.6c.2 0 .3-.1.3-.2l.2-1c.4-.1.7-.3 1.1-.6l1 .3c.2 0 .3 0 .4-.1l.8-1.4c.1-.2 0-.3-.1-.4zM5 6.5c-.8 0-1.5-.7-1.5-1.5S4.2 3.5 5 3.5 6.5 4.2 6.5 5 5.8 6.5 5 6.5z"/></svg>`,minimize:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><rect x="1" y="4" width="8" height="2"/></svg>`,expand:`<svg width="8" height="8" viewBox="0 0 8 8" fill="currentColor"><polygon points="1,1 7,4 1,7"/></svg>`},_=document.createElement(`div`);_.id=`simulator`,_.dataset.puzzmoBuild=ae,_.innerHTML=`
|
|
462
462
|
<style>
|
|
463
463
|
:root {
|
|
464
464
|
--sim-bg: #1a1a2e;
|
|
@@ -1926,5 +1926,5 @@ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.len
|
|
|
1926
1926
|
</div>
|
|
1927
1927
|
</div>
|
|
1928
1928
|
</div>
|
|
1929
|
-
`,document.body.appendChild(_);let v=_.querySelector(`#simulator-panel`),y=_.querySelector(`#simulator-header`),b=_.querySelector(`#simulator-header-indicator`),x=_.querySelector(`#simulator-header-status-text`),S=_.querySelector(`#simulator-header-pause`),C=_.querySelector(`#simulator-header-retry`),w=_.querySelector(`#simulator-header-settings`),T=_.querySelector(`#simulator-toggle`),E=_.querySelector(`#simulator-timer`),D=_.querySelector(`#simulator-tabs`),O=_.querySelector(`#simulator-content`),k=e=>_.querySelector(e),A=e=>{S.innerHTML=e?g.play:g.pause,S.title=e?`Resume`:`Pause`},j=(e,t)=>{let n=k(`#simulator-status .text`),r=k(`#simulator-status .indicator`),i=t===`complete`?`✓`:``;n&&(n.textContent=e),r&&(r.className=`indicator ${t}`,r.textContent=i),b.className=t,b.textContent=i,x.textContent=e},
|
|
1930
|
-
//# sourceMappingURL=createSimulator-
|
|
1929
|
+
`,document.body.appendChild(_);let v=_.querySelector(`#simulator-panel`),y=_.querySelector(`#simulator-header`),b=_.querySelector(`#simulator-header-indicator`),x=_.querySelector(`#simulator-header-status-text`),S=_.querySelector(`#simulator-header-pause`),C=_.querySelector(`#simulator-header-retry`),w=_.querySelector(`#simulator-header-settings`),T=_.querySelector(`#simulator-toggle`),E=_.querySelector(`#simulator-timer`),D=_.querySelector(`#simulator-tabs`),O=_.querySelector(`#simulator-content`),k=e=>_.querySelector(e),A=e=>{S.innerHTML=e?g.play:g.pause,S.title=e?`Resume`:`Pause`},j=(e,t)=>{let n=k(`#simulator-status .text`),r=k(`#simulator-status .indicator`),i=t===`complete`?`✓`:``;n&&(n.textContent=e),r&&(r.className=`indicator ${t}`,r.textContent=i),b.className=t,b.textContent=i,x.textContent=e},M=(e,t)=>{t&&t!==`0`?E.innerHTML=`${e}<span class="penalty">+${t}</span>`:E.textContent=e},F=e=>{var t;h.activeTab=e,O.classList.remove(`hidden`),ne(e),D.querySelectorAll(`.simulator-tab`).forEach(t=>{t.classList.toggle(`active`,t.getAttribute(`data-tab`)===e)}),_.querySelectorAll(`.simulator-tab-content`).forEach(t=>{t.classList.toggle(`active`,t.id===`simulator-tab-${e}`)}),w.classList.toggle(`active`,e===`auth`);let n=p.find(t=>t.id===e);n==null||(t=n.onActivate)==null||t.call(n,H)},I=e=>{h.isCollapsed=e,v.classList.toggle(`collapsed`,e),te(e),e?(O.classList.add(`hidden`),D.querySelectorAll(`.simulator-tab`).forEach(e=>e.classList.remove(`active`))):F(h.activeTab)},L=()=>{f.updatePreview(H)},R=function(){var e=n.t(function*(){var e,t;if(h.appliedPuzzleOverride!==null)return h.appliedPuzzleOverride;if(h.puzzleData)return h.puzzleData;if(!l||l.size===0)throw Error(`No fixtures configured. Add puzzle fixture files (.json or .toml) to a fixtures directory and pass fixturesGlob to the simulator.`);let n=(e=h.selectedCategory)==null?u[0]:e,r=n?l.get(n):void 0;if(!r||r.size===0)throw Error(`No puzzles found in fixture category "${n}"`);let i=(t=h.selectedPuzzle)==null?r.keys().next().value:t,a=i?r.get(i):void 0;if(!a)throw Error(`Puzzle "${i}" not found in category "${n}"`);h.puzzleData=a,console.log(`Simulator: Puzzle loaded from fixtures`,{category:n,puzzle:i}),h.originalPuzzle=a;let o=k(`#simulator-puzzle`);return o&&(o.value=h.originalPuzzle),h.activeTab===`thumb`&&L(),h.puzzleData});return function(){return e.apply(this,arguments)}}(),z=N(e=>{d.addLogEntry(e,H)}),B=(e,t)=>{P(e,t,z)},se=e=>{var t;let n=(t=e.buckets)!=null&&t.length?e.buckets:u,r=n.find(e=>{var t;return!(!(l==null||(t=l.get(e))==null)&&t.size)});if(r!==void 0||!n.length)return{nonce:e.nonce,error:`No fixtures in "${r==null?``:r}" to stand in for a pool`,failed:!0};let i=n.flatMap(e=>[...l.get(e).keys()].map(t=>`fixtures/${e}/${t}`)),a=i.filter(t=>{var n;return!((n=e.exclude)!=null&&n.includes(t))}),o=a.length?a:i,s=o[Math.floor(Math.random()*o.length)],[,c,...d]=s.split(`/`);return{nonce:e.nonce,puzzle:{key:s,puzzle:l.get(c).get(d.join(`/`))}}},V=(e,t)=>{let n=_.querySelector(`[data-badge="${e}"]`);n&&(n.textContent=t&&t>0?String(t):``)},H={state:h,getElement:k,sendToGame:B,logMessage:z.log,loadPuzzle:R,updateStatus:j,updateTimer:M,setCollapsed:I,switchTab:F,updateThumbnail:L,updateBadge:V,fixtures:l,fixtureCategories:u,gameSlug:(s=e.slug)==null?null:s};console.log(`[Simulator] Context created with gameSlug:`,H.gameSlug),p.forEach(e=>e.bind(H)),D.querySelectorAll(`.simulator-tab`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.getAttribute(`data-tab`);F(t),V(t,0)})}),T.addEventListener(`click`,e=>{e.stopPropagation(),I(!0)}),S.addEventListener(`click`,e=>{e.stopPropagation(),h.isPaused?(B(`RESUME_GAME`,{}),h.isPaused=!1,A(!1),j(`Running`,`ready`)):(B(`PAUSE_GAME`,{}),h.isPaused=!0,A(!0),j(`Paused`,`paused`));let t=k(`#simulator-pause`);t&&(t.textContent=h.isPaused?`Resume`:`Pause`)}),C.addEventListener(`click`,e=>{e.stopPropagation(),B(`RETRY_PUZZLE`,{}),h.hasStarted=!1,h.isPaused=!1,A(!1),S.disabled=!0,j(`Ready to retry`,`ready`);let t=k(`#simulator-pause`),n=k(`#simulator-start`);t&&(t.disabled=!0,t.textContent=`Pause`),n&&(n.textContent=`Start`)}),w.addEventListener(`click`,e=>{e.stopPropagation(),h.isCollapsed&&I(!1),F(`auth`)}),y.addEventListener(`click`,e=>{h.isCollapsed&&e.target!==T&&I(!1)}),h.isCollapsed||F(h.activeTab);let U=new URLSearchParams(window.location.search);(U.has(`code`)||U.has(`error`))&&(I(!1),F(`auth`));let le=e=>{let t={additionalTimeAddedSecs:0,boardState:h.currentInputStr,combinedTimeSecs:0,completed:!1,createdAt:new Date().toISOString(),elapsedTimeSecs:0,id:`simulator-gameplay-${Date.now()}`,ownerID:`simulator-owner`,pointsAwarded:0,slug:`simulator-game`,viewerOwnsPuzzle:!0},n=e===null?void 0:{gameplay:t,puzzle:{id:`simulator-puzzle`,name:`Proto Jig Puzzle`,puzzle:e,mostRecentDaily:null}};return{userState:{gameSettings:{"proto-game":h.gameSettings},id:`simulator-user`,ownerID:`simulator-owner`},currentUser:{id:`simulator-user`,name:`Simulator`,username:`simulator`,usernameID:`0000`,type:`User`,roles:``},game:qt,session:n,viewerStorage:h.userStorage,theme:h.selectedTheme,hostContext:h.hostContext,appRuntimeContract:`1.0`}},W=[`1.0`,`1.1`],G=function(){var r=n.t(function*(n){let r=e.session!==!1||n===`1.0`;r?e.session===!1&&console.warn("Simulator: `session: false` needs a game built on an SDK speaking runtime contract 1.1 or later"):console.log(`Simulator: Sending READY_DATA without a session`),j(r?`Loading puzzle...`:`Sending READY_DATA...`,`waiting`);try{let e=t.t(t.t({},le(r?yield R():null)),{},{appRuntimeContract:n});j(`Sending READY_DATA...`,`waiting`),B(`READY_DATA`,e),j(`Waiting for game to load...`,`waiting`)}catch(e){j(`Error: ${e}`,`paused`)}});return function(e){return r.apply(this,arguments)}}(),ue=()=>{console.log(`Simulator: Game loaded, ready to start`),C.disabled=!1,p.forEach(e=>{var t;return(t=e.onMessage)==null?void 0:t.call(e,`READY_GAME_LOADED`,void 0,H)}),c&&!h.hasStarted&&setTimeout(()=>{let e=k(`#simulator-start`);e==null||e.click(),S.disabled=!1,h.hasStarted=!0,j(`Running`,`ready`)},100)};return re((e,t)=>{var n,r;if(e===`READY`){console.log(`Simulator: Received READY from game`),G(W.includes(t==null?void 0:t.runtimeContract)?t.runtimeContract:`1.0`);return}if(e===`READY_GAME_LOADED`){ue();return}if(e===`TIMER_TICK`){if(t!=null&&t.display){let[e,n]=t.display;M(e,n)}return}if(e===`TIMER_SYNC`)return;if(e===`SIDEBAR_UPDATE`){console.log(`Simulator: Sidebar update`,t);return}p.forEach(n=>{var r;return(r=n.onMessage)==null?void 0:r.call(n,e,t,H)});let i=(n=t==null||(r=t.input)==null?void 0:r.boardState)==null?t==null?void 0:t.boardState:n;if(e===`UPLOAD_NEW_GAME_STATE`&&i&&(h.currentInputStr=i,h.activeTab===`thumb`&&L(),console.log(`Simulator: Game state uploaded`,t)),e===`COMPLETE_REPEATABLE_RUN`&&console.log(`Simulator: Repeatable run completed`,t),e===`REQUEST_PUZZLE`){B(`PUZZLE_DATA`,se(t));return}if(e===`UPDATE_GAME_USER_STATE`&&typeof(t==null?void 0:t.state)==`string`){var a;h.userStorage={state:t.state,stateVersion:(a=t.stateVersion)==null?1:a},console.log(`Simulator: Game user storage updated`,t)}e===`GAME_COMPLETED`&&(console.log(`Simulator: Game completed!`,t),S.disabled=!0,h.hasStarted=!1,j(`Completed!`,`complete`))},z),console.log(`Simulator initialized`),$={updateFixtures:e=>{l=ie(e),u=Array.from(l.keys()).sort(),H.fixtures=l,H.fixtureCategories=u;let t=localStorage.getItem(`simulator-fixture-category`);if(!h.selectedCategory||!u.includes(h.selectedCategory)){var n;h.selectedCategory=t&&u.includes(t)?t:(n=u[0])==null?null:n}let r=p.find(e=>e.id===`ctrl`);r==null||r.bind(H),console.log(`Simulator: Fixtures updated`,{categories:u,selectedCategory:h.selectedCategory})},sendToGame:B,loadPuzzle:R},$}var qt={id:`simulator-game`,slug:`proto-game`,stableSlug:`proto-game`,displayName:`Proto Game`,version:{id:`simulator-version`,label:null,featuresArr:[0],flagsArr:[0],runtime:{id:`simulator-runtime`,version:null}}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Kt}});
|
|
1930
|
+
//# sourceMappingURL=createSimulator-Bb1LTB5P.cjs.map
|