{"appearance":{"background":"white","padding":14,"font":{"family":"Courier New","size":12.0,"bold":false,"italic":false,"underline":false,"strikeout":false,"color":"rgb(0,72,168)"},"border":{"on":false,"size":1.0,"style":"solid","color":"#666"},"text":{"wrap":false,"hAlign":"left","vAlign":"top"}},"outputType":"WIDGET","guid":"e8dc2410-1c64-4d80-891e-9b67ef64f389","name":"correspondence.analysis","outputs":{"console":"<pre class='debug-source'>># --- preload packages ---\n</pre>\n<pre class='debug-source'>>require()\n</pre>\n<pre class='debug-message'>Loading required package: \n</pre>\n<pre class='debug-source'>># --- run the code ---\n</pre>\n<pre class='debug-source'>>formTableToAnalyse <- `Category of Readership by Level of Education`\n</pre>\n<pre class='debug-source'>>formNormalization <- "Principal"\n</pre>\n<pre class='debug-source'>>formInteractive <- TRUE\n</pre>\n<pre class='debug-source'>>formIgnoreRows <- "NET, Total, SUM"\n</pre>\n<pre class='debug-source'>>formIgnoreColumns <- "NET, Total, SUM"\n</pre>\n<pre class='debug-source'>>library(flipMultivariates)\n</pre>\n<pre class='debug-source'>>rows.to.remove <- unlist(strsplit("NET, Total, SUM", ","))\n</pre>\n<pre class='debug-source'>>columns.to.remove <- unlist(strsplit("NET, Total, SUM", ","))\n</pre>\n<pre class='debug-source'>>correspondence.analysis = CorrespondenceAnalysis(`Category of Readership by Level of Education`, normalization = "Principal", TRUE, rows.to.remove, columns.to.remove)\n</pre>\n<pre class='debug-source'>>correspondence.analysis</pre>","htmlwidgets":"<div id=\"htmlwidget_container\">\n <div id=\"htmlwidget-644\" style=\"width:960px;height:500px;\" class=\"scatterD3\"></div>\n</div>\n<script type=\"application/json\" data-for=\"htmlwidget-644\">{\"x\":{\"data\":{\"x\":[-0.389600492825987,-0.22384372711619,0.444091807567403,-0.525020067881581,-0.280752389284281,0.110184321874778,0.225289505494424,0.47029862979666],\"y\":[0.183200268199974,-0.1144329583242,0.0241249209829415,0.104456218560474,-0.158265967298051,0.113603493338996,-0.106166065661156,0.0463723210597366],\"lab\":[\"Glance\",\"Fairly thorough\",\"Very thorough\",\"Some primary\",\"Primary completed\",\"Some secondary\",\"Secondary completed\",\"Some tertiary\"],\"col_var\":[\"Rows\",\"Rows\",\"Rows\",\"Columns\",\"Columns\",\"Columns\",\"Columns\",\"Columns\"],\"key_var\":[1,2,3,4,5,6,7,8],\"tooltip_text\":[\"<strong>Glance</strong><br>36 Some primary<br>21 Primary completed<br>22 Some secondary<br>12 Secondary completed<br>12 Some tertiary\",\"<strong>Fairly thorough</strong><br>50 Some primary<br>55 Primary completed<br>33 Some secondary<br>40 Secondary completed<br>27 Some tertiary\",\"<strong>Very thorough</strong><br>14 Some primary<br>24 Primary completed<br>45 Some secondary<br>49 Secondary completed<br>62 Some tertiary\",\"<strong>Some primary</strong><br>36 Glance<br>50 Fairly thorough<br>14 Very thorough\",\"<strong>Primary completed</strong><br>21 Glance<br>55 Fairly thorough<br>24 Very thorough\",\"<strong>Some secondary</strong><br>22 Glance<br>33 Fairly thorough<br>45 Very thorough\",\"<strong>Secondary completed</strong><br>12 Glance<br>40 Fairly thorough<br>49 Very thorough\",\"<strong>Some tertiary</strong><br>12 Glance<br>27 Fairly thorough<br>62 Very thorough\"]},\"settings\":{\"labels_size\":10,\"point_size\":64,\"point_opacity\":1,\"xlab\":\"Dimension 1 (91.1%)\",\"ylab\":\"Dimension 2 (8.9%)\",\"has_labels\":true,\"col_var\":[\"Rows\",\"Rows\",\"Rows\",\"Columns\",\"Columns\",\"Columns\",\"Columns\",\"Columns\"],\"col_lab\":\"\",\"colors\":[\"#5B9BD5\",\"#ED7D31\",\"#A5A5A5\",\"#1EC000\",\"#4472C4\",\"#70AD47\",\"#255E91\",\"#9E480E\",\"#636363\",\"#997300\",\"#264478\",\"#43682B\",\"#000000\",\"#FF2323\"],\"symbol_var\":null,\"symbol_lab\":\"NULL\",\"size_var\":null,\"size_range\":[10,300],\"size_lab\":\"NULL\",\"key_var\":null,\"type_var\":null,\"unit_circle\":false,\"has_color_var\":true,\"has_symbol_var\":false,\"has_size_var\":false,\"has_legend\":true,\"has_tooltips\":true,\"tooltip_text\":[\"<strong>Glance</strong><br>36 Some primary<br>21 Primary completed<br>22 Some secondary<br>12 Secondary completed<br>12 Some tertiary\",\"<strong>Fairly thorough</strong><br>50 Some primary<br>55 Primary completed<br>33 Some secondary<br>40 Secondary completed<br>27 Some tertiary\",\"<strong>Very thorough</strong><br>14 Some primary<br>24 Primary completed<br>45 Some secondary<br>49 Secondary completed<br>62 Some tertiary\",\"<strong>Some primary</strong><br>36 Glance<br>50 Fairly thorough<br>14 Very thorough\",\"<strong>Primary completed</strong><br>21 Glance<br>55 Fairly thorough<br>24 Very thorough\",\"<strong>Some secondary</strong><br>22 Glance<br>33 Fairly thorough<br>45 Very thorough\",\"<strong>Secondary completed</strong><br>12 Glance<br>40 Fairly thorough<br>49 Very thorough\",\"<strong>Some tertiary</strong><br>12 Glance<br>27 Fairly thorough<br>62 Very thorough\"],\"has_custom_tooltips\":true,\"fixed\":true,\"legend_width\":150,\"html_id\":\"scatterD3-KIYZTOBD\",\"xlim\":[-0.574786002765493,0.520064564680572],\"ylim\":[-0.175339279072952,0.200273579974875],\"dom_id_reset_zoom\":\"scatterD3-reset-zoom\",\"dom_id_svg_export\":\"scatterD3-svg-export\",\"transitions\":false,\"hashes\":[]}},\"evals\":[]}</script>\n<script type=\"application/htmlwidget-sizing\" data-for=\"htmlwidget-644\">{\"viewer\":{\"width\":450,\"height\":350,\"padding\":15,\"fill\":true},\"browser\":{\"width\":960,\"height\":500,\"padding\":40,\"fill\":true}}</script>","htmlwidget-head":"data:text/javascript;base64,KGZ1bmN0aW9uKCkgewogIC8vIElmIHdpbmRvdy5IVE1MV2lkZ2V0cyBpcyBhbHJlYWR5IGRlZmluZWQsIHRoZW4gdXNlIGl0OyBvdGhlcndpc2UgY3JlYXRlIGEKICAvLyBuZXcgb2JqZWN0LiBUaGlzIGFsbG93cyBwcmVjZWRpbmcgY29kZSB0byBzZXQgb3B0aW9ucyB0aGF0IGFmZmVjdCB0a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cC5icm93c2VyOwogICAgfQogIH0KCiAgZnVuY3Rpb24gaW5pdFNpemluZyhlbCkgewogICAgdmFyIHNpemluZyA9IHNpemluZ1BvbGljeShlbCk7CiAgICBpZiAoIXNpemluZykKICAgICAgcmV0dXJuOwoKICAgIHZhciBjZWwgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiaHRtbHdpZGdldF9jb250YWluZXIiKTsKICAgIGlmICghY2VsKQogICAgICByZXR1cm47CgogICAgaWYgKHR5cGVvZihzaXppbmcucGFkZGluZykgIT09ICJ1bmRlZmluZWQiKSB7CiAgICAgIGRvY3VtZW50LmJvZHkuc3R5bGUubWFyZ2luID0gIjAiOwogICAgICBkb2N1bWVudC5ib2R5LnN0eWxlLnBhZGRpbmcgPSBwYWRkaW5nVG9Dc3ModW5wYWNrUGFkZGluZyhzaXppbmcucGFkZGluZykpOwogICAgfQoKICAgIGlmIChzaXppbmcuZmlsbCkgewogICAgICBkb2N1bWVudC5ib2R5LnN0eWxlLm92ZXJmbG93ID0gImhpZGRlbiI7CiAgICAgIGRvY3VtZW50LmJvZHkuc3R5bGUud2lkdGggPSAiMTAwJSI7CiAgICAgIGRvY3VtZW50LmJvZHkuc3R5bGUuaGVpZ2h0ID0gIjEwMCUiOwogICAgICBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuc3R5bGUud2lkdGggPSAiMTAwJSI7CiAgICAgIGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5zdHlsZS5oZWlnaHQgPSAiMTAwJSI7CiAgICAgIGlmIChjZWwpIHsKICAgICAgICBjZWwuc3R5bGUucG9zaXRpb24gPSAiYWJzb2x1dGUiOwogICAgICAgIHZhciBwYWQgPSB1bnBhY2tQYWRkaW5nKHNpemluZy5wYWRkaW5nKTsKICAgICAgICBjZWwuc3R5bGUudG9wID0gcGFkLnRvcCArICJweCI7CiAgICAgICAgY2VsLnN0eWxlLnJpZ2h0ID0gcGFkLnJpZ2h0ICsgInB4IjsKICAgICAgICBjZWw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KCiAgICAgICAgICAvLyBSZWFsbHkgZHVtYiB3YXkgdG8ga2VlcCB0aGUgc2l6ZS9wb3NpdGlvbiBvZiB0aGUgZXJyb3IgaW4gc3luYyB3aXRoCiAgICAgICAgICAvLyB0aGUgcGFyZW50IGVsZW1lbnQgYXMgdGhlIHdpbmRvdyBpcyByZXNpemVkIG9yIHdoYXRldmVyLgogICAgICAgICAgdmFyIGludElkID0gc2V0SW50ZXJ2YWwoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIGlmICghZXJyb3JEaXZbMF0ucGFyZW50RWxlbWVudCkgewogICAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwoaW50SWQpOwogICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBlcnJvckRpdgogICAgICAgICAgICAgIC5jc3MoInRvcCIsIGVsLm9mZnNldFRvcCkKICAgICAgICAgICAgICAuY3NzKCJsZWZ0IiwgZWwub2Zmc2V0TGVmdCkKICAgICAgICAgICAgICAuY3NzKCJtYXhXaWR0aCIsIGVsLm9mZnNldFdpZHRoKQogICAgICAgICAgICAgIC5jc3MoImhlaWdodCIsIGVsLm9mZnNldEhlaWdodCk7CiAgICAgICAgICB9LCA1MDApOwogICAgICAgIH0KICAgICAgfQogICAgfSwKICAgIGNsZWFyRXJyb3I6IGZ1bmN0aW9uKGVsKSB7CiAgICAgIHZhciAkZWwgPSAkKGVsKTsKICAgICAgdmFyIGRpc3BsYXkgPSAkZWwuZGF0YSgicmVzdG9yZS1kaXNwbGF5LW1vZGUiKTsKICAgICAgJGVsLmRhdGEoInJlc3RvcmUtZGlzcGxheS1tb2RlIiwgbnVsbCk7CgogICAgICBpZiAoZGlzcGxheSA9PT0gImlubGluZSIgfHwgZGlzcGxheSA9PT0gImlubGluZS1ibG9jayIpIHsKICAgICAgICBpZiAoZGlzcGxheSkKICAgICAgICAgICRlbC5jc3MoImRpc3BsYXkiLCBkaXNwbGF5KTsKICAgICAgICAkKGVsLm5leHRTaW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ZhbHNdOwogICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGRhdGEuZXZhbHMgJiYgaSA8IGRhdGEuZXZhbHMubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgd2luZG93LkhUTUxXaWRnZXRzLmV2YWx1YXRlU3RyaW5nTWVtYmVyKGRhdGEueCwgZGF0YS5ldmFsc1tpXSk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoIXRoaXMucmVuZGVyT25OdWxsVmFsdWUpIHsKICAgICAgICAgICAgaWYgKGRhdGEueCA9PT0gbnVsbCkgewogICAgICAgICAgICAgIGVsLnN0eWxlLnZpc2liaWxpdHkgPSAiaGlkZGVuIjsKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgZWwuc3R5bGUudmlzaWJpbGl0eSA9ICJpbmhlcml0IjsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKCFlbGVtZW50RGF0YShlbCwgImluaXRpYWxpemVkIikpIHsKICAgICAgICAgICAgaW5pdFNpemluZyhlbCk7CgogICAgICAgICAgICBlbGVtZW50RGF0YShlbCwgImluaXRpYWxpemVkIiwgdHJ1ZSk7CiAgICAgICAgICAgIGlmICh0aGlzLl9odG1sd2lkZ2V0c19pbml0aWFsaXplKSB7CiAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IHRoaXMuX2h0bWx3aWRnZXRzX2luaXRpYWxpemUoZWwsIGVsLm9mZnNldFdpZHRoLAogICAgICAgICAgICAgICAgZWwub2Zmc2V0SGVpZ2h0KTsKICAgICAgICAgICAgICBlbGVtZW50RGF0YShlbCwgImluaXRfcmVzdWx0IiwgcmVzdWx0KTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgU2hpbnkucmVuZGVyRGVwZW5kZW5jaWVzKGRhdGEuZGVwcyk7CiAgICAgICAgICBzdXBlcmZ1bmMoZWwsIGRhdGEueCwgZWxlbWVudERhdGEoZWwsIC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AgICAgICAgIHZhciByZXNpemVIYW5kbGVyID0gZnVuY3Rpb24oZSkgewogICAgICAgICAgICB2YXIgc2l6ZSA9IHsKICAgICAgICAgICAgICB3OiBzaXplT2JqID8gc2l6ZU9iai5nZXRXaWR0aCgpIDogZWwub2Zmc2V0V2lkdGgsCiAgICAgICAgICAgICAgaDogc2l6ZU9iaiA/IHNpemVPYmouZ2V0SGVpZ2h0KCkgOiBlbC5vZmZzZXRIZWlnaHQKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaWYgKHNpemUudyA9PT0gMCAmJiBzaXplLmggPT09IDApCiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICBpZiAoc2l6ZS53ID09PSBsYXN0U2l6ZS53ICYmIHNpemUuaCA9PT0gbGFzdFNpemUuaCkKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIGxhc3RTaXplID0gc2l6ZTsKICAgICAgICAgICAgYmluZGluZy5yZXNpemUoZWwsIHNpemUudywgc2l6ZS5oLCBpbml0UmVzdWx0KTsKICAgICAgICAgIH07CgogICAgICAgICAgb24od2luZG93LCAicmVzaXplIiwgcmVzaXplSGFuZGxlcik7CgogICAgICAgICAgLy8gVGhpcyBpcyBuZWVkZWQgZm9yIGNhc2VzIHdoZXJlIHdlJ3JlIHJ1bm5pbmcgaW4gYSBTaGlueQogICAgICAgICAgLy8gYXBwLCBidXQgdGhlIHdpZGdldCBpdHNlbGYgaXMgbm90IGEgU2hpbnkgb3V0cHV0LCBidXQKICAgICAgICAgIC8vIHJhdGhlciBhIHNpbXBsZSBzdGF0aWMgd2lkZ2V0LiBPbmUgZXhhbXBsZSBvZiB0aGlzIGlzCiAgICAgICAgICAvLyBhbiBybWFya2Rvd24gZG9jdW1lbnQgdGhhdCBoYXMgcnVudGltZTpzaGlueSBhbmQgd2lkZ2V0CiAgICAgICAgICAvLyB0aGF0IGlzbid0IGluIGEgcmVuZGVyIGZ1bmN0aW9uLiBTaGlueSBvbmx5IGtub3dzIHR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iICsga2V5ICsgIiBub3QgZm91bmQgaW4gZG9jdW1lbnQiKTsKICAgIH0KICAgIHJldHVybiBsaW5rLmdldEF0dHJpYnV0ZSgiaHJlZiIpOwogIH07CgogIHdpbmRvdy5IVE1MV2lkZ2V0cy5kYXRhZnJhbWVUb0QzID0gZnVuY3Rpb24oZGYpIHsKICAgIHZhciBuYW1lcyA9IFtdOwogICAgdmFyIGxlbmd0aDsKICAgIGZvciAodmFyIG5hbWUgaW4gZGYpIHsKICAgICAgICBpZiAoZGYuaGFzT3duUHJvcGVydHkobmFtZSkpCiAgICAgICAgICAgIG5hbWVzLnB1c2gobmFtZSk7CiAgICAgICAgaWYgKHR5cGVvZihkZltuYW1lXSkgIT09ICJvYmplY3QiIHx8IHR5cGVvZihkZltuYW1lXS5sZW5ndGgpID09PSAidW5kZWZpbmVkIikgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIkFsbCBmaWVsZHMgbXVzdCBiZSBhcnJheXMiKTsKICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZihsZW5ndGgpICE9PSAidW5kZWZpbmVkIiAmJiBsZW5ndGggIT09IGRmW25hbWVdLmxlbmd0aCkgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIkFsbCBmaWVsZHMgbXVzdCBiZSBhcnJheXMgb2YgdGhlIHNhbWUgbGVuZ3RoIik7CiAgICAgICAgfQogICAgICAgIGxlbmd0aCA9IGRmW25hbWVdLmxlbmd0aDsKICAgIH0KICAgIHZhciByZXN1bHRzID0gW107CiAgICB2YXIgaXRlbTsKICAgIGZvciAodmFyIHJvdyA9IDA7IHJvdyA8IGxlbmd0aDsgcm93KyspIHsKICAgICAgICBpdGVtID0ge307CiAgICAgICAgZm9yICh2YXIgY29sID0gMDsgY29sIDwgbmFtZXMubGVuZ3RoOyBjb2wrKykgewogICAgICAgICAgICBpdGVtW25hbWVzW2NvbF1dID0gZGZbbmFtZXNbY29sXV1bcm93XTsKICAgICAgICB9CiAgICAgICAgc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gIikiKTsKICAgICAgICB9IGVsc2UgeyAvLyBvdGhlcndpc2UgY29udGludWUgdG8gbmV4dCBlbWJlZGRlZCBvYmplY3QKICAgICAgICAgIG8gPSBvW3BhcnRdOwogICAgICAgIH0KICAgICAgfQogICAgfQogIH07Cn0pKCk7Cg==\ndata:text/css;base64,LnNjYXR0ZXJEMy10b29sdGlwIHsKICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTsKICAgIGNvbG9yOiAjMjIyOwogICAgYmFja2dyb3VuZDogI2ZmZjsKICAgIHBhZGRpbmc6IC41ZW07CiAgICB0ZXh0LXNoYWRvdzogI2Y1ZjVmNSAwIDFweCAwOwogICAgYm9yZGVyLXJhZGl1czogMnB4OwogICAgYm94LXNoYWRvdzogMHB4IDBweCAycHggMHB4ICNhNmE2YTY7CiAgICBvcGFjaXR5OiAwLjk7CiAgICBmb250LWZhbWlseTogc2Fucy1zZXJpZjsKICAgIGZvbnQtc2l6ZTogOXB4OwogICAgei1pbmRleDogMTA7Cn0KCi5oaWRkZW4gewogICAgZGlzcGxheTogbm9uZTsKfQoKLnNjYXR0ZXJEMyAucG9pbnQtbGFiZWwgewogIGN1cnNvcjogcG9pbnRlcjsKfQoKLnNjYXR0ZXJEMyAucGFuZSB7CiAgY3Vyc29yOiBtb3ZlOwp9\ndata:text/javascript;base64,IWZ1bmN0aW9uKCl7ZnVuY3Rpb24gbihuKXtyZXR1cm4gbiYmKG4ub3duZXJEb2N1bWVudHx8bi5kb2N1bWVudHx8bikuZG9jdW1lbnRFbGVtZW50fWZ1bmN0aW9uIHQobil7cmV0dXJuIG4mJihuLm93bmVyRG9jdW1lbnQmJm4ub3duZXJEb2N1bWVudC5kZWZhdWx0Vmlld3x8bi5kb2N1bWVudCYmbnx8bi5kZWZhdWx0Vmlldyl9ZnVuY3Rpb24gZShuLHQpe3JldHVybiB0Pm4/LTE6bj50PzE6bj49dD8wOjAvMH1mdW5jdGlvbiByKG4pe3JldHVybiBudWxsPT09bj8wLzA6K259Z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OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1pbl94ID0gc2V0dGluZ3MueGxpbVswXTsKICAgICAgICAgICAgbWF4X3ggPSBzZXR0aW5ncy54bGltWzFdOwogICAgICAgICAgICBnYXBfeCA9IDA7CiAgICAgICAgfQogICAgICAgIGlmIChzZXR0aW5ncy55bGltID09PSBudWxsKSB7CiAgICAgICAgICAgIG1pbl95ID0gZDMubWluKGRhdGEsIGZ1bmN0aW9uKGQpIHsgcmV0dXJuKGQueSk7fSApOwogICAgICAgICAgICBtYXhfeSA9IGQzLm1heChkYXRhLCBmdW5jdGlvbihkKSB7IHJldHVybihkLnkpO30gKTsKICAgICAgICAgICAgZ2FwX3kgPSAobWF4X3kgLSBtaW5feSkgKiAwLjI7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbWluX3kgPSBzZXR0aW5ncy55bGltWzBdOwogICAgICAgICAgICBtYXhfeSA9IHNldHRpbmdzLnlsaW1bMV07CiAgICAgICAgICAgIGdhcF95ID0gMDsKICAgICAgICB9CgogICAgICAgIC8vIEZpeGVkIHJhdGlvCiAgICAgICAgaWYgKHNldHRpbmdzLmZpeGVkKSB7CiAgICAgICAgICAgIG1pbl94ID0gbWluX3kgPSBNYXRoLm1pbihtaW5feCwgbWluX3kpOwogICAgICAgICAgICBtYXhfeCA9IG1heF95ID0gTWF0aC5tYXgobWF4X3gsIG1heF95KTsKICAgICAgICAgICAgZ2FwX3ggPSBnYXBfeSA9IE1hdGgubWF4KGdhcF94LCBnYXBfeSk7CiAgICAgICAgfQoKICAgICAgICAvLyB4LCB5LCBjb2xvciwgc3ltYm9sIGFuZCBzaXplIHNjYWxlcwogICAgICAgIHggPSBkMy5zY2FsZS5saW5lYXIoKS5yYW5nZShbMCwgZGltcy53aWR0aF0pOwogICAgICAgIHkgPSBkMy5zY2FsZS5saW5lYXIoKS5yYW5nZShbZGltcy5oZWlnaHQsIDBdKTsKICAgICAgICB4LmRvbWFpbihbbWluX3ggLSBnY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GUubGluZWFyKCkKICAgICAgICAucmFuZ2Uoc2V0dGluZ3Muc2l6ZV9yYW5nZSkKICAgICAgICAuZG9tYWluKFtkMy5taW4oZGF0YSwgZnVuY3Rpb24oZCkgeyByZXR1cm4oZC5zaXplX3Zhcik7fSApLAogICAgICAgICAgICAgICAgIGQzLm1heChkYXRhLCBmdW5jdGlvbihkKSB7IHJldHVybihkLnNpemVfdmFyKTt9ICldKTsKCiAgICAgICAgLy8gem9vbSBiZWhhdmlvcgogICAgICAgIHpvb20gPSBkMy5iZWhhdmlvci56b29tKCkKICAgICAgICAueCh4KQogICAgICAgIC55KHkpCiAgICAgICAgLnNjYWxlRXh0ZW50KFsxLCAzMl0pCiAgICAgICAgLm9uKCJ6b29tIiwgZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICB6b29tZWQoKTsKICAgICAgICAgfSk7CgogICAgICAgIC8vIHggYW5kIHkgYXhpcyBmdW5jdGlvbnMKICAgICAgICB4QXhpcyA9IGQzLnN2Zy5heGlzKCkKICAgICAgICAuc2NhbGUoeCkKICAgICAgICAub3JpZW50KCJib3R0b20iKQogICAgICAgIC50aWNrU2l6ZSgtZGltcy5oZWlnaHQpOwogICAgICAgIHlBeGlzID0gZDMuc3ZnLmF4aXMoKQogICAgICAgIC5zY2FsZSh5KQogICAgICAgIC5vcmllbnQoImxlZnQiKQogICAgICAgIC50aWNrU2l6ZSgtZGltcy53aWR0aCk7CgogICAgfQoKICAgIC8vIEtleSBmdW5jdGlvbiB0byBpZGVudGlmeSByb3dzIHdoZW4gaW50ZXJhY3RpdmVseSBmaWx0ZXJpbmcKICAgIGZ1bmN0aW9uIGtleShkKSB7CiAgICAgICAgcmV0dXJuIGQua2V5X3ZhcjsKICAgIH0KCiAgICAvLyBEZWZhdWx0IHRyYW5zbGF0aW9uIGZ1bmN0aW9uIGZvciBwb2ludHMgYW5kIGxhYmVscwogICAgZnVuY3Rpb24gdHJhbnNsYXRpb24oZCkgewogICAgICAgIHJldHVybiAidHJhbn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mQoImciKQogICAgICAgIC5hdHRyKCJjbGFzcyIsICJ4IGF4aXMiKQogICAgICAgIC5hdHRyKCJ0cmFuc2Zvcm0iLCAidHJhbnNsYXRlKDAsIiArIGRpbXMuaGVpZ2h0ICsgIikiKQogICAgICAgIC5jYWxsKHhBeGlzKQogICAgICAgIC5hcHBlbmQoInRleHQiKQogICAgICAgIC5hdHRyKCJjbGFzcyIsICJheGlzLWxhYmVsIikKICAgICAgICAuYXR0cigieCIsIGRpbXMud2lkdGggLSA1KQogICAgICAgIC5hdHRyKCJ5IiwgLTYpCiAgICAgICAgLnN0eWxlKCJ0ZXh0LWFuY2hvciIsICJlbmQiKQogICAgICAgIC50ZXh0KHNldHRpbmdzLnhsYWIpOwoKICAgICAgICAvLyB5IGF4aXMKICAgICAgICBzZWxlY3Rpb24uYXBwZW5kKCJnIikKICAgICAgICAuYXR0cigiY2xhc3MiLCAieSBheGlzIikKICAgICAgICAuY2FsbCh5QXhpcykKICAgICAgICAuYXBwZW5kKCJ0ZXh0IikKICAgICAgICAuYXR0cigiY2xhc3MiLCAiYXhpcy1sYWJlbCIpCiAgICAgICAgLmF0dHIoInRyYW5zZm9ybSIsICJyb3RhdGUoLTkwKSIpCiAgICAgICAgLmF0dHIoIngiLCAtNSkKICAgICAgICAuYXR0cigieSIsIDYpCiAgICAgICAgLmF0dHIoImR5IiwgIi43MWVtIikKICAgICAgICAuc3R5bGUoInRleHQtYW5jaG9yIiwgImVuZCIpCiAgICAgICAgLnRleHQoc2V0dGluZ3MueWxhYik7CgogICAgfQoKICAgIC8vIFplcm8gaG9yaXpvbnRhbCBhbmQgdmVydGljYWwgbGluZXMKICAgIHplcm9saW5lID0gZDMuc3ZnLmxpbmUoKQogICAgLngoZnVuY3Rpb24oZCkge3JldHVybiB4KGQueCl9KQogICAgLnkoZnVuY3Rpb24oZCkge3JldHVybiB5KGQueSl9KTsKCiAgICAvLyBDcmVhdGUgdG9vbHRpcCBjb250ZW50IGZ1bmN0aW9uCiAgICBm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sIGZ1bmN0aW9uKGQpIHsgcmV0dXJuIHkoZC55KSB9KTsKICAgIH0KCiAgICAvLyBJbml0aWFsIGFycm93IGF0dHJpYnV0ZXMKICAgIGZ1bmN0aW9uIGFycm93X2luaXQgKHNlbGVjdGlvbikgewogICAgICAgIHNlbGVjdGlvbgogICAgICAgICAvLyB0b29sdGlwcyB3aGVuIGhvdmVyaW5nIHBvaW50cwogICAgICAgIGlmIChzZXR0aW5ncy5oYXNfdG9vbHRpcHMpIHsKICAgICAgICAgICAgdmFyIHRvb2x0aXAgPSBkMy5zZWxlY3QoIi5zY2F0dGVyRDMtdG9vbHRpcCIpOwogICAgICAgICAgICBzZWxlY3Rpb24ub24oIm1vdXNlb3ZlciIsIGZ1bmN0aW9uKGQsIGkpewogICAgICAgICAgICAgICAgdG9vbHRpcC5zdHlsZSgidmlzaWJpbGl0eSIsICJ2aXNpYmxlIikKICAgICAgICAgICAgICAgIC5odG1sKHRvb2x0aXBfY29udGVudChkKSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBzZWxlY3Rpb24ub24oIm1vdXNlbW92ZSIsIGZ1bmN0aW9uKCl7CiAgICAgICAgICAgICAgICB0b29sdGlwLnN0eWxlKCJ0b3AiLCAoZDMuZXZlbnQucGFnZVkrMTUpKyJweCIpLnN0eWxlKCJsZWZ0IiwoZDMuZXZlbnQucGFnZVgrMTUpKyJweCIpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgc2VsZWN0aW9uLm9uKCJtb3VzZW91dCIsIGZ1bmN0aW9uKCl7CiAgICAgICAgICAgICAgICB0b29sdGlwLnN0eWxlKCJ2aXNpYmlsaXR5IiwgImhpZGRlbiIpOwogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9CgogICAgLy8gQXBwbHkgZm9ybWF0IHRvIGFycm93CiAgICBmdW5jdGlvbiBhcnJvd19mb3JtYXR0aW5nKHNlbGVjdGlvbikgewogICAgICAgIHNlbGVjdGlvbgogICAgICAgIC5jYWxsKGR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gICAgIHZhciBjaGFydCA9IGQzLnNlbGVjdCh0aGlzKS5ub2RlKCkucGFyZW50Tm9kZTsKICAgICAgdmFyIHNpemUgPSAoZC5zaXplX3ZhciA9PT0gdW5kZWZpbmVkKSA/IHNldHRpbmdzLnBvaW50X3NpemUgOiBzaXplX3NjYWxlKGQuc2l6ZV92YXIpOwogICAgICB2YXIgZHggPSAoZC5sYWJfZHggPT09IHVuZGVmaW5lZCkgPyAwIDogZC5sYWJfZHg7CiAgICAgIHZhciBkeSA9IChkLmxhYl9keCA9PT0gdW5kZWZpbmVkKSA/IGRlZmF1bHRfbGFiZWxfZHkoc2l6ZSwgZC55LCBkLnR5cGVfdmFyKSA6IGQubGFiX2R5OwogICAgICBkMy5zZWxlY3QoY2hhcnQpLmFwcGVuZCgic3ZnOmxpbmUiKQogICAgICAuYXR0cigiaWQiLCAic2NhdHRlckQzLWRyYWctbGluZSIpCiAgICAgIC5hdHRyKCJ4MSIsIHgoZC54KSkuYXR0cigieDIiLCB4KGQueCkgKyBkeCkKICAgICAgLmF0dHIoInkxIiwgeShkLnkpKS5hdHRyKCJ5MiIsIHkoZC55KSArIGR5KQogICAgICAuc3R5bGUoInN0cm9rZSIsICIjMDAwIikKICAgICAgLnN0eWxlKCJvcGFjaXR5IiwgMC4zKTsKICAgIH0pCiAgICAub24oJ2RyYWcnLCBmdW5jdGlvbihkKSB7CiAgICAgICAgY3ggPSBkMy5ldmVudC54IC0geChkLngpOwogICAgICAgIGN5ID0gZDMuZXZlbnQueSAtIHkoZC55KTsKICAgICAgICBkMy5zZWxlY3QodGhpcykKICAgICAgICAuYXR0cignZHgnLCBjeCArICJweCIpCiAgICAgICAgLmF0dHIoJ2R5JywgY3kgKyAicHgiKTsKICAgICAgICBkMy5zZWxlY3QoIiNzY2F0dGVyRDMtZHJhZy1saW5lIikKICAgICAgICAuYXR0cigneDInLCB4KGQueCkgKyBjeCkKICAgICAgICAuYXR0cigieTIiLCB5KGQueSkgKyBjeSk7CiAgICAgICA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A9IGQzLmxlZ2VuZC5jb2xvcigpCiAgICAgICAgLnNoYXBlUGFkZGluZygzKQogICAgICAgIC5zaGFwZSgicmVjdCIpCiAgICAgICAgLnNjYWxlKGxlZ2VuZF9jb2xvcl9zY2FsZSkKICAgICAgICAub24oImNlbGxvdmVyIiwgZnVuY3Rpb24oZCkgewogICAgICAgICAgICB2YXIgbnNlbCA9ICIuY29sb3I6bm90KC5jb2xvci1jIiArIGQgKyAiKSI7CiAgICAgICAgICAgIHZhciBzZWwgPSAiLmNvbG9yLWMiICsgZDsKICAgICAgICAgICAgc3ZnLnNlbGVjdEFsbChuc2VsKQogICAgICAgICAgICAudHJhbnNpdGlvbigpCiAgICAgICAgICAgIC5zdHlsZSgib3BhY2l0eSIsIDAuMik7CiAgICAgICAgICAgIHN2Zy5zZWxlY3RBbGwoc2VsKQogICAgICAgICAgICAudHJhbnNpdGlvbigpCiAgICAgICAgICAgIC5zdHlsZSgib3BhY2l0eSIsIDEpOwogICAgICAgIH0pCiAgICAgICAgLm9uKCJjZWxsb3V0IiwgZnVuY3Rpb24oZCkgewogICAgICAgICAgICB2YXIgc2VsID0gIi5jb2xvciI7CiAgICAgICAgICAgIHN2Zy5zZWxlY3RBbGwoc2VsKQogICAgICAgICAgICAudHJhbnNpdGlvbigpCiAgICAgICAgICAgIC5zdHlsZSgib3BhY2l0eSIsIHNldHRpbmdzLnBvaW50X29wYWNpdHkpOwogICAgICAgICAgICBzdmcuc2VsZWN0QWxsKCIucG9pbnQtbGFiZWwiKQogICAgICAgICAgICAudHJhbnNpdGlvbigpCiAgICAgICAgICAgIC5zdHlsZSgib3BhY2l0eSIsIDEpOwogICAgICAgIH0pOwoKICAgICAgICBsZWdlbmQuYXBwZW5kKCJnIikKICAgICAgICAuYXBwZW5kKCJ0ZXh0IikKICAgICAgICAuYXR0cigiY2xhc3MiLCAiY29sb3ItbGVnZW5kLWxhYmVsIikKICAgICAgICAuYXR0cigidHJhbnNmb3JtIiwgInRyYW5zbGF0ZSg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b21haW4ubWFwKGZ1bmN0aW9uKGQpIHtyZXR1cm4gZDMuc3ZnLnN5bWJvbCgpLnR5cGUoZDMuc3ZnLnN5bWJvbFR5cGVzW3N5bWJvbF9zY2FsZShkKV0pKCl9KSk7CgogICAgICAgIHZhciBzeW1ib2xfbGVnZW5kID0gZDMubGVnZW5kLnN5bWJvbCgpCiAgICAgICAgLnNoYXBlUGFkZGluZyg1KQogICAgICAgIC5zY2FsZShsZWdlbmRfc3ltYm9sX3NjYWxlKQogICAgICAgIC5vbigiY2VsbG92ZXIiLCBmdW5jdGlvbihkKSB7CiAgICAgICAgICAgIHZhciBuc2VsID0gIi5zeW1ib2w6bm90KC5zeW1ib2wtYyIgKyBkICsgIikiOwogICAgICAgICAgICB2YXIgc2VsID0gIi5zeW1ib2wtYyIgKyBkOwogICAgICAgICAgICBzdmcuc2VsZWN0QWxsKG5zZWwpCiAgICAgICAgICAgIC50cmFuc2l0aW9uKCkKICAgICAgICAgICAgLnN0eWxlKCJvcGFjaXR5IiwgMC4yKTsKICAgICAgICAgICAgc3ZnLnNlbGVjdEFsbChzZWwpCiAgICAgICAgICAgIC50cmFuc2l0aW9uKCkKICAgICAgICAgICAgLnN0eWxlKCJvcGFjaXR5IiwgMSk7CiAgICAgICAgfSkKICAgICAgICAub24oImNlbGxvdXQiLCBmdW5jdGlvbihkKSB7CiAgICAgICAgICAgIHZhciBzZWwgPSAiLnN5bWJvbCI7CiAgICAgICAgICAgIHN2Zy5zZWxlY3RBbGwoc2VsKQogICAgICAgICAgICAudHJhbnNpdGlvbigpCiAgICAgICAgICAgIC5zdHlsZSgib3BhY2l0eSIsIHNldHRpbmdzLnBvaW50X29wYWNpdHkpOwogICAgICAgICAgICBzdmcuc2VsZWN0QWxsKCIucG9pbnQtbGFiZWwiKQogICAgICAgICAgICAudHJhbnNpdGlvbigpCiAgICAgICAgICAgIC5zdHlsZSgib3BhY2l0eSIsIDEpOwogICAgICAgIH0pOwoKICAgICAgICBsZWdlbmQuYXBwZ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gpICsgIiwiICsgKG1hcmdpbi5zaXplX2xlZ2VuZF90b3AgKyAxNCkgKyAiKSIpCiAgICAgICAgLmNhbGwoc2l6ZV9sZWdlbmQpOwoKICAgIH0KCiAgICAvLyBGaWx0ZXIgcG9pbnRzIGFuZCBhcnJvd3MgZGF0YQogICAgZnVuY3Rpb24gcG9pbnRfZmlsdGVyKGQpIHsKICAgICAgcmV0dXJuIGQudHlwZV92YXIgPT09IHVuZGVmaW5lZCB8fCBkLnR5cGVfdmFyID09ICJwb2ludCI7CiAgICB9CiAgICBmdW5jdGlvbiBhcnJvd19maWx0ZXIoZCkgewogICAgICByZXR1cm4gZC50eXBlX3ZhciAhPT0gdW5kZWZpbmVkICYmIGQudHlwZV92YXIgPT0gImFycm93IjsKICAgIH0KCgogICAgZnVuY3Rpb24gY2hhcnQoc2VsZWN0aW9uKSB7CiAgICAgICAgc2VsZWN0aW9uLmVhY2goZnVuY3Rpb24oKSB7CgogICAgICAgICAgICBzZXR1cF9zaXplcygpOwogICAgICAgICAgICBzZXR1cF9zY2FsZXMoKTsKCiAgICAgICAgICAgIC8vIFJvb3QgY2hhcnQgZWxlbWVudCBhbmQgYXhlcwogICAgICAgICAgICByb290ID0gc3ZnLmFwcGVuZCgiZyIpCiAgICAgICAgICAgIC5hdHRyKCJjbGFzcyIsICJyb290IikKICAgICAgICAgICAgLnN0eWxlKCJmaWxsIiwgIiNGRkYiKQogICAgICAgICAgICAuYXR0cigidHJhbnNmb3JtIiwgInRyYW5zbGF0ZSgiICsgbWFyZ2luLmxlZnQgKyAiLCIgKyBtYXJnaW4udG9wICsgIikiKQogICAgICAgICAgICAuY2FsbChhZGRfYXhlcyk7CgogICAgICAgICAgICAvLyA8ZGVmcz4KICAgICAgICAgICAgdmFyIGRlZnMgPSBzdmcuYXBwZW5kKCJkZWZzIik7CiAgICAgICAgICAgIC8vIGNsaXBwaW5nIHJlY3RhbmdsZQogICAgICAgICAgICBkZWZzLmFwcGVuZCgiY2xpcFBhdGgiKQogICAgICAgICAgICAuYXR0cignaWQnLCAnc2NhdHRlcmNsaXAtJyArIHNldHRpbmdzLmh0bWxfaWQpCiAgICAgICAgICAgIC5hcHBlbmQoJ3JlY3QnKQogICAgICAgICAgICAuYXR0cignY2xhc3MnLCAnY2xpcHJlY3QnKQogICAgICAgICAgICAuYXR0cignd2lkdGgnLCBkaW1zLndpZHRoKQogICAgICAgICAgICAuYXR0cignaGVpZ2h0JywgZGltcy5oZWlnaHQpOwogICAgICAgICAgICAvLyBhcnJvdyBoZWFkIG1hcmtlcnMKICAgICAgICAgICAgY29sb3Jfc2NhbGUucmFuZ2UoKS5mb3JFYWNoKGZ1bmN0aW9uKGQpIHsKICAgICAgICAgICAgICAgIGRlZnMuYXBwZW5kKCJtYXJrZXIiKQogICAgICAgICAgICAgICAgLmF0dHIoImlkIiwgImFycm93LWhlYWQtIiArIHNldHRpbmdzLmh0bWxfaWQgKyAiLSIgKyBkKQogICAgICAgICAgICAgICAgLmF0dHIoIm1hcmtlcldpZHRoIiwgIjEwIikKICAgICAgICAgICAgICAgIC5hdHRyKCJtYXJrZXJIZWlnaHQiLCAiMTAiKQogICAgICAgICAgICAgICAgLmF0dHIoInJlZlgiLCAiMTAiKQogICAgICAgICAgICAgICAgLmF0dHIoInJlZlkiLCAiNCIpCiAgICAgICAgICAgICAgICAuYXR0cigib3JpZW50IiwgImF1dG8iKQogICAgICAgICAgICAgICAgLmFwcGVuZCgicGF0aCIpCiAgICAgICAgICAgICAgICAuYXR0cigiZCIsICJNMCwwIEwwLDggTDEwLDQgTDAsMCIpCiAgICAgICAgICAgICAgICAuc3R5bGUoImZpbGwiLCBkKTsKICAgICAgICAgICAgfSk7CgogICAgICAgICAgICAvLyB6b29tIHBhbmUKICAgICAgICAgICAgcm9vdC5hcHBlbmQoInJlY3QiKQogICAgICAgICAgICAuYXR0cigiY2xhc3MiLCAicGFuZSIpCiAgICAgICAgICAgIC5hdHRyKCJ3aWR0aCIsIGRpbXMud2lkdGgpCiAgICAgICAgICAgIC5hdHRyKCJoZWlnaHQiLCBkaW1zLmhlaWdodCkKICAgICAgICAgICAgLnN0eWxlKCJmaWxsIiwgIm5vbmUiKQogICAgICAgICAgICAuc3R5bGUoInBvaW50ZXItZXZlbnRzIiwgImFsbCIpCiAgICAgICAgICAgIC5jYWxsKHpvb20pOwoKICAgICAgICAgICAgLy8gY2hhcnQgYm9keQogICAgICAgICAgICB2YXIgY2hhcnRfYm9keSA9IHJvb3QuYXBwZW5kKCJnIikKICAgICAgICAgICAgLmF0dHIoImNsYXNzIiwgImNoYXJ0LWJvZHkiKQogICAgICAgICAgICAuYXR0cigid2lkdGgiLCBkaW1zLndpZHRoKQogICAgICAgICAgICAuYXR0cigiaGVpZ2h0IiwgZGltcy5oZWlnaHQpCiAgICAgICAgICAgIC5hdHRyKCJjbGlwLXBhdGgiLCAidXJsKCIgKyBkb2N1bWVudC5sb2NhdGlvbi5ocmVmICsgIiNzY2F0dGVyY2xpcC0iICsgc2V0dGluZ3MuaHRtbF9pZCArICIpIik7CgogICAgICAgICAgICAgY2hhcnRfYm9keS5hcHBlbmQoInBhdGgiKQogICAgICAgICAgICAuYXR0cigiY2xhc3MiLCAiemVyb2xpbmUgaGxpbmUiKQogICAgICAgICAgICAuYXR0cigiZCIsIHplcm9saW5lKFt7eDp4LmRvbWFpbigpWzBdLCB5OjB9LCB7eDp4LmRvbWFpbigpWzFdLCB5OjB9XSkpOwogICAgICAgICAgICBjaGFydF9ib2R5LmFwcGVuZCgicGF0aCIpCiAgICAgICAgICAgIC5hdHRyKCJjbGFzcyIsICJ6ZXJvbGluZSB2bGluZSIpCiAgICAgICAgICAgIC5hdHRyKCJkIiwgemVyb2xpbmUoW3t4OjAsIHk6eS5kb21haW4oKVswXX0sIHt4OjAsIHk6eS5kb21haW4oKVsxXX1dKSk7CgogICAgICAgICAgICAvLyBVbml0IGNpcmNsZQogICAgICAgICAgICBpZiAoc2V0dGluZ3MudW5pdF9jaXJjbGUpIHsKICAgICAgICAgICAgICB2YXIgdW5pdF9jaXJjbGUgPSBjaGFydF9ib2R5LmFwcGVuZCgnc3ZnOmVsbGlwc2UnKQogICAgICAgICAgICAgIC5hdHRyKCdjbGFzcycsICd1bml0LWNpcmNsZScpCiAgICAgICAgICAgICAgLmNhbGwodW5pdF9jaXJjbGVfaW5pdCk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIC8vIEFkZCBwb2ludHMKICAgICAgICAgICAgdmFyIGRvdCA9IGNoYXJ0X2JvZHkKICAgICAgICAgICAgLnNlbGVjdEFsbCgiLmRvdCIpCiAgICAgICAgICAgIC5kYXRhKGRhdGEuZmlsdGVyKHBvaW50X2ZpbHRlciksIGtleShwb2ludF9maWx0ZXIpKTsKICAgICAgICAgICAgZG90LmVudGVyKCkKICAgICAgICAgICAgLmFwcGVuZCgicGF0aCIpCiAgICAgICAgICAgIC5jYWxsKGRvdF9pbml0KQogICAgICAgICAgICAuY2FsbChkb3RfZm9ybWF0dGluZyk7CiAgICAgICAgICAgIC8vIEFkZCBhcnJvd3MKICAgICAgICAgICAgdmFyIGFycm93ID0gY2hhcnRfYm9keQogICAgICAgICAgICAuc2VsZWN0QWxsKCIuYXJyb3ciKQogICAgICAgICAgICAuZGF0YShkYXRhLmZpbHRlcihhcnJvd19maWx0ZXIpLCBrZXkoYXJyb3dfZmlsdGVyKSk7CiAgICAgICAgICAgIGFycm93LmVudGVyKCkKICAgICAgICAgICAgLmFwcGVuZCgic3ZnOmxpbmUiKQogICAgICAgICAgICAuY2FsbChhcnJvd19pbml0KQogICAgICAgICAgICAuY2FsbChhcnJvd19mb3JtYXR0aW5nKTsKCgogICAgICAgICAgICAvLyBBZGQgdGV4dCBsYWJlbHMKICAgICAgICAgICAgaWYgKHNldHRpbmdzLmhhc19sYWJlbHMpIHsKICAgICAgICAgICAgICAgIHZhciBsYWJlbHMgPSBjaGFydF9ib2R5LnNlbGVjdEFsbCgiLnBvaW50LWxhYmVsIikKICAgICAgICAgICAgICAgIC5kYXRhKGRhdGEsIGtleSk7CgogICAgICAgICAgICAgICAgbGFiZWxzLmVudGVyKCkKICAgICAgICAgICAgICAgIC5hcHBlbmQoInRleHQiKQogICAgICAgICAgICAgICAgLmNhbGwobGFiZWxfaW5pdCkKICAgICAgICAgICAgICAgIC5jYWxsKGxhYmVsX2Zvcm1hdHRpbmcpCiAgICAgICAgICAgICAgICAuY2FsbChkcmFnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gTGVnZW5kcwogICAgICAgICAgICBpZiAoc2V0dGluZ3MuaGFzX2xlZ2VuZCAmJiBzZXR0aW5ncy5sZWdlbmRfd2lkdGggPiAwKSB7CiAgICAgICAgICAgICAgICB2YXIgbGVnZW5kID0gc3ZnLmFwcGVuZCgiZyIpLmF0dHIoImNsYXNzIiwgImxlZ2VuZCIpOwogICAgICAgICAgICAgICAgLy8gQ29sb3IgbGVnZW5kCiAgICAgICAgICAgICAgICBpZiAoc2V0dGluZ3MuaGFzX2NvbG9yX3ZhcikgewogICAgICAgICAgICAgICAgICAgIGFkZF9jb2xvcl9sZWdlbmQuc3ZnID0gc3ZnOwogICAgICAgICAgICAgICAgICAgIGFkZF9jb2xvcl9sZWdlbmQobGVnZW5kKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIC8vIFN5bWJvbCBsZWdlbmQKICAgICAgICAgICAgICAgIGlmIChzZXR0aW5ncy5oYXNfc3ltYm9sX3ZhcikgewogICAgICAgICAgICAgICAgICAgIGFkZF9zeW1ib2xfbGVnZW5kLnN2ZyA9IHN2ZzsKICAgICAgICAgICAgICAgICAgICBhZGRfc3ltYm9sX2xlZ2VuZChsZWdlbmQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgLy8gU2l6ZSBsZWdlbmQKICAgICAgICAgICAgICAgIGlmIChzZXR0aW5ncy5oYXNfc2l6ZV92YXIpIGFkZF9zaXplX2xlZ2VuZChsZWdlbmQpOwogICAgICAgICAgICB9CgogICAgICAgIH0pOwogICAgfQ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hhcnRfYm9keS5zZWxlY3RBbGwoIi5wb2ludC1sYWJlbCIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZGF0YShkYXRhLCBrZXkpOwogICAgICAgICAgICAgICAgbGFiZWxzLmVudGVyKCkKICAgICAgICAgICAgICAgIC5hcHBlbmQoInRleHQiKQogICAgICAgICAgICAgICAgLmNhbGwobGFiZWxfaW5pdCkKICAgICAgICAgICAgICAgIC5jYWxsKGxhYmVsX2Zvcm1hdHRpbmcpCiAgICAgICAgICAgICAgICAuY2FsbChkcmFnKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAob2xkX3NldHRpbmdzLnVuaXRfY2lyY2xlICE9IHNldHRpbmdzLnVuaXRfY2lyY2xlKSB7CiAgICAgICAgICAgIGlmICghc2V0dGluZ3MudW5pdF9jaXJjbGUpIHsKICAgICAgICAgICAgICAgIHZhciBjaXJjbGUgPSBzdmcuc2VsZWN0KCIudW5pdC1jaXJjbGUiKTsKICAgICAgICAgICAgICAgIGNpcmNsZS50cmFuc2l0aW9uKCkuZHVyYXRpb24oMTAwMCkuY2FsbCh1bml0X2NpcmNsZV9pbml0KQogICAgICAgICAgICAgICAgLnN0eWxlKCJvcGFjaXR5IiwgIjAiKS5yZW1vdmUoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoc2V0dGluZ3MudW5pdF9jaXJjbGUpIHsKICAgICAgICAgICAgICAgIHZhciBjaGFydF9ib2R5ID0gc3ZnLnNlbGVjdCgiLmNoYXJ0LWJvZHkiKTsKICAgICAgICAgICAgICAgIGNoYXJ0X2JvZHkuYXBwZW5kKCdzdmc6ZWxsaXBzZScpCiAgICAgICAgICAgICAgICAuYXR0cignY2xhc3MnLCAndW5pdC1jaXJjbGUnKQogICAgICAgICAgICAgICAgLnN0eWxlKCJvcGFjaXR5IiwgIjAiKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH07CgogICAgLy8gVXBkYXRlIGRhdGEgd2l0aCB0cmF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tIGdhcF94LCBtYXhfeCArIGdhcF94XSksCiAgICAgICAgICAgICAgICBpeSA9IGQzLmludGVycG9sYXRlKHkuZG9tYWluKCksIFttaW5feSAtIGdhcF95LCBtYXhfeSArIGdhcF95XSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24odCkgewogICAgICAgICAgICAgICAgICAgIHpvb20ueCh4LmRvbWFpbihpeCh0KSkpLnkoeS5kb21haW4oaXkodCkpKTsKICAgICAgICAgICAgICAgICAgICB6b29tZWQocmVzZXQgPSB0cnVlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0pCiAgICAgICAgfSk7CgogICAgICAgIC8vIFNWRyBleHBvcnQKICAgICAgICBkMy5zZWxlY3QoIiMiICsgc2V0dGluZ3MuZG9tX2lkX3N2Z19leHBvcnQpCiAgICAgICAgLm9uKCJjbGljayIsIGZ1bmN0aW9uKCl7CiAgICAgICAgICAgIHZhciBzdmdfY29udGVudCA9IHN2ZwogICAgICAgICAgICAuYXR0cigieG1sbnMiLCAiaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciKQogICAgICAgICAgICAuYXR0cigidmVyc2lvbiIsIDEuMSkKICAgICAgICAgICAgLm5vZGUoKS5wYXJlbnROb2RlLmlubmVySFRNTDsKICAgICAgICAgICAgc3ZnX2NvbnRlbnQgPSBzdmdfY29udGVudC5yZXBsYWNlKC9jbGlwLXBhdGg9InVybFwoLio/KCMuKj8pXCkiLywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjbGlwLXBhdGg9InVybCgkMSkiJyk7CiAgICAgICAgICAgIHZhciBpbWFnZVVybCA9ICJkYXRhOmltYWdlL29jdGV0LXN0cmVhbTtiYXNlNjQsXG4iICsgYnRvYShzdmdfY29udGVudCk7CiAgICAgICAgICAgIGQzLnNlbGVjdCh0aGlzKQogICAgICAgICAgICAuYXR0cigiZG93bmxvYWQiLCAic2NhdHRlckQzLnN2ZyIpCiAgICAgIC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yBpdAogICAgICAgIGlmICghb2JqLnNldHRpbmdzLnRyYW5zaXRpb25zKSB7CiAgICAgICAgICAgIHN2Zy5zZWxlY3RBbGwoIio6bm90KHN0eWxlKSIpLnJlbW92ZSgpOwogICAgICAgIH0KCiAgICAgICAgLy8gQ29tcGxldGUgZHJhdwogICAgICAgIGlmIChyZWRyYXcpIHsKICAgICAgICAgICAgc2NhdHRlciA9IHNjYXR0ZXIuZGF0YShkYXRhLCByZWRyYXcpOwogICAgICAgICAgICBzY2F0dGVyID0gc2NhdHRlci5zZXR0aW5ncyhvYmouc2V0dGluZ3MpOwogICAgICAgICAgICAvLyBhZGQgY29udHJvbHMgaGFuZGxlcnMgZm9yIHNoaW55IGFwcHMKICAgICAgICAgICAgc2NhdHRlci5hZGRfY29udHJvbHNfaGFuZGxlcnMoKTsKICAgICAgICAgICAgLy8gZHJhdyBjaGFydAogICAgICAgICAgICBkMy5zZWxlY3QoZWwpCiAgICAgICAgICAgIC5jYWxsKHNjYXR0ZXIpOwogICAgICAgIH0KICAgICAgICAvLyBVcGRhdGUgb25seQogICAgICAgIGVsc2UgewogICAgICAgICAgICAvLyBDaGVjayB3aGF0IGRpZCBjaGFuZ2UKICAgICAgICAgICAgb2JqLnNldHRpbmdzLmhhc19sZWdlbmRfY2hhbmdlZCA9IHNjYXR0ZXIuc2V0dGluZ3MoKS5oYXNfbGVnZW5kICE9IG9iai5zZXR0aW5ncy5oYXNfbGVnZW5kOwogICAgICAgICAgICBvYmouc2V0dGluZ3MuaGFzX2xhYmVsc19jaGFuZ2VkID0gc2NhdHRlci5zZXR0aW5ncygpLmhhc19sYWJlbHMgIT0gb2JqLnNldHRpbmdzLmhhc19sYWJlbHM7CiAgICAgICAgICAgIGZ1bmN0aW9uIGNoYW5nZWQodmFybmFtZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG9iai5zZXR0aW5ncy5oYXNoZXNbdmFybmFtZV0gIT0gc2NhdHRlci5zZXR0aW5ncygpLmhhc2hlc1t2YXJuYW1lXTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgb2JqLnNldHRpbmdzLnhfY2hhbmdlZCA9IGNoYW5nZWQoIngiKTsKICAgICAgICAgICAgb2JqLnNldHRpbmdzLnlfY2hhbmdlZCA9IGNoYW5nZWQoInkiKTsKICAgICAgICAgICAgb2JqLnNldHRpbmdzLmxhYl9jaGFuZ2VkID0gY2hhbmdlZCgibGFiIik7CiAgICAgICAgICAgIG9iai5zZXR0aW5ncy5sZWdlbmRfY2hhbmdlZCA9IGNoYW5nZWQoImNvbF92YXIiKSB8fCBjaGFuZ2VkKCJzeW1ib2xfdmFyIikgfHwgY2hhbmdlZCgic2l6ZV92YXIiKTsKICAgICAgICAgICAgb2JqLnNldHRpbmdzLmRhdGFfY2hhbmdlZCA9IG9iai5zZXR0aW5ncy54X2NoYW5nZWQgfHwgb2JqLnNldHRpbmdzLnlfY2hhbmdlZCB8fCBvYmouc2V0dGluZ3MubGFiX2NoYW5nZWQgfHwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iai5zZXR0aW5ncy5sZWdlbmRfY2hhbmdlZCB8fCBvYmouc2V0dGluZ3MuaGFzX2xhYmVsc19jaGFuZ2VkOwogICAgICAgICAgICBzY2F0dGVyID0gc2NhdHRlci5zZXR0aW5ncyhvYmouc2V0dGluZ3MpOwogICAgICAgICAgICAvLyBVcGRhdGUgZGF0YSBvbmx5IGlmIG5lZWRlZAogICAgICAgICAgICBpZiAob2JqLnNldHRpbmdzLmRhdGFfY2hhbmdlZCkgc2NhdHRlciA9IHNjYXR0ZXIuZGF0YShkYXRhLCByZWRyYXcpOwogICAgICAgIH0KICAgIH0KCn0pOw==","message":"","warning":"","visible":"yes"},"updateButtonRed":false,"updateMessage":"there are no changes","codeHasChanged":false,"autosaveCodeHasChanged":false,"secondsTaken":1.3051835,"updated":"2016-01-04T00:41:31.3472917+00:00","lastUpdatedMessage":null,"executedCode":"library(flipMultivariates)\nrows.to.remove <- unlist(strsplit(\"NET, Total, SUM\", \",\"))\ncolumns.to.remove <- unlist(strsplit(\"NET, Total, SUM\", \",\"))\ncorrespondence.analysis = CorrespondenceAnalysis(`Category of Readership by Level of Education`, normalization = \"Principal\", TRUE, rows.to.remove, columns.to.remove)","lastSavedCode":"library(flipMultivariates)\nrows.to.remove <- unlist(strsplit(\"NET, Total, SUM\", \",\"))\ncolumns.to.remove <- unlist(strsplit(\"NET, Total, SUM\", \",\"))\ncorrespondence.analysis = CorrespondenceAnalysis(`Category of Readership by Level of Education`, normalization = \"Principal\", TRUE, rows.to.remove, columns.to.remove)","highlightedCodeSpans":[{"start":197,"length":46,"index":2}],"tableTransformations":"<TabularTransformer>\r\n <TabularTransform />\r\n</TabularTransformer>","tabularFilteringOptions":null,"guiControls":{"JSError":null,"JSErrorDetails":null,"Errors":null,"Controls":[{"Type":"Heading","Text":"Correspondence Analysis of a Table"},{"Type":"DropBox","Label":"Table","ControlName":"formTableToAnalyse","Prompt":"Drag an input which is of type <b>Table</b> or <b>Ritem</b>, from the Report tree.","ErrorMessage":"<b>Table</b> accepts only one input which is of type <b>Table</b> or <b>Ritem</b>.","Invalid":null,"Value":{"items":null,"guid":"2340fd4e-0409-49a4-8a00-7777fae999c3","type":"table","title":"Category of Readership by Level of Education"},"Values":null,"Allowed":["2340fd4e-0409-49a4-8a00-7777fae999c3","e8dc2410-1c64-4d80-891e-9b67ef64f389"],"AllowedTypes":["table","RItem"],"Multi":false,"MinInputs":1,"MaxInputs":1,"Height":1,"Duplicates":false},{"Type":"ComboBox","Label":"Normalization","ControlName":"formNormalization","Prompt":null,"ErrorMessage":null,"Invalid":null,"Value":"Principal","Values":["Principal","Row principal","Column principal","Symmetrical (½)","None"]},{"Type":"CheckBox","Label":"Interactive","ControlName":"formInteractive","Prompt":null,"ErrorMessage":null,"Invalid":null,"CheckAlign":"right","Value":true},{"Type":"TextBox","Label":"Rows to ignore","ControlName":"formIgnoreRows","Prompt":null,"ErrorMessage":null,"Invalid":null,"Value":"NET, Total, SUM"},{"Type":"TextBox","Label":"Columns to ignore","ControlName":"formIgnoreColumns","Prompt":null,"ErrorMessage":null,"Invalid":null,"Value":"NET, Total, SUM"},{"Vertical":true}],"Notifications":null},"showDebug":false,"pageType":"RCode","layout":"OutputOnly","size":{"Width":553,"Height":328},"vSplit":0.25,"hSplit":0.45,"updateWarnings":true,"updateMode":"Automatic","warnSlow":true,"outputSize":{"Width":553,"Height":328},"Options":{"debugconsole":false,"objectinspectorpage":"RCode","codeposition":"OutputOnly","size":{"width":553,"height":328},"splitH":0.45,"splitV":0.25,"update warnings":true,"updating":"Automatic","warn slow":true}}
')
: (src.startsWith('data:text/css')
? ('')
: null); });
if (script_tags.any(function (t) { return t === null; }))
throw new Error('widget head resource had an unknown type');
var html = '\n'
+ '\n'
+ '\n'
+ script_tags.join('\n')
+ '\n'
+ '\n'
+ '\n'
+ (Util.isForScreenshot() ? '\n' : '\n')
+ body
+ '\n'
+ '';
var iframe = document.createElement('iframe');
iframe.className = 'r-htmlwidget-iframe';
this._jqObj[0].appendChild(iframe);
setTimeout(function () {
if (!_this._jqObj.existsInDom())
return;
var document = (iframe.contentWindow) ? iframe.contentWindow.document : (iframe.contentDocument && iframe.contentDocument.document) ? iframe.contentDocument.document : iframe.contentDocument;
if (!document)
return;
document.open();
document.write(html);
document.close();
_this._reZoomOutput();
setTimeout(function () { return _this.reload; }, 100);
setTimeout(function () { return _this.outputReadyForTraining = true; }, 1000);
}, 0);
};
RItemGui.prototype.reload = function () {
var DOMContentLoaded_event = document.createEvent("Event");
DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true);
window.document.dispatchEvent(DOMContentLoaded_event);
};
RItemGui.prototype.applyAppearanceParameters = function (appearance) {
var container = $("div#{0} #output .ritem-text-container".format(this.id()));
var output = $("div#{0} #output .ritem-text-output".format(this.id()));
var border = appearance.border;
container.css({
"background": appearance.background,
"border-width": border.size + "px",
"border-color": border.color,
"border-style": border.on ? border.style : "none",
"padding": appearance.padding
});
var font = appearance.font;
var text = appearance.text;
output.css({
"font-family": font.family,
"font-size": font.size + "px",
"color": font.color,
"font-weight": font.bold ? "bold" : "normal",
"font-style": font.italic ? "italic" : "normal",
"text-decoration": font.underline ? (font.strikeout ? "underline line-through" : "underline") : (font.strikeout ? "line-through" : "none"),
"text-align": text.hAlign,
"vertical-align": text.vAlign,
"white-space": text.wrap ? "normal" : "pre"
});
};
RItemGui.prototype.onROutputOptionClicked = function (gui, i) {
var outputs = gui._state.getOutputs();
if (outputs == null)
return;
if (i === 1)
this._displayEltHtml(outputs["console"]);
else if (i === 2)
this.displayError(outputs);
else
switch (this._state.outputType) {
case OutputType.TABLE:
this.displayTable(outputs["table"]);
break;
case OutputType.TEXT:
this.displayText(outputs["text"]);
break;
case OutputType.PLOT:
this.displayPlot(outputs["plots"]);
break;
default: this.clear();
}
};
RItemGui.prototype.clear = function () {
if (this._jqObj)
this._jqObj.empty();
};
RItemGui.prototype.changeLayout = function (layout) {
this.applyLayout(layout);
if (this._editMode || Environment.isDisplayr) {
this._state.oldLayout = layout;
this.itemDidReattachToWorkarea();
}
};
RItemGui.prototype.itemDidReattachToWorkarea = function () {
if (this._state.outputType === OutputType.WIDGET)
this._displayAppropriateOutput();
};
RItemGui.prototype.applyLayout = function (layout) {
this._codeContainer.detach();
this._outputContainer.detach();
if (this._hsplitter)
this._hsplitter.destroy();
if (this._vsplitter)
this._vsplitter.destroy();
if (this._state.oldLayout === Layout.CodeOnly || this._state.oldLayout === Layout.OutputOnly)
this._contentFrame.removeClass("flip-container");
this._contentFrame.children(".splitPanel").remove();
switch (layout) {
case Layout.CodeOnly:
this._contentFrame.append(this._codeContainer);
break;
case Layout.OutputOnly:
this._outputContainer.children().removeClass("notransition");
this._contentFrame.addClass("flip-container flip-notanimating").append(this._outputContainer);
break;
case Layout.Left:
this._hsplitter = new WebWidgets.HorizontalSplitter(this._contentFrame, false, 100 * this._state.hSplit);
this.modifyOutputSplitter(this._hsplitter);
this._hsplitter.leftPanel.append(this._codeContainer);
this._hsplitter.rightPanel.addClass("flip-container flip-notanimating").append(this._outputContainer);
break;
case Layout.Top:
this._vsplitter = new WebWidgets.VerticalSplitter(this._contentFrame, false, 100 * this._state.vSplit);
this.modifyOutputSplitter(this._vsplitter);
this._vsplitter.topPanel.append(this._codeContainer);
this._vsplitter.bottomPanel.addClass("flip-container flip-notanimating").append(this._outputContainer);
break;
case Layout.Right:
this._hsplitter = new WebWidgets.HorizontalSplitter(this._contentFrame, false, 100 - 100 * this._state.hSplit);
this.modifyOutputSplitter(this._hsplitter);
this._hsplitter.leftPanel.addClass("flip-container flip-notanimating").append(this._outputContainer);
this._hsplitter.rightPanel.append(this._codeContainer);
break;
case Layout.Bottom:
this._vsplitter = new WebWidgets.VerticalSplitter(this._contentFrame, false, 100 - 100 * this._state.vSplit);
this.modifyOutputSplitter(this._vsplitter);
this._vsplitter.topPanel.addClass("flip-container flip-notanimating").append(this._outputContainer);
this._vsplitter.bottomPanel.append(this._codeContainer);
break;
}
if (Util.isForScreenshot())
(this._state.showDebug ? this._jqObj : this._jqConsole).css('display', 'none');
else
this.set_flip("div#{0} .flip-1".format(this.id()), this._state.showDebug);
};
RItemGui.prototype.set_flip = function (clss, flipToBack) {
console.log("set flip: " + this._state.oldLayout);
$(clss).addClass("notransition");
if (flipToBack)
$(clss).addClass("flipped");
else
$(clss).removeClass("flipped");
setTimeout(function () {
$(clss).removeClass("notransition");
}, 600);
};
RItemGui.prototype.resetPreviewer = function () {
if (this._previewer) {
this._previewer.setTarget(null);
this._previewer.hide();
}
};
RItemGui.prototype.resetNotificationBar = function () {
if (this._editMode) {
this._notificationBar.clearMustChooseOutputType();
this._notificationBar.clearError();
this._notificationBar.clearWarnings();
}
};
RItemGui.prototype.resetNotificationBarWarnings = function () {
if (this._editMode)
this._notificationBar.clearWarnings();
};
RItemGui.prototype.properEnter = function (guid) {
var _this = this;
this.enterRItem(guid);
this._editMode = true;
if (this._ritem_oi)
this._ritem_oi.setRGuiControlsPanel(this._rControlsContainer);
this.guiControlsReadyForTraining = false;
QServerRequestsCommon.GetREditGuiControls({ GUID: guid }, function (response) {
_this.showControlCode(response.CodeForRGuiControls);
_this.gotRControls(response.RGuiControls);
});
this._firstPreCalcStuff = true;
this.getPreCalcStuff();
};
RItemGui.prototype.enterRItem = function (guid) {
var _this = this;
bugLog('enterRItem({0})'.format(guid));
this.resetPreviewer();
this._readyForTraining = false;
this._state.guid = guid;
if (!this._forDataSet) {
this.guiControlsReadyForTraining = false;
this.subscribe('GetRControls', function (response) { return _this.gotRControls(response); });
this.updateInspectorSize();
}
};
RItemGui.prototype.leaveRItem = function (refresh_r_item) {
bugLog('leaveRItem');
this.unsubscribe('GetRControls');
this.unsubscribe('GetREditPreCalcStuff');
this.unsubscribe('GetREditPostCalcStuff');
this.resetNotificationBar();
this._notificationBar.warnSlow(false);
this._readyForTraining = false;
this._editMode = false;
this.rItemCodeEditor.enabled(false);
this._ritem_oi.codeEditor.enabled(false);
clearTimeout(this._state.autosaveTimer);
clearTimeout(this._state.highlightingTimer);
if (refresh_r_item && this.getItemGuids().length === 1) {
var code_to_save = null;
if (!this._waitingForPreCalcStuff) {
var code = this._codeEditorCoordinator.getCode();
this._state.codeHasChanged = code !== this._state.executedCode;
var need_to_save = code !== this._state.lastSavedCode;
if (need_to_save)
this._state.lastSavedCode = code;
code_to_save = need_to_save ? code : null;
}
this._state.autosaveCodeHasChanged = false;
QServerRequestsCommon.RItemLeaveEditMode({ GUID: this.getItemGuids()[0], Code: code_to_save });
}
};
RItemGui.prototype.getItemGuids = function () {
return [this._state.guid];
};
RItemGui.prototype.subscribe = function (name, callback) {
var guid = this._state.guid ? this._state.guid : "no-guid";
var request = { Request: name, GUID: guid };
if (!Subscription.isSubscribed(request))
Subscription.subscribe(request, callback);
};
RItemGui.prototype.unsubscribe = function (name) {
var guid = this._state.guid ? this._state.guid : "no-guid";
var request = { Request: name, GUID: guid };
if (Subscription.isSubscribed(request))
Subscription.unsubscribe(request);
};
RItemGui.prototype.getPreCalcStuff = function () {
var _this = this;
this._waitingForPreCalcStuff = true;
var handle_precalcstuff = function (response) {
if (!_this._editMode)
return;
_this.displayBeforeCalculation(response.Options, _this._firstPreCalcStuff || !_this._state.autosaveCodeHasChanged ? response.Code : null, response.Highlights.Highlights, response.Name);
_this.rItemCodeEditor.enabled(true);
_this._ritem_oi.codeEditor.enabled(true);
_this._waitingForPreCalcStuff = false;
if (_this._firstPreCalcStuff) {
_this._firstPreCalcStuff = false;
QServerRequestsCommon.RItemAutoUpdate({ GUIDs: [_this._state.guid] }, function () {
_this.getPostCalcStuff();
});
}
};
if (this._forDataSet)
QServerRequestsCommon.GetREditPreCalcStuff({ GUID: this._state.guid }, handle_precalcstuff);
else
this.subscribe('GetREditPreCalcStuff', handle_precalcstuff);
};
RItemGui.prototype.getPostCalcStuff = function () {
var _this = this;
var handle_postcalcstuff = function (response) {
if (!_this._editMode)
return;
_this.displayAfterCalculation(response.Outputs, response.IsErroneous, new Date(response.LastUpdatedDate));
};
if (this._forDataSet) {
QServerRequestsCommon.GetREditPostCalcStuff({ GUID: this._state.guid }, handle_postcalcstuff);
}
else {
this.unsubscribe('GetREditPostCalcStuff');
this.subscribe('GetREditPostCalcStuff', handle_postcalcstuff);
}
};
RItemGui.prototype.showRGUIControlError = function (details) {
if (this._editMode)
this._ritem_oi.controlEditor.markError(details[0] - 1, details[1], details[2], true);
};
RItemGui.prototype.setObjectExplorerFilter = function (dropbox) {
};
RItemGui.prototype.showCode = function (code, force_change) {
if (force_change === void 0) { force_change = false; }
if (force_change) {
this._state.lastSavedCode = code + "!";
this._readyForTraining = false;
}
else
this._state.lastSavedCode = code;
this._codeEditorCoordinator.setCode(code);
this.refreshWarnings();
this.lastUpdatedMessageMaintainer.refreshUpdate();
if (force_change)
this._state.codeHasChanged = true;
if (this._editMode && !this.multiple)
this.startImmediateTimer();
};
RItemGui.prototype.highlightSpans = function (spans) {
this._codeEditorCoordinator.highlightSpans(spans);
};
RItemGui.prototype.showControlCode = function (code) {
if (this._editMode)
this._ritem_oi.controlEditor.text(code);
};
RItemGui.prototype.gotRControls = function (response) {
var _this = this;
var old_scroll = this._rControlsContainer.scrollTop();
this._rControls.empty();
var div = this._rControls;
this._dropBoxes = [];
var controls = response.Controls;
if (!controls || controls.length === 0 || controls[0]["Vertical"] !== undefined && controls.length === 1) {
var name = this._forDataSet ? "Create a Dataset" : this._state.name;
div.append('
{0}
'.format(name));
div.append('
No input code has been specified. To add input, edit the JavaScript code in the "R Input Code" section of the Object Inspector.
');
if (this._ritem_oi)
this._ritem_oi.setRGuiControlsPageTitle(null);
setTimeout(function () { _this.guiControlsReadyForTraining = true; }, 100);
return;
}
if (response.JSError) {
$("#js-error").text(response.JSError);
var details = response.JSErrorDetails;
this.showRGUIControlError(details);
}
else {
$("#js-error").text("");
}
var vertical = controls.any(function (x) { return !!x["Vertical"]; });
$("#invalid-r-control").text("");
var orig_div = div;
var first_heading = null;
$.each(controls, function (i, args) {
var name = args["ControlName"];
var label = args["Label"] ? args["Label"] : "";
var invalid = args["Invalid"];
if (vertical) {
div = $('');
orig_div.append(div);
}
args = $.extend({ 'IsRegressionTesting': _this._regression_testing }, args);
var control = null;
switch (args["Type"]) {
case "CheckBox": {
var chkbox = new SCCheckBox(name, label, args["Prompt"], args["CheckAlign"], function () {
_this.StateChanged("GetRControls", "SetValueForRControl", name, chkbox.checked() ? "true" : "false", function (response) { return _this.gotRControls(response); });
});
chkbox.checked(args["Value"]);
control = chkbox;
break;
}
case "DropBox": {
var dropbox = new RibbonDropBox(name, label, _this._guidToTreeViewItemResolver, function () { return _this.setObjectExplorerFilter(dropbox); }, function () {
var multi = dropbox.multi();
var value = multi ? dropbox.values().map(function (item) { return item.guid; }).join(";") : dropbox.value() ? dropbox.value().guid : null;
_this.StateChanged("GetRControls", multi ? "SetGuidsForRControl" : "SetGuidForRControl", name, value, function (response) { return _this.gotRControls(response); });
}, args);
_this._dropBoxes.push(dropbox);
control = dropbox;
break;
}
case "ComboBox":
case "StatisticPicker": {
var cbobox = new SCComboBox(name, label, args["Prompt"], false, function () {
_this.StateChanged("GetRControls", "SetValueForRControl", name, cbobox.value(), function (response) { return _this.gotRControls(response); });
});
cbobox.populateList(args["Values"], false);
cbobox.value(args["Value"]);
cbobox.setOptions(args);
control = cbobox;
break;
}
case "NumberBox":
case "TextBox": {
var numeric = args["Type"] === "NumberBox" || args["Validator"] === "number";
var txtbox = new SCTextBox(name, label, args["Prompt"], function () {
_this.StateChanged("GetRControls", "SetValueForRControl", name, txtbox.text(), function (response) { return _this.gotRControls(response); });
}, numeric);
txtbox.text(args["Value"]);
txtbox.setOptions(args);
control = txtbox;
break;
}
case "NumericUpDown": {
var updown = new RibbonUpDown(name, label, args["Prompt"], function () {
_this.StateChanged("GetRControls", "SetValueForRControl", name, updown.value().toString(), function (response) { return _this.gotRControls(response); });
});
updown.increment(args["Increment"]);
updown.min(args["Min"]);
updown.max(args["Max"]);
updown.value(args["Value"]);
control = updown;
break;
}
case "ColorPicker": {
var color = new SCPopupColor(name, label, args["Prompt"], 'medium', Util.makeSharedWebUiSpriteImg('colourfill.png'), function () { return _this.StateChanged("GetRControls", "SetValueForRControl", name, _this.rgbAsString(color), function (response) { return _this.gotRControls(response); }); }, null, Translate('More Colors...'));
color.value(args["Value"]);
control = color;
break;
}
case "Label": {
var lbl = new RibbonLabelledText(name, args["Text"], null);
lbl.addToDialog(div, null);
lbl.enabled(true);
break;
}
case "LineBreak": {
div.append($(" "));
break;
}
case "Heading": {
if (first_heading === null)
first_heading = args["Text"];
else
div.append($("
").text(args["Text"]));
break;
}
case "Summary": {
div.append(" ");
div.append($("").text(args["Text"]));
break;
}
}
if (control) {
control.addToDialog(div, null);
control.enabled(true);
if (invalid) {
var jq = control.getJqPrimaryControl();
jq.addClass("ribbon-invalid");
jq.parent().find("div.drop-error").html(invalid);
}
}
});
if (this._ritem_oi) {
this._ritem_oi.setRGuiControlsPageTitle(first_heading);
this._ritem_oi.fireOnceWhenRGuiControlsPageShown(function () {
if (vertical) {
var w = _this.widthOfLabels() + 10;
_this._rControls.find("label").width(w);
_this._rControls.find("div.drop-error").css({ left: w });
_this._rControls.find("span.ribbon-combobox input").width("calc(100% - {0}px)".format(w + 25));
_this._rControls.find("span.ribbon-textbox input").width("calc(100% - {0}px)".format(w + 9));
}
else {
_this._rControls.children(".ribbon-checkbox").css("display", "inline");
_this._rControls.children(".sc-combobox").css("display", "inline");
}
_this._rControlsContainer.scrollTop(old_scroll);
});
}
setTimeout(function () { _this.guiControlsReadyForTraining = true; }, 100);
};
RItemGui.prototype.rgbAsString = function (color) {
var rgb = RibbonPopupColor.strToColor(color.value());
return rgb.replace('rgb(', '').replace(')', '');
};
RItemGui.prototype.widthOfLabels = function () {
return this._rControls.find("label".format(this.id())).map(function (i, x) { return $(x).width(); }).toArray().reduce(function (sum, x) { return Math.max(sum, x); }, 0);
};
RItemGui.prototype.StateChanged = function (get_request, set_request, set_name, set_value, success) {
RUtil.StateChanged(this._forDataSet ? 1 : this._editMode ? 2 : 3, this._state.guid, get_request, set_request, set_name, set_value, success);
};
RItemGui.prototype.toggleDebug = function (visible) {
if (this._editMode)
this._ritem_oi.chkDebug.checked(visible);
};
RItemGui.prototype.setDebugVisibility = function (visible, originated_in_checkbox) {
if (this._state.showDebug === visible)
return;
this._state.showDebug = visible;
if (originated_in_checkbox) {
this.do_flip("div#{0} .flip-1".format(this.id()), visible);
this.changeOption("debugconsole", visible, originated_in_checkbox);
}
else {
this.set_flip("div#{0} .flip-1".format(this.id()), visible);
this.toggleDebug(visible);
}
};
RItemGui.prototype.do_flip = function (clss, flipToBack) {
var _this = this;
console.log("flip: " + this._state.oldLayout);
var id = this.id();
$('div#{0} #resizable-box > .splitPanel'.format(id)).css("overflow", "visible");
var other = (this._state.oldLayout === Layout.Top) === clss.endsWith(".flip-0") ? "bottom" : "top";
$('div#{0} #resizable-box .splitPanel-{1}'.format(id, other)).css("z-index", "-1").addClass("shadow");
$('div#{0} #resizable-box .ui-icon-gripsmall-diagonal-se'.format(id)).css('visibility', "hidden");
$('div#{0} #resizable-box'.format(id)).removeClass("shadow");
$(clss).addClass("shadow");
var fc = $(clss).closest('.flip-container');
fc.addClass('flip-animating');
setTimeout(function () {
fc.addClass('flip-transition');
if (flipToBack)
$(clss).addClass("flipped");
else
$(clss).removeClass("flipped");
setTimeout(function () {
$('div#{0} #resizable-box'.format(id)).addClass("shadow");
$(clss).removeClass("shadow");
fc.removeClass('flip-transition');
fc.removeClass('flip-animating');
$('div#{0} #resizable-box .splitPanel-{1}'.format(id, other)).css("z-index", "0").removeClass("shadow");
$('div#{0} #resizable-box > .splitPanel'.format(id)).css("overflow", "hidden");
if (!flipToBack && _this.rItemCodeEditor)
_this.rItemCodeEditor.refresh();
$('div#{0} #resizable-box .ui-icon-gripsmall-diagonal-se'.format(id)).css('visibility', "visible");
}, 600);
}, 0);
};
RItemGui.prototype.showDependencies = function (svg, width) {
this.clear();
var elt;
elt = $('
');
this._addElement(elt);
elt.append($('')
.addClass("ritem-image")
.css("width", 4 * width + "px")
.css("background", "url(data:image/svg+xml;base64,{0})".format(svg)));
};
RItemGui.prototype.showPreview = function (html, is_man_page) {
};
RItemGui.prototype.setLastUpdatedText = function (message) {
this.lastUpdatedMessageMaintainer.setTextAndTooltip(message);
};
RItemGui.prototype.doneDisplaying = function () {
var _this = this;
setTimeout(function () { _this._readyForTraining = true; _this.guiControlsReadyForTraining = true; }, 100);
};
RItemGui.prototype.isReadyForTraining = function (output_expected) {
if (!this._readyForTraining
|| !this.guiControlsReadyForTraining
|| (output_expected && (!this.outputReadyForTraining || this._waitingForTableStyles)))
return false;
if (this._state.outputType === OutputType.WIDGET) {
var widget_iframe = $('.r-htmlwidget-iframe');
if (widget_iframe.length) {
if (!widget_iframe[0].contentWindow['HTMLWidgets'].isRendered)
return false;
var widget_document = widget_iframe[0].contentDocument;
for (var i = 0; i < widget_document.images.length; i++) {
var img = widget_document.images[i];
if (!img.complete || img.naturalWidth === 0 || img.naturalHeight === 0)
return false;
}
if ($('*', widget_iframe.contents()).is(function (index, element) { return element['__transition__']; }))
return false;
if (this.transitionsInProgress($('.leaflet-fade-anim .leaflet-tile-loaded', widget_iframe.contents()), 250))
return false;
}
}
return true;
};
RItemGui.prototype.transitionsInProgress = function (elements, transition_length) {
var in_transition = false;
elements.each(function (index, elem) {
if (elem.attributes.getNamedItem('data-regrtest-transitioning')) {
in_transition = true;
}
else if (!elem.attributes.getNamedItem('data-regrtest-transitioned')) {
in_transition = true;
elem.setAttribute('data-regrtest-transitioning', '');
setTimeout(function () {
elem.removeAttribute('data-regrtest-transitioning');
elem.setAttribute('data-regrtest-transitioned', '');
}, transition_length);
}
});
return in_transition;
};
RItemGui.prototype.setOutputAsUnready = function () {
this.outputReadyForTraining = false;
};
RItemGui.prototype.isRegressionTesting = function () {
return this._regression_testing;
};
RItemGui.prototype.getState = function () {
return this._state;
};
return RItemGui;
})();
var RClientState = (function () {
function RClientState() {
}
RClientState.prototype.changeState = function (request) {
};
RClientState.prototype.difference = function () {
};
RClientState.prototype.compactedRequest = function (guid) {
return null;
};
return RClientState;
})();
var rClientState = new RClientState();
var RUtil;
(function (RUtil) {
function StateChanged(mode, guid, get_request, set_request, set_name, set_value, success) {
var request = { Request: set_request, Guid: guid, Name: set_name, Value: set_value };
if (set_name === "Code")
$.extend(request, { Code: set_value });
switch (mode) {
case 1:
Util.qServerRequest(request);
Util.qServerRequest({
Request: get_request,
GUID: guid
}, function (response) { return success(response); });
break;
case 2:
Util.qServerRequest(request);
break;
case 3:
rClientState.changeState(request);
break;
}
}
RUtil.StateChanged = StateChanged;
})(RUtil || (RUtil = {}));
;
// /Scripts/Dashboard/RItem/RItemMultiGui.ts
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var RItemMultiGui = (function (_super) {
__extends(RItemMultiGui, _super);
function RItemMultiGui(centre, state, for_dataset, regression_testing, notification_bar, ritem_oi, previewer) {
this._guids = [];
_super.call(this, centre, state, ritem_oi, notification_bar, for_dataset, regression_testing, false, new RibbonCodeEditorCoordinator(state.guid));
this.setPreviewer(previewer);
}
RItemMultiGui.prototype.setupBody = function () {
};
RItemMultiGui.prototype.setupLeftSide = function (leftPanel) {
leftPanel.empty();
var contentFrame = $('
')
.addClass("shadow")
.addClass("cant-resize");
var div = $('
').addClass("item-title").text(item.title));
};
RItemDragHelper.widthOfSelectionFromTree = function (treeView) {
var _this = this;
var selected = treeView.getSelection();
var div = $("
").css({ visibility: "hidden", display: "inline-block" });
treeView.getContainer().append(div);
selected.forEach(function (item) { return div.append(_this.jqForTreeViewItem(item)); });
var w = div.width();
div.remove();
return w;
};
RItemDragHelper.prototype.getJq = function () {
return this._jq;
};
RItemDragHelper.prototype.getDropBox = function () {
return this._dropBox;
};
RItemDragHelper.prototype.setDropBox = function (drop_box) {
this._dropBox = drop_box;
};
RItemDragHelper.prototype.getSelection = function () {
return this._treeView.getSelection();
};
RItemDragHelper.prototype.getSortedSelection = function () {
return this._treeView.getModel().getSortedSelectedItems();
};
return RItemDragHelper;
})();
;
// /Scripts/Ribbon/ScriptControls/SCCheckBox.ts
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var SCCheckBox = (function (_super) {
__extends(SCCheckBox, _super);
function SCCheckBox() {
_super.apply(this, arguments);
}
SCCheckBox.prototype.addToDom = function (row_jq, ribbon, ribbon_section_row, nested_within_popup) {
var _this = this;
this.commonAddToDom(ribbon, ribbon_section_row, nested_within_popup);
var btn_jq = $('');
btn_jq.prop('id', this.name);
btn_jq.preventSelection();
btn_jq.addClass('ribbon-checkbox');
if (this._withinPopup) {
var icon_jq = $('');
btn_jq.append(icon_jq);
}
var span_jq = $('');
span_jq.addClass('ribbon-mediumlabel');
var chk_id = this.name + 'chk';
var label_jq = $('');
label_jq.prop('for', chk_id);
var chk_jq = $('');
chk_jq.prop('id', chk_id);
this.chkjq = chk_jq;
if (this.checkAlign === 'left') {
span_jq.append(chk_jq);
span_jq.append(label_jq);
}
else {
span_jq.append(label_jq);
span_jq.append(chk_jq);
}
btn_jq.append(span_jq);
row_jq.append(btn_jq);
chk_jq.change(function () {
_this.onCheckChanged();
});
this.btnjq = btn_jq;
return btn_jq;
};
SCCheckBox.prototype.updateDom = function () {
var _this = this;
if (!this.btnjq)
return;
this.updateDomVisibility(this.btnjq);
this.updateDomEnabled(this.btnjq, function () { return _this.chkjq.removeAttr('disabled'); }, function () { return _this.chkjq.prop('disabled', true); });
var chk = this.chkjq[0];
if (this.indeterminate() && !chk.indeterminate)
this.chkjq.prop('indeterminate', true);
if (!this.indeterminate() && chk.indeterminate)
this.chkjq.prop('indeterminate', false);
if (this.checked() && !this.chkjq.is(':checked'))
this.chkjq.prop('checked', true);
if (!this.checked() && this.chkjq.is(':checked'))
this.chkjq.removeAttr('checked');
if (this.label())
this.btnjq.find('label').text(this.label());
if (this.tooltip())
this.btnjq.prop('title', this.tooltip()).simpleTip();
};
return SCCheckBox;
})(RibbonCheckBox);
;
// /Scripts/Ribbon/ScriptControls/SCComboBox.ts
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var SCComboBox = (function (_super) {
__extends(SCComboBox, _super);
function SCComboBox() {
_super.apply(this, arguments);
}
SCComboBox.prototype.addToDom = function (row_jq, ribbon, ribbon_section_row, nested_within_popup) {
var _this = this;
this.commonAddToDom(ribbon, ribbon_section_row, nested_within_popup);
var span_jq = RibbonComboBox.createJqComboBox(this.name);
this.btnjq = span_jq;
this.inputjq = span_jq.find("input");
this.inputjq.attr('placeholder', Util.htmlToText(this._prompt || ''));
var dropdown_btn_jq = span_jq.find('a');
if (this.allowEdit) {
this.inputjq.keyup(function (event) {
if (event.which === Keys.enter) {
event.preventDefault();
_this.onEditCommit();
}
else if (event.which === Keys.escape) {
event.preventDefault();
_this.updateDom();
}
});
this.inputjq.focusout(function () {
_this.onEditCommit();
});
dropdown_btn_jq.mousedown(function (event) {
event.preventDefault();
_this.onClick();
});
}
else {
this.inputjq.prop('disabled', true);
span_jq.mousedown(function (event) {
event.preventDefault();
if (event.target === _this.btnjq.find('label')[0])
return;
_this.onClick();
});
}
var div = $("
").addClass("sc-combobox").append(span_jq, $("
").addClass("drop-error").text(this._invalidMsg || ""));
row_jq.append(div);
this.createPopupJQuery();
this.popupjq.addClass('ribbon-combobox-popup');
row_jq.append(this.popupjq);
return span_jq;
};
SCComboBox.prototype.setOptions = function (options) {
this._prompt = options["Prompt"];
this._errorMsg = options["ErrorMessage"];
this._invalidMsg = options["Invalid"];
};
return SCComboBox;
})(RibbonComboBox);
;
// /Scripts/Ribbon/ScriptControls/SCPopupColor.ts
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var SCPopupColor = (function (_super) {
__extends(SCPopupColor, _super);
function SCPopupColor(name, label, tooltip, size, icon_url, on_color_changed, no_color_label, more_colors_label, popup_controls) {
_super.call(this, name, null, tooltip, size, icon_url, on_color_changed, no_color_label, more_colors_label, popup_controls);
this._leftLabel = label;
}
SCPopupColor.prototype.addToDom = function (row_jq, ribbon, ribbon_section_row, nested_within_popup) {
var btn_jq = _super.prototype.addToDom.call(this, row_jq, ribbon, ribbon_section_row, nested_within_popup);
btn_jq.addClass('ribbon-color-parent');
if (this._leftLabel)
btn_jq.parent().prepend($("