smartdown
Version:
A library for translating, rendering and interacting with Smartdown documents. Smartdown is an extension of Markdown that provides richer media support and reactive programming capability.
2 lines • 712 kB
JavaScript
/*! For license information please see smartdown.js.LICENSE.txt */
!function(e,f){"object"==typeof exports&&"object"==typeof module?module.exports=f():"function"==typeof define&&define.amd?define("smartdown",[],f):"object"==typeof exports?exports.smartdown=f():e.smartdown=f()}(self,(()=>(()=>{var e,f,t,n,r={9724:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(4883)],void 0===(o="function"==typeof(n=function(e,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){(0,f.registerExtension)("abc",["smartdownBase:lib/abcjs_midi_5.9.1-min.js","smartdownBase:lib/abcjs-midi-no-fa.css"])}})?n.apply(f,r):n)||(e.exports=o)},2742:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t(4883)],void 0===(o="function"==typeof(n=function(f){"use strict";var t={register:function(){(0,f.registerExtension)("brython",["https://cdn.rawgit.com/brython-dev/brython/3.9.2/www/src/brython.js","https://cdn.rawgit.com/brython-dev/brython/3.9.2/www/src/brython_stdlib.js"])},generateAugmentedPlayable:function(e,f,t){var n;if(f)console.log("Brython.generateAugmentedPlayable isModule==true not yet implemented");else{var r=e+"_brython";n="\nconst pythonSource =\n`".concat(t,"`;\n\n\nlet s = document.getElementById('").concat(r,"');\nif (!s) {\n s = document.createElement('script');\n s.type = 'text/python3';\n s.id = '").concat(r,"';\n}\n\ns.innerHTML = '';\n\ntry {\n s.appendChild(document.createTextNode(pythonSource));\n document.body.appendChild(s);\n} catch (e) {\n s.text = code;\n document.body.appendChild(s);\n}\n\nconst div = document.getElementById(\"").concat(e,'");\nconst smartdownPlayableContext = {\n smartdown: smartdown,\n divId: "').concat(e,"\",\n div: div,\n this: this,\n env: env\n};\n\nif (typeof __BRYTHON__ === 'object') {\n if (!__BRYTHON__.isConfiguredForSmartdown) {\n window.$locals___main__ = {};\n // https://github.com/brython-dev/brython/blob/master/www/doc/en/options.md\n const options = {\n debug: 1,\n cache: false,\n static_stdlib_import: false,\n ids: [],\n indexedDB: true,\n };\n const brythonResult = brython(options);\n __BRYTHON__.isConfiguredForSmartdown = true;\n }\n\n const moduleName = '").concat(r,"'; // '__main__';\n const localsId = '").concat(r,"';\n const lineInfo = null;\n\n // https://github.com/brython-dev/brython/wiki/How-Brython-works\n __BRYTHON__.$options = {\n debug: 1\n };\n\n window['$locals_' + moduleName] = {};\n const tree = __BRYTHON__.py2js(\n pythonSource,\n moduleName,\n moduleName, // localsId,\n lineInfo); // .to_js();\n let js = tree.to_js();\n var ns = __BRYTHON__.$call(__BRYTHON__.builtins.dict)();\n __BRYTHON__.smartdown = smartdownPlayableContext;\n __BRYTHON__.__ARGV = [smartdownPlayableContext];\n\n eval(js, ns);\n}\nelse {\n const errorMsg = '__BRYTHON__ is not defined. Probably due to debugging or some failure to load the Brython library';\n console.log(errorMsg);\n div.innerHTML = '<h4>' + errorMsg + '</h4>';\n}\n")}return n}};e.exports=t})?n.apply(f,r):n)||(e.exports=o)},4027:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(4883)],void 0===(o="function"==typeof(n=function(e,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){(0,f.registerExtension)("d3",["https://unpkg.com/d3/dist/d3.min.js",function(){window.smartdown.d3=window.d3=d3},"https://cdn.jsdelivr.net/npm/d3-cloud/build/d3.layout.cloud.min.js",function(){window.d3cloud=window.d3.layout.cloud,window.smartdown.d3cloud=window.d3cloud},"https://unpkg.com/topojson/dist/topojson.js",function(){window.smartdown.topojson=window.topojson},"smartdownBase:lib/webcomponents-loader.js","https://cdnjs.cloudflare.com/ajax/libs/crossfilter2/1.4.7/crossfilter.min.js","https://unpkg.com/d3fc/build/d3fc.js",function(){window.d3fc=window.fc,window.smartdown.d3fc=window.d3fc},"https://unpkg.com/dc/dist/dc.min.js","https://unpkg.com/dc/dist/style/dc.min.css",function(){window.d3dc=window.dc,window.smartdown.d3dc=window.d3dc,window.d3dc.config.defaultColors(window.d3.schemeCategory10)},"https://unpkg.com/d3-sankey/dist/d3-sankey.min.js"])}})?n.apply(f,r):n)||(e.exports=o)},1364:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t(1790),t(564),t(8155),t(4883)],n=function(f,n,r,o){"use strict";var a=t(6784);f=a(f),n=a(n),r=a(r);var i={};function s(){Filament.applyResult=function(){var e=(0,r.default)(f.default.mark((function e(t,r,o){var a,i;return f.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t){e.next=4;break}smartdown.consoleWrite(r,["Filament.eval_code() returns undefined"]),e.next=18;break;case 4:if("object"!==(0,n.default)(t)){e.next=17;break}if("function"!=typeof t.cb){e.next=13;break}return a=o.div.id+"_canvas",o.div.innerHTML='\n <canvas\n id="'.concat(a,'"\n style="display: block; margin: auto;"\n xwidth="300"\n height="300"></canvas>\n '),i=document.getElementById(a),e.next=11,t.cb(i);case 11:e.next=15;break;case 13:smartdown.consoleWrite(r,[t]),t.toString&&smartdown.consoleWrite(r,[t.toString()]);case 15:e.next=18;break;case 17:smartdown.consoleWrite(r,["Filament.eval_code() returns ",(0,n.default)(t),t]);case 18:case"end":return e.stop()}}),e)})));return function(f,t,n){return e.apply(this,arguments)}}(),Filament.addSmartdownFunctionsToScope=function(e,t,n){e.install(new Filament.FilamentFunctionWithScope("print",{msg:Filament.REQUIRED},(function(e,f){smartdown.consoleWrite(t,[f])}))),e.install(new Filament.FilamentFunctionWithScope("sd_set",{name:Filament.REQUIRED,value:Filament.REQUIRED},(function(e,f,t){smartdown.setVariable(f.value,t.value)}))),e.install(new Filament.FilamentFunctionWithScope("sd_get",{name:Filament.REQUIRED},(function(e,f){return Filament.string(smartdown.smartdownVariables[f.value])}))),e.install(new Filament.FilamentFunctionWithScope("sd_watch",{name:Filament.REQUIRED,handler:Filament.REQUIRED},(function(e,o,a){n.dependOn[o.value]=(0,r.default)(f.default.mark((function e(){var r;return f.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.fun(Filament.string(smartdown.smartdownVariables[o.value]));case 2:return r=e.sent,e.next=5,Filament.applyResult(r,t,n);case 5:case"end":return e.stop()}}),e)})))})))}}i.register=function(){(0,o.registerExtension)("filament",["smartdownBase:lib/filament.js",s])},i.generateAugmentedPlayable=function(e,f){var t;return e?console.log("FilamentExtension.generateAugmentedPlayable isModule==true not yet implemented"):t="(async () => {\nconst filamentSource =\n`".concat(f,"`;\n\nif (typeof Filament === 'object') {\n const localScope = Filament.make_standard_scope();\n Filament.addSmartdownFunctionsToScope(localScope, playable, this);\n\n const ret = await Filament.parseAndEvalWithScope(filamentSource, localScope);\n await Filament.applyResult(ret, playable, this);\n}\nelse {\n const errorMsg = 'Filament is not defined.\\nProbably due to debugging or some failure to load the Filament library';\n this.log(errorMsg);\n}\n})();"),t},e.exports=i},void 0===(o=n.apply(f,r))||(e.exports=o)},4319:function(e,f,t){var n,r;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,void 0===(r="function"==typeof(n=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var f=window.lodashEach=t(5390),n=[];window.smartdownJSModules.graphviz={loader:function(e){window.smartdownJSModules.graphviz.loaded?e():window.smartdownJSModules.graphviz.loadedCallbacks.length>0?window.smartdownJSModules.graphviz.loadedCallbacks.push(e):(window.smartdownJSModules.graphviz.loadedCallbacks.push(e),window.smartdown.importScriptUrl("smartdownBase:lib/viz.js",(function(){window.smartdown.importScriptUrl("smartdownBase:lib/lite.render.js",(function(){f(window.mediaRegistry,(function(e){n.push({path:e.url,width:"200px",height:"200px"})})),window.graphvizImages=n;var e=window.smartdownJSModules.graphviz.loadedCallbacks;window.smartdownJSModules.graphviz.loadedCallbacks=[],e.forEach((function(e){e()}))}))})))},loaded:null,loadedCallbacks:[]},e.default=n})?n.apply(f,[f]):n)||(e.exports=r)},1257:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(4883)],void 0===(o="function"==typeof(n=function(e,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){(0,f.registerExtension)("leaflet",["https://unpkg.com/leaflet/dist/leaflet.js","https://unpkg.com/leaflet/dist/leaflet.css",function(){window.Leaflet=window.L}])}})?n.apply(f,r):n)||(e.exports=o)},9453:function(e,f,t){var n,r;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,void 0===(r="function"==typeof(n=function(){"use strict";e.exports=function(){var e=window.MathJax;t.g.MathJax=window.MathJax,e.Hub.Config({"fast-preview":{},TeX:{MultLineWidth:"85%",equationNumbers:{autoNumber:"none"},extensions:["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js","autobold.js","AMScd.js","mhchem.js","action.js","extpfeil.js",window.xypicURL]},"HTML-CSS":{matchFontHeight:!1},tex2jax:{preview:"none",inlineMath:[["$","$"],["\\(","\\)"]],displayMath:[["$$","$$"],["\\[","\\]"]],processEscapes:!0,skipTags:["script","noscript","style","textarea","pre","code","annotation","annotation-xml"]},asciimath2jax:{delimiters:[["@","@"]]},skipStartupTypeset:!0,showProcessingMessages:!1,displayAlign:"center",positionToHash:!1}),e.Hub.Register.MessageHook("Math Processing Error",(function(f){console.log("Math Processing Error",f,e.Hub.lastError)}))}})?n.apply(f,[]):n)||(e.exports=r)},2539:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(4883)],void 0===(o="function"==typeof(n=function(e,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t={mermaid:null,mermaidRender:null};function n(e,f){t.mermaid?(e.classList.add("mermaid"),t.mermaid.render(e.id+"_svg",f,(function(f){var t=function(e){var f="<style>",t="</style>",n=(e=e.replace(/\n/g,"")).indexOf(f),r=e.indexOf(t),o=e.slice(n+7,r).trim().split(/}/g);--o.length;var a=f+o.map((function(e){var f=e.indexOf("{"),t=e.slice(0,f),n=e.slice(f),r=t.replace(/,/g,",.mermaid ");return(r=(r=".mermaid "+r).replace(/.mermaid .mermaid/g,".mermaid"))+n})).join("}")+t;return e.slice(0,n)+a+e.slice(r+8)}(f);e.innerHTML=t}),e)):e.innerHTML="mermaidjs not loaded"}t.register=function(){(0,f.registerExtension)("mermaid",["https://unpkg.com/mermaid@9.4/dist/mermaid.min.js",function(){console.log("mermaid loaded"),t.mermaid=window.mermaid,t.mermaidRender=n,t.mermaid.initialize({startOnLoad:!1,cloneCssStyles:!1,logLevel:3,htmlLabels:!0,fontSize:16,flowchart:{htmlLabels:!0,useMaxWidth:!1},sequence:{diagramMarginX:50,diagramMarginY:20,actorMargin:40,width:120,height:40,boxMargin:20,boxTextMargin:5,noteMargin:5,messageMargin:55,mirrorActors:!1,bottomMarginAdj:0,useMaxWidth:!1},ganttchart:{titleTopMargin:15,diagramMarginX:10,diagramMarginY:10,barHeight:20,barGap:4,topPadding:50,sidePadding:75,gridLineStartPadding:35,fontSize:16,numberSectionStyles:3,useMaxWidth:!1}})}])},e.default=t})?n.apply(f,r):n)||(e.exports=o)},4433:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(4883)],void 0===(o="function"==typeof(n=function(e,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t={register:function(){(0,f.registerExtension)("openjscad",["https://unpkg.com/@jscad/core/dist/jscad-core.min.js","https://unpkg.com/@jscad/modeling/dist/jscad-modeling.min.js","https://unpkg.com/@jscad/regl-renderer/dist/jscad-regl-renderer.min.js",function(){var e,f={readFileSync:function(){return e}},t={extensions:{}};jscadCore.io.registerAllExtensions(f,t);var n=t.extensions[".stl"];window.jscadStlDeserializer={deserializer:{deserialize:function(f,t){e=t;var r={};return n(r,"hello",t),r.exports[0]}},extension:"stl"}}])},generateInnerHTML:function(e){return'\n<div\n class="openjscad-container">\n <div\n id="'.concat(e,'-viewerDiv"\n class="viewerDiv">\n </div>\n <div\n class="viewer-footer">\n <button\n onclick="window.resetCamera').concat(e,'()">\n Reset Camera\n </button>\n <button\n onclick="window.exportSTL').concat(e,'()">\n Export STL\n </button>\n <table\n id="').concat(e,'-parametersTable"\n class="openjscad-parametersTable">\n </table>\n </div>\n</div>\n')},generateAugmentedPlayable:function(e,f){return"\n// Begin Augmented script\nconst viewerDivId = '".concat(e,"-viewerDiv';\nconst parametersTableId = '").concat(e,"-parametersTable';\n\nconst viewerDiv = document.getElementById(viewerDivId);\nconst parametersTable = document.getElementById(parametersTableId);\n\n// ********************\n// Renderer configuration and initiation.\n// ********************\nconst { prepareRender, drawCommands, cameras, controls, entitiesFromSolids } = jscadReglRenderer;\n\nconst perspectiveCamera = cameras.perspective;\nconst orbitControls = controls.orbit;\n\nconst containerElement = viewerDiv;\n\nconst width = containerElement.clientWidth\nconst height = containerElement.clientHeight\n\nconst state = {}\n\n// prepare the camera\nstate.camera = Object.assign({}, perspectiveCamera.defaults)\nperspectiveCamera.setProjection(state.camera, state.camera, { width, height })\nperspectiveCamera.update(state.camera, state.camera)\n\n// prepare the controls\nstate.controls = orbitControls.defaults\n\n// prepare the renderer\nconst setupOptions = {\n glOptions: { container: containerElement },\n}\nconst renderer = prepareRender(setupOptions)\n\nconst gridOptions = {\n visuals: {\n drawCmd: 'drawGrid',\n show: true,\n color: [0, 0, 0, 1],\n subColor: [0, 0, 1, 0.5],\n fadeOut: false,\n transparent: true\n },\n size: [200, 200],\n ticks: [10, 1]\n};\n\nconst axisOptions = {\n visuals: {\n drawCmd: 'drawAxis',\n show: true\n },\n};\n\nconst wrapper = async () => {\n const packageNameToGlobal = {\n '@jscad/core': jscadCore,\n '@jscad/modeling': jscadModeling,\n '@jscad/stl-deserializer': jscadStlDeserializer,\n // '@jscad/io/io': jscadIoIo,\n };\n\n const require = (packageName) => {\n const result = packageNameToGlobal[packageName];\n if (!result) {\n console.log(`Error in require('${packageName}'). Package not available.`);\n }\n return result;\n };\n\n const module = {\n exports: {},\n };\n\n ").concat(f,"\n\n const smartdownOpenJSCADMain = module.exports.main;\n const smartdownOpenJSCADParams = {};\n\n if (module.exports.getParameterDefinitions) {\n module.exports.getParameterDefinitions().forEach((def) => {\n smartdownOpenJSCADParams[def.name] = def.initial;\n });\n }\n\n return smartdownOpenJSCADMain(smartdownOpenJSCADParams);\n}\n\nconst model = await wrapper();\nlet resetView = false;\nlet zoomToFit = true;\n\nconst entities = entitiesFromSolids({}, model)\n\n// assemble the options for rendering\nconst renderOptions = {\n rendering: {\n background: [0.9, 0.9, 1, 1],\n meshColor: [0, 0.6, 1, 1],\n autoRotate: false,\n autoZoom: false\n },\n camera: state.camera,\n drawCommands: {\n drawAxis: drawCommands.drawAxis,\n drawGrid: drawCommands.drawGrid,\n drawLines: drawCommands.drawLines,\n drawMesh: drawCommands.drawMesh\n },\n // define the visual content\n entities: [\n gridOptions,\n axisOptions,\n ...entities\n ]\n}\n\n// the heart of rendering, as themes, controls, etc change\nlet updateView = true\n\nconst doRotatePanZoom = () => {\n if (rotateDelta[0] || rotateDelta[1]) {\n const updated = orbitControls.rotate({ controls: state.controls, camera: state.camera, speed: rotateSpeed }, rotateDelta)\n state.controls = { ...state.controls, ...updated.controls }\n updateView = true\n rotateDelta = [0, 0]\n }\n\n if (panDelta[0] || panDelta[1]) {\n const updated = orbitControls.pan({ controls:state.controls, camera:state.camera, speed: panSpeed }, panDelta)\n state.controls = { ...state.controls, ...updated.controls }\n panDelta = [0, 0]\n state.camera.position = updated.camera.position\n state.camera.target = updated.camera.target\n updateView = true\n }\n\n if (zoomDelta) {\n const updated = orbitControls.zoom({ controls:state.controls, camera:state.camera, speed: zoomSpeed }, zoomDelta)\n state.controls = { ...state.controls, ...updated.controls }\n zoomDelta = 0\n updateView = true\n }\n\n if (zoomToFit) {\n const updated = orbitControls.zoomToFit({ controls:state.controls, camera:state.camera, entities })\n state.controls = { ...state.controls, ...updated.controls }\n\n updateView = true;\n zoomToFit = false;\n }\n\n if (resetView) {\n console.log('resetView', state.camera.position, state.camera.target);\n state.camera.position = [1, 1, 1];\n state.camera.target = [0, 0, 0];\n const updated = orbitControls.zoomToFit({ controls:state.controls, camera:state.camera, entities })\n state.controls = { ...state.controls, ...updated.controls }\n\n updateView = true;\n resetView = false;\n }\n}\n\nconst updateAndRender = (timestamp) => {\n doRotatePanZoom()\n\n if (updateView) {\n const updates = orbitControls.update({ controls: state.controls, camera: state.camera })\n state.controls = { ...state.controls, ...updates.controls }\n updateView = state.controls.changed // for elasticity in rotate / zoom\n\n state.camera.position = updates.camera.position\n perspectiveCamera.update(state.camera)\n\n renderer(renderOptions)\n }\n window.requestAnimationFrame(updateAndRender)\n}\nwindow.requestAnimationFrame(updateAndRender);\n\n// convert HTML events (mouse movement) to viewer changes\nlet lastX = 0;\nlet lastY = 0;\n\nconst rotateSpeed = 0.002\nconst panSpeed = 1\nconst zoomSpeed = 0.08\nlet rotateDelta = [0, 0]\nlet panDelta = [0, 0]\nlet zoomDelta = 0\nlet pointerDown = false\nlet lastDistance = null;\nlet scaling = false;\nlet panning = false;\n\nconst downHandler = (ev) => {\n pointerDown = true\n lastX = ev.pageX\n lastY = ev.pageY\n // console.log('downHandler', ev.pageX, ev.pageY);\n containerElement.setPointerCapture(ev.pointerId)\n // ev.stopPropagation();\n // ev.preventDefault();\n};\n\nconst moveHandler = (ev) => {\n if (!pointerDown) return\n if (scaling) return\n // console.log('moveHandler', scaling, ev.pageX, ev.pageY);\n\n const dx = lastX - ev.pageX \n const dy = ev.pageY - lastY\n\n const shiftKey = (ev.shiftKey === true) || panning\n if (shiftKey) {\n panDelta[0] += dx\n panDelta[1] += dy\n } else {\n rotateDelta[0] -= dx\n rotateDelta[1] -= dy\n }\n\n lastX = ev.pageX\n lastY = ev.pageY\n\n ev.preventDefault()\n ev.stopPropagation();\n};\n\nconst upHandler = (ev) => {\n // console.log('upHandler', ev.pageX, ev.pageY);\n pointerDown = false\n containerElement.releasePointerCapture(ev.pointerId);\n lastDistance = null;\n // ev.stopPropagation();\n // ev.preventDefault();\n};\n\nconst wheelHandler = (ev) => {\n zoomDelta += ev.deltaY\n ev.preventDefault()\n};\n\ncontainerElement.onpointerdown = downHandler;\ncontainerElement.onpointermove = moveHandler;\ncontainerElement.onpointerup = upHandler;\n\nconst touchStartHandler = (e) => {\n // console.log('touchStartHandler', e);\n if (e.touches.length === 2) {\n // console.log('touchStartHandler2', e.touches.length);\n scaling = true;\n }\n else if (e.touches.length === 3) {\n panning = true;\n }\n};\n\nconst touchMoveHandler = (e) => {\n // console.log('touchMoveHandler', e);\n if (scaling) {\n const distance = Math.hypot(\n e.touches[0].pageX - e.touches[1].pageX,\n e.touches[0].pageY - e.touches[1].pageY);\n if (lastDistance !== null) {\n // console.log('#touchMoveHandler2', distance, lastDistance, distance - lastDistance);\n zoomDelta -= distance - lastDistance;\n }\n lastDistance = distance;\n }\n};\n\nconst touchEndHandler = (e) => {\n // console.log('touchEndHandler', e);\n scaling = false;\n panning = false;\n};\n\ncontainerElement.ontouchstart = touchStartHandler;\ncontainerElement.ontouchmove = touchMoveHandler;\ncontainerElement.ontouchend = touchEndHandler;\n\ncontainerElement.onwheel = wheelHandler;\n\nwindow[`resetCamera").concat(e,"`] = function() {\n resetView = true;\n // zoomToFit = true;\n updateView = true;\n};\n\nwindow[`exportSTL").concat(e,"`] = function() {\n window.alert('Export STL is Not Yet Implemented.');\n console.log('exportSTL NYI', state, state.camera);\n};\n\n\n// End Augmented Code\n")}};e.default=t})?n.apply(f,r):n)||(e.exports=o)},1365:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(564)],void 0===(o="function"==typeof(n=function(e,f){"use strict";var n=t(6784);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,f=n(f);var r=t(4753),o=t(4018),a=t(7514),i={Loader:{},VarDefs:null,UserFunctionDefs:null,SystemVarDecls:null,SystemVarUpdates:null,SystemVarDefs:null};"object"===("undefined"==typeof process?"undefined":(0,f.default)(process))&&process.env.TEST_RUN&&(document.hasFocus=document.hasFocus||function(){return!1}),window.smartdownJSModules.p5js={loader:function(e){window.smartdownJSModules.p5js.loaded?e():window.smartdownJSModules.p5js.loadedCallbacks.length>0?window.smartdownJSModules.p5js.loadedCallbacks.push(e):(window.smartdownJSModules.p5js.loadedCallbacks.push(e),t.e(847).then(t.t.bind(t,8773,23)).then((function(e){window.smartdownJSModules.p5js.loaded=e,i.Loader=e.default,window.p5js=e,window.P5=i.Loader,window.p5=i.Loader,t.e(87).then(t.t.bind(t,482,23)).then((function(){var e=window.smartdownJSModules.p5js.loadedCallbacks;window.smartdownJSModules.p5js.loadedCallbacks=[],e.forEach((function(e){e()}))})).catch((function(e){console.log("loadP5Sound error",e)}))})).catch((function(e){console.log("loadP5JSerror",e)})))},loaded:null,loadedCallbacks:[]};var s=[];Object.keys(a).forEach((function(e){if(0!==e.indexOf("_"))if(-1!==o.indexOf(e));else if("function"===a[e])if("loadFont"===e){s.push("\n function loadFontWrapper(p5, path, callback, onError) {\n return p5.loadFont(path, callback, onError);\n }\n const loadFont = loadFontWrapper.bind(p5, p5);\n ")}else if("createCanvas"===e){s.push("\n function createCanvasWrapper(p5, w, h, renderer) {\n //console.log('in createCanvasWrapper', w, h, renderer);\n p5.createCanvas(w, h, renderer);\n width = p5.width;\n height = p5.height;\n }\n const createCanvas = createCanvasWrapper.bind(p5, p5);\n ")}else s.push("const ".concat(e," = p5.").concat(e,".bind(p5);"));else s.push("const "+e+" = p5."+e+";")})),i.VarDefs=s.join("\n");var c=[],l=[],d=[];o.forEach((function(e){c.push("var ".concat(e,";")),l.push("".concat(e," = p5.").concat(e,";")),d.push("const ".concat(e," = p5.").concat(e,";"))})),i.SystemVarDecls=c.join("\n"),i.SystemVarUpdates=l.join(""),i.SystemVarDefs=d.join("");var u=[];r.forEach((function(e){var f="if (typeof ".concat(e," === 'function') {\n p5.").concat(e," = function(p5, ").concat(e,") {\n ").concat(i.SystemVarUpdates,"\n\n ").concat(e,"();\n };\n p5.").concat(e," = p5.").concat(e,".bind(this, p5, ").concat(e,");\n }");u.push(f)})),i.UserFunctionDefs=u.join("\n"),e.default=i})?n.apply(f,r):n)||(e.exports=o)},7514:function(e,f){var t,n;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,void 0===(n="function"==typeof(t=function(){"use strict";e.exports={_initializeInstanceVariables:"function",P2D:"string",WEBGL:"string",ARROW:"string",CROSS:"string",HAND:"string",MOVE:"string",TEXT:"string",WAIT:"string",HALF_PI:"number",PI:"number",QUARTER_PI:"number",TAU:"number",TWO_PI:"number",DEGREES:"string",RADIANS:"string",DEG_TO_RAD:"number",RAD_TO_DEG:"number",CORNER:"string",CORNERS:"string",RADIUS:"string",RIGHT:"string",LEFT:"string",CENTER:"string",TOP:"string",BOTTOM:"string",BASELINE:"string",POINTS:"number",LINES:"number",LINE_STRIP:"number",LINE_LOOP:"number",TRIANGLES:"number",TRIANGLE_FAN:"number",TRIANGLE_STRIP:"number",QUADS:"string",QUAD_STRIP:"string",TESS:"string",CLOSE:"string",OPEN:"string",CHORD:"string",PIE:"string",PROJECT:"string",SQUARE:"string",ROUND:"string",BEVEL:"string",MITER:"string",RGB:"string",HSB:"string",HSL:"string",AUTO:"string",ALT:"number",BACKSPACE:"number",CONTROL:"number",DELETE:"number",DOWN_ARROW:"number",ENTER:"number",ESCAPE:"number",LEFT_ARROW:"number",OPTION:"number",RETURN:"number",RIGHT_ARROW:"number",SHIFT:"number",TAB:"number",UP_ARROW:"number",BLEND:"string",REMOVE:"string",ADD:"string",DARKEST:"string",LIGHTEST:"string",DIFFERENCE:"string",SUBTRACT:"string",EXCLUSION:"string",MULTIPLY:"string",SCREEN:"string",REPLACE:"string",OVERLAY:"string",HARD_LIGHT:"string",SOFT_LIGHT:"string",DODGE:"string",BURN:"string",THRESHOLD:"string",GRAY:"string",OPAQUE:"string",INVERT:"string",POSTERIZE:"string",DILATE:"string",ERODE:"string",BLUR:"string",NORMAL:"string",ITALIC:"string",BOLD:"string",BOLDITALIC:"string",_DEFAULT_TEXT_FILL:"string",_DEFAULT_LEADMULT:"number",_CTX_MIDDLE:"string",LINEAR:"string",QUADRATIC:"string",BEZIER:"string",CURVE:"string",STROKE:"string",FILL:"string",TEXTURE:"string",IMMEDIATE:"string",IMAGE:"string",NEAREST:"string",REPEAT:"string",CLAMP:"string",MIRROR:"string",LANDSCAPE:"string",PORTRAIT:"string",_DEFAULT_STROKE:"string",_DEFAULT_FILL:"string",GRID:"string",AXES:"string",_preloadMethods:"object",_registeredMethods:"object",_registeredPreloadMethods:"object",_frameRate:"number",_lastFrameTime:"number",_targetFrameRate:"number",print:"function",frameCount:"number",deltaTime:"number",focused:"boolean",cursor:"function",frameRate:"function",getFrameRate:"function",setFrameRate:"function",noCursor:"function",displayWidth:"number",displayHeight:"number",windowWidth:"number",windowHeight:"number",_onresize:"function",width:"number",height:"number",fullscreen:"function",pixelDensity:"function",displayDensity:"function",getURL:"function",getURLPath:"function",getURLParams:"function",_helpForMisusedAtTopLevelCode:"function",pushStyle:"function",popStyle:"function",popMatrix:"function",pushMatrix:"function",_promisePreloads:"object",registerPromisePreload:"function",_setupPromisePreloads:"function",_wrapPromisePreload:"function",_legacyPreloadGenerator:"function",camera:"function",perspective:"function",ortho:"function",frustum:"function",createCamera:"function",setCamera:"function",setAttributes:"function",_assert3d:"function",createCanvas:"function",resizeCanvas:"function",noCanvas:"function",createGraphics:"function",blendMode:"function",noLoop:"function",loop:"function",push:"function",pop:"function",redraw:"function",applyMatrix:"function",resetMatrix:"function",rotate:"function",rotateX:"function",rotateY:"function",rotateZ:"function",scale:"function",shearX:"function",shearY:"function",translate:"function",_normalizeArcAngles:"function",arc:"function",ellipse:"function",circle:"function",_renderEllipse:"function",line:"function",point:"function",quad:"function",rect:"function",square:"function",_renderRect:"function",triangle:"function",ellipseMode:"function",noSmooth:"function",rectMode:"function",smooth:"function",strokeCap:"function",strokeJoin:"function",strokeWeight:"function",bezier:"function",bezierDetail:"function",bezierPoint:"function",bezierTangent:"function",curve:"function",curveDetail:"function",curveTightness:"function",curvePoint:"function",curveTangent:"function",beginContour:"function",beginShape:"function",bezierVertex:"function",curveVertex:"function",endContour:"function",endShape:"function",quadraticVertex:"function",vertex:"function",alpha:"function",blue:"function",brightness:"function",color:"function",green:"function",hue:"function",lerpColor:"function",lightness:"function",red:"function",saturation:"function",background:"function",clear:"function",colorMode:"function",fill:"function",noFill:"function",noStroke:"function",stroke:"function",erase:"function",noErase:"function",createStringDict:"function",createNumberDict:"function",storeItem:"function",getItem:"function",clearStorage:"function",removeItem:"function",select:"function",selectAll:"function",_wrapElement:"function",removeElements:"function",createDiv:"function",createP:"function",createSpan:"function",createImg:"function",createA:"function",createSlider:"function",createButton:"function",createCheckbox:"function",createSelect:"function",createRadio:"function",createColorPicker:"function",createInput:"function",createFileInput:"function",createVideo:"function",createAudio:"function",VIDEO:"string",AUDIO:"string",createCapture:"function",createElement:"function",deviceOrientation:"string",accelerationX:"number",accelerationY:"number",accelerationZ:"number",pAccelerationX:"number",pAccelerationY:"number",pAccelerationZ:"number",_updatePAccelerations:"function",rotationX:"number",rotationY:"number",rotationZ:"number",pRotationX:"number",pRotationY:"number",pRotationZ:"number",pRotateDirectionX:"undefined",pRotateDirectionY:"undefined",pRotateDirectionZ:"undefined",_updatePRotations:"function",turnAxis:"undefined",setMoveThreshold:"function",setShakeThreshold:"function",_ondeviceorientation:"function",_ondevicemotion:"function",_handleMotion:"function",isKeyPressed:"boolean",keyIsPressed:"boolean",key:"string",keyCode:"number",_onkeydown:"function",_onkeyup:"function",_onkeypress:"function",_onblur:"function",keyIsDown:"function",_areDownKeys:"function",movedX:"number",movedY:"number",_hasMouseInteracted:"boolean",mouseX:"number",mouseY:"number",pmouseX:"number",pmouseY:"number",winMouseX:"number",winMouseY:"number",pwinMouseX:"number",pwinMouseY:"number",mouseButton:"number",mouseIsPressed:"boolean",_updateNextMouseCoords:"function",_updateMouseCoords:"function",_setMouseButton:"function",_onmousemove:"function",_onmousedown:"function",_onmouseup:"function",_ondragend:"function",_ondragover:"function",_onclick:"function",_ondblclick:"function",_mouseWheelDeltaY:"number",_pmouseWheelDeltaY:"number",_onwheel:"function",requestPointerLock:"function",exitPointerLock:"function",touches:"object",_updateTouchCoords:"function",_ontouchstart:"function",_ontouchmove:"function",_ontouchend:"function",createImage:"function",saveCanvas:"function",saveGif:"function",saveFrames:"function",_makeFrame:"function",loadImage:"function",image:"function",tint:"function",noTint:"function",_getTintedImageCanvas:"function",imageMode:"function",pixels:"object",blend:"function",copy:"function",_copyHelper:"function",filter:"function",get:"function",loadPixels:"function",set:"function",updatePixels:"function",loadJSON:"function",loadStrings:"function",loadTable:"function",loadXML:"function",loadBytes:"function",httpGet:"function",httpPost:"function",httpDo:"function",_pWriters:"object",createWriter:"function",save:"function",saveJSON:"function",saveJSONObject:"function",saveJSONArray:"function",saveStrings:"function",saveTable:"function",writeFile:"function",downloadFile:"function",_checkFileExtension:"function",_isSafari:"function",abs:"function",ceil:"function",constrain:"function",dist:"function",exp:"function",floor:"function",lerp:"function",log:"function",mag:"function",map:"function",max:"function",min:"function",norm:"function",pow:"function",round:"function",sq:"function",sqrt:"function",fract:"function",createVector:"function",noise:"function",noiseDetail:"function",noiseSeed:"function",_lcg:"function",_lcgSetSeed:"function",randomSeed:"function",random:"function",randomGaussian:"function",_angleMode:"string",acos:"function",asin:"function",atan:"function",atan2:"function",cos:"function",sin:"function",tan:"function",degrees:"function",radians:"function",angleMode:"function",_toRadians:"function",_toDegrees:"function",_fromRadians:"function",textAlign:"function",textLeading:"function",textSize:"function",textStyle:"function",textWidth:"function",textAscent:"function",textDescent:"function",_updateTextMetrics:"function",loadFont:"function",text:"function",textFont:"function",append:"function",arrayCopy:"function",concat:"function",reverse:"function",shorten:"function",shuffle:"function",sort:"function",splice:"function",subset:"function",float:"function",int:"function",str:"function",boolean:"function",byte:"function",char:"function",unchar:"function",hex:"function",unhex:"function",join:"function",match:"function",matchAll:"function",nf:"function",nfc:"function",nfp:"function",nfs:"function",split:"function",splitTokens:"function",trim:"function",day:"function",hour:"function",minute:"function",millis:"function",month:"function",second:"function",year:"function",plane:"function",box:"function",sphere:"function",cylinder:"function",cone:"function",ellipsoid:"function",torus:"function",orbitControl:"function",debugMode:"function",noDebugMode:"function",_grid:"function",_axesIcon:"function",ambientLight:"function",specularColor:"function",directionalLight:"function",pointLight:"function",lights:"function",lightFalloff:"function",spotLight:"function",noLights:"function",loadModel:"function",model:"function",loadShader:"function",createShader:"function",shader:"function",resetShader:"function",normalMaterial:"function",texture:"function",textureMode:"function",textureWrap:"function",ambientMaterial:"function",emissiveMaterial:"function",specularMaterial:"function",shininess:"function",isSupported:"function",isFileSupported:"function",getAudioContext:"function",userStartAudio:"function",soundOut:"object",sampleRate:"function",freqToMidi:"function",midiToFreq:"function",soundFormats:"function",disposeSound:"function",_checkFileFormats:"function",_mathChain:"function",loadSound:"function",createConvolver:"function",setBPM:"function",saveSound:"function"}})?t.apply(f,[]):t)||(e.exports=n)},4018:function(e,f){var t,n;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,void 0===(n="function"==typeof(t=function(){"use strict";e.exports=["canvas","frameCount","width","height","windowWidth","windowHeight","mouseX","mouseY","winMouseX","winMouseY","pmouseX","pmouseY","pwinMouseX","pwinMouseY","mouseButton","mouseIsPressed","touches","pAccelerationX","pAccelerationY","pAccelerationZ","pRotationX","pRotationY","pRotationZ","pAccelerationX","pAccelerationY","deviceOrientation","turnAxis","key","isKeyPressed","keyIsPressed","keyCode"]})?t.apply(f,[]):t)||(e.exports=n)},4753:function(e,f){var t,n;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,void 0===(n="function"==typeof(t=function(){"use strict";e.exports=["draw","setup","preload","mousePressed","mouseDragged","mouseMoved","mouseReleased","mouseClicked","mouseWheel","doubleClicked","windowResized","touchStarted","touchMoved","touchEnded","deviceMoved","deviceTurned","deviceShaken","keyPressed","keyReleased","keyTyped"]})?t.apply(f,[]):t)||(e.exports=n)},8078:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(4883)],void 0===(o="function"==typeof(n=function(e,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){(0,f.registerExtension)("plotly",["https://cdn.plot.ly/plotly-latest.min.js",function(){window.smartdown.mathjaxConfigure()}])}})?n.apply(f,r):n)||(e.exports=o)},5007:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(4883)],void 0===(o="function"==typeof(n=function(e,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t={register:function(){(0,f.registerExtension)("react",["https://unpkg.com/react@16/umd/react.development.js","https://unpkg.com/react-dom@16/umd/react-dom.development.js","https://unpkg.com/babel-standalone@6/babel.min.js"])},generateAugmentedPlayable:function(){return"// Augmented React Code to be transpiled.\n\nlet transformedReactCode;\ntry {\n transformedReactCode = Babel.transform(playable.code,\n {\n presets: [['es2015', { modules: false }], 'react', 'stage-0']\n }).code;\n}\ncatch (e) {\n console.log('error in Babel.transform()', e);\n this.log('# Babel.transform() error: ', e);\n}\n\nconst asyncWrapperCode =\n`\nconst outerThis = this;\nreturn (async function() {\n${transformedReactCode}\n}).call(outerThis);\n`;\n\nreturn smartdown.runFunction(asyncWrapperCode, this, [...arguments], 'react', this.div);\n"}};e.default=t})?n.apply(f,r):n)||(e.exports=o)},3638:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(846),t(4883)],void 0===(o="function"==typeof(n=function(e,f,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n={register:function(){(0,t.registerExtension)("stdlib",["smartdownBase:lib/stdlib-tree.min.js","smartdownBase:lib/stdlib-datasets-tree-exclude.min.js",function(){n.vdomToHtml=smartdown.vdomToHtml,window.Stdlib=n,smartdown.Stdlib=n,n.datasets={};var e=window.stdlib_datasets_exclude.datasets;Object.keys(e).forEach((function(f){n.datasets[f.toLowerCase()]=e[f]}));var f=window.stdlib;Object.keys(f).forEach((function(e){n[e]=f[e]}))}])},loadSOTU:function(e){if(n.datasets["sotu-data"]);else{var t="smartdownBase:lib/stdlib-datasets-sotu.min.js";(0,f.importScriptUrl)(t,(function(){n.datasets["sotu-data"]=window.stdlib_datasets_sotu.SOTU,e()}),(function(e){console.log("loadSOTU importScriptUrl error",t,e)}))}},datasets:{}};e.default=n})?n.apply(f,r):n)||(e.exports=o)},484:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(4883)],void 0===(o="function"==typeof(n=function(e,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){(0,f.registerExtension)("three",["https://unpkg.com/three@0.122/build/three.min.js",function(){window.smartdown.THREE=window.THREE}])}})?n.apply(f,r):n)||(e.exports=o)},9233:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[f,t(4883)],void 0===(o="function"==typeof(n=function(e,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t={register:function(){(0,f.registerExtension)("typescript",["https://cdn.jsdelivr.net/npm/typescript/lib/typescript.min.js"])},generateAugmentedPlayable:function(e,f){return f?"// Augmented TypeScript Code to be transpiled.\n\nconst asyncWrapper =\n`\n${playable.code}\nif (typeof start !== 'undefined') {\n smartdown.es6Playables['".concat(e,"'].start = start;\n}\n`;\n\nlet result = window.ts.transpileModule(\n asyncWrapper,\n {\n compilerOptions: {\n esModuleInterop: true,\n // allowUmdGlobalAccess: true,\n // alwaysStrict: true,\n isolatedModules: true,\n module: 'es6',\n target: 'es6',\n allowJs: true,\n checkJs: true,\n diagnostics: true,\n extendedDiagnostics: true,\n },\n reportDiagnostics: true,\n});\n\nif (result.diagnostics.length > 0) {\n result.diagnostics.forEach(d => {\n this.log('# ' + d.messageText);\n });\n}\nelse {\n playable.augmentedCode = result.outputText;\n\n const argValues = [\n playable,\n smartdown.smartdownVariables,\n smartdown.P5Loader,\n window.d3,\n window.d3fc,\n window.d3dc,\n window.topojson,\n window.Plotly,\n window.Leaflet,\n window.Stdlib,\n window.THREE,\n smartdown,\n {} // This will be a p5 obj in the case of using P5.Loader\n ];\n\n const embedResult = smartdown.runModule(playable, argValues, 'typescript');\n}\n\n"):"// Augmented TypeScript Code to be transpiled.\n\nconst asyncWrapper =\n`\nconst outerThis = this;\nreturn (async function() {\n${playable.code}\n}).call(outerThis);\n`;\n\nlet result = window.ts.transpileModule(\n asyncWrapper,\n {\n compilerOptions: {\n // esModuleInterop: true,\n // allowUmdGlobalAccess: true,\n alwaysStrict: true,\n // isolatedModules: true,\n module: 'commonjs',\n target: 'es6',\n allowJs: true,\n checkJs: true,\n diagnostics: true,\n extendedDiagnostics: true,\n },\n reportDiagnostics: true,\n});\n\nif (result.diagnostics.length > 0) {\n result.diagnostics.forEach(d => {\n this.log('# ' + d.messageText);\n });\n}\n\nreturn smartdown.runFunction(result.outputText, this, [...arguments], 'typescript', this.div);\n"}};e.default=t})?n.apply(f,r):n)||(e.exports=o)},9141:function(e,f,t){var n,r,o;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,r=[t(1234),t(3139),t(1200),t(5390),t(4214),t(8264),t(887),t(3185),t(7302),t(2249),t(7914),t(7438),t(4883),t(6479),t(9453),t(1365),t(3977),t(7482),t(3362),t(6843),t(8971),t(9027),t(5019),t(1375),t(4479),t(7721),t(5895),t(9712),t(1660),t(3963),t(6999),t(7255),t(3407),t(3971),t(5337),t(6133),t(827),t(247),t(1715),t(8412),t(2748),t(9662),t(9358),t(3169),t(5423),t(846),t(6456),t(9473),t(2144)],n=function(f,n,r,o,a,i,s,c,l,d,u,p,h,g,b,m,_,y,v,w,x,E,k,A,D,C,S,O,T,R,N,j,I,M,F,L,B,P,z,U,H,$,q,G,W,V,Z,J,Y){"use strict";var X=t(6784);f=X(f),n=X(n),r=X(r),o=X(o),a=X(a),i=X(i),s=X(s),c=X(c),l=X(l),d=X(d),u=X(u),p=X(p),g=X(g),b=X(b),m=X(m),y=X(y),v=X(v),w=X(w),x=X(x),E=X(E),k=X(k),A=X(A),D=X(D),C=X(C),S=X(S),O=X(O),T=X(T),R=X(R),N=X(N),j=X(j),I=X(I),L=X(L),B=X(B),P=X(P),z=X(z),U=X(U),H=X(H),$=X($),q=X(q),Z=X(Z),J=X(J),Y=X(Y),window.lodashMap=a.default,window.lodashEach=o.default,window.lodashIsEqual=i.default,window.jsyaml=l.default;var K=!1,Q="smartdownVariable/",ee="^^InLiNe^^";function fe(e,f){if(smartdown.smartdownVariables[e]=f,smartdown.persistence){var t=Q+e,n=f;u.default.setItem(t,n).then((function(){})).catch((function(e){console.log("localForage STORE ERROR",t,n,e)}))}}function te(e,f,t){var n=smartdown.smartdownVariables[e];!t&&(0,Y.default)(e,n,f)||(fe(e,f),(0,U.default)(e,f))}function ne(){(0,o.default)(smartdown.smartdownCells,(function(e,f){document.getElementById(f)||delete smartdown.smartdownCells[f]}))}function re(){(0,o.default)(smartdown.smartdownCells,(function(e){var f=smartdown.smartdownVariables[e.cellBinding];fe(e.cellBinding,f)}))}(0,$.default)();var oe,ae=!1;var ie=0;function se(e,t,n){smartdown.currentRenderDiv?console.log("setSmartdown REENTRANCY FAIL",smartdown.currentRenderDiv.id,e.slice(0,40)):smartdown.currentRenderDiv=t,smartdown.currentBackpatches[t.id]=[],function(){if(oe=0,!ae){var e;ae=!0;var f=document.getElementsByTagName("body")[0];window.addEventListener("scroll",(function(){var t=window.scrollY;Math.abs(oe-t)>25&&(f.classList.add("disable-hover"),clearTimeout(e),e=setTimeout((function(){f.classList.remove("disable-hover")}),700)),oe=t}),!1)}}(),(0,z.default)(),(0,P.default)(t,!0);var r=(0,E.default)(e);function a(){var f;function r(e){var f=e||function(){};smartdown.persistence?u.default.iterate((function(e,f){if(0===f.indexOf(Q)){var t=f.slice(Q.length);e&&(smartdown.smartdownVariables[t]=e)}})).then((function(){f()})).catch((function(e){console.log(e),f()})):f()}function a(e){ne(),re(),window.twttr&&window.twttr.widgets&&window.twttr.widgets.load(t),(0,p.default)({playButtonStyles:{width:"60px",height:"60px","border-radius":"30px",background:"rgba(200, 200, 200, 0.5)",position:"absolute",top:"50%",left:"50%",margin:"-30px 0 0 -30px"},playButtonIconStyles:{width:"0",height:"0","border-top":"14px solid transparent","border-bottom":"14px solid transparent","border-left":"14px solid rgba(0, 0, 0, 0.5)",position:"absolute",left:"26px",top:"16px"}}),document.querySelectorAll(".gifffer-container button").forEach((function(e){e.addEventListener("click",(function(e){e.stopPropagation()}))})),(0,N.default)(t,(function(){y.default.cardLoading&&(y.default.cardLoading=!1,ne(),re(),(0,o.default)(smartdown.smartdownVariables,(function(e,f){te(f,e)})),(0,U.default)()),e&&e()}))}window.addEventListener("resize",(function(){f||(f=setTimeout((function(){var e;f=null,e=y.default.playablesRegistered,Object.keys(e).forEach((function(f){var t=e[f];t.playing&&document.getElementById(t.divId)&&t.embedThis&&t.embedThis.sizeChanged&&t.embedThis.sizeChanged()}))}),500))})),e.search(/[^`]!\[[^\]]*\]\(https:\/\/twitter\.com\/[^`]/)>=0?y.default.twitterLoading?a((function(){r(n)})):(y.default.twitterLoading=!0,(0,V.importScriptUrl)("https://platform.twitter.com/widgets.js",(function(){console.log("Twitter loaded... window.twttr",window.twttr),a((function(){r(n)}))}))):a((function(){r(n)}))}e=r.markdown,t.frontmatter=r.frontmatter;var i=(new c.default.Lexer).lex(e),s=null,l=null;i.forEach((function(e){if("paragraph"===e.type){if(l){var f=e.tokens[0];f&&"text"===f.type&&(f.text=ee+f.text,0===f.text.indexOf(ee)||(f.text=ee+f.text))}s=e,l=null}else if("code"===e.type){var t=e.lang&&e.lang.indexOf("/inline")>=0;if(s&&t&&0!==s.text.indexOf(ee)){var n=s.tokens[0];n&&"text"===n.type&&(0===n.text.indexOf(ee)||(n.text=ee+n.text))}l=t?e:null,s=null}else"space"===e.type||"script"===e.type||(s=null,l=null)}));var d=c.default.parser(i),h=f.default.sanitize(d,{FORCE_BODY:!0,ADD_TAGS:["script","iframe"],ADD_ATTR:["onblur","oninput","onchange","onclick","onmousedown","onmouseup","onmouseenter","onmouseleave","onkeydown","onkeyup","target","allow","allowfullscreen"]});d!==h&&(d=h),smartdown.currentRenderDiv=null,ie=5,function e(f){var n=smartdown.currentBackpatches[t.id],r=0;n.forEach((function(e){e.key?e.replace?(d=d.replace(e.key,e.replace),e.key=null):++r:console.log("applyBackpatches anomaly no key",t.id,e)})),r>0?--ie<=0?console.log("Aborting applyBackpatches recursion...",n):window.setTimeout((function(){e((function(){f()}))}),1e3):f()}((function(){t.innerHTML=d,K?(MathJax.Hub.Typeset(t),a()):MathJax.Hub.Typeset(t,a)}))}function ce(e,f,t){"number"===t&&(f=Number(f));try{ne()}catch(f){console.log("exception during ensureCells",e,f)}try{te(e,f)}catch(f){console.log("exception during propagateChangedVariable",e,f)}}function le(e){Array.isArray(e)?(0,o.default)(e,(function(e){var f=e.rhs;"number"===e.type&&(f=Number(f)),fe(e.lhs,f)})):Object.keys(e).forEach((function(f){fe(f,e[f])})),ne(),(0,U.default)()}function de(e,f){var t=e.lhss,n=e.rhss,r=e.types,i=0;if(t.length!==n.length||r.length!==t.length)console("lhss.length !== rhss.length || types.length !== lhss.length",t.length,n.length,r.length);else{for(var s=function(){var e=t[c],s=n[c],l=r[c];if(s=(0,A.default)(s),"TEMPLATECELLID"===e);else if(s)if("/"===s[0]){if(s=s.slice(1),y.default.calcHandlers){var d=s.split(/[./[]/)[0],u=s.slice(d.length),p=y.default.calcHandlers[d];p&&(++i,p(d,u,function(e){return function(t){te(e,t),0==--i&&f&&f()}}(e)))}}else{var h="";(0,o.default)(smartdown.smartdownVariables,(function(e,f){h+=","+f})),h=h.slice(1);var g=(0,a.default)(smartdown.smartdownVariables,(function(e){return e})),b=new Function(h,"return "+s+";").apply({},g);"number"===l&&(b=Number(b)),te(e,b)}},c=0;c<t.length;++c)s();i>0||f&&f()}}e.exports={initialize:function(e,f,t,n,r,o){var a={media:e,baseURL:f,cardLoader:n,calcHandlers:r,linkRules:o};(0,q.default)(a,t)},configure:q.default,expressionsRegistered:y.default.expressionsRegistered,playablesRegistered:y.default.playablesRegistered,playablesRegisteredOrder:y.default.playablesRegisteredOrder,enhanceMarkedAndOpts:C.default,partitionMultipart:k.default,registerPlayable:R.default,playPlayable:T.default,resetPlayable:j.default,toggleDebug:F.toggleDebug,toggleConsole:M.toggleConsole,consoleWrite:M.consoleWrite,showDisclosure:W.showDisclosure,hideDisclosure:W.hideDisclosure,isFullscreen:G.isFullscreen,openFullscreen:G.openFullscreen,closeFullscreen:G.closeFullscreen,toggleKiosk:L.default,toggleDisclosure:W.toggleDisclosure,activateOnMouseLeave:W.activateOnMouseLeave,deactivateOnMouseLeave:W.deactivateOnMouseLeave,linkWrapperExit:W.linkWrapperExit,startAutoplay:B.default,setSmartdown:se,setHome:function(e,f,t){y.default.currentMD=e,y.default.currentHomeDiv=f,window.getSelection().removeAllRanges(),(0,P.default)(f,!0),(0,H.default)(),se(e,f,(function(){(0,U.default)(),t()}))},resetVariables:function(){smartdown.smartdownVariables={},fe(null,null),re()},loadCardsFromDocumentScripts:function(){y.default.smartdownScripts.length=0,Object.keys(y.default.smartdownScriptsMap).forEach((function(e){delete y.default.smartdownScriptsMap[e]}));var e=document.scripts;Object.keys(e).forEach((function(f){var t=e[f];t&&t.type&&"text/x-smartdown"===t.type&&(y.default.smartdownScripts.push(t),y.default.smartdownScriptsMap[t.id]=t)}))},registerExpression:S.default,computeExpressions:O.default,computeStoredExpression:function(e){var f=y.default.expressionsRegistered[e];f?f.manual&&de(f,(function(){(0,U.default)()})):console.log("computeStoredExpression no such expression",e,y.default.expressionsRegistered)},setVariable:ce,set:function(e,f,t){arguments.length>1?ce(e,f,t):le(e)},setVariables:le,setPersistence:function(e){smartdown.persistence=e},computeExpression:de,goToCard:function(e,f,t){if(f&&(f.preventDefault(),f.stopPropagation()),t||(t="smartdown-output"),y.default.cardLoading=!0,y.default.cardLoader)y.default.cardLoader(e,t);else{var n=null;if(e&&"Home"!==e){var r=y.default.smartdownScriptsMap[e];r&&(n=r.text)}else n=y.default.currentMD;n&&se(n,y.default.currentHomeDiv,null)}},smartdownScripts:y.default.smartdownScripts,smartdownScriptsMap:y.default.smartdownScriptsMap,currentHomeDiv:y.default.currentHomeDiv,cardLoader:y.default.cardLoader,calcHandlers:y.default.calcHandlers,importCssCode:V.importCssCode,importCssUrl:V.importCssUrl,importScriptUrl:V.importScriptUrl,importModuleUrl:V.importModuleUrl,importTextUrl:V.importTextUrl,linkRules:y.default.linkRules,expandHrefWithLinkRules:v.default,setLinkRules:w.default,getMedia:function(e){return sma