{"version":3,"sources":["jsdelivr-header.js","/npm/gitbook-plugin-pyweb@0.0.5/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,GAAK,QAAQ,MACb,KAAQ,QAAQ,QAChB,aAAe,EACnB,OAAO,QAAU,CACb,QAAS,CACL,OAAQ,SACR,GAAI,CACJ,gBACA,iCACA,wBACA,iBACF,gBACE,wBAEA,IAAK,CACD,iBAEJ,KAAM,CACJ,aAAc,WAEd,EACA,WAAY,WAEZ,IAGJ,OAAQ,CAEN,MAAQ,CACN,QAAU,SAAS,GAIjB,IAAI,EAAW,KAAK,UAAU,KAAK,QAAQ,KAAK,IAAI,IAAI,QAAQ,MAAQ,IAAM,KAAK,QAAQ,KAAK,IAAI,IAAI,KAAK,OACzG,EAAO,EAAI,KAEX,EAAW,EAAW,KAD1B,EAAO,EAAK,QAAQ,MAAM,KACS,OAEnC,EAAW,KAAK,UAAU,GAG1B,IAAI,EAAS,GAAG,aAAa,GAC7B,EAAS,OAAO,GAAQ,QAAQ,KAAM,SACrC,QAAQ,KAAM,UACd,QAAQ,KAAM,SACd,QAAQ,KAAM,QACd,QAAQ,KAAM,QACf,IAAI,EAAY,gBAAgB,aAAa,6CAA6C,aAAa,KAAK,EAAO,SAWnH,OATA,GAAa,sBAAsB,aAAa,iBAEhD,GAAa,2FAA2F,aAAa,kBAAkB,aAAa,aAEpJ,GAAa,8BAA8B,aAAa,yCAGxD,eAEO,CAET,IAGJ,MAAO,CAIN,KAAQ,WACJ,QAAQ,IAAI,eAChB,EAEC,OAAU,WACN,QAAQ,IAAI,gBAChB","file":"/npm/gitbook-plugin-pyweb@0.0.5/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/gitbook-plugin-pyweb@0.0.5/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var fs = require(\"fs\");\nvar path =  require('path');\nvar editor_count = 0;\nmodule.exports = {\n    website: {\n        assets: \"./book\",\n        js: [\n        \"editor/ace.js\",\n        \"editor/theme-tomorrow_night.js\",\n        \"editor/mode-python.js\",\n        \"webpyeditor.js\",\n\t\t    \"js/brython.js\",\n        \"js/brython_stdlib.js\"\n        ],\n        css: [\n            \"pygitbook.css\"\n        ],\n        html: {\n          \"body:start\": function() {\n           \n          },\n          \"body:end\": function() {\n            \n          }\n        }\n      },\n      blocks: {\n\n        pyweb : {\n          process : function(blk) {\n            \n            \n            \n            var filepath = path.normalize(path.dirname(this.ctx.ctx.options.root) + \"/\" + path.dirname(this.ctx.ctx.file.path));\n            var file = blk.body;\n            file = file.replace(/\\\\/g,\"\");\n            var fullpath = filepath + \"/\"+file.trim();\n            \n            fullpath = path.normalize(fullpath);\n            \n            //got the python code\n            var python = fs.readFileSync(fullpath);\n            python = String(python).replace(/&/g, '&amp;')\n            .replace(/\"/g, '&quot;')\n            .replace(/'/g, '&#39;')\n            .replace(/</g, '&lt;')\n            .replace(/>/g, '&gt;');\n            var html_code = '<div id=\"code'+editor_count+'\" class=\"codeEditor\" data-editor = \"editor'+editor_count+'\">'+python+'</div>';\n\n            html_code += \"<script> var editor\"+editor_count+\"='';</script>\";\n\n            html_code += \"<input type='button' class='btn pyBtn' id='run0' value='run' onclick=\\\"run_python(editor\"+editor_count+\",'python_result\"+editor_count+\"')\\\"><br/>\";\n\n            html_code += \"<textarea id='python_result\"+editor_count+\"' readonly class='console'></textarea>\";\n\n\n            editor_count++;\n\n            return html_code;\n\n          }\n        }\n      }, //end of blocks\n      hooks: {\n       // For all the hooks, this represent the current generator\n\n       // This is called before the book is generated\n       \"init\": function() {\n           console.log(\"Start PyWeb!\");\n       },\n       // This is called after the book generation\n        \"finish\": function() {\n            console.log(\"Finish PyWeb!\");\n        }\n      }//end of hooks\n\n    } //end of exports\n"]}