about summary refs log tree commit diff
path: root/sourcecodes
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes')
-rw-r--r--sourcecodes/.violin_plotly.py.swpbin0 -> 16384 bytes
-rw-r--r--sourcecodes/BNW_overview_new.PNGbin0 -> 1114695 bytes
-rw-r--r--sourcecodes/BNW_workflow_1.htm645
-rw-r--r--sourcecodes/BNW_workflow_2.htm731
-rw-r--r--sourcecodes/BNW_workflow_net1.htm49
-rw-r--r--sourcecodes/BNW_workflow_sci.htm36
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_best_structure.jpgbin73502 -> 0 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_file_upload.jpgbin66635 -> 0 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_file_upload_new.pngbin0 -> 129970 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_geno1_2.jpgbin81853 -> 0 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_geno1_2_new.pngbin0 -> 98634 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_global_settings.jpgbin24453 -> 0 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_matrix.jpgbin107678 -> 0 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_model_avg_struct.jpgbin77206 -> 0 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_model_avg_struct_new.pngbin0 -> 37141 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_no_weight.pngbin0 -> 50297 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_trait2_15.jpgbin76253 -> 0 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_trait2_15_new.pngbin0 -> 85384 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/8node_with_weights.pngbin0 -> 43854 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/add_remove_MAS.pngbin0 -> 56401 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/add_remove_Weight.pngbin0 -> 57758 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/add_remove_filter.pngbin0 -> 49987 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/add_remove_final.pngbin0 -> 77282 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/add_remove_new_edge.pngbin0 -> 56941 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/add_remove_original_interface.pngbin0 -> 54516 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/add_remove_original_network.pngbin0 -> 194538 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/add_remove_red_edge.pngbin0 -> 57077 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/add_remove_removed.pngbin0 -> 55849 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/image2_4.pngbin0 -> 31431 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/image2_5.pngbin0 -> 89918 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/sci_5node_network1.pngbin0 -> 106300 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/sci_5node_part1.pngbin0 -> 60172 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/sci_5node_part2.pngbin0 -> 45388 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/sci_5node_part3.pngbin0 -> 84739 bytes
-rw-r--r--sourcecodes/BNW_workflow_test_files/sci_5node_upload.pngbin0 -> 93545 bytes
-rw-r--r--sourcecodes/about_this_page.php180
-rw-r--r--sourcecodes/add_evd.php8
-rw-r--r--sourcecodes/add_evd_example.php195
-rw-r--r--sourcecodes/add_inv.php13
-rw-r--r--sourcecodes/add_inv_example.php254
-rw-r--r--sourcecodes/add_remove_howto.htm359
-rw-r--r--sourcecodes/bn_after_upload_gom.php147
-rw-r--r--sourcecodes/bn_file_load_gom.php154
-rw-r--r--sourcecodes/clear.php1
-rw-r--r--sourcecodes/clear_cv_pred.php9
-rw-r--r--sourcecodes/clear_example.php25
-rw-r--r--sourcecodes/create_tiers_gom_part1.php196
-rw-r--r--sourcecodes/create_tiers_gom_part2.php (renamed from sourcecodes/create_tiers_gom.php)187
-rw-r--r--sourcecodes/cross_valid.php106
-rw-r--r--sourcecodes/cross_valid_example.php125
-rw-r--r--sourcecodes/cv_plotly.py90
-rw-r--r--sourcecodes/cv_predictions.php47
-rw-r--r--sourcecodes/data/LRlnetwork.json10
-rw-r--r--sourcecodes/data/example2_test/exAban.txt1
-rw-r--r--sourcecodes/data/example2_test/exAcontinuous_input.txt203
-rw-r--r--sourcecodes/data/example2_test/exAcontinuous_input_orig.txt201
-rw-r--r--sourcecodes/data/example2_test/exAk.txt1
-rw-r--r--sourcecodes/data/example2_test/exAparent.txt1
-rw-r--r--sourcecodes/data/example2_test/exAstructure_input.txt9
-rw-r--r--sourcecodes/data/example2_test/exAstructure_input_temp.txt9
-rw-r--r--sourcecodes/data/example2_test/exAthr.txt1
-rw-r--r--sourcecodes/data/example2_test/exAwhite.txt1
-rw-r--r--sourcecodes/data/example_chl/bWRstructure_input.txt13
-rw-r--r--sourcecodes/data/example_chl/bWRstructure_input_temp.txt6
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRcontinuous_input.txt (renamed from sourcecodes/data/example_chl/bWRcontinuous_input.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRcontinuous_input_orig.txt42
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRgraphviz.txt (renamed from sourcecodes/data/example_chl/bWRgraphviz.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRmap.txt (renamed from sourcecodes/data/example_chl/bWRmap.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRmapdata.txt (renamed from sourcecodes/data/example_chl/bWRmapdata.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRname.txt (renamed from sourcecodes/data/example_chl/bWRname.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRnet_figure.txt (renamed from sourcecodes/data/example_chl/bWRnet_figure.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRnet_figure_new.txt (renamed from sourcecodes/data/example_chl/bWRnet_figure_new.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRnlevels.txt (renamed from sourcecodes/data/example_chl/bWRnlevels.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRnnode.txt (renamed from sourcecodes/data/example_chl/bWRnnode.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRparameters.txt (renamed from sourcecodes/data/example_chl/bWRparameters.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRstructure_input.txt7
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRstructure_old.txt (renamed from sourcecodes/data/example_chl/bWRstructure_old.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRtype.txt (renamed from sourcecodes/data/example_chl/bWRtype.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRvar.txt (renamed from sourcecodes/data/example_chl/bWRvar.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRvardata.txt (renamed from sourcecodes/data/example_chl/bWRvardata.txt)0
-rw-r--r--sourcecodes/data/example_chl/old_gn/bWRvarname.txt (renamed from sourcecodes/data/example_chl/bWRvarname.txt)0
-rw-r--r--sourcecodes/data/example_sample/sample_input.txt42
-rw-r--r--sourcecodes/data/example_sample/sample_input.txt~42
-rw-r--r--sourcecodes/data/sample_input.txt42
-rw-r--r--sourcecodes/delete_cv_pred.sh22
-rw-r--r--sourcecodes/enter_netID.php14
-rw-r--r--sourcecodes/enter_netID.php~74
-rw-r--r--sourcecodes/example.php68
-rw-r--r--sourcecodes/examplefilecopy.sh6
-rw-r--r--sourcecodes/examples/cardiagnosis.php4
-rw-r--r--sourcecodes/examples/chl_example.php4
-rw-r--r--sourcecodes/examples/my_new_style.css478
-rw-r--r--sourcecodes/examples/spleen_immune_example.php4
-rw-r--r--sourcecodes/examples/synthetic_example2.php4
-rw-r--r--sourcecodes/examples/synthetic_example3.php4
-rw-r--r--sourcecodes/execute_bn_gom.php16
-rw-r--r--sourcecodes/executionprogress.php10
-rw-r--r--sourcecodes/executionprogress_default.php79
-rw-r--r--sourcecodes/faq.php28
-rw-r--r--sourcecodes/filecopy.sh18
-rw-r--r--sourcecodes/getting_started.php29
-rw-r--r--sourcecodes/graph-creator.js275
-rw-r--r--sourcecodes/graphviz_structure.php31
-rw-r--r--sourcecodes/header_batchsearch.inc6
-rw-r--r--sourcecodes/header_new.inc6
-rw-r--r--sourcecodes/help.php131
-rw-r--r--sourcecodes/home.php76
-rw-r--r--sourcecodes/home_upload.php11
-rw-r--r--sourcecodes/input_check.php86
-rw-r--r--sourcecodes/js-graph-it.css24
-rw-r--r--sourcecodes/js-graph-it.js1802
-rw-r--r--sourcecodes/kfold_cv.php115
-rw-r--r--sourcecodes/kfold_cv_example.php150
-rw-r--r--sourcecodes/kfold_plotly.py86
-rw-r--r--sourcecodes/layout.php79
-rw-r--r--sourcecodes/layout_cyto.php93
-rw-r--r--sourcecodes/layout_cyto.php~402
-rw-r--r--sourcecodes/layout_example.php122
-rw-r--r--sourcecodes/layout_svg_no.php155
-rw-r--r--sourcecodes/layout_svg_wt.php140
-rw-r--r--sourcecodes/mat_structure.php6
-rw-r--r--sourcecodes/matrix.php3
-rw-r--r--sourcecodes/matrix_new.php84
-rw-r--r--sourcecodes/modified_network.php4
-rw-r--r--sourcecodes/modify_structure_learning.php7
-rw-r--r--sourcecodes/my_new_style.css514
-rw-r--r--sourcecodes/net_structure.php175
-rw-r--r--sourcecodes/net_structure.php.bk132
-rw-r--r--sourcecodes/net_structure.php~136
-rw-r--r--sourcecodes/network_layout_evd.php31
-rw-r--r--sourcecodes/network_layout_evd_2.php17
-rw-r--r--sourcecodes/network_layout_evd_2_example.php956
-rw-r--r--sourcecodes/network_layout_evd_example.php634
-rw-r--r--sourcecodes/network_layout_inv.php17
-rw-r--r--sourcecodes/network_layout_inv_2.php17
-rw-r--r--sourcecodes/network_layout_inv_2_example.php1152
-rw-r--r--sourcecodes/network_layout_inv_example.php666
-rw-r--r--sourcecodes/parameter_display.php127
-rw-r--r--sourcecodes/parameter_display.php.bk19
-rw-r--r--sourcecodes/parameter_learning/Predictmultiple.m2
-rw-r--r--sourcecodes/parameter_learning/Predictmultipleintervention.m2
-rw-r--r--sourcecodes/parameter_learning/code_backup/Predictmultiple.m72
-rw-r--r--sourcecodes/parameter_learning/code_backup/Predictmultipleintrvention.m95
-rw-r--r--sourcecodes/parameter_learning/code_backup/checkDiscreteNodes.m37
-rw-r--r--sourcecodes/parameter_learning/code_backup/checkStructure.m78
-rw-r--r--sourcecodes/parameter_learning/code_backup/drawFigure.m390
-rw-r--r--sourcecodes/parameter_learning/code_backup/drawFigure.m~388
-rw-r--r--sourcecodes/parameter_learning/code_backup/drawFigureM.m230
-rw-r--r--sourcecodes/parameter_learning/code_backup/getParams.m22
-rw-r--r--sourcecodes/parameter_learning/code_backup/looCrossValid.m241
-rw-r--r--sourcecodes/parameter_learning/code_backup/parameterLearning.m17
-rw-r--r--sourcecodes/parameter_learning/code_backup/prepareInput.m294
-rw-r--r--sourcecodes/parameter_learning/code_backup/prepareInput.m~294
-rw-r--r--sourcecodes/parameter_learning/code_backup/readInput.m63
-rw-r--r--sourcecodes/parameter_learning/code_backup/readInputData.m75
-rw-r--r--sourcecodes/parameter_learning/code_backup/readInputStructure.m72
-rw-r--r--sourcecodes/parameter_learning/code_backup/runBN_initial.m57
-rw-r--r--sourcecodes/parameter_learning/code_backup/standardizeData.m25
-rw-r--r--sourcecodes/parameter_learning/code_backup/writeParameters.m106
-rw-r--r--sourcecodes/parameter_learning/code_backup/writeParameters_ev.m151
-rw-r--r--sourcecodes/parameter_learning/code_backup/writeParameters_int.m186
-rw-r--r--sourcecodes/parameter_learning/createJSON.m13
-rw-r--r--sourcecodes/parameter_learning/createSVG.m28
-rw-r--r--sourcecodes/parameter_learning/drawFigure.m73
-rw-r--r--sourcecodes/parameter_learning/drawFigureM.m25
-rw-r--r--sourcecodes/parameter_learning/kfoldCrossValid.m21
-rw-r--r--sourcecodes/parameter_learning/looCrossValid.m18
-rw-r--r--sourcecodes/parameter_learning/modifyEdges.m179
-rw-r--r--sourcecodes/parameter_learning/normpdf.m50
-rw-r--r--sourcecodes/parameter_learning/normrnd.m130
-rw-r--r--sourcecodes/parameter_learning/prepareInput.m84
-rw-r--r--sourcecodes/parameter_learning/removeNodes.m39
-rw-r--r--sourcecodes/parameter_learning/runBN_initial.m2
-rw-r--r--sourcecodes/parameter_learning/testSetPredictions.m32
-rw-r--r--sourcecodes/parameter_learning/writeParameters.m34
-rw-r--r--sourcecodes/parameter_learning/writeParameters_ev.m28
-rw-r--r--sourcecodes/parameter_learning/writeParameters_int.m29
-rw-r--r--sourcecodes/parameter_learning/writeSettings.m200
-rw-r--r--sourcecodes/print_structure/index.html6
-rw-r--r--sourcecodes/print_structure/structure.c97
-rw-r--r--sourcecodes/remove_variables.php84
-rw-r--r--sourcecodes/remove_variables_processing.php16
-rw-r--r--sourcecodes/remove_variables_processing_default.php14
-rw-r--r--sourcecodes/reroute.php21
-rw-r--r--sourcecodes/restructuremap.php42
-rw-r--r--sourcecodes/review_settings.php84
-rw-r--r--sourcecodes/run.sh24
-rw-r--r--sourcecodes/run_scripts/#run_octave#15
-rw-r--r--sourcecodes/run_scripts/BNW_workflow_sci.htm381
-rw-r--r--sourcecodes/run_scripts/path_cd.m5
-rw-r--r--sourcecodes/run_scripts/run_del_var7
-rw-r--r--sourcecodes/run_scripts/run_kfold15
-rw-r--r--sourcecodes/run_scripts/run_loo12
-rw-r--r--sourcecodes/run_scripts/run_mod_edges19
-rw-r--r--sourcecodes/run_scripts/run_mod_edges.bk24
-rw-r--r--sourcecodes/run_scripts/run_mod_edges~45
-rw-r--r--sourcecodes/run_scripts/run_mod_str7
-rw-r--r--sourcecodes/run_scripts/run_mod_str~24
-rw-r--r--sourcecodes/run_scripts/run_octave15
-rw-r--r--sourcecodes/run_scripts/run_octave_evd9
-rw-r--r--sourcecodes/run_scripts/run_octave_inv9
-rw-r--r--sourcecodes/run_scripts/run_octave_test~7
-rw-r--r--sourcecodes/run_scripts/run_octave~14
-rw-r--r--sourcecodes/run_scripts/run_prep_input7
-rw-r--r--sourcecodes/run_scripts/run_settings4
-rw-r--r--sourcecodes/run_scripts/run_test_set12
-rw-r--r--sourcecodes/run_scripts/run_violin11
-rw-r--r--sourcecodes/run_scripts/test7
-rw-r--r--sourcecodes/run_scripts/test~15
-rw-r--r--sourcecodes/runtime_check.php6
-rw-r--r--sourcecodes/sample_input.php45
-rw-r--r--sourcecodes/scripts/FileSaver.min.js1
-rw-r--r--sourcecodes/scripts/accordion.js31
-rw-r--r--sourcecodes/scripts/accordion.js~31
-rw-r--r--sourcecodes/scripts/canvas-toBlob.js125
-rw-r--r--sourcecodes/scripts/create_table.js84
-rw-r--r--sourcecodes/scripts/create_table.js~82
-rw-r--r--sourcecodes/scripts/cytoscape-dagre.min.js8
-rw-r--r--sourcecodes/scripts/cytoscape-panzoom.js587
-rw-r--r--sourcecodes/scripts/cytoscape.js-panzoom.css220
-rw-r--r--sourcecodes/scripts/cytoscape.min.js23
-rw-r--r--sourcecodes/scripts/d3-selection-multi.v1.js94
-rw-r--r--sourcecodes/scripts/d3.v4.min.js2
-rw-r--r--sourcecodes/scripts/dagre.js16396
-rw-r--r--sourcecodes/scripts/font-awesome.css821
-rw-r--r--sourcecodes/scripts/font-awesome.css~821
-rw-r--r--sourcecodes/scripts/fontawesome-webfont.eotbin0 -> 38205 bytes
-rw-r--r--sourcecodes/scripts/fontawesome-webfont.svg63
-rw-r--r--sourcecodes/scripts/fontawesome-webfont.ttfbin0 -> 80652 bytes
-rw-r--r--sourcecodes/scripts/fontawesome-webfont.woffbin0 -> 44432 bytes
-rw-r--r--sourcecodes/scripts/jquery.min.js4
-rw-r--r--sourcecodes/scripts/lodash.js17105
-rw-r--r--sourcecodes/scripts/table.css42
-rw-r--r--sourcecodes/scripts/table.css~42
-rw-r--r--sourcecodes/test_set_predictions.php140
-rw-r--r--sourcecodes/test_set_predictions_example.php158
-rw-r--r--sourcecodes/tier_description_processing_gom.php52
-rw-r--r--sourcecodes/ts_plotly.py89
-rw-r--r--sourcecodes/upload_structure_file.php97
-rw-r--r--sourcecodes/view_distributions.php (renamed from sourcecodes/cv_predictions_example.php)20
-rw-r--r--sourcecodes/view_input_data.php203
-rw-r--r--sourcecodes/view_input_data_text.php62
-rw-r--r--sourcecodes/violin.php57
-rw-r--r--sourcecodes/violin_ev_plotly.py137
-rw-r--r--sourcecodes/violin_int_plotly.py149
-rw-r--r--sourcecodes/violin_plotly.py123
-rw-r--r--sourcecodes/workflow.php14
247 files changed, 43720 insertions, 12685 deletions
diff --git a/sourcecodes/.violin_plotly.py.swp b/sourcecodes/.violin_plotly.py.swp
new file mode 100644
index 00000000..ccadb5a6
--- /dev/null
+++ b/sourcecodes/.violin_plotly.py.swp
Binary files differdiff --git a/sourcecodes/BNW_overview_new.PNG b/sourcecodes/BNW_overview_new.PNG
new file mode 100644
index 00000000..7355e3b0
--- /dev/null
+++ b/sourcecodes/BNW_overview_new.PNG
Binary files differdiff --git a/sourcecodes/BNW_workflow_1.htm b/sourcecodes/BNW_workflow_1.htm
deleted file mode 100644
index 603ad8d8..00000000
--- a/sourcecodes/BNW_workflow_1.htm
+++ /dev/null
@@ -1,645 +0,0 @@
-<html xmlns:v="urn:schemas-microsoft-com:vml"
-xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 12">
-<meta name=Originator content="Microsoft Word 12">
-<link rel=File-List href="BNW_workflow_test_files/filelist.xml">
-<link rel=Edit-Time-Data href="BNW_workflow_test_files/editdata.mso">
-<link rel=themeData href="BNW_workflow_test_files/themedata.thmx">
-<link rel=colorSchemeMapping
-href="BNW_workflow_test_files/colorschememapping.xml">
-<style>
-<!--
- /* Font Definitions */
- @font-face
-	{font-family:"Cambria Math";
-	panose-1:2 4 5 3 5 4 6 3 2 4;
-	mso-font-charset:1;
-	mso-generic-font-family:roman;
-	mso-font-format:other;
-	mso-font-pitch:variable;
-	mso-font-signature:0 0 0 0 0 0;}
-@font-face
-	{font-family:Calibri;
-	panose-1:2 15 5 2 2 2 4 3 2 4;
-	mso-font-charset:0;
-	mso-generic-font-family:swiss;
-	mso-font-pitch:variable;
-	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
-@font-face
-	{font-family:Tahoma;
-	panose-1:2 11 6 4 3 5 4 4 2 4;
-	mso-font-charset:0;
-	mso-generic-font-family:swiss;
-	mso-font-pitch:variable;
-	mso-font-signature:-520081665 -1073717157 41 0 66047 0;}
- /* Style Definitions */
- p.MsoNormal, li.MsoNormal, div.MsoNormal
-	{mso-style-unhide:no;
-	mso-style-qformat:yes;
-	mso-style-parent:"";
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:10.0pt;
-	margin-left:0in;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
-	{mso-style-noshow:yes;
-	mso-style-priority:99;
-	mso-style-link:"Balloon Text Char";
-	margin:0in;
-	margin-bottom:.0001pt;
-	mso-pagination:widow-orphan;
-	font-size:8.0pt;
-	font-family:"Tahoma","sans-serif";
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;}
-p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
-	{mso-style-priority:34;
-	mso-style-unhide:no;
-	mso-style-qformat:yes;
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:10.0pt;
-	margin-left:.5in;
-	mso-add-space:auto;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
-	{mso-style-priority:34;
-	mso-style-unhide:no;
-	mso-style-qformat:yes;
-	mso-style-type:export-only;
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:0in;
-	margin-left:.5in;
-	margin-bottom:.0001pt;
-	mso-add-space:auto;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
-	{mso-style-priority:34;
-	mso-style-unhide:no;
-	mso-style-qformat:yes;
-	mso-style-type:export-only;
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:0in;
-	margin-left:.5in;
-	margin-bottom:.0001pt;
-	mso-add-space:auto;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
-	{mso-style-priority:34;
-	mso-style-unhide:no;
-	mso-style-qformat:yes;
-	mso-style-type:export-only;
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:10.0pt;
-	margin-left:.5in;
-	mso-add-space:auto;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-span.BalloonTextChar
-	{mso-style-name:"Balloon Text Char";
-	mso-style-noshow:yes;
-	mso-style-priority:99;
-	mso-style-unhide:no;
-	mso-style-locked:yes;
-	mso-style-link:"Balloon Text";
-	mso-ansi-font-size:8.0pt;
-	mso-bidi-font-size:8.0pt;
-	font-family:"Tahoma","sans-serif";
-	mso-ascii-font-family:Tahoma;
-	mso-hansi-font-family:Tahoma;
-	mso-bidi-font-family:Tahoma;}
-.MsoChpDefault
-	{mso-style-type:export-only;
-	mso-default-props:yes;
-	font-size:10.0pt;
-	mso-ansi-font-size:10.0pt;
-	mso-bidi-font-size:10.0pt;
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-@page WordSection1
-	{size:8.5in 11.0in;
-	margin:1.0in 1.0in 1.0in 1.0in;
-	mso-header-margin:.5in;
-	mso-footer-margin:.5in;
-	mso-paper-source:0;}
-div.WordSection1
-	{page:WordSection1;}
- /* List Definitions */
- @list l0
-	{mso-list-id:779757819;
-	mso-list-type:hybrid;
-	mso-list-template-ids:939584274 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
-@list l0:level1
-	{mso-level-text:"%1\)";
-	mso-level-tab-stop:none;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level2
-	{mso-level-tab-stop:1.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level3
-	{mso-level-tab-stop:1.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level4
-	{mso-level-tab-stop:2.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level5
-	{mso-level-tab-stop:2.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level6
-	{mso-level-tab-stop:3.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level7
-	{mso-level-tab-stop:3.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level8
-	{mso-level-tab-stop:4.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level9
-	{mso-level-tab-stop:4.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1
-	{mso-list-id:1813714603;
-	mso-list-type:hybrid;
-	mso-list-template-ids:939584274 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
-@list l1:level1
-	{mso-level-text:"%1\)";
-	mso-level-tab-stop:none;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level2
-	{mso-level-tab-stop:1.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level3
-	{mso-level-tab-stop:1.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level4
-	{mso-level-tab-stop:2.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level5
-	{mso-level-tab-stop:2.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level6
-	{mso-level-tab-stop:3.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level7
-	{mso-level-tab-stop:3.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level8
-	{mso-level-tab-stop:4.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level9
-	{mso-level-tab-stop:4.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-ol
-	{margin-bottom:0in;}
-ul
-	{margin-bottom:0in;}
--->
-</style>
-<!--[if gte mso 10]>
-<style>
- /* Style Definitions */
- table.MsoNormalTable
-	{mso-style-name:"Table Normal";
-	mso-tstyle-rowband-size:0;
-	mso-tstyle-colband-size:0;
-	mso-style-noshow:yes;
-	mso-style-priority:99;
-	mso-style-qformat:yes;
-	mso-style-parent:"";
-	mso-padding-alt:0in 5.4pt 0in 5.4pt;
-	mso-para-margin:0in;
-	mso-para-margin-bottom:.0001pt;
-	mso-pagination:widow-orphan;
-	font-size:10.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;}
-</style>
-<![endif]--><!--[if gte mso 9]><xml>
- <o:shapedefaults v:ext="edit" spidmax="4098"/>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <o:shapelayout v:ext="edit">
-  <o:idmap v:ext="edit" data="1"/>
- </o:shapelayout></xml><![endif]-->
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=WordSection1>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>This workflow will provide
-an overview of how to use BNW to:<o:p></o:p></span></p>
-
-<p class=MsoListParagraphCxSpFirst style='margin-right:307.5pt;mso-add-space:
-auto;text-indent:-.25in;mso-list:l1 level1 lfo2'><![if !supportLists]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif";
-mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>1)<span
-style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'>Select
-a structure learning method and upload data into BNW<o:p></o:p></span></p>
-
-<p class=MsoListParagraphCxSpMiddle style='margin-right:307.5pt;mso-add-space:
-auto;text-indent:-.25in;mso-list:l1 level1 lfo2'><![if !supportLists]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif";
-mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>2)<span
-style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'>Use
-the BNW structural restraint interface<o:p></o:p></span></p>
-
-<p class=MsoListParagraphCxSpLast style='margin-right:307.5pt;mso-add-space:
-auto;text-indent:-.25in;mso-list:l1 level1 lfo2'><![if !supportLists]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif";
-mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>3)<span
-style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'>Make
-predictions with the network structure<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
-normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>1.
-Select structure learning method and uploading data into BNW<o:p></o:p></span></b></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>For this workflow, we are
-creating a network using a biological data set containing both continuous and
-discrete variables. The variables are a genotype (the discrete variable), three
-gene expression traits (Gene1, Gene2, Gene3), and a phenotype.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>We do not know the network
-structure for this dataset, so we will first use BNW to learn the structure. Selecting
-<u>Learn a network model from data</u> on the BNW home page presents a list of the
-three structure learning methods that are currently implemented in BNW. <o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><!--[if gte vml 1]><v:shapetype
- id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
- path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
- <v:stroke joinstyle="miter"/>
- <v:formulas>
-  <v:f eqn="if lineDrawn pixelLineWidth 0"/>
-  <v:f eqn="sum @0 1 0"/>
-  <v:f eqn="sum 0 0 @1"/>
-  <v:f eqn="prod @2 1 2"/>
-  <v:f eqn="prod @3 21600 pixelWidth"/>
-  <v:f eqn="prod @3 21600 pixelHeight"/>
-  <v:f eqn="sum @0 0 1"/>
-  <v:f eqn="prod @6 1 2"/>
-  <v:f eqn="prod @7 21600 pixelWidth"/>
-  <v:f eqn="sum @8 21600 0"/>
-  <v:f eqn="prod @7 21600 pixelHeight"/>
-  <v:f eqn="sum @10 21600 0"/>
- </v:formulas>
- <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
- <o:lock v:ext="edit" aspectratio="t"/>
-</v:shapetype><v:shape id="Picture_x0020_2" o:spid="_x0000_i1037" type="#_x0000_t75"
- style='width:300pt;height:117pt;visibility:visible;mso-wrap-style:square'>
- <v:imagedata src="BNW_workflow_test_files/image003.jpg" o:title="" croptop="19333f"
-  cropbottom="34461f" cropleft="11633f" cropright="33260f"/>
-</v:shape><![endif]--><![if !vml]><img width=450 height=156
-src="BNW_workflow_test_files/image003.jpg" v:shapes="Picture_x0020_2"><![endif]></span><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>Because the network contains
-only 5 variables, we can use any of these structure learning methods. If more
-than 6 variables are present, using the global optimal search method would likely be necessary.
-We will use the exhaustive search with model averaging method in this workflow.
-More information about the structure learning methods can be found on the BNW
-help page.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>After selecting the
-Exhaustive Search button, we are prompted to upload a file containing the data.
-<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<img width=700 height=225
-src="BNW_workflow_test_files/image006.jpg" v:shapes="Picture_x0020_5"><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>The figure
-below shows BNW after we have uploaded the data file. The first line of the
-data contains the names of the variables included in the network, while the
-remaining lines are the variable values for individual samples. A description
-of how to format data files for use in BNW can be found on the BNW help page and can be accessed by the the <u>Data formatting guidelines</u> option in the left menu. Additionally, two additional options, <u>Select additional constraints</u> or <u>Perform Bayesian network modeling with no restraints</u>, appear in the left menu after loading the data file.<o:p></o:p></span></p><br>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=675 height=225
-src="BNW_workflow_test_files/image008.jpg" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
-normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>2.
-Use the structural constraint interface<o:p></o:p></span></b></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>Here, we will use the
-structural constraint interface to help identify biologically meaningful
-network structures. Specifically, we want to investigate how the genotype
-impacts gene expression which then impacts the phenotype.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><o:p>&nbsp;</o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>The first
-section of the structural constraint interface allows users to assign the variables
-(nodes) in the network to tiers. By default, three tiers are shown, but this
-can be changed by selecting a different number in the drop-down menu. The
-leftmost box of this section contains draggable boxes with the names of the
-variables in the network. <o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=750 height=300
-src="BNW_workflow_test_files/image010.jpg" v:shapes="Picture_x0020_14"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>For this
-network, we want to assign Genotype to Tier1, the gene expression traits to
-Tier2, and the Phenotype to Tier3.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=750 height=300
-src="BNW_workflow_test_files/image012.jpg" v:shapes="Picture_x0020_17"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>The second
-section in the structural constraint interface allows users to specify the
-types of interactions that are allowed both between and within tiers. In this
-case, we will keep the default settings, which will allow there to be edges
-between nodes within a tier, prevent nodes in Tier1 from being the child of
-Tier2 and Tier3 nodes, and prevent nodes in Tier2 from being the child of Tier2
-nodes. <o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><![if !vml]><img width=475 height=200
-src="BNW_workflow_test_files/image014.jpg" v:shapes="Picture_x0020_20"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>The final
-section of the structural constraint interface would allow for the
-specification of particular edges that should be banned from the network or
-required to be in the network. Users can identify these edges by dragging the
-nodes to appropriate boxes. In this case, we do not want to ban or require any
-specific edges. <o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=430 height=227
-src="BNW_workflow_test_files/image016.jpg" v:shapes="Picture_x0020_23"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>After
-entering the structural constraints, BNW will perform structure learning from
-the data after clicking <u>Perform Bayesin network modeling</u> on the left menu and
-present the structure of the network as shown below. Genotype, the discrete
-node, is shown as a bar chart with the bars showing the fraction of samples
-with each genotype in the data, while the other nodes are shown as lines with
-the Gaussian distributions that best fit the data.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><!--[if gte vml 1]><v:shape
- id="Picture_x0020_26" o:spid="_x0000_i1030" type="#_x0000_t75" style='width:367.5pt;
- height:400.5pt;visibility:visible;mso-wrap-style:square'>
- <v:imagedata src="BNW_workflow_test_files/image017.png" o:title="" croptop="11774f"
-  cropbottom="5139f" cropleft="15267f" cropright="16897f"/>
-</v:shape><![endif]--><![if !vml]><img width=490 height=534
-src="BNW_workflow_test_files/image018.jpg" v:shapes="Picture_x0020_26"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>To further
-investigate the structure of the network, users can select <u>Display Structure
-Matrix</u> in the left menu. This will bring up a popup windoe containing a table
-showing the confidence of each directed edge in the network after model
-averaging. For this network, all of the nodes included in the network were
-present in almost all high scoring networks, as the values of the edges are all
-near 1. BNW displays all edges with a confidence greater than 0.5 in the
-network structure. A second table in the window shows the structure matrix with
-a 1 for edges included in the structure and 0 for edges that are not included. These
-tables can be downloaded by clicking the download link.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><!--[if gte vml 1]><v:shape
- id="Picture_x0020_41" o:spid="_x0000_i1029" type="#_x0000_t75" style='width:358.5pt;
- height:158.25pt;visibility:visible;mso-wrap-style:square'>
- <v:imagedata src="BNW_workflow_test_files/image033.png" o:title="" croptop="19224f"
-  cropbottom="21354f" cropleft="10363f" cropright="12698f"/>
-</v:shape><![endif]--><![if !vml]><img width=478 height=211
-src="BNW_workflow_test_files/image020.jpg" v:shapes="Picture_x0020_41"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
-normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif";
-mso-no-proof:yes'>3) </span></b><b style='mso-bidi-font-weight:normal'><span
-style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>Make
-predictions with the network structure<o:p></o:p></span></b></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>BNW can be used to both
-predict the values of variables in a network given known evidence and to
-investigate how the network might change in response to interventions. Users
-can switch between evidence and intervention modes by selecting the proper
-button on the top of the page containing the network structure.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>For example,
-suppose we want to use the model to make predictions for a new sample that was
-not in the original dataset. We know that this sample was from an individual
-with Genotype=2 and want to predict the values of the genes and phenotype for
-the individual. To enter this evidence in the network, we simply click on the
-Genotype node in the network and enter 2 in the popup window. <o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>The figure below shows the
-changes in the network after entering this evidence.The node for which evidence was entered now contains a red outline and all of the nodes in the network now contain both blue and red lines. The blue lines show the original values of the distributions, while the red lines shown the predicted values given the
-evidence. In this case, knowing that the individual had Genotype=2 would cause
-us to predict that the expression of Gene1 and the value of the phenotype would
-be above average, while the expression of Gene2 and Gene3 would be decreases.
-The specific changes in the predicted values can be investigated by hovering
-over the nodes and observing the values at the peaks of the distribution.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><!--[if gte vml 1]><v:shape
- id="Picture_x0020_29" o:spid="_x0000_i1028" type="#_x0000_t75" style='width:352.5pt;
- height:464.25pt;visibility:visible;mso-wrap-style:square'>
- <v:imagedata src="BNW_workflow_test_files/image019.png" o:title="" croptop="5662f"
-  cropbottom="3557f" cropleft="15900f" cropright="17569f"/>
-</v:shape><![endif]--><![if !vml]><img width=470 height=619
-src="BNW_workflow_test_files/image022.jpg" v:shapes="Picture_x0020_29"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>Evidence
-can be entered in more than one node in the network. For example, the figure
-below shows predicted values for the network after entering evidence for both
-Genotype and Gene1.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><!--[if gte vml 1]><v:shape
- id="Picture_x0020_32" o:spid="_x0000_i1027" type="#_x0000_t75" style='width:291.75pt;
- height:414pt;visibility:visible;mso-wrap-style:square'>
- <v:imagedata src="BNW_workflow_test_files/image021.png" o:title="" croptop="9437f"
-  cropbottom="5850f" cropleft="16919f" cropright="22117f"/>
-</v:shape><![endif]--><![if !vml]><img width=389 height=552
-src="BNW_workflow_test_files/image024.jpg" v:shapes="Picture_x0020_32"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>To use the
-network to predict the results of intervention, select the proper button on the
-top of the window to enter intervention mode. While evidence simply changes the
-predicted values of the other nodes in the network, intervention has a larger
-effect, as it removes the dependence of the intervened network on its parents
-and changes the network structure. <o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><!--[if gte vml 1]><v:shape
- id="Picture_x0020_35" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:295.5pt;
- height:417.75pt;visibility:visible;mso-wrap-style:square'>
- <v:imagedata src="BNW_workflow_test_files/image023.png" o:title="" croptop="9437f"
-  cropbottom="5375f" cropleft="16718f" cropright="21976f"/>
-</v:shape><![endif]--><![if !vml]><img width=394 height=557
-src="BNW_workflow_test_files/image026.jpg" v:shapes="Picture_x0020_35"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>The figure
-below shows the changes in the network in BNW after intervention on Gene1 that
-results Gene1 having a low value. The predictions of the network after this
-intervention could be compared with experiments that prevent Gene1 from being
-expressed. Intervention that decreases Gene1 is predicted to result in an increase
-in Gene2 and a decrease in the phenotype. Note that Genotype and Gene3, which
-are not descendents of Gene1, are not affected by the intervention.<o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><!--[if gte vml 1]><v:shape
- id="Picture_x0020_38" o:spid="_x0000_i1025" type="#_x0000_t75" style='width:297.75pt;
- height:406.5pt;visibility:visible;mso-wrap-style:square'>
- <v:imagedata src="BNW_workflow_test_files/image025.png" o:title="" croptop="9382f"
-  cropbottom="6755f" cropleft="16815f" cropright="21642f"/>
-</v:shape><![endif]--><![if !vml]><img width=397 height=542
-src="BNW_workflow_test_files/image039.jpg" v:shapes="Picture_x0020_38"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><o:p>&nbsp;</o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>
-
-</div>
-
-</body>
-
-</html>
diff --git a/sourcecodes/BNW_workflow_2.htm b/sourcecodes/BNW_workflow_2.htm
deleted file mode 100644
index 577a388e..00000000
--- a/sourcecodes/BNW_workflow_2.htm
+++ /dev/null
@@ -1,731 +0,0 @@
-<html xmlns:v="urn:schemas-microsoft-com:vml"
-xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 12">
-<meta name=Originator content="Microsoft Word 12">
-<link rel=File-List href="BNW_workflow_test_files/filelist.xml">
-<link rel=Edit-Time-Data href="BNW_workflow_test_files/editdata.mso">
-<!--[if !mso]>
-<style>
-v\:* {behavior:url(#default#VML);}
-o\:* {behavior:url(#default#VML);}
-w\:* {behavior:url(#default#VML);}
-.shape {behavior:url(#default#VML);}
-</style>
-<![endif]--><!--[if gte mso 9]><xml>
- <o:DocumentProperties>
-  <o:Author>Admin</o:Author>
-  <o:LastAuthor>Admin</o:LastAuthor>
-  <o:Revision>19</o:Revision>
-  <o:TotalTime>249</o:TotalTime>
-  <o:Created>2012-11-26T22:35:00Z</o:Created>
-  <o:LastSaved>2012-11-27T21:40:00Z</o:LastSaved>
-  <o:Pages>5</o:Pages>
-  <o:Words>1033</o:Words>
-  <o:Characters>5892</o:Characters>
-  <o:Company>The University of Memphis</o:Company>
-  <o:Lines>49</o:Lines>
-  <o:Paragraphs>13</o:Paragraphs>
-  <o:CharactersWithSpaces>6912</o:CharactersWithSpaces>
-  <o:Version>12.00</o:Version>
- </o:DocumentProperties>
-</xml><![endif]-->
-<link rel=themeData href="BNW_workflow_test_files/themedata.thmx">
-<link rel=colorSchemeMapping
-href="BNW_workflow_test_files/colorschememapping.xml">
-<!--[if gte mso 9]><xml>
- <w:WordDocument>
-  <w:SpellingState>Clean</w:SpellingState>
-  <w:GrammarState>Clean</w:GrammarState>
-  <w:TrackMoves>false</w:TrackMoves>
-  <w:TrackFormatting/>
-  <w:PunctuationKerning/>
-  <w:ValidateAgainstSchemas/>
-  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
-  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
-  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
-  <w:DoNotPromoteQF/>
-  <w:LidThemeOther>EN-US</w:LidThemeOther>
-  <w:LidThemeAsian>X-NONE</w:LidThemeAsian>
-  <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
-  <w:Compatibility>
-   <w:BreakWrappedTables/>
-   <w:SnapToGridInCell/>
-   <w:WrapTextWithPunct/>
-   <w:UseAsianBreakRules/>
-   <w:DontGrowAutofit/>
-   <w:SplitPgBreakAndParaMark/>
-   <w:DontVertAlignCellWithSp/>
-   <w:DontBreakConstrainedForcedTables/>
-   <w:DontVertAlignInTxbx/>
-   <w:Word11KerningPairs/>
-   <w:CachedColBalance/>
-  </w:Compatibility>
-  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
-  <m:mathPr>
-   <m:mathFont m:val="Cambria Math"/>
-   <m:brkBin m:val="before"/>
-   <m:brkBinSub m:val="&#45;-"/>
-   <m:smallFrac m:val="off"/>
-   <m:dispDef/>
-   <m:lMargin m:val="0"/>
-   <m:rMargin m:val="0"/>
-   <m:defJc m:val="centerGroup"/>
-   <m:wrapIndent m:val="1440"/>
-   <m:intLim m:val="subSup"/>
-   <m:naryLim m:val="undOvr"/>
-  </m:mathPr></w:WordDocument>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
-  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
-  LatentStyleCount="267">
-  <w:LsdException Locked="false" Priority="0" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
-  <w:LsdException Locked="false" Priority="9" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
-  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
-  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
-  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
-  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
-  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
-  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
-  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
-  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
-  <w:LsdException Locked="false" Priority="39" Name="toc 1"/>
-  <w:LsdException Locked="false" Priority="39" Name="toc 2"/>
-  <w:LsdException Locked="false" Priority="39" Name="toc 3"/>
-  <w:LsdException Locked="false" Priority="39" Name="toc 4"/>
-  <w:LsdException Locked="false" Priority="39" Name="toc 5"/>
-  <w:LsdException Locked="false" Priority="39" Name="toc 6"/>
-  <w:LsdException Locked="false" Priority="39" Name="toc 7"/>
-  <w:LsdException Locked="false" Priority="39" Name="toc 8"/>
-  <w:LsdException Locked="false" Priority="39" Name="toc 9"/>
-  <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
-  <w:LsdException Locked="false" Priority="10" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Title"/>
-  <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
-  <w:LsdException Locked="false" Priority="11" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
-  <w:LsdException Locked="false" Priority="22" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
-  <w:LsdException Locked="false" Priority="20" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
-  <w:LsdException Locked="false" Priority="59" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Table Grid"/>
-  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
-  <w:LsdException Locked="false" Priority="1" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
-  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Shading"/>
-  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light List"/>
-  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Grid"/>
-  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 1"/>
-  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 2"/>
-  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 1"/>
-  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 2"/>
-  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 1"/>
-  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 2"/>
-  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 3"/>
-  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Dark List"/>
-  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Shading"/>
-  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful List"/>
-  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Grid"/>
-  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
-  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light List Accent 1"/>
-  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
-  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
-  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
-  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
-  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
-  <w:LsdException Locked="false" Priority="34" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
-  <w:LsdException Locked="false" Priority="29" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
-  <w:LsdException Locked="false" Priority="30" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
-  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
-  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
-  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
-  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
-  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Dark List Accent 1"/>
-  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
-  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
-  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
-  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
-  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light List Accent 2"/>
-  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
-  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
-  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
-  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
-  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
-  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
-  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
-  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
-  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Dark List Accent 2"/>
-  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
-  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
-  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
-  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
-  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light List Accent 3"/>
-  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
-  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
-  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
-  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
-  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
-  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
-  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
-  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
-  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Dark List Accent 3"/>
-  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
-  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
-  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
-  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
-  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light List Accent 4"/>
-  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
-  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
-  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
-  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
-  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
-  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
-  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
-  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
-  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Dark List Accent 4"/>
-  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
-  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
-  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
-  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
-  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light List Accent 5"/>
-  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
-  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
-  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
-  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
-  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
-  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
-  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
-  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
-  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Dark List Accent 5"/>
-  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
-  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
-  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
-  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
-  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light List Accent 6"/>
-  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
-  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
-  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
-  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
-  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
-  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
-  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
-  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
-  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Dark List Accent 6"/>
-  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
-  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
-  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
-   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
-  <w:LsdException Locked="false" Priority="19" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
-  <w:LsdException Locked="false" Priority="21" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
-  <w:LsdException Locked="false" Priority="31" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
-  <w:LsdException Locked="false" Priority="32" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
-  <w:LsdException Locked="false" Priority="33" SemiHidden="false"
-   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
-  <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
-  <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
- </w:LatentStyles>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
- @font-face
-	{font-family:"Cambria Math";
-	panose-1:2 4 5 3 5 4 6 3 2 4;
-	mso-font-charset:1;
-	mso-generic-font-family:roman;
-	mso-font-format:other;
-	mso-font-pitch:variable;
-	mso-font-signature:0 0 0 0 0 0;}
-@font-face
-	{font-family:Calibri;
-	panose-1:2 15 5 2 2 2 4 3 2 4;
-	mso-font-charset:0;
-	mso-generic-font-family:swiss;
-	mso-font-pitch:variable;
-	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
-@font-face
-	{font-family:Tahoma;
-	panose-1:2 11 6 4 3 5 4 4 2 4;
-	mso-font-charset:0;
-	mso-generic-font-family:swiss;
-	mso-font-pitch:variable;
-	mso-font-signature:-520081665 -1073717157 41 0 66047 0;}
- /* Style Definitions */
- p.MsoNormal, li.MsoNormal, div.MsoNormal
-	{mso-style-unhide:no;
-	mso-style-qformat:yes;
-	mso-style-parent:"";
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:10.0pt;
-	margin-left:0in;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
-	{mso-style-noshow:yes;
-	mso-style-priority:99;
-	mso-style-link:"Balloon Text Char";
-	margin:0in;
-	margin-bottom:.0001pt;
-	mso-pagination:widow-orphan;
-	font-size:8.0pt;
-	font-family:"Tahoma","sans-serif";
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;}
-p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
-	{mso-style-priority:34;
-	mso-style-unhide:no;
-	mso-style-qformat:yes;
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:10.0pt;
-	margin-left:.5in;
-	mso-add-space:auto;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
-	{mso-style-priority:34;
-	mso-style-unhide:no;
-	mso-style-qformat:yes;
-	mso-style-type:export-only;
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:0in;
-	margin-left:.5in;
-	margin-bottom:.0001pt;
-	mso-add-space:auto;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
-	{mso-style-priority:34;
-	mso-style-unhide:no;
-	mso-style-qformat:yes;
-	mso-style-type:export-only;
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:0in;
-	margin-left:.5in;
-	margin-bottom:.0001pt;
-	mso-add-space:auto;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
-	{mso-style-priority:34;
-	mso-style-unhide:no;
-	mso-style-qformat:yes;
-	mso-style-type:export-only;
-	margin-top:0in;
-	margin-right:0in;
-	margin-bottom:10.0pt;
-	margin-left:.5in;
-	mso-add-space:auto;
-	line-height:115%;
-	mso-pagination:widow-orphan;
-	font-size:11.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-span.BalloonTextChar
-	{mso-style-name:"Balloon Text Char";
-	mso-style-noshow:yes;
-	mso-style-priority:99;
-	mso-style-unhide:no;
-	mso-style-locked:yes;
-	mso-style-link:"Balloon Text";
-	mso-ansi-font-size:8.0pt;
-	mso-bidi-font-size:8.0pt;
-	font-family:"Tahoma","sans-serif";
-	mso-ascii-font-family:Tahoma;
-	mso-hansi-font-family:Tahoma;
-	mso-bidi-font-family:Tahoma;}
-.MsoChpDefault
-	{mso-style-type:export-only;
-	mso-default-props:yes;
-	font-size:10.0pt;
-	mso-ansi-font-size:10.0pt;
-	mso-bidi-font-size:10.0pt;
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-fareast-font-family:Calibri;
-	mso-fareast-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;
-	mso-bidi-font-family:"Times New Roman";
-	mso-bidi-theme-font:minor-bidi;}
-@page WordSection1
-	{size:8.5in 11.0in;
-	margin:1.0in 1.0in 1.0in 1.0in;
-	mso-header-margin:.5in;
-	mso-footer-margin:.5in;
-	mso-paper-source:0;}
-div.WordSection1
-	{page:WordSection1;}
- /* List Definitions */
- @list l0
-	{mso-list-id:779757819;
-	mso-list-type:hybrid;
-	mso-list-template-ids:939584274 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
-@list l0:level1
-	{mso-level-text:"%1\)";
-	mso-level-tab-stop:none;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level2
-	{mso-level-tab-stop:1.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level3
-	{mso-level-tab-stop:1.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level4
-	{mso-level-tab-stop:2.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level5
-	{mso-level-tab-stop:2.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level6
-	{mso-level-tab-stop:3.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level7
-	{mso-level-tab-stop:3.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level8
-	{mso-level-tab-stop:4.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l0:level9
-	{mso-level-tab-stop:4.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1
-	{mso-list-id:1813714603;
-	mso-list-type:hybrid;
-	mso-list-template-ids:939584274 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
-@list l1:level1
-	{mso-level-text:"%1\)";
-	mso-level-tab-stop:none;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level2
-	{mso-level-tab-stop:1.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level3
-	{mso-level-tab-stop:1.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level4
-	{mso-level-tab-stop:2.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level5
-	{mso-level-tab-stop:2.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level6
-	{mso-level-tab-stop:3.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level7
-	{mso-level-tab-stop:3.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level8
-	{mso-level-tab-stop:4.0in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-@list l1:level9
-	{mso-level-tab-stop:4.5in;
-	mso-level-number-position:left;
-	text-indent:-.25in;}
-ol
-	{margin-bottom:0in;}
-ul
-	{margin-bottom:0in;}
--->
-</style>
-<!--[if gte mso 10]>
-<style>
- /* Style Definitions */
- table.MsoNormalTable
-	{mso-style-name:"Table Normal";
-	mso-tstyle-rowband-size:0;
-	mso-tstyle-colband-size:0;
-	mso-style-noshow:yes;
-	mso-style-priority:99;
-	mso-style-qformat:yes;
-	mso-style-parent:"";
-	mso-padding-alt:0in 5.4pt 0in 5.4pt;
-	mso-para-margin:0in;
-	mso-para-margin-bottom:.0001pt;
-	mso-pagination:widow-orphan;
-	font-size:10.0pt;
-	font-family:"Calibri","sans-serif";
-	mso-ascii-font-family:Calibri;
-	mso-ascii-theme-font:minor-latin;
-	mso-hansi-font-family:Calibri;
-	mso-hansi-theme-font:minor-latin;}
-</style>
-<![endif]--><!--[if gte mso 9]><xml>
- <o:shapedefaults v:ext="edit" spidmax="4098"/>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <o:shapelayout v:ext="edit">
-  <o:idmap v:ext="edit" data="1"/>
- </o:shapelayout></xml><![endif]-->
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=WordSection1>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>This workflow contains examples of using the BNW structural constraint interface to help identify biologically meaningful genetic network models for two cases:<o:p></o:p></span></p>
-
-<p class=MsoListParagraphCxSpFirst style='margin-right:307.5pt;mso-add-space:
-auto;text-indent:-.25in;mso-list:l1 level1 lfo2'><![if !supportLists]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif";
-mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>1)<span
-style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'>A genetic network linking genotype and phenotype<o:p></o:p></span></p>
-
-<p class=MsoListParagraphCxSpMiddle style='margin-right:307.5pt;mso-add-space:
-auto;text-indent:-.25in;mso-list:l1 level1 lfo2'><![if !supportLists]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif";
-mso-fareast-font-family:Arial'><span style='mso-list:Ignore'>2)<span
-style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'>A genetic network with multiple genotypes and cis- and trans-regulated genes<o:p></o:p></span></p>
-
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
-normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>1.
-A genetic network linking genotype and phenotype<o:p></o:p></span></b></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>In this example, we will use the structural constraint interface to create a genetic network linking a genotype with intermediated phenotypes (i.e., gene expression or other cellular level traits) and a higher-order phenotype. The figure below shows a screenshot of BNW after loading the data file and selecting <u>Go to structure learning settings and the BNW structural constraint interface</u>. There are 5 nodes in the network, Genotype, Int1, Int2, Int3, and a Phenotype.<br><br><o:p></o:p></span></p>
-<![if !vml]><img width=520 height=205
-src="BNW_workflow_test_files/image2_1.jpg" v:shapes="Picture_x0020_2"><![endif]></span><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'><o:p></o:p></span></p>
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><o:p>&nbsp;</o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'> We want to assign the nodes to three tiers in this example, so we will keep the number of tiers at the default setting, and drag the nodes to the proper tiers.<br><br><o:p></o:p></span></p>
-<![if !vml]><img width=520 height=205
-src="BNW_workflow_test_files/image2_2.jpg" v:shapes="Picture_x0020_2"><![endif]></span><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>In this example, we do not want the genotype to be the direct parent of the phenotype, so we made some changes to the <u>Define interactions allowed between tiers</u> section of the structural constraint interface. Specifically, we have unchecked two boxes that are different from the default settings: (1) we have unchecked the box that allows the node(s) in Tier1 from being the parents of the node(s) in Tier3 and (2) we have unchecked the box that allows the node(s) in Tier3 from being the children of the node(s) in Tier1.  Actually, unchecking either of these boxes would have been sufficient in preventing direct interactions between Genotype and Phenotype, but, there is no harm in unchecking both boxes. There are no additional specific edges that we want to ban or require in the network, so we do not have to add any edges to the <u>Specify additional constraint</u> section and we can proceed with structure learning.<br><br><o:p></o:p></span></p>
-<![if !vml]><img width=650 height=200
-src="BNW_workflow_test_files/image2_3.jpg" v:shapes="Picture_x0020_2"><![endif]></span><span
-style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'><o:p></o:p></span></p>
-
-
-<p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
-normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>2.
-A genetic network with multiple genotypes and cis- and trans-regulated genes.<o:p></o:p></span></b></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'> In this example, we will add restrictions to a network containing 8 nodes: 2 genotype nodes (Geno1 and Geno2), 3 cis-regulated gene expression traits (cisGene1, cisGene2, and cisGene3), 2 trans-regulated gene expression traits (transGene1 and transGene2), and a phenotype (Pheno). We have four tiers of nodes (genotypes, cis-regulated genes, trans-regulated genes, and phenotype), so we have selected 4 from the dropdown menu at the top of the page and assigned the nodes to the correct tiers. We could make a more complex system of tiers that would allow us to specify which genes are regulated by which genotypes (for example, Geno1 regulates cisGene1 and transGene1, while Geno2 regulates cisGene2, cisGene3, and transGene2), but, for this example, we will use a simpler system of 4 tiers.<br><br><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=537 height=258
-src="BNW_workflow_test_files/image2_4.jpg" v:shapes="Picture_x0020_14"><![endif]><o:p></o:p></span></p>
-
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'> We have made one change to the default setting in the <u>Define interactions allowed between tiers</u> section. For Tier1, which contains the genotypes, we have selected "No" for the "Are within tier interactions allowed?", as it does not make biological sense for one genotype variation to cause the variation in another genotype in this examples.<br><br><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=536 height=133
-src="BNW_workflow_test_files/image2_5.jpg" v:shapes="Picture_x0020_14"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>Assume that a known regulatory relationship between cisGene1 and transGene1 has been established from previous experiments. We can require that this relationship is included in the network by adding the edge list of required edges in the <u>Specify additional constraints</u> section.<br><br><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=750 height=300
-src="BNW_workflow_test_files/image2_6.jpg" v:shapes="Picture_x0020_17"><![endif]><o:p></o:p></span></p>
-</div>
-
-</body>
-
-</html>
diff --git a/sourcecodes/BNW_workflow_net1.htm b/sourcecodes/BNW_workflow_net1.htm
index aafab31f..3ad19201 100644
--- a/sourcecodes/BNW_workflow_net1.htm
+++ b/sourcecodes/BNW_workflow_net1.htm
@@ -294,7 +294,7 @@ ul
 line-height:115%;font-family:"Arial","sans-serif"'>
 <br>
 This tutorial provides
-an overview of using BNW to build a Bayesian network model from a dataset and use the network to make predictions. The dataset used in this tutorial is a synthetic example of a genetic dataset that has a total of 8 variables. Two of the variables are genotypes labeled Geno1 and Geno2, and the remaining 6 variables are gene expression levels or other quantitative traits that are labeled Trait1 to Trait6. The dataset is available <a href="example_datasets/example_data_8nodes.txt">here</a>.<br><br>The data file is formatted according to the guidelines on the <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/help.php#file_format>BNW help page</a>. The first row of the file contains the names of the variables and the remaining rows contain the data for each sample of the dataset. The genotypes (Geno1 and Geno2), which have two possible states (1 and 2), are the only discrete variables in the network and are the leftmost variables in the input file. The quantitative traits are continuous variables.<o:p></o:p></span></p>
+an overview of using BNW to build a Bayesian network model from a dataset and use the network to make predictions. The dataset used in this tutorial is a synthetic example of a genetic dataset that has a total of 8 variables. Two of the variables are genotypes labeled Geno1 and Geno2, and the remaining 6 variables are gene expression levels or other quantitative traits that are labeled Trait1 to Trait6. The dataset is available <a href="example_datasets/example_data_8nodes.txt">here</a>.<br><br>The data file is formatted according to the guidelines on the <a href=./help.php#file_format>BNW help page</a>. The first row of the file contains the names of the variables and the remaining rows contain the data for each sample of the dataset. The genotypes (Geno1 and Geno2), which have two possible states (1 and 2), are the only discrete variables in the network. The quantitative traits are continuous variables.<o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-right:107.5pt'><b style='mso-bidi-font-weight:
 normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>1. Structure learning using default options<o:p></o:p></span></b></p>
@@ -303,17 +303,17 @@ normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif"'>We do not know the network structure that underlies the relationships between the variables in this dataset, so we will use BNW to learn the structure that best explains the data. To begin, select <u>Learn a network model from data</u> from the BNW home page. Next, click <u>Choose File</u> at the top of the file upload page, navigate to and select the data file, and click <u>Upload</u>. A screen similar to image shown below should be displayed.<br><br><o:p></o:p></span></p>
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><![if !vml]><img width=1128 height=499
-src="BNW_workflow_test_files/8node_file_upload.jpg" v:shapes="Picture_x0020_2"><![endif]></span><span
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><![if !vml]><img width=787 height=423
+src="BNW_workflow_test_files/8node_file_upload_new.png" v:shapes="Picture_x0020_2"><![endif]></span><span
 style='font-size:12.0pt;line-height:115%;font-family:"Arial","sans-serif"'><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'>Clicking on the <u>View uploaded variables and data</u> on the left menu will bring up a pop-up window that displays the uploaded data file or information about the data set, such whether variables were classified as discrete or continuous. This information can be used to ensure that the input file was uploaded and properly interpreted in BNW.<br><br> Other options on the left menu will continue with structure learning. Initially, we will perform structure learning using default options in BNW and click on the <u>Perform Bayesian network modeling using default settings</u> button. By default, BNW limits the maximum number of parents for any node in the network to 4 and presents the structure of the single highest scoring network. Structure learning can take a significant amount of time for larger networks. For this dataset, structure learning should take only a few seconds, and the structure below will soon be displayed. The network can be also be accessed <a href="example.php?My_key=example1|Bqx" target="_blank">here</a>.<br><br>
+line-height:115%;font-family:"Arial","sans-serif"'>The buttons on the top of the page allow you to perform Bayesian network modeling using default settings; modify structure learning settings and add structural constraints; or remove variables from the data set. Under these buttons, a description of the loaded data set is provided, including if BNW classified the variables as discrete or continuous. In this case, the uploaded data file contained 8 variables and had 200 cases. Two variables (Geno1 and Geno2) were determined to be discrete variables because they had only 2 different values in the input data file. The other six variables were continuous variables with the means and standard deviations shown in the table. <br><br> Initially, we will perform structure learning using default options in BNW and click on the <u>Perform Bayesian network modeling using default settings</u> button. By default, BNW limits the maximum number of parents for any node in the network to 4 and presents the structure of the single highest scoring network. Structure learning can take a significant amount of time for larger networks. For this dataset, structure learning should take only a few seconds, and the structure below will soon be displayed. The network can be also be accessed <a href="example.php?My_key=example1|Bqx" target="_blank">here</a>.<br><br>
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<img width=908 height=842
-src="BNW_workflow_test_files/8node_best_structure.jpg" v:shapes="Picture_x0020_5"><o:p></o:p></span></p>
+<img width=308 height=264
+src="BNW_workflow_test_files/8node_no_weight.png" v:shapes="Picture_x0020_5"><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
@@ -324,58 +324,49 @@ normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>In order to test if edges present the single best scoring network are conserved across high scoring networks. We can modify the structure learning settings to get identify the structures of many high scoring networks and perform <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/help.php#learn_details>model averaging</a> over these structures. To do this, return to the BNW home page, select <u>Learn a network model from data</u>, and upload the data file. Instead of using the default settings, select <u>Go to structure learning settings and the BNW structural constraint interface</u>. A more detailed overview of use of the structural constraint interface is provided in <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/BNW_workflow_2.htm>another tutorial</a>, but, here, we will investigate the impact of modifying some of the structure learning settings shown below:<br><o:p></o:p></span></p><br>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>In order to test if edges present the single best scoring network are conserved across high scoring networks, we can modify the structure learning settings to identify the structures of many high scoring networks and perform <a href=./help.php#learn_details>model averaging</a> over these structures. To do this, click the <u>Modify network strucutre</u> button on the left of the page, opening a menu with three options that can be used to modify the network structure. <u>Add or remove edges from network</u> provides an interface for making specific changes to the network structure. The use of this interface is discussed <a href=./add_remove_howto.htm target=_blank>here</a>. In this tutorial, we are examining the impact of changing the settings used during structure learning on the network structure and click on <u>Modify structure learning settings</u>. We then select <u>Go to structure learning settings and the BNW structural constraint interface</u> on the resulting page. A more detailed overview of use of the structural constraint interface is provided in <a href=./BNW_workflow_sci.htm>another tutorial</a>. <br><br>Here, we only change the <u>Number of networks to include in model averaging</u> to 1000 and select <u>Continue to assign variables to tiers</u>. In this case, we will not assign variables to tiers, and can immediately click <u>Click here to perform Bayesian network modeling after creating tiers</u>. Now, instead of displaying the single highest scoring network, BNW will determine the 1000 highest scoring networks, perform model averaing over these networks, and display the structure after model averaging that includes all features with a <u>Model averaging edge selection threshold</u> greater than 0.5. Model averaging over the 1000 highest scoring structures has resulted in a change in the network structure as shown below and is available <a href="example.php?My_key=example2|hQG" target="blank_">here</a>.<br><o:p></o:p></span></p><br>
 
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=628 height=181
-src="BNW_workflow_test_files/8node_global_settings.jpg" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
+<![if !vml]><img width=366 height=262
+src="BNW_workflow_test_files/8node_model_avg_struct_new.png" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>Change the <u>Number of networks to include in model averaging</u> to 100 and select <u>Perform Bayesian network modeling</u>. Now, instead of displaying the single highest scoring network, BNW will determine the 100 highest scoring networks, perform model averaing over these networks, and display the structure after model averaging that includes all features with a <u>Model averaging edge selection threshold</u> greater than 0.5. Model averaging over the 100 highest scoring structures has resulted in a change in the network structure as shown below and is available <a href="example.php?My_key=example2|hQG" target="blank_">here</a>.<br><o:p></o:p></span></p><br>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>Specifically, the single best model network contains a directed edge linking Trait6 with Trait3, while this edge is absent from the structure after model averaging over the 1000 best scoring networks. More information about the network structure can be viewed by clicking <u>Network image options</u> on the left menu and, then, <u>Show network with edge weights</u>. The network structure with the edges labeled by their scores after model averaging will be displayed.<br><o:p></o:p></span></p><br>
 
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=1034 height=802
-src="BNW_workflow_test_files/8node_model_avg_struct.jpg" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
+<![if !vml]><img width=389 height=259
+src="BNW_workflow_test_files/8node_with_weights.png" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>Specifically, the single best model network contains a directed edge linking Trait6 with Trait3, while this edge is absent from the structure after model averaging over the 100 best scoring networks. Clicking <u>Display structure matrix</u> displays the model averaging scores as well as the structure matrix. The structure matrix file can be downloaded and used in return sessions to BNW, allowing users to skip structure learning and more quickly use the model to make predictions.<br><o:p></o:p></span></p><br>
-
-<p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=899 height=563
-src="BNW_workflow_test_files/8node_matrix.jpg" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>In the model averaging scores, we can observe that most of the network edges in the model average network were found in all or nearly all of the 100 highest scoring networks. For example, edges from Geno2 to Traits 3 and 4 have posterior probabilities of 1. Also, the edge from Trait6 to Trait3 that was observed in the single highest scoring network has a posterior probability of 0.46, and it, therefore, falls just short of being included in the model averaged network structure.<br><o:p></o:p></span></p><br>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br> The model averaging scores show that the edges in this network model were found in all or nearly all of the 1000 highest scoring networks, and, thus, have scores of 0.99 or 1.00. For example, edges from Geno2 to Traits 3 and 4 have scores of 1. The model averaging scores for all possible directed edges in the network can be found by clicking <u>View structure matrix</u> under the <u>More about network</u> menu. The data provided in the structure matrix shows that the edge from Trait6 to Trait3 that was observed in the single highest scoring network has a posterior probability of 0.40, and it, therefore, falls short of being included in the model averaged network structure. The structure matrix file can be downloaded and used in return sessions to BNW, allowing users to skip structure learning and more quickly use the model to make predictions.<o:p></o:p></span></p><br>
 
 <p class=MsoNormal style='margin-right:107.5pt'><b style='mso-bidi-font-weight:
 normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>3. Using the network structure to make predictions<o:p></o:p></span></b></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>To make predictions with the network, we will use the structure learned after model averaging of the top 100 highest scoring networks. First, we will use the model to compare the expected values for nodes in the network based on observed genotypes. For these predictions, we will use evidence mode when making predictions, which is the default behavior in BNW. The difference between evidence and intervention modes is discussed in the <a href=http://compbio.uthsc.edu/BNW_1.2/sourcecodes/faq.php#evid_inter>BNW FAQ page</a>. To use the model to make predictions based on Geno1, click on one of the blue bars in the Geno1 node and enter 1 or 2 to indicate which genotype value should be used to predict the values of the other network nodes. In the figure below, Geno1 is outlined in red and state 2 has a 100% probability, indicating that the value of this node has been entered as evidence. The red lines in the figure show the predicted distributions of the nodes after this evidence is known and can be compared with the blue lines which show the distributions for variables using the original data.<o:p></o:p></span></p><br>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>The network model can be used by make predictions through an interactive interface after clicking on the <u>Use network to make predictions</u> button on the left menu. To make predictions with the network, we will use the structure learned after model averaging of the top 1000 highest scoring networks. First, we will use the model to compare the expected values for nodes in the network based on observed genotypes. For these predictions, we will use evidence mode when making predictions, which is the default behavior in BNW. The difference between evidence and intervention modes is discussed in the <a href=./faq.php#evid_inter>BNW FAQ page</a>. To use the model to make predictions based on Geno1, click on one of the blue bars in the Geno1 node and enter 1 or 2 to indicate which genotype value should be used to predict the values of the other network nodes. In the figure below, Geno1 is outlined in red and state 2 has a 100% probability, indicating that the value of this node has been entered as evidence. The red lines in the figure show the predicted distributions of the nodes after this evidence is known and can be compared with the blue lines which show the distributions for variables using the original data.<o:p></o:p></span></p><br>
 
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=1086 height=866
-src="BNW_workflow_test_files/8node_geno1_2.jpg" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
+<![if !vml]><img width=533 height=517
+src="BNW_workflow_test_files/8node_geno1_2_new.png" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>If Geno1 has genotype 2, the value of Traits 1, 2, and 4 are expected to increase compared with the distribution for all data. Specifically, the mean value of Trait2 is expected to be near 1 for Geno1=2 data, while it is close to 0 when this evidence is not known. Traits 1 and 4 are also expected to increase, but the magnitude of this increase is not expected to be as large. Predicted distributions for the other nodes in the network, which are not descendants of Geno1, are expected to be close to the same as their original distributions, and, the red line covers the blue line for some nodes.<br><br>
-To quantitatively assess the impact of this evidence on the network predictions, the <u>View parameters</u> button on the left menu can be selected. Clicking this button brings up a pop-up window with the network parameters (i.e., the probability distributions of the states of discrete nodes and the means and standard deviations of the Gaussian distributions for continuous nodes) for both the original data set and the data when considering the entered evidence. <br><br>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'><br>If Geno1 has genotype 2, the value of Traits 1, 2, and 4 are expected to increase compared with the distribution for all data. Specifically, the mean value of Trait2 is expected to be near 1 for Geno1=2 data, while it is close to 0 when this evidence is not known. Traits 1 and 4 are also expected to increase, but the magnitude of this increase is not expected to be as large.<br><br>
+To quantitatively assess the impact of this evidence on the network predictions, the <u>View parameters</u> button within the <u>More about network parameters and structure</u> menu can be selected. Clicking this button brings up a pop-up window with the network parameters (i.e., the probability distributions of the states of discrete nodes and the means and standard deviations of the Gaussian distributions for continuous nodes) for both the original data set and the data when considering the entered evidence. <br><br>
 Evidence for multiple nodes can be considered at the same time by clicking on a new node in the network and entering a value. Alternatively, users can select <u>Clear evidence</u> to reset the network to show the orignial distributions in a new tab.<br><br>
 Next, we will make predictions using the intervention mode. To use the prediction mode, click the button next to <u>Intervention</u> at the top of the page. The <u>Selected mode</u> tab on the left of the screan should now display Intervention. The effects of experimental intervention on Trait2 can be predicted by clicking on the blue line in the Trait2 node and entering a value for the variable. The figure below shows the network after setting Trait2 to a value of 1.5.<o:p></o:p></span></p><br>
 
 <p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=1036 height=864
-src="BNW_workflow_test_files/8node_trait2_15.jpg" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
+<![if !vml]><img width=517 height=516
+src="BNW_workflow_test_files/8node_trait2_15_new.png" v:shapes="Picture_x0020_8"><![endif]><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
diff --git a/sourcecodes/BNW_workflow_sci.htm b/sourcecodes/BNW_workflow_sci.htm
index 1e56bb11..3911d400 100644
--- a/sourcecodes/BNW_workflow_sci.htm
+++ b/sourcecodes/BNW_workflow_sci.htm
@@ -324,31 +324,31 @@ A genetic network linking genotype and phenotype<o:p></o:p></span></b></p>
 line-height:115%;font-family:"Arial","sans-serif"'>In this example, we will use the structural constraint interface to create a genetic network linking a genotype with gene expression traits and a higher-order phenotype. There are 5 nodes in the network: Genotype, Gene1, Gene2, Gene3, and Phenotype. The input data file is available <a href="example_datasets/sci_5node_input_data2.txt">here</a>. To begin, select <u>Learn a network model from data</u> on the BNW homepage and load the data file, displaying what is shown below:<br><br><o:p></o:p></span></p>
 
 
-<img width=1076 height=404 src="BNW_workflow_test_files/sci_5node_upload.jpg" v:shapes="Picture_x0020_2"></img>
+<img width=776 height=322 src="BNW_workflow_test_files/sci_5node_upload.png" v:shapes="Picture_x0020_2"></img>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><br>We now have the option of either learning performing structure learning using the default BNW settings and no additional structural constraints or we can use modify settings and add structural constraints. Here, we will select <u>Go to structure learning settings and the BNW structural constraint interface</u> to select the latter option. The BNW structural constraint interface is described in our <a href="help.php#constraint_interface">Help page</a>. At shown in the figure below, the top of the page has several settings for global features of the structure search. We have kept the default settings, except we have changed the <u>Number of networks to include in model averaging</u> to 1000. As this is a small network with only 5 nodes, including many high scoring networks had little effect on the estimated time required to perform structure learning, and the estimated run time increased from 12 to 13 seconds. We also could increase the <u>Maximum number of parents for any node</u> to any value without significantly changing the run time for a network of this size. For larger networks with more than approximately 10 nodes, changing these settings can have a major impact on estimated run times.<br><br><o:p></o:p></span></p>
+line-height:115%;font-family:"Arial","sans-serif"'><br>We now have the option of either learning performing structure learning using the default BNW settings or we can modify settings and add structural constraints. Here, we will select <u>Go to structure learning settings and the BNW structural constraint interface</u> to select the latter option. The BNW structural constraint interface is described in our <a href="help.php#constraint_interface">Help page</a>. At shown in the figure below, the first page has several settings for global features of the structure search. We have kept the default settings, except we have changed the <u>Number of networks to include in model averaging</u> to 1000. As this is a small network with only 5 nodes, including many high scoring networks had little effect on the estimated time required to perform structure learning, and the estimated run time increased from 12 to 13 seconds. We also could increase the <u>Maximum number of parents for any node</u> to any value without significantly changing the run time for a network of this size. For larger networks with more than approximately 10 nodes, changing these settings can have a major impact on estimated run times.<br><br><o:p></o:p></span></p>
 
-<img width=596 height=217 src="BNW_workflow_test_files/sci_5node_part1.jpg" v:shapes="Picture_x0020_2"></img>
+<img width=508 height=175 src="BNW_workflow_test_files/sci_5node_part1.png" v:shapes="Picture_x0020_2"></img>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><br>In the next section of the structural constraint interface, we assign nodes to tiers which will can be used to focus network searches on biologically meaningful networks. Our dataset contains a genotype, three gene expression traits, and a higher order phenotype. Instead of considering all possible network models for this dataset, we may want to focus on models relevant to a questions such as: How does variation in genotype and gene expression explain the variation observed in the phenotype? To address this question, we assign the network nodes to three tiers: Tier1 contains the genotype, Tier2 contains the gene expression traits, and Tier3 contains the phenotype.<br><br><o:p></o:p></span></p>
+line-height:115%;font-family:"Arial","sans-serif"'><br>Clicking the <u>Continue to assign variables to tiers</u> button allows the assignment of nodes to tiers which can focus network searches on biologically meaningful networks. Our dataset contains a genotype, three gene expression traits, and a higher order phenotype. Instead of considering all possible network models for this dataset, we may want to focus on models relevant to a questions such as: How does variation in genotype and gene expression explain the variation observed in the phenotype? To address this question, we assign the network nodes to three tiers: Tier1 contains the genotype, Tier2 contains the gene expression traits, and Tier3 contains the phenotype.<br><br><o:p></o:p></span></p>
 
-<img width=633 height=214 src="BNW_workflow_test_files/sci_5node_part2.jpg" v:shapes="Picture_x0020_2"></img>
+<img width=671 height=320 src="BNW_workflow_test_files/sci_5node_part2.png" v:shapes="Picture_x0020_2"></img>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><br>The third section of the BNW structural constraint interface allows users to specify the interactions that are allowed within and between tiers. By default, within tier interactions (i.e., nodes in TierX can be parents or children of other nodes in TierX) are allowed, but users may want to prevent within tier interactions for some cases. For example, it may be advantageous to prevent interactions between a tier that contained a set of some demographic variables (e.g., age, sex, and race), as these variables are not likely to be causal factor that influence other factors in the tier. In this case, within tier interactions only apply to Tier2, and we do not have any prior knowledge that indicates that between gene interactions should not be allowed, so we will keep the default setting and allow within tier interactions.<br><br> The default settings for between tier interactions allow nodes within a tier to be the parents of all nodes in lower ranking tiers. Here, the Genotype node in Tier1 can be parents of the gene nodes in Tier2 and the Phenotype node in Tier3, the gene nodes in Tier2 can be the parents of the Tier3 Phenotype node, and the Tier3 Phenotype node cannot be the parents of nodes in any other tier. Therefore, by default, the Genotype node can be the direct parent of the Phenotype node. We may want to allow this interaction, as the genotype may influence genotype through genes or other factors that are not explicitly included as variables in the network. If users do not want to allow this direct Genotype-Phenotype interaction, they can unclick the Tier3 box in the <u>Which tiers contain nodes that can be the children of this tier?</u> for Tier1. In this case, we have maintained the default settings which are shown below.<br><br><o:p></o:p></span></p>
+line-height:115%;font-family:"Arial","sans-serif"'><br>The third section of the BNW structural constraint interface allows users to specify the interactions that are allowed within and between tiers. By default, within tier interactions (i.e., nodes in TierX can be parents or children of other nodes in TierX) are allowed, but users may want to prevent within tier interactions for some cases. For example, it may be advantageous to prevent interactions between a tier that contained a set of some demographic variables (e.g., age, sex, and race), as these variables are not likely to be causal factor that influence other factors in the tier. In this case, within tier interactions only apply to Tier2, and we do not have any prior knowledge that indicates that between gene interactions should not be allowed, so we will keep the default setting and allow within tier interactions.<br><br> The default settings for between tier interactions allow nodes within a tier to be the parents of all nodes in lower ranking tiers. Here, the Genotype node in Tier1 can be parents of the gene nodes in Tier2 and the Phenotype node in Tier3, the gene nodes in Tier2 can be the parents of the Tier3 Phenotype node, and the Tier3 Phenotype node cannot be the parents of nodes in any other tier. Therefore, by default, the Genotype node can be the direct parent of the Phenotype node. We may want to allow this interaction, as the genotype may influence genotype through genes or other factors that are not explicitly included as variables in the network. If users do not want to allow this direct Genotype-Phenotype interaction, they can unclick the Tier3 box in the <u>Which tiers contain nodes that can be the children of this tier?</u> for Tier1. In this case, we have maintained the default settings which are shown below. The final section of this menu allows for listing specific edges that should be banned or required in the network structures. We will not ban or require any specific edges in this network.<br><br><o:p></o:p></span></p>
 
-<img width=600 height=175 src="BNW_workflow_test_files/sci_5node_part3.jpg" v:shapes="Picture_x0020_2"></img>
+<img width=886 height=443 src="BNW_workflow_test_files/sci_5node_part3.png" v:shapes="Picture_x0020_2"></img>
 
 <p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif"'><br>In this example, we will not specify any additional constraints in the fourth section of the structural constraint interface, and we can click <u>Perform Bayesian network modeling</u> on the upper left corner of the page. The figure below shows the network with the model average network of the 1000 highest scoring networks and this network is available <a href="example.php?My_key=example_sci|Llu" target="_blank">here</a>. Genotype directly influences two of the genes (Gene1 and Gene3), and two of the genes (Gene2 and Gene3) directly influence the Phenotype. In this case, although we did not prevent the Genotype from directly influencing the Phenotype, the highest scoring networks did not include this directed edge. The right side of the figure shows the predictions of the network with Genotype=1 used as evidence. If Genotype is known to be in state 1, the values of all other variables in the network are expected to decrease compared to the distributions learned using all phenotypes. A more complete description of using BNW to make predictions with network models can be found in a <a href="BNW_workflow_net1.htm">separate tutorial</a>.<br><br><o:p></o:p></span></p>
+line-height:115%;font-family:"Arial","sans-serif"'><br>In this example, we will not specify any additional constraints in the fourth section of the structural constraint interface, and we can click <u>Click here to perform Bayesian network modeling</u> on the top of the page. The figure below shows the network with the model average network of the 1000 highest scoring networks and this network is available <a href="example.php?My_key=example_sci|Llu" target="_blank">here</a>. Genotype directly influences two of the genes (Gene1 and Gene3), and two of the genes (Gene2 and Gene3) directly influence the Phenotype. In this case, although we did not prevent the Genotype from directly influencing the Phenotype, the highest scoring networks did not include this directed edge. The right side of the figure shows the predictions of the network with Genotype=1 used as evidence. If Genotype is known to be in state 1, the values of all other variables in the network are expected to decrease compared to the distributions learned using all phenotypes. A more complete description of using BNW to make predictions with network models can be found in a <a href="BNW_workflow_net1.htm">separate tutorial</a>.<br><br><o:p></o:p></span></p>
 
-<img width=1117 height=846 src="BNW_workflow_test_files/sci_5node_network1.jpg" v:shapes="Picture_x0020_2"></img>
+<img width=587 height=561 src="BNW_workflow_test_files/sci_5node_network1.png" v:shapes="Picture_x0020_2"></img>
 
 
 <p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
@@ -361,27 +361,19 @@ line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'> In this exa
 
 <p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=537 height=258
-src="BNW_workflow_test_files/image2_4.jpg" v:shapes="Picture_x0020_14"><![endif]><o:p></o:p></span></p>
+<![if !vml]><img width=863 height=419
+src="BNW_workflow_test_files/image2_4.png" v:shapes="Picture_x0020_14"><![endif]><o:p></o:p></span></p>
 
 
 <p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
 0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'> We have made one change to the default setting in the <u>Define interactions allowed between tiers</u> section. For Tier1, which contains the genotypes, we have selected "No" for the "Are within tier interactions allowed?", as it does not make biological sense for one genotype variation to cause the variation in another genotype in this example.<br><br><o:p></o:p></span></p>
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'> We have made one change to the default setting in the <u>Define interactions allowed between tiers</u> section. For Tier1, which contains the genotypes, we have selected "No" for the "Are within tier interactions allowed?", as it does not make biological sense for one genotype variation to cause the variation in another genotype in this example.<br><br>Also, assume that a known regulatory relationship between cisGene1 and transGene1 has been established from previous experiments. We can require that this relationship is included in the network by adding the edge list of required edges in the <u>Specify additional constraints</u> section.<br><br><o:p></o:p></span></p>
 
 <p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
 line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=536 height=133
-src="BNW_workflow_test_files/image2_5.jpg" v:shapes="Picture_x0020_14"><![endif]><o:p></o:p></span></p>
+<![if !vml]><img width=1006 height=631
+src="BNW_workflow_test_files/image2_5.png" v:shapes="Picture_x0020_14"><![endif]><o:p></o:p></span></p>
 
-<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
-0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>Assume that a known regulatory relationship between cisGene1 and transGene1 has been established from previous experiments. We can require that this relationship is included in the network by adding the edge list of required edges in the <u>Specify additional constraints</u> section.<br><br><o:p></o:p></span></p>
-
-<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
-line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
-<![if !vml]><img width=750 height=300
-src="BNW_workflow_test_files/image2_6.jpg" v:shapes="Picture_x0020_17"><![endif]><o:p></o:p></span></p>
 </div>
 
 </body>
diff --git a/sourcecodes/BNW_workflow_test_files/8node_best_structure.jpg b/sourcecodes/BNW_workflow_test_files/8node_best_structure.jpg
deleted file mode 100644
index 3fce7f95..00000000
--- a/sourcecodes/BNW_workflow_test_files/8node_best_structure.jpg
+++ /dev/null
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_file_upload.jpg b/sourcecodes/BNW_workflow_test_files/8node_file_upload.jpg
deleted file mode 100644
index 7a40cdae..00000000
--- a/sourcecodes/BNW_workflow_test_files/8node_file_upload.jpg
+++ /dev/null
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_file_upload_new.png b/sourcecodes/BNW_workflow_test_files/8node_file_upload_new.png
new file mode 100644
index 00000000..4f754bfc
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/8node_file_upload_new.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_geno1_2.jpg b/sourcecodes/BNW_workflow_test_files/8node_geno1_2.jpg
deleted file mode 100644
index 849caf65..00000000
--- a/sourcecodes/BNW_workflow_test_files/8node_geno1_2.jpg
+++ /dev/null
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_geno1_2_new.png b/sourcecodes/BNW_workflow_test_files/8node_geno1_2_new.png
new file mode 100644
index 00000000..ededa53d
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/8node_geno1_2_new.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_global_settings.jpg b/sourcecodes/BNW_workflow_test_files/8node_global_settings.jpg
deleted file mode 100644
index 80a427c9..00000000
--- a/sourcecodes/BNW_workflow_test_files/8node_global_settings.jpg
+++ /dev/null
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_matrix.jpg b/sourcecodes/BNW_workflow_test_files/8node_matrix.jpg
deleted file mode 100644
index 71842c04..00000000
--- a/sourcecodes/BNW_workflow_test_files/8node_matrix.jpg
+++ /dev/null
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct.jpg b/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct.jpg
deleted file mode 100644
index 20b4d73b..00000000
--- a/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct.jpg
+++ /dev/null
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct_new.png b/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct_new.png
new file mode 100644
index 00000000..0f87f3d3
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/8node_model_avg_struct_new.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_no_weight.png b/sourcecodes/BNW_workflow_test_files/8node_no_weight.png
new file mode 100644
index 00000000..75a5313e
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/8node_no_weight.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_trait2_15.jpg b/sourcecodes/BNW_workflow_test_files/8node_trait2_15.jpg
deleted file mode 100644
index 33ea13cf..00000000
--- a/sourcecodes/BNW_workflow_test_files/8node_trait2_15.jpg
+++ /dev/null
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_trait2_15_new.png b/sourcecodes/BNW_workflow_test_files/8node_trait2_15_new.png
new file mode 100644
index 00000000..213f1f15
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/8node_trait2_15_new.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/8node_with_weights.png b/sourcecodes/BNW_workflow_test_files/8node_with_weights.png
new file mode 100644
index 00000000..27717913
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/8node_with_weights.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/add_remove_MAS.png b/sourcecodes/BNW_workflow_test_files/add_remove_MAS.png
new file mode 100644
index 00000000..82ad2432
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/add_remove_MAS.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/add_remove_Weight.png b/sourcecodes/BNW_workflow_test_files/add_remove_Weight.png
new file mode 100644
index 00000000..5773ff0b
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/add_remove_Weight.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/add_remove_filter.png b/sourcecodes/BNW_workflow_test_files/add_remove_filter.png
new file mode 100644
index 00000000..35887a81
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/add_remove_filter.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/add_remove_final.png b/sourcecodes/BNW_workflow_test_files/add_remove_final.png
new file mode 100644
index 00000000..efaa1c8b
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/add_remove_final.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/add_remove_new_edge.png b/sourcecodes/BNW_workflow_test_files/add_remove_new_edge.png
new file mode 100644
index 00000000..2ee67069
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/add_remove_new_edge.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/add_remove_original_interface.png b/sourcecodes/BNW_workflow_test_files/add_remove_original_interface.png
new file mode 100644
index 00000000..6d3f443d
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/add_remove_original_interface.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/add_remove_original_network.png b/sourcecodes/BNW_workflow_test_files/add_remove_original_network.png
new file mode 100644
index 00000000..139efb04
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/add_remove_original_network.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/add_remove_red_edge.png b/sourcecodes/BNW_workflow_test_files/add_remove_red_edge.png
new file mode 100644
index 00000000..2f5e4bcd
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/add_remove_red_edge.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/add_remove_removed.png b/sourcecodes/BNW_workflow_test_files/add_remove_removed.png
new file mode 100644
index 00000000..5e126891
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/add_remove_removed.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/image2_4.png b/sourcecodes/BNW_workflow_test_files/image2_4.png
new file mode 100644
index 00000000..a3218d75
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/image2_4.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/image2_5.png b/sourcecodes/BNW_workflow_test_files/image2_5.png
new file mode 100644
index 00000000..facdae33
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/image2_5.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/sci_5node_network1.png b/sourcecodes/BNW_workflow_test_files/sci_5node_network1.png
new file mode 100644
index 00000000..8bfc1400
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/sci_5node_network1.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/sci_5node_part1.png b/sourcecodes/BNW_workflow_test_files/sci_5node_part1.png
new file mode 100644
index 00000000..7a8f2ce9
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/sci_5node_part1.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/sci_5node_part2.png b/sourcecodes/BNW_workflow_test_files/sci_5node_part2.png
new file mode 100644
index 00000000..c12f9692
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/sci_5node_part2.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/sci_5node_part3.png b/sourcecodes/BNW_workflow_test_files/sci_5node_part3.png
new file mode 100644
index 00000000..f29ac1c8
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/sci_5node_part3.png
Binary files differdiff --git a/sourcecodes/BNW_workflow_test_files/sci_5node_upload.png b/sourcecodes/BNW_workflow_test_files/sci_5node_upload.png
new file mode 100644
index 00000000..5fe1e152
--- /dev/null
+++ b/sourcecodes/BNW_workflow_test_files/sci_5node_upload.png
Binary files differdiff --git a/sourcecodes/about_this_page.php b/sourcecodes/about_this_page.php
new file mode 100644
index 00000000..a04eab6b
--- /dev/null
+++ b/sourcecodes/about_this_page.php
@@ -0,0 +1,180 @@
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/accordion.js"></script>
+<?php
+
+$key=$_POST["My_key"];
+if($key=="")
+  $key="ab";//uniqid("");
+
+include("header_new.inc");
+?>
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><a href="help.php">Main help page</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+
+
+
+<!-- Main content -->
+<div id="outer">
+
+<table width=100% align=center>
+<tr>
+<td>
+<h2>Table of Contents</h2>
+<ol class="help">
+<li><a href="#file_upload">File upload</a>
+<li><a href="#network_structure">Network structure</a>
+<li><a href="#network_predictions">Network predictions</a>
+<li><a href="#input_check">Input file processing</a>
+<li><a href="#matrix">Structure matrix</a>
+<li><a href="#parameters">Network parameters</a>
+
+</ol>
+</td>
+</tr>
+</table>
+
+
+<br>
+<table>
+<tr>
+<a name=file_upload><h2>1. File upload page</h2></a>
+</tr>
+<br>
+<tr><td>
+  <p align="justify">This is the main page for uploading a data file for use with BNW. This input file should be a tab-delimited text file. Formatting guidelines are more fully described <a href="help.php#file_format">here</a>. Several example data sets can be loaded by clicking the appropriate button.<br><br>
+  After loading the data file, Bayesian network modeling can performed using default settings or using the BNW <a href="help.php#constraint_interface">structural constraint interface</a>. The "Remove variables from data set" button can be used to edit input files. This option may be useful for examining the impact of specific variables on network structures.<br><br>
+  Finally, a table describing the file uploaded to BNW is provided that can be inspected to ensure that the input file was properly interpreted. This table is described in more detail <a href=#input_check>here<a>.<br><br> 
+</td></tr>
+</table>
+
+
+<br>
+<table>
+<tr>
+<a name=network_structure><h2>2. Network structure page</h2></a>
+</tr>
+<br>
+<tr><td>
+  <p align="justify">This page displays the network structure learned from the loaded data file. If model averaging was used to determine the network structure, the weights of edges after model averaging can be viewed by clicking "Network image options" and "Show network with edge weights". Users should also note the three letter network ID code in the upper left of the page. This code can be used to return to the network in the future. However, files stored on BNW are cleared periodically, and users should download the Structure Matrix, as described <a href="#matrix">here</a>, to ensure that they can return to a specific network structure in the future.<br><br>
+  After viewing the network structure, users have four main options. First, clicking "Use network to make predictions" goes to a more detailed view of the network that can be used to quickly investigate how network variables respond to interventions.<br><br>
+  Second, the "Network image options" menu allows users to save the network image as a PNG or SVG file. If model averaging was used during structure learning, the weights of network edges can be added to the network image<br><br>
+  Third, users can learn more about the network structure and parameters, or check to make sure the input file was properly processed by BNW.<br><br>
+  Fourth, the network structure can be modified by either directly adding or removing specific edges, changing the settings used during structure learning, or removing variables from the data set.<br><br>
+</td></tr>
+</table>
+
+<br>
+<table>
+<tr>
+<a name=network_predictions><h2>3. Network predictions page</h2></a>
+</tr>
+<br>
+<tr><td>
+  <p align="justify">This page is the main way in which users can use the network to make predictions about how observed evidence or interventions impact the other variables in the network. Users can switch between "Evidence" and "Intervention" modes by clicking the appropriate button. These modes are described more fully <a href=help.php#param_learn>here</a>. Entered evidence or interventions can be removed by clicking "Clear evidence".<br><br>
+  Leave-one-out cross-validation, k-fold cross validation, and predictions of an uploaded test set can be performed using the network after clicking on "Cross validations and predictions".<br><br>
+  Users can also access network parameters and violin plots of the distributions of the network under the "More about network" menu. If evidence/intervention has been entered in the network, parameters and violin plots that consider this information are also provided, providing additional quantification and visualization of the impact of the added evidence/intervention.<br><br>
+</td></tr>
+</table>
+
+
+
+<br>
+<table>
+<tr>
+<a name=input_check><h2>4. Input processing page</h2></a>
+</tr>
+<br>
+<tr><td>
+  <p align="justify">The main goal of this page is to allow users to ensure that input files have been uploaded and processed correctly.  The title of the table indicates if any variables or cases (rows) were automatically removed by BNW. Variables would be removed by BNW if all cases contained the same value. Cases would be removed if they contained missing data (i.e., at least one of the variables in the case had a value of 'NA').<br><br>
+  The table has 4 columns:<br>
+- The name of each variable in the input file.<br>
+- The type of the variable as determined by BNW.<br>
+- The number of states for discrete variables or the mean and standard deviation for continuous variables.<br>
+- A brief explanation for why the variable was classified as discrete or continuous.<br><br>
+</td></tr>
+</table>
+
+
+
+<br>
+<table>
+<tr>
+<a name=matrix><h2>5. Structure matrix</h2></a>
+</tr>
+<br>
+<tr><td>
+  <p align="justify">This page provides the structure matrix, a table containing the network structure learned from the data. A '1' in the table indicates that a directed edge going from the row variable to the column variable is present in the network. In other words, the row variable is the parent, while the column variable is the child.<br><br>
+The structure matrix can be downloaded by clicking the link under the structure matrix. Users can upload the structure matrix file to BNW in the future to return to the network and make additional predictions.<br><br>
+  If model averaging was performed when learning the structure, a second table on the page provides the model averaging scores of the directed edges in the network. Model averaging is further described <a href=help.php#learn_details>here</a>.<br><br>
+</td></tr>
+</table>
+
+
+<br>
+<table>
+<tr>
+<a name=parameters><h2>6. Network parameters</h2></a>
+</tr>
+<br>
+<tr><td>
+  <p align="justify">This page provides a table with the network parameters for each variable in the network. For discrete variables, the probability of each possible state is shown. For continuous variables, means and standard deviations of Gaussian distributions are provided. If the continuous variable has one or more discrete parents, it is described by a mixture of Gaussian distributions, and the corresponding table contains the weights of these Gaussian distributions.<br><br>
+  If evidence or intervention has been used to make predictions in the network, there is a second set of parameter tables. These tables provide the parameters considering entered evidence or intervention values.<br><br>
+</td></tr>
+</table>
+
+
+</table>
+
+
+<br>
+<br>
+
+<br>
+
+<table align="center" width="100%">
+<tr>
+<a name="contact"><h2>Contact us</h2></a>
+</tr>
+<tr>
+<td>
+Please send questions and comments to <a href=mailto:ycui2@uthsc.edu>Dr. Yan Cui</a> at University of Tennesee Health 
+Science Center.
+</td>
+</tr>
+</table>
+
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</div>
+</html>
diff --git a/sourcecodes/add_evd.php b/sourcecodes/add_evd.php
index c031ead6..50740d02 100644
--- a/sourcecodes/add_evd.php
+++ b/sourcecodes/add_evd.php
@@ -39,7 +39,9 @@ foreach($leve_l as $l)
 function mapid($name,$keyval)
 {
 
-$dir="./data/";
+  //$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 $nm=$dir.$keyval."mapdata.txt";
 $namelist=file_get_contents("$nm");
 
@@ -65,7 +67,9 @@ return $val;
 }
 
 
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $lfile=$dir.$keyval."nlevels.txt";
 $dmapdata=file_get_contents($lfile);   
diff --git a/sourcecodes/add_evd_example.php b/sourcecodes/add_evd_example.php
deleted file mode 100644
index cc393c0b..00000000
--- a/sourcecodes/add_evd_example.php
+++ /dev/null
@@ -1,195 +0,0 @@
-<?php 
-include("input_validate.php");
-$keyval=valid_keyval(trim($_GET['My_key']));
-
-//include("restructuremap.php");
-
-
-function discretemap($textdata,$sym,$dmapdata)
-{
-$textdata=trim($textdata);
-$leve_l=array();
-$leve_l=explode("\n",$dmapdata);
-$leve_d=array();
-
-foreach($leve_l as $l)
-{ 
-  $l=trim($l);
-  $leve_d=explode("\t",$l);
-  $inxname=trim($leve_d[0]);
-  $name=trim($sym);
-  if($inxname==$name)
-  {    $i=0;
-       foreach($leve_d as $d)
-       { 
-         $d=trim($d);
-         if($d==$textdata)
-             return $i;
-         $i++;
-       }
-  } 
-}
-
-}
-
-
-
-
-
-function mapid($name,$keyval)
-{
-
-$dir="./data/";
-$nm=$dir.$keyval."mapdata.txt";
-$namelist=file_get_contents("$nm");
-
-$str_arrname=array();
-$str_arrname=explode("\n",$namelist);
-$dataname=array();
-$dataname=explode("\t",$str_arrname[0]);
-$i=1;
-
- foreach($dataname as $cell)
- {
-   $cell=trim($cell);
-   if($cell==$name)
-   {
-    $val=$i;
-    break;      
-   }
-    $i++;
- }
-
-return $val;
-
-}
-
-
-$dir="./data/";
-
-$lfile=$dir.$keyval."nlevels.txt";
-$dmapdata=file_get_contents($lfile);   
-
-
-$sym=trim($_GET['name']);
-
-$textdata=$_GET['evidence'];
-$ft=$dir.$keyval."var.txt";
-$fpvar = file_get_contents("$ft");
-$ft=$dir.$keyval."vardata.txt";
-$fpdata  = file_get_contents("$ft");
-$ft=$dir.$keyval."varname.txt";
-$fpvarname  = file_get_contents("$ft");
-
-$vriable=mapid($sym,$keyval);
-
-$ft=$dir.$keyval."type.txt";
-$type = file_get_contents("$ft");
-$type_r=array();
-$type_r=explode("\n",$type);
-$type_n=array();
-$type_n=explode("\t",$type_r[0]);
-$type_d=array();
-$type_d=explode("\t",$type_r[1]);
-
-$nn=count($type_n);
-
-for($j=0;$j<$nn;$j++)
-{   
-   $dn=$type_n[$j];
-   $sym=trim($sym);
-   $dn=trim($dn); 
-   if($dn==$sym)
-     $s=$j;
-} 
-
-$dt=$type_d[$s];
-
-if($dt!=1)
-   $textdata=discretemap($textdata,$sym,$dmapdata);
-
- $ft=$dir."$keyval"."var.txt"; 
- $f1=fopen("$ft","w");  
- $ft=$dir."$keyval"."vardata.txt";
- $f2=fopen("$ft","w");  
- $ft=$dir."$keyval"."varname.txt";
- $f3=fopen("$ft","w");
-
-
-$pos = strpos($fpvarname, $sym);
-
-if($fpvarname=="")
-{
-  fwrite($f1,$vriable);
-  fwrite($f2,$textdata);
-  fwrite($f3,$sym);
-
-}
-else 
-{
-  if ($pos === false)// append at buttom as new records 
-  {
-  
-     $fpvar=$fpvar."\t".$vriable;
-     fwrite($f1,$fpvar);
-
-     $fpdata=$fpdata."\t".$textdata;
-     fwrite($f2,$fpdata);
-
-     $fpvarname=$fpvarname."\t".$sym;
-     fwrite($f3,$fpvarname);
-
-  }
-  else 
-  {
-     $cld=explode("\t",$fpvarname);
-     $j=0;
-     $inx=0;
-     foreach($cld as $cc)
-     {
-        $cc=trim($cc);
-        if($cc==$sym)
-        {
-              $inx=$j;
-        } 
-        $j++;
-    
-     }
-
- 
-     fwrite($f1,$fpvar);
-     fwrite($f3,$fpvarname);
-
-     $cld1=explode("\t",$fpdata);
-     $j=0;
-     $dataw="";
-     foreach($cld1 as $cc)
-     {
-        $cc=trim($cc);
-        if($j==$inx)
-        {
-              $inx=$j;
-              fprintf($f2,"%s\t",$textdata);
-        }
-        else 
-        {          
-              fprintf($f2,"%s\t",$cc);
-        }
-        
-        $j++;
-    
-     }
-
-   }
-
-}
-
- 
-  //execute shell script for matlab
-  $keyval = valid_keyval($keyval);
-  shell_exec('./run_scripts/run_octave_evd '.$keyval);
-
-?>
-<script>
-window.open("network_layout_evd_2_example.php?My_key=<?php print($keyval);?>",'_self',false);
-</script>
diff --git a/sourcecodes/add_inv.php b/sourcecodes/add_inv.php
index 4fe0fa10..013ba61e 100644
--- a/sourcecodes/add_inv.php
+++ b/sourcecodes/add_inv.php
@@ -34,7 +34,9 @@ foreach($leve_l as $l)
 function mapid($name,$keyval)
 {
 
-$dir="./data/";
+  //$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $nm=$dir."$keyval"."mapdata.txt";
 $namelist=file_get_contents("$nm");
@@ -61,7 +63,9 @@ return $val;
 }
 
 
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $lfile=$dir.$keyval."nlevels.txt";
 $dmapdata=file_get_contents($lfile);
@@ -218,12 +222,13 @@ $dataname=array();
 $dataname=explode("\t",$str_arrmat[0]);
 $n=count($dataname);
 
-$initialstring="digraph G {\n"."size=\"10,10\";  ratio = fill;\n"."node [shape=square,width=1.5];\n";
+$initialstring="digraph G {\n"."size=\"6,8\";  ratio = fill;\n"."node [shape=square,width=1.5];\n";
 $endstring="}";
 fwrite($fout,"$initialstring");
 
 
-$g_file_name="./data/".$keyval."grviz_name_file_new.txt";
+//$g_file_name="./data/".$keyval."grviz_name_file_new.txt";
+$g_file_name=$dir.$keyval."grviz_name_file_new.txt";
 $grviz_name_file=fopen($g_file_name,"w");
 
 for($i=0;$i<$n;$i++)
diff --git a/sourcecodes/add_inv_example.php b/sourcecodes/add_inv_example.php
deleted file mode 100644
index 74c8547c..00000000
--- a/sourcecodes/add_inv_example.php
+++ /dev/null
@@ -1,254 +0,0 @@
-<?php 
-  //include("restructuremap.php");
-include("input_validate.php");
-$keyval=valid_keyval($_GET["My_key"]);
-
-function discretemap($textdata,$sym,$dmapdata)
-{
-$textdata=trim($textdata);
-$leve_l=array();
-$leve_l=explode("\n",$dmapdata);
-$leve_d=array();
-
-foreach($leve_l as $l)
-{ 
-  $l=trim($l);
-  $leve_d=explode("\t",$l);
-  $inxname=trim($leve_d[0]);
-  $name=trim($sym);
-  if($inxname==$name)
-  {    $i=0;
-       foreach($leve_d as $d)
-       { 
-         $d=trim($d);
-         if($d==$textdata)
-             return $i;
-         $i++;
-       }
-  } 
-}
-
-}
-
-
-function mapid($name,$keyval)
-{
-
-$dir="./data/";
-
-$nm=$dir."$keyval"."mapdata.txt";
-$namelist=file_get_contents("$nm");
-
-$str_arrname=array();
-$str_arrname=explode("\n",$namelist);
-$dataname=array();
-$dataname=explode("\t",$str_arrname[0]);
-$i=1;
-
- foreach($dataname as $cell)
- {
-   $cell=trim($cell);
-   if($cell==$name)
-   {
-    $val=$i;
-    break;      
-   }
-    $i++;
- }
-
-return $val;
-
-}
-
-
-$dir="./data/";
-
-$lfile=$dir.$keyval."nlevels.txt";
-$dmapdata=file_get_contents($lfile);
-
-
-$sym=trim($_GET['name']);
-
-$textdata=$_GET['evidence'];
-$ft=$dir.$keyval."var.txt";
-$fpvar = file_get_contents("$ft");
-$ft=$dir.$keyval."vardata.txt";
-$fpdata  = file_get_contents("$ft");
-$ft=$dir.$keyval."varname.txt";
-$fpvarname  = file_get_contents("$ft");
-
-$vriable=mapid($sym,$keyval);
-$ft=$dir.$keyval."type.txt";
-$type = file_get_contents("$ft");
-
-$type_r=array();
-$type_r=explode("\n",$type);
-$type_n=array();
-$type_n=explode("\t",$type_r[0]);
-$type_d=array();
-$type_d=explode("\t",$type_r[1]);
-
-$nn=count($type_n);
-
-for($j=0;$j<$nn;$j++)
-{   
-   $dn=$type_n[$j];
-   $sym=trim($sym);
-   $dn=trim($dn); 
-   if($dn==$sym)
-     $s=$j;
-} 
-
-$dt=$type_d[$s];
-
-if($dt!=1)
-   $textdata=discretemap($textdata,$sym,$dmapdata);
-
-
-
-
- $ft=$dir.$keyval."var.txt"; 
- $f1=fopen("$ft","w");  
- $ft=$dir.$keyval."vardata.txt";
- $f2=fopen("$ft","w");  
- $ft=$dir.$keyval."varname.txt";
- $f3=fopen("$ft","w");
-
-
-$pos = strpos($fpvarname, $sym);
-
-if($fpvarname=="")
-{
-  fwrite($f1,$vriable);
-  fwrite($f2,$textdata);
-  fwrite($f3,$sym);
-
-}
-else 
-{
-  if ($pos === false)// append at buttom as new records 
-  {
-  
-     $fpvar=$fpvar."\t".$vriable;
-     fwrite($f1,$fpvar);
-
-     $fpdata=$fpdata."\t".$textdata;
-     fwrite($f2,$fpdata);
-
-     $fpvarname=$fpvarname."\t".$sym;
-     fwrite($f3,$fpvarname);
-
-  }
-  else 
-  {
-     $cld=explode("\t",$fpvarname);
-     $j=0;
-     $inx=0;
-     foreach($cld as $cc)
-     {
-        $cc=trim($cc);
-        if($cc==$sym)
-        {
-              $inx=$j;
-        } 
-        $j++;
-    
-     }
-
- 
-     fwrite($f1,$fpvar);
-     fwrite($f3,$fpvarname);
-
-     $cld1=explode("\t",$fpdata);
-     $j=0;
-     $dataw="";
-     foreach($cld1 as $cc)
-     {
-        $cc=trim($cc);
-        if($j==$inx)
-        {
-              $inx=$j;
-              fprintf($f2,"%s\t",$textdata);
-        }
-        else 
-        {          
-              fprintf($f2,"%s\t",$cc);
-        }
-        
-        $j++;
-    
-     }
-
-   }
-
-}
-
-include("mat_structure.php");
-$keyval = valid_keyval($keyval);
-structure_change($keyval);
-
-
-
-
-
-//  $file1="./data/".$keyval."run_newintervention.sh";
-//  $initiallines=file_get_contents("./data/temp_intervention_file");
-//  $all_lines="$initiallines"."$keyval\nfi\nexit";
-
-//  $fp = fopen($file1,"w"); 
-//  fwrite($fp, "$all_lines\n");
-//  fclose($fp);
-  //execute shell script for matlab
- // $cmd="./runmat_inv.sh $keyval";
-//  system($cmd);
-shell_exec('./run_scripts/run_octave_inv '.$keyval);
-
-
-
-
-$matfile=$dir.$keyval."structure_input_new.txt";
-
-$fout=fopen($dir.$keyval."graphviz_new.txt","w");
-$matrix1=file_get_contents("$matfile");           
-$str_arrmat=array();
-$str_arrmat=explode("\n",$matrix1);
-$datamat=array();
-$data_cell=array(); 
-
-$dataname=array();
-$dataname=explode("\t",$str_arrmat[0]);
-$n=count($dataname);
-
-$initialstring="digraph G {\n"."size=\"10,10\";  ratio = fill;\n"."node [shape=square,width=1.5];\n";
-$endstring="}";
-fwrite($fout,"$initialstring");
-
-for($i=1;$i<=$n;$i++)
-{
-         $ii=$i-1; 
-         $row_name=trim($dataname[$ii]);  
-
- 
-         $col_arr=explode("\t",$str_arrmat[$i]);
-        
-        
-	   for($j=0;$j<$n;$j++)
-	   {
-               $col_val=trim($col_arr[$j]);
-               if($col_val==1)
-               { 
-                  $col_name=trim($dataname[$j]);
-                  fprintf($fout,"%s -> %s;\n",$row_name,$col_name);  
-
-                 
-	        }
-          }
-          
-     
-} 
-fwrite($fout,"$endstring");   
-
-?>
-<script>
-window.open("network_layout_inv_2_example.php?My_key=<?php print($keyval);?>",'_self',false);
-</script>
diff --git a/sourcecodes/add_remove_howto.htm b/sourcecodes/add_remove_howto.htm
new file mode 100644
index 00000000..cb4add2c
--- /dev/null
+++ b/sourcecodes/add_remove_howto.htm
@@ -0,0 +1,359 @@
+<html xmlns:v="urn:schemas-microsoft-com:vml"
+xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 12">
+<meta name=Originator content="Microsoft Word 12">
+<link rel=File-List href="BNW_workflow_test_files/filelist.xml">
+<link rel=Edit-Time-Data href="BNW_workflow_test_files/editdata.mso">
+<link rel=themeData href="BNW_workflow_test_files/themedata.thmx">
+<link rel=colorSchemeMapping
+href="BNW_workflow_test_files/colorschememapping.xml">
+<style>
+<!--
+ /* Font Definitions */
+ @font-face
+	{font-family:"Cambria Math";
+	panose-1:2 4 5 3 5 4 6 3 2 4;
+	mso-font-charset:1;
+	mso-generic-font-family:roman;
+	mso-font-format:other;
+	mso-font-pitch:variable;
+	mso-font-signature:0 0 0 0 0 0;}
+@font-face
+	{font-family:Calibri;
+	panose-1:2 15 5 2 2 2 4 3 2 4;
+	mso-font-charset:0;
+	mso-generic-font-family:swiss;
+	mso-font-pitch:variable;
+	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
+@font-face
+	{font-family:Tahoma;
+	panose-1:2 11 6 4 3 5 4 4 2 4;
+	mso-font-charset:0;
+	mso-generic-font-family:swiss;
+	mso-font-pitch:variable;
+	mso-font-signature:-520081665 -1073717157 41 0 66047 0;}
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+	{mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-parent:"";
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:10.0pt;
+	margin-left:0in;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
+	{mso-style-noshow:yes;
+	mso-style-priority:99;
+	mso-style-link:"Balloon Text Char";
+	margin:0in;
+	margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:8.0pt;
+	font-family:"Tahoma","sans-serif";
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;}
+p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
+	{mso-style-priority:34;
+	mso-style-unhide:no;
+	mso-style-qformat:yes;
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:10.0pt;
+	margin-left:.5in;
+	mso-add-space:auto;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
+	{mso-style-priority:34;
+	mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-type:export-only;
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:0in;
+	margin-left:.5in;
+	margin-bottom:.0001pt;
+	mso-add-space:auto;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
+	{mso-style-priority:34;
+	mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-type:export-only;
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:0in;
+	margin-left:.5in;
+	margin-bottom:.0001pt;
+	mso-add-space:auto;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
+	{mso-style-priority:34;
+	mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-type:export-only;
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:10.0pt;
+	margin-left:.5in;
+	mso-add-space:auto;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+span.BalloonTextChar
+	{mso-style-name:"Balloon Text Char";
+	mso-style-noshow:yes;
+	mso-style-priority:99;
+	mso-style-unhide:no;
+	mso-style-locked:yes;
+	mso-style-link:"Balloon Text";
+	mso-ansi-font-size:8.0pt;
+	mso-bidi-font-size:8.0pt;
+	font-family:"Tahoma","sans-serif";
+	mso-ascii-font-family:Tahoma;
+	mso-hansi-font-family:Tahoma;
+	mso-bidi-font-family:Tahoma;}
+.MsoChpDefault
+	{mso-style-type:export-only;
+	mso-default-props:yes;
+	font-size:10.0pt;
+	mso-ansi-font-size:10.0pt;
+	mso-bidi-font-size:10.0pt;
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+@page WordSection1
+	{size:8.5in 11.0in;
+	margin:1.0in 1.0in 1.0in 1.0in;
+	mso-header-margin:.5in;
+	mso-footer-margin:.5in;
+	mso-paper-source:0;}
+div.WordSection1
+	{page:WordSection1;}
+ /* List Definitions */
+ @list l0
+	{mso-list-id:779757819;
+	mso-list-type:hybrid;
+	mso-list-template-ids:939584274 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l0:level1
+	{mso-level-text:"%1\)";
+	mso-level-tab-stop:none;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level2
+	{mso-level-tab-stop:1.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level3
+	{mso-level-tab-stop:1.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level4
+	{mso-level-tab-stop:2.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level5
+	{mso-level-tab-stop:2.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level6
+	{mso-level-tab-stop:3.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level7
+	{mso-level-tab-stop:3.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level8
+	{mso-level-tab-stop:4.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level9
+	{mso-level-tab-stop:4.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1
+	{mso-list-id:1813714603;
+	mso-list-type:hybrid;
+	mso-list-template-ids:939584274 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l1:level1
+	{mso-level-text:"%1\)";
+	mso-level-tab-stop:none;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level2
+	{mso-level-tab-stop:1.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level3
+	{mso-level-tab-stop:1.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level4
+	{mso-level-tab-stop:2.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level5
+	{mso-level-tab-stop:2.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level6
+	{mso-level-tab-stop:3.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level7
+	{mso-level-tab-stop:3.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level8
+	{mso-level-tab-stop:4.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level9
+	{mso-level-tab-stop:4.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+ol
+	{margin-bottom:0in;}
+ul
+	{margin-bottom:0in;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=WordSection1>
+
+
+<p class=MsoNormal style='margin-right:107.5pt'><b style='mso-bidi-font-weight:
+normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>Network modification interface<o:p></o:p></span></b></p>
+
+<p class=MsoNormal style='margin-right:107.5pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif"'>
+This page provides an overview of the interface used to add or remove edges from network structures in BNW. Two potential cases when this process may be useful are (1) investigating how a specific edge impacts the predictions of the network or (2) changing the edge weight threshold that was used to select edges to include in the network after model averaging.
+<br><br>
+Network structures can be modified in three ways: a new edge can be added to the network, a selected edge can be removed from the network, and, if model averaging of high scoring network structures was performed, the edge selection threshold can be increased. These options are discussed in detail below.<br>
+<br> After modifying the network structure as desired, clicking <u>Use modified network</u> on the right menu will go to the options for interacting with the network in BNW. Additionally, an image of the network within the interface can be saved by clicking on the <u>Save network as PNG</u> button.
+<br><br>
+The original network model that will be used to show the options for modifying a network structure is shown below, where the numbers next to the network edges indicate the edge weights after model averaging of the 1000 highest scoring network structures:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<img width=220 height=267 src="BNW_workflow_test_files/add_remove_original_network.png">
+<br><br>
+This network is initially displayed in the network modification interface as shown below. The nodes of the network can be rearranged by clicking and dragging on the node.<br>
+<img width=758 height=314 src="BNW_workflow_test_files/add_remove_original_interface.png">
+
+<o:p></o:p></span></p>
+<p class=MsoNormal style='margin-right:107.5pt'><b style='mso-bidi-font-weight:
+normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>1. Adding edges to networks<o:p></o:p></span></b></p>
+
+<p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif"'>Network edges can be added to the network by clicking on the nodes of the network that should be connected and clicking <u>Add edge between selected nodes</u> on the left menu. Here, we will add an edge from <b>MAS</b> to <b>Weight</b>. First, click on <b>MAS</b>, the variable that is the source of the edge. The <b>MAS</b> node is now highlighted with green:<br>
+<img width=758 height=314 src="BNW_workflow_test_files/add_remove_MAS.png">
+<br><br>
+Next, click on <b>Weight</b>, the node that will be at the end of the desired edge. This node now has a red border:
+<img width=758 height=314 src="BNW_workflow_test_files/add_remove_Weight.png">
+<br><br>
+Finally, clicking <u>Add edge between selected nodes</u> will add the edge between these node, from <b>MAS</b> to <b>Weight</b>:<br>
+<img width=758 height=314 src="BNW_workflow_test_files/add_remove_new_edge.png"><br><br>
+
+
+<o:p></o:p></span></p>
+<p class=MsoNormal style='margin-right:107.5pt'><b style='mso-bidi-font-weight:
+normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>2. Remove selected edges<o:p></o:p></span></b></p>
+
+<p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif"'>
+Here, we will remove the edge from <b>MAS</b> to <b>Load</b> from the network, starting from the network structure above. First, click on this edge in the network. This edge is now red and has a dashed line:<br>
+<img width=758 height=314 src="BNW_workflow_test_files/add_remove_red_edge.png"><br><br>
+Now, click on <u>Remove selected edges</u> on the left menu to remove this edge:<br>
+<img width=758 height=314 src="BNW_workflow_test_files/add_remove_removed.png"><br><br>
+
+<o:p></o:p></span></p>
+<p class=MsoNormal style='margin-right:107.5pt'><b style='mso-bidi-font-weight:
+normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>3. Change edge weight threshold<o:p></o:p></span></b></p>
+
+<p class=MsoNormal style='margin-top:0in;margin-right:107.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif"'>
+Third, the network structure can be modified by changing the edge weight threshold. Only network edges whose weights are above this threshold are included in the network. This is accomplished using the <u>Filter edges by weight</u> slider on the left menu. In this example, the edge weight selection threshold used when learning the network structure was 0.5. Thus, the value of the edge weight filter is originally set to 0.5. Moving the slider to 0.9 increases the edge weight threshold accordingly, removing two edges (<b>Ctrq3</b> to <b>Weight</b> and <b>MAS</b> to <b>Neutrophil</b>) from the network:
+<img width=758 height=314 src="BNW_workflow_test_files/add_remove_filter.png"><br><br>
+
+Finally, clicking on <u>Use modified network</u> returns to the main BNW network image view with the modified network structure:
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<img width=388 height=255 src="BNW_workflow_test_files/add_remove_final.png">
+<br><br><br><br>
+<o:p></o:p></span></p><br>
+
+
+</div>
+
+</body>
+
+</html>
diff --git a/sourcecodes/bn_after_upload_gom.php b/sourcecodes/bn_after_upload_gom.php
index d7435cfd..11a92650 100644
--- a/sourcecodes/bn_after_upload_gom.php
+++ b/sourcecodes/bn_after_upload_gom.php
@@ -1,8 +1,16 @@
+<meta charset="utf-8">
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+
 <?php
+   // This file is copied form bn_file_load_gom.php with some lines commented out.
+   //It is used by modify_structure_learning.php to copy the input file over
+   // and begin structure learning.
+
   //Going to modify this so it just writes the uploaded data to a file.
   //Standardization and determining other factors will be performed in
   //  a Matlab/Octave script.
-
+//<link rel="stylesheet" href="./scripts/table.css" type="text/css">
 include("header_new.inc");
 include("header_batchsearch.inc");
 include("runtime_check.php");
@@ -10,7 +18,7 @@ include("input_validate.php");
 //$searchID="";
 $searchID="YES";
 $UploadValue="NO";
-$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
+$TextFile=$_FILES["MyFile"]["name"];
 
 
 /////////////Generate a random key/////////////////////
@@ -30,14 +38,16 @@ $TextFile=$HTTP_POST_FILES["MyFile"]["name"];
 //  $keyval=valid_keyval($keyval);
 
 //$sid=$keyval."continuous_input";
-//$dir="./data/";
+////$dir="./data/";
+//$dir="/tmp/bnw/";
+//$input_table_file="./data/".$keyval."input_table.txt";
 
 //$TextinFile=$dir.$sid."_orig.txt";
 
 
-if(isset($HTTP_POST_VARS["searchkey"]))
+if(isset($_POST["searchkey"]))
 {
-   $searchID=$HTTP_POST_VARS["searchkey"];
+   $searchID=$_POST["searchkey"];
 
 }
 
@@ -46,8 +56,10 @@ if($searchID=="")
 ?>
 
 <!-- Site navigation menu -->
-<ul class="navbar">
+<ul class="navbar2">
+  <li><a href="sample_input.php" target="_blank">View sample input file</a> 
   <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
+  <li><a href="about_this_page.php#file_upload" target="_blank">About this page</a>
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
 </ul>
@@ -55,15 +67,15 @@ if($searchID=="")
 }
 
 
-if(isset($HTTP_POST_VARS["MyUpload"]))
+if(isset($_POST["MyUpload"]))
 {
-   $UploadValue=$HTTP_POST_VARS["MyUpload"];
+   $UploadValue=$_POST["MyUpload"];
    if ($UploadValue=="YES")
    {
         if($TextFile!="")
         {
 	  //	  $TextFile = valid_input($TextFile);
-            $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
+            $sta=move_uploaded_file($_FILES['MyFile']['tmp_name'],$TextinFile);
             if(!$sta)
             {
                  echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>";
@@ -88,57 +100,29 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
 
 ?>
 <div id="outernew">
-<h2><font color=#33339f>Upload data file for structure learning search</font></h2>
-<FORM name="key_search" enctype="multipart/form-data" ACTION="bn_file_load_gom.php" METHOD=POST>
-
-<table align="left" cellspacing="3" cellpadding="1" border="0"  width="60%">
-<tr>
-<td>
-<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 > 
-<INPUT TYPE="submit" value="  Upload  " onclick="return Upload();">
+  <h3>Upload data file for structure learning search:</h3>
+<br>
+<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="bn_file_load_gom.php" METHOD=POST>
+
+<INPUT style="background-color:#FFFFFF;" type="file" name="MyFile" id="MyFile_id" class="inputfile" onchange="upload_submit()" >
+<label for="MyFile_id">Choose a file. . .</label> 
 <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
 <INPUT TYPE="hidden" name="MyUpload" value="NO"> 
-</td>
-</tr>
-<tr>
-<td align="left"><font color=#33339f><br>Content of uploaded data file:</font><br>
-          <textarea name="searchkey" rows="8" cols="100"><?PHP print($searchID)?> </textarea>
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load example data of immune responses to infection with Chlamydia psittaci  " onclick="return demochl();">&nbsp&nbsp&nbsp
-<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load example data of a synthetic genetic network with 2 genotypes and 6 traits  " onclick="return demo8nodes();">&nbsp&nbsp&nbsp
-<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load example data of immune-related gene in the spleens of BXD mice  " onclick="return demospnl();">&nbsp&nbsp&nbsp
-<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load the ksl dataset from deal  " onclick="return demoksl();">&nbsp&nbsp&nbsp
-<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load the rat dataset from deal  " onclick="return demorat();">&nbsp&nbsp&nbsp
-<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-</table>
+<textarea name="searchkey" style="display:none;"><?PHP print($searchID)?> </textarea>
+<br>
+<br>
+<br>
 </FORM>
 </div>
 
+<script>
+  function upload_submit() {
+    Upload();
+    document.getElementById("in_form").submit();
+  }
+</script>
+
+
 <?php
 
 if($searchID!="")
@@ -151,27 +135,44 @@ if($searchID!="")
   //$keyval = valid_keyval($keyval);
   //shell_exec('./run_scripts/run_prep_input '.$keyval);
   $keyval=valid_keyval($_GET["My_key"]);
+  $input_table_file="/var/lib/genenet/bnw/".$keyval."input_table.txt";
   $parent_number=4;
   $k_number=1;
   $runtime=exe_time($keyval,$parent_number,$k_number);
 ?>
 <ul class="navbar2">
-  <li><a href="executionprogress.php?My_key=<?php print($keyval);?>">Perform Bayesian network modeling using default settings</a>
-  <li><a href="create_tiers_gom.php?My_key=<?php print($keyval);?>">Go to structure learning settings and the BNW structural constraint interface</a>  
-  <li><a href="remove_variables.php?My_key=<?php print($keyval);?>">Remove variables from data set</a>  
-  <li><a href="javascript:void(0);"
-NAME="InputCheck" title="InputCheck"
-    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Rat//ting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
-</ul>
-<ul class="navbar">
+<li><a href="about_this_page.php#file_upload" target="_blank">About this page</a>
 <li><a href="help.php" target="_blank">Help</a>
 <li><a href="home.php">Home</a>
 </ul>
-<div id="outernew">
-<p><h3><?php 
-print("Estimated run time for current dataset using default settings: $runtime seconds");
+<div id="outernew_load">
+<br>
+   <a class=button3 href="executionprogress_default.php?My_key=<?php print($keyval);?>">Perform Bayesian network modeling using default settings. Estimated runtime: <?php print($runtime);?> seconds</a>
+<br>
+<a class=button3 href="create_tiers_gom_part1.php?My_key=<?php print($keyval);?>">Go to structure learning settings and the BNW structural constraint interface</a>
+<br>
+<a class=button3 href="remove_variables.php?My_key=<?php print($keyval);?>">Remove variables from data set</a>  
+<br>
+<br>
+<p><h3>The uploaded data file has the following properties:
+<br></h3>
+<?php
+$table_text = json_encode(file("file://".$input_table_file));
 ?>
-<br><br><br><br></h3>
+  <div class="d3_table" id="table_div1">
+  <script type="text/javascript">
+   d3.text("", function(error, raw_temp){
+       var dsv = d3.dsvFormat("\t");
+         var data1 = <?php echo $table_text;?>;
+         var data2 = data1.join("");
+	 var data = dsv.parse(data2);
+	 var caption_text = data.pop();
+       if (error) throw error;
+       tabulate_caption("#table_div1",data,caption_text.Variable);
+     });
+</script>
+</div>
+<br><br><br></h3>
 </p>
 <br>
 <br>
@@ -180,6 +181,18 @@ print("Estimated run time for current dataset using default settings: $runtime s
 <br>
 <br>
 <br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
 </div>
 <?php
 }
diff --git a/sourcecodes/bn_file_load_gom.php b/sourcecodes/bn_file_load_gom.php
index 3f3ef195..d2480cd4 100644
--- a/sourcecodes/bn_file_load_gom.php
+++ b/sourcecodes/bn_file_load_gom.php
@@ -1,15 +1,19 @@
+<meta charset="utf-8">
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+
 <?php
   //Going to modify this so it just writes the uploaded data to a file.
   //Standardization and determining other factors will be performed in
   //  a Matlab/Octave script.
-
+//<link rel="stylesheet" href="./scripts/table.css" type="text/css">
 include("header_new.inc");
 include("header_batchsearch.inc");
 include("runtime_check.php");
 include("input_validate.php");
 $searchID="";
 $UploadValue="NO";
-$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
+$TextFile=$_FILES["MyFile"]["name"];
 
 
 /////////////Generate a random key/////////////////////
@@ -29,14 +33,18 @@ if($_POST["My_key"]!="")
   $keyval=valid_keyval($keyval);
 
 $sid=$keyval."continuous_input";
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+//$input_table_file="./data/".$keyval."input_table.txt";
+$input_table_file=$dir.$keyval."input_table.txt";
 
 $TextinFile=$dir.$sid."_orig.txt";
 
 
-if(isset($HTTP_POST_VARS["searchkey"]))
+if(isset($_POST["searchkey"]))
 {
-   $searchID=$HTTP_POST_VARS["searchkey"];
+   $searchID=$_POST["searchkey"];
 
 }
 
@@ -45,8 +53,10 @@ if($searchID=="")
 ?>
 
 <!-- Site navigation menu -->
-<ul class="navbar">
+<ul class="navbar2">
+  <li><a href="sample_input.php" target="_blank">View sample input file</a> 
   <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
+  <li><a href="about_this_page.php#file_upload" target="_blank">About this page</a>
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
 </ul>
@@ -54,15 +64,15 @@ if($searchID=="")
 }
 
 
-if(isset($HTTP_POST_VARS["MyUpload"]))
+if(isset($_POST["MyUpload"]))
 {
-   $UploadValue=$HTTP_POST_VARS["MyUpload"];
+   $UploadValue=$_POST["MyUpload"];
    if ($UploadValue=="YES")
    {
         if($TextFile!="")
         {
 	  //	  $TextFile = valid_input($TextFile);
-            $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
+            $sta=move_uploaded_file($_FILES['MyFile']['tmp_name'],$TextinFile);
             if(!$sta)
             {
                  echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>";
@@ -87,57 +97,45 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
 
 ?>
 <div id="outernew">
-<h2><font color=#33339f>Upload data file for structure learning search</font></h2>
-<FORM name="key_search" enctype="multipart/form-data" ACTION="bn_file_load_gom.php" METHOD=POST>
-
-<table align="left" cellspacing="3" cellpadding="1" border="0"  width="60%">
-<tr>
-<td>
-<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 > 
-<INPUT TYPE="submit" value="  Upload  " onclick="return Upload();">
+  <h3>Upload data file for structure learning search:</h3>
+<br>
+<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="bn_file_load_gom.php" METHOD=POST>
+
+<INPUT style="background-color:#FFFFFF;" type="file" name="MyFile" id="MyFile_id" class="inputfile" onchange="upload_submit()" >
+<label for="MyFile_id">Choose a file. . .</label> 
 <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
 <INPUT TYPE="hidden" name="MyUpload" value="NO"> 
-</td>
-</tr>
-<tr>
-<td align="left"><font color=#33339f><br>Content of uploaded data file:</font><br>
-          <textarea name="searchkey" rows="8" cols="100"><?PHP print($searchID)?> </textarea>
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load example data of immune responses to infection with Chlamydia psittaci  " onclick="return demochl();">&nbsp&nbsp&nbsp
-<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load example data of a synthetic genetic network with 2 genotypes and 6 traits  " onclick="return demo8nodes();">&nbsp&nbsp&nbsp
-<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load example data of immune-related gene in the spleens of BXD mice  " onclick="return demospnl();">&nbsp&nbsp&nbsp
+<textarea name="searchkey" style="display:none;"><?PHP print($searchID)?> </textarea>
+<br>
+<br>
+<br>
+<h3>Or load one of the example data sets below:</h3><br>
+<INPUT TYPE="submit" class=button2 value="  Load example data of immune responses to infection with Chlamydia psittaci  " onclick="return demochl();">
 <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load the ksl dataset from deal  " onclick="return demoksl();">&nbsp&nbsp&nbsp
+<br>
+<INPUT TYPE="submit" class=button2 value="  Load example data of a synthetic genetic network with 2 genotypes and 6 traits  " onclick="return demo8nodes();">
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?>> 
+<br>
+<INPUT TYPE="submit" class=button2 value="  Load example data of immune-related gene in the spleens of BXD mice  " onclick="return demospnl();">
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?>>
+<br>
+<INPUT TYPE="submit" class=button2 value="  Load the ksl dataset from deal  " onclick="return demoksl();">&nbsp&nbsp&nbsp
 <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-<tr>
-<td>
-<INPUT TYPE="submit" value="  Load the rat dataset from deal  " onclick="return demorat();">&nbsp&nbsp&nbsp
+<br>
+<INPUT TYPE="submit" class=button2 value="  Load the rat dataset from deal  " onclick="return demorat();">&nbsp&nbsp&nbsp
 <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-</td>
-</tr>
-</table>
+<br>
 </FORM>
 </div>
 
+<script>
+  function upload_submit() {
+    Upload();
+    document.getElementById("in_form").submit();
+  }
+</script>
+
+
 <?php
 
 if($searchID!="")
@@ -154,22 +152,38 @@ if($searchID!="")
   $runtime=exe_time($keyval,$parent_number,$k_number);
 ?>
 <ul class="navbar2">
-  <li><a href="executionprogress.php?My_key=<?php print($keyval);?>">Perform Bayesian network modeling using default settings</a>
-  <li><a href="create_tiers_gom.php?My_key=<?php print($keyval);?>">Go to structure learning settings and the BNW structural constraint interface</a>  
-  <li><a href="remove_variables.php?My_key=<?php print($keyval);?>">Remove variables from data set</a>  
-  <li><a href="javascript:void(0);"
-NAME="InputCheck" title="InputCheck"
-    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Rat//ting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
-</ul>
-<ul class="navbar">
+<li><a href="about_this_page.php#file_upload" target="_blank">About this page</a>
 <li><a href="help.php" target="_blank">Help</a>
 <li><a href="home.php">Home</a>
 </ul>
-<div id="outernew">
-<p><h3><?php 
-print("Estimated run time for current dataset using default settings: $runtime seconds");
+<div id="outernew_load">
+<br>
+   <a class=button3 href="executionprogress_default.php?My_key=<?php print($keyval);?>">Perform Bayesian network modeling using default settings. Estimated runtime: <?php print($runtime);?> seconds</a>
+<br>
+<a class=button3 href="create_tiers_gom_part1.php?My_key=<?php print($keyval);?>">Go to structure learning settings and the BNW structural constraint interface</a>
+<br>
+<a class=button3 href="remove_variables.php?My_key=<?php print($keyval);?>">Remove variables from data set</a>  
+<br>
+<br>
+<p><h3>The uploaded data file has the following properties:
+<br></h3>
+<?php 
+$table_text = json_encode(file("file://".$input_table_file));
 ?>
-<br><br><br><br></h3>
+  <div class="d3_table" id="table_div1">
+  <script type="text/javascript">
+   d3.text("", function(error, raw_temp){
+       var dsv = d3.dsvFormat("\t")
+	var data1 = <?php echo $table_text?> 
+        var data2 = data1.join("")
+ 	var data = dsv.parse(data2)
+	var caption_text = data.pop()
+       if (error) throw error;
+       tabulate_caption("#table_div1",data,caption_text.Variable);
+     });
+</script>
+</div>
+<br><br><br></h3>
 </p>
 <br>
 <br>
@@ -178,6 +192,18 @@ print("Estimated run time for current dataset using default settings: $runtime s
 <br>
 <br>
 <br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
 </div>
 <?php
 }
diff --git a/sourcecodes/clear.php b/sourcecodes/clear.php
index b06c9bc1..fee97d76 100644
--- a/sourcecodes/clear.php
+++ b/sourcecodes/clear.php
@@ -20,7 +20,6 @@ $al3=rand(0,51);
 $alpha="$alphas[$al1]"."$alphas[$al2]"."$alphas[$al3]";
 $keyval=valid_keyval($alpha);
 shell_exec('./filecopy.sh '.$oldkeyval.' '.$keyval);
-
 ?>
 <script>
 window.open("layout.php?My_key=<?php print($keyval);?>",'_self',false);
diff --git a/sourcecodes/clear_cv_pred.php b/sourcecodes/clear_cv_pred.php
new file mode 100644
index 00000000..59fbac29
--- /dev/null
+++ b/sourcecodes/clear_cv_pred.php
@@ -0,0 +1,9 @@
+<?php
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]);
+shell_exec('./delete_cv_pred.sh '.$keyval);
+
+?>
+<script>
+window.open("cv_predictions.php?My_key=<?php print($keyval);?>",'_self',false);
+</script>
diff --git a/sourcecodes/clear_example.php b/sourcecodes/clear_example.php
deleted file mode 100644
index c01a6f7e..00000000
--- a/sourcecodes/clear_example.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-include("input_validate.php");
-$oldkeyval=valid_keyval($_GET["My_key"]);
-//if (preg_match('/[^A-Za-z]/',$oldkeyval)) {
-//  echo "Key value must contain only uppercase or lowercase letters.";
-//  $oldkeyval='';
-//}
-
-/////////////Generate a random key/////////////////////
-$alphas=array();
-$alphas = array_merge(range('A', 'Z'), range('a', 'z'));
-
-$al1=rand(0,51);
-$al2=rand(0,51);
-$al3=rand(0,51);
-
-$alpha="$alphas[$al1]"."$alphas[$al2]"."$alphas[$al3]";
-$keyval=$alpha;
-$keyval=valid_keyval($keyval);
-shell_exec('./filecopy.sh '.$oldkeyval.' '.$keyval);
-
-?>
-<script>
-window.open("layout_example.php?My_key=<?php print($keyval);?>",'_self',false);
-</script>
diff --git a/sourcecodes/create_tiers_gom_part1.php b/sourcecodes/create_tiers_gom_part1.php
new file mode 100644
index 00000000..f2125367
--- /dev/null
+++ b/sourcecodes/create_tiers_gom_part1.php
@@ -0,0 +1,196 @@
+<?php 
+
+///////This code will allow users to group variables in tier. getcombineDescription() function combined all data and take you to "tier_description_processing_gom.php" for preparation of ban and whitelist //////////
+
+include("header_new.inc");
+include("runtime_check.php");
+include("input_validate.php");
+$keyval=$_GET["My_key"];
+
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+
+$type_n=array();
+
+//Get number of tier data and key value for changes in number of tier
+
+if(isset($_POST["nm_tier"]))
+{
+   $type_n=explode("|",$_POST["nm_tier"]);
+}
+else if(isset($_POST["nm_parent"]))
+{
+   $type_n=explode("|",$_POST["nm_parent"]);
+}
+else if(isset($_POST["nm_k"]))
+{
+   $type_n=explode("|",$_POST["nm_k"]);
+}
+else if(isset($_POST["nm_thr"]))
+{
+    $type_n=explode("|",$_POST["nm_thr"]);
+}
+
+$parent_number=trim($type_n[0]);   
+$k_number=trim($type_n[1]);   
+$tier_number=trim($type_n[2]);   
+$structure_thr=trim($type_n[3]);   
+
+
+if($keyval=="")
+  $keyval=$type_n[4];
+
+
+if($parent_number=="")
+{
+   $parent_number=4;
+}
+
+if($k_number=="")
+{
+   $k_number=1;
+}
+
+if($tier_number=="")
+{
+  $tier_number=3;
+}
+if($structure_thr=="")
+{
+  $structure_thr=0.5;
+}
+
+
+
+$nf=$dir.$keyval."nnode.txt";
+$node=trim(file_get_contents("$nf"));
+$maxplist=$node-1;
+
+//print default number of parents
+$pfile=$dir.$keyval."parent.txt";
+$parentf=fopen($pfile,"w");
+fwrite($parentf,"$parent_number\n");
+
+//print default number of k for model averaging
+$kfile=$dir.$keyval."k.txt";
+$kf=fopen($kfile,"w");
+fwrite($kf,"$k_number\n");
+
+//print model averaging threshold
+$thrfile=$dir.$keyval."thr.txt";
+$kf=fopen($thrfile,"w");
+fwrite($kf,"$structure_thr\n");
+
+//////////////////Check execution time//////////////////////////////////////////////
+$keyval=valid_keyval($keyval);
+$runtime=exe_time($keyval,$parent_number,$k_number);
+
+//print("Runtime is $runtime");
+
+?>
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><a href="input_check.php?My_key=<?php print($keyval);?>" target="_blank";>View uploaded variables and data</a>
+  <li><a href="help.php#constraint_interface" target="_blank">About this page</a>
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+<div id="outernew_sci">
+<br>
+<p><h3>Set structure learning settings:<br></h3>
+</p>
+<table align="center">
+<tr>
+<td align="left">
+Maximum number of parents for any node:
+</td>
+<td align="left"> 
+     <form method="post" action="create_tiers_gom_part1.php" name="form">
+  <SELECT style='font-size:16px' NAME="nm_parent"  onchange="form.submit();">
+      <?php if($node<=5) 
+            {
+               for($i=1;$i<=4;$i++)
+              {
+            ?>
+              <option value=<?php $combined=$i."|".$k_number."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($parent_number == $i) {print "selected";}?>><?php print($i)?></option>
+            <?php
+              }
+            }
+            else if($node<=10) 
+            {
+               for($i=1;$i<$node;$i++)
+              {
+            ?>
+              <option value=<?php $combined=$i."|".$k_number."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($parent_number == $i) {print "selected";}?>><?php print($i)?></option>
+            <?php
+              }
+            }
+            else
+            {
+               for($i=1;$i<=9;$i++)
+               {
+   
+                ?>
+                 <option value=<?php $combined=$i."|".$k_number."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($parent_number == $i) {print "selected";}?>><?php print($i)?></option>
+               <?php
+               }
+               ?>
+              <option value=<?php $combined=$maxplist."|".$k_number."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($parent_number == $maxplist) {print "selected";}?>>All</option>
+           <?php
+
+            }
+            
+     ?>  
+ 
+      </SELECT>
+   </form>
+</td>
+</tr>
+<tr>
+<td align="left">
+Number of networks to include in model averaging:
+</td>
+<td align="left"> 
+     <form method="post" action="create_tiers_gom_part1.php" name="form">
+      <SELECT style='font-size:16px' NAME="nm_k"  onchange="form.submit();">
+           <option selected value=<?php $combined=$parent_number."|"."1"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 1) {print "selected";}?>><?php print("1")?></option>
+           <option value=<?php $combined=$parent_number."|"."10"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 10) {print "selected";}?>><?php print("10")?></option>
+          <option value=<?php $combined=$parent_number."|"."50"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 50) {print "selected";}?>><?php print("50")?></option>
+          <option value=<?php $combined=$parent_number."|"."100"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 100) {print "selected";}?>><?php print("100")?></option>
+          <option value=<?php $combined=$parent_number."|"."500"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 500) {print "selected";}?>><?php print("500")?></option>
+          <option value=<?php $combined=$parent_number."|"."1000"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 1000) {print "selected";}?>><?php print("1000")?></option>
+      </SELECT>
+   </form>
+</td>
+</tr>
+<tr>
+<td align="left">
+Model averaging edge selection threshold:
+</td>
+<td align="left"> 
+     <form method="post" action="create_tiers_gom_part1.php" name="form">
+      <SELECT style='font-size:16px' NAME="nm_thr"  onchange="form.submit();">
+     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.5"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.5) {print "selected";}?>>0.5</option>
+     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.6"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.6) {print "selected";}?>>0.6</option>
+     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.7"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.7) {print "selected";}?>>0.7</option>
+     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.8"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.8) {print "selected";}?>>0.8</option>
+     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.9"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.9) {print "selected";}?>>0.9</option>
+     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."1.0"."|".$keyval; print($combined)?> <?php if($structure_thr == 1.0) {print "selected";}?>>1.0</option>
+    
+      </SELECT>
+   </form>
+</td>
+</tr>
+</table>
+</br>
+
+<p><h3><?php 
+print("Estimated run time for the current parameters: $runtime seconds");
+?>
+<br></h3>
+</p>
+<br>
+<a class=button3 href="create_tiers_gom_part2.php?My_key=<?php print($keyval);?>">Continue to assign variables to tiers</a>
+<br>
diff --git a/sourcecodes/create_tiers_gom.php b/sourcecodes/create_tiers_gom_part2.php
index 5f59ab5b..9bec2c88 100644
--- a/sourcecodes/create_tiers_gom.php
+++ b/sourcecodes/create_tiers_gom_part2.php
@@ -7,7 +7,9 @@ include("runtime_check.php");
 include("input_validate.php");
 $keyval=$_GET["My_key"];
 
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $type_n=array();
 
@@ -17,47 +19,17 @@ if(isset($_POST["nm_tier"]))
 {
    $type_n=explode("|",$_POST["nm_tier"]);
 }
-else if(isset($_POST["nm_parent"]))
-{
-   $type_n=explode("|",$_POST["nm_parent"]);
-}
-else if(isset($_POST["nm_k"]))
-{
-   $type_n=explode("|",$_POST["nm_k"]);
-}
-else if(isset($_POST["nm_thr"]))
-{
-    $type_n=explode("|",$_POST["nm_thr"]);
-}
 
-$parent_number=trim($type_n[0]);   
-$k_number=trim($type_n[1]);   
-$tier_number=trim($type_n[2]);   
-$structure_thr=trim($type_n[3]);   
+$tier_number=trim($type_n[0]);   
 
 
 if($keyval=="")
-  $keyval=$type_n[4];
-
-
-if($parent_number=="")
-{
-   $parent_number=4;
-}
-
-if($k_number=="")
-{
-   $k_number=1;
-}
+  $keyval=$type_n[1];
 
 if($tier_number=="")
 {
   $tier_number=3;
 }
-if($structure_thr=="")
-{
-  $structure_thr=0.5;
-}
 
 
 
@@ -65,144 +37,34 @@ $nf=$dir.$keyval."nnode.txt";
 $node=trim(file_get_contents("$nf"));
 $maxplist=$node-1;
 
-//print default number of parents
-$pfile=$dir.$keyval."parent.txt";
-$parentf=fopen($pfile,"w");
-fwrite($parentf,"$parent_number\n");
-
-//print default number of k for model averaging
-$kfile=$dir.$keyval."k.txt";
-$kf=fopen($kfile,"w");
-fwrite($kf,"$k_number\n");
-
-//print model averaging threshold
-$thrfile=$dir.$keyval."thr.txt";
-$kf=fopen($thrfile,"w");
-fwrite($kf,"$structure_thr\n");
 
 //////////////////Check execution time//////////////////////////////////////////////
 $keyval=valid_keyval($keyval);
-$runtime=exe_time($keyval,$parent_number,$k_number);
-
-//print("Runtime is $runtime");
-
 ?>
 <!-- Site navigation menu -->
 <ul class="navbar2">
-  <li><p onClick="getcombineDescription(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a href="javascript:void(0)" >Perform Bayesian network modeling</a></p>
-  <li><a href="javascript:void(0);"
-NAME="InputCheck" title="InputCheck"
-    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Rat//ting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
-</ul>
-<ul class="navbar">
-  <li><a href="help.php#constraint_interface" target="_blank">How to use this page</a>
+  <li><a href="input_check.php?My_key=<?php print($keyval);?>" target="_blank">View uploaded variables and data</a>
+  <li><a href="help.php#constraint_interface" target="_blank">About this page</a>
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
-
 </ul>
 
-<div id="outernew">
-<p><h3><?php 
-print("Estimated run time for the current parameters: $runtime seconds");
-?>
-<br><br></h3>
-</p>
+<div id="outernew_sci">
+<br>
+<p onClick="getcombineDescription(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a class=button3 href="javascript:void(0)" >Click here to perform Bayesian network modeling after creating tiers</a></p>
 <br>
-<p><h3>1. Global structure learning settings:<br><br></h3>
-</p>
 <table align="center">
 <tr>
 <td align="left">
-Maximum number of parents for any node:
+<h3>1. Set number of tiers:</h3>
 </td>
 <td align="left"> 
-     <form method="post" action="create_tiers_gom.php" name="form">
-      <SELECT NAME="nm_parent"  onchange="form.submit();">
-      <?php if($node<=5) 
-            {
-               for($i=1;$i<=4;$i++)
-              {
-            ?>
-              <option value=<?php $combined=$i."|".$k_number."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($parent_number == $i) {print "selected";}?>><?php print($i)?></option>
-            <?php
-              }
-            }
-            else if($node<=10) 
-            {
-               for($i=1;$i<$node;$i++)
-              {
-            ?>
-              <option value=<?php $combined=$i."|".$k_number."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($parent_number == $i) {print "selected";}?>><?php print($i)?></option>
-            <?php
-              }
-            }
-            else
-            {
-               for($i=1;$i<=9;$i++)
-               {
-   
-                ?>
-                 <option value=<?php $combined=$i."|".$k_number."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($parent_number == $i) {print "selected";}?>><?php print($i)?></option>
-               <?php
-               }
-               ?>
-              <option value=<?php $combined=$maxplist."|".$k_number."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($parent_number == $maxplist) {print "selected";}?>>All</option>
-           <?php
-
-            }
-            
-     ?>  
- 
-      </SELECT>
-   </form>
-</td>
-</tr>
-<tr>
-<td align="left">
-Number of networks to include in model averaging:
-</td>
-<td align="left"> 
-     <form method="post" action="create_tiers_gom.php" name="form">
-      <SELECT NAME="nm_k"  onchange="form.submit();">
-           <option value=<?php $combined=$parent_number."|"."1"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 1) {print "selected";}?>><?php print("1")?></option>
-           <option value=<?php $combined=$parent_number."|"."10"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 10) {print "selected";}?>><?php print("10")?></option>
-          <option value=<?php $combined=$parent_number."|"."50"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 50) {print "selected";}?>><?php print("50")?></option>
-          <option value=<?php $combined=$parent_number."|"."100"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 100) {print "selected";}?>><?php print("100")?></option>
-          <option value=<?php $combined=$parent_number."|"."500"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 500) {print "selected";}?>><?php print("500")?></option>
-          <option value=<?php $combined=$parent_number."|"."1000"."|".$tier_number."|".$structure_thr."|".$keyval; print($combined)?> <?php if($k_number == 1000) {print "selected";}?>><?php print("1000")?></option>
-      </SELECT>
-   </form>
-</td>
-</tr>
-<tr>
-<td align="left">
-Model averaging edge selection threshold:
-</td>
-<td align="left"> 
-     <form method="post" action="create_tiers_gom.php" name="form">
-      <SELECT NAME="nm_thr"  onchange="form.submit();">
-     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.5"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.5) {print "selected";}?>>0.5</option>
-     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.6"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.6) {print "selected";}?>>0.6</option>
-     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.7"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.7) {print "selected";}?>>0.7</option>
-     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.8"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.8) {print "selected";}?>>0.8</option>
-     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."0.9"."|".$keyval; print($combined)?> <?php if($structure_thr == 0.9) {print "selected";}?>>0.9</option>
-     <option value=<?php $combined=$parent_number."|".$k_number."|".$tier_number."|"."1.0"."|".$keyval; print($combined)?> <?php if($structure_thr == 1.0) {print "selected";}?>>1.0</option>
-    
-      </SELECT>
-   </form>
-</td>
-</tr>
-<tr>
-<td align="left">
-Number of tiers:
-</td>
-<td align="left"> 
-     <form method="post" action="create_tiers_gom.php" name="form">
-      <SELECT NAME="nm_tier"  onchange="form.submit();">
+     <form method="post" action="create_tiers_gom_part2.php" name="form">
+      <SELECT style='font-size:16px;' NAME="nm_tier"  onchange="form.submit();">
       <?php for($i=2;$i<10;$i++)
       {
         ?>
-           <option value=<?php $combined=$parent_number."|".$k_number."|".$i."|".$structure_thr."|".$keyval; print($combined)?> <?php if($tier_number == $i) {print "selected";}?>><?php print($i)?></option>
+           <option value=<?php $combined=$i."|".$keyval; print($combined)?> <?php if($tier_number == $i) {print "selected";}?>><?php print($i)?></option>
      <?php
      }
    
@@ -244,25 +106,25 @@ if(isset($HTTP_POST_VARS["whitetext"]))
                 position:absolute;
                 left:215px;
                 white-space: nowrap; 
-                min-width: 3000px;
+                min-width: 2200px;
                 float:top;
                 }
 
         #int_box1{
                 white-space: nowrap;
-                min-width: 10000px;
+                min-width: 2200px;
                 }
         #int_box2{
                 white-space: nowrap;
-                min-width: 10000px;
+                min-width: 2200px;
                 }
         #int_box3{
                 white-space: nowrap;
-                min-width: 10000px;
+                min-width: 2200px;
                 }
         #int_box4{
                 white-space: nowrap;
-                min-width: 10000px;
+                min-width: 2200px;
                 }
 
         #outer_tier_desc{
@@ -270,7 +132,7 @@ if(isset($HTTP_POST_VARS["whitetext"]))
                 }
 
         #outer_tier_desc1{
-                width:2000px;
+                width:2200px;
                 margin-top: 20px;
                 }
 
@@ -354,7 +216,8 @@ if(isset($HTTP_POST_VARS["whitetext"]))
 		margin-left:10px;
 		margin-top:10px;
 		border: 2px dashed;
-                background-color:#C0C0C0;
+                background-color:LightGrey;
+		text-align:center;
 	}
 	.node2 {
 		width:150px;
@@ -363,7 +226,7 @@ if(isset($HTTP_POST_VARS["whitetext"]))
 		margin-left:10px;
 		margin-top:10px;
 		border: 2px dashed;
-                background-color:#EAE822;
+                background-color:LightGrey;
 	}
 
 </style> 
@@ -1013,10 +876,10 @@ function clearBWLists()
        <br>
            
         <div id="outer_box_lists">
-       <p><h3>4. Specify additional constraints:<br></h3>
+       <p><h3><br>4. Specify additional constraints:<br></h3>
        </p>         
        <br>
-       <div><input type="button" value="Clear lists of banned and required edges" onClick="clearBWLists()"/></div><br>
+       <div><input type="button" class=button2 value="Clear lists of banned and required edges" onClick="clearBWLists()"/></div><br>
         <div id="nodelist2" ondrop="return false"
         ondragcenter="return false" ondragover="return false" >Nodes<br>
         </div>
diff --git a/sourcecodes/cross_valid.php b/sourcecodes/cross_valid.php
index c3c8bd55..8adbcdfe 100644
--- a/sourcecodes/cross_valid.php
+++ b/sourcecodes/cross_valid.php
@@ -1,11 +1,19 @@
+<head>
+<meta http-equiv='cache-control' content='no-cache'> 
+<meta http-equiv='expires' content='0'> 
+<meta http-equiv='pragma' content='no-cache'> 
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
 <?php 
 include("header_new.inc");
+include("header_batchsearch.inc");
 include("input_validate.php");
 $keyval=$_GET["My_key"];
 if($keyval!='') {
   $keyval = valid_keyval($keyval);
 }
 ?>
+</head>
 
 <?php
 $varName = "";
@@ -38,12 +46,18 @@ function test_input($data) {
 }
 ?>
 
+<?php
+$varName_file = "/var/lib/genenet/bnw/".$keyval."name.txt";
+$varName_line = file_get_contents($varName_file);
+$varNamesArr = explode("\t",$varName_line);
+?>
+
+
+
 
 <!-- Site navigation menu -->
 <ul class="navbar2">
-  <li><p>Network ID:<br><?php print($keyval);?></p></li>
-</ul>
-<ul class="navbar">
+  <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
   <li><a href="javascript:void(0);"
   NAME="Network" title="Network" onClick=window.open("layout.php?My_key=<?php print($keyval);?>","_self");>Return to network</a>
   <li><a href="javascript:void(0);"
@@ -52,14 +66,22 @@ function test_input($data) {
   <li><a href="home.php">Home</a>
 </ul>
 
+<body>
 
 <!-- Main content -->
 <div id="outer">
 
 <?php
-  $filename1="./data/".$keyval."looCV.txt";
-  $filename2="./data/".$keyval."looCV_temp.txt";
-if(file_exists($filename2))
+  //  $filename1="./data/".$keyval."looCV.txt";
+  //  $filename2="./data/".$keyval."looCV_temp.txt";
+//  $dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+$filename1=$keyval."looCV.txt";
+$filename2=$keyval."looCV_temp.txt";
+   $plotly_file=$keyval."loo_plotly.html";
+//   $plotly_file_local = "./data/".$keyval."loo_plotly.html";
+//   $pred_file_local = "./data/".$keyval."looCV.txt";
+if(file_exists($dir.$filename2))
  {?>
 <br>
   <h2> Leave-one-out cross-validation results are being calculated</h2>
@@ -68,30 +90,48 @@ if(file_exists($filename2))
 <br>
 <?php
  }
- else if(file_exists($filename1))
- {?>
-    <h2> <a href=<?php $d="./data/".$keyval."looCV.txt"; print($d);?>>Download cross-validation results</a></h2>   
-<?php
-   $plotly_file="./data/".$keyval."loo_plotly.html";
-   if(file_exists($plotly_file))
-     {?>
+ else if(file_exists($dir.$filename1))
+ {
+ $file_data = file_get_contents($dir.$plotly_file);
+
+ ?>
      <div>
-	 <object type="text/html" data=<?php print($plotly_file);?> width="800" height="500" >
+	  <object width="800" height="500" data=<?=$file_data?>
          </object>
      </div>
- <?php
-      }?>    
+<?php
+$table_text = json_encode(file("file://".$dir.$filename1));
+?>
+     <div class="d3_table" id="table_div1">
+     <script type="text/javascript">
+	d3.text("", function(error,raw) {
+	    var dsv=d3.dsvFormat("\t")
+	      var data1 = <?php echo $table_text;?>;
+              var data2 = data1.join("");
+              var data=dsv.parse(data2)
+	      var caption_text=data.pop()
+	      if (error) throw error;
+	    tabulate_caption("#table_div1",data,caption_text.CaseRow);
+	  });
+</script>
+</div>
 <br>
-<h3>Perform leave-one-out cross-validation of another network variable<br></h3>
-<p align="justify"> 
- Enter the name of another variable below to validate predictions of that variable.
+    <a class=button2 href=<?php print("reroute.php?".$filename1);?>>Download cross-validation results</a>
 <br>
+<br>
+<h3>Perform leave-one-out cross-validation of another network variable<br></h3>
 <p><span class="error"></span></p>
-<FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
-    Variable Name:<INPUT TYPE="text" name="varName" value="<?php echo $varName;?>" style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px;
-display: block; height: 30px; width: 300px;"><span class="error"> <?php if($varNameErr!="1") {echo $varNameErr;};?></span>
+<FORM METHOD="post" id=form ACTION="<?php $location = htmlspecialchars($_SERVER["PHP_SELF"]); echo ''.$location.'#form';?>">
+<p style='font-size:18px'>Select variable name:</p>
+<select style='font-size:18px' Name="varName">
+ <?php foreach($varNamesArr as $entry){
+     echo "<option value='".$entry."'>$entry</option>";
+   }?>
+</select>
 <input type='hidden' name='My_key' value='<?php print($keyval)?>'>
-<br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
+<input class=button2 type="submit" name="submit" value="Submit" style="font-size:18px">
+<br><br>
+</FORM>
 </FORM>
 </p>
 <br>
@@ -99,15 +139,21 @@ display: block; height: 30px; width: 300px;"><span class="error"> <?php if($varN
      } else {
 ?>
 <h2>Perform leave-one-out cross-validation of network</h2>
-<p align="justify"> 
-  To perform cross-validation, enter the name of the variable that you want to test the predictions of below.
+
+<p align="justify" style='font-size:18px'>
+  Select the variable that you want to examine the predictions of below.
+<br>
 <br>
 <p><span class="error"></span></p>
 <FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
-    Variable Name:<INPUT TYPE="text" name="varName" value="<?php echo $varName;?>" style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px;
-display: block; height: 30px; width: 300px;"><span class="error"> <?php if($varNameErr!="1") {echo $varNameErr;};?></span>
+<p style='font-size:18px'> Select variable name:</p><br>
+<select style='font-size:18px' Name="varName">
+ <?php foreach($varNamesArr as $entry){
+     echo "<option value='".$entry."'>$entry</option>";
+   }?>
+</select>
 <input type='hidden' name='My_key' value='<?php print($keyval)?>'>
-<br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
+<input class=button2 type="submit" name="submit" value="Submit" style="font-size:18px">
 </FORM>
 </p>
 <br>
@@ -123,9 +169,7 @@ if($varNameErr=="1")
   $pred_link='cv_predictions.php?My_key='.$keyval;
   sleep(1);
   echo "<br>";
-  echo "Calculation submitted";
-  echo "<br>";
-  echo "<a href=$pred_link>Click to return to cross-validation and predictions menu</a>";
+  echo "<a class=button3 href=$pred_link>Calculation submitted. Click here to return to cross-validation and predictions menu.</a><br><br>";
 }
 ?>
 
diff --git a/sourcecodes/cross_valid_example.php b/sourcecodes/cross_valid_example.php
deleted file mode 100644
index 041df913..00000000
--- a/sourcecodes/cross_valid_example.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php 
-include("header_new.inc");
-include("input_validate.php");
-$keyval=$_GET["My_key"];
-if($keyval!='') {
-  $keyval = valid_keyval($keyval);
-}
-?>
-
-<?php
-$varName = "";
-$varNameErr = "";
-
-if ($_SERVER["REQUEST_METHOD"] == "POST") {
-  $keyval=$_POST["My_key"];
-  if($keyval!='') {
-    $keyval = valid_keyval($keyval);
-  }
-  if (empty($_POST["varName"])) {
-    $varNameErr = "Entering a variable name is required";
-  } else {
-    //    $varName = test_input($_POST["varName"]);
-    $varName = valid_input($_POST["varName"]);
-    $varNameErr = "1";
-    // check if name only contains letters and whitespace
-    //if (!preg_match("/^[\w]*$/",$varName)) {
-    //  $varNameErr = "The input string contains characters that are not allowed"; 
-    //}
-  }
-}
-
-
-function test_input($data) {
-  $data = trim($data);
-  $data = stripslashes($data);
-  $data = htmlspecialchars($data);
-  return $data;
-}
-?>
-
-
-<!-- Site navigation menu -->
-<ul class="navbar2">
-  <li><p>Network ID:<br><?php print($keyval);?></p></li>
-</ul>
-<ul class="navbar">
-  <li><a href="javascript:void(0);"
-  NAME="Network" title="Network" onClick=window.open("layout_example.php?My_key=<?php print($keyval);?>","_self");>Return to network</a>
-  <li><a href="javascript:void(0);"
-  NAME="CV_predictions" title="CV_pred" onClick=window.open("cv_predictions_example.php?My_key=<?php print($keyval);?>","_self");>Return to validation and predictions menu</a>
-  <li><a href="help.php">Help</a>
-  <li><a href="home.php">Home</a>
-</ul>
-
-
-<!-- Main content -->
-<div id="outer">
-
-<?php
-  $filename1="./data/".$keyval."looCV.txt";
-  $filename2="./data/".$keyval."looCV_temp.txt";
-if(file_exists($filename2))
- {?>
-<br>
-  <h2> Leave-one-out cross-validation results are being calculated</h2>
-<br>
-     <a href=<?php $ref="cv_predictions_example.php?".$keyval; print($ref);?>Refresh to update status</a>
-<br>
-<?php
- }
- else if(file_exists($filename1))
- {?>
-<br>
-    <h2> <a href=<?php $d="./data/".$keyval."looCV.txt"; print($d);?>>View cross-validation results</a></h2>
-<br>
-<h3>Perform leave-one-out cross-validation of another network variable<br></h3>
-<p align="justify"> 
- Enter the name of another variable below to validate predictions of that variable.
-<br>
-<p><span class="error"></span></p>
-<FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
-    Variable Name:<INPUT TYPE="text" name="varName" value="<?php echo $varName;?>" style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px;
-display: block; height: 30px; width: 300px;"><span class="error"> <?php if($varNameErr!="1") {echo $varNameErr;};?></span>
-<input type='hidden' name='My_key' value='<?php print($keyval)?>'>
-<br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
-</FORM>
-</p>
-<br>
-<?php
-     } else {
-?>
-<h2>Perform leave-one-out cross-validation of network</h2>
-<p align="justify"> 
-  To perform cross-validation, enter the name of the variable that you want to test the predictions of below.
-<br>
-<p><span class="error"></span></p>
-<FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
-    Variable Name:<INPUT TYPE="text" name="varName" value="<?php echo $varName;?>" style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px;
-display: block; height: 30px; width: 300px;"><span class="error"> <?php if($varNameErr!="1") {echo $varNameErr;};?></span>
-<input type='hidden' name='My_key' value='<?php print($keyval)?>'>
-<br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
-</FORM>
-</p>
-<br>
-
-<?php
-}
-
-if($varNameErr=="1")
-{
-  $command = './run_scripts/run_loo '.$keyval.' '.$varName;
-  $output = shell_exec("$command > /dev/null 2 > /dev/null &");
-  $pred_link='cv_predictions_example.php?My_key='.$keyval;
-  sleep(1);
-  echo "<br>";
-  echo "Calculation submitted";
-  echo "<br>";
-  echo "<a href=$pred_link>Click to return to cross-validation and predictions menu</a>";
-}
-?>
-
-</div>
-</body>
-
-
diff --git a/sourcecodes/cv_plotly.py b/sourcecodes/cv_plotly.py
index 9ee49634..05d0621d 100644
--- a/sourcecodes/cv_plotly.py
+++ b/sourcecodes/cv_plotly.py
@@ -1,9 +1,7 @@
-#!/home/jziebart/python/Python-2.7.15/python
+#!/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3
 import os
 import sys
 
-#sys.path.append('/home/jziebart/.local/bin')
-#sys.path.append('/home/jziebart/.local/lib')
 
 import plotly
 import plotly.graph_objs as go
@@ -16,19 +14,25 @@ outfile = netID+"loo_plotly.html"
  
 filename=netID+"looCV.txt"
 f=open(filename,"r")
-#Read the first line to get the variable name
-line=f.readline()
-line = map(string.strip,line.strip().split(" "))
-varName = line[-1]
-
+lines=f.readlines()
+#Read the last line to get the variable name
+line = lines.pop()
+#line = map(string.strip,line.strip().split(" "))
+line = line.strip().split(" ")
+varName = line[3][:-1]
+plot_title = varName+" LOOCV"
+#remove header line
+header = lines.pop(0)
 
 #Read type file to determine if it is continuous or discrete
 typefile = netID+"type.txt"
 tf=open(typefile,"r")
 line=tf.readline()
-varnames = map(string.strip,line.strip().split("\t"))
+#varnames = map(string.strip,line.strip().split("\t"))
+varnames = line.strip().split("\t")
 line=tf.readline()
-vartypes = map(string.strip,line.strip().split("\t"))
+#vartypes = map(string.strip,line.strip().split("\t"))
+vartypes = line.strip().split("\t")
 varindex = varnames.index(varName)
 cd_type = int(vartypes[varindex])
 
@@ -36,21 +40,33 @@ cd_type = int(vartypes[varindex])
 if cd_type == 1:
     #Make scatterplot for continuous_data
     #Read introductory lines from file
-    for i in range(6):
-        line = f.readline()
+#    for i in range(6):
+#        line = f.readline()
     #Read the data
     x = []
     y = []
-    line = f.readline()
-    while line:
-        line = map(string.strip,line.strip().split("\t"))
+#    line = f.readline()
+#    while line:
+    for line in lines:
+        #line = map(string.strip,line.strip().split("\t"))
+        line = line.strip().split("\t")
         x.append(float(line[1]))
         y.append(float(line[2]))
-        line=f.readline()
+#        line=f.readline()
 
     data = [go.Scatter(x=x,y=y,mode='markers')]
     layout = go.Layout(
-        xaxis=dict(
+        title=plot_title,
+        titlefont=dict(
+            family='Arial, sans-serif',
+            size=24,
+            color='black'
+            ),
+        title_xref="paper",
+	title_x=0.5,
+	title_xanchor="center",
+	title_yanchor="middle",
+	xaxis=dict(
             autorange=True,
             title='Actual values',
             titlefont=dict(
@@ -67,25 +83,26 @@ if cd_type == 1:
                 size=18,
                 color='black'
                 ),
-            )
+            ),
+        margin=dict(t=30,l=50,b=40)
         )
     fig = go.Figure(data=data, layout = layout)
     plotly.offline.plot(fig,filename=outfile)
 
 else:
     #Make bar chart for discrete data
-    #Read introductory lines from file
-    for i in range(5):
-        line = f.readline()
     #Get names of states
-    line = map(string.strip,line.strip().split("\t"))
-    states = line[2:]
+    #header = map(string.strip,header.strip().split("\t"))
+    header = header.strip().split("\t")
+    states = header[2:]
     #Read the data
     actual = []
     predicted = []
-    line = f.readline()
-    while line:
-        line = map(string.strip,line.strip().split("\t"))
+ #   line = f.readline()
+ #   while line:
+    for line in lines:
+        #line = map(string.strip,line.strip().split("\t"))
+        line = line.strip().split("\t")
         actual.append(line[1])
         predict_x = line[2:]
         predict_x = [float(x) for x in predict_x]
@@ -98,7 +115,7 @@ else:
         if len(max_items) > 1:
             predicted.pop()
             actual.pop()
-        line=f.readline()
+#        line=f.readline()
     
     #Go through states and get number of true positives, false positives, and false negatives
     tp_all = []
@@ -121,15 +138,25 @@ else:
         tp_all.append(tp)
         fn_all.append(fn)
         fp_all.append(fp)
-    print tp_all
-    print fn_all
-    print fp_all
+   # print tp_all
+   # print fn_all
+   #  print fp_all
     trace1 = go.Bar(x=states,y=tp_all,name="True Positives")
     trace2 = go.Bar(x=states,y=fn_all,name="False Negatives")
     trace3 = go.Bar(x=states,y=fp_all,name="False Positives")
     data = [trace1,trace2,trace3]
     layout = go.Layout(
         barmode='group',
+        title=plot_title,
+        titlefont=dict(
+            family='Arial, sans-serif',
+            size=24,
+            color='black'
+            ),
+	title_xref="paper",
+	title_x=0.5,
+	title_xanchor="center",
+	title_yanchor="middle",
         xaxis=dict(
             autorange=True,
             title='State',
@@ -147,7 +174,8 @@ else:
                 size=18,
                 color='black'
                 ),
-            )
+            ),
+        margin=dict(t=30,l=50,b=40),
     )
     fig = go.Figure(data=data, layout = layout)
     plotly.offline.plot(fig,filename=outfile)
diff --git a/sourcecodes/cv_predictions.php b/sourcecodes/cv_predictions.php
index 811f0c35..65915534 100644
--- a/sourcecodes/cv_predictions.php
+++ b/sourcecodes/cv_predictions.php
@@ -9,11 +9,13 @@ $keyval=valid_keyval($_GET["My_key"]);
 
 <!-- Site navigation menu -->
 <ul class="navbar2">
-  <li><p>Network ID:<br><?php print($keyval);?></p></li>
-</ul>
-<ul class="navbar">
+  <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
+  <li><a href="javascript:void(0);"
+    NAME="Network" title="Network" onClick=window.open("layout.php?My_key=<?php print($keyval);?>","_self");>Return to network</a></li>
   <li><a href="javascript:void(0);"
-    NAME="Network" title="Network" onClick=window.open("layout.php?My_key=<?php print($keyval);?>","_self");>Return to network</a>
+    NAME="Clear predictions" title="Clear predictions" onClick=window.open("clear_cv_pred.php?My_key=<?php print($keyval);?>","_self");>Clear all prediction and validation files</a></li>
+</ul>
+    <ul class="navbar2">
   <li><a href="help.php">Help</a>
   <li><a href="home.php">Home</a>
 
@@ -27,63 +29,64 @@ $keyval=valid_keyval($_GET["My_key"]);
 <br>
 <p align="justify">
 <ul class="listbar">
+<li>This feature has recently been added to BNW and is still being tested. Please inform us of any issues.<br>
+  Its use is briefly described <a href="help.php#crossvalid" target="_blank">here</a>.<br><br></li>
 <?php
-  $loo_file1="./data/".$keyval."looCV_temp.txt";
-  $loo_file2="./data/".$keyval."looCV.txt";
+//  $dir="/tmp/bnw/";
+  $dir="/var/lib/genenet/bnw/";
+  $loo_file1=$dir.$keyval."looCV_temp.txt";
+  $loo_file2=$dir.$keyval."looCV.txt";
 if(file_exists($loo_file1))
   {?>
-<li>1: Leave-one-out cross-validation predictions are being calculated.
-     <a href="cv_predictions.php?My_key=<?php print($keyval);?>">Refresh and update status</a>
+<li> <a class=button3 href="cv_predictions.php?My_key=<?php print($keyval);?>">Leave-one-out cross-validation predictions are being calculated.<br> Click here to update status.</a>
 <br>
 </li>
   <?php
    } else if(file_exists($loo_file2)) {
    ?>   
-<li>1: <a href="cross_valid.php?My_key=<?php print($keyval);?>" target='_self'>Leave-one-out cross-validation results are available.</a></li>
+<li><a class=button3 href="cross_valid.php?My_key=<?php print($keyval);?>" target='_self'>Leave-one-out cross-validation results are available.</a></li>
   <?php
     } else {
   ?>
-  <li>1: <a href="cross_valid.php?My_key=<?php print($keyval);?>" target='_self'>Perform leave-one-out cross-validation</a></li>
+  <li><a class=button3 href="cross_valid.php?My_key=<?php print($keyval);?>" target='_self'>Perform leave-one-out cross-validation</a></li>
   <?php
     }
    ?>
 <?php
-  $kfold_file1="./data/".$keyval."kfoldCV_temp.txt";
-  $kfold_file2="./data/".$keyval."kfoldCV.txt";
+  $kfold_file1=$dir.$keyval."kfoldCV_temp.txt";
+  $kfold_file2=$dir.$keyval."kfold_plotly.html";
 if(file_exists($kfold_file1))
   {?>
-<li>2: k-fold cross-validation predictions are being calculated.
-     <a href="cv_predictions.php?My_key=<?php print($keyval);?>">Refresh and update status</a>
+<li> <a class=button3 href="cv_predictions.php?My_key=<?php print($keyval);?>">k-fold cross-validation predictions are being calculated.<br>Click here to update status.</a>
 <br>
 </li>
   <?php
    } else if(file_exists($kfold_file2)) {
    ?>   
-<li>2: <a href="kfold_cv.php?My_key=<?php print($keyval);?>" target='_self'>k-fold cross-validation results are available</a></li>
+<li><a class=button3 href="kfold_cv.php?My_key=<?php print($keyval);?>" target='_self'>k-fold cross-validation results are available</a></li>
   <?php
     } else {
   ?>
-  <li>2: <a href="kfold_cv.php?My_key=<?php print($keyval);?>" target='_self'>Perform k-fold cross-validation</a></li>
+  <li><a class=button3 href="kfold_cv.php?My_key=<?php print($keyval);?>" target='_self'>Perform k-fold cross-validation</a></li>
   <?php
     }
    ?>
 <?php
-  $ts_file1="./data/".$keyval."ts_upload.txt";
-  $ts_file2="./data/".$keyval."ts_output.txt";
+  $ts_file1=$dir.$keyval."ts_upload.txt";
+  $ts_file2=$dir.$keyval."ts_output.txt";
 if(file_exists($ts_file1))
   {?>
-<li>3: Test set predictions are being calculated.
-     <a href="cv_predictions.php?My_key=<?php print($keyval);?>">Refresh and update status</a>
+<li><a class=button3 href="cv_predictions.php?My_key=<?php print($keyval);?>">Test set predictions are being calculated.<br> Click here to update status.</a>
 <br>
 </li>
   <?php
    } else if(file_exists($ts_file2)) {
    ?>   
-<li>3: <a href="test_set_predictions.php?My_key=<?php print($keyval);?>" target='_self'>Test set predictions are available</a></li>
+<li><a class=button3 href="test_set_predictions.php?My_key=<?php print($keyval);?>" target='_self'>Test set predictions are available</a></li>
   <?php
     } else {
   ?>
-  <li>3: <a href="test_set_predictions.php?My_key=<?php print($keyval);?>" target='_self'>Make predictions using a test data set</a></li>
+  <li><a class=button3 href="test_set_predictions.php?My_key=<?php print($keyval);?>" target='_self'>Make predictions using a test data set</a></li>
   <?php
     }
    ?>
diff --git a/sourcecodes/data/LRlnetwork.json b/sourcecodes/data/LRlnetwork.json
new file mode 100644
index 00000000..7ee3b56f
--- /dev/null
+++ b/sourcecodes/data/LRlnetwork.json
@@ -0,0 +1,10 @@
+{
+  "nodes": [
+    {
+    "data": {
+      "id": "1",
+      "label": "Node1"
+    }
+    }
+  ]
+}
diff --git a/sourcecodes/data/example2_test/exAban.txt b/sourcecodes/data/example2_test/exAban.txt
new file mode 100644
index 00000000..83e81b8b
--- /dev/null
+++ b/sourcecodes/data/example2_test/exAban.txt
@@ -0,0 +1 @@
+From	To
diff --git a/sourcecodes/data/example2_test/exAcontinuous_input.txt b/sourcecodes/data/example2_test/exAcontinuous_input.txt
new file mode 100644
index 00000000..5e296c45
--- /dev/null
+++ b/sourcecodes/data/example2_test/exAcontinuous_input.txt
@@ -0,0 +1,203 @@
+Geno1	Geno2	Trait1	Trait2	Trait3	Trait4	Trait5	Trait6
+2	2	1	1	1	1	1	1
+2	2	0.46259	1.2692	-1.3164	-0.44096	0.5929	-0.75422
+1	1	-0.10011	-0.88834	1.6407	0.99972	0.31288	0.65602
+1	1	-1.0533	-0.55296	1.2715	1.3686	-0.19153	0.37361
+1	2	0.042371	0.13573	-0.72659	-0.66133	0.43157	-1.6715
+1	2	-0.68686	-1.6152	-0.95019	-1.2239	0.12319	-0.79155
+1	1	-0.4558	0.090877	0.94224	1.2354	-0.36356	0.34937
+1	1	0.237	-0.49002	1.8939	1.4399	0.033059	1.3229
+1	2	0.070265	0.22547	-1.4903	-0.069341	-0.16148	-0.01449
+1	1	-0.69146	-0.43461	1.1501	0.21205	-0.18087	0.32746
+1	1	0.31535	-0.9858	0.57816	0.35924	0.12866	1.0553
+2	1	1.2718	0.39314	0.6669	0.90002	-0.30206	1.3376
+1	1	1.1871	-0.45611	0.87227	0.31014	-0.092846	0.81278
+2	1	-1.0168	-0.44286	1.6933	0.72968	0.038808	0.81906
+2	2	-0.25313	0.52468	0.02823	-0.20984	-0.075809	-1.3591
+1	2	-0.58108	-0.3967	-0.11925	-0.61288	0.46778	0.090941
+1	2	-0.88043	-0.28187	-1.1645	-1.2543	-0.28951	-1.039
+1	2	0.54121	0.24395	-1.0043	-1.4483	-0.19839	-2.5407
+2	1	0.47375	1.1319	0.68553	1.035	0.44043	1.3011
+2	1	0.57785	0.69093	1.5941	1.6735	0.19981	0.50708
+1	2	-0.43989	0.0024131	-1.5405	-1.2304	-0.15382	-1.1058
+2	1	0.38035	-0.063535	1.1606	1.3124	-0.38043	0.6277
+1	2	0.70114	-0.41044	-0.39767	-1.5424	0.27477	-0.76183
+1	1	-0.9406	-0.20526	1.3302	1.097	0.16006	1.2988
+1	2	0.52122	0.064793	-0.031492	0.21696	-0.41979	-0.79123
+1	2	-0.53387	-0.71043	-0.52344	-1.5584	-0.09538	-1.5781
+1	1	0.49563	-0.58126	0.7747	1.274	0.19196	0.10624
+2	2	1.1499	1.879	0.43595	0.73474	0.045381	-0.88645
+1	2	0.40705	-0.37647	-0.19815	-1.5366	0.37167	-0.10553
+2	2	0.62526	0.043371	-0.64449	-0.44076	-0.4318	-0.91807
+1	1	-0.61788	-0.62414	0.3169	0.85091	-0.10135	0.79065
+1	1	0.18491	-1.5226	1.1149	0.75046	0.25948	0.42431
+2	2	0.86063	0.92883	-1.1584	-0.099858	-0.55095	-0.064129
+1	2	-0.28946	0.0057533	-0.95703	-0.44018	0.084268	-0.23718
+1	1	-0.073096	0.16452	1.4444	1.1452	0.46025	0.30452
+1	1	0.15637	-0.73137	0.585	-0.046911	0.43881	1.2888
+1	2	0.081142	-0.63691	-0.14883	0.66593	-0.13479	-0.22207
+1	1	0.10876	-0.23383	1.8314	1.3282	0.4362	0.90139
+1	2	-1.0582	-0.97152	-0.57118	-1.2617	0.17115	-0.060679
+2	2	-0.47421	-0.56819	-0.38775	0.035215	0.51982	-1.6309
+2	2	-0.10242	0.8127	0.41773	-1.1308	-0.30719	-0.80758
+1	1	-0.083462	-0.4565	1.1556	0.3299	0.087362	0.31349
+1	2	-0.98158	0.01727	-1.3281	-1.4474	0.54555	-0.10096
+1	1	-0.80604	-0.19415	1.4986	1.3386	-0.16367	0.68271
+1	1	0.80082	-0.57853	1.0716	0.94015	-0.54114	0.032172
+2	2	2.0456	0.97954	-0.45536	-0.14332	-0.25819	-1.0833
+1	1	-0.30148	0.20623	0.64194	0.76414	-0.59067	0.64326
+1	1	-0.55625	-0.26957	1.8447	1.6568	-0.38077	0.58831
+1	2	0.11898	0.80706	-0.025844	-0.57984	-0.23395	-1.1554
+1	2	-0.095497	-1.0637	-0.92583	-0.57928	0.23695	-0.42992
+2	2	0.066154	0.73037	-0.73622	-0.57047	0.39169	0.40928
+1	1	0.81522	0.11381	0.68971	0.29219	0.037792	0.81502
+1	1	-0.65356	-0.20182	0.92089	0.92298	-0.5417	0.49215
+1	1	-0.90826	-0.10979	1.3847	0.75954	-0.20255	0.32975
+1	2	-0.25671	-1.1903	-1.4241	-1.6058	-0.062549	-1.3981
+2	2	-1.8038	-1.4801	-0.94121	-1.6244	0.4817	-0.0029469
+1	2	0.12651	0.028719	-1.5818	-1.0266	0.19779	-0.36357
+1	1	-1.0658	-0.58443	0.68956	0.35467	0.11177	1.5243
+1	2	0.14729	-0.15111	-0.027639	-0.2899	0.11533	-0.60305
+2	2	-0.76889	0.87161	-0.83556	-1.1777	-0.21878	-0.98527
+2	2	0.12252	0.49068	-0.2557	-1.5816	0.25332	-0.78715
+1	1	-0.40287	0.26456	0.62208	0.60909	0.36074	0.092703
+2	1	-0.78301	1.4641	1.3162	1.9448	-0.10841	0.9618
+1	2	-0.25018	-0.32797	-1.113	-1.6123	0.6272	-1.2718
+2	1	0.15804	-0.18147	2.4571	0.59504	-0.34056	0.8691
+2	1	-0.582	0.25738	1.4075	0.92251	-0.40889	0.66381
+1	1	-0.26827	0.58632	0.51883	1.5745	-0.13818	1.0526
+1	2	0.13453	0.18218	-0.51676	-0.54166	-0.36636	-1.206
+2	1	1.1502	0.36164	1.9983	1.0809	0.11272	0.67683
+1	2	0.27812	0.46559	-1.6109	-0.91039	0.3803	-0.71802
+2	1	0.15292	0.61921	0.71009	1.3063	-0.35819	0.8661
+1	2	0.19902	0.48986	-1.4026	-0.8495	0.47158	0.0622
+2	1	0.4838	1.1096	1.4392	1.1438	0.34739	0.084004
+1	1	-0.63609	-0.35105	0.63581	1.1939	-0.062938	0.91353
+1	2	0.64203	-0.5095	-1.7792	-0.88803	0.43482	-0.66314
+1	1	-0.18434	-0.48157	0.69942	0.56942	-0.019967	0.50506
+1	1	0.10168	-1.0928	1.2144	0.28313	0.22159	0.54058
+1	1	-0.18578	-0.45336	1.5468	0.99679	0.11821	1.0476
+1	2	-0.60607	-1.1275	-0.90963	-0.69014	-0.33163	-1.2734
+1	1	-0.35353	-0.42708	0.78989	0.14094	-0.056632	0.80598
+1	1	-0.020221	-1.1235	1.9782	-0.041281	0.19857	1.2488
+1	1	1.2346	-0.37121	1.3325	1.1237	-0.027458	1.0044
+2	2	-0.54489	1.6812	-0.59836	-0.012441	0.41243	-0.58835
+2	1	-0.029577	2.1707	1.3285	1.2109	0.29684	0.90646
+2	2	0.70774	1.0606	-1.3996	-0.020914	-0.60955	-1.2187
+2	1	0.07926	0.52862	1.3994	0.54549	0.55303	0.16155
+1	1	0.041856	-0.92023	0.87269	-0.66601	-0.15945	0.1004
+1	2	0.17665	0.31945	-1.7756	-0.60442	0.020525	-1.0625
+1	1	-0.090238	-0.65111	0.56993	-0.4117	-0.19486	-0.18849
+1	2	0.059166	-0.47194	-0.69068	-0.41022	0.25867	-0.057175
+1	2	0.10473	0.66887	0.082035	-0.55975	-0.28439	-1.468
+1	1	-0.20937	-0.36621	0.09609	0.28164	0.24673	-0.11107
+1	2	-1.2678	0.22369	-0.42201	-0.70103	0.075915	-1.3347
+1	2	-0.35467	0.11166	-0.42144	-0.095223	-0.29936	-0.68322
+2	2	0.84875	1.24	-0.81217	0.084034	-0.32224	-1.6241
+2	1	-0.45939	1.3208	0.97993	1.2991	-0.015791	1.487
+1	2	-0.42254	-0.57928	-0.58529	-2.2375	0.51999	-0.79909
+2	1	0.32092	-0.13796	0.67098	0.24639	-0.36066	-0.032948
+1	2	-1.2408	-0.94836	0.026276	-0.37981	-0.02237	-0.38777
+2	2	0.20959	2.1466	-1.7027	-1.3169	-0.16515	-1.046
+2	2	-0.10482	1.3773	-1.2998	-0.014223	0.34065	-0.35362
+1	2	-0.66188	-1.2477	-0.62084	0.27682	0.1674	-0.8918
+1	1	-0.97246	-0.73017	1.3843	1.5549	0.1067	0.85754
+1	1	0.74567	-0.032694	1.1153	0.97318	-0.0033905	0.85059
+2	2	0.29324	-0.090608	-0.4945	-1.0484	-0.14987	-1.0141
+2	1	-0.86818	0.44948	1.8531	0.51896	-0.021141	1.8486
+1	2	0.362	-0.29749	-0.66525	0.21709	-0.15594	-1.4087
+1	2	-0.17675	0.36465	-0.45423	-1.262	0.22968	-1.246
+1	2	-0.34633	-0.16067	-1.2216	-1.3019	-0.040891	-1.2935
+1	2	0.44608	-0.57732	0.25606	-1.1664	0.54705	-0.19859
+1	2	0.45398	-0.55214	-0.33433	-0.085418	-0.10094	-0.48509
+1	2	0.12407	0.022419	-1.0312	-0.47727	0.20924	-1.2961
+1	1	-0.76644	-1.1794	1.2345	0.84756	0.1532	0.77648
+1	2	-0.10329	-0.53768	-0.67677	-0.58708	-0.014634	-0.036347
+1	1	0.2378	0.15372	0.49652	0.29193	0.19047	1.152
+1	2	0.024605	-0.38937	-0.89907	-0.42106	0.16921	-0.80893
+1	2	0.28812	0.26265	-0.94234	-0.88527	-0.49803	0.48254
+1	1	0.85086	0.11783	1.5014	1.2382	0.24441	1.3649
+2	2	0.86172	0.14894	-0.4846	-1.3488	-0.41844	-1.1372
+1	2	0.67971	-0.27488	-0.50687	-0.79153	-0.093399	-1.391
+1	1	-0.91977	-0.66099	0.5801	0.46587	-0.2263	1.43
+1	2	0.88213	-0.48674	-0.42406	-1.2762	0.28981	-1.0813
+2	1	-0.36583	0.51518	1.4491	1.4995	-0.073755	1.1218
+1	1	-0.54006	-0.59443	0.81263	0.65809	-0.15621	1.2508
+2	2	1.2125	-0.012648	-0.92657	-0.81972	-0.1536	-1.0176
+1	2	0.42493	0.34558	-1.7672	-1.3503	-0.045928	0.37449
+1	1	0.17097	-0.86593	-0.13424	1.0257	0.058014	0.91044
+2	1	-1.393	0.5338	1.8514	2.291	0.15305	0.30028
+1	1	-0.58552	-1.5337	1.5133	0.9976	0.64638	1.4428
+1	2	0.046272	-0.56387	-0.86063	-1.0462	0.014457	-1.3038
+1	2	0.34933	-0.16796	-0.27854	-0.27327	-0.0040928	-0.17912
+1	1	-1.0672	0.3979	1.208	0.50111	-0.013978	0.015097
+1	2	0.31052	-0.46723	-1.1237	0.59267	0.30978	-1.0169
+1	2	-0.55337	-0.42776	-0.12612	-0.41838	-0.56558	-0.58189
+2	2	0.3925	0.15644	-0.72963	-0.66601	-0.10837	-0.27787
+1	2	-0.48513	-1.4119	-0.16889	-0.19646	-0.068098	-0.084247
+2	2	0.16692	1.5447	-1.3064	-1.3338	-0.25668	-0.48832
+1	2	-0.36092	0.31518	-0.44815	-1.4019	-0.47505	-0.37187
+1	1	-1.8192	-0.57745	1.1304	0.262	-0.3595	0.58577
+1	1	-0.065383	0.07156	1.4931	2.3215	0.85149	1.4585
+2	1	-1.119	0.70896	1.0498	0.74334	0.75838	1.6107
+2	2	-0.17682	-0.21029	-0.74465	-0.83806	0.10827	-1.2829
+1	2	0.69834	-0.082402	0.64008	-0.83119	-0.26766	0.36961
+2	2	-0.28266	1.1929	-0.15174	0.098554	-0.33989	-0.6376
+2	2	1.5369	1.8434	0.0030761	-0.59703	0.14497	-1.5165
+1	2	0.35023	-0.28475	-0.93594	-1.0937	-0.46614	-2.188
+2	1	0.62308	1.0873	-0.0037182	0.86847	-0.48699	-0.10105
+1	1	-1.0408	-0.99866	2.0799	1.1634	0.092516	0.30401
+1	1	-0.87125	-0.88987	1.0278	1.0157	-0.23725	1.2377
+1	2	-0.020591	-0.03398	-0.024834	-1.3588	-0.045961	-0.89693
+1	1	0.9213	-0.57037	1.044	1.2994	0.046517	0.66563
+1	2	-0.87288	-0.96382	-0.704	-1.2184	0.046903	-0.30008
+1	2	0.77586	-0.34168	-0.09867	-0.37744	-0.24309	-0.13441
+2	1	0.19521	0.67595	1.4533	1.5115	0.19553	0.79596
+2	1	-1.3273	1.0891	1.2544	0.98928	0.045725	0.54963
+2	2	0.59176	0.65915	-0.84578	-0.080229	-0.26961	0.24045
+1	2	-0.66958	-1.042	-1.2138	-0.7612	-0.22775	-0.40062
+1	2	1.1154	-0.57069	-0.6592	-2.1961	-0.013175	0.46007
+1	2	-0.5254	0.0031225	-0.77758	0.8169	0.13224	-0.65572
+2	1	0.24551	1.5078	0.10719	1.1454	0.70578	0.59051
+1	2	0.29875	-0.11455	-1.0497	-0.77881	0.080708	-0.48337
+1	1	-0.1047	0.011628	1.2504	0.41776	-0.20102	1.2252
+1	2	0.44808	-0.8165	-0.080134	-0.49618	0.051011	-0.71722
+2	1	2.0365	1.5592	1.3257	1.2472	-0.47899	0.10943
+1	1	-0.16507	-0.66011	0.98739	0.58519	0.245	-0.43277
+1	2	-0.028366	-0.16961	-1.3266	0.14248	-0.24634	-1.1154
+2	1	0.92842	1.8842	1.3169	1.0358	-0.20988	0.88021
+2	2	0.33158	0.32463	-0.50924	0.40233	0.54391	-0.24309
+1	2	1.2555	0.1928	-0.487	0.048779	-0.23483	-1.477
+2	1	0.75021	0.85943	-0.2323	0.10748	-0.68906	0.84276
+2	2	0.6297	1.7397	-1.6136	-0.43268	-0.21442	-0.77462
+2	1	0.53168	1.0807	1.0853	0.62304	0.44036	0.48087
+1	2	-0.31256	-0.69771	-0.88556	-1.333	0.038614	-1.5744
+1	2	-0.039695	-0.52447	0.91401	-0.93272	0.53434	-0.080746
+2	1	-0.16596	0.56821	0.76008	0.45442	0.10286	0.6539
+1	2	-0.4331	-0.89669	-1.3097	-1.2157	0.1065	-0.8512
+1	2	-0.34708	-0.51457	-1.012	-0.39437	-0.55374	-1.144
+2	2	0.024082	0.7128	-1.3702	-1.4492	-0.10228	-0.59071
+1	2	-0.0037109	-0.68845	-0.649	-0.91581	0.066805	-0.98583
+2	1	0.68706	0.067424	0.87139	0.7938	-0.099645	1.529
+2	2	-0.31183	0.57814	-0.80815	-0.66724	-0.31919	-0.61319
+1	2	-0.11153	-0.6246	-0.27979	-0.18363	0.83639	0.014919
+2	2	0.20406	1.5838	-0.96334	-1.1228	-0.17808	-1.2123
+2	2	-0.1134	0.63358	-0.53321	-0.84276	-0.27657	-0.36992
+1	2	0.25517	0.67006	-0.1349	0.18275	0.40982	-0.62487
+1	1	-1.2684	0.31042	0.91155	0.66143	0.2483	-0.12434
+1	1	-0.97542	-0.85419	0.7663	0.16362	-0.18737	0.67266
+1	2	-0.043882	-0.62746	-0.82816	-0.40626	-0.051048	-0.61297
+1	1	0.59605	-0.45852	1.2962	0.78156	-0.48154	0.17778
+2	2	-0.06266	1.1144	-0.80524	-0.3189	-0.16038	-0.96372
+1	2	-1.1821	1.0798	-1.3407	-0.52643	0.12458	-0.7871
+2	2	0.59446	0.89186	-0.97856	-0.64658	0.2712	-1.5538
+1	2	0.15067	0.41827	-1.0487	-1.0551	0.19143	-1.4537
+1	2	-1.073	0.022587	-1.7088	-1.3777	0.1964	-0.84025
+2	1	0.20928	1.8026	1.2073	2.78	0.15131	0.3448
+1	2	-1.1317	-0.6359	-0.70457	-1.676	-0.22886	-0.58769
+1	1	-0.039428	-0.58746	0.56	0.7896	-0.052581	0.99511
+1	2	0.55023	-0.20403	0.138	-0.70518	0.66927	-0.28861
+2	2	0.57423	1.1886	0.092876	0.025677	-0.41099	-1.2858
+2	2	-0.14179	1.5827	-0.94328	0.7703	-0.43967	-0.50448
+2	2	0.14666	1.0492	-0.0030259	-0.62418	-0.087515	-0.048386
+
diff --git a/sourcecodes/data/example2_test/exAcontinuous_input_orig.txt b/sourcecodes/data/example2_test/exAcontinuous_input_orig.txt
new file mode 100644
index 00000000..11f30f63
--- /dev/null
+++ b/sourcecodes/data/example2_test/exAcontinuous_input_orig.txt
@@ -0,0 +1,201 @@
+Geno1	Geno2	Trait1	Trait2	Trait3	Trait4	Trait5	Trait6
+2	2	0.46259	1.2692	-1.3164	-0.44096	0.5929	-0.75422
+1	1	-0.10011	-0.88834	1.6407	0.99972	0.31288	0.65602
+1	1	-1.0533	-0.55296	1.2715	1.3686	-0.19153	0.37361
+1	2	0.042371	0.13573	-0.72659	-0.66133	0.43157	-1.6715
+1	2	-0.68686	-1.6152	-0.95019	-1.2239	0.12319	-0.79155
+1	1	-0.4558	0.090877	0.94224	1.2354	-0.36356	0.34937
+1	1	0.237	-0.49002	1.8939	1.4399	0.033059	1.3229
+1	2	0.070265	0.22547	-1.4903	-0.069341	-0.16148	-0.01449
+1	1	-0.69146	-0.43461	1.1501	0.21205	-0.18087	0.32746
+1	1	0.31535	-0.9858	0.57816	0.35924	0.12866	1.0553
+2	1	1.2718	0.39314	0.6669	0.90002	-0.30206	1.3376
+1	1	1.1871	-0.45611	0.87227	0.31014	-0.092846	0.81278
+2	1	-1.0168	-0.44286	1.6933	0.72968	0.038808	0.81906
+2	2	-0.25313	0.52468	0.02823	-0.20984	-0.075809	-1.3591
+1	2	-0.58108	-0.3967	-0.11925	-0.61288	0.46778	0.090941
+1	2	-0.88043	-0.28187	-1.1645	-1.2543	-0.28951	-1.039
+1	2	0.54121	0.24395	-1.0043	-1.4483	-0.19839	-2.5407
+2	1	0.47375	1.1319	0.68553	1.035	0.44043	1.3011
+2	1	0.57785	0.69093	1.5941	1.6735	0.19981	0.50708
+1	2	-0.43989	0.0024131	-1.5405	-1.2304	-0.15382	-1.1058
+2	1	0.38035	-0.063535	1.1606	1.3124	-0.38043	0.6277
+1	2	0.70114	-0.41044	-0.39767	-1.5424	0.27477	-0.76183
+1	1	-0.9406	-0.20526	1.3302	1.097	0.16006	1.2988
+1	2	0.52122	0.064793	-0.031492	0.21696	-0.41979	-0.79123
+1	2	-0.53387	-0.71043	-0.52344	-1.5584	-0.09538	-1.5781
+1	1	0.49563	-0.58126	0.7747	1.274	0.19196	0.10624
+2	2	1.1499	1.879	0.43595	0.73474	0.045381	-0.88645
+1	2	0.40705	-0.37647	-0.19815	-1.5366	0.37167	-0.10553
+2	2	0.62526	0.043371	-0.64449	-0.44076	-0.4318	-0.91807
+1	1	-0.61788	-0.62414	0.3169	0.85091	-0.10135	0.79065
+1	1	0.18491	-1.5226	1.1149	0.75046	0.25948	0.42431
+2	2	0.86063	0.92883	-1.1584	-0.099858	-0.55095	-0.064129
+1	2	-0.28946	0.0057533	-0.95703	-0.44018	0.084268	-0.23718
+1	1	-0.073096	0.16452	1.4444	1.1452	0.46025	0.30452
+1	1	0.15637	-0.73137	0.585	-0.046911	0.43881	1.2888
+1	2	0.081142	-0.63691	-0.14883	0.66593	-0.13479	-0.22207
+1	1	0.10876	-0.23383	1.8314	1.3282	0.4362	0.90139
+1	2	-1.0582	-0.97152	-0.57118	-1.2617	0.17115	-0.060679
+2	2	-0.47421	-0.56819	-0.38775	0.035215	0.51982	-1.6309
+2	2	-0.10242	0.8127	0.41773	-1.1308	-0.30719	-0.80758
+1	1	-0.083462	-0.4565	1.1556	0.3299	0.087362	0.31349
+1	2	-0.98158	0.01727	-1.3281	-1.4474	0.54555	-0.10096
+1	1	-0.80604	-0.19415	1.4986	1.3386	-0.16367	0.68271
+1	1	0.80082	-0.57853	1.0716	0.94015	-0.54114	0.032172
+2	2	2.0456	0.97954	-0.45536	-0.14332	-0.25819	-1.0833
+1	1	-0.30148	0.20623	0.64194	0.76414	-0.59067	0.64326
+1	1	-0.55625	-0.26957	1.8447	1.6568	-0.38077	0.58831
+1	2	0.11898	0.80706	-0.025844	-0.57984	-0.23395	-1.1554
+1	2	-0.095497	-1.0637	-0.92583	-0.57928	0.23695	-0.42992
+2	2	0.066154	0.73037	-0.73622	-0.57047	0.39169	0.40928
+1	1	0.81522	0.11381	0.68971	0.29219	0.037792	0.81502
+1	1	-0.65356	-0.20182	0.92089	0.92298	-0.5417	0.49215
+1	1	-0.90826	-0.10979	1.3847	0.75954	-0.20255	0.32975
+1	2	-0.25671	-1.1903	-1.4241	-1.6058	-0.062549	-1.3981
+2	2	-1.8038	-1.4801	-0.94121	-1.6244	0.4817	-0.0029469
+1	2	0.12651	0.028719	-1.5818	-1.0266	0.19779	-0.36357
+1	1	-1.0658	-0.58443	0.68956	0.35467	0.11177	1.5243
+1	2	0.14729	-0.15111	-0.027639	-0.2899	0.11533	-0.60305
+2	2	-0.76889	0.87161	-0.83556	-1.1777	-0.21878	-0.98527
+2	2	0.12252	0.49068	-0.2557	-1.5816	0.25332	-0.78715
+1	1	-0.40287	0.26456	0.62208	0.60909	0.36074	0.092703
+2	1	-0.78301	1.4641	1.3162	1.9448	-0.10841	0.9618
+1	2	-0.25018	-0.32797	-1.113	-1.6123	0.6272	-1.2718
+2	1	0.15804	-0.18147	2.4571	0.59504	-0.34056	0.8691
+2	1	-0.582	0.25738	1.4075	0.92251	-0.40889	0.66381
+1	1	-0.26827	0.58632	0.51883	1.5745	-0.13818	1.0526
+1	2	0.13453	0.18218	-0.51676	-0.54166	-0.36636	-1.206
+2	1	1.1502	0.36164	1.9983	1.0809	0.11272	0.67683
+1	2	0.27812	0.46559	-1.6109	-0.91039	0.3803	-0.71802
+2	1	0.15292	0.61921	0.71009	1.3063	-0.35819	0.8661
+1	2	0.19902	0.48986	-1.4026	-0.8495	0.47158	0.0622
+2	1	0.4838	1.1096	1.4392	1.1438	0.34739	0.084004
+1	1	-0.63609	-0.35105	0.63581	1.1939	-0.062938	0.91353
+1	2	0.64203	-0.5095	-1.7792	-0.88803	0.43482	-0.66314
+1	1	-0.18434	-0.48157	0.69942	0.56942	-0.019967	0.50506
+1	1	0.10168	-1.0928	1.2144	0.28313	0.22159	0.54058
+1	1	-0.18578	-0.45336	1.5468	0.99679	0.11821	1.0476
+1	2	-0.60607	-1.1275	-0.90963	-0.69014	-0.33163	-1.2734
+1	1	-0.35353	-0.42708	0.78989	0.14094	-0.056632	0.80598
+1	1	-0.020221	-1.1235	1.9782	-0.041281	0.19857	1.2488
+1	1	1.2346	-0.37121	1.3325	1.1237	-0.027458	1.0044
+2	2	-0.54489	1.6812	-0.59836	-0.012441	0.41243	-0.58835
+2	1	-0.029577	2.1707	1.3285	1.2109	0.29684	0.90646
+2	2	0.70774	1.0606	-1.3996	-0.020914	-0.60955	-1.2187
+2	1	0.07926	0.52862	1.3994	0.54549	0.55303	0.16155
+1	1	0.041856	-0.92023	0.87269	-0.66601	-0.15945	0.1004
+1	2	0.17665	0.31945	-1.7756	-0.60442	0.020525	-1.0625
+1	1	-0.090238	-0.65111	0.56993	-0.4117	-0.19486	-0.18849
+1	2	0.059166	-0.47194	-0.69068	-0.41022	0.25867	-0.057175
+1	2	0.10473	0.66887	0.082035	-0.55975	-0.28439	-1.468
+1	1	-0.20937	-0.36621	0.09609	0.28164	0.24673	-0.11107
+1	2	-1.2678	0.22369	-0.42201	-0.70103	0.075915	-1.3347
+1	2	-0.35467	0.11166	-0.42144	-0.095223	-0.29936	-0.68322
+2	2	0.84875	1.24	-0.81217	0.084034	-0.32224	-1.6241
+2	1	-0.45939	1.3208	0.97993	1.2991	-0.015791	1.487
+1	2	-0.42254	-0.57928	-0.58529	-2.2375	0.51999	-0.79909
+2	1	0.32092	-0.13796	0.67098	0.24639	-0.36066	-0.032948
+1	2	-1.2408	-0.94836	0.026276	-0.37981	-0.02237	-0.38777
+2	2	0.20959	2.1466	-1.7027	-1.3169	-0.16515	-1.046
+2	2	-0.10482	1.3773	-1.2998	-0.014223	0.34065	-0.35362
+1	2	-0.66188	-1.2477	-0.62084	0.27682	0.1674	-0.8918
+1	1	-0.97246	-0.73017	1.3843	1.5549	0.1067	0.85754
+1	1	0.74567	-0.032694	1.1153	0.97318	-0.0033905	0.85059
+2	2	0.29324	-0.090608	-0.4945	-1.0484	-0.14987	-1.0141
+2	1	-0.86818	0.44948	1.8531	0.51896	-0.021141	1.8486
+1	2	0.362	-0.29749	-0.66525	0.21709	-0.15594	-1.4087
+1	2	-0.17675	0.36465	-0.45423	-1.262	0.22968	-1.246
+1	2	-0.34633	-0.16067	-1.2216	-1.3019	-0.040891	-1.2935
+1	2	0.44608	-0.57732	0.25606	-1.1664	0.54705	-0.19859
+1	2	0.45398	-0.55214	-0.33433	-0.085418	-0.10094	-0.48509
+1	2	0.12407	0.022419	-1.0312	-0.47727	0.20924	-1.2961
+1	1	-0.76644	-1.1794	1.2345	0.84756	0.1532	0.77648
+1	2	-0.10329	-0.53768	-0.67677	-0.58708	-0.014634	-0.036347
+1	1	0.2378	0.15372	0.49652	0.29193	0.19047	1.152
+1	2	0.024605	-0.38937	-0.89907	-0.42106	0.16921	-0.80893
+1	2	0.28812	0.26265	-0.94234	-0.88527	-0.49803	0.48254
+1	1	0.85086	0.11783	1.5014	1.2382	0.24441	1.3649
+2	2	0.86172	0.14894	-0.4846	-1.3488	-0.41844	-1.1372
+1	2	0.67971	-0.27488	-0.50687	-0.79153	-0.093399	-1.391
+1	1	-0.91977	-0.66099	0.5801	0.46587	-0.2263	1.43
+1	2	0.88213	-0.48674	-0.42406	-1.2762	0.28981	-1.0813
+2	1	-0.36583	0.51518	1.4491	1.4995	-0.073755	1.1218
+1	1	-0.54006	-0.59443	0.81263	0.65809	-0.15621	1.2508
+2	2	1.2125	-0.012648	-0.92657	-0.81972	-0.1536	-1.0176
+1	2	0.42493	0.34558	-1.7672	-1.3503	-0.045928	0.37449
+1	1	0.17097	-0.86593	-0.13424	1.0257	0.058014	0.91044
+2	1	-1.393	0.5338	1.8514	2.291	0.15305	0.30028
+1	1	-0.58552	-1.5337	1.5133	0.9976	0.64638	1.4428
+1	2	0.046272	-0.56387	-0.86063	-1.0462	0.014457	-1.3038
+1	2	0.34933	-0.16796	-0.27854	-0.27327	-0.0040928	-0.17912
+1	1	-1.0672	0.3979	1.208	0.50111	-0.013978	0.015097
+1	2	0.31052	-0.46723	-1.1237	0.59267	0.30978	-1.0169
+1	2	-0.55337	-0.42776	-0.12612	-0.41838	-0.56558	-0.58189
+2	2	0.3925	0.15644	-0.72963	-0.66601	-0.10837	-0.27787
+1	2	-0.48513	-1.4119	-0.16889	-0.19646	-0.068098	-0.084247
+2	2	0.16692	1.5447	-1.3064	-1.3338	-0.25668	-0.48832
+1	2	-0.36092	0.31518	-0.44815	-1.4019	-0.47505	-0.37187
+1	1	-1.8192	-0.57745	1.1304	0.262	-0.3595	0.58577
+1	1	-0.065383	0.07156	1.4931	2.3215	0.85149	1.4585
+2	1	-1.119	0.70896	1.0498	0.74334	0.75838	1.6107
+2	2	-0.17682	-0.21029	-0.74465	-0.83806	0.10827	-1.2829
+1	2	0.69834	-0.082402	0.64008	-0.83119	-0.26766	0.36961
+2	2	-0.28266	1.1929	-0.15174	0.098554	-0.33989	-0.6376
+2	2	1.5369	1.8434	0.0030761	-0.59703	0.14497	-1.5165
+1	2	0.35023	-0.28475	-0.93594	-1.0937	-0.46614	-2.188
+2	1	0.62308	1.0873	-0.0037182	0.86847	-0.48699	-0.10105
+1	1	-1.0408	-0.99866	2.0799	1.1634	0.092516	0.30401
+1	1	-0.87125	-0.88987	1.0278	1.0157	-0.23725	1.2377
+1	2	-0.020591	-0.03398	-0.024834	-1.3588	-0.045961	-0.89693
+1	1	0.9213	-0.57037	1.044	1.2994	0.046517	0.66563
+1	2	-0.87288	-0.96382	-0.704	-1.2184	0.046903	-0.30008
+1	2	0.77586	-0.34168	-0.09867	-0.37744	-0.24309	-0.13441
+2	1	0.19521	0.67595	1.4533	1.5115	0.19553	0.79596
+2	1	-1.3273	1.0891	1.2544	0.98928	0.045725	0.54963
+2	2	0.59176	0.65915	-0.84578	-0.080229	-0.26961	0.24045
+1	2	-0.66958	-1.042	-1.2138	-0.7612	-0.22775	-0.40062
+1	2	1.1154	-0.57069	-0.6592	-2.1961	-0.013175	0.46007
+1	2	-0.5254	0.0031225	-0.77758	0.8169	0.13224	-0.65572
+2	1	0.24551	1.5078	0.10719	1.1454	0.70578	0.59051
+1	2	0.29875	-0.11455	-1.0497	-0.77881	0.080708	-0.48337
+1	1	-0.1047	0.011628	1.2504	0.41776	-0.20102	1.2252
+1	2	0.44808	-0.8165	-0.080134	-0.49618	0.051011	-0.71722
+2	1	2.0365	1.5592	1.3257	1.2472	-0.47899	0.10943
+1	1	-0.16507	-0.66011	0.98739	0.58519	0.245	-0.43277
+1	2	-0.028366	-0.16961	-1.3266	0.14248	-0.24634	-1.1154
+2	1	0.92842	1.8842	1.3169	1.0358	-0.20988	0.88021
+2	2	0.33158	0.32463	-0.50924	0.40233	0.54391	-0.24309
+1	2	1.2555	0.1928	-0.487	0.048779	-0.23483	-1.477
+2	1	0.75021	0.85943	-0.2323	0.10748	-0.68906	0.84276
+2	2	0.6297	1.7397	-1.6136	-0.43268	-0.21442	-0.77462
+2	1	0.53168	1.0807	1.0853	0.62304	0.44036	0.48087
+1	2	-0.31256	-0.69771	-0.88556	-1.333	0.038614	-1.5744
+1	2	-0.039695	-0.52447	0.91401	-0.93272	0.53434	-0.080746
+2	1	-0.16596	0.56821	0.76008	0.45442	0.10286	0.6539
+1	2	-0.4331	-0.89669	-1.3097	-1.2157	0.1065	-0.8512
+1	2	-0.34708	-0.51457	-1.012	-0.39437	-0.55374	-1.144
+2	2	0.024082	0.7128	-1.3702	-1.4492	-0.10228	-0.59071
+1	2	-0.0037109	-0.68845	-0.649	-0.91581	0.066805	-0.98583
+2	1	0.68706	0.067424	0.87139	0.7938	-0.099645	1.529
+2	2	-0.31183	0.57814	-0.80815	-0.66724	-0.31919	-0.61319
+1	2	-0.11153	-0.6246	-0.27979	-0.18363	0.83639	0.014919
+2	2	0.20406	1.5838	-0.96334	-1.1228	-0.17808	-1.2123
+2	2	-0.1134	0.63358	-0.53321	-0.84276	-0.27657	-0.36992
+1	2	0.25517	0.67006	-0.1349	0.18275	0.40982	-0.62487
+1	1	-1.2684	0.31042	0.91155	0.66143	0.2483	-0.12434
+1	1	-0.97542	-0.85419	0.7663	0.16362	-0.18737	0.67266
+1	2	-0.043882	-0.62746	-0.82816	-0.40626	-0.051048	-0.61297
+1	1	0.59605	-0.45852	1.2962	0.78156	-0.48154	0.17778
+2	2	-0.06266	1.1144	-0.80524	-0.3189	-0.16038	-0.96372
+1	2	-1.1821	1.0798	-1.3407	-0.52643	0.12458	-0.7871
+2	2	0.59446	0.89186	-0.97856	-0.64658	0.2712	-1.5538
+1	2	0.15067	0.41827	-1.0487	-1.0551	0.19143	-1.4537
+1	2	-1.073	0.022587	-1.7088	-1.3777	0.1964	-0.84025
+2	1	0.20928	1.8026	1.2073	2.78	0.15131	0.3448
+1	2	-1.1317	-0.6359	-0.70457	-1.676	-0.22886	-0.58769
+1	1	-0.039428	-0.58746	0.56	0.7896	-0.052581	0.99511
+1	2	0.55023	-0.20403	0.138	-0.70518	0.66927	-0.28861
+2	2	0.57423	1.1886	0.092876	0.025677	-0.41099	-1.2858
+2	2	-0.14179	1.5827	-0.94328	0.7703	-0.43967	-0.50448
+2	2	0.14666	1.0492	-0.0030259	-0.62418	-0.087515	-0.048386
diff --git a/sourcecodes/data/example2_test/exAk.txt b/sourcecodes/data/example2_test/exAk.txt
new file mode 100644
index 00000000..29d6383b
--- /dev/null
+++ b/sourcecodes/data/example2_test/exAk.txt
@@ -0,0 +1 @@
+100
diff --git a/sourcecodes/data/example2_test/exAparent.txt b/sourcecodes/data/example2_test/exAparent.txt
new file mode 100644
index 00000000..b8626c4c
--- /dev/null
+++ b/sourcecodes/data/example2_test/exAparent.txt
@@ -0,0 +1 @@
+4
diff --git a/sourcecodes/data/example2_test/exAstructure_input.txt b/sourcecodes/data/example2_test/exAstructure_input.txt
new file mode 100644
index 00000000..410c0fa4
--- /dev/null
+++ b/sourcecodes/data/example2_test/exAstructure_input.txt
@@ -0,0 +1,9 @@
+Geno1	Geno2	Trait1	Trait2	Trait3	Trait4	Trait5	Trait6	
+0	0	0	1	0	0	0	0	
+0	0	0	0	1	1	0	1	
+0	0	0	0	0	0	0	0	
+0	0	1	0	0	1	0	0	
+0	0	0	0	0	1	0	0	
+0	0	0	0	0	0	0	0	
+0	0	0	0	0	0	0	0	
+0	0	0	0	0	0	0	0	
diff --git a/sourcecodes/data/example2_test/exAstructure_input_temp.txt b/sourcecodes/data/example2_test/exAstructure_input_temp.txt
new file mode 100644
index 00000000..27bddc96
--- /dev/null
+++ b/sourcecodes/data/example2_test/exAstructure_input_temp.txt
@@ -0,0 +1,9 @@
+Geno1	Geno2	Trait1	Trait2	Trait3	Trait4	Trait5	Trait6	
+0.000000	0.030654	0.000000	1.000000	0.000000	0.000000	0.350069	0.000000	
+0.030654	0.000000	0.049399	0.000000	1.000000	1.000000	0.000000	1.000000	
+0.000000	0.000000	0.000000	0.000000	0.025163	0.000000	0.123845	0.000000	
+0.000000	0.000000	1.000000	0.000000	0.000000	1.000000	0.053585	0.000000	
+0.000000	0.000000	0.013273	0.108604	0.000000	1.000000	0.010570	0.391609	
+0.000000	0.000000	0.013713	0.000000	0.000000	0.000000	0.011282	0.026127	
+0.000000	0.000000	0.028672	0.000000	0.000000	0.000000	0.000000	0.137567	
+0.000000	0.000000	0.136004	0.056792	0.457123	0.029978	0.069699	0.000000	
diff --git a/sourcecodes/data/example2_test/exAthr.txt b/sourcecodes/data/example2_test/exAthr.txt
new file mode 100644
index 00000000..2eb3c4fe
--- /dev/null
+++ b/sourcecodes/data/example2_test/exAthr.txt
@@ -0,0 +1 @@
+0.5
diff --git a/sourcecodes/data/example2_test/exAwhite.txt b/sourcecodes/data/example2_test/exAwhite.txt
new file mode 100644
index 00000000..83e81b8b
--- /dev/null
+++ b/sourcecodes/data/example2_test/exAwhite.txt
@@ -0,0 +1 @@
+From	To
diff --git a/sourcecodes/data/example_chl/bWRstructure_input.txt b/sourcecodes/data/example_chl/bWRstructure_input.txt
index efa98e06..1114285f 100644
--- a/sourcecodes/data/example_chl/bWRstructure_input.txt
+++ b/sourcecodes/data/example_chl/bWRstructure_input.txt
@@ -1,7 +1,6 @@
-Ctrq3	MAS	Neutrophil	Load	Weight
-0	1	1	1	1
-0	0	1	1	0
-0	0	0	0	1
-0	0	0	0	0
-0	0	0	0	0
-
+Ctrq3	MAS	Neutrophil	Load	Weight	
+0	1	1	1	1	
+0	0	1	1	0	
+0	0	0	0	1	
+0	0	0	0	0	
+0	0	0	0	0	
diff --git a/sourcecodes/data/example_chl/bWRstructure_input_temp.txt b/sourcecodes/data/example_chl/bWRstructure_input_temp.txt
new file mode 100644
index 00000000..dd28b6b9
--- /dev/null
+++ b/sourcecodes/data/example_chl/bWRstructure_input_temp.txt
@@ -0,0 +1,6 @@
+Ctrq3	MAS	Neutrophil	Load	Weight	
+0.000000	0.971631	0.988653	0.975655	0.808347	
+0.000000	0.000000	0.574946	0.600694	0.458029	
+0.000000	0.423826	0.000000	0.140335	0.962872	
+0.000000	0.399237	0.131467	0.000000	0.470194	
+0.000000	0.000000	0.000000	0.000000	0.000000	
diff --git a/sourcecodes/data/example_chl/bWRcontinuous_input.txt b/sourcecodes/data/example_chl/old_gn/bWRcontinuous_input.txt
index cf674ffd..cf674ffd 100644
--- a/sourcecodes/data/example_chl/bWRcontinuous_input.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRcontinuous_input.txt
diff --git a/sourcecodes/data/example_chl/old_gn/bWRcontinuous_input_orig.txt b/sourcecodes/data/example_chl/old_gn/bWRcontinuous_input_orig.txt
new file mode 100644
index 00000000..62705bb9
--- /dev/null
+++ b/sourcecodes/data/example_chl/old_gn/bWRcontinuous_input_orig.txt
@@ -0,0 +1,42 @@
+Ctrq3	MAS	Neutrophil	Load	Weight
+2	0.969230769	3	3.252367514	1
+2	0.925170068	1.6	2.46322088	1.033472803
+1	0.427272727	33.8	4.206610024	0.831372549
+2	0.877835951	8.3	3.764250875	0.967153285
+2	0.914862915	4.4	3.691700208	1.046025105
+2	0.560334528	4.9	2.604550033	0.98046875
+1	0.383073497	13.1	4.273556814	0.812316716
+1	0.101010101	18.6	5.089640217	0.771929825
+1	0.106719368	18.9	4.915125346	0.80994152
+2	0.894736842	2.5	2.691700208	0.995515695
+1	0.067226891	19.8	4.878194228	0.846153846
+2	0.921022067	2.9	4.127428778	1.03875969
+2	0.938701923	0.7	4.366310867	0.984732824
+1	0.658008658	15.7	4.531121115	0.884210526
+2	0.9	4.8	2.604550033	0.913194444
+2	0.790923825	10.4	2.390670213	0.892857143
+1	0.295539033	8.6	4.24137213	0.85840708
+2	0.317757009	12.2	4.449648073	0.889830508
+1	0.032418953	20.2	5.053428044	0.811320755
+1	0.603960396	23.4	4.283775979	0.805460751
+2	0.939351199	3.6	2.349277527	0.952380952
+1	0.978448276	0.4	3.495405563	0.8875
+1	0.1	23.2	4.675613388	0.766101695
+1	0.036363636	32.6	4.938109253	0.828125
+1	0.660247593	9.2	3.826398782	0.921052632
+1	0.078651685	35.8	4.513630383	0.852112676
+1	0.186915888	20.7	5.048247532	0.779761905
+1	0.071578947	35.6	4.574586809	0.797356828
+1	0.239520958	15.4	4.331548761	0.941176471
+1	0.205741627	24.5	5.058547488	0.774193548
+1	0.062300319	13.4	4.594790195	0.832236842
+2	0.599675851	5	4.18178644	0.969348659
+1	0.324246772	13.5	4.252367514	0.858585859
+1	0.87628866	14.2	2.929061124	0.869863014
+1	0.146103896	15.6	4.579726449	0.9
+1	0.257383966	22.5	5.210214148	0.75
+1	0.033333333	31.1	4.632578756	0.718644068
+1	0.29739777	36.1	3.880756445	0.798353909
+2	0.872979215	4.2	4.097465554	0.856756757
+2	0.909221902	4.3	3.650307523	0.976
+1	0.10041841	28.3	4.46322088	0.757462687
diff --git a/sourcecodes/data/example_chl/bWRgraphviz.txt b/sourcecodes/data/example_chl/old_gn/bWRgraphviz.txt
index 2cd4e8cd..2cd4e8cd 100644
--- a/sourcecodes/data/example_chl/bWRgraphviz.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRgraphviz.txt
diff --git a/sourcecodes/data/example_chl/bWRmap.txt b/sourcecodes/data/example_chl/old_gn/bWRmap.txt
index b24eae2f..b24eae2f 100644
--- a/sourcecodes/data/example_chl/bWRmap.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRmap.txt
diff --git a/sourcecodes/data/example_chl/bWRmapdata.txt b/sourcecodes/data/example_chl/old_gn/bWRmapdata.txt
index ce5416ce..ce5416ce 100644
--- a/sourcecodes/data/example_chl/bWRmapdata.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRmapdata.txt
diff --git a/sourcecodes/data/example_chl/bWRname.txt b/sourcecodes/data/example_chl/old_gn/bWRname.txt
index 48018335..48018335 100644
--- a/sourcecodes/data/example_chl/bWRname.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRname.txt
diff --git a/sourcecodes/data/example_chl/bWRnet_figure.txt b/sourcecodes/data/example_chl/old_gn/bWRnet_figure.txt
index 6a3a1dbc..6a3a1dbc 100644
--- a/sourcecodes/data/example_chl/bWRnet_figure.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRnet_figure.txt
diff --git a/sourcecodes/data/example_chl/bWRnet_figure_new.txt b/sourcecodes/data/example_chl/old_gn/bWRnet_figure_new.txt
index 9b493660..9b493660 100644
--- a/sourcecodes/data/example_chl/bWRnet_figure_new.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRnet_figure_new.txt
diff --git a/sourcecodes/data/example_chl/bWRnlevels.txt b/sourcecodes/data/example_chl/old_gn/bWRnlevels.txt
index 9f618060..9f618060 100644
--- a/sourcecodes/data/example_chl/bWRnlevels.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRnlevels.txt
diff --git a/sourcecodes/data/example_chl/bWRnnode.txt b/sourcecodes/data/example_chl/old_gn/bWRnnode.txt
index 7ed6ff82..7ed6ff82 100644
--- a/sourcecodes/data/example_chl/bWRnnode.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRnnode.txt
diff --git a/sourcecodes/data/example_chl/bWRparameters.txt b/sourcecodes/data/example_chl/old_gn/bWRparameters.txt
index 6d6eabf6..6d6eabf6 100644
--- a/sourcecodes/data/example_chl/bWRparameters.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRparameters.txt
diff --git a/sourcecodes/data/example_chl/old_gn/bWRstructure_input.txt b/sourcecodes/data/example_chl/old_gn/bWRstructure_input.txt
new file mode 100644
index 00000000..efa98e06
--- /dev/null
+++ b/sourcecodes/data/example_chl/old_gn/bWRstructure_input.txt
@@ -0,0 +1,7 @@
+Ctrq3	MAS	Neutrophil	Load	Weight
+0	1	1	1	1
+0	0	1	1	0
+0	0	0	0	1
+0	0	0	0	0
+0	0	0	0	0
+
diff --git a/sourcecodes/data/example_chl/bWRstructure_old.txt b/sourcecodes/data/example_chl/old_gn/bWRstructure_old.txt
index a6aed858..a6aed858 100644
--- a/sourcecodes/data/example_chl/bWRstructure_old.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRstructure_old.txt
diff --git a/sourcecodes/data/example_chl/bWRtype.txt b/sourcecodes/data/example_chl/old_gn/bWRtype.txt
index 03b402ee..03b402ee 100644
--- a/sourcecodes/data/example_chl/bWRtype.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRtype.txt
diff --git a/sourcecodes/data/example_chl/bWRvar.txt b/sourcecodes/data/example_chl/old_gn/bWRvar.txt
index 56a6051c..56a6051c 100644
--- a/sourcecodes/data/example_chl/bWRvar.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRvar.txt
diff --git a/sourcecodes/data/example_chl/bWRvardata.txt b/sourcecodes/data/example_chl/old_gn/bWRvardata.txt
index 56a6051c..56a6051c 100644
--- a/sourcecodes/data/example_chl/bWRvardata.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRvardata.txt
diff --git a/sourcecodes/data/example_chl/bWRvarname.txt b/sourcecodes/data/example_chl/old_gn/bWRvarname.txt
index 6ef2df09..6ef2df09 100644
--- a/sourcecodes/data/example_chl/bWRvarname.txt
+++ b/sourcecodes/data/example_chl/old_gn/bWRvarname.txt
diff --git a/sourcecodes/data/example_sample/sample_input.txt b/sourcecodes/data/example_sample/sample_input.txt
new file mode 100644
index 00000000..13ee69e5
--- /dev/null
+++ b/sourcecodes/data/example_sample/sample_input.txt
@@ -0,0 +1,42 @@
+Geno	Trait1	Trait2	Trait3	Phenotype
+A	0.969230769	3	3.252367514	1
+A	0.925170068	1.6	2.46322088	1.033472803
+B	0.427272727	33.8	4.206610024	0.831372549
+A	0.877835951	8.3	3.764250875	0.967153285
+A	0.914862915	4.4	3.691700208	1.046025105
+A	0.560334528	4.9	2.604550033	0.98046875
+B	0.383073497	13.1	4.273556814	0.812316716
+B	0.101010101	18.6	5.089640217	0.771929825
+B	0.106719368	18.9	4.915125346	0.80994152
+2	0.894736842	2.5	2.691700208	0.995515695
+1	0.067226891	19.8	4.878194228	0.846153846
+2	0.921022067	2.9	4.127428778	1.03875969
+2	0.938701923	0.7	4.366310867	0.984732824
+1	0.658008658	15.7	4.531121115	0.884210526
+2	0.9	4.8	2.604550033	0.913194444
+2	0.790923825	10.4	2.390670213	0.892857143
+1	0.295539033	8.6	4.24137213	0.85840708
+2	0.317757009	12.2	4.449648073	0.889830508
+1	0.032418953	20.2	5.053428044	0.811320755
+1	0.603960396	23.4	4.283775979	0.805460751
+2	0.939351199	3.6	2.349277527	0.952380952
+1	0.978448276	0.4	3.495405563	0.8875
+1	0.1	23.2	4.675613388	0.766101695
+1	0.036363636	32.6	4.938109253	0.828125
+1	0.660247593	9.2	3.826398782	0.921052632
+1	0.078651685	35.8	4.513630383	0.852112676
+1	0.186915888	20.7	5.048247532	0.779761905
+1	0.071578947	35.6	4.574586809	0.797356828
+1	0.239520958	15.4	4.331548761	0.941176471
+1	0.205741627	24.5	5.058547488	0.774193548
+1	0.062300319	13.4	4.594790195	0.832236842
+2	0.599675851	5	4.18178644	0.969348659
+1	0.324246772	13.5	4.252367514	0.858585859
+1	0.87628866	14.2	2.929061124	0.869863014
+1	0.146103896	15.6	4.579726449	0.9
+1	0.257383966	22.5	5.210214148	0.75
+1	0.033333333	31.1	4.632578756	0.718644068
+1	0.29739777	36.1	3.880756445	0.798353909
+2	0.872979215	4.2	4.097465554	0.856756757
+2	0.909221902	4.3	3.650307523	0.976
+1	0.10041841	28.3	4.46322088	0.757462687
diff --git a/sourcecodes/data/example_sample/sample_input.txt~ b/sourcecodes/data/example_sample/sample_input.txt~
new file mode 100644
index 00000000..62705bb9
--- /dev/null
+++ b/sourcecodes/data/example_sample/sample_input.txt~
@@ -0,0 +1,42 @@
+Ctrq3	MAS	Neutrophil	Load	Weight
+2	0.969230769	3	3.252367514	1
+2	0.925170068	1.6	2.46322088	1.033472803
+1	0.427272727	33.8	4.206610024	0.831372549
+2	0.877835951	8.3	3.764250875	0.967153285
+2	0.914862915	4.4	3.691700208	1.046025105
+2	0.560334528	4.9	2.604550033	0.98046875
+1	0.383073497	13.1	4.273556814	0.812316716
+1	0.101010101	18.6	5.089640217	0.771929825
+1	0.106719368	18.9	4.915125346	0.80994152
+2	0.894736842	2.5	2.691700208	0.995515695
+1	0.067226891	19.8	4.878194228	0.846153846
+2	0.921022067	2.9	4.127428778	1.03875969
+2	0.938701923	0.7	4.366310867	0.984732824
+1	0.658008658	15.7	4.531121115	0.884210526
+2	0.9	4.8	2.604550033	0.913194444
+2	0.790923825	10.4	2.390670213	0.892857143
+1	0.295539033	8.6	4.24137213	0.85840708
+2	0.317757009	12.2	4.449648073	0.889830508
+1	0.032418953	20.2	5.053428044	0.811320755
+1	0.603960396	23.4	4.283775979	0.805460751
+2	0.939351199	3.6	2.349277527	0.952380952
+1	0.978448276	0.4	3.495405563	0.8875
+1	0.1	23.2	4.675613388	0.766101695
+1	0.036363636	32.6	4.938109253	0.828125
+1	0.660247593	9.2	3.826398782	0.921052632
+1	0.078651685	35.8	4.513630383	0.852112676
+1	0.186915888	20.7	5.048247532	0.779761905
+1	0.071578947	35.6	4.574586809	0.797356828
+1	0.239520958	15.4	4.331548761	0.941176471
+1	0.205741627	24.5	5.058547488	0.774193548
+1	0.062300319	13.4	4.594790195	0.832236842
+2	0.599675851	5	4.18178644	0.969348659
+1	0.324246772	13.5	4.252367514	0.858585859
+1	0.87628866	14.2	2.929061124	0.869863014
+1	0.146103896	15.6	4.579726449	0.9
+1	0.257383966	22.5	5.210214148	0.75
+1	0.033333333	31.1	4.632578756	0.718644068
+1	0.29739777	36.1	3.880756445	0.798353909
+2	0.872979215	4.2	4.097465554	0.856756757
+2	0.909221902	4.3	3.650307523	0.976
+1	0.10041841	28.3	4.46322088	0.757462687
diff --git a/sourcecodes/data/sample_input.txt b/sourcecodes/data/sample_input.txt
new file mode 100644
index 00000000..5d900d3c
--- /dev/null
+++ b/sourcecodes/data/sample_input.txt
@@ -0,0 +1,42 @@
+Genotype	Trait1	Trait2	Trait3	Phenotype
+A	0.969	3	3.25	1.0
+NA	0.925	1.6	2.46	1.03
+B	0.427	NA	4.20	0.83
+A	0.877	8.3	3.76	0.96
+A	0.914	4.4	3.69	1.04
+A	0.560	4.9	2.60	0.98
+B	0.383	13.1	4.27	0.81
+B	0.101	18.6	5.08	0.77
+B	0.106	18.9	4.91	0.80
+A	0.894	2.5	2.69	0.99
+B	0.067	19.8	4.87	0.84
+A	0.921	2.9	4.12	1.03
+A	0.938	0.7	4.36	0.98
+B	0.658	15.7	4.53	0.88
+A	0.9	4.8	2.60	0.91
+A	0.790	10.4	2.39	0.89
+B	0.295	8.6	4.24	0.85
+A	0.317	12.2	4.44	0.88
+B	0.032	20.2	5.05	0.81
+B	0.603	23.4	4.28	0.80
+A	0.939	3.6	2.34	0.95
+B	0.978	0.4	3.49	0.88
+B	0.1	23.2	4.67	0.76
+B	0.036	32.6	4.93	0.82
+B	0.660	9.2	3.82	0.92
+B	0.078	35.8	4.51	0.85
+B	0.186	20.7	5.04	0.77
+B	0.071	35.6	4.57	0.79
+B	0.239	15.4	4.33	0.94
+B	0.205	24.5	5.05	0.77
+B	0.062	13.4	4.59	0.83
+A	0.599	5	4.18	0.96
+B	0.324	13.2	4.25	0.85
+B	0.876	14.2	2.92	0.86
+B	0.146	15.6	4.57	0.9
+B	0.257	22.5	5.21	0.75
+B	0.033	31.1	4.63	0.71
+B	0.297	36.1	3.88	0.79
+A	0.872	4.2	4.09	0.85
+A	0.909	4.3	3.65	0.97
+B	0.100	28.3	4.46	0.75
diff --git a/sourcecodes/delete_cv_pred.sh b/sourcecodes/delete_cv_pred.sh
new file mode 100644
index 00000000..b756e2b6
--- /dev/null
+++ b/sourcecodes/delete_cv_pred.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+#cd ./data/
+#cd /tmp/bnw/
+cd /var/lib/genenet/bnw/
+temp='looCV_temp.txt'
+rm $1$temp
+temp='looCV.txt'
+rm $1$temp
+rm $1$temp
+temp='loo_plotly.html'
+temp='kfoldCV_temp.txt'
+rm $1$temp
+temp='kfoldCV.txt'
+rm $1$temp
+temp='kfold_plotly.html'
+rm $1$temp
+temp='ts_upload.txt'
+rm $1$temp
+temp='ts_output.txt'
+rm $1$temp
+temp='ts_plotly.html'
+rm $1$temp
diff --git a/sourcecodes/enter_netID.php b/sourcecodes/enter_netID.php
index f90f78db..219ea966 100644
--- a/sourcecodes/enter_netID.php
+++ b/sourcecodes/enter_netID.php
@@ -36,26 +36,22 @@ function test_input($data) {
 
 
 <!-- Site navigation menu -->
-<ul class="navbar">
+<ul class="navbar2">
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
 </ul>
 
 <div id="outer">
 <!-- Main content -->
-<br>
-<br>
-<h1>Enter network ID from previously used network</h1>
-<br>
+<h2>Enter network ID from previously used network</h2>
 <p align="justify"> 
-  Networks that have previously been generated in BNW can be accessed by entering the network ID in the input box below. The network ID is currently a three character string that can be found on the left hand menu of any network page. Network files are periodically deleted from BNW so it is possible that older networks may no longer be active.
+<br>  Networks that have previously been generated in BNW can be accessed by entering the network ID in the input box below. The network ID is currently a three character string that can be found on the left hand menu of any network page. Network files are periodically deleted from BNW so it is possible that older networks may no longer be active.
 <br>
 <br>
 <p><span class="error"></span></p>
 <FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
     Network ID:<INPUT TYPE="text" name="netID" value="<?php echo $netID;?>" style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px;
-display: block; height: 30px; width: 100px;"><span class="error"> <?php echo $netIDErr;?></span>
-<br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
+display: block; height: 30px; width: 100px;"><span class="error"> <?php echo $netIDErr;?></span><input class="button2" type="submit" name="submit" value="Submit">
 </FORM>
 </p>
 <br>
@@ -66,7 +62,7 @@ if ($netIDErr=="1")
   $keyval=$netID;
 ?>
 <script>
-  window.open("layout.php?My_key=<?php print($keyval);?>",'_self',false);  
+  window.open("layout_svg_no.php?My_key=<?php print($keyval);?>",'_self',false);  
 </script>
 <?php
 }
diff --git a/sourcecodes/enter_netID.php~ b/sourcecodes/enter_netID.php~
new file mode 100644
index 00000000..c58e63f3
--- /dev/null
+++ b/sourcecodes/enter_netID.php~
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<html>
+
+<?php 
+
+include("header_new.inc");
+include("input_validate.php");
+
+$netID = "";
+$netIDErr = "";
+if ($_SERVER["REQUEST_METHOD"] == "POST") {
+  if (empty($_POST["netID"])) {
+    $netIDErr = "Entering a network ID is required";
+  } else {
+    //    $netID = valid_keyval($_POST["netID"]);
+    $netIDErr = "1";
+    $netID = test_input($_POST["netID"]);
+    //    $netIDErr = "1";
+    // check if name only contains letters
+    if (strlen($netID)!=3) {
+          $netIDErr = "Network ID must be three letters"; 
+    }
+    if (!preg_match('/^[a-zA-Z]+$/',$netID)) {
+          $netIDErr = "Only letters are allowed"; 
+    }
+  }
+}
+
+function test_input($data) {
+  $data = trim($data);
+  $data = stripslashes($data);
+  $data = htmlspecialchars($data);
+  return $data;
+}
+?>
+
+
+<!-- Site navigation menu -->
+<ul class="navbar">
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+<div id="outer">
+<!-- Main content -->
+<h2>Enter network ID from previously used network</h2>
+<p align="justify"> 
+<br>  Networks that have previously been generated in BNW can be accessed by entering the network ID in the input box below. The network ID is currently a three character string that can be found on the left hand menu of any network page. Network files are periodically deleted from BNW so it is possible that older networks may no longer be active.
+<br>
+<br>
+<p><span class="error"></span></p>
+<FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
+    Network ID:<INPUT TYPE="text" name="netID" value="<?php echo $netID;?>" style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px;
+display: block; height: 30px; width: 100px;"><span class="error"> <?php echo $netIDErr;?></span>
+<br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
+</FORM>
+</p>
+<br>
+
+<?php
+if ($netIDErr=="1")
+{
+  $keyval=$netID;
+?>
+<script>
+  window.open("layout_svg_no.php?My_key=<?php print($keyval);?>",'_self',false);  
+</script>
+<?php
+}
+?>
+
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/sourcecodes/example.php b/sourcecodes/example.php
index 11c74633..d831b32d 100644
--- a/sourcecodes/example.php
+++ b/sourcecodes/example.php
@@ -1,6 +1,8 @@
 <?php
 include("input_validate.php");
 $oldkeyval=$_GET["My_key"];
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $type_n=array();
 
@@ -23,9 +25,73 @@ $alpha="$alphas[$al1]"."$alphas[$al2]"."$alphas[$al3]";
 $keyval=$alpha;
 shell_exec('./examplefilecopy.sh '.$example.' '.$oldkeyval.' '.$keyval);
 
+
+shell_exec('./run_scripts/run_prep_input '.$keyval);
+
+
+/////////////////////////////////structure matrix////////////////////////////
+
+$matfile=$dir.$keyval."structure_input.txt";
+
+$fout=fopen($dir.$keyval."graphviz.txt","w");
+
+$matrix1=file_get_contents("$matfile");
+$str_arrmat=array();
+$str_arrmat=explode("\n",$matrix1);
+$datamat=array();
+$data_cell=array();
+
+$dataname=array();
+$dataname=explode("\t",$str_arrmat[0]);
+$n=count($dataname);
+
+$initialstring="digraph G {\n"."size=\"6,8\";\n"."node [shape=square,width=1.5];\n";
+$endstring="}";
+fwrite($fout,"$initialstring");
+
+$g_file_name=$dir.$keyval."grviz_name_file.txt";
+$grviz_name_file=fopen($g_file_name,"w");
+
+for($i=0;$i<$n;$i++)
+  {
+    $row_name=trim($dataname[$i]);
+    fwrite($grviz_name_file,"$row_name\n");
+  }
+
+for($i=1;$i<=$n;$i++)
+  {
+    $ii=$i-1;
+    $row_name=trim($dataname[$ii]);
+
+    $col_arr=explode("\t",$str_arrmat[$i]);
+
+    for($j=0;$j<$n;$j++)
+      {
+	$col_val=trim($col_arr[$j]);
+	if($col_val==1)
+	  {
+	    $col_name=trim($dataname[$j]);
+	    fprintf($fout,"%s -> %s;\n",$ii,$j);
+	    //fprintf($fouttemp,"%s -> %s;\n",$row_name,$col_name);
+
+	  }
+      }
+
+
+  }
+fwrite($fout,"$endstring");
+fclose($fout);
+
+
+shell_exec('./run_scripts/run_octave '.$keyval);
+
+
+
+
 ?>
 <script>
-window.open("layout_example.php?My_key=<?php print($keyval);?>",'_self',false);
+ //window.open("layout_example.php?My_key=<?php print($keyval);?>",'_self',false);
+ window.open("layout_svg_no.php?My_key=<?php print($keyval);?>",'_self',false);
 </script>
 
 
diff --git a/sourcecodes/examplefilecopy.sh b/sourcecodes/examplefilecopy.sh
index cd49d670..b10aca42 100644
--- a/sourcecodes/examplefilecopy.sh
+++ b/sourcecodes/examplefilecopy.sh
@@ -6,6 +6,6 @@ do
   echo "Processing $f file..."
   new=${f//$2/$3} 
   # take action on each file. $f store current file name
-  #echo "new Processing $new file..."
-  cp $f ../$new
-done
\ No newline at end of file
+  # echo "new Processing $new file..."
+  cp $f /var/lib/genenet/bnw/$new
+done
diff --git a/sourcecodes/examples/cardiagnosis.php b/sourcecodes/examples/cardiagnosis.php
index 1c2b14e4..8cd94303 100644
--- a/sourcecodes/examples/cardiagnosis.php
+++ b/sourcecodes/examples/cardiagnosis.php
@@ -7,8 +7,8 @@ if($key=="")
 include("../header_new.inc");
 ?>
 <!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="../bn_file_load_gom.php">Learn a network model from data</a>
+<ul class="navbar2">
+  <li><a href="../bn_file_load_gom.php">Load data and begin modeling</a>
   <li><a href="../home_upload.php">Make predictions using a known structure</a>  
   <li><a href="../help.php">Help</a>
   <li><a href="../faq.php">FAQ</a>
diff --git a/sourcecodes/examples/chl_example.php b/sourcecodes/examples/chl_example.php
index f695ad5c..d46daf4e 100644
--- a/sourcecodes/examples/chl_example.php
+++ b/sourcecodes/examples/chl_example.php
@@ -7,8 +7,8 @@ if($key=="")
 include("../header_new.inc");
 ?>
 <!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="../bn_file_load_gom.php">Learn a network model from data</a>
+<ul class="navbar2">
+  <li><a href="../bn_file_load_gom.php">Load data and begin modeling</a>
   <li><a href="../home_upload.php">Make predictions using a known structure</a>  
   <li><a href="../help.php">Help</a>
   <li><a href="../faq.php">FAQ</a>
diff --git a/sourcecodes/examples/my_new_style.css b/sourcecodes/examples/my_new_style.css
index 20db184f..a84fe952 100644
--- a/sourcecodes/examples/my_new_style.css
+++ b/sourcecodes/examples/my_new_style.css
@@ -8,97 +8,196 @@ height: 100%;
 
 body {
   margin:0px;
-  font-family: Georgia, "Times New Roman",
-        Times, serif;
-  color: #33339F;
+  font-family: Arial;
+/*  color: #33339F; */
   background-color: white;
-  padding-bottom:0px; 
+  padding-bottom:10px; 
 
 }
 
+.td_title
+{
+        padding: 0;
+        margin: 0;
+	display: inline-block;
+        font-family:Arial;
+        font-size:20pt;
+        HORIZONTAL-ALIGN: center;
+        color:#FFFFFF; 
+        background-color: #3071a9;
+        //font-weight:bold;
+        //FONT-STYLE: italic;
+        text-align:left;
+	white-space: nowrap;
+	overflow: hidden;
 
+}
 
-.td_title
+.td_title_home
 {
         padding: 0;
         margin: 0;
         font-family:Arial;
         font-size:24pt;
-        HRIZONTAL-ALIGN: center;
-        color:#FFFFFF;
+        HORIZONTAL-ALIGN: center;
+        color:#FFFFFF; 
+        background-color: #3071a9;
         font-weight:bold;
         //FONT-STYLE: italic;
-        background-color: #33339F;
-        text-align:center
+        text-align:center;
+	white-space: nowrap;
+	overflow: hidden;
 
 }
 
+#outer {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 2em;
+  left: 8.5em;
+  text-align:left;
+  background:white;
+  min-width:50%;
+  min-height:50%;
+  max-width:70%;
 
+}
 
-#outer {
+#outer_home {
   padding: 0;
   margin: 0;
   position: absolute;
-  top: 9em;
-  left: 12em;
+  top: 4em;
+  left: 8.5em;
+  text-align:left;
+  background:white;
+  min-width:50%;
+  min-height:50%;
+  max-width:70%;
+}
+
+#svg_div {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 2.5em;
+  left: 8.2em;
   text-align:left;
   background:white;
   min-width:50%;
-  min-hieght:50%;
+  min-height:50%;
   max-width:70%;
 
 }
 
+
+
+#violin_div {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 2em;
+  left: 8.1em;
+  text-align:left;
+  background:white;
+  min-width:70%;
+  min-height:50%;
+  max-width:80%;
+
+}
+
 #outernew {
   padding: 0;
   margin: 0;
   position: absolute;
-  top: 9em;
-  left: 12em;
+  top: 2.5em;
+  left: 9em;
   text-align:left;
   background:white;
   min-width:50%;
-  min-hieght:50%;
+  min-height:50%;
   max-width:60%;
 
 }
 
-#outernewnew {
+#outernew_load {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 2em;
+  left: 9em;
+  text-align:left;
+  background:white;
+  width:70%;
+}
+
+#outernew_sci {
   padding: 0;
   margin: 0;
   position: absolute;
-  top: 12em;
-  left: 25em;
+  top: 2em;
+  left: 9em;
   text-align:left;
   background:white;
   min-width:50%;
-  min-hieght:50%;
-  max-width:60%;
+  min-height:50%;
+  max-width:80%;
 
 }
 
 
+ol.help {
+    margin: 0px 0;
+    padding: 0;
+    list-style: decimal;
+    list-style-position: inside;
+}    
+
+ol.help li
+{
+    margin: 0px;
+    padding: 0px;
+    text-indent: -2.2em;
+    margin-left: 3.4em;
+}
 
 ul.navbar {
   list-style-type: none;
+  display: block;
   padding: 0;
-  margin: 0;
+  margin-top: 0;
   /*position: relative;*/
   float: top;
   /*margin-top: 20px;*/
   top: 9em;
   left: 1em;
-  width: 9em }
+  width: 8em; }
+
+ul.navbar_ac {
+  list-style-type: none;
+  display: inline-block;
+  padding: 0;
+  margin-top: 0;
+  /*position: relative;*/
+  float: top;
+  /*margin-top: 20px;*/
+  top: 9em;
+  left: 1em;
+  width: 7.7em;
+ }
 
 ul.navbar2 {
   list-style-type: none;
+  display: block;
   padding: 0;
   margin: 0;
   /*position: absolute;*/
   float:top;
   top: 9em;
   left: 1em;
-  width: 9em }
+  width: 8em;
+  }
 
 ul.listbar {
   list-style-type: none;
@@ -113,26 +212,90 @@ h1 {
   font-family: Helvetica, Geneva, Arial,
         SunSans-Regular, sans-serif }
 ul.navbar li {
-/*  background: #D0A9F5; */
-  background: #33339F;
-  margin: 0.5em 0;
-  padding: 0.3em;
-  border-right: 1em solid black }
+/*  background: #D0A9F5; 
+  background: #33339F;*/
+  background: LightGrey;
+  margin-top: 0.2em;
+  margin-left: 0.1em;
+  padding: 0.2em;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+ul.navbar li:focus,
+ul.navbar li:hover {
+    background: #E5E8E8;
+    outline: 1px solid black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
 ul.navbar a {
   text-decoration: none 
 }
 ul.navbar a:link {
- color: white; }
+ color: black; }
 ul.navbar a:visited {
- color: white; }
+ color: black; }
+ul.navbar p {
+  text-decoration: none;
+  color: black;
+}
+
+ul.navbar_ac li {
+/*  background: #D0A9F5; 
+  display: inline-block; 
+  background: #33339F; */
+  background: LightGrey;
+  color: black; 
+  margin-top: 0.2em;
+  padding: 0.1em;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+ul.navbar_ac li:focus,
+ul.navbar_ac li:hover {
+    background: #E5E8E8;
+    outline: 1px solid black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+ul.navbar_ac a {
+  text-decoration: none 
+}
+ul.navbar_ac a:link {
+ color: black; }
+ul.navbar_ac a:visited {
+ color: black; }
+ul.navbar_ac p {
+  text-decoration: none;
+  color: black;
+}
+
+
 
 ul.navbar2 li {
-/*  background: #D0A9F5; */
-  background: black;
-  margin: 0.5em 0;
-  padding: 0.3em;
-  border-right: 1em solid #33339F;
-  color: white }
+/*  background: #D0A9F5; 
+  display: inline-block; */
+  background: #3071a9;
+  margin-top: 0.2em;
+  margin-left: 0.1em;
+  padding: 0.2em;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+  color:white;
+ }
+ul.navbar2 li:focus,
+ul.navbar2 li:hover {
+    background: #488AC7;
+    outline: 1px solid black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
 ul.navbar2 a {
   text-decoration: none 
 }
@@ -153,3 +316,244 @@ address {
   padding-top: 1em;
   border-top: thin dotted }
 
+
+
+.accordion {
+  font-family: Arial;
+  font-size: 12pt;
+  color: white;
+  display: block;
+  background: #3071a9;
+  margin-top: 0.2em;
+  margin-left: 0.1em;
+  border: none;
+  padding: 0.2em;
+  float:top;
+  top: 9em;
+  width: 8em;
+  text-align: left;
+  cursor: pointer;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+.accordion:hover {
+    background: #488AC7;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+
+div.panel {
+    padding: 0.2em;
+//  margin-top: 3.3em 0;
+  display: none;
+  overflow: hidden;
+ }
+
+
+div.panel.show {
+    display: inline-block ;
+    margin: 0em 0;
+}
+
+
+.button1 {
+  font-family: Arial;
+  font-size: 12pt;
+  display: inline-block;
+  color: black;
+  text-align: left;
+  width: 7.7em;
+  background: LightGrey;
+  margin-top: 0.2em;
+  padding: 0.2em;
+  border: none;
+  cursor: pointer;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+.button1:focus,
+.button1:hover {
+    background: #E5E8E8;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+
+
+.button2 {
+  font-size: 12pt;
+  display: inline-block;
+  text-align: center;
+  background: LightGrey;
+  color:black;
+  margin-top: 0.2em;
+  padding: 0.2em 0.5em;
+  border: none;
+  cursor: pointer;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+.button2:focus,
+.button2:hover {
+    background: #E5E8E8;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+.button3 {
+  font-size: 12pt;
+  display: inline-block;
+  text-align: center;
+  background: LightGrey;
+  color:black;
+  margin-top: 0.4em;
+  padding: 0.2em 0.5em;
+  border: none;
+  cursor: pointer;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+  width:30em;
+}
+.button3:focus,
+.button3:hover {
+    background: #E5E8E8;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+a.button3 a {
+  text-decoration: none; 
+}
+a.button3:link {
+ text-decoration: none; 
+ color: black; }
+a.button3:visited {
+ text-decoration: none; 
+ color: black; }
+
+
+.no-bullet{
+    list-style-type: none
+}
+
+
+
+.new-button {
+    display: inline-block;
+    padding: 8px 12px;
+    cursor: pointer;
+    border-radius: 4px;
+    background-color: LightGrey;
+    font-size: 16px;
+    color: black;
+}
+
+.inputfile {
+    width: 0.1px;
+    height: 0.1px;
+    opacity: 0;
+    overflow: hidden;
+    position: absolute;
+    z-index: -1;
+}
+
+.button-wrap {
+    position: relative;
+}
+
+.inputfile + label {
+    font: 12pt;
+    padding: 8px 12px;
+    color: black;
+    background-color: LightGrey;
+    display: inline-block;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+
+.inputfile:focus + label,
+.inputfile + label:hover {
+    background: #E5E8E8;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+
+
+input[type=range] {
+  -webkit-appearance: none;
+  width: 100%;
+}
+input[type=range]:focus {
+outline: none;
+}
+
+
+
+.table_div {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 3em;
+  left: 8.1em;
+  text-align:left;
+  background:white;
+  min-width:50%;
+  min-height:70%;
+  max-width:70%;
+}
+
+.d3_table table {
+width: 100%;
+  border-collapse: collapse;
+  margin: 6;
+}
+.d3_table caption {
+  font-size: 14pt;
+  text-align: left;
+}
+/* Zebra striping */
+.d3_table tr:nth-of-type(even) {
+background: LightGrey;
+}
+.d3_table th {
+background: #3071a9;
+color: white;
+font-size: 12pt;
+font-weight: normal;
+}
+
+.d3_table td, th {
+padding: 6px;
+border: 1px solid #ccc;
+    text-align: center;
+}
+.horizontal-header {
+background: #3071a9;
+color: white;
+  font-size: 12pt;
+}
+th.corner-header {
+background: LightGrey;
+color: black;
+  font-size: 12pt;
+}
+
+
+
diff --git a/sourcecodes/examples/spleen_immune_example.php b/sourcecodes/examples/spleen_immune_example.php
index 89df2c7b..8b5c3d79 100644
--- a/sourcecodes/examples/spleen_immune_example.php
+++ b/sourcecodes/examples/spleen_immune_example.php
@@ -7,8 +7,8 @@ if($key=="")
 include("../header_new.inc");
 ?>
 <!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="../bn_file_load_gom.php">Learn a network model from data</a>
+<ul class="navbar2">
+  <li><a href="../bn_file_load_gom.php">Load data and begin modeling</a>
   <li><a href="../home_upload.php">Make predictions using a known structure</a>  
   <li><a href="../help.php">Help</a>
   <li><a href="../faq.php">FAQ</a>
diff --git a/sourcecodes/examples/synthetic_example2.php b/sourcecodes/examples/synthetic_example2.php
index aed9d357..e65c1db3 100644
--- a/sourcecodes/examples/synthetic_example2.php
+++ b/sourcecodes/examples/synthetic_example2.php
@@ -7,8 +7,8 @@ if($key=="")
 include("../header_new.inc");
 ?>
 <!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="../bn_file_load_gom.php">Learn a network model from data</a>
+<ul class="navbar2">
+  <li><a href="../bn_file_load_gom.php">Load data and begin modeling</a>
   <li><a href="../home_upload.php">Make predictions using a known structure</a>  
   <li><a href="../help.php">Help</a>
   <li><a href="../faq.php">FAQ</a>
diff --git a/sourcecodes/examples/synthetic_example3.php b/sourcecodes/examples/synthetic_example3.php
index 167132e2..be0faffe 100644
--- a/sourcecodes/examples/synthetic_example3.php
+++ b/sourcecodes/examples/synthetic_example3.php
@@ -7,8 +7,8 @@ if($key=="")
 include("../header_new.inc");
 ?>
 <!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="../bn_file_load_gom.php">Learn a network model from data</a>
+<ul class="navbar2">
+  <li><a href="../bn_file_load_gom.php">Load data and begin modeling</a>
   <li><a href="../home_upload.php">Make predictions using a known structure</a>  
   <li><a href="../help.php">Help</a>
   <li><a href="../faq.php">FAQ</a>
diff --git a/sourcecodes/execute_bn_gom.php b/sourcecodes/execute_bn_gom.php
index 78ba0810..1de6f9f6 100644
--- a/sourcecodes/execute_bn_gom.php
+++ b/sourcecodes/execute_bn_gom.php
@@ -4,22 +4,24 @@ include("input_validate.php");
 $keyval=valid_keyval($_GET["My_key"]);
 
 //////////////execute c codes for local score///////////////////
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
-$pfile="./data/".$keyval."parent.txt";
+$pfile=$dir.$keyval."parent.txt";
 $parentf=file_get_contents("$pfile");
 //$maxp=valid_input($parentf);
 $maxp=trim($parentf);
 
 
-$kfile="./data/".$keyval."k.txt";
+$kfile=$dir.$keyval."k.txt";
 $kf=file_get_contents("$kfile");
 //$maxk=valid_input($kf);
 $maxk=trim($kf);
 
 
 
-$thrfile="./data/".$keyval."thr.txt";
+$thrfile=$dir.$keyval."thr.txt";
 $thr=file_get_contents("$thrfile");
 //$thr=valid_input($thr);
 $thr=trim($thr);
@@ -45,11 +47,11 @@ $dataname=array();
 $dataname=explode("\t",$str_arrmat[0]);
 $n=count($dataname);
 
-$initialstring="digraph G {\n"."size=\"10,10\";  ratio = fill;\n"."node [shape=square,width=1.5];\n";
+$initialstring="digraph G {\n"."size=\"6,8\";  ratio = fill;\n"."node [shape=square,width=1.5];\n";
 $endstring="}";
 fwrite($fout,"$initialstring");
 
-$g_file_name="./data/".$keyval."grviz_name_file.txt";
+$g_file_name=$dir.$keyval."grviz_name_file.txt";
 $grviz_name_file=fopen($g_file_name,"w");
 
 for($i=0;$i<$n;$i++)
@@ -88,6 +90,6 @@ shell_exec('./run_scripts/run_octave '.$keyval);
 
 ?>
 <script>
-window.open("layout.php?My_key=<?php print($keyval);?>",'_self',false);
+window.open("layout_svg_no.php?My_key=<?php print($keyval);?>",'_self',false);
 </script>
 
diff --git a/sourcecodes/executionprogress.php b/sourcecodes/executionprogress.php
index 6bdec524..7c5d3163 100644
--- a/sourcecodes/executionprogress.php
+++ b/sourcecodes/executionprogress.php
@@ -6,7 +6,9 @@ include("runtime_check.php");
 include("input_validate.php");
 
 $keyval=valid_keyval($_GET["My_key"]);
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 //number of parents
 $pfile=$dir.$keyval."parent.txt";
@@ -26,13 +28,13 @@ $runtime=exe_time($keyval,$parent_number,$k_number);
 
 ?>
 
-<div>
+<div id='execute_div'>
+<br>
 <p><h3><?php 
 print("Network ID: $keyval<br/>");
 print("Estimated run time: $runtime seconds");
 ?>
-<br><br></h3>
-<br>
+<br></h3>
 <table align="center"><tr><td><b></br></br></br>Computing ....</b>
 <div style="font-size:20pt;padding:6px;border:solid black 4px">
 <span id="progress1">&nbsp; &nbsp;</span>
diff --git a/sourcecodes/executionprogress_default.php b/sourcecodes/executionprogress_default.php
new file mode 100644
index 00000000..0cc09b81
--- /dev/null
+++ b/sourcecodes/executionprogress_default.php
@@ -0,0 +1,79 @@
+<?php
+////////////////This code load a data file and creates input file for continuous global optimal search (our modification). execute_bn_gom.php link is for execution of structure learning and create_tiers_gom.php is for adding restrictions///////////////////////////////////
+
+include("header_new.inc");
+include("runtime_check.php");
+include("input_validate.php");
+
+$keyval=valid_keyval($_GET["My_key"]);
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+
+//number of parents
+$pfile=$dir.$keyval."parent.txt";
+$parent_number=file_get_contents("$pfile");
+
+
+//number of k for model averaging
+$kfile=$dir.$keyval."k.txt";
+$k_number=file_get_contents("$kfile");
+
+
+$parent_number=trim($parent_number);
+$k_number=trim($k_number);
+
+//////////////////Check execution time///////////////////////////////////////////////
+$runtime=exe_time($keyval,$parent_number,$k_number);
+shell_exec('./run_scripts/run_settings '.$keyval);
+?>
+
+<div id="execute_div">
+<br>
+<p><h3><?php 
+print("Network ID: $keyval<br/>");
+print("Estimated run time: $runtime seconds");
+?>
+<br></h3>
+<table align="center"><tr><td><b></br></br></br>Computing ....</b>
+<div style="font-size:20pt;padding:6px;border:solid black 4px">
+<span id="progress1">&nbsp; &nbsp;</span>
+<span id="progress2">&nbsp; &nbsp;</span>
+<span id="progress3">&nbsp; &nbsp;</span>
+<span id="progress4">&nbsp; &nbsp;</span>
+<span id="progress5">&nbsp; &nbsp;</span>
+<span id="progress6">&nbsp; &nbsp;</span>
+<span id="progress7">&nbsp; &nbsp;</span>
+<span id="progress8">&nbsp; &nbsp;</span>
+<span id="progress9">&nbsp; &nbsp;</span>
+<span id="progress10">&nbsp; &nbsp;</span>
+</p>
+</div>
+</td></tr></table>
+
+<script language="javascript">
+<!-- Begin Script
+var progressEnd = 10;	// set to number of progress <span>'s.
+var progressColor = 'blue';	// set to progress bar color
+var progressInterval = 1000;	// set to time between updates (milli-seconds)
+
+var progressAt = progressEnd;
+var progressTimer;
+function progress_clear() {
+for (var i = 1; i <= progressEnd; i++) document.getElementById('progress'+i).style.backgroundColor = 'transparent';
+progressAt = 0;
+}
+function progress_update() {
+progressAt++;
+if (progressAt > progressEnd) progress_clear();
+else document.getElementById('progress'+progressAt).style.backgroundColor = progressColor;
+progressTimer = setTimeout('progress_update()',progressInterval);
+}
+// End -->
+
+progress_update();	
+</script>
+</div>
+<script>
+window.open("execute_bn_gom.php?My_key=<?php print($keyval);?>",'_self',false);
+</script>
diff --git a/sourcecodes/faq.php b/sourcecodes/faq.php
index 7e3d918b..26030bf5 100644
--- a/sourcecodes/faq.php
+++ b/sourcecodes/faq.php
@@ -1,3 +1,6 @@
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/accordion.js"></script>
 <?php
 include("input_validate.php");
 $key=$_POST["My_key"];
@@ -8,13 +11,26 @@ $key=valid_keyval("$key");
 include("header_new.inc");
 ?>
 
-<!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="bn_file_load_gom.php">Learn a network model from data</a>
-  <li><a href="home_upload.php">Make predictions using a known structure</a>  
+<ul class="navbar2">
+  <li><a href="bn_file_load_gom.php">Load data and begin modeling</a>
+</ul>
+   <button class="accordion">Return to a network&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+  <div class="panel">
+  <ul class="navbar_ac">
+  <li><a href="enter_netID.php">Use a network ID to return to a network</a>
+  <li><a href="home_upload.php">Load data for a known structure</a>  
+  </ul>
+  </div>  
+  <button class="accordion">Other help resources&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+  <div class="panel">
+  <ul class="navbar_ac">
+  <li><a href="getting_started.php">Getting started</a>
   <li><a href="workflow.php">Tutorials and examples</a>
   <li><a href="help.php">Help</a>
-  <li><a href="faq.php">FAQ</a>
+  </ul>
+  </div>  
+</ul>
+<ul class="navbar2">
   <li><a href="home.php">Home</a>
 </ul>
 
@@ -26,7 +42,7 @@ include("header_new.inc");
 <tr>
 <td>
 <h2>Frequently Asked Questions</h2>
-<ol>
+<ol class="help">
 <li><a href="#default_setting">What are the default settings for structure learning in BNW?</a>
 <li><a href="#size_limits">Are there limits on network sizes in BNW?</a>
 <li><a href="#input_files">What input files do I need to use BNW?</a>
diff --git a/sourcecodes/filecopy.sh b/sourcecodes/filecopy.sh
index a5616952..fa8560de 100644
--- a/sourcecodes/filecopy.sh
+++ b/sourcecodes/filecopy.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
-cd ./data/
+#cd ./data/
+#cd /tmp/bnw/
+cd /var/lib/genenet/bnw/
 FILES=$1*
 for f in $FILES
 do
@@ -21,3 +23,17 @@ temp='ts_upload.txt'
 rm $2$temp
 temp='ts_output.txt'
 rm $2$temp
+temp='net_figure_new.txt'
+rm $2$temp
+temp='parameters_ev.txt'
+rm $2$temp
+temp='vardata.txt'
+rm $2$temp
+temp='varname.txt'
+rm $2$temp
+temp='var.txt'
+rm $2$temp
+temp='violin_evidence.txt'
+rm $2$temp
+temp='violin_plotly_evidence.html'
+rm $2$temp
diff --git a/sourcecodes/getting_started.php b/sourcecodes/getting_started.php
index 15652b91..cd9e7094 100644
--- a/sourcecodes/getting_started.php
+++ b/sourcecodes/getting_started.php
@@ -1,26 +1,41 @@
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/accordion.js"></script>
 <?php 
 
 include("header_new.inc");
 ?>
 
 <!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="bn_file_load_gom.php">Learn a network model from data</a>
-  <li><a href="home_upload.php">Make predictions using a known structure</a>  
+<ul class="navbar2">
+  <li><a href="bn_file_load_gom.php">Load data and begin modeling</a>
+</ul>
+   <button class="accordion">Return to a network&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+  <div class="panel">
+  <ul class="navbar_ac">
+  <li><a href="enter_netID.php">Use a network ID to return to a network</a>
+  <li><a href="home_upload.php">Load data for a known structure</a>  
+  </ul>
+  </div>  
+  <button class="accordion">Other help resources&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+  <div class="panel">
+  <ul class="navbar_ac">
   <li><a href="workflow.php">Tutorials and examples</a>
   <li><a href="help.php">Help</a>
   <li><a href="faq.php">FAQ</a>
+  </ul>
+  </div>  
+</ul>
+<ul class="navbar2">
   <li><a href="home.php">Home</a>
-
-
 </ul>
 
 
 <!-- Main content -->
 <div id="outer">
-<h1>Getting Started with BNW</h1>
+<h2>Getting Started with BNW</h2>
 <br>
-    <p align="justify">The Bayesian Network Webserver (BNW) is designed to be a comprehensive tool for Bayesian network modeling of biological datasets. It should allow users to, within seconds or minutes, go from having a simply formatted input file containing a dataset to using a network model to make predictions about the interactions between variables and the potential effects of experimental interventions. New users of BNW may want to start by following <a href="BNW_workflow_net1.htm">this tutorial</a> which uses an example dataset that is used to create a genetic network. An additional <a href="BNW_workflow_sci.htm">tutorial</a> provides an introduction to using the BNW structural constraint interface. Several example networks using real and synthetic data are available <a href="workflow.php">here</a>.<br>
+    <p align="justify">The Bayesian Network Webserver (BNW) is designed to be a comprehensive tool for Bayesian network modeling of biological datasets. It should allow users to, within seconds or minutes, go from having a simply formatted input file containing a dataset to using a network model to make predictions about the interactions between variables and the potential effects of experimental interventions. New users of BNW may want to start by following <a href="BNW_workflow_net1.htm" target="_blank">this tutorial</a> which uses an example dataset that is used to create a genetic network. An additional <a href="BNW_workflow_sci.htm" target="_blank">tutorial</a> provides an introduction to using the BNW structural constraint interface. Several example networks using real and synthetic data are available <a href="workflow.php">here</a>.<br>
 <br>
 BNW also provides a <a href="help.php">help</a> page that provides an overview of the use of BNW as well as a <a href="faq.php">FAQ</a> page that addresses specific questions.
 <br>
diff --git a/sourcecodes/graph-creator.js b/sourcecodes/graph-creator.js
deleted file mode 100644
index d9764d46..00000000
--- a/sourcecodes/graph-creator.js
+++ /dev/null
@@ -1,275 +0,0 @@
-var colors = d3.scaleOrdinal(d3.schemeCategory10);
-
-var svg = d3.select("svg"),
-    width = +svg.attr("width"),
-    height = +svg.attr("height"),
-    node,
-    link;
-
-svg.append('defs').append('marker')
-    .attrs({'id':'arrowhead',
-		'viewBox':'-0 -5 10 10',
-		'refX':13,
-		'refY':0,
-		'orient':'auto',
-		'markerWidth':13,
-		'markerHeight':13,
-		'xoverflow':'visible',
-		'stroke-width':'4px',
-		'stroke-opacity':0.8})
-    .append('svg:path')
-    .attr('d', 'M 0,-5 L 10 ,0 L 0,5')
-    .attr('fill', '#999')
-    .style('stroke','none');
-
-var simulation = d3.forceSimulation()
-    .force("link", d3.forceLink().id(function (d) {return d.id;}).distance(400).strength(0))
-    //    .force("charge", d3.forceManyBody())
-    //.force("center", d3.forceCenter(width / 2, height / 2));
-
-d3.json("graph.json", function (error, graph) {
-        if (error) throw error;
-        update(graph.links, graph.nodes);
-    })
-
-    function update(links, nodes) {
-    link = svg.selectAll(".link")
-	.data(links)
-	.enter()
-	.append("line")
-	.attr("class", "link")
-	.attr('marker-end','url(#arrowhead)')
-    .attr('stroke',"#999")
-    .attr('stroke-opacity',.8)
-    .attr('stroke-width',"1px");
-
-    link.append("title")
-	.text(function (d) {return d.type;});
-
-    edgepaths = svg.selectAll(".edgepath")
-	.data(links)
-	.enter()
-	.append('path')
-	.attrs({
-                'class': 'edgepath',
-                'fill-opacity': 0,
-                'stroke-opacity': 0,
-                'id': function (d, i) {return 'edgepath' + i}
-            })
-	.style("pointer-events", "none");
-
-    edgelabels = svg.selectAll(".edgelabel")
-	.data(links)
-	.enter()
-	.append('text')
-	.style("pointer-events", "none")
-	.attrs({
-                'class': 'edgelabel',
-                'id': function (d, i) {return 'edgelabel' + i},
-                'font-size': 17,
-                'fill': '#aaa',
-		'dx': 0,
-		'dy': -4
-            });
-
-    edgelabels.append('textPath')
-	.attr('xlink:href', function (d, i) {return '#edgepath' + i})
-	.style("text-anchor", "middle")
-	.style("pointer-events", "none")
-	.attr("startOffset", "50%")
-	.attr("startOffset", "50%")
-	.text(function (d) {return d.type});
-
-    node = svg.selectAll(".node")
-	.data(nodes)
-	.enter()
-	.append("g")
-	.attr("class", "node")
-	.call(d3.drag()
-	      .on("start", dragstarted)
-	      .on("drag", dragged)
-	      //.on("end", dragended)
-	      );
-
-    node.append("circle")
-	.attr("r", 5)
-        .style("fill","#999");
-    //	.attr("r", 5)
-    //	.style("fill", function (d, i) {return colors(i);})
-
-    node.append("title")
-	.text(function (d) {return d.name;});
-
-    node.append("text")
-       .text(function (d) {return d.name;})
-       .attr("x",10)
-       .attr("dy", ".35em")
-       .attr("font","20px")
-       .attr("font-size",20)
-    //.attr("dy", -3)
-    //	.text(function (d) {return d.name+":"+d.label;});
-
-    simulation
-        .nodes(nodes)
-        .on("tick", ticked);
-
-    simulation.force("link")
-        .links(links);
-}
-
-function ticked() {
-        link
-            .attr("x1", function (d) {return d.source.x;})
-            .attr("y1", function (d) {return d.source.y;})
-            .attr("x2", function (d) {return d.target.x;})
-            .attr("y2", function (d) {return d.target.y;});
-
-        node
-            .attr("transform", function (d) {return "translate(" + d.x + ", " + d.y + ")";});
-
-        edgepaths.attr('d', function (d) {
-		return 'M ' + d.source.x + ' ' + d.source.y + ' L ' + d.target.x + ' ' + d.target.y;
-	    });
-
-        edgelabels.attr('transform', function (d) {
-		if (d.target.x < d.source.x) {
-		    var bbox = this.getBBox();
-
-		    rx = bbox.x + bbox.width / 2;
-		    ry = bbox.y + bbox.height / 2;
-		    return 'rotate(180 ' + rx + ' ' + ry + ')';
-		}
-		else {
-		    return 'rotate(0)';
-		}
-	    });
-}
-
-function dragstarted(d) {
-    if (!d3.event.active) simulation.alphaTarget(0.3).restart()
-			      d.fx = d.x;
-    d.fy = d.y;
-}
-
-function dragged(d) {
-    d.fx = d3.event.x;
-    d.fy = d3.event.y;
-}
-
-//    function dragended(d) {
-//        if (!d3.event.active) simulation.alphaTarget(0);
-//        d.fx = undefined;
-//        d.fy = undefined;
-//    }
-
-
-
-d3.select('#saveButton').on('click', function(){
-	var svgString = getSVGString(svg.node());
-	svgString2Image( svgString, 2*width, 2*height, 'png', save ); // passes Blob and filesize String to the callback
-
-	function save( dataBlob, filesize ){
-	    saveAs( dataBlob, 'D3 vis exported to PNG.png' ); // FileSaver.js function
-	}
-    });
-
-// Below are the functions that handle actual exporting:
-// getSVGString ( svgNode ) and svgString2Image( svgString, width, height, format, callback )
-function getSVGString( svgNode ) {
-    svgNode.setAttribute('xlink', 'http://www.w3.org/1999/xlink');
-    var cssStyleText = getCSSStyles( svgNode );
-    appendCSS( cssStyleText, svgNode );
-
-    var serializer = new XMLSerializer();
-    var svgString = serializer.serializeToString(svgNode);
-    svgString = svgString.replace(/(\w+)?:?xlink=/g, 'xmlns:xlink='); // Fix root xlink without namespace
-    svgString = svgString.replace(/NS\d+:href/g, 'xlink:href'); // Safari NS namespace fix
-
-    return svgString;
-
-    function getCSSStyles( parentElement ) {
-	var selectorTextArr = [];
-
-	// Add Parent element Id and Classes to the list
-	selectorTextArr.push( '#'+parentElement.id );
-	for (var c = 0; c < parentElement.classList.length; c++)
-	    if ( !contains('.'+parentElement.classList[c], selectorTextArr) )
-		selectorTextArr.push( '.'+parentElement.classList[c] );
-
-	// Add Children element Ids and Classes to the list
-	var nodes = parentElement.getElementsByTagName("*");
-	for (var i = 0; i < nodes.length; i++) {
-	    var id = nodes[i].id;
-	    if ( !contains('#'+id, selectorTextArr) )
-		selectorTextArr.push( '#'+id );
-
-	    var classes = nodes[i].classList;
-	    for (var c = 0; c < classes.length; c++)
-		if ( !contains('.'+classes[c], selectorTextArr) )
-		    selectorTextArr.push( '.'+classes[c] );
-	}
-
-	// Extract CSS Rules
-	var extractedCSSText = "";
-	for (var i = 0; i < document.styleSheets.length; i++) {
-	    var s = document.styleSheets[i];
-	    
-	    try {
-		if(!s.cssRules) continue;
-	    } catch( e ) {
-		if(e.name !== 'SecurityError') throw e; // for Firefox
-		continue;
-	    }
-
-	    var cssRules = s.cssRules;
-	    for (var r = 0; r < cssRules.length; r++) {
-		if ( contains( cssRules[r].selectorText, selectorTextArr ) )
-		    extractedCSSText += cssRules[r].cssText;
-	    }
-	}
-	
-
-	return extractedCSSText;
-
-	function contains(str,arr) {
-	    return arr.indexOf( str ) === -1 ? false : true;
-	}
-
-    }
-
-    function appendCSS( cssText, element ) {
-	var styleElement = document.createElement("style");
-	styleElement.setAttribute("type","text/css"); 
-	styleElement.innerHTML = cssText;
-	var refNode = element.hasChildNodes() ? element.children[0] : null;
-	element.insertBefore( styleElement, refNode );
-    }
-}
-
-
-function svgString2Image( svgString, width, height, format, callback ) {
-    var format = format ? format : 'png';
-
-    var imgsrc = 'data:image/svg+xml;base64,'+ btoa( unescape( encodeURIComponent( svgString ) ) ); // Convert SVG string to data URL
-
-    var canvas = document.createElement("canvas");
-    var context = canvas.getContext("2d");
-
-    canvas.width = width;
-    canvas.height = height;
-
-    var image = new Image();
-    image.onload = function() {
-	context.clearRect ( 0, 0, width, height );
-	context.drawImage(image, 0, 0, width, height);
-
-	canvas.toBlob( function(blob) {
-		var filesize = Math.round( blob.length/1024 ) + ' KB';
-		if ( callback ) callback( blob, filesize );
-	    });
-
-	
-    };
-
-    image.src = imgsrc;
-}
diff --git a/sourcecodes/graphviz_structure.php b/sourcecodes/graphviz_structure.php
index c708a25c..0708971f 100644
--- a/sourcecodes/graphviz_structure.php
+++ b/sourcecodes/graphviz_structure.php
@@ -23,8 +23,12 @@ $keyval=valid_keyval($_GET["My_key"]);
 /////////////////////////////////structure matrix//////////////////////////////////////////////////////////
 
 
-$matfile="./data/".$keyval."structure_input.txt";
-$fout=fopen("./data/".$keyval."graphviz.txt","w");
+//$matfile="./data/".$keyval."structure_input.txt";
+//$fout=fopen("./data/".$keyval."graphviz.txt","w");
+//$matfile="/tmp/bnw/".$keyval."structure_input.txt";
+//$fout=fopen("/tmp/bnw/".$keyval."graphviz.txt","w");
+$matfile="/var/lib/genenet/bnw/".$keyval."structure_input.txt";
+$fout=fopen("/var/lib/genenet/bnw/".$keyval."graphviz.txt","w");
 
 $matrix1=file_get_contents("$matfile");           
 $str_arrmat=array();
@@ -36,13 +40,15 @@ $dataname=array();
 $dataname=explode("\t",$str_arrmat[0]);
 $n=count($dataname);
 
-$initialstring="digraph G {\n"."size=\"10,10\";  ratio = fill;\n"."node [shape=square,width=1.5];\n";
+$initialstring="digraph G {\n"."size=\"6,8\";\n"."node [shape=square,width=1.5];\n";
 $endstring="}";
 fwrite($fout,"$initialstring");
 //fwrite($fouttemp,"$initialstring_temp");
 
 
-$g_file_name="./data/".$keyval."grviz_name_file.txt";
+//$g_file_name="./data/".$keyval."grviz_name_file.txt";
+//$g_file_name="/tmp/bnw/".$keyval."grviz_name_file.txt";
+$g_file_name="/var/lib/genenet/bnw/".$keyval."grviz_name_file.txt";
 $grviz_name_file=fopen($g_file_name,"w");
 
 for($i=0;$i<$n;$i++)
@@ -75,23 +81,12 @@ for($i=1;$i<=$n;$i++)
      
 } 
 fwrite($fout,"$endstring");   
-//fwrite($fouttemp,"$endstring");
- 
-//shell_exec('/usr/bin/dot -Tpng -o /var/www/html/compbio/BNW/graphviz.jpg /var/www/html/compbio/BNW/graphviztemp.txt');
-
-$file1="./data/".$keyval."run_initialstructure.sh";
-$initiallines=file_get_contents("./data/temp_shell_file_initial_structure");
-$all_lines="$initiallines"."$keyval\nfi\nexit";
-$fp = fopen($file1,"w"); 
-fwrite($fp, "$all_lines\n");
-fclose($fp);
-//prepare and execute shell script for matlab with a write lock
-//$cmd="./runmat.sh $keyval";
-//system($cmd);
+
 shell_exec('./run_scripts/run_octave '.$keyval);
+ 
 ?>
 <script>
-window.open("layout.php?My_key=<?php print($keyval);?>",'_self',false);
+window.open("layout_svg_no.php?My_key=<?php print($keyval);?>",'_self',false);
 </script>
 
 
diff --git a/sourcecodes/header_batchsearch.inc b/sourcecodes/header_batchsearch.inc
index 4e142255..8aad9177 100644
--- a/sourcecodes/header_batchsearch.inc
+++ b/sourcecodes/header_batchsearch.inc
@@ -1,6 +1,6 @@
 <html>
 <head>
-<LINK REL=StyleSheet HREF="./my_style.css" TYPE="text/css">
+<LINK REL=StyleSheet HREF="./my_new_style.css" TYPE="text/css">
 <script language="JavaScript">
 <!-- hide
 
@@ -107,7 +107,7 @@ searchkey.value="Sex\tDrug\tW1\tW2\nM\tD1\t5.00\t6.00\nM\tD1\t7.00\t6.00\nM\tD1\
 }
 }
 
-
+ 
 function Upload()
 {
         
@@ -118,6 +118,8 @@ function Upload()
 }
 
 
+
+
 function SearchCheck()
 {
 	with(window.document.key_search)
diff --git a/sourcecodes/header_new.inc b/sourcecodes/header_new.inc
index b6db3db4..317b99b5 100644
--- a/sourcecodes/header_new.inc
+++ b/sourcecodes/header_new.inc
@@ -3,7 +3,7 @@
 <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
 <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
 <META HTTP-EQUIV="Expires" CONTENT="0">
-
+  
   <title>Bayesian Network Webserver</title>
   <link rel="stylesheet" href="my_new_style.css">
 
@@ -13,9 +13,9 @@
 <script type="text/javascript">
                 document.body.innerHTML = '';
 </script>
-<table align=center width="100%" bordercolor=#33339F border=1 cellspacing=0 cellpadding=0>
+<table align=center width="100%" cellspacing=0 cellpadding=0>
 <tr>
-<td width="100%" height=60 class="td_title">Bayesian Network Webserver for Biological Network Modeling</td>
+<td width="100%" height=32 class="td_title">&nbsp;&nbsp;Bayesian Network Webserver for Biological Network Modeling</td>
 </tr>
 </table>
 
diff --git a/sourcecodes/help.php b/sourcecodes/help.php
index 8ed4a009..7714946e 100644
--- a/sourcecodes/help.php
+++ b/sourcecodes/help.php
@@ -1,3 +1,6 @@
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/accordion.js"></script>
 <?php
 
 $key=$_POST["My_key"];
@@ -8,27 +11,43 @@ include("header_new.inc");
 ?>
 
 <!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="bn_file_load_gom.php">Learn a network model from data</a>
-  <li><a href="home_upload.php">Make predictions using a known structure</a>  
+<ul class="navbar2">
+  <li><a href="bn_file_load_gom.php">Load data and begin modeling</a>
+</ul>
+   <button class="accordion">Return to a network&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+  <div class="panel">
+  <ul class="navbar_ac">
+  <li><a href="enter_netID.php">Use a network ID to return to a network</a>
+  <li><a href="home_upload.php">Load data for a known structure</a>  
+  </ul>
+  </div>  
+  <button class="accordion">Other help resources&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+  <div class="panel">
+  <ul class="navbar_ac">
+  <li><a href="getting_started.php">Getting started</a>
   <li><a href="workflow.php">Tutorials and examples</a>
-  <li><a href="help.php">Help</a>
   <li><a href="faq.php">FAQ</a>
+  </ul>
+  </div>  
+</ul>
+<ul class="navbar2">
   <li><a href="home.php">Home</a>
 </ul>
 
 
+
+
 <!-- Main content -->
 <div id="outer">
 
 <table width=100% align=center>
 <tr>
 <td>
-<h2>Table of Contents</h2>
-<ol>
+<h2>BNW Help: Table of Contents</h2>
+<ol class="help">
 <li><a href="#introduction">Introduction</a>
 <li><a href="#learn_methods">Structure learning overview</a>
-<li><a href="#constraint_interface">Structural constraint interface</a>
+<li><a href="#constraint_interface">Structure learning settings and the structural constraint interface</a>
 <li><a href="#param_learn">Parameter learning and using models to make predictions</a>
 <li><a href="#learn_details">Details of structure learning methods</a>
 <li><a href="#file_format">Formatting files for BNW</a>
@@ -45,7 +64,7 @@ include("header_new.inc");
 <br>
 <table>
 <tr>
-<a name=learn_methods><h2>1. Introduction to BNW</h2></a>
+<a name=introduction><h2>1. Introduction to BNW</h2></a>
 </tr>
 <br>
 <tr><td>
@@ -70,19 +89,20 @@ include("header_new.inc");
 <br>
 <table>
 <tr>
-<a name=constraint_interface><h2>3. Structural constraint interface</h2></a>
+<a name=constraint_interface><h2>3. Structure learning settings and the structural constraint interface</h2></a>
 </tr>
 <br>
 <tr><td>
 <p align="justify">
-BNW includes a structural constraint interface that provides users with options that can increase the speed of structure learning, aid in identifying robust network structures, and limit structure searches to biologically or physically meaningful networks by incorporating prior knowledge. Examples of using the structural constraint interface are available <a href="BNW_workflow_sci.htm">here</a>.<br><br><b>Global structure learning settings</b>: The first section of the structural constraint interface allows users to set the following options that define global properties of the network structure search:<br><br>
-<u>Maximum number of parents</u>: This option sets a limit on the number of immediate parents for every node in the network and can impact structure learning in two main ways. First, limiting the maximum number of parents can dramatically increase the speed of  structure learning for larger networks. Second, this limit may also help in avoiding over-fitting a network model, as it prevents a variable from being directly influenced by a large number of the other variables in the network. By default, the maximum number of parents of a node in BNW is 4.<br><br>
-<u>Number of networks to include in model averaging</u>: This option specifies <i>k</i>, the number of the high scoring networks that will be included in <a href="#learn_details">model averaging</a>. For <i>k</i>=1, only the highest scoring network is considered and no model averaging is performed. For other values of <i>k</i>, model averaging is performed over the <i>k</i>-best networks. Increasing the value of <i>k</i> will increase the time required to perform the structure learning search but may increase the performance of model averaging.<br><br>
+       BNW includes a structural constraint interface that provides users with options that can increase the speed of structure learning, aid in identifying robust network structures, and limit structure searches to biologically or physically meaningful networks by incorporating prior knowledge. This procedure has two main steps. First, a set of global structure learning settings are defined. Second, network variables are assigned to tiers and the types of interactions that are allowed within and between tiers are set. An example of using the structural constraint interface is available <a href="BNW_workflow_sci.htm">here</a>.<br><br><b>Global structure learning settings:</b><br><br>
+<u>Maximum number of parents</u>: This option sets a limit on the number of immediate parents for every node in the network and can impact structure learning in two main ways. First, limiting the maximum number of parents can dramatically reduce the time required for  structure learning of larger networks. Second, this limit may also help in avoiding over-fitting a network model, as it prevents a variable from being directly influenced by a large number of the other variables in the network. By default, the maximum number of parents of a node in BNW is 4.<br><br>
+<u>Number of networks to include in model averaging</u>: This option specifies <i>k</i>, the number of the high scoring networks that will be included in <a href="#learn_details">model averaging</a>. For <i>k</i>=1, only the highest scoring network is considered and no model averaging is performed. For other values of <i>k</i>, model averaging is performed over the <i>k</i>-best networks. Increasing the value of <i>k</i> will increase the time required to perform the structure learning search but may improve the performance of model averaging.<br><br>
 <u>Model averaging selection threshold</u>: This option specifies the threshold that should be used to select directed edges to be included in the network given their posterior probabilities after model averaging. All directed edges with posterior probabilities greater than the threshold will be included in the network. It is ignored if <i>k</i>=1. By default, the threshold is set to 0.5.<br><br>
-<u>Number of tiers</u>: Users of BNW can separate the nodes in the network into tiers, which can then be used to specify structure learning constraints as discussed below. The number of tiers is set to 3 by default. If the network variables are not assigned to tiers, this option will be ignored when structure learning is performed.
-<br><br><b> Tier Assignment</b>: The next section of the structural constraint interface allows users to separate the nodes in the network into tiers that can be used to easily indicate structural constraints. A node can be placed in a tier by simple clicking and dragging the node into the appropriate box.<br><br>
-<b>Tier Interactions</b>: This section allows for the description of the interactions that are allowed within and between tiers. By default, edges are allowed within tiers for all tiers, and nodes within a tier are only allowed to be parents of nodes within lower ranking tiers. For example, nodes in Tier2 of a network with 4 tiers could be the parents of nodes in Tiers 3 and 4, but could not be the parents of nodes in Tier1. Users can modify the allowed interactions to fit the details of their networks. For example, they may want to prohibit interactions within a tier containing variables that do not causally depend on each other.<br><br>
-<b>Specific Banned and Required Edges</b>: Finally, users can enter lists of banned and required edges to identify specific interactions that should or should not be included in the network. Banned edges can be used if experimental testing has shown that a particular regulatory relationship does not exist, while required edges can specify known regulatory relationships.
+<b> Structural constaint interface:</b><br><br>
+<u>Number of tiers</u>: This option specifies the number of different tiers to which variables can be assigned.<br><br>
+<u>Tier Assignment</u>: Network variables can be placed in desired tiers by clicking and dragging the variable into the appropriate box. If variables are not placed in a tier, they are included in structure learning without any restrictions.<br><br>
+<u>Tier Interactions</u>: This section allows for the description of the interactions that are allowed within and between tiers. By default, edges are allowed within tiers for all tiers, and nodes within a tier are only allowed to be parents of nodes within lower ranking tiers. For example, nodes in Tier2 of a network with 4 tiers could be the parents of nodes in Tiers 3 and 4, but could not be the parents of nodes in Tier1. Users can modify the allowed interactions to fit the details of their networks. For example, they may want to prohibit interactions within a tier containing variables that do not causally depend on each other.<br><br>
+<u>Specific Banned and Required Edges</u>: Finally, users can enter lists of banned and required edges to identify specific interactions that should or should not be included in the network. Banned edges can be used if experimental testing has shown that a particular regulatory relationship does not exist, while required edges can specify known regulatory relationships.
 </p>
 <br>
 </td></tr>
@@ -96,7 +116,7 @@ BNW includes a structural constraint interface that provides users with options
 </tr>
 <br>
 <tr><td>
-  <p align="justify"> After structure learning is completed, BNW automatically performs parameter learning of the network model using the Kevin Murphy's <a href=http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.1216>Bayes Net Toolbox</a> (<a href=https://github.com/bayesnet/bnt>BNT</a>) and displays the network model. BNW has been recently been updataed and Dirichlet prior distributions are now used during parameter learning.<br><br>Discrete variables in the network are displayed as bar charts and continuous variables are displayed as Gaussian distributions. The networks can be used to make predictions after clicking on a node and entering a value for that variable. Specifically, click on either the blue bar for a discrete node or the blue line for a continuous node to bring up a pop-up box that can be used to enter a value for the node. After submitting a value for the variable, the distributions of the other nodes in the network will change, allowing for visualization of the impact of setting the variable to the given value. The distributions after the entered value is considered are shown in red, while the original distributions are shown in blue. The node for which data was entered is outlined in red.<br><br>
+  <p align="justify"> After structure learning is completed, BNW automatically performs parameter learning of the network model using the Kevin Murphy's <a href=http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.1216>Bayes Net Toolbox</a> (<a href=https://github.com/bayesnet/bnt>BNT</a>) and displays the network model. BNW has been recently been updated and Dirichlet prior distributions are now used during parameter learning.<br><br>Discrete variables in the network are displayed as bar charts and continuous variables are displayed as Gaussian distributions. The networks can be used to make predictions after clicking on a node and entering a value for that variable. Specifically, click on either the blue bar for a discrete node or the blue line for a continuous node to bring up a pop-up box that can be used to enter a value for the node. After submitting a value for the variable, the distributions of the other nodes in the network will change, allowing for visualization of the impact of setting the variable to the given value. The distributions after the entered value is considered are shown in red, while the original distributions are shown in blue. The node for which data was entered is outlined in red.<br><br>
 Two prediction modes are available in BNW: evidence and intervention. In the evidence mode, entered values will alter the distributions of the other variables in the network, but will not alter the network structure. In intervention mode, the intervention alters both the distributions of the network variables and the network structure. Specifically, the intervened variable becomes independent of its parents. Evidence mode is appropriate when making predictions of other network variables after the value of one variable in the network is observed, while intervention mode is appropriate for predictions after experimental interventions that alter the values of some variables in the network. Further discussion of the difference between evidence and intervention prediction modes is given on the BNW <a href="faq.php">FAQ</a> page.       
 </td></tr>
 </table>
@@ -129,44 +149,47 @@ Two prediction modes are available in BNW: evidence and intervention. In the evi
 <h3>Data file format</h3>
 </tr>
 <tr><td>
-  <p align="justify"> Data files uploaded to the Bayesian Network Webserver should be tab-delimited text files with the names of the variables in the first row of the file and the values of the variables for each sample or individual in the remaining rows. <br><br>Variable names should not contain any whitespace characters.<br><br>BNW automatically determines whether each variable contains continuous or discrete data. BNW applies the following rules, in order, to determine if variables should be considered discrete or continuous:<br><br>
+  <p align="justify"> Data files uploaded to the Bayesian Network Webserver should be tab-delimited text files with the names of the variables in the first row of the file and the values of the variables for each sample or individual in the remaining rows. A sample input file is provided <a href=sample_input.php>here</a>.<br><br>Variable names should not contain any whitespace characters.<br><br>BNW automatically determines whether each variable contains continuous or discrete data by applying the following rules, in order:<br><br>
  <b> 1.</b> If a variable contains 3 or fewer different values, the variable is considered to be discrete.<br><br>
  <b> 2.</b> If a variable contains more than 20 different values, the variable is considered to be continuous.<br><br>
  <b> 3.</b> If the ratio of the number of different values for a variable compared to the number of cases in the data set is large, the variable is considered to be continuous. Specifically, if this ratio is 1/3 or larger, the variable is considered to be continuous.<br><br>
  <b> 4.</b> If none of the first three rules apply, the data set is inspected to determine if any of the values for the variable contain a period (.). If at least one value contains a period, the variable is considered to be continuous; otherwise, the variable is considered to be discrete.<br><br>
-  Users can examine whether or not BNW has correctly loaded input data files and classified variables by clicking on "View uploaded variables and data" on the left-hand menu after uploading a dataset. We believe that BNW should correctly classify variables in most cases, but users may occasionally need to add or remove a period to the data of some variables. <br><br>
-    An example input data file for a file with 5 variables is given below. The network contains 2 discrete (Disc1 and Disc2) variables, which are given in the first two columns of the file, and 3 continuous variables (Cont1, Cont2, and Cont3). Disc1 is a discrete variable with two states (1 and 2), while Disc2 has two states (A and B). Although the samples of Cont2 are integral values, we wish to deal with this variable as continuous, not discrete. Therefore, the value of Cont2 for the first sample is given as '3.0' instead of '3' so that one of the values of Cont2 contains a '.', helping to ensure that Cont2 is interpreted as a continuous variable.
+  Users can examine whether or not BNW has correctly loaded input data files and classified variables by clicking on "View uploaded variables and data" after uploading a dataset. We believe that BNW should correctly classify variables in most cases, but users may occasionally need to add or remove a period to the data of some variables. <br><br>
+BNW allows input data files to contain cases that have missing data. A value of "NA" should be entered if the value of a variable is missing for the case. Cases with missing variables are ignored by BNW and are removed from the data set before structure and parameter learning.<br><br>
+    An example input data file for a file with 5 variables is given below. The network contains 2 discrete (Disc1 and Disc2) variables, which are given in the first two columns of the file, and 3 continuous variables (Cont1, Cont2, and Cont3). Disc1 is a discrete variable with two states (1 and 2), while Disc2 has two states (A and B). Although Cont2 has integral values, the value of Cont2 for the first sample is given as '3.0' instead of '3'. The addition of the '.' is not necessary, but ensures that Cont2 is interpreted as a continuous variable.
 </p>
 <br>
+<div class="d3_table">
 <table>
-<tr><th>Disc1</th><th>&nbsp;</th><th>Disc2</th><th>&nbsp;</th><th>Cont1</th><th>&nbsp;</th><th>Cont2</th><th>&nbsp;</th><th>Cont3</td></tr>
+<tr><th>Disc1</th><th>Disc2</th><th>Cont1</th><th>Cont2</th><th>Cont3</td></tr>
 <tr>
-<td>2</td><td>&nbsp;</td><td>A</td><td>&nbsp;</td><td>3.25</td><td>&nbsp;</td><td>3.0</td><td>&nbsp;</td><td>0.97</td>
+<td>2</td><td>A</td><td>3.25</td><td>3.0</td><td>0.97</td>
 </tr>
 <tr>
-<td>2</td><td>&nbsp;</td><td>B</td><td>&nbsp;</td><td>2.46</td><td>&nbsp;</td><td>2</td><td>&nbsp;</td><td>0.93</td>
+<td>2</td><td>B</td><td>2.46</td><td>2</td><td>0.93</td>
 </tr>
 <tr>
-<td>1</td><td>&nbsp;</td><td>A</td><td>&nbsp;</td><td>4.21</td><td>&nbsp;</td><td>33</td><td>&nbsp;</td><td>0.43</td>
+<td>1</td><td>A</td><td>4.21</td><td>33</td><td>0.43</td>
 </tr>
 <tr>
-<td>2</td><td>&nbsp;</td><td>B</td><td>&nbsp;</td><td>3.76</td><td>&nbsp;</td><td>8</td><td>&nbsp;</td><td>0.88</td>
+<td>2</td><td>B</td><td>3.76</td><td>8</td><td>0.88</td>
 </tr>
 <tr>
-<td>2</td><td>&nbsp;</td><td>A</td><td>&nbsp;</td><td>3.69</td><td>&nbsp;</td><td>4</td><td>&nbsp;</td><td>0.91</td>
+<td>2</td><td>A</td><td>3.69</td><td>4</td><td>0.91</td>
 </tr>
 <tr>
-<td>1</td><td>&nbsp;</td><td>B</td><td>&nbsp;</td><td>4.27</td><td>&nbsp;</td><td>13</td><td>&nbsp;</td><td>0.38</td>
+<td>1</td><td>B</td><td>4.27</td><td>13</td><td>0.38</td>
 </tr>
 <tr>
-<td>1</td><td>&nbsp;</td><td>A</td><td>&nbsp;</td><td>4.12</td><td>&nbsp;</td><td>9</td><td>&nbsp;</td><td>0.45</td>
+<td>1</td><td>A</td><td>4.12</td><td>9</td><td>0.45</td>
 </tr>
 </table>
+</div>
 <br>
 <br>
 <h3>Structure file format</h3>
 <p align="justify">
-  If the structure of the network model for a dataset is already known, users can upload this structure by selecting "Upload structure" on the BNW home page. The structure file should be tab-delimited, with the variable names on the first row. The remainder of the file should be an n x n matrix of 0's and 1's, where n is the number of variables in the network. A '1' in row i and column j in this matrix indicates that there is a directed edge connecting variables i and j, (i.e., there is a edge from i to j in the network). '0' indicate that there is not a directed edge from variable i to variable j.
+  If the structure of the network model for a dataset is already known, users can upload this structure by selecting "Upload structure" on the BNW home page. The structure file should be tab-delimited, with the variable names on the first row. The remainder of the file should be an n x n matrix of 0's and 1's, where n is the number of variables in the network. A '1' in row i and column j in this matrix indicates that there is a directed edge connecting variables i and j, (i.e., there is a edge from i to j in the network). '0' indicates that there is not a directed edge from variable i to variable j.
 <br><br> An example of a structure data file is shown below. The following edges would be included in the network:
 <br>1. Disc1 -> Cont1
 <br>2. Dics2 -> Cont2
@@ -174,13 +197,14 @@ Two prediction modes are available in BNW: evidence and intervention. In the evi
 <br>4. Cont2 -> Cont3 
 </p>
 <br>
+<div class="d3_table">
 <table>
-<tr><th>Disc1</th><th>&nbsp;</th><th>Disc2</th><th>&nbsp;</th><th>Cont1</th><th>&nbsp;</th><th>Cont2</th><th>&nbsp;</th><th>Cont3</td></tr>
-<tr><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>1</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td></tr>
-<tr><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>1</td><td>&nbsp;</td><td>0</td></tr>
-<tr><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>1</td></tr>
-<tr><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>1</td></tr>
-<tr><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td></tr>
+<tr><th>Disc1</th><th>Disc2</th><th>Cont1</th><th>Cont2</th><th>Cont3</td></tr>
+<tr><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td></tr>
+<tr><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td></tr>
+<tr><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td></tr>
+<tr><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td></tr>
+<tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
 </table>
 <br>
 </table>
@@ -207,27 +231,30 @@ Two prediction modes are available in BNW: evidence and intervention. In the evi
 </tr>
 <br>
 <tr><td>
-<p align="justify"> BNW has recently been updated to add features and improve the user experience. These updates have included improving the network model visualizations and allowing users to more quickly load large data sets. Additionally, in a change that is invisible to users, BNW now uses Octave to perform parameter learning with the Bayes Net Toolbox. <br><br>
-Major changes and new features that have been added to BNW include:<br>
-<br><b>1)</b> Parameter learning settings have been modified. Specifically, network parameters (e.g., the distributions of states for discrete variables and means and standard deviations of Gaussian distributions) are now learned using Dirichlet prior distributions. In our testing, this has had a minimal impact on the parameters of most networks, but has helped reduce the impact of cases with rare combinations of states on the predicted distributions of some networks. In the original version of BNW, no priors were used.<br>
-<br><b>2)</b> Increased flexibility in formatting of uploaded data files. One major change is that BNW now allows for users to upload data files in which discrete variables have alphabetic values. For example, a file containing a node for the genotype of BXD mice can now have values of B and D; the values do not have to be recoded as integers. A full description of the proper format for input files in BNW considering these changes can be found <a href="help.php#file_format">here</a>.<br>
-<br><b>3)</b> Added "View uploaded variables and data" button to allow users to ensure that uploaded data sets are loaded and parsed correctly. After users upload a data set, clicking this button provides the ability to view either the uploaded data file directly or view a variable description file that shows how BNW has parsed the data. The variable description file lists the number of variables and cases (e.g., individuals or samples) in the data file. It also indicates whether each variable is discrete or continuous and the criteria that was used to make this determination. For discrete variables, the possible states of the variable are provided. For continuous variables, the mean and standard deviation of the variable is provided.<br>
-<br><b>4)</b> Added "View parameters" button to allow users to quantify network parameters. Users can now view the parameters of the network models considering the original data set that was uploaded by the user or the predicted parameters considering the evidence or intervention that has been entered by the user. This feature allows users to quantify predictions using the Bayesian network model.<br>
-<br>After performing structure learning and viewing their network model, users now have the ability to click a "View parameters" button on menu to the left of the model structure. This button provides a link to a file containing the original parameters of the model. For discrete nodes, the fraction of cases for each possible state in the variable is provided. For continuous nodes, the mean and standard deviation of the Gaussian distribution that best fits the data in the variable are provided.<br><br>
-If users have made predictions using either the evidence or intervention modes, a link to a file containing the parameters of the network considering the entered evidence or intervention is provided. The file lists the predicted fraction of states for discrete nodes and predicted mean and standard deviation of the Gaussian distribution for continuous nodes. Nodes for which evidence or intervention has been entered are also noted in the file.    
-<br>
-<br><b>5)</b> Added a "Use a network ID to return to a network" on the BNW home page. This button allows users to enter a network ID to return to a previously generated network model. The network ID can also be used to share the network model with collaborators. The network ID is a three character string that is listed in left menu of a BNW network page.
-<br> 
-<br><b>6)</b> BNW is now able to perform cross-validation and make predictions on a test data set using the "Cross validation and predictions" button on the left menu of the network page. Clicking this button presents three options: leave-one-out cross validation, k-fold cross validation, and uploading a test data set to make predictions using the network model.<br><br> 
-<b>Leave-one-out cross validation: </b>Users should enter the name of a network variable that they want to investigate. These calculations can take up to 3 minutes for large data sets.
+<p align="justify"> BNW has recently been updated to add features and improve the user experience. Four major recent changes have been:<br><br>
+<b>The addition of a new visualization of the network structure:</b> This network structure is presented to users immediately after structure learning to allow for a simpler introduction to the relationships within the network model. This new network image can be shown with or without edge weights that were determined after model averaging and can also be exported as a PNG or SVG file. The visualization of the network that has previously been used in BNW and is appropriate for using the network to make predictions can be accssed by clicking on the <u>Use network to make predictions</u> button on the left side of the page.<br>
+<br><b>The addition of a several options for modifying input files and network structures:</b> Users of BNW now have the option of changing structure learning settings, making specific changes to network structures, and removing variables from an uploaded data set without having to re-upload input data files.<br>
+<br><b>The addition of several options for learning more about the network parameters and distributions:</b> First, a <u>View parameters</u> button has been added that allows users to quantify network parameters. The parameters of the network model considering the original data set that was uploaded by the user or the predicted parameters considering the evidence or intervention that has been entered by the user. The fraction of cases for each possible state is provided for discrete nodes, while continuous nodes are described by the means and standard deviations of Gaussian distributions.<br><br>If users have made predictions using either the evidence or intervention modes, a link to a file containing the parameters of the network considering the entered evidence or intervention is also provided. The file lists the predicted fraction of states for discrete nodes and predicted mean and standard deviation of the Gaussian distribution for continuous nodes. Nodes for which evidence or intervention has been entered are also noted in the file.<br>
+<br>Second, clicking <u>View violin plots of distributions</u> shows a figure created using <a href="plotly.com" target="_blank">plotly</a> that compares fits to uploaded data and the distributions from the network parameters. If evidence or interventions have been added to the network, an additional plot compares the fits to the data, as originally uploaded, with the distributions in the network model considering the evidence or intervention.<br>
+<br><a name=crossvalid></a>
+<b> BNW is now able to perform cross-validation and make predictions on a test data set:</b> Clicking the <u>Cross validation and predictions</u> button on the network page presents three options for testing the predictions of the network: leave-one-out cross validation, k-fold cross validation, and uploading a test data set to make predictions using the network model.<br><br> 
+<b>a) Leave-one-out cross validation: </b>Users should enter the name of a network variable that they want to investigate. These calculations can take up to 3 minutes for large data sets.
 After the calculation is complete, the cross-validation output contains the following information:<br><br>
 For discrete variables, the predicted likelihood of each state for the left-out case, given the values of its parent variables in the network, is provided.<br><br>
 For continuous variables, the predicted mean and standard deviation of the left-out variable, given the values of its parent variables in the network, is provided.<br><br>
-<b>k-fold cross validation: </b>Users should enter the name of the variable that should be predicted as well as the number of folds into which the data set should be split.
+<b>b) k-fold cross validation: </b>Users should enter the name of the variable that should be predicted as well as the number of folds into which the data set should be split.
 The output file contains similar information as what is produced using leave-one-out cross-validation.<br><br>
-<b>Predictions on a test data set: </b>Users can then upload a file containing a test data set. The format of the file should follow the format of the input data file with two exceptions:<br><br>
-<b>a)</b> The first line of the file should containing the name of the variable that should be predicted.<br><br>
-<b>b)</b> "NA" can be used for missing data. The test data file can contain missing data. If data for a variable of a given sample or case is not known, an "NA" can be entered in the input file. Data can be missing for the variable that is to be predicted or for the variables that are to be used as predictors.<br><br>
+<b>c)Predictions on a test data set: </b>Users can then upload a file containing a test data set. The format of the file should follow the format of the input data file with one important exception: The first line of the file should containing the name of the variable that should be predicted.<br><br>
+The test data file can contain missing data. If data for a variable of a given sample or case is not known, an "NA" can be entered in the input file. Data can be missing for the variable that is to be predicted or for the variables that are to be used as predictors.<br>
+<br><b>Other changes and new features</b> that have been added to BNW since its introduction in <a href="https://academic.oup.com/bioinformatics/article/29/21/2801/195868" target="_blank">Bioinformatics</a> include:<br>
+<br><b>1)</b> Parameter learning settings have been modified. Specifically, network parameters (e.g., the distributions of states for discrete variables and means and standard deviations of Gaussian distributions) are now learned using Dirichlet prior distributions. In our testing, this has had a minimal impact on the parameters of most networks, but has helped reduce the impact of cases with rare combinations of states on the predicted distributions of some networks. In the original version of BNW, no priors were used.<br>
+<br><b>2)</b> Increased flexibility in formatting of uploaded data files. One major change is that BNW now allows for users to upload data files in which discrete variables have alphabetic values. For example, a file containing a node for the genotype of BXD mice can now have values of B and D; the values do not have to be recoded as integers. Input data files can also contain missing data by entering "NA" for missing values. Cases with missing data are ignored during structure and parameter learning of the network. A full description of the proper format for input files in BNW considering these changes can be found <a href="help.php#file_format">here</a>.<br>
+<br><b>3)</b> Added "View uploaded variables and data" button to allow users to ensure that uploaded data sets are loaded and parsed correctly. After users upload a data set, clicking this button provides the ability to view either the uploaded data file directly or view a variable description file that shows how BNW has parsed the data. The variable description file lists the number of variables and cases (e.g., individuals or samples) in the data file. It also indicates whether each variable is discrete or continuous and the criteria that was used to make this determination. For discrete variables, the possible states of the variable are provided. For continuous variables, the mean and standard deviation of the variable is provided.<br>
+<br><b>4)</b> Added a "Use a network ID to return to a network" on the BNW home page. This button allows users to enter a network ID to return to a previously generated network model. The network ID can also be used to share the network model with collaborators. The network ID is a three character string that is listed in left menu of a BNW network page.
+<br>
+<br><b>5)</b> In a change that is invisible to users, Octave is used instead of Matlab for parameter learning using the BayesNet Toolbox.<br> 
+<!--
+-->
 <br>
 </table>
 
diff --git a/sourcecodes/home.php b/sourcecodes/home.php
index fa0afbba..c6fdc4df 100644
--- a/sourcecodes/home.php
+++ b/sourcecodes/home.php
@@ -1,38 +1,74 @@
-<?php 
+<head>
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/accordion.js"></script>
+
+<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
+<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
+<META HTTP-EQUIV="Expires" CONTENT="0">
+
+  <title>Bayesian Network Webserver</title>
+  <link rel="stylesheet" href="my_new_style.css">
+
+</head>
+
+<body>
+<script type="text/javascript">
+   document.body.innerHTML = '';
+</script>
+<table align=center width="100%" bordercolor=#3071a9 border=1 cellspacing=0 cellpadding=0>
+<tr>
+   <td width="100%" height=60 class="td_title_home">&nbsp;&nbsp;Bayesian Network Webserver for Biological Network Modeling</td>
+</tr>
+</table>
+
+
+
+</head>
 
-include("header_new.inc");
-?>
 
 <!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="bn_file_load_gom.php">Learn a network model from data</a>
-  <li><a href="home_upload.php">Make predictions using a known structure</a>  
-  <li><a href="enter_netID.php">Use a network ID to return to a network</a>  
-  <li><a href="getting_started.php">Getting started with BNW</a>
-  <li><a href="help.php">Help</a>
+<ul class="navbar2">
+  <li><a href="bn_file_load_gom.php">Load data and begin modeling</a>
+</ul>
+   <button class="accordion">Return to a network&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+  <div class="panel">
+  <ul class="navbar_ac">
+  <li><a href="enter_netID.php">Use a network ID to return to a network</a>
+  <li><a href="home_upload.php">Load data for a known structure</a>  
+  </ul>
+  </div>  
+   <button class="accordion">New to BNW?&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+  <div class="panel">
+  <ul class="navbar_ac">
+  <li><a href="getting_started.php">Getting started</a>
   <li><a href="workflow.php">Tutorials and examples</a>
+  <li><a href="help.php">Main help page</a>
   <li><a href="faq.php">FAQ</a>
-  <li><a href="../downloads/BNW_src_files.tar">Download</a>
-  <li><a href="home.php">Home</a>
+  </ul>
+  </div>  
+<ul class="navbar2">
+  <li><a href="../downloads/BNW_src_files.tar">Download structure learning package</a>
+</ul>
 
 
 </ul>
 
 
+
 <!-- Main content -->
-<div id="outer">
-<h1>BNW: from data to predictions</h1>
-<IMG SRC="BNW_overview.png" ATL="" BORDER=0 WIDTH=812 HEIGHT=290><BR>
-<br>
-<br>
-<b>    <p align="justify"> BNW has recently been updated. Read more about these updates <a href="help.php#updates">here.</a></b>
-<br>
+<div id="outer_home">
 <br>
     <p align="justify"> The Bayesian Network Web Server (BNW) is a comprehensive web server for Bayesian network modeling of biological data sets. It is designed so that users can quickly and seamlessly upload a dataset, learn the structure of the network model that best explains the data, and use the model to understand and make predictions about relationships between the variables in the model. Many real world data sets, including those used to create genetic network models, contain both discrete (e.g., genotypes) and  continuous (e.g., gene expression traits) variables, and BNW allows for modeling of these hybrid data sets.
-<br>
+<br><br>
+<b>    <p align="justify"> BNW has recently been updated. Read more about these updates <a href="help.php#updates">here.</a>
+<br><br>
+An older version of BNW is available <a href="http://compbio.uthsc.edu/BNW_1.2">here.</a></b>
+<br><br>
+<img class="wide" SRC="BNW_overview_new.PNG" ATL="" BORDER=0 WIDTH=1197 HEIGHT=487><BR>
 <br>
 <b>
-How to cite the BNW:
+How to cite BNW:
 </b>
 <br>
 1. Ziebarth JD, Bhattacharya A, Cui Y (2013) <a href="http://bioinformatics.oxfordjournals.org/content/29/21/2801.abstract"  target="_blank">Bayesian Network Webserver: a comprehensive tool for biological network modeling.</a> Bioinformatics. 29(21): 2801-2803.
diff --git a/sourcecodes/home_upload.php b/sourcecodes/home_upload.php
index 09af0910..e9d459dc 100644
--- a/sourcecodes/home_upload.php
+++ b/sourcecodes/home_upload.php
@@ -5,9 +5,6 @@ include("header_new.inc");
 
 <!-- Site navigation menu -->
 <ul class="navbar2">
-<li><a href="upload_structure_file.php">Upload data and structure files</a>
-</ul>
-<ul class="navbar">
   <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a>
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
@@ -16,19 +13,17 @@ include("header_new.inc");
 <div id="outer">
 <!-- Main content -->
 <br>
-<br>
-<h1>Investigate networks with a known structure</h1>
+<h2>Investigate networks with a known structure</h2>
 <br>
 <p align="justify"> 
   BNW can be used to study and make predictions for models with a known structure. To use this feature, click the "Upload data and structure files" button below to upload the file containing the data for each of the variables in the network. Then, upload a file containing the network structure. Guidelines for formatting the data and structure data files can be found <a href="help.php#file_format">here</a>.
 <br>
 <br>
 <FORM METHOD="LINK" ACTION="upload_structure_file.php">
-<INPUT TYPE="submit" VALUE="Upload data and structure files" style="color: #fff; padding: 2px 5px; border: 2px solid; border-color: black black black black; background-color: #33339f; font-family: Georgia, ..., serif; font-size: 18px;
-display: block; height: 30px; width: 300px;">
+<INPUT TYPE="submit" class=button2 VALUE="Upload data and structure files">
 </FORM>
 </p>
 <br>
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/sourcecodes/input_check.php b/sourcecodes/input_check.php
index b3c0a421..832b8faa 100644
--- a/sourcecodes/input_check.php
+++ b/sourcecodes/input_check.php
@@ -1,16 +1,80 @@
-<?php $keyval=$_GET["My_key"]; ?>
+<head>
+<meta charset="utf-8">
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+<?php 
+include("header_new.inc");
+include("input_validate.php");
+if($_GET["My_key"]!="")
+  $keyval=valid_keyval($_GET["My_key"]);
+if($_POST["My_key"]!="")
+  $keyval=valid_keyval($_POST["My_key"]);
 
-<h3> <a href=<?php $d="./data/".$keyval."input_desc.txt"; print($d);?>>View variable descriptions</a></h3>
-<br>
+$dir = "/var/lib/genenet/bnw/";
+
+$input_table_file=$keyval."input_table.txt";
+$input_data_file=$keyval."continuous_input_orig.txt";
+
+
+?>
+
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+</head>
+
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
+ <li><a href="about_this_page.php#input_check">About this page</a>
+ <li><a href="help.php">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
 
+<body>
+  <div class="table_div">
+  <p class=basic_header>Description of network variables:</p>
+  <div class="d3_table" id="table_div1">
+  <?php
+   $table_text = json_encode(file("file://".$dir.$input_table_file)); 
+  ?> 
+<script type="text/javascript">
+  d3.text("", function(error, raw){
+  var dsv = d3.dsvFormat("\t")
+  var data1 = <?php echo $table_text?>;
+  var data2 = data1.join("")
+  var data = dsv.parse(data2)
+  var caption_text = data.pop();
+  if (error) throw error;
+      tabulate_caption("#table_div1",data,caption_text.Variable);
+    });
+</script>
+</div>
 <br>
+  <div class="d3_table" id="table_div2">
 
-<?php
-$filename="./data/".$keyval."continuous_input_orig.txt";
-if(file_exists($filename)) 
-{?>
-<h3> <a href=<?php $d="./data/".$keyval."continuous_input_orig.txt"; print($d);?>>View uploaded data file</a></h3>
+  <?php
+   $table_text = json_encode(file("file://".$dir.$input_data_file)); 
+  ?>
+  <script type="text/javascript">
+
+  d3.text("", function(error, raw){
+  var dsv = d3.dsvFormat("\t")
+  var data1 = <?php echo $table_text?>;
+  var data2 = data1.join("")
+  var data = dsv.parse(data2)
+  var caption_text = "Input data file:";
+      if (error) throw error;
+      tabulate_caption("#table_div2",data,caption_text);
+    });
+
+</script>
+ </div>
+
+
+
+&nbsp;&nbsp;&nbsp;&nbsp;<a class=button2 href="<?php print("reroute.php?".$input_data_file);?>">Download original input file<br></a>
 <br>
-<?php
-}
-?>
+<br><br>
+</div>
+</body>
+
diff --git a/sourcecodes/js-graph-it.css b/sourcecodes/js-graph-it.css
deleted file mode 100644
index 46757760..00000000
--- a/sourcecodes/js-graph-it.css
+++ /dev/null
@@ -1,24 +0,0 @@
-.draggable
-{
-	position: absolute;
-	cursor: move;
-	z-index: 1;
-}
-
-.connector
-{
-	background-color: black;
-}
-
-.dock_point
-{
-	height: 1px;
-	width: 1px;
-	overflow: hidden;
-	padding: 0px !important;
-	border: none !important;
-	margin: 0px !important;
-	position: absolute;
-	font-size: 1px;
-	visibility: hidden;
-}
\ No newline at end of file
diff --git a/sourcecodes/js-graph-it.js b/sourcecodes/js-graph-it.js
deleted file mode 100644
index 8d9387b4..00000000
--- a/sourcecodes/js-graph-it.js
+++ /dev/null
@@ -1,1802 +0,0 @@
-/*********************
- * browser detection *
- *********************/
-
-var ie=document.all;
-var nn6=document.getElementById&&!document.all;
-
-/****************************************************
- * This class is a scanner for the visitor pattern. *
- ****************************************************/
- 
-/**
- * Constructor, parameters are:
- * visitor: the visitor implementation, it must be a class with a visit(element) method.
- * scanElementsOnly: a flag telling whether to scan html elements only or all html nodes.
- */
-function DocumentScanner(visitor, scanElementsOnly)
-{
-	this.visitor = visitor;
-	this.scanElementsOnly = scanElementsOnly;
-
-	/**
-	 * Scans the element
-	 */
-	this.scan = function(element)
-	{
-		var i;
-		if(this.visitor.visit(element))
-		{
-			// visit child elements
-			var children = element.childNodes;
-			for(i = 0; i < children.length; i++)
-			{
-				if(!this.scanElementsOnly || children[i].nodeType == 1)
-				{
-					this.scan(children[i]);
-				}
-			}
-		}		
-	}	
-}
-
-/*****************
- * drag and drop *
- *****************/
- 
-var isdrag=false;					// this flag indicates that the mouse movement is actually a drag.
-var mouseStartX, mouseStartY;		// mouse position when drag starts
-var elementStartX, elementStartY;	// element position when drag starts
-
-/**
- * the html element being dragged.
- */
-var elementToMove;
-
-/**
- * an array containing the blocks being dragged. This is used to notify them of move.
- */
-var blocksToMove;
-
-/**
- * this variable stores the orginal z-index of the object being dragged in order
- * to restore it upon drop.
- */ 
-var originalZIndex;
-
-/**
- * an array containing bounds to be respected while dragging elements,
- * these bounds are left, top, left + width, top + height of the parent element.
- */
-var bounds = new Array(4);
-
-/**
- * this visitor is used to find blocks nested in the element being moved.
- */
-function BlocksToMoveVisitor()
-{
-	this.visit = function(element)
-	{
-		if(isBlock(element))
-		{
-			blocksToMove.push(findBlock(element.id));
-			return false;
-		}
-		else
-			return true;
-	}
-}
-
-var blocksToMoveScanner = new DocumentScanner(new BlocksToMoveVisitor(), true);
-
-function movemouse(e)
-{
-	if (isdrag)
-	{
-		var currentMouseX = nn6 ? e.clientX : event.clientX;
-		var currentMouseY = nn6 ? e.clientY : event.clientY;
-		var newElementX = elementStartX + currentMouseX - mouseStartX;
-		var newElementY = elementStartY + currentMouseY - mouseStartY;
-
-		// check bounds
-		// note: the "-1" and "+1" is to avoid borders overlap
-		if(newElementX < bounds[0])
-			newElementX = bounds[0] + 1;
-		if(newElementX + elementToMove.offsetWidth > bounds[2])
-			newElementX = bounds[2] - elementToMove.offsetWidth - 1;
-		if(newElementY < bounds[1])
-			newElementY = bounds[1] + 1;
-		if(newElementY + elementToMove.offsetHeight > bounds[3])
-			newElementY = bounds[3] - elementToMove.offsetHeight - 1;
-		
-		// move element
-		elementToMove.style.left = newElementX + 'px';
-		elementToMove.style.top  = newElementY + 'px';
-
-//		elementToMove.style.left = newElementX / elementToMove.parentNode.offsetWidth * 100 + '%';
-//		elementToMove.style.top  = newElementY / elementToMove.parentNode.offsetHeight * 100 + '%';
-	
-		elementToMove.style.right = null;
-		elementToMove.style.bottom = null;
-		
-		var i;
-		for(i = 0; i < blocksToMove.length; i++)
-		{
-			blocksToMove[i].onMove();
-		}
-		return false;
-	}
-}
-
-/**
- * finds the innermost draggable element starting from the one that generated the event "e"
- * (i.e.: the html element under mouse pointer), then setup the document's onmousemove function to
- * move the element around.
- */
-function startDrag(e) 
-{	
-	var eventSource = nn6 ? e.target : event.srcElement;
-	if(eventSource.tagName == 'HTML')
-		return;
-
-	while (eventSource != document.body && !hasClass(eventSource, "draggable"))
-	{  	
-		eventSource = nn6 ? eventSource.parentNode : eventSource.parentElement;
-	}
-
-	// if a draggable element was found, calculate its actual position
-	if (hasClass(eventSource, "draggable"))
-	{
-		isdrag = true;
-		elementToMove = eventSource;
-
-		// set absolute positioning on the element		
-		elementToMove.style.position = "absolute";
-				
-		// calculate start point
-		elementStartX = elementToMove.offsetLeft;
-		elementStartY = elementToMove.offsetTop;
-		
-		// calculate mouse start point
-		mouseStartX = nn6 ? e.clientX : event.clientX;
-		mouseStartY = nn6 ? e.clientY : event.clientY;
-		
-		// calculate bounds as left, top, width, height of the parent element
-		if(getStyle(elementToMove.parentNode, "position") == 'absolute')
-		{
-			bounds[0] = 0;
-			bounds[1] = 0;
-		}
-		else
-		{
-			bounds[0] = calculateOffsetLeft(elementToMove.parentNode);
-			bounds[1] = calculateOffsetTop(elementToMove.parentNode);
-		}
-		bounds[2] = bounds[0] + elementToMove.parentNode.offsetWidth;
-		bounds[3] = bounds[1] + elementToMove.parentNode.offsetHeight;		
-		
-		// either find the block related to the dragging element to call its onMove method
-		blocksToMove = new Array();
-		
-		blocksToMoveScanner.scan(eventSource);
-		document.onmousemove = movemouse;
-		
-		originalZIndex = getStyle(elementToMove, "z-index");
-		elementToMove.style.zIndex = "3";
-		
-		return false;
-	}
-}
-
-function stopDrag(e)
-{
-	isdrag=false; 
-	if(elementToMove)
-		elementToMove.style.zIndex=originalZIndex;
-	elementToMove = null;
-	document.onmousemove = null;
-       
-}
-
-document.onmousedown = startDrag;
-document.onmouseup = stopDrag;
-
-
-
-/*************
- * Constants *
- *************/
-var LEFT = 1;
-var RIGHT = 2;
-var UP = 4;
-var DOWN = 8;
-var HORIZONTAL = LEFT + RIGHT;
-var VERTICAL = UP + DOWN;
-var AUTO = HORIZONTAL + VERTICAL;
-
-var START = 0;
-var END = 1;
-var SCROLLBARS_WIDTH = 18;
-
-/**************
- * Inspectors *
- **************/
-
-var inspectors = new Array();
-
-/**
- * The canvas class.
- * This class is built on a div html element.
- */
-function Canvas(htmlElement)
-{
-	/*
-	 * initialization
-	 */
-	this.id = htmlElement.id;
-	this.htmlElement = htmlElement;
-	this.blocks = new Array();
-	this.connectors = new Array();
-	this.offsetLeft = calculateOffsetLeft(this.htmlElement);
-	this.offsetTop = calculateOffsetTop(this.htmlElement);	
-	
-	this.width;
-	this.height;
-
-	// create the inner div element
-	this.innerDiv = document.createElement("div");
-	
-	this.initCanvas = function()
-	{
-		// setup the inner div
-		var children = this.htmlElement.childNodes;
-		var i;
-		var el;
-		var n = children.length;
-		for(i = 0; i < n; i++)
-		{
-			el = children[0];
-			this.htmlElement.removeChild(el);
-			this.innerDiv.appendChild(el);
-			if(el.style)
-				el.style.zIndex = "2";
-		}
-		this.htmlElement.appendChild(this.innerDiv);
-
-		this.htmlElement.style.overflow = "auto";
-		this.htmlElement.style.position = "relative";
-		this.innerDiv.id = this.id + "_innerDiv";
-		this.innerDiv.style.border = "none";
-		this.innerDiv.style.padding = "0px";
-		this.innerDiv.style.margin = "0px";
-		this.innerDiv.style.position = "absolute";
-		this.innerDiv.style.top = "0px";
-		this.innerDiv.style.left = "0px";
-		this.width = 0;
-		this.height = 0;
-		this.offsetLeft = calculateOffsetLeft(this.innerDiv);
-		this.offsetTop = calculateOffsetTop(this.innerDiv);
-
-		// inspect canvas children to identify first level blocks
-		new DocumentScanner(this, true).scan(this.htmlElement);
-		
-		// now this.width and this.height are populated with minimum values needed for the inner
-		// blocks to fit, add 2 to avoid border overlap;
-		this.height += 2;
-		this.width += 2;
-		
-		var visibleWidth = this.htmlElement.offsetWidth - 2; // - 2 is to avoid border overlap
-		var visibleHeight = this.htmlElement.offsetHeight - 2; // - 2 is to avoid border overlap
-		
-		// consider the scrollbars width calculating the inner div size
-		if(this.height > visibleHeight)
-			visibleWidth -= SCROLLBARS_WIDTH;
-		if(this.width > visibleWidth)
-			visibleHeight -= SCROLLBARS_WIDTH;
-			
-		this.height = Math.max(this.height, visibleHeight);
-		this.width = Math.max(this.width, visibleWidth);
-		
-		this.innerDiv.style.width = this.width + "px";
-		this.innerDiv.style.height = this.height + "px";
-		
-		// init connectors
-		for(i = 0; i < this.connectors.length; i++)
-		{
-			this.connectors[i].initConnector();
-		}
-	}
-	
-	this.visit = function(element)
-	{
-		if(element == this.htmlElement)
-			return true;
-	
-		// check the element dimensions against the acutal size of the canvas
-		this.width = Math.max(this.width, calculateOffsetLeft(element) - this.offsetLeft + element.offsetWidth);
-		this.height = Math.max(this.height, calculateOffsetTop(element) - this.offsetTop + element.offsetHeight);
-		
-		if(isBlock(element))
-		{
-			// block found initialize it
-			var newBlock = new Block(element, this);
-			newBlock.initBlock();
-			this.blocks.push(newBlock);
-			return false;
-		}
-		else if(isConnector(element))
-		{
-			// connector found, just create it, source or destination blocks may not 
-			// have been initialized yet
-			var newConnector = new Connector(element, this);
-			this.connectors.push(newConnector);
-			return false;
-		}
-		else
-		{
-			// continue searching nested elements
-			return true;
-		}
-	}
-	
-	/*
-	 * methods
-	 */	
-	this.print = function()
-	{
-		var output = '<ul><legend>canvas: ' + this.id + '</legend>';
-		var i;
-		for(i = 0; i < this.blocks.length; i++)
-		{
-			output += '<li>';
-			output += this.blocks[i].print();
-			output += '</li>';
-		}
-		output += '</ul>';
-		return output;
-	}
-	
-	/*
-	 * This function searches for a nested block with a given id
-	 */
-	this.findBlock = function(blockId)
-	{
-		var result;
-		var i;
-		for(i = 0; i < this.blocks.length && !result; i++)
-		{
-			result = this.blocks[i].findBlock(blockId);
-		}
-		
-		return result;
-	}
-	
-	this.toString = function()
-	{
-		return 'canvas: ' + this.id;		
-	}
-}
-
-/*
- * Block class
- */
-function Block(htmlElement, canvas)
-{	
-	/*
-	 * initialization
-	 */
-	 
-	this.canvas = canvas;
-	this.htmlElement = htmlElement;
-	this.id = htmlElement.id;
-	this.blocks = new Array();
-	this.moveListeners = new Array();
-	
-	if(this.id == 'description2_out1')
-		var merda = 0;
-	this.currentTop = calculateOffsetTop(this.htmlElement) - this.canvas.offsetTop;
-	this.currentLeft = calculateOffsetLeft(this.htmlElement) - this.canvas.offsetLeft;
-	
-	this.visit = function(element)
-	{
-		if(element == this.htmlElement)
-		{
-			// exclude itself
-			return true;
-		}
-
-		if(isBlock(element))
-		{
-			var innerBlock = new Block(element, this.canvas);
-			innerBlock.initBlock();
-			this.blocks.push(innerBlock);
-			this.moveListeners.push(innerBlock);
-			return false;
-		}
-		else
-			return true;
-	}
-	
-	this.initBlock = function()
-	{
-		// inspect block children to identify nested blocks
-		
-		new DocumentScanner(this, true).scan(this.htmlElement);
-	}
-	
-	this.top = function()
-	{
-		return this.currentTop;
-	}
-	
-	this.left = function()
-	{
-		return this.currentLeft;
-	}
-	
-	this.width = function()
-	{
-		return this.htmlElement.offsetWidth;		
-	}
-	
-	this.height = function()
-	{
-		return this.htmlElement.offsetHeight;
-	}
-	
-	/*
-	 * methods
-	 */	
-	this.print = function()
-	{
-		var output = 'block: ' + this.id;
-		if(this.blocks.length > 0)
-		{
-			output += '<ul>';
-			var i;
-			for(i = 0; i < this.blocks.length; i++)
-			{
-				output += '<li>';
-				output += this.blocks[i].print();
-				output += '</li>';
-			}
-			output += '</ul>';
-		}
-		return output;
-	}
-	
-	/*
-	 * This function searches for a nested block (or the block itself) with a given id
-	 */
-	this.findBlock = function(blockId)
-	{
-		if(this.id == blockId)
-			return this;
-			
-		var result;
-		var i;
-		for(i = 0; i < this.blocks.length && !result; i++)
-		{
-			result = this.blocks[i].findBlock(blockId);
-		}
-		
-		return result;
-	}
-	
-	this.move = function(left, top)
-	{
-		this.htmlElement.style.left = left;
-		this.htmlElement.style.top = top;
-		
-		this.onMove();
-	}
-		
-	this.onMove = function()
-	{
-		var i;
-		this.currentLeft = calculateOffsetLeft(this.htmlElement) - this.canvas.offsetLeft;
-		this.currentTop = calculateOffsetTop(this.htmlElement) - this.canvas.offsetTop;
-		// notify listeners
-		for(i = 0; i < this.moveListeners.length; i++)
-		{
-			this.moveListeners[i].onMove();
-		}
-	}
-	
-	this.toString = function()
-	{
-		return 'block: ' + this.id;
-	}
-}
-
-/**
- * This class represents a connector segment, it is drawn via a div element.
- * A segment has a starting point defined by the properties startX and startY, a length,
- * a thickness and an orientation.
- * Allowed values for the orientation property are defined by the constants UP, LEFT, DOWN and RIGHT.
- */
-function Segment(id, parentElement)
-{
-	this.id = id;
-	this.htmlElement = document.createElement('div');
-	this.htmlElement.id = id;
-	this.htmlElement.style.position = 'absolute';
-	this.htmlElement.style.overflow = 'hidden';
-	parentElement.appendChild(this.htmlElement);
-
-	this.startX;
-	this.startY;
-	this.length;
-	this.thickness;
-	this.orientation;
-	this.nextSegment;
-	this.visible = true;
-	
-	/**
-	 * draw the segment. This operation is cascaded to next segment if any.
-	 */
-	this.draw = function()
-	{
-		// set properties to next segment
-		if(this.nextSegment)
-		{
-			this.nextSegment.startX = this.getEndX();
-			this.nextSegment.startY = this.getEndY();			
-		}
-		
-		if(this.visible)
-			this.htmlElement.style.display = 'block';
-		else
-			this.htmlElement.style.display = 'none';
-	
-		switch(this.orientation)
-		{
-			case LEFT:
-				this.htmlElement.style.left = (this.startX - this.length) + "px";				
-				this.htmlElement.style.top = this.startY + "px";
-				this.htmlElement.style.width = this.length + "px";
-				this.htmlElement.style.height = this.thickness + "px";
-				break;
-			case RIGHT:
-				this.htmlElement.style.left = this.startX + "px";
-				this.htmlElement.style.top = this.startY + "px";
-				if(this.nextSegment)
-					this.htmlElement.style.width = this.length + this.thickness + "px";
-				else
-					this.htmlElement.style.width = this.length + "px";
-				this.htmlElement.style.height = this.thickness + "px";
-				break;
-			case UP:
-				this.htmlElement.style.left = this.startX + "px";
-				this.htmlElement.style.top = (this.startY - this.length) + "px";
-				this.htmlElement.style.width = this.thickness + "px";
-				this.htmlElement.style.height = this.length + "px";
-				break;
-			case DOWN:
-				this.htmlElement.style.left = this.startX + "px";
-				this.htmlElement.style.top = this.startY + "px";
-				this.htmlElement.style.width = this.thickness + "px";
-				if(this.nextSegment)
-					this.htmlElement.style.height = this.length + this.thickness + "px";
-				else
-					this.htmlElement.style.height = this.length + "px";
-				break;
-		}
-		
-		if(this.nextSegment)
-			this.nextSegment.draw();
-	}
-	
-	/**
-	 * Returns the "left" coordinate of the end point of this segment
-	 */
-	this.getEndX = function()
-	{		
-		switch(this.orientation)
-		{
-			case LEFT: return this.startX - this.length;
-			case RIGHT: return this.startX + this.length;
-			case DOWN: return this.startX;
-			case UP: return this.startX;
-		}
-	}
-	
-	/**
-	 * Returns the "top" coordinate of the end point of this segment
-	 */
-	this.getEndY = function()
-	{		
-		switch(this.orientation)
-		{
-			case LEFT: return this.startY;
-			case RIGHT: return this.startY;
-			case DOWN: return this.startY + this.length;
-			case UP: return this.startY - this.length;
-		}
-	}
-		
-	/**
-	 * Append another segment to the end point of this.
-	 * If another segment is already appended to this, cascades the operation so
-	 * the given next segment will be appended to the tail of the segments chain.
-	 */
-	this.append = function(nextSegment)
-	{
-		if(!nextSegment)
-			return;
-		if(!this.nextSegment)
-		{
-			this.nextSegment = nextSegment;
-			this.nextSegment.startX = this.getEndX();
-			this.nextSegment.startY = this.getEndY();
-		}
-		else
-			this.nextSegment.append(nextSegment);
-	}
-	
-	this.detach = function()
-	{
-		var s = this.nextSegment;
-		this.nextSegment = null;
-		return s;
-	}
-	
-	/**
-	 * hides this segment and all the following
-	 */
-	this.cascadeHide = function()
-	{
-		this.visible = false;
-		if(this.nextSegment)
-			this.nextSegment.cascadeHide();
-	}
-}
-/**
- * Connector class.
- * The init function takes two Block objects as arguments representing 
- * the source and destination of the connector
- */
-function Connector(htmlElement, canvas)
-{
-	/**
-	 * declaring html element
-	 */
-	this.htmlElement = htmlElement;
-	
-	/**
-	 * the canvas this connector is in
-	 */
-	this.canvas = canvas;
-	
-	/**
-	 * the source block
-	 */
-	this.source = null;
-	
-	/**
-	 * the destination block
-	 */
-	this.destination = null;	
-	
-	/**
-	 * preferred orientation
-	 */
-	this.preferredSourceOrientation = AUTO;
-	this.preferredDestinationOrientation = AUTO;
-	
-	/**
-	 * css class to be applied to the connector's segments
-	 */
-	this.connectorClass;
-	
-	/**
-	 * minimum length for a connector segment.
-	 */
-	this.minSegmentLength = 10;
-
-	/**
-	 * size of the connector, i.e.: thickness of the segments.
-	 */
-	this.size = 2;
-	
-	/**
-	 * connector's color
-	 */
-	this.color = 'black';
-	
-	/**
-	 * move listeners, they are notify when connector moves
-	 */
-	this.moveListeners = new Array();
-	
-	this.firstSegment;
-	
-	this.segmentsPool;
-	
-	this.segmentsNumber = 0;
-	
-	this.strategy;
-		
-	this.initConnector = function()
-	{
-		// detect the connector id
-		if(this.htmlElement.id)
-			this.id = this.htmlElement.id;
-		else
-			this.id = this.htmlElement.className;
-			
-		// split the class name to get the ids of the source and destination blocks
-		var splitted = htmlElement.className.split(' ');
-		if(splitted.length < 3)
-		{
-			alert('Unable to create connector \'' + id + '\', class is not in the correct format: connector <sourceBlockId>, <destBlockId>');
-			return;
-		}
-		
-		this.connectorClass = splitted[0] + ' ' + splitted[1] + ' ' + splitted[2];
-		
-		this.source = this.canvas.findBlock(splitted[1]);
-		if(!this.source)
-		{
-			alert('cannot find source block with id \'' + splitted[1] + '\'');
-			return;
-		}
-		
-		this.destination = this.canvas.findBlock(splitted[2]);
-		if(!this.destination)
-		{
-			alert('cannot find destination block with id \'' + splitted[2] + '\'');
-			return;
-		}
-		
-		// check preferred orientation
-		if(hasClass(this.htmlElement, 'vertical'))
-		{
-			this.preferredSourceOrientation = VERTICAL;
-			this.preferredDestinationOrientation = VERTICAL;
-		}
-		else if(hasClass(this.htmlElement, 'horizontal'))
-		{
-			this.preferredSourceOrientation = HORIZONTAL;
-			this.preferredDestinationOrientation = HORIZONTAL;
-		}
-		else
-		{
-			// check preferred orientation on source side
-			if(hasClass(this.htmlElement, 'vertical_start'))
-				this.preferredSourceOrientation = VERTICAL;
-			else if(hasClass(this.htmlElement, 'horizontal_start'))
-				this.preferredSourceOrientation = HORIZONTAL;
-			else if(hasClass(this.htmlElement, 'left_start'))
-				this.preferredSourceOrientation = LEFT;
-			else if(hasClass(this.htmlElement, 'right_start'))
-				this.preferredSourceOrientation = RIGHT;
-			else if(hasClass(this.htmlElement, 'up_start'))
-				this.preferredSourceOrientation = UP;
-			else if(hasClass(this.htmlElement, 'down_start'))
-				this.preferredSourceOrientation = DOWN;
-			
-			// check preferred orientation on destination side
-			if(hasClass(this.htmlElement, 'vertical_end'))
-				this.preferredDestinationOrientation = VERTICAL;
-			else if(hasClass(this.htmlElement, 'horizontal_end'))
-				this.preferredDestinationOrientation = HORIZONTAL;
-			else if(hasClass(this.htmlElement, 'left_end'))
-				this.preferredDestinationOrientation = LEFT;
-			else if(hasClass(this.htmlElement, 'right_end'))
-				this.preferredDestinationOrientation = RIGHT;
-			else if(hasClass(this.htmlElement, 'up_end'))
-				this.preferredDestinationOrientation = UP;
-			else if(hasClass(this.htmlElement, 'down_end'))
-				this.preferredDestinationOrientation = DOWN;
-		}
-		
-		// get the first strategy as default
-		this.strategy = strategies[0](this);
-		this.repaint();
-		
-		this.source.moveListeners.push(this);
-		this.destination.moveListeners.push(this);
-		
-		// call inspectors for this connector
-		var i;
-		for(i = 0; i < inspectors.length; i++)
-		{
-			inspectors[i].inspect(this);
-		}
-		
-		// remove old html element
-		this.htmlElement.parentNode.removeChild(this.htmlElement);
-	}
-	
-	this.getStartSegment = function()
-	{
-		return this.firstSegment;
-	}
-	
-	this.getEndSegment = function()
-	{
-		var s = this.firstSegment;
-		while(s.nextSegment)
-			s = s.nextSegment;
-		return s;
-	}
-	
-	this.getMiddleSegment = function()
-	{
-		if(!this.strategy)
-			return null;
-		else
-			return this.strategy.getMiddleSegment();
-	}
-	
-	this.createSegment = function()
-	{
-		var segment;
-		
-		// if the pool contains more objects, borrow the segment, create it otherwise
-		if(this.segmentsPool)
-		{
-			segment = this.segmentsPool;
-			this.segmentsPool = this.segmentsPool.detach();
-		}
-		else
-		{		
-			segment = new Segment(this.id + "_" + (this.segmentsNumber + 1), this.canvas.htmlElement);
-			segment.htmlElement.className = this.connectorClass;
-			if(!getStyle(segment.htmlElement, 'background-color'))
-				segment.htmlElement.style.backgroundColor = this.color;
-			segment.thickness = this.size;
-		}
-		this.segmentsNumber++;
-		
-		if(this.firstSegment)
-			this.firstSegment.append(segment);
-		else
-			this.firstSegment = segment;
-		segment.visible = true;
-		return segment;
-	}
-	
-	/**
-	 * Repaints the connector
-	 */
-	this.repaint = function()
-	{
-		// check strategies fitness and choose the best fitting one
-		var i;
-		var maxFitness = 0;
-		var fitness;
-		var s;
-		
-		// check if any strategy is possible with preferredOrientation
-		for(i = 0; i < strategies.length; i++)
-		{
-			this.clearSegments();
-			
-			fitness = 0;
-			s = strategies[i](this);
-			if(s.isApplicable())
-			{
-				fitness++;
-				s.paint();
-				// check resulting orientation against the preferred orientations
-				if((this.firstSegment.orientation & this.preferredSourceOrientation) != 0)
-					fitness++;
-				if((this.getEndSegment().orientation & this.preferredDestinationOrientation) != 0)
-					fitness++;
-			}
-			
-			if(fitness > maxFitness)
-			{
-				this.strategy = s;
-				maxFitness = fitness;
-			}
-		}			
-		
-		this.clearSegments();
-
-		this.strategy.paint();
-		this.firstSegment.draw();
-
-		// this is needed to actually hide unused html elements	
-		if(this.segmentsPool)
-			this.segmentsPool.draw();
-	}
-	
-	/**
-	 * Hide all the segments and return them to pool
-	 */
-	this.clearSegments = function()
-	{
-		if(this.firstSegment)
-		{
-			this.firstSegment.cascadeHide();
-			this.firstSegment.append(this.segmentsPool);
-			this.segmentsPool = this.firstSegment;
-			this.firstSegment = null;
-		}	
-	}
-		
-	this.onMove = function()
-	{
-		this.repaint();
-		
-		// notify listeners
-		var i;
-		for(i = 0; i < this.moveListeners.length; i++)
-			this.moveListeners[i].onMove();
-	}
-}
-
-var strategies = new Array();
-
-function ConnectorEnd(htmlElement, connector, side)
-{
-	this.side = side;
-	this.htmlElement = htmlElement;
-	this.connector = connector;
-	connector.canvas.htmlElement.appendChild(htmlElement);
-	// strip extension
-	if(this.htmlElement.tagName.toLowerCase() == "img")
-	{
-		this.src = this.htmlElement.src.substring(0, this.htmlElement.src.lastIndexOf('.'));
-		this.srcExtension = this.htmlElement.src.substring(this.htmlElement.src.lastIndexOf('.'));
-		this.htmlElement.style.zIndex = getStyle(this.connector.htmlElement, "z-index");
-	}
-	
-	this.orientation;
-	
-	this.repaint = function()
-	{
-		this.htmlElement.style.position = 'absolute';
-				
-		var left;
-		var top;
-		var segment;
-		var orientation;
-		
-		if(this.side == START)
-		{
-			segment = connector.getStartSegment();
-			left = segment.startX;
-			top = segment.startY;
-			orientation = segment.orientation;
-			// swap orientation
-			if((orientation & VERTICAL) != 0)
-				orientation = (~orientation) & VERTICAL;
-			else
-				orientation = (~orientation) & HORIZONTAL;
-		}
-		else
-		{
-			segment = connector.getEndSegment();
-			left = segment.getEndX();
-			top = segment.getEndY();
-			orientation = segment.orientation;
-		}
-		
-		switch(orientation)
-		{
-			case LEFT:
-				top -= (this.htmlElement.offsetHeight - segment.thickness) / 2;
-				break;
-			case RIGHT:
-				left -= this.htmlElement.offsetWidth;
-				top -= (this.htmlElement.offsetHeight - segment.thickness) / 2;
-				break;
-			case DOWN:
-				top -= this.htmlElement.offsetHeight;
-				left -= (this.htmlElement.offsetWidth - segment.thickness) / 2;
-				break;
-			case UP:
-				left -= (this.htmlElement.offsetWidth - segment.thickness) / 2;
-				break;
-		}
-		
-		this.htmlElement.style.left = Math.ceil(left) + "px";
-		this.htmlElement.style.top = Math.ceil(top) + "px";
-		
-		if(this.htmlElement.tagName.toLowerCase() == "img" && this.orientation != orientation)
-		{
-			var orientationSuffix;
-			switch(orientation)
-			{
-				case UP: orientationSuffix = "u"; break;
-				case DOWN: orientationSuffix = "d"; break;
-				case LEFT: orientationSuffix = "l"; break;
-				case RIGHT: orientationSuffix = "r"; break;
-			}
-			this.htmlElement.src = this.src + "_" + orientationSuffix + this.srcExtension;
-		}
-		this.orientation = orientation;
-	}
-	
-	this.onMove = function()
-	{
-		this.repaint();
-	}
-}
-
-function SideConnectorLabel(connector, htmlElement, side)
-{
-	this.connector = connector;
-	this.htmlElement = htmlElement;
-	this.side = side;
-	this.connector.htmlElement.parentNode.appendChild(htmlElement);
-		
-	this.repaint = function()
-	{
-		this.htmlElement.style.position = 'absolute';
-		var left;
-		var top;
-		var segment;
-
-		if(this.side == START)
-		{	
-			segment = this.connector.getStartSegment();
-			left = segment.startX;
-			top = segment.startY;
-			if(segment.orientation == LEFT)
-				left -= this.htmlElement.offsetWidth;
-			if(segment.orientation == UP)
-				top -= this.htmlElement.offsetHeight;
-				
-			if((segment.orientation & HORIZONTAL) != 0 && top < this.connector.getEndSegment().getEndY())
-				top -= this.htmlElement.offsetHeight;
-			if((segment.orientation & VERTICAL) != 0 && left < this.connector.getEndSegment().getEndX())
-				left -= this.htmlElement.offsetWidth;
-		}
-		else
-		{	
-			segment = this.connector.getEndSegment();
-			left = segment.getEndX();
-			top = segment.getEndY();
-			if(segment.orientation == RIGHT)
-				left -= this.htmlElement.offsetWidth;
-			if(segment.orientation == DOWN)
-				top -= this.htmlElement.offsetHeight;
-			if((segment.orientation & HORIZONTAL) != 0 && top < this.connector.getStartSegment().startY)
-				top -= this.htmlElement.offsetHeight;
-			if((segment.orientation & VERTICAL) != 0 && left < this.connector.getStartSegment().startX)
-				left -= this.htmlElement.offsetWidth;
-		}
-		
-		this.htmlElement.style.left = Math.ceil(left) + "px";
-		this.htmlElement.style.top = Math.ceil(top) + "px";
-	}
-	
-	this.onMove = function()
-	{
-		this.repaint();
-	}
-}
-
-function MiddleConnectorLabel(connector, htmlElement)
-{
-	this.connector = connector;
-	this.htmlElement = htmlElement;
-	this.connector.canvas.htmlElement.appendChild(htmlElement);
-	
-	this.repaint = function()
-	{
-		this.htmlElement.style.position = 'absolute';
-		
-		var left;
-		var top;
-		var segment = connector.getMiddleSegment();
-
-		if((segment.orientation & VERTICAL) != 0)
-		{
-			// put label at middle height on right side of the connector
-			top = segment.htmlElement.offsetTop + (segment.htmlElement.offsetHeight - this.htmlElement.offsetHeight) / 2;
-			left = segment.htmlElement.offsetLeft;
-		}
-		else
-		{
-			// put connector below the connector at middle widths
-			top = segment.htmlElement.offsetTop;
-			left = segment.htmlElement.offsetLeft + (segment.htmlElement.offsetWidth - this.htmlElement.offsetWidth) / 2;;
-		}
-		
-		this.htmlElement.style.left = Math.ceil(left) + "px";
-		this.htmlElement.style.top = Math.ceil(top) + "px";
-	}
-	
-	this.onMove = function()
-	{
-		this.repaint();
-	}
-}
-
-/*
- * Inspector classes
- */
-
-function ConnectorEndsInspector()
-{
-	this.inspect = function(connector)
-	{
-		var children = connector.htmlElement.childNodes;
-		var i;
-		for(i = 0; i < children.length; i++)
-		{
-			if(hasClass(children[i], "connector-end"))
-			{
-				var newElement = new ConnectorEnd(children[i], connector, END);
-				newElement.repaint();
-				connector.moveListeners.push(newElement);
-			}
-			else if(hasClass(children[i], "connector-start"))
-			{
-				var newElement = new ConnectorEnd(children[i], connector, START);
-				newElement.repaint();
-				connector.moveListeners.push(newElement);
-			}
-		}
-	}
-}
-
-function ConnectorLabelsInspector()
-{
-	this.inspect = function(connector)
-	{
-		var children = connector.htmlElement.childNodes;
-		var i;
-		for(i = 0; i < children.length; i++)
-		{
-			if(hasClass(children[i], "source-label"))
-			{
-				var newElement = new SideConnectorLabel(connector, children[i], START);
-				newElement.repaint();
-				connector.moveListeners.push(newElement);
-			}
-			else if(hasClass(children[i], "middle-label"))
-			{
-				var newElement = new MiddleConnectorLabel(connector, children[i]);
-				newElement.repaint();
-				connector.moveListeners.push(newElement);
-			}
-			else if(hasClass(children[i], "destination-label"))
-			{
-				var newElement = new SideConnectorLabel(connector, children[i], END);
-				newElement.repaint();
-				connector.moveListeners.push(newElement);
-			}
-		}
-	}
-}
-
-/*
- * Inspector registration
- */
-
-inspectors.push(new ConnectorEndsInspector());
-inspectors.push(new ConnectorLabelsInspector());
-
-/*
- * an array containing all the canvases in document
- */
-var canvases = new Array();
-
-/*
- * This function initializes the js_graph objects inspecting the html document
- */
-function initPageObjects()
-{
-	if(isCanvas(document.body))
-	{
-		var newCanvas = new Canvas(document.body);
-		newCanvas.initCanvas();
-		canvases.push(newCanvas);
-	}
-	else
-	{	
-		var divs = document.getElementsByTagName('div');
-		var i;
-		for(i = 0; i < divs.length; i++)
-		{
-			if(isCanvas(divs[i]) && !findCanvas(divs[i].id))
-			{
-				var newCanvas = new Canvas(divs[i]);
-				newCanvas.initCanvas();
-				canvases.push(newCanvas);
-			}
-		}
-	}
-}
-
-
-/*
- * Utility functions
- */
-
-
-function findCanvas(canvasId)
-{	
-	var i;
-	for(i = 0; i < canvases.length; i++)
-		if(canvases[i].id == canvasId)
-			return canvases[i];
-	return null;
-}
-
-function findBlock(blockId)
-{
-	var i;
-	for(i = 0; i < canvases.length; i++)
-	{
-		var block = canvases[i].findBlock(blockId);
-		if(block)
-			return block;
-	}
-	return null;
-}
- 
-/*
- * This function determines whether a html element is to be considered a canvas
- */
-function isBlock(htmlElement)
-{
-	return hasClass(htmlElement, 'block');
-}
-
-/*
- * This function determines whether a html element is to be considered a block
- */
-function isCanvas(htmlElement)
-{
-	return hasClass(htmlElement, 'canvas');
-}
-
-/*
- * This function determines whether a html element is to be considered a connector
- */
-function isConnector(htmlElement)
-{
-	return htmlElement.className && htmlElement.className.match(new RegExp('connector .*'));
-}
-
-/*
- * This function calculates the absolute 'top' value for a html node
- */
-function calculateOffsetTop(obj)
-{
-	var curtop = 0;
-	if (obj.offsetParent)
-	{
-		curtop = obj.offsetTop
-		while (obj = obj.offsetParent) 
-			curtop += obj.offsetTop
-	}
-	else if (obj.y)
-		curtop += obj.y;
-	return curtop;
-}
-
-/*
- * This function calculates the absolute 'left' value for a html node
- */
-function calculateOffsetLeft(obj)
-{
-	var curleft = 0;
-	if (obj.offsetParent)
-	{
-		curleft = obj.offsetLeft
-		while (obj = obj.offsetParent) 
-		{
-			curleft += obj.offsetLeft;
-		}
-	}
-	else if (obj.x)
-		curleft += obj.x;
-	return curleft;
-}
-
-function parseBorder(obj, side)
-{
-	var sizeString = getStyle(obj, "border-" + side + "-width");
-	if(sizeString && sizeString != "")
-	{
-		if(sizeString.substring(sizeString.length - 2) == "px")
-			return parseInt(sizeString.substring(0, sizeString.length - 2));
-	}
-	return 0;
-}
-
-function hasClass(element, className)
-{
-	if(!element || !element.className)
-		return false;
-		
-	var classes = element.className.split(' ');
-	var i;
-	for(i = 0; i < classes.length; i++)
-		if(classes[i] == className)
-			return true;
-	return false;
-}
-
-/**
- * This function retrieves the actual value of a style property even if it is set via css.
- */
-function getStyle(node, styleProp)
-{
-	// if not an element
-	if( node.nodeType != 1)
-		return;
-		
-	var value;
-	if (node.currentStyle)
-	{
-		// ie case
-		styleProp = replaceDashWithCamelNotation(styleProp);
-		value = node.currentStyle[styleProp];
-	}
-	else if (window.getComputedStyle)
-	{
-		// mozilla case
-		value = document.defaultView.getComputedStyle(node, null).getPropertyValue(styleProp);
-	}
-	
-	return value;
-}
-
-function replaceDashWithCamelNotation(value)
-{
-	var pos = value.indexOf('-');
-	while(pos > 0 && value.length > pos + 1)
-	{
-		value = value.substring(0, pos) + value.substring(pos + 1, pos + 2).toUpperCase() + value.substring(pos + 2);
-		pos = value.indexOf('-');
-	}
-	return value;
-}
-
-
-/*******************************
- * Connector paint strategies. *
- *******************************/
- 
-/**
- * Horizontal "S" routing strategy.
- */
-function HorizontalSStrategy(connector)
-{
-	this.connector = connector;
-	
-	this.startSegment;
-	this.middleSegment;
-	this.endSegment;
-	
-	this.strategyName = "horizontal_s";
-	
-	this.getMiddleSegment = function()
-	{
-		return this.middleSegment;
-	}
-	
-	this.isApplicable = function()
-	{
-		var sourceLeft = this.connector.source.left();
-		var sourceWidth = this.connector.source.width();
-		var destinationLeft = this.connector.destination.left();
-		var destinationWidth = this.connector.destination.width();
-		
-		return Math.abs(2 * destinationLeft + destinationWidth - (2 * sourceLeft + sourceWidth)) - (sourceWidth + destinationWidth) > 4 * this.connector.minSegmentLength;
-	}
-	
-	this.paint = function()
-	{
-		this.startSegment = connector.createSegment();
-		this.middleSegment = connector.createSegment();
-		this.endSegment = connector.createSegment();
-		
-		var sourceLeft = this.connector.source.left();
-		var sourceTop = this.connector.source.top();
-		var sourceWidth = this.connector.source.width();
-		var sourceHeight = this.connector.source.height();
-		
-		var destinationLeft = this.connector.destination.left();
-		var destinationTop = this.connector.destination.top();
-		var destinationWidth = this.connector.destination.width();
-		var destinationHeight = this.connector.destination.height();
-		
-		var hLength;
-		
-		this.startSegment.startY = Math.floor(sourceTop + sourceHeight / 2);
-			
-		// deduce which face to use on source and destination blocks
-		if(sourceLeft + sourceWidth / 2 < destinationLeft + destinationWidth / 2)
-		{
-			// use left side of the source block and right side of the destination block
-			this.startSegment.startX = sourceLeft + sourceWidth;
-			hLength = destinationLeft - (sourceLeft + sourceWidth);
-		}
-		else
-		{
-			// use right side of the source block and left side of the destination block
-			this.startSegment.startX = sourceLeft;
-			hLength = destinationLeft + destinationWidth - sourceLeft;
-		}
-
-		// first horizontal segment positioning
-		this.startSegment.length = Math.floor(Math.abs(hLength) / 2);
-		this.startSegment.orientation = hLength > 0 ? RIGHT : LEFT;
-		
-		// vertical segment positioning			
-		var vLength = Math.floor(destinationTop + destinationHeight / 2 - (sourceTop + sourceHeight / 2));		
-		this.middleSegment.length = Math.abs(vLength);
-		if(vLength == 0)
-			this.middleSegment.visible = false;
-		this.middleSegment.orientation = vLength > 0 ? DOWN : UP;
-		
-		// second horizontal segment positioning
-		this.endSegment.length = Math.floor(Math.abs(hLength) / 2);
-		this.endSegment.orientation = hLength > 0 ? RIGHT : LEFT;
-	}
-}
-
-/**
- * Vertical "S" routing strategy.
- */
-function VerticalSStrategy(connector)
-{
-	this.connector = connector;
-	
-	this.startSegment;
-	this.middleSegment;
-	this.endSegment;
-	
-	this.strategyName = "vertical_s";
-	
-	this.getMiddleSegment = function()
-	{
-		return this.middleSegment;
-	}	
-	
-	this.isApplicable = function()
-	{
-		var sourceTop = this.connector.source.top();
-		var sourceHeight = this.connector.source.height();
-		var destinationTop = this.connector.destination.top();
-		var destinationHeight = this.connector.destination.height();
-		return Math.abs(2 * destinationTop + destinationHeight - (2 * sourceTop + sourceHeight)) - (sourceHeight + destinationHeight) > 4 * this.connector.minSegmentLength;
-	}
-	
-	this.paint = function()
-	{
-		this.startSegment = connector.createSegment();
-		this.middleSegment = connector.createSegment();
-		this.endSegment = connector.createSegment();
-		
-		var sourceLeft = this.connector.source.left();
-		var sourceTop = this.connector.source.top();
-		var sourceWidth = this.connector.source.width();
-		var sourceHeight = this.connector.source.height();
-		
-		var destinationLeft = this.connector.destination.left();
-		var destinationTop = this.connector.destination.top();
-		var destinationWidth = this.connector.destination.width();
-		var destinationHeight = this.connector.destination.height();
-		
-		var vLength;
-		
-		this.startSegment.startX = 	Math.floor(sourceLeft + sourceWidth / 2);
-			
-		// deduce which face to use on source and destination blocks
-		if(sourceTop + sourceHeight / 2 < destinationTop + destinationHeight / 2)
-		{
-			// use bottom side of the source block and top side of destination block
-			this.startSegment.startY = sourceTop + sourceHeight;
-			vLength = destinationTop - (sourceTop + sourceHeight);
-		}
-		else
-		{
-			// use top side of the source block and bottom side of the destination block
-			this.startSegment.startY = sourceTop;
-			vLength = destinationTop + destinationHeight - sourceTop;
-		}
-		
-		// first vertical segment positioning
-		this.startSegment.length = Math.floor(Math.abs(vLength) / 2);
-		this.startSegment.orientation = vLength > 0 ? DOWN : UP;
-		
-		// horizontal segment positioning
-		var hLength = Math.floor(destinationLeft + destinationWidth / 2 - (sourceLeft + sourceWidth / 2));
-		this.middleSegment.length = Math.abs(hLength);
-		this.middleSegment.orientation = hLength > 0 ? RIGHT : LEFT;
-					
-		// second vertical segment positioning
-		this.endSegment.length = Math.floor(Math.abs(vLength) / 2);
-		this.endSegment.orientation = vLength > 0 ? DOWN : UP;
-	}
-}
-
-/**
- * A horizontal "L" connector routing strategy
- */
-function HorizontalLStrategy(connector)
-{
-	this.connector = connector;
-	
-	this.destination;
-	
-	this.startSegment;
-	this.endSegment;
-	
-	this.strategyName = "horizontal_L";
-	
-	this.isApplicable = function()
-	{
-		var destMiddle = Math.floor(this.connector.destination.left() + this.connector.destination.width() / 2);
-		var sl = this.connector.source.left();
-		var sw = this.connector.source.width();
-		var dt = this.connector.destination.top();
-		var dh = this.connector.destination.height();
-		var sourceMiddle = Math.floor(this.connector.source.top() + this.connector.source.height() / 2);
-
-		if(destMiddle > sl && destMiddle < sl + sw)
-			return false;
-		if(sourceMiddle > dt && sourceMiddle < dt + dh)
-			return false;
-		return true;
-	}
-	
-	/**
-	 * Chooses the longest segment as the "middle" segment.
-	 */
-	this.getMiddleSegment = function()
-	{
-		if(this.startSegment.length > this.endSegment.length)
-			return this.startSegment;
-		else
-			return this.endSegment;
-	}
-	
-	this.paint = function()
-	{
-		this.startSegment = this.connector.createSegment();
-		this.endSegment = this.connector.createSegment();
-		
-		var destMiddleX = Math.floor(this.connector.destination.left() + this.connector.destination.width() / 2);
-		var sl = this.connector.source.left();
-		var sw = this.connector.source.width();
-		var dt = this.connector.destination.top();
-		var dh = this.connector.destination.height();
-		
-		this.startSegment.startY = Math.floor(this.connector.source.top() + this.connector.source.height() / 2);
-		
-		// decide which side of the source block to connect to
-		if(Math.abs(destMiddleX - sl) < Math.abs(destMiddleX - (sl + sw)))
-		{
-			// use the left face
-			this.startSegment.orientation = (destMiddleX < sl) ? LEFT : RIGHT;				
-			this.startSegment.startX = sl;
-		}
-		else
-		{
-			// use the right face
-			this.startSegment.orientation = (destMiddleX > (sl + sw)) ? RIGHT : LEFT;
-			this.startSegment.startX = sl + sw;
-		}
-		
-		this.startSegment.length = Math.abs(destMiddleX - this.startSegment.startX);
-		
-		// decide which side of the destination block to connect to
-		if(Math.abs(this.startSegment.startY - dt) < Math.abs(this.startSegment.startY - (dt + dh)))
-		{
-			// use the upper face
-			this.endSegment.orientation = (this.startSegment.startY < dt) ? DOWN : UP;
-			this.endSegment.length = Math.abs(this.startSegment.startY - dt);
-		}
-		else
-		{
-			// use the lower face
-			this.endSegment.orientation = (this.startSegment.startY > (dt + dh)) ? UP : DOWN;
-			this.endSegment.length = Math.abs(this.startSegment.startY - (dt + dh));
-		}
-	}
-}
-
-/**
- * Vertical "L" connector routing strategy
- */
-function VerticalLStrategy(connector)
-{
-	this.connector = connector;
-	
-	this.startSegment;
-	this.endSegment;
-	
-	this.strategyName = "vertical_L";
-	
-	this.isApplicable = function()
-	{
-		var sourceMiddle = Math.floor(this.connector.source.left() + this.connector.source.width() / 2);
-		var dl = this.connector.destination.left();
-		var dw = this.connector.destination.width();
-		var st = this.connector.source.top();
-		var sh = this.connector.source.height();
-		var destMiddle = Math.floor(this.connector.destination.top() + this.connector.destination.height() / 2);
-
-		if(sourceMiddle > dl && sourceMiddle < dl + dw)
-			return false;
-		if(destMiddle > st && destMiddle < st + sh)
-			return false;
-		return true;	
-	}
-	
-	/**
-	 * Chooses the longest segment as the "middle" segment.
-	 */
-	this.getMiddleSegment = function()
-	{
-		if(this.startSegment.length > this.endSegment.length)
-			return this.startSegment;
-		else
-			return this.endSegment;
-	}
-	
-	this.paint = function()
-	{
-		this.startSegment = this.connector.createSegment();
-		this.endSegment = this.connector.createSegment();
-		
-		var destMiddleY = Math.floor(this.connector.destination.top() + this.connector.destination.height() / 2);
-		var dl = this.connector.destination.left();
-		var dw = this.connector.destination.width();
-		var st = this.connector.source.top();
-		var sh = this.connector.source.height();
-		
-		this.startSegment.startX = Math.floor(this.connector.source.left() + this.connector.source.width() / 2);
-		
-		// decide which side of the source block to connect to
-		if(Math.abs(destMiddleY - st) < Math.abs(destMiddleY - (st + sh)))
-		{
-			// use the upper face
-			this.startSegment.orientation = (destMiddleY < st) ? UP : DOWN;
-			this.startSegment.startY = st;
-		}
-		else
-		{
-			// use the lower face
-			this.startSegment.orientation = (destMiddleY > (st + sh)) ? DOWN : UP;
-			this.startSegment.startY = st + sh;
-		}
-		
-		this.startSegment.length = Math.abs(destMiddleY - this.startSegment.startY);
-		
-		// decide which side of the destination block to connect to
-		if(Math.abs(this.startSegment.startX - dl) < Math.abs(this.startSegment.startX - (dl + dw)))
-		{
-			// use the left face
-			this.endSegment.orientation = (this.startSegment.startX < dl) ? RIGHT : LEFT;
-			this.endSegment.length = Math.abs(this.startSegment.startX - dl);
-		}
-		else
-		{
-			// use the right face
-			this.endSegment.orientation = (this.startSegment.startX > dl + dw) ? LEFT : RIGHT;
-			this.endSegment.length = Math.abs(this.startSegment.startX - (dl + dw));
-		}
-	}
-}
-
-function HorizontalCStrategy(connector, startOrientation)
-{
-	this.connector = connector;
-	
-	this.startSegment;
-	this.middleSegment;
-	this.endSegment;
-	
-	this.strategyName = "horizontal_c";
-	
-	this.getMiddleSegment = function()
-	{
-		return this.middleSegment;
-	}	
-	
-	this.isApplicable = function()
-	{
-		return true;
-	}
-	
-	this.paint = function()
-	{
-		this.startSegment = connector.createSegment();
-		this.middleSegment = connector.createSegment();
-		this.endSegment = connector.createSegment();
-		
-		var sign = 1;
-		if(startOrientation == RIGHT)
-			sign = -1;
-		
-		var startX = this.connector.source.left();
-		if(startOrientation == RIGHT)
-			startX += this.connector.source.width();
-		var startY = Math.floor(this.connector.source.top() + this.connector.source.height() / 2);
-		
-		var endX = this.connector.destination.left();
-		if(startOrientation == RIGHT)
-			endX += this.connector.destination.width();
-		var endY = Math.floor(this.connector.destination.top() + this.connector.destination.height() / 2);
-
-		this.startSegment.startX = startX;
-		this.startSegment.startY = startY;
-		this.startSegment.orientation = startOrientation;
-		this.startSegment.length = this.connector.minSegmentLength + Math.max(0, sign * (startX - endX));
-		
-		var vLength = endY - startY;
-		this.middleSegment.orientation = vLength > 0 ? DOWN : UP;
-		this.middleSegment.length = Math.abs(vLength);
-		
-		this.endSegment.orientation = startOrientation == LEFT ? RIGHT : LEFT;
-		this.endSegment.length = Math.max(0, sign * (endX - startX)) + this.connector.minSegmentLength;
-	}
-}
-
-function VerticalCStrategy(connector, startOrientation)
-{
-	this.connector = connector;
-	
-	this.startSegment;
-	this.middleSegment;
-	this.endSegment;
-	
-	this.strategyName = "vertical_c";
-	
-	this.getMiddleSegment = function()
-	{
-		return this.middleSegment;
-	}	
-	
-	this.isApplicable = function()
-	{
-		return true;
-	}
-	
-	this.paint = function()
-	{
-		this.startSegment = connector.createSegment();
-		this.middleSegment = connector.createSegment();
-		this.endSegment = connector.createSegment();
-		
-		var sign = 1;
-		if(startOrientation == DOWN)
-			sign = -1;
-		
-		var startY = this.connector.source.top();
-		if(startOrientation == DOWN)
-			startY += this.connector.source.height();
-		var startX = Math.floor(this.connector.source.left() + this.connector.source.width() / 2);
-		
-		var endY = this.connector.destination.top();
-		if(startOrientation == DOWN)
-			endY += this.connector.destination.height();
-		var endX = Math.floor(this.connector.destination.left() + this.connector.destination.width() / 2);
-
-		this.startSegment.startX = startX;
-		this.startSegment.startY = startY;
-		this.startSegment.orientation = startOrientation;
-		this.startSegment.length = this.connector.minSegmentLength + Math.max(0, sign * (startY - endY));
-		
-		var hLength = endX - startX;
-		this.middleSegment.orientation = hLength > 0 ? RIGHT : LEFT;
-		this.middleSegment.length = Math.abs(hLength);
-		
-		this.endSegment.orientation = startOrientation == UP ? DOWN : UP;
-		this.endSegment.length = Math.max(0, sign * (endY - startY)) + this.connector.minSegmentLength;
-	}
-}
-
-
-strategies[0] = function(connector) {return new HorizontalSStrategy(connector)};
-strategies[1] = function(connector) {return new VerticalSStrategy(connector)};
-strategies[2] = function(connector) {return new HorizontalLStrategy(connector)};
-strategies[3] = function(connector) {return new VerticalLStrategy(connector)};
-strategies[4] = function(connector) {return new HorizontalCStrategy(connector, LEFT)};
-strategies[5] = function(connector) {return new HorizontalCStrategy(connector, RIGHT)};
-strategies[6] = function(connector) {return new VerticalCStrategy(connector, UP)};
-strategies[7] = function(connector) {return new VerticalCStrategy(connector, DOWN)};
\ No newline at end of file
diff --git a/sourcecodes/kfold_cv.php b/sourcecodes/kfold_cv.php
index b168254a..16de2d5c 100644
--- a/sourcecodes/kfold_cv.php
+++ b/sourcecodes/kfold_cv.php
@@ -1,11 +1,20 @@
-<?php 
+<head>
+<meta http-equiv='cache-control' content='no-cache'>
+<meta http-equiv='expires' content='0'>
+<meta http-equiv='pragma' content='no-cache'>
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+<?php
 include("header_new.inc");
+include("header_batchsearch.inc");
 include("input_validate.php");
 if($_GET["My_key"]!="")
   $keyval=valid_keyval($_GET["My_key"]);
 if($_POST["My_key"]!="")
   $keyval=valid_keyval($_POST["My_key"]);
+
 ?>
+</head>
 
 <?php
 $varName = "";
@@ -37,17 +46,21 @@ function test_input($data) {
 
 ?>
 
+<?php
+$varName_file = "/var/lib/genenet/bnw/".$keyval."name.txt";
+$varName_line = file_get_contents($varName_file);
+$varNamesArr = explode("\t",$varName_line);
+?>
+
+
 
 <!-- Site navigation menu -->
 <ul class="navbar2">
-  <li><p>Network ID:<br><?php print($keyval);?></p></li>
-</ul>
-<ul class="navbar">
+  <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
   <li><a href="javascript:void(0);"
   NAME="Network" title="Network" onClick=window.open("layout.php?My_key=<?php print($keyval);?>","_self");>Return to network</a>
   <li><a href="javascript:void(0);"
   NAME="CV_predictions" title="CV_pred" onClick=window.open("cv_predictions.php?My_key=<?php print($keyval);?>","_self");>Return to validation and predictions menu</a>
-
   <li><a href="help.php">Help</a>
   <li><a href="home.php">Home</a>
 
@@ -61,40 +74,59 @@ function test_input($data) {
 <!-- Main content -->
 
 <?php
-  $filename1="./data/".$keyval."kfoldCV.txt";
-  $filename2="./data/".$keyval."kfoldCV_temp.txt";
-if(file_exists($filename2))
+  //  $filename1="./data/".$keyval."kfoldCV.txt";
+  //  $filename2="./data/".$keyval."kfoldCV_temp.txt";
+  $dir="/var/lib/genenet/bnw/";
+  $filename1=$keyval."kfoldCV.txt";
+  $filename2=$keyval."kfoldCV_temp.txt";
+$plotly_file=$keyval."kfold_plotly.html";
+//$plotly_file_local="./data/".$keyval."kfold_plotly.html";
+//$pred_file_local="./data/".$keyval."kfoldCV.txt";
+
+if(file_exists($dir.$filename2))
  {?>
 <br>
   <h2> k-fold cross-validation results are being calculated</h2>
 <br>
 <?php
  }
- else if(file_exists($filename1))
- {?>
-<br>
-    <h2> <a href=<?php $d="./data/".$keyval."kfoldCV.txt"; print($d);?>>View cross-validation results</a></h2>
-<?php
-   $plotly_file="./data/".$keyval."kfold_plotly.html";
-   if(file_exists($plotly_file))
-     {?>
-     <div>
-	 <object type="text/html" data=<?php print($plotly_file);?> width="800" height="500" >
+ else if(file_exists($dir.$plotly_file))
+ {
+ $table_text = json_encode(file("file://".$dir.$filename1));
+ //$plotly_data=file_get_contents("file://".$dir.$plotly_file);
+?>
+ <div>
+         <object width="800" height="500" data=<?php include($dir.$plotly_file)?> 
          </object>
      </div>
- <?php
-      }?>    
+     <div class="d3_table" id="table_div1">
+     <script type="text/javascript">
+        d3.text("", function(error,raw) {
+        var dsv=d3.dsvFormat("\t")
+	var data1 = <?php echo $table_text;?>;
+        var data2 = data1.join("");
+        var data=dsv.parse(data2)
+        var caption_text=data.pop()
+        if (error) throw error;
+           tabulate_caption("#table_div1",data,caption_text.CaseRow);
+        });
+</script>
+</div>
 <br>
-<h3>Perform k-fold cross-validation of another network variable</h3>
-<p align="justify"> 
- Enter the name of variable and number of folds below to validate predictions of that variable.
+    <a class=button2 href=<?php print("reroute.php?".$filename1);?>>Download cross-validation results</a>
 <br>
-</p>
-<FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
-  Variable name:<INPUT TYPE="text" name="varName" value="<?php echo $varName;?>" style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px; display: block; height: 30px; width: 300px;">
-<span class="error"> <?php if($varNameErr!="1") {echo $varNameErr;};?></span>
 <br>
-    Number of folds:<br><SELECT NAME="nm_folds">
+<h3>Perform k-fold cross-validation of another network variable</h3><br>
+<FORM METHOD="post" id=form ACTION="<?php $location = htmlspecialchars($_SERVER["PHP_SELF"]); echo ''.$location.'#form';?>">
+<p style="font-size:18px">Select variable name:</p>
+<select style='font-size:18px' Name="varName">
+   <?php foreach($varNamesArr as $entry){
+     echo "<option value='".$entry."'>$entry</option>";
+   }?>
+</select>
+<span class="error"> <?php if($varNameErr!="1") {echo $varNameErr;};?></span>
+<br><br>
+    <p style="font-size:18px">Number of folds:</p><SELECT style='font-size:20px' NAME="nm_folds">
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
@@ -106,22 +138,27 @@ if(file_exists($filename2))
      <option value="10">10</option>
      </select>
      <input type='hidden' name='My_key' value='<?php print($keyval)?>'>
-     <br><br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
+     <br><br><input class=button2 type="submit" name="submit" value="Submit" style="font-size: 18px">
 </FORM>
 <br>
+
 <?php
      } else {
 ?>
 <h2>Perform k-fold cross-validation of network</h2>
-<p align="justify"> 
-  To perform cross-validation, enter the name of the variable <br>that you want to test the predictions of and the number <br>of folds that the data should be separated into below.
-<br>
+<p align="justify">
+  To perform cross-validation, select the name of the variable that you want to test <br>the predictions of and the number of folds below. <br><br>
 <FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
-  Variable Name:<INPUT TYPE="text" name="varName" value="<?php echo $varName;?>" 
-  style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px; display: block; height: 30px; width: 300px;">
+     <p style='font-size:18px'>Select variable name:</p>
+<select style='font-size:18px' Name="varName">
+   <?php foreach($varNamesArr as $entry){
+     echo "<option value='".$entry."'>$entry</option>";
+   }?>
+</select>
   <span class="error"> <?php if($varNameErr!="1") {echo $varNameErr;};?></span>
-  <br>
-     Number of folds:<br><SELECT NAME="nm_folds">
+  <br><br>
+     <p style="font-size:18px">Number of folds:</p>
+   <SELECT style='font-size:18px' NAME="nm_folds">
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
@@ -133,7 +170,7 @@ if(file_exists($filename2))
      <option value="10">10</option>
      </select>
      <input type='hidden' name='My_key' value='<?php print($keyval)?>'>
-     <br><br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
+     <br><br><input class=button2 type="submit" name="submit" value="Submit" style="font-size: 18px;">
 </FORM>
 </p>
 <br>
@@ -148,9 +185,7 @@ if($nm_folds!="")
   $pred_link='cv_predictions.php?My_key='.$keyval;
   sleep(1);
   echo "<br>";
-  echo "Calculation submitted";
-  echo "<br>";
-  echo "<a href=$pred_link>Click to return to cross-validation and predictions menu</a>";
+  echo "<a class=button3 href=$pred_link>Calculation submitted. Click here to return to cross-validation and predictions menu</a><br><br>";
 }
 ?>
 
diff --git a/sourcecodes/kfold_cv_example.php b/sourcecodes/kfold_cv_example.php
deleted file mode 100644
index 68c1a3bf..00000000
--- a/sourcecodes/kfold_cv_example.php
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php 
-include("header_new.inc");
-include("input_validate.php");
-if($_GET["My_key"]!="")
-  $keyval=valid_keyval($_GET["My_key"]);
-if($_POST["My_key"]!="")
-  $keyval=valid_keyval($_POST["My_key"]);
-?>
-
-<?php
-$varName = "";
-$varNameErr = "";
-$nm_folds="";
-
-if ($_SERVER["REQUEST_METHOD"] == "POST") {
-  $nm_folds = (int)$_POST['nm_folds'];
-  if (empty($_POST["varName"])) {
-    $varNameErr = "Entering a variable name is required";
-  } else {
-    //    $varName = test_input($_POST["varName"]);
-    $varName = valid_input($_POST["varName"]);
-    $varNameErr = "1";
-    // check if name only contains letters, numbers, and whitespace
-    //   if (!preg_match('/^[-A-Za-z\d\ \t\r\n_\.]+$',$varName)) {
-    //      $varNameErr = "The input string contains characters that are not allowed";
-    //    }
-  }
-}
-
-
-function test_input($data) {
-  $data = trim($data);
-  $data = stripslashes($data);
-  $data = htmlspecialchars($data);
-  return $data;
-}
-
-?>
-
-
-<!-- Site navigation menu -->
-<ul class="navbar2">
-  <li><p>Network ID:<br><?php print($keyval);?></p></li>
-</ul>
-<ul class="navbar">
-  <li><a href="javascript:void(0);"
-  NAME="Network" title="Network" onClick=window.open("layout_example.php?My_key=<?php print($keyval);?>","_self");>Return to network</a>
-  <li><a href="javascript:void(0);"
-  NAME="CV_predictions" title="CV_pred" onClick=window.open("cv_predictions_example.php?My_key=<?php print($keyval);?>","_self");>Return to validation and predictions menu</a>
-
-  <li><a href="help.php">Help</a>
-  <li><a href="home.php">Home</a>
-
-
-</ul>
-
-
-
-
-<div id="outer">
-<!-- Main content -->
-
-<?php
-  $filename1="./data/".$keyval."kfoldCV.txt";
-  $filename2="./data/".$keyval."kfoldCV_temp.txt";
-if(file_exists($filename2))
- {?>
-<br>
-  <h2> k-fold cross-validation results are being calculated</h2>
-<br>
-<?php
- }
- else if(file_exists($filename1))
- {?>
-<br>
-    <h2> <a href=<?php $d="./data/".$keyval."kfoldCV.txt"; print($d);?>>View cross-validation results</a></h2>
-<br>
-<h3>Perform k-fold cross-validation of another network variable</h3>
-<p align="justify"> 
- Enter the name of variable and number of folds below to validate predictions of that variable.
-<br>
-</p>
-<FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
-  Variable name:<INPUT TYPE="text" name="varName" value="<?php echo $varName;?>" style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px; display: block; height: 30px; width: 300px;">
-<span class="error"> <?php if($varNameErr!="1") {echo $varNameErr;};?></span>
-<br>
-    Number of folds:<br><SELECT NAME="nm_folds">
-     <option value="2">2</option>
-     <option value="3">3</option>
-     <option value="4">4</option>
-     <option value="5">5</option>
-     <option value="6">6</option>
-     <option value="7">7</option>
-     <option value="8">8</option>
-     <option value="9">9</option>
-     <option value="10">10</option>
-     </select>
-     <input type='hidden' name='My_key' value='<?php print($keyval)?>'>
-     <br><br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
-</FORM>
-<br>
-<?php
-     } else {
-?>
-<h2>Perform k-fold cross-validation of network</h2>
-<p align="justify"> 
-  To perform cross-validation, enter the name of the variable <br>that you want to test the predictions of and the number <br>of folds that the data should be separated into below.
-<br>
-<FORM METHOD="post" ACTION="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
-  Variable Name:<INPUT TYPE="text" name="varName" value="<?php echo $varName;?>" 
-  style="padding: 2px 5px; border: 2px solid; border-color: black black black black; font-family: Georgia, ..., serif; font-size: 18px; display: block; height: 30px; width: 300px;">
-  <span class="error"> <?php if($varNameErr!="1") {echo $varNameErr;};?></span>
-  <br>
-     Number of folds:<br><SELECT NAME="nm_folds">
-     <option value="2">2</option>
-     <option value="3">3</option>
-     <option value="4">4</option>
-     <option value="5">5</option>
-     <option value="6">6</option>
-     <option value="7">7</option>
-     <option value="8">8</option>
-     <option value="9">9</option>
-     <option value="10">10</option>
-     </select>
-     <input type='hidden' name='My_key' value='<?php print($keyval)?>'>
-     <br><br><input type="submit" name="submit" value="Submit" style="display: block; height: 30px; width:100px; font-family: Georgia, ..., serif; font-size: 16px;">
-</FORM>
-</p>
-<br>
-
-<?php
-}
-
-if($nm_folds!="")
-{
-  $command = './run_scripts/run_kfold '.$keyval.' '.$varName.' '.$nm_folds;
-  $output = shell_exec("$command > /dev/null 2 > /dev/null &");
-  $pred_link='cv_predictions_example.php?My_key='.$keyval;
-  sleep(1);
-  echo "<br>";
-  echo "Calculation submitted";
-  echo "<br>";
-  echo "<a href=$pred_link>Click to return to cross-validation and predictions menu</a>";
-}
-?>
-
-</div>
-</body>
-
-
diff --git a/sourcecodes/kfold_plotly.py b/sourcecodes/kfold_plotly.py
index e038c796..102d01d2 100644
--- a/sourcecodes/kfold_plotly.py
+++ b/sourcecodes/kfold_plotly.py
@@ -1,15 +1,13 @@
-#!/home/jziebart/python/Python-2.7.15/python
+#!/var/www/html/compbio/BNW_1.3/bnw-env/bin/python
 import os
 import sys
 
-#sys.path.append('/home/jziebart/.local/bin')
-#sys.path.append('/home/jziebart/.local/lib')
-
 import plotly
 import plotly.graph_objs as go
 import csv
 import string
 
+
 netID = sys.argv[-1]
 
 outfile = netID+"kfold_plotly.html"
@@ -17,19 +15,26 @@ outfile = netID+"kfold_plotly.html"
 filename=netID+"kfoldCV.txt"
 f=open(filename,"r")
 #Read the first line to get the variable name
-line=f.readline()
-line = map(string.strip,line.strip().split(" "))
-print line
-varName = line[-1]
-print varName
+lines=f.readlines()
+line = lines.pop()
+#line = map(string.strip,line.strip().split(" "))
+line = line.strip().split(" ")
+#print line
+varName = line[3][:-1]
+#print varName
+plot_title = varName+' k-fold validation'
+#print plot_title
+header = lines.pop(0)
 
 #Read type file to determine if it is continuous or discrete
 typefile = netID+"type.txt"
 tf=open(typefile,"r")
 line=tf.readline()
-varnames = map(string.strip,line.strip().split("\t"))
+#varnames = map(string.strip,line.strip().split("\t"))
+varnames = line.strip().split("\t")
 line=tf.readline()
-vartypes = map(string.strip,line.strip().split("\t"))
+#vartypes = map(string.strip,line.strip().split("\t"))
+vartypes = line.strip().split("\t")
 varindex = varnames.index(varName)
 cd_type = int(vartypes[varindex])
 
@@ -37,20 +42,32 @@ cd_type = int(vartypes[varindex])
 if cd_type == 1:
     #Make scatterplot for continuous_data
     #Read introductory lines from file
-    for i in range(6):
-        line = f.readline()
+#    for i in range(6):
+#        line = f.readline()
     #Read the data
     x = []
     y = []
-    line = f.readline()
-    while line:
-        line = map(string.strip,line.strip().split("\t"))
+#    line = f.readline()
+#    while line:
+    for line in lines:
+        #line = map(string.strip,line.strip().split("\t"))
+        line = line.strip().split("\t")
         x.append(float(line[2]))
         y.append(float(line[3]))
-        line=f.readline()
+#        line=f.readline()
 
     data = [go.Scatter(x=x,y=y,mode='markers')]
     layout = go.Layout(
+        title=plot_title,
+        titlefont=dict(
+            family='Arial, sans-serif',
+            size=24,
+            color='black'
+            ),
+	title_xref="paper",
+	title_x=0.5,
+	title_xanchor="center",
+	title_yanchor="middle",
         xaxis=dict(
             autorange=True,
             title='Actual values',
@@ -68,7 +85,8 @@ if cd_type == 1:
                 size=18,
                 color='black'
                 ),
-            )
+            ),
+        margin=dict(t=30,l=50,b=40)
         )
     fig = go.Figure(data=data, layout = layout)
     plotly.offline.plot(fig,filename=outfile)
@@ -76,17 +94,20 @@ if cd_type == 1:
 else:
     #Make bar chart for discrete data
     #Read introductory lines from file
-    for i in range(5):
-        line = f.readline()
+#    for i in range(5):
+#        line = f.readline()
     #Get names of states
-    line = map(string.strip,line.strip().split("\t"))
-    states = line[3:]
+    #header = map(string.strip,header.strip().split("\t"))
+    header = header.strip().split("\t")
+    states = header[3:]
     #Read the data
     actual = []
     predicted = []
-    line = f.readline()
-    while line:
-        line = map(string.strip,line.strip().split("\t"))
+#    line = f.readline()
+#    while line:
+    for line in lines:
+        #line = map(string.strip,line.strip().split("\t"))
+        line = line.strip().split("\t")
         actual.append(line[2])
         predict_x = line[3:]
         predict_x = [float(x) for x in predict_x]
@@ -99,7 +120,7 @@ else:
         if len(max_items) > 1:
             predicted.pop()
             actual.pop()
-        line=f.readline()
+#        line=f.readline()
     
     #Go through states and get number of true positives, false positives, and false negatives
     tp_all = []
@@ -128,6 +149,16 @@ else:
     data = [trace1,trace2,trace3]
     layout = go.Layout(
         barmode='group',
+        title=plot_title,
+        titlefont=dict(
+            family='Arial, sans-serif',
+            size=24,
+            color='black'
+            ),
+	title_xref="paper",	
+	title_x=0.5,
+	title_xanchor="center",
+	title_yanchor="middle",
         xaxis=dict(
             autorange=True,
             title='State',
@@ -145,7 +176,8 @@ else:
                 size=18,
                 color='black'
                 ),
-            )
+            ),
+        margin=dict(t=30,l=50,b=40),
     )
     fig = go.Figure(data=data, layout = layout)
     plotly.offline.plot(fig,filename=outfile)
diff --git a/sourcecodes/layout.php b/sourcecodes/layout.php
index 6c50a561..aef275ca 100644
--- a/sourcecodes/layout.php
+++ b/sourcecodes/layout.php
@@ -1,10 +1,16 @@
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/accordion.js"></script>
+
 <?php
 
 include("header_new.inc");
 include("input_validate.php");
 $keyval=valid_keyval($_GET["My_key"]);
 
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $vf1=$dir.$keyval."var.txt";
 $vf2=$dir.$keyval."varname.txt";
@@ -49,47 +55,52 @@ function calcHeight()
 }
 //-->
 </script>
-<form  method="post" name="form"> 
-<table width="100%" align="center" style="background-color:" bordercolor=white border=0.5 cellspacing="0" cellpadding="0">
- <tr valign=top>
-      <td colspan=4><hr size=3></td>
-  </tr>
-<tr >
-<th align=right> <h3>Prediction Mode:&nbsp</h3></th>
-  <td align=left>
-      <input name="Datatype" type="radio" value=<?php $radioval="Evidence"; echo $radioval; ?> checked <?php echo $S1; ?>" onClick="javascript:this.form.submit();">Evidence&nbsp;&nbsp;&nbsp;
-      <input name="Datatype" type="radio" value=<?php $radioval="Intervention"; echo $radioval; ?> <?php echo $S2; ?>" onClick="javascript:this.form.submit();"> Intervention
-      
-  </td>
-</tr>
-  <tr valign=top>
-      <td colspan=4><hr size=3></td>
-  </tr>
-
-</table>
-</form>
 
 <!-- Site navigation menu -->
 <ul class="navbar2">
-   <li><p>Selected mode:<br><?php print($radiovalue);?></p></li>
-   <li><p>Network ID:<br><?php print($keyval);?></p></li>
+   <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
+   <li><p style="display:inline">Prediction mode</p>
+     <form  method="post" name="form"> 
+    <label><input name="Datatype" type="radio" value=<?php $radioval="Evidence"; echo $radioval; ?> checked <?php echo $S1; ?>" onClick="javascript:this.form.submit();"><p style="display:inline">Evidence<br></p></label>
+      <label><input name="Datatype" type="radio" value=<?php $radioval="Intervention"; echo $radioval; ?> <?php echo $S2; ?>" onClick="javascript:this.form.submit();"><p style="display:inline">Intervention</p></label>
+   </form></li>
+   <li><a href="clear.php?My_key=<?php print($keyval);?>" target='_blank'>Clear evidence</a>
 </ul>
-
-<ul class="navbar">
- <li><a href="clear.php?My_key=<?php print($keyval);?>" target='_blank'>Clear evidence</a>
-<li><a href="cv_predictions.php?My_key=<?php print($keyval);?>";>Cross validation and predictions</a>
-<li><a href="modify_edges.php?My_key=<?php print($keyval);?>" target='_blank'>Modify network structure</a>
-  <li><a href="javascript:void(0);"
-NAME="Model Averaging Matrix" title="Model Averaging Matrix"
-onClick=window.open("matrix.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>Display structure matrix</a>  
-  <li><a href="javascript:void(0);"
-NAME="Parameters" title="Parameters"
-onClick=window.open("parameter_display.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>View parameters</a>  
+<ul class="navbar2">
+   <li><a href="cv_predictions.php?My_key=<?php print($keyval);?>";>Cross validation and predictions</a>
+</ul>
+   <button class="accordion">More about network&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+<li><a href="parameter_display.php?My_key=<?php print($keyval);?>" target='_blank'>View parameters</a>
+<li><a href="violin.php?My_key=<?php print($keyval);?>" target='_blank'>View violin plots of distributions</a>
+  <li><a href="matrix_new.php?My_key=<?php print($keyval);?>" target="_blank">View structure matrix</a>  
+<?php
+$filename1="/var/lib/genenet/bnw/".$keyval."slsettings.txt";
+if(file_exists($filename1))  
+  {?>
+  <li><a href="review_settings.php?My_key=<?php print($keyval);?>" target="_blank">View structure learning settings</a>
+<?php
+}?>  
+  <li><a href="input_check.php?My_key=<?php print($keyval);?>" target="_blank">View input data and descriptions</a>
+ <li><a href="layout_svg_no.php?My_key=<?php print($keyval);?>">Return to simplified network structure</a>
+</ul>
+</div>
+<button class="accordion">Modify network structure&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+<li><a href="layout_cyto.php?My_key=<?php print($keyval);?>" target='_blank'>Add or remove network edges</a>
 <li><a href="modify_structure_learning.php?My_key=<?php print($keyval);?>" target='_blank';>Modify structure learning settings</a>
+<li><a href="remove_variables.php?My_key=<?php print($keyval);?>" target='_blank';>Select variables to remove and relearn structure</a>
+</ul>
+</div>
+<ul class="navbar2">
+ <li><a href="about_this_page.php#network_predictions" target='_blank'>About this page</a> 
  <li><a href="help.php" target='_blank'>Help</a> 
  <li><a href="../home.php">Home</a>
 </ul>
 
+
 <?php
     //echo "Selected mode:";
     //echo $radiovalue;
@@ -100,11 +111,9 @@ if($radiovalue==$valcompare)
 {
 ?>
 <div  id="outernew">
-
 <object type="text/html" data="network_layout_evd.php?My_key=<?php print($keyval);?>" style="width:3000; height:3000">
 <p>Error: Try again</p>
 </object>
-
 </div>
 <?php
 }
diff --git a/sourcecodes/layout_cyto.php b/sourcecodes/layout_cyto.php
index 100ba044..85d8835a 100644
--- a/sourcecodes/layout_cyto.php
+++ b/sourcecodes/layout_cyto.php
@@ -1,8 +1,9 @@
 <!DOCTYPE html>
 <head>
 
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cytoscape-panzoom/2.5.3/cytoscape.js-panzoom.css">
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css">
+
+<link rel="stylesheet" href="./scripts/cytoscape.js-panzoom.css">
+<link rel="stylesheet" href="./scripts/font-awesome.css">
 
 
 <?php
@@ -11,35 +12,44 @@ include("header_new.inc");
 include("input_validate.php");
 $keyval=valid_keyval($_GET["My_key"]);
 
-$dir="./data/";
+//$dir="./data/";
+//In this case, $dir is used by the json command so it is interpreted and turned into /tmp/bnw/ automatically
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
-$input_json=$dir.$keyval."network.json";
+$input_json=$keyval."network.json";
 $output_png=$keyval."modified_network.png";
 
-
+//In this section, $dir is used by php, so we need to use /tmp/bnw
+//$thrfile="/tmp/bnw/".$keyval."thr.txt";
+$thrfile="/var/lib/genenet/bnw/".$keyval."thr.txt";
+if(file_exists($thrfile))
+  {
+    $thr=file_get_contents("$thrfile");
+    $thr=trim($thr);
+  } else {
+  $thr=0.5;
+}
 ?>
 
 
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.7.1/cytoscape.min.js"></script>
-<script src="https://unpkg.com/dagre@0.7.4/dist/dagre.js"></script>
-<script src="http://spades.bioinf.spbau.ru/~alla/graph_viewer/js/cytoscape-dagre.js"></script>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape-panzoom/2.5.3/cytoscape-panzoom.js"></script>
-<!---
-<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/2.7.29/cytoscape.min.js"></script>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.7.1/cytoscape.min.js"></script>
--->
-<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.js"></script>
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/cytoscape.min.js"></script>
+<script src="./scripts/dagre.js"></script>
+<script src="./scripts/cytoscape-dagre.min.js"></script>
+<script src="./scripts/cytoscape-panzoom.js"></script>
+<script src="./scripts/lodash.js"></script>
 
 
 <style type = "text/css">
-   #cy {
+
+#cy {
    width: 80%;
    height: 80%;
 position: absolute;
 /*float: top;*/
-top: 5em;
-left: 10em;
+top: 3em;
+left: 9em;
 overflow: auto;
 border: 2px solid;
 border-radius: 0.5em;
@@ -61,11 +71,16 @@ display: none;
 }
 
 #filterOut {
-  color: white;
+  color: black;
 }
 
 </style>
 
+<?php
+$json_text = json_encode(file("file://".$dir.$input_json));
+?>
+
+
 <script>
 
   //  var default_layout = { name: 'breadthfirst',
@@ -82,11 +97,16 @@ var default_layout = { name: 'dagre',
 		       padding: 30,
 		       spacingFactor: 1.25
   }
+  
 
-  $.getJSON("<?php print($input_json);?>",function (data) {
-  //$.getJSON("./data/cwHnetwork.json",function (data) {
+  //$.getJSON("<?php print($input_json);?>",function (data) {
+  $.getJSON("./data/LRlnetwork.json",function (dumm) {
       //    console.log(data);
     //     document.addEventListener('DOMContentLoaded', function(){
+     var data1 = <?php echo $json_text?>;
+//    console.log(data1); 
+    var data2 = data1.join("");
+     var data = JSON.parse(data2);
       var cy = window.cy = cytoscape({
 	container: document.getElementById('cy'),
 	    elements: data,
@@ -247,7 +267,7 @@ $("#addEdge").click(function (e) {
       return;
     var edge = new Object();
     edge.group = 'edges';
-    edge.data = {source: cy.filter("node.selected1")[0].data('id'), target: cy.$("node.selected2")[0].data('id'), weight: 1};
+    edge.data = {source: cy.filter("node.selected1")[0].data('id'), target: cy.$("node.selected2")[0].data('id'), weight: 1.1};
     cy.add(edge);
     cy.filter("node.selected1").removeClass('selected1',false);
     cy.filter("node.selected2").removeClass('selected2',false);
@@ -268,6 +288,7 @@ $("#deleteEdge").click(function (e) {
       {
        cy.remove(tEdges[i]);
       }
+     eles = cy.filter();
   });
 
 
@@ -342,30 +363,40 @@ $('#pos_slide').change(function (e) {
 
 <body>
 <!-- Site navigation menu -->
-<ul class="navbar2">
-   <li><p>Network ID:<br><?php print($keyval);?></p></li>
-</ul>
-
 <ul class="navbar">
  <li><a id="addEdge" href="#">Add edge between selected nodes</a></li>
     <li><a id="deleteEdge" href="#">Remove selected edges</a></li>
+<?php
+    //$filename1="/tmp/bnw/".$keyval."structure_input_temp.txt";
+    $filename1="/var/lib/genenet/bnw/".$keyval."structure_input_temp.txt";
+if(file_exists($filename1))
+  {?>
  <li><a id="weightFilter" href="#">Filter edges by weight:</a>
   <form name="weightValue">
-  <output name="filterOut" id="filterOut">0.5</output><br>
-  <input type="range" name="weightOutputName" id= "pos_slide" min="0.5" max="1" value ="0.5" step="0.01" list="weight" style="display: inline; width: 120px" oninput="filterOut.value = pos_slide.value">
+    <output name="filterOut" id="filterOut" style="color:black"><?php print($thr);?></output><br>
+  <input type="range" name="weightOutputName" id= "pos_slide" min="<?php print($thr);?>" max="1" value ="<?php print($thr);?>" step="0.01" list="weight" style="display: inline; width: 120px" oninput="filterOut.value = pos_slide.value">
   </form>
   </li>
+<?php
+											}
+?>
  <li><a id="saveNetwork" href="#">Use modified network</a></li>
- <li><a id="downloadNetwork" href="#">Save network as png</a></li>
+</ul>
+<ul class="navbar2">
+   <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
+ <li><a id="downloadNetwork" href="#">Save network as PNG</a></li>
+</ul>
+<ul class="navbar2">
+ <li><a href="add_remove_howto.htm" target='_blank'>About this page</a> 
  <li><a href="help.php" target='_blank'>Help</a> 
  <li><a href="../home.php">Home</a>
 </ul>
 
 <div id="cy"></div>
-<div = id="loading">
+<div id="loading">
     <span class="fa fa-refresh fa-spin"></spin>
 </div>
 
 </body>
 
-</html>
\ No newline at end of file
+</html>
diff --git a/sourcecodes/layout_cyto.php~ b/sourcecodes/layout_cyto.php~
new file mode 100644
index 00000000..272ae961
--- /dev/null
+++ b/sourcecodes/layout_cyto.php~
@@ -0,0 +1,402 @@
+<!DOCTYPE html>
+<head>
+
+
+<!--
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cytoscape-panzoom/2.5.3/cytoscape.js-panzoom.css">
+<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css">
+-->
+
+<link rel="stylesheet" href="./scripts/cytoscape.js-panzoom.css">
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+
+
+<?php
+
+include("header_new.inc");
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]);
+
+$dir="./data/";
+//In this case, $dir is used by the json command so it is interpreted and turned into /tmp/bnw/ automatically
+//$dir="/tmp/bnw/";
+
+$input_json=$dir.$keyval."network.json";
+$output_png=$keyval."modified_network.png";
+
+//In this section, $dir is used by php, so we need to use /tmp/bnw
+$thrfile="/tmp/bnw/".$keyval."thr.txt";
+if(file_exists($thrfile))
+  {
+    $thr=file_get_contents("$thrfile");
+    $thr=trim($thr);
+  } else {
+  $thr=0.5;
+}
+?>
+
+
+<!--
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.7.1/cytoscape.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape-panzoom/2.5.3/cytoscape-panzoom.js"></script>
+<script src="https://unpkg.com/dagre@0.7.4/dist/dagre.js"></script>
+<script src="https://cdn.jsdelivr.net/npm/cytoscape-dagre@2.2.2/cytoscape-dagre.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.js"></script>
+-->
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/cytoscape.min.js"></script>
+<script src="./scripts/dagre.js"></script>
+<script src="./scripts/cytoscape-dagre.min.js"></script>
+<script src="./scripts/cytoscape-panzoom.js"></script>
+<script src="./scripts/lodash.js"></script>
+
+
+<style type = "text/css">
+
+#cy {
+   width: 80%;
+   height: 80%;
+position: absolute;
+/*float: top;*/
+top: 3em;
+left: 9em;
+overflow: auto;
+border: 2px solid;
+border-radius: 0.5em;
+}
+
+
+#loading {
+position: absolute;
+display: block;
+top: 10%;
+width: 45%;
+color: #000;
+font-size: 8em;
+text-align: center;
+}
+
+#loading.loaded {
+display: none;
+}
+
+#filterOut {
+  color: black;
+}
+
+</style>
+
+<script>
+
+  //  var default_layout = { name: 'breadthfirst',
+  //		       directed: true,
+  //		       maximal: true,
+  //		       grid: true,
+  //		       spacingFactor: 1,
+  //			 fit: true, //whether to fit the viewport to the graph
+  //		       padding: 10 // the padding on fit
+  //}
+
+var default_layout = { name: 'dagre',
+		       fit: true,
+		       padding: 30,
+		       spacingFactor: 1.25
+  }
+
+  $.getJSON("<?php print($input_json);?>",function (data) {
+  //$.getJSON("./data/cwHnetwork.json",function (data) {
+      //    console.log(data);
+    //     document.addEventListener('DOMContentLoaded', function(){
+      var cy = window.cy = cytoscape({
+	container: document.getElementById('cy'),
+	    elements: data,
+	    layout: default_layout,
+	    style: [
+		    { 
+		    selector: 'node',
+			style: {
+			'label': 'data(label)',
+			  'font-size': 20,
+			 'shape': 'roundrectangle',
+			 'text-halign': 'center',
+			 'text-valign': 'center',
+			 'width': 'label',
+			 'height': 'label',
+			 'padding': '6px',
+			 'color': 'black',
+			 'background-color': 'white',
+			 'border-style': 'solid',
+			 'border-color': 'black',
+			 'border-width': '2px'
+			  }
+		    }, 
+		    {
+		    selector: '.selected1',
+			style:{
+			'color': 'green',
+			'shape': 'ellipse',
+			  'background-color': '#DCDCDC',
+			 'border-color': 'green',
+			  'border-width': '2px',
+			 'border-style': 'dashed'
+			  }
+		    },
+		    {
+		    selector: '.selected2',
+			style:{
+			'color': 'red',
+			'shape': 'octagon',
+			 'border-color': 'red',
+			  'border-width': '2px',
+			  'background-color': '#DCDCDC',
+			  'border-style': 'dashed'
+			  }
+		    },
+		    {
+		    selector: 'edge',
+			style: {
+			'line-color': 'black',
+			  'curve-style': 'bezier',
+			  //'target-endpoint': 'outside-to-node-or-label',
+			  'width': '3px',
+			 'target-arrow-shape': 'triangle',
+			 'target-arrow-color': 'black',
+			 'control-point-step-size': '140px',
+			 'arrow-scale': '2'
+			  }
+		    },
+		    {
+		    selector: '.selected3',
+			style:{
+			'line-color': 'red',
+			  'target-arrow-color': 'red',
+			  'line-style': 'dashed'
+			  }
+		    }
+		    ]
+	    });
+      //       });
+
+
+
+      //window.onload=function() {
+
+  var eles = cy.filter(); //var containing all elements so they can be restored after being removed
+
+  // the default values of each option are outlined below:
+  var defaults = {
+  zoomFactor: 0.05, // zoom factor per zoom tick
+  zoomDelay: 45, // how many ms between zoom ticks
+  minZoom: 0.1, // min zoom level
+  maxZoom: 10, // max zoom level
+  fitPadding: 30, // padding when fitting
+  panSpeed: 10, // how many ms in between pan ticks
+  panDistance: 10, // max pan distance per tick
+  panDragAreaSize: 75, // the length of the pan drag box in which the vector for panning is calculated (bigger = finer control of pan speed and direction)
+  panMinPercentSpeed: 0.25, // the slowest speed we can pan by (as a percent of panSpeed)
+  panInactiveArea: 8, // radius of inactive area in pan drag box
+  panIndicatorMinOpacity: 0.5, // min opacity of pan indicator (the draggable nib); scales from this to 1.0
+  zoomOnly: false, // a minimal version of the ui only with zooming (useful on systems with bad mousewheel resolution)
+  fitSelector: undefined, // selector of elements to fit
+  animateOnFit: function(){ // whether to animate on fit
+      return false;
+    },
+  fitAnimationDuration: 1000, // duration of animation on fit
+
+  // icon class names
+  sliderHandleIcon: 'fa fa-minus',
+  zoomInIcon: 'fa fa-plus',
+  zoomOutIcon: 'fa fa-minus',
+  resetIcon: 'fa fa-expand',
+  };
+
+
+
+  cy.panzoom( defaults );
+
+  $("#loading").addClass("loaded");
+
+//This is probably more complex than it needs to be; 
+// the goal is to ensure:
+// 1) No more than two nodes can be selected at a time.
+// 2) Only one parent node (selected1) and only one child node (selected2) 
+//        can be selected
+cy.on('tap', 'node', function(event) {
+    if(cy.filter("node.selected1").length == 0) {
+      event.target.addClass('selected1');
+      event.target.removeClass('selected2');
+    } else {
+      event.target.removeClass('selected1');
+      if(cy.filter("node.selected1").length == 1) {
+	if(cy.filter("node.selected2").length == 0) {
+	  event.target.addClass('selected2');
+	} else {
+	  event.cy.filter("node.selected2").removeClass("selected2");
+	}
+      } else {
+	event.cy.filter("node.selected1").removeClass("selected1");
+	event.cy.filter("node.selected2").removeClass("selected2");
+      }
+    }
+  });
+//The code below works with older versions of Cytoscape.js (before v3)
+//cy.on('tap', 'node', function(event) {
+//    if(cy.filter("node.selected1").length == 0) {
+//      event.cyTarget.addClass('selected1');
+//      event.cyTarget.removeClass('selected2');
+//    } else {
+//      event.cyTarget.removeClass('selected1');
+//      if(cy.filter("node.selected1").length == 1) {
+//	if(cy.filter("node.selected2").length == 0) {
+//	  event.cyTarget.addClass('selected2');
+//	} else {
+//	  event.cy.filter("node.selected2").removeClass("selected2");
+//	}
+//      } else {
+//	event.cy.filter("node.selected1").removeClass("selected1");
+//	event.cy.filter("node.selected2").removeClass("selected2");
+//      }
+//    }
+//  });
+
+
+$("#addEdge").click(function (e) {
+    if(cy.filter("node.selected1").length !=1)
+      return;
+    if(cy.filter("node.selected1").length !=1)
+      return;
+    var edge = new Object();
+    edge.group = 'edges';
+    edge.data = {source: cy.filter("node.selected1")[0].data('id'), target: cy.$("node.selected2")[0].data('id'), weight: 1};
+    cy.add(edge);
+    cy.filter("node.selected1").removeClass('selected1',false);
+    cy.filter("node.selected2").removeClass('selected2',false);
+  });
+
+
+//cy.on('tap', 'edge', function(event) {
+//    event.cyTarget.toggleClass('selected3');
+//  });
+
+cy.on('tap', 'edge', function(event) {
+    event.target.toggleClass('selected3');
+  });
+
+$("#deleteEdge").click(function (e) {
+    var tEdges = cy.filter("edge.selected3");
+    for (var i = 0; i < tEdges.length; i++)
+      {
+       cy.remove(tEdges[i]);
+      }
+     eles = cy.filter();
+  });
+
+
+//$("#saveNetwork").click(function (e) {
+//    console.log(cy.elements().jsons());
+//});
+
+$("#downloadNetwork").click(function (e) {
+    var png64 = cy.png();
+    $(this).attr('href',png64);
+    $(this).attr('download',"<?php print($output_png);?>");
+  });
+
+$("#saveNetwork").click(function (e) {
+    //var jsonObject = JSON.stringify(cy.elements().jsons());
+    
+    $("#loading").removeClass("loaded");
+    var node_labs = cy.nodes().map(function (ele) {
+	return ele.data('label');
+      });
+    var sources = cy.edges().map(function (ele) {
+	return ele.data('source');
+      });
+    var targets = cy.edges().map(function (ele) {
+	return ele.data('target');
+      });
+    var weights = cy.edges().map(function (ele) {
+	return ele.data('weight');
+      });
+      
+    var old_key = "<?php print($keyval);?>";
+    $.post("modified_network.php", {
+          old_key : old_key,
+	  nnodes : node_labs.length,
+	  node_labs : JSON.stringify(node_labs),
+	  nedges : sources.length,
+	  sources : JSON.stringify(sources),
+	  targets : JSON.stringify(targets),
+	  weights : JSON.stringify(weights)
+	  },
+      function( data ) {
+      	window.location.href = data;
+      });
+    //    $.post("modified_network.php", {
+    //  str : old_key,
+	  //json : jsonObject
+  //    	  },
+});
+
+
+
+
+
+$('#pos_slide').change(function (e) {
+    eles.restore();
+      pos_slide_val = $('#pos_slide').val();
+      cy.$("edge[weight < " + pos_slide_val + "]").remove();
+    });
+
+//  };
+});
+
+
+
+</script>
+
+
+
+
+</head>
+
+
+<body>
+<!-- Site navigation menu -->
+<ul class="navbar">
+ <li><a id="addEdge" href="#">Add edge between selected nodes</a></li>
+    <li><a id="deleteEdge" href="#">Remove selected edges</a></li>
+<?php
+    $filename1="/tmp/bnw/".$keyval."structure_input_temp.txt";
+if(file_exists($filename1))
+  {?>
+ <li><a id="weightFilter" href="#">Filter edges by weight:</a>
+  <form name="weightValue">
+    <output name="filterOut" id="filterOut" style="color:black"><?php print($thr);?></output><br>
+  <input type="range" name="weightOutputName" id= "pos_slide" min="<?php print($thr);?>" max="1" value ="<?php print($thr);?>" step="0.01" list="weight" style="display: inline; width: 120px" oninput="filterOut.value = pos_slide.value">
+  </form>
+  </li>
+<?php
+											}
+?>
+ <li><a id="saveNetwork" href="#">Use modified network</a></li>
+</ul>
+<ul class="navbar2">
+   <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
+ <li><a id="downloadNetwork" href="#">Save network as PNG</a></li>
+</ul>
+<ul class="navbar2">
+ <li><a href="add_remove_howto.htm" target='_blank'>About this page</a> 
+ <li><a href="help.php" target='_blank'>Help</a> 
+ <li><a href="../home.php">Home</a>
+</ul>
+
+<div id="cy"></div>
+<div id="loading">
+    <span class="fa fa-refresh fa-spin"></spin>
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/sourcecodes/layout_example.php b/sourcecodes/layout_example.php
deleted file mode 100644
index ce2cb7ef..00000000
--- a/sourcecodes/layout_example.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-include("header_new.inc");
-include("input_validate.php");
-
-$keyval=valid_keyval($_GET["My_key"]);
-
-$dir="./data/";
-
-$vf1=$dir.$keyval."var.txt";
-$vf2=$dir.$keyval."varname.txt";
-$vf3=$dir.$keyval."vardata.txt";
-unlink($vf1);
-unlink($vf2);
-unlink($vf3);
-
-
-$radiovalue="Evidence";
-$valcompare="Evidence";
-
-
-  if(isset($_POST["Datatype"])) 
- {
-
- $radiovalue=$_POST["Datatype"];
- if($radiovalue=="Evidence") $S1="checked=\"checked\"";
- if($radiovalue=="Intervention") $S2="checked=\"checked\"";
- }
- else
- {
-   $radiovalue="Evidence";
-   $S1="checked=\"checked\"";
- }
-
-
-
-?>
-<script language="JavaScript">
-<!--
-function calcHeight()
-{
-  //find the height of the internal page
-  var the_height=
-    document.getElementById('the_iframe').contentWindow.
-      document.body.scrollHeight;
-
-  //change the height of the iframe
-  document.getElementById('the_iframe').height=
-      the_height;
-}
-//-->
-</script>
-<form  method="post" name="form"> 
-<table width="100%" align="center" style="background-color:" bordercolor=white border=0.5 cellspacing="0" cellpadding="0">
- <tr valign=top>
-      <td colspan=4><hr size=3></td>
-  </tr>
-<tr >
-<th align=right> <h3>Prediction Mode:&nbsp</h3></th>
-  <td align=left>
-      <input name="Datatype" type="radio" value=<?php $radioval="Evidence"; echo $radioval; ?> checked <?php echo $S1; ?>" onClick="javascript:this.form.submit();">Evidence&nbsp;&nbsp;&nbsp;
-      <input name="Datatype" type="radio" value=<?php $radioval="Intervention"; echo $radioval; ?> <?php echo $S2; ?>" onClick="javascript:this.form.submit();"> Intervention
-      
-  </td>
-</tr>
-  <tr valign=top>
-      <td colspan=4><hr size=3></td>
-  </tr>
-
-</table>
-</form>
-
-<!-- Site navigation menu -->
-<ul class="navbar2">
-   <li><p>Selected mode:<br><?php print($radiovalue);?></p></li>
-   <li><p>Network ID:<br><?php print($keyval);?></p></li>
-</ul>
-
-<ul class="navbar">
- <li><a href="clear_example.php?My_key=<?php print($keyval);?>" target='_blank'>Clear evidence</a>
-<li><a href="cv_predictions_example.php?My_key=<?php print($keyval);?>";>Cross validation and predictions</a>
-  <li><a href="javascript:void(0);"
-NAME="Model Averaging Matrix" title="Model Averaging Matrix"
-onClick=window.open("matrix.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>Display structure matrix</a>  
-  <li><a href="javascript:void(0);"
-NAME="Parameters" title="Parameters"
-onClick=window.open("parameter_display.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>View parameters</a>  
- <li><a href="help.php" target='_blank'>Help</a> 
- <li><a href="home.php">Home</a>
-</ul>
-
-<?php
-    //echo "Selected mode:";
-    //echo $radiovalue;
-
-
-
-if($radiovalue==$valcompare)
-{
-?>
-<div  id="outernew">
-
-<object type="text/html" data="network_layout_evd_example.php?My_key=<?php print($keyval);?>" style="width:3000; height:3000">
-<p>Error: Try again</p>
-</object>
-
-</div>
-<?php
-}
-else
-{
-?>
-<div  id="outernew">
-<object type="text/html" data="network_layout_inv_example.php?My_key=<?php print($keyval);?>" style="width:3000; height:3000">
-<p>Error: Try again</p>
-</object>
-
-</div>
-<?php
-}
-?>
-
diff --git a/sourcecodes/layout_svg_no.php b/sourcecodes/layout_svg_no.php
index 673da217..f32b4054 100644
--- a/sourcecodes/layout_svg_no.php
+++ b/sourcecodes/layout_svg_no.php
@@ -1,21 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<style>
-.button {
-  font-family: Times;
-  background-color: #33339F;
-  border: none;
- color: white;
- padding: 5px 5px;
-   text-align: center;
-   font-size: 16px;
- }
-
-.button:hover {
-  background-color: blue;
- }
-</style>
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/accordion.js"></script>
+
+
 </head>
 
 <?php
@@ -24,9 +14,10 @@ include("header_new.inc");
 include("input_validate.php");
 $keyval=valid_keyval($_GET["My_key"]);
 
-$dir="./data/";
+//$dir="./data/";
+$dir="/var/lib/genenet/bnw/";
 
-$svg_file=$dir.$keyval."network_no_edge.svg";
+$svg_file=$keyval."network_no_edge.svg";
 $png_file=$keyval."network_no_edge.png";
 
 
@@ -47,100 +38,110 @@ function calcHeight()
 //-->
 </script>
 
+<!--
 <script src="http://d3js.org/d3.v4.min.js" charset="utf-8"></script>
 <script src="http://d3js.org/d3-selection-multi.v1.js"></script>
 <script src="https://cdn.rawgit.com/eligrey/canvas-toBlob.js/f1a01896135ab378aa5c0118eadd81da55e698d8/canvas-toBlob.js"></script>
 <script src="https://cdn.rawgit.com/eligrey/FileSaver.js/e9d941381475b5df8b7d7691013401e171014e89/FileSaver.min.js"></script>
+-->
+
+<script src="./scripts/d3.v4.min.js" charset="utf-8"></script>
+<script src="./scripts/d3-selection-multi.v1.js"></script>
+<script src="./scripts/canvas-toBlob.js"></script>
+<script src="./scripts/FileSaver.min.js"></script>
 
 
 <!-- Site navigation menu -->
 <ul class="navbar2">
-   <li><p>Network ID:<br><?php print($keyval);?></p></li>
+<li class="noHover">Network ID:<br><?php print($keyval);?></li>
+<li><a href="layout.php?My_key=<?php print($keyval);?>">Use network to make predictions</a></li>
+</ul>
+  <button class="accordion">Network image options&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+<?php
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+$filename1=$dir.$keyval."structure_input_temp.txt";
+if(file_exists($filename1))
+  {?>
+<li><a href="layout_svg_wt.php?My_key=<?php print($keyval);?>">Show network with edge weights</a></li>
+<?php
+   }
+?>
+<button id='saveButton' class="button1">Save network as PNG</button>
+<button id='saveButton_svg' class="button1">Save network as SVG</button>
 </ul>
+</div>
+   <button class="accordion">More about network&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+  <li><a href="matrix_new.php?My_key=<?php print($keyval);?>" target="_blank">View structure matrix</a>  
+  <li><a href="parameter_display.php?My_key=<?php print($keyval);?>" target="_blank">View network parameters</a>  
+<?php
+$filename1=$dir.$keyval."slsettings.txt";
+if(file_exists($filename1))
+  {?>
+  <li><a href="review_settings.php?My_key=<?php print($keyval);?>" target="_blank">View structure learning settings</a>  
+<?php
+}?>
+  <li><a href="input_check.php?My_key=<?php print($keyval);?>" target="_blank">View input data and descriptions</a>  
+</ul>
+</div>
 
-<ul class="navbar">
-<li><a href="layout.php?My_key=<?php print($keyval);?>">Use network to make predictions</a>
-<li><a href="layout_cyto.php?My_key=<?php print($keyval);?>" target='_blank'>Modify network structure</a>
+  <button class="accordion">Modify network structure&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+  <li><a href="layout_cyto.php?My_key=<?php print($keyval);?>" target='_blank'>Add or remove edges from network</a>
 <li><a href="modify_structure_learning.php?My_key=<?php print($keyval);?>" target='_blank';>Modify structure learning settings</a>
-  <li><a href="javascript:void(0);"
-NAME="Model Averaging Matrix" title="Model Averaging Matrix"
-onClick=window.open("matrix.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>Display structure matrix</a>  
+<li><a href="remove_variables.php?My_key=<?php print($keyval);?>" target='_blank';>Remove variables from network and relearn structure</a>
+</ul>
+</div>
+<ul class="navbar2">
+ <li><a href="about_this_page.php#network_structure" target='_blank'>About this page</a> 
  <li><a href="help.php" target='_blank'>Help</a> 
  <li><a href="../home.php">Home</a>
 </ul>
 
 <div id="svg_div">
 
-<a href="layout_svg_wt.php?My_key=<?php print($keyval);?>"><button type="submit" class="button">Show edge weights</button></a>
-&nbsp;
-&nbsp;
-&nbsp;
-<button id='saveButton' class="button">Save network as PNG</button>
-&nbsp;
-&nbsp;
-&nbsp;
-<a href="<?php print($svg_file);?>" download><button type="submit" class="button">Save network as SVG</button></a>
-<br>
-<br>
 
 
 <script>
-  //onload = "makeDraggable(evt)";
 
-d3.xml("<?php print($svg_file);?>", function(error, documentFragment){
-  if (error) {console.log(error); return;}
-  
+
+
+
+  //onload = "makeDraggable(evt)";
+<?php
+$svg_xml = json_encode(file("file://".$dir.$svg_file));
+?>
+d3.xml("", function(dumm){
+ var data1 = <?php echo $svg_xml;?>;
+ var data2 = data1.join("") 
+ parser = new DOMParser();
+ documentFragment = parser.parseFromString(data2,"text/xml");
  var svgNode = documentFragment
     .getElementsByTagName("svg")[0];
 
   d3.select("#svg_div").node().appendChild(svgNode);
-  //  nodes = d3.selectAll('.node');
-  //  links = d3.selectAll('.edge');
 
   width = svgNode.getBBox().width*5;
   height = svgNode.getBBox().height*5;
 
-  //  nodes
-  //  .call(d3.drag()
-  //	  .on("start",dragstarted)
-  //	  .on("drag",dragged)
-  //	  .on("end",dragended));
-
-  //  links
-  //  .call(d3.drag()
-  //	  .on("start",dragstarted)
-  //	  .on("drag",dragged)
-  //	  .on("end",dragended));
-
-
-  //function dragstarted(d) {
-  //  d3.select(this).raise().classed("active", true);
-  //}
-
-  //function dragged(d) {
-  //this.x = this.x || 0;
-  //this.y = this.y || 0;
-  //this.x += d3.event.dx;
-  //this.y += d3.event.dy;
-  //d3.select(this)
-  //  .attr("transform","translate(" + this.x + "," + this.y + ")");
-  //}
-
-  //function dragended(d) {
-  //d3.select(this).classed("active", false);
-  //}
-
-  //console.log(svgNode);
-  //console.log(nodes);
-  //console.log(links);
-
-  });
+});
 
 </script>
 
 
 
 <script>
+   d3.select('#saveButton_svg').on('click',function() {
+         var svgString = getSVGString(d3.select("#svg_div").select('svg').node());
+ var svgBlob = new Blob([svgString],{type:"image/svg+xml;charset=utf-8"});
+ saveAs(svgBlob,"<?php echo $svg_file; ?>");
+});
+
 
     d3.select('#saveButton').on('click', function(){
 	 var svgString = getSVGString(d3.select("#svg_div").select('svg').node());
@@ -261,4 +262,4 @@ function svgString2Image( svgString, width, height, format, callback ) {
 
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/sourcecodes/layout_svg_wt.php b/sourcecodes/layout_svg_wt.php
index f24bb338..3f4bc6f0 100644
--- a/sourcecodes/layout_svg_wt.php
+++ b/sourcecodes/layout_svg_wt.php
@@ -1,21 +1,10 @@
 <!DOCTYPE html>
 <html>
 <head>
-<style>
-.button {
-  font-family: Times;
-  background-color: #33339F;
-  border: none;
- color: white;
- padding: 5px 5px;
-   text-align: center;
-   font-size: 16px;
- }
-
-.button:hover {
-  background-color: blue;
- }
-</style>
+<link rel="stylesheet" href="./scripts/font-awesome.css">
+<script src="./scripts/jquery.min.js"></script>
+<script src="./scripts/accordion.js"></script>
+
 </head>
 
 <?php
@@ -24,9 +13,10 @@ include("header_new.inc");
 include("input_validate.php");
 $keyval=valid_keyval($_GET["My_key"]);
 
-$dir="./data/";
+//$dir="./data/";
+$dir="/var/lib/genenet/bnw/";
 
-$svg_file=$dir.$keyval."network.svg";
+$svg_file=$keyval."network.svg";
 $png_file=$keyval."network.png";
 
 
@@ -47,94 +37,76 @@ function calcHeight()
 //-->
 </script>
 
-<script src="http://d3js.org/d3.v4.min.js" charset="utf-8"></script>
-<script src="http://d3js.org/d3-selection-multi.v1.js"></script>
-<script src="https://cdn.rawgit.com/eligrey/canvas-toBlob.js/f1a01896135ab378aa5c0118eadd81da55e698d8/canvas-toBlob.js"></script>
-<script src="https://cdn.rawgit.com/eligrey/FileSaver.js/e9d941381475b5df8b7d7691013401e171014e89/FileSaver.min.js"></script>
+<script src="./scripts/d3.v4.min.js" charset="utf-8"></script>
+<script src="./scripts/d3-selection-multi.v1.js"></script>
+<script src="./scripts/canvas-toBlob.js"></script>
+<script src="./scripts/FileSaver.min.js"></script>
 
 
 <!-- Site navigation menu -->
 <ul class="navbar2">
-   <li><p>Network ID:<br><?php print($keyval);?></p></li>
+<li class="noHover">Network ID:<br><?php print($keyval);?></li>
+<li><a href="layout.php?My_key=<?php print($keyval);?>">Use network to make predictions</a></li>
 </ul>
-
-<ul class="navbar">
-<li><a href="layout.php?My_key=<?php print($keyval);?>">Use network to make predictions</a>
-<li><a href="layout_cyto.php?My_key=<?php print($keyval);?>" target='_blank'>Modify network structure</a>
+  <button class="accordion">Network image options&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+<li><a href="layout_svg_no.php?My_key=<?php print($keyval);?>">Hide edge weights</a></li>
+</li>
+<button id='saveButton' class="button1">Save network as PNG</button>
+<button id='saveButton_svg' class="button1">Save network as SVG</button>
+</ul>
+</div>
+   <button class="accordion">More about network&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+  <li><a href="matrix_new.php?My_key=<?php print($keyval);?>" target="_blank">View structure matrix</a>  
+  <li><a href="parameter_display.php?My_key=<?php print($keyval);?>" target="_blank">View network parameters</a>  
+  <li><a href="review_settings.php?My_key=<?php print($keyval);?>" target="_blank">View structure learning settings</a>  
+  <li><a href="input_check.php?My_key=<?php print($keyval);?>" target="_blank">View input data and descriptions</a>  
+</ul>
+</div>
+ <button class="accordion">Modify network structure&nbsp;&nbsp;<i class="fa fa-angle-down" style="font-size: 18px;"></i></button>
+<div class="panel">
+<ul class="navbar_ac">
+<li><a href="layout_cyto.php?My_key=<?php print($keyval);?>" target='_blank'>Add or remove edges from network</a>
 <li><a href="modify_structure_learning.php?My_key=<?php print($keyval);?>" target='_blank';>Modify structure learning settings</a>
-  <li><a href="javascript:void(0);"
-NAME="Model Averaging Matrix" title="Model Averaging Matrix"
-onClick=window.open("matrix.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>Display structure matrix</a>  
- <li><a href="help.php" target='_blank'>Help</a> 
+<li><a href="remove_variables.php?My_key=<?php print($keyval);?>" target='_blank';>Select variables to remove and relearn structure</a>
+</ul>
+</div>
+<ul class="navbar2">
+ <li><a href="about_this_page.php#network_structure" target='_blank'>About this page</a>
+ <li><a href="help.php" target='_blank'>Help</a>
  <li><a href="../home.php">Home</a>
 </ul>
 
-<div id="svg_div">
 
-<a href="layout_svg_no.php?My_key=<?php print($keyval);?>"><button type="submit" class="button">Remove edge weights</button></a>
-&nbsp;
-&nbsp;
-&nbsp;
-<button id='saveButton' class="button">Save network as PNG</button>
-&nbsp;
-&nbsp;
-&nbsp;
-<a href="<?php print($svg_file);?>" download><button type="submit" class="button">Save network as SVG</button></a>
+
+
+<div id="svg_div">
 <br>
 <br>
 
 
 <script>
-  //onload = "makeDraggable(evt)";
 
-d3.xml("<?php print($svg_file);?>", function(error, documentFragment){
-  if (error) {console.log(error); return;}
 
-  
+<?php
+$svg_xml = json_encode(file("file://".$dir.$svg_file));
+?>
+d3.xml("", function(dumm){
+ var data1 = <?php echo $svg_xml;?>;
+ var data2 = data1.join("");
+ parser = new DOMParser();
+ documentFragment = parser.parseFromString(data2,"text/xml");
  var svgNode = documentFragment
     .getElementsByTagName("svg")[0];
 
   d3.select("#svg_div").node().appendChild(svgNode);
-  //nodes = d3.selectAll('.node');
-  //links = d3.selectAll('.edge');
 
   width = svgNode.getBBox().width*5;
   height = svgNode.getBBox().height*5;
 
-  //  nodes
-  //  .call(d3.drag()
-  //	  .on("start",dragstarted)
-  //	  .on("drag",dragged)
-  //	  .on("end",dragended));
-
-  //  links
-  //  .call(d3.drag()
-  //	  .on("start",dragstarted)
-  //	  .on("drag",dragged)
-  //	  .on("end",dragended));
-
-
-  //function dragstarted(d) {
-  //  d3.select(this).raise().classed("active", true);
-  //}
-
-  //function dragged(d) {
-  //  this.x = this.x || 0;
-  //  this.y = this.y || 0;
-  //  this.x += d3.event.dx;
-  //  this.y += d3.event.dy;
-  //  d3.select(this)
-  //    .attr("transform","translate(" + this.x + "," + this.y + ")");
-  //}
-
-  //function dragended(d) {
-  //  d3.select(this).classed("active", false);
-  //}
-
-//console.log(svgNode);
-//console.log(nodes);
-//console.log(links);
-
   });
 
 </script>
@@ -142,6 +114,12 @@ d3.xml("<?php print($svg_file);?>", function(error, documentFragment){
 
 
 <script>
+    d3.select('#saveButton_svg').on('click',function() {
+        var svgString = getSVGString(d3.select("#svg_div").select('svg').node());
+   var svgBlob = new Blob([svgString],{type:"image/svg+xml;charset=utf-8"});
+   saveAs(svgBlob,"<?php echo $svg_file;?>");
+});
+
 
     d3.select('#saveButton').on('click', function(){
 	 var svgString = getSVGString(d3.select("#svg_div").select('svg').node());
@@ -262,4 +240,4 @@ function svgString2Image( svgString, width, height, format, callback ) {
 
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/sourcecodes/mat_structure.php b/sourcecodes/mat_structure.php
index dd1daccf..c1f0d82b 100644
--- a/sourcecodes/mat_structure.php
+++ b/sourcecodes/mat_structure.php
@@ -1,7 +1,9 @@
 <?php
 function structure_change($keyval)
 {
-$dir="./data/";
+  //$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 $matfile=$dir.$keyval."varname.txt";
 $namelist=file_get_contents("$matfile");
 $matfilestruct=$dir.$keyval."structure_input.txt";
@@ -75,4 +77,4 @@ for($l=0;$l<=$i;$l++)
 //return $matfilestruct;
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/sourcecodes/matrix.php b/sourcecodes/matrix.php
index c1e56cf6..aaf58028 100644
--- a/sourcecodes/matrix.php
+++ b/sourcecodes/matrix.php
@@ -1,7 +1,8 @@
 <?php 
 include("input_validate.php");
 $keyval=valid_keyval($_GET["My_key"]);
-$dir="./data/";
+//$dir="./data/";
+$dir="/tmp/bnw/";
 
 $matfile=$dir.$keyval."structure_input_temp.txt";
 $fpw=fopen($dir.$keyval."Model_Averaging_Scores.txt","w");
diff --git a/sourcecodes/matrix_new.php b/sourcecodes/matrix_new.php
new file mode 100644
index 00000000..22ea851a
--- /dev/null
+++ b/sourcecodes/matrix_new.php
@@ -0,0 +1,84 @@
+<head>
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+<?php 
+include("header_new.inc");
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]);
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+
+$score_file = $keyval."structure_input_temp.txt";
+$mat_file = $keyval."structure_input.txt";
+
+?>
+
+</head>
+
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></a></li>
+  <li><a href="about_this_page.php#matrix">About this page</a>
+  <li><a href="help.php">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+<body>
+<?php
+$table_text =json_encode(file("file://".$dir.$mat_file));
+?>
+  <div class="table_div">
+  <div class="d3_table" id="table_div1">
+  <script type="text/javascript">
+  d3.text("", function(error, raw){
+  var dsv = d3.dsvFormat("\t")
+  var data1 = <?php echo $table_text?>;
+  var data2 = data1.join("")
+  var data = dsv.parse(data2)
+  var caption_text = "Structure matrix";
+  if (error) throw error;
+      tabulate_header_row("#table_div1",data,caption_text);
+    });
+</script>
+</div>
+&nbsp;&nbsp;&nbsp;&nbsp;<a class=button2 target="_blank" href="<?php print("reroute.php?".$mat_file);?>">Download structure matrix</a>
+<br>
+<br>
+<?php
+if(file_exists($dir.$score_file))
+      {
+$table_text1a = json_encode(file("file://".$dir.$score_file))
+?>
+  <div class="d3_table" id="table_div2">
+
+  <script type="text/javascript">
+
+  d3.text("", function(error, raw_temp){
+  var dsv = d3.dsvFormat("\t")
+  var data1a = <?php echo $table_text1a?>; 
+  var data2a = data1a.join("");  
+  var data = dsv.parse(data2a)
+  var caption_text = "Model averaging scores";
+      if (error) throw error;
+      tabulate_header_row("#table_div2",data,caption_text);
+    });
+
+</script>
+ </div>
+
+&nbsp;&nbsp;&nbsp;&nbsp;<a class=button2 target="_blank" href="<?php print("reroute.php?".$score_file);?>">Download model averaging scores<br></a>
+<br>
+<?php
+      }
+?>
+<br>
+<br>
+<br>
+<br>
+<br>
+</div>
+</body>
+
+
diff --git a/sourcecodes/modified_network.php b/sourcecodes/modified_network.php
index a8eabefa..35f7a54a 100644
--- a/sourcecodes/modified_network.php
+++ b/sourcecodes/modified_network.php
@@ -27,7 +27,9 @@ if($_POST["My_key"]!="")
   $keyval=valid_keyval($keyval);
 
 
-$filename = "./data/".$old_key."modify_edge.txt";
+//$filename = "./data/".$old_key."modify_edge.txt";
+//$filename = "/tmp/bnw/".$old_key."modify_edge.txt";
+$filename = "/var/lib/genenet/bnw/".$old_key."modify_edge.txt";
 
 $file = fopen($filename,'w');
 //fwrite($file,$json);
diff --git a/sourcecodes/modify_structure_learning.php b/sourcecodes/modify_structure_learning.php
index 67a065d4..35e805d5 100644
--- a/sourcecodes/modify_structure_learning.php
+++ b/sourcecodes/modify_structure_learning.php
@@ -6,7 +6,10 @@ function get_tier($keyval)
 {
 
 $tier=trim($_GET['tier']);
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+
+$dir="/var/lib/genenet/bnw/";
 $tf=$dir.$keyval."del_var.txt";
 $fpvar = fopen("$tf","w");
 
@@ -230,4 +233,4 @@ shell_exec('./run_scripts/run_prep_input '.$keyval);
 ?>
 <script>
 window.open("bn_after_upload_gom.php?My_key=<?php print($keyval);?>",'_self',false);
-</script>
\ No newline at end of file
+</script>
diff --git a/sourcecodes/my_new_style.css b/sourcecodes/my_new_style.css
index 8e88862f..7f861fbd 100644
--- a/sourcecodes/my_new_style.css
+++ b/sourcecodes/my_new_style.css
@@ -6,41 +6,100 @@ html, body {
 height: 100%;
 }
 
+img.wide {
+    width:100%;
+    height:auto;
+}
+
 body {
   margin:0px;
-  font-family: Georgia, "Times New Roman",
-        Times, serif;
-  color: #33339F;
+  font-family: Arial;
+/*  color: #33339F; */
   background-color: white;
-  padding-bottom:0px; 
+  padding-bottom:10px; 
 
 }
 
+.td_title
+{
+        padding: 0;
+        margin: 0;
+	display: inline-block;
+        font-family:Arial;
+        font-size:20pt;
+        HORIZONTAL-ALIGN: center;
+        color:#FFFFFF; 
+        background-color: #3071a9;
+        //font-weight:bold;
+        //FONT-STYLE: italic;
+        text-align:left;
+	white-space: nowrap;
+	overflow: hidden;
 
+}
 
-.td_title
+.td_title_home
 {
         padding: 0;
         margin: 0;
         font-family:Arial;
         font-size:24pt;
-        HRIZONTAL-ALIGN: center;
-        color:#FFFFFF;
+        HORIZONTAL-ALIGN: center;
+        color:#FFFFFF; 
+        background-color: #3071a9;
         font-weight:bold;
         //FONT-STYLE: italic;
-        background-color: #33339F;
-        text-align:center
+        text-align:center;
+	white-space: nowrap;
+	overflow: hidden;
 
 }
 
+#outer {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 2em;
+  left: 8.5em;
+  text-align:left;
+  background:white;
+  min-width:50%;
+  min-height:50%;
+  max-width:80%;
+}
+
+#execute_div {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 2em;
+  left: 3em;
+  text-align:left;
+  background:white;
+  min-width:50%;
+  min-height:50%;
+  max-width:80%;
+}
 
+#outer_home {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 4em;
+  left: 8.5em;
+  text-align:left;
+  background:white;
+  min-width:50%;
+  min-height:50%;
+  max-width:85%;
+}
 
-#outer {
+#svg_div {
   padding: 0;
   margin: 0;
   position: absolute;
-  top: 9em;
-  left: 12em;
+  top: 2.5em;
+  left: 8.2em;
   text-align:left;
   background:white;
   min-width:50%;
@@ -49,56 +108,113 @@ body {
 
 }
 
+
+
+#violin_div {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 2em;
+  left: 8.1em;
+  text-align:left;
+  background:white;
+  min-width:70%;
+  min-height:50%;
+  max-width:80%;
+
+}
+
 #outernew {
   padding: 0;
   margin: 0;
   position: absolute;
-  top: 9em;
-  left: 12em;
+  top: 2.5em;
+  left: 9em;
   text-align:left;
   background:white;
   min-width:50%;
   min-height:50%;
-  max-width:60%;
+  max-width:75%;
 
 }
 
-#outernewnew {
+#outernew_load {
   padding: 0;
   margin: 0;
   position: absolute;
-  top: 12em;
-  left: 25em;
+  top: 2em;
+  left: 9em;
+  text-align:left;
+  background:white;
+  width:70%;
+}
+
+#outernew_sci {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 2em;
+  left: 9em;
   text-align:left;
   background:white;
   min-width:50%;
   min-height:50%;
-  max-width:60%;
+  max-width:80%;
 
 }
 
 
+ol.help {
+    margin: 0px 0;
+    padding: 0;
+    list-style: decimal;
+    list-style-position: inside;
+}    
+
+ol.help li
+{
+    margin: 0px;
+    padding: 0px;
+    text-indent: -2.2em;
+    margin-left: 3.4em;
+}
 
 ul.navbar {
   list-style-type: none;
+  display: block;
   padding: 0;
-  margin: 0;
+  margin-top: 0;
+  /*position: relative;*/
+  float: top;
+  /*margin-top: 20px;*/
+  top: 9em;
+  left: 1em;
+  width: 8em; }
+
+ul.navbar_ac {
+  list-style-type: none;
+  display: inline-block;
+  padding: 0;
+  margin-top: 0;
   /*position: relative;*/
   float: top;
   /*margin-top: 20px;*/
   top: 9em;
   left: 1em;
-  width: 9em }
+  width: 7.7em;
+ }
 
 ul.navbar2 {
   list-style-type: none;
+  display: block;
   padding: 0;
   margin: 0;
   /*position: absolute;*/
   float:top;
   top: 9em;
   left: 1em;
-  width: 9em }
+  width: 8em;
+  }
 
 ul.listbar {
   list-style-type: none;
@@ -110,30 +226,97 @@ ul.listbar {
 
 
 h1 {
-  font-family: Helvetica, Geneva, Arial,
-        SunSans-Regular, sans-serif }
+  font-family: Helvetica, Geneva, Arial, 
+       SunSans-Regular, sans-serif }
 ul.navbar li {
-/*  background: #D0A9F5; */
-  background: #33339F;
-  margin: 0.5em 0;
-  padding: 0.3em;
-  border-right: 1em solid black }
+/*  background: #D0A9F5; 
+  background: #33339F;*/
+  background: LightGrey;
+  margin-top: 0.2em;
+  margin-left: 0.1em;
+  padding: 0.2em;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+ul.navbar li:focus,
+ul.navbar li:hover {
+    background: #E5E8E8;
+    outline: 1px solid black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
 ul.navbar a {
+  display: block;
   text-decoration: none 
 }
 ul.navbar a:link {
- color: white; }
+ color: black; }
 ul.navbar a:visited {
- color: white; }
+ color: black; }
+ul.navbar p {
+  text-decoration: none;
+  color: black;
+}
+
+ul.navbar_ac li {
+/*  background: #D0A9F5; 
+  display: inline-block; 
+  background: #33339F; */
+  background: LightGrey;
+  color: black; 
+  margin-top: 0.2em;
+  padding: 0.1em;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+ul.navbar_ac li:focus,
+ul.navbar_ac li:hover {
+    background: #E5E8E8;
+    outline: 1px solid black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+ul.navbar_ac a {
+  display: block;
+  text-decoration: none 
+}
+ul.navbar_ac a:link {
+ color: black; }
+ul.navbar_ac a:visited {
+ color: black; }
+ul.navbar_ac p {
+  text-decoration: none;
+  color: black;
+}
+
+
 
 ul.navbar2 li {
-/*  background: #D0A9F5; */
-  background: black;
-  margin: 0.5em 0;
-  padding: 0.3em;
-  border-right: 1em solid #33339F;
-  color: white }
+/*  background: #D0A9F5; 
+  display: inline-block; */
+  background: #3071a9;
+  margin-top: 0.2em;
+  margin-left: 0.1em;
+  padding: 0.2em;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+  color:white;
+ }
+ul.navbar2 li:focus,
+ul.navbar2 li:hover {
+    background: #488AC7;
+    outline: 1px solid black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
 ul.navbar2 a {
+  display: block;
   text-decoration: none 
 }
 ul.navbar2 a:link {
@@ -141,6 +324,8 @@ ul.navbar2 a:link {
 ul.navbar2 a:visited {
  color: white; }
 
+
+
 a:link {
   color: black; }
 a:hover {
@@ -153,3 +338,258 @@ address {
   padding-top: 1em;
   border-top: thin dotted }
 
+
+
+.accordion {
+  font-family: Arial;
+  font-size: 12pt;
+  color: white;
+  display: block;
+  background: #3071a9;
+  margin-top: 0.2em;
+  margin-left: 0.1em;
+  border: none;
+  padding: 0.2em;
+  float:top;
+  top: 9em;
+  width: 8em;
+  text-align: left;
+  cursor: pointer;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+.accordion:hover {
+    background: #488AC7;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+
+div.panel {
+    padding: 0.2em;
+//  margin-top: 3.3em 0;
+  display: none;
+  overflow: hidden;
+ }
+
+
+div.panel.show {
+    display: inline-block ;
+    margin: 0em 0;
+}
+
+
+.button1 {
+  font-family: Arial;
+  font-size: 12pt;
+  display: inline-block;
+  color: black;
+  text-align: left;
+  width: 7.7em;
+  background: LightGrey;
+  margin-top: 0.2em;
+  padding: 0.2em;
+  border: none;
+  cursor: pointer;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+.button1:focus,
+.button1:hover {
+    background: #E5E8E8;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+
+
+.button2 {
+  font-family: Arial;
+  font-size: 12pt;
+  display: inline-block;
+  text-align: center;
+  background: LightGrey;
+  color:black;
+  margin-top: 0.2em;
+  padding: 0.2em 0.5em;
+  border: none;
+  cursor: pointer;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+  text-decoration: none;
+}
+.button2:focus,
+.button2:hover {
+    background: #E5E8E8;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+.button3 {
+  font-size: 14pt;
+  display: inline-block;
+  text-align: center;
+  background: LightGrey;
+  color:black;
+  margin-top: 0.4em;
+  padding: 0.2em 0.5em;
+  border: none;
+  cursor: pointer;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+  width:30em;
+}
+.button3:focus,
+.button3:hover {
+    background: #E5E8E8;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+a.button3 a {
+  text-decoration: none; 
+  font-size: 14pt;
+}
+a.button3:link {
+ text-decoration: none; 
+ color: black; 
+  font-size: 14pt;
+}
+a.button3:visited {
+ text-decoration: none; 
+ color: black; }
+
+
+.no-bullet{
+    list-style-type: none
+}
+
+
+
+.new-button {
+    display: inline-block;
+    padding: 8px 12px;
+    cursor: pointer;
+    border-radius: 4px;
+    background-color: LightGrey;
+    font-size: 16px;
+    color: black;
+}
+
+.inputfile {
+    width: 0.1px;
+    height: 0.1px;
+    opacity: 0;
+    overflow: hidden;
+    position: absolute;
+    z-index: -1;
+}
+
+.button-wrap {
+    position: relative;
+}
+
+.inputfile + label {
+    font: 12pt;
+    padding: 8px 12px;
+    color: black;
+    background-color: LightGrey;
+    display: inline-block;
+  border-top-left-radius: 3px;
+  border-top-right-radius: 3px;
+  border-bottom-left-radius: 3px;
+  border-bottom-right-radius: 3px;
+}
+
+.inputfile:focus + label,
+.inputfile + label:hover {
+    background: #E5E8E8;
+    outline: 1px black;
+    outline: -webkit-focus-ring-color auto 5px;
+    cursor: pointer;
+}
+
+
+
+input[type=range] {
+  -webkit-appearance: none;
+  width: 100%;
+}
+input[type=range]:focus {
+outline: none;
+}
+
+
+
+.table_div {
+  padding: 0;
+  margin: 0;
+  position: absolute;
+  top: 3em;
+  left: 8.5em;
+  text-align:left;
+  background:white;
+  min-width:50%;
+  min-height:70%;
+  max-width:80%;
+}
+
+.d3_table table {
+width: 100%;
+  border-collapse: collapse;
+  margin: 6;
+}
+.d3_table caption {
+  font-size: 14pt;
+  text-align: left;
+}
+/* Zebra striping */
+.d3_table tr:nth-of-type(even) {
+background: LightGrey;
+}
+.d3_table th {
+background: #3071a9;
+color: white;
+font-size: 12pt;
+font-weight: normal;
+}
+
+.d3_table td, th {
+padding: 6px;
+border: 1px solid #ccc;
+    text-align: center;
+}
+.horizontal-header {
+background: #3071a9;
+color: white;
+  font-size: 12pt;
+}
+th.corner-header {
+background: LightGrey;
+color: black;
+  font-size: 12pt;
+}
+
+
+
+.noHover {
+   pointer-events: none;
+}
+
+.basic_header {
+  font-size: 16pt;
+}
+
+
diff --git a/sourcecodes/net_structure.php b/sourcecodes/net_structure.php
index ac61e143..12126e45 100644
--- a/sourcecodes/net_structure.php
+++ b/sourcecodes/net_structure.php
@@ -1,42 +1,62 @@
 <?php
+  //Going to modify this so it just writes the uploaded data to a file.
+  //Standardization and determining other factors will be performed in
+  //  a Matlab/Octave script.
+
 include("header_new.inc");
 include("header_batchsearch.inc");
 include("input_validate.php");
-////////////////continuous///////////////
+
 $searchID="";
 $UploadValue="NO";
-$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
-
-if($_POST["My_key"]!="")
-  $keyval=$_POST["My_key"];
+$TextFile=$_FILES["MyFile"]["name"];
 
 if($_GET["My_key"]!="")
   $keyval=$_GET["My_key"];
 
+if($_POST["My_key"]!="")
+  $keyval=$_POST["My_key"];
+
 $keyval=valid_keyval($keyval);
 
 $sid="structure_input";
-$dir="./data/$keyval";
+//$dir="./data/";
+//$dir="/tmp/bnw/".$keyval;
+$dir="/var/lib/genenet/bnw/";
 
-$TextinFileFinal=$dir.$sid.".txt";
+$TextinFile=$dir.$keyval.$sid.".txt";
 
-$TextinFile=$dir.$sid."_temp.txt";
+//$TextinFileFinal=$dir.$sid.".txt";
 
-$TextinFilenamelist=$dir."name.txt";
+//$TextinFile=$dir.$sid."_temp.txt";
 
-if(isset($HTTP_POST_VARS["searchkey"]))
+if(isset($_POST["searchkey"]))
 {
-   $searchID=$HTTP_POST_VARS["searchkey"];
+   $searchID=$_POST["searchkey"];
+
+}
+
+if($searchID=="")
+{
+?>
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+<?php
 }
 
-if(isset($HTTP_POST_VARS["MyUpload"]))
+if(isset($_POST["MyUpload"]))
 {
-   $UploadValue=$HTTP_POST_VARS["MyUpload"];
+   $UploadValue=$_POST["MyUpload"];
    if ($UploadValue=="YES")
    {
         if($TextFile!="")
         {
-            $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
+            $sta=move_uploaded_file($_FILES['MyFile']['tmp_name'],$TextinFile);
             if(!$sta)
             {
                  echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>";
@@ -45,14 +65,10 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
             }
             else
             {
-                 $searchID=file_get_contents("$TextinFile");
-		 //fclose($fh);
-		  unlink($TextinFile);
-
+                $searchID=file_get_contents("$TextinFile");
+		//unlink($TextinFile);
             }
-
         }
-
        else
        {
            echo "<script type='text/javascript'> window.alert ('Sorry, please select upload file.')</script>";
@@ -60,79 +76,76 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
    }
 }
 
-if($searchID!="")
-{
 ?>
-
-<!-- Site navigation menu -->
-<ul class="navbar2">
-  <li><a href="graphviz_structure.php?My_key=<?php print($keyval);?>">Display structure</a>
-</ul>
-<ul class="navbar">
-  <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a>
-  <li><a href="help.php" target="_blank">Help</a>
-  <li><a href="home.php">Home</a>
-</ul>
-<?php
-}
-else
-{
-
-?>
-<!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a>
-  <li><a href="help.php" target='_blank'>Help</a>
-  <li><a href="home.php">Home</a>
-</ul>
-<?php
-}
-?>
-
 <div id="outernew">
-
-<h2>Upload network structure</h2>
-<FORM name="key_search" enctype="multipart/form-data" ACTION="net_structure.php" METHOD=POST>
-
-<table align="left" cellspacing="3" cellpadding="1" border="0"  width="90%">
-<tr>
-   <td>
-       <INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 > 
-       <INPUT TYPE="submit" value="  Upload  " onclick="return Upload();">
-      <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-        <INPUT TYPE="hidden" name="MyUpload" value="NO"> 
-   </td>
-</tr>
-<tr>
-   <td><font color=#3735CA><br>Content of uploaded structure file:</font><br>
-          <textarea name="searchkey" rows="10" cols="100"><?PHP print($searchID)?> </textarea>
-  </td>
-</tr>
-<tr>
-    <td>
-       <INPUT TYPE="submit" value="  Load example structure  " onclick="return demo_str();">&nbsp&nbsp&nbsp
+<h2><font>Upload structure file</font></h2>
+<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="net_structure.php" METHOD=POST>
+<INPUT style="background-color:#FFFFFF;" type="file" name="MyFile" id="MyFile_id" class="inputfile" onchange="upload_submit()" >
+<label for="MyFile_id">Choose a file. . .</label>
+  <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+<INPUT TYPE="hidden" name="MyUpload" value="NO">
+  <textarea name="searchkey" style="display:none;"><?PHP print($searchID)?> </textarea>
+<br><br>
+  <INPUT TYPE="submit" class=button2 value="  Load example structure  " onclick="return demo_str();">&nbsp&nbsp&nbsp
       <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-    </td>
-</tr>
-
-</table>
 </FORM>
-
 </div>
+<script>
+  function upload_submit() {
+    Upload();
+    document.getElementById("in_form").submit();
+  }
+</script>
+
 <?php
+
+if($searchID!="")
+    {
+    if ($UploadValue=="NO")
+      {
   $str_arr=array();
   $searchID=trim($searchID);
   $str_arr=explode("\n",$searchID);
   $data=array();
-    
-  $fpmain = fopen($TextinFileFinal,"w");
-  
+
+  $fpmain = fopen($TextinFile,"w");
+
   foreach($str_arr as $line)
   {
-       $line=trim($line);
-	fwrite($fpmain, "$line\n");
-      
-  }
+    $line=trim($line);
+    fwrite($fpmain, "$line\n");
 
+  }
+      }
+?>
+<ul class="navbar2">
+  <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+<div id="outernew_load">
+<br>
+<a class=button3 href="graphviz_structure.php?My_key=<?php print($keyval);?>">Display uploaded network</a>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
 
+<?php
+}
 ?>
+
+</body>
+</html>
+
+
diff --git a/sourcecodes/net_structure.php.bk b/sourcecodes/net_structure.php.bk
new file mode 100644
index 00000000..395c6112
--- /dev/null
+++ b/sourcecodes/net_structure.php.bk
@@ -0,0 +1,132 @@
+<?php
+include("header_new.inc");
+include("header_batchsearch.inc");
+include("input_validate.php");
+////////////////continuous///////////////
+$searchID="";
+$UploadValue="NO";
+$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
+
+if($_POST["My_key"]!="")
+  $keyval=$_POST["My_key"];
+
+if($_GET["My_key"]!="")
+  $keyval=$_GET["My_key"];
+
+$keyval=valid_keyval($keyval);
+
+$sid="structure_input";
+//$dir="./data/$keyval";
+$dir="/tmp/bnw/$keyval";
+
+$TextinFileFinal=$dir.$sid.".txt";
+
+$TextinFile=$dir.$sid."_temp.txt";
+
+$TextinFilenamelist=$dir."name.txt";
+
+if(isset($HTTP_POST_VARS["searchkey"]))
+{
+   $searchID=$HTTP_POST_VARS["searchkey"];
+}
+
+if(isset($HTTP_POST_VARS["MyUpload"]))
+{
+   $UploadValue=$HTTP_POST_VARS["MyUpload"];
+   if ($UploadValue=="YES")
+   {
+        if($TextFile!="")
+        {
+            $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
+            if(!$sta)
+            {
+                 echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>";
+                 flush();
+                 exit();
+            }
+            else
+            {
+                 $searchID=file_get_contents("$TextinFile");
+		 //fclose($fh);
+		  unlink($TextinFile);
+
+            }
+
+        }
+
+       else
+       {
+           echo "<script type='text/javascript'> window.alert ('Sorry, please select upload file.')</script>";
+       }
+   }
+}
+
+if($searchID!="")
+{
+?>
+
+<!-- Site navigation menu -->
+<ul class="navbar">
+  <li><a href="graphviz_structure.php?My_key=<?php print($keyval);?>">Display structure</a>
+</ul>
+<ul class="navbar">
+  <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a>
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+<div id="outernew_load">
+</div>
+<?php
+}
+else
+{
+
+?>
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a>
+  <li><a href="help.php" target='_blank'>Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+<?php
+}
+?>
+
+<div id="outernew">
+
+<h2>Upload network structure</h2>
+<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="net_structure.php" METHOD=POST>
+<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" id="MyFile_id" class="inputfile" onchange="upload_submit()" > 
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+<INPUT TYPE="hidden" name="MyUpload" value="NO"> 
+<textarea name="searchkey" style="display:none"><?PHP print($searchID)?> </textarea>
+<br><br>
+<INPUT TYPE="submit" value="  Load example structure  " onclick="return demo_str();">&nbsp&nbsp&nbsp
+<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+</FORM>
+
+</div>
+<script>
+  function upload_submit() {
+  Upload();
+  document.getElementById("in_form").submit();
+}
+</script>
+
+
+<?php
+  $str_arr=array();
+  $searchID=trim($searchID);
+  $str_arr=explode("\n",$searchID);
+  $data=array();
+    
+  $fpmain = fopen($TextinFileFinal,"w");
+  
+  foreach($str_arr as $line)
+  {
+       $line=trim($line);
+	fwrite($fpmain, "$line\n");
+      
+  }
+
+?>
diff --git a/sourcecodes/net_structure.php~ b/sourcecodes/net_structure.php~
new file mode 100644
index 00000000..d4462962
--- /dev/null
+++ b/sourcecodes/net_structure.php~
@@ -0,0 +1,136 @@
+<?php
+  //Going to modify this so it just writes the uploaded data to a file.
+  //Standardization and determining other factors will be performed in
+  //  a Matlab/Octave script.
+
+include("header_new.inc");
+include("header_batchsearch.inc");
+include("input_validate.php");
+
+$searchID="";
+$UploadValue="NO";
+$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
+
+if($_POST["My_key"]!="")
+  $keyval=$_POST["My_key"];
+
+if($_GET["My_key"]!="")
+  $keyval=$_GET["My_key"];
+
+$keyval=valid_keyval($keyval);
+
+$sid="structure_input";
+//$dir="./data/";
+$dir="/tmp/bnw/".$keyval;
+
+$TextinFile=$dir.$sid.".txt";
+
+//$TextinFileFinal=$dir.$sid.".txt";
+
+//$TextinFile=$dir.$sid."_temp.txt";
+
+if(isset($HTTP_POST_VARS["searchkey"]))
+{
+   $searchID=$HTTP_POST_VARS["searchkey"];
+
+}
+
+if($searchID=="")
+{
+?>
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+<?php
+}
+
+if(isset($HTTP_POST_VARS["MyUpload"]))
+{
+   $UploadValue=$HTTP_POST_VARS["MyUpload"];
+   if ($UploadValue=="YES")
+   {
+        if($TextFile!="")
+        {
+            $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
+            if(!$sta)
+            {
+                 echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>";
+                 flush();
+                 exit();
+            }
+            else
+            {
+                $searchID=file_get_contents("$TextinFile");
+		//unlink($TextinFile);
+            }
+        }
+       else
+       {
+           echo "<script type='text/javascript'> window.alert ('Sorry, please select upload file.')</script>";
+       }
+   }
+}
+
+?>
+<div id="outernew">
+<h2><font>Upload structure file</font></h2>
+<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="net_structure.php" METHOD=POST>
+<INPUT style="background-color:#FFFFFF;" type="file" name="MyFile" id="MyFile_id" class="inputfile" onchange="upload_submit()" >
+<label for="MyFile_id">Choose a file. . .</label>
+  <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+<INPUT TYPE="hidden" name="MyUpload" value="NO">
+  <textarea name="searchkey" style="display:none;"><?PHP print($searchID)?> </textarea>
+<br><br>
+  <INPUT TYPE="submit" class=button2 value="  Load example structure  " onclick="return demo_str();">&nbsp&nbsp&nbsp
+      <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+</FORM>
+</div>
+<script>
+  function upload_submit() {
+    Upload();
+    document.getElementById("in_form").submit();
+  }
+</script>
+
+<?php
+
+if($searchID!="")
+    {
+    if ($UploadValue=="NO")
+      {
+  $str_arr=array();
+  $searchID=trim($searchID);
+  $str_arr=explode("\n",$searchID);
+  $data=array();
+
+  $fpmain = fopen($TextinFile,"w");
+
+  foreach($str_arr as $line)
+  {
+    $line=trim($line);
+    fwrite($fpmain, "$line\n");
+
+  }
+      }
+?>
+<ul class="navbar2">
+  <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
+  <li><a href="help.php" target="_blank">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+<div id="outernew_load">
+<br>
+<a class=button3 href="graphviz_structure.php?My_key=<?php print($keyval);?>">Display uploaded network</a>
+<br>
+<?php
+}
+?>
+
+</body>
+</html>
+
+
diff --git a/sourcecodes/network_layout_evd.php b/sourcecodes/network_layout_evd.php
index 661caebc..7d97483a 100644
--- a/sourcecodes/network_layout_evd.php
+++ b/sourcecodes/network_layout_evd.php
@@ -25,11 +25,11 @@ foreach($leve_l as $l)
            
 }
 
-
 /////////////Read data from net_figure file/////////////
 
-$dir="./data/";
-
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $keyval=valid_keyval($_GET["My_key"]);
 
@@ -50,7 +50,7 @@ $str_arrmat=explode("\n",$matrix1);
 if($str_arrmat[2]=="" || $matrix1=="")
 {
 ?>
-  <h1><font color=blue>Error: Unable to display your network structure.</font></h1>
+  <h1><br><br><br><font color=blue>Error: Unable to display your network structure.</font></h1>
 <?php
 exit;
 }
@@ -113,7 +113,8 @@ $r_index+=4;
 $grv=$dir.$keyval."graphviz.txt";
 $line=shell_exec('/usr/bin/dot -Tplain -y '.$grv);
 $grviz_name_list=array();
-$g_file_name="./data/".$keyval."grviz_name_file.txt";
+//$g_file_name="./data/".$keyval."grviz_name_file.txt";
+$g_file_name=$dir.$keyval."grviz_name_file.txt";
 $grviz_name=file_get_contents("$g_file_name");
 $grviz_name_list=explode("\n",$grviz_name);
 
@@ -239,7 +240,7 @@ $nedges=$ii;
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-<script type="text/javascript" src="http://www.google.com/jsapi"></script>
+<script type="text/javascript" src="https://www.google.com/jsapi"></script>
 <script type="text/javascript">
 google.load('visualization', '1', {packages: ['corechart']});
 </script>
@@ -247,12 +248,19 @@ google.load('visualization', '1', {packages: ['corechart']});
 
 <?php 
 $data_val="";
+$x_max = $ID_data[0][1];
+$y_max = $ID_data[0][2];
 
 for($i=0;$i<$nnode;$i++)
  {
 ////////////////////////////select node //////////////////////////////////////
+   if($ID_data[$i][1] > $x_max) $x_max = $ID_data[$i][1];
+   if($ID_data[$i][2] > $y_max) $y_max = $ID_data[$i][2];
+			   
  $name=$ID_data[$i][0];
- $fname="draw_".$name."()";
+ $replaced_char = array("-","/",",",".","!","?");
+ $name_replaced = str_replace($replaced_char,"_",$name);
+ $fname="draw_".$name_replaced."()";
  $data_val.=$name;
  for($j=0;$j<$node;$j++)
  {
@@ -354,7 +362,7 @@ for($i=0;$i<$nnode;$i++)
   function <?php print($fname);?> {
   // Create and populate the data table.
   var data = google.visualization.arrayToDataTable([
-						    [{label:'<?php print($name);?>',type:'number'}, {label:''}],
+						    [{label:"<?php print($name);?>",type:'number'}, {label:''}],
   <?php
   $c_i=2;
   for($j=0;$j<100;$j++) 
@@ -465,6 +473,8 @@ function canvas_arrow_head(context, fromx, fromy, tox, toy){
 </head>
 
 <body>
+
+
 <canvas id="test" width="3000" height="3000" style="position:absolute">
 <script>
 function canvas_arrow_draw(n, polypts,context){
@@ -564,15 +574,18 @@ for($i=0;$i<$nnode;$i++)
   $x=$ID_data[$i][1]-8; $y=$ID_data[$i][2]-20; 
 
   $name=$ID_data[$i][0];
+  $replaced_char = array("-","/",",",".","?","!");
+  $name_replaced = str_replace($replaced_char,"_",$name);
 ?>
 
 <script type="text/javascript">
-   google.setOnLoadCallback(draw_<?php print($name)?>);
+   google.setOnLoadCallback(draw_<?php print($name_replaced)?>);
 </script>
 <div id="<?php print($name)?>" style="left: <?php print($x)?>px; top: <?php print($y)?>px; width:<?php print($width);?>; height:<?php print($height);?>; position: absolute"></div>
 
 <?php 
 }
+
 ?>
 
 
diff --git a/sourcecodes/network_layout_evd_2.php b/sourcecodes/network_layout_evd_2.php
index 931cc0b8..ed9ce502 100644
--- a/sourcecodes/network_layout_evd_2.php
+++ b/sourcecodes/network_layout_evd_2.php
@@ -26,7 +26,9 @@ foreach($leve_l as $l)
 
 $keyval=valid_keyval($_GET["My_key"]);
 //////////////////////////Entered evidences//////////////////////////////////////////
-$dir="./data/";
+//$dir="./data/";
+//$dir ="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $lfile=$dir.$keyval."nlevels.txt";
 $levelmap=file_get_contents($lfile);   
@@ -248,7 +250,8 @@ $line=shell_exec('/usr/bin/dot -Tplain -y '.$grv);
 
 
 $grviz_name_list=array();
-$g_file_name="./data/".$keyval."grviz_name_file.txt";
+//$g_file_name="./data/".$keyval."grviz_name_file.txt";
+$g_file_name=$dir.$keyval."grviz_name_file.txt";
 $grviz_name=file_get_contents("$g_file_name");
 $grviz_name_list=explode("\n",$grviz_name);
 
@@ -375,7 +378,7 @@ $nedges=$ii;
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-<script type="text/javascript" src="http://www.google.com/jsapi"></script>
+<script type="text/javascript" src="https://www.google.com/jsapi"></script>
  <script type="text/javascript">
   google.load('visualization', '1', {packages: ['corechart']});
  </script>
@@ -388,7 +391,9 @@ for($i=0;$i<$nnode;$i++)
  {
 ////////////////////////////select node //////////////////////////////////////
  $name=$ID_data[$i][0];
- $fname="draw_".$name."()";
+ $replaced_char = array("-","/",",",".","!","?");
+ $name_replaced = str_replace($replaced_char,"_",$name);
+ $fname="draw_".$name_replaced."()";
  $data_val.=$name;
  $flag=0; //evidence flag
  for($j=0;$j<$node;$j++)
@@ -877,10 +882,12 @@ for($i=0;$i<$nnode;$i++)
 {
   $x=$ID_data[$i][1]-8; $y=$ID_data[$i][2]-20; 
   $name=$ID_data[$i][0];
+  $replaced_char = array("-","/",",",".","!","?");
+  $name_replaced = str_replace($replaced_char,"_",$name);
 ?>
 
 <script type="text/javascript">
-   google.setOnLoadCallback(draw_<?php print($name)?>);
+   google.setOnLoadCallback(draw_<?php print($name_replaced)?>);
 </script>
 <div id="<?php print($name)?>" style="left: <?php print($x)?>px; top: <?php print($y)?>px; width:<?php print($width);?>; height:<?php print($height);?>; position: absolute"></div>
 
diff --git a/sourcecodes/network_layout_evd_2_example.php b/sourcecodes/network_layout_evd_2_example.php
deleted file mode 100644
index 876d674f..00000000
--- a/sourcecodes/network_layout_evd_2_example.php
+++ /dev/null
@@ -1,956 +0,0 @@
-<?php 
-  //include("structuremap.php");
-include("input_validate.php");
-include("header_batchsearch.inc");
-
-function levelmap($inx,$name,$mapdata)
-{
-
-$leve_l=array();
-$leve_l=explode("\n",$mapdata);
-$leve_d=array();
-
-foreach($leve_l as $l)
-{ 
-  $l=trim($l);
-  $leve_d=explode("\t",$l);
-  $inxname=trim($leve_d[0]);
-  $name=trim($name);
-  if($inxname==$name)
-    return $leve_d[$inx];
-}
-           
-}
-
-
-
-$keyval=valid_keyval($_GET["My_key"]);
-//////////////////////////Entered evidences//////////////////////////////////////////
-$dir="./data/";
-
-$lfile=$dir.$keyval."nlevels.txt";
-$levelmap=file_get_contents($lfile);   
-
-
-
-$lf=$dir."$keyval"."varname.txt";
-
-$lines = file("$lf");
-
-$ev_arr=array();
-$evdata_arr=array();
-
-$data_cell_ev=array();
-$cev=0;
-
-// Loop through our array, show HTML source as HTML source; and line numbers too.
-foreach ($lines as $line_num => $line) 
-{
-	$data_cell_ev=explode("\t",$line);
-	foreach ($data_cell_ev as $ld)
-	{
-  		$ldd=trim($ld);
-  		if($ldd !="")
-  		{
-        		$ev_arr[$cev]=$ldd;  
-                     $cev++;
-  			//echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($ldd) . "<br />\n";
-  		}
-	}
-
-}
-
-$lf=$dir."$keyval"."vardata.txt";
-$linesd = file("$lf");
-
-$cevdata=0;
-// Loop through our array, show HTML source as HTML source; and line numbers too.
-foreach ($linesd as $line_num => $line) 
-{
-  
-	$data_cell_ev=explode("\t",$line);
-	foreach ($data_cell_ev as $ld)
-	{
-  		$ldd=trim($ld);
-  		if($ldd !="")
-  		{
-        		$evdata_arr[$cevdata]=$ldd;  
-                     $cevdata++;
-                     //echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($ldd) . "<br />\n";
-
-  			
-  		}
-	}
-  
-}
-
-
-
-////////////////////////////////////Read data from net_figure file///////////////////////Graphp Display/////////////////////////////////////////////
-
-
-$matfile=$dir.$keyval."net_figure_new.txt";
-
-$data_val="";
-
-$matrix=file("$matfile");
-$matrix1=file_get_contents("$matfile");              //file("$matfile");
-
-
-$str_arrmat=array();
-$str_arrmat=explode("\n",$matrix1);
-
-$node=trim($str_arrmat[1]);
-
-if($str_arrmat[2]=="" || $matrix1=="")
-{
-?>
-<h1><font color=blue>Error: Unable to display your network structure.</font></h1>
-<?php
-exit;
-}
-/*
-if($node<=5)
-{
-  $width=200;
-  $height=150;
-  $font=11;
-}
-else if($node>5 && $node<=7)
-{
-  $width=150;
-  $height=120;
-  $font=10;
-
-}
-else if($node>7 && $node<=10)
-{
-  $width=110;
-  $height=85;
-  $font=8;
-}
-else 
-{
-  $width=80;
-  $height=60;
-  $font=7;
-}
-*/
-  $width=150;
-  $height=150;
-  $font=12;
-
-
-$datamat=array();
-$data_read=array();
-
-$r_index=$node+3;
-
-for($i=0;$i<$node;$i++)
-{
-  	$datamat=explode("\t",$str_arrmat[$r_index]);
-   	$data_read[$i][0]=trim($datamat[0]);  //name
- 	$data_read[$i][1]=trim($datamat[1]);  //datatype
-       $nodetype=$data_read[$i][1];
-	$col_in=2;
-	$r_index+=4;
-	$evd=-9999;
-	$name=$data_read[$i][0];
-	for($ii=0;$ii<$cev;$ii++)
-	{
-     		if($ev_arr[$ii]==$name)
-     		{
-        		$evd=$evdata_arr[$ii]; 
-                     if($nodetype>1)
-                       $evd=levelmap($evd,$data_read[$i][0],$levelmap);
- 
-        		break;
-     		}
-	}
-
-	if($evd!=-9999)//with evidence
-	{
-           $datamat=explode("\t",$str_arrmat[$r_index]);
-           $data_read[$i][$col_in]=trim($datamat[0]);  //x data
-           $col_in++;
-           $data_read[$i][$col_in]=trim($datamat[1]);  //y data
-           $col_in++;
-           $r_index++; // increment to point next data
-
-      	
-	}
-	else //without evidence
-	{
-		if($nodetype==1)  //type=coninuous
-		{
-         		for($j=1;$j<=101;$j++)
-         		{
-           			$datamat=explode("\t",$str_arrmat[$r_index]);
-           			$data_read[$i][$col_in]=trim($datamat[0]);  //x data
-			       $col_in++;
-           			$data_read[$i][$col_in]=trim($datamat[1]);  //y data
-           			$col_in++;
-           			$r_index++; // increment to point next data
-        
-        		 } 
-		}
-		if($nodetype>1)  //type=descrete
-		{
-         		$iter=$datamat[1];
-         		for($j=1;$j<=$iter;$j++)
-         		{
-           			$datamat=explode("\t",$str_arrmat[$r_index]);
-           			$data_read[$i][$col_in]=trim($datamat[0]);  //x data
-                     	$data_read[$i][$col_in]=levelmap($data_read[$i][$col_in],$data_read[$i][0],$levelmap);
-           			$col_in++;
-           			$data_read[$i][$col_in]=trim($datamat[1]);  //y data
-           			$col_in++;
-           			$r_index++; // increment to point next data
-           //echo "<br />"; 
-         		} 
-		}
-
-	}
-
-}
-
-
-$matfile_old=$dir.$keyval."net_figure.txt";
-
-$data_val="";
-
-$matrix_old=file("$matfile_old");
-$matrix1_old=file_get_contents("$matfile_old");              //file("$matfile");
-$str_arrmat_old=array();
-$str_arrmat_old=explode("\n",$matrix1_old);
-$datamat_old=array();
-$data_read_old=array();
-$node_old=trim($str_arrmat_old[0]);
-$r_index_old=$node_old+2;
-
-for($i=0;$i<$node_old;$i++)
-{
-	$datamat_old=explode("\t",$str_arrmat_old[$r_index_old]);
-	$data_read_old[$i][0]=trim($datamat_old[0]);  //name
-	$data_read_old[$i][1]=trim($datamat_old[1]);  //datatype
-	$col_in_old=2;
-	$r_index_old+=4;
-	if($datamat_old[1]==1)  //type=coninuous
-	{
-         for($j=1;$j<=101;$j++)
-         {
-           $datamat_old=explode("\t",$str_arrmat_old[$r_index_old]);
-           $data_read_old[$i][$col_in_old]=trim($datamat_old[0]);  //x data
-
-           $col_in_old++;
-           $data_read_old[$i][$col_in_old]=trim($datamat_old[1]);  //y data
-   
-           $col_in_old++;
-           $r_index_old++; // increment to point next data
-
-         } 
-	}
-	if($datamat_old[1]>1)  //type=descrete
-	{
-         $iter=$datamat_old[1];
-         for($j=1;$j<=$iter;$j++)
-         {
-           $datamat_old=explode("\t",$str_arrmat_old[$r_index_old]);
-           $data_read_old[$i][$col_in_old]=trim($datamat_old[0]);  //x data
-           //$data_read_old[$i][$col_in_old]='y';
-           $data_read_old[$i][$col_in_old]=levelmap($data_read_old[$i][$col_in_old],$data_read_old[$i][0],$levelmap);
- 
-           $col_in_old++;
-           $data_read_old[$i][$col_in_old]=trim($datamat_old[1]);  //y data
-           $col_in_old++;
-           $r_index_old++; // increment to point next data
-
-         } 
-	}
-}
-
-
-////////////////////////////////////////////////Graphviz data read////////////////////////////////////////////////////////////////////////////////
-$grv=$dir.$keyval."graphviz.txt";
-$line=shell_exec('/usr/bin/dot -Tplain -y '.$grv);
-
-
-//$grfilename=$keyval."graphviz.txt";
-//$cmd="/usr/bin/dot -Tplain -y  $grfilename";
-//$line=system($cmd);
-
-
-
-//shell_exec('/usr/bin/dot -Tpng -o /var/www/html/compbio/BNW/graphviz.png /var/www/html/compbio/BNW/graphviz.txt');
-$str_arrname=array();
-$str_arrname=explode("\n",$line);
-$data=array();
-$ID_data=array();
-$i=0;
-$ii=0;
-foreach($str_arrname as $row)
-{
-  $i++;
-  if($i>1)
-  {
-       
-  	$data=explode(" ",$row);
-       $j=0;
-       $k=0;
-       $flag=0;
-  	foreach($data as $cell)
-	{
-             
-             $j++;
-             
-             $cell=trim($cell);
-             //echo $cell;
-             //echo '&nbsp';
-             if($j==1 && $cell=="node")
-             {
-                $flag=1;
-             }  
-               
-             if($j>1 && $j<5 && $flag==1)
-             {
-    		  //echo $cell;
-   		  //echo '&nbsp';
-                if($j==2)
-                   $ID_data[$ii][$k]=$cell;
-                else
-                   $ID_data[$ii][$k]=round($cell/10*900);
-               // echo $ID_data[$ii][$k];
-                //echo '&nbsp';
-
-                $k++; 
-             }
-       } 
-  
-       if($flag==1)
-       {
-          $ID_data[$ii][3]=$ID_data[$ii][1]+100;
-          $ID_data[$ii][4]=$ID_data[$ii][2]+150; 
-          $ID_data[$ii][5]=$ID_data[$ii][1]+100;
-          $ID_data[$ii][6]=$ID_data[$ii][2]; 
-          $ii++;
-          //echo "<br />"; 
-       } 
-     // echo "<br />"; 
-	
-  }
-}
-
-$nnode=$ii;
-$edge_data=array();
-
-$i=0;
-$ii=0;
-
-foreach($str_arrname as $row)
-{
-  $i++;
-  if($i>1)
-  {
-       
-  	$data=explode(" ",$row);
-       $j=0;
-       
-       $flag=0;
-       $number_of_point=0;
-       $index=0; 
-  	foreach($data as $cell)
-	{
-             $j++;
-             $cell=trim($cell);
-         
-             if($j==1 && $cell=="edge")
-             {
-                $flag=1;
-             }  
-               
-             if($j==2 && $flag==1)
-             {
-                
-                for($k=0;$k<$nnode;$k++)
-                {
-                      if($cell==$ID_data[$k][0])
-                      {
-                          $edge_data[$ii][0]=$ID_data[$k][3];
-                          $edge_data[$ii][1]=$ID_data[$k][4];
-                      }                     
-
-                }
-               
-             }
-             else if($j==3 && $flag==1)
-             {
-               for($k=0;$k<$nnode;$k++)
-                {
-                      if($cell==$ID_data[$k][0])
-                      {
-                          $edge_data[$ii][2]=$ID_data[$k][5];
-                          $edge_data[$ii][3]=$ID_data[$k][6];
-                      }                     
-
-                }
-
-             }
-             else if($j==4 && $flag==1)
-             {
-                  $edge_data[$ii][4]=$cell;
-                  $number_of_point=$cell*2;
-                  $index=5;
-             }
-             else if($j>4 && $number_of_point>0 && $flag==1)
-             {
-                if(($j%2)!=0)
-                  $edge_data[$ii][$index]=round($cell/10*900)+60;//+30+30;
-                else
-                  $edge_data[$ii][$index]=round($cell/10*900)+48;//+18+30;
-
-                $number_of_point--;
-                $index++;
-             }
-
-
-             
-       } 
-       if($flag==1)
-       {
-          $ii++;
-          //echo "<br />"; 
-       } 
- 	
-  }
-}
-
-
-$nedges=$ii;
-//echo $nedges;
-
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-<script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript">
-  google.load('visualization', '1', {packages: ['corechart']});
- </script>
- 
-
-<?php 
-$data_val="";
-
-for($i=0;$i<$nnode;$i++)
- {
-////////////////////////////select node //////////////////////////////////////
- $name=$ID_data[$i][0];
- $fname="draw_".$name."()";
- $data_val.=$name;
- $flag=0; //evidence flag
- for($j=0;$j<$node;$j++)
- {
-    if($data_read[$j][0]==$name)
-    {
-       $s_i=$j;
-       break;
-    } 
- }
- for($j=0;$j<$node_old;$j++)
- {
-    if($data_read_old[$j][0]==$name)
-    {
-       $s_i_old=$j;
-       break;
-    } 
- }
- 
-
-/////////////////////////////////Display nodes//////////////////////////////////////////////////////////
-?>    
-<script type="text/javascript">
-<?php
-  $node_type=$data_read[$s_i][1];
-  if($node_type>1) //discrete node
-  { 
-?>
-  function <?php print($fname);?> {
-  // Create and populate the data table.
-  <?php
- $evd=-9999;
-  for($ii=0;$ii<$cev;$ii++)
-  {
-     if($ev_arr[$ii]==$name)
-     {
-        $evd=$evdata_arr[$ii]; 
-        $evd=levelmap($evd,$name,$levelmap); 
-        $flag=1;
-        break;
-     }
-  }
-if($evd==-9999)
-{
-?>
-  var data = google.visualization.arrayToDataTable([
-   ['<?php print($name);?>', 'Old', 'New'],
-<?php
-  $c_i=2; 
-  $c_i_old=2;
-  for($j=0;$j<$node_type-1;$j++) 
-  {     
-       $val1=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;        
-  ?>
-   ['<?php print($val1);?>', <?php print($val2_old);?>, <?php print($val2);?>],
-  <?php
-  }
-  if($j==$node_type-1)
-  {
-       $val1=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;        
-  ?>
-   ['<?php print($val1);?>', <?php print($val2_old);?>, <?php print($val2);?>]
-<?php
-  }
-}
-else
-{
-  
-?>
-  var data = google.visualization.arrayToDataTable([
-    ['<?php print($name);?>', 'Old', 'New'],
-
-<?php
- 
-  $c_i_old=2;
-  for($j=0;$j<$node_type-1;$j++) 
-  {     
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++; 
-       if($val1_old==$evd)       
-       {
-  ?>
-         ['<?php print($val1_old);?>', <?php print($val2_old);?>, 1],
-
-  <?php
-       }
-       else{
-       ?>
-         ['<?php print($val1_old);?>', <?php print($val2_old);?>, 0],
-
-<?php
-         }   
-  }
-  if($j==$node_type-1)
-  {
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-      if($val1_old==$evd)       
-       {
-      
-  ?>
-        ['<?php print($val1_old);?>', <?php print($val2_old);?>, 1]
-      <?php
-       } 
-       else{
-       ?>
-        ['<?php print($val1_old);?>', <?php print($val2_old);?>, 0] 
-<?php
-         }  
-  }
-}
-?>
- ]);
- 
-      
-        // Create and draw the visualization.
-      
-      var cnode="<?php print($name); ?>";
-      var keyv="<?php print($keyval);?>";
-     <?php if($evd!=-9999)
-             {
-                $named=$name.":".$evd;
-                $bcolor="red";
-                $font=10;
-             }
-             else
-             {
-                $named=$name;
-                $bcolor="black";
-                $font=12;
-             }
-         ?>  
-
-        var chart = new google.visualization.ColumnChart(document.getElementById('<?php print($name);?>'));
-        function selectHandler() {
-          var selectedItem = chart.getSelection()[0];
-          if (selectedItem) {
-            var topping = data.getValue(selectedItem.row, 0);
-            
-            var s = window.prompt('Selected evidence ' + topping + ' for ' + cnode + '. Enter new evidence ', topping );
-	    if (input_check(s))
-	      {
-		window.location.href = "add_evd_example.php?name=" + cnode + "&evidence=" + s + "&My_key=" + keyv;
-	      }
-	    else
-	      {
-		window.location.href = "input_error_no_menu.php";
-	      }
-          }
-        } 
-         chart.draw(data,
-                 {title:"<?php print($named);?>", titleTextStyle: {fontSize: <?php print($font);?>},
-                  width:<?php print($width);?>, height:<?php print($height);?>,
-		    vAxis: {textStyle: {fontSize:9},minValue:0,maxValue:1},
-		    hAxis: {textStyle: {fontSize:11}}, legend: {position: 'none'},
-                  backgroundColor: {stroke: '<?php print($bcolor);?>', strokeWidth: 5}}
-            );
-        google.visualization.events.addListener(chart, 'select', selectHandler);  
-
-  }
-<?php
- }
- else //continuous node
- {
-?>
-  function <?php print($fname);?> {
-  // Create and populate the data table.
-  <?php
- $evd=-9999;
-  for($ii=0;$ii<$cev;$ii++)
-  {
-     if($ev_arr[$ii]==$name)
-     {
-        $evd=$evdata_arr[$ii]; 
-        break;
-     }
-  }
-if($evd==-9999)
-{
-?>
-  var data = google.visualization.arrayToDataTable([
-						    [{label:'<?php print($name);?>',type:'number'}, {label:'Old'},{label:'New'}],
-<?php
-  $c_i=2;
-  $c_i_old=2;
-  for($j=0;$j<100;$j++) 
-  {
-       $val1=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;         
-
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++; 
-  ?>
-   ['<?php print($val1);?>', <?php print($val2_old);?>, <?php print($val2);?>],
-
-  <?php
-  }
-  if($j==100)
-  {
-        $val1=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;   
-  ?>
-   ['<?php print($val1);?>', <?php print($val2_old);?>, <?php print($val2);?>]
-<?php
-  }
-}
-else
-{
-    $evduse=$evd;
-?>
-  var data = google.visualization.arrayToDataTable([
-						    [{label:'<?php print($name);?>',type:'number'}, {label:'Old'},{label:'New'}], 
-//   ['<?php print($name);?>', 'Old', 'New'],
-
-<?php
- 
-  $c_i_old=2;
-  for($j=0;$j<100;$j++) 
-  {     
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++; 
-       if($val1_old<$evduse)  
-       {
-       ?>
-         ['<?php print($val1_old);?>', <?php print($val2_old);?>, 0],
-<?php
-       }
-       else if($val1_old>=$evduse) 
-       {
-        $evduse=99999;
-       ?>
-       ['<?php print($val1_old);?>', <?php print($val2_old);?>, 1],
-     
-       <?php
-       } 
- }
-  if($j==100)
-  {
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-      
-  ?>
-        ['<?php print($val1_old);?>', <?php print($val2_old);?>, 0]
- 
-<?php
-  }
-}
-?>
- ]);
-
-      
-        // Create and draw the visualization.
-      var cnode="<?php print($name); ?>";
-      var keyv="<?php print($keyval);?>";
-
-       <?php if($evd!=-9999)
-             {
-                $named=$name.":".$evd;
-                $bcolor="red";
-                $font=10;
-             }
-             else
-             {
-                $named=$name;
-                $bcolor="black";
-                $font=12;
-             }
-         ?>  
-        var chart = new google.visualization.LineChart(document.getElementById('<?php print($name);?>'));
-
-        function selectHandler() {
-          var selectedItem = chart.getSelection()[0];
-          if (selectedItem) {
-           
-            var topping = data.getValue(selectedItem.row, 0);
-            var s = window.prompt('Selected evidence ' + topping + ' for ' + cnode + '. Enter new evidence ', topping );
-	    if (input_check(s))
-	      {
-		window.location.href = "add_evd_example.php?name=" + cnode + "&evidence=" + s + "&My_key=" + keyv; 
-	      }
-	    else
-	      {
-		window.location.href = "input_error_no_menu.php";
-	      }
-          }
-        }
-            chart.draw(data, {curveType: "function",
-                  title:"<?php print($named);?>", titleTextStyle: {fontSize: <?php print($font);?>},
-			legend: {position: 'none'},
-                  width:<?php print($width);?>, height:<?php print($height);?>,
-		  hAxis: {gridlines: {count: 4}, textStyle: {fontSize: 9}, viewWindowMode: 'maximized'},
-		    vAxis: {maxValue: 0.5, minValue: 0,viewWindow: {min:0}, gridlines: {count:5}, textStyle: {fontSize: 9}},
-		    chartArea:{left:30,top:25,right:8,bottom:25},
-                  backgroundColor: {stroke: '<?php print($bcolor);?>', strokeWidth: 5}}
-            );
-           google.visualization.events.addListener(chart, 'select', selectHandler); 
-       }
-
-<?php
- }
-?>
-</script>
-<?php
-///////////////////////////end of display nodes////////////////////////////////////////////////
-}
-
-
-///////////////////////////////////write data to file///////////////////////////////////////////////////////////
-?>
-
-
-
-<script type="text/javascript">
-function canvas_arrow(context, fromx, fromy, tox, toy){
-    var headlen = 15;
-    var dx = tox-fromx;
-    var dy = toy-fromy;
-    var angle = Math.atan2(dy,dx);
-    context.moveTo(fromx,fromy);
-    context.lineTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle-Math.PI/6),toy-headlen*Math.sin(angle-Math.PI/6));
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle+Math.PI/6),toy-headlen*Math.sin(angle+Math.PI/6));
-}
-</script>
-
-<script type="text/javascript">
-function canvas_arrow_head(context, fromx, fromy, tox, toy){
-    var headlen = 15;
-    var dx = tox-fromx;
-    var dy = toy-fromy;
-    var angle = Math.atan2(dy,dx);
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle-Math.PI/6),toy-headlen*Math.sin(angle-Math.PI/6));
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle+Math.PI/6),toy-headlen*Math.sin(angle+Math.PI/6));
-}
-</script>
-
-
-</head>
-
-<body>
-<canvas id="test" width="3000" height="3000" style="position:absolute">
-<script>
-function canvas_arrow_draw(n, polypts,context){
-
-//Create jsGraphics object
-var headlen = 10;
-/*
-var hexno=new String;
-arr=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
-var n1=Math.round(Math.random()*15);
-var n2=Math.round(Math.random()*15);
-var n3=Math.round(Math.random()*15);
-var n4=Math.round(Math.random()*15);
-var n5=Math.round(Math.random()*15);
-var n6=Math.round(Math.random()*15);
-hexno="#"+arr[n1]+""+arr[n2]+""+arr[n3]+""+arr[n4]+""+arr[n5]+""+arr[n6];
-*/
-hexno="black";
-var polypoints = new Array();
-var n2=n*2;
-
-
-var sx=polypts[0];
-var sy=polypts[1];
- 
-var sx1=polypts[n2-4];
-var sy1=polypts[n2-3];
-var ex1=polypts[n2-2];
-var ey1=polypts[n2-1];
-
-context.beginPath();
-canvas_arrow_head(context,sx1,sy1,ex1,ey1);
-
-context.moveTo(polypts[0],polypts[1]);
-nm=n%3;
-ni=(n-nm)/3;
-
-for(i=0;i<ni;i++)
-{
-  i11=i*6+2;
-  i12=i*6+3;
-  i21=i*6+4;
-  i22=i*6+5;
-  i31=i*6+6;
-  i32=i*6+7;
-
-  context.bezierCurveTo(polypts[i11],polypts[i12],polypts[i21],polypts[i22],polypts[i31],polypts[i32]);
-  context.moveTo(polypts[i31],polypts[i32]);
-
- // polypoints[i] = new jxPoint(polypts[i1], polypts[i2]);
-}
-
-
-if(nm==2)
-{
-  context.moveTo(polypts[i21],polypts[i22]);
-  context.bezierCurveTo(polypts[i31],polypts[i32],sx1,sy1,ex1,ey1);
-  context.moveTo(ex1,ey1);
-
-}
-
- context.strokeStyle = hexno;
- context.stroke();
-
-}
-
-
-var canvas=document.getElementById("test");
-var context = canvas.getContext("2d");
-context.lineWidth = 3;
-
-<?php
-for($i=0;$i<$nedges;$i++)
-{
-
-   $n=$edge_data[$i][4]; 
-   $n2=$n*2;
-   
-?>
-var polypoints = new Array();
-var j=0;
-var n="<?php print($n);?>";
-<?php
-for($j=0;$j<$n2;$j++)
-{
-$inx=$j+5;
-$data=$edge_data[$i][$inx];
-
-?>
-	polypoints[j] = "<?php print($data);?>";
-
-       j++;
-<?php
-}
-?>
-canvas_arrow_draw(n,polypoints,context);
-<?php
-}
-?>
-
-
-
-</script>
-</canvas>
-
-
-<?php 
-for($i=0;$i<$nnode;$i++)
-{
-  $x=$ID_data[$i][1]-8; $y=$ID_data[$i][2]-20; 
-  $name=$ID_data[$i][0];
-?>
-
-<script type="text/javascript">
-   google.setOnLoadCallback(draw_<?php print($name)?>);
-</script>
-<div id="<?php print($name)?>" style="left: <?php print($x)?>px; top: <?php print($y)?>px; width:<?php print($width);?>; height:<?php print($height);?>; position: absolute"></div>
-
-<?php 
-}
-?>
-
-
-</body>
-
-
-
-</html>
-
diff --git a/sourcecodes/network_layout_evd_example.php b/sourcecodes/network_layout_evd_example.php
deleted file mode 100644
index 56f80a4e..00000000
--- a/sourcecodes/network_layout_evd_example.php
+++ /dev/null
@@ -1,634 +0,0 @@
-<?php 
-  //include("structuremap.php");
-include("header_batchsearch.inc");
-include("input_validate.php");
-
-function levelmap($inx,$name,$mapdata)
-{
-
-$leve_l=array();
-$leve_l=explode("\n",$mapdata);
-$leve_d=array();
-
-foreach($leve_l as $l)
-{ 
-  $l=trim($l);
-  $leve_d=explode("\t",$l);
-  $inxname=trim($leve_d[0]);
-  $name=trim($name);
-  if($inxname==$name)
-    return $leve_d[$inx];
-}
-           
-}
-
-
-////////////////////////////////////Read data from net_figure file///////////////////////Graphp Display/////////////////////////////////////////////
-$dir="./data/";
-
-
-$keyval=valid_keyval($_GET["My_key"]);
-
-$matfile=$dir."$keyval"."net_figure.txt";
-
-$data_val="";
-
-$matrix=file("$matfile");
-$matrix1=file_get_contents("$matfile");   
-
-$lfile=$dir.$keyval."nlevels.txt";
-$levelmap=file_get_contents($lfile);   
-
-
-$str_arrmat=array();
-$str_arrmat=explode("\n",$matrix1);
-
-if($str_arrmat[2]=="" || $matrix1=="")
-{
-?>
-<h1><font color=blue>Error: Unable to display your network structure.</font></h1>
-<?php
-exit;
-}
-
-$datamat=array();
-$data_read=array();
- 
-$node=trim($str_arrmat[0]);
-  $width=150;
-  $height=150;
-  $font=12;
-
-$r_index=$node+2;
-
-for($i=0;$i<$node;$i++)
-{
-$datamat=explode("\t",$str_arrmat[$r_index]);
-$data_read[$i][0]=trim($datamat[0]);  //name
-$data_read[$i][1]=trim($datamat[1]);  //datatype
-$col_in=2;
-$r_index+=4;
-	if($datamat[1]==1)  //type=coninuous
-	{
-         for($j=1;$j<=101;$j++)
-         {
-           $datamat=explode("\t",$str_arrmat[$r_index]);
-           $data_read[$i][$col_in]=trim($datamat[0]);  //x data
-         //  echo $data_read[$i][$col_in];
-          // echo '&nbsp';
-
-           $col_in++;
-           $data_read[$i][$col_in]=trim($datamat[1]);  //y data
-          // echo $data_read[$i][$col_in];
-	   // echo '&nbsp';
-
-           $col_in++;
-           $r_index++; // increment to point next data
-           // echo "<br />"; 
-         } 
-	}
-	if($datamat[1]>1)  //type=descrete
-	{
-         $iter=$datamat[1];
-         for($j=1;$j<=$iter;$j++)
-         {
-           $datamat=explode("\t",$str_arrmat[$r_index]);
-           $data_read[$i][$col_in]=trim($datamat[0]);  //x data
-           //use level mapping
-           $data_read[$i][$col_in]=levelmap($data_read[$i][$col_in],$data_read[$i][0],$levelmap);
- 
-           $col_in++;
-           $data_read[$i][$col_in]=trim($datamat[1]);  //y data
-         
-           $col_in++;
-           $r_index++; // increment to point next data
-           //echo "<br />"; 
-         } 
-	}
-
-}
-
-
-
-
-////////////////////////////////////////////////Graphviz data read////////////////////////////////////////////////////////////////////////////////
-
-$grv=$dir.$keyval."graphviz.txt";
-$line=shell_exec('/usr/bin/dot -Tplain -y '.$grv);
-
-//$grfilename=$keyval."graphviz.txt";
-//$cmd="/usr/bin/dot -Tplain -y  $grfilename";
-//$line=system($cmd);
-
-
-
-
-$str_arrname=array();
-$str_arrname=explode("\n",$line);
-$data=array();
-$ID_data=array();
-$i=0;
-$ii=0;
-foreach($str_arrname as $row)
-{
-  $i++;
-  if($i>1)
-  {
-       
-  	$data=explode(" ",$row);
-       $j=0;
-       $k=0;
-       $flag=0;
-  	foreach($data as $cell)
-	{
-             
-             $j++;
-             
-             $cell=trim($cell);
-             //echo $cell;
-             //echo '&nbsp';
-             if($j==1 && $cell=="node")
-             {
-                $flag=1;
-             }  
-               
-             if($j>1 && $j<5 && $flag==1)
-             {
-    		  //echo $cell;
-   		  //echo '&nbsp';
-                if($j==2)
-                   $ID_data[$ii][$k]=$cell;
-                else
-                   $ID_data[$ii][$k]=round($cell/10*900);
-               // echo $ID_data[$ii][$k];
-                //echo '&nbsp';
-
-                $k++; 
-             }
-       } 
-  
-       if($flag==1)
-       {
-          $ID_data[$ii][3]=$ID_data[$ii][1]+100;
-          $ID_data[$ii][4]=$ID_data[$ii][2]+150; 
-          $ID_data[$ii][5]=$ID_data[$ii][1]+100;
-          $ID_data[$ii][6]=$ID_data[$ii][2]; 
-          $ii++;
-          //echo "<br />"; 
-       } 
-     // echo "<br />"; 
-	
-  }
-}
-
-$nnode=$ii;
-$edge_data=array();
-
-$i=0;
-$ii=0;
-
-foreach($str_arrname as $row)
-{
-  $i++;
-  if($i>1)
-  {
-       
-  	$data=explode(" ",$row);
-       $j=0;
-       
-       $flag=0;
-       $number_of_point=0;
-       $index=0; 
-  	foreach($data as $cell)
-	{
-             $j++;
-             $cell=trim($cell);
-         
-             if($j==1 && $cell=="edge")
-             {
-                $flag=1;
-             }  
-               
-             if($j==2 && $flag==1)
-             {
-                
-                for($k=0;$k<$nnode;$k++)
-                {
-                      if($cell==$ID_data[$k][0])
-                      {
-                          $edge_data[$ii][0]=$ID_data[$k][3];
-                          $edge_data[$ii][1]=$ID_data[$k][4];
-                      }                     
-
-                }
-               
-             }
-             else if($j==3 && $flag==1)
-             {
-               for($k=0;$k<$nnode;$k++)
-                {
-                      if($cell==$ID_data[$k][0])
-                      {
-                          $edge_data[$ii][2]=$ID_data[$k][5];
-                          $edge_data[$ii][3]=$ID_data[$k][6];
-                      }                     
-
-                }
-
-             }
-             else if($j==4 && $flag==1)
-             {
-                  $edge_data[$ii][4]=$cell;
-                  $number_of_point=$cell*2;
-                  $index=5;
-             }
-             else if($j>4 && $number_of_point>0 && $flag==1)
-             {
-                if(($j%2)!=0)
-                  $edge_data[$ii][$index]=round($cell/10*900)+60;//+30+30;
-                else
-                  $edge_data[$ii][$index]=round($cell/10*900)+48;//+18+30;
-
-                $number_of_point--;
-                $index++;
-             }
-
-
-             
-       } 
-       if($flag==1)
-       {
-          $ii++;
-          //echo "<br />"; 
-       } 
- 	
-  }
-}
-
-
-$nedges=$ii;
-
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-<script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript">
-  google.load('visualization', '1', {packages: ['corechart']});
- </script>
- 
-
-<?php 
-$data_val="";
-
-for($i=0;$i<$nnode;$i++)
- {
-////////////////////////////select node //////////////////////////////////////
- $name=$ID_data[$i][0];
- $fname="draw_".$name."()";
- $data_val.=$name;
- for($j=0;$j<$node;$j++)
- {
-    if($data_read[$j][0]==$name)
-    {
-       $s_i=$j;
-       break;
-    } 
- }
- 
-/////////////////////////////////Display nodes//////////////////////////////////////////////////////////
-?>    
- <script type="text/javascript">
-
-
-<?php
-  $node_type=$data_read[$s_i][1];
-  if($node_type>1) //discrete node
-  { 
-?>
-  
- 
-  function <?php print($fname);?> {
-  // Create and populate the data table.
- 
-  var data = google.visualization.arrayToDataTable([
-   ['<?php print($name);?>', ''],
-  <?php
-  $c_i=2; 
-
-  for($j=0;$j<$node_type-1;$j++) 
-  {     
-       $val1=trim($data_read[$s_i][$c_i]);
-
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $data_val.="\t".$val2;
-        
-  ?>
-   ['<?php print($val1);?>', <?php print($val2);?>],
-
-  <?php
-  }
-  if($j==$node_type-1)
-  {
-        $val1=trim($data_read[$s_i][$c_i]);
-
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $data_val.="\t".$val2."\n";
-  ?> 
-    ['<?php print($val1);?>', <?php print($val2);?>]
-<?php
-  }
-?>
-  ]);
-      
-        // Create and draw the visualization.
-      
-      var cnode="<?php print($name); ?>";
-      var keyv="<?php print($keyval);?>";  
-
-        var chart = new google.visualization.ColumnChart(document.getElementById('<?php print($name);?>'));
-        function selectHandler() {
-          var selectedItem = chart.getSelection()[0];
-          if (selectedItem) {
-            var topping = data.getValue(selectedItem.row, 0);
-            
-            var s = window.prompt('Selected evidence ' + topping + ' for ' + cnode + '. Enter new evidence ', topping );
-	    if (input_check(s))
-	      {
-                window.location.href = "add_evd_example.php?name=" + cnode + "&evidence=" + s + "&My_key="  + keyv;
-	      }
-	    else
-	      {
-		window.location.href = "input_error_no_menu.php";
-	      }
-  
-              //alert('The user selected ' + topping + topname);
-          }
-        } 
-         chart.draw(data,
-                 {title:"<?php print($name);?>", titleTextStyle: {fontSize: <?php print($font);?>},
-                  width:<?php print($width);?>, height:<?php print($height);?>,
-		    vAxis: {textStyle: {fontSize:9},minValue: 0, maxValue: 1},
-		    hAxis: {textStyle: {fontSize:11}}, legend: {position: 'none'},
-                  backgroundColor: {stroke: 'black', strokeWidth: 5}}
-            );
-        google.visualization.events.addListener(chart, 'select', selectHandler);  
-
-  }
-<?php
- }
- else //continuous node
- {
-?>
-  function <?php print($fname);?> {
-  // Create and populate the data table.
-  var data = google.visualization.arrayToDataTable([
-						    [ {label: '<?php print($name);?>', type: 'number'}, {label:''}],
-  <?php
-  $c_i=2;
-  for($j=0;$j<100;$j++) 
-  {
-       $val1=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;         
-       $data_val.="\t".$val2;
-  ?>
-   ['<?php print(floatval($val1));?>', <?php print($val2);?>],
-
-  <?php
-  }
-  if($j==100)
-  {
-       $val1=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $data_val.="\t".$val2."\n";
-  ?> 
-    ['<?php print($val1);?>', <?php print($val2);?>]
-<?php
-  }
-?>
-  ]);
-      
-        // Create and draw the visualization.
-      var cnode="<?php print($name); ?>";
-      var keyv="<?php print($keyval);?>";  
-        var chart = new google.visualization.LineChart(document.getElementById('<?php print($name);?>'));
-
-        function selectHandler() {
-          var selectedItem = chart.getSelection()[0];
-          if (selectedItem) {
-           
-            var topping = data.getValue(selectedItem.row, 0);
-            var s = window.prompt('Selected evidence ' + topping + ' for ' + cnode + '. Enter new evidence ', topping );
-	    if (input_check(s))
-	      {
-		window.location.href = "add_evd_example.php?name=" + cnode + "&evidence=" + s + "&My_key=" + keyv; 
-	      }
-	    else
-	      {
-		window.location.href = "input_error_no_menu.php";
-	      }
-
-          }
-        }
-            chart.draw(data, {curveType: "function",
-                  title:"<?php print($name);?>", titleTextStyle: {fontSize: <?php print($font);?>},
-		  legend: {position: 'none'},
-                  width:<?php print($width);?>, height:<?php print($height);?>,
-						  vAxis: {minValue: 0, maxValue: 0.5, viewWindow: {min:0}, gridlines: {count: 5}, textStyle: {fontSize: 9}},
-                  hAxis: {gridlines: {count: 4}, textStyle: {fontSize: 9},viewWindowMode: 'maximized'},
-                  chartArea:{left:30,top:25,right:8,bottom:25},
-		    backgroundColor: {stroke: 'black', strokeWidth: 5}}
-            );
-           google.visualization.events.addListener(chart, 'select', selectHandler); 
-       }
-
-<?php
- }
-?>
-</script>
-<?php
-///////////////////////////end of display nodes////////////////////////////////////////////////
-}
-
-///////////////////////////////////write data to file///////////////////////////////////////////////////////////
-$fl=$dir.$keyval."structure_old.txt";
-$fp = fopen("$fl","w");
-fwrite($fp,"$data_val");
-?>
-
-
-
-<script type="text/javascript">
-function canvas_arrow(context, fromx, fromy, tox, toy){
-    var headlen = 15;
-    var dx = tox-fromx;
-    var dy = toy-fromy;
-    var angle = Math.atan2(dy,dx);
-    context.moveTo(fromx,fromy);
-    context.lineTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle-Math.PI/6),toy-headlen*Math.sin(angle-Math.PI/6));
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle+Math.PI/6),toy-headlen*Math.sin(angle+Math.PI/6));
-}
-</script>
-
-<script type="text/javascript">
-function canvas_arrow_head(context, fromx, fromy, tox, toy){
-    var headlen = 15;
-    var dx = tox-fromx;
-    var dy = toy-fromy;
-    var angle = Math.atan2(dy,dx);
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle-Math.PI/6),toy-headlen*Math.sin(angle-Math.PI/6));
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle+Math.PI/6),toy-headlen*Math.sin(angle+Math.PI/6));
-}
-</script>
-
-
-</head>
-
-<body>
-<canvas id="test" width="3000" height="3000" style="position:absolute">
-<script>
-function canvas_arrow_draw(n, polypts,context){
-
-//Create jsGraphics object
-var headlen = 10;
-/*
-var hexno=new String;
-arr=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
-var n1=Math.round(Math.random()*15);
-var n2=Math.round(Math.random()*15);
-var n3=Math.round(Math.random()*15);
-var n4=Math.round(Math.random()*15);
-var n5=Math.round(Math.random()*15);
-var n6=Math.round(Math.random()*15);
-hexno="#"+arr[n1]+""+arr[n2]+""+arr[n3]+""+arr[n4]+""+arr[n5]+""+arr[n6];
-*/
-hexno="black";
-var polypoints = new Array();
-var n2=n*2;
-
-
-var sx=polypts[0];
-var sy=polypts[1];
- 
-var sx1=polypts[n2-4];
-var sy1=polypts[n2-3];
-var ex1=polypts[n2-2];
-var ey1=polypts[n2-1];
-
-context.beginPath();
-canvas_arrow_head(context,sx1,sy1,ex1,ey1);
-
-context.moveTo(polypts[0],polypts[1]);
-nm=n%3;
-ni=(n-nm)/3;
-
-for(i=0;i<ni;i++)
-{
-  i11=i*6+2;
-  i12=i*6+3;
-  i21=i*6+4;
-  i22=i*6+5;
-  i31=i*6+6;
-  i32=i*6+7;
-
-  context.bezierCurveTo(polypts[i11],polypts[i12],polypts[i21],polypts[i22],polypts[i31],polypts[i32]);
-  context.moveTo(polypts[i31],polypts[i32]);
-
- // polypoints[i] = new jxPoint(polypts[i1], polypts[i2]);
-}
-
-
-if(nm==2)
-{
-  context.moveTo(polypts[i21],polypts[i22]);
-  context.bezierCurveTo(polypts[i31],polypts[i32],sx1,sy1,ex1,ey1);
-  context.moveTo(ex1,ey1);
-
-}
-
- context.strokeStyle = hexno;
- context.stroke();
-
-}
-
-
-var canvas=document.getElementById("test");
-var context = canvas.getContext("2d");
-context.lineWidth = 3;
-
-<?php
-for($i=0;$i<$nedges;$i++)
-{
-
-   $n=$edge_data[$i][4]; 
-   $n2=$n*2;
-   
-?>
-var polypoints = new Array();
-var j=0;
-var n="<?php print($n);?>";
-<?php
-for($j=0;$j<$n2;$j++)
-{
-$inx=$j+5;
-$data=$edge_data[$i][$inx];
-
-?>
-	polypoints[j] = "<?php print($data);?>";
-
-       j++;
-<?php
-}
-?>
-canvas_arrow_draw(n,polypoints,context);
-<?php
-}
-?>
-
-
-
-</script>
-</canvas>
-
-
-<?php 
-for($i=0;$i<$nnode;$i++)
-{
-  $x=$ID_data[$i][1]-8; $y=$ID_data[$i][2]-20; 
-
-  $name=$ID_data[$i][0];
-?>
-
-<script type="text/javascript">
-   google.setOnLoadCallback(draw_<?php print($name)?>);
-</script>
-<div id="<?php print($name)?>" style="left: <?php print($x)?>px; top: <?php print($y)?>px; width:<?php print($width);?>; height:<?php print($height);?>; position: absolute"></div>
-
-<?php 
-}
-?>
-
-
-</body>
-
-
-
-</html>
-
-
diff --git a/sourcecodes/network_layout_inv.php b/sourcecodes/network_layout_inv.php
index f6856fe4..7442026f 100644
--- a/sourcecodes/network_layout_inv.php
+++ b/sourcecodes/network_layout_inv.php
@@ -23,7 +23,9 @@ foreach($leve_l as $l)
 ////////////////////////////////////Read data from net_figure file///////////////////////Graphp Display/////////////////////////////////////////////
 
 $keyval=valid_keyval($_GET["My_key"]);
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $lfile=$dir.$keyval."nlevels.txt";
 $levelmap=file_get_contents($lfile);   
@@ -102,7 +104,8 @@ $grv=$dir.$keyval."graphviz.txt";
 $line=shell_exec('/usr/bin/dot -Tplain -y '.$grv);
 
 $grviz_name_list=array();
-$g_file_name="./data/".$keyval."grviz_name_file.txt";
+//$g_file_name="./data/".$keyval."grviz_name_file.txt";
+$g_file_name=$dir.$keyval."grviz_name_file.txt";
 $grviz_name=file_get_contents("$g_file_name");
 $grviz_name_list=explode("\n",$grviz_name);
 
@@ -231,7 +234,7 @@ $nedges=$ii;
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-<script type="text/javascript" src="http://www.google.com/jsapi"></script>
+<script type="text/javascript" src="https://www.google.com/jsapi"></script>
  <script type="text/javascript">
   google.load('visualization', '1', {packages: ['corechart']});
  </script>
@@ -244,7 +247,9 @@ for($i=0;$i<$nnode;$i++)
  {
 ////////////////////////////select node //////////////////////////////////////
  $name=$ID_data[$i][0];
- $fname="draw_".$name."()";
+ $replaced_char = array("-","/",",",".","!","?");
+ $name_replaced = str_replace($replaced_char,"_",$name);
+ $fname="draw_".$name_replaced."()";
  $data_val.=$name;
  for($j=0;$j<$node;$j++)
  {
@@ -567,10 +572,12 @@ for($i=0;$i<$nnode;$i++)
   $x=$ID_data[$i][1]-8; $y=$ID_data[$i][2]-20; 
 
   $name=$ID_data[$i][0];
+  $replaced_char = array("-","/",",",".","!","?");
+  $name_replaced = str_replace($replaced_char,"_",$name);
 ?>
 
 <script type="text/javascript">
-   google.setOnLoadCallback(draw_<?php print($name)?>);
+   google.setOnLoadCallback(draw_<?php print($name_replaced)?>);
 </script>
 <div id="<?php print($name)?>" style="left: <?php print($x)?>px; top: <?php print($y)?>px; width:<?php print($width);?>; height:<?php print($height);?>; position: absolute"></div>
 
diff --git a/sourcecodes/network_layout_inv_2.php b/sourcecodes/network_layout_inv_2.php
index 65451727..c851f018 100644
--- a/sourcecodes/network_layout_inv_2.php
+++ b/sourcecodes/network_layout_inv_2.php
@@ -26,7 +26,9 @@ foreach($leve_l as $l)
 
 $keyval=valid_keyval($_GET["My_key"]);
 
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $lfile=$dir.$keyval."nlevels.txt";
 $levelmap=file_get_contents($lfile); 
@@ -360,7 +362,8 @@ $grv=$dir.$keyval."graphviz_new.txt";
 $line=shell_exec('/usr/bin/dot -Tplain -y '.$grv);
 
 $grviz_name_list=array();
-$g_file_name="./data/".$keyval."grviz_name_file_new.txt";
+//$g_file_name="./data/".$keyval."grviz_name_file_new.txt";
+$g_file_name=$dir.$keyval."grviz_name_file_new.txt";
 $grviz_name=file_get_contents("$g_file_name");
 $grviz_name_list=explode("\n",$grviz_name);
 
@@ -525,7 +528,7 @@ $nedges=$ii;
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-<script type="text/javascript" src="http://www.google.com/jsapi"></script>
+<script type="text/javascript" src="https://www.google.com/jsapi"></script>
  <script type="text/javascript">
   google.load('visualization', '1', {packages: ['corechart']});
  </script>
@@ -538,7 +541,9 @@ for($i=0;$i<$nnode;$i++)
  {
 ////////////////////////////select node //////////////////////////////////////
  $name=$ID_data[$i][0];
- $fname="draw_".$name."()";
+ $replaced_char = array("-","/",",",".","!","?");
+ $name_replaced = str_replace($replaced_char,"_",$name);
+ $fname="draw_".$name_replaced."()";
  $data_val.=$name;
 $flag=0; //evidence flag
  for($j=0;$j<$node;$j++)
@@ -1131,10 +1136,12 @@ for($i=0;$i<$nnode;$i++)
 {
   $x=$ID_data[$i][1]-8; $y=$ID_data[$i][2]-20;
   $name=$ID_data[$i][0];
+  $replaced_char = array("-","/",",",".","!","?");
+  $name_replaced = str_replace($replaced_char,"_",$name);
 ?>
 
 <script type="text/javascript">
-   google.setOnLoadCallback(draw_<?php print($name)?>);
+   google.setOnLoadCallback(draw_<?php print($name_replaced)?>);
 </script>
 <div id="<?php print($name)?>" style="left: <?php print($x)?>px; top: <?php print($y)?>px; width:<?php print($width);?>; height:<?php print($height);?>; position: absolute"></div>
 
diff --git a/sourcecodes/network_layout_inv_2_example.php b/sourcecodes/network_layout_inv_2_example.php
deleted file mode 100644
index b4878af9..00000000
--- a/sourcecodes/network_layout_inv_2_example.php
+++ /dev/null
@@ -1,1152 +0,0 @@
-<?php 
-  //include("structuremap.php");
-include("header_batchsearch.inc");
-include("input_validate.php");
-
-function levelmap($inx,$name,$mapdata)
-{
-
-$leve_l=array();
-$leve_l=explode("\n",$mapdata);
-$leve_d=array();
-
-foreach($leve_l as $l)
-{ 
-  $l=trim($l);
-  $leve_d=explode("\t",$l);
-  $inxname=trim($leve_d[0]);
-  $name=trim($name);
-  if($inxname==$name)
-    return $leve_d[$inx];
-}
-           
-}
-
-
-
-$keyval=valid_keyval($_GET["My_key"]);
-
-$dir="./data/";
-
-$lfile=$dir.$keyval."nlevels.txt";
-$levelmap=file_get_contents($lfile); 
-///////////////////Search for child nodes////////////////////////////////
-
-function ischild($ev_child_arr,$name)
-{
-  $match=0;
-  $dataname=array();
-  $dataname=explode("|",$ev_child_arr);
-  $n=count($dataname);
-  for($i=0;$i<$n;$i++)
-  {
-
-     if($dataname[$i]==$name)
-     {
-         $match=1;
-         break;
-     
-     }
-
-  } 
-
-  return $match;
-}
-
-
-
-
-//////////////////////////Entered evidences//////////////////////////////////////////
-
-$fl=$dir.$keyval."varname.txt";
-$lines = file("$fl");
-
-$ev_arr=array();
-$ev_arr_tmp=array();
-
-$evdata_arr=array();
-
-$data_cell_ev=array();
-$cev=0;
-
-// Loop through our array, show HTML source as HTML source; and line numbers too.
-foreach ($lines as $line_num => $line) 
-{
-	$data_cell_ev=explode("\t",$line);
-	foreach ($data_cell_ev as $ld)
-	{
-  		$ldd=trim($ld);
-  		if($ldd !="")
-  		{
-        		$ev_arr[$cev]=$ldd;
-                     $ev_arr_tmp[$cev]=$ldd;  
-                     $cev++;
-  			//echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($ldd) . "<br />\n";
-  		}
-	}
-
-}
-//////number of evidence node
-$temp_cev=$cev;
-/////////////////////////////////////
-//$ev_arr[$cev]  evidence array  
-//$cev  number of evidence
-/////////////////////////////////////
-// go through the structure file to pick childern of evidence node 
-//
-////////////////////////////////////
-$matfile=$dir.$keyval."structure_input_new.txt";
-$matrix1=file_get_contents("$matfile");           
-$str_arrmat=array();
-$str_arrmat=explode("\n",$matrix1);
-$datamat=array();
-$data_cell=array(); 
-$col_arr=array();
-$dataname=array();
-$dataname=explode("\t",$str_arrmat[0]);
-$n=count($dataname);
-
-$ev_child_arr="";
-  
-for($ii=0;$ii<$temp_cev;$ii++)
-{
-         $evdname=$ev_arr_tmp[$ii];
-         for($i=1;$i<=$n;$i++)
-         {
-                   $iii=$i-1; 
-                   $row_name=trim($dataname[$iii]);
-           
-                   if($row_name==$evdname)
-                   {
-	                      $col_arr=explode("\t",$str_arrmat[$i]);
-		               for($j=0;$j<$n;$j++)
-	  	               {
-               	           $col_val=trim($col_arr[$j]);
-               	           if($col_val==1)
-               	           { 
-                                       $ddname=trim($dataname[$j]); 
-                                       $pos = strpos($ev_child_arr, $ddname);
-                                       if ($pos === false)
-                                       {
-                                          $ev_arr_tmp[$temp_cev]=$ddname; 
-                                          $temp_cev++;
-                                          $ev_child_arr.="|".$ddname;
-                                       }
-                           
-	        	            }
-          	                }
-
-                   }
-        }        
-     
-} 
-
-
-
-$fl=$dir.$keyval."vardata.txt";
-$linesd = file("$fl");
-$cevdata=0;
-// Loop through our array, show HTML source as HTML source; and line numbers too.
-foreach ($linesd as $line_num => $line) 
-{
-  
-	$data_cell_ev=explode("\t",$line);
-	foreach ($data_cell_ev as $ld)
-	{
-  		$ldd=trim($ld);
-  		if($ldd !="")
-  		{
-        		$evdata_arr[$cevdata]=$ldd;  
-                     $cevdata++;
-                     //echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($ldd) . "<br />\n";
-
-  			
-  		}
-	}
-  
-}
-
-
-
-////////////////////////////////////Read data from net_figure file///////////////////////Graphp Display/////////////////////////////////////////////
-
-
-$matfile=$dir.$keyval."net_figure_new.txt";
-
-$data_val="";
-
-$matrix=file("$matfile");
-$matrix1=file_get_contents("$matfile");              //file("$matfile");
-
-$str_arrmat=array();
-$str_arrmat=explode("\n",$matrix1);
-
-if($str_arrmat[2]=="" || $matrix1=="")
-{
-?>
-<h1><font color=blue>Error: Unable to display your network structure.</font></h1>
-<?php
-exit;
-}
-
-$node=trim($str_arrmat[1]);
-
-
-
-
-
-/*
-if($node<=5)
-{
-  $width=200;
-  $hieght=150;
-  $font=14;
-}
-else if($node>5 && $node<=7)
-{
-  $width=150;
-  $hieght=120;
-  $font=12;
-
-}
-else if($node>7 && $node<=10)
-{
-  $width=110;
-  $hieght=85;
-  $font=10;
-}
-else 
-{
-  $width=80;
-  $hieght=60;
-  $font=8;
-}
-*/
-  $width=150;
-  $hieght=150;
-  $font=12;
-
-
-$datamat=array();
-$data_read=array();
-
-$r_index=$node+3;
-
-for($i=0;$i<$node;$i++)
-{
-$datamat=explode("\t",$str_arrmat[$r_index]);
-$data_read[$i][0]=trim($datamat[0]);  //name
-$data_read[$i][1]=trim($datamat[1]);  //datatype
-$nodetype=$data_read[$i][1];
-$col_in=2;
-$r_index+=4;
-$evd=-9999;
-$name=$data_read[$i][0];
-for($ii=0;$ii<$cev;$ii++)
-{
-     if($ev_arr[$ii]==$name)
-     {
-        $evd=$evdata_arr[$ii]; 
-        if($nodetype>1)
-            $evd=levelmap($evd,$data_read[$i][0],$levelmap);
-
-        break;
-     }
-}
-
-if($evd!=-9999)//with evidence
-{
-           $datamat=explode("\t",$str_arrmat[$r_index]);
-           $data_read[$i][$col_in]=trim($datamat[0]);  //x data
-           $col_in++;
-           $data_read[$i][$col_in]=trim($datamat[1]);  //y data
-           $col_in++;
-           $r_index++; // increment to point next data
-
-      
-}
-else //without evidence
-{
-	if($nodetype==1)  //type=coninuous
-	{
-         for($j=1;$j<=101;$j++)
-         {
-           $datamat=explode("\t",$str_arrmat[$r_index]);
-           $data_read[$i][$col_in]=trim($datamat[0]);  //x data
- 
-           $col_in++;
-           $data_read[$i][$col_in]=trim($datamat[1]);  //y data
- 
-           $col_in++;
-           $r_index++; // increment to point next data
-         } 
-	}
-	if($nodetype>1)  //type=descrete
-	{
-         $iter=$datamat[1];
-         for($j=1;$j<=$iter;$j++)
-         {
-           $datamat=explode("\t",$str_arrmat[$r_index]);
-           $data_read[$i][$col_in]=trim($datamat[0]);  //x data
-           $data_read[$i][$col_in]=levelmap($data_read[$i][$col_in],$data_read[$i][0],$levelmap);
-  
-           $col_in++;
-           $data_read[$i][$col_in]=trim($datamat[1]);  //y data
-            $col_in++;
-           $r_index++; // increment to point next data
-         } 
-	}
-
-}
-
-}
-
-
-$matfile_old=$dir.$keyval."net_figure.txt";
-
-$data_val="";
-
-$matrix_old=file("$matfile_old");
-$matrix1_old=file_get_contents("$matfile_old");              //file("$matfile");
-$str_arrmat_old=array();
-$str_arrmat_old=explode("\n",$matrix1_old);
-$datamat_old=array();
-$data_read_old=array();
-$node_old=trim($str_arrmat_old[0]);
-$r_index_old=$node_old+2;
-
-for($i=0;$i<$node_old;$i++)
-{
-	$datamat_old=explode("\t",$str_arrmat_old[$r_index_old]);
-	$data_read_old[$i][0]=trim($datamat_old[0]);  //name
-	$data_read_old[$i][1]=trim($datamat_old[1]);  //datatype
-	$col_in_old=2;
-	$r_index_old+=4;
-	if($datamat_old[1]==1)  //type=coninuous
-	{
-         for($j=1;$j<=101;$j++)
-         {
-           $datamat_old=explode("\t",$str_arrmat_old[$r_index_old]);
-           $data_read_old[$i][$col_in_old]=trim($datamat_old[0]);  //x data
-
-           $col_in_old++;
-           $data_read_old[$i][$col_in_old]=trim($datamat_old[1]);  //y data
-   
-           $col_in_old++;
-           $r_index_old++; // increment to point next data
-
-         } 
-	}
-	if($datamat_old[1]>1)  //type=descrete
-	{
-         $iter=$datamat_old[1];
-         for($j=1;$j<=$iter;$j++)
-         {
-           $datamat_old=explode("\t",$str_arrmat_old[$r_index_old]);
-           $data_read_old[$i][$col_in_old]=trim($datamat_old[0]);  //x data
-           $data_read_old[$i][$col_in_old]=levelmap($data_read_old[$i][$col_in_old],$data_read_old[$i][0],$levelmap);
-           $col_in_old++;
-           $data_read_old[$i][$col_in_old]=trim($datamat_old[1]);  //y data
-           $col_in_old++;
-           $r_index_old++; // increment to point next data
-
-         } 
-	}
-}
-
-
-////////////////////////////////////////////////Graphviz data read////////////////////////////////////////////////////////////////////////////////
-$grv=$dir.$keyval."graphviz_new.txt";
-$line=shell_exec('/usr/bin/dot -Tplain -y '.$grv);
-
-
-
-//$grfilename=$keyval."graphviz.txt";
-//$cmd="/usr/bin/dot -Tplain -y  $grfilename";
-//$line=system($cmd);
-
-
-//shell_exec('/usr/bin/dot -Tpng -o /var/www/html/compbio/BNW/graphviz.png /var/www/html/compbio/BNW/graphviz.txt');
-$str_arrname=array();
-$str_arrname=explode("\n",$line);
-$data=array();
-$ID_data=array();
-$i=0;
-$ii=0;
-foreach($str_arrname as $row)
-{
-  $i++;
-  if($i>1)
-  {
-       
-  	$data=explode(" ",$row);
-       $j=0;
-       $k=0;
-       $flag=0;
-  	foreach($data as $cell)
-	{
-             
-             $j++;
-             
-             $cell=trim($cell);
-             //echo $cell;
-             //echo '&nbsp';
-             if($j==1 && $cell=="node")
-             {
-                $flag=1;
-             }  
-               
-             if($j>1 && $j<5 && $flag==1)
-             {
-    		  //echo $cell;
-   		  //echo '&nbsp';
-                if($j==2)
-                   $ID_data[$ii][$k]=$cell;
-                else
-                   $ID_data[$ii][$k]=round($cell/10*900);
-               // echo $ID_data[$ii][$k];
-                //echo '&nbsp';
-
-                $k++; 
-             }
-       } 
-  
-       if($flag==1)
-       {
-          $ID_data[$ii][3]=$ID_data[$ii][1]+100;
-          $ID_data[$ii][4]=$ID_data[$ii][2]+150; 
-          $ID_data[$ii][5]=$ID_data[$ii][1]+100;
-          $ID_data[$ii][6]=$ID_data[$ii][2]; 
-          $ii++;
-          //echo "<br />"; 
-       } 
-     // echo "<br />"; 
-	
-  }
-}
-
-$nnode=$ii;
-$edge_data=array();
-
-$i=0;
-$ii=0;
-
-foreach($str_arrname as $row)
-{
-  $i++;
-  if($i>1)
-  {
-       
-  	$data=explode(" ",$row);
-       $j=0;
-       
-       $flag=0;
-       $number_of_point=0;
-       $index=0; 
-  	foreach($data as $cell)
-	{
-             $j++;
-             $cell=trim($cell);
-         
-             if($j==1 && $cell=="edge")
-             {
-                $flag=1;
-             }  
-               
-             if($j==2 && $flag==1)
-             {
-                
-                for($k=0;$k<$nnode;$k++)
-                {
-                      if($cell==$ID_data[$k][0])
-                      {
-                          $edge_data[$ii][0]=$ID_data[$k][3];
-                          $edge_data[$ii][1]=$ID_data[$k][4];
-                      }                     
-
-                }
-               
-             }
-             else if($j==3 && $flag==1)
-             {
-               for($k=0;$k<$nnode;$k++)
-                {
-                      if($cell==$ID_data[$k][0])
-                      {
-                          $edge_data[$ii][2]=$ID_data[$k][5];
-                          $edge_data[$ii][3]=$ID_data[$k][6];
-                      }                     
-
-                }
-
-             }
-             else if($j==4 && $flag==1)
-             {
-                  $edge_data[$ii][4]=$cell;
-                  $number_of_point=$cell*2;
-                  $index=5;
-             }
-             else if($j>4 && $number_of_point>0 && $flag==1)
-             {
-                if(($j%2)!=0)
-                  $edge_data[$ii][$index]=round($cell/10*900)+60;//+30+30;
-                else
-                  $edge_data[$ii][$index]=round($cell/10*900)+48;//+18+30;
-
-                $number_of_point--;
-                $index++;
-             }
-
-
-             
-       } 
-       if($flag==1)
-       {
-          $ii++;
-          //echo "<br />"; 
-       } 
- 	
-  }
-}
-
-
-$nedges=$ii;
-//echo $nedges;
-
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-<script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript">
-  google.load('visualization', '1', {packages: ['corechart']});
- </script>
- 
-
-<?php 
-$data_val="";
-
-for($i=0;$i<$nnode;$i++)
- {
-////////////////////////////select node //////////////////////////////////////
- $name=$ID_data[$i][0];
- $fname="draw_".$name."()";
- $data_val.=$name;
-$flag=0; //evidence flag
- for($j=0;$j<$node;$j++)
- {
-    if($data_read[$j][0]==$name)
-    {
-       $s_i=$j;
-       break;
-    } 
- }
- for($j=0;$j<$node_old;$j++)
- {
-    if($data_read_old[$j][0]==$name)
-    {
-       $s_i_old=$j;
-       break;
-    } 
- }
- 
-
-/////////////////////////////////Display nodes//////////////////////////////////////////////////////////
-?>    
- <script type="text/javascript">
-
-
-<?php
-  $node_type=$data_read[$s_i][1];
-  if($node_type>1) //discrete node
-  { 
-?>
- 
-  function <?php print($fname);?> {
-  // Create and populate the data table.
- 
-  <?php
- $evd=-9999;
-  for($ii=0;$ii<$cev;$ii++)
-  {
-     if($ev_arr[$ii]==$name)
-     {
-        $evd=$evdata_arr[$ii]; 
-        //$evd=levelmap($evd,$name,$levelmap);
-        $flag=1;
-        break;
-     }
-  }
-if($evd==-9999)
-{
-
-    //$pos = strpos($ev_child_arr,$name);
-    //if ($pos == false)
-    $match=ischild($ev_child_arr,$name);
-    if($match==0)
-    {
-?>
-  var data = google.visualization.arrayToDataTable([
-   ['<?php print($name);?>', 'Old'],
-<?php
-  $c_i=2; 
-  $c_i_old=2;
-  for($j=0;$j<$node_type-1;$j++) 
-  {     
-       $val1=trim($data_read[$s_i][$c_i]);
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;        
-  ?>
-   ['<?php print($val1_old);?>', <?php print($val2_old);?>],
-
-  <?php
-  }
-  if($j==$node_type-1)
-  {
-        $val1=trim($data_read[$s_i][$c_i]);
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-
-        $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;        
-  ?>
-   ['<?php print($val1_old);?>', <?php print($val2_old);?>]
-<?php
-   }
- }
- else 
- {
-   ?>
-  var data = google.visualization.arrayToDataTable([
-   ['<?php print($name);?>', 'Old', 'New'],
-<?php
-  $c_i=2; 
-  $c_i_old=2;
-  for($j=0;$j<$node_type-1;$j++) 
-  {     
-       $val1=trim($data_read[$s_i][$c_i]);
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;        
-  ?>
-   ['<?php print($val1);?>', <?php print($val2_old);?>, <?php print($val2);?>],
-
-  <?php
-  }
-  if($j==$node_type-1)
-  {
-        $val1=trim($data_read[$s_i][$c_i]);
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-
-        $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;        
-  ?>
-   ['<?php print($val1);?>', <?php print($val2_old);?>, <?php print($val2);?>]
-<?php
-   }
-  }
-}
-else
-{
-  
-?>
-  var data = google.visualization.arrayToDataTable([
-    ['<?php print($name);?>', 'Old', 'New'],
-
-<?php
- 
-  $c_i_old=2;
-  for($j=0;$j<$node_type-1;$j++) 
-  {     
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++; 
-       if($val1_old==$evd)       
-       {
-  ?>
-         ['<?php print($val1_old);?>', <?php print($val2_old);?>, 1],
-
-  <?php
-       }
-       else{
-       ?>
-         ['<?php print($val1_old);?>', <?php print($val2_old);?>, 0],
-
-<?php
-         }   
-  }
-  if($j==$node_type-1)
-  {
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-      if($val1_old==$evd)       
-       {
-      
-  ?>
-        ['<?php print($val1_old);?>', <?php print($val2_old);?>, 1]
-      <?php
-       } 
-       else{
-       ?>
-        ['<?php print($val1_old);?>', <?php print($val2_old);?>, 0] 
-<?php
-         }  
-  }
-}
-?>
- ]);
-
- 
-      
-        // Create and draw the visualization.
-      
-      var cnode="<?php print($name); ?>";
-      var keyv="<?php print($keyval);?>";
-
-    <?php if($evd!=-9999)
-             {
-                $named=$name.":".$evd;
-                $bcolor="red";
-                $font=10;
-             }
-             else
-             {
-                $named=$name;
-                $bcolor="black";
-                $font=12;
-             }
-         ?>  
-
-
-        var chart = new google.visualization.ColumnChart(document.getElementById('<?php print($name);?>'));
-        function selectHandler() {
-          var selectedItem = chart.getSelection()[0];
-          if (selectedItem) {
-            var topping = data.getValue(selectedItem.row, 0);
-            
-            var s = window.prompt('Selected evidence ' + topping + ' for ' + cnode + '. Enter new evidence ', topping );
-	    if (input_check(s))
-	      {
-		window.location.href = "add_inv_example.php?name=" + cnode + "&evidence=" + s + "&My_key=" + keyv;
-	      }
-	    else
-	      {
-		window.location.href = "input_error_no_menu.php";
-	      }
-          }
-        } 
-         chart.draw(data,
-                 {title:"<?php print($named);?>", titleTextStyle: {fontSize: <?php print($font);?>},
-                  width:<?php print($width);?>, height:<?php print($hieght);?>,
-                  hAxis: {textStyle: {fontSize:11}},
-		   vAxis: {minValue: 0, maxValue: 1, textStyle: {fontSize: 9}}, legend: {position: 'none'},
-                  backgroundColor: {stroke: '<?php print($bcolor);?>', strokeWidth: 5}}
-            );
-        google.visualization.events.addListener(chart, 'select', selectHandler);  
-
-  }
-<?php
- }
- else //continuous node
- {
-?>
-  function <?php print($fname);?> {
-  // Create and populate the data table.
-  <?php
- $evd=-9999;
-  for($ii=0;$ii<$cev;$ii++)
-  {
-     if($ev_arr[$ii]==$name)
-     {
-        $evd=$evdata_arr[$ii]; 
-        break;
-     }
-  }
-if($evd==-9999)
-{
-
-    //$pos = strpos($ev_child_arr,$name);
-    //if ($pos == false)
-    $match=ischild($ev_child_arr,$name);
-    if($match==0)
-    {
-?>
-  var data = google.visualization.arrayToDataTable([
-	[{label:'<?php print($name);?>',type:'number'},{label:'Old'}],
-<?php
-  $c_i=2;
-  $c_i_old=2;
-  for($j=0;$j<100;$j++) 
-  {
-       $val1=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;         
-
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++; 
-  ?>
-   ['<?php print($val1_old);?>', <?php print($val2_old);?>],
-
-  <?php
-  }
-  if($j==100)
-  {
-        $val1=trim($data_read[$s_i][$c_i]);
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-  
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;   
-  ?>
-   ['<?php print($val1_old);?>', <?php print($val2_old);?>]
-
-
-<?php 
-     }
-    }
-    else 
-    {
-
-?>
-  var data = google.visualization.arrayToDataTable([
-	[{label:'<?php print($name);?>',type:'number'},{label:'Old'},{label:'New'}],
-<?php
-  $c_i=2;
-  $c_i_old=2;
-  for($j=0;$j<100;$j++) 
-  {
-       $val1=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;         
-
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++; 
-  ?>
-   ['<?php print($val1);?>', <?php print($val2_old);?>, <?php print($val2);?>],
-
-  <?php
-  }
-  if($j==100)
-  {
-        $val1=trim($data_read[$s_i][$c_i]);
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;   
-  ?>
-   ['<?php print($val1);?>', <?php print($val2_old);?>, <?php print($val2);?>]
-<?php
-   }
-  }
-}
-else
-{
-    $evduse=$evd;
-?>
-  var data = google.visualization.arrayToDataTable([
-	[{label:'<?php print($name);?>',type:'number'},{label: 'Old'},{label: 'New'}],
-
-<?php
- 
-  $c_i_old=2;
-  for($j=0;$j<100;$j++) 
-  {     
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++; 
-       if($val1_old<$evduse)  
-       {
-       ?>
-         ['<?php print($val1_old);?>', <?php print($val2_old);?>, 0],
-<?php
-       }
-       else if($val1_old>=$evduse) 
-       {
-        $evduse=99999;
-       ?>
-       ['<?php print($val1_old);?>', <?php print($val2_old);?>, 1],
-     
-       <?php
-       } 
- }
-  if($j==100)
-  {
-       $val1_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-       $val2_old=trim($data_read_old[$s_i_old][$c_i_old]);
-       $c_i_old++;
-      
-  ?>
-        ['<?php print($val1_old);?>', <?php print($val2_old);?>, 0]
- 
-<?php
-  }
-}
-?>
- ]);
-      
-        // Create and draw the visualization.
-      var cnode="<?php print($name); ?>";
-      var keyv="<?php print($keyval);?>";
-     <?php if($evd!=-9999)
-             {
-                $named=$name.":".$evd;
-                $bcolor="red";
-                $font=10;
-             }
-             else
-             {
-                $named=$name;
-                $bcolor="black";
-                $font=12;
-             }
-       ?>  
-        var chart = new google.visualization.LineChart(document.getElementById('<?php print($name);?>'));
-
-        function selectHandler() {
-          var selectedItem = chart.getSelection()[0];
-          if (selectedItem) {
-           
-            var topping = data.getValue(selectedItem.row, 0);
-            var s = window.prompt('Selected evidence ' + topping + ' for ' + cnode + '. Enter new evidence ', topping );
-	    if (input_check(s))
-	      {
-		window.location.href = "add_inv_example.php?name=" + cnode + "&evidence=" + s + "&My_key=" + keyv;
-	      }
-	    else
-	      {
-		window.location.href = "input_error_no_menu.php";
-	      }
-
-          }
-        }
-            chart.draw(data, {curveType: "function",
-                  title:"<?php print($named);?>", titleTextStyle: {fontSize: <?php print($font);?>},
-			legend: {position: 'none'},
-                  width:<?php print($width);?>, height:<?php print($hieght);?>,
-		  hAxis: {gridlines: {count: 4}, textStyle: {fontSize: 9}, viewWindowMode: 'maximized'},
-                   vAxis: {maxValue: 0.5, minValue: 0,viewWindow: {min:0}, gridlines: {count:5}, textStyle: {fontSize: 9}},
-                   chartArea:{left:30,top:25,right:8,bottom:25},
-                   backgroundColor: {stroke: '<?php print($bcolor);?>', strokeWidth: 5}}
-            );
-           google.visualization.events.addListener(chart, 'select', selectHandler); 
-       }
-
-<?php
- }
-?>
-</script>
-<?php
-///////////////////////////end of display nodes////////////////////////////////////////////////
-}
-
-?>
-
-
-
-<script type="text/javascript">
-function canvas_arrow(context, fromx, fromy, tox, toy){
-    var headlen = 15;
-    var dx = tox-fromx;
-    var dy = toy-fromy;
-    var angle = Math.atan2(dy,dx);
-    context.moveTo(fromx,fromy);
-    context.lineTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle-Math.PI/6),toy-headlen*Math.sin(angle-Math.PI/6));
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle+Math.PI/6),toy-headlen*Math.sin(angle+Math.PI/6));
-}
-</script>
-
-<script type="text/javascript">
-function canvas_arrow_head(context, fromx, fromy, tox, toy){
-    var headlen = 15;
-    var dx = tox-fromx;
-    var dy = toy-fromy;
-    var angle = Math.atan2(dy,dx);
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle-Math.PI/6),toy-headlen*Math.sin(angle-Math.PI/6));
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle+Math.PI/6),toy-headlen*Math.sin(angle+Math.PI/6));
-}
-</script>
-
-
-</head>
-
-<body>
-<canvas id="test" width="3000" height="3000" style="position:absolute">
-<script>
-function canvas_arrow_draw(n, polypts,context){
-
-//Create jsGraphics object
-var headlen = 10;
-/*
-var hexno=new String;
-arr=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
-var n1=Math.round(Math.random()*15);
-var n2=Math.round(Math.random()*15);
-var n3=Math.round(Math.random()*15);
-var n4=Math.round(Math.random()*15);
-var n5=Math.round(Math.random()*15);
-var n6=Math.round(Math.random()*15);
-hexno="#"+arr[n1]+""+arr[n2]+""+arr[n3]+""+arr[n4]+""+arr[n5]+""+arr[n6];
-*/
-hexno="black";
-var polypoints = new Array();
-var n2=n*2;
-
-
-var sx=polypts[0];
-var sy=polypts[1];
- 
-var sx1=polypts[n2-4];
-var sy1=polypts[n2-3];
-var ex1=polypts[n2-2];
-var ey1=polypts[n2-1];
-
-context.beginPath();
-canvas_arrow_head(context,sx1,sy1,ex1,ey1);
-
-context.moveTo(polypts[0],polypts[1]);
-nm=n%3;
-ni=(n-nm)/3;
-
-for(i=0;i<ni;i++)
-{
-  i11=i*6+2;
-  i12=i*6+3;
-  i21=i*6+4;
-  i22=i*6+5;
-  i31=i*6+6;
-  i32=i*6+7;
-
-  context.bezierCurveTo(polypts[i11],polypts[i12],polypts[i21],polypts[i22],polypts[i31],polypts[i32]);
-  context.moveTo(polypts[i31],polypts[i32]);
-
- // polypoints[i] = new jxPoint(polypts[i1], polypts[i2]);
-}
-
-
-if(nm==2)
-{
-  context.moveTo(polypts[i21],polypts[i22]);
-  context.bezierCurveTo(polypts[i31],polypts[i32],sx1,sy1,ex1,ey1);
-  context.moveTo(ex1,ey1);
-
-}
-
- context.strokeStyle = hexno;
- context.stroke();
-
-}
-
-
-var canvas=document.getElementById("test");
-var context = canvas.getContext("2d");
-context.lineWidth = 3;
-
-<?php
-for($i=0;$i<$nedges;$i++)
-{
-
-   $n=$edge_data[$i][4]; 
-   $n2=$n*2;
-   
-?>
-var polypoints = new Array();
-var j=0;
-var n="<?php print($n);?>";
-<?php
-for($j=0;$j<$n2;$j++)
-{
-$inx=$j+5;
-$data=$edge_data[$i][$inx];
-
-?>
-	polypoints[j] = "<?php print($data);?>";
-
-       j++;
-<?php
-}
-?>
-canvas_arrow_draw(n,polypoints,context);
-<?php
-}
-?>
-
-
-
-</script>
-</canvas>
-
-
-<?php 
-for($i=0;$i<$nnode;$i++)
-{
-  $x=$ID_data[$i][1]-8; $y=$ID_data[$i][2]-20;
-  $name=$ID_data[$i][0];
-?>
-
-<script type="text/javascript">
-   google.setOnLoadCallback(draw_<?php print($name)?>);
-</script>
-<div id="<?php print($name)?>" style="left: <?php print($x)?>px; top: <?php print($y)?>px; width:<?php print($width);?>; height:<?php print($hieght);?>; position: absolute"></div>
-
-<?php 
-}
-?>
-
-
-</body>
-
-
-
-</html>
-
diff --git a/sourcecodes/network_layout_inv_example.php b/sourcecodes/network_layout_inv_example.php
deleted file mode 100644
index 076832b6..00000000
--- a/sourcecodes/network_layout_inv_example.php
+++ /dev/null
@@ -1,666 +0,0 @@
-<?php 
-  //include("structuremap.php");
-include("header_batchsearch.inc");
-include("input_validate.php");
-
-function levelmap($inx,$name,$mapdata)
-{
-
-$leve_l=array();
-$leve_l=explode("\n",$mapdata);
-$leve_d=array();
-
-foreach($leve_l as $l)
-{ 
-  $l=trim($l);
-  $leve_d=explode("\t",$l);
-  $inxname=trim($leve_d[0]);
-  $name=trim($name);
-  if($inxname==$name)
-    return $leve_d[$inx];
-}
-           
-}
-
-////////////////////////////////////Read data from net_figure file///////////////////////Graphp Display/////////////////////////////////////////////
-
-$keyval=valid_keyval($_GET["My_key"]);
-$dir="./data/";
-
-$lfile=$dir.$keyval."nlevels.txt";
-$levelmap=file_get_contents($lfile);   
-
-
-
-
-$matfile=$dir."$keyval"."net_figure.txt";
-
-
-$data_val="";
-
-$matrix=file("$matfile");
-$matrix1=file_get_contents("$matfile");              //file("$matfile");
-
-$str_arrmat=array();
-$str_arrmat=explode("\n",$matrix1);
-
-
-if($str_arrmat[2]=="" || $matrix1=="")
-{
-?>
-<h1><font color=blue>Error: Unable to display your network structure.</font></h1>
-
-<?php
-exit;
-}
-
-$datamat=array();
-$data_read=array();
- 
-$node=trim($str_arrmat[0]);
-/*
-if($node<=5)
-{
-  $width=200;
-  $height=150;
-  $font=14;
-}
-else if($node>5 && $node<=7)
-{
-  $width=150;
-  $height=120;
-  $font=12;
-
-}
-else if($node>7 && $node<=10)
-{
-  $width=110;
-  $height=85;
-  $font=10;
-}
-else 
-{
-  $width=80;
-  $height=60;
-  $font=8;
-}
-*/
-  $width=150;
-  $height=150;
-  $font=12;
-
-$r_index=$node+2;
-
-for($i=0;$i<$node;$i++)
-{
-$datamat=explode("\t",$str_arrmat[$r_index]);
-$data_read[$i][0]=trim($datamat[0]);  //name
-$data_read[$i][1]=trim($datamat[1]);  //datatype
-$col_in=2;
-$r_index+=4;
-	if($datamat[1]==1)  //type=coninuous
-	{
-         for($j=1;$j<=101;$j++)
-         {
-           $datamat=explode("\t",$str_arrmat[$r_index]);
-           $data_read[$i][$col_in]=trim($datamat[0]);  //x data
-         //  echo $data_read[$i][$col_in];
-          // echo '&nbsp';
-
-           $col_in++;
-           $data_read[$i][$col_in]=trim($datamat[1]);  //y data
-          // echo $data_read[$i][$col_in];
-	   // echo '&nbsp';
-
-           $col_in++;
-           $r_index++; // increment to point next data
-           // echo "<br />"; 
-         } 
-	}
-	if($datamat[1]>1)  //type=descrete
-	{
-         $iter=$datamat[1];
-         for($j=1;$j<=$iter;$j++)
-         {
-           $datamat=explode("\t",$str_arrmat[$r_index]);
-           $data_read[$i][$col_in]=trim($datamat[0]);  //x data
-           $data_read[$i][$col_in]=levelmap($data_read[$i][$col_in],$data_read[$i][0],$levelmap);
-
-         //  echo $data_read[$i][$col_in];
-          // echo '&nbsp';
-  
-           $col_in++;
-           $data_read[$i][$col_in]=trim($datamat[1]);  //y data
-          // echo $data_read[$i][$col_in];
-           //echo '&nbsp';
-
-           $col_in++;
-           $r_index++; // increment to point next data
-           //echo "<br />"; 
-         } 
-	}
-
-}
-
-
-
-
-////////////////////////////////////////////////Graphviz data read////////////////////////////////////////////////////////////////////////////////
-$grv=$dir.$keyval."graphviz.txt";
-$line=shell_exec('/usr/bin/dot -Tplain -y '.$grv);
-
-
-//$grfilename=$keyval."graphviz.txt";
-//$cmd="/usr/bin/dot -Tplain -y  $grfilename";
-//$line=system($cmd);
-
-
-//shell_exec('/usr/bin/dot -Tpng -o /var/www/html/compbio/BNW/graphviz.png /var/www/html/compbio/BNW/graphviz.txt');
-$str_arrname=array();
-$str_arrname=explode("\n",$line);
-$data=array();
-$ID_data=array();
-$i=0;
-$ii=0;
-foreach($str_arrname as $row)
-{
-  $i++;
-  if($i>1)
-  {
-       
-  	$data=explode(" ",$row);
-       $j=0;
-       $k=0;
-       $flag=0;
-  	foreach($data as $cell)
-	{
-             
-             $j++;
-             
-             $cell=trim($cell);
-             //echo $cell;
-             //echo '&nbsp';
-             if($j==1 && $cell=="node")
-             {
-                $flag=1;
-             }  
-               
-             if($j>1 && $j<5 && $flag==1)
-             {
-    		  //echo $cell;
-   		  //echo '&nbsp';
-                if($j==2)
-                   $ID_data[$ii][$k]=$cell;
-                else
-                   $ID_data[$ii][$k]=round($cell/10*900);
-               // echo $ID_data[$ii][$k];
-                //echo '&nbsp';
-
-                $k++; 
-             }
-       } 
-  
-       if($flag==1)
-       {
-          $ID_data[$ii][3]=$ID_data[$ii][1]+100;
-          $ID_data[$ii][4]=$ID_data[$ii][2]+150; 
-          $ID_data[$ii][5]=$ID_data[$ii][1]+100;
-          $ID_data[$ii][6]=$ID_data[$ii][2]; 
-          $ii++;
-          //echo "<br />"; 
-       } 
-     // echo "<br />"; 
-	
-  }
-}
-
-$nnode=$ii;
-$edge_data=array();
-
-$i=0;
-$ii=0;
-
-foreach($str_arrname as $row)
-{
-  $i++;
-  if($i>1)
-  {
-       
-  	$data=explode(" ",$row);
-       $j=0;
-       
-       $flag=0;
-       $number_of_point=0;
-       $index=0; 
-  	foreach($data as $cell)
-	{
-             $j++;
-             $cell=trim($cell);
-         
-             if($j==1 && $cell=="edge")
-             {
-                $flag=1;
-             }  
-               
-             if($j==2 && $flag==1)
-             {
-                
-                for($k=0;$k<$nnode;$k++)
-                {
-                      if($cell==$ID_data[$k][0])
-                      {
-                          $edge_data[$ii][0]=$ID_data[$k][3];
-                          $edge_data[$ii][1]=$ID_data[$k][4];
-                      }                     
-
-                }
-               
-             }
-             else if($j==3 && $flag==1)
-             {
-               for($k=0;$k<$nnode;$k++)
-                {
-                      if($cell==$ID_data[$k][0])
-                      {
-                          $edge_data[$ii][2]=$ID_data[$k][5];
-                          $edge_data[$ii][3]=$ID_data[$k][6];
-                      }                     
-
-                }
-
-             }
-             else if($j==4 && $flag==1)
-             {
-                  $edge_data[$ii][4]=$cell;
-                  $number_of_point=$cell*2;
-                  $index=5;
-             }
-             else if($j>4 && $number_of_point>0 && $flag==1)
-             {
-                if(($j%2)!=0)
-                  $edge_data[$ii][$index]=round($cell/10*900)+60;//+30+30;
-                else
-                  $edge_data[$ii][$index]=round($cell/10*900)+48;//+18+30;
-
-                $number_of_point--;
-                $index++;
-             }
-
-
-             
-       } 
-       if($flag==1)
-       {
-          $ii++;
-          //echo "<br />"; 
-       } 
- 	
-  }
-}
-
-
-$nedges=$ii;
-
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-<script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript">
-  google.load('visualization', '1', {packages: ['corechart']});
- </script>
- 
-
-<?php 
-$data_val="";
-
-for($i=0;$i<$nnode;$i++)
- {
-////////////////////////////select node //////////////////////////////////////
- $name=$ID_data[$i][0];
- $fname="draw_".$name."()";
- $data_val.=$name;
- for($j=0;$j<$node;$j++)
- {
-    if($data_read[$j][0]==$name)
-    {
-       $s_i=$j;
-       break;
-    } 
- }
- 
-/////////////////////////////////Display nodes//////////////////////////////////////////////////////////
-?>    
- <script type="text/javascript">
-
-
-<?php
-  $node_type=$data_read[$s_i][1];
-  if($node_type>1) //discrete node
-  { 
-?>
-  
- 
-  function <?php print($fname);?> {
-  // Create and populate the data table.
- 
-  var data = google.visualization.arrayToDataTable([
-   ['<?php print($name);?>', ''],
-  <?php
-  $c_i=2; 
-
-  for($j=0;$j<$node_type-1;$j++) 
-  {     
-       $val1=trim($data_read[$s_i][$c_i]);
-
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $data_val.="\t".$val2;
-        
-  ?>
-   ['<?php print($val1);?>', <?php print($val2);?>],
-
-  <?php
-  }
-  if($j==$node_type-1)
-  {
-        $val1=trim($data_read[$s_i][$c_i]);
-
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $data_val.="\t".$val2."\n";
-  ?> 
-    ['<?php print($val1);?>', <?php print($val2);?>]
-<?php
-  }
-?>
-  ]);
-      
-        // Create and draw the visualization.
-      
-      var cnode="<?php print($name); ?>";
-       var keyv="<?php print($keyval);?>";  
-        var chart = new google.visualization.ColumnChart(document.getElementById('<?php print($name);?>'));
-        function selectHandler() {
-          var selectedItem = chart.getSelection()[0];
-          if (selectedItem) {
-            var topping = data.getValue(selectedItem.row, 0);
-            
-            var s = window.prompt('Selected evidence ' + topping + ' for ' + cnode + '. Enter new evidence ', topping );
-	    if (input_check(s))
-	      {       
-		window.location.href = "add_inv_example.php?name=" + cnode + "&evidence=" + s + "&My_key=" + keyv;
-	      }
-	    else
-	      {
-		window.location.href = "input_error_no_menu.php";
-	      }
-            }
-        } 
-         chart.draw(data,
-                 {title:"<?php print($name);?>", titleTextStyle: {fontSize: <?php print($font);?>},
-                  width:<?php print($width);?>, height:<?php print($height);?>,
-                  hAxis: {textStyle: {fontSize:11}},
-		    vAxis: {minValue: 0, maxValue: 1, textStyle: {fontSize: 9}}, legend: {position: 'none'},
-                  backgroundColor: {stroke: 'black', strokeWidth: 5}}
-            );
-        google.visualization.events.addListener(chart, 'select', selectHandler);  
-
-  }
-<?php
- }
- else //continuous node
- {
-?>
-  function <?php print($fname);?> {
-  // Create and populate the data table.
-  var data = google.visualization.arrayToDataTable([
-						    [{label:'<?php print($name);?>', type: 'number'},{label: ''}],
-  <?php
-  $c_i=2;
-  for($j=0;$j<100;$j++) 
-  {
-       $val1=trim($data_read[$s_i][$c_i]);
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;         
-       $data_val.="\t".$val2;
-  ?>
-   ['<?php print($val1);?>', <?php print($val2);?>],
-
-  <?php
-  }
-  if($j==100)
-  {
-       $val1=trim($data_read[$s_i][$c_i]);
-
-       $c_i++;
-       $val2=trim($data_read[$s_i][$c_i]);
-       $c_i++;
-       $data_val.="\t".$val2."\n";
-  ?> 
-    ['<?php print($val1);?>', <?php print($val2);?>]
-<?php
-  }
-?>
-  ]);
-      
-        // Create and draw the visualization.
-      var cnode="<?php print($name); ?>";
-      var keyv="<?php print($keyval);?>";
-
-        var chart = new google.visualization.LineChart(document.getElementById('<?php print($name);?>'));
-
-        function selectHandler() {
-          var selectedItem = chart.getSelection()[0];
-          if (selectedItem) {
-           
-            var topping = data.getValue(selectedItem.row, 0);
-            var s = window.prompt('Selected evidence ' + topping + ' for ' + cnode + '. Enter new evidence ', topping );
-	    if (input_check(s))
-	      {
-		window.location.href = "add_inv_example.php?name=" + cnode + "&evidence=" + s + "&My_key=" + keyv;
-	      }
-	    else
-	      {
-		window.location.href = "input_error_no_menu.php";
-	      }
-          }
-        }
-            chart.draw(data, {curveType: "function",
-                  title:"<?php print($name);?>", titleTextStyle: {fontSize: <?php print($font);?>},
-			legend: {position: 'none'},
-                  width:<?php print($width);?>, height:<?php print($height);?>,
-		  hAxis: {gridlines: {count: 4}, textStyle: {fontSize: 9}, viewWindowMode: 'maximized'},
-                    vAxis: {maxValue: 0.5, minValue: 0,viewWindow: {min:0}, gridlines: {count:5}, textStyle: {fontSize: 9}},
-                    chartArea:{left:30,top:25,right:8,bottom:25},
-                  backgroundColor: {stroke: 'black', strokeWidth: 5}}
-            );
-           google.visualization.events.addListener(chart, 'select', selectHandler); 
-       }
-
-<?php
- }
-?>
-</script>
-<?php
-///////////////////////////end of display nodes////////////////////////////////////////////////
-}
-
-
-///////////////////////////////////write data to file///////////////////////////////////////////////////////////
-
-
-?>
-
-
-
-<script type="text/javascript">
-function canvas_arrow(context, fromx, fromy, tox, toy){
-    var headlen = 15;
-    var dx = tox-fromx;
-    var dy = toy-fromy;
-    var angle = Math.atan2(dy,dx);
-    context.moveTo(fromx,fromy);
-    context.lineTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle-Math.PI/6),toy-headlen*Math.sin(angle-Math.PI/6));
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle+Math.PI/6),toy-headlen*Math.sin(angle+Math.PI/6));
-}
-</script>
-
-<script type="text/javascript">
-function canvas_arrow_head(context, fromx, fromy, tox, toy){
-    var headlen = 15;
-    var dx = tox-fromx;
-    var dy = toy-fromy;
-    var angle = Math.atan2(dy,dx);
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle-Math.PI/6),toy-headlen*Math.sin(angle-Math.PI/6));
-    context.moveTo(tox,toy);
-    context.lineTo(tox-headlen*Math.cos(angle+Math.PI/6),toy-headlen*Math.sin(angle+Math.PI/6));
-}
-</script>
-
-
-</head>
-
-<body>
-<canvas id="test" width="3000" height="3000" style="position:absolute">
-<script>
-function canvas_arrow_draw(n, polypts,context){
-
-//Create jsGraphics object
-var headlen = 10;
-/*
-var hexno=new String;
-arr=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
-var n1=Math.round(Math.random()*15);
-var n2=Math.round(Math.random()*15);
-var n3=Math.round(Math.random()*15);
-var n4=Math.round(Math.random()*15);
-var n5=Math.round(Math.random()*15);
-var n6=Math.round(Math.random()*15);
-hexno="#"+arr[n1]+""+arr[n2]+""+arr[n3]+""+arr[n4]+""+arr[n5]+""+arr[n6];
-*/
-hexno="black";
-var polypoints = new Array();
-var n2=n*2;
-
-
-var sx=polypts[0];
-var sy=polypts[1];
- 
-var sx1=polypts[n2-4];
-var sy1=polypts[n2-3];
-var ex1=polypts[n2-2];
-var ey1=polypts[n2-1];
-
-context.beginPath();
-canvas_arrow_head(context,sx1,sy1,ex1,ey1);
-
-context.moveTo(polypts[0],polypts[1]);
-nm=n%3;
-ni=(n-nm)/3;
-
-for(i=0;i<ni;i++)
-{
-  i11=i*6+2;
-  i12=i*6+3;
-  i21=i*6+4;
-  i22=i*6+5;
-  i31=i*6+6;
-  i32=i*6+7;
-
-  context.bezierCurveTo(polypts[i11],polypts[i12],polypts[i21],polypts[i22],polypts[i31],polypts[i32]);
-  context.moveTo(polypts[i31],polypts[i32]);
-
- // polypoints[i] = new jxPoint(polypts[i1], polypts[i2]);
-}
-
-
-if(nm==2)
-{
-  context.moveTo(polypts[i21],polypts[i22]);
-  context.bezierCurveTo(polypts[i31],polypts[i32],sx1,sy1,ex1,ey1);
-  context.moveTo(ex1,ey1);
-
-}
-
- context.strokeStyle = hexno;
- context.stroke();
-
-}
-
-
-var canvas=document.getElementById("test");
-var context = canvas.getContext("2d");
-context.lineWidth = 3;
-
-<?php
-for($i=0;$i<$nedges;$i++)
-{
-
-   $n=$edge_data[$i][4]; 
-   $n2=$n*2;
-   
-?>
-var polypoints = new Array();
-var j=0;
-var n="<?php print($n);?>";
-<?php
-for($j=0;$j<$n2;$j++)
-{
-$inx=$j+5;
-$data=$edge_data[$i][$inx];
-
-?>
-	polypoints[j] = "<?php print($data);?>";
-
-       j++;
-<?php
-}
-?>
-canvas_arrow_draw(n,polypoints,context);
-<?php
-}
-?>
-
-
-
-</script>
-</canvas>
-
-
-<?php 
-for($i=0;$i<$nnode;$i++)
-{
-  $x=$ID_data[$i][1]-8; $y=$ID_data[$i][2]-20; 
-
-  $name=$ID_data[$i][0];
-?>
-
-<script type="text/javascript">
-   google.setOnLoadCallback(draw_<?php print($name)?>);
-</script>
-<div id="<?php print($name)?>" style="left: <?php print($x)?>px; top: <?php print($y)?>px; width:<?php print($width);?>; height:<?php print($height);?>; position: absolute"></div>
-
-<?php 
-}
-?>
-
-
-</body>
-
-
-
-</html>
-
-
diff --git a/sourcecodes/parameter_display.php b/sourcecodes/parameter_display.php
index 1d65a11f..df85468c 100644
--- a/sourcecodes/parameter_display.php
+++ b/sourcecodes/parameter_display.php
@@ -1,19 +1,130 @@
+<head>
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
 <?php 
+include("header_new.inc");
 include("input_validate.php");
-$keyval=valid_keyval($_GET["My_key"]); 
+$keyval=valid_keyval($_GET["My_key"]);
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+
+$param_file = $keyval."parameters.txt";
+$param_ev_file = $keyval."parameters_ev.txt";
+
 ?>
 
-<h3> <a href=<?php $d="./data/".$keyval."parameters.txt"; print($d);?>>View original parameters</a></h3>
-<br>
+</head>
 
-<br>
 
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
+  <li><a href="about_this_page.php#parameters">About this page</a>
+  <li><a href="help.php">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+<body>
+  <div class='table_div' id='parameter_div'>
+  <?php 
+  $table_text = json_encode(file("file://".$dir.$param_file));
+  ?>
+  <script type="text/javascript">
+  d3.text("", function(error, raw){
+      var data1 = <?php echo $table_text;?>;
+      var data2 = data1.join("");
+      var data = data2.split("\n\n");
+      var dsv = d3.dsvFormat("\t");
+   var i;
+   for (i = 0; i < data.length; i++) {
+     var data_temp = data[i].split("\n");
+     var caption_text = data_temp.shift();
+     var data_temp = data_temp.join("\n");
+     var newDiv = document.createElement('div');
+     newDiv.id = 'table_div'+i;
+     newDiv.className = 'd3_table';
+     var dataCurrent = dsv.parse(data_temp);
+     var div_id = '#table_div'+i;
+     var paramDiv = document.getElementById("parameter_div");
+     paramDiv.appendChild(newDiv);
+     tabulate_caption(div_id,dataCurrent,caption_text);
+   }
+   if (error) throw error;
+   add_header();
+    });
+</script>
+<?php
+if(file_exists($dir.$param_ev_file)) 
+{
+$table_text = json_encode(file("file://".$dir.$param_ev_file));
+?>
+  <script type="text/javascript">
+  d3.text("", function(error, raw){
+      var data1 = <?php echo $table_text;?>;
+      var data2 = data1.join("");
+      var data = data2.split("\n\n");
+      var dsv = d3.dsvFormat("\t");
+   var i;
+   for (i = 1000; i < data.length + 1000; i++) {
+     var data_temp = data[i-1000].split("\n");
+     var caption_text = data_temp.shift();
+     var data_temp = data_temp.join("\n");
+     var newDiv = document.createElement('div');
+     newDiv.id = 'table_div'+i;
+     newDiv.className = 'd3_table';
+     var dataCurrent = dsv.parse(data_temp);
+     var div_id = '#table_div'+i;
+     var paramDiv = document.getElementById("parameter_div");
+     paramDiv.appendChild(newDiv);
+     tabulate_caption(div_id,dataCurrent,caption_text);
+   }
+   if (error) throw error;
+   add_header2();
+    });
+</script>
+<?php
+}
+?>
+</div>
+<div id="table_header">
+<h3 id="header">Original network parameters</h3>
+</div>
+<div id="download">
+&nbsp;&nbsp;&nbsp;&nbsp;<a class=button2 target="_blank" href="<?php print("reroute.php?".$param_file);?>">Download original parameters</a><br><br>
 <?php
-$filename="./data/".$keyval."parameters_ev.txt";
-if(file_exists($filename)) 
+if(file_exists($dir.$param_ev_file)) 
 {?>
-<h3> <a href=<?php $d="./data/".$keyval."parameters_ev.txt"; print($d);?>>View parameters after added evidence or intervention</a></h3>
-<br>
+<h3> Network parameters considering evidence/intervention</h3>
 <?php
 }
 ?>
+</div>
+  <script type="text/javascript">
+  function add_header() {
+  var element = document.getElementById("table_header");
+  var parentNode = document.getElementById("parameter_div");
+  console.log(parentNode);
+  parentNode.insertBefore(element,parentNode.firstChild);
+  var element = document.getElementById("download");
+  parentNode.appendChild(element);
+}
+</script>
+<?php
+if(file_exists($dir.$param_ev_file)) 
+{?>
+<div id="download2">
+&nbsp;&nbsp;&nbsp;&nbsp;<a class=button2 href="<?php print("reroute.php?".$param_ev_file);?>">Download parameters considering evidence/intervention</a><br><br>
+</div>
+<?php
+}
+?>
+  <script type="text/javascript">
+  function add_header2() {
+  var parentNode = document.getElementById("parameter_div");
+  var element = document.getElementById("download2");
+  parentNode.appendChild(element);
+}
+</script>
+
+</body>
diff --git a/sourcecodes/parameter_display.php.bk b/sourcecodes/parameter_display.php.bk
new file mode 100644
index 00000000..dedfa3cb
--- /dev/null
+++ b/sourcecodes/parameter_display.php.bk
@@ -0,0 +1,19 @@
+<?php 
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]); 
+?>
+
+<h3> <a href=<?php $d="./data/".$keyval."parameters.txt"; print($d);?>>View original parameters</a></h3>
+<br>
+
+<br>
+
+<?php
+$filename="/tmp/bnw/".$keyval."parameters_ev.txt";
+if(file_exists($filename)) 
+{?>
+<h3> <a href=<?php $d="./data/".$keyval."parameters_ev.txt"; print($d);?>>View parameters after added evidence or intervention</a></h3>
+<br>
+<?php
+}
+?>
diff --git a/sourcecodes/parameter_learning/Predictmultiple.m b/sourcecodes/parameter_learning/Predictmultiple.m
index a7236e35..2abd1df9 100644
--- a/sourcecodes/parameter_learning/Predictmultiple.m
+++ b/sourcecodes/parameter_learning/Predictmultiple.m
@@ -79,7 +79,7 @@ end
 
 filename=strcat(pre,'net_figure_new.txt');
 
-drawFigureM(nnodes,bnet,labels,filename,cases,stdevs,means,select_var_new,select_var_data_new);
+drawFigureM(nnodes,bnet,labels,filename,cases,stdevs,means,select_var_new,select_var_data_new,pre);
 
 writeParameters_ev(pre,bnet,nnodes,labels,cases,stdevs,means,select_var_new,select_var_data_new);
 
diff --git a/sourcecodes/parameter_learning/Predictmultipleintervention.m b/sourcecodes/parameter_learning/Predictmultipleintervention.m
index 7e6140a9..b4ad58b8 100644
--- a/sourcecodes/parameter_learning/Predictmultipleintervention.m
+++ b/sourcecodes/parameter_learning/Predictmultipleintervention.m
@@ -100,7 +100,7 @@ end
 
 filename=strcat(pre,'net_figure_new.txt');
 
-drawFigureM(nnodes,bnet,labels,filename,cases,stdevs,means,select_var_new,select_var_data_new);
+drawFigureM(nnodes,bnet,labels,filename,cases,stdevs,means,select_var_new,select_var_data_new,pre);
 
 writeParameters_int(pre,bnet,nnodes,labels,cases,stdevs,means,select_var_new,select_var_data_new);
 
diff --git a/sourcecodes/parameter_learning/code_backup/Predictmultiple.m b/sourcecodes/parameter_learning/code_backup/Predictmultiple.m
deleted file mode 100644
index 9d107628..00000000
--- a/sourcecodes/parameter_learning/code_backup/Predictmultiple.m
+++ /dev/null
@@ -1,72 +0,0 @@
-function Predictmultiple(pre)
-dfile=strcat(pre,'structure_input.txt');
-sfile=dfile;
-dfile=strcat(pre,'continuous_input.txt');
-nnodefile=strcat(pre,'nnode.txt');
-
-fnnode = fopen(nnodefile,'r');
-nnodes = fscanf(fnnode,'%d');
-
-Std_flag=true;
-[labels,cases,bnet]=readInput(dfile,sfile,nnodes,Std_flag);
-
-[bnet]=parameterLearning(bnet,cases);
-
-fvarfile=strcat(pre,'var.txt');
-fvar = fopen(fvarfile,'r');                         
-select_var_new = fscanf(fvar,'%d');
-
-fvardfile=strcat(pre,'vardata.txt');
-fvard = fopen(fvardfile,'r');
-select_var_data_new = fscanf(fvard,'%f');
-
-means_orig = cell(1,nnodes);
-stdevs_orig = cell(1,nnodes);
-labels_orig = cell(1,nnodes);
-%Read in original means and standard deviations
-mapfile = strcat(pre,'map.txt');
-fmap = fopen(mapfile,'r');
-for i=1:nnodes
-    buffer = fgetl(mapfile);
-    temp = cell(1,3);
-    for j=1:3
-        [next,buffer] = strtok(buffer);
-        temp{j} = next;
-    end
-    labels_orig{i} = temp{1};
-    means_orig{i} = str2num(temp{3});
-    stdevs_orig{i} = str2num(temp{2});
-end
-fclose(fmap);
-
-%Need to map the means and stdevs to the correct labels
-means = cell(1,nnodes);
-stdevs = cell(1,nnodes);
-%Read in labels in new order.
-labelsnew = cell(1,nnodes);
-mapdatafile = strcat(pre,'mapdata.txt');
-fmapdata = fopen(mapdatafile,'r');
-buffer = fgetl(fmapdata);
-for i = 1:nnodes
-    [next,buffer ] = strtok(buffer);
-    labelsnew{i} = next;
-end
-fclose(fmapdata);
-for i = 1:nnodes
-    for j = 1:nnodes
-       if strcmp(labelsnew{i},labels_orig{j})
-          means{i} = means_orig{j};
-          stdevs{i} = stdevs_orig{j};
-          break
-       end
-    end
-end
-
-
-filename=strcat(pre,'net_figure_new.txt');
-
-drawFigureM(nnodes,bnet,labels,filename,cases,stdevs,means,select_var_new,select_var_data_new);
-
-writeParameters_ev(pre,bnet,nnodes,labels,cases,stdevs,means,select_var_new,select_var_data_new);
-
-end
diff --git a/sourcecodes/parameter_learning/code_backup/Predictmultipleintrvention.m b/sourcecodes/parameter_learning/code_backup/Predictmultipleintrvention.m
deleted file mode 100644
index e9f741f2..00000000
--- a/sourcecodes/parameter_learning/code_backup/Predictmultipleintrvention.m
+++ /dev/null
@@ -1,95 +0,0 @@
-function Predictmultipleintrvention(pre)
-dfile=strcat(pre,'structure_input.txt');
-sfile=dfile;
-dfile=strcat(pre,'continuous_input.txt');
-nnodefile=strcat(pre,'nnode.txt');
-
-fnnode = fopen(nnodefile,'r');
-nnodes = fscanf(fnnode,'%d');
-
-fvarnamefile=strcat(pre,'varname.txt');
-
-varfile = fopen(fvarnamefile,'r');
-
-Std_flag=true;
-[labels,cases,bnet]=readInput(dfile,sfile,nnodes,Std_flag);
-
-[bnet]=parameterLearning(bnet,cases);
-
-fvarfile=strcat(pre,'var.txt');
-fvar = fopen(fvarfile,'r');                           
-select_var_new = fscanf(fvar,'%d');
-
-nm = numel(select_var_new);
-
-varlabels = cell(1,nm);
-varbuffer = fgetl(varfile);    %get header line as a string
-for j=1:nm
-    [varnext,varbuffer] = strtok(varbuffer);
-    varlabels{j} = varnext;
-    for i=1:nnodes    
-        if strcmp(varlabels{j},labels{i})
-            select_var_new(j)=i;
-        end
-     end    
-    
-end
-
-
-
-
-fvardfile=strcat(pre,'vardata.txt');
-
-fvard = fopen(fvardfile,'r');
-
-select_var_data_new = fscanf(fvard,'%f');
-
-means_orig = cell(1,nnodes);
-stdevs_orig = cell(1,nnodes);
-labels_orig = cell(1,nnodes);
-%Read in original means and standard deviations
-mapfile = strcat(pre,'map.txt');
-fmap = fopen(mapfile,'r');
-for i=1:nnodes
-    buffer = fgetl(mapfile);
-    temp = cell(1,3);
-    for j=1:3
-        [next,buffer] = strtok(buffer);
-        temp{j} = next;
-    end
-    labels_orig{i} = temp{1};
-    means_orig{i} = str2num(temp{3});
-    stdevs_orig{i} = str2num(temp{2});
-end
-fclose(fmap);
-
-%Need to map the means and stdevs to the correct labels
-means = cell(1,nnodes);
-stdevs = cell(1,nnodes);
-%Read in labels in new order.
-labelsnew = cell(1,nnodes);
-mapdatafile = strcat(pre,'mapdata.txt');
-fmapdata = fopen(mapdatafile,'r');
-buffer = fgetl(fmapdata);
-for i = 1:nnodes
-    [next,buffer ] = strtok(buffer);
-    labelsnew{i} = next;
-end
-fclose(fmapdata);
-for i = 1:nnodes
-    for j = 1:nnodes
-       if strcmp(labelsnew{i},labels_orig{j})
-          means{i} = means_orig{j};
-          stdevs{i} = stdevs_orig{j};
-          break
-       end
-    end
-end
-
-filename=strcat(pre,'net_figure_new.txt');
-
-drawFigureM(nnodes,bnet,labels,filename,cases,stdevs,means,select_var_new,select_var_data_new);
-
-writeParameters_int(pre,bnet,nnodes,labels,cases,stdevs,means,select_var_new,select_var_data_new);
-
-end
diff --git a/sourcecodes/parameter_learning/code_backup/checkDiscreteNodes.m b/sourcecodes/parameter_learning/code_backup/checkDiscreteNodes.m
deleted file mode 100644
index c9d0692c..00000000
--- a/sourcecodes/parameter_learning/code_backup/checkDiscreteNodes.m
+++ /dev/null
@@ -1,37 +0,0 @@
-function [ ] = checkDiscreteNodes( bnet, cases)
-    %checkDiscreteNodes Checks if states of discrete nodes are be integers from 1 to M
-    %   where M is the number of states of the node.  (M should be the same as
-    %   node_sizes in the bnet).
-    % 
-    %Input:
-    %   bnet: BNT bnet
-    %   cases: cell array of data
-    %
-%
-node_sizes = bnet.node_sizes;
-dnodes = bnet.dnodes;
-ndisc = size(dnodes,2);
-ncases = size(cases,2);
-
-%check to see that all data for discrete nodes are integers
-for i = 1:ndisc
-    inode = dnodes(i);
-    data = cases(inode,:);
-    isize = node_sizes(inode);
-    states = zeros(1,isize);
-    for j = 1:isize
-        states(j) = j;
-    end
-    for j = 1:ncases
-        k = int64(data{j});
-        if ~any(k==states)
-            error(['Discrete nodes must be integers from 1 to the number of states']);
-        end
-    end
-end
-
-    
-end
-
-
-
diff --git a/sourcecodes/parameter_learning/code_backup/checkStructure.m b/sourcecodes/parameter_learning/code_backup/checkStructure.m
deleted file mode 100644
index b4de9403..00000000
--- a/sourcecodes/parameter_learning/code_backup/checkStructure.m
+++ /dev/null
@@ -1,78 +0,0 @@
-function [ labels, cases, dag, node_sizes, ord_flag ] = checkStructure(labels, cases, dag, node_sizes)
-    %checkStructure Check to see if nodes are sorted correctly.  Nodes must be
-    %   in topological order (i.e., parents before children) before parameter
-    %   learning can take place. This function performs this sorting.
-    %
-    %Input and output have the same meaning.  The output has just been
-    %topologically ordered.
-    %   labels = cell array with the names of the nodes.
-    %   cases = cell array with the data.
-    %   dag = matrix with the strucutre of the network.
-    %   node_sizes = vector with the size of each node.
-
-%make connections array
-%count how big you need the connections array to be
-nnodes = size(dag,1);
-narcs = 0;
-for i = 1:nnodes
-    for j = 1:nnodes
-        if dag(i,j) == 1
-            narcs = narcs + 1;
-        end
-    end
-end
-%fill connections array with label names
-connections = cell(narcs,2);
-ncount = 0;
-for i = 1:nnodes
-    for j = 1:nnodes
-        if dag(i,j) == 1
-            ncount = ncount + 1;
-            connections{ncount,1} = labels{i};
-            connections{ncount,2} = labels{j};
-        end
-    end
-end
-
-%get topologically sorted dag and labels
-[new_dag, new_labels] = mk_adj_mat(connections, labels, 1);
-
-%check to see if order changed
-ord_flag = 0;
-for i = 1:nnodes
-    if ~strcmp(new_labels{i},labels{i})
-        ord_flag = 1;
-    end
-end
-
-if ord_flag
-    %get new ordering of nodes
-    order = cell(1,nnodes);
-    for i = 1:nnodes
-        for j = 1:nnodes
-            if strcmp(new_labels{j},labels{i})
-                order{i} = j;
-            end
-        end
-    end
-
-    %reorder cases and node_sizes
-    new_cases = cell(size(cases));
-    for i = 1:nnodes
-        new_cases(order{i},:) = cases(i,:);
-    end
-    new_node_sizes = zeros(1,nnodes);
-    for i = 1:nnodes
-        new_node_sizes(order{i}) = node_sizes(i);
-    end
-
-
-    dag = new_dag;
-    cases = new_cases;
-    node_sizes = new_node_sizes;
-    labels = new_labels;    
-end
-
-end
-%end checkStructure.m
-
diff --git a/sourcecodes/parameter_learning/code_backup/drawFigure.m b/sourcecodes/parameter_learning/code_backup/drawFigure.m
deleted file mode 100644
index f84bffa3..00000000
--- a/sourcecodes/parameter_learning/code_backup/drawFigure.m
+++ /dev/null
@@ -1,390 +0,0 @@
-function [] = drawFigure(nnodes,bnet,labels,filename,cases,stdevs,means,selectvar,selectdata)
-%drawFigure writes the parameters and data that are needed to draw the
-%structure of a Bayesian network for BNW.
-% This is the first function that
-
-
-
-if nargin < 8,
-    drawFigureNoEv(nnodes,bnet,labels,filename,cases,stdevs,means);
-else
-    drawFigureEv(nnodes,bnet,labels,filename,cases,stdevs,means,selectvar,selectdata);
-end;
-
-end
-
-
-
-function [] = drawFigureEv(nnodes,bnet,labels,filename,cases,stdevs,means,selectvar,selectdata)
-%Function to use if there is no entered evidence. 
-%         
-%
-%Before each printed line, I will have a line that starts with %%%
-% that describes what will be on that line
-
-%Create an empty evidence cell array.
-
-%val=cases;
-%for i = 1:nnodes
-% val(i,1)=val(i,2);
-
-%end
-
-A=cell2mat(cases');
-Amax=max(A);
-Amin=min(A);
-
-
-evidence = cell(1,nnodes);
-engine = jtree_inf_engine(bnet);
-
-evidence{selectvar}=selectdata;
-
-[engine,loglik]=enter_evidence(engine,evidence);
-
-%Open the file, and write the nodes to a file.
-fileID = fopen(filename,'w');
-
-%%%%Evidence node
-fprintf(fileID,'%i\n',selectvar);
-%%% The number of nodes
-fprintf(fileID,'%i\n',nnodes);
-%Get canvas size
-labels_temp = cellstr(labels);
-[x,y] = make_layout(bnet.dag);
-
-x = x - min(x);
-y = 1 - y;
-y = y - min(y);
-
-[x_dim,y_dim] = canvasSize(nnodes,x,y);
-
-%%% The dimensions of the canvas for the javascript code
-fprintf(fileID,'%i\t%i\t\n',x_dim,y_dim)
-
-x = x*x_dim;
-y = y*y_dim;
-for i = 1:nnodes,
-%%% The name and X- and Y-positions of each node
-    fprintf(fileID,'%s\t%i\t%i\n',labels{i},round(x(i)),round(y(i)));
-end
-
-%Get the number of parents and children for each node.
-num_par = zeros(1,nnodes);
-%For parents, sum down columns
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(j,i) == 1,
-            num_par(i) = num_par(i) + 1;
-        end
-    end
-end
-num_child = zeros(1,nnodes);
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(i,j) == 1,
-            num_child(i) = num_child(i) + 1;
-        end
-    end
-end
-
-
-for i = 1:nnodes,
-    %%% The name and type of each node (1=continuous, the number of states
-    %%% if it is discrete
-    fprintf(fileID,'%s\t%i\n',labels{i},bnet.node_sizes(i));
-    %%% The size of the node, I am going to keep them 
-    %%% 250(width) by 150(height) for now
-    %Could modify this to change the width based on the length of the node
-    %name
-    fprintf(fileID,'%i\t%i\n',250,150);
-    %%% The number of parents of the node, and the parents
-    if num_par(i) == 0;
-        %%% If no parents:
-        fprintf(fileID,'%i\n',num_par(i));
-    else
-        parents = zeros(1,num_par(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(j,i) == 1,
-             parents(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_par(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_par(i),parents(1,:));
-    end
-    
-    
-    %%% The number of children of the node, and the children
-    if num_child(i) == 0;
-        %%% If no children:
-        fprintf(fileID,'%i\n',num_child(i));
-    else
-        children = zeros(1,num_child(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(i,j) == 1,
-             children(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_child(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_child(i),children(1,:));
-    end
-    
-    predict = marginal_nodes(engine,i);
-    if isempty(evidence{i})
-      if bnet.node_sizes(i) ~= 1,
-        for j = 1:bnet.node_sizes(i),
-            %%%For discrete nodes, the state and the percent of that state
-            fprintf(fileID,'%i\t%6.4f\n',j,predict.T(j));
-        end;
-      else
-
-        [x_vals,y_vals] = calcGaussian(predict.mu,predict.Sigma,Amax(i),Amin(i));
-        %%%For continuous nodes, print x and the pdf of a normal curve.
-        for j = 1:101,
-            %%Undo standardization
-            xvals(j,1) = xvals(j,1)*stdevs{i}+means{i}
-            fprintf(fileID,'%6.4f\t%6.4f\n',x_vals(j,1),y_vals(j,1));
-        end;
-      end;
-    else
-      fprintf(fileID,'%6.4f\t%6.4f\n',selectdata,1);
-    end
-    
-end
-%fprintf(fileID,'%s\t %\n',labels_temp{:});
-
-
-fclose(fileID);
-
-end
-
-
-
-
-
-
-function [] = drawFigureNoEv(nnodes,bnet,labels,filename,cases,stdevs,means)
-%Function to use if there is no entered evidence. 
-%         
-%
-%Before each printed line, I will have a line that starts with %%%
-% that describes what will be on that line
-A=cell2mat(cases');
-Amax=max(A);
-Amin=min(A);
-
-%Create an empty evidence cell array.
-evidence = cell(1,nnodes);
-engine = jtree_inf_engine(bnet);
-[engine,loglik] = enter_evidence(engine,evidence);
-
-%Open the file, and write the nodes to a file.
-fileID = fopen(filename,'w');
-%%% The number of nodes
-fprintf(fileID,'%i\n',nnodes);
-
-%Get canvas size
-
-labels_temp = cellstr(labels);
-[x,y] = make_layout(bnet.dag);
-%[x,y] = layout_dag(bnet.dag);
-
-
-x = x - min(x);
-y = 1 - y;
-y = y - min(y);
-
-[x_dim,y_dim] = canvasSize(nnodes,x,y);
-
-%%% The dimensions of the canvas for the javascript code
-fprintf(fileID,'%i\t%i\t\n',x_dim,y_dim)
-
-x = x*x_dim;
-y = y*y_dim;
-for i = 1:nnodes,
-%%% The name and X- and Y-positions of each node
-    fprintf(fileID,'%s\t%i\t%i\n',labels{i},round(x(i)),round(y(i)));
-end
-
-%Get the number of parents and children for each node.
-num_par = zeros(1,nnodes);
-%For parents, sum down columns
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(j,i) == 1,
-            num_par(i) = num_par(i) + 1;
-        end
-    end
-end
-num_child = zeros(1,nnodes);
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(i,j) == 1,
-            num_child(i) = num_child(i) + 1;
-        end
-    end
-end
-
-
-for i = 1:nnodes,
-    %%% The name and type of each node (1=continuous, the number of states
-    %%% if it is discrete
-    fprintf(fileID,'%s\t%i\n',labels{i},bnet.node_sizes(i));
-    %%% The size of the node, I am going to keep them 
-    %%% 250(width) by 150(height) for now
-    %Could modify this to change the width based on the length of the node
-    %name
-    fprintf(fileID,'%i\t%i\n',250,150);
-    %%% The number of parents of the node, and the parents
-    if num_par(i) == 0;
-        %%% If no parents:
-        fprintf(fileID,'%i\n',num_par(i));
-    else
-        parents = zeros(1,num_par(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(j,i) == 1,
-             parents(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_par(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_par(i),parents(1,:));
-    end
-    
-    
-    %%% The number of children of the node, and the children
-    if num_child(i) == 0;
-        %%% If no children:
-        fprintf(fileID,'%i\n',num_child(i));
-    else
-        children = zeros(1,num_child(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(i,j) == 1,
-             children(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_child(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_child(i),children(1,:));
-    end
-    
-    predict = marginal_nodes(engine,i);
-    if bnet.node_sizes(i) ~= 1,
-        for j = 1:bnet.node_sizes(i),
-            %%%For discrete nodes, the state and the percent of that state
-            fprintf(fileID,'%i\t%6.4f\n',j,predict.T(j));
-        end;
-    else
-        %cases(i)
-       % MAX(cases(i))
-       % MIN(cases(i))
-        [x_vals,y_vals] = calcGaussian(predict.mu,predict.Sigma,Amax(i),Amin(i));
-        %%%For continuous nodes, print x and the pdf of a normal curve.
-        for j = 1:101,
-            %%Undo standardization
-            x_vals(j,1) = x_vals(j,1)*stdevs{i}+means{i};
-            fprintf(fileID,'%6.4f\t%6.4f\n',x_vals(j,1),y_vals(j,1));
-        end;
-    end;
-end
-%fprintf(fileID,'%s\t %\n',labels_temp{:});
-
-
-fclose(fileID);
-
-end
-
-
-function [x_dim, y_dim] = canvasSize(nnodes,x,y)
-%canvasSize Function to calculate the size of the canvas to
-%           build the network structure
-
-
-%I am going to assume that the node size will be
-% height = 150, width = 250
-% so there will be a node spacing of 
-% 200 (in y-dim) and 300 (in x-dim).
-y_space = 200;
-x_space = 300;
-
-%Set default minimum x and y dimensions
-x_dim = 1200;
-y_dim = 1200;
-
-%get unique y values
-y_unique = unique(y);
-size_y = size(y_unique,2);
-y_dim_temp = size_y*y_space;
-
-%get the maximum nodes in any layer
-size_x = zeros(1,size_y);
-for i = 1:size_y,
-    for j = 1:nnodes,
-        if y_unique(i) == y(j),
-            size_x(1,i) = size_x(1,i) + 1;
-        end;
-    end;
-end;
-size_x = max(size_x);
-x_dim_temp = size_x*x_space;
-
-if x_dim_temp > x_dim,
-    x_dim = x_dim_temp;
-end;
-
-if y_dim_temp > y_dim,
-    y_dim = y_dim_temp;
-end;
-end
-
-function [x_vals,y_vals] = calcGaussian(mu,Sigma,maxval,minval)
-%Function to calculate 101 points of Gaussian function to use in plotting
-% Gets the probability density of the mean value and 50 evenly spaced
-% points up to 3Sigma below the mean and 50 evenly space points up to
-% 3Sigma above the mean.
-%maxval
-%minval
-x_vals = zeros(101,1);
-y_vals = zeros(101,1);
-
-%x_vals(1,1) = mu - 3*Sigma;
-x_vals(1,1) = minval - 1;
-gap=((maxval+1)-(minval - 1))/100;
-%x_vals(1,1) = 0;%mu - 3*Sigma;
-for i = 1:100,
-   % x_vals(i+1,1) = x_vals(1,1) + i*6*Sigma/100;
-    x_vals(i+1,1) = x_vals(i,1) + gap;
- %x_vals(i+1,1) = x_vals(i,1) + 1/100;
-end
-
-for i = 1:101,
-    y_vals(i,1) = normpdf(x_vals(i,1),mu,Sigma);
-end
-
-end
diff --git a/sourcecodes/parameter_learning/code_backup/drawFigure.m~ b/sourcecodes/parameter_learning/code_backup/drawFigure.m~
deleted file mode 100644
index 404a65f7..00000000
--- a/sourcecodes/parameter_learning/code_backup/drawFigure.m~
+++ /dev/null
@@ -1,388 +0,0 @@
-function [] = drawFigure(nnodes,bnet,labels,filename,cases,stdevs,means,selectvar,selectdata)
-%drawFigure writes the parameters and data that are needed to draw the
-%structure of a Bayesian network.
-
-
-if nargin < 8,
-    drawFigureNoEv(nnodes,bnet,labels,filename,cases,stdevs,means);
-else
-    drawFigureEv(nnodes,bnet,labels,filename,cases,stdevs,means,selectvar,selectdata);
-end;
-
-end
-
-
-
-function [] = drawFigureEv(nnodes,bnet,labels,filename,cases,stdevs,means,selectvar,selectdata)
-%Function to use if there is no entered evidence. 
-%         
-%
-%Before each printed line, I will have a line that starts with %%%
-% that describes what will be on that line
-
-%Create an empty evidence cell array.
-
-%val=cases;
-%for i = 1:nnodes
-% val(i,1)=val(i,2);
-
-%end
-
-A=cell2mat(cases');
-Amax=max(A);
-Amin=min(A);
-
-
-evidence = cell(1,nnodes);
-engine = jtree_inf_engine(bnet);
-
-evidence{selectvar}=selectdata;
-
-[engine,loglik]=enter_evidence(engine,evidence);
-
-%Open the file, and write the nodes to a file.
-fileID = fopen(filename,'w');
-
-%%%%Evidence node
-fprintf(fileID,'%i\n',selectvar);
-%%% The number of nodes
-fprintf(fileID,'%i\n',nnodes);
-%Get canvas size
-labels_temp = cellstr(labels);
-[x,y] = make_layout(bnet.dag);
-
-x = x - min(x);
-y = 1 - y;
-y = y - min(y);
-
-[x_dim,y_dim] = canvasSize(nnodes,x,y);
-
-%%% The dimensions of the canvas for the javascript code
-fprintf(fileID,'%i\t%i\t\n',x_dim,y_dim)
-
-x = x*x_dim;
-y = y*y_dim;
-for i = 1:nnodes,
-%%% The name and X- and Y-positions of each node
-    fprintf(fileID,'%s\t%i\t%i\n',labels{i},round(x(i)),round(y(i)));
-end
-
-%Get the number of parents and children for each node.
-num_par = zeros(1,nnodes);
-%For parents, sum down columns
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(j,i) == 1,
-            num_par(i) = num_par(i) + 1;
-        end
-    end
-end
-num_child = zeros(1,nnodes);
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(i,j) == 1,
-            num_child(i) = num_child(i) + 1;
-        end
-    end
-end
-
-
-for i = 1:nnodes,
-    %%% The name and type of each node (1=continuous, the number of states
-    %%% if it is discrete
-    fprintf(fileID,'%s\t%i\n',labels{i},bnet.node_sizes(i));
-    %%% The size of the node, I am going to keep them 
-    %%% 250(width) by 150(height) for now
-    %Could modify this to change the width based on the length of the node
-    %name
-    fprintf(fileID,'%i\t%i\n',250,150);
-    %%% The number of parents of the node, and the parents
-    if num_par(i) == 0;
-        %%% If no parents:
-        fprintf(fileID,'%i\n',num_par(i));
-    else
-        parents = zeros(1,num_par(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(j,i) == 1,
-             parents(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_par(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_par(i),parents(1,:));
-    end
-    
-    
-    %%% The number of children of the node, and the children
-    if num_child(i) == 0;
-        %%% If no children:
-        fprintf(fileID,'%i\n',num_child(i));
-    else
-        children = zeros(1,num_child(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(i,j) == 1,
-             children(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_child(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_child(i),children(1,:));
-    end
-    
-    predict = marginal_nodes(engine,i);
-    if isempty(evidence{i})
-      if bnet.node_sizes(i) ~= 1,
-        for j = 1:bnet.node_sizes(i),
-            %%%For discrete nodes, the state and the percent of that state
-            fprintf(fileID,'%i\t%6.4f\n',j,predict.T(j));
-        end;
-      else
-
-        [x_vals,y_vals] = calcGaussian(predict.mu,predict.Sigma,Amax(i),Amin(i));
-        %%%For continuous nodes, print x and the pdf of a normal curve.
-        for j = 1:101,
-            %%Undo standardization
-            xvals(j,1) = xvals(j,1)*stdevs{i}+means{i}
-            fprintf(fileID,'%6.4f\t%6.4f\n',x_vals(j,1),y_vals(j,1));
-        end;
-      end;
-    else
-      fprintf(fileID,'%6.4f\t%6.4f\n',selectdata,1);
-    end
-    
-end
-%fprintf(fileID,'%s\t %\n',labels_temp{:});
-
-
-fclose(fileID);
-
-end
-
-
-
-
-
-
-function [] = drawFigureNoEv(nnodes,bnet,labels,filename,cases,stdevs,means)
-%Function to use if there is no entered evidence. 
-%         
-%
-%Before each printed line, I will have a line that starts with %%%
-% that describes what will be on that line
-A=cell2mat(cases');
-Amax=max(A);
-Amin=min(A);
-
-%Create an empty evidence cell array.
-evidence = cell(1,nnodes);
-engine = jtree_inf_engine(bnet);
-[engine,loglik] = enter_evidence(engine,evidence);
-
-%Open the file, and write the nodes to a file.
-fileID = fopen(filename,'w');
-%%% The number of nodes
-fprintf(fileID,'%i\n',nnodes);
-
-%Get canvas size
-
-labels_temp = cellstr(labels);
-[x,y] = make_layout(bnet.dag);
-%[x,y] = layout_dag(bnet.dag);
-
-
-x = x - min(x);
-y = 1 - y;
-y = y - min(y);
-
-[x_dim,y_dim] = canvasSize(nnodes,x,y);
-
-%%% The dimensions of the canvas for the javascript code
-fprintf(fileID,'%i\t%i\t\n',x_dim,y_dim)
-
-x = x*x_dim;
-y = y*y_dim;
-for i = 1:nnodes,
-%%% The name and X- and Y-positions of each node
-    fprintf(fileID,'%s\t%i\t%i\n',labels{i},round(x(i)),round(y(i)));
-end
-
-%Get the number of parents and children for each node.
-num_par = zeros(1,nnodes);
-%For parents, sum down columns
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(j,i) == 1,
-            num_par(i) = num_par(i) + 1;
-        end
-    end
-end
-num_child = zeros(1,nnodes);
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(i,j) == 1,
-            num_child(i) = num_child(i) + 1;
-        end
-    end
-end
-
-
-for i = 1:nnodes,
-    %%% The name and type of each node (1=continuous, the number of states
-    %%% if it is discrete
-    fprintf(fileID,'%s\t%i\n',labels{i},bnet.node_sizes(i));
-    %%% The size of the node, I am going to keep them 
-    %%% 250(width) by 150(height) for now
-    %Could modify this to change the width based on the length of the node
-    %name
-    fprintf(fileID,'%i\t%i\n',250,150);
-    %%% The number of parents of the node, and the parents
-    if num_par(i) == 0;
-        %%% If no parents:
-        fprintf(fileID,'%i\n',num_par(i));
-    else
-        parents = zeros(1,num_par(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(j,i) == 1,
-             parents(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_par(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_par(i),parents(1,:));
-    end
-    
-    
-    %%% The number of children of the node, and the children
-    if num_child(i) == 0;
-        %%% If no children:
-        fprintf(fileID,'%i\n',num_child(i));
-    else
-        children = zeros(1,num_child(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(i,j) == 1,
-             children(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_child(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_child(i),children(1,:));
-    end
-    
-    predict = marginal_nodes(engine,i);
-    if bnet.node_sizes(i) ~= 1,
-        for j = 1:bnet.node_sizes(i),
-            %%%For discrete nodes, the state and the percent of that state
-            fprintf(fileID,'%i\t%6.4f\n',j,predict.T(j));
-        end;
-    else
-        %cases(i)
-       % MAX(cases(i))
-       % MIN(cases(i))
-        [x_vals,y_vals] = calcGaussian(predict.mu,predict.Sigma,Amax(i),Amin(i));
-        %%%For continuous nodes, print x and the pdf of a normal curve.
-        for j = 1:101,
-            %%Undo standardization
-            x_vals(j,1) = x_vals(j,1)*stdevs{i}+means{i};
-            fprintf(fileID,'%6.4f\t%6.4f\n',x_vals(j,1),y_vals(j,1));
-        end;
-    end;
-end
-%fprintf(fileID,'%s\t %\n',labels_temp{:});
-
-
-fclose(fileID);
-
-end
-
-
-function [x_dim, y_dim] = canvasSize(nnodes,x,y)
-%canvasSize Function to calculate the size of the canvas to
-%           build the network structure
-
-
-%I am going to assume that the node size will be
-% height = 150, width = 250
-% so there will be a node spacing of 
-% 200 (in y-dim) and 300 (in x-dim).
-y_space = 200;
-x_space = 300;
-
-%Set default minimum x and y dimensions
-x_dim = 1200;
-y_dim = 1200;
-
-%get unique y values
-y_unique = unique(y);
-size_y = size(y_unique,2);
-y_dim_temp = size_y*y_space;
-
-%get the maximum nodes in any layer
-size_x = zeros(1,size_y);
-for i = 1:size_y,
-    for j = 1:nnodes,
-        if y_unique(i) == y(j),
-            size_x(1,i) = size_x(1,i) + 1;
-        end;
-    end;
-end;
-size_x = max(size_x);
-x_dim_temp = size_x*x_space;
-
-if x_dim_temp > x_dim,
-    x_dim = x_dim_temp;
-end;
-
-if y_dim_temp > y_dim,
-    y_dim = y_dim_temp;
-end;
-end
-
-function [x_vals,y_vals] = calcGaussian(mu,Sigma,maxval,minval)
-%Function to calculate 101 points of Gaussian function to use in plotting
-% Gets the probability density of the mean value and 50 evenly spaced
-% points up to 3Sigma below the mean and 50 evenly space points up to
-% 3Sigma above the mean.
-%maxval
-%minval
-x_vals = zeros(101,1);
-y_vals = zeros(101,1);
-
-%x_vals(1,1) = mu - 3*Sigma;
-x_vals(1,1) = minval - 1;
-gap=((maxval+1)-(minval - 1))/100;
-%x_vals(1,1) = 0;%mu - 3*Sigma;
-for i = 1:100,
-   % x_vals(i+1,1) = x_vals(1,1) + i*6*Sigma/100;
-    x_vals(i+1,1) = x_vals(i,1) + gap;
- %x_vals(i+1,1) = x_vals(i,1) + 1/100;
-end
-
-for i = 1:101,
-    y_vals(i,1) = normpdf(x_vals(i,1),mu,Sigma);
-end
-
-end
diff --git a/sourcecodes/parameter_learning/code_backup/drawFigureM.m b/sourcecodes/parameter_learning/code_backup/drawFigureM.m
deleted file mode 100644
index 91b8698f..00000000
--- a/sourcecodes/parameter_learning/code_backup/drawFigureM.m
+++ /dev/null
@@ -1,230 +0,0 @@
-function [] = drawFigureM(nnodes,bnet,labels,filename,cases,stdevs,means,selectvar,selectdata)
-%drawFigureM writes the parameters and data that are needed to draw the
-%structure of a Bayesian network after added evidence or intervention
-
-fileID = fopen(filename,'w');
-
-
-A=cell2mat(cases');
-Amax=max(A);
-Amin=min(A);
-
-
-evidence = cell(1,nnodes);
-engine = jtree_inf_engine(bnet);
-
-m = size(selectvar,1);
-
-ev_dat = zeros(1,nnodes);
-for i = 1:m,
-    di=selectvar(i,1);
-    ev_dat(di)=selectdata(i,1);   
-%Need to standardized evidence for continuous nodes.
-    if bnet.node_sizes(di) == 1
-        ev_dat(di) = (ev_dat(di) - means{di}) / stdevs{di};
-    end
-    evidence{di}=ev_dat(di);
-    fprintf(fileID,'%i\t',di);
-end
-
-fprintf(fileID,'\n');
-
-[engine,loglik]=enter_evidence(engine,evidence);
-
-%Open the file, and write the nodes to a file.
-%%% The number of nodes
-fprintf(fileID,'%i\n',nnodes);
-%Get canvas size
-labels_temp = cellstr(labels);
-[x,y] = make_layout(bnet.dag);
-x = x - min(x);
-y = 1 - y;
-y = y - min(y);
-[x_dim,y_dim] = canvasSize(nnodes,x,y);
-
-%%% The dimensions of the canvas for the javascript code
-fprintf(fileID,'%i\t%i\t\n',x_dim,y_dim);
-x = x*x_dim;
-y = y*y_dim;
-for i = 1:nnodes,
-%%% The name and X- and Y-positions of each node
-    fprintf(fileID,'%s\t%i\t%i\n',labels{i},round(x(i)),round(y(i)));
-end
-
-%Get the number of parents and children for each node.
-num_par = zeros(1,nnodes);
-%For parents, sum down columns
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(j,i) == 1,
-            num_par(i) = num_par(i) + 1;
-        end
-    end
-end
-num_child = zeros(1,nnodes);
-for i = 1:nnodes,
-    for j = 1:nnodes,
-        if bnet.dag(i,j) == 1,
-            num_child(i) = num_child(i) + 1;
-        end
-    end
-end
-
-for i = 1:nnodes,
-    %%% The name and type of each node (1=continuous, the number of states
-    %%% if it is discrete
-    fprintf(fileID,'%s\t%i\n',labels{i},bnet.node_sizes(i));
-    %%% The size of the node, I am going to keep them 
-    %%% 250(width) by 150(height) for now
-    %Could modify this to change the width based on the length of the node
-    %name
-    fprintf(fileID,'%i\t%i\n',250,150);
-    %%% The number of parents of the node, and the parents
-    if num_par(i) == 0;
-        %%% If no parents:
-        fprintf(fileID,'%i\n',num_par(i));
-    else
-        parents = zeros(1,num_par(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(j,i) == 1,
-             parents(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_par(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_par(i),parents(1,:));
-    end
-    
-    
-    %%% The number of children of the node, and the children
-    if num_child(i) == 0;
-        %%% If no children:
-        fprintf(fileID,'%i\n',num_child(i));
-    else
-        children = zeros(1,num_child(i));
-        k = 1;
-        for j = 1:nnodes,
-           if bnet.dag(i,j) == 1,
-             children(1,k) = j;
-             k = k + 1;
-           end
-        end
-        format = '%i\t';
-        for j = 1:num_child(i)-1,
-            format = strcat(format,'%i\t');
-        end
-        format = strcat(format,'%i\n');
-        %%%If there are parents:
-        fprintf(fileID,format,num_child(i),children(1,:));
-    end
-    
-    predict = marginal_nodes(engine,i);
-    if isempty(evidence{i})
-      if bnet.node_sizes(i) ~= 1,
-        for j = 1:bnet.node_sizes(i),
-            %%%For discrete nodes, the state and the percent of that state
-            fprintf(fileID,'%i\t%6.4f\n',j,predict.T(j));
-        end;
-      else
-        [x_vals,y_vals] = calcGaussian(predict.mu,predict.Sigma,Amax(i),Amin(i));
-        %%%For continuous nodes, print x and the pdf of a normal curve.
-        for j = 1:101,
-            %%Undo standardization
-            x_vals(j,1) = x_vals(j,1)*stdevs{i}+means{i};
-            fprintf(fileID,'%6.4f\t%6.4f\n',x_vals(j,1),y_vals(j,1));
-        end;
-      end;
-    else
-      if bnet.node_sizes(i) == 1,
-	fprintf(fileID,'%6.4f\t%6.4f\n',ev_dat(i)*stdevs{i}+means{i},1);
-      else
-	fprintf(fileID,'%6.4f\t%6.4f\n',ev_dat(i),1);
-      endif 
-    end
-    
-end
-
-fclose(fileID);
-end
-
-
-
-
-
-
-
-
-
-function [x_dim, y_dim] = canvasSize(nnodes,x,y)
-%canvasSize Function to calculate the size of the canvas to
-%           build the network structure
-
-
-%I am going to assume that the node size will be
-% height = 150, width = 250
-% so there will be a node spacing of 
-% 200 (in y-dim) and 300 (in x-dim).
-y_space = 200;
-x_space = 300;
-
-%Set default minimum x and y dimensions
-x_dim = 1200;
-y_dim = 1200;
-
-%get unique y values
-y_unique = unique(y);
-size_y = size(y_unique,2);
-y_dim_temp = size_y*y_space;
-
-%get the maximum nodes in any layer
-size_x = zeros(1,size_y);
-for i = 1:size_y,
-    for j = 1:nnodes,
-        if y_unique(i) == y(j),
-            size_x(1,i) = size_x(1,i) + 1;
-        end;
-    end;
-end;
-size_x = max(size_x);
-x_dim_temp = size_x*x_space;
-
-if x_dim_temp > x_dim,
-    x_dim = x_dim_temp;
-end;
-
-if y_dim_temp > y_dim,
-    y_dim = y_dim_temp;
-end;
-end
-
-function [x_vals,y_vals] = calcGaussian(mu,Sigma,maxval,minval)
-%Function to calculate 101 points of Gaussian function to use in plotting
-% Gets the probability density of the mean value and 50 evenly spaced
-% points up to 3Sigma below the mean and 50 evenly space points up to
-% 3Sigma above the mean.
-%maxval
-%minval
-x_vals = zeros(101,1);
-y_vals = zeros(101,1);
-
-%x_vals(1,1) = mu - 3*Sigma;
-x_vals(1,1) = minval - 1;
-gap=((maxval+1)-(minval - 1))/100;
-%x_vals(1,1) = 0;%mu - 3*Sigma;
-for i = 1:100,
-   % x_vals(i+1,1) = x_vals(1,1) + i*6*Sigma/100;
-    x_vals(i+1,1) = x_vals(i,1) + gap;
- %x_vals(i+1,1) = x_vals(i,1) + 1/100;
-end
-
-for i = 1:101,
-    y_vals(i,1) = normpdf(x_vals(i,1),mu,Sigma);
-end
-
-end
diff --git a/sourcecodes/parameter_learning/code_backup/getParams.m b/sourcecodes/parameter_learning/code_backup/getParams.m
deleted file mode 100644
index 31f84ffb..00000000
--- a/sourcecodes/parameter_learning/code_backup/getParams.m
+++ /dev/null
@@ -1,22 +0,0 @@
-function [ bnet ] = getParams( bnet, cases )
-%getParams Code to initialize CPT and do parameter learning.
-%This will be very basic for now.  I can add more options later.
-
-dnodes = bnet.dnodes;
-cnodes = bnet.cnodes;
-nnodes = size(dnodes,2)+size(cnodes,2);
-
-%make dnodes tabular_CPT
-for i = 1:size(dnodes,2)
-    bnet.CPD{dnodes(i)} = tabular_CPD(bnet,dnodes(i));
-end
-
-for i = 1:size(cnodes,2)
-    bnet.CPD{cnodes(i)} = gaussian_CPD(bnet,cnodes(i));
-end
-
-bnet = learn_params(bnet,cases);
-
-
-end
-
diff --git a/sourcecodes/parameter_learning/code_backup/looCrossValid.m b/sourcecodes/parameter_learning/code_backup/looCrossValid.m
deleted file mode 100644
index 21d6560d..00000000
--- a/sourcecodes/parameter_learning/code_backup/looCrossValid.m
+++ /dev/null
@@ -1,241 +0,0 @@
-function looCrossValid(pre,predict_label)
-% This function will peform leave-one-out cross-validation.
-% This requires the specification of the name of the variable
-%   that you want to predict.
-% For now, I will assume that the variable is a discrete variable.
-
-
-
-sfile=strcat(pre,'structure_input.txt');
-dfile=strcat(pre,'continuous_input.txt');
-nnodefile=strcat(pre,'nnode.txt');
-fnnode = fopen(nnodefile,'r');
-nnodes = fscanf(fnnode,'%d');
-
-Std_flag=true;
-[labels,cases,bnet]=readInput(dfile,sfile,nnodes,Std_flag);
-
-for i=1:nnodes
-    if strcmp(labels(i),predict_label)
-       predict_node = i;
-    end
-end
-
-predict_cases = bnet.node_sizes(predict_node);
-
-if predict_cases == 1
-	looCV_continuous(pre,predict_label,nnodes,labels,cases,bnet,predict_node,predict_cases);
-else
-	looCV_discrete(pre,predict_label,nnodes,labels,cases,bnet,predict_node,predict_cases);
-endif
-
-end
-
-function looCV_continuous(pre,predict_label,nnodes,labels,cases,bnet,predict_node,predict_cases)
-
-ncases = size(cases,2);
-
-%%Read in original means and standard deviations to report output as
-%% untransformed values.
-means_orig=cell(1,nnodes);
-stdevs_orig=cell(1,nnodes);
-labels_orig=cell(1,nnodes);
-%Read in original means and standard deviations
-mapfile = strcat(pre,'map.txt');
-fmap = fopen(mapfile,'r');
-for i=1:nnodes
-    buffer = fgetl(mapfile);
-    temp = cell(1,3);
-    for j=1:3
-        [next,buffer] = strtok(buffer);
-	temp{j} = next;
-    end
-    labels_orig{i} = temp{1};
-    means_orig{i} = str2num(temp{3});
-    stdevs_orig{i} = str2num(temp{2});
-end
-fclose(fmap);
-%Need to map the means and stdevs to the correct labels
-means = cell(1,nnodes);
-stdevs = cell(1,nnodes);
-%Read in labels in new order.
-labelsnew = cell(1,nnodes);
-mapdatafile = strcat(pre,'mapdata.txt');
-fmapdata = fopen(mapdatafile,'r');
-buffer = fgetl(fmapdata);
-for i = 1:nnodes
-    [next,buffer ] = strtok(buffer);
-    labelsnew{i} = next;
-end
-fclose(fmapdata);
-for i = 1:nnodes
-    for j = 1:nnodes
-       if strcmp(labelsnew{i},labels_orig{j})
-          means{i} = means_orig{j};
-          stdevs{i} = stdevs_orig{j};
-          break
-       end
-    end
-end
-
-
-loopredictions=zeros(size(cases,2),2);
-
-%t=cputime;
-%First get loo predictions
-for i =1:ncases
-%  i
-  current_data = cases(:,i);
-  cases_new = cases;
-  cases_new(:,i) = [];
-  evidence = current_data;
-  evidence{predict_node} = {};
-  [bnet]=parameterLearning(bnet,cases_new);
-  engine = jtree_inf_engine(bnet);
-  [engine,loglik] = enter_evidence(engine,evidence);
-  predict = marginal_nodes(engine,predict_node);
-  adj_mu = predict.mu*stdevs{predict_node}+means{predict_node};
-  adj_sigma = stdevs{predict_node}*predict.Sigma;
-  loopredictions(i,1) = adj_mu;
-  loopredictions(i,2) = adj_sigma;
-end
-%e=cputime-t;
-
-
-%Open output file.
-filename = strcat(pre,'looCV.txt');
-fileID = fopen(filename,'w');
-
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
-
-
-%%Print the predictions
-fprintf(fileID,'Predicted mean and standard deviation for each case:\n');
-fprintf(fileID,'Mean\tStDev\n');
-for i = 1:ncases
-     fprintf(fileID,'%i\t',i);
-     fprintf(fileID,'%6.4f\t%6.4f\n',loopredictions(i,:));
-end
-
-end
-
-
-function looCV_discrete(pre,predict_label,nnodes,labels,cases,bnet,predict_node,predict_cases)
-
-ncases = size(cases,2);
-
-%This next section just gets the original names of the levels.
-% so they can be written to the output file.
-%%Get the maximum_number of states so array will be big enough
-%%Add 1 because the input includes the node name
-max_states = max(bnet.node_sizes) + 1;
-disc_nodes = size(bnet.dnodes,2);
-
-%%Get mapping of discrete levels.
-levelfile = strcat(pre,'nlevels.txt');
-flevels = fopen(levelfile,'r');
-levels = cell(disc_nodes,max_states);
-ndisc_nodes = 0;
-for i=1:disc_nodes
-    ndisc_nodes = ndisc_nodes + 1;
-    buffer = fgetl(flevels);
-     for j = 1:max_states
-       [next,buffer] = strtok(buffer);
-       if j == 1
-          levels{i,j} = next;
-       else
-%          levels{i,j} = uint16(str2num(next));
-          levels{i,j} = next;
-       end
-       if length(buffer) < 1
-        break
-       end
-     end
-end
-
-pred_levels = cell(1,predict_cases);
-for i = 1:disc_nodes
-   if strcmp(levels{i,1},predict_label);
-	for j = 1:predict_cases
-	    pred_levels{j} = levels{i,j+1};
-	end
-        break
-   end
-end
-
-loopredictions=zeros(size(cases,2),predict_cases);
-
-%t=cputime;
-%First get loo predictions
-for i =1:ncases
-%  i
-  current_data = cases(:,i);
-  cases_new = cases;
-  cases_new(:,i) = [];
-  evidence = current_data;
-  evidence{predict_node} = {};
-
-  [bnet]=parameterLearning(bnet,cases_new);
-  engine = jtree_inf_engine(bnet);
-  [engine,loglik] = enter_evidence(engine,evidence);
-  predict = marginal_nodes(engine,predict_node);
-  for j = 1:predict_cases
-	loopredictions(i,j) = predict.T(j);
-  end
-end
-%e=cputime-t;
-
-%Now compare with actual outcomes
-actual_states = zeros(1,predict_cases);
-for i=1:ncases
-    for j = 1:predict_cases
-	if cell2mat(cases(predict_node,i)) == j
-           actual_states(j) = actual_states(j) + 1;
-	end
-    end
-end
-
-actual_states;
-pred_states = zeros(1,ncases);
-
-for i=1:ncases
-    max_state = 1;
-    for j = 2:predict_cases
-       if loopredictions(i,j) > loopredictions(i,max_state)
-           max_state = j;
-	end
-    end
-    pred_states(i) = max_state;
-end
-
-correct = 0;
-for i=1:ncases
-    if pred_states(i) == cell2mat(cases(predict_node,i))
-	correct = correct + 1;
-    end
-end
-
-accuracy = correct/ncases;
-
-%Open output file.
-filename = strcat(pre,'looCV.txt');
-fileID = fopen(filename,'w');
-
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
-
-
-%%Print the accuracy
-fprintf(fileID,'Fraction of accurate predictions: %6.4f\n\n',accuracy);
-
-%%Print the predictions
-fprintf(fileID,'Predicted likelihood of each state for each case:\n');
-fprintf(fileID,'%s\t','Case');
-fprintf(fileID,'%s\t',pred_levels{1:end-1});
-fprintf(fileID,'%s\n',pred_levels{end});
-for i = 1:ncases
-     fprintf(fileID,'%i\t',i);
-     fprintf(fileID,'%6.4f\t',loopredictions(i,1:end-1));
-     fprintf(fileID,'%6.4f\n',loopredictions(i,end));
-end
-
-end
diff --git a/sourcecodes/parameter_learning/code_backup/parameterLearning.m b/sourcecodes/parameter_learning/code_backup/parameterLearning.m
deleted file mode 100644
index 872e94b1..00000000
--- a/sourcecodes/parameter_learning/code_backup/parameterLearning.m
+++ /dev/null
@@ -1,17 +0,0 @@
-function [ bnet ] = parameterLearning( bnet,cases,engine_name )
-%parameterLearning Do parameter learning and inference
-
-%engine is an optional argument
-if nargin < 3
-    engine_name = 'jtree_inf_engine';
-end
-
-
-%First do parameter learning with all the data
-[bnet] = getParams(bnet,cases);
-
-
-
-
-end
-
diff --git a/sourcecodes/parameter_learning/code_backup/prepareInput.m b/sourcecodes/parameter_learning/code_backup/prepareInput.m
deleted file mode 100644
index 838dcd2c..00000000
--- a/sourcecodes/parameter_learning/code_backup/prepareInput.m
+++ /dev/null
@@ -1,294 +0,0 @@
-function  [ ] = prepareInput( pre )
-   %   
-   %  This function takes files that are uploaded to BNW and creates output
-   %    files that can be used for structure and parameter learning.
-   %  It replaces php code that was previously in bn_file_load_gom.php.
-   %    There are several improvements in performance and ease of use:
-   %     1) Loading files is significantly (~5x) faster for large input files.
-   %     2) The allowed values for discrete variables are more flexible. 
-   %           (e.g., A genotype variable be 'B' and 'D' instead of having
-   %               to replace to make them '1' and '2'.)
-   %     3) Continuous variables may be identified as continuous in some cases
-   %            even if there is not a period.
-   %     4) The states of discrete variables should be correctly ordered in
-   %            almost all cases.
-   %     5) An additional output file is written that will let users check if
-   %            the input file has been uploaded and parsed correctly.
-   %     6) Future updates to this code should be easier than updating the php.
-   %      
-   %
-   %  Input: ???continuous_input_orig.txt
-   %    This is the input file that is uploaded to BNW.
-   %    It is directly written out by the BNW php code with no modification.
-   %    The file format is a header line containing the variable names
-   %     followed by the data, with each case in a row.
-   %
-   %  Output: There are many output files.
-   %    1) The main output file is ???continuous_input.txt that can be
-   %       used by the structure learning code and parameter learning codes.
-   %       The first line is variable names, the second line is the node type
-   %          (continuous nodes should have 1, discrete nodes have the number
-   %           of states), and the rest is the data.
-   %    2) A new output file is ???input_desc.txt, a file that describes the
-   %        data so users can check that it has been parsed correctly.
-   %    3) ???nlevels.txt: The states of discrete variables.
-   %    4) ???name.txt: The names of the variables as uploaded.
-   %    5) ???type.txt: The number of states for each variables
-   %            (1 indicates a continuous variable.)
-   %    6/7) ???nnode.txt and ???nrows.txt: number of nodes and cases
-   %    8-12) ???ban.txt, ???white.txt, ???k.txt, ???thr.txt, and
-   %          ???parent.txt: Files with default values for structure learning. 
-   %
-
-%  open file for input, include error handling
-dfile=strcat(pre,'continuous_input_orig.txt');
-
-fin = fopen(dfile,'r');
-if fin < 0
-   error(['Could not open ',dfile,' for input']);
-end
-
-% Get the number of cases (the number of rows in the file excluding the header)
-ncases = fskipl(fin,Inf) - 1;
-
-frewind(fin);
-
-% Read in first line to get the number of nodes and the node labels.
-buffer = fgetl(fin);    %get header line as a string
-nnodes = numel(strfind(buffer,"\t")) + 1;
-labels = cell(1,nnodes);
-for j=1:nnodes
-    [next,buffer] = strtok(buffer);
-    labels{j} = next;
-end
-
-% Read in the data
-data = cell(ncases,nnodes);
-for i = 1:ncases
-    buffer = fgetl(fin);
-    for j = 1:nnodes
-         [next,buffer] = strtok(buffer);
-         data{i,j} = next;
-    end
-end
-
-% Determine whether or not the nodes are continuous or discrete.
-% First, treat them as all discrete and get the states and number of stats(levels).
-levels = cell(1,nnodes);
-states = [];
-for j = 1:nnodes
-   states{end+1} = unique(data(:,j));
-   levels{j} = size(states{j},1);
-end
-
-reason = cell(1,nnodes);
-%Now do some checks to see if nodes are discrete or continuous
-for j = 1:nnodes
-    % If there are 3 or less unique values, I will assume that the node is discrete.
-    if levels{j} < 4;
-        reason{j} = "It was determined to be discrete because there are a small number (<4) of possible values.";
-        continue
-    % If there are as many unique values as a third of the number of cases,
-    %      I will assume that the node is continuous.
-    elseif levels{j} > ncases/3;
-       levels{j} = 1;
-       reason{j} = "It was determined to be continuous because there are a large number of possible values compared to the number of cases.";
-       continue
-    % If there are more than twenty unique values,
-    %      I will assume that the node is continuous.
-    elseif levels{j} > 20;
-       levels{j} = 1;
-       reason{j} = "It was determined to be continuous because there are many (>20) possible values.";
-       continue
-    % Otherwise, I will scan through the individual values.
-    % If any of the values contain a '.', I will assume it is continuous.
-    else
-       reason{j} = "It was determined to be discrete by default.";
-       period_test = 0;
-       column = data(:,j);
-       k = 1;
-       while period_test == 0 
-           period_test = sum(cell2mat(strfind(column(k),".")));
-           if period_test != 0;
-              reason{j} = "This variable was determined to be continuous because there were several possible values and at least one value contained a period(.).";
-              levels{j} = 1;
-           end
-           k++;
-           if k > ncases
-              break
-           end
-        end
-    end
-end
-
-%I need to check if any discrete nodes are listed after continuous nodes.
-%If so, I need to rearrange the columns.
-max_disc = 0;
-min_cont = nnodes + 1;
-for i = 1:nnodes
-    if levels{i} > 1
-       max_disc = i;
-    elseif min_cont == nnodes+1
-       min_cont = i;
-    end
-end
-%If max_disc > min_cont, you need to rearrange the nodes
-%  to put the discrete nodes first.
-if max_disc > min_cont
-  levels_old = levels;
-  labels_old = labels;
-  data_old = data;
-  states_old = states;
-  reason_old = reason;
-  new_order = {};
-  for i=1:nnodes
-    if levels_old{i} > 1
-      new_order{end+1} = i;
-    end
-  end
-  for i=1:nnodes
-    if levels_old{i} == 1
-      new_order{end+1} = i;
-    end
-  end
-  labels = {};
-  levels = {};
-  states = {};
-  reason = {};
-  for i =1:nnodes
-    labels{i} = labels_old{new_order{i}};
-    levels{i} = levels_old{new_order{i}};
-    states{i} = states_old{new_order{i}};
-    reason{i} = reason_old{new_order{i}};
-    for j=1:ncases
-      data{j,i} = data_old{j,new_order{i}};
-    end
-  end
-  
-endif
-
-
-%Write other files that are used by BNW for this key.
-%The first group of files establish default settings for structure learning.
-outfile = strcat(pre,'white.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'From\tTo\n');
-fclose(fout);
-
-outfile = strcat(pre,'ban.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'From\tTo\n');
-fclose(fout);
-
-outfile = strcat(pre,'k.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'1\n');
-fclose(fout);
-
-outfile = strcat(pre,'parent.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'4\n');
-fclose(fout);
-
-outfile = strcat(pre,'thr.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'0.5\n');
-fclose(fout);
-
-
-%The next group of files have information about the uploaded file.
-outfile = strcat(pre,'name.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%s\t',labels{1:end-1});
-fprintf(fout,'%s\n',labels{end});
-fclose(fout);
-
-outfile = strcat(pre,'nnode.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%i\n',nnodes);
-fclose(fout);
-
-outfile = strcat(pre,'nrows.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%i\n',ncases);
-fclose(fout);
-
-outfile = strcat(pre,'type.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%s\t',labels{1:end-1});
-fprintf(fout,'%s\n',labels{end});
-fprintf(fout,'%i\t',levels{1:end-1});
-fprintf(fout,'%i\n',levels{end});
-fclose(fout);
-
-%This output file contains the states for discrete nodes.
-% The unique matlab function already sorts the states.
-outfile = strcat(pre,'nlevels.txt');
-fout = fopen(outfile,'w');
-for i = 1:nnodes
-    if levels{i} > 1
-        fprintf(fout,'%s\t',labels{i},states{i}{1:end-1});
-        fprintf(fout,'%s\n',states{i}{end});
-    end
-end
-fclose(fout);
-
-
-%Print a file with a short description of the input.
-descfile = strcat(pre,'input_desc.txt');
-dout = fopen(descfile,'w');
-fprintf(dout,['As loaded, the input file had the following properties:\n\n']);
-dout = fopen(descfile,'a');
-fprintf(dout,'There are %i variables and %i cases(rows).\n',size(labels,2),ncases);
-fprintf(dout,'The variable names are:\n');
-fprintf(dout,'%s\t',labels{1:end-1});
-fprintf(dout,'%s\n\n',labels{end});
-for i=1:nnodes
-    if levels{i} == 1
-       fprintf(dout,'%s is a continuous variable.\n',labels{i});
-       fprintf(dout,'%s\n',reason{i});
-       column = str2double(data(:,i));
-       colmean = mean(column);
-       colstd = std(column);
-       fprintf(dout,'It has a mean of %6.3f and a standard deviation of %6.3f\n\n',mean(column),std(column))
-    else 
-       fprintf(dout,'%s is a discrete variable with %i states.\n',labels{i},levels{i});
-       fprintf(dout,'%s\n',reason{i});
-       fprintf(dout,'The states are: ');
-       fprintf(dout,'%s ',states{i}{1:end-1});
-       fprintf(dout,'%s\n\n',states{i}{end});
-    end
-end
-fclose(fout);
-
-outfile = strcat(pre,'continuous_input.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%s\t',labels{1:end-1});
-fprintf(fout,'%s\n',labels{end});
-fprintf(fout,'%i\t',levels{1:end-1});
-fprintf(fout,'%i\n',levels{end});
-%Need to replace states in discrete variables with integers for BNT
-for i = 1:nnodes
-    if levels{i} > 1
-	for j = 1:ncases
-            for k=1:size(states{i},1)
-	      if data{j,i} == states{i}{k}
-                 data{j,i} = sprintf('%i',num2cell(k){1});;
-                 break
-              end
-            end
-        end
-     end
-end
-for i = 1:ncases
-      fprintf(fout,'%s\t',data{i,1:end-1});
-      fprintf(fout,'%s\n',data{i,end});
-end
-fclose(fout);
-
-
-
-
-
-end
-%  end of prepareInput.m
\ No newline at end of file
diff --git a/sourcecodes/parameter_learning/code_backup/prepareInput.m~ b/sourcecodes/parameter_learning/code_backup/prepareInput.m~
deleted file mode 100644
index 9fc0f97f..00000000
--- a/sourcecodes/parameter_learning/code_backup/prepareInput.m~
+++ /dev/null
@@ -1,294 +0,0 @@
-function  [ ] = prepareInput( pre )
-   %   
-   %  This function takes files that are uploaded to BNW and creates output
-   %    files that can be used for structure and parameter learning.
-   %  It replaces php code that was previously in bn_file_load_gom.php.
-   %    There are several improvements in performance and ease of use:
-   %     1) Loading files is significantly (~5x) faster for large input files.
-   %     2) The allowed values for discrete variables are more flexible. 
-   %           (e.g., A genotype variable be 'B' and 'D' instead of having
-   %               to replace to make them '1' and '2'.)
-   %     3) Continuous variables may be identified as continuous in some cases
-   %            even if there is not a period.
-   %     4) The states of discrete variables should be correctly ordered in
-   %            almost all cases.
-   %     5) An additional output file is written that will let users check if
-   %            the input file has been uploaded and parsed correctly.
-   %     6) Future updates to this code should be easier than updating the php.
-   %      
-   %
-   %  Input: ???continuous_input_orig.txt
-   %    This is the input file that is uploaded to BNW.
-   %    It is directly written out by the BNW php code with no modification.
-   %    The file format is a header line containing the variable names
-   %     followed by the data, with each case in a row.
-   %
-   %  Output: There are many output files.
-   %    1) The main output file is ???continuous_input.txt that can be
-   %       used by the structure learning code and parameter learning codes.
-   %       The first line is variable names, the second line is the node type
-   %          (continuous nodes should have 1, discrete nodes have the number
-   %           of states), and the rest is the data.
-   %    2) A new output file is ???input_desc.txt, a file that describes the
-   %        data so users can check that it has been parsed correctly.
-   %    3) ???nlevels.txt: The states of discrete variables.
-   %    4) ???name.txt: The names of the variables as uploaded.
-   %    5) ???type.txt: The number of states for each variables
-   %            (1 indicates a continuous variable.)
-   %    6/7) ???nnode.txt and ???nrows.txt: number of nodes and cases
-   %    8-12) ???ban.txt, ???white.txt, ???k.txt, ???thr.txt, and
-   %          ???parent.txt: Files with default values for structure learning. 
-   %
-
-%  open file for input, include error handling
-dfile=strcat(pre,'continuous_input_orig.txt');
-
-fin = fopen(dfile,'r');
-if fin < 0
-   error(['Could not open ',dfile,' for input']);
-end
-
-% Get the number of cases (the number of rows in the file excluding the header)
-ncases = fskipl(fin,Inf) - 1;
-
-frewind(fin);
-
-% Read in first line to get the number of nodes and the node labels.
-buffer = fgetl(fin);    %get header line as a string
-nnodes = numel(strfind(buffer,"\t")) + 1;
-labels = cell(1,nnodes);
-for j=1:nnodes
-    [next,buffer] = strtok(buffer);
-    labels{j} = next;
-end
-
-% Read in the data
-data = cell(ncases,nnodes);
-for i = 1:ncases
-    buffer = fgetl(fin);
-    for j = 1:nnodes
-         [next,buffer] = strtok(buffer);
-         data{i,j} = next;
-    end
-end
-
-% Determine whether or not the nodes are continuous or discrete.
-% First, treat them as all discrete and get the states and number of stats(levels).
-levels = cell(1,nnodes);
-states = [];
-for j = 1:nnodes
-   states{end+1} = unique(data(:,j));
-   levels{j} = size(states{j},1);
-end
-
-reason = cell(1,nnodes);
-%Now do some checks to see if nodes are discrete or continuous
-for j = 1:nnodes
-    % If there are 3 or less unique values, I will assume that the node is discrete.
-    if levels{j} < 4;
-        reason{j} = "This was determined to be discrete because there are few (<4) different values.";
-        continue
-    % If there are as many unique values as a third of the number of cases,
-    %      I will assume that the node is continuous.
-    elseif levels{j} > ncases/3;
-       levels{j} = 1;
-       reason{j} = "This was determined to be continuous because there are a large number of different values compared to the number of cases.";
-       continue
-    % If there are more than twenty unique values,
-    %      I will assume that the node is continuous.
-    elseif levels{j} > 20;
-       levels{j} = 1;
-       reason{j} = "This was determined to be continuous because there are many (>20) possible values.";
-       continue
-    % Otherwise, I will scan through the individual values.
-    % If any of the values contain a '.', I will assume it is continuous.
-    else
-       reason{j} = "This variable was determined to be discrete.";
-       period_test = 0;
-       column = data(:,j);
-       k = 1;
-       while period_test == 0 
-           period_test = sum(cell2mat(strfind(column(k),".")));
-           if period_test != 0;
-              reason{j} = "This variable was determined to be continuous because there were several possible values and at least one value contained a period (".").";
-              levels{j} = 1;
-           end
-           k++;
-           if k > ncases
-              break
-           end
-        end
-    end
-end
-
-%I need to check if any discrete nodes are listed after continuous nodes.
-%If so, I need to rearrange the columns.
-max_disc = 0;
-min_cont = nnodes + 1;
-for i = 1:nnodes
-    if levels{i} > 1
-       max_disc = i;
-    elseif min_cont == nnodes+1
-       min_cont = i;
-    end
-end
-%If max_disc > min_cont, you need to rearrange the nodes
-%  to put the discrete nodes first.
-if max_disc > min_cont
-  levels_old = levels;
-  labels_old = labels;
-  data_old = data;
-  states_old = states;
-  reason_old = reason;
-  new_order = {};
-  for i=1:nnodes
-    if levels_old{i} > 1
-      new_order{end+1} = i;
-    end
-  end
-  for i=1:nnodes
-    if levels_old{i} == 1
-      new_order{end+1} = i;
-    end
-  end
-  labels = {};
-  levels = {};
-  states = {};
-  reason = {};
-  for i =1:nnodes
-    labels{i} = labels_old{new_order{i}};
-    levels{i} = levels_old{new_order{i}};
-    states{i} = states_old{new_order{i}};
-    reason{i} = reason_old{new_order{i}};
-    for j=1:ncases
-      data{j,i} = data_old{j,new_order{i}};
-    end
-  end
-  
-endif
-
-
-%Write other files that are used by BNW for this key.
-%The first group of files establish default settings for structure learning.
-outfile = strcat(pre,'white.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'From\tTo\n');
-fclose(fout);
-
-outfile = strcat(pre,'ban.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'From\tTo\n');
-fclose(fout);
-
-outfile = strcat(pre,'k.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'1\n');
-fclose(fout);
-
-outfile = strcat(pre,'parent.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'4\n');
-fclose(fout);
-
-outfile = strcat(pre,'thr.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'0.5\n');
-fclose(fout);
-
-
-%The next group of files have information about the uploaded file.
-outfile = strcat(pre,'name.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%s\t',labels{1:end-1});
-fprintf(fout,'%s\n',labels{end});
-fclose(fout);
-
-outfile = strcat(pre,'nnode.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%i\n',nnodes);
-fclose(fout);
-
-outfile = strcat(pre,'nrows.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%i\n',ncases);
-fclose(fout);
-
-outfile = strcat(pre,'type.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%s\t',labels{1:end-1});
-fprintf(fout,'%s\n',labels{end});
-fprintf(fout,'%i\t',levels{1:end-1});
-fprintf(fout,'%i\n',levels{end});
-fclose(fout);
-
-%This output file contains the states for discrete nodes.
-% The unique matlab function already sorts the states.
-outfile = strcat(pre,'nlevels.txt');
-fout = fopen(outfile,'w');
-for i = 1:nnodes
-    if levels{i} > 1
-        fprintf(fout,'%s\t',labels{i},states{i}{1:end-1});
-        fprintf(fout,'%s\n',states{i}{end});
-    end
-end
-fclose(fout);
-
-
-%Print a file with a short description of the input.
-descfile = strcat(pre,'input_desc.txt');
-dout = fopen(descfile,'w');
-fprintf(dout,['As loaded, the input file had the following properties:\n\n']);
-dout = fopen(descfile,'a');
-fprintf(dout,'There are %i variables and %i cases(rows)\n',size(labels,2),ncases);
-fprintf(dout,'The variable names are:\n');
-fprintf(dout,'%s\t',labels{1:end-1});
-fprintf(dout,'%s\n\n',labels{end});
-for i=1:nnodes
-    if levels{i} == 1
-       fprintf(dout,'%s is a continuous variable\n',labels{i});
-       fprintf(dout,'%s\n',reason{i});
-       column = str2double(data(:,i));
-       colmean = mean(column);
-       colstd = std(column);
-       fprintf(dout,'It has a mean of %6.3f and a standard deviation of %6.3f\n\n',mean(column),std(column))
-    else 
-       fprintf(dout,'%s is a discrete variable with %i states\n',labels{i},levels{i});
-       fprintf(dout,'%s\n',reason{i});
-       fprintf(dout,'The states are: ');
-       fprintf(dout,'%s ',states{i}{1:end-1});
-       fprintf(dout,'%s\n\n',states{i}{end});
-    end
-end
-fclose(fout);
-
-outfile = strcat(pre,'continuous_input.txt');
-fout = fopen(outfile,'w');
-fprintf(fout,'%s\t',labels{1:end-1});
-fprintf(fout,'%s\n',labels{end});
-fprintf(fout,'%i\t',levels{1:end-1});
-fprintf(fout,'%i\n',levels{end});
-%Need to replace states in discrete variables with integers for BNT
-for i = 1:nnodes
-    if levels{i} > 1
-	for j = 1:ncases
-            for k=1:size(states{i},1)
-	      if data{j,i} == states{i}{k}
-                 data{j,i} = sprintf('%i',num2cell(k){1});;
-                 break
-              end
-            end
-        end
-     end
-end
-for i = 1:ncases
-      fprintf(fout,'%s\t',data{i,1:end-1});
-      fprintf(fout,'%s\n',data{i,end});
-end
-fclose(fout);
-
-
-
-
-
-end
-%  end of prepareInput.m
\ No newline at end of file
diff --git a/sourcecodes/parameter_learning/code_backup/readInput.m b/sourcecodes/parameter_learning/code_backup/readInput.m
deleted file mode 100644
index 891d7f36..00000000
--- a/sourcecodes/parameter_learning/code_backup/readInput.m
+++ /dev/null
@@ -1,63 +0,0 @@
-function [ labels, cases, bnet, node_sizes, data,labelsold] = readInput( dfile, sfile, nnodes, std_flag )
-    %readInput is to be used when reading in a network with a known structure
-    %   
-    %Input:
-	%   dfile  = name of the file containing the data (required)
-    %   sfile = name of the file containing the structure (required)
-    %   nnodes = number of nodes in the network (required)
-    %   std_flag = flag for whether or not to standardize the data.
-    %   (optional-- Default is FALSE)
-    %
-    %   See readInputData.m and readInputStructure.m for description of the
-    %       format of the dfile and sfile, respectively. 
-    %
-    %Output:
-    %   labels = cell array with the names of the nodes.
-    %   cases = cell array with the data.
-    %   bnet = BNT bayesian network with the input structure.
-
-if nargin < 4
-    std_flag = false(1);
-end
-
-    
-% read in the file with the data
-[labelsold,node_sizes,cases, data] = readInputData(dfile,nnodes);
-
-
-% read in the file with the structure
-[dag] = readInputStructure(sfile,labelsold);
-
-
-% check the ordering of the nodes and reorder if necessary
-[labels,cases,dag,node_sizes,ord_flag] = checkStructure(labelsold,cases,dag,node_sizes);
-
-dcount = 0;
-for i = 1:nnodes
-    if node_sizes(i) ~= 1
-        dcount = dcount + 1;
-    end
-end
-discrete = zeros(1,dcount);
-dcount = 0;
-for i = 1:nnodes
-    if node_sizes(i) ~= 1
-        dcount = dcount + 1;
-        discrete(dcount) = i;
-    end
-end
-
-bnet = mk_bnet(dag,node_sizes,'discrete',discrete,'names',labels);
-
-%bnet.dag
-
-checkDiscreteNodes(bnet,cases);
-
-% standardize continuous data to have a mean = 0 and std = 1
-if (std_flag)
-    [cases] = standardizeData(labels,node_sizes,cases);
-end
-        
-
-end
-%  end of readInput.m
diff --git a/sourcecodes/parameter_learning/code_backup/readInputData.m b/sourcecodes/parameter_learning/code_backup/readInputData.m
deleted file mode 100644
index 706e2751..00000000
--- a/sourcecodes/parameter_learning/code_backup/readInputData.m
+++ /dev/null
@@ -1,75 +0,0 @@
-function  [ labels , node_sizes, cases, data] = readInputData( dfile , nnodes )
-	%  readColData  reads data from a file containing data in columns
-	%               that have text titles, and possibly other header text
-	%   
-	%  Input:
-	%     dfile  = name of the file containing the data.(required)
-	%     nnodes  = number of columns in the data file.  (required)
-    %
-    %   Function assumes the following format for the input file:
-    %       1) First line has labels for each of the nodes.  There cannot
-    %              be spaces in any node label.
-    %       2) The next line is the "node_sizes" of the nodes.  If the 
-    %           nodes are discrete, this number will be equal to the number
-    %           of states.  If the nodes are continuous, they should be 
-    %           equal to 1.  The function assumes that any nodes with
-    %           node_size = 1 is continuous.
-    %       3) The rest of the file is numeric data.  The data in the input
-    %               data has the number of columns equal to the number of 
-    %               nodes in the network and the number of rows equal to
-    %               the number of samples.
-    %
-    %
-	%  Output:
-	%     labels = cell array with node (column) labels.
-    %     node_sizes  =  vector with the size of each node
-    %     cases = cell array with the data.  The cases array is transposed
-    %       in comparison with the input data to agree with the format of
-    %       cell data used in BNT.
-
-%  open file for input, include error handling
-fin = fopen(dfile,'r');
-if fin < 0
-   error(['Could not open ',dfile,' for input']);
-end
-
-% Read in first line to get the node labels.
-labels = cell(1,nnodes);
-buffer = fgetl(fin);    %get header line as a string
-for j=1:nnodes
-    [next,buffer] = strtok(buffer);
-    labels{j} = next;
-end
-
-%  Read in the data.  Use the vetorized fscanf function to load all
-%  numerical values into one vector.  Then reshape this vector into a
-%  matrix.
-
-data = fscanf(fin,'%f');  %  Load the numerical values into one long vector
-
-
-
-
-nd = length(data);        %  total number of data points
-nr = nd/nnodes;            %  number of rows; check (next statement) to make sure
-if nr ~= round(nd/nnodes)
-   fprintf(1,'\ndata: nrow = %f\tncol = %d\n',nr,nnodes);
-   fprintf(1,'number of data points = %d does not equal nrow*ncol\n',nd);
-   error('data is not rectangular')
-end
-
-data = reshape(data,nnodes,nr)';   %  have to transpose the reshaped array
-
-
-node_sizes = zeros(1,nnodes);
-for j = 1:nnodes
-    node_sizes(j) = data(1,j);
-end
-
-nr = nr - 1;
-data(1,:) = [];
-cases = cell(nnodes,nr);
-cases(:,:) = num2cell(data');
-
-end
-%  end of readInputData.m
\ No newline at end of file
diff --git a/sourcecodes/parameter_learning/code_backup/readInputStructure.m b/sourcecodes/parameter_learning/code_backup/readInputStructure.m
deleted file mode 100644
index 6b3cbece..00000000
--- a/sourcecodes/parameter_learning/code_backup/readInputStructure.m
+++ /dev/null
@@ -1,72 +0,0 @@
-function [ dag ] = readInputStructure( sfile, labels )
-%readInputStructure Read in file with structure information
-    %   
-    %Input:
-	%     sfile  = name of the file containing the data (required)
-	%     labels = cell array with node labels. (required)
-    %     nnodes  = number of columns in the data file. (required)  
-    %
-    %   Function assumes the following format for the structure input file:
-    %       1) The first line has node labels.  These must be the same as 
-    %           in the input data file.  They cannot contain spaces.
-    %       2) The remainder of the file contains the structure of the dag.
-    %           The structure of a graph is a N-by-N matrix, where N is the
-    %           number of nodes.  There are 1's in the matrix representing
-    %           parent-child relationships.  For each 1, the row indicates
-    %           the parent and the column indicates the child.  For
-    %           example, a 1 in the (2,3) position of the matrix indicates
-    %           that there is an arc pointing from node 2 to node 3.
-    %        
-    %
-	%  Output:
-    %     dag = matrix with the structure.
-%
-%   Read in first line of the structure file
-%  open file for input, include error handling
-fin = fopen(sfile,'r');
-if fin < 0
-   error(['Could not open ',sfile,' for input']);
-end
-
-nnodes = size(labels,2);
-% Read in first line to get the node labels.
-labels_test = cell(1,nnodes);
-buffer = fgetl(fin);    %get header line as a string
-for j=1:nnodes
-    [next,buffer] = strtok(buffer);
-    labels_test{j} = next;  
-end
-    
-for j=1:nnodes
-    if labels_test{j} ~= labels{j}
-        fprintf(['Label of node ',j,' is not consistent in input and structure files'])
-    end
-end
-
-data = fscanf(fin,'%f');
-  
-nd = length(data);        %  total number of data points
-nr = nd/nnodes;            %  number of rows; check (next statement) to make sure
-if nr ~= round(nd/nnodes)
-   fprintf(1,'\ndata: nrow = %f\tncol = %d\n',nr,nnodes);
-   fprintf(1,'number of data points = %d does not equal nrow*ncol\n',nd);
-   error('Structure file does not have the correct dimensions (1)')
-end
-% check to make sure that structure is square
-if nr ~= nnodes
-    error('Structure file does not have the correct dimensions (2)')
-end
-
-data = reshape(data,nnodes,nr)';   %  have to transpose the reshaped array
-
-
-dag = zeros(nnodes,nnodes);
-for i = 1:size(data,1)
-    for j = 1:size(data,2)
-        dag(i,j) = data(i,j);
-    end
-end
-
-
-end
-%  end of readInputStructure.m
diff --git a/sourcecodes/parameter_learning/code_backup/runBN_initial.m b/sourcecodes/parameter_learning/code_backup/runBN_initial.m
deleted file mode 100644
index 0deff1b5..00000000
--- a/sourcecodes/parameter_learning/code_backup/runBN_initial.m
+++ /dev/null
@@ -1,57 +0,0 @@
-function runBN_initial(pre)
-sfile=strcat(pre,'structure_input.txt');
-dfile=strcat(pre,'continuous_input.txt');
-
-nnodefile=strcat(pre,'nnode.txt');
-fnnode = fopen(nnodefile,'r');
-nnodes = fscanf(fnnode,'%d');
-
-
-mapfilename=strcat(pre,'mapdata.txt');
-mapvalfilename=strcat(pre,'map.txt');
-
-mapfile = fopen(mapfilename,'w');
-
-mapval = fopen(mapvalfilename,'w');
-
-
-Std_flag=true;
-[labels,cases,bnet,node_sizes,data,labelsold]=readInput(dfile,sfile,nnodes,Std_flag);
-s=std(data,0,1);
-m=mean(data);
-
-for i=1:nnodes
-  fprintf(mapval,'%s\t%f\t%f\n',labelsold{i},s(i),m(i));
-end
-
-fprintf(mapfile,'%s',labels{1});
-for i=2:nnodes
-  fprintf(mapfile,'\t%s',labels{i});
-end
-fprintf(mapfile,'\n');
-fclose(mapval);
-fclose(mapfile);
-
-%Need to rearrange the means and stdevs to match the new labeling.
-means = cell(1,nnodes);
-stdevs = cell(1,nnodes);
-for i = 1:nnodes
-    for j = 1:nnodes
-       if strcmp(labels{i},labelsold{j})
-          means{i} = m(j);
-          stdevs{i} = s(j);
-          break
-       end
-    end
-end
-
-
-[bnet]=parameterLearning(bnet,cases);
-
-filename=strcat(pre,'net_figure.txt');
-
-drawFigure(nnodes,bnet,labels,filename,cases,stdevs,means);
-
-writeParameters(pre,nnodes,bnet,labels,cases,labelsold,s,m);
-
-end
diff --git a/sourcecodes/parameter_learning/code_backup/standardizeData.m b/sourcecodes/parameter_learning/code_backup/standardizeData.m
deleted file mode 100644
index db5e04c7..00000000
--- a/sourcecodes/parameter_learning/code_backup/standardizeData.m
+++ /dev/null
@@ -1,25 +0,0 @@
-function [ cases ] = standardizeData( labels, node_sizes, cases )
-%standardizeData standardizes continuous nodes so they have a mean = 0
-%   and standard deviation = 1
-
-
-nnodes = size(labels,2);
-
-%fprintf(['Standardizing data for continuous nodes\n'])
-for i = 1:nnodes
-    if node_sizes(i) == 1
-        temp = cell2num(cases(i,:));
-        [temp] = standardize(temp);
-        cases(i,:) = num2cell(temp);
-    end
-end
-
-%write standardized data to file
-%fprintf(['Standardized data is written to file standardized_data.txt\n'])
-%fout = 'standardized_data.txt';
-%txt = sprintf([repmat('%s\t',1,size(labels,2))],labels{:});
-%dlmwrite(fout,txt,'');
-%dlmwrite(fout,cell2num(cases'),'-append','delimiter','\t');
-
-end
-
diff --git a/sourcecodes/parameter_learning/code_backup/writeParameters.m b/sourcecodes/parameter_learning/code_backup/writeParameters.m
deleted file mode 100644
index 0790a8e2..00000000
--- a/sourcecodes/parameter_learning/code_backup/writeParameters.m
+++ /dev/null
@@ -1,106 +0,0 @@
-function [] = writeParameters(pre,nnodes,bnet,labels,cases,labelsold,s,m)
-%Writes a file that contains the parameters of the network with no evidence.
-
-
-%%Get the types of the nodes.
-typefile = strcat(pre,'type.txt');
-ftype = fopen(typefile,'r');
-types = cell(1,nnodes);
-buffer = fgetl(ftype);
-buffer = fgetl(ftype);
-for j = 1:nnodes
-    [next,buffer] = strtok(buffer);
-    types{j} = uint16(str2num(next));
-end
-
-max_states = 0;
-disc_nodes = 0;
-for j = 1:nnodes
-  if types{j} > max_states
-    max_states = types{j};
-  end
-  if types{j} > 1
-    disc_nodes = disc_nodes + 1;
-  end
-end
-
-%Add 1 to max_states to account for node name
-max_states = max_states + 1;
-
-%%Get mapping of discrete levels.
-levelfile = strcat(pre,'nlevels.txt');
-flevels = fopen(levelfile,'r');
-levels = cell(disc_nodes,max_states);
-ndisc_nodes = 0;
-for i=1:disc_nodes
-    ndisc_nodes = ndisc_nodes + 1;
-    buffer = fgetl(flevels);
-     for j = 1:max_states
-       [next,buffer] = strtok(buffer);
-       if j == 1
-          levels{i,j} = next;
-       else
-%          levels{i,j} = uint16(str2num(next));
-          levels{i,j} = next;
-       end        
-       if length(buffer) < 1
-        break
-       end
-     end
-end
-
-
-evidence = cell(1,nnodes);
-engine = jtree_inf_engine(bnet);
-[engine,loglik] = enter_evidence(engine,evidence);
-
-%Open output file.
-filename = strcat(pre,'parameters.txt');
-fileID = fopen(filename,'w');
-
-for i = 1:nnodes
-    for j = 1:nnodes
-	if strcmp(labelsold{i},labels{j});
-            nodeid = j;
-            break
-        end
-    end
-    predict = marginal_nodes(engine,nodeid);
-    %%%Print the name of the node
-    fprintf(fileID,'%s\n',labels{nodeid});
-    %%%Print the type of node
-    if bnet.node_sizes(nodeid) == 1;
-        line = 'Continuous node\n';
-        fprintf(fileID,line);
-        %%% 'i' in the line below is correct: m and s are had original node labeling
-        adj_mu = predict.mu*s(i)+m(i);
-        adj_sigma = s(i)*predict.Sigma;
-	fprintf(fileID,'%6.4f\t%6.4f\n\n',adj_mu,adj_sigma);
-    else
-        line = 'Discrete node with %i states\n';
-        fprintf(fileID,line,bnet.node_sizes(nodeid));
-        %line = 'Probability of each state\n';
-        %fprintf(fileID,line);
-        nodeid2 = 0;
-        for k = 1:ndisc_nodes,
-           if strcmp(levels{k,1},labels{nodeid}),
-	      nodeid2 = k;
-              break
-           end
-        end
-        for j = 1:bnet.node_sizes(nodeid),
-            %%%For discrete nodes, the state and the percent of that state
-%		  fprintf(fileID,'%i\t%6.4f\n',levels{nodeid2,j+1},predict.T(j));
-		  fprintf(fileID,'%s\t%6.4f\n',levels{nodeid2,j+1},predict.T(j));
-        end;
-        fprintf(fileID,'\n')
-
-    end
-end
-
-
-
-fclose(fileID);
-
-end
-
diff --git a/sourcecodes/parameter_learning/code_backup/writeParameters_ev.m b/sourcecodes/parameter_learning/code_backup/writeParameters_ev.m
deleted file mode 100644
index fc24e2e5..00000000
--- a/sourcecodes/parameter_learning/code_backup/writeParameters_ev.m
+++ /dev/null
@@ -1,151 +0,0 @@
-function [] = writeParameters_ev(pre,bnet,nnodes,labels,cases,stdevs,means,selectvar,selectdata)
-%Writes a file that contains the parameters of the network after entering evidence.
-
-%Read in original node labels to get node IDs.
-infile = strcat(pre,'continuous_input.txt');
-fin = fopen(infile,'r');
-labelsold = cell(1,nnodes);
-buffer = fgetl(fin);
-for j = 1:nnodes
-    [next,buffer] = strtok(buffer);
-    labelsold{j} = next;
-end
-fclose(fin);
-
-
-evidence = cell(1,nnodes);
-engine = jtree_inf_engine(bnet);
-
-m = size(selectvar,1);
-
-%%Get the types of the nodes.
-typefile = strcat(pre,'type.txt');
-ftype = fopen(typefile,'r');
-types = cell(1,nnodes);
-buffer = fgetl(ftype);
-buffer = fgetl(ftype);
-for j = 1:nnodes
-   [next,buffer] = strtok(buffer);
-   types{j} = uint16(str2num(next));
-end
-
-max_states = 0;
-disc_nodes = 0;
-for j = 1:nnodes
-  if types{j} > max_states
-       max_states = types{j};
-  end
-  if types{j} > 1
-    disc_nodes = disc_nodes + 1;
-  end
-end
-
-%Add 1 to max_states to account for node name
-max_states = max_states + 1;
-
-%%Get mapping of discrete levels.
-levelfile = strcat(pre,'nlevels.txt');
-flevels = fopen(levelfile,'r');
-levels = cell(disc_nodes,max_states);
-ndisc_nodes = 0;
-for i=1:disc_nodes
-	ndisc_nodes = ndisc_nodes + 1;
-buffer = fgetl(flevels);
-for j = 1:max_states
-	  [next,buffer] = strtok(buffer);
-       if j == 1
-	 levels{i,j} = next;
-       else
-%	 levels{i,j} = uint16(str2num(next));
-	 levels{i,j} = next;
-       end
-       if length(buffer) < 1
-        break
-       end
-     end
-end
-
-
-ev_dat = zeros(1,nnodes);
-for i = 1:m,
-    di=selectvar(i,1);
-    ev_dat(di)=selectdata(i,1);
-%Need to standardize evidence for continuous nodes.
-    if bnet.node_sizes(di) == 1,
-        ev_dat(di) = (ev_dat(di) - means{di})/stdevs{di};
-    end
-    evidence{di} = ev_dat(di);
-end
-
-[engine,loglik]=enter_evidence(engine,evidence);
-
-%Open output file.
-filename = strcat(pre,'parameters_ev.txt');
-fileID = fopen(filename,'w');
-
-for i = 1:nnodes
-    for j = 1:nnodes
-	if strcmp(labelsold{i},labels{j});
-            nodeid = j;
-            break
-        end
-    end
-    %%%Print the name of the node
-    fprintf(fileID,'%s\n',labels{nodeid});
-    predict = marginal_nodes(engine,nodeid);
-    if isempty(evidence{nodeid})
-       %%%Print the type of node
-       if bnet.node_sizes(nodeid) == 1;
-           line = 'Continuous parameters considering evidence:\n';
-           fprintf(fileID,line);
-           %line = 'Mean and standard deviation of Gaussian distribution\n';
-           %fprintf(fileID,line);
-	     adj_mu = predict.mu*stdevs{nodeid}+means{nodeid};
-             adj_sigma = stdevs{nodeid}*predict.Sigma;
-             fprintf(fileID,'%6.4f\t%6.4f\n\n',adj_mu,adj_sigma);
-       else
-           line = 'Probability of states considering evidence:\n';
-           fprintf(fileID,line);
-           nodeid2 = 0;
-           for k = 1:ndisc_nodes,
-	     if strcmp(levels{k,1},labels{nodeid}),
-                nodeid2 = k;
-                break
-             end
-            end
-	    for j = 1:bnet.node_sizes(nodeid),
-		%%%For discrete nodes, the state and the percent of that state
-%		fprintf(fileID,'%i\t%6.4f\n',levels{nodeid2,j+1},predict.T(j));
-		fprintf(fileID,'%s\t%6.4f\n',levels{nodeid2,j+1},predict.T(j));
-           end;
-           fprintf(fileID,'\n')
-       end
-   else
-       if bnet.node_sizes(nodeid) == 1;
-          line = 'Evidence was observed for this node. The observed value was:\n';
-          fprintf(fileID,line);  
-          adj_mu = ev_dat(nodeid)*stdevs{nodeid}+means{nodeid};
-          fprintf(fileID,'%6.4f\n\n',adj_mu);
-       else
-          nodeid2 = 0;
-          for k = 1:ndisc_nodes,
-	    if strcmp(levels{k,1},labels{nodeid}),
-               nodeid2 = k;
-               break
-            end
-          end
-	 line = 'Evidence was observed for this node. The observed state was:\n';
-         fprintf(fileID,line);
-         state_ev =   uint16(ev_dat(nodeid));
-%         fprintf(fileID,'%i\n\n',levels{nodeid2,state_ev+1});
-         fprintf(fileID,'%s\n\n',levels{nodeid2,state_ev+1});
-       end
-   end
-end
-
-
-
-fclose(fileID);
-
-end
-
diff --git a/sourcecodes/parameter_learning/code_backup/writeParameters_int.m b/sourcecodes/parameter_learning/code_backup/writeParameters_int.m
deleted file mode 100644
index ed92d593..00000000
--- a/sourcecodes/parameter_learning/code_backup/writeParameters_int.m
+++ /dev/null
@@ -1,186 +0,0 @@
-function [] = writeParameters_int(pre,bnet,nnodes,labels,cases,stdevs,means,selectvar,selectdata)
-%Writes a file that contains the parameters of the network after intervention.
-
-
-%First read input file to get node labels to get node IDs.
-infile = strcat(pre,'continuous_input.txt');
-fin = fopen(infile,'r');
-labelsold = cell(1,nnodes);
-buffer = fgetl(fin);
-for j = 1:nnodes
-    [next,buffer] = strtok(buffer);
-    labelsold{j} = next;
-end
-
-evidence = cell(1,nnodes);
-engine = jtree_inf_engine(bnet);
-
-m = size(selectvar,1);
-
-%%Get the types of the nodes.
-typefile = strcat(pre,'type.txt');
-ftype = fopen(typefile,'r');
-types = cell(1,nnodes);
-buffer = fgetl(ftype);
-buffer = fgetl(ftype);
-for j = 1:nnodes
-   [next,buffer] = strtok(buffer);
-   types{j} = uint16(str2num(next));
-end
-
-max_states = 0;
-disc_nodes = 0;
-for j = 1:nnodes
-  if types{j} > max_states
-       max_states = types{j};
-  end
-  if types{j} > 1
-    disc_nodes = disc_nodes + 1;
-  end
-end
-
-%Add 1 to max_states to account for node name
-max_states = max_states + 1;
-
-%%Get mapping of discrete levels.
-levelfile = strcat(pre,'nlevels.txt');
-flevels = fopen(levelfile,'r');
-levels = cell(disc_nodes,max_states);
-ndisc_nodes = 0;
-for i=1:disc_nodes
-	ndisc_nodes = ndisc_nodes + 1;
-buffer = fgetl(flevels);
-for j = 1:max_states
-	  [next,buffer] = strtok(buffer);
-       if j == 1
-	 levels{i,j} = next;
-       else
-%	 levels{i,j} = uint16(str2num(next));
-	 levels{i,j} = next;
-       end
-       if length(buffer) < 1
-        break
-       end
-     end
-end
-
-
-ev_dat = zeros(1,nnodes);
-for i = 1:m,
-    di=selectvar(i,1);
-    ev_dat(di)=selectdata(i,1);
-%Need to standardize evidence for continuous nodes.
-    if bnet.node_sizes(di) == 1,
-      ev_dat(di) = (ev_dat(di) - means{di})/stdevs{di};
-    end
-    evidence{di} = ev_dat(di);
-end
-
-[engine,loglik]=enter_evidence(engine,evidence);
-
-%Get list of nodes that are children, grandchildren, etc. of intervened nodes
-%int_nodes contains the list of these children nodes
-int_nodes = zeros(1,nnodes);
-%new_nodes is just a temporary array to know when to keep looking
-new_nodes = zeros(1,nnodes);
-for i = 1:nnodes
-    if !isempty(evidence{i});
-        new_nodes(i) = 1;
-        int_nodes(i) = 1;
-    end
-end
-while sum(new_nodes) != 0
-   new_nodes_old = new_nodes;
-   new_nodes = zeros(1,nnodes);
-   for i = 1:nnodes
-      if new_nodes_old(i) == 1
-           for j = 1:nnodes
-              if int_nodes(j) == 0
-	        if bnet.dag(i,j) == 1,
-		     new_nodes(j) = 1;
-                end
-              end
-           end
-       end
-   end
-   for i = 1:nnodes
-      if new_nodes(i) == 1;
-        int_nodes(i) = 1;
-      end
-   end               
-end
-
-
-%Open output file.
-filename = strcat(pre,'parameters_ev.txt');
-fileID = fopen(filename,'w');
-
-for i = 1:nnodes
-    for j = 1:nnodes
-	if strcmp(labelsold{i},labels{j});
-            nodeid = j;
-            break
-        end
-    end
-    %check to see if this is a node impacted by intervention
-    if int_nodes(nodeid) == 1
-    %%%Print the name of the node
-    fprintf(fileID,'%s\n',labels{nodeid});
-    predict = marginal_nodes(engine,nodeid);
-    if isempty(evidence{nodeid})
-       %%%Print the type of node
-       if bnet.node_sizes(nodeid) == 1;
-           line = 'Continuous parameters considering intervention:\n';
-           fprintf(fileID,line);
-           %line = 'Mean and standard deviation of Gaussian distribution\n';
-           %fprintf(fileID,line);
-	   adj_mu = predict.mu*stdevs{nodeid}+means{nodeid};
-           adj_sigma = stdevs{nodeid}*predict.Sigma;
-           fprintf(fileID,'%6.4f\t%6.4f\n\n',adj_mu,adj_sigma);
-       else
-           line = 'Probability of states considering intervention:\n';
-           fprintf(fileID,line);
-           nodeid2 = 0;
-           for k = 1:ndisc_nodes,
-	     if strcmp(levels{k,1},labels{nodeid}),
-                nodeid2 = k;
-                break
-             end
-            end
-	    for j = 1:bnet.node_sizes(nodeid),
-		%%%For discrete nodes, the state and the percent of that state
-%		fprintf(fileID,'%i\t%6.4f\n',levels{nodeid2,j+1},predict.T(j));
-		fprintf(fileID,'%s\t%6.4f\n',levels{nodeid2,j+1},predict.T(j));
-           end;
-           fprintf(fileID,'\n')
-       end
-   else
-       if bnet.node_sizes(nodeid) == 1;
-          line = 'Intervention on this node assigned the following value:\n';
-          fprintf(fileID,line);  
-          adj_mu = ev_dat(nodeid)*stdevs{nodeid}+means{nodeid};
-          fprintf(fileID,'%6.4f\n\n',adj_mu);
-       else
-          nodeid2 = 0;
-          for k = 1:ndisc_nodes,
-	    if strcmp(levels{k,1},labels{nodeid}),
-               nodeid2 = k;
-               break
-            end
-          end
-	 line = 'Intervention on this node assigned the following state:\n';
-         fprintf(fileID,line);
-         state_ev =   uint16(ev_dat(nodeid));
-%         fprintf(fileID,'%i\n\n',levels{nodeid2,state_ev+1});
-         fprintf(fileID,'%s\n\n',levels{nodeid2,state_ev+1});
-       end
-   end
-   end
-end
-
-
-
-fclose(fileID);
-
-end
-
diff --git a/sourcecodes/parameter_learning/createJSON.m b/sourcecodes/parameter_learning/createJSON.m
index 65758356..e6fd7ea2 100644
--- a/sourcecodes/parameter_learning/createJSON.m
+++ b/sourcecodes/parameter_learning/createJSON.m
@@ -12,6 +12,10 @@ function  [ ] = createJSON( pre )
    %
 
 
+nnodefile=strcat(pre,'nnode.txt');
+fnnode = fopen(nnodefile,'r');
+nnodes = fscanf(fnnode,'%d');
+
 %  open file for input, include error handling
 dfile=strcat(pre,'structure_input.txt');
 
@@ -22,7 +26,6 @@ end
 
 % Read in first line to get the number of nodes and the node labels.
 buffer = strtrim(fgetl(fin));    %get header line as a string
-nnodes = numel(strfind(buffer,"\t"))+1;
 labels = cell(1,nnodes);
 for j=1:nnodes
     [next,buffer] = strtok(buffer);
@@ -40,8 +43,14 @@ for i = 1:nnodes
 end
 
 
-% open file to read in model averaging scores
+
+%Check to see if a file with model averaging scores exists
 dfile2=strcat(pre,'structure_input_temp.txt');
+%if it does not exist, then just open the other structure file again
+if exist(dfile2, 'file') != 2
+   dfile2 = dfile;
+   frewind(dfile2);
+end
 
 fin2 = fopen(dfile2,'r');
 if fin2 < 0
diff --git a/sourcecodes/parameter_learning/createSVG.m b/sourcecodes/parameter_learning/createSVG.m
index f7cc9b64..2d190b68 100644
--- a/sourcecodes/parameter_learning/createSVG.m
+++ b/sourcecodes/parameter_learning/createSVG.m
@@ -16,6 +16,10 @@ function  [ ] = createSVG( pre )
    %
 
 
+nnodefile=strcat(pre,'nnode.txt');
+fnnode = fopen(nnodefile,'r');
+nnodes = fscanf(fnnode,'%d');
+
 %  open file for input, include error handling
 dfile=strcat(pre,'structure_input.txt');
 
@@ -26,19 +30,20 @@ end
 
 % Read in first line to get the number of nodes and the node labels.
 buffer = fgetl(fin);    %get header line as a string
-nnodes = numel(strfind(buffer,"\t")) + 1;
+
 labels = cell(1,nnodes);
 for j=1:nnodes
+    j, buffer
     [next,buffer] = strtok(buffer);
     labels{j} = next;
 end
 
-
 % Read in the edges
 edges = cell(nnodes,nnodes);
 for i = 1:nnodes
     buffer = fgetl(fin);
     for j = 1:nnodes
+	 i, j, buffer
          [next,buffer] = strtok(buffer);
          edges{i,j} = next;
     end
@@ -48,6 +53,13 @@ end
 % open file to read in model averaging scores
 dfile2=strcat(pre,'structure_input_temp.txt');
 
+%If it does not exist, then just read in the regular structure file
+%%   as the model averaging score file
+if exist(dfile2, 'file') != 2
+   dfile2 = dfile;
+   frewind(dfile2);
+end
+
 if (exist(dfile2) == 0)
   scores = cell(nnodes,nnodes);
   for i = 1:nnodes
@@ -107,11 +119,11 @@ end
 
 outfile = strcat(pre,'graphviz_svg.txt');
 fout = fopen(outfile,'w');
-fprintf(fout,"digraph G {\n");
+fprintf(fout,"digraph \"\" {\n");
 %fprintf(fout,"size=\"10,10\"; ratio = fill;\n");
 fprintf(fout,"size=\"10,10\"; remincross = true;\n");
-fprintf(fout,"node [shape=rectangle, width=1.0, fontsize=22];\n");
-fprintf(fout,"edge [fontsize=16];\n");
+fprintf(fout,"node [shape=box, fontsize=18, margin=\"0.05,0\", height=0.3, rounded=true];\n");
+fprintf(fout,"edge [fontsize=12];\n");
 for i = 1:nedges
   fprintf(fout,"\"%s\" -> \"%s\" [ label=\"%3.2f\", penwidth=\"%3.2f\" ];\n",labels{sources(i)},labels{targets(i)},scores1(i),2*scores1(i));
 end
@@ -121,11 +133,11 @@ fclose(fout);
 
 outfile2 = strcat(pre,'graphviz_svg_no_edge.txt');
 fout2 = fopen(outfile2,'w');
-fprintf(fout2,"digraph G {\n");
+fprintf(fout2,"digraph \"\" {\n");
 %fprintf(fout,"size=\"10,10\"; ratio = fill;\n");
 fprintf(fout2,"size=\"10,10\"; remincross = true;\n");
-fprintf(fout2,"node [shape=rectangle, width=1.0, fontsize=22];\n");
-fprintf(fout2,"edge [fontsize=16];\n");
+fprintf(fout2,"node [shape=box, fontsize=18, margin=\"0.05,0\", height=0.3,rounded=true];\n");
+fprintf(fout2,"edge [fontsize=12];\n");
 for i = 1:nedges
   fprintf(fout,"\"%s\" -> \"%s\" [ penwidth=\"%3.2f\" ];\n",labels{sources(i)},labels{targets(i)},2*scores1(i));
 end
diff --git a/sourcecodes/parameter_learning/drawFigure.m b/sourcecodes/parameter_learning/drawFigure.m
index c48f5b2d..8255f6b9 100644
--- a/sourcecodes/parameter_learning/drawFigure.m
+++ b/sourcecodes/parameter_learning/drawFigure.m
@@ -1,4 +1,4 @@
-function [] = drawFigure(nnodes,bnet,labels,filename,cases,stdevs,means)
+function [] = drawFigure(nnodes,bnet,labels,filename,cases,stdevs,means,pre)
 %drawFigure writes the parameters and data that are needed to draw the
 %structure of a Bayesian network for BNW.
 % This is the function that is called to create the initial
@@ -11,6 +11,10 @@ function [] = drawFigure(nnodes,bnet,labels,filename,cases,stdevs,means)
 % 
 % drawFigure is called by runBN_intial.m
 %
+% This was modified to show the original distributions of continuous nodes 
+%  as mixtures of Gaussian distributions instead of marginalizing the nodes.
+%  JZ, 7-15-2019
+
 
 A=cell2mat(cases');
 Amax=max(A);
@@ -26,6 +30,11 @@ fileID = fopen(filename,'w');
 %%% The number of nodes
 fprintf(fileID,'%i\n',nnodes);
 
+%Open file to write violin plot data
+
+violin_file = strcat(pre,'violin_orig.txt');
+vfile = fopen(violin_file,'w');
+
 %Get canvas size
 
 labels_temp = cellstr(labels);
@@ -68,7 +77,6 @@ for i = 1:nnodes,
     end
 end
 
-
 for i = 1:nnodes,
     %%% The name and type of each node (1=continuous, the number of states
     %%% if it is discrete
@@ -131,22 +139,67 @@ for i = 1:nnodes,
             fprintf(fileID,'%i\t%6.4f\n',j,predict.T(j));
         end;
     else
-        %cases(i)
-       % MAX(cases(i))
-       % MIN(cases(i))
-        [x_vals,y_vals] = calcGaussian(predict.mu,predict.Sigma,Amax(i),Amin(i));
-        %%%For continuous nodes, print x and the pdf of a normal curve.
-        for j = 1:101,
+	%% The name of the node for the violin plot data
+	if bnet.node_sizes(i) == 1;
+	    fprintf(vfile,'Data for new node\n');
+	    fprintf(vfile,'%s\n',labels{i});
+	end
+
+        %The next line is marginal node method for continuous variables.
+        %%[x_vals,y_vals] = calcGaussian(predict.mu,predict.Sigma,Amax(i),Amin(i));
+        %Instead get mixture of Gaussian distributions.
+	s=struct(bnet.CPD{i});
+	no_gaussians = size(s.Wsum)(1);
+        Wsum = sum(s.Wsum);
+        weights = zeros(no_gaussians,1);
+	for j=1:no_gaussians,
+            weights(j) = s.Wsum(j)/Wsum;
+        end;
+
+
+	%Get random samples from normals to make violin plots
+        for j=1:no_gaussians
+                normrnd_count = int16(1000*weights(j));
+                if normrnd_count > 0
+		    violin_data = normrnd(s.mean(j),sqrt(s.cov(j)),normrnd_count,1);
+		%violin_data = normrnd(s.mean(j),sqrt(s.cov(j)),1000,1);
+		    for k = 1:size(violin_data)
+		      fprintf(vfile,'%6.4f\n',violin_data(k));
+		    end
+		end
+	end
+        
+
+        all_y = zeros(101,1);
+        for j=1:no_gaussians
+            [x_vals,y_vals] = calcGaussian(s.mean(j),sqrt(s.cov(j)),Amax(i),Amin(i));
+            y_vals = y_vals*weights(j);
+            all_y = all_y + y_vals;
+	end;
+        
+        %%%For continuous nodes, print x and the pdf of curve.
+	for j = 1:101,
+            %Write data to make violin plots
+            %no_lines = int16(100*y_vals(j,1));
+            %if no_lines > 0;
+	    %	for k = 1:no_lines
+	    %	    fprintf(vfile,'%6.4f\n',x_vals(j,1));
+            %    end
+            %end
             %%Undo standardization
             x_vals(j,1) = x_vals(j,1)*stdevs{i}+means{i};
-            fprintf(fileID,'%6.4f\t%6.4f\n',x_vals(j,1),y_vals(j,1));
+            %%fprintf(fileID,'%6.4f\t%6.4f\n',x_vals(j,1),y_vals(j,1));
+            fprintf(fileID,'%6.4f\t%6.4f\n',x_vals(j,1),all_y(j,1));
         end;
-    end;
+
+end
+
 end
 %fprintf(fileID,'%s\t %\n',labels_temp{:});
 
 
 fclose(fileID);
+fclose(vfile);
 
 end
 
diff --git a/sourcecodes/parameter_learning/drawFigureM.m b/sourcecodes/parameter_learning/drawFigureM.m
index 820f06dd..4a666ada 100644
--- a/sourcecodes/parameter_learning/drawFigureM.m
+++ b/sourcecodes/parameter_learning/drawFigureM.m
@@ -1,4 +1,4 @@
-function [] = drawFigureM(nnodes,bnet,labels,filename,cases,stdevs,means,selectvar,selectdata)
+function [] = drawFigureM(nnodes,bnet,labels,filename,cases,stdevs,means,selectvar,selectdata,pre)
 %drawFigureM writes the parameters and data that are needed to draw the
 %structure of a Bayesian network after adding evidence or intervention
 %It creates the net_figure_new file after evidence/intervetion.
@@ -51,6 +51,11 @@ y = 1 - y;
 y = y - min(y);
 [x_dim,y_dim] = canvasSize(nnodes,x,y);
 
+%Open file to write violin plot data
+violin_file = strcat(pre,'violin_evidence.txt');
+vfile = fopen(violin_file,'w');
+
+
 %%% The dimensions of the canvas for the javascript code
 fprintf(fileID,'%i\t%i\t\n',x_dim,y_dim);
 x = x*x_dim;
@@ -141,7 +146,22 @@ for i = 1:nnodes,
             fprintf(fileID,'%i\t%6.4f\n',j,predict.T(j));
         end;
       else
-        [x_vals,y_vals] = calcGaussian(predict.mu,predict.Sigma,Amax(i),Amin(i));
+        %% The name of the node for the violin plot data
+        if bnet.node_sizes(i) == 1;
+            fprintf(vfile,'Data for new node\n');
+            fprintf(vfile,'%s\n',labels{i});
+        end
+
+        %Get random samples from normals to make violin plots
+        violin_data = normrnd(predict.mu,sqrt(predict.Sigma),1000,1);
+        %violin_data = normrnd(s.mean(j),sqrt(s.cov(j)),1000,1);
+        for k = 1:size(violin_data)
+            fprintf(vfile,'%6.4f\n',violin_data(k));
+        end
+
+
+
+        [x_vals,y_vals] = calcGaussian(predict.mu,sqrt(predict.Sigma),Amax(i),Amin(i));
         %%%For continuous nodes, print x and the pdf of a normal curve.
         for j = 1:101,
             %%Undo standardization
@@ -160,6 +180,7 @@ for i = 1:nnodes,
 end
 
 fclose(fileID);
+fclose(vfile);
 end
 
 
diff --git a/sourcecodes/parameter_learning/kfoldCrossValid.m b/sourcecodes/parameter_learning/kfoldCrossValid.m
index 02f34866..40b72c61 100644
--- a/sourcecodes/parameter_learning/kfoldCrossValid.m
+++ b/sourcecodes/parameter_learning/kfoldCrossValid.m
@@ -117,7 +117,7 @@ end
 filename = strcat(pre,'kfoldCV.txt');
 fileID = fopen(filename,'w');
 
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
+%fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
 
 %Calculate RMSEP (root mean square error of prediction) and q^2
 %First, calculate TSS (total sum of squares) and
@@ -136,19 +136,22 @@ end
 rmsep = sqrt(press/ncases);
 q_squared = 1 - press/tss;
 
-%% Print rmseq and q^2
-fprintf(fileID,'RMS error of predictions: %6.4f\n',rmsep);
-fprintf(fileID,'Q^2 of predictions: %6.4f\n\n',q_squared);
+%% Print rmsep and q^2
+%fprintf(fileID,'RMS error of predictions: %6.4f\n',rmsep);
+%fprintf(fileID,'Q^2 of predictions: %6.4f\n\n',q_squared);
 
 
 %%Print the predictions
-fprintf(fileID,'Predicted mean and standard deviation for each case:\n');
+%%fprintf(fileID,'Predicted mean and standard deviation for each case:\n');
 fprintf(fileID,'CaseRow\tFoldNumber\tActualValue\tPredictionMean\tPredictionStDev\n');
 for i = 1:ncases
      fprintf(fileID,'%i\t%i\t%6.4f\t',i,kfold_index(i),case_adj(i));
      fprintf(fileID,'%6.4f\t%6.4f\n',kfoldPredictions(i,:));
 end
 
+%%Print rmse and q^2
+fprintf(fileID,'k-fold CV for %s; RMSE= %6.4f; Q^2= %6.4f\n',predict_label,rmsep,q_squared);
+
 fflush(fileID);
 fclose(fileID);
 
@@ -267,14 +270,14 @@ accuracy = correct/ncases;
 filename = strcat(pre,'kfoldCV.txt');
 fileID = fopen(filename,'w');
 
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
+%fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
 
 
 %%Print the accuracy
-fprintf(fileID,'Fraction of accurate predictions: %6.4f\n\n',accuracy);
+%fprintf(fileID,'Fraction of accurate predictions: %6.4f\n\n',accuracy);
 
 %%Print the predictions
-fprintf(fileID,'Predicted likelihood of each state for each case:\n');
+%fprintf(fileID,'Predicted likelihood of each state for each case:\n');
 fprintf(fileID,'%s\t%s\t%s\t','CaseRow','FoldNumber','ActualState');
 fprintf(fileID,'%s\t',pred_levels{1:end-1});
 fprintf(fileID,'%s\n',pred_levels{end});
@@ -286,6 +289,8 @@ for i = 1:ncases
      fprintf(fileID,'%6.4f\n',kfoldPredictions(i,end));
 end
 
+fprintf(fileID,'k-fold CV for %s; Fraction of accurate predictions= %6.4f\n',predict_label,accuracy);
+
 fflush(fileID);
 fclose(fileID);
 
diff --git a/sourcecodes/parameter_learning/looCrossValid.m b/sourcecodes/parameter_learning/looCrossValid.m
index 840e486e..8cfffe79 100644
--- a/sourcecodes/parameter_learning/looCrossValid.m
+++ b/sourcecodes/parameter_learning/looCrossValid.m
@@ -2,7 +2,7 @@ function looCrossValid(pre,predict_label)
 % This function will peform leave-one-out cross-validation.
 % This requires the specification of the name of the variable
 %   that you want to predict.
-
+% Modifying to output a table.  Sept 2020
 
 
 sfile=strcat(pre,'structure_input.txt');
@@ -93,7 +93,7 @@ end
 filename = strcat(pre,'looCV.txt');
 fileID = fopen(filename,'w');
 
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
+%fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
 
 %Calculate RMSEP (root mean square error of prediction) and q^2
 %First, calculate TSS (total sum of squares) and
@@ -113,18 +113,17 @@ end
 rmsep = sqrt(press/ncases);
 q_squared = 1 - press/tss;
 
-%% Print rmseq and q^2
-fprintf(fileID,'RMS error of predictions: %6.4f\n',rmsep);
-fprintf(fileID,'Q^2 of predictions: %6.4f\n\n',q_squared);
 
 
 %%Print the predictions
-fprintf(fileID,'Predicted mean and standard deviation for each case:\n');
+%%fprintf(fileID,'Predicted mean and standard deviation for each case:\n');
 fprintf(fileID,'CaseRow\tActualValue\tPredictionMean\tPredictionStDev\n');
 for i = 1:ncases
      fprintf(fileID,'%i\t%6.4f\t',i,case_adj(i));
      fprintf(fileID,'%6.4f\t%6.4f\n',loopredictions(i,:));
 end
+%% Print rmse and q^2
+fprintf(fileID,'LOOCV predictions of %s; RMSE= %6.4f; Q^2= %6.4f\n',predict_label,rmsep,q_squared);
 
 fflush(fileID);
 fclose(fileID);
@@ -232,14 +231,13 @@ accuracy = correct/ncases;
 filename = strcat(pre,'looCV.txt');
 fileID = fopen(filename,'w');
 
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
+%fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
 
 
 %%Print the accuracy
-fprintf(fileID,'Fraction of accurate predictions: %6.4f\n\n',accuracy);
+%fprintf(fileID,'Fraction of accurate predictions: %6.4f\n\n',accuracy);
 
 %%Print the predictions
-fprintf(fileID,'Predicted likelihood of each state for each case:\n');
 fprintf(fileID,'%s\t%s\t','CaseRow','ActualState');
 fprintf(fileID,'%s\t',pred_levels{1:end-1});
 fprintf(fileID,'%s\n',pred_levels{end});
@@ -251,6 +249,8 @@ for i = 1:ncases
      fprintf(fileID,'%6.4f\n',loopredictions(i,end));
 end
 
+fprintf(fileID,'LOOCV predictions of %s; Fraction of accurate predictions= %6.4f\n',predict_label,accuracy);
+
 fflush(fileID);
 fclose(fileID);
 
diff --git a/sourcecodes/parameter_learning/modifyEdges.m b/sourcecodes/parameter_learning/modifyEdges.m
index 2b336710..6542d9fb 100644
--- a/sourcecodes/parameter_learning/modifyEdges.m
+++ b/sourcecodes/parameter_learning/modifyEdges.m
@@ -2,132 +2,147 @@ function  [ ] = modifyEdges( pre_old, pre_new )
    %  This function will allow users to add or delete edges from the network.
    %
    %  Input: 
-   %   1) pre_oldstructure_input.txt
-   %    Original structure file.
-   %   2) pre_olddel_edge.txt
-   %    A list of the edges that should be deleted.   
-   %   3) pre_oldadd_edge.txt
-   %    A list of the edges that should be added.
+   %  pre_oldstructure_input.txt-- old structure file that is just used to make sure the node order is consistent
+   %  pre_oldmodify_edge.txt-- file with network structure after modification
    %
    %  Output: 
    %   pre_newstructure_input.txt-- structure file with edges added/deleted.
+   %   pre_newstructure_input_temp.txt-- structure file with model averaging scores.
+   %  September 16, 2020: I am only writing the file with model averaging scores
+   %         if no edges were added to the network.
    %
 
 
 %  open file for input, include error handling
 dfile=strcat(pre_old,'structure_input.txt');
-
 fin = fopen(dfile,'r');
 if fin < 0
    error(['Could not open ',dfile,' for input']);
 end
 
-% Read in first line to get the number of nodes and the node labels.
+
+%  open file for input, include error handling
+mfile=strcat(pre_old,'modify_edge.txt');
+fin2 = fopen(mfile,'r');
+if fin2 < 0
+   error(['Could not open ',mfile,' for input']);
+end
+% Read in first line to get the number of nodes
+nnodes = str2num(fgetl(fin2));
+
+% Read in first line of old structure file to get the node labels.
 buffer = fgetl(fin);    %get header line as a string
-nnodes = numel(strfind(buffer,"\t"));
 labels = cell(1,nnodes);
 for j=1:nnodes
     [next,buffer] = strtok(buffer);
     labels{j} = next;
 end
 
-% Read in the edges
-edges = cell(nnodes,nnodes);
-for i = 1:nnodes
-    buffer = fgetl(fin);
-    for j = 1:nnodes
-         [next,buffer] = strtok(buffer);
-         edges{i,j} = next;
-    end
+%Read in network structure information
+buffer = fgetl(fin2);
+buffer = buffer(2:end-1);
+buffer = strrep(buffer,"\"","");
+labels2 = cell(1,nnodes);
+for j=1:nnodes
+    [next,buffer] = strtok(buffer,",");
+    labels2{j} = next;
 end
 
+nedges = str2num(fgetl(fin2));
+buffer = fgetl(fin2);
+buffer = buffer(2:end-1);
+buffer = strrep(buffer,"\"","");
+sources = cell(1,nedges);
+for j=1:nedges
+    [next,buffer] = strtok(buffer,",");
+    sources{j} = str2num(next);
+end
 
-%  open file with edges to be deleted
-dedgefile=strcat(pre_old,'del_edge.txt');
-fin2 = fopen(dedgefile,'r');
-ndel=fskipl(fin2,Inf) - 1;
-frewind(fin2);
 
-delfrom = cell(1,ndel);
-delto = cell(1,ndel);
+buffer = fgetl(fin2);
+buffer = buffer(2:end-1);
+buffer = strrep(buffer,"\"","");
+targets = cell(1,nedges);
+for j=1:nedges
+    [next,buffer] = strtok(buffer,",");
+    targets{j} = str2num(next);
+end
 
-buffer = fgetl(fin2);    %get header line
-for j=1:ndel
-  buffer = fgetl(fin2);    %get line with actual variables
-  [next,buffer] = strtok(buffer);
-  delfrom{j} = next;
-  [next,buffer] = strtok(buffer);
-  delto{j} = next;
+buffer = fgetl(fin2);
+buffer = buffer(2:end-1);
+weights = cell(1,nedges);
+for j=1:nedges
+    [next,buffer] = strtok(buffer,",");
+    weights{j} = next;
 end
 
-%get index of edges to delete
-idel_from = [];
-idel_to = [];
-for j = 1:ndel
-  for k = 1:nnodes
-    if strcmp(labels{k},delfrom{j})
-      idel_from = [idel_from;k];
-    endif
-    if strcmp(labels{k},delto{j})
-      idel_to = [idel_to;k];
+
+%label_map is the index in "labels" that corresponds to each label in "labels2"
+label_map = cell(1,nnodes);
+for i = 1:nnodes
+  current = labels2{i};
+  for j = 1:nnodes
+    if strcmp(current,labels{j})
+      label_map{i} = j;
     endif
   end
 end
 
-for i = 1:ndel
-  edges(idel_from(i),idel_to(i)) = "0";
-end
 
-fclose(fin2);
+edges_out = cell(nnodes,nnodes);
+scores_out = cell(nnodes,nnodes);
 
-%  open file with edges to be added
-aedgefile=strcat(pre_old,'add_edge.txt');
-fin3 = fopen(aedgefile,'r');
-nadd=fskipl(fin3,Inf) - 1;
-frewind(fin3);
+for i = 1:nedges
+  source_i = label_map{sources{i}};
+  target_i = label_map{targets{i}};
+  scores_out(source_i,target_i) = weights{i};
+  edges_out(source_i,target_i) = "1";
+end
 
-addfrom = cell(1,nadd);
-addto = cell(1,nadd);
 
-buffer = fgetl(fin3);    %get header line
-for j=1:nadd
-  buffer = fgetl(fin3);    %get line with actual variables
-  [next,buffer] = strtok(buffer);
-  addfrom{j} = next;
-  [next,buffer] = strtok(buffer);
-  addto{j} = next;
-end
+tf = cellfun('isempty',edges_out);
+edges_out(tf) = {"0"};
+scores_out(tf) = {"0"};
 
-%get index of edges to added
-iadd_from = [];
-iadd_to = [];
-for j = 1:nadd
-  for k = 1:nnodes
-    if strcmp(labels{k},addfrom{j})
-      iadd_from = [iadd_from;k];
-    endif
-    if strcmp(labels{k},addto{j})
-      iadd_to = [iadd_to;k];
-    endif
+test_score = 1;
+for i=1:nnodes
+  for j=1:nnodes
+     if strcmp(scores_out{i,j},"1.1")
+       test_score = 0;
+     end
   end
 end
 
-for i = 1:nadd
-  edges(iadd_from(i),iadd_to(i)) = "1";
-end
 
-
-
-
-
-outfile = strcat(pre_new,'structure_input.txt');
+if test_score == 1
+outfile = strcat(pre_new,'structure_input_temp.txt');
 fout = fopen(outfile,'w');
 fprintf(fout,'%s\t',labels{1:end-1});
-fprintf(fout,'%s\n',labels{end});
+fprintf(fout,'%s\t\n',labels{end});
 for i = 1:nnodes
-      fprintf(fout,'%s\t',edges{i,1:end-1});
-      fprintf(fout,'%s\n',edges{i,end});
+      fprintf(fout,'%s\t',scores_out{i,1:end-1});
+      fprintf(fout,'%s\t\n',scores_out{i,end});
 end
 fclose(fout);
+end
+
+
+
+outfile2 = strcat(pre_new,'structure_input.txt');
+fout2 = fopen(outfile2,'w');
+fprintf(fout2,'%s\t',labels{1:end-1});
+fprintf(fout2,'%s\t\n',labels{end});
+for i = 1:nnodes
+      fprintf(fout2,'%s\t',edges_out{i,1:end-1});
+      fprintf(fout2,'%s\t\n',edges_out{i,end});
+end
+fclose(fout2);
+
+
+
+
+
+
+
 
 end
diff --git a/sourcecodes/parameter_learning/normpdf.m b/sourcecodes/parameter_learning/normpdf.m
new file mode 100644
index 00000000..2b154f02
--- /dev/null
+++ b/sourcecodes/parameter_learning/normpdf.m
@@ -0,0 +1,50 @@
+function p = normpdf(x,m,s);
+% Normal probability density function
+%
+% pdf = normpdf(x,m,s);
+%
+% Computes the PDF of a the normal distribution 
+%    with mean m and standard deviation s
+%    default: m=0; s=1;
+% x,m,s must be matrices of same size, or any one can be a scalar. 
+%
+% see also: NORMCDF, NORMINV 
+
+% Reference(s):
+
+%	Version 1.28   Date: 23.Sep.2002
+%	Copyright (c) 2000-2002 by  Alois Schloegl <a.schloegl@ieee.org>	
+
+%    This program is free software; you can redistribute it and/or modify
+%    it under the terms of the GNU General Public License as published by
+%    the Free Software Foundation; either version 2 of the License, or
+%    (at your option) any later version.
+%
+%    This program is distributed in the hope that it will be useful,
+%    but WITHOUT ANY WARRANTY; without even the implied warranty of
+%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%    GNU General Public License for more details.
+%
+%    You should have received a copy of the GNU General Public License
+%    along with this program; if not, write to the Free Software
+%    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+if nargin==1,
+        m=0;s=1;
+elseif nargin==2,
+        s=1;
+end;        
+
+% allocate output memory and check size of argument
+z = (x-m)./s;		% if this line causes an error, input arguments do not fit. 
+
+%p = ((2*pi)^(-1/2))*exp(-z.^2/2)./s;
+SQ2PI = 2.5066282746310005024157652848110;
+p = exp(-z.^2/2)./(s*SQ2PI);
+
+p((x==m) & (s==0)) = inf;
+
+p(isinf(z)~=0) = 0;
+
+p(isnan(x) | isnan(m) | isnan(s) | (s<0)) = nan;
+
diff --git a/sourcecodes/parameter_learning/normrnd.m b/sourcecodes/parameter_learning/normrnd.m
new file mode 100644
index 00000000..0267ddf6
--- /dev/null
+++ b/sourcecodes/parameter_learning/normrnd.m
@@ -0,0 +1,130 @@
+## Copyright (C) 2012 Rik Wehbring
+## Copyright (C) 1995-2012 Kurt Hornik
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} normrnd (@var{mu}, @var{sigma})
+## @deftypefnx {Function File} {} normrnd (@var{mu}, @var{sigma}, @var{r})
+## @deftypefnx {Function File} {} normrnd (@var{mu}, @var{sigma}, @var{r}, @var{c}, @dots{})
+## @deftypefnx {Function File} {} normrnd (@var{mu}, @var{sigma}, [@var{sz}])
+## Return a matrix of random samples from the normal distribution with
+## parameters mean @var{mu} and standard deviation @var{sigma}.
+##
+## When called with a single size argument, return a square matrix with
+## the dimension specified.  When called with more than one scalar argument the
+## first two arguments are taken as the number of rows and columns and any
+## further arguments specify additional matrix dimensions.  The size may also
+## be specified with a vector of dimensions @var{sz}.
+## 
+## If no size arguments are given then the result matrix is the common size of
+## @var{mu} and @var{sigma}.
+## @end deftypefn
+
+## Author: KH <Kurt.Hornik@wu-wien.ac.at>
+## Description: Random deviates from the normal distribution
+
+function rnd = normrnd (mu, sigma, varargin)
+
+  if (nargin < 2)
+    print_usage ();
+  endif
+
+  if (!isscalar (mu) || !isscalar (sigma))
+    [retval, mu, sigma] = common_size (mu, sigma);
+    if (retval > 0)
+      error ("normrnd: mu and sigma must be of common size or scalars");
+    endif
+  endif
+
+  if (iscomplex (mu) || iscomplex (sigma))
+    error ("normrnd: MU and SIGMA must not be complex");
+  endif
+
+  if (nargin == 2)
+    sz = size (mu);
+  elseif (nargin == 3)
+    if (isscalar (varargin{1}) && varargin{1} >= 0)
+      sz = [varargin{1}, varargin{1}];
+    elseif (isrow (varargin{1}) && all (varargin{1} >= 0))
+      sz = varargin{1};
+    else
+      error ("normrnd: dimension vector must be row vector of non-negative integers");
+    endif
+  elseif (nargin > 3)
+    if (any (cellfun (@(x) (!isscalar (x) || x < 0), varargin)))
+      error ("normrnd: dimensions must be non-negative integers");
+    endif
+    sz = [varargin{:}];
+  endif
+
+  if (!isscalar (mu) && !isequal (size (mu), sz))
+    error ("normrnd: mu and sigma must be scalar or of size SZ");
+  endif
+
+  if (isa (mu, "single") || isa (sigma, "single"))
+    cls = "single";
+  else
+    cls = "double";
+  endif
+
+  if (isscalar (mu) && isscalar (sigma))
+    if (!isnan (mu) && !isinf (mu) && (sigma > 0) && (sigma < Inf))
+      rnd =  mu + sigma * randn (sz);
+    else
+      rnd = NaN (sz, cls);
+    endif
+  else
+    rnd = mu + sigma .* randn (sz);
+    k = isnan (mu) | isinf (mu) | !(sigma > 0) | !(sigma < Inf);
+    rnd(k) = NaN;
+  endif
+
+endfunction
+
+
+%!assert(size (normrnd (1,2)), [1, 1]);
+%!assert(size (normrnd (ones(2,1), 2)), [2, 1]);
+%!assert(size (normrnd (ones(2,2), 2)), [2, 2]);
+%!assert(size (normrnd (1, 2*ones(2,1))), [2, 1]);
+%!assert(size (normrnd (1, 2*ones(2,2))), [2, 2]);
+%!assert(size (normrnd (1, 2, 3)), [3, 3]);
+%!assert(size (normrnd (1, 2, [4 1])), [4, 1]);
+%!assert(size (normrnd (1, 2, 4, 1)), [4, 1]);
+
+%% Test class of input preserved
+%!assert(class (normrnd (1, 2)), "double");
+%!assert(class (normrnd (single(1), 2)), "single");
+%!assert(class (normrnd (single([1 1]), 2)), "single");
+%!assert(class (normrnd (1, single(2))), "single");
+%!assert(class (normrnd (1, single([2 2]))), "single");
+
+%% Test input validation
+%!error normrnd ()
+%!error normrnd (1)
+%!error normrnd (ones(3),ones(2))
+%!error normrnd (ones(2),ones(3))
+%!error normrnd (i, 2)
+%!error normrnd (2, i)
+%!error normrnd (1,2, -1)
+%!error normrnd (1,2, ones(2))
+%!error normrnd (1, 2, [2 -1 2])
+%!error normrnd (1,2, 1, ones(2))
+%!error normrnd (1,2, 1, -1)
+%!error normrnd (ones(2,2), 2, 3)
+%!error normrnd (ones(2,2), 2, [3, 2])
+%!error normrnd (ones(2,2), 2, 2, 3)
diff --git a/sourcecodes/parameter_learning/prepareInput.m b/sourcecodes/parameter_learning/prepareInput.m
index 3147d54e..39368582 100644
--- a/sourcecodes/parameter_learning/prepareInput.m
+++ b/sourcecodes/parameter_learning/prepareInput.m
@@ -1,6 +1,5 @@
 function  [ ] = prepareInput( pre )
-   % Jan. 2019: Modifying to allow for missing data.
-   %   
+   % 
    %  This function takes files that are uploaded to BNW and creates output
    %    files that can be used for structure and parameter learning.
    %  It replaces php code that was previously in bn_file_load_gom.php.
@@ -32,12 +31,13 @@ function  [ ] = prepareInput( pre )
    %           of states), and the rest is the data.
    %    2) A new output file is ???input_desc.txt, a file that describes the
    %        data so users can check that it has been parsed correctly.
-   %    3) ???nlevels.txt: The states of discrete variables.
-   %    4) ???name.txt: The names of the variables as uploaded.
-   %    5) ???type.txt: The number of states for each variables
+   %    3) ???input_table.txt Similar to above file, but in tabular format.
+   %    4) ???nlevels.txt: The states of discrete variables.
+   %    5) ???name.txt: The names of the variables as uploaded.
+   %    6) ???type.txt: The number of states for each variables
    %            (1 indicates a continuous variable.)
-   %    6/7) ???nnode.txt and ???nrows.txt: number of nodes and cases
-   %    8-12) ???ban.txt, ???white.txt, ???k.txt, ???thr.txt, and
+   %    7/8) ???nnode.txt and ???nrows.txt: number of nodes and cases
+   %    9-13) ???ban.txt, ???white.txt, ???k.txt, ???thr.txt, and
    %          ???parent.txt: Files with default values for structure learning. 
    %
    % It is called by the run_prep_input script in the 'sourcecodes' directory.
@@ -54,6 +54,7 @@ end
 % Get the number of cases (the number of rows in the file excluding the header)
 ncases = fskipl(fin,Inf) - 1;
 
+
 frewind(fin);
 
 % Read in first line to get the number of nodes and the node labels.
@@ -65,6 +66,8 @@ for j=1:nnodes
     labels{j} = next;
 end
 
+
+
 % Read in the data
 data = cell(ncases,nnodes);
 for i = 1:ncases
@@ -75,11 +78,25 @@ for i = 1:ncases
     end
 end
 
+%Read one more line of the file to make sure that
+% it does not contain a final line of data
+buffer = fgetl(fin);
+if length(buffer) > 1
+    ncases = ncases + 1;
+    for j = 1:nnodes
+         [next,buffer] = strtok(buffer);
+         data{ncases,j} = next;
+    end
+end
+  
+
+
 % Remove all rows that have missing data from data file
 remove_count = sum(any(strcmp(data,"NA"),2));
 data(any(strcmp(data,"NA"),2),:)=[];
 ncases = ncases - remove_count;
 
+
 % Determine whether or not the nodes are continuous or discrete.
 % First, treat them as all discrete and get the states and number of stats(levels).
 levels = cell(1,nnodes);
@@ -89,36 +106,54 @@ for j = 1:nnodes
    levels{j} = size(states{j},1);
 end
 
+
+
+% Remove any variables that have a single variable
+remove_labels = cell(1,nnodes);
+remove = [];
+for j = 1:nnodes
+  if levels{j} == 1
+    remove_labels{j} = labels{j};
+    remove(end+1) = j;
+  end
+end
+
+nnodes = nnodes - size(remove,2);
+data(:,remove)=[];
+labels(remove) = [];
+levels(remove) = [];
+states(:,remove) = [];
+
 reason = cell(1,nnodes);
 %Now do some checks to see if nodes are discrete or continuous
 for j = 1:nnodes
     % If there are 3 or less unique values, I will assume that the node is discrete.
     if levels{j} < 4;
-        reason{j} = "It was determined to be discrete because there are a small number (<4) of possible values.";
+        reason{j} = "Small number (<4) of possible values";
         continue
     % If there are as many unique values as a third of the number of cases,
     %      I will assume that the node is continuous.
     elseif levels{j} > ncases/3;
        levels{j} = 1;
-       reason{j} = "It was determined to be continuous because there are a large number of possible values compared to the number of cases.";
+       reason{j} = "Large number of possible values compared to the number of cases";
        continue
     % If there are more than twenty unique values,
     %      I will assume that the node is continuous.
     elseif levels{j} > 20;
        levels{j} = 1;
-       reason{j} = "It was determined to be continuous because there are many (>20) possible values.";
+       reason{j} = "Many (>20) possible values";
        continue
     % Otherwise, I will scan through the individual values.
     % If any of the values contain a '.', I will assume it is continuous.
     else
-       reason{j} = "It was determined to be discrete by default.";
+       reason{j} = "Default classification";
        period_test = 0;
        column = data(:,j);
        k = 1;
        while period_test == 0 
            period_test = sum(cell2mat(strfind(column(k),".")));
            if period_test != 0;
-              reason{j} = "This variable was determined to be continuous because there were several possible values and at least one value contained a period(.).";
+              reason{j} = "At least one value contained a period(.).";
               levels{j} = 1;
            end
            k++;
@@ -129,6 +164,8 @@ for j = 1:nnodes
     end
 end
 
+
+
 %I need to check if any discrete nodes are listed after continuous nodes.
 %If so, I need to rearrange the columns.
 max_disc = 0;
@@ -175,7 +212,6 @@ if max_disc > min_cont
   
 endif
 
-
 %Write other files that are used by BNW for this key.
 %The first group of files establish default settings for structure learning.
 outfile = strcat(pre,'white.txt');
@@ -241,14 +277,24 @@ for i = 1:nnodes
 end
 fclose(fout);
 
-
 %Print a file with a short description of the input.
 descfile = strcat(pre,'input_desc.txt');
 dout = fopen(descfile,'w');
+tablefile = strcat(pre,'input_table.txt');
+dout_table = fopen(tablefile,'w');
 fprintf(dout,['As loaded, the input file had the following properties:\n\n']);
-dout = fopen(descfile,'a');
+if size(remove,1) > 0
+	fprintf(dout,['The following variables were removed because they contained only one value:\n']);
+	for j = 1:size(remove_labels,2)
+		if remove_labels{j}!= 1
+		  fprintf(dout,'%s\n',remove_labels{j});
+		end
+	end
+	fprintf(dout,['\n']);
+end
 fprintf(dout,'There are %i variables and %i cases(rows).\n',size(labels,2),ncases);
 fprintf(dout,'%i cases(rows) have been removed because they contained NA (missing data).\n',remove_count);
+fprintf(dout_table,'Variable\tType\tStates/Mean (St Dev)\tReason for classification\n');
 fprintf(dout,'The variable names are:\n');
 fprintf(dout,'%s\t',labels{1:end-1});
 fprintf(dout,'%s\n\n',labels{end});
@@ -259,16 +305,20 @@ for i=1:nnodes
        column = str2double(data(:,i));
        colmean = mean(column);
        colstd = std(column);
-       fprintf(dout,'It has a mean of %6.3f and a standard deviation of %6.3f\n\n',mean(column),std(column))
+       fprintf(dout,'It has a mean of %6.3f and a standard deviation of %6.3f\n\n',mean(column),std(column));
+       fprintf(dout_table,'%s\tContinuous\t%6.3f (%6.3f)\t%s\n',labels{i},mean(column),std(column),reason{i});
     else 
        fprintf(dout,'%s is a discrete variable with %i states.\n',labels{i},levels{i});
        fprintf(dout,'%s\n',reason{i});
        fprintf(dout,'The states are: ');
        fprintf(dout,'%s ',states{i}{1:end-1});
        fprintf(dout,'%s\n\n',states{i}{end});
+       fprintf(dout_table,'%s\tDiscrete\t%i\t%s\n',labels{i},levels{i},reason{i});
     end
 end
-fclose(fout);
+fprintf(dout_table,'There are %i variables and %i cases; %i variables and %i rows were removed.\n',size(labels,2),ncases,size(remove,1),remove_count);
+fclose(dout);
+fclose(dout_table);
 
 outfile = strcat(pre,'continuous_input.txt');
 fout = fopen(outfile,'w');
diff --git a/sourcecodes/parameter_learning/removeNodes.m b/sourcecodes/parameter_learning/removeNodes.m
index 8740d999..45f09cb7 100644
--- a/sourcecodes/parameter_learning/removeNodes.m
+++ b/sourcecodes/parameter_learning/removeNodes.m
@@ -59,27 +59,34 @@ if fin2 < 0
    dellabels = {};
    ndel = 0;
 else
-  buffer = fgetl(fin2);    %get header line as a string
-  ndel = numel(strfind(buffer," ")) + 1;
-  dellabels = cell(1,ndel);
-  for j=1:ndel
-    [next,buffer] = strtok(buffer);
-    dellabels{j} = next;
+  buffer = fgetl(fin2);    %get first line as a string
+  if buffer < 0
+    dellabels = {};
+    ndel = 0;
+  else
+    ndel = numel(strfind(buffer," ")) + 1;
+    dellabels = cell(1,ndel);
+    for j=1:ndel
+      [next,buffer] = strtok(buffer);
+      dellabels{j} = next;
+    end
   end
 end
 
 %get index of variables to delete
-delindex = [];
-for j=1:nnodes
-  for k = 1:ndel
-    if strcmp(labels{j},dellabels{k})
-      delindex = [delindex;j];
-    endif
-  end
-end
+if ndel > 0
+  delindex = [];
+  for j=1:nnodes
+    for k = 1:ndel
+      if strcmp(labels{j},dellabels{k})
+	delindex = [delindex;j];
+      endif
+    end
+   end
 
-labels(:,[delindex])=[];
-data(:,[delindex])=[];
+   labels(:,[delindex])=[];
+   data(:,[delindex])=[];
+end
 
 outfile = strcat(pre_new,'continuous_input_orig.txt');
 fout = fopen(outfile,'w');
diff --git a/sourcecodes/parameter_learning/runBN_initial.m b/sourcecodes/parameter_learning/runBN_initial.m
index 16ce06dc..d87e468b 100644
--- a/sourcecodes/parameter_learning/runBN_initial.m
+++ b/sourcecodes/parameter_learning/runBN_initial.m
@@ -63,7 +63,7 @@ end
 
 filename=strcat(pre,'net_figure.txt');
 
-drawFigure(nnodes,bnet,labels,filename,cases,stdevs,means);
+drawFigure(nnodes,bnet,labels,filename,cases,stdevs,means,pre);
 
 writeParameters(pre,nnodes,bnet,labels,cases,labelsold,s,m);
 
diff --git a/sourcecodes/parameter_learning/testSetPredictions.m b/sourcecodes/parameter_learning/testSetPredictions.m
index 23a50868..978326b0 100644
--- a/sourcecodes/parameter_learning/testSetPredictions.m
+++ b/sourcecodes/parameter_learning/testSetPredictions.m
@@ -4,7 +4,7 @@ function  [ ] = testSetPredictions( pre )
    %   in the uploaded data file.
    %      
    %
-   %  Input: ???ts_input.txt
+   %  Input: ???ts_upload.txt
    %    This is the input file that is uploaded to BNW.
    %    It is directly written out by the BNW php code with no modification.
    %    The file format is a header line containing the variable that you want to predict.
@@ -157,7 +157,6 @@ for i=1:nnodes
      end
   else
      for j=1:ntestcases
-	labels{i}
         if !strcmp(data_test{j,i},"NA")
 	    for jj = 1:size(levels,1)
 		if strcmp(labels{i},levels{jj,1})
@@ -179,7 +178,7 @@ end
 predict_cases = bnet.node_sizes(predict_node);
 
 if predict_cases == 1
-      ts_continuous(pre,bnet,nnodes,predict_label,predict_node,data_test,means,stdevs)
+      ts_continuous(pre,bnet,nnodes,predict_label,predict_node,data_test,means,stdevs);
 else
       pred_levels = cell(1,predict_cases);
       for i = 1:disc_nodes
@@ -190,7 +189,7 @@ else
             break
          end
       end
-      ts_discrete(pre,bnet,nnodes,predict_label,predict_node,data_test,pred_levels,predict_cases)
+      ts_discrete(pre,bnet,nnodes,predict_label,predict_node,data_test,pred_levels,predict_cases);
 end
 
 %delete(dfile)
@@ -224,7 +223,7 @@ end
 filename = strcat(pre,'ts_output.txt');
 fileID = fopen(filename,'w');
 
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
+%fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
 
 
 %Calculate RMSEP (root mean square error of prediction) and q^2
@@ -235,14 +234,11 @@ actual_values = [];
 predictions_removeNA = [];
 for i=1:ntestcases
    if !strcmp(data_test(i,predict_node),'NA')
-        actual_values = [actual_values, cell2num(data_test(i,predict_node))]
-	predictions_removeNA = [predictions_removeNA,predictions(i,1)]
+        actual_values = [actual_values, cell2num(data_test(i,predict_node))];
+	predictions_removeNA = [predictions_removeNA,predictions(i,1)];
    end
 end
 
-size(actual_values)
-size(predictions_removeNA)
-
 average = mean(actual_values);
 average = average*stdevs{predict_node}+means{predict_node};
 tss = 0;
@@ -256,12 +252,12 @@ rmsep = sqrt(press/length(actual_values));
 q_squared = 1 - press/tss;
 
 %% Print rmseq and q^2
-fprintf(fileID,'RMS error of predictions: %6.4f\n',rmsep);
-fprintf(fileID,'Q^2 of predictions: %6.4f\n\n',q_squared);
+%fprintf(fileID,'RMS error of predictions: %6.4f\n',rmsep);
+%fprintf(fileID,'Q^2 of predictions: %6.4f\n\n',q_squared);
 
 
 %%Print the predictions
-fprintf(fileID,'Predicted mean and standard deviation for each case:\n');
+%fprintf(fileID,'Predicted mean and standard deviation for each case:\n');
 fprintf(fileID,'CaseRow\tActualValue\tPredictionMean\tPredictionStDev\n');
 for i = 1:ntestcases
      if strcmp(data_test{i,predict_node},"NA")
@@ -273,6 +269,8 @@ for i = 1:ntestcases
      fprintf(fileID,'%6.4f\t%6.4f\n',predictions(i,:));
 end
 
+fprintf(fileID,'Test set predictions for %s; RMSE= %6.4f; Q^2= %6.4f\n',predict_label,rmsep,q_squared);
+
 fflush(fileID);
 fclose(fileID);
 
@@ -333,13 +331,13 @@ accuracy = correct/length(pred_states);
 filename = strcat(pre,'ts_output.txt');
 fileID = fopen(filename,'w');
 
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
+%fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
 
 %%Print the accuracy
-fprintf(fileID,'Fraction of accurate predictions: %6.4f\n\n',accuracy);
+%fprintf(fileID,'Fraction of accurate predictions: %6.4f\n\n',accuracy);
 
 %%Print the predictions
-fprintf(fileID,'Predicted likelihood of each state for each case:\n');
+%fprintf(fileID,'Predicted likelihood of each state for each case:\n');
 fprintf(fileID,'%s\t%s\t','CaseRow','ActualState');
 fprintf(fileID,'%s\t',pred_levels{1:end-1});
 fprintf(fileID,'%s\n',pred_levels{end});
@@ -355,6 +353,8 @@ for i = 1:ntestcases
      fprintf(fileID,'%6.4f\n',predictions(i,end));
 end
 
+fprintf(fileID,'Test set predictions of %s; Fraction of accurate predictions= %6.4f\n',predict_label,accuracy);
+
 fflush(fileID);
 fclose(fileID);
 
diff --git a/sourcecodes/parameter_learning/writeParameters.m b/sourcecodes/parameter_learning/writeParameters.m
index 6efafe8a..cb119c76 100644
--- a/sourcecodes/parameter_learning/writeParameters.m
+++ b/sourcecodes/parameter_learning/writeParameters.m
@@ -5,7 +5,7 @@ function [] = writeParameters(pre,nnodes,bnet,labels,cases,labelsold,s,m)
 %    for the network.
 %
 % writeParameters is called by runBN_intial.m
-
+% Simplifying output to read in and make table on webpage.
 
 %%Get the types of the nodes.
 typefile = strcat(pre,'type.txt');
@@ -76,15 +76,32 @@ for i = 1:nnodes
     fprintf(fileID,'%s\n',labels{nodeid});
     %%%Print the type of node
     if bnet.node_sizes(nodeid) == 1;
-        line = 'Continuous node\n';
-        fprintf(fileID,line);
         %%% 'i' in the line below is correct: m and s are had original node labeling
-        adj_mu = predict.mu*s(i)+m(i);
-        adj_sigma = s(i)*predict.Sigma;
-	fprintf(fileID,'%6.4f\t%6.4f\n\n',adj_mu,adj_sigma);
+	CPD=struct(bnet.CPD{nodeid});
+	no_gaussians = size(CPD.Wsum)(1);
+	if no_gaussians == 1
+            %%%line = 'Continuous node\n';
+            %%%fprintf(fileID,line);
+            adj_mu = CPD.mean*s(i)+m(i);
+            adj_sigma = s(i)*sqrt(CPD.cov);
+	    fprintf(fileID,'Mean\tSt Dev\n');
+	    fprintf(fileID,'%6.4f\t%6.4f\n\n',adj_mu,adj_sigma);
+	else
+        %%%%line = 'Continuous node modeled as a mixture of %i Gaussian distributions\n';
+        %%%%fprintf(fileID,line,no_gaussians);
+	fprintf(fileID,'Mean\tSt Dev\tWeight\n');
+	Wsum = sum(CPD.Wsum);
+	for j=1:no_gaussians
+            adj_mu = CPD.mean(j)*s(i)+m(i);
+            adj_sigma = s(i)*sqrt(CPD.cov(j));
+	    weight = CPD.Wsum(j)/Wsum;
+	    fprintf(fileID,'%6.4f\t%6.4f\t%6.4f\n',adj_mu,adj_sigma,weight);
+	end
+        fprintf(fileID,'\n');
+        end
     else
-        line = 'Discrete node with %i states\n';
-        fprintf(fileID,line,bnet.node_sizes(nodeid));
+        %%line = 'Discrete node with %i states\n';
+        %%fprintf(fileID,line,bnet.node_sizes(nodeid));
         %line = 'Probability of each state\n';
         %fprintf(fileID,line);
         nodeid2 = 0;
@@ -94,6 +111,7 @@ for i = 1:nnodes
               break
            end
         end
+	fprintf(fileID,'State\tProbability\n');
         for j = 1:bnet.node_sizes(nodeid),
             %%%For discrete nodes, the state and the percent of that state
 %		  fprintf(fileID,'%i\t%6.4f\n',levels{nodeid2,j+1},predict.T(j));
diff --git a/sourcecodes/parameter_learning/writeParameters_ev.m b/sourcecodes/parameter_learning/writeParameters_ev.m
index 1f07c745..13524f26 100644
--- a/sourcecodes/parameter_learning/writeParameters_ev.m
+++ b/sourcecodes/parameter_learning/writeParameters_ev.m
@@ -97,21 +97,22 @@ for i = 1:nnodes
         end
     end
     %%%Print the name of the node
-    fprintf(fileID,'%s\n',labels{nodeid});
+    fprintf(fileID,'%s considering evidence\n',labels{nodeid});
     predict = marginal_nodes(engine,nodeid);
     if isempty(evidence{nodeid})
        %%%Print the type of node
        if bnet.node_sizes(nodeid) == 1;
-           line = 'Continuous parameters considering evidence:\n';
-           fprintf(fileID,line);
+           %%%line = 'Continuous parameters considering evidence:\n';
+           %%%fprintf(fileID,line);
            %line = 'Mean and standard deviation of Gaussian distribution\n';
            %fprintf(fileID,line);
 	     adj_mu = predict.mu*stdevs{nodeid}+means{nodeid};
-             adj_sigma = stdevs{nodeid}*predict.Sigma;
+             adj_sigma = stdevs{nodeid}*sqrt(predict.Sigma);
+	    fprintf(fileID,'Mean\tSt Dev\n');
              fprintf(fileID,'%6.4f\t%6.4f\n\n',adj_mu,adj_sigma);
        else
-           line = 'Probability of states considering evidence:\n';
-           fprintf(fileID,line);
+           %line = 'Probability of states considering evidence:\n';
+           %fprintf(fileID,line);
            nodeid2 = 0;
            for k = 1:ndisc_nodes,
 	     if strcmp(levels{k,1},labels{nodeid}),
@@ -119,6 +120,7 @@ for i = 1:nnodes
                 break
              end
             end
+	    fprintf(fileID,'State\tProbability\n');
 	    for j = 1:bnet.node_sizes(nodeid),
 		%%%For discrete nodes, the state and the percent of that state
 %		fprintf(fileID,'%i\t%6.4f\n',levels{nodeid2,j+1},predict.T(j));
@@ -128,10 +130,11 @@ for i = 1:nnodes
        end
    else
        if bnet.node_sizes(nodeid) == 1;
-          line = 'Evidence was observed for this node. The observed value was:\n';
-          fprintf(fileID,line);  
+          %%line = 'Evidence was observed for this node. The observed value was:\n';
+          %%fprintf(fileID,line);  
           adj_mu = ev_dat(nodeid)*stdevs{nodeid}+means{nodeid};
-          fprintf(fileID,'%6.4f\n\n',adj_mu);
+	  fprintf(fileID,'Observed as\tValue\n');
+          fprintf(fileID,'Evidence\t%6.4f\n\n',adj_mu);
        else
           nodeid2 = 0;
           for k = 1:ndisc_nodes,
@@ -140,11 +143,12 @@ for i = 1:nnodes
                break
             end
           end
-	 line = 'Evidence was observed for this node. The observed state was:\n';
-         fprintf(fileID,line);
+	 %%line = 'Evidence was observed for this node. The observed state was:\n';
+         %%fprintf(fileID,line);
          state_ev =   uint16(ev_dat(nodeid));
 %         fprintf(fileID,'%i\n\n',levels{nodeid2,state_ev+1});
-         fprintf(fileID,'%s\n\n',levels{nodeid2,state_ev+1});
+	  fprintf(fileID,'Observed as\tValue\n');
+         fprintf(fileID,'Evidence\t %s\n\n',levels{nodeid2,state_ev+1});
        end
    end
 end
diff --git a/sourcecodes/parameter_learning/writeParameters_int.m b/sourcecodes/parameter_learning/writeParameters_int.m
index 69dcbb93..98e4edf1 100644
--- a/sourcecodes/parameter_learning/writeParameters_int.m
+++ b/sourcecodes/parameter_learning/writeParameters_int.m
@@ -5,6 +5,7 @@ function [] = writeParameters_int(pre,bnet,nnodes,labels,cases,stdevs,means,sele
 %    for the network.
 %
 % writeParameters is called by Predictmultipleintervention.m
+% Modifying to simplify output to make a table on webpage.
 
 %First read input file to get node labels to get node IDs.
 infile = strcat(pre,'continuous_input.txt');
@@ -129,21 +130,22 @@ for i = 1:nnodes
     %check to see if this is a node impacted by intervention
     if int_nodes(nodeid) == 1
     %%%Print the name of the node
-    fprintf(fileID,'%s\n',labels{nodeid});
+    fprintf(fileID,'%s considering intervention\n',labels{nodeid});
     predict = marginal_nodes(engine,nodeid);
     if isempty(evidence{nodeid})
        %%%Print the type of node
        if bnet.node_sizes(nodeid) == 1;
-           line = 'Continuous parameters considering intervention:\n';
-           fprintf(fileID,line);
+           %line = 'Continuous parameters considering intervention:\n';
+           %fprintf(fileID,line);
            %line = 'Mean and standard deviation of Gaussian distribution\n';
            %fprintf(fileID,line);
 	   adj_mu = predict.mu*stdevs{nodeid}+means{nodeid};
-           adj_sigma = stdevs{nodeid}*predict.Sigma;
+           adj_sigma = stdevs{nodeid}*sqrt(predict.Sigma);
+	   fprintf(fileID,"Mean\tSt Dev\n");
            fprintf(fileID,'%6.4f\t%6.4f\n\n',adj_mu,adj_sigma);
        else
-           line = 'Probability of states considering intervention:\n';
-           fprintf(fileID,line);
+           %line = 'Probability of states considering intervention:\n';
+           %fprintf(fileID,line);
            nodeid2 = 0;
            for k = 1:ndisc_nodes,
 	     if strcmp(levels{k,1},labels{nodeid}),
@@ -151,6 +153,7 @@ for i = 1:nnodes
                 break
              end
             end
+	    fprintf(fileID,"State\tProbability\n")
 	    for j = 1:bnet.node_sizes(nodeid),
 		%%%For discrete nodes, the state and the percent of that state
 %		fprintf(fileID,'%i\t%6.4f\n',levels{nodeid2,j+1},predict.T(j));
@@ -160,10 +163,11 @@ for i = 1:nnodes
        end
    else
        if bnet.node_sizes(nodeid) == 1;
-          line = 'Intervention on this node assigned the following value:\n';
-          fprintf(fileID,line);  
+          %line = 'Intervention on this node assigned the following value:\n';
+          %fprintf(fileID,line);  
           adj_mu = ev_dat(nodeid)*stdevs{nodeid}+means{nodeid};
-          fprintf(fileID,'%6.4f\n\n',adj_mu);
+	  fprintf(fileID,"Fixed by\tValue\n");
+          fprintf(fileID,'Intervention\t%6.4f\n\n',adj_mu);
        else
           nodeid2 = 0;
           for k = 1:ndisc_nodes,
@@ -172,11 +176,12 @@ for i = 1:nnodes
                break
             end
           end
-	 line = 'Intervention on this node assigned the following state:\n';
-         fprintf(fileID,line);
+	 %line = 'Intervention on this node assigned the following state:\n';
+         %fprintf(fileID,line);
          state_ev =   uint16(ev_dat(nodeid));
 %         fprintf(fileID,'%i\n\n',levels{nodeid2,state_ev+1});
-         fprintf(fileID,'%s\n\n',levels{nodeid2,state_ev+1});
+	 fprintf(fileID,"Fixed by\tValue\n");
+         fprintf(fileID,'Intervention\t%s\n\n',levels{nodeid2,state_ev+1});
        end
    end
    end
diff --git a/sourcecodes/parameter_learning/writeSettings.m b/sourcecodes/parameter_learning/writeSettings.m
new file mode 100644
index 00000000..0c5ad865
--- /dev/null
+++ b/sourcecodes/parameter_learning/writeSettings.m
@@ -0,0 +1,200 @@
+function writeSettings(pre)
+  %function to write tables of settings used in structure learning
+  % so they can be reviewed by users
+
+
+parfile = strcat(pre,'parent.txt');
+paropen = fopen(parfile,'r');
+par_val = fscanf(paropen,'%i');
+
+kfile = strcat(pre,'k.txt');
+kopen = fopen(kfile,'r');
+k_val = fscanf(kopen,'%i');
+
+thrfile = strcat(pre,'thr.txt');
+thropen = fopen(thrfile,'r');
+thr_val = fscanf(thropen,'%f');
+
+filename = strcat(pre,'slsettings.txt');
+fileID = fopen(filename,'w');
+fprintf(fileID,'Structure learning settings\n');
+fprintf(fileID,'Parameter\tValue\n');
+fprintf(fileID,'Maximum number of parents\t%i\n',par_val);
+fprintf(fileID,'Number of structures for model averaging\t%i\n',k_val);
+fprintf(fileID,'Model averaging selection threshold\t%6.3f\n',thr_val);
+fprintf(fileID,'\n');
+
+tierfile = strcat(pre,'tier.txt');
+if exist(tierfile,'file') == 2
+	tieropen = fopen(tierfile,'r');
+	tiers = fscanf(tieropen,'%s');
+	tiers = strsplit(",",tiers);
+	tiers(size(tiers,2)) = [];
+	fprintf(fileID,'Tier assignments\n');
+	fprintf(fileID,'Variable\tTier\n');
+	notiers = str2num(tiers{1});
+	i = 1;
+        for j = 1:notiers
+		i = i + 1;
+		tiername = tiers{i};
+		i = i + 1;
+		novars = str2num(tiers{i});
+                if novars == 0
+                   fprintf(fileID,'No variables\t%s\n',tiername);
+                else
+		   for k = 1:novars
+		       i = i + 1;
+		       fprintf(fileID,'%s\t%s\n',tiers{i},tiername);
+                   end
+                end
+        end
+fprintf(fileID,"\n");
+end
+
+
+descfile = strcat(pre,'tierdesc.txt');
+%format of ???tierdesc.txt is:
+%% Assume that there are n tiers:
+%% For Tier i:
+%%   within tier interactions allowed: 
+%%       (i-1)*n+1 true/false for yes,
+%%       (i-1)*n+2 true/false for no;  (not needed, opposite of above)
+%%   Tier j (for 1 to n, with i != j)
+%%       Can j be parent of Tier i
+%%       Can j be child of Tier i
+if exist(descfile,'file') == 2
+        %%I am going to assume that if ???tierdesc.txt exists, then
+        %%%  ???tiers.txt exists and notiers has been defined.
+        within = cell(notiers,1);
+        parents = cell(notiers,notiers);
+        children = cell(notiers,notiers);
+        within(:) = 0;
+        parents(:) = 0;
+        children(:) = 0;
+	descopen = fopen(descfile,'r');
+	desc = fscanf(descopen,'%s');
+	desc = strsplit(",",desc);
+	desc(size(desc,2)) = [];
+        for i = 1:notiers
+            %%Pull out the section of desc array for this tiers
+            desc_current = desc((i-1)*notiers*2+1:i*notiers*2);
+	    for j = 1:notiers
+		if j < i
+                   if strcmp(desc_current{j*2+1},'true')
+                       parents{i,j} = j;
+		   end
+                   if strcmp(desc_current{j*2+2},'true')
+                       children{i,j} = j;
+		   end
+		end
+                if i == j
+                   if strcmp(desc_current{1},'true')
+                      within{i,1} = 1;
+		   end
+		end
+		if j > i
+                   if strcmp(desc_current{(j-1)*2+1},'true')
+                       parents{i,j} = j;
+		   end
+                   if strcmp(desc_current{(j-1)*2+2},'true')
+                       children{i,j} = j;
+		   end
+		end
+	end
+	end
+        fprintf(fileID,"Within tier interactions\n");
+        fprintf(fileID,"Tier\tAre within tier interaction allowed?\n");
+        for i = 1:notiers
+            i1 = sprintf("%i",i);
+            if within{i,1} == 1
+               fprintf(fileID,"Tier%s\tYes\n",i1);
+            else
+               fprintf(fileID,"Tier%s\tNo\n",i1);
+            end
+        end
+        fprintf(fileID,'\n');          
+	fprintf(fileID,'Allowed parents\n');
+	fprintf(fileID,'Tier\tOther tiers containing potential parents\n');
+        for i=1:notiers
+	    lineout = '';
+            for j=1:notiers
+               if parents{i,j} != 0
+                   j1 = sprintf("%i",parents{i,j});
+                   lineout = strcat(lineout,j1,',',{' '});
+               end
+            end
+	    col1 = sprintf("%i",i);
+            col1 = strcat("Tier",col1);
+            if size(lineout,1) > 0
+	       fprintf(fileID,'%s\t%s\n',col1,lineout{1,1}(1:end-2));
+            else 
+	       fprintf(fileID,'%s\tNone\n',col1);
+            end
+        end
+        fprintf(fileID,'\n');          
+	fprintf(fileID,'Allowed children\n');
+	fprintf(fileID,'Tier\tOther tiers containing potential children\n');
+        for i=1:notiers
+	    lineout = '';
+            for j=1:notiers
+               if children{i,j} != 0
+                   j1 = sprintf("%i",children{i,j});
+                   lineout = strcat(lineout,j1,',',{' '});
+               end
+            end
+	    col1 = sprintf("%i",i);
+            col1 = strcat("Tier",col1);
+            if size(lineout,1) > 0
+	       fprintf(fileID,'%s\t%s\n',col1,lineout{1,1}(1:end-2));
+            else 
+	       fprintf(fileID,'%s\tNone\n',col1);
+            end
+        end
+end
+
+banfile = strcat(pre,'ban.txt');
+if exist(banfile,'file') == 2
+	banopen = fopen(banfile,'r');
+	ban = fscanf(banopen,'%s');
+	ban = strsplit(",",ban);
+        ban(end) = [];
+        nban = size(ban,2)/2;
+        if nban > 0
+           fprintf(fileID,'\n');          
+           fprintf(fileID,'Banned edges\n');
+	   fprintf(fileID,'From\tTo\n');
+           for j=1:nban
+              j1 = (j-1)*2 + 1;
+              j2 = (j-1)*2 + 2;
+	      fprintf(fileID,"%s\t%s\n",ban{1,j1},ban{1,j2})
+           end
+        end
+end
+
+
+
+whitefile = strcat(pre,'white.txt');
+if exist(whitefile,'file') == 2
+	whiteopen = fopen(whitefile,'r');
+	white = fscanf(whiteopen,'%s');
+	white = strsplit(",",white);
+        white(end) = [];
+        nwhite = size(white,2)/2;
+        if nwhite > 0
+           fprintf(fileID,'\n');          
+           fprintf(fileID,'Required edges\n');
+	   fprintf(fileID,'From\tTo\n');
+           for j=1:nwhite
+              j1 = (j-1)*2 + 1;
+              j2 = (j-1)*2 + 2;
+	      fprintf(fileID,"%s\t%s\n",white{1,j1},white{1,j2})
+           end
+        end
+end
+
+
+
+
+fclose(fileID);
+
+end
\ No newline at end of file
diff --git a/sourcecodes/print_structure/index.html b/sourcecodes/print_structure/index.html
deleted file mode 100644
index 43d547ad..00000000
--- a/sourcecodes/print_structure/index.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html>
-<head>
-<title>Bayesian Network Web Server</title>
-<meta HTTP-EQUIV="REFRESH" content="0; url=http://compbio.uthsc.edu/BNW_1.02/sourcecodes/home.php">
-</head>
-</html>
diff --git a/sourcecodes/print_structure/structure.c b/sourcecodes/print_structure/structure.c
deleted file mode 100644
index cc893a35..00000000
--- a/sourcecodes/print_structure/structure.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include<stdio.h>
-#include<stdlib.h>
-#include<string.h>
-#include<math.h>
-
-struct st{
-char *name;	
-double *data;	
-}*st_tab;
-
-main(int argc,char *argv[])
-{
-FILE *fp1,*fp2,*fp3;
-char line[2500];
-int i,j,rd;
-double d,row;
-double thr=atof(argv[5]);
-
-fp1=fopen(argv[2],"r");
-fp2=fopen(argv[3],"w");
-
-fp3=fopen(argv[4],"w");
-
-
-row=0.0;
-while(fgets(line,2500,fp1)!=NULL)
-   row++;
-
-rd=(int)sqrt(row);
-
-printf("%d\n",rd);
-
-fclose(fp1);
-fp1=fopen(argv[1],"r");
-
-st_tab=(struct st *)malloc(sizeof(struct st)*rd);
-
-for(i=0;i<rd;i++)
-{
-   fscanf(fp1,"%s",line);	
-   st_tab[i].name=(char *)malloc(sizeof(char)*(sizeof(line)+1));
-   strcpy(st_tab[i].name,line);
-   st_tab[i].data=(double *)calloc(rd,sizeof(double));
-}
-
-fclose(fp1);
-fp1=fopen(argv[2],"r");
-
-for(i=0;i<rd;i++)
-{
-    for(j=0;j<rd;j++)
-    {
-          fscanf(fp1,"%s",line);
-	   fscanf(fp1,"%s",line);
-	   fscanf(fp1,"%s",line);		
-   	   fscanf(fp1,"%lf",&d);
-          st_tab[i].data[j]=d;
-    
-    }
-}
-
-/*
-for(i=0;i<rd;i++)
-{
-    for(j=0;j<rd;j++)
-    {
-         if(st_tab[i].data[j]>=st_tab[j].data[i])
-                 st_tab[j].data[i]=0.0;
-    
-    }
-}
-*/
-
-for(i=0;i<rd;i++)
-{ 
-    fprintf(fp2,"%s\t",st_tab[i].name);
-    fprintf(fp3,"%s\t",st_tab[i].name);
-}
-
-fprintf(fp2,"\n");
-fprintf(fp3,"\n");
-
-for(i=0;i<rd;i++)
-{ 
-    for(j=0;j<rd;j++)
-    {
-   	   fprintf(fp2,"%lf\t",st_tab[j].data[i]);
-          if(st_tab[j].data[i]>thr)	
-   	     fprintf(fp3,"1\t");
-          else 	
-   	     fprintf(fp3,"0\t");
-    }
-    fprintf(fp2,"\n");
-    fprintf(fp3,"\n");
-}
-
-}
diff --git a/sourcecodes/remove_variables.php b/sourcecodes/remove_variables.php
index c88bc29e..1373bcae 100644
--- a/sourcecodes/remove_variables.php
+++ b/sourcecodes/remove_variables.php
@@ -7,7 +7,9 @@ include("runtime_check.php");
 include("input_validate.php");
 $keyval=$_GET["My_key"];
 
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $type_n=array();
 
@@ -89,14 +91,6 @@ $runtime=exe_time($keyval,$parent_number,$k_number);
 ?>
 <!-- Site navigation menu -->
 <ul class="navbar2">
-  <li><p onClick="getcombineDescriptionDefault(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a href="javascript:void(0)" >Perform structure learning with default settings</a></p>
-  <li><p onClick="getcombineDescription(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a href="javascript:void(0)" >Go to structural constraint interface</a></p>
-  <li><a href="javascript:void(0);"
-NAME="InputCheck" title="InputCheck"
-    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Ratting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
-</ul>
-<ul class="navbar">
-  <li><a href="help.php#constraint_interface" target="_blank">How to use this page</a>
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
 
@@ -107,14 +101,14 @@ NAME="InputCheck" title="InputCheck"
 <?php
 
 
-if(isset($HTTP_POST_VARS["bantext"]))
+if(isset($_POST["bantext"]))
 {
-   $ban_search=$HTTP_POST_VARS["searchkey"];
+   $ban_search=$_POST["searchkey"];
 }
 
-if(isset($HTTP_POST_VARS["whitetext"]))
+if(isset($_POST["whitetext"]))
 {
-   $white_search=$HTTP_POST_VARS["searchkey"];
+   $white_search=$_POST["searchkey"];
 }
 
 ?>
@@ -133,7 +127,7 @@ if(isset($HTTP_POST_VARS["whitetext"]))
                 position:absolute;
                 left:215px;
                 white-space: nowrap; 
-                min-width: 3000px;
+                min-width: 80%;
                 float:top;
                 }
 
@@ -177,7 +171,7 @@ if(isset($HTTP_POST_VARS["whitetext"]))
                 left: 215px;
                 width:449px;
 		border: 2px solid;
-                background-color:#C0C0C0;
+                background-color:LightGrey;
 		font-weight:bold;
                 margin-left:15px;
 	}
@@ -196,7 +190,7 @@ if(isset($HTTP_POST_VARS["whitetext"]))
                 left:700px;
                 width:449px;
 		border: 2px solid;
-                background-color:#C0C0C0;
+                background-color:LightGrey;
 		font-weight:bold;
 	}
         #white_from {
@@ -243,7 +237,8 @@ if(isset($HTTP_POST_VARS["whitetext"]))
 		margin-left:10px;
 		margin-top:10px;
 		border: 2px dashed;
-                background-color:#C0C0C0;
+                background-color:LightGrey;
+		text-align:center;
 	}
 	.node2 {
 		width:150px;
@@ -838,7 +833,8 @@ function getcombineDescription(ntiers,ban_from,ban_to,white_from,white_to,keyv)
 {
   ntiers = 1;
   var tier=getNodesInTiers(ntiers);
-  var txtFile="./data/"+keyv+"del_var.txt";
+  //  var txtFile="./data/"+keyv+"del_var.txt";
+  var txtFile="/var/lib/genene/bnw/"+keyv+"del_var.txt";
   //var file = new File(txtFile);
   //file.open("w");
   //file.write(tier);
@@ -855,7 +851,8 @@ function getcombineDescriptionDefault(ntiers,ban_from,ban_to,white_from,white_to
 {
   ntiers = 1;
   var tier=getNodesInTiers(ntiers);
-  var txtFile="./data/"+keyv+"del_var.txt";
+  var txtFile="/tmp/bnw/"+keyv+"del_var.txt";
+  //var txtFile="./data/"+keyv+"del_var.txt";
   //var file = new File(txtFile);
   //file.open("w");
   //file.write(tier);
@@ -912,59 +909,18 @@ function clearBWLists()
 
 <body onload="loadFunction(nnodes,ntiers)">
 </br>
-        <p><h3>Select variables to remove:<br></h3>
+       <p><h3>Drag variables into appropriate boxes and select option below:<br></h3>
          </p>
         <br>
         <div id="tier_box">
         <div id="tiers"></div>
        
        </div>
+         <p onClick="getcombineDescriptionDefault(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a class=button3 href="javascript:void(0)" >Perform structure learning with default settings</a></p>
+  <p onClick="getcombineDescription(ntiers,'ban_from','ban_to','white_from','white_to','<?php print($keyval);?>')"><a class=button3 href="javascript:void(0)" >Go to structural constraint interface</a></p>
 
-<!--
-           
-       <div id="outer_tier_desc1">
-       <p><h3>3. Define interactions allowed between tiers:<br></h3> 
-       </p>
-       <br>
-       <div id="int_box1">
-       </div>
-       <br>
-       <div id="int_box2">
-       </div>
-       <br>
-       <div id="int_box3">
-       </div>
-       <br>
-       <div id="int_box4">
-       </div>
-       </div>
-       <br>
-       <br>
-       <br>
-
-        <div id="outer_box_lists">
-       <p><h3>4. Specify additional constraints:<br></h3>
-       </p>         
-       <br>
-       <div><input type="button" value="Clear lists of banned and required edges" onClick="clearBWLists()"/></div><br>
-        <div id="nodelist2" ondrop="return false"
-        ondragcenter="return false" ondragover="return false" >Nodes<br>
-        </div>
-         
-        <div id="ban_outer">Banned edges<br>
-        <div id="ban_from" class="tier" ondrop="return dropCopy(event)"
-        ondragenter="return false" ondragover="return false">From<br></div>
-        <div id="ban_to" class="tier" ondrop="return dropCopy(event)"
-        ondragenter="return false" ondragover="return false">To<br></div>
-        </div>
-        <div id="white_outer">Required edges<br>
-        <div id="white_from" class="tier" ondrop="return dropCopy(event)"
-        ondragenter="return false" ondragover="return false">From<br></div>
-        <div id="white_to" class="tier" ondrop="return dropCopy(event)"
-        ondragenter="return false" ondragover="return false">To<br></div>
-        </div>
--->
 
+<br>
         </div>
        
         <br>
diff --git a/sourcecodes/remove_variables_processing.php b/sourcecodes/remove_variables_processing.php
index be2d9f5d..0a147595 100644
--- a/sourcecodes/remove_variables_processing.php
+++ b/sourcecodes/remove_variables_processing.php
@@ -6,7 +6,9 @@ function get_tier($keyval)
 {
 
 $tier=trim($_GET['tier']);
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 $tf=$dir.$keyval."del_var.txt";
 $fpvar = fopen("$tf","w");
 
@@ -47,7 +49,9 @@ function describe_tier($fpvar,$keyval)
 
 
 $tierdesc=trim($_GET['tierdesc']);
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 $tf=$dir.$keyval."tier.txt";
 $tier=file_get_contents("$tf");
 
@@ -190,7 +194,9 @@ if($d1!="" && $d2!="")
 
 
 
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 //$sid1=$dir.$keyval."ban";
 //$sid2=$dir.$keyval."white";
@@ -228,5 +234,5 @@ shell_exec('./run_scripts/run_del_var '.$oldkey.' '.$keyval);
 ////////////////////////////////////execute structurelearning/////////////////////////////////////////////////////////////////////////////////////////////
 ?>
 <script>
-window.open("create_tiers_gom.php?My_key=<?php print($keyval);?>",'_self',false);
-</script>
\ No newline at end of file
+window.open("create_tiers_gom_part1.php?My_key=<?php print($keyval);?>",'_self',false);
+</script>
diff --git a/sourcecodes/remove_variables_processing_default.php b/sourcecodes/remove_variables_processing_default.php
index 255535b2..90258420 100644
--- a/sourcecodes/remove_variables_processing_default.php
+++ b/sourcecodes/remove_variables_processing_default.php
@@ -6,7 +6,9 @@ function get_tier($keyval)
 {
 
 $tier=trim($_GET['tier']);
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 $tf=$dir.$keyval."del_var.txt";
 $fpvar = fopen("$tf","w");
 
@@ -47,7 +49,9 @@ function describe_tier($fpvar,$keyval)
 
 
 $tierdesc=trim($_GET['tierdesc']);
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw";
 $tf=$dir.$keyval."tier.txt";
 $tier=file_get_contents("$tf");
 
@@ -190,7 +194,9 @@ if($d1!="" && $d2!="")
 
 
 
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 //$sid1=$dir.$keyval."ban";
 //$sid2=$dir.$keyval."white";
@@ -229,4 +235,4 @@ shell_exec('./run_scripts/run_del_var '.$oldkey.' '.$keyval);
 ?>
 <script>
 window.open("executionprogress.php?My_key=<?php print($keyval);?>",'_self',false);
-</script>
\ No newline at end of file
+</script>
diff --git a/sourcecodes/reroute.php b/sourcecodes/reroute.php
new file mode 100644
index 00000000..da1152dd
--- /dev/null
+++ b/sourcecodes/reroute.php
@@ -0,0 +1,21 @@
+<?php
+##
+## Retrieve the file passed in the URL and send it to the browser.
+## Set the $WORKDIR variable to point to the directory containing
+## the files to be displayed.
+
+$FILENAME = $_SERVER['QUERY_STRING'];
+$WORKDIR = '/var/lib/genenet/bnw/';
+
+if ( file_exists( $WORKDIR . $FILENAME ) )
+{
+    header("Content-type: text/plain");
+    ##readfile($WORKDIR.$FILENAME);
+    print file_get_contents( "file://" . $WORKDIR . $FILENAME, FALSE );
+}
+else
+{
+    echo " File " . $FILENAME . " not found in " . $WORKDIR . "\n";
+}
+?>
+
diff --git a/sourcecodes/restructuremap.php b/sourcecodes/restructuremap.php
deleted file mode 100644
index fb2a86cc..00000000
--- a/sourcecodes/restructuremap.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-
-function reversemap($id,$val,$keyval)
-{
-
-$dir="./data/";
-
-$matfile=$dir."$keyval"."map.txt";
-
-
-$matrix=file("$matfile");
-$matrix1=file_get_contents("$matfile");             
-$str_arrmat=array();
-$str_arrmat=explode("\n",$matrix1);
-$datamat=array();
-$data_cell=array(); 
-
-$data_cell_canvas=array();
-
-foreach($str_arrmat as $line)
-{
-
-$data_cell_canvas=explode("\t",$line);
-$map_name=trim($data_cell_canvas[0]);
-$map_type=$data_cell_canvas[1];
-$map_std=$data_cell_canvas[2];
-$map_mean=$data_cell_canvas[3];
-if($id==$map_name)
-{
- $mapval=($val-$map_mean)/$map_std;
-  break;
-}
-
-}
-return $mapval;
-}
-
-
-
-?>
-
diff --git a/sourcecodes/review_settings.php b/sourcecodes/review_settings.php
new file mode 100644
index 00000000..d945ce00
--- /dev/null
+++ b/sourcecodes/review_settings.php
@@ -0,0 +1,84 @@
+<head>
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+<?php 
+include("header_new.inc");
+include("input_validate.php");
+$keyval=valid_keyval($_GET["My_key"]);
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir = "/var/lib/genenet/bnw/";
+
+$settings_file = $keyval."slsettings.txt";
+
+?>
+
+</head>
+
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
+  <li><a href="about_this_page.php#parameters">About this page</a>
+  <li><a href="help.php">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+<body>
+
+<?php 
+if(!file_exists($dir.$settings_file))
+	{
+?>
+       <div class='table_div'>
+	<h3> No structure learning settings file found. </h3>
+       </div>
+<?php
+} else {
+$table_text = json_encode(file("file://".$dir.$settings_file));
+?>
+  <div class='table_div' id='parameter_div'>
+  <script type="text/javascript">
+  d3.text("", function(error, raw){
+      var data1 = <?php echo $table_text;?>;
+      var data2 = data1.join("")
+      var data = data2.split("\n\n");
+      var dsv = d3.dsvFormat("\t");
+   var i;
+   for (i = 0; i < data.length; i++) {
+     var data_temp = data[i].split("\n");
+     var caption_text = data_temp.shift();
+     var data_temp = data_temp.join("\n");
+     var newDiv = document.createElement('div');
+     newDiv.id = 'table_div'+i;
+     newDiv.className = 'd3_table';
+     var dataCurrent = dsv.parse(data_temp);
+     var div_id = '#table_div'+i;
+     var paramDiv = document.getElementById("parameter_div");
+     paramDiv.appendChild(newDiv);
+     tabulate_caption(div_id,dataCurrent,caption_text);
+   }
+   if (error) throw error;
+   add_header();
+    });
+</script>
+</div>
+<div id="table_header">
+</div>
+<div id="download">
+&nbsp;&nbsp;&nbsp;&nbsp;<a class=button2 href="<?php print("reroute.php?".$settings_file);?>">Download structure learning settings file</a><br><br>
+</div>
+<?php
+}
+?>
+  <script type="text/javascript">
+  function add_header() {
+  var element = document.getElementById("table_header");
+  var parentNode = document.getElementById("parameter_div");
+  parentNode.insertBefore(element,parentNode.firstChild);
+  var element = document.getElementById("download");
+  parentNode.appendChild(element);
+}
+</script>
+
+</body>
diff --git a/sourcecodes/run.sh b/sourcecodes/run.sh
index 95e5f417..344b7591 100644
--- a/sourcecodes/run.sh
+++ b/sourcecodes/run.sh
@@ -1,20 +1,26 @@
 #!/bin/bash
-d=`dirname $0`
+#d=`dirname $0`
 #ess=1
-DIR="$d/data/$1"
-DIR_1="$d/data/$1/"
+#DIR="$d/data/$1"
+#DIR_1="$d/data/$1/"
+cd /var/lib/genenet/bnw
 
-mkdir -p $DIR
+
+mkdir -p /var/lib/genenet/bnw/$1
 
 maxparent=$2
 k=$3
 THR=$4
 
-./network_score $d/data/$1continuous_input.txt $d/data/$1ban.txt $d/data/$1white.txt $maxparent $DIR
+./network_score /var/lib/genenet/bnw/$1continuous_input.txt /var/lib/genenet/bnw/$1ban.txt /var/lib/genenet/bnw/$1white.txt $maxparent /var/lib/genenet/bnw/$1
+
+./k-best/src/data2netk_poster.sh /var/lib/genenet/bnw/$1continuous_input.txt /var/lib/genenet/bnw/$1 $k $maxparent
 
-$d/k-best/src/data2netk_poster.sh $d/data/$1continuous_input.txt $DIR $k $maxparent
+./structure /var/lib/genenet/bnw/$1continuous_input.txt /var/lib/genenet/bnw/$1/postProbEachEdge.txt /var/lib/genenet/bnw/$1structure_input_temp.txt /var/lib/genenet/bnw/$1structure_input.txt $THR
 
-./structure $d/data/$1continuous_input.txt $DIR/postProbEachEdge.txt $d/data/$1structure_input_temp.txt $d/data/$1structure_input.txt $THR
+rm -r /var/lib/genenet/bnw/$1
 
-rm -r $DIR_1*
-rmdir $DIR
+if [ $k = 1 ]
+then
+    rm -r /var/lib/genenet/bnw/$1structure_input_temp.txt
+fi
diff --git a/sourcecodes/run_scripts/#run_octave# b/sourcecodes/run_scripts/#run_octave#
deleted file mode 100644
index 2beea5d8..00000000
--- a/sourcecodes/run_scripts/#run_octave#
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
-runBN_initial(arg_list{1});
-createSVG(arg_list{1});
-createJSON(arg_list{1});
-output = strcat(arg_list{1},"network.svg");
-command = cstrcat("/usr/bin/dot -Tsvg -o",output," ",arg_list{1},"graphviz_svg.txt > ",output);
-system(command);
-output2 = strcat(arg_list{1},"network_no_edge.svg");
-command2 = cstrcat("/usr/bin/dot -Tsvg -o",output2," ",arg_list{1},"graphviz_svg_no_edge.txt > ",output2);
-system(command2);
diff --git a/sourcecodes/run_scripts/BNW_workflow_sci.htm b/sourcecodes/run_scripts/BNW_workflow_sci.htm
new file mode 100644
index 00000000..3911d400
--- /dev/null
+++ b/sourcecodes/run_scripts/BNW_workflow_sci.htm
@@ -0,0 +1,381 @@
+<html xmlns:v="urn:schemas-microsoft-com:vml"
+xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 12">
+<meta name=Originator content="Microsoft Word 12">
+<link rel=File-List href="BNW_workflow_test_files/filelist.xml">
+<link rel=Edit-Time-Data href="BNW_workflow_test_files/editdata.mso">
+<style>
+<!--
+ /* Font Definitions */
+ @font-face
+	{font-family:"Cambria Math";
+	panose-1:2 4 5 3 5 4 6 3 2 4;
+	mso-font-charset:1;
+	mso-generic-font-family:roman;
+	mso-font-format:other;
+	mso-font-pitch:variable;
+	mso-font-signature:0 0 0 0 0 0;}
+@font-face
+	{font-family:Calibri;
+	panose-1:2 15 5 2 2 2 4 3 2 4;
+	mso-font-charset:0;
+	mso-generic-font-family:swiss;
+	mso-font-pitch:variable;
+	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
+@font-face
+	{font-family:Tahoma;
+	panose-1:2 11 6 4 3 5 4 4 2 4;
+	mso-font-charset:0;
+	mso-generic-font-family:swiss;
+	mso-font-pitch:variable;
+	mso-font-signature:-520081665 -1073717157 41 0 66047 0;}
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+	{mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-parent:"";
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:10.0pt;
+	margin-left:0in;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
+	{mso-style-noshow:yes;
+	mso-style-priority:99;
+	mso-style-link:"Balloon Text Char";
+	margin:0in;
+	margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:8.0pt;
+	font-family:"Tahoma","sans-serif";
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;}
+p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
+	{mso-style-priority:34;
+	mso-style-unhide:no;
+	mso-style-qformat:yes;
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:10.0pt;
+	margin-left:.5in;
+	mso-add-space:auto;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
+	{mso-style-priority:34;
+	mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-type:export-only;
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:0in;
+	margin-left:.5in;
+	margin-bottom:.0001pt;
+	mso-add-space:auto;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
+	{mso-style-priority:34;
+	mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-type:export-only;
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:0in;
+	margin-left:.5in;
+	margin-bottom:.0001pt;
+	mso-add-space:auto;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
+	{mso-style-priority:34;
+	mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-type:export-only;
+	margin-top:0in;
+	margin-right:0in;
+	margin-bottom:10.0pt;
+	margin-left:.5in;
+	mso-add-space:auto;
+	line-height:115%;
+	mso-pagination:widow-orphan;
+	font-size:11.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+span.BalloonTextChar
+	{mso-style-name:"Balloon Text Char";
+	mso-style-noshow:yes;
+	mso-style-priority:99;
+	mso-style-unhide:no;
+	mso-style-locked:yes;
+	mso-style-link:"Balloon Text";
+	mso-ansi-font-size:8.0pt;
+	mso-bidi-font-size:8.0pt;
+	font-family:"Tahoma","sans-serif";
+	mso-ascii-font-family:Tahoma;
+	mso-hansi-font-family:Tahoma;
+	mso-bidi-font-family:Tahoma;}
+.MsoChpDefault
+	{mso-style-type:export-only;
+	mso-default-props:yes;
+	font-size:10.0pt;
+	mso-ansi-font-size:10.0pt;
+	mso-bidi-font-size:10.0pt;
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-fareast-font-family:Calibri;
+	mso-fareast-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:minor-bidi;}
+@page WordSection1
+	{size:8.5in 11.0in;
+	margin:1.0in 1.0in 1.0in 1.0in;
+	mso-header-margin:.5in;
+	mso-footer-margin:.5in;
+	mso-paper-source:0;}
+div.WordSection1
+	{page:WordSection1;}
+ /* List Definitions */
+ @list l0
+	{mso-list-id:779757819;
+	mso-list-type:hybrid;
+	mso-list-template-ids:939584274 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l0:level1
+	{mso-level-text:"%1\)";
+	mso-level-tab-stop:none;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level2
+	{mso-level-tab-stop:1.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level3
+	{mso-level-tab-stop:1.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level4
+	{mso-level-tab-stop:2.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level5
+	{mso-level-tab-stop:2.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level6
+	{mso-level-tab-stop:3.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level7
+	{mso-level-tab-stop:3.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level8
+	{mso-level-tab-stop:4.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l0:level9
+	{mso-level-tab-stop:4.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1
+	{mso-list-id:1813714603;
+	mso-list-type:hybrid;
+	mso-list-template-ids:939584274 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
+@list l1:level1
+	{mso-level-text:"%1\)";
+	mso-level-tab-stop:none;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level2
+	{mso-level-tab-stop:1.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level3
+	{mso-level-tab-stop:1.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level4
+	{mso-level-tab-stop:2.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level5
+	{mso-level-tab-stop:2.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level6
+	{mso-level-tab-stop:3.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level7
+	{mso-level-tab-stop:3.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level8
+	{mso-level-tab-stop:4.0in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+@list l1:level9
+	{mso-level-tab-stop:4.5in;
+	mso-level-number-position:left;
+	text-indent:-.25in;}
+ol
+	{margin-bottom:0in;}
+ul
+	{margin-bottom:0in;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+	{mso-style-name:"Table Normal";
+	mso-tstyle-rowband-size:0;
+	mso-tstyle-colband-size:0;
+	mso-style-noshow:yes;
+	mso-style-priority:99;
+	mso-style-qformat:yes;
+	mso-style-parent:"";
+	mso-padding-alt:0in 5.4pt 0in 5.4pt;
+	mso-para-margin:0in;
+	mso-para-margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:10.0pt;
+	font-family:"Calibri","sans-serif";
+	mso-ascii-font-family:Calibri;
+	mso-ascii-theme-font:minor-latin;
+	mso-hansi-font-family:Calibri;
+	mso-hansi-theme-font:minor-latin;}
+</style>
+<![endif]--><!--[if gte mso 9]><xml>
+ <o:shapedefaults v:ext="edit" spidmax="4098"/>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <o:shapelayout v:ext="edit">
+  <o:idmap v:ext="edit" data="1"/>
+ </o:shapelayout></xml><![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=WordSection1>
+
+<p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
+normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'>1.
+A genetic network linking genotype and phenotype<o:p></o:p></span></b></p>
+
+<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif"'>In this example, we will use the structural constraint interface to create a genetic network linking a genotype with gene expression traits and a higher-order phenotype. There are 5 nodes in the network: Genotype, Gene1, Gene2, Gene3, and Phenotype. The input data file is available <a href="example_datasets/sci_5node_input_data2.txt">here</a>. To begin, select <u>Learn a network model from data</u> on the BNW homepage and load the data file, displaying what is shown below:<br><br><o:p></o:p></span></p>
+
+
+<img width=776 height=322 src="BNW_workflow_test_files/sci_5node_upload.png" v:shapes="Picture_x0020_2"></img>
+
+<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif"'><br>We now have the option of either learning performing structure learning using the default BNW settings or we can modify settings and add structural constraints. Here, we will select <u>Go to structure learning settings and the BNW structural constraint interface</u> to select the latter option. The BNW structural constraint interface is described in our <a href="help.php#constraint_interface">Help page</a>. At shown in the figure below, the first page has several settings for global features of the structure search. We have kept the default settings, except we have changed the <u>Number of networks to include in model averaging</u> to 1000. As this is a small network with only 5 nodes, including many high scoring networks had little effect on the estimated time required to perform structure learning, and the estimated run time increased from 12 to 13 seconds. We also could increase the <u>Maximum number of parents for any node</u> to any value without significantly changing the run time for a network of this size. For larger networks with more than approximately 10 nodes, changing these settings can have a major impact on estimated run times.<br><br><o:p></o:p></span></p>
+
+<img width=508 height=175 src="BNW_workflow_test_files/sci_5node_part1.png" v:shapes="Picture_x0020_2"></img>
+
+<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif"'><br>Clicking the <u>Continue to assign variables to tiers</u> button allows the assignment of nodes to tiers which can focus network searches on biologically meaningful networks. Our dataset contains a genotype, three gene expression traits, and a higher order phenotype. Instead of considering all possible network models for this dataset, we may want to focus on models relevant to a questions such as: How does variation in genotype and gene expression explain the variation observed in the phenotype? To address this question, we assign the network nodes to three tiers: Tier1 contains the genotype, Tier2 contains the gene expression traits, and Tier3 contains the phenotype.<br><br><o:p></o:p></span></p>
+
+<img width=671 height=320 src="BNW_workflow_test_files/sci_5node_part2.png" v:shapes="Picture_x0020_2"></img>
+
+<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif"'><br>The third section of the BNW structural constraint interface allows users to specify the interactions that are allowed within and between tiers. By default, within tier interactions (i.e., nodes in TierX can be parents or children of other nodes in TierX) are allowed, but users may want to prevent within tier interactions for some cases. For example, it may be advantageous to prevent interactions between a tier that contained a set of some demographic variables (e.g., age, sex, and race), as these variables are not likely to be causal factor that influence other factors in the tier. In this case, within tier interactions only apply to Tier2, and we do not have any prior knowledge that indicates that between gene interactions should not be allowed, so we will keep the default setting and allow within tier interactions.<br><br> The default settings for between tier interactions allow nodes within a tier to be the parents of all nodes in lower ranking tiers. Here, the Genotype node in Tier1 can be parents of the gene nodes in Tier2 and the Phenotype node in Tier3, the gene nodes in Tier2 can be the parents of the Tier3 Phenotype node, and the Tier3 Phenotype node cannot be the parents of nodes in any other tier. Therefore, by default, the Genotype node can be the direct parent of the Phenotype node. We may want to allow this interaction, as the genotype may influence genotype through genes or other factors that are not explicitly included as variables in the network. If users do not want to allow this direct Genotype-Phenotype interaction, they can unclick the Tier3 box in the <u>Which tiers contain nodes that can be the children of this tier?</u> for Tier1. In this case, we have maintained the default settings which are shown below. The final section of this menu allows for listing specific edges that should be banned or required in the network structures. We will not ban or require any specific edges in this network.<br><br><o:p></o:p></span></p>
+
+<img width=886 height=443 src="BNW_workflow_test_files/sci_5node_part3.png" v:shapes="Picture_x0020_2"></img>
+
+<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif"'><br>In this example, we will not specify any additional constraints in the fourth section of the structural constraint interface, and we can click <u>Click here to perform Bayesian network modeling</u> on the top of the page. The figure below shows the network with the model average network of the 1000 highest scoring networks and this network is available <a href="example.php?My_key=example_sci|Llu" target="_blank">here</a>. Genotype directly influences two of the genes (Gene1 and Gene3), and two of the genes (Gene2 and Gene3) directly influence the Phenotype. In this case, although we did not prevent the Genotype from directly influencing the Phenotype, the highest scoring networks did not include this directed edge. The right side of the figure shows the predictions of the network with Genotype=1 used as evidence. If Genotype is known to be in state 1, the values of all other variables in the network are expected to decrease compared to the distributions learned using all phenotypes. A more complete description of using BNW to make predictions with network models can be found in a <a href="BNW_workflow_net1.htm">separate tutorial</a>.<br><br><o:p></o:p></span></p>
+
+<img width=587 height=561 src="BNW_workflow_test_files/sci_5node_network1.png" v:shapes="Picture_x0020_2"></img>
+
+
+<p class=MsoNormal style='margin-right:307.5pt'><b style='mso-bidi-font-weight:
+normal'><span style='font-size:14.0pt;line-height:115%;font-family:"Arial","sans-serif"'><br>2.
+A genetic network with multiple genotypes and cis- and trans-regulated genes.<o:p></o:p></span></b></p>
+
+<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'> In this example, we will add restrictions to a network containing 8 nodes: 2 genotype nodes (Geno1 and Geno2), 3 cis-regulated gene expression traits (cisGene1, cisGene2, and cisGene3), 2 trans-regulated gene expression traits (transGene1 and transGene2), and a phenotype (Pheno). We have four tiers of nodes (genotypes, cis-regulated genes, trans-regulated genes, and phenotype), so we have selected 4 from the dropdown menu at the top of the page and assigned the nodes to the correct tiers. We could make a more complex system of tiers that would allow us to specify which genes are regulated by which genotypes (for example, Geno1 regulates cisGene1 and transGene1, while Geno2 regulates cisGene2, cisGene3, and transGene2), but, for this example, we will use a simpler system of 4 tiers.<br><br><o:p></o:p></span></p>
+
+<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
+<![if !vml]><img width=863 height=419
+src="BNW_workflow_test_files/image2_4.png" v:shapes="Picture_x0020_14"><![endif]><o:p></o:p></span></p>
+
+
+<p class=MsoNormal style='margin-top:0in;margin-right:307.5pt;margin-bottom:
+0in;margin-left:0in;margin-bottom:.0001pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'> We have made one change to the default setting in the <u>Define interactions allowed between tiers</u> section. For Tier1, which contains the genotypes, we have selected "No" for the "Are within tier interactions allowed?", as it does not make biological sense for one genotype variation to cause the variation in another genotype in this example.<br><br>Also, assume that a known regulatory relationship between cisGene1 and transGene1 has been established from previous experiments. We can require that this relationship is included in the network by adding the edge list of required edges in the <u>Specify additional constraints</u> section.<br><br><o:p></o:p></span></p>
+
+<p class=MsoNormal style='margin-right:307.5pt'><span style='font-size:12.0pt;
+line-height:115%;font-family:"Arial","sans-serif";mso-no-proof:yes'>
+<![if !vml]><img width=1006 height=631
+src="BNW_workflow_test_files/image2_5.png" v:shapes="Picture_x0020_14"><![endif]><o:p></o:p></span></p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/sourcecodes/run_scripts/path_cd.m b/sourcecodes/run_scripts/path_cd.m
new file mode 100644
index 00000000..d45098d0
--- /dev/null
+++ b/sourcecodes/run_scripts/path_cd.m
@@ -0,0 +1,5 @@
+base_dir = pwd();
+addpath(strcat(base_dir,"/bnt-master"));
+addpath(genpathKPM(strcat(base_dir,"/bnt-master")));
+addpath(strcat(base_dir,"/parameter_learning"));
+cd /var/lib/genenet/bnw/;
diff --git a/sourcecodes/run_scripts/run_del_var b/sourcecodes/run_scripts/run_del_var
index 0b1bdfdc..5a500ee2 100644
--- a/sourcecodes/run_scripts/run_del_var
+++ b/sourcecodes/run_scripts/run_del_var
@@ -1,8 +1,5 @@
 #!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
+source("./run_scripts/path_cd.m")
+arg_list = argv();
 removeNodes(arg_list{1},arg_list{2});
 prepareInput(arg_list{2});
\ No newline at end of file
diff --git a/sourcecodes/run_scripts/run_kfold b/sourcecodes/run_scripts/run_kfold
index f90a5428..371649e4 100644
--- a/sourcecodes/run_scripts/run_kfold
+++ b/sourcecodes/run_scripts/run_kfold
@@ -1,18 +1,15 @@
 #!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
+source("./run_scripts/path_cd.m")
+arg_list = argv();
 fileout=strcat(arg_list{1},"kfoldCV.txt");
 delete(fileout);
+fileout=strcat(arg_list{1},"kfold_plotly.html");
+delete(fileout);
 filename=strcat(arg_list{1},"kfoldCV_temp.txt");
 fout_temp=fopen(filename,'w');
 fprintf(fout_temp,arg_list{2});
 kfoldCrossValid(arg_list{1},arg_list{2},arg_list{3});
 fclose(fout_temp);
-delete(filename);
-
-
-command=strcat({"/home/jziebart/python/Python-2.7.15/python ../kfold_plotly.py "},arg_list{1});
+command=cstrcat("/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3 ",base_dir,"/kfold_plotly.py ",arg_list{1});
 test=system(command);
+delete(filename);
diff --git a/sourcecodes/run_scripts/run_loo b/sourcecodes/run_scripts/run_loo
index 3ff4f4db..4fbc0b28 100644
--- a/sourcecodes/run_scripts/run_loo
+++ b/sourcecodes/run_scripts/run_loo
@@ -1,17 +1,15 @@
 #!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
+source("./run_scripts/path_cd.m")
+arg_list = argv();
 filename=strcat(arg_list{1},"looCV.txt");
 delete(filename);
+filename=strcat(arg_list{1},"loo_plotly.html");
+delete(filename);
 filename=strcat(arg_list{1},"looCV_temp.txt");
 fout_temp=fopen(filename,'w');
 fprintf(fout_temp,arg_list{2});
 fclose(fout_temp);
 looCrossValid(arg_list{1},arg_list{2});
 delete(filename);
-
-command=strcat({"/home/jziebart/python/Python-2.7.15/python ../cv_plotly.py "},arg_list{1});
+command=cstrcat("/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3 ",base_dir,"/cv_plotly.py ",arg_list{1});
 test=system(command);
diff --git a/sourcecodes/run_scripts/run_mod_edges b/sourcecodes/run_scripts/run_mod_edges
index 30176e9c..a8376351 100644
--- a/sourcecodes/run_scripts/run_mod_edges
+++ b/sourcecodes/run_scripts/run_mod_edges
@@ -1,9 +1,6 @@
 #!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
+source("./run_scripts/path_cd.m")
+arg_list = argv();
 modifyEdges(arg_list{1},arg_list{2});
 
 fname1=strcat(arg_list{1},"continuous_input.txt");
@@ -22,3 +19,15 @@ fname1=strcat(arg_list{1},"name.txt");
 fname2=strcat(arg_list{2},"name.txt");
 copyfile(fname1,fname2);
 
+fname1=strcat(arg_list{1},"type.txt");
+fname2=strcat(arg_list{2},"type.txt");
+copyfile(fname1,fname2);
+
+fname1=strcat(arg_list{1},"nlevels.txt");
+fname2=strcat(arg_list{2},"nlevels.txt");
+copyfile(fname1,fname2);
+
+fname1=strcat(arg_list{1},"input_table.txt");
+fname2=strcat(arg_list{2},"input_table.txt");
+copyfile(fname1,fname2);
+
diff --git a/sourcecodes/run_scripts/run_mod_edges.bk b/sourcecodes/run_scripts/run_mod_edges.bk
deleted file mode 100644
index 30176e9c..00000000
--- a/sourcecodes/run_scripts/run_mod_edges.bk
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
-modifyEdges(arg_list{1},arg_list{2});
-
-fname1=strcat(arg_list{1},"continuous_input.txt");
-fname2=strcat(arg_list{2},"continuous_input.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"continuous_input_orig.txt");
-fname2=strcat(arg_list{2},"continuous_input_orig.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"nnode.txt");
-fname2=strcat(arg_list{2},"nnode.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"name.txt");
-fname2=strcat(arg_list{2},"name.txt");
-copyfile(fname1,fname2);
-
diff --git a/sourcecodes/run_scripts/run_mod_edges~ b/sourcecodes/run_scripts/run_mod_edges~
deleted file mode 100644
index 1659c684..00000000
--- a/sourcecodes/run_scripts/run_mod_edges~
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
-modifyEdges(arg_list{1},arg_list{2});
-
-fname1=strcat(arg_list{1},"continuous_input.txt");
-fname2=strcat(arg_list{2},"continuous_input.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"continuous_input_orig.txt");
-fname2=strcat(arg_list{2},"continuous_input_orig.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"nnode.txt");
-fname2=strcat(arg_list{2},"nnode.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"name.txt");
-fname2=strcat(arg_list{2},"name.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"type.txt");
-fname2=strcat(arg_list{2},"type.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"nlevels.txt");
-fname2=strcat(arg_list{2},"nlevels.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"grviz_name_file.txt");
-fname2=strcat(arg_list{2},"grviz_name_file.txt");
-copyfile(fname1,fname2);
-
-runBN_initial(arg_list{2});
-createSVG(arg_list{2});
-createJSON(arg_list{2});
-output = strcat(arg_list{2},"network.svg");
-command = cstrcat("/usr/bin/dot -Tsvg -o",output," ",arg_list{1},"graphviz_svg.txt > ",output);
-system(command);
-output2 = strcat(arg_list{2},"network_no_edge.svg");
-command2 = cstrcat("/usr/bin/dot -Tsvg -o",output2," ",arg_list{2},"graphviz_svg_no_edge.txt > ",output2);
-system(command2);
diff --git a/sourcecodes/run_scripts/run_mod_str b/sourcecodes/run_scripts/run_mod_str
index 63439afd..2acacbb8 100644
--- a/sourcecodes/run_scripts/run_mod_str
+++ b/sourcecodes/run_scripts/run_mod_str
@@ -1,9 +1,6 @@
 #!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
+source("./run_scripts/path_cd.m")
+arg_list = argv();
 
 fname1=strcat(arg_list{1},"continuous_input_orig.txt");
 fname2=strcat(arg_list{2},"continuous_input_orig.txt");
diff --git a/sourcecodes/run_scripts/run_mod_str~ b/sourcecodes/run_scripts/run_mod_str~
deleted file mode 100644
index 30176e9c..00000000
--- a/sourcecodes/run_scripts/run_mod_str~
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
-modifyEdges(arg_list{1},arg_list{2});
-
-fname1=strcat(arg_list{1},"continuous_input.txt");
-fname2=strcat(arg_list{2},"continuous_input.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"continuous_input_orig.txt");
-fname2=strcat(arg_list{2},"continuous_input_orig.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"nnode.txt");
-fname2=strcat(arg_list{2},"nnode.txt");
-copyfile(fname1,fname2);
-
-fname1=strcat(arg_list{1},"name.txt");
-fname2=strcat(arg_list{2},"name.txt");
-copyfile(fname1,fname2);
-
diff --git a/sourcecodes/run_scripts/run_octave b/sourcecodes/run_scripts/run_octave
index 3879280e..5bc782ef 100644
--- a/sourcecodes/run_scripts/run_octave
+++ b/sourcecodes/run_scripts/run_octave
@@ -1,7 +1,14 @@
 #!/usr/bin/octave -qf
-cd ./data
+source("./run_scripts/path_cd.m")
 arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
 runBN_initial(arg_list{1});
+createSVG(arg_list{1});
+createJSON(arg_list{1});
+output = strcat(arg_list{1},"network.svg");
+command = cstrcat("/usr/bin/dot -Tsvg -o",output," ",arg_list{1},"graphviz_svg.txt > ",output);
+system(command);
+output2 = strcat(arg_list{1},"network_no_edge.svg");
+command2 = cstrcat("/usr/bin/dot -Tsvg -o",output2," ",arg_list{1},"graphviz_svg_no_edge.txt > ",output2);
+system(command2);
+command= cstrcat("/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3 ",base_dir,"/violin_plotly.py ",arg_list{1});
+test=system(command);
diff --git a/sourcecodes/run_scripts/run_octave_evd b/sourcecodes/run_scripts/run_octave_evd
index 9f661925..ae072fdd 100644
--- a/sourcecodes/run_scripts/run_octave_evd
+++ b/sourcecodes/run_scripts/run_octave_evd
@@ -1,7 +1,6 @@
 #!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
+source("./run_scripts/path_cd.m")
+arg_list = argv();
 Predictmultiple(arg_list{1});
+command=cstrcat("/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3 ",base_dir,"/violin_ev_plotly.py ",arg_list{1});
+test=system(command);
diff --git a/sourcecodes/run_scripts/run_octave_inv b/sourcecodes/run_scripts/run_octave_inv
index f9e568e3..12c1d204 100644
--- a/sourcecodes/run_scripts/run_octave_inv
+++ b/sourcecodes/run_scripts/run_octave_inv
@@ -1,7 +1,6 @@
 #!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
+source("./run_scripts/path_cd.m")
+arg_list = argv();
 Predictmultipleintervention(arg_list{1});
+command=cstrcat("/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3 ",base_dir,"/violin_int_plotly.py ",arg_list{1});
+test=system(command);
diff --git a/sourcecodes/run_scripts/run_octave_test~ b/sourcecodes/run_scripts/run_octave_test~
deleted file mode 100644
index 3879280e..00000000
--- a/sourcecodes/run_scripts/run_octave_test~
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
-runBN_initial(arg_list{1});
diff --git a/sourcecodes/run_scripts/run_octave~ b/sourcecodes/run_scripts/run_octave~
deleted file mode 100644
index 5a83f277..00000000
--- a/sourcecodes/run_scripts/run_octave~
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
-runBN_initial(arg_list{1});
-createSVG(arg_list{1});
-output = strcat(arg_list{1},"network.svg");
-command = cstrcat("/usr/bin/dot -Tsvg -o",output," ",arg_list{1},"graphviz_svg.txt > ",output);
-system(command);
-output2 = strcat(arg_list{1},"network_no_edge.svg");
-command2 = cstrcat("/usr/bin/dot -Tsvg -o",output2," ",arg_list{1},"graphviz_svg_no_edge.txt > ",output2);
-system(command2);
diff --git a/sourcecodes/run_scripts/run_prep_input b/sourcecodes/run_scripts/run_prep_input
index 4611d880..47503ce7 100644
--- a/sourcecodes/run_scripts/run_prep_input
+++ b/sourcecodes/run_scripts/run_prep_input
@@ -1,7 +1,4 @@
 #!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
+source("./run_scripts/path_cd.m");
+arg_list = argv();
 prepareInput(arg_list{1});
diff --git a/sourcecodes/run_scripts/run_settings b/sourcecodes/run_scripts/run_settings
new file mode 100644
index 00000000..c32cd116
--- /dev/null
+++ b/sourcecodes/run_scripts/run_settings
@@ -0,0 +1,4 @@
+#!/usr/bin/octave -qf
+source("./run_scripts/path_cd.m");
+arg_list = argv();
+writeSettings(arg_list{1});
diff --git a/sourcecodes/run_scripts/run_test_set b/sourcecodes/run_scripts/run_test_set
index dbf929f8..67ae66cd 100644
--- a/sourcecodes/run_scripts/run_test_set
+++ b/sourcecodes/run_scripts/run_test_set
@@ -1,15 +1,13 @@
 #!/usr/bin/octave -qf
-cd ./data
+source("./run_scripts/path_cd.m")
 arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
 filename=strcat(arg_list{1},"ts_output.txt");
 delete(filename);
+filename=strcat(arg_list{1},"ts_plotly.html");
+delete(filename);
 testSetPredictions(arg_list{1});
-fclose(filename);
+#fclose(filename);
 filename=strcat(arg_list{1},"ts_upload.txt");
 delete(filename);
-
-command=strcat({"/home/jziebart/python/Python-2.7.15/python ../ts_plotly.py "},arg_list{1});
+command=cstrcat("/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3 ",base_dir,"/ts_plotly.py ",arg_list{1});
 test=system(command);
diff --git a/sourcecodes/run_scripts/run_violin b/sourcecodes/run_scripts/run_violin
new file mode 100644
index 00000000..d7605671
--- /dev/null
+++ b/sourcecodes/run_scripts/run_violin
@@ -0,0 +1,11 @@
+#!/usr/bin/octave -qf
+source("./run_scripts/path_cd.m");
+arg_list = argv(); 
+command(cstrcat("/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3 ",base_dir,"violin.py ",arg_list{1});
+test=system(command);
+#command=strcat({"/home/jziebart/python/Python-2.7.15/python ../violin_plotly.py "},arg_list{1});
+#test=system(command);
+#command=strcat({"/home/jziebart/python/Python-2.7.15/python ../violin_ev_plotly.py "},arg_list{1});
+#test=system(command);
+#command=strcat({"/home/jziebart/python/Python-2.7.15/python ../violin_int_plotly.py "},arg_list{1});
+#test=system(command);
diff --git a/sourcecodes/run_scripts/test b/sourcecodes/run_scripts/test
deleted file mode 100644
index fc47416b..00000000
--- a/sourcecodes/run_scripts/test
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
-createJSON(arg_list{1});
diff --git a/sourcecodes/run_scripts/test~ b/sourcecodes/run_scripts/test~
deleted file mode 100644
index 2beea5d8..00000000
--- a/sourcecodes/run_scripts/test~
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/octave -qf
-cd ./data
-arg_list = argv(); 
-addpath("../bnt-master");
-addpath(genpathKPM("../bnt-master"));
-addpath("../parameter_learning");
-runBN_initial(arg_list{1});
-createSVG(arg_list{1});
-createJSON(arg_list{1});
-output = strcat(arg_list{1},"network.svg");
-command = cstrcat("/usr/bin/dot -Tsvg -o",output," ",arg_list{1},"graphviz_svg.txt > ",output);
-system(command);
-output2 = strcat(arg_list{1},"network_no_edge.svg");
-command2 = cstrcat("/usr/bin/dot -Tsvg -o",output2," ",arg_list{1},"graphviz_svg_no_edge.txt > ",output2);
-system(command2);
diff --git a/sourcecodes/runtime_check.php b/sourcecodes/runtime_check.php
index 439a0b14..d8c30bb7 100644
--- a/sourcecodes/runtime_check.php
+++ b/sourcecodes/runtime_check.php
@@ -3,7 +3,9 @@
 function exe_time($keyval,$parent_number,$k_number)
 {
 
-$dir="./data/";
+  //$dir="./data/";
+  //$dir="/tmp/bnw/";
+  $dir="/var/lib/genenet/bnw/";
 
 $nrf = $dir.$keyval."nrows.txt";
 $nrows=trim(file_get_contents("$nrf"));
@@ -60,4 +62,4 @@ $totaltime=$local*($nrows/100)+$k_time+12;
 //return $max_parent_row[$node];
 return $totaltime;
 
-}
\ No newline at end of file
+}
diff --git a/sourcecodes/sample_input.php b/sourcecodes/sample_input.php
new file mode 100644
index 00000000..2b0ded93
--- /dev/null
+++ b/sourcecodes/sample_input.php
@@ -0,0 +1,45 @@
+<head>
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+<?php 
+include("header_new.inc");
+include("input_validate.php");
+
+?>
+
+</head>
+
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><a href="bn_file_load_gom.php">Load data and begin modeling</a>
+  <li><a href="help.php">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+<body>
+  <div id="outernew">
+  <h3>Sample input data file</h3>
+  <br>A sample input file is shown below. A text version can be viewed or downloaded <a href="./data/sample_input.txt">here</a>.<br><br>
+  The first row contains the variable names. Each remaining row is a case or sample.<br><br>
+  The first column is a discrete genotype variable which has 2 states (A and B). The remaining columns contain 4 continuous variables.<br><br>
+  Two cases have unknown values (Genotype and Trait2 for rows 3 and 4, respectively). These are represented with "NA" in the input file. Rows containing "NA"
+for any variable are ignored by BNW.<br><br>
+  <div class="d3_table" id="table_div1">
+  <script type="text/javascript">
+  d3.text("./data/sample_input.txt", function(error, raw){
+  var dsv = d3.dsvFormat("\t")
+  var data = dsv.parse(raw)
+  var caption_text = "Sample Input File";
+  if (error) throw error;
+      tabulate_caption("#table_div1",data,caption_text);
+    });
+</script>
+</div>
+<br>
+<br>
+<br>
+</div>
+</body>
+
+
diff --git a/sourcecodes/scripts/FileSaver.min.js b/sourcecodes/scripts/FileSaver.min.js
new file mode 100644
index 00000000..0ec6dd23
--- /dev/null
+++ b/sourcecodes/scripts/FileSaver.min.js
@@ -0,0 +1 @@
+(function(a,b){if("function"==typeof define&&define.amd)define([],b);else if("undefined"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){"use strict";function b(a,b){return"undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){g(d.response,b,c)},d.onerror=function(){console.error("could not download file")},d.send()}function d(a){var b=new XMLHttpRequest;b.open("HEAD",a,!1);try{b.send()}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,a=/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4E4),setTimeout(function(){e(j)},0))}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else{var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i)})}}:function(b,d,e,g){if(g=g||open("","_blank"),g&&(g.document.title=g.document.body.innerText="downloading..."),"string"==typeof b)return c(b,d,e);var h="application/octet-stream"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&"undefined"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),g?g.location.href=a:location=a,g=null},k.readAsDataURL(b)}else{var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m)},4E4)}});f.saveAs=g.saveAs=g,"undefined"!=typeof module&&(module.exports=g)});
diff --git a/sourcecodes/scripts/accordion.js b/sourcecodes/scripts/accordion.js
new file mode 100644
index 00000000..513bde84
--- /dev/null
+++ b/sourcecodes/scripts/accordion.js
@@ -0,0 +1,31 @@
+$(function() {
+var acc = document.getElementsByClassName("accordion");
+var panel = document.getElementsByClassName("panel");
+var icons = document.getElementsByClassName("i");
+var i;
+
+for (var i = 0; i < acc.length; i++) {
+    acc[i].onclick = function() {
+	var setClasses = !this.classList.contains('active');
+	setClass(acc, 'active', 'remove');
+	setClass(panel, 'show', 'remove');
+	if (setClasses) {
+	    this.classList.toggle("active");
+	    this.nextElementSibling.classList.toggle("show");
+	}
+    }
+}
+
+function setClass(els, className, fnName) {
+    for (var i = 0; i < els.length; i++) {
+	els[i].classList[fnName](className);
+    }
+}
+
+$('button').click(function() {
+	$('i').not($(this).find('i')).removeClass('fa-angle-up')
+	    $('i').not($(this).find('i')).addClass('fa-angle-down')
+	    $(this).find('i').toggleClass('fa-angle-down fa-angle-up')
+	    });
+    }
+   )
diff --git a/sourcecodes/scripts/accordion.js~ b/sourcecodes/scripts/accordion.js~
new file mode 100644
index 00000000..51949b96
--- /dev/null
+++ b/sourcecodes/scripts/accordion.js~
@@ -0,0 +1,31 @@
+$(function() {
+var acc = document.getElementsByClassName("accordion");
+var panel = document.getElementsByClassName("panel");
+var icons = document.getElementsByClassName("i");
+var i;
+
+for (var i = 0; i < acc.length; i++) {
+    acc[i].onclick = function() {
+	var setClasses = !this.classList.contains('active');
+	setClass(acc, 'active', 'remove');
+	setClass(panel, 'show', 'remove');
+	if (setClasses) {
+	    this.classList.toggle("active");
+	    this.nextElementSibling.classList.toggle("show");
+	}
+    }
+}
+
+function setClass(els, className, fnName) {
+    for (var i = 0; i < els.length; i++) {
+	els[i].classList[fnName](className);
+    }
+}
+
+$('button').click(function() {
+	$('i').not($(this).find('i')).removeClass('fa-minus')
+	    $('i').not($(this).find('i')).addClass('fa-plus')
+	    $(this).find('i').toggleClass('fa-plus fa-minus')
+	    });
+    }
+   )
\ No newline at end of file
diff --git a/sourcecodes/scripts/canvas-toBlob.js b/sourcecodes/scripts/canvas-toBlob.js
new file mode 100644
index 00000000..3dd3c7ef
--- /dev/null
+++ b/sourcecodes/scripts/canvas-toBlob.js
@@ -0,0 +1,125 @@
+/* canvas-toBlob.js
+ * A canvas.toBlob() implementation.
+ * 2016-05-26
+ * 
+ * By Eli Grey, http://eligrey.com and Devin Samarin, https://github.com/eboyjr
+ * License: MIT
+ *   See https://github.com/eligrey/canvas-toBlob.js/blob/master/LICENSE.md
+ */
+
+/*global self */
+/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
+  plusplus: true */
+
+/*! @source http://purl.eligrey.com/github/canvas-toBlob.js/blob/master/canvas-toBlob.js */
+
+(function(view) {
+    "use strict";
+var
+      Uint8Array = view.Uint8Array
+    , HTMLCanvasElement = view.HTMLCanvasElement
+    , canvas_proto = HTMLCanvasElement && HTMLCanvasElement.prototype
+    , is_base64_regex = /\s*;\s*base64\s*(?:;|$)/i
+				 , to_data_url = "toDataURL"
+				 , base64_ranks
+				 , decode_base64 = function(base64) {
+    var
+      len = base64.length
+    , buffer = new Uint8Array(len / 4 * 3 | 0)
+    , i = 0
+    , outptr = 0
+    , last = [0, 0]
+    , state = 0
+    , save = 0
+    , rank
+    , code
+    , undef
+    ;
+    while (len--) {
+	code = base64.charCodeAt(i++);
+	rank = base64_ranks[code-43];
+	if (rank !== 255 && rank !== undef) {
+	    last[1] = last[0];
+	    last[0] = code;
+	    save = (save << 6) | rank;
+	    state++;
+	    if (state === 4) {
+		buffer[outptr++] = save >>> 16;
+		if (last[1] !== 61 /* padding character */) {
+		    buffer[outptr++] = save >>> 8;
+		}
+		if (last[0] !== 61 /* padding character */) {
+		    buffer[outptr++] = save;
+		}
+		state = 0;
+	    }
+	}
+    }
+    // 2/3 chance there's going to be some null bytes at the end, but that
+    // doesn't really matter with most image formats.
+    // If it somehow matters for you, truncate the buffer up outptr.
+    return buffer;
+}
+;
+if (Uint8Array) {
+    base64_ranks = new Uint8Array([
+				   62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1
+				   , -1, -1,  0, -1, -1, -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9
+				   , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25
+				   , -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35
+				   , 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
+				   ]);
+}
+if (HTMLCanvasElement && (!canvas_proto.toBlob || !canvas_proto.toBlobHD)) {
+    if (!canvas_proto.toBlob)
+	canvas_proto.toBlob = function(callback, type /*, ...args*/) {
+	    if (!type) {
+		type = "image/png";
+	    } if (this.mozGetAsFile) {
+		callback(this.mozGetAsFile("canvas", type));
+		return;
+	    } if (this.msToBlob && /^\s*image\/png\s*(?:$|;)/i.test(type)) {
+		callback(this.msToBlob());
+		return;
+	    }
+
+	    var
+	    args = Array.prototype.slice.call(arguments, 1)
+	    , dataURI = this[to_data_url].apply(this, args)
+	    , header_end = dataURI.indexOf(",")
+	    , data = dataURI.substring(header_end + 1)
+	    , is_base64 = is_base64_regex.test(dataURI.substring(0, header_end))
+	    , blob
+	    ;
+	    if (Blob.fake) {
+		// no reason to decode a data: URI that's just going to become a data URI again
+		blob = new Blob
+		    if (is_base64) {
+			blob.encoding = "base64";
+		    } else {
+			blob.encoding = "URI";
+		    }
+		blob.data = data;
+		blob.size = data.length;
+	    } else if (Uint8Array) {
+		if (is_base64) {
+		    blob = new Blob([decode_base64(data)], {type: type});
+		} else {
+		    blob = new Blob([decodeURIComponent(data)], {type: type});
+		}
+	    }
+	    callback(blob);
+	};
+
+    if (!canvas_proto.toBlobHD && canvas_proto.toDataURLHD) {
+	canvas_proto.toBlobHD = function() {
+	    to_data_url = "toDataURLHD";
+	    var blob = this.toBlob();
+	    to_data_url = "toDataURL";
+	    return blob;
+	}
+    } else {
+	canvas_proto.toBlobHD = canvas_proto.toBlob;
+    }
+}
+}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
diff --git a/sourcecodes/scripts/create_table.js b/sourcecodes/scripts/create_table.js
new file mode 100644
index 00000000..6d0cd9b7
--- /dev/null
+++ b/sourcecodes/scripts/create_table.js
@@ -0,0 +1,84 @@
+function tabulate_caption(container,data,caption_text) {
+    var table = d3.select(container).append('table');
+    var caption = table.append("caption").text(caption_text);
+    //var titles = d3.keys(data[0]);
+    var titles = data.columns;
+    var headers = table.append('thead').append('tr')
+        .selectAll('th')
+        .data(titles).enter()
+        .append('th')
+        .text(function (d) {
+	    return d;
+	    });
+
+    var rows = table.append('tbody').selectAll('tr')
+        .data(data).enter()
+        .append('tr');
+    rows.selectAll('td')
+        .data(function (d) {
+		return titles.map(function (k) {
+			return { 'value': d[k], 'name': k};
+		    });
+	    }).enter()
+        .append('td')
+        .attr('data-th', function (d) {
+		return d.name;
+	    })
+        .text(function (d) {
+		return d.value;
+	    });
+    return table;
+}
+
+function tabulate_header_row(container,data,caption_text) {
+    var table = d3.select(container).append('table');
+    var caption = table.append("caption").text(caption_text);
+    //var titles = d3.keys(data[0]);
+    var titles = data.columns;
+    for (var i=0; i<data.length  ;i++) {
+	delete data[i][""];
+	data[i]["From\\To"] = titles[i]; 
+    }
+    //var titles = d3.keys(data[0]);
+    var titles = data.columns;
+    titles.pop();
+    titles.unshift("From\\To");
+    var headers = table.append('thead').append('tr')
+        .selectAll('th')
+        .data(titles).enter()
+        .append('th')
+	.attr("class", function(d) {
+		if (d == "From\\To") {
+		    return "corner-header"
+			}
+	    })
+        .text(function (d) {
+	    return d;
+	    });
+
+    var rows = table.append('tbody').selectAll('tr')
+        .data(data).enter()
+        .append('tr');
+    rows.selectAll('td')
+        .data(function (d) {
+		return titles.map(function (k) {
+			return { 'value': d[k], 'name': k};
+		    });
+	    }).enter()
+        .append('td')
+        .attr('data-th', function (d) {
+		return d.name;
+	    })
+	.attr("class", function(d) {
+		if (d.name == "From\\To") {
+		    return "horizontal-header"
+			}
+	    })
+        .text(function (d) {
+		return d.value;
+	    });
+ 
+    
+
+    return table;
+}
diff --git a/sourcecodes/scripts/create_table.js~ b/sourcecodes/scripts/create_table.js~
new file mode 100644
index 00000000..85df8edb
--- /dev/null
+++ b/sourcecodes/scripts/create_table.js~
@@ -0,0 +1,82 @@
+function tabulate_caption(container,data,caption_text) {
+    var table = d3.select(container).append('table');
+    var caption = table.append("caption").text(caption_text);
+    //var titles = d3.keys(data[0]);
+    var titles = data.columns;
+    var headers = table.append('thead').append('tr')
+        .selectAll('th')
+        .data(titles).enter()
+        .append('th')
+        .text(function (d) {
+	    return d;
+	    });
+
+    var rows = table.append('tbody').selectAll('tr')
+        .data(data).enter()
+        .append('tr');
+    rows.selectAll('td')
+        .data(function (d) {
+		return titles.map(function (k) {
+			return { 'value': d[k], 'name': k};
+		    });
+	    }).enter()
+        .append('td')
+        .attr('data-th', function (d) {
+		return d.name;
+	    })
+        .text(function (d) {
+		return d.value;
+	    });
+    return table;
+}
+
+function tabulate_header_row(container,data,caption_text) {
+    var table = d3.select(container).append('table');
+    var caption = table.append("caption").text(caption_text);
+    var titles = d3.keys(data[0]);
+    for (var i=0; i<data.length  ;i++) {
+	delete data[i][""];
+	data[i]["From\\To"] = titles[i]; 
+    }
+    var titles = d3.keys(data[0]);
+    titles.pop();
+    titles.unshift("From\\To");
+    var headers = table.append('thead').append('tr')
+        .selectAll('th')
+        .data(titles).enter()
+        .append('th')
+	.attr("class", function(d) {
+		if (d == "From\\To") {
+		    return "corner-header"
+			}
+	    })
+        .text(function (d) {
+	    return d;
+	    });
+
+    var rows = table.append('tbody').selectAll('tr')
+        .data(data).enter()
+        .append('tr');
+    rows.selectAll('td')
+        .data(function (d) {
+		return titles.map(function (k) {
+			return { 'value': d[k], 'name': k};
+		    });
+	    }).enter()
+        .append('td')
+        .attr('data-th', function (d) {
+		return d.name;
+	    })
+	.attr("class", function(d) {
+		if (d.name == "From\\To") {
+		    return "horizontal-header"
+			}
+	    })
+        .text(function (d) {
+		return d.value;
+	    });
+ 
+    
+
+    return table;
+}
diff --git a/sourcecodes/scripts/cytoscape-dagre.min.js b/sourcecodes/scripts/cytoscape-dagre.min.js
new file mode 100644
index 00000000..d45a3b30
--- /dev/null
+++ b/sourcecodes/scripts/cytoscape-dagre.min.js
@@ -0,0 +1,8 @@
+/**
+ * Minified by jsDelivr using UglifyJS v3.4.4.
+ * Original file: /npm/cytoscape-dagre@2.2.2/cytoscape-dagre.js
+ * 
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
+ */
+!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("dagre")):"function"==typeof define&&define.amd?define(["dagre"],n):"object"==typeof exports?exports.cytoscapeDagre=n(require("dagre")):e.cytoscapeDagre=n(e.dagre)}(this,function(t){return function(t){var r={};function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=r,o.i=function(e){return e},o.d=function(e,n,t){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="",o(o.s=3)}([function(e,n,t){"use strict";var S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=t(2),o=t(1),j=t(4);function i(e){this.options=o({},r,e)}i.prototype.run=function(){var r=this.options,e=r.cy,n=r.eles,t=function(e,n){return"function"==typeof n?n.apply(e,[e]):n},o=r.boundingBox||{x1:0,y1:0,w:e.width(),h:e.height()};void 0===o.x2&&(o.x2=o.x1+o.w),void 0===o.w&&(o.w=o.x2-o.x1),void 0===o.y2&&(o.y2=o.y1+o.h),void 0===o.h&&(o.h=o.y2-o.y1);var i=new j.graphlib.Graph({multigraph:!0,compound:!0}),a={},u=function(e,n){null!=n&&(a[e]=n)};u("nodesep",r.nodeSep),u("edgesep",r.edgeSep),u("ranksep",r.rankSep),u("rankdir",r.rankDir),u("ranker",r.ranker),i.setGraph(a),i.setDefaultEdgeLabel(function(){return{}}),i.setDefaultNodeLabel(function(){return{}});for(var c=n.nodes(),d=0;d<c.length;d++){var s=c[d],f=s.layoutDimensions(r);i.setNode(s.id(),{width:f.w,height:f.h,name:s.id()})}for(var p=0;p<c.length;p++){var y=c[p];y.isChild()&&i.setParent(y.id(),y.parent().id())}for(var l=n.edges().stdFilter(function(e){return!e.source().isParent()&&!e.target().isParent()}),h=0;h<l.length;h++){var g=l[h];i.setEdge(g.source().id(),g.target().id(),{minlen:t(g,r.minLen),weight:t(g,r.edgeWeight),name:g.id()},g.id())}j.layout(i);for(var x=i.nodes(),v=0;v<x.length;v++){var m=x[v],b=i.node(m);e.getElementById(m).scratch().dagre=b}var w=void 0;r.boundingBox?(w={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0},c.forEach(function(e){var n=e.scratch().dagre;w.x1=Math.min(w.x1,n.x),w.x2=Math.max(w.x2,n.x),w.y1=Math.min(w.y1,n.y),w.y2=Math.max(w.y2,n.y)}),w.w=w.x2-w.x1,w.h=w.y2-w.y1):w=o;return c.layoutPositions(this,r,function(e){var n=(e="object"===(void 0===e?"undefined":S(e))?e:this).scratch().dagre;return function(e){if(r.boundingBox){var n=0===w.w?0:(e.x-w.x1)/w.w,t=0===w.h?0:(e.y-w.y1)/w.h;return{x:o.x1+n*o.w,y:o.y1+t*o.h}}return e}({x:n.x,y:n.y})}),this},e.exports=i},function(e,n,t){"use strict";e.exports=null!=Object.assign?Object.assign.bind(Object):function(t){for(var e=arguments.length,n=Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.forEach(function(n){Object.keys(n).forEach(function(e){return t[e]=n[e]})}),t}},function(e,n,t){"use strict";var r={nodeSep:void 0,edgeSep:void 0,rankSep:void 0,rankDir:void 0,ranker:void 0,minLen:function(e){return 1},edgeWeight:function(e){return 1},fit:!0,padding:30,spacingFactor:void 0,nodeDimensionsIncludeLabels:!1,animate:!1,animateFilter:function(e,n){return!0},animationDuration:500,animationEasing:void 0,boundingBox:void 0,transform:function(e,n){return n},ready:function(){},stop:function(){}};e.exports=r},function(e,n,t){"use strict";var r=t(0),o=function(e){e&&e("layout","dagre",r)};"undefined"!=typeof cytoscape&&o(cytoscape),e.exports=o},function(e,n){e.exports=t}])});
+//# sourceMappingURL=/sm/653f14dc85cb194fee69b74fe6b9b034938c93f534910af207b005ce64ca3a02.map
\ No newline at end of file
diff --git a/sourcecodes/scripts/cytoscape-panzoom.js b/sourcecodes/scripts/cytoscape-panzoom.js
new file mode 100644
index 00000000..77ac7355
--- /dev/null
+++ b/sourcecodes/scripts/cytoscape-panzoom.js
@@ -0,0 +1,587 @@
+/*!
+Copyright (c) The Cytoscape Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the “Software”), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+;(function(){ 'use strict';
+
+  // registers the extension on a cytoscape lib ref
+  var register = function( cytoscape, $ ){
+    if( !cytoscape || !$ ){ return; } // can't register if cytoscape or jquery unspecified
+
+    $.fn.cyPanzoom = $.fn.cytoscapePanzoom = function( options ){
+      panzoom.apply( this, [ options, cytoscape, $ ] );
+
+      return this; // chainability
+    };
+
+    // if you want a core extension
+    cytoscape('core', 'panzoom', function( options ){ // could use options object, but args are up to you
+      panzoom.apply( this, [ options, cytoscape, $ ] );
+
+      return this; // chainability
+    });
+
+  };
+
+  var defaults = {
+    zoomFactor: 0.05, // zoom factor per zoom tick
+    zoomDelay: 45, // how many ms between zoom ticks
+    minZoom: 0.1, // min zoom level
+    maxZoom: 10, // max zoom level
+    fitPadding: 50, // padding when fitting
+    panSpeed: 10, // how many ms in between pan ticks
+    panDistance: 10, // max pan distance per tick
+    panDragAreaSize: 75, // the length of the pan drag box in which the vector for panning is calculated (bigger = finer control of pan speed and direction)
+    panMinPercentSpeed: 0.25, // the slowest speed we can pan by (as a percent of panSpeed)
+    panInactiveArea: 8, // radius of inactive area in pan drag box
+    panIndicatorMinOpacity: 0.5, // min opacity of pan indicator (the draggable nib); scales from this to 1.0
+    zoomOnly: false, // a minimal version of the ui only with zooming (useful on systems with bad mousewheel resolution)
+    fitSelector: undefined, // selector of elements to fit
+    animateOnFit: function(){ // whether to animate on fit
+      return false;
+    },
+    fitAnimationDuration: 1000, // duration of animation on fit
+
+    // icon class names
+    sliderHandleIcon: 'fa fa-minus',
+    zoomInIcon: 'fa fa-plus',
+    zoomOutIcon: 'fa fa-minus',
+    resetIcon: 'fa fa-expand'
+  };
+
+  var panzoom = function( params, cytoscape, $ ){
+    var cyRef = this;
+    var options = $.extend(true, {}, defaults, params);
+    var fn = params;
+
+    var functions = {
+      destroy: function(){
+        var $this = $(cyRef.container());
+        var $pz = $this.find(".cy-panzoom");
+
+        $pz.data('winbdgs').forEach(function( l ){
+          $(window).unbind( l.evt, l.fn );
+        });
+
+        $pz.data('cybdgs').forEach(function( l ){
+          cyRef.off( l.evt, l.fn );
+        });
+
+        $pz.remove();
+      },
+
+      init: function(){
+        var browserIsMobile = 'ontouchstart' in window;
+
+        return $(cyRef.container()).each(function(){
+          var $container = $(this);
+          $container.cytoscape = cytoscape;
+
+          var winbdgs = [];
+          var $win = $(window);
+
+          var windowBind = function( evt, fn ){
+            winbdgs.push({ evt: evt, fn: fn });
+
+            $win.bind( evt, fn );
+          };
+
+          var windowUnbind = function( evt, fn ){
+            for( var i = 0; i < winbdgs.length; i++ ){
+              var l = winbdgs[i];
+
+              if( l.evt === evt && l.fn === fn ){
+                winbdgs.splice( i, 1 );
+                break;
+              }
+            }
+
+            $win.unbind( evt, fn );
+          };
+
+          var cybdgs = [];
+
+          var cyOn = function( evt, fn ){
+            cybdgs.push({ evt: evt, fn: fn });
+
+            cyRef.on( evt, fn );
+          };
+
+          var cyOff = function( evt, fn ){
+            for( var i = 0; i < cybdgs.length; i++ ){
+              var l = cybdgs[i];
+
+              if( l.evt === evt && l.fn === fn ){
+                cybdgs.splice( i, 1 );
+                break;
+              }
+            }
+
+            cyRef.off( evt, fn );
+          };
+
+          var $panzoom = $('<div class="cy-panzoom"></div>');
+          $container.prepend( $panzoom );
+
+          $panzoom.css('position', 'absolute'); // must be absolute regardless of stylesheet
+
+          $panzoom.data('winbdgs', winbdgs);
+          $panzoom.data('cybdgs', cybdgs);
+
+          if( options.zoomOnly ){
+            $panzoom.addClass("cy-panzoom-zoom-only");
+          }
+
+          // add base html elements
+          /////////////////////////
+
+          var $zoomIn = $('<div class="cy-panzoom-zoom-in cy-panzoom-zoom-button"><span class="icon '+ options.zoomInIcon +'"></span></div>');
+          $panzoom.append( $zoomIn );
+
+          var $zoomOut = $('<div class="cy-panzoom-zoom-out cy-panzoom-zoom-button"><span class="icon ' + options.zoomOutIcon + '"></span></div>');
+          $panzoom.append( $zoomOut );
+
+          var $reset = $('<div class="cy-panzoom-reset cy-panzoom-zoom-button"><span class="icon ' + options.resetIcon + '"></span></div>');
+          $panzoom.append( $reset );
+
+          var $slider = $('<div class="cy-panzoom-slider"></div>');
+          $panzoom.append( $slider );
+
+          $slider.append('<div class="cy-panzoom-slider-background"></div>');
+
+          var $sliderHandle = $('<div class="cy-panzoom-slider-handle"><span class="icon ' + options.sliderHandleIcon + '"></span></div>');
+          $slider.append( $sliderHandle );
+
+          var $noZoomTick = $('<div class="cy-panzoom-no-zoom-tick"></div>');
+          $slider.append( $noZoomTick );
+
+          var $panner = $('<div class="cy-panzoom-panner"></div>');
+          $panzoom.append( $panner );
+
+          var $pHandle = $('<div class="cy-panzoom-panner-handle"></div>');
+          $panner.append( $pHandle );
+
+          var $pUp = $('<div class="cy-panzoom-pan-up cy-panzoom-pan-button"></div>');
+          var $pDown = $('<div class="cy-panzoom-pan-down cy-panzoom-pan-button"></div>');
+          var $pLeft = $('<div class="cy-panzoom-pan-left cy-panzoom-pan-button"></div>');
+          var $pRight = $('<div class="cy-panzoom-pan-right cy-panzoom-pan-button"></div>');
+          $panner.append( $pUp ).append( $pDown ).append( $pLeft ).append( $pRight );
+
+          var $pIndicator = $('<div class="cy-panzoom-pan-indicator"></div>');
+          $panner.append( $pIndicator );
+
+          // functions for calculating panning
+          ////////////////////////////////////
+
+          function handle2pan(e){
+            var v = {
+              x: e.originalEvent.pageX - $panner.offset().left - $panner.width()/2,
+              y: e.originalEvent.pageY - $panner.offset().top - $panner.height()/2
+            }
+
+            var r = options.panDragAreaSize;
+            var d = Math.sqrt( v.x*v.x + v.y*v.y );
+            var percent = Math.min( d/r, 1 );
+
+            if( d < options.panInactiveArea ){
+              return {
+                x: NaN,
+                y: NaN
+              };
+            }
+
+            v = {
+              x: v.x/d,
+              y: v.y/d
+            };
+
+            percent = Math.max( options.panMinPercentSpeed, percent );
+
+            var vnorm = {
+              x: -1 * v.x * (percent * options.panDistance),
+              y: -1 * v.y * (percent * options.panDistance)
+            };
+
+            return vnorm;
+          }
+
+          function donePanning(){
+            clearInterval(panInterval);
+            windowUnbind("mousemove", handler);
+
+            $pIndicator.hide();
+          }
+
+          function positionIndicator(pan){
+            var v = pan;
+            var d = Math.sqrt( v.x*v.x + v.y*v.y );
+            var vnorm = {
+              x: -1 * v.x/d,
+              y: -1 * v.y/d
+            };
+
+            var w = $panner.width();
+            var h = $panner.height();
+            var percent = d/options.panDistance;
+            var opacity = Math.max( options.panIndicatorMinOpacity, percent );
+            var color = 255 - Math.round( opacity * 255 );
+
+            $pIndicator.show().css({
+              left: w/2 * vnorm.x + w/2,
+              top: h/2 * vnorm.y + h/2,
+              background: "rgb(" + color + ", " + color + ", " + color + ")"
+            });
+          }
+
+          function calculateZoomCenterPoint(){
+            var pan = cyRef.pan();
+            var zoom = cyRef.zoom();
+
+            zx = $container.width()/2;
+            zy = $container.height()/2;
+          }
+
+          var zooming = false;
+          function startZooming(){
+            zooming = true;
+
+            calculateZoomCenterPoint();
+          }
+
+
+          function endZooming(){
+            zooming = false;
+          }
+
+          var zx, zy;
+          function zoomTo(level){
+            if( !zooming ){ // for non-continuous zooming (e.g. click slider at pt)
+              calculateZoomCenterPoint();
+            }
+
+            cyRef.zoom({
+              level: level,
+              renderedPosition: { x: zx, y: zy }
+            });
+          }
+
+          var panInterval;
+
+          var handler = function(e){
+            e.stopPropagation(); // don't trigger dragging of panzoom
+            e.preventDefault(); // don't cause text selection
+            clearInterval(panInterval);
+
+            var pan = handle2pan(e);
+
+            if( isNaN(pan.x) || isNaN(pan.y) ){
+              $pIndicator.hide();
+              return;
+            }
+
+            positionIndicator(pan);
+            panInterval = setInterval(function(){
+              cyRef.panBy(pan);
+            }, options.panSpeed);
+          };
+
+          $pHandle.bind("mousedown", function(e){
+            // handle click of icon
+            handler(e);
+
+            // update on mousemove
+            windowBind("mousemove", handler);
+          });
+
+          $pHandle.bind("mouseup", function(){
+            donePanning();
+          });
+
+          windowBind("mouseup blur", function(){
+            donePanning();
+          });
+
+
+
+          // set up slider behaviour
+          //////////////////////////
+
+          $slider.bind('mousedown', function(){
+            return false; // so we don't pan close to the slider handle
+          });
+
+          var sliderVal;
+          var sliding = false;
+          var sliderPadding = 2;
+
+          function setSliderFromMouse(evt, handleOffset){
+            if( handleOffset === undefined ){
+              handleOffset = 0;
+            }
+
+            var padding = sliderPadding;
+            var min = 0 + padding;
+            var max = $slider.height() - $sliderHandle.height() - 2*padding;
+            var top = evt.pageY - $slider.offset().top - handleOffset;
+
+            // constrain to slider bounds
+            if( top < min ){ top = min }
+            if( top > max ){ top = max }
+
+            var percent = 1 - (top - min) / ( max - min );
+
+            // move the handle
+            $sliderHandle.css('top', top);
+
+            var zmin = options.minZoom;
+            var zmax = options.maxZoom;
+
+            // assume (zoom = zmax ^ p) where p ranges on (x, 1) with x negative
+            var x = Math.log(zmin) / Math.log(zmax);
+            var p = (1 - x)*percent + x;
+
+            // change the zoom level
+            var z = Math.pow( zmax, p );
+
+            // bound the zoom value in case of floating pt rounding error
+            if( z < zmin ){
+              z = zmin;
+            } else if( z > zmax ){
+              z = zmax;
+            }
+
+            zoomTo( z );
+          }
+
+          var sliderMdownHandler, sliderMmoveHandler;
+          $sliderHandle.bind('mousedown', sliderMdownHandler = function( mdEvt ){
+            var handleOffset = mdEvt.target === $sliderHandle[0] ? mdEvt.offsetY : 0;
+            sliding = true;
+
+            startZooming();
+            $sliderHandle.addClass("active");
+
+            var lastMove = 0;
+            windowBind('mousemove', sliderMmoveHandler = function( mmEvt ){
+              var now = +new Date;
+
+              // throttle the zooms every 10 ms so we don't call zoom too often and cause lag
+              if( now > lastMove + 10 ){
+                lastMove = now;
+              } else {
+                return false;
+              }
+
+              setSliderFromMouse(mmEvt, handleOffset);
+
+              return false;
+            });
+
+            // unbind when
+            windowBind('mouseup', function(){
+              windowUnbind('mousemove', sliderMmoveHandler);
+              sliding = false;
+
+              $sliderHandle.removeClass("active");
+              endZooming();
+            });
+
+            return false;
+          });
+
+          $slider.bind('mousedown', function(e){
+            if( e.target !== $sliderHandle[0] ){
+              sliderMdownHandler(e);
+              setSliderFromMouse(e);
+            }
+          });
+
+          function positionSliderFromZoom(){
+            var z = cyRef.zoom();
+            var zmin = options.minZoom;
+            var zmax = options.maxZoom;
+
+            // assume (zoom = zmax ^ p) where p ranges on (x, 1) with x negative
+            var x = Math.log(zmin) / Math.log(zmax);
+            var p = Math.log(z) / Math.log(zmax);
+            var percent = 1 - (p - x) / (1 - x); // the 1- bit at the front b/c up is in the -ve y direction
+
+            var min = sliderPadding;
+            var max = $slider.height() - $sliderHandle.height() - 2*sliderPadding;
+            var top = percent * ( max - min );
+
+            // constrain to slider bounds
+            if( top < min ){ top = min }
+            if( top > max ){ top = max }
+
+            // move the handle
+            $sliderHandle.css('top', top);
+          }
+
+          positionSliderFromZoom();
+
+          cyOn('zoom', function(){
+            if( !sliding ){
+              positionSliderFromZoom();
+            }
+          });
+
+          // set the position of the zoom=1 tick
+          (function(){
+            var z = 1;
+            var zmin = options.minZoom;
+            var zmax = options.maxZoom;
+
+            // assume (zoom = zmax ^ p) where p ranges on (x, 1) with x negative
+            var x = Math.log(zmin) / Math.log(zmax);
+            var p = Math.log(z) / Math.log(zmax);
+            var percent = 1 - (p - x) / (1 - x); // the 1- bit at the front b/c up is in the -ve y direction
+
+            if( percent > 1 || percent < 0 ){
+              $noZoomTick.hide();
+              return;
+            }
+
+            var min = sliderPadding;
+            var max = $slider.height() - $sliderHandle.height() - 2*sliderPadding;
+            var top = percent * ( max - min );
+
+            // constrain to slider bounds
+            if( top < min ){ top = min }
+            if( top > max ){ top = max }
+
+            $noZoomTick.css('top', top);
+          })();
+
+          // set up zoom in/out buttons
+          /////////////////////////////
+
+          function bindButton($button, factor){
+            var zoomInterval;
+
+            $button.bind("mousedown", function(e){
+              e.preventDefault();
+              e.stopPropagation();
+
+              if( e.button != 0 ){
+                return;
+              }
+
+              var doZoom = function(){
+                var zoom = cyRef.zoom();
+                var lvl = cyRef.zoom() * factor;
+
+                if( lvl < options.minZoom ){
+                  lvl = options.minZoom;
+                }
+
+                if( lvl > options.maxZoom ){
+                  lvl = options.maxZoom;
+                }
+
+                if( (lvl == options.maxZoom && zoom == options.maxZoom) ||
+                  (lvl == options.minZoom && zoom == options.minZoom)
+                ){
+                  return;
+                }
+
+                zoomTo(lvl);
+              };
+
+              startZooming();
+              doZoom();
+              zoomInterval = setInterval(doZoom, options.zoomDelay);
+
+              return false;
+            });
+
+            windowBind("mouseup blur", function(){
+              clearInterval(zoomInterval);
+              endZooming();
+            });
+          }
+
+          bindButton( $zoomIn, (1 + options.zoomFactor) );
+          bindButton( $zoomOut, (1 - options.zoomFactor) );
+
+          $reset.bind("mousedown", function(e){
+            if( e.button != 0 ){
+              return;
+            }
+
+            var elesToFit = options.fitSelector?cyRef.elements(options.fitSelector):cyRef.elements();
+
+            if( elesToFit.size() === 0 ){
+              cyRef.reset();
+            } else {
+              var animateOnFit = typeof options.animateOnFit === 'function' ? options.animateOnFit.call() : options.animateOnFit;
+              if(animateOnFit){
+                cyRef.animate({
+                  fit: {
+                    eles: elesToFit,
+                    padding: options.fitPadding
+                  }
+                }, {
+                  duration: options.fitAnimationDuration
+                });
+              }
+              else{
+                cyRef.fit( elesToFit, options.fitPadding );
+              }
+
+            }
+
+            return false;
+          });
+
+
+
+        });
+      }
+    };
+
+    if( functions[fn] ){
+      return functions[fn].apply(this, Array.prototype.slice.call( arguments, 1 ));
+    } else if( typeof fn == 'object' || !fn ) {
+      return functions.init.apply( this, arguments );
+    } else {
+      $.error("No such function `"+ fn +"` for jquery.cytoscapePanzoom");
+    }
+
+    return $(this);
+  };
+
+
+  if( typeof module !== 'undefined' && module.exports ){ // expose as a commonjs module
+    module.exports = function( cytoscape, jquery ){
+      register( cytoscape, jquery || require('jquery') );
+    }
+  } else if( typeof define !== 'undefined' && define.amd ){ // expose as an amd/requirejs module
+    define('cytoscape-panzoom', function(){
+      return register;
+    });
+  }
+
+  if( typeof cytoscape !== 'undefined' && typeof jQuery !== 'undefined' ){ // expose to global cytoscape (i.e. window.cytoscape)
+    register( cytoscape, jQuery );
+  }
+
+})();
diff --git a/sourcecodes/scripts/cytoscape.js-panzoom.css b/sourcecodes/scripts/cytoscape.js-panzoom.css
new file mode 100644
index 00000000..dfa9c592
--- /dev/null
+++ b/sourcecodes/scripts/cytoscape.js-panzoom.css
@@ -0,0 +1,220 @@
+.cy-panzoom {
+    position: absolute;
+    font-size: 12px;
+    color: #fff;
+    font-family: arial, helvetica, sans-serif;
+    line-height: 1;
+    color: #666;
+    font-size: 11px;
+    z-index: 99999;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-zoom-button {
+    cursor: pointer;
+    padding: 3px;
+    text-align: center;
+    position: absolute;
+    border-radius: 3px;
+    width: 10px;
+    height: 10px;
+    left: 16px;
+    background: #fff;
+    border: 1px solid #999;
+    margin-left: -1px;
+    margin-top: -1px;
+    z-index: 1;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-zoom-button:active,
+.cy-panzoom-slider-handle:active,
+.cy-panzoom-slider-handle.active {
+    background: #ddd;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-pan-button {
+    position: absolute;
+    z-index: 1;
+    height: 16px;
+    width: 16px;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-reset {
+    top: 55px;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-zoom-in {
+    top: 80px;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-zoom-out {
+    top: 197px;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-pan-up {
+    top: 0;
+    left: 50%;
+    margin-left: -5px;
+    width: 0;
+    height: 0;
+    border-left: 5px solid transparent;
+    border-right: 5px solid transparent;
+    border-bottom: 5px solid #666;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-pan-down {
+    bottom: 0;
+    left: 50%;
+    margin-left: -5px;
+    width: 0;
+    height: 0;
+    border-left: 5px solid transparent;
+    border-right: 5px solid transparent;
+    border-top: 5px solid #666;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-pan-left {
+    top: 50%;
+    left: 0;
+    margin-top: -5px;
+    width: 0;
+    height: 0;
+    border-top: 5px solid transparent;
+    border-bottom: 5px solid transparent;
+    border-right: 5px solid #666;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-pan-right {
+    top: 50%;
+    right: 0;
+    margin-top: -5px;
+    width: 0;
+    height: 0;
+    border-top: 5px solid transparent;
+    border-bottom: 5px solid transparent;
+    border-left: 5px solid #666;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-pan-indicator {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 8px;
+    height: 8px;
+    border-radius: 8px;
+    background: #000;
+    border-radius: 8px;
+    margin-left: -5px;
+    margin-top: -5px;
+    display: none;
+    z-index: 999;
+    opacity: 0.6;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-slider {
+    position: absolute;
+    top: 97px;
+    left: 17px;
+    height: 100px;
+    width: 15px;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-slider-background {
+    position: absolute;
+    top: 0;
+    width: 2px;
+    height: 100px;
+    left: 5px;
+    background: #fff;
+    border-left: 1px solid #999;
+    border-right: 1px solid #999;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-slider-handle {
+    position: absolute;
+    width: 16px;
+    height: 8px;
+    background: #fff;
+    border: 1px solid #999;
+    border-radius: 2px;
+    margin-left: -2px;
+    z-index: 999;
+    line-height: 8px;
+    cursor: default;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-slider-handle .icon {
+    margin: 0 4px;
+    line-height: 10px;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-no-zoom-tick {
+    position: absolute;
+    background: #666;
+    border: 1px solid #fff;
+    border-radius: 2px;
+    margin-left: -1px;
+    width: 8px;
+    height: 2px;
+    left: 3px;
+    z-index: 1;
+    margin-top: 3px;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-panner {
+    position: absolute;
+    left: 5px;
+    top: 5px;
+    height: 40px;
+    width: 40px;
+    background: #fff;
+    border: 1px solid #999;
+    border-radius: 40px;
+    margin-left: -1px;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-panner-handle {
+    position: absolute;
+    left: 0;
+    top: 0;
+    outline: none;
+    height: 40px;
+    width: 40px;
+    position: absolute;
+    z-index: 999;
+    box-sizing: content-box;
+}
+
+.cy-panzoom-zoom-only .cy-panzoom-slider,
+.cy-panzoom-zoom-only .cy-panzoom-panner {
+    display: none;
+}
+
+.cy-panzoom-zoom-only .cy-panzoom-reset {
+    top: 20px;
+}
+
+.cy-panzoom-zoom-only .cy-panzoom-zoom-in {
+    top: 45px;
+}
+
+.cy-panzoom-zoom-only .cy-panzoom-zoom-out {
+    top: 70px;
+}
diff --git a/sourcecodes/scripts/cytoscape.min.js b/sourcecodes/scripts/cytoscape.min.js
new file mode 100644
index 00000000..ce78add6
--- /dev/null
+++ b/sourcecodes/scripts/cytoscape.min.js
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2016-2019, The Cytoscape Consortium.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the “Software”), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).cytoscape=t()}(this,function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var a="undefined"==typeof window?null:window,o=a?a.navigator:null,s=(a&&a.document,e("")),l=e({}),u=e(function(){}),c="undefined"==typeof HTMLElement?"undefined":e(HTMLElement),h=function(e){return e&&e.instanceString&&p(e.instanceString)?e.instanceString():null},d=function(t){return null!=t&&e(t)==s},p=function(t){return null!=t&&e(t)===u},f=function(e){return Array.isArray?Array.isArray(e):null!=e&&e instanceof Array},g=function(t){return null!=t&&e(t)===l&&!f(t)&&t.constructor===Object},v=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},y=function(e){return"undefined"===c?void 0:null!=e&&e instanceof HTMLElement},m=function(e){return b(e)||x(e)},b=function(e){return"collection"===h(e)&&e._private.single},x=function(e){return"collection"===h(e)&&!e._private.single},w=function(e){return"core"===h(e)},E=function(e){return"stylesheet"===h(e)},k=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},C=function(t){return function(t){return null!=t&&e(t)===l}(t)&&p(t.then)},S=function(){return o&&o.userAgent.match(/msie|trident|edge/i)},D=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function n(){var r,i=arguments,a=t.apply(this,i),o=n.cache;return(r=o[a])||(r=o[a]=e.apply(this,i)),r};return n.cache={},n},P=D(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),T=D(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),M=D(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),B=function(e){return k(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},_="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",N=function(e,t){return e<t?-1:e>t?1:0},I=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},z=function(e){return(f(e)?e:null)||function(e){return L[e.toLowerCase()]}(e)||function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r;return 4===e.length?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),r=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16)),[t,n,r]}}(e)||function(e){var t,n=new RegExp("^rgb[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var h=i<.5?i*(1+r):i+r-i*r,d=2*i-h;o=Math.round(255*u(d,h,n+1/3)),s=Math.round(255*u(d,h,n)),l=Math.round(255*u(d,h,n-1/3))}t=[o,s,l,a]}return t}(e)},L={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},A=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(g(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},O=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(g(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))return t}return t},R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var F="Expected a function",V=NaN,q="[object Symbol]",j=/^\s+|\s+$/g,Y=/^[-+]0x[0-9a-f]+$/i,X=/^0b[01]+$/i,W=/^0o[0-7]+$/i,H=parseInt,K="object"==typeof R&&R&&R.Object===Object&&R,G="object"==typeof self&&self&&self.Object===Object&&self,Z=K||G||Function("return this")(),U=Object.prototype.toString,$=Math.max,Q=Math.min,J=function(){return Z.Date.now()};function ee(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function te(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&U.call(e)==q}(e))return V;if(ee(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ee(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(j,"");var n=X.test(e);return n||W.test(e)?H(e.slice(2),n?2:8):Y.test(e)?V:+e}var ne=function(e,t,n){var r,i,a,o,s,l,u=0,c=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(F);function p(t){var n=r,a=i;return r=i=void 0,u=t,o=e.apply(a,n)}function f(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-u>=a}function g(){var e=J();if(f(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return h?Q(n,a-(e-u)):n}(e))}function v(e){return s=void 0,d&&r?p(e):(r=i=void 0,o)}function y(){var e=J(),n=f(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(g,t),c?p(e):o}(l);if(h)return s=setTimeout(g,t),p(l)}return void 0===s&&(s=setTimeout(g,t)),o}return t=te(t)||0,ee(n)&&(c=!!n.leading,a=(h="maxWait"in n)?$(te(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},y.flush=function(){return void 0===s?o:v(J())},y},re=a?a.performance:null,ie=re&&re.now?function(){return re.now()}:function(){return Date.now()},ae=function(){if(a){if(a.requestAnimationFrame)return function(e){a.requestAnimationFrame(e)};if(a.mozRequestAnimationFrame)return function(e){a.mozRequestAnimationFrame(e)};if(a.webkitRequestAnimationFrame)return function(e){a.webkitRequestAnimationFrame(e)};if(a.msRequestAnimationFrame)return function(e){a.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(ie())},1e3/60)}}(),oe=function(e){return ae(e)},se=ie,le=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;!(t=e.next()).done;)n=33*n^t.value;return n>>>0},ue=function(e){return(33*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381)^e)>>>0},ce=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return le({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},he=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return le({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},de=function(){return pe(arguments)},pe=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?he(r):he(r,t)}return t},fe=!0,ge=null!=console.warn,ve=null!=console.trace,ye=Number.MAX_SAFE_INTEGER||9007199254740991,me=function(){return!0},be=function(){return!1},xe=function(){return 0},we=function(){},Ee=function(e){throw new Error(e)},ke=function(e){if(void 0===e)return fe;fe=!!e},Ce=function(e){ke()&&(ge?console.warn(e):(console.log(e),ve&&console.trace()))},Se=function(e){return null==e?e:f(e)?e.slice():g(e)?function(e){return I({},e)}(e):e},De=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},Pe={},Te=function(){return Pe},Me=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},Be=function(e,t,n){for(var r=e.length;r>=0&&(e[r]!==t||(e.splice(r,1),n));r--);},_e=function(e){e.splice(0,e.length)},Ne=function(e,t,n){return n&&(t=M(n,t)),e[t]},Ie=function(e,t,n,r){n&&(t=M(n,t)),e[t]=r},ze="undefined"!=typeof Map?Map:function(){function e(){t(this,e),this._obj={}}return r(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Le=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var i=0;i<r.length;i++)this.add(r[i])}}return r(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),e}(),Ae="undefined"!==("undefined"==typeof Set?"undefined":e(Set))?Set:Le,Oe=function(e,t,n){if(n=!(void 0!==n&&!n),void 0!==e&&void 0!==t&&w(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Ae,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];f(t.classes)?l=t.classes:d(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var h=l[u];h&&""!==h&&i.classes.add(h)}this.createEmitter();var p=t.style||t.css;p&&(Ce("Setting a `style` bypass at element creation is deprecated"),this.style(p)),(void 0===n||n)&&this.restore()}else Ee("An element must be of type `nodes` or `edges`; you specified `"+r+"`")}else Ee("An element must have a core reference and parameters set")},Re=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;g(t)&&!m(t)&&(t=(i=t).roots||i.root,n=i.visit,r=i.directed),r=2!==arguments.length||p(n)?r:n,n=p(n)?n:function(){};for(var a,o=this._private.cy,s=t=d(t)?this.filter(t):t,l=[],u=[],c={},h={},f={},v=0,y=this.byGroup(),b=y.nodes,x=y.edges,w=0;w<s.length;w++){var E=s[w],k=E.id();E.isNode()&&(l.unshift(E),e.bfs&&(f[k]=!0,u.push(E)),h[k]=0)}var C=function(){var t=e.bfs?l.shift():l.pop(),i=t.id();if(e.dfs){if(f[i])return"continue";f[i]=!0,u.push(t)}var o,s=h[i],d=c[i],p=null!=d?d.source():null,g=null!=d?d.target():null,y=null==d?void 0:t.same(p)?g[0]:p[0];if(!0===(o=n(t,d,y,v++,s)))return a=t,"break";if(!1===o)return"break";for(var m=t.connectedEdges().filter(function(e){return(!r||e.source().same(t))&&x.has(e)}),w=0;w<m.length;w++){var E=m[w],k=E.connectedNodes().filter(function(e){return!e.same(t)&&b.has(e)}),C=k.id();0===k.length||f[C]||(k=k[0],l.push(k),e.bfs&&(f[C]=!0,u.push(k)),c[C]=E,h[C]=h[i]+1)}};e:for(;0!==l.length;){switch(C()){case"continue":continue;case"break":break e}}for(var S=o.collection(),D=0;D<u.length;D++){var P=u[D],T=c[P.id()];null!=T&&S.merge(T),S.merge(P)}return{path:o.collection(S),found:o.collection(a)}}},Fe={breadthFirstSearch:Re({bfs:!0}),depthFirstSearch:Re({dfs:!0})};Fe.bfs=Fe.breadthFirstSearch,Fe.dfs=Fe.depthFirstSearch;var Ve=function(e,t){return e(t={exports:{}},t.exports),t.exports}(function(e,t){(function(){var t,n,r,i,a,o,s,l,u,c,h,d,p,f,g;r=Math.floor,c=Math.min,n=function(e,t){return e<t?-1:e>t?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);i<a;)o(t,e[s=r((i+a)/2)])<0?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return null==r&&(r=n),e.push(t),f(e,0,e.length-1,r)},a=function(e,t){var r,i;return null==t&&(t=n),r=e.pop(),e.length?(i=e[0],e[0]=r,g(e,0,t)):i=r,i},l=function(e,t,r){var i;return null==r&&(r=n),i=e[0],e[0]=t,g(e,0,r),i},s=function(e,t,r){var i;return null==r&&(r=n),e.length&&r(e[0],t)<0&&(t=(i=[e[0],t])[0],e[0]=i[1],g(e,0,r)),t},i=function(e,t){var i,a,o,s,l,u;for(null==t&&(t=n),l=[],a=0,o=(s=function(){u=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;a<o;a++)i=s[a],l.push(g(e,i,t));return l},p=function(e,t,r){var i;if(null==r&&(r=n),-1!==(i=e.indexOf(t)))return f(e,0,i,r),g(e,i,r)},h=function(e,t,r){var a,o,l,u,c;if(null==r&&(r=n),!(o=e.slice(0,t)).length)return o;for(i(o,r),l=0,u=(c=e.slice(t)).length;l<u;l++)a=c[l],s(o,a,r);return o.sort(r).reverse()},d=function(e,t,r){var o,s,l,h,d,p,f,g,v;if(null==r&&(r=n),10*t<=e.length){if(!(l=e.slice(0,t).sort(r)).length)return l;for(s=l[l.length-1],h=0,p=(f=e.slice(t)).length;h<p;h++)r(o=f[h],s)<0&&(u(l,o,0,null,r),l.pop(),s=l[l.length-1]);return l}for(i(e,r),v=[],d=0,g=c(t,e.length);0<=g?d<g:d>g;0<=g?++d:--d)v.push(a(e,r));return v},f=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},g=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i<a;)(s=i+1)<a&&!(r(e[i],e[s])<0)&&(i=s),e[t]=e[i],i=2*(t=i)+1;return e[t]=o,f(e,l,t,r)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=o,e.pop=a,e.replace=l,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=h,e.nsmallest=d,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),e.exports=t}).call(R)}),qe=Me({root:null,weight:function(e){return 1},directed:!1}),je={dijkstra:function(e){if(!g(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=qe(e),r=n.root,i=n.weight,a=n.directed,o=this,s=i,l=d(r)?this.filter(r)[0]:r[0],u={},c={},h={},p=this.byGroup(),f=p.nodes,v=p.edges;v.unmergeBy(function(e){return e.isLoop()});for(var y=function(e){return u[e.id()]},m=function(e,t){u[e.id()]=t,b.updateItem(e)},b=new Ve(function(e,t){return y(e)-y(t)}),x=0;x<f.length;x++){var w=f[x];u[w.id()]=w.same(l)?0:1/0,b.push(w)}for(var E=function(e,t){for(var n,r=(a?e.edgesTo(t):e.edgesWith(t)).intersect(v),i=1/0,o=0;o<r.length;o++){var l=r[o],u=s(l);(u<i||!n)&&(i=u,n=l)}return{edge:n,dist:i}};b.size()>0;){var k=b.pop(),C=y(k),S=k.id();if(h[S]=C,C!==1/0)for(var D=k.neighborhood().intersect(f),P=0;P<D.length;P++){var T=D[P],M=T.id(),B=E(k,T),_=C+B.dist;_<y(T)&&(m(T,_),c[M]={node:k,edge:B.edge})}}return{distanceTo:function(e){var t=d(e)?f.filter(e)[0]:e[0];return h[t.id()]},pathTo:function(e){var t=d(e)?f.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},Ye={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++){if(a[t].has(e))return t}},l=0;l<i;l++)a[l]=this.spawn(n[l]);for(var u=r.sort(function(t,n){return e(t)-e(n)}),c=0;c<u.length;c++){var h=u[c],d=h.source()[0],p=h.target()[0],f=s(d),g=s(p),v=a[f],y=a[g];f!==g&&(o.merge(h),v.merge(y),a.splice(g,1))}return o}},Xe=Me({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),We={aStar:function(e){var t=this.cy(),n=Xe(e),r=n.root,i=n.goal,a=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var l,u,c=r.id(),h=i.id(),d={},p={},f={},g=new Ve(function(e,t){return p[e.id()]-p[t.id()]}),v=new Ae,y={},m={},b=function(e,t){g.push(e),v.add(t)};b(r,c),d[c]=0,p[c]=a(r);for(var x,w=0;g.size()>0;){if(l=g.pop(),u=l.id(),v.delete(u),w++,u===h){for(var E=[],k=i,C=h,S=m[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=y[C]);)S=m[C=k.id()];return{found:!0,distance:d[u],path:this.spawn(E),steps:w}}f[u]=!0;for(var D=l._private.edges,P=0;P<D.length;P++){var T=D[P];if(this.hasElementWithId(T.id())&&(!o||T.data("source")===u)){var M=T.source(),B=T.target(),_=M.id()!==u?M:B,N=_.id();if(this.hasElementWithId(N)&&!f[N]){var I=d[u]+s(T);x=N,v.has(x)?I<d[N]&&(d[N]=I,p[N]=I+a(_),y[N]=l):(d[N]=I,p[N]=I+a(_),b(_,N),y[N]=l,m[N]=T)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},He=Me({weight:function(e){return 1},directed:!1}),Ke={floydWarshall:function(e){for(var t=this.cy(),n=He(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,l=o.edges,u=s.length,c=u*u,h=function(e){return s.indexOf(e)},p=function(e){return s[e]},f=new Array(c),g=0;g<c;g++){var v=g%u,y=(g-v)/u;f[g]=y===v?0:1/0}for(var m=new Array(c),b=new Array(c),x=0;x<l.length;x++){var w=l[x],E=w.source()[0],k=w.target()[0];if(E!==k){var C=h(E),S=h(k),D=C*u+S,P=a(w);if(f[D]>P&&(f[D]=P,m[D]=S,b[D]=w),!i){var T=S*u+C;!i&&f[T]>P&&(f[T]=P,m[T]=C,b[T]=w)}}}for(var M=0;M<u;M++)for(var B=0;B<u;B++)for(var _=B*u+M,N=0;N<u;N++){var I=B*u+N,z=M*u+N;f[_]+f[z]<f[I]&&(f[I]=f[_]+f[z],m[I]=m[_])}var L=function(e){return h(function(e){return(d(e)?t.filter(e):e)[0]}(e))};return{distance:function(e,t){var n=L(e),r=L(t);return f[n*u+r]},path:function(e,n){var r=L(e),i=L(n),a=p(r);if(r===i)return a.collection();if(null==m[r*u+i])return t.collection();var o,s=t.collection(),l=r;for(s.merge(a);r!==i;)l=r,r=m[r*u+i],o=b[l*u+r],s.merge(o),s.merge(p(r));return s}}}},Ge=Me({weight:function(e){return 1},directed:!1,root:null}),Ze={bellmanFord:function(e){var t=this,n=Ge(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,h=u.nodes,p=h.length,f=new ze,g=!1;a=l.collection(a)[0],c.unmergeBy(function(e){return e.isLoop()});for(var v=c.length,y=function(e){var t=f.get(e.id());return t||(t={},f.set(e.id(),t)),t},m=function(e){return(d(e)?l.$(e):e)[0]},b=0;b<p;b++){var x=h[b],w=y(x);x.same(a)?w.dist=0:w.dist=1/0,w.pred=null,w.edge=null}for(var E=!1,k=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,E=!0)},C=1;C<p;C++){E=!1;for(var S=0;S<v;S++){var D=c[S],P=D.source(),T=D.target(),M=o(D),B=y(P),_=y(T);k(P,0,D,B,_,M),i||k(T,0,D,_,B,M)}if(!E)break}if(E)for(var N=0;N<v;N++){var I=c[N],z=I.source(),L=I.target(),A=o(I),O=y(z).dist,R=y(L).dist;if(O+A<R||!i&&R+A<O){Ce("Graph contains a negative weight cycle for Bellman-Ford"),g=!0;break}}return{distanceTo:function(e){return y(m(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=[],i=m(e);;){if(null==i)return t.spawn();var o=y(i),l=o.edge,u=o.pred;if(r.unshift(i[0]),i.same(n)&&r.length>0)break;null!=l&&r.unshift(l),i=u}return s.spawn(r)},hasNegativeWeightCycle:g,negativeWeightCycles:[]}}},Ue=Math.sqrt(2),$e=function(e,t,n){0===n.length&&Ee("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],h=c[1],d=c[2];(t[h]===o&&t[d]===s||t[h]===s&&t[d]===o)&&l.splice(u,1)}for(var p=0;p<l.length;p++){var f=l[p];f[1]===s?(l[p]=f.slice(),l[p][1]=o):f[2]===s&&(l[p]=f.slice(),l[p][2]=o)}for(var g=0;g<t.length;g++)t[g]===s&&(t[g]=o);return l},Qe=function(e,t,n,r){for(;n>r;){var i=Math.floor(Math.random()*t.length);t=$e(i,e,t),n--}return t},Je={kargerStein:function(){var e=this.byGroup(),t=e.nodes,n=e.edges;n.unmergeBy(function(e){return e.isLoop()});var r=t.length,i=n.length,a=Math.ceil(Math.pow(Math.log(r)/Math.LN2,2)),o=Math.floor(r/Ue);if(!(r<2)){for(var s=[],l=0;l<i;l++){var u=n[l];s.push([l,t.indexOf(u.source()),t.indexOf(u.target())])}for(var c=1/0,h=[],d=new Array(r),p=new Array(r),f=new Array(r),g=function(e,t){for(var n=0;n<r;n++)t[n]=e[n]},v=0;v<=a;v++){for(var y=0;y<r;y++)p[y]=y;var m=Qe(p,s.slice(),r,o),b=m.slice();g(p,f);var x=Qe(p,m,o,2),w=Qe(f,b,o,2);x.length<=w.length&&x.length<c?(c=x.length,h=x,g(p,d)):w.length<=x.length&&w.length<c&&(c=w.length,h=w,g(f,d))}for(var E=this.spawn(h.map(function(e){return n[e[0]]})),k=this.spawn(),C=this.spawn(),S=d[0],D=0;D<d.length;D++){var P=d[D],T=t[D];P===S?k.merge(T):C.merge(T)}return{cut:E,partition1:k,partition2:C}}Ee("At least 2 nodes are required for Karger-Stein algorithm")}},et=function(e){return{x:e.x,y:e.y}},tt=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},nt=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},rt=function(e){return{x:e[0],y:e[1]}},it=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},at=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},ot=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},st=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},lt=function(e){return Math.PI*e/180},ut=function(e,t){return Math.atan2(t,e)-Math.PI/2},ct=Math.log2||function(e){return Math.log(e)/Math.log(2)},ht=function(e){return e>0?1:e<0?-1:0},dt=function(e,t){return Math.sqrt(pt(e,t))},pt=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},ft=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},gt=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},vt=function(e,t,n,r){return{x:gt(e.x,t.x,n.x,r),y:gt(e.y,t.y,n.y,r)}},yt=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=dt(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}},mt=function(e,t,n){return Math.max(e,Math.min(n,t))},bt=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},xt=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},wt=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Et=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},kt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Ct=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},St=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},Dt=function(e,t){e.x1+=t.x,e.x2+=t.x,e.y1+=t.y,e.y2+=t.y},Pt=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2<t.x1)&&(!(t.x2<e.x1)&&(!(e.y2<t.y1)&&(!(t.y2<e.y1)&&(!(e.y1>t.y2)&&!(t.y1>e.y2)))))))},Tt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Mt=function(e,t){return Tt(e,t.x,t.y)},Bt=function(e,t){return Tt(e,t.x1,t.y1)&&Tt(e,t.x2,t.y2)},_t=function(e,t,n,r,i,a,o){var s,l=Qt(i,a),u=i/2,c=a/2,h=r-c-o;if((s=Ht(e,t,n,r,n-u+l-o,h,n+u-l+o,h,!1)).length>0)return s;var d=n+u+o;if((s=Ht(e,t,n,r,d,r-c+l-o,d,r+c-l+o,!1)).length>0)return s;var p=r+c+o;if((s=Ht(e,t,n,r,n-u+l-o,p,n+u-l+o,p,!1)).length>0)return s;var f,g=n-u-o;if((s=Ht(e,t,n,r,g,r-c+l-o,g,r+c-l+o,!1)).length>0)return s;var v=n-u+l,y=r-c+l;if((f=Xt(e,t,n,r,v,y,l+o)).length>0&&f[0]<=v&&f[1]<=y)return[f[0],f[1]];var m=n+u-l,b=r-c+l;if((f=Xt(e,t,n,r,m,b,l+o)).length>0&&f[0]>=m&&f[1]<=b)return[f[0],f[1]];var x=n+u-l,w=r+c-l;if((f=Xt(e,t,n,r,x,w,l+o)).length>0&&f[0]>=x&&f[1]>=w)return[f[0],f[1]];var E=n-u+l,k=r+c-l;return(f=Xt(e,t,n,r,E,k,l+o)).length>0&&f[0]<=E&&f[1]>=k?[f[0],f[1]]:[]},Nt=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),h=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=h+s},It=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,h=Math.min(r,s,a)-l,d=Math.max(r,s,a)+l;return!(e<u||e>c||t<h||t>d)},zt=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},Lt=function(e,t,n,r,i){var a,o,s,l,u,c,h,d;return s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,h=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,void(i[5]=-h)):(i[5]=i[3]=0,0===a?(d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*d-h,void(i[4]=i[2]=-(d+h))):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),void(i[4]=-h+d*Math.cos((l+4*Math.PI)/3))))},At=function(e,t,n,r,i,a,o,s){var l=[];Lt(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var h,d,p,f=-1,g=0;g<u.length;g++)h=Math.pow(1-u[g],2)*n+2*(1-u[g])*u[g]*i+u[g]*u[g]*o,d=Math.pow(1-u[g],2)*r+2*(1-u[g])*u[g]*a+u[g]*u[g]*s,p=Math.pow(h-e,2)+Math.pow(d-t,2),f>=0?p<f&&(f=p):f=p;return f},Ot=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],h=c*c/l;return c<0?u:h>l?(e-i)*(e-i)+(t-a)*(t-a):u-h},Rt=function(e,t,n){for(var r,i,a,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],i=n[2*l+1],l+1<n.length/2?(a=n[2*(l+1)],o=n[2*(l+1)+1]):(a=n[2*(l+1-n.length/2)],o=n[2*(l+1-n.length/2)+1]),r==e&&a==e);else{if(!(r>=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},Ft=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h,d=Math.cos(-u),p=Math.sin(-u),f=0;f<c.length/2;f++)c[2*f]=a/2*(n[2*f]*d-n[2*f+1]*p),c[2*f+1]=o/2*(n[2*f+1]*d+n[2*f]*p),c[2*f]+=r,c[2*f+1]+=i;if(l>0){var g=qt(c,-l);h=Vt(g)}else h=c;return Rt(e,t,h)},Vt=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],n=e[4*c+1],r=e[4*c+2],i=e[4*c+3],c<e.length/4-1?(a=e[4*(c+1)],o=e[4*(c+1)+1],s=e[4*(c+1)+2],l=e[4*(c+1)+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var h=Ht(t,n,r,i,a,o,s,l,!0);u[2*c]=h[0],u[2*c+1]=h[1]}return u},qt=function(e,t){for(var n,r,i,a,o=new Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(i=e[2*(s+1)],a=e[2*(s+1)+1]):(i=e[0],a=e[1]);var l=a-r,u=-(i-n),c=Math.sqrt(l*l+u*u),h=l/c,d=u/c;o[4*s]=n+h*t,o[4*s+1]=r+d*t,o[4*s+2]=i+h*t,o[4*s+3]=a+d*t}return o},jt=function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var l=Math.sqrt(o*o+s*s),u=l-1;if(u<0)return[];var c=u/l;return[(n-e)*c+e,(r-t)*c+t]},Yt=function(e,t,n,r,i,a,o){return e-=i,t-=a,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},Xt=function(e,t,n,r,i,a,o){var s=[n-e,r-t],l=[e-i,t-a],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),h=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(h<0)return[];var d=(-c+Math.sqrt(h))/(2*u),p=(-c-Math.sqrt(h))/(2*u),f=Math.min(d,p),g=Math.max(d,p),v=[];if(f>=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},Wt=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Ht=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,p=r-t,f=s-a,g=h*d-f*u,v=c*d-p*u,y=f*c-h*p;if(0!==y){var m=g/y,b=v/y;return-.001<=m&&m<=1.001&&-.001<=b&&b<=1.001?[e+m*c,t+m*p]:l?[e+m*c,t+m*p]:[]}return 0===g||0===v?Wt(e,n,o)===o?[o,s]:Wt(e,n,i)===i?[i,a]:Wt(i,o,n)===n?[n,r]:[]:[]},Kt=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,p,f=[],g=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y<g.length/2;y++)g[2*y]=n[2*y]*a+r,g[2*y+1]=n[2*y+1]*o+i;if(s>0){var m=qt(g,-s);u=Vt(m)}else u=g}else u=n;for(var b=0;b<u.length/2;b++)c=u[2*b],h=u[2*b+1],b<u.length/2-1?(d=u[2*(b+1)],p=u[2*(b+1)+1]):(d=u[0],p=u[1]),0!==(l=Ht(e,t,r,i,c,h,d,p)).length&&f.push(l[0],l[1]);return f},Gt=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},Zt=function(e,t){var n=$t(e,t);return n=Ut(n)},Ut=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var u=2/(o-i),c=2/(s-a),h=0;h<r;h++)t=e[2*h]=e[2*h]*u,n=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var d=0;d<r;d++)n=e[2*d+1]=e[2*d+1]+(-1-a);return e},$t=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i,a=new Array(2*e),o=0;o<e;o++)i=o*n+r,a[2*o]=Math.cos(i),a[2*o+1]=Math.sin(-i);return a},Qt=function(e,t){return Math.min(e/4,t/4,8)},Jt=function(e,t,n){return[e-2*t+n,2*(t-e),e]},en=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},tn=Me({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),nn={pageRank:function(e){for(var t=tn(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),l=s.nodes,u=s.edges,c=l.length,h=c*c,d=u.length,p=new Array(h),f=new Array(c),g=(1-n)/c,v=0;v<c;v++){for(var y=0;y<c;y++){p[v*c+y]=0}f[v]=0}for(var m=0;m<d;m++){var b=u[m],x=b.data("source"),w=b.data("target");if(x!==w){var E=l.indexOfId(x),k=l.indexOfId(w),C=a(b);p[k*c+E]+=C,f[E]+=C}}for(var S=1/c+g,D=0;D<c;D++)if(0===f[D])for(var P=0;P<c;P++){p[P*c+D]=S}else for(var T=0;T<c;T++){var M=T*c+D;p[M]=p[M]/f[D]+g}for(var B,_=new Array(c),N=new Array(c),I=0;I<c;I++)_[I]=1;for(var z=0;z<i;z++){for(var L=0;L<c;L++)N[L]=0;for(var A=0;A<c;A++)for(var O=0;O<c;O++){var R=A*c+O;N[A]+=p[R]*_[O]}ft(N),B=_,_=N,N=B;for(var F=0,V=0;V<c;V++){var q=B[V]-_[V];F+=q*q}if(F<r)break}return{rank:function(e){return e=o.collection(e)[0],_[l.indexOf(e)]}}}},rn=Me({root:null,weight:function(e){return 1},directed:!1,alpha:0}),an={degreeCentralityNormalized:function(e){e=rn(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<r;l++){var u=n[l],c=u.id();e.root=u;var h=this.degreeCentrality(e);o<h.indegree&&(o=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,a[c]=h.outdegree}return{indegree:function(e){return 0==o?0:(d(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(d(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var p={},f=0,g=0;g<r;g++){var v=n[g];e.root=v;var y=this.degreeCentrality(e);f<y.degree&&(f=y.degree),p[v.id()]=y.degree}return{degree:function(e){return 0===f?0:(d(e)&&(e=t.filter(e)),p[e.id()]/f)}}},degreeCentrality:function(e){e=rn(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),u=l.filter(function(e){return e.target().same(i)&&n.has(e)}),c=l.filter(function(e){return e.source().same(i)&&n.has(e)}),h=u.length,d=c.length,p=0,f=0,g=0;g<u.length;g++)p+=a(u[g]);for(var v=0;v<c.length;v++)f+=a(c[v]);return{indegree:Math.pow(h,1-s)*Math.pow(p,s),outdegree:Math.pow(d,1-s)*Math.pow(f,s)}}for(var y=i.connectedEdges().intersection(n),m=y.length,b=0,x=0;x<y.length;x++)b+=a(y[x]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};an.dc=an.degreeCentrality,an.dcn=an.degreeCentralityNormalised=an.degreeCentralityNormalized;var on=Me({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),sn={closenessCentralityNormalized:function(e){for(var t=on(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:i}),c=0;c<l.length;c++){for(var h=0,p=l[c],f=0;f<l.length;f++)if(c!==f){var g=u.distance(p,l[f]);h+=n?1/g:g}n||(h=1/h),s<h&&(s=h),o[p.id()]=h}return{closeness:function(e){return 0==s?0:(e=d(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=on(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var h=o.distanceTo(c);s+=a?1/h:h}}return a?s:1/s}};sn.cc=sn.closenessCentrality,sn.ccn=sn.closenessCentralityNormalised=sn.closenessCentralityNormalized;var ln=Me({weight:null,directed:!1}),un={betweennessCentrality:function(e){for(var t=ln(e),n=t.directed,r=t.weight,i=null!=r,a=this.cy(),o=this.nodes(),s={},l={},u=0,c=function(e,t){l[e]=t,t>u&&(u=t)},h=function(e){return l[e]},d=0;d<o.length;d++){var p=o[d],f=p.id();s[f]=n?p.outgoers().nodes():p.openNeighborhood().nodes(),c(f,0)}for(var g=function(e){for(var t=o[e].id(),n=[],l={},u={},d={},p=new Ve(function(e,t){return d[e]-d[t]}),f=0;f<o.length;f++){var g=o[f].id();l[g]=[],u[g]=0,d[g]=1/0}for(u[t]=1,d[t]=0,p.push(t);!p.empty();){var v=p.pop();if(n.push(v),i)for(var y=0;y<s[v].length;y++){var m=s[v][y],b=a.getElementById(v),x=void 0;x=b.edgesTo(m).length>0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),d[m]>d[v]+w&&(d[m]=d[v]+w,p.nodes.indexOf(m)<0?p.push(m):p.updateItem(m),u[m]=0,l[m]=[]),d[m]==d[v]+w&&(u[m]=u[m]+u[v],l[m].push(v))}else for(var E=0;E<s[v].length;E++){var k=s[v][E].id();d[k]==1/0&&(p.push(k),d[k]=d[v]+1),d[k]==d[v]+1&&(u[k]=u[k]+u[v],l[k].push(v))}}for(var C={},S=0;S<o.length;S++)C[o[S].id()]=0;for(;n.length>0;)for(var D=n.pop(),P=0;P<l[D].length;P++){var T=l[D][P];C[T]=C[T]+u[T]/u[D]*(1+C[D]),D!=o[e].id()&&c(D,h(D)+C[D])}},v=0;v<o.length;v++)g(v);var y={betweenness:function(e){var t=a.collection(e).id();return h(t)},betweennessNormalized:function(e){if(0==u)return 0;var t=a.collection(e).id();return h(t)/u}};return y.betweennessNormalised=y.betweennessNormalized,y}};un.bc=un.betweennessCentrality;var cn=Me({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),hn=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},dn=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},pn=function(e,t,n){for(var r=new Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},fn=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=pn(e,r,t);return e},gn=function(e,t,n){for(var r=new Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return dn(r,t),r},vn=function(e,t,n,r){for(var i=0;i<n;i++){if(Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r)!==Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r))return!1}return!0},yn=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},mn=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=function(e){return cn(e)}(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=new Array(u),h=0;h<u;h++)c[h]=0;for(var d=0;d<n.length;d++){var p=n[d],f=a[p.source().id()],g=a[p.target().id()],v=hn(p,i.attributes);c[f*l+g]+=v,c[g*l+f]+=v}!function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n}(c,l,i.multFactor),dn(c,l);for(var y=!0,m=0;y&&m<i.maxIterations;)y=!1,s=fn(c,l,i.expandFactor),c=gn(s,l,i.inflateFactor),vn(c,s,u,4)||(y=!0),m++;var b=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r);return b=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&yn(e[t],e[n])&&e.splice(n,1);return e}(b)},bn={markovClustering:mn,mcl:mn},xn=function(e){return e},wn=function(e,t){return Math.abs(t-e)},En=function(e,t,n){return e+wn(t,n)},kn=function(e,t,n){return e+Math.pow(n-t,2)},Cn=function(e){return Math.sqrt(e)},Sn=function(e,t,n){return Math.max(e,wn(t,n))},Dn=function(e,t,n,r,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:xn,o=r,s=0;s<e;s++)o=i(o,t(s),n(s));return a(o)},Pn={euclidean:function(e,t,n){return e>=2?Dn(e,t,n,0,kn,Cn):Dn(e,t,n,0,En)},squaredEuclidean:function(e,t,n){return Dn(e,t,n,0,kn)},manhattan:function(e,t,n){return Dn(e,t,n,0,En)},max:function(e,t,n){return Dn(e,t,n,-1/0,Sn)}};function Tn(e,t,n,r,i,a){var o;return o=p(e)?e:Pn[e]||Pn.euclidean,0===t&&p(e)?o(i,a):o(t,n,r,i,a)}Pn["squared-euclidean"]=Pn.squaredEuclidean,Pn.squaredeuclidean=Pn.squaredEuclidean;var Mn=Me({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Bn=function(e){return Mn(e)},_n=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return Tn(e,r.length,a,function(e){return r[e](t)},o,s)},Nn=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,a[l]=e.max(n[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[u]=s}return o},In=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=_n(n,e,t[s],r,i);l<a&&(a=l,o=s)}return o},zn=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)n[(i=t[a]).id()]===e&&r.push(i);return r},Ln=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++){if(Math.abs(e[r][i]-t[r][i])>n)return!1}return!0},An=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},On=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];An(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},Rn=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=_n("manhattan",t[i],e,n,"kMedoids");return r},Fn=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],i.m);for(var u=0;u<e.length;u++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var h=0;h<t.length;h++)a+=r[h][u]*i.attributes[c](t[h]),o+=r[h][u];e[u][c]=a/o}},Vn=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,l,u=2/(i.m-1),c=0;c<n.length;c++)for(var h=0;h<r.length;h++){o=0;for(var d=0;d<n.length;d++)s=_n(i.distance,r[h],n[c],i.attributes,"cmeans"),l=_n(i.distance,r[h],n[d],i.attributes,"cmeans"),o+=Math.pow(s/l,u);e[h][c]=1/o}},qn=function(e){var t,n,r,i,a=this.cy(),o=this.nodes(),s=Bn(e);r=new Array(o.length);for(var l=0;l<o.length;l++)r[l]=new Array(s.k);n=new Array(o.length);for(var u=0;u<o.length;u++)n[u]=new Array(s.k);for(var c=0;c<o.length;c++){for(var h=0,d=0;d<s.k;d++)n[c][d]=Math.random(),h+=n[c][d];for(var p=0;p<s.k;p++)n[c][p]=n[c][p]/h}t=new Array(s.k);for(var f=0;f<s.k;f++)t[f]=new Array(s.attributes.length);i=new Array(o.length);for(var g=0;g<o.length;g++)i[g]=new Array(s.k);for(var v=!0,y=0;v&&y<s.maxIterations;)v=!1,Fn(t,o,n,i,s),Vn(n,r,t,o,s),Ln(n,r,s.sensitivityThreshold)||(v=!0),y++;return{clusters:function(e,t,n,r){for(var i,a,o=new Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var u=0;u<t[0].length;u++)t[l][u]>i&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c<o.length;c++)o[c]=r.collection(o[c]);return o}(o,n,s,a),degreeOfMembership:n}},jn={kMeans:function(t){var n,r=this.cy(),i=this.nodes(),a=null,o=Bn(t),s=new Array(o.k),l={};o.testMode?"number"==typeof o.testCentroids?(o.testCentroids,n=Nn(i,o.k,o.attributes)):n="object"===e(o.testCentroids)?o.testCentroids:Nn(i,o.k,o.attributes):n=Nn(i,o.k,o.attributes);for(var u,c,h,d=!0,p=0;d&&p<o.maxIterations;){for(var f=0;f<i.length;f++)l[(a=i[f]).id()]=In(a,n,o.distance,o.attributes,"kMeans");d=!1;for(var g=0;g<o.k;g++){var v=zn(g,i,l);if(0!==v.length){for(var y=o.attributes.length,m=n[g],b=new Array(y),x=new Array(y),w=0;w<y;w++){x[w]=0;for(var E=0;E<v.length;E++)a=v[E],x[w]+=o.attributes[w](a);b[w]=x[w]/v.length,u=b[w],c=m[w],h=o.sensitivityThreshold,Math.abs(c-u)<=h||(d=!0)}n[g]=b,s[g]=r.collection(v)}}p++}return s},kMedoids:function(t){var n,r,i=this.cy(),a=this.nodes(),o=null,s=Bn(t),l=new Array(s.k),u={},c=new Array(s.k);s.testMode?"number"==typeof s.testCentroids||(n="object"===e(s.testCentroids)?s.testCentroids:On(a,s.k)):n=On(a,s.k);for(var h=!0,d=0;h&&d<s.maxIterations;){for(var p=0;p<a.length;p++)u[(o=a[p]).id()]=In(o,n,s.distance,s.attributes,"kMedoids");h=!1;for(var f=0;f<n.length;f++){var g=zn(f,a,u);if(0!==g.length){c[f]=Rn(n[f],g,s.attributes);for(var v=0;v<g.length;v++)(r=Rn(g[v],g,s.attributes))<c[f]&&(c[f]=r,n[f]=g[v],h=!0);l[f]=i.collection(g)}}d++}return l},fuzzyCMeans:qn,fcm:qn},Yn=Me({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Xn={single:"min",complete:"max"},Wn=function(e,t,n,r,i){for(var a,o=0,s=1/0,l=i.attributes,u=function(e,t){return Tn(i.distance,l.length,function(t){return l[t](e)},function(e){return l[e](t)},e,t)},c=0;c<e.length;c++){var h=e[c].key,d=n[h][r[h]];d<s&&(o=h,s=d)}if("threshold"===i.mode&&s>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===i.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;v<e.length;v++){var y=e[v];f.key===y.key?a=1/0:"min"===i.linkage?(a=n[f.key][y.key],n[f.key][y.key]>n[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[f.key][y.key],n[f.key][y.key]<n[g.key][y.key]&&(a=n[g.key][y.key])):a="mean"===i.linkage?(n[f.key][y.key]*f.size+n[g.key][y.key]*g.size)/(f.size+g.size):"dendrogram"===i.mode?u(y.value,f.value):u(y.value[0],f.value[0]),n[f.key][y.key]=n[y.key][f.key]=a}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===f.key||r[b]===g.key){for(var x=b,w=0;w<e.length;w++){var E=e[w].key;n[b][E]<n[b][x]&&(x=E)}r[b]=x}e[m].index=m}return f.key=g.key=f.index=g.index=null,!0},Hn=function e(t,n,r){t&&(t.value?n.push(t.value):(t.left&&e(t.left,n,r),t.right&&e(t.right,n,r)))},Kn=function(e){for(var t=this.cy(),n=this.nodes(),r=function(e){var t=Yn(e),n=Xn[t.linkage];return null!=n&&(t.linkage=n),t}(e),i=r.attributes,a=function(e,t){return Tn(r.distance,i.length,function(t){return i[t](e)},function(e){return i[e](t)},e,t)},o=[],s=[],l=[],u=[],c=0;c<n.length;c++){var h={value:"dendrogram"===r.mode?n[c]:[n[c]],key:c,index:c};o[c]=h,u[c]=h,s[c]=[],l[c]=0}for(var d=0;d<o.length;d++)for(var p=0;p<=d;p++){var f=void 0;f="dendrogram"===r.mode?d===p?1/0:a(o[d].value,o[p].value):d===p?1/0:a(o[d].value[0],o[p].value[0]),s[d][p]=f,s[p][d]=f,f<s[d][l[d]]&&(l[d]=p)}for(var g,v=Wn(o,u,s,l,r);v;)v=Wn(o,u,s,l,r);return"dendrogram"===r.mode?(g=function e(t,n,r){if(!t)return[];var i=[],a=[],o=[];return 0===n?(t.left&&Hn(t.left,i,r),t.right&&Hn(t.right,a,r),o=i.concat(a),[r.collection(o)]):1===n?t.value?[r.collection(t.value)]:(t.left&&Hn(t.left,i,r),t.right&&Hn(t.right,a,r),[r.collection(i),r.collection(a)]):t.value?[r.collection(t.value)]:(t.left&&(i=e(t.left,n-1,r)),t.right&&(a=e(t.right,n-1,r)),i.concat(a))}(o[0],r.dendrogramDepth,t),r.addDendrogram&&function e(t,n){if(!t)return"";if(t.left&&t.right){var r=e(t.left,n),i=e(t.right,n),a=n.add({group:"nodes",data:{id:r+","+i}});return n.add({group:"edges",data:{source:r,target:a.id()}}),n.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}return t.value?t.value.id():void 0}(o[0],t)):(g=new Array(o.length),o.forEach(function(e,n){e.key=e.index=null,g[n]=t.collection(e.value)})),g},Gn={hierarchicalClustering:Kn,hca:Kn},Zn=Me({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Un=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-Tn(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},$n=function(e,t){return"median"===t?st(e):"mean"===t?ot(e):"min"===t?it(e):"max"===t?at(e):t},Qn=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},Jn=function(e){for(var t,n,r,i,a,o,s=this.cy(),l=this.nodes(),u=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||Ee("Damping must range on [0.5, 1).  Got: ".concat(t));var r=["median","mean","min","max"];return r.some(function(e){return e===n})||v(n)||Ee("Preference must be one of [".concat(r.map(function(e){return"'".concat(e,"'")}).join(", "),"] or a number.  Got: ").concat(n)),Zn(e)}(e),c={},h=0;h<l.length;h++)c[l[h].id()]=h;n=(t=l.length)*t,r=new Array(n);for(var d=0;d<n;d++)r[d]=-1/0;for(var p=0;p<t;p++)for(var f=0;f<t;f++)p!==f&&(r[p*t+f]=Un(u.distance,l[p],l[f],u.attributes));i=$n(r,u.preference);for(var g=0;g<t;g++)r[g*t+g]=i;a=new Array(n);for(var y=0;y<n;y++)a[y]=0;o=new Array(n);for(var m=0;m<n;m++)o[m]=0;for(var b=new Array(t),x=new Array(t),w=new Array(t),E=0;E<t;E++)b[E]=0,x[E]=0,w[E]=0;for(var k,C=new Array(t*u.minIterations),S=0;S<C.length;S++)C[S]=0;for(k=0;k<u.maxIterations;k++){for(var D=0;D<t;D++){for(var P=-1/0,T=-1/0,M=-1,B=0,_=0;_<t;_++)b[_]=a[D*t+_],(B=o[D*t+_]+r[D*t+_])>=P?(T=P,P=B,M=_):B>T&&(T=B);for(var N=0;N<t;N++)a[D*t+N]=(1-u.damping)*(r[D*t+N]-P)+u.damping*b[N];a[D*t+M]=(1-u.damping)*(r[D*t+M]-T)+u.damping*b[M]}for(var I=0;I<t;I++){for(var z=0,L=0;L<t;L++)b[L]=o[L*t+I],x[L]=Math.max(0,a[L*t+I]),z+=x[L];z-=x[I],x[I]=a[I*t+I],z+=x[I];for(var A=0;A<t;A++)o[A*t+I]=(1-u.damping)*Math.min(0,z-x[A])+u.damping*b[A];o[I*t+I]=(1-u.damping)*(z-x[I])+u.damping*b[I]}for(var O=0,R=0;R<t;R++){var F=o[R*t+R]+a[R*t+R]>0?1:0;C[k%u.minIterations*t+R]=F,O+=F}if(O>0&&(k>=u.minIterations-1||k==u.maxIterations-1)){for(var V=0,q=0;q<t;q++){w[q]=0;for(var j=0;j<u.minIterations;j++)w[q]+=C[j*t+q];0!==w[q]&&w[q]!==u.minIterations||V++}if(V===t)break}}for(var Y=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r}(t,a,o),X=function(e,t,n){for(var r=Qn(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,l=-1/0,u=0;u<a.length;u++){for(var c=0,h=0;h<a.length;h++)c+=t[a[h]*e+a[u]];c>l&&(s=u,l=c)}n[i]=a[s]}return r=Qn(e,t,n)}(t,r,Y),W={},H=0;H<Y.length;H++)W[Y[H]]=[];for(var K=0;K<l.length;K++){var G=X[c[l[K].id()]];null!=G&&W[G].push(l[K])}for(var Z=new Array(Y.length),U=0;U<Y.length;U++)Z[U]=s.collection(W[Y[U]]);return Z},er={};[Fe,je,Ye,We,Ke,Ze,Je,nn,an,sn,un,bn,jn,Gn,{affinityPropagation:Jn,ap:Jn}].forEach(function(e){I(er,e)});var tr=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};tr.prototype={fulfill:function(e){return nr(this,1,"fulfillValue",e)},reject:function(e){return nr(this,2,"rejectReason",e)},then:function(e,t){var n=new tr;return this.onFulfilled.push(ar(e,n,"fulfill")),this.onRejected.push(ar(t,n,"reject")),rr(this),n.proxy}};var nr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,rr(e)),e},rr=function(e){1===e.state?ir(e,"onFulfilled",e.fulfillValue):2===e.state&&ir(e,"onRejected",e.rejectReason)},ir=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},ar=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){return void t.reject(e)}or(t,i)}}},or=function t(n,r){if(n!==r&&n.proxy!==r){var i;if("object"===e(r)&&null!==r||"function"==typeof r)try{i=r.then}catch(e){return void n.reject(e)}if("function"!=typeof i)n.fulfill(r);else{var a=!1;try{i.call(r,function(e){a||(a=!0,e===r?n.reject(new TypeError("circular thenable chain")):t(n,e))},function(e){a||(a=!0,n.reject(e))})}catch(e){a||n.reject(e)}}}else n.reject(new TypeError("cannot resolve promise with itself"))};tr.all=function(e){return new tr(function(t,n){for(var r=new Array(e.length),i=0,a=function(n,a){r[n]=a,++i===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then(function(e){a(t,e)},function(e){n(e)}):a(t,r)}(o)})},tr.resolve=function(e){return new tr(function(t,n){t(e)})},tr.reject=function(e){return new tr(function(t,n){n(e)})};var sr="undefined"!=typeof Promise?Promise:tr,lr=function(e,t,n){var r=w(e),i=!r,a=this._private=I({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&p(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},ur=lr.prototype;I(ur,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),m(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;switch(e){case"frame":t=n.frames;break;default:case"complete":case"completed":t=n.completes}return new sr(function(e,n){t.push(function(){e()})})}}),ur.complete=ur.completed,ur.run=ur.play,ur.running=ur.playing;var cr={};[{animated:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return!1;var t=e[0];return t?t._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t<e.length;t++){e[t]._private.animation.queue=[]}return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=void 0!==this.length,r=n?this:[this],i=this._private.cy||this,a=!n,o=!a;if(!i.styleEnabled())return this;var s=i.style();if(e=I({},e,t),0===Object.keys(e).length)return new lr(r[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(o&&(e.style=s.getPropsList(e.style||e.css),e.css=void 0),o&&null!=e.renderedPosition){var l=e.renderedPosition,u=i.pan(),c=i.zoom();e.position=nt(l,c,u)}if(a&&null!=e.panBy){var h=e.panBy,d=i.pan();e.pan={x:d.x+h.x,y:d.y+h.y}}var p=e.center||e.centre;if(a&&null!=p){var f=i.getCenterPan(p.eles,e.zoom);null!=f&&(e.pan=f)}if(a&&null!=e.fit){var v=e.fit,y=i.getFitViewport(v.eles||v.boundingBox,v.padding);null!=y&&(e.pan=y.pan,e.zoom=y.zoom)}if(a&&g(e.zoom)){var m=i.getZoomedViewport(e.zoom);null!=m&&(m.zoomed&&(e.zoom=m.zoom),m.panned&&(e.pan=m.pan))}return new lr(r[0],e)}},animate:function(){return function(e,t){var n=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=I({},e,t));for(var r=0;r<n.length;r++){var i=n[r],a=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,a?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=void 0!==this.length?this:[this],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var i=0;i<n.length;i++){for(var a=n[i]._private,o=a.animation.current,s=0;s<o.length;s++){var l=o[s]._private;t&&(l.duration=0)}e&&(a.animation.queue=[]),t||(a.animation.current=[])}return r.notify("draw"),this}}},{data:function(e){return e=I({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=void 0!==this.length,a=i?this:[this],o=i?this[0]:this;if(d(t)){var s;if(r.allowGetting&&void 0===n)return o&&(r.beforeGet(o),s=o._private[r.field][t]),s;if(r.allowSetting&&void 0!==n&&!r.immutableKeys[t]){var l=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},t,n);r.beforeSet(this,l);for(var u=0,c=a.length;u<c;u++){var h=a[u];r.canSet(h)&&(h._private[r.field][t]=n)}r.updateStyle&&this.updateStyle(),r.onSet(this),r.settingTriggersEvent&&this[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&g(t)){var f,v,y=t,m=Object.keys(y);r.beforeSet(this,y);for(var b=0;b<m.length;b++){if(v=y[f=m[b]],!r.immutableKeys[f])for(var x=0;x<a.length;x++){var w=a[x];r.canSet(w)&&(w._private[r.field][f]=v)}}r.updateStyle&&this.updateStyle(),r.onSet(this),r.settingTriggersEvent&&this[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&p(t)){var E=t;this.on(r.bindingEvent,E)}else if(r.allowGetting&&void 0===t){var k;return o&&(r.beforeGet(o),k=o._private[r.field]),k}return this}},removeData:function(e){return e=I({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=void 0!==this.length?this:[this];if(d(t)){for(var i=t.split(/\s+/),a=i.length,o=0;o<a;o++){var s=i[o];if(!k(s))if(!n.immutableKeys[s])for(var l=0,u=r.length;l<u;l++)r[l]._private[n.field][s]=void 0}n.triggerEvent&&this[n.triggerFnName](n.event)}else if(void 0===t){for(var c=0,h=r.length;c<h;c++)for(var p=r[c]._private[n.field],f=Object.keys(p),g=0;g<f.length;g++){var v=f[g];!n.immutableKeys[v]&&(p[v]=void 0)}n.triggerEvent&&this[n.triggerFnName](n.event)}return this}}},{eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new sr(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}}].forEach(function(e){I(cr,e)});var hr={animate:cr.animate(),animation:cr.animation(),animated:cr.animated(),clearQueue:cr.clearQueue(),delay:cr.delay(),delayAnimation:cr.delayAnimation(),stop:cr.stop()},dr={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach(function(e){return t.push(e)}),t}f(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],r=new Ae(e),i=0;i<this.length;i++){for(var a=this[i],o=a._private,s=o.classes,l=!1,u=0;u<e.length;u++){var c=e[u];if(!s.has(c)){l=!0;break}}l||(l=s.size!==e.length),l&&(o.classes=r,n.push(a))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){f(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i<a;i++)for(var o=this[i],s=o._private.classes,l=!1,u=0;u<e.length;u++){var c=e[u],h=s.has(c),d=!1;t||n&&!h?(s.add(c),d=!0):(!t||n&&h)&&(s.delete(c),d=!0),!l&&d&&(r.push(o),l=!0)}return r.length>0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};dr.className=dr.classNames=dr.classes;var pr={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:'"(?:\\\\"|[^"])*"|'+"'(?:\\\\'|[^'])*'",number:_,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};pr.variable="(?:[\\w-]|(?:\\\\"+pr.metaChar+"))+",pr.value=pr.string+"|"+pr.number,pr.className=pr.variable,pr.id=pr.variable,function(){var e,t,n;for(e=pr.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],pr.comparatorOp+="|@"+t;for(e=pr.comparatorOp.split("|"),n=0;n<e.length;n++)(t=e[n]).indexOf("!")>=0||"="!==t&&(pr.comparatorOp+="|\\!"+t)}();var fr=0,gr=1,vr=2,yr=3,mr=4,br=5,xr=6,wr=7,Er=8,kr=9,Cr=10,Sr=11,Dr=12,Pr=13,Tr=14,Mr=15,Br=16,_r=17,Nr=18,Ir=19,zr=20,Lr=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return function(e,t){return-1*N(e,t)}(e.selector,t.selector)}),Ar=function(){for(var e,t={},n=0;n<Lr.length;n++)t[(e=Lr[n]).selector]=e.matches;return t}(),Or="("+Lr.map(function(e){return e.selector}).join("|")+")",Rr=function(e){return e.replace(new RegExp("\\\\("+pr.metaChar+")","g"),function(e,t){return t})},Fr=function(e,t,n){e[e.length-1]=n},Vr=[{name:"group",query:!0,regex:"("+pr.group+")",populate:function(e,t,n){var r=i(n,1)[0];t.checks.push({type:fr,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:Or,populate:function(e,t,n){var r=i(n,1)[0];t.checks.push({type:wr,value:r})}},{name:"id",query:!0,regex:"\\#("+pr.id+")",populate:function(e,t,n){var r=i(n,1)[0];t.checks.push({type:Er,value:Rr(r)})}},{name:"className",query:!0,regex:"\\.("+pr.className+")",populate:function(e,t,n){var r=i(n,1)[0];t.checks.push({type:kr,value:Rr(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+pr.variable+")\\s*\\]",populate:function(e,t,n){var r=i(n,1)[0];t.checks.push({type:mr,field:Rr(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+pr.variable+")\\s*("+pr.comparatorOp+")\\s*("+pr.value+")\\s*\\]",populate:function(e,t,n){var r=i(n,3),a=r[0],o=r[1],s=r[2];s=null!=new RegExp("^"+pr.string+"$").exec(s)?s.substring(1,s.length-1):parseFloat(s),t.checks.push({type:yr,field:Rr(a),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+pr.boolOp+")\\s*("+pr.variable+")\\s*\\]",populate:function(e,t,n){var r=i(n,2),a=r[0],o=r[1];t.checks.push({type:br,field:Rr(o),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+pr.meta+")\\s*("+pr.comparatorOp+")\\s*("+pr.number+")\\s*\\]\\]",populate:function(e,t,n){var r=i(n,3),a=r[0],o=r[1],s=r[2];t.checks.push({type:xr,field:Rr(a),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:pr.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]={checks:[]}}},{name:"directedEdge",separator:!0,regex:pr.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,i={checks:[]};return n.checks.push({type:Sr,source:r,target:i}),Fr(e,0,n),e.edgeCount++,i}var a={checks:[]},o=t,s={checks:[]};return a.checks.push({type:Dr,source:o,target:s}),Fr(e,0,a),e.edgeCount++,s}},{name:"undirectedEdge",separator:!0,regex:pr.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,i={checks:[]};return n.checks.push({type:Cr,nodes:[r,i]}),Fr(e,0,n),e.edgeCount++,i}var a={checks:[]},o=t,s={checks:[]};return a.checks.push({type:Tr,node:o,neighbor:s}),Fr(e,0,a),s}},{name:"child",separator:!0,regex:pr.child,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},i=e[e.length-1];return n.checks.push({type:Mr,parent:i,child:r}),Fr(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var a={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return a.checks.push({type:Ir,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:zr}],c.checks.push({type:zr}),s.checks.push({type:_r,parent:c,child:u}),Fr(e,0,a),e.currentSubject=l,e.compoundCount++,u}var h={checks:[]},d={checks:[]},p=[{type:_r,parent:h,child:d}];return h.checks=t.checks,t.checks=p,e.compoundCount++,d}},{name:"descendant",separator:!0,regex:pr.descendant,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},i=e[e.length-1];return n.checks.push({type:Br,ancestor:i,descendant:r}),Fr(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var a={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return a.checks.push({type:Ir,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:zr}],c.checks.push({type:zr}),s.checks.push({type:Nr,ancestor:c,descendant:u}),Fr(e,0,a),e.currentSubject=l,e.compoundCount++,u}var h={checks:[]},d={checks:[]},p=[{type:Nr,ancestor:h,descendant:d}];return h.checks=t.checks,t.checks=p,e.compoundCount++,d}},{name:"subject",modifier:!0,regex:pr.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return Ce("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=null==n?null:n.type;r===Sr?n.type=Pr:r===Cr&&(n.type=Tr,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Vr.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var qr=function(e){for(var t,n,r,i=0;i<Vr.length;i++){var a=Vr[i],o=a.name,s=e.match(a.regexObj);if(null!=s){n=s,t=a,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},jr={parse:function(e){var t=this.inputText=e,n=this[0]={checks:[]};for(this.length=1,t=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e}(t);;){var r=qr(t);if(null==r.expr)return Ce("The selector `"+e+"`is invalid"),!1;var i=r.match.slice(1),a=r.expr.populate(this,n,i);if(!1===a)return!1;if(null!=a&&(n=a),(t=r.remaining).match(/^\s*$/))break}var o=this[this.length-1];null!=this.currentSubject&&(o.subject=this.currentSubject),o.edgeCount=this.edgeCount,o.compoundCount=this.compoundCount;for(var s=0;s<this.length;s++){var l=this[s];if(l.compoundCount>0&&l.edgeCount>0)return Ce("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return Ce("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&Ce("The selector `"+e+"` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return d(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case fr:var l=e(s);return l.substring(0,l.length-1);case yr:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case br:var h=r.operator,d=r.field;return"["+e(h)+d+"]";case mr:return"["+r.field+"]";case xr:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case wr:return s;case Er:return"#"+s;case kr:return"."+s;case _r:case Mr:return i(r.parent,a)+n(">")+i(r.child,a);case Nr:case Br:return i(r.ancestor,a)+" "+i(r.descendant,a);case Ir:var f=i(r.left,a),g=i(r.subject,a),v=i(r.right,a);return f+(f.length>0?" ":"")+g+v;case zr:return""}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)},"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},Yr=function(e,t,n){var r,i,a,o=d(e),s=v(e),l=d(n),u=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e<n;break;case"<=":h=!0,r=e<=n;break;default:r=!1}return!c||null==e&&h||(r=!r),r},Xr=function(e,t){return e.data(t)},Wr=[],Hr=function(e,t){return e.checks.every(function(e){return Wr[e.type](e,t)})};Wr[fr]=function(e,t){var n=e.value;return"*"===n||n===t.group()},Wr[wr]=function(e,t){return function(e,t){return Ar[e](t)}(e.value,t)},Wr[Er]=function(e,t){var n=e.value;return t.id()===n},Wr[kr]=function(e,t){var n=e.value;return t.hasClass(n)},Wr[xr]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Yr(function(e,t){return e[t]()}(t,n),r,i)},Wr[yr]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Yr(Xr(t,n),r,i)},Wr[br]=function(e,t){var n=e.field,r=e.operator;return function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}}(Xr(t,n),r)},Wr[mr]=function(e,t){var n=e.field;e.operator;return void 0!==Xr(t,n)},Wr[Cr]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return Hr(n,i)&&Hr(r,a)||Hr(r,i)&&Hr(n,a)},Wr[Tr]=function(e,t){return Hr(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&Hr(e.neighbor,t)})},Wr[Sr]=function(e,t){return Hr(e.source,t.source())&&Hr(e.target,t.target())},Wr[Dr]=function(e,t){return Hr(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&Hr(e.target,t)})},Wr[Pr]=function(e,t){return Hr(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&Hr(e.source,t)})},Wr[Mr]=function(e,t){return Hr(e.child,t)&&Hr(e.parent,t.parent())},Wr[_r]=function(e,t){return Hr(e.parent,t)&&t.children().some(function(t){return Hr(e.child,t)})},Wr[Br]=function(e,t){return Hr(e.descendant,t)&&t.ancestors().some(function(t){return Hr(e.ancestor,t)})},Wr[Nr]=function(e,t){return Hr(e.ancestor,t)&&t.descendants().some(function(t){return Hr(e.descendant,t)})},Wr[Ir]=function(e,t){return Hr(e.subject,t)&&Hr(e.left,t)&&Hr(e.right,t)},Wr[zr]=function(){return!0},Wr[gr]=function(e,t){return e.value.has(t)},Wr[vr]=function(e,t){return(0,e.value)(t)};var Kr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||d(e)&&e.match(/^\s*$/)||(m(e)?this.addQuery({checks:[{type:gr,value:e.collection()}]}):p(e)?this.addQuery({checks:[{type:vr,value:e}]}):d(e)?this.parse(e)||(this.invalid=!0):Ee("A selector must be created from a string; found ",e))},Gr=Kr.prototype;[jr,{matches:function(e){for(var t=0;t<this.length;t++){var n=this[t];if(Hr(n,e))return!0}return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===Er)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(Hr(r,e))return!0}return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}}].forEach(function(e){return I(Gr,e)}),Gr.text=function(){return this.inputText},Gr.size=function(){return this.length},Gr.eq=function(e){return this[e]},Gr.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},Gr.addQuery=function(e){this[this.length++]=e},Gr.selector=Gr.toString;var Zr={allAre:function(e){var t=new Kr(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new Kr(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++){if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};Zr.allAreNeighbours=Zr.allAreNeighbors,Zr.has=Zr.contains,Zr.equal=Zr.equals=Zr.same;var Ur,$r,Qr=function(e,t){return function(n,r,i,a){var o,s=n;if(null==s?o="":m(s)&&1===s.length&&(o=s.id()),1===this.length&&o){var l=this[0]._private,u=l.traversalCache=l.traversalCache||{},c=u[t]=u[t]||[],h=he(o),d=c[h];return d||(c[h]=e.call(this,n,r,i,a))}return e.call(this,n,r,i,a)}},Jr={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,{unique:!0}).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,{unique:!0}).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:Qr(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,{unique:!0}).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return function e(n){for(var r=0;r<n.length;r++){var i=n[r];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,{unique:!0}).filter(e)}};function ei(e,t,n,r){for(var i=[],a=new Ae,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?i.push(l):o&&r(i,a,l)}for(;i.length>0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function ti(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function ni(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function ri(e,t,n){ni(e,t,n),ti(e,t,n)}Jr.forEachDown=function(e){return ei(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ti)},Jr.forEachUp=function(e){return ei(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ni)},Jr.forEachUpAndDown=function(e){return ei(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ri)},Jr.ancestors=Jr.parents,(Ur=$r={data:cr.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:cr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:cr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:cr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:cr.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:cr.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Ur.data,Ur.removeAttr=Ur.removeData;var ii,ai,oi=$r,si={};function li(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;a<i.length;a++){var o=i[a];!t&&o.isLoop()||(n+=e(r,o))}return n}}}function ui(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);void 0===o||void 0!==r&&!t(o,r)||(r=o)}return r}}I(si,{degree:li(function(e,t){return t.source().same(t.target())?2:1}),indegree:li(function(e,t){return t.target().same(e)?1:0}),outdegree:li(function(e,t){return t.source().same(e)?1:0})}),I(si,{minDegree:ui("degree",function(e,t){return e<t}),maxDegree:ui("degree",function(e,t){return e>t}),minIndegree:ui("indegree",function(e,t){return e<t}),maxIndegree:ui("indegree",function(e,t){return e>t}),minOutdegree:ui("outdegree",function(e,t){return e<t}),maxOutdegree:ui("outdegree",function(e,t){return e>t})}),I(si,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var ci=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};!i.isParent()||0===o.x&&0===o.y||i.children().shift(o,n),i.shiftCachedBoundingBox(o)}}},hi={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){ci(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(ii=ai={position:cr.data(hi),silentPosition:cr.data(I({},hi,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){ci(e,t,!0)}})),positions:function(e,t){if(g(e))t?this.silentPosition(e):this.position(e);else if(p(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a,o=this[i];(a=n(o,i))&&(t?o.silentPosition(a):o.position(a))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(g(e)?(r={x:v(e.x)?e.x:0,y:v(e.y)?e.y:0},n=t):d(e)&&v(t)&&((r={x:0,y:0})[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a],s=o.position(),l={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}i.endBatch()}return this},silentShift:function(e,t){return g(e)?this.shift(e,!0):d(e)&&v(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=g(e)?e:void 0,s=void 0!==o||void 0!==t&&d(e);if(n&&n.isNode()){if(!s){var l=n.position();return o=tt(l,i,a),void 0===e?o:o[e]}for(var u=0;u<this.length;u++){var c=this[u];void 0!==t?c.position(e,(t-a[e])/i):void 0!==o&&c.position(nt(o,i,a))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=g(e)?e:void 0,a=void 0!==i||void 0!==t&&d(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(!a){var s=n.position(),l=o?n.parent():null,u=l&&l.length>0,c=u;u&&(l=l[0]);var h=c?l.position():{x:0,y:0};return i={x:s.x-h.x,y:s.y-h.y},void 0===e?i:i[e]}for(var p=0;p<this.length;p++){var f=this[p],v=o?f.parent():null,y=v&&v.length>0,m=y;y&&(v=v[0]);var b=m?v.position():{x:0,y:0};void 0!==t?f.position(e,t+b[e]):void 0!==i&&f.position({x:i.x+b.x,y:i.y+b.y})}}else if(!a)return;return this}}).modelPosition=ii.point=ii.position,ii.modelPositions=ii.points=ii.positions,ii.renderedPoint=ii.renderedPosition,ii.relativePoint=ii.relativePosition;var di,pi,fi=ai;di=pi={},pi.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},pi.dirtyCompoundBoundsCache=function(){var e=this.cy();return e.styleEnabled()&&e.hasCompoundNodes()?(this.forEachUp(function(e){if(e.isParent()){var t=e._private;t.compoundBoundsClean=!1,t.bbCache=null,e.emitAndNotify("bounds")}}),this):this},pi.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.filter(function(e){return"element"===e.pstyle("display").value}).boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,p=h.biasComplementDiff,f=y(i.height.val-a.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;a.compoundBoundsClean||(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var gi=function(e){return e===1/0||e===-1/0?0:e},vi=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},yi=function(e,t){return null==t?e:vi(e,t.x1,t.y1,t.x2,t.y2)},mi=function(e,t,n){return Ne(e,t,n)},bi=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Ct(u,1),vi(e,u.x1,u.y1,u.x2,u.y2)}}},xi=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=mi(a,"labelWidth",n),p=mi(a,"labelHeight",n),f=mi(a,"labelX",n),g=mi(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=p,C=d,S=C/2,D=k/2;if(m)o=f-S,s=f+S,l=g-D,u=g+D;else{switch(c.value){case"left":o=f-C,s=f;break;case"center":o=f-S,s=f+S;break;case"right":o=f,s=f+C}switch(h.value){case"top":l=g-k,u=g;break;case"center":l=g-D,u=g+D;break;case"bottom":l=g,u=g+k}}o+=v-Math.max(x,w)-E,s+=v+Math.max(x,w)+E,l+=y-Math.max(x,w)-E,u+=y+Math.max(x,w)+E;var P=n||"main",T=i.labelBounds,M=T[P]=T[P]||{};M.x1=o,M.y1=l,M.x2=s,M.y2=u,M.w=s-o,M.h=u-l,Ct(M,1);var B=m&&"autorotate"===b.strValue,_=null!=b.pfValue&&0!==b.pfValue;if(B||_){var N=B?mi(i.rstyle,"labelAngle",n):b.pfValue,I=Math.cos(N),z=Math.sin(N),L=(o+s)/2,A=(l+u)/2;if(!m){switch(c.value){case"left":L=s;break;case"right":L=o}switch(h.value){case"top":A=u;break;case"bottom":A=l}}var O=function(e,t){return{x:(e-=L)*I-(t-=A)*z+L,y:e*z+t*I+A}},R=O(o,l),F=O(o,u),V=O(s,l),q=O(s,u);o=Math.min(R.x,F.x,V.x,q.x),s=Math.max(R.x,F.x,V.x,q.x),l=Math.min(R.y,F.y,V.y,q.y),u=Math.max(R.y,F.y,V.y,q.y)}vi(e,o,l,s,u),vi(i.labelBounds.all,o,l,s,u)}return e}},wi=function(e){var t=0,n=function(e){return(e?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeOverlays)},Ei=function(e){if(e.isEdge()){var t=e.source().position(),n=e.target().position(),r=function(e){return Math.round(e)};return ce([r(t.x),r(t.y),r(n.x),r(n.y)])}return 0},ki=function(e,t){var n,r=e._private,i=(null==t?Si:wi(t))===Si,a=Ei(e),o=r.bbCachePosKey===a,s=!(t.useCache&&o)||null==r.bbCache;if(s?(o||e.recalculateRenderedStyle(),n=function(e,t){var n,r,i,a,o,s,l=e._private.cy,u=l.styleEnabled(),c=l.headless(),h=bt(),d=e._private,p=u?e.pstyle("display").value:"element",f=e.isNode(),g=e.isEdge(),v="none"!==p,y=d.rstyle,m=f&&u?e.pstyle("bounds-expansion").pfValue:0;if(v){var b=0;u&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(b=e.pstyle("overlay-padding").value);var x=0;if(u&&(x=e.pstyle("width").pfValue/2),f&&t.includeNodes){var w=e.position();o=w.x,s=w.y;var E=e.outerWidth()/2,k=e.outerHeight()/2;vi(h,n=o-E,i=s-k,r=o+E,a=s+k)}else if(g&&t.includeEdges)if(u&&!c&&(n=Math.min(y.srcX,y.midX,y.tgtX),r=Math.max(y.srcX,y.midX,y.tgtX),i=Math.min(y.srcY,y.midY,y.tgtY),a=Math.max(y.srcY,y.midY,y.tgtY),vi(h,n-=x,i-=x,r+=x,a+=x)),u&&!c&&"haystack"===e.pstyle("curve-style").strValue){var C=y.haystackPts||[];if(n=C[0].x,i=C[0].y,n>(r=C[1].x)){var S=n;n=r,r=S}if(i>(a=C[1].y)){var D=i;i=a,a=D}vi(h,n-x,i-x,r+x,a+x)}else{for(var P=y.bezierPts||y.linePts||[],T=0;T<P.length;T++){var M=P[T];n=M.x-x,r=M.x+x,i=M.y-x,a=M.y+x,vi(h,n,i,r,a)}if(0===P.length){var B=e.source().position(),_=e.target().position();if((n=B.x)>(r=_.x)){var N=n;n=r,r=N}if((i=B.y)>(a=_.y)){var I=i;i=a,a=I}vi(h,n-=x,i-=x,r+=x,a+=x)}}if(u&&t.includeEdges&&g&&(bi(h,e,"mid-source"),bi(h,e,"mid-target"),bi(h,e,"source"),bi(h,e,"target")),u&&"yes"===e.pstyle("ghost").value){var z=e.pstyle("ghost-offset-x").pfValue,L=e.pstyle("ghost-offset-y").pfValue;vi(h,h.x1+z,h.y1+L,h.x2+z,h.y2+L)}var A=d.bodyBounds=d.bodyBounds||{};St(A,h),Ct(A,m),Ct(A,1),u&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,vi(h,n-b,i-b,r+b,a+b));var O=d.overlayBounds=d.overlayBounds||{};St(O,h),Ct(O,m),Ct(O,1);var R=d.labelBounds=d.labelBounds||{};null!=R.all?wt(R.all):R.all=bt(),u&&t.includeLabels&&(xi(h,e,null),g&&(xi(h,e,"source"),xi(h,e,"target")))}return h.x1=gi(h.x1),h.y1=gi(h.y1),h.x2=gi(h.x2),h.y2=gi(h.y2),h.w=gi(h.x2-h.x1),h.h=gi(h.y2-h.y1),h.w>0&&h.h>0&&v&&(Ct(h,m),Ct(h,1)),h}(e,Ci),r.bbCache=n,r.bbCacheShift.x=r.bbCacheShift.y=0,r.bbCachePosKey=a):n=r.bbCache,!s&&(0!==r.bbCacheShift.x||0!==r.bbCacheShift.y)){var l=Dt,u=r.bbCacheShift,c=function(e,t){null!=e&&l(e,t)};l(n,u);var h=r.bodyBounds,d=r.overlayBounds,p=r.labelBounds,f=r.arrowBounds;c(h,u),c(d,u),null!=f&&(c(f.source,u),c(f.target,u),c(f["mid-source"],u),c(f["mid-target"],u)),null!=p&&(c(p.main,u),c(p.all,u),c(p.source,u),c(p.target,u))}if(r.bbCacheShift.x=r.bbCacheShift.y=0,!i){var g=e.isNode();n=bt(),(t.includeNodes&&g||t.includeEdges&&!g)&&(t.includeOverlays?yi(n,r.overlayBounds):yi(n,r.bodyBounds)),t.includeLabels&&yi(n,r.labelBounds.all),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Ci={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeOverlays:!0,useCache:!0},Si=wi(Ci),Di=Me(Ci);pi.boundingBox=function(e){if(1===this.length&&null!=this[0]._private.bbCache&&(void 0===e||void 0===e.useCache||!0===e.useCache))return e=void 0===e?Ci:Di(e),ki(this[0],e);var t=bt(),n=Di(e=e||Ci);if(this.cy().styleEnabled())for(var r=0;r<this.length;r++){var i=this[r],a=i._private,o=Ei(i),s=a.bbCachePosKey===o,l=n.useCache&&s;i.recalculateRenderedStyle(l)}this.updateCompoundBounds();for(var u=0;u<this.length;u++){var c=this[u];yi(t,ki(c,n))}return t.x1=gi(t.x1),t.y1=gi(t.y1),t.x2=gi(t.x2),t.y2=gi(t.y2),t.w=gi(t.x2-t.x1),t.h=gi(t.y2-t.y1),t},pi.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCacheShift.x=t.bbCacheShift.y=0,t.bbCachePosKey=null}return this.emitAndNotify("bounds"),this},pi.shiftCachedBoundingBox=function(e){for(var t=0;t<this.length;t++){var n=this[t]._private;null!=n.bbCache&&(n.bbCacheShift.x+=e.x,n.bbCacheShift.y+=e.y)}return this.emitAndNotify("bounds"),this},pi.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes();if(r&&(t=t.filter(function(e){return!e.isParent()})),g(e)){var i=e;e=function(){return i}}n.startBatch(),t.forEach(function(t,n){return t._private.bbAtOldPos=e(t,n)}).silentPositions(e),r&&this.updateCompoundBounds(!0);var a=xt(this.boundingBox({useCache:!1}));return t.silentPositions(function(e){return e._private.bbAtOldPos}),n.endBatch(),a},di.boundingbox=di.bb=di.boundingBox,di.renderedBoundingbox=di.renderedBoundingBox;var Pi,Ti,Mi=pi;Pi=Ti={};var Bi=function(e){e.uppercaseName=B(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=B(e.outerName),Pi[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t){if(!r)return 1;if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);switch(i.strValue){case"label":return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return i.pfValue}}},Pi["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)return n?t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding():1},Pi["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},Pi["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};Bi({name:"width"}),Bi({name:"height"}),Ti.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),void 0!==t.autoPadding?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue};var _i=Ti,Ni={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},Ii=Object.keys(Ni).reduce(function(e,t){var n=Ni[t],r=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)}(t);return e[t]=function(){return function(e,t){if(e.isEdge())return t(e)}(this,n.get)},n.mult?e[r]=function(){return function(e,t){if(e.isEdge()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return tt(e,i,r)})}}(this,n.get)}:e[r]=function(){return function(e,t){if(e.isEdge()){var n=e.cy();return tt(t(e),n.zoom(),n.pan())}}(this,n.get)},e},{}),zi=I({},fi,Mi,_i,Ii),Li=function(e,t){this.recycle(e,t)};function Ai(){return!1}function Oi(){return!0}Li.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Ai,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Oi:Ai):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Oi;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Oi;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Oi,this.stopPropagation()},isDefaultPrevented:Ai,isPropagationStopped:Ai,isImmediatePropagationStopped:Ai};var Ri=/^([^.]+)(\.(?:[^.]+))?$/,Fi={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Vi=Object.keys(Fi),qi={};function ji(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:qi,t=arguments.length>1?arguments[1]:void 0,n=0;n<Vi.length;n++){var r=Vi[n];this[r]=e[r]||Fi[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Yi=ji.prototype,Xi=function(e,t,n,r,i,a,o){p(r)&&(i=r,r=null),o&&(a=null==a?o:I({},a,o));for(var s=f(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!k(u)){var c=u.match(Ri);if(c)if(!1===t(e,u,c[1],c[2]?c[2]:null,r,i,a))break}}},Wi=function(e,t){return e.addEventFields(e.context,t),new Li(t.type,t)},Hi=function(e,t,n){if("event"!==h(n))if(g(n))t(e,Wi(e,n));else for(var r=f(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!k(a)){var o=a.match(Ri);if(o){var s=o[1],l=o[2]?o[2]:null;t(e,Wi(e,{type:s,namespace:l,target:e.context}))}}}else t(e,n)};Yi.on=Yi.addListener=function(e,t,n,r,i){return Xi(this,function(e,t,n,r,i,a,o){p(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},Yi.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},Yi.removeListener=Yi.off=function(e,t,n,r){var i=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var a=this.listeners,o=function(o){var s=a[o];Xi(i,function(t,n,r,i,l,u){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},Yi.removeAllListeners=function(){return this.removeListener("*")},Yi.emit=Yi.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,f(t)||(t=[t]),Hi(this,function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}}(o,t),e.beforeEmit(e.context,i,a),i.conf&&i.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==i}));var s=e.callbackContext(e.context,i,a),l=i.callback.apply(s,o);e.afterEmit(e.context,i,a),!1===l&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o(s);e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var Ki={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&b(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Gi=function(e){return d(e)?new Kr(e):e},Zi={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new ji(Ki,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=Gi(t),i=0;i<this.length;i++){this[i].emitter().on(e,r,n)}return this},removeListener:function(e,t,n){for(var r=Gi(t),i=0;i<this.length;i++){this[i].emitter().removeListener(e,r,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){this[e].emitter().removeAllListeners()}return this},one:function(e,t,n){for(var r=Gi(t),i=0;i<this.length;i++){this[i].emitter().one(e,r,n)}return this},once:function(e,t,n){for(var r=Gi(t),i=0;i<this.length;i++){this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){this[n].emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};cr.eventAliasesOn(Zi);var Ui={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.merge(r):t.merge(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(d(e)||m(e))return new Kr(e).filter(this);if(p(e)){for(var n=this.spawn(),r=0;r<this.length;r++){var i=this[r];(t?e.apply(t,[i,r,this]):e(i,r,this))&&n.merge(i)}return n}return this.spawn()},not:function(e){if(e){d(e)&&(e=this.filter(e));for(var t=[],n=e._private.map,r=0;r<this.length;r++){var i=this[r];n.has(i.id())||t.push(i)}return this.spawn(t)}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(d(e)){var t=e;return this.filter(t)}for(var n=[],r=e,i=this.length<e.length,a=i?r._private.map:this._private.map,o=i?this:r,s=0;s<o.length;s++){var l=o[s]._private.data.id,u=a.get(l);u&&n.push(u.ele)}return this.spawn(n)},xor:function(e){var t=this._private.cy;d(e)&&(e=t.$(e));var n=[],r=e,i=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return i(this,r),i(r,this),this.spawn(n)},diff:function(e){var t=this._private.cy;d(e)&&(e=t.$(e));var n=[],r=[],i=[],a=e,o=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.push(a):n.push(a)}};return o(this,a,n),o(a,this,r),{left:this.spawn(n,{unique:!0}),right:this.spawn(r,{unique:!0}),both:this.spawn(i,{unique:!0})}},add:function(e){var t=this._private.cy;if(!e)return this;if(d(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=[],i=0;i<this.length;i++)r.push(this[i]);for(var a=this._private.map,o=0;o<e.length;o++){var s=!a.has(e[o].id());s&&r.push(e[o])}return this.spawn(r)},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&d(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var l=this.length++;this[l]=o,i.set(s,{ele:o,index:l})}else{var u=i.get(s).index;this[u]=o,i.set(s,{ele:o,index:u})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&d(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=0;r<this.length;r++){var i=this[r],a=t?e.apply(t,[i,r,this]):e(i,r,this);n.push(a)}return n},reduce:function(e,t){for(var n=t,r=0;r<this.length;r++)n=e(n,this[r],r,this);return n},max:function(e,t){for(var n,r=-1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o>r&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o<r&&(r=o,n=a)}return{value:r,ele:n}}},$i=Ui;$i.u=$i["|"]=$i["+"]=$i.union=$i.or=$i.add,$i["\\"]=$i["!"]=$i["-"]=$i.difference=$i.relativeComplement=$i.subtract=$i.not,$i.n=$i["&"]=$i["."]=$i.and=$i.intersection=$i.intersect,$i["^"]=$i["(+)"]=$i["(-)"]=$i.symmetricDifference=$i.symdiff=$i.xor,$i.fnFilter=$i.filterFn=$i.stdFilter=$i.filter,$i.complement=$i.abscomp=$i.absoluteComplement;var Qi=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?ye:0}var i=r(e)-r(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1:0}var o=a(e)-a(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},Ji={forEach:function(e,t){if(p(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if(!1===(t?e.apply(t,[i,r,this]):e(i,r,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!p(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Qi)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:ye-1}var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}};Ji.each=Ji.forEach;var ea=Me({nodeDimensionsIncludeLabels:!1}),ta={layoutDimensions:function(e){if((e=ea(e)).nodeDimensionsIncludeLabels){var t=this.boundingBox();return{w:t.w,h:t.h}}return{w:this.outerWidth(),h:this.outerHeight()}},layoutPositions:function(e,t,n){var r=this.nodes(),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=D(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=t.spacingFactor&&1!==t.spacingFactor,u=function(){if(!l)return null;for(var e=bt(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);kt(e,i.x,i.y)}return e}(),c=D(function(e,n){var r=s(e,n);l&&(r=function(e,t,n){var r=t.x1+t.w/2,i=t.y1+t.h/2;return{x:r+(n.x-r)*e,y:i+(n.y-i)*e}}(Math.abs(t.spacingFactor),u,r));return null!=t.transform&&(r=t.transform(e,r)),r},o);if(t.animate){for(var h=0;h<r.length;h++){var d=r[h],p=c(d,h);if(null==t.animateFilter||t.animateFilter(d,h)){var f=d.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(f)}else d.position(p)}if(t.fit){var g=i.animation({fit:{boundingBox:a.boundingBoxAt(c),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else if(void 0!==t.zoom&&void 0!==t.pan){var v=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}e.animations.forEach(function(e){return e.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),sr.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else r.positions(c),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(I({},e,{eles:this}))}};function na(e,t,n){var r,i=n._private,a=i.styleCache=i.styleCache||[];return null!=(r=a[e])?r:r=a[e]=t(n)}function ra(e,t){return e=he(e),function(n){return na(e,t,n)}}function ia(e,t){e=he(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return na(e,n,t)}}ta.createLayout=ta.makeLayout=ta.layout;var aa={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach(function(e){n(e),e.connectedEdges().forEach(n)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=t.style(),i=this;e=!(!e&&void 0!==e),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var a=r.apply(i);return e?a.emitAndNotify("style"):a.emit("style"),this},parsedStyle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(g(e)){var i=e;r.applyBypass(this,i,!1),this.emitAndNotify("style")}else if(d(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r<this.length;r++){var i=this[r];n.removeAllBypasses(i,!1)}else{e=e.split(/\s+/);for(var a=0;a<this.length;a++){var o=this[a];n.removeBypasses(o,e,!1)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle("opacity").value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++){i*=a[o].pstyle("opacity").value}return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();return e?t?0===e.effectiveOpacity():0===e.pstyle("opacity").value:void 0},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function oa(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++){if(!t(n[r]))return!1}return!0}function sa(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||oa(i,r);var s=o.source,l=o.target;return n(s)&&(!a||oa(s,n))&&(s===l||n(l)&&(!a||oa(l,n)))}}}var la=ra("eleTakesUpSpace",function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())});aa.takesUpSpace=ia("takesUpSpace",sa({ok:la}));var ua=ra("eleInteractive",function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&la(e)}),ca=ra("parentInteractive",function(e){return"visible"===e.pstyle("visibility").value&&la(e)});aa.interactive=ia("interactive",sa({ok:ua,parentOk:ca,edgeOkViaNode:la})),aa.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var ha=ra("eleVisible",function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&la(e)}),da=la;aa.visible=ia("visible",sa({ok:ha,edgeOkViaNode:da})),aa.hidden=function(){var e=this[0];if(e)return!e.visible()},aa.isBundledBezier=ia("isBundledBezier",function(){return!!this.cy().styleEnabled()&&(!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace())}),aa.bypass=aa.css=aa.style,aa.renderedCss=aa.renderedStyle,aa.removeBypass=aa.removeCss=aa.removeStyle,aa.pstyle=aa.parsedStyle;var pa={};function fa(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(1===t.length&&p(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&f(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(l);if(void 0!==h&&(u=h,!h))return this}u&&(l._private[e.field]=e.value,c&&n.push(l))}var d=this.spawn(n);d.updateStyle(),d.emit(e.event),o&&d.emit(o)}return this}}function ga(e){pa[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},pa[e.on]=fa({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),pa[e.off]=fa({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}ga({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),ga({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),ga({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),ga({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),pa.deselect=pa.unselect,pa.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},ga({field:"active",on:"activate",off:"unactivate"}),ga({field:"pannable",on:"panify",off:"unpanify"}),pa.inactive=function(){var e=this[0];if(e)return!e._private.active};var va={},ya=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();if(e.noIncomingEdges&&c===i&&u!==i||e.noOutgoingEdges&&u===i&&c!==i){a=!0;break}}a||n.push(i)}}return this.spawn(n,{unique:!0}).filter(t)}},ma=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target();e.outgoing&&l===i?(n.push(s),n.push(u)):e.incoming&&u===i&&(n.push(s),n.push(l))}}return this.spawn(n,{unique:!0}).filter(t)}},ba=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],u=l.id();i[u]||(i[u]=!0,r.push(l),o=!0)}if(!o)break;n=a}return this.spawn(r,{unique:!0}).filter(t)}};function xa(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,{unique:!0}).filter(t)}}function wa(e){return function(t){var n=[],r=this._private.cy,i=e||{};d(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),h=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||h){if(i.thisIsSrc||i.thisIsTgt){if(i.thisIsSrc&&!c)continue;if(i.thisIsTgt&&!h)continue}n.push(l)}}return this.spawn(n,{unique:!0})}}function Ea(e){return e=I({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,h=0;h<c.length;h++){var d=c[h],p=d._private.data,f=p.target,g=p.source,v=f===u&&g===l,y=l===f&&u===g;(i.codirected&&v||!i.codirected&&(v||y))&&n.push(d)}return this.spawn(n,{unique:!0}).filter(t)}}va.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},I(va,{roots:ya({noIncomingEdges:!0}),leaves:ya({noOutgoingEdges:!0}),outgoers:Qr(ma({outgoing:!0}),"outgoers"),successors:ba({outgoing:!0}),incomers:Qr(ma({incoming:!0}),"incomers"),predecessors:ba({incoming:!0})}),I(va,{neighborhood:Qr(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target(),c=i===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,{unique:!0}).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),va.neighbourhood=va.neighborhood,va.closedNeighbourhood=va.closedNeighborhood,va.openNeighbourhood=va.openNeighborhood,I(va,{source:Qr(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:Qr(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:xa({attr:"source"}),targets:xa({attr:"target"})}),I(va,{edgesWith:Qr(wa(),"edgesWith"),edgesTo:Qr(wa({thisIsSrc:!0}),"edgesTo")}),I(va,{connectedEdges:Qr(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var i=r._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,{unique:!0}).filter(e)},"connectedEdges"),connectedNodes:Qr(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];r.isEdge()&&(t.push(r.source()[0]),t.push(r.target()[0]))}return this.spawn(t,{unique:!0}).filter(e)},"connectedNodes"),parallelEdges:Qr(Ea(),"parallelEdges"),codirectedEdges:Qr(Ea({codirected:!0}),"codirectedEdges")}),I(va,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach(function(t){t.connectedEdges().forEach(function(t){e.has(t.source())&&e.has(t.target())&&e.merge(t)})})};do{s()}while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),va.componentsOf=va.components;var ka=function(e,t,n){for(var r=null!=n?n:De();e.hasElementWithId(r);)r=De();return r},Ca=function(e,t,n){if(void 0!==e&&w(e)){var r=new ze,i=!1;if(t){if(t.length>0&&g(t[0])&&!b(t[0])){i=!0;for(var a=[],o=new Ae,s=0,l=t.length;s<l;s++){var u=t[s];null==u.data&&(u.data={});var c=u.data;if(null==c.id)c.id=ka(e,u);else if(e.hasElementWithId(c.id)||o.has(c.id))continue;var h=new Oe(e,u,!1);a.push(h),o.add(c.id)}t=a}}else t=[];this.length=0;for(var d=0,p=t.length;d<p;d++){var f=t[d][0];if(null!=f){var v=f._private.data.id;(null==n||n.unique&&!r.has(v))&&(r.set(v,{index:this.length,ele:f}),this[this.length]=f,this.length++)}}this._private={cy:e,map:r},i&&this.restore()}else Ee("A collection must have a reference to the core")},Sa=Oe.prototype=Ca.prototype;Sa.instanceString=function(){return"collection"},Sa.spawn=function(e,t,n){return w(e)||(n=t,t=e,e=this.cy()),new Ca(e,t,n)},Sa.spawnSelf=function(){return this.spawn(this)},Sa.cy=function(){return this._private.cy},Sa.renderer=function(){return this._private.cy.renderer()},Sa.element=function(){return this[0]},Sa.collection=function(){return x(this)?this:new Ca(this._private.cy,[this])},Sa.unique=function(){return new Ca(this._private.cy,this,{unique:!0})},Sa.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},Sa.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new Ca(t)},Sa.$id=Sa.getElementById,Sa.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},Sa.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},Sa.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},Sa.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(g(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var u=e.data.parent;null==u&&null==i.parent||u==i.parent||(void 0===u&&(u=null),null!=u&&(u=""+u),t=t.move({parent:u}))}}e.position&&t.position(e.position);var c=function(n,i,a){var o=e[n];null!=o&&o!==r[n]&&(o?t[i]():t[a]())};return c("removed","remove","restore"),c("selected","select","unselect"),c("selectable","selectify","unselectify"),c("locked","lock","unlock"),c("grabbable","grabify","ungrabify"),c("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var h={data:Se(r.data),position:Se(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};h.classes="";var d=0;return r.classes.forEach(function(e){return h.classes+=0==d++?e:" "+e}),h}}},Sa.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},Sa.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n].json(),i=new Oe(e,r,!1);t.push(i)}return new Ca(e,t)},Sa.copy=Sa.clone,Sa.restore=function(){for(var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.cy(),a=i._private,o=[],s=[],l=0,u=this.length;l<u;l++){var c=this[l];r&&!c.removed()||(c.isNode()?o.push(c):s.push(c))}e=o.concat(s);var h=function(){e.splice(t,1),t--};for(t=0;t<e.length;t++){var p=e[t],f=p._private,g=f.data;if(p.clearTraversalCache(),r||f.removed)if(void 0===g.id)g.id=ka(i,p);else if(v(g.id))g.id=""+g.id;else{if(k(g.id)||!d(g.id)){Ee("Can not create element with invalid string ID `"+g.id+"`"),h();continue}if(i.hasElementWithId(g.id)){Ee("Can not create second element with ID `"+g.id+"`"),h();continue}}else;var y=g.id;if(p.isNode()){var m=f.position;null==m.x&&(m.x=0),null==m.y&&(m.y=0)}if(p.isEdge()){for(var b=p,x=["source","target"],w=x.length,E=!1,C=0;C<w;C++){var S=x[C],D=g[S];v(D)&&(D=g[S]=""+g[S]),null==D||""===D?(Ee("Can not create edge `"+y+"` with unspecified "+S),E=!0):i.hasElementWithId(D)||(Ee("Can not create edge `"+y+"` with nonexistant "+S+" `"+D+"`"),E=!0)}if(E){h();continue}var P=i.getElementById(g.source),T=i.getElementById(g.target);P.same(T)?P._private.edges.push(b):(P._private.edges.push(b),T._private.edges.push(b)),b._private.source=P,b._private.target=T}f.map=new ze,f.map.set(y,{ele:p,index:0}),f.removed=!1,r&&i.addToPool(p)}for(var M=0;M<o.length;M++){var B=o[M],_=B._private.data;v(_.parent)&&(_.parent=""+_.parent);var N=_.parent;if(null!=N){var I=i.getElementById(N);if(I.empty())_.parent=void 0;else{for(var z=!1,L=I;!L.empty();){if(B.same(L)){z=!0,_.parent=void 0;break}L=L.parent()}z||(I[0]._private.children.push(B),B._private.parent=I[0],a.hasCompoundNodes=!0)}}}if(e.length>0){for(var A=new Ca(i,e),O=0;O<A.length;O++){var R=A[O];R.isNode()||(R.parallelEdges().clearTraversalCache(),R.source().clearTraversalCache(),R.target().clearTraversalCache())}(a.hasCompoundNodes?i.collection().merge(A).merge(A.connectedNodes()).merge(A.parent()):A).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(n),n?A.emitAndNotify("add"):r&&A.emit("add")}return this},Sa.removed=function(){var e=this[0];return e&&e._private.removed},Sa.inside=function(){var e=this[0];return e&&!e._private.removed},Sa.remove=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=[],r={},i=this._private.cy;function a(e){var i=r[e.id()];t&&e.removed()||i||(r[e.id()]=!0,e.isNode()?(n.push(e),function(e){for(var t=e._private.edges,n=0;n<t.length;n++)a(t[n])}(e),function(e){for(var t=e._private.children,n=0;n<t.length;n++)a(t[n])}(e)):n.unshift(e))}for(var o=0,s=this.length;o<s;o++){a(this[o])}function l(e,t){var n=e._private.edges;Be(n,t),e.clearTraversalCache()}function u(e){e.clearTraversalCache()}var c=[];function h(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();Be(n,t),t._private.parent=null,c.ids[r]||(c.ids[r]=!0,c.push(e))}c.ids={},this.dirtyCompoundBoundsCache(),t&&i.removeFromPool(n);for(var d=0;d<n.length;d++){var p=n[d];if(p.isEdge()){var f=p.source()[0],g=p.target()[0];l(f,p),l(g,p);for(var v=p.parallelEdges(),y=0;y<v.length;y++){var m=v[y];u(m),m.isBundledBezier()&&m.dirtyBoundingBoxCache()}}else{var b=p.parent();0!==b.length&&h(b,p)}t&&(p._private.removed=!0)}var x=i._private.elements;i._private.hasCompoundNodes=!1;for(var w=0;w<x.length;w++){if(x[w].isParent()){i._private.hasCompoundNodes=!0;break}}var E=new Ca(this.cy(),n);E.size()>0&&(e?E.emitAndNotify("remove"):t&&E.emit("remove"));for(var k=0;k<c.length;k++){var C=c[k];t&&C.removed()||C.updateStyle()}return E},Sa.move=function(e){var t=this._private.cy,n=this,r=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var i=r(e.source),a=r(e.target),o=null!=i&&t.hasElementWithId(i),s=null!=a&&t.hasElementWithId(a);(o||s)&&(t.batch(function(){n.remove(!1,!1),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],r=t._private.data;t.isEdge()&&(o&&(r.source=i),s&&(r.target=a))}n.restore(!1,!1)}),n.emitAndNotify("move"))}else if(void 0!==e.parent){var l=r(e.parent);if(null===l||t.hasElementWithId(l)){var u=null===l?void 0:l;t.batch(function(){var e=n.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var r=n[t],i=r._private.data;r.isNode()&&(i.parent=u)}e.restore(!1,!1)}),n.emitAndNotify("move")}}return this},[er,hr,dr,Zr,Jr,oi,si,zi,Zi,Ui,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Ji,ta,aa,pa,va].forEach(function(e){I(Sa,e)});var Da={add:function(e){var t,n=this;if(m(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new Ca(n,i)}}else if(f(e)){t=new Ca(n,e)}else if(g(e)&&(f(e.nodes)||f(e.edges))){for(var s=e,l=[],u=["nodes","edges"],c=0,h=u.length;c<h;c++){var d=u[c],p=s[d];if(f(p))for(var v=0,y=p.length;v<y;v++){var b=I({group:d},p[v]);l.push(b)}}t=new Ca(n,l)}else{t=new Oe(n,e).collection()}return t},remove:function(e){if(m(e));else if(d(e)){var t=e;e=this.$(t)}return e.remove()}};function Pa(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var h=0;h<4;++h)if("number"!=typeof arguments[h]||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var d=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function g(e){return 3*e}function v(e,t,n){return((p(t,n)*e+f(t,n))*e+g(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*f(t,n)*e+g(t)}function m(t){for(var r=0,c=1,h=l-1;c!==h&&d[c]<=t;++c)r+=u;var p=r+(t-d[--c])/(d[c+1]-d[c])*u,f=y(p,e,n);return f>=a?function(t,r){for(var a=0;a<i;++a){var o=y(r,e,n);if(0===o)return r;r-=(v(r,e,n)-t)/o}return r}(t,p):0===f?p:function(t,r,i){var a,l,u=0;do{(a=v(l=r+(i-r)/2,e,n)-t)>0?i=l:r=l}while(Math.abs(a)>o&&++u<s);return l}(t,r,r+u)}var b=!1;function x(){b=!0,e===t&&n===r||function(){for(var t=0;t<l;++t)d[t]=v(t*u,e,n)}()}var w=function(i){return b||x(),e===t&&n===r?i:0===i?0:1===i?1:v(m(i),t,r)};w.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var E="generateBezier("+[e,t,n,r]+")";return w.toString=function(){return E},w}var Ta=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,.5*r,i),o=t(n,.5*r,a),s=t(n,r,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),u=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,l.tension=t,l.friction=r,o=(a=null!==i)?(c=e(t,r))/i*.016:.016;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>1e-4&&Math.abs(s.v)>1e-4;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),Ma=function(e,t,n,r){var i=Pa(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},Ba={linear:function(e,t,n){return e+(t-e)*n},ease:Ma(.25,.1,.25,1),"ease-in":Ma(.42,0,1,1),"ease-out":Ma(0,0,.58,1),"ease-in-out":Ma(.42,0,.58,1),"ease-in-sine":Ma(.47,0,.745,.715),"ease-out-sine":Ma(.39,.575,.565,1),"ease-in-out-sine":Ma(.445,.05,.55,.95),"ease-in-quad":Ma(.55,.085,.68,.53),"ease-out-quad":Ma(.25,.46,.45,.94),"ease-in-out-quad":Ma(.455,.03,.515,.955),"ease-in-cubic":Ma(.55,.055,.675,.19),"ease-out-cubic":Ma(.215,.61,.355,1),"ease-in-out-cubic":Ma(.645,.045,.355,1),"ease-in-quart":Ma(.895,.03,.685,.22),"ease-out-quart":Ma(.165,.84,.44,1),"ease-in-out-quart":Ma(.77,0,.175,1),"ease-in-quint":Ma(.755,.05,.855,.06),"ease-out-quint":Ma(.23,1,.32,1),"ease-in-out-quint":Ma(.86,0,.07,1),"ease-in-expo":Ma(.95,.05,.795,.035),"ease-out-expo":Ma(.19,1,.22,1),"ease-in-out-expo":Ma(1,0,0,1),"ease-in-circ":Ma(.6,.04,.98,.335),"ease-out-circ":Ma(.075,.82,.165,1),"ease-in-out-circ":Ma(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Ba.linear;var r=Ta(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":Ma};function _a(e,t,n,r,i){if(1===r)return n;var a=i(t,n,r);return null==e?a:((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max)),a)}function Na(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function Ia(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=Na(e,i),s=Na(t,i);if(v(o)&&v(s))return _a(a,o,s,n,r);if(f(o)&&f(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],h=s[u];if(null!=c&&null!=h){var d=_a(a,c,h,n,r);l.push(d)}else l.push(h)}return l}}function za(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,l=o.startTime,u=(r?e:e.cy()).style();if(!o.easingImpl)if(null==s)o.easingImpl=Ba.linear;else{var c,h,p;if(d(s))c=u.parse("transition-timing-function",s).value;else c=s;d(c)?(h=c,p=[]):(h=c[1],p=c.slice(2).map(function(e){return+e})),p.length>0?("spring"===h&&p.push(o.duration),o.easingImpl=Ba[h].apply(null,p)):o.easingImpl=Ba[h]}var f,g=o.easingImpl;if(f=0===o.duration?1:(n-l)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var v=o.startPosition,y=o.position;if(y&&i&&!e.locked()){var m={};La(v.x,y.x)&&(m.x=Ia(v.x,y.x,f,g)),La(v.y,y.y)&&(m.y=Ia(v.y,y.y,f,g)),e.position(m)}var b=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(La(b.x,x.x)&&(w.x=Ia(b.x,x.x,f,g)),La(b.y,x.y)&&(w.y=Ia(b.y,x.y,f,g)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(La(k,C)&&(a.zoom=mt(a.minZoom,Ia(k,C,f,g),a.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var D=o.style;if(D&&D.length>0&&i){for(var P=0;P<D.length;P++){var T=D[P],M=T.name,B=T,_=o.startStyle[M],N=Ia(_,B,f,g,u.properties[_.name]);u.overrideBypass(e,M,N)}e.emit("style")}}return o.progress=f,f}function La(e,t){return null!=e&&null!=t&&(!(!v(e)||!v(t))||!(!e||!t))}function Aa(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function Oa(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(!n&&"none"===t.pstyle("display").value){a=a.splice(0,a.length).concat(o.splice(0,o.length));for(var l=0;l<a.length;l++)a[l].stop()}if(0===a.length){var u=o.shift();u&&a.push(u)}for(var c=function(e){for(var t=e.length-1;t>=0;t--){(0,e[t])()}e.splice(0,e.length)},h=a.length-1;h>=0;h--){var d=a[h],p=d._private;p.stopped?(a.splice(h,1),p.hooked=!1,p.playing=!1,p.started=!1,c(p.frames)):(p.playing||p.applying)&&(p.playing&&p.applying&&(p.applying=!1),p.started||Aa(0,d,e),za(t,d,e,n),p.applying&&(p.applying=!1),c(p.frames),null!=p.step&&p.step(e),d.completed()&&(a.splice(h,1),p.hooked=!1,p.playing=!1,p.started=!1,c(p.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=i(n[o]);a=a||s}var l=i(t,!0);(a||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Ra={animate:cr.animate(),animation:cr.animation(),animated:cr.animated(),clearQueue:cr.clearQueue(),delay:cr.delay(),delayAnimation:cr.delayAnimation(),stop:cr.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,n){Oa(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&oe(function(n){Oa(n,e),t()})}()}}},Fa={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&b(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Va=function(e){return d(e)?new Kr(e):e},qa={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new ji(Fa,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Va(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Va(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Va(t),n),this},once:function(e,t,n){return this.emitter().one(e,Va(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};cr.eventAliasesOn(qa);var ja={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};ja.jpeg=ja.jpg;var Ya={layout:function(e){if(null!=e)if(null!=e.name){var t=e.name,n=this.extension("layout",t);if(null!=n){var r;r=d(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$();var i=new n(I({},e,{cy:this,eles:r}));return i}Ee("No such layout `"+t+"` found.  Did you forget to import it and `cytoscape.use()` it?")}else Ee("A `name` must be specified to make a layout");else Ee("Layout options must be specified to make a layout")}};Ya.createLayout=Ya.makeLayout=Ya.layout;var Xa={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}})}},Wa=Me({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),Ha={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null!=t){void 0!==e.wheelSensitivity&&Ce("You have set a custom wheel sensitivity.  This will make your app zoom unnaturally when using mainstream mice.  You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=Wa(e);n.cy=this,this._private.renderer=new t(n),this.notify("init")}else Ee("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ha.invalidateDimensions=Ha.resize;var Ka={collection:function(e,t){return d(e)?this.$(e):m(e)?e.collection():f(e)?new Ca(this,e,t):new Ca(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Ka.elements=Ka.filter=Ka.$;var Ga={};Ga.apply=function(e){var t=this._private,n=t.cy.collection();t.newStyle&&(t.contextStyles={},t.propDiffs={},this.cleanElements(e,!0));for(var r=0;r<e.length;r++){var i=e[r],a=this.getContextMeta(i);if(!a.empty){var o=this.getContextStyle(a),s=this.applyContextStyle(a,o,i);t.newStyle||this.updateTransitions(i,s.diffProps),this.updateStyleHints(i)&&n.merge(i)}}return t.newStyle=!1,n},Ga.getPropertiesDiff=function(e,t){var n=this._private.propDiffs=this._private.propDiffs||{},r=e+"-"+t,i=n[r];if(i)return i;for(var a=[],o={},s=0;s<this.length;s++){var l=this[s],u="t"===e[s],c="t"===t[s],h=u!==c,d=l.mappedProperties.length>0;if(h||c&&d){var p=void 0;h&&d?p=l.properties:h?p=l.properties:d&&(p=l.mappedProperties);for(var f=0;f<p.length;f++){for(var g=p[f],v=g.name,y=!1,m=s+1;m<this.length;m++){var b=this[m];if("t"===t[m]&&(y=null!=b.properties[g.name]))break}o[v]||y||(o[v]=!0,a.push(v))}}}return n[r]=a,a},Ga.getContextMeta=function(e){var t,n="",r=e._private.styleCxtKey||"";this._private.newStyle&&(r="");for(var i=0;i<this.length;i++){var a=this[i];n+=a.selector&&a.selector.matches(e)?"t":"f"}return t=this.getPropertiesDiff(r,n),e._private.styleCxtKey=n,{key:n,diffPropNames:t,empty:0===t.length}},Ga.getContextStyle=function(e){var t=e.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var r={_private:{key:t}},i=0;i<this.length;i++){var a=this[i];if("t"===t[i])for(var o=0;o<a.properties.length;o++){var s=a.properties[o];r[s.name]=s}}return n[t]=r,r},Ga.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,i={},a=this.types,o=0;o<r.length;o++){var s=r[o],l=t[s],u=n.pstyle(s);if(!l){if(!u)continue;l=u.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0}}if(u!==l){if(l.mapped===a.fn&&null!=u&&null!=u.mapping&&u.mapping.value===l.value){var c=u.mapping;if((c.fnValue=l.value(n))===c.prevFnValue)continue}var h=i[s]={prev:u};this.applyParsedProperty(n,l),h.next=n.pstyle(s),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},Ga.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;r=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];t.styleKeys[c]=0}for(var h=function(e,n){return t.styleKeys[n]=ue(e,t.styleKeys[n])},d=function(e,t){for(var n=0;n<e.length;n++)h(e.charCodeAt(n),t)},p=function(e){return-128<e&&e<128&&Math.floor(e)!==e?-(1024*e|0):e},f=0;f<r.length;f++){var g=r[f],v=l[g];if(null!=v){var y=this.properties[g],m=y.type,b=y.groupKey,x=void 0;null!=y.hashOverride?x=y.hashOverride(e,v):null!=v.pfValue&&(x=v.pfValue);var w=null==y.enums?v.value:null,E=null!=x,k=E||null!=w,C=v.units;if(m.number&&k){var S=E?x:w;if(m.multiple)for(var D=0;D<S.length;D++)h(p(S[D]),b);else h(p(S),b);E||null==C||d(C,b)}else d(v.strValue,b)}}for(var P=0,T=0;T<i.length;T++){var M=i[T],B=t.styleKeys[M];P=ue(B,P)}t.styleKey=P;var _=t.labelDimsKey=t.styleKeys.labelDimensions;if(t.labelKey=a(e,["label"],_),t.labelStyleKey=ue(t.styleKeys.commonLabel,t.labelKey),s||(t.sourceLabelKey=a(e,["source-label"],_),t.sourceLabelStyleKey=ue(t.styleKeys.commonLabel,t.sourceLabelKey),t.targetLabelKey=a(e,["target-label"],_),t.targetLabelStyleKey=ue(t.styleKeys.commonLabel,t.targetLabelKey)),s){var N=t.styleKeys,I=N.nodeBody,z=N.nodeBorder,L=N.backgroundImage,A=N.compound,O=N.pie;t.nodeKey=ce([z,L,A,O],I),t.hasPie=0!=O}return o!==t.styleKey},Ga.clearStyleHints=function(e){var t=e._private;t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},Ga.applyParsedProperty=function(e,t){var n,r=this,i=t,a=e._private.style,o=r.types,s=r.properties[i.name].type,l=i.bypass,u=a[i.name],c=u&&u.bypass,h=e._private,d=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},p=function(){var t=d(u),n=d(i);r.checkTriggers(e,i.name,t,n)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(i=t=this.parse(t.name,"bezier",l)),i.delete)return a[i.name]=void 0,p(),!0;if(i.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,p(),!0):(p(),!0);if(i.deleteBypass)return u?!!u.bypass&&(a[i.name]=u.bypassed,p(),!0):(p(),!0);var f=function(){Ce("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+i.name+"` with data field `"+i.field+"`); try a `["+i.field+"]` selector to limit scope to elements with `"+i.field+"` defined")};switch(i.mapped){case o.mapData:for(var g,y=i.field.split("."),m=h.data,b=0;b<y.length&&m;b++){m=m[y[b]]}if(null==m)return f(),!1;if(!v(m))return Ce("Do not use continuous mappers without specifying numeric data (i.e. `"+i.field+": "+m+"` for `"+e.id()+"` is non-numeric)"),!1;var x=i.fieldMax-i.fieldMin;if((g=0===x?0:(m-i.fieldMin)/x)<0?g=0:g>1&&(g=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],k=i.valueMin[1],C=i.valueMax[1],S=i.valueMin[2],D=i.valueMax[2],P=null==i.valueMin[3]?1:i.valueMin[3],T=null==i.valueMax[3]?1:i.valueMax[3],M=[Math.round(w+(E-w)*g),Math.round(k+(C-k)*g),Math.round(S+(D-S)*g),Math.round(P+(T-P)*g)];n={bypass:i.bypass,name:i.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else{if(!s.number)return!1;var B=i.valueMin+(i.valueMax-i.valueMin)*g;n=this.parse(i.name,B,i.bypass,"mapping")}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var _=i.field.split("."),N=h.data,I=0;I<_.length&&N;I++){N=N[_[I]]}if(null!=N&&(n=this.parse(i.name,N,i.bypass,"mapping")),!n)return f(),!1;n.mapping=i,i=n;break;case o.fn:var z=i.value,L=null!=i.fnValue?i.fnValue:z(e);if(i.prevFnValue=L,null==L)return Ce("Custom function mappers may not return null (i.e. `"+i.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(n=this.parse(i.name,L,i.bypass,"mapping")))return Ce("Custom function mappers may not return invalid values for the property type (i.e. `"+i.name+"` for ele `"+e.id()+"` is invalid)"),!1;n.mapping=Se(i),i=n;break;case void 0:break;default:return!1}return l?(i.bypassed=c?u.bypassed:u,a[i.name]=i):c?u.bypassed=i:a[i.name]=i,p(),!0},Ga.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),t)for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else r._private.style={}}},Ga.update=function(){this._private.cy.mutableElements().updateStyle()},Ga.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,u=0;u<i.length;u++){var c=i[u],h=e.pstyle(c),d=t[c];if(d){var p=d.prev,g=null!=d.next?d.next:h,y=!1,m=void 0;p&&(v(p.pfValue)&&v(g.pfValue)?(y=g.pfValue-p.pfValue,m=p.pfValue+1e-6*y):v(p.value)&&v(g.value)?(y=g.value-p.value,m=p.value+1e-6*y):f(p.value)&&f(g.value)&&(y=p.value[0]!==g.value[0]||p.value[1]!==g.value[1]||p.value[2]!==g.value[2],m=p.strValue),y&&(s[c]=g.strValue,this.applyBypass(e,c,m),l=!0))}}if(!l)return;r.transitioning=!0,new sr(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Ga.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Ga.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},Ga.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),"bezier"!==e.pstyle("curve-style").value&&("curve-style"!==t||"bezier"!==n&&"bezier"!==r)||!i.triggersBoundsOfParallelBeziers||e.parallelEdges().forEach(function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()})})},Ga.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Za={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name,s=this.parse(o,n,!0);s&&i.push(s)}}else if(d(t)){var l=this.parse(t,n,!0);l&&i.push(l)}else{if(!g(t))return!1;var u=t;r=n;for(var c=Object.keys(u),h=0;h<c.length;h++){var p=c[h],f=u[p];if(void 0===f&&(f=u[T(p)]),void 0!==f){var v=this.parse(p,f,!0);v&&i.push(v)}}}if(0===i.length)return!1;for(var y=!1,m=0;m<e.length;m++){for(var b=e[m],x={},w=void 0,E=0;E<i.length;E++){var k=i[E];if(r){var C=b.pstyle(k.name);w=x[k.name]={prev:C}}y=this.applyParsedProperty(b,k)||y,r&&(w.next=b.pstyle(k.name))}y&&this.updateStyleHints(b),r&&this.updateTransitions(b,x,!0)}return y},overrideBypass:function(e,t,n){t=P(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),a.strValue=s?"rgb("+n.join(",")+")":l?n.join(" "):""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,t,u,n)}},removeAllBypasses:function(e,t){return this.removeBypasses(e,this.propertyNames,t)},removeBypasses:function(e,t,n){for(var r=0;r<e.length;r++){for(var i=e[r],a={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=i.pstyle(l.name);if(u&&u.bypass){var c=this.parse(s,"",!0),h=a[l.name]={prev:u};this.applyParsedProperty(i,c),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,a,!0)}}},Ua={getEmSizeInPixels:function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},containerCss:function(e){var t=this._private.cy.container();if(a&&t&&a.getComputedStyle)return a.getComputedStyle(t).getPropertyValue(e)}},$a={getRenderedStyle:function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},getRawStyle:function(e,t){if(e=e[0]){for(var n={},r=0;r<this.properties.length;r++){var i=this.properties[r],a=this.getStylePropertyValue(e,i.name,t);null!=a&&(n[i.name]=a,n[T(i.name)]=a)}return n}},getIndexedStyle:function(e,t,n,r){var i=e.pstyle(t)[n][r];return null!=i?i:e.cy().style().getDefaultProperty(t)[n][0]},getStylePropertyValue:function(e,t,n){if(e=e[0]){var r=this.properties[t];r.alias&&(r=r.pointsTo);var i=r.type,a=e.pstyle(r.name);if(a){var o=a.value,s=a.units,l=a.strValue;if(n&&i.number&&null!=o&&v(o)){var u=e.cy().zoom(),c=function(e){return e*u},h=function(e,t){return c(e)+t},p=f(o);return(p?s.every(function(e){return null!=e}):null!=s)?p?o.map(function(e,t){return h(e,s[t])}).join(" "):h(o,s):p?o.map(function(e){return d(e)?e:""+c(e)}).join(" "):""+c(o)}if(null!=l)return l}return null}},getAnimationStartStyle:function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);void 0!==a&&(a=g(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},getPropsList:function(e){var t=[],n=e,r=this.properties;if(n)for(var i=Object.keys(n),a=0;a<i.length;a++){var o=i[a],s=n[o],l=r[o]||r[P(o)],u=this.parse(l.name,s);u&&t.push(u)}return t},getNonDefaultPropertiesHash:function(e,t,n){var r,i,a,o,s,l,u=n;for(s=0;s<t.length;s++)if(r=t[s],null!=(i=e.pstyle(r,!1)))if(null!=i.pfValue)u=ue(o,u);else for(a=i.strValue,l=0;l<a.length;l++)o=a.charCodeAt(l),u=ue(o,u);return u}};$a.getPropertiesHash=$a.getNonDefaultPropertiesHash;var Qa={appendFromJson:function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n.selector,i=n.style||n.css,a=Object.keys(i);this.selector(r);for(var o=0;o<a.length;o++){var s=a[o],l=i[s];this.css(s,l)}}return this},fromJson:function(e){return this.resetToDefault(),this.appendFromJson(e),this},json:function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e}},Ja={appendFromString:function(e){var t,n,r,i=""+e;function a(){i=i.length>t.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[\/][*](\s|.)+?[*][\/]/g,"");;){if(i.match(/^\s*$/))break;var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){Ce("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l)if(new Kr(l).invalid){Ce("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var h=[];;){if(n.match(/^\s*$/))break;var d=n.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!d){Ce("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=d[0];var p=d[1],f=d[2];if(this.properties[p])this.parse(p,f)?(h.push({name:p,val:f}),o()):(Ce("Skipping property: Invalid property definition in: "+r),o());else Ce("Skipping property: Invalid property name in: "+r),o()}if(c){a();break}this.selector(l);for(var g=0;g<h.length;g++){var v=h[g];this.css(v.name,v.val)}a()}return this},fromString:function(e){return this.resetToDefault(),this.appendFromString(e),this}},eo={};!function(){var e=_,t=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},n=function(t){var n=e+"|\\w+|rgb[a]?\\((?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)(?:\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)|hsl[a]?\\((?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+t+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+n+")\\s*\\,\\s*("+n+")\\)$"},r=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];eo.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials"],multiple:!0},bgClip:{enums:["none","node"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","taxi"]},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","square","pentagon","hexagon","concavehexagon","concave-hexagon","heptagon","octagon","tag","star","diamond","vee","rhomboid","polygon"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:t("data")},layoutData:{mapping:!0,regex:t("layoutData")},scratch:{mapping:!0,regex:t("scratch")},mapData:{mapping:!0,regex:n("mapData")},mapLayoutData:{mapping:!0,regex:n("mapLayoutData")},mapScratch:{mapping:!0,regex:n("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:r,singleRegexMatchValue:!0},urls:{regexes:r,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return d(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]}};var i={zeroNonZero:function(e,t){return(null==e||null==t)&&e!==t||(0==e&&0!=t||0!=e&&0==t)},any:function(e,t){return e!=t}},a=eo.types,o=[{name:"label",type:a.text,triggersBounds:i.any},{name:"text-rotation",type:a.textRotation,triggersBounds:i.any},{name:"text-margin-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"text-margin-y",type:a.bidirectionalSize,triggersBounds:i.any}],s=[{name:"source-label",type:a.text,triggersBounds:i.any},{name:"source-text-rotation",type:a.textRotation,triggersBounds:i.any},{name:"source-text-margin-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"source-text-margin-y",type:a.bidirectionalSize,triggersBounds:i.any},{name:"source-text-offset",type:a.size,triggersBounds:i.any}],l=[{name:"target-label",type:a.text,triggersBounds:i.any},{name:"target-text-rotation",type:a.textRotation,triggersBounds:i.any},{name:"target-text-margin-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"target-text-margin-y",type:a.bidirectionalSize,triggersBounds:i.any},{name:"target-text-offset",type:a.size,triggersBounds:i.any}],u=[{name:"font-family",type:a.fontFamily,triggersBounds:i.any},{name:"font-style",type:a.fontStyle,triggersBounds:i.any},{name:"font-weight",type:a.fontWeight,triggersBounds:i.any},{name:"font-size",type:a.size,triggersBounds:i.any},{name:"text-transform",type:a.textTransform,triggersBounds:i.any},{name:"text-wrap",type:a.textWrap,triggersBounds:i.any},{name:"text-overflow-wrap",type:a.textOverflowWrap,triggersBounds:i.any},{name:"text-max-width",type:a.size,triggersBounds:i.any},{name:"text-outline-width",type:a.size,triggersBounds:i.any},{name:"line-height",type:a.positiveNumber,triggersBounds:i.any}],c=[{name:"text-valign",type:a.valign,triggersBounds:i.any},{name:"text-halign",type:a.halign,triggersBounds:i.any},{name:"color",type:a.color},{name:"text-outline-color",type:a.color},{name:"text-outline-opacity",type:a.zeroOneNumber},{name:"text-background-color",type:a.color},{name:"text-background-opacity",type:a.zeroOneNumber},{name:"text-background-padding",type:a.size,triggersBounds:i.any},{name:"text-border-opacity",type:a.zeroOneNumber},{name:"text-border-color",type:a.color},{name:"text-border-width",type:a.size,triggersBounds:i.any},{name:"text-border-style",type:a.borderStyle,triggersBounds:i.any},{name:"text-background-shape",type:a.textBackgroundShape,triggersBounds:i.any},{name:"text-justification",type:a.justification}],h=[{name:"events",type:a.bool},{name:"text-events",type:a.bool}],p=[{name:"display",type:a.display,triggersZOrder:i.any,triggersBounds:i.any,triggersBoundsOfParallelBeziers:!0},{name:"visibility",type:a.visibility,triggersZOrder:i.any},{name:"opacity",type:a.zeroOneNumber,triggersZOrder:i.zeroNonZero},{name:"text-opacity",type:a.zeroOneNumber},{name:"min-zoomed-font-size",type:a.size},{name:"z-compound-depth",type:a.zCompoundDepth,triggersZOrder:i.any},{name:"z-index-compare",type:a.zIndexCompare,triggersZOrder:i.any},{name:"z-index",type:a.nonNegativeInt,triggersZOrder:i.any}],f=[{name:"overlay-padding",type:a.size,triggersBounds:i.any},{name:"overlay-color",type:a.color},{name:"overlay-opacity",type:a.zeroOneNumber,triggersBounds:i.zeroNonZero}],g=[{name:"transition-property",type:a.propList},{name:"transition-duration",type:a.time},{name:"transition-delay",type:a.time},{name:"transition-timing-function",type:a.easing}],v=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},y=[{name:"height",type:a.nodeSize,triggersBounds:i.any,hashOverride:v},{name:"width",type:a.nodeSize,triggersBounds:i.any,hashOverride:v},{name:"shape",type:a.nodeShape,triggersBounds:i.any},{name:"shape-polygon-points",type:a.polygonPointList,triggersBounds:i.any},{name:"background-color",type:a.color},{name:"background-fill",type:a.fill},{name:"background-opacity",type:a.zeroOneNumber},{name:"background-blacken",type:a.nOneOneNumber},{name:"background-gradient-stop-colors",type:a.colors},{name:"background-gradient-stop-positions",type:a.percentages},{name:"background-gradient-direction",type:a.gradientDirection},{name:"padding",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"padding-relative-to",type:a.paddingRelativeTo,triggersBounds:i.any},{name:"bounds-expansion",type:a.size,triggersBounds:i.any}],m=[{name:"border-color",type:a.color},{name:"border-opacity",type:a.zeroOneNumber},{name:"border-width",type:a.size,triggersBounds:i.any},{name:"border-style",type:a.borderStyle}],b=[{name:"background-image",type:a.urls},{name:"background-image-crossorigin",type:a.bgCrossOrigin},{name:"background-image-opacity",type:a.zeroOneNumbers},{name:"background-position-x",type:a.bgPos},{name:"background-position-y",type:a.bgPos},{name:"background-width-relative-to",type:a.bgRelativeTo},{name:"background-height-relative-to",type:a.bgRelativeTo},{name:"background-repeat",type:a.bgRepeat},{name:"background-fit",type:a.bgFit},{name:"background-clip",type:a.bgClip},{name:"background-width",type:a.bgWH},{name:"background-height",type:a.bgWH},{name:"background-offset-x",type:a.bgPos},{name:"background-offset-y",type:a.bgPos}],x=[{name:"position",type:a.position,triggersBounds:i.any},{name:"compound-sizing-wrt-labels",type:a.compoundIncludeLabels,triggersBounds:i.any},{name:"min-width",type:a.size,triggersBounds:i.any},{name:"min-width-bias-left",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"min-width-bias-right",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"min-height",type:a.size,triggersBounds:i.any},{name:"min-height-bias-top",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"min-height-bias-bottom",type:a.sizeMaybePercent,triggersBounds:i.any}],w=[{name:"line-style",type:a.lineStyle},{name:"line-color",type:a.color},{name:"line-fill",type:a.fill},{name:"line-cap",type:a.lineCap},{name:"line-dash-pattern",type:a.numbers},{name:"line-dash-offset",type:a.number},{name:"line-gradient-stop-colors",type:a.colors},{name:"line-gradient-stop-positions",type:a.percentages},{name:"curve-style",type:a.curveStyle,triggersBounds:i.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:a.zeroOneNumber,triggersBounds:i.any},{name:"source-endpoint",type:a.edgeEndpoint,triggersBounds:i.any},{name:"target-endpoint",type:a.edgeEndpoint,triggersBounds:i.any},{name:"control-point-step-size",type:a.size,triggersBounds:i.any},{name:"control-point-distances",type:a.bidirectionalSizes,triggersBounds:i.any},{name:"control-point-weights",type:a.numbers,triggersBounds:i.any},{name:"segment-distances",type:a.bidirectionalSizes,triggersBounds:i.any},{name:"segment-weights",type:a.numbers,triggersBounds:i.any},{name:"taxi-turn",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"taxi-turn-min-distance",type:a.size,triggersBounds:i.any},{name:"taxi-direction",type:a.axisDirection,triggersBounds:i.any},{name:"edge-distances",type:a.edgeDistances,triggersBounds:i.any},{name:"arrow-scale",type:a.positiveNumber,triggersBounds:i.any},{name:"loop-direction",type:a.angle,triggersBounds:i.any},{name:"loop-sweep",type:a.angle,triggersBounds:i.any},{name:"source-distance-from-node",type:a.size,triggersBounds:i.any},{name:"target-distance-from-node",type:a.size,triggersBounds:i.any}],E=[{name:"ghost",type:a.bool,triggersBounds:i.any},{name:"ghost-offset-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"ghost-offset-y",type:a.bidirectionalSize,triggersBounds:i.any},{name:"ghost-opacity",type:a.zeroOneNumber}],k=[{name:"selection-box-color",type:a.color},{name:"selection-box-opacity",type:a.zeroOneNumber},{name:"selection-box-border-color",type:a.color},{name:"selection-box-border-width",type:a.size},{name:"active-bg-color",type:a.color},{name:"active-bg-opacity",type:a.zeroOneNumber},{name:"active-bg-size",type:a.size},{name:"outside-texture-bg-color",type:a.color},{name:"outside-texture-bg-opacity",type:a.zeroOneNumber}],C=[];eo.pieBackgroundN=16,C.push({name:"pie-size",type:a.sizeMaybePercent});for(var S=1;S<=eo.pieBackgroundN;S++)C.push({name:"pie-"+S+"-background-color",type:a.color}),C.push({name:"pie-"+S+"-background-size",type:a.percent}),C.push({name:"pie-"+S+"-background-opacity",type:a.zeroOneNumber});var D=[],P=eo.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:a.arrowShape,triggersBounds:i.any},{name:"arrow-color",type:a.color},{name:"arrow-fill",type:a.arrowFill}].forEach(function(e){P.forEach(function(t){var n=t+"-"+e.name,r=e.type,i=e.triggersBounds;D.push({name:n,type:r,triggersBounds:i})})},{});var T=eo.properties=[].concat(h,g,p,f,E,c,u,o,s,l,y,m,b,C,x,w,D,k),M=eo.propertyGroups={behavior:h,transition:g,visibility:p,overlay:f,ghost:E,commonLabel:c,labelDimensions:u,mainLabel:o,sourceLabel:s,targetLabel:l,nodeBody:y,nodeBorder:m,backgroundImage:b,pie:C,compound:x,edgeLine:w,edgeArrow:D,core:k},B=eo.propertyGroupNames={};(eo.propertyGroupKeys=Object.keys(M)).forEach(function(e){B[e]=M[e].map(function(e){return e.name}),M[e].forEach(function(t){return t.groupKey=e})});var N=eo.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];eo.propertyNames=T.map(function(e){return e.name});for(var I=0;I<T.length;I++){var z=T[I];T[z.name]=z}for(var L=0;L<N.length;L++){var A=N[L],O=T[A.pointsTo],R={name:A.name,alias:!0,pointsTo:O};T.push(R),T[A.name]=R}}(),eo.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},eo.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=I({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1,   1, -1,   1, 1,   -1, 1","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(e,t){for(var n=1;n<=eo.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"taxi-turn":"50%","taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"}].reduce(function(e,t){return eo.arrowPrefixes.forEach(function(n){var r=n+"-"+t.name,i=t.value;e[r]=i}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);n[a]=s}}return e.defaultProperties=n,e.defaultProperties},eo.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var to={parse:function(e,t,n,r){if(p(t))return this.parseImplWarn(e,t,n,r);var i,a=de(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),o=this.propCache=this.propCache||[];return(i=o[a])||(i=o[a]=this.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(i=Se(i))&&(i.value=Se(i.value)),i},parseImplWarn:function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return i||null==t||Ce("The style property `".concat(e,": ").concat(t,"` is invalid")),i}};to.parseImpl=function(e,t,n,r){e=P(e);var i=this.properties[e],a=t,o=this.types;if(!i)return null;if(void 0===t)return null;i.alias&&(i=i.pointsTo,e=i.name);var s=d(t);s&&(t=t.trim());var l,u,c=i.type;if(!c)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(p(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};if(!s||r||t.length<7||"a"!==t[1]);else{if(t.length>=7&&"d"===t[0]&&(l=new RegExp(o.data.regex).exec(t))){if(n)return!1;var h=o.data;return{name:e,value:l,strValue:""+t,mapped:h,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(u=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;var g=o.mapData;if(!c.color&&!c.number)return!1;var y=this.parse(e,u[4]);if(!y||y.mapped)return!1;var m=this.parse(e,u[5]);if(!m||m.mapped)return!1;if(y.pfValue===m.pfValue||y.strValue===m.strValue)return Ce("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+y.strValue+"`"),this.parse(e,y.strValue);if(c.color){var b=y.value,x=m.value;if(!(b[0]!==x[0]||b[1]!==x[1]||b[2]!==x[2]||b[3]!==x[3]&&(null!=b[3]&&1!==b[3]||null!=x[3]&&1!==x[3])))return!1}return{name:e,value:u,strValue:""+t,mapped:g,field:u[1],fieldMin:parseFloat(u[2]),fieldMax:parseFloat(u[3]),valueMin:y.value,valueMax:m.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var w;if(w=s?t.split(/\s+/):f(t)?t:[t],c.evenMultiple&&w.length%2!=0)return null;for(var E=[],k=[],C=[],S="",D=!1,T=0;T<w.length;T++){var M=this.parse(e,w[T],n,"multiple");D=D||d(M.value),E.push(M.value),C.push(null!=M.pfValue?M.pfValue:M.value),k.push(M.units),S+=(T>0?" ":"")+M.strValue}return c.validate&&!c.validate(E,k)?null:c.singleEnum&&D?1===E.length&&d(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:C,strValue:S,bypass:n,units:k}}var B,N=function(){for(var r=0;r<c.enums.length;r++){if(c.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(c.number){var I,L="px";if(c.units&&(I=c.units),c.implicitUnits&&(L=c.implicitUnits),!c.unitless)if(s){var A="px|em"+(c.allowPercent?"|\\%":"");I&&(A=I);var O=t.match("^("+_+")("+A+")?$");O&&(t=O[1],I=O[2]||L)}else I&&!c.implicitUnits||(I=L);if(t=parseFloat(t),isNaN(t)&&void 0===c.enums)return null;if(isNaN(t)&&void 0!==c.enums)return t=a,N();if(c.integer&&(!v(B=t)||Math.floor(B)!==B))return null;if(void 0!==c.min&&(t<c.min||c.strictMin&&t===c.min)||void 0!==c.max&&(t>c.max||c.strictMax&&t===c.max))return null;var R={name:e,value:t,strValue:""+t+(I||""),units:I,bypass:n};return c.unitless||"px"!==I&&"em"!==I?R.pfValue=t:R.pfValue="px"!==I&&I?this.getEmSizeInPixels()*t:t,"ms"!==I&&"s"!==I||(R.pfValue="ms"===I?t:1e3*t),"deg"!==I&&"rad"!==I||(R.pfValue="rad"===I?t:lt(t)),"%"===I&&(R.pfValue=t/100),R}if(c.propList){var F=[],V=""+t;if("none"===V);else{for(var q=V.split(/\s*,\s*|\s+/),j=0;j<q.length;j++){var Y=q[j].trim();this.properties[Y]?F.push(Y):Ce("`"+Y+"` is not a valid property name")}if(0===F.length)return null}return{name:e,value:F,strValue:0===F.length?"none":F.join(" "),bypass:n}}if(c.color){var X=z(t);return X?{name:e,value:X,pfValue:X,strValue:"rgb("+X[0]+","+X[1]+","+X[2]+")",bypass:n}:null}if(c.regex||c.regexes){if(c.enums){var W=N();if(W)return W}for(var H=c.regexes?c.regexes:[c.regex],K=0;K<H.length;K++){var G=new RegExp(H[K]).exec(t);if(G)return{name:e,value:c.singleRegexMatchValue?G[1]:G,strValue:""+t,bypass:n}}return null}return c.string?{name:e,value:""+t,strValue:""+t,bypass:n}:c.enums?N():null};var no=function e(t){if(!(this instanceof e))return new e(t);w(t)?(this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()):Ee("A style must have a core reference")},ro=no.prototype;ro.instanceString=function(){return"style"},ro.clear=function(){for(var e=0;e<this.length;e++)this[e]=void 0;return this.length=0,this._private.newStyle=!0,this},ro.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},ro.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},ro.selector=function(e){var t="core"===e?null:new Kr(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},ro.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],n=0;n<this.properties.length;n++){var r=this.properties[n],i=t[r.name];void 0===i&&(i=t[T(r.name)]),void 0!==i&&this.cssRule(r.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},ro.style=ro.css,ro.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n),!this[r].selector&&(this._private.coreStyle[n.name]=n)}return this},ro.append=function(e){return E(e)?e.appendToStyle(this):f(e)?this.appendFromJson(e):d(e)&&this.appendFromString(e),this},no.fromJson=function(e,t){var n=new no(e);return n.fromJson(t),n},no.fromString=function(e,t){return new no(e).fromString(t)},[Ga,Za,Ua,$a,Qa,Ja,eo,to].forEach(function(e){I(ro,e)}),no.types=ro.types,no.properties=ro.properties,no.propertyGroups=ro.propertyGroups,no.propertyGroupNames=ro.propertyGroupNames,no.propertyGroupKeys=ro.propertyGroupKeys;var io={style:function(e){e&&this.setStyle(e).update();return this._private.style},setStyle:function(e){var t=this._private;return E(e)?t.style=e.generateStyle(this):f(e)?t.style=no.fromJson(this,e):d(e)?t.style=no.fromString(this,e):t.style=no(this),t.style}},ao={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return null==t.selectionType&&(t.selectionType="single"),void 0===e?t.selectionType:("additive"!==e&&"single"!==e||(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(d(a[0]))return o[e=a[0]];if(g(a[0])){if(!this._private.panningEnabled)return this;r=(n=a[0]).x,i=n.y,v(r)&&(o.x=r),v(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],"x"!==e&&"y"!==e||!v(t)||(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a,o,s=arguments,l=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:g(e)&&(a=(i=s[0]).x,o=i.y,v(a)&&(l.x+=a),v(o)&&(l.y+=o),this.emit("pan viewport"));break;case 2:r=t,"x"!==(n=e)&&"y"!==n||!v(r)||(l[n]+=r),this.emit("pan viewport")}return this.notify("viewport"),this},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(v(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n,r;if(d(e)){var i=e;e=this.$(i)}else if(g(r=e)&&v(r.x1)&&v(r.x2)&&v(r.y1)&&v(r.y2)){var a=e;(n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else m(e)||(e=this.mutableElements());if(!m(e)||!e.empty()){n=n||e.boundingBox();var o,s=this.width(),l=this.height();if(t=v(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)<this._private.minZoom?this._private.minZoom:o,pan:{x:(s-o*(n.x1+n.x2))/2,y:(l-o*(n.y1+n.y2))/2}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return v(e)&&v(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):v(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:v(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),v(e)?n=e:g(e)&&(n=e.level,null!=e.position?t=tt(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!v(n)||n===a||null!=t&&(!v(t.x)||!v(t.y)))return null;if(null!=t){var s=i,l=a,u=n;return{zoomed:!0,panned:!0,zoom:u,pan:{x:-u/l*(t.x-s.x)+t.x,y:-u/l*(t.y-s.y)+t.y}}}return{zoomed:!0,panned:!1,zoom:n,pan:i}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed?(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this):this},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e)return this;if(v(e.zoom)||(n=!1),g(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;v(l.x)&&(t.pan.x=l.x,o=!1),v(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(d(e)){var n=e;e=this.mutableElements().filter(n)}else m(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=a.getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}}};ao.centre=ao.center,ao.autolockNodes=ao.autolock,ao.autoungrabifyNodes=ao.autoungrabify;var oo={data:cr.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0}),removeData:cr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0}),scratch:cr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0}),removeScratch:cr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0})};oo.attr=oo.data,oo.removeAttr=oo.removeData;var so=function(e){var t=this,n=(e=I({},e)).container;n&&!y(n)&&y(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var o=void 0!==a&&void 0!==n&&!e.headless,s=e;s.layout=I({name:o?"grid":"null"},s.layout),s.renderer=I({name:o?"canvas":"null"},s.renderer);var l=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},u=this._private={container:n,ready:!1,options:s,elements:new Ca(this),listeners:[],aniEles:new Ca(this),data:{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,s.zoomingEnabled),userZoomingEnabled:l(!0,s.userZoomingEnabled),panningEnabled:l(!0,s.panningEnabled),userPanningEnabled:l(!0,s.userPanningEnabled),boxSelectionEnabled:l(!0,s.boxSelectionEnabled),autolock:l(!1,s.autolock,s.autolockNodes),autoungrabify:l(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:l(!1,s.autounselectify),styleEnabled:void 0===s.styleEnabled?o:s.styleEnabled,zoom:v(s.zoom)?s.zoom:1,pan:{x:g(s.pan)&&v(s.pan.x)?s.pan.x:0,y:g(s.pan)&&v(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});u.styleEnabled&&t.setStyle([]);var c=I({},s,s.renderer);t.initRenderer(c);!function(e,t){if(e.some(C))return sr.all(e).then(t);t(e)}([s.style,s.elements],function(e){var n=e[0],a=e[1];u.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(g(e)||f(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var a=I({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,function(){t.startAnimationLoop(),u.ready=!0,p(s.ready)&&t.on("ready",s.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")},s.done)})},lo=so.prototype;I(lo,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},mount:function(e){if(null!=e){var t=this,n=t._private,r=n.options;return!y(e)&&y(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(I({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Se(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements();if(g(e)){if(t.startBatch(),e.elements){var i={},a=function(e,n){for(var r=[],a=[],o=0;o<e.length;o++){var s=e[o],l=""+s.data.id,u=t.getElementById(l);i[l]=!0,0!==u.length?a.push({ele:u,json:s}):n?(s.group=n,r.push(s)):r.push(s)}t.add(r);for(var c=0;c<a.length;c++){var h=a[c],d=h.ele,p=h.json;d.json(p)}};if(f(e.elements))a(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];f(u)&&a(u,l)}var c=t.collection();r.filter(function(e){return!i[e.id()]}).forEach(function(e){e.isParent()?c.merge(e):e.remove()}),c.forEach(function(e){return e.children().move({parent:null})}),c.forEach(function(e){return function(e){return t.getElementById(e.id())}(e).remove()})}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x===n.pan.x&&e.pan.y===n.pan.y||t.pan(e.pan)),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify"],d=0;d<h.length;d++){var p=h[d];null!=e[p]&&t[p](e[p])}return t.endBatch(),this}var v={};!!e?v.elements=this.elements().map(function(e){return e.json()}):(v.elements={},r.forEach(function(e){var t=e.group();v.elements[t]||(v.elements[t]=[]),v.elements[t].push(e.json())})),this._private.styleEnabled&&(v.style=t.style().json()),v.data=Se(t.data());var y=n.options;return v.zoomingEnabled=n.zoomingEnabled,v.userZoomingEnabled=n.userZoomingEnabled,v.zoom=n.zoom,v.minZoom=n.minZoom,v.maxZoom=n.maxZoom,v.panningEnabled=n.panningEnabled,v.userPanningEnabled=n.userPanningEnabled,v.pan=Se(n.pan),v.boxSelectionEnabled=n.boxSelectionEnabled,v.renderer=Se(y.renderer),v.hideEdgesOnViewport=y.hideEdgesOnViewport,v.textureOnViewport=y.textureOnViewport,v.wheelSensitivity=y.wheelSensitivity,v.motionBlur=y.motionBlur,v}}),lo.$id=lo.getElementById,[Da,Ra,qa,ja,Ya,Xa,Ha,Ka,io,ao,oo].forEach(function(e){I(lo,e)});var uo={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,maximal:!1,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},co=function(e){return e.scratch("breadthfirst")},ho=function(e,t){return e.scratch("breadthfirst",t)};function po(e){this.options=I({},uo,e)}po.prototype.run=function(){var e,t=this.options,n=t,r=t.cy,i=n.eles,a=i.nodes().filter(function(e){return!e.isParent()}),o=i,s=n.directed,l=n.maximal||n.maximalAdjustments>0,u=bt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(m(n.roots))e=n.roots;else if(f(n.roots)){for(var c=[],h=0;h<n.roots.length;h++){var p=n.roots[h],g=r.getElementById(p);c.push(g)}e=r.collection(c)}else if(d(n.roots))e=r.$(n.roots);else if(s)e=a.roots();else{var v=i.components();e=r.collection();for(var y=function(t){var n=v[t],r=n.maxDegree(!1),i=n.filter(function(e){return e.degree(!1)===r});e=e.add(i)},b=0;b<v.length;b++)y(b)}var x=[],w={},E=function(e,t){null==x[t]&&(x[t]=[]);var n=x[t].length;x[t].push(e),ho(e,{index:n,depth:t})};o.bfs({roots:e,directed:n.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();E(a,i),w[o]=!0}});for(var k=[],C=0;C<a.length;C++){var S=a[C];w[S.id()]||k.push(S)}var D=function(e){for(var t=x[e],n=0;n<t.length;n++){var r=t[n];null!=r?ho(r,{depth:e,index:n}):(t.splice(n,1),n--)}},P=function(){for(var e=0;e<x.length;e++)D(e)},T=function(e,t){for(var n=co(e),r=e.incomers().filter(function(e){return e.isNode()&&i.has(e)}),a=-1,o=e.id(),s=0;s<r.length;s++){var l=r[s],u=co(l);a=Math.max(a,u.depth)}return n.depth<=a&&(t[o]?null:(function(e,t){var n=co(e),r=n.depth,i=n.index;x[r][i]=null,E(e,t)}(e,a+1),t[o]=!0,!0))};if(s&&l){var M=[],B={},_=function(e){return M.push(e)};for(a.forEach(function(e){return M.push(e)});M.length>0;){var I=M.shift(),z=T(I,B);if(z)I.outgoers().filter(function(e){return e.isNode()&&i.has(e)}).forEach(_);else if(null===z){Ce("Detected double maximal shift for node `"+I.id()+"`.  Bailing maximal adjustment due to cycle.  Use `options.maximal: true` only on DAGs.");break}}}P();var L=0;if(n.avoidOverlap)for(var A=0;A<a.length;A++){var O=a[A].layoutDimensions(n),R=O.w,F=O.h;L=Math.max(L,R,F)}for(var V={},q=function(e){if(V[e.id()])return V[e.id()];for(var t=co(e).depth,n=e.neighborhood(),r=0,i=0,o=0;o<n.length;o++){var s=n[o];if(!s.isEdge()&&!s.isParent()&&a.has(s)){var l=co(s),u=l.index,c=l.depth;if(null!=u&&null!=c){var h=x[c].length;c<t&&(r+=u/(h-1),i++)}}}return r/=i=Math.max(1,i),0===i&&(r=0),V[e.id()]=r,r},j=function(e,t){var n=q(e)-q(t);return 0===n?N(e.id(),t.id()):n},Y=0;Y<x.length;Y++)x[Y].sort(j),D(Y);for(var X=[],W=0;W<k.length;W++)X.push(k[W]);x.unshift(X),P();for(var H=0,K=0;K<x.length;K++)H=Math.max(x[K].length,H);var G=u.x1+u.w/2,Z=u.x1+u.h/2,U=x.reduce(function(e,t){return Math.max(e,t.length)},0);return a.layoutPositions(this,n,function(e){var t=co(e),r=t.depth,i=t.index,a=x[r].length,o=Math.max(u.w/((n.grid?U:a)+1),L),s=Math.max(u.h/(x.length+1),L),l=Math.min(u.w/2/x.length,u.h/2/x.length);if(l=Math.max(l,L),n.circle){var c=l*r+l-(x.length>0&&x[0].length<=3?l/2:0),h=2*Math.PI/x[r].length*i;return 0===r&&1===x[0].length&&(c=1),{x:G+c*Math.cos(h),y:Z+c*Math.sin(h)}}return{x:G+(i+1-(a+1)/2)*o,y:(r+1)*s}}),this};var fo={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function go(e){this.options=I({},fo,e)}go.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=bt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),h=0,d=0;d<a.length;d++){var p=a[d].layoutDimensions(t),f=p.w,g=p.h;h=Math.max(h,f,g)}if(o=v(t.radius)?t.radius:a.length<=1?0:Math.min(s.h,s.w)/2-h,a.length>1&&t.avoidOverlap){h*=1.75;var y=Math.cos(c)-Math.cos(0),m=Math.sin(c)-Math.sin(0),b=Math.sqrt(h*h/(y*y+m*m));o=Math.max(b,o)}return a.layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}}),this};var vo,yo={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function mo(e){this.options=I({},yo,e)}mo.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles.nodes().not(":parent"),a=bt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o=a.x1+a.w/2,s=a.y1+a.h/2,l=[],u=0,c=0;c<i.length;c++){var h,d=i[c];h=t.concentric(d),l.push({value:h,node:d}),d._private.scratch.concentric=h}i.updateStyle();for(var p=0;p<i.length;p++){var f=i[p].layoutDimensions(t);u=Math.max(u,f.w,f.h)}l.sort(function(e,t){return t.value-e.value});for(var g=t.levelWidth(i),v=[[]],y=v[0],m=0;m<l.length;m++){var b=l[m];if(y.length>0)Math.abs(y[0].value-b.value)>=g&&(y=[],v.push(y));y.push(b)}var x=u+t.minNodeSpacing;if(!t.avoidOverlap){var w=v.length>0&&v[0].length>1,E=(Math.min(a.w,a.h)/2-x)/(v.length+w?1:0);x=Math.min(x,E)}for(var k=0,C=0;C<v.length;C++){var S=v[C],D=void 0===t.sweep?2*Math.PI-2*Math.PI/S.length:t.sweep,P=S.dTheta=D/Math.max(1,S.length-1);if(S.length>1&&t.avoidOverlap){var T=Math.cos(P)-Math.cos(0),M=Math.sin(P)-Math.sin(0),B=Math.sqrt(x*x/(T*T+M*M));k=Math.max(B,k)}S.r=k,k+=x}if(t.equidistant){for(var _=0,N=0,I=0;I<v.length;I++){var z=v[I].r-N;_=Math.max(_,z)}N=0;for(var L=0;L<v.length;L++){var A=v[L];0===L&&(N=A.r),A.r=N,N+=_}}for(var O={},R=0;R<v.length;R++)for(var F=v[R],V=F.dTheta,q=F.r,j=0;j<F.length;j++){var Y=F[j],X=t.startAngle+(n?1:-1)*V*j,W={x:o+q*Math.cos(X),y:s+q*Math.sin(X)};O[Y.node.id()]=W}return i.layoutPositions(this,t,function(e){var t=e.id();return O[t]}),this};var bo={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function xo(e){this.options=I({},bo,e),this.options.layout=this}xo.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,!0!==e.animate&&!1!==e.animate||n.emit({type:"layoutstart",layout:n}),vo=!0===e.debug;var r=wo(t,n,e);vo&&(void 0)(r),e.randomize&&Co(r,t);var i=se(),a=function(){Do(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter)&&(Po(r,e,t),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),i=So(r,e,t);t.layoutPositions(n,e,i)}},l=0,u=!0;if(!0===e.animate){!function t(){for(var n=0;u&&n<e.refresh;)u=o(l),l++,n++;u?(se()-i>=e.animationThreshold&&a(),oe(t)):(Fo(r,e),s())}()}else{for(;u;)u=o(l),l++;Fo(r,e),s()}return this},xo.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},xo.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var wo=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:bt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=n.eles.components(),s={},l=0;l<o.length;l++)for(var u=o[l],c=0;c<u.length;c++){s[u[c].id()]=l}for(l=0;l<a.nodeSize;l++){var h=(y=i[l]).layoutDimensions(n);(I={}).isLocked=y.locked(),I.id=y.data("id"),I.parentId=y.data("parent"),I.cmptId=s[y.id()],I.children=[],I.positionX=y.position("x"),I.positionY=y.position("y"),I.offsetX=0,I.offsetY=0,I.height=h.w,I.width=h.h,I.maxX=I.positionX+I.width/2,I.minX=I.positionX-I.width/2,I.maxY=I.positionY+I.height/2,I.minY=I.positionY-I.height/2,I.padLeft=parseFloat(y.style("padding")),I.padRight=parseFloat(y.style("padding")),I.padTop=parseFloat(y.style("padding")),I.padBottom=parseFloat(y.style("padding")),I.nodeRepulsion=p(n.nodeRepulsion)?n.nodeRepulsion(y):n.nodeRepulsion,a.layoutNodes.push(I),a.idToIndex[I.id]=l}var d=[],f=0,g=-1,v=[];for(l=0;l<a.nodeSize;l++){var y,m=(y=a.layoutNodes[l]).parentId;null!=m?a.layoutNodes[a.idToIndex[m]].children.push(y.id):(d[++g]=y.id,v.push(y.id))}for(a.graphSet.push(v);f<=g;){var b=d[f++],x=a.idToIndex[b],w=a.layoutNodes[x].children;if(w.length>0){a.graphSet.push(w);for(l=0;l<w.length;l++)d[++g]=w[l]}}for(l=0;l<a.graphSet.length;l++){var E=a.graphSet[l];for(c=0;c<E.length;c++){var k=a.idToIndex[E[c]];a.indexToGraph[k]=l}}for(l=0;l<a.edgeSize;l++){var C=r[l],S={};S.id=C.data("id"),S.sourceId=C.data("source"),S.targetId=C.data("target");var D=p(n.idealEdgeLength)?n.idealEdgeLength(C):n.idealEdgeLength,P=p(n.edgeElasticity)?n.edgeElasticity(C):n.edgeElasticity,T=a.idToIndex[S.sourceId],M=a.idToIndex[S.targetId];if(a.indexToGraph[T]!=a.indexToGraph[M]){for(var B=Eo(S.sourceId,S.targetId,a),_=a.graphSet[B],N=0,I=a.layoutNodes[T];-1===_.indexOf(I.id);)I=a.layoutNodes[a.idToIndex[I.parentId]],N++;for(I=a.layoutNodes[M];-1===_.indexOf(I.id);)I=a.layoutNodes[a.idToIndex[I.parentId]],N++;D*=N*n.nestingFactor}S.idealLength=D,S.elasticity=P,a.layoutEdges.push(S)}return a},Eo=function(e,t,n){var r=ko(e,t,0,n);return 2>r.count?0:r.graph},ko=function e(t,n,r,i){var a=i.graphSet[r];if(-1<a.indexOf(t)&&-1<a.indexOf(n))return{count:2,graph:r};for(var o=0,s=0;s<a.length;s++){var l=a[s],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(0!==c.length){var h=e(t,n,i.indexToGraph[i.idToIndex[c[0]]],i);if(0!==h.count){if(1!==h.count)return h;if(2===++o)break}}}return{count:o,graph:r}},Co=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},So=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(t.boundingBox){var s=(o.positionX-i.x1)/i.w,l=(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}return{x:o.positionX,y:o.positionY}}},Do=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=So(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},Po=function(e,t,n){To(e,t),Io(e,t),zo(e,t),Lo(e,t),Ao(e,t)},To=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];Bo(o,l,e,t)}},Mo=function(e){return-e+2*e*Math.random()},Bo=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY;0===i&&0===a&&(i=Mo(1),a=Mo(1));var o=_o(e,t,i,a);if(o>0)var s=(u=r.nodeOverlap*o)*i/(g=Math.sqrt(i*i+a*a)),l=u*a/g;else{var u,c=No(e,i,a),h=No(t,-1*i,-1*a),d=h.x-c.x,p=h.y-c.y,f=d*d+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*d/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},_o=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},No=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0<n?(u.x=r,u.y=i+a/2,u):0===t&&0>n?(u.x=r,u.y=i+a/2,u):0<t&&-1*l<=s&&s<=l?(u.x=r+o/2,u.y=i+o*n/2/t,u):0>t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0<n&&(s<=-1*l||s>=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},Io=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,u=s.positionY-a.positionY;if(0!==l||0!==u){var c=No(a,l,u),h=No(s,-1*l,-1*u),d=h.x-c.x,p=h.y-c.y,f=Math.sqrt(d*d+p*p),g=Math.pow(r.idealLength-f,2)/r.elasticity;if(0!==f)var v=g*d/f,y=g*p/f;else v=0,y=0;a.isLocked||(a.offsetX+=v,a.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},zo=function(e,t){for(var n=0;n<e.graphSet.length;n++){var r=e.graphSet[n],i=r.length;if(0===n)var a=e.clientHeight/2,o=e.clientWidth/2;else{var s=e.layoutNodes[e.idToIndex[r[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]];a=l.positionX,o=l.positionY}for(var u=0;u<i;u++){var c=e.layoutNodes[e.idToIndex[r[u]]];if(!c.isLocked){var h=a-c.positionX,d=o-c.positionY,p=Math.sqrt(h*h+d*d);if(p>1){var f=t.gravity*h/p,g=t.gravity*d/p;c.offsetX+=f,c.offsetY+=g}}}}},Lo=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,h=0;h<l.length;h++){var d=e.layoutNodes[e.idToIndex[l[h]]];d.offsetX+=u,d.offsetY+=c,n[++i]=l[h]}s.offsetX=0,s.offsetY=0}}},Ao=function(e,t){for(var n=0;n<e.nodeSize;n++){0<(i=e.layoutNodes[n]).children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(n=0;n<e.nodeSize;n++){if(!(0<(i=e.layoutNodes[n]).children.length||i.isLocked)){var r=Oo(i.offsetX,i.offsetY,e.temperature);i.positionX+=r.x,i.positionY+=r.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,Ro(i,e)}}for(n=0;n<e.nodeSize;n++){var i;0<(i=e.layoutNodes[n]).children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},Oo=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},Ro=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLeft<i.minX)&&(i.minX=t.minX-i.padLeft,a=!0),(null==i.maxY||t.maxY+i.padBottom>i.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTop<i.minY)&&(i.minY=t.minY-i.padTop,a=!0),a?e(i,n):void 0}},Fo=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}var s=0;for(i=0;i<r.length;i++){if(g=r[i]){g.x1=1/0,g.x2=-1/0,g.y1=1/0,g.y2=-1/0;for(var l=0;l<g.length;l++){var u=g[l];g.x1=Math.min(g.x1,u.positionX-u.width/2),g.x2=Math.max(g.x2,u.positionX+u.width/2),g.y1=Math.min(g.y1,u.positionY-u.height/2),g.y2=Math.max(g.y2,u.positionY+u.height/2)}g.w=g.x2-g.x1,g.h=g.y2-g.y1,s+=g.w*g.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});var c=0,h=0,d=0,p=0,f=Math.sqrt(s)*e.clientWidth/e.clientHeight;for(i=0;i<r.length;i++){var g;if(g=r[i]){for(l=0;l<g.length;l++){(u=g[l]).isLocked||(u.positionX+=c,u.positionY+=h)}c+=g.w+t.componentSpacing,d+=g.w+t.componentSpacing,p=Math.max(p,g.h),d>f&&(h+=p+t.componentSpacing,c=0,d=0,p=0)}}},Vo={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function qo(e){this.options=I({},Vo,e)}qo.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles.nodes().not(":parent");t.sort&&(r=r.sort(t.sort));var i=bt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===i.h||0===i.w)r.layoutPositions(this,t,function(e){return{x:i.x1,y:i.y1}});else{var a=r.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),l=Math.round(i.w/i.h*o),u=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},c=function(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e},h=t.rows,d=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=d)s=h,l=d;else if(null!=h&&null==d)s=h,l=Math.ceil(a/s);else if(null==h&&null!=d)l=d,s=Math.ceil(a/l);else if(l*s>a){var p=u(),f=c();(p-1)*f>=a?u(p-1):(f-1)*p>=a&&c(f-1)}else for(;l*s<a;){var g=u(),v=c();(v+1)*g>=a?c(v+1):u(g+1)}var y=i.w/l,m=i.h/s;if(t.condense&&(y=0,m=0),t.avoidOverlap)for(var b=0;b<r.length;b++){var x=r[b],w=x._private.position;null!=w.x&&null!=w.y||(w.x=0,w.y=0);var E=x.layoutDimensions(t),k=t.avoidOverlapPadding,C=E.w+k,S=E.h+k;y=Math.max(y,C),m=Math.max(m,S)}for(var D={},P=function(e,t){return!!D["c-"+e+"-"+t]},T=function(e,t){D["c-"+e+"-"+t]=!0},M=0,B=0,_=function(){++B>=l&&(B=0,M++)},N={},I=0;I<r.length;I++){var z=r[I],L=t.position(z);if(L&&(void 0!==L.row||void 0!==L.col)){var A={row:L.row,col:L.col};if(void 0===A.col)for(A.col=0;P(A.row,A.col);)A.col++;else if(void 0===A.row)for(A.row=0;P(A.row,A.col);)A.row++;N[z.id()]=A,T(A.row,A.col)}}r.layoutPositions(this,t,function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var a=N[e.id()];if(a)n=a.col*y+y/2+i.x1,r=a.row*m+m/2+i.y1;else{for(;P(M,B);)_();n=B*y+y/2+i.x1,r=M*m+m/2+i.y1,T(M,B),_()}return{x:n,y:r}})}return this};var jo={ready:function(){},stop:function(){}};function Yo(e){this.options=I({},jo,e)}Yo.prototype.run=function(){var e=this.options,t=e.eles;e.cy;return this.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this},Yo.prototype.stop=function(){return this};var Xo={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Wo(e){this.options=I({},Xo,e)}Wo.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=p(e.positions);return t.layoutPositions(this,e,function(t,r){var i=function(t){if(null==e.positions)return et(t.position());if(n)return e.positions(t);var r=e.positions[t._private.data.id];return null==r?null:r}(t);return!t.locked()&&null!=i&&i}),this};var Ho={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ko(e){this.options=I({},Ho,e)}Ko.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles.nodes().not(":parent"),r=bt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.layoutPositions(this,e,function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var Go=[{name:"breadthfirst",impl:po},{name:"circle",impl:go},{name:"concentric",impl:mo},{name:"cose",impl:xo},{name:"grid",impl:qo},{name:"null",impl:Yo},{name:"preset",impl:Wo},{name:"random",impl:Ko}];function Zo(e){this.options=e,this.notifications=0}var Uo=function(){};Zo.prototype={recalculateRenderedStyle:Uo,notify:function(){this.notifications++},init:Uo,isHeadless:function(){return!0}};var $o={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,u=i.y-n/2-o,c=i.y+n/2+o;return s<=e&&e<=l&&u<=t&&t<=c},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=(e*Math.sin(r)+t*Math.cos(r))*n;return{x:a*n+i.x,y:o+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(r(s,l,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){d(s)&&(s=e[s]),e[r]=I({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){var l=a(i(this.points,n+2*s,r,o));return Rt(e,t,l)},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:be,roughCollide:be,draw:we,spacing:xe,gap:xe}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var l=i(this.points,n,a,o),u=this.controlPoint,c=r(u[0],u[1],n,a,o);t.arrowShapeImpl(this.name)(e,l,c)},gap:function(e){return.8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.pointsTee,n+2*l,r,o));return Rt(e,t,u)||Rt(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e;return n[3]=n[3]-r,n[5]=n[5]-r,n},collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.crossLinePts(n,s),n+2*l,r,o));return Rt(e,t,u)||Rt(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return.525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i;return Math.pow(s.x-e,2)+Math.pow(s.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return.95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})}},Qo={projectIntoViewport:function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-i)/o-s.x)/l,((t-a)/o-s.y)/l]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=a.getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i=r("padding-left"),o=r("padding-right"),s=r("padding-top"),l=r("padding-bottom"),u=r("border-left-width"),c=r("border-right-width"),h=r("border-top-width"),d=(r("border-bottom-width"),e.clientWidth),p=e.clientHeight,f=i+o,g=s+l,v=u+c,y=t.width/(d+v),m=d-f,b=p-g,x=t.left+i+u,w=t.top+s+h;return this.containerBB=[x,w,m,b,y]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},findNearestElements:function(e,t,n,r){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),h=s.cy.hasCompoundNodes(),d=(r?24:8)/c,p=(r?8:2)/c,f=(r?8:2)/c,g=1/0;function v(e,t){if(e.isNode()){if(a)return;a=e,u.push(e)}if(e.isEdge()&&(null==t||t<g))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value)for(var n=0;n<u.length;n++)if(u[n].isEdge()){u[n]=e,i=e,g=null!=t?t:g;break}}else u.push(e),i=e,g=null!=t?t:g}function y(n){var r=n.outerWidth()+2*p,i=n.outerHeight()+2*p,a=r/2,l=i/2,u=n.position();if(u.x-a<=e&&e<=u.x+a&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,i,u.x,u.y))return v(n,0),!0}function m(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,p=l/2+d,f=p*p,g=2*p,m=i.source,b=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var x=a.allpts,w=0;w+3<x.length;w+=2)if(Nt(e,t,x[w],x[w+1],x[w+2],x[w+3],g)&&f>(r=Ot(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5<a.allpts.length;w+=4)if(It(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5],g)&&f>(r=At(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w<k.length;w++){var C=k[w],S=s.arrowShapes[n.pstyle(C.name+"-arrow-shape").value],D=n.pstyle("width").pfValue;if(S.roughCollide(e,t,E,C.angle,{x:C.x,y:C.y},D,d)&&S.collide(e,t,E,C.angle,{x:C.x,y:C.y},D,d))return v(n),!0}h&&u.length>0&&(y(m),y(b))}function b(e,t,n){return Ne(e,t,n)}function x(n,r){var i,a=n._private,o=f;i=r?r+"-":"";var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=a.rstyle,c=b(u,"labelX",r),h=b(u,"labelY",r),d=b(a.rscratch,"labelAngle",r),p=s.x1-o,g=s.x2+o,y=s.y1-o,m=s.y2+o;if(d){var x=Math.cos(d),w=Math.sin(d),E=function(e,t){return{x:(e-=c)*x-(t-=h)*w+c,y:e*w+t*x+h}},k=E(p,y),C=E(p,m),S=E(g,y),D=E(g,m),P=[k.x,k.y,S.x,S.y,D.x,D.y,C.x,C.y];if(Rt(e,t,P))return v(n),!0}else if(Tt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r),c=bt({x1:e=o,y1:t=l,x2:n=s,y2:r=u}),h=0;h<i.length;h++){var d=i[h];if(d.isNode()){var p=d,f=p.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});Pt(c,f)&&!Bt(f,c)&&a.push(p)}else{var g=d,v=g._private,y=v.rscratch;if(null!=y.startX&&null!=y.startY&&!Tt(c,y.startX,y.startY))continue;if(null!=y.endX&&null!=y.endY&&!Tt(c,y.endX,y.endY))continue;if("bezier"===y.edgeType||"multibezier"===y.edgeType||"self"===y.edgeType||"compound"===y.edgeType||"segments"===y.edgeType||"haystack"===y.edgeType){for(var m=v.rstyle.bezierPts||v.rstyle.linePts||v.rstyle.haystackPts,b=!0,x=0;x<m.length;x++)if(!Mt(c,m[x])){b=!1;break}b&&a.push(g)}else"haystack"!==y.edgeType&&"straight"!==y.edgeType||a.push(g)}}return a}},Jo={calculateArrowAngles:function(e){var t,n,r,i,a,o,s=e._private.rscratch,l="haystack"===s.edgeType,u="bezier"===s.edgeType,c="multibezier"===s.edgeType,h="segments"===s.edgeType,d="compound"===s.edgeType,p="self"===s.edgeType;if(l?(r=s.haystackPts[0],i=s.haystackPts[1],a=s.haystackPts[2],o=s.haystackPts[3]):(r=s.arrowStartX,i=s.arrowStartY,a=s.arrowEndX,o=s.arrowEndY),g=s.midX,v=s.midY,h)t=r-s.segpts[0],n=i-s.segpts[1];else if(c||d||p||u){var f=s.allpts;t=r-gt(f[0],f[2],f[4],.1),n=i-gt(f[1],f[3],f[5],.1)}else t=r-g,n=i-v;s.srcArrowAngle=ut(t,n);var g=s.midX,v=s.midY;if(l&&(g=(r+a)/2,v=(i+o)/2),t=a-r,n=o-i,h)if((f=s.allpts).length/2%2==0){var y=(m=f.length/2)-2;t=f[m]-f[y],n=f[m+1]-f[y+1]}else{y=(m=f.length/2-1)-2;var m,b=m+2;t=f[m]-f[y],n=f[m+1]-f[y+1]}else if(c||d||p){var x,w,E,k,f=s.allpts;if(s.ctrlpts.length/2%2==0){var C=(S=(D=f.length/2-1)+2)+2;x=gt(f[D],f[S],f[C],0),w=gt(f[D+1],f[S+1],f[C+1],0),E=gt(f[D],f[S],f[C],1e-4),k=gt(f[D+1],f[S+1],f[C+1],1e-4)}else{var S,D;C=(S=f.length/2-1)+2;x=gt(f[D=S-2],f[S],f[C],.4999),w=gt(f[D+1],f[S+1],f[C+1],.4999),E=gt(f[D],f[S],f[C],.5),k=gt(f[D+1],f[S+1],f[C+1],.5)}t=E-x,n=k-w}(s.midtgtArrowAngle=ut(t,n),s.midDispX=t,s.midDispY=n,t*=-1,n*=-1,h)&&((f=s.allpts).length/2%2==0||(t=-(f[b=(m=f.length/2-1)+2]-f[m]),n=-(f[b+1]-f[m+1])));if(s.midsrcArrowAngle=ut(t,n),h)t=a-s.segpts[s.segpts.length-2],n=o-s.segpts[s.segpts.length-1];else if(c||d||p||u){var P=(f=s.allpts).length;t=a-gt(f[P-6],f[P-4],f[P-2],.9),n=o-gt(f[P-5],f[P-3],f[P-1],.9)}else t=a-g,n=o-v;s.tgtArrowAngle=ut(t,n)}};Jo.getArrowWidth=Jo.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r,r)};var es={};function ts(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}es.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=2*Math.random()*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,l=o.position(),u=s.position(),c=o.width(),h=s.width(),d=o.height(),p=s.height(),f=n.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*c*f+l.x,i.source.y*d*f+l.y,i.target.x*h*f+u.x,i.target.y*p*f+u.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},es.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,o=e.pstyle("edge-distances").value,s=e.pstyle("segment-weights"),l=e.pstyle("segment-distances"),u=Math.min(s.pfValue.length,l.pfValue.length);n.edgeType="segments",n.segpts=[];for(var c=0;c<u;c++){var h=s.pfValue[c],d=l.pfValue[c],p=1-h,f=h,g="node-position"===o?r:i,v={x:g.x1*p+g.x2*f,y:g.y1*p+g.y2*f};n.segpts.push(v.x+a.x*d,v.y+a.y*d)}},es.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var d=n,p=h;r&&(d=0,p=l);var f=u-Math.PI/2,g=f-c/2,v=f+c/2,y=String(u+"_"+c);d=void 0===a[y]?a[y]=0:++a[y],i.ctrlpts=[o.x+1.4*Math.cos(g)*p*(d/3+1),o.y+1.4*Math.sin(g)*p*(d/3+1),o.x+1.4*Math.cos(v)*p*(d/3+1),o.y+1.4*Math.sin(v)*p*(d/3+1)]},es.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),p=d?d.pfValue[0]:void 0,f=n,g=h;r&&(f=0,g=p);var v={x:a.x-s/2,y:a.y-l/2},y={x:o.x-u/2,y:o.y-c/2},m={x:Math.min(v.x,y.x),y:Math.min(v.y,y.y)},b=Math.max(.5,Math.log(.01*s)),x=Math.max(.5,Math.log(.01*u));i.ctrlpts=[m.x,m.y-(1+Math.pow(50,1.12)/100)*g*(f/3+1)*b,m.x-(1+Math.pow(50,1.12)/100)*g*(f/3+1)*x,m.y]},es.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},es.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=t.vectorNormInverse,s=t.posPts,l=t.intersectionPts,u=e.pstyle("edge-distances").value,c=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),d=e.pstyle("control-point-weights"),p=h&&d?Math.min(h.value.length,d.value.length):1,f=h?h.pfValue[0]:void 0,g=d.value[0],v=r;a.edgeType=v?"multibezier":"bezier",a.ctrlpts=[];for(var y=0;y<p;y++){var m=(.5-t.eles.length/2+n)*c*(i?-1:1),b=void 0,x=ht(m);v&&(f=h?h.pfValue[y]:c,g=d.value[y]);var w=void 0!==(b=r?f:void 0!==f?x*f:void 0)?b:m,E=1-g,k=g,C="node-position"===u?s:l,S={x:C.x1*E+C.x2*k,y:C.y1*E+C.y2*k};a.ctrlpts.push(S.x+o.x*w,S.y+o.y*w)}},es.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r=t.posPts,i=t.srcW,a=t.srcH,o=t.tgtW,s=t.tgtH,l="node-position"!==e.pstyle("edge-distances").value,u=e.pstyle("taxi-direction").value,c=u,h=e.pstyle("taxi-turn"),d=h.pfValue,p=e.pstyle("taxi-turn-min-distance").pfValue,f="%"===h.units,g=l?(i+o)/2:0,v=l?(a+s)/2:0,y=r.x2-r.x1,m=r.y2-r.y1,b=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},x=b(y,g),w=b(m,v),E=!1;"auto"===u?u=Math.abs(x)>Math.abs(w)?"horizontal":"vertical":"upward"===u||"downward"===u?(u="vertical",E=!0):"leftward"!==u&&"rightward"!==u||(u="horizontal",E=!0);var k="vertical"===u,C=k?w:x,S=k?m:y,D=ht(S),P=!1;E&&f||!("downward"===c&&S<0||"upward"===c&&S>0||"leftward"===c&&S>0||"rightward"===c&&S<0)||(C=(D*=-1)*Math.abs(C),P=!0);var T=f?d*C:d*D,M=function(e){return Math.abs(e)<p||Math.abs(e)>=Math.abs(C)},B=M(T),_=M(C-T);if((B||_)&&!P)if(k){var N=Math.abs(S)<=a/2,I=Math.abs(y)<=o/2;if(N){var z=(r.x1+r.x2)/2,L=r.y1,A=r.y2;n.segpts=[z,L,z,A]}else if(I){var O=(r.y1+r.y2)/2,R=r.x1,F=r.x2;n.segpts=[R,O,F,O]}else n.segpts=[r.x1,r.y2]}else{var V=Math.abs(S)<=i/2,q=Math.abs(m)<=s/2;if(V){var j=(r.y1+r.y2)/2,Y=r.x1,X=r.x2;n.segpts=[Y,j,X,j]}else if(q){var W=(r.x1+r.x2)/2,H=r.y1,K=r.y2;n.segpts=[W,H,W,K]}else n.segpts=[r.x2,r.y1]}else if(k){var G=r.y1+T+(l?a/2*D:0),Z=r.x1,U=r.x2;n.segpts=[Z,G,U,G]}else{var $=r.x1+T+(l?i/2*D:0),Q=r.y1,J=r.y2;n.segpts=[$,Q,$,J]}},es.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=!v(n.startX)||!v(n.startY),d=!v(n.arrowStartX)||!v(n.arrowStartY),p=!v(n.endX)||!v(n.endY),f=!v(n.arrowEndX)||!v(n.arrowEndY),g=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),y=dt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),m=y<g,b=dt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),x=b<g,w=!1;if(h||d||m){w=!0;var E={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},k=Math.sqrt(E.x*E.x+E.y*E.y),C={x:E.x/k,y:E.y/k},S=Math.max(a,o),D={x:n.ctrlpts[0]+2*C.x*S,y:n.ctrlpts[1]+2*C.y*S},P=u.intersectLine(r.x,r.y,a,o,D.x,D.y,0);m?(n.ctrlpts[0]=n.ctrlpts[0]+C.x*(g-y),n.ctrlpts[1]=n.ctrlpts[1]+C.y*(g-y)):(n.ctrlpts[0]=P[0]+C.x*g,n.ctrlpts[1]=P[1]+C.y*g)}if(p||f||x){w=!0;var T={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},M=Math.sqrt(T.x*T.x+T.y*T.y),B={x:T.x/M,y:T.y/M},_=Math.max(a,o),N={x:n.ctrlpts[0]+2*B.x*_,y:n.ctrlpts[1]+2*B.y*_},I=c.intersectLine(i.x,i.y,s,l,N.x,N.y,0);x?(n.ctrlpts[0]=n.ctrlpts[0]+B.x*(g-b),n.ctrlpts[1]=n.ctrlpts[1]+B.y*(g-b)):(n.ctrlpts[0]=I[0]+B.x*g,n.ctrlpts[1]=I[1]+B.y*g)}w&&this.findEndpoints(e)}},es.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);var r;t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,.5,t.midX=gt(t.allpts[r],t.allpts[r+2],t.allpts[r+4],.5),t.midY=gt(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],.5))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType)if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.segpts.length%4==0){var i=t.segpts.length/2,a=i-2;t.midX=(t.segpts[a]+t.segpts[i])/2,t.midY=(t.segpts[a+1]+t.segpts[i+1])/2}else{var o=t.segpts.length/2-1;t.midX=t.segpts[o],t.midY=t.segpts[o+1]}},es.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||v(t.startX)&&v(t.startY)&&v(t.endX)&&v(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Ce("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw.  Adjust your edge style (e.g. control points) accordingly or use an alternative edge type.  This is expected behaviour when the source node and the target node overlap."))},es.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),i=new ze,a=[],o=[],s=0;s<e.length;s++){var l=e[s],u=l._private,c=l.pstyle("curve-style").value;if(!l.removed()&&l.takesUpSpace())if("haystack"!==c){var h="unbundled-bezier"===c||"segments"===c||"straight"===c||"taxi"===c,d="unbundled-bezier"===c||"bezier"===c,p=u.source.poolIndex(),f=u.target.poolIndex(),g=(h?-1:1)*ce([p,f].sort()),y=i.get(g);null==y&&(y={eles:[]},i.set(g,y),a.push(g)),y.eles.push(l),h&&(y.hasUnbundled=!0),d&&(y.hasBezier=!0)}else o.push(l)}for(var m=function(e){var o=a[e],s=i.get(o),l=void 0;if(!s.hasUnbundled){var u=s.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});_e(s.eles),u.forEach(function(e){return s.eles.push(e)}),s.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var c=s.eles[0],h=c.source(),d=c.target();if(h.poolIndex()>d.poolIndex()){var p=h;h=d,d=p}var f=s.srcPos=h.position(),g=s.tgtPos=d.position(),y=s.srcW=h.outerWidth(),m=s.srcH=h.outerHeight(),b=s.tgtW=d.outerWidth(),x=s.tgtH=d.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(h)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(d)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var k=0;k<s.eles.length;k++){var C=s.eles[k],S=C[0]._private.rscratch,D=C.pstyle("curve-style").value,P="unbundled-bezier"===D||"segments"===D||"taxi"===D,T=!h.same(C.source());if(!s.calculatedIntersection&&h!==d&&(s.hasBezier||s.hasUnbundled)){s.calculatedIntersection=!0;var M=w.intersectLine(f.x,f.y,y,m,g.x,g.y,0),B=s.srcIntn=M,_=E.intersectLine(g.x,g.y,b,x,f.x,f.y,0),N=s.tgtIntn=_,I=s.intersectionPts={x1:M[0],x2:_[0],y1:M[1],y2:_[1]},z=s.posPts={x1:f.x,x2:g.x,y1:f.y,y2:g.y},L=_[1]-M[1],A=_[0]-M[0],O=Math.sqrt(A*A+L*L),R=s.vector={x:A,y:L},F=s.vectorNorm={x:R.x/O,y:R.y/O},V={x:-F.y,y:F.x};s.nodesOverlap=!v(O)||E.checkPoint(M[0],M[1],0,b,x,g.x,g.y)||w.checkPoint(_[0],_[1],0,y,m,f.x,f.y),s.vectorNormInverse=V,l={nodesOverlap:s.nodesOverlap,dirCounts:s.dirCounts,calculatedIntersection:!0,hasBezier:s.hasBezier,hasUnbundled:s.hasUnbundled,eles:s.eles,srcPos:g,tgtPos:f,srcW:b,srcH:x,tgtW:y,tgtH:m,srcIntn:N,tgtIntn:B,srcShape:E,tgtShape:w,posPts:{x1:z.x2,y1:z.y2,x2:z.x1,y2:z.y1},intersectionPts:{x1:I.x2,y1:I.y2,x2:I.x1,y2:I.y1},vector:{x:-R.x,y:-R.y},vectorNorm:{x:-F.x,y:-F.y},vectorNormInverse:{x:-V.x,y:-V.y}}}var q=T?l:s;S.nodesOverlap=q.nodesOverlap,S.srcIntn=q.srcIntn,S.tgtIntn=q.tgtIntn,r&&(h.isParent()||h.isChild()||d.isParent()||d.isChild())&&(h.parents().anySame(d)||d.parents().anySame(h)||h.same(d))?t.findCompoundLoopPoints(C,q,k,P):h===d?t.findLoopPoints(C,q,k,P):"segments"===D?t.findSegmentsPoints(C,q):"taxi"===D?t.findTaxiPoints(C,q):"straight"===D||!P&&s.eles.length%2==1&&k===Math.floor(s.eles.length/2)?t.findStraightEdgePoints(C):t.findBezierPoints(C,q,k,P,T),t.findEndpoints(C),t.tryToCorrectInvalidPoints(C,q),t.checkForInvalidEdgeWarning(C),t.storeAllpts(C),t.storeEdgeProjections(C),t.calculateArrowAngles(C),t.recalculateEdgeLabelProjections(C),t.calculateLabelAngles(C)}},b=0;b<a.length;b++)m(b);this.findHaystackPoints(o)}},es.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if("segments"===t.edgeType)return this.recalculateRenderedStyle(e),ts(t.segpts)},es.getControlPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return this.recalculateRenderedStyle(e),ts(t.ctrlpts)},es.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var ns={manualEndptToPx:function(e,t){var n=e.position(),r=e.outerWidth(),i=e.outerHeight();if(2===t.value.length){var a=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(a[0]=a[0]*r),"%"===t.units[1]&&(a[1]=a[1]*i),a[0]+=n.x,a[1]+=n.y,a}var o=t.pfValue[0];o=-Math.PI/2+o;var s=2*Math.max(r,i),l=[n.x+Math.cos(o)*s,n.y+Math.sin(o)*s];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,r,i,l[0],l[1],0)},findEndpoints:function(e){var t,n,r,i,a,o=this,s=e.source()[0],l=e.target()[0],u=s.position(),c=l.position(),h=e.pstyle("target-arrow-shape").value,d=e.pstyle("source-arrow-shape").value,p=e.pstyle("target-distance-from-node").pfValue,f=e.pstyle("source-distance-from-node").pfValue,g=e.pstyle("curve-style").value,y=e._private.rscratch,m=y.edgeType,b="self"===m||"compound"===m,x="bezier"===m||"multibezier"===m||b,w="bezier"!==m,E="straight"===m||"segments"===m,k="segments"===m,C=x||w||E,S=b||"taxi"===g,D=e.pstyle("source-endpoint"),P=S?"outside-to-node":D.value,T=e.pstyle("target-endpoint"),M=S?"outside-to-node":T.value;if(y.srcManEndpt=D,y.tgtManEndpt=T,x){var B=[y.ctrlpts[0],y.ctrlpts[1]];n=w?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:B,r=B}else if(E){var _=k?y.segpts.slice(0,2):[c.x,c.y];n=k?y.segpts.slice(y.segpts.length-2):[u.x,u.y],r=_}if("inside-to-node"===M)t=[c.x,c.y];else if(T.units)t=this.manualEndptToPx(l,T);else if("outside-to-line"===M)t=y.tgtIntn;else if("outside-to-node"===M||"outside-to-node-or-label"===M?i=n:"outside-to-line"!==M&&"outside-to-line-or-label"!==M||(i=[u.x,u.y]),t=o.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),i[0],i[1],0),"outside-to-node-or-label"===M||"outside-to-line-or-label"===M){var N=l._private.rscratch,I=N.labelWidth,z=N.labelHeight,L=N.labelX,A=N.labelY,O=l.pstyle("text-valign").value;"top"===O?A-=z/2:"bottom"===O&&(A+=z/2);var R=l.pstyle("text-halign").value;"left"===R?L-=I/2:"right"===R&&(L+=I/2);var F=o.nodeShapes.rectangle.intersectLine(L,A,I,z,i[0],i[1],0),V=u,q=pt(V,rt(t));pt(V,rt(F))<q&&(t=F)}var j=Gt(t,n,o.arrowShapes[h].spacing(e)+p),Y=Gt(t,n,o.arrowShapes[h].gap(e)+p);if(y.endX=Y[0],y.endY=Y[1],y.arrowEndX=j[0],y.arrowEndY=j[1],"inside-to-node"===P)t=[u.x,u.y];else if(D.units)t=this.manualEndptToPx(s,D);else if("outside-to-line"===P)t=y.srcIntn;else if("outside-to-node"===P||"outside-to-node-or-label"===P?a=r:"outside-to-line"!==P&&"outside-to-line-or-label"!==P||(a=[c.x,c.y]),t=o.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),a[0],a[1],0),"outside-to-node-or-label"===P||"outside-to-line-or-label"===P){var X=s._private.rscratch,W=X.labelWidth,H=X.labelHeight,K=X.labelX,G=X.labelY,Z=s.pstyle("text-valign").value;"top"===Z?G-=H/2:"bottom"===Z&&(G+=H/2);var U=s.pstyle("text-halign").value;"left"===U?K-=W/2:"right"===U&&(K+=W/2);var $=o.nodeShapes.rectangle.intersectLine(K,G,W,H,a[0],a[1],0),Q=c,J=pt(Q,rt(t));pt(Q,rt($))<J&&(t=$)}var ee=Gt(t,r,o.arrowShapes[d].spacing(e)+f),te=Gt(t,r,o.arrowShapes[d].gap(e)+f);y.startX=te[0],y.startY=te[1],y.arrowStartX=ee[0],y.arrowStartY=ee[1],C&&(v(y.startX)&&v(y.startY)&&v(y.endX)&&v(y.endY)?y.badLine=!1:y.badLine=!0)},getSourceEndpoint:function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},getTargetEndpoint:function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}}},rs={};function is(e,t,n){for(var r=function(e,t,n,r){return gt(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}rs.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)is(this,e,n.allpts.slice(i,i+6))}else if("segments"===r){var a=t.rstyle.linePts=[];for(i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]})}else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},rs.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var as={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!k(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,h=i.rscratch,d=i.rstyle;switch(u){case"left":n=l.x-a/2-s;break;case"right":n=l.x+a/2+s;break;default:n=l.x}switch(c){case"top":r=l.y-o/2-s;break;case"bottom":r=l.y+o/2+s;break;default:r=l.y}h.labelX=n,h.labelY=r,d.labelX=n,d.labelY=r,this.applyLabelDimensions(e)}}},os=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},ss=function(e,t){var n=t.x-e.x,r=t.y-e.y;return os(n,r)};as.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){Ie(n.rscratch,e,t,r),Ie(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y);var s=os(r.midDispX,r.midDispY);o("labelAutoAngle",null,s);var l=function(s){var l,u="source"===s;if(a[s]){var c=e.pstyle(s+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var h,d=function e(){if(e.cache)return e.cache;for(var t=[],a=0;a+5<r.allpts.length;a+=4){var o={x:r.allpts[a],y:r.allpts[a+1]},s={x:r.allpts[a+2],y:r.allpts[a+3]},l={x:r.allpts[a+4],y:r.allpts[a+5]};t.push({p0:o,p1:s,p2:l,startDist:0,length:0,segments:[]})}var u=n.rstyle.bezierPts,c=i.bezierProjPcts.length;function h(e,t,n,r,i){var a=dt(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var d=0;d<t.length;d++){var p=t[d],f=t[d-1];f&&(p.startDist=f.startDist+f.length),h(p,p.p0,u[d*c],0,i.bezierProjPcts[0]);for(var g=0;g<c-1;g++)h(p,u[d*c+g],u[d*c+g+1],i.bezierProjPcts[g],i.bezierProjPcts[g+1]);h(p,u[d*c+c-1],p.p2,i.bezierProjPcts[c-1],1)}return e.cache=t}(),p=0,f=0,g=0;g<d.length;g++){for(var v=d[u?g:d.length-1-g],y=0;y<v.segments.length;y++){var m=v.segments[u?y:v.segments.length-1-y],b=g===d.length-1&&y===v.segments.length-1;if(p=f,(f+=m.length)>=c||b){h={cp:v,segment:m};break}}if(h)break}var x=h.cp,w=h.segment,E=(c-p)/w.length,k=w.t1-w.t0,C=u?w.t0+k*E:w.t1-k*E;C=mt(0,C,1),t=vt(x.p0,x.p1,x.p2,C),l=function(e,t,n,r){var i=mt(0,r-.001,1),a=mt(0,r+.001,1),o=vt(e,t,n,i),s=vt(e,t,n,a);return ss(o,s)}(x.p0,x.p1,x.p2,C);break;case"straight":case"segments":case"haystack":for(var S,D,P,T,M=0,B=r.allpts.length,_=0;_+3<B&&(u?(P={x:r.allpts[_],y:r.allpts[_+1]},T={x:r.allpts[_+2],y:r.allpts[_+3]}):(P={x:r.allpts[B-2-_],y:r.allpts[B-1-_]},T={x:r.allpts[B-4-_],y:r.allpts[B-3-_]}),D=M,!((M+=S=dt(P,T))>=c));_+=2);var N=(c-D)/S;N=mt(0,N,1),t=yt(P,T,N),l=ss(P,T)}o("labelX",s,t.x),o("labelY",s,t.y),o("labelAutoAngle",s,l)}};l("source"),l("target"),this.applyLabelDimensions(e)}},as.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},as.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Ne(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,h=i.width,d=i.height+(l-1)*(a-1)*u;Ie(n.rstyle,"labelWidth",t,h),Ie(n.rscratch,"labelWidth",t,h),Ie(n.rstyle,"labelHeight",t,d),Ie(n.rscratch,"labelHeight",t,d),Ie(n.rscratch,"labelLineHeight",t,c)},as.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Ie(n.rscratch,e,t,r),r):Ne(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=i.split("\n"),c=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,d=[],p=/[\s\u200b]+/,f=h?"":" ",g=0;g<u.length;g++){var v=u[g],y=this.calculateLabelDimensions(e,v).width;if(h){var m=v.split("").join("​");v=m}if(y>c){for(var b=v.split(p),x="",w=0;w<b.length;w++){var E=b[w],k=0===x.length?E:x+f+E;this.calculateLabelDimensions(e,k).width<=c?x+=E+f:(d.push(x),x=E+f)}x.match(/^[\s\u200b]+$/)||d.push(x)}else d.push(v)}o("labelWrapCachedLines",d),i=o("labelWrapCachedText",d.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){for(var C=e.pstyle("text-max-width").pfValue,S="",D=!1,P=0;P<i.length;P++){if(this.calculateLabelDimensions(e,S+i[P]+"…").width>C)break;S+=i[P],P===i.length-1&&(D=!0)}return D||(S+="…"),S}return i},as.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},as.calculateLabelDimensions=function(e,t){var n=he(t,e._private.labelDimsKey),r=this.labelDimCache||(this.labelDimCache=[]),i=r[n];if(null!=i)return i;var a=e.pstyle("font-style").strValue,o=1*e.pstyle("font-size").pfValue+"px",s=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,u=this.labelCalcDiv;u||(u=this.labelCalcDiv=document.createElement("div"),document.body.appendChild(u));var c=u.style;return c.fontFamily=s,c.fontStyle=a,c.fontSize=o,c.fontWeight=l,c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none",c.padding="0",c.lineHeight="1","wrap"===e.pstyle("text-wrap").value?c.whiteSpace="pre":c.whiteSpace="normal",u.textContent=t,r[n]={width:Math.ceil(u.clientWidth/1),height:Math.ceil(u.clientHeight/1)}},as.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=t?t+"-":"",a=e.pstyle(i+"text-rotation"),o=a.strValue;return"none"===o?0:r&&"autorotate"===o?n.labelAutoAngle:"autorotate"===o?0:a.pfValue},as.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,"source"),r.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var ls={},us=!1;ls.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(e.width()<28||e.height()<28))return us||(Ce("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),us=!0),"rectangle";if(e.isParent())return"rectangle"===t||"roundrectangle"===t||"cutrectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var cs={registerCalculationListeners:function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){e[r]._private.rstyle.clean=!1}};n.binder(e).on("bounds.* dirty.*",function(e){var t=e.target;r(t)}).on("style.* background.*",function(e){var t=e.target;r(t,!1)});var i=function(i){if(i){for(var a=n.onUpdateEleCalcsFns,o=0;o<t.length;o++){var s=t[o];s.isNode()&&!s._private.rstyle.clean&&r(s.connectedEdges())}if(a)for(o=0;o<a.length;o++){(0,a[o])(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},recalculateRenderedStyle:function(e,t){var n=[],r=[];if(!this.destroyed){void 0===t&&(t=!0);for(var i=0;i<e.length;i++){var a=(l=(s=e[i])._private).rstyle;t&&a.clean||s.removed()||"none"!==s.pstyle("display").value&&("nodes"===l.group?r.push(s):n.push(s),a.clean=!0)}for(i=0;i<r.length;i++){a=(l=(s=r[i])._private).rstyle;var o=s.position();this.recalculateNodeLabelProjection(s),a.nodeX=o.x,a.nodeY=o.y,a.nodeW=s.pstyle("width").pfValue,a.nodeH=s.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(i=0;i<n.length;i++){a=(l=(s=n[i])._private).rstyle;var s,l,u=l.rscratch;a.srcX=u.arrowStartX,a.srcY=u.arrowStartY,a.tgtX=u.arrowEndX,a.tgtY=u.arrowEndY,a.midX=u.midX,a.midY=u.midY,a.labelAngle=u.labelAngle,a.sourceLabelAngle=u.sourceLabelAngle,a.targetLabelAngle=u.targetLabelAngle}}}},hs={updateCachedGrabbedEles:function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=(i=e[n])._private.rscratch;i.grabbed()&&!i.isParent()?t.push(i):r.inDragLayer?e.drag.push(i):e.nondrag.push(i)}for(n=0;n<t.length;n++){var i=t[n];e.drag.push(i)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Qi),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t}},ds={};[Qo,Jo,es,ns,rs,as,ls,cs,hs].forEach(function(e){I(ds,e)});var ps={getCachedImage:function(e,t,n){var r=this.imageCache=this.imageCache||{},i=r[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;var a=(i=r[e]=r[e]||{}).image=new Image;a.addEventListener("load",n),a.addEventListener("error",function(){a.error=!0});return"data:"===e.substring(0,"data:".length).toLowerCase()||(a.crossOrigin=t),a.src=e,a}},fs={registerBinding:function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]),a=this.binder(e);return a.on.apply(a,i)}};fs.binder=function(e){var t,n=this,r=e===window||e===document||e===document.body||(t=e,"undefined"!=typeof HTMLElement&&t instanceof HTMLElement);if(null==n.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});window.addEventListener("test",null,a)}catch(e){}n.supportsPassiveEvents=i}var o=function(t,i,a){var o=Array.prototype.slice.call(arguments);return r&&n.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),n.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},fs.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},fs.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},fs.load=function(){var e=this,t=function(e){return e.selected()},n=function(t,n,r,i){null==t&&(t=e.cy);for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},r=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},i=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable())for(var i=0;n&&i<n.length;i++){if((t=n[i]).isNode()&&t.isParent()){r=!1;break}}else r=!0;return r},a=function(e){e[0]._private.rscratch.inDragLayer=!0},o=function(e){e[0]._private.rscratch.isGrabTarget=!0},s=function(e,t){var n=t.addToList;n.has(e)||(n.merge(e),function(e){e[0]._private.grabbed=!0}(e))},l=function(t,n){n=n||{};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(a),t.neighborhood().stdFilter(function(e){return!r||e.isEdge()}).forEach(a)),n.addToList&&t.forEach(function(e){s(e,n)}),function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(a),n.connectedEdges().forEach(a)),t.addToList&&t.addToList.unmerge(n)}}(t,n),h(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},u=l,c=function(t){t&&(e.getCachedZSortedEles().forEach(function(e){!function(e){e[0]._private.grabbed=!1}(e),function(e){e[0]._private.rscratch.inDragLayer=!1}(e),function(e){e[0]._private.rscratch.isGrabTarget=!1}(e)}),e.updateCachedGrabbedEles())},h=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(a),r.forEach(a)),t.addToList&&r.forEach(function(e){s(e,t)})}}},d=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},p="undefined"!=typeof MutationObserver;p?(e.removeObserver=new MutationObserver(function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r)for(var i=0;i<r.length;i++){if(r[i]===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(t){e.destroy()});var f=ne(function(){e.cy.resize()},100);p&&(e.styleObserver=new MutationObserver(f),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(window,"resize",f);var g=function(){e.invalidateContainerClientCoordsCache()};!function(e,t){for(;null!=e;)t(e),e=e.parentNode}(e.container,function(t){e.registerBinding(t,"transitionend",g),e.registerBinding(t,"animationend",g),e.registerBinding(t,"scroll",g)}),e.registerBinding(e.container,"contextmenu",function(e){e.preventDefault()});var y=function(t){for(var n=e.findContainerClientCoords(),r=n[0],i=n[1],a=n[2],o=n[3],s=t.touches?t.touches:[t],l=!1,u=0;u<s.length;u++){var c=s[u];if(r<=c.clientX&&c.clientX<=r+a&&i<=c.clientY&&c.clientY<=i+o){l=!0;break}}if(!l)return!1;for(var h=e.container,d=t.target.parentNode,p=!1;d;){if(d===h){p=!0;break}d=d.parentNode}return!!p};e.registerBinding(e.container,"mousedown",function(t){if(y(t)){t.preventDefault(),d(),e.hoverData.capture=!0,e.hoverData.which=t.which;var r=e.cy,i=[t.clientX,t.clientY],a=e.projectIntoViewport(i[0],i[1]),s=e.selection,c=e.findNearestElements(a[0],a[1],!0,!1),h=c[0],p=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=i;if(3==t.which){e.hoverData.cxtStarted=!0;var f={originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}};h?(h.activate(),h.emit(f),e.hoverData.down=h):r.emit(f),e.hoverData.downTime=(new Date).getTime(),e.hoverData.cxtDragged=!1}else if(1==t.which){if(h&&h.activate(),null!=h&&e.nodeIsGrabbable(h)){var g=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};if(o(h),h.selected()){p=e.dragData.possibleDragElements=r.collection();var v=r.$(function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)});l(v,{addToList:p}),h.emit(g("grabon")),v.forEach(function(e){e.emit(g("grab"))})}else p=e.dragData.possibleDragElements=r.collection(),u(h,{addToList:p}),h.emit(g("grabon")).emit(g("grab"));e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=h,e.hoverData.downs=c,e.hoverData.downTime=(new Date).getTime(),n(h,["mousedown","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==h?(s[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint("select",!0),e.redraw()):h.pannable()&&(s[4]=1),e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var n=e.hoverData.down;n?n.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}}):r.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}})}},e.tapholdDuration)}s[0]=s[2]=a[0],s[1]=s[3]=a[1]}},!1),e.registerBinding(window,"mousemove",function(t){if(e.hoverData.capture||y(t)){var a=!1,o=e.cy,s=o.zoom(),u=[t.clientX,t.clientY],h=e.projectIntoViewport(u[0],u[1]),d=e.hoverData.mdownPos,p=e.hoverData.mdownGPos,f=e.selection,g=null;e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.selecting||(g=e.findNearestElement(h[0],h[1],!0,!1));var m,b=e.hoverData.last,x=e.hoverData.down,w=[h[0]-f[2],h[1]-f[3]],E=e.dragData.possibleDragElements;if(p){var k=u[0]-p[0],C=k*k,S=u[1]-p[1],D=C+S*S;e.hoverData.isOverThresholdDrag=m=D>=e.desktopTapThreshold2}var P=r(t);m&&(e.hoverData.tapholdCancelled=!0);a=!0,n(g,["mousemove","vmousemove","tapdrag"],t,{x:h[0],y:h[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:h[0],y:h[1]}}),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(m){var M={originalEvent:t,type:"cxtdrag",position:{x:h[0],y:h[1]}};x?x.emit(M):o.emit(M),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:h[0],y:h[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:h[0],y:h[1]}}))}}else if(e.hoverData.dragging){if(a=!0,o.panningEnabled()&&o.userPanningEnabled()){var B;if(e.hoverData.justStartedPan){var _=e.hoverData.mdownPos;B={x:(h[0]-_[0])*s,y:(h[1]-_[1])*s},e.hoverData.justStartedPan=!1}else B={x:w[0]*s,y:w[1]*s};o.panBy(B),e.hoverData.dragged=!0}h=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=f[4]||null!=x&&!x.pannable()){if(x&&x.pannable()&&x.active()&&x.unactivate(),x&&x.grabbed()||g==b||(b&&n(b,["mouseout","tapdragout"],t,{x:h[0],y:h[1]}),g&&n(g,["mouseover","tapdragover"],t,{x:h[0],y:h[1]}),e.hoverData.last=g),x)if(m){if(o.boxSelectionEnabled()&&P)x&&x.grabbed()&&(c(E),x.emit("freeon"),E.emit("free"),e.dragData.didDrag&&(x.emit("dragfreeon"),E.emit("dragfree"))),T();else if(x&&x.grabbed()&&e.nodeIsDraggable(x)){var N=!e.dragData.didDrag;N&&e.redrawHint("eles",!0),e.dragData.didDrag=!0;var I=o.collection();e.hoverData.draggingEles||l(E,{inDragLayer:!0});var z={x:0,y:0};if(v(w[0])&&v(w[1])&&(z.x+=w[0],z.y+=w[1],N)){var L=e.hoverData.dragDelta;L&&v(L[0])&&v(L[1])&&(z.x+=L[0],z.y+=L[1])}for(var A=0;A<E.length;A++){var O=E[A];e.nodeIsDraggable(O)&&O.grabbed()&&I.merge(O)}e.hoverData.draggingEles=!0,I.silentShift(z).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(w[0]),t.push(w[1])):(t[0]+=w[0],t[1]+=w[1])}();a=!0}else if(m){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!P&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){i(x,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=rt(d),e.redrawHint("select",!0),e.redraw())}}else T();x&&x.pannable()&&x.active()&&x.unactivate()}return f[2]=h[0],f[3]=h[1],a?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}},!1),e.registerBinding(window,"mouseup",function(i){if(e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(i.clientX,i.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,h=e.hoverData.down,d=r(i);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,h&&h.unactivate(),3===e.hoverData.which){var p={originalEvent:i,type:"cxttapend",position:{x:o[0],y:o[1]}};if(h?h.emit(p):a.emit(p),!e.hoverData.cxtDragged){var f={originalEvent:i,type:"cxttap",position:{x:o[0],y:o[1]}};h?h.emit(f):a.emit(f)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(n(l,["mouseup","tapend","vmouseup"],i,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||n(h,["click","tap","vclick"],i,{x:o[0],y:o[1]}),null!=h||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||r(i)||(a.$(t).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=h||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||d?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):d||(a.$(t).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:i,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()?g.emit("box").stdFilter(v).select().emit("boxselect"):(d||a.$(t).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=h&&h.grabbed();c(u),y&&(h.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(h.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null}},!1);var m,b,x,w,E,k,C,S,D,P,T,M,B;e.registerBinding(e.container,"wheel",function(t){if(!e.scrollingPage){var n,r=e.cy,i=e.projectIntoViewport(t.clientX,t.clientY),a=[i[0]*r.zoom()+r.pan().x,i[1]*r.zoom()+r.pan().y];e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4]?t.preventDefault():r.panningEnabled()&&r.userPanningEnabled()&&r.zoomingEnabled()&&r.userZoomingEnabled()&&(t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150),n=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,n*=e.wheelSensitivity,1===t.deltaMode&&(n*=33),r.zoom({level:r.zoom()*Math.pow(10,n),renderedPosition:{x:a[0],y:a[1]}}))}},!0),e.registerBinding(window,"scroll",function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"mouseout",function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})},!1),e.registerBinding(e.container,"mouseover",function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})},!1);var _,N,I,z,L=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},A=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",_=function(t){if(y(t)){d(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var s=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=s[0],i[1]=s[1]}if(t.touches[1]){s=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=s[0],i[3]=s[1]}if(t.touches[2]){s=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=s[0],i[5]=s[1]}if(t.touches[1]){c(e.dragData.touchDragEles);var h=e.findContainerClientCoords();D=h[0],P=h[1],T=h[2],M=h[3],m=t.touches[0].clientX-D,b=t.touches[0].clientY-P,x=t.touches[1].clientX-D,w=t.touches[1].clientY-P,B=0<=m&&m<=T&&0<=x&&x<=T&&0<=b&&b<=M&&0<=w&&w<=M;var p=r.pan(),f=r.zoom();E=L(m,b,x,w),k=A(m,b,x,w),S=[((C=[(m+x)/2,(b+w)/2])[0]-p.x)/f,(C[1]-p.y)/f];if(k<4e4&&!t.touches[2]){var g=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):r.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2]);else if(t.touches[1]);else if(t.touches[0]){var _=e.findNearestElements(i[0],i[1],!0,!0),N=_[0];if(null!=N&&(N.activate(),e.touchData.start=N,e.touchData.starts=_,e.nodeIsGrabbable(N))){var I=e.dragData.touchDragEles=r.collection(),z=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),N.selected()?(z=r.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),l(z,{addToList:I})):u(N,{addToList:I}),o(N);var O=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};N.emit(O("grabon")),z?z.forEach(function(e){e.emit(O("grab"))}):N.emit(O("grab"))}n(N,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==N&&(e.data.bgActivePosistion={x:s[0],y:s[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||n(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})},e.tapholdDuration)}if(t.touches.length>=1){for(var R=e.touchData.startPosition=[],F=0;F<i.length;F++)R[F]=a[F]=i[F];var V=t.touches[0];e.touchData.startGPosition=[V.clientX,V.clientY]}}},!1),e.registerBinding(window,"touchmove",N=function(t){var r=e.touchData.capture;if(r||y(t)){var a=e.selection,o=e.cy,s=e.touchData.now,u=e.touchData.earlier,h=o.zoom();if(t.touches[0]){var d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=d[0],s[1]=d[1]}if(t.touches[1]){d=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=d[0],s[3]=d[1]}if(t.touches[2]){d=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=d[0],s[5]=d[1]}var p,f=e.touchData.startGPosition;if(r&&t.touches[0]&&f){for(var g=[],C=0;C<s.length;C++)g[C]=s[C]-u[C];var T=t.touches[0].clientX-f[0],M=T*T,_=t.touches[0].clientY-f[1];p=M+_*_>=e.touchTapThreshold2}if(r&&e.touchData.cxt){t.preventDefault();var N=t.touches[0].clientX-D,I=t.touches[0].clientY-P,z=t.touches[1].clientX-D,O=t.touches[1].clientY-P,R=A(N,I,z,O);if(R/k>=2.25||R>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var F={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(F),e.touchData.start=null):o.emit(F)}}if(r&&e.touchData.cxt){F={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(F):o.emit(F),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var V=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&V===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=V,V&&V.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(r&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.redrawHint("select",!0),a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),a[4]=1,e.touchData.selecting=!0,e.redraw();else if(r&&t.touches[1]&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var q=0;q<ee.length;q++){var j=ee[q]._private;j.grabbed=!1,j.rscratch.inDragLayer=!1}}var Y=e.touchData.start,X=(N=t.touches[0].clientX-D,I=t.touches[0].clientY-P,z=t.touches[1].clientX-D,O=t.touches[1].clientY-P,L(N,I,z,O)),W=X/E;if(B){var H=(N-m+(z-x))/2,K=(I-b+(O-w))/2,G=o.zoom(),Z=G*W,U=o.pan(),$=S[0]*G+U.x,Q=S[1]*G+U.y,J={x:-Z/G*($-U.x-H)+$,y:-Z/G*(Q-U.y-K)+Q};if(Y&&Y.active()){var ee=e.dragData.touchDragEles;c(ee),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Y.unactivate().emit("freeon"),ee.emit("free"),e.dragData.didDrag&&(Y.emit("dragfreeon"),ee.emit("dragfree"))}o.viewport({zoom:Z,pan:J,cancelOnFailedZoom:!0}),E=X,m=N,b=I,x=z,w=O,e.pinching=!0}if(t.touches[0]){d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=d[0],s[1]=d[1]}if(t.touches[1]){d=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=d[0],s[3]=d[1]}if(t.touches[2]){d=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=d[0],s[5]=d[1]}}else if(t.touches[0]){var te=e.touchData.start,ne=e.touchData.last;if(e.hoverData.draggingEles||e.swipePanning||(V=e.findNearestElement(s[0],s[1],!0,!0)),r&&null!=te&&t.preventDefault(),r&&null!=te&&e.nodeIsDraggable(te))if(p){ee=e.dragData.touchDragEles;var re=!e.dragData.didDrag;re&&l(ee,{inDragLayer:!0}),e.dragData.didDrag=!0;var ie={x:0,y:0};if(v(g[0])&&v(g[1]))if(ie.x+=g[0],ie.y+=g[1],re)e.redrawHint("eles",!0),(ae=e.touchData.dragDelta)&&v(ae[0])&&v(ae[1])&&(ie.x+=ae[0],ie.y+=ae[1]);e.hoverData.draggingEles=!0,ee.silentShift(ie).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==u[0]&&e.touchData.startPosition[1]==u[1]&&e.redrawHint("eles",!0),e.redraw()}else{var ae;0===(ae=e.touchData.dragDelta=e.touchData.dragDelta||[]).length?(ae.push(g[0]),ae.push(g[1])):(ae[0]+=g[0],ae[1]+=g[1])}if(n(te||V,["touchmove","tapdrag","vmousemove"],t,{x:s[0],y:s[1]}),te&&te.grabbed()||V==ne||(ne&&ne.emit({originalEvent:t,type:"tapdragout",position:{x:s[0],y:s[1]}}),V&&V.emit({originalEvent:t,type:"tapdragover",position:{x:s[0],y:s[1]}})),e.touchData.last=V,r)for(q=0;q<s.length;q++)s[q]&&e.touchData.startPosition[q]&&p&&(e.touchData.singleTouchMoved=!0);if(r&&(null==te||te.pannable())&&o.panningEnabled()&&o.userPanningEnabled()){i(te,e.touchData.starts)&&(t.preventDefault(),e.swipePanning?o.panBy({x:g[0]*h,y:g[1]*h}):p&&(e.swipePanning=!0,o.panBy({x:T*h,y:_*h}),te&&(te.unactivate(),e.data.bgActivePosistion||(e.data.bgActivePosistion=rt(e.touchData.startPosition)),e.redrawHint("select",!0),e.touchData.start=null)));d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=d[0],s[1]=d[1]}}for(C=0;C<s.length;C++)u[C]=s[C];r&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(window,"touchcancel",I=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(window,"touchend",z=function(r){var i=e.touchData.start;if(e.touchData.capture){0===r.touches.length&&(e.touchData.capture=!1),r.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,h=e.touchData.earlier;if(r.touches[0]){var d=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);u[0]=d[0],u[1]=d[1]}if(r.touches[1]){d=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);u[2]=d[0],u[3]=d[1]}if(r.touches[2]){d=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);u[4]=d[0],u[5]=d[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:r,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:r,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!r.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var f=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:r,position:{x:u[0],y:u[1]}});f.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),f.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),r.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(r.touches[1]);else if(r.touches[0]);else if(!r.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=i){var v=i._private.grabbed;c(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(i.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),g.emit("dragfree"))),n(i,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);n(y,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),n(i,["tap","vclick"],r,{x:u[0],y:u[1]})),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w<e.touchTapThreshold2&&!e.pinching&&("single"===s.selectionType()?(s.$(t).unmerge(i).unselect(["tapunselect"]),i.select(["tapselect"])):i.selected()?i.unselect(["tapunselect"]):i.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var E=0;E<u.length;E++)h[E]=u[E];e.dragData.didDrag=!1,0===r.touches.length&&(e.touchData.dragDelta=[],e.touchData.startPosition=null,e.touchData.startGPosition=null),r.touches.length<2&&(e.pinching=!1,e.redrawHint("eles",!0),e.redraw())}},!1),"undefined"==typeof TouchEvent){var O=[],R=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},F=function(e){O.push(function(e){return{event:e,touch:R(e)}}(e))},V=function(e){for(var t=0;t<O.length;t++){if(O[t].event.pointerId===e.pointerId)return void O.splice(t,1)}},q=function(e){e.touches=O.map(function(e){return e.touch})},j=function(e){return"mouse"===e.pointerType||4===e.pointerType};e.registerBinding(e.container,"pointerdown",function(e){j(e)||(e.preventDefault(),F(e),q(e),_(e))}),e.registerBinding(e.container,"pointerup",function(e){j(e)||(V(e),q(e),z(e))}),e.registerBinding(e.container,"pointercancel",function(e){j(e)||(V(e),q(e),I())}),e.registerBinding(e.container,"pointermove",function(e){j(e)||(e.preventDefault(),function(e){var t=O.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=R(e)}(e),q(e),N(e))})}};var gs={generatePolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o){return Kt(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o){return Ft(e,t,this.points,a,o,r,i,[0,-1],n)}}},generateEllipse:function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){return jt(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o){return Yt(e,t,r,i,a,o,n)}}},generateRoundRectangle:function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Zt(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){return _t(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=Qt(r,i),l=2*s;return!!Ft(e,t,this.points,a,o,r,i-l,[0,-1],n)||(!!Ft(e,t,this.points,a,o,r-l,i,[0,-1],n)||(!!Yt(e,t,l,l,a-r/2+s,o-i/2+s,n)||(!!Yt(e,t,l,l,a+r/2-s,o-i/2+s,n)||(!!Yt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!Yt(e,t,l,l,a-r/2+s,o+i/2-s,n)))))}}},generateCutRectangle:function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:8,points:Zt(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},generateCutTrianglePts:function(e,t,n,r){var i=this.cornerLength,a=t/2,o=e/2,s=n-o,l=n+o,u=r-a,c=r+a;return{topLeft:[s,u+i,s+i,u,s+i,u+i],topRight:[l-i,u,l,u+i,l-i,u+i],bottomRight:[l,c-i,l-i,c,l-i,c-i],bottomLeft:[s+i,c,s,c-i,s+i,c-i]}},intersectLine:function(e,t,n,r,i,a,o){var s=this.generateCutTrianglePts(n+2*o,r+2*o,e,t),l=[].concat.apply([],[s.topLeft.splice(0,4),s.topRight.splice(0,4),s.bottomRight.splice(0,4),s.bottomLeft.splice(0,4)]);return Kt(i,a,l,e,t)},checkPoint:function(e,t,n,r,i,a,o){if(Ft(e,t,this.points,a,o,r,i-2*this.cornerLength,[0,-1],n))return!0;if(Ft(e,t,this.points,a,o,r-2*this.cornerLength,i,[0,-1],n))return!0;var s=this.generateCutTrianglePts(r,i,a,o);return Rt(e,t,s.topLeft)||Rt(e,t,s.topRight)||Rt(e,t,s.bottomRight)||Rt(e,t,s.bottomLeft)}}},generateBarrel:function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Zt(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){var s=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),l=function(e){var t=vt({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=vt({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),r=vt({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]},u=[].concat(l(s.topLeft),l(s.topRight),l(s.bottomRight),l(s.bottomLeft));return Kt(i,a,u,e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,l=r-i,u=r+i,c=en(e,t),h=c.heightOffset,d=c.widthOffset,p=c.ctrlPtOffsetPct*e,f={topLeft:[o,l+h,o+p,l,o+d,l],topRight:[s-d,l,s-p,l,s,l+h],bottomRight:[s,u-h,s-p,u,s-d,u],bottomLeft:[o+d,u,o+p,u,o,u-h]};return f.topLeft.isTop=!0,f.topRight.isTop=!0,f.bottomLeft.isBottom=!0,f.bottomRight.isBottom=!0,f},checkPoint:function(e,t,n,r,i,a,o){var s=en(r,i),l=s.heightOffset,u=s.widthOffset;if(Ft(e,t,this.points,a,o,r,i-2*l,[0,-1],n))return!0;if(Ft(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var c=this.generateBarrelBezierPts(r,i,a,o),h=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1],l=Math.min(r,a),u=Math.max(r,a),c=Math.min(o,s),h=Math.max(o,s);if(l<=e&&e<=u&&c<=t&&t<=h){var d=Jt(r,i,a),p=zt(d[0],d[1],d[2],e).filter(function(e){return 0<=e&&e<=1});if(p.length>0)return p[0]}return null},d=Object.keys(c),p=0;p<d.length;p++){var f=c[d[p]],g=h(e,t,f);if(null!=g){var v=f[5],y=f[3],m=f[1],b=gt(v,y,m,g);if(f.isTop&&b<=t)return!0;if(f.isBottom&&t<=b)return!0}}return!1}}},generateBottomRoundrectangle:function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Zt(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){var s=t-(r/2+o),l=Ht(i,a,e,t,e-(n/2+o),s,e+(n/2+o),s,!1);return l.length>0?l:_t(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=Qt(r,i),l=2*s;if(Ft(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(Ft(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Rt(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!Yt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!Yt(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},registerNodeShapes:function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Zt(3,0)),this.generatePolygon("rectangle",Zt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle(),this.generatePolygon("diamond",[0,1,1,0,0,-1,-1,0]),this.generatePolygon("pentagon",Zt(5,0)),this.generatePolygon("hexagon",Zt(6,0)),this.generatePolygon("heptagon",Zt(7,0)),this.generatePolygon("octagon",Zt(8,0));var n=new Array(20),r=$t(5,0),i=$t(5,Math.PI/5),a=.5*(3-Math.sqrt(5));a*=1.57;for(var o=0;o<i.length/2;o++)i[2*o]*=a,i[2*o+1]*=a;for(o=0;o<5;o++)n[4*o]=r[2*o],n[4*o+1]=r[2*o+1],n[4*o+2]=i[2*o],n[4*o+3]=i[2*o+1];n=Ut(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]),this.generatePolygon("tag",[-1,-1,.25,-1,1,0,.25,1,-1,1]),e.makePolygon=function(e){var n,r="polygon-"+e.join("$");return(n=this[r])?n:t.generatePolygon(r,e)}}},vs={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(e){e=e||Te();var t=this;void 0===t.averageRedrawTime&&(t.averageRedrawTime=0),void 0===t.lastRedrawTime&&(t.lastRedrawTime=0),void 0===t.lastDrawTime&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},beforeRender:function(e,t){if(!this.destroyed){null==t&&Ee("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(e,t){return t.priority-e.priority})}}},ys=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};vs.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;oe(function n(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){ys(e,!0,r);var i=se();e.render(e.renderOptions);var a=e.lastDrawTime=se();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else ys(e,!1,r);e.skipFrame=!1,oe(n)}})}};var ms=function(e){this.init(e)},bs=ms.prototype;bs.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],bs.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container();if(a){var r=a.document,i=r.head,o="__________cytoscape_container",s=null!=r.getElementById("__________cytoscape_stylesheet");if(n.className.indexOf(o)<0&&(n.className=(n.className||"")+" "+o),!s){var l=r.createElement("style");l.id="__________cytoscape_stylesheet",l.innerHTML="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}"static"===a.getComputedStyle(n).getPropertyValue("position")&&Ce("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.hideLabelsOnViewport=e.hideLabelsOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=v(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},bs.notify=function(e,t){var n=this,r=n.cy;this.destroyed||("init"!==e?"destroy"!==e?(("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&n.invalidateCachedZSortedEles(),"viewport"===e&&n.redrawHint("select",!0),"load"!==e&&"resize"!==e&&"mount"!==e||(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()):n.destroy():n.load())},bs.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch(e){}},bs.isHeadless=function(){return!1},[$o,ds,ps,fs,gs,vs].forEach(function(e){I(bs,e)});var xs=function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=ne(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),i=e.priority||we;n.beforeRender(function(i,a){var o=se(),s=n.averageRedrawTime,l=n.lastRedrawTime,u=[],c=n.cy.extent(),h=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var d=se(),p=d-o,f=d-a;if(l<1e3/60){var g=1e3/60-(i?s:0);if(f>=e.deqFastCost*g)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*(1e3/60))break;var v=e.deq(t,h,c);if(!(v.length>0))break;for(var y=0;y<v.length;y++)u.push(v[y])}u.length>0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&r())},i(t))}}},ws=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:be;t(this,e),this.idsByKey=new ze,this.keyForId=new ze,this.cachesByLvl=new ze,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return r(e,[{key:"getIdsFor",value:function(e){null==e&&Ee("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Ae,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new ze,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Es={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ks=Me({getKey:null,doesEleInvalidateKey:be,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:me,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Cs=function(e,t){this.renderer=e,this.onDequeues=[];var n=ks(t);I(this,n),this.lookup=new ws(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},Ss=Cs.prototype;Ss.reasons=Es,Ss.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},Ss.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Ss.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new Ve(function(e,t){return t.reqs-e.reqs})},Ss.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Ss.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(ct(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,h=t.w*u,d=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||h>1024)return null;var g=a.getTextureQueue(p),v=g[g.length-2],y=function(){return a.recycleTexture(p,h)||a.addTexture(p,h)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidth<h&&(v=y());for(var m,b=function(e){return e&&e.scaledLabelShown===d},x=i&&i===Es.dequeue,w=i&&i===Es.highQuality,E=i&&i===Es.downscale,k=r+1;k<=3;k++){var C=l.get(e,k);if(C){m=C;break}}var S=m&&m.level===r+1?m:null,D=function(){v.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,v.usedWidth,0,h,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,h,p),b(S))D();else if(b(m)){if(!w)return a.queueElement(e,m.level-1),m;for(var P=m.level;P>r;P--)S=a.getElement(e,t,n,P,Es.downscale);D()}else{var T;if(!x&&!w&&!E)for(var M=r-1;M>=-4;M--){var B=l.get(e,M);if(B){T=B;break}}if(b(T))return a.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,d,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:h,height:c,scaledLabelShown:d},v.usedWidth+=Math.ceil(h+8),v.eleCaches.push(f),l.set(e,r,f),a.checkTextureFullness(v),f},Ss.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},Ss.invalidateElement=function(e){var t=this.lookup,n=[];if(t.isInvalid(e)){for(var r=-4;r<=3;r++){var i=t.getForCachedKey(e,r);i&&n.push(i)}if(t.invalidate(e))for(var a=0;a<n.length;a++){var o=n[a],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},Ss.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},Ss.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Be(t,e):e.fullnessChecks++},Ss.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Be(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a<i.length;a++){var o=i[a];r.deleteCache(o.key,o.level)}_e(i),this.getRetiredTextureQueue(t).push(e)},Ss.addTexture=function(e,t){var n={};return this.getTextureQueue(e).push(n),n.eleCaches=[],n.height=e,n.width=Math.max(1024,t),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=this.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},Ss.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),i=0;i<r.length;i++){var a=r[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,_e(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Be(r,a),n.push(a),a}},Ss.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},Ss.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,!u){r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,Es.dequeue)}}return r},Ss.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=ye,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Ss.onDequeue=function(e){this.onDequeues.push(e)},Ss.offDequeue=function(e){Be(this.onDequeues,e)},Ss.setupDequeueing=xs({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){(0,e.onDequeues[n])(t)}},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++){var s=a[o].boundingBox();if(Pt(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Ds=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=se()-500,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=ne(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),n.beforeRender(function(e,n){n-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);t.layersQueue=new Ve(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},Ps=Ds.prototype,Ts=0,Ms=Math.pow(2,53)-1;Ps.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:Ts=++Ts%Ms,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(n,n),s.translate(l,u),o},Ps.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(ct(i*t)))<-4)n=-4;else if(i>=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Be(c,o)}}();var h=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=bt();for(var t=0;t<e.length;t++)Et(o,e[t].boundingBox())}}(),o.w*u*(o.h*u)>16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var d=null,p=e.length/1,f=!a,g=0;g<e.length;g++){var v=e[g],y=v._private.rscratch,m=y.imgLayerCaches=y.imgLayerCaches||{},b=m[n];if(b)d=b;else{if((!d||d.eles.length>=p||!Bt(d.bb,v.boundingBox()))&&!(d=h({insert:!0,after:d})))return null;s||f?r.queueLayer(d,v):r.drawEleInLayer(d,v,n,t),d.eles.push(v),m[n]=d}}return s||(f?null:c)},Ps.getEleLevelForLayerLevel=function(e,t){return e},Ps.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},Ps.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},Ps.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0)this.invalidateLayer(i);else{var s=a;for(o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}}},Ps.updateElementsInLayers=function(e,t){for(var n=b(e[0]),r=0;r<e.length;r++)for(var i=n?null:e[r],a=n?e[r]:e[r].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];u&&(i&&this.getEleLevelForLayerLevel(u.level)!==i.level||t(u,a,i))}},Ps.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},Ps.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=se(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},Ps.invalidateLayer=function(e){if(this.lastInvalidationTime=se(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Be(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},Ps.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,r){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},Ps.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},Ps.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},Ps.dequeue=function(e){for(var t=this.layersQueue,n=[],r=0;r<1&&0!==t.size();){var i=t.peek();if(i.replacement)t.pop();else if(i.replaces&&i!==i.replaces.replacement)t.pop();else if(i.invalid)t.pop();else{var a=i.elesQueue.shift();a&&(this.drawEleInLayer(i,a,i.level,e),r++),0===n.length&&n.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&this.applyLayerReplacement(i),this.requestRedraw())}}return n},Ps.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],n=e.replaces,r=t.indexOf(n);if(!(r<0||n.invalid)){t[r]=e;for(var i=0;i<e.eles.length;i++){var a=e.eles[i]._private,o=a.imgLayerCaches=a.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},Ps.requestRedraw=ne(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),Ps.setupDequeueing=xs({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:we,shouldRedraw:me,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Bs,_s={};function Ns(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function Is(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function zs(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];e.moveTo(s.x,s.y);for(i=1;i<o.length;i++){a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function Ls(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}_s.arrowShapeImpl=function(e){return(Bs||(Bs={polygon:Ns,"triangle-backcurve":Is,"triangle-tee":zs,"triangle-cross":zs,circle:Ls}))[e]};var As={drawElement:function(e,t,n,r,i,a){t.isNode()?this.drawNode(e,t,n,r,i,a):this.drawEdge(e,t,n,r,i,a)},drawElementOverlay:function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},drawCachedElementPortion:function(e,t,n,r,i,a,o){var s=this,l=n.getBoundingBox(t);if(0!==l.w&&0!==l.h){var u=n.getElement(t,l,r,i,a);if(null!=u){var c=t.effectiveOpacity();if(0===c)return;var h,d,p,f,g,v,y=o(s,t),m=l.x1,b=l.y1,x=l.w,w=l.h;if(0!==y){var E=n.getRotationPoint(t);p=E.x,f=E.y,e.translate(p,f),e.rotate(y),(g=s.getImgSmoothing(e))||s.setImgSmoothing(e,!0);var k=n.getRotationOffset(t);h=k.x,d=k.y}else h=m,d=b;1!==c&&(v=e.globalAlpha,e.globalAlpha=v*c),e.drawImage(u.texture.canvas,u.x,0,u.width,u.height,h,d,x,w),1!==c&&(e.globalAlpha=v),0!==y&&(e.rotate(-y),e.translate(-p,-f),g||s.setImgSmoothing(e,!1))}else n.drawElement(e,t)}}},Os=function(){return 0},Rs=function(e,t){return e.getTextAngle(t,null)},Fs=function(e,t){return e.getTextAngle(t,"source")},Vs=function(e,t){return e.getTextAngle(t,"target")};As.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,h=s.tlbTxrCache,d=t.boundingBox(),p=!0===a?l.reasons.highQuality:null;0!==d.w&&0!==d.h&&t.visible()&&(r&&!Pt(d,r)||(o.drawCachedElementPortion(e,t,l,n,i,p,Os),o.drawCachedElementPortion(e,t,u,n,i,p,Rs),t.isEdge()&&(o.drawCachedElementPortion(e,t,c,n,i,p,Fs),o.drawCachedElementPortion(e,t,h,n,i,p,Vs)),o.drawElementOverlay(e,t)))},As.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},As.drawCachedElements=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,n,r)}},As.drawCachedNodes=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,n,r)}},As.drawLayeredElements=function(e,t,n,r){var i=this.data.lyrTxrCache.getLayers(t,n);if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,n,r)};var qs={drawEdge:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if(t.visible()&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=t.pstyle("line-style").value,h=t.pstyle("width").pfValue,d=t.pstyle("line-cap").value,p=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u;e.lineWidth=h,e.lineCap=d,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,c),e.lineCap="butt"},f=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u;o.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var g=t.pstyle("ghost-offset-x").pfValue,v=t.pstyle("ghost-offset-y").pfValue,y=t.pstyle("ghost-opacity").value,m=u*y;e.translate(g,v),p(m),f(m),e.translate(-g,-v)}p(),f(),i&&o.drawEdgeOverlay(e,t),o.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}},drawEdgeOverlay:function(e,t){if(t.visible()){var n=t.pstyle("overlay-opacity").value;if(0!==n){var r=this,i=r.usePaths(),a=t._private.rscratch,o=2*t.pstyle("overlay-padding").pfValue,s=t.pstyle("overlay-color").value;e.lineWidth=o,"self"!==a.edgeType||i?e.lineCap="round":e.lineCap="butt",r.colorStrokeStyle(e,s[0],s[1],s[2],n),r.drawEdgePath(t,e,a.allpts,"solid")}}},drawEdgePath:function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<n.length;d+=4)t.quadraticCurveTo(n[d],n[d+1],n[d+2],n[d+3]);break;case"straight":case"segments":case"haystack":for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1])}t=o,l?t.stroke(i):t.stroke(),t.setLineDash&&t.setLineDash([])},drawArrowheads:function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},drawArrowhead:function(e,t,n,r,i,a,o){if(!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a)){var s=t.pstyle(n+"-arrow-shape").value;if("none"!==s){var l="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",u=t.pstyle(n+"-arrow-fill").value,c=t.pstyle("width").pfValue,h=t.pstyle("opacity").value;void 0===o&&(o=h);var d=e.globalCompositeOperation;1===o&&"hollow"!==u||(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,l,c,s,r,i,a),e.globalCompositeOperation=d);var p=t.pstyle(n+"-arrow-color").value;this.colorFillStyle(e,p[0],p[1],p[2],o),this.colorStrokeStyle(e,p[0],p[1],p[2],o),this.drawArrowShape(t,e,u,c,s,r,i,a)}}},drawArrowShape:function(e,t,n,r,i,a,o,s){var l,u=this,c=this.usePaths()&&"triangle-cross"!==i,h=!1,d=t,p={x:a,y:o},f=e.pstyle("arrow-scale").value,g=this.getArrowWidth(r,f),v=u.arrowShapes[i];if(c){var y=u.arrowPathCache=u.arrowPathCache||[],m=he(i),b=y[m];null!=b?(l=t=b,h=!0):(l=t=new Path2D,y[m]=l)}t.beginPath&&t.beginPath(),h||(c?v.draw(t,1,0,{x:0,y:0},1):v.draw(t,g,s,p,r)),t.closePath&&t.closePath(),t=d,c&&(t.translate(a,o),t.rotate(s),t.scale(g,g)),"filled"!==n&&"both"!==n||(c?t.fill(l):t.fill()),"hollow"!==n&&"both"!==n||(t.lineWidth=(v.matchEdgeWidth?r:1)/(c?g:1),t.lineJoin="miter",c?t.stroke(l):t.stroke()),c&&(t.scale(1/g,1/g),t.rotate(-s),t.translate(-a,-o))}},js={safeDrawImage:function(e,t,n,r,i,a,o,s,l,u){i<=0||a<=0||l<=0||u<=0||e.drawImage(t,n,r,i,a,o,s,l,u)},drawInscribedImage:function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,l=o.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),h=c(n,"background-fit","value",r),d=c(n,"background-repeat","value",r),p=n.width(),f=n.height(),g=2*n.padding(),v=p+("inner"===c(n,"background-width-relative-to","value",r)?0:g),y=f+("inner"===c(n,"background-height-relative-to","value",r)?0:g),m=n._private.rscratch,b="node"===n.pstyle("background-clip").value,x=c(n,"background-image-opacity","value",r)*i,w=t.width||t.cachedW,E=t.height||t.cachedH;null!=w&&null!=E||(document.body.appendChild(t),w=t.cachedW=t.width||t.offsetWidth,E=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var k=w,C=E;if("auto"!==c(n,"background-width","value",r)&&(k="%"===c(n,"background-width","units",r)?c(n,"background-width","pfValue",r)*v:c(n,"background-width","pfValue",r)),"auto"!==c(n,"background-height","value",r)&&(C="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*y:c(n,"background-height","pfValue",r)),0!==k&&0!==C){if("contain"===h)k*=S=Math.min(v/k,y/C),C*=S;else if("cover"===h){var S;k*=S=Math.max(v/k,y/C),C*=S}var D=s-v/2,P=c(n,"background-position-x","units",r),T=c(n,"background-position-x","pfValue",r);D+="%"===P?(v-k)*T:T;var M=c(n,"background-offset-x","units",r),B=c(n,"background-offset-x","pfValue",r);D+="%"===M?(v-k)*B:B;var _=l-y/2,N=c(n,"background-position-y","units",r),I=c(n,"background-position-y","pfValue",r);_+="%"===N?(y-C)*I:I;var z=c(n,"background-offset-y","units",r),L=c(n,"background-offset-y","pfValue",r);_+="%"===z?(y-C)*L:L,m.pathCache&&(D-=s,_-=l,s=0,l=0);var A=e.globalAlpha;if(e.globalAlpha=x,"no-repeat"===d)b&&(e.save(),m.pathCache?e.clip(m.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,v,y),e.clip())),a.safeDrawImage(e,t,0,0,w,E,D,_,k,C),b&&e.restore();else{var O=e.createPattern(t,d);e.fillStyle=O,a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,v,y),e.translate(D,_),e.fill(),e.translate(-D,-_)}e.globalAlpha=A}}},Ys={};Ys.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(ct(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},Ys.drawElementText=function(e,t,n,r,i){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.pstyle("label"),c=t.pstyle("source-label"),h=t.pstyle("target-label");if(!(u&&u.value||c&&c.value||h&&h.value))return;e.textAlign="center",e.textBaseline="bottom"}var d,p=!n;n&&(d=n,e.translate(-d.x1,-d.y1)),null==i?(o.drawText(e,t,null,p,a),t.isEdge()&&(o.drawText(e,t,"source",p,a),o.drawText(e,t,"target",p,a))):o.drawText(e,t,i,p,a),n&&e.translate(d.x1,d.y1)},Ys.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},Ys.setupTextStyle=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=t.pstyle("text-opacity").value*(n?t.effectiveOpacity():1),l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Ys.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=Ne(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Ys.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,l,u=Ne(a,"labelX",n),c=Ne(a,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,i);var d,p=n?n+"-":"",f=Ne(a,"labelWidth",n),g=Ne(a,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,y=t.pstyle(p+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(m&&(b="center",x="center"),u+=v,c+=y,0!==(d=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(d),u=0,c=0),x){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g}var w=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue;if(w>0||k>0&&E>0){var S=u-C;switch(b){case"left":S-=f;break;case"center":S-=f/2}var D=c-g-C,P=f+2*C,T=g+2*C;if(w>0){var M=e.fillStyle,B=t.pstyle("text-background-color").value;e.fillStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+w*o+")","roundrectangle"==t.pstyle("text-background-shape").strValue?function(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill()}(e,S,D,P,T,2):e.fillRect(S,D,P,T),e.fillStyle=M}if(k>0&&E>0){var _=e.strokeStyle,N=e.lineWidth,I=t.pstyle("text-border-color").value,z=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*o+")",e.lineWidth=k,e.setLineDash)switch(z){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(S,D,P,T),"double"===z){var L=k/2;e.strokeRect(S+L,D+L,P-2*L,T-2*L)}e.setLineDash&&e.setLineDash([]),e.lineWidth=N,e.strokeStyle=_}}var A=2*t.pstyle("text-outline-width").pfValue;if(A>0&&(e.lineWidth=A),"wrap"===t.pstyle("text-wrap").value){var O=Ne(a,"labelWrapCachedLines",n),R=Ne(a,"labelLineHeight",n),F=f/2,V=this.getLabelJustification(t);switch("auto"===V||("left"===b?"left"===V?u+=-f:"center"===V&&(u+=-F):"center"===b?"left"===V?u+=-F:"right"===V&&(u+=F):"right"===b&&("center"===V?u+=F:"right"===V&&(u+=f))),x){case"top":c-=(O.length-1)*R;break;case"center":case"bottom":c-=(O.length-1)*R}for(var q=0;q<O.length;q++)A>0&&e.strokeText(O[q],u,c),e.fillText(O[q],u,c),c+=R}else A>0&&e.strokeText(h,u,c),e.fillText(h,u,c);0!==d&&(e.rotate(-d),e.translate(-s,-l))}}};var Xs={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,h=t.position();if(v(h.x)&&v(h.y)&&t.visible()){var d,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),y=!1,m=t.padding();r=t.width()+2*m,i=t.height()+2*m,n&&(p=n,e.translate(-p.x1,-p.y1));for(var b=t.pstyle("background-image").value,x=new Array(b.length),w=new Array(b.length),E=0,k=0;k<b.length;k++){var C=b[k];if(x[k]=null!=C&&"none"!==C){var S=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",k);E++,w[k]=l.getCachedImage(C,S,function(){u.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var D=t.pstyle("background-blacken").value,P=t.pstyle("border-width").pfValue,T=t.pstyle("background-opacity").value*f,M=t.pstyle("border-color").value,B=t.pstyle("border-style").value,_=t.pstyle("border-opacity").value*f;e.lineJoin="miter";var N=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:T;l.eleFillStyle(e,t,n)},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_;l.colorStrokeStyle(e,M[0],M[1],M[2],t)},z=t.pstyle("shape").strValue,L=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(h.x,h.y);var A=l.nodePathCache=l.nodePathCache||[],O=de("polygon"===z?z+","+L.join(","):z,""+i,""+r),R=A[O];null!=R?(d=R,y=!0,c.pathCache=d):(d=new Path2D,A[O]=c.pathCache=d)}var F=function(){if(!y){var n=h;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(d||e,n.x,n.y,r,i)}g?e.fill(d):e.fill()},V=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=u.backgrounding,i=0,a=0;a<w.length;a++)x[a]&&w[a].complete&&!w[a].error&&(i++,l.drawInscribedImage(e,w[a],t,a,n));u.backgrounding=!(i===E),r!==u.backgrounding&&t.updateStyle(!1)},q=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i)))},j=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,n=(D>0?D:-D)*t,r=D>0?0:255;0!==D&&(l.colorFillStyle(e,r,r,r,n),g?e.fill(d):e.fill())},Y=function(){if(P>0){if(e.lineWidth=P,e.lineCap="butt",e.setLineDash)switch(B){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(g?e.stroke(d):e.stroke(),"double"===B){e.lineWidth=P/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(d):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var X=t.pstyle("ghost-offset-x").pfValue,W=t.pstyle("ghost-offset-y").pfValue,H=t.pstyle("ghost-opacity").value,K=H*f;e.translate(X,W),N(H*T),F(),V(K),q(0!==D||0!==P),j(K),I(H*_),Y(),e.translate(-X,-W)}N(),F(),V(),q(0!==D||0!==P),j(),I(),Y(),g&&e.translate(-h.x,-h.y),l.drawElementText(e,t,null,a),o&&l.drawNodeOverlay(e,t,h,r,i),n&&e.translate(p.x1,p.y1)}},drawNodeOverlay:function(e,t,n,r,i){if(t.visible()){var a=t.pstyle("overlay-padding").pfValue,o=t.pstyle("overlay-opacity").value,s=t.pstyle("overlay-color").value;if(o>0){if(n=n||t.position(),null==r||null==i){var l=t.padding();r=t.width()+2*l,i=t.height()+2*l}this.colorFillStyle(e,s[0],s[1],s[2],o),this.nodeShapes.roundrectangle.draw(e,n.x,n.y,r+2*a,i+2*a),e.fill()}}},hasPie:function(e){return(e=e[0])._private.hasPie},drawPie:function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,h=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var d=1;d<=i.pieBackgroundN;d++){var p=t.pstyle("pie-"+d+"-background-size").value,f=t.pstyle("pie-"+d+"-background-color").value,g=t.pstyle("pie-"+d+"-background-opacity").value*n,v=p/100;v+h>1&&(v=1-h);var y=1.5*Math.PI+2*Math.PI*h,m=y+2*Math.PI*v;0===p||h>=1||h+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),h+=v)}}},Ws={};Ws.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},Ws.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if((t=n[i]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},Ws.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)if(n.isEdge()){var u=n.sourceEndpoint(),c=n.targetEndpoint(),h=n.midpoint(),d=dt(u,h),p=dt(c,h);a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(d,p))}else{var f=o?{x:0,y:0}:n.position(),g=n.width(),v=n.height();a=e.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(g,v))}else if(n.isEdge()){var y=n.sourceEndpoint(),m=n.targetEndpoint();a=e.createLinearGradient(y.x,y.y,m.x,m.y)}else{var b=o?{x:0,y:0}:n.position(),x=n.width()/2,w=n.height()/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(b.x,b.y-w,b.x,b.y+w);break;case"to-top":a=e.createLinearGradient(b.x,b.y+w,b.x,b.y-w);break;case"to-left":a=e.createLinearGradient(b.x-x,b.y,b.x+x,b.y);break;case"to-right":a=e.createLinearGradient(b.x+x,b.y,b.x-x,b.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(b.x-x,b.y-w,b.x+x,b.y+w);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(b.x-x,b.y+w,b.x+x,b.y-w);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(b.x+x,b.y-w,b.x-x,b.y+w);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(b.x+x,b.y+w,b.x-x,b.y-w)}}if(!a)return null;for(var E=l.length===s.length,k=s.length,C=0;C<k;C++)a.addColorStop(E?l[C]:C/(k-1),"rgba("+s[C][0]+","+s[C][1]+","+s[C][2]+","+i+")");return a},Ws.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},Ws.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},Ws.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},Ws.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},Ws.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},Ws.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},Ws.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]&&e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG]||(o=s);var l,u=i*o,c=a*o;if(u!==t.canvasWidth||c!==t.canvasHeight){t.fontCaches=null;var h=n.canvasContainer;h.style.width=i+"px",h.style.height=a+"px";for(var d=0;d<t.CANVAS_LAYERS;d++)(l=n.canvases[d]).width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"px";for(d=0;d<t.BUFFER_COUNT;d++)(l=n.bufferCanvases[d]).width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"px";t.textureMult=1,o<=1&&(l=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,l.width=u*t.textureMult,l.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c}},Ws.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},Ws.render=function(e){var t=(e=e||Te()).forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,i=e.forcedZoom,a=e.forcedPan,o=this,s=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,l=o.cy,u=o.data,c=u.canvasNeedsRedraw,h=o.textureOnViewport&&!t&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),d=void 0!==e.motionBlur?e.motionBlur:o.motionBlur,p=o.motionBlurPxRatio,f=l.hasCompoundNodes(),g=o.hoverData.draggingEles,v=!(!o.hoverData.selecting&&!o.touchData.selecting),y=d=d&&!t&&o.motionBlurEnabled&&!v;t||(o.prevPxRatio!==s&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=s),!t&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),d&&(null==o.mbFrames&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(y=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!h&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},C=o.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!f||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var S=o.getCachedZSortedEles();function D(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function P(e,r){var s,l,c,h;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,h=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,h=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?D(e,0,0,c,h):t||void 0!==r&&!r||e.clearRect(0,0,c,h),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(h||(o.textureDrawLastFrame=!1),h){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var M=u.contexts[o.NODE],B=o.textureCache.texture;k=o.textureCache.viewport;M.setTransform(1,0,0,1,0,0),d?D(M,0,0,k.width,k.height):M.clearRect(0,0,k.width,k.height);var _=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(M,_[0],_[1],_[2],N),M.fillRect(0,0,k.width,k.height);b=l.zoom();P(M,!1),M.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),M.drawImage(B,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var I=l.extent(),z=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles,L=o.hideEdgesOnViewport&&z,A=[];if(A[o.NODE]=!c[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,A[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),A[o.DRAG]=!c[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,A[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||A[o.NODE]){var O=d&&!A[o.NODE]&&1!==p;P(M=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),d&&!O?"motionBlur":void 0),L?o.drawCachedNodes(M,S.nondrag,s,I):o.drawLayeredElements(M,S.nondrag,s,I),o.debug&&o.drawDebugPoints(M,S.nondrag),n||d||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||A[o.DRAG])){O=d&&!A[o.DRAG]&&1!==p;P(M=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),d&&!O?"motionBlur":void 0),L?o.drawCachedNodes(M,S.drag,s,I):o.drawCachedElements(M,S.drag,s,I),o.debug&&o.drawDebugPoints(M,S.drag),n||d||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(P(M=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;M.lineWidth=R,M.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",M.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(M.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",M.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var F=u.bgActivePosistion;M.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",M.beginPath(),M.arc(F.x,F.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),M.fill()}var V=o.lastRedrawTime;if(o.showFps&&V){V=Math.round(V);var q=Math.round(1e3/V);M.setTransform(1,0,0,1,0,0),M.fillStyle="rgba(255, 0, 0, 0.75)",M.strokeStyle="rgba(255, 0, 0, 0.75)",M.lineWidth=1,M.fillText("1 frame = "+V+" ms = "+q+" fps",0,20);M.strokeRect(0,30,250,20),M.fillRect(0,30,250*Math.min(q/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(d&&1!==p){var j=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):D(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||A[o.NODE])&&(H(j,Y,A[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||A[o.DRAG])&&(H(X,W,A[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!h,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()},100)),t||l.emit("render")};for(var Hs={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],n+s*a[2*l+1]);e.closePath()},drawRoundRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2,s=Qt(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.arcTo(t+a,n-o,t+a,n,s),e.arcTo(t+a,n+o,t,n+o,s),e.arcTo(t-a,n+o,t-a,n,s),e.arcTo(t-a,n-o,t,n-o,s),e.lineTo(t,n-o),e.closePath()},drawBottomRoundRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2,s=Qt(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.lineTo(t+a,n-o),e.lineTo(t+a,n),e.arcTo(t+a,n+o,t,n+o,s),e.arcTo(t-a,n+o,t-a,n,s),e.lineTo(t-a,n-o),e.lineTo(t,n-o),e.closePath()},drawCutRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2;e.beginPath&&e.beginPath(),e.moveTo(t-a+8,n-o),e.lineTo(t+a-8,n-o),e.lineTo(t+a,n-o+8),e.lineTo(t+a,n+o-8),e.lineTo(t+a-8,n+o),e.lineTo(t-a+8,n+o),e.lineTo(t-a,n+o-8),e.lineTo(t-a,n-o+8),e.closePath()},drawBarrelPath:function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,l=t+a,u=n-o,c=n+o,h=en(r,i),d=h.widthOffset,p=h.heightOffset,f=h.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(s,u+p),e.lineTo(s,c-p),e.quadraticCurveTo(s+f,c,s+d,c),e.lineTo(l-d,c),e.quadraticCurveTo(l-f,c,l,c-p),e.lineTo(l,u+p),e.quadraticCurveTo(l-f,u,l-d,u),e.lineTo(s+d,u),e.quadraticCurveTo(s+f,u,s,u+p),e.closePath()}},Ks=Math.sin(0),Gs=Math.cos(0),Zs={},Us={},$s=Math.PI/40,Qs=0*Math.PI;Qs<2*Math.PI;Qs+=$s)Zs[Qs]=Math.sin(Qs),Us[Qs]=Math.cos(Qs);Hs.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=$s)a=t-s*Zs[u]*Ks+s*Us[u]*Gs,o=n+l*Us[u]*Ks+l*Zs[u]*Gs,0===u?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var Js={};function el(e){var t=e.indexOf(",");return e.substr(t+1)}function tl(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new sr(function(r,i){try{t.toBlob(function(e){null!=e?r(e):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(e){i(e)}});case"blob":return function(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}(el(r()),n);case"base64":return el(r());case"base64uri":default:return r()}}Js.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},Js.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=v(e.maxWidth)||v(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;v(e.maxWidth)&&(u=l*e.maxWidth/i),v(e.maxHeight)&&(c=l*e.maxHeight/a),i*=l=Math.min(u,c),a*=l}o||(i*=s,a*=s,l*=s);var h=document.createElement("canvas");h.width=i,h.height=a,h.style.width=i+"px",h.style.height=a+"px";var d=h.getContext("2d");if(i>0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),d.translate(g.x,g.y),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(-g.x,-g.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},Js.png=function(e){return tl(e,this.bufferCanvasImage(e),"image/png")},Js.jpg=function(e){return tl(e,this.bufferCanvasImage(e),"image/jpeg")};var nl={nodeShapeImpl:function(e,t,n,r,i,a,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},rl=al,il=al.prototype;function al(e){var t=this;t.data={canvases:new Array(il.CANVAS_LAYERS),contexts:new Array(il.CANVAS_LAYERS),canvasNeedsRedraw:new Array(il.CANVAS_LAYERS),bufferCanvases:new Array(il.BUFFER_COUNT),bufferContexts:new Array(il.CANVAS_LAYERS)};t.data.canvasContainer=document.createElement("div");var n=t.data.canvasContainer.style;t.data.canvasContainer.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",n.position="relative",n.zIndex="0",n.overflow="hidden";var r=e.cy.container();r.appendChild(t.data.canvasContainer),r.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";var i={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};S()&&(i["-ms-touch-action"]="none",i["touch-action"]="none");for(var a=0;a<il.CANVAS_LAYERS;a++){var o=t.data.canvases[a]=document.createElement("canvas");t.data.contexts[a]=o.getContext("2d"),Object.keys(i).forEach(function(e){o.style[e]=i[e]}),o.style.position="absolute",o.setAttribute("data-id","layer"+a),o.style.zIndex=String(il.CANVAS_LAYERS-a),t.data.canvasContainer.appendChild(o),t.data.canvasNeedsRedraw[a]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[il.NODE].setAttribute("data-id","layer"+il.NODE+"-node"),t.data.canvases[il.SELECT_BOX].setAttribute("data-id","layer"+il.SELECT_BOX+"-selectbox"),t.data.canvases[il.DRAG].setAttribute("data-id","layer"+il.DRAG+"-drag");for(a=0;a<il.BUFFER_COUNT;a++)t.data.bufferCanvases[a]=document.createElement("canvas"),t.data.bufferContexts[a]=t.data.bufferCanvases[a].getContext("2d"),t.data.bufferCanvases[a].style.position="absolute",t.data.bufferCanvases[a].setAttribute("data-id","buffer"+a),t.data.bufferCanvases[a].style.zIndex=String(-a-1),t.data.bufferCanvases[a].style.visibility="hidden";t.pathsEnabled=!0;var s=bt(),l=function(e){return{x:-e.w/2,y:-e.h/2}},u=function(e){return e.boundingBox(),e[0]._private.bodyBounds},c=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||s},h=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||s},d=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||s},p=function(e,t){return t},f=function(e,t){return{x:e.x+t.pstyle("text-margin-x").pfValue,y:e.y+t.pstyle("text-margin-y").pfValue}},g=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},v=t.data.eleTxrCache=new Cs(t,{getKey:function(e){return e[0]._private.nodeKey},doesEleInvalidateKey:function(e){var t=e[0]._private;return!(t.oldBackgroundTimestamp===t.backgroundTimestamp)},drawElement:function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},getBoundingBox:u,getRotationPoint:function(e){return{x:((t=u(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2};var t},getRotationOffset:function(e){return l(u(e))},allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),y=t.data.lblTxrCache=new Cs(t,{getKey:function(e){return e[0]._private.labelStyleKey},drawElement:function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)},getBoundingBox:c,getRotationPoint:function(e){return f(g(e,"labelX","labelY"),e)},getRotationOffset:function(e){var t=c(e),n=l(c(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w;break;case"right":n.x=0}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h;break;case"bottom":n.y=0}}return n},isVisible:p}),m=t.data.slbTxrCache=new Cs(t,{getKey:function(e){return e[0]._private.sourceLabelStyleKey},drawElement:function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)},getBoundingBox:h,getRotationPoint:function(e){return f(g(e,"sourceLabelX","sourceLabelY"),e)},getRotationOffset:function(e){return l(h(e))},isVisible:p}),b=t.data.tlbTxrCache=new Cs(t,{getKey:function(e){return e[0]._private.targetLabelStyleKey},drawElement:function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)},getBoundingBox:d,getRotationPoint:function(e){return f(g(e,"targetLabelX","targetLabelY"),e)},getRotationOffset:function(e){return l(d(e))},isVisible:p}),x=t.data.lyrTxrCache=new Ds(t);t.onUpdateEleCalcs(function(e,t){v.invalidateElements(t),y.invalidateElements(t),m.invalidateElements(t),b.invalidateElements(t),x.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var w=function(e){for(var t=0;t<e.length;t++)x.enqueueElementRefinement(e[t].ele)};v.onDequeue(w),y.onDequeue(w),m.onDequeue(w),b.onDequeue(w)}il.CANVAS_LAYERS=3,il.SELECT_BOX=0,il.DRAG=1,il.NODE=2,il.BUFFER_COUNT=3,il.TEXTURE_BUFFER=0,il.MOTIONBLUR_BUFFER_NODE=1,il.MOTIONBLUR_BUFFER_DRAG=2,il.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[il.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[il.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[il.SELECT_BOX]=t}};var ol="undefined"!=typeof Path2D;il.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},il.usePaths=function(){return ol&&this.pathsEnabled},il.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},il.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},il.makeOffscreenCanvas=function(t,n){var r;return"undefined"!==("undefined"==typeof OffscreenCanvas?"undefined":e(OffscreenCanvas))?r=new OffscreenCanvas(t,n):((r=document.createElement("canvas")).width=t,r.height=n),r},[_s,As,qs,js,Ys,Xs,Ws,Hs,Js,nl].forEach(function(e){I(il,e)});var sl=[{type:"layout",extensions:Go},{type:"renderer",extensions:[{name:"null",impl:Zo},{name:"base",impl:ms},{name:"canvas",impl:rl}]}],ll={},ul={};function cl(e,t,n){var r=n,i=function(n){Ee("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(so.prototype[t])return i(t);so.prototype[t]=n}else if("collection"===e){if(Ca.prototype[t])return i(t);Ca.prototype[t]=n}else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),g(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(e){return e._private.cy},d={addEventFields:function(e,t){t.layout=e,t.cy=h(e),t.target=e},bubble:function(){return!0},parent:function(e){return h(e)}};I(o,{createEmitter:function(){return this._private.emitter=new ji(d,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),cr.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var p=hl("renderer","base"),f=p.prototype,v=n,y=n.prototype,m=function(){p.apply(this,arguments),v.apply(this,arguments)},b=m.prototype;for(var x in f){var w=f[x];if(null!=y[x])return i(x);b[x]=w}for(var E in y)b[E]=y[E];f.clientFunctions.forEach(function(e){b[e]=b[e]||function(){Ee("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=m}return A({map:ll,keys:[e,t],value:r})}function hl(e,t){return O({map:ll,keys:[e,t]})}var dl=function(){return 2===arguments.length?hl.apply(null,arguments):3===arguments.length?cl.apply(null,arguments):4===arguments.length?function(e,t,n,r){return O({map:ul,keys:[e,t,n,r]})}.apply(null,arguments):5===arguments.length?function(e,t,n,r,i){return A({map:ul,keys:[e,t,n,r],value:i})}.apply(null,arguments):void Ee("Invalid extension access syntax")};so.prototype.extension=dl,sl.forEach(function(e){e.extensions.forEach(function(t){cl(e.type,t.name,t.impl)})});var pl=function e(){if(!(this instanceof e))return new e;this.length=0},fl=pl.prototype;fl.instanceString=function(){return"stylesheet"},fl.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},fl.css=function(e,t){var n=this.length-1;if(d(e))this[n].properties.push({name:e,value:t});else if(g(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(null!=s){var l=no.properties[o]||no.properties[T(o)];if(null!=l){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},fl.style=fl.css,fl.generateStyle=function(e){var t=new no(e);return this.appendToStyle(t)},fl.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var gl=function(e){return void 0===e&&(e={}),g(e)?new so(e):d(e)?dl.apply(dl,arguments):void 0};return gl.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(gl),e.apply(null,t),this},gl.warnings=function(e){return ke(e)},gl.version="3.7.1",gl.stylesheet=gl.Stylesheet=pl,gl});
diff --git a/sourcecodes/scripts/d3-selection-multi.v1.js b/sourcecodes/scripts/d3-selection-multi.v1.js
new file mode 100644
index 00000000..ebd23dbe
--- /dev/null
+++ b/sourcecodes/scripts/d3-selection-multi.v1.js
@@ -0,0 +1,94 @@
+// https://github.com/d3/d3-selection-multi Version 1.0.1. Copyright 2017 Mike Bostock.
+(function (global, factory) {
+	typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('d3-selection'), require('d3-transition')) :
+	typeof define === 'function' && define.amd ? define(['d3-selection', 'd3-transition'], factory) :
+	(factory(global.d3,global.d3));
+}(this, (function (d3Selection,d3Transition) { 'use strict';
+
+function attrsFunction(selection$$1, map) {
+  return selection$$1.each(function() {
+    var x = map.apply(this, arguments), s = d3Selection.select(this);
+    for (var name in x) s.attr(name, x[name]);
+  });
+}
+
+function attrsObject(selection$$1, map) {
+  for (var name in map) selection$$1.attr(name, map[name]);
+  return selection$$1;
+}
+
+var selection_attrs = function(map) {
+  return (typeof map === "function" ? attrsFunction : attrsObject)(this, map);
+};
+
+function stylesFunction(selection$$1, map, priority) {
+  return selection$$1.each(function() {
+    var x = map.apply(this, arguments), s = d3Selection.select(this);
+    for (var name in x) s.style(name, x[name], priority);
+  });
+}
+
+function stylesObject(selection$$1, map, priority) {
+  for (var name in map) selection$$1.style(name, map[name], priority);
+  return selection$$1;
+}
+
+var selection_styles = function(map, priority) {
+  return (typeof map === "function" ? stylesFunction : stylesObject)(this, map, priority == null ? "" : priority);
+};
+
+function propertiesFunction(selection$$1, map) {
+  return selection$$1.each(function() {
+    var x = map.apply(this, arguments), s = d3Selection.select(this);
+    for (var name in x) s.property(name, x[name]);
+  });
+}
+
+function propertiesObject(selection$$1, map) {
+  for (var name in map) selection$$1.property(name, map[name]);
+  return selection$$1;
+}
+
+var selection_properties = function(map) {
+  return (typeof map === "function" ? propertiesFunction : propertiesObject)(this, map);
+};
+
+function attrsFunction$1(transition$$1, map) {
+  return transition$$1.each(function() {
+    var x = map.apply(this, arguments), t = d3Selection.select(this).transition(transition$$1);
+    for (var name in x) t.attr(name, x[name]);
+  });
+}
+
+function attrsObject$1(transition$$1, map) {
+  for (var name in map) transition$$1.attr(name, map[name]);
+  return transition$$1;
+}
+
+var transition_attrs = function(map) {
+  return (typeof map === "function" ? attrsFunction$1 : attrsObject$1)(this, map);
+};
+
+function stylesFunction$1(transition$$1, map, priority) {
+  return transition$$1.each(function() {
+    var x = map.apply(this, arguments), t = d3Selection.select(this).transition(transition$$1);
+    for (var name in x) t.style(name, x[name], priority);
+  });
+}
+
+function stylesObject$1(transition$$1, map, priority) {
+  for (var name in map) transition$$1.style(name, map[name], priority);
+  return transition$$1;
+}
+
+var transition_styles = function(map, priority) {
+  return (typeof map === "function" ? stylesFunction$1 : stylesObject$1)(this, map, priority == null ? "" : priority);
+};
+
+d3Selection.selection.prototype.attrs = selection_attrs;
+d3Selection.selection.prototype.styles = selection_styles;
+d3Selection.selection.prototype.properties = selection_properties;
+d3Transition.transition.prototype.attrs = transition_attrs;
+d3Transition.transition.prototype.styles = transition_styles;
+
+})));
diff --git a/sourcecodes/scripts/d3.v4.min.js b/sourcecodes/scripts/d3.v4.min.js
new file mode 100644
index 00000000..607d1879
--- /dev/null
+++ b/sourcecodes/scripts/d3.v4.min.js
@@ -0,0 +1,2 @@
+// https://d3js.org Version 4.13.0. Copyright 2018 Mike Bostock.
+(function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})})(this,function(t){"use strict";function n(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function e(t){return 1===t.length&&(t=function(t){return function(e,r){return n(t(e),r)}}(t)),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}function r(t,n){return[t,n]}function i(t){return null===t?NaN:+t}function o(t,n){var e,r,o=t.length,u=0,a=-1,c=0,s=0;if(null==n)for(;++a<o;)isNaN(e=i(t[a]))||(s+=(r=e-c)*(e-(c+=r/++u)));else for(;++a<o;)isNaN(e=i(n(t[a],a,t)))||(s+=(r=e-c)*(e-(c+=r/++u)));if(u>1)return s/(u-1)}function u(t,n){var e=o(t,n);return e?Math.sqrt(e):e}function a(t,n){var e,r,i,o=t.length,u=-1;if(null==n){for(;++u<o;)if(null!=(e=t[u])&&e>=e)for(r=i=e;++u<o;)null!=(e=t[u])&&(r>e&&(r=e),i<e&&(i=e))}else for(;++u<o;)if(null!=(e=n(t[u],u,t))&&e>=e)for(r=i=e;++u<o;)null!=(e=n(t[u],u,t))&&(r>e&&(r=e),i<e&&(i=e));return[r,i]}function c(t){return function(){return t}}function s(t){return t}function f(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}function l(t,n,e){var r,i,o,u,a=-1;if(n=+n,t=+t,e=+e,t===n&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(u=h(t,n,e))||!isFinite(u))return[];if(u>0)for(t=Math.ceil(t/u),n=Math.floor(n/u),o=new Array(i=Math.ceil(n-t+1));++a<i;)o[a]=(t+a)*u;else for(t=Math.floor(t*u),n=Math.ceil(n*u),o=new Array(i=Math.ceil(t-n+1));++a<i;)o[a]=(t-a)/u;return r&&o.reverse(),o}function h(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=Hs?10:o>=js?5:o>=Xs?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Hs?10:o>=js?5:o>=Xs?2:1)}function p(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Hs?i*=10:o>=js?i*=5:o>=Xs&&(i*=2),n<t?-i:i}function d(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1}function v(t,n,e){if(null==e&&(e=i),r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,o=(r-1)*n,u=Math.floor(o),a=+e(t[u],u,t);return a+(+e(t[u+1],u+1,t)-a)*(o-u)}}function g(t){for(var n,e,r,i=t.length,o=-1,u=0;++o<i;)u+=t[o].length;for(e=new Array(u);--i>=0;)for(n=(r=t[i]).length;--n>=0;)e[--u]=r[n];return e}function _(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&r>e&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&r>e&&(r=e);return r}function y(t){if(!(i=t.length))return[];for(var n=-1,e=_(t,m),r=new Array(e);++n<e;)for(var i,o=-1,u=r[n]=new Array(i);++o<i;)u[o]=t[o][n];return r}function m(t){return t.length}function x(t){return t}function b(t){return"translate("+(t+.5)+",0)"}function w(t){return"translate(0,"+(t+.5)+")"}function M(){return!this.__axis}function T(t,n){function e(e){var h=null==i?n.ticks?n.ticks.apply(n,r):n.domain():i,p=null==o?n.tickFormat?n.tickFormat.apply(n,r):x:o,d=Math.max(u,0)+c,v=n.range(),g=+v[0]+.5,_=+v[v.length-1]+.5,y=(n.bandwidth?function(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(e){return+t(e)+n}}:function(t){return function(n){return+t(n)}})(n.copy()),m=e.selection?e.selection():e,b=m.selectAll(".domain").data([null]),w=m.selectAll(".tick").data(h,n).order(),T=w.exit(),N=w.enter().append("g").attr("class","tick"),k=w.select("line"),S=w.select("text");b=b.merge(b.enter().insert("path",".tick").attr("class","domain").attr("stroke","#000")),w=w.merge(N),k=k.merge(N.append("line").attr("stroke","#000").attr(f+"2",s*u)),S=S.merge(N.append("text").attr("fill","#000").attr(f,s*d).attr("dy",t===$s?"0em":t===Zs?"0.71em":"0.32em")),e!==m&&(b=b.transition(e),w=w.transition(e),k=k.transition(e),S=S.transition(e),T=T.transition(e).attr("opacity",Qs).attr("transform",function(t){return isFinite(t=y(t))?l(t):this.getAttribute("transform")}),N.attr("opacity",Qs).attr("transform",function(t){var n=this.parentNode.__axis;return l(n&&isFinite(n=n(t))?n:y(t))})),T.remove(),b.attr("d",t===Gs||t==Ws?"M"+s*a+","+g+"H0.5V"+_+"H"+s*a:"M"+g+","+s*a+"V0.5H"+_+"V"+s*a),w.attr("opacity",1).attr("transform",function(t){return l(y(t))}),k.attr(f+"2",s*u),S.attr(f,s*d).text(p),m.filter(M).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Ws?"start":t===Gs?"end":"middle"),m.each(function(){this.__axis=y})}var r=[],i=null,o=null,u=6,a=6,c=3,s=t===$s||t===Gs?-1:1,f=t===Gs||t===Ws?"x":"y",l=t===$s||t===Zs?b:w;return e.scale=function(t){return arguments.length?(n=t,e):n},e.ticks=function(){return r=Vs.call(arguments),e},e.tickArguments=function(t){return arguments.length?(r=null==t?[]:Vs.call(t),e):r.slice()},e.tickValues=function(t){return arguments.length?(i=null==t?null:Vs.call(t),e):i&&i.slice()},e.tickFormat=function(t){return arguments.length?(o=t,e):o},e.tickSize=function(t){return arguments.length?(u=a=+t,e):u},e.tickSizeInner=function(t){return arguments.length?(u=+t,e):u},e.tickSizeOuter=function(t){return arguments.length?(a=+t,e):a},e.tickPadding=function(t){return arguments.length?(c=+t,e):c},e}function N(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new k(r)}function k(t){this._=t}function S(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=Js,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}function E(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),tf.hasOwnProperty(n)?{space:tf[n],local:t}:t}function A(t){var n=E(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Ks&&n.documentElement.namespaceURI===Ks?n.createElement(t):n.createElementNS(e,t)}})(n)}function C(){}function z(t){return null==t?C:function(){return this.querySelector(t)}}function P(){return[]}function R(t){return null==t?P:function(){return this.querySelectorAll(t)}}function L(t){return new Array(t.length)}function q(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function D(t,n,e,r,i,o){for(var u,a=0,c=n.length,s=o.length;a<s;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new q(t,o[a]);for(;a<c;++a)(u=n[a])&&(i[a]=u)}function U(t,n,e,r,i,o,u){var a,c,s,f={},l=n.length,h=o.length,p=new Array(l);for(a=0;a<l;++a)(c=n[a])&&(p[a]=s=uf+u.call(c,c.__data__,a,n),s in f?i[a]=c:f[s]=c);for(a=0;a<h;++a)(c=f[s=uf+u.call(t,o[a],a,o)])?(r[a]=c,c.__data__=o[a],f[s]=null):e[a]=new q(t,o[a]);for(a=0;a<l;++a)(c=n[a])&&f[p[a]]===c&&(i[a]=c)}function O(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function F(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function I(t,n){return t.style.getPropertyValue(n)||F(t).getComputedStyle(t,null).getPropertyValue(n)}function Y(t){return t.trim().split(/^|\s+/)}function B(t){return t.classList||new H(t)}function H(t){this._node=t,this._names=Y(t.getAttribute("class")||"")}function j(t,n){for(var e=B(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function X(t,n){for(var e=B(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function V(){this.textContent=""}function $(){this.innerHTML=""}function W(){this.nextSibling&&this.parentNode.appendChild(this)}function Z(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function G(){return null}function Q(){var t=this.parentNode;t&&t.removeChild(this)}function J(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function K(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}function tt(t,n,e){return t=nt(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function nt(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function et(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function rt(t,n,e){var r=af.hasOwnProperty(t.type)?tt:nt;return function(i,o,u){var a,c=this.__on,s=r(n,o,u);if(c)for(var f=0,l=c.length;f<l;++f)if((a=c[f]).type===t.type&&a.name===t.name)return this.removeEventListener(a.type,a.listener,a.capture),this.addEventListener(a.type,a.listener=s,a.capture=e),void(a.value=n);this.addEventListener(t.type,s,e),a={type:t.type,name:t.name,value:n,listener:s,capture:e},c?c.push(a):this.__on=[a]}}function it(n,e,r,i){var o=t.event;n.sourceEvent=t.event,t.event=n;try{return e.apply(r,i)}finally{t.event=o}}function ot(t,n,e){var r=F(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function ut(t,n){this._groups=t,this._parents=n}function at(){return new ut([[document.documentElement]],cf)}function ct(t){return"string"==typeof t?new ut([[document.querySelector(t)]],[document.documentElement]):new ut([[t]],cf)}function st(){return new ft}function ft(){this._="@"+(++sf).toString(36)}function lt(){for(var n,e=t.event;n=e.sourceEvent;)e=n;return e}function ht(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=n.clientX,r.y=n.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var i=t.getBoundingClientRect();return[n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop]}function pt(t){var n=lt();return n.changedTouches&&(n=n.changedTouches[0]),ht(t,n)}function dt(t,n,e){arguments.length<3&&(e=n,n=lt().changedTouches);for(var r,i=0,o=n?n.length:0;i<o;++i)if((r=n[i]).identifier===e)return ht(t,r);return null}function vt(){t.event.stopImmediatePropagation()}function gt(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function _t(t){var n=t.document.documentElement,e=ct(t).on("dragstart.drag",gt,!0);"onselectstart"in n?e.on("selectstart.drag",gt,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function yt(t,n){var e=t.document.documentElement,r=ct(t).on("dragstart.drag",null);n&&(r.on("click.drag",gt,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}function mt(t){return function(){return t}}function xt(t,n,e,r,i,o,u,a,c,s){this.target=t,this.type=n,this.subject=e,this.identifier=r,this.active=i,this.x=o,this.y=u,this.dx=a,this.dy=c,this._=s}function bt(){return!t.event.button}function wt(){return this.parentNode}function Mt(n){return null==n?{x:t.event.x,y:t.event.y}:n}function Tt(){return"ontouchstart"in this}function Nt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function kt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function St(){}function Et(t){var n;return t=(t+"").trim().toLowerCase(),(n=pf.exec(t))?(n=parseInt(n[1],16),new Rt(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=df.exec(t))?At(parseInt(n[1],16)):(n=vf.exec(t))?new Rt(n[1],n[2],n[3],1):(n=gf.exec(t))?new Rt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=_f.exec(t))?Ct(n[1],n[2],n[3],n[4]):(n=yf.exec(t))?Ct(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=mf.exec(t))?Lt(n[1],n[2]/100,n[3]/100,1):(n=xf.exec(t))?Lt(n[1],n[2]/100,n[3]/100,n[4]):bf.hasOwnProperty(t)?At(bf[t]):"transparent"===t?new Rt(NaN,NaN,NaN,0):null}function At(t){return new Rt(t>>16&255,t>>8&255,255&t,1)}function Ct(t,n,e,r){return r<=0&&(t=n=e=NaN),new Rt(t,n,e,r)}function zt(t){return t instanceof St||(t=Et(t)),t?(t=t.rgb(),new Rt(t.r,t.g,t.b,t.opacity)):new Rt}function Pt(t,n,e,r){return 1===arguments.length?zt(t):new Rt(t,n,e,null==r?1:r)}function Rt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Lt(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Dt(t,n,e,r)}function qt(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Dt)return new Dt(t.h,t.s,t.l,t.opacity);if(t instanceof St||(t=Et(t)),!t)return new Dt;if(t instanceof Dt)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,c=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(e<r):e===o?(r-n)/a+2:(n-e)/a+4,a/=c<.5?o+i:2-o-i,u*=60):a=c>0&&c<1?0:u,new Dt(u,a,c,t.opacity)}(t):new Dt(t,n,e,null==r?1:r)}function Dt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ut(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function Ot(t){if(t instanceof It)return new It(t.l,t.a,t.b,t.opacity);if(t instanceof Vt){var n=t.h*wf;return new It(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof Rt||(t=zt(t));var e=jt(t.r),r=jt(t.g),i=jt(t.b),o=Yt((.4124564*e+.3575761*r+.1804375*i)/Tf),u=Yt((.2126729*e+.7151522*r+.072175*i)/Nf);return new It(116*u-16,500*(o-u),200*(u-Yt((.0193339*e+.119192*r+.9503041*i)/kf)),t.opacity)}function Ft(t,n,e,r){return 1===arguments.length?Ot(t):new It(t,n,e,null==r?1:r)}function It(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function Yt(t){return t>Cf?Math.pow(t,1/3):t/Af+Sf}function Bt(t){return t>Ef?t*t*t:Af*(t-Sf)}function Ht(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function jt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Xt(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Vt)return new Vt(t.h,t.c,t.l,t.opacity);t instanceof It||(t=Ot(t));var n=Math.atan2(t.b,t.a)*Mf;return new Vt(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Vt(t,n,e,null==r?1:r)}function Vt(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function $t(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Wt)return new Wt(t.h,t.s,t.l,t.opacity);t instanceof Rt||(t=zt(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Df*r+Lf*n-qf*e)/(Df+Lf-qf),o=r-i,u=(Rf*(e-i)-zf*o)/Pf,a=Math.sqrt(u*u+o*o)/(Rf*i*(1-i)),c=a?Math.atan2(u,o)*Mf-120:NaN;return new Wt(c<0?c+360:c,a,i,t.opacity)}(t):new Wt(t,n,e,null==r?1:r)}function Wt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Zt(t,n,e,r,i){var o=t*t,u=o*t;return((1-3*t+3*o-u)*n+(4-6*o+3*u)*e+(1+3*t+3*o-3*u)*r+u*i)/6}function Gt(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],u=r>0?t[r-1]:2*i-o,a=r<n-1?t[r+2]:2*o-i;return Zt((e-r/n)*n,u,i,o,a)}}function Qt(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],u=t[(r+1)%n],a=t[(r+2)%n];return Zt((e-r/n)*n,i,o,u,a)}}function Jt(t){return function(){return t}}function Kt(t,n){return function(e){return t+e*n}}function tn(t,n){var e=n-t;return e?Kt(t,e>180||e<-180?e-360*Math.round(e/360):e):Jt(isNaN(t)?n:t)}function nn(t){return 1==(t=+t)?en:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Jt(isNaN(n)?e:n)}}function en(t,n){var e=n-t;return e?Kt(t,e):Jt(isNaN(t)?n:t)}function rn(t){return function(n){var e,r,i=n.length,o=new Array(i),u=new Array(i),a=new Array(i);for(e=0;e<i;++e)r=Pt(n[e]),o[e]=r.r||0,u[e]=r.g||0,a[e]=r.b||0;return o=t(o),u=t(u),a=t(a),r.opacity=1,function(t){return r.r=o(t),r.g=u(t),r.b=a(t),r+""}}}function on(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),u=new Array(r);for(e=0;e<i;++e)o[e]=fn(t[e],n[e]);for(;e<r;++e)u[e]=n[e];return function(t){for(e=0;e<i;++e)u[e]=o[e](t);return u}}function un(t,n){var e=new Date;return t=+t,n-=t,function(r){return e.setTime(t+n*r),e}}function an(t,n){return t=+t,n-=t,function(e){return t+n*e}}function cn(t,n){var e,r={},i={};null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={});for(e in n)e in t?r[e]=fn(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}function sn(t,n){var e,r,i,o=Vf.lastIndex=$f.lastIndex=0,u=-1,a=[],c=[];for(t+="",n+="";(e=Vf.exec(t))&&(r=$f.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,c.push({i:u,x:an(e,r)})),o=$f.lastIndex;return o<n.length&&(i=n.slice(o),a[u]?a[u]+=i:a[++u]=i),a.length<2?c[0]?function(t){return function(n){return t(n)+""}}(c[0].x):function(t){return function(){return t}}(n):(n=c.length,function(t){for(var e,r=0;r<n;++r)a[(e=c[r]).i]=e.x(t);return a.join("")})}function fn(t,n){var e,r=typeof n;return null==n||"boolean"===r?Jt(n):("number"===r?an:"string"===r?(e=Et(n))?(n=e,Hf):sn:n instanceof Et?Hf:n instanceof Date?un:Array.isArray(n)?on:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?cn:an)(t,n)}function ln(t,n){return t=+t,n-=t,function(e){return Math.round(t+n*e)}}function hn(t,n,e,r,i,o){var u,a,c;return(u=Math.sqrt(t*t+n*n))&&(t/=u,n/=u),(c=t*e+n*r)&&(e-=t*c,r-=n*c),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,c/=a),t*r<n*e&&(t=-t,n=-n,c=-c,u=-u),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Wf,skewX:Math.atan(c)*Wf,scaleX:u,scaleY:a}}function pn(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,u){var a=[],c=[];return o=t(o),u=t(u),function(t,r,i,o,u,a){if(t!==i||r!==o){var c=u.push("translate(",null,n,null,e);a.push({i:c-4,x:an(t,i)},{i:c-2,x:an(r,o)})}else(i||o)&&u.push("translate("+i+n+o+e)}(o.translateX,o.translateY,u.translateX,u.translateY,a,c),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:an(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,u.rotate,a,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:an(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,u.skewX,a,c),function(t,n,e,r,o,u){if(t!==e||n!==r){var a=o.push(i(o)+"scale(",null,",",null,")");u.push({i:a-4,x:an(t,e)},{i:a-2,x:an(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,u.scaleX,u.scaleY,a,c),o=u=null,function(t){for(var n,e=-1,r=c.length;++e<r;)a[(n=c[e]).i]=n.x(t);return a.join("")}}}function dn(t){return((t=Math.exp(t))+1/t)/2}function vn(t,n){var e,r,i=t[0],o=t[1],u=t[2],a=n[0],c=n[1],s=n[2],f=a-i,l=c-o,h=f*f+l*l;if(h<nl)r=Math.log(s/u)/Jf,e=function(t){return[i+t*f,o+t*l,u*Math.exp(Jf*t*r)]};else{var p=Math.sqrt(h),d=(s*s-u*u+tl*h)/(2*u*Kf*p),v=(s*s-u*u-tl*h)/(2*s*Kf*p),g=Math.log(Math.sqrt(d*d+1)-d),_=Math.log(Math.sqrt(v*v+1)-v);r=(_-g)/Jf,e=function(t){var n=t*r,e=dn(g),a=u/(Kf*p)*(e*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(Jf*n+g)-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+a*f,o+a*l,u*e/dn(Jf*n+g)]}}return e.duration=1e3*r,e}function gn(t){return function(n,e){var r=t((n=qt(n)).h,(e=qt(e)).h),i=en(n.s,e.s),o=en(n.l,e.l),u=en(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=u(t),n+""}}}function _n(t){return function(n,e){var r=t((n=Xt(n)).h,(e=Xt(e)).h),i=en(n.c,e.c),o=en(n.l,e.l),u=en(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=u(t),n+""}}}function yn(t){return function n(e){function r(n,r){var i=t((n=$t(n)).h,(r=$t(r)).h),o=en(n.s,r.s),u=en(n.l,r.l),a=en(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=u(Math.pow(t,e)),n.opacity=a(t),n+""}}return e=+e,r.gamma=n,r}(1)}function mn(){return pl||(gl(xn),pl=vl.now()+dl)}function xn(){pl=0}function bn(){this._call=this._time=this._next=null}function wn(t,n,e){var r=new bn;return r.restart(t,n,e),r}function Mn(){mn(),++cl;for(var t,n=Yf;n;)(t=pl-n._time)>=0&&n._call.call(null,t),n=n._next;--cl}function Tn(){pl=(hl=vl.now())+dl,cl=sl=0;try{Mn()}finally{cl=0,function(){var t,n,e=Yf,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Yf=n);Bf=t,kn(r)}(),pl=0}}function Nn(){var t=vl.now(),n=t-hl;n>ll&&(dl-=n,hl=t)}function kn(t){if(!cl){sl&&(sl=clearTimeout(sl));t-pl>24?(t<1/0&&(sl=setTimeout(Tn,t-vl.now()-dl)),fl&&(fl=clearInterval(fl))):(fl||(hl=vl.now(),fl=setInterval(Nn,ll)),cl=1,gl(Tn))}}function Sn(t,n,e){var r=new bn;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}function En(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};(function(t,n,e){function r(c){var s,f,l,h;if(e.state!==xl)return o();for(s in a)if((h=a[s]).name===e.name){if(h.state===wl)return Sn(r);h.state===Ml?(h.state=Nl,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete a[s]):+s<n&&(h.state=Nl,h.timer.stop(),delete a[s])}if(Sn(function(){e.state===wl&&(e.state=Ml,e.timer.restart(i,e.delay,e.time),i(c))}),e.state=bl,e.on.call("start",t,t.__data__,e.index,e.group),e.state===bl){for(e.state=wl,u=new Array(l=e.tween.length),s=0,f=-1;s<l;++s)(h=e.tween[s].value.call(t,t.__data__,e.index,e.group))&&(u[++f]=h);u.length=f+1}}function i(n){for(var r=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(o),e.state=Tl,1),i=-1,a=u.length;++i<a;)u[i].call(null,r);e.state===Tl&&(e.on.call("end",t,t.__data__,e.index,e.group),o())}function o(){e.state=Nl,e.timer.stop(),delete a[n];for(var r in a)return;delete t.__transition}var u,a=t.__transition;a[n]=e,e.timer=wn(function(t){e.state=xl,e.timer.restart(r,e.delay,e.time),e.delay<=t&&r(t-e.delay)},0,e.time)})(t,e,{name:n,index:r,group:i,on:_l,tween:yl,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:ml})}function An(t,n){var e=zn(t,n);if(e.state>ml)throw new Error("too late; already scheduled");return e}function Cn(t,n){var e=zn(t,n);if(e.state>bl)throw new Error("too late; already started");return e}function zn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Pn(t,n){var e,r,i,o=t.__transition,u=!0;if(o){n=null==n?null:n+"";for(i in o)(e=o[i]).name===n?(r=e.state>bl&&e.state<Tl,e.state=Nl,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):u=!1;u&&delete t.__transition}}function Rn(t,n,e){var r=t._id;return t.each(function(){var t=Cn(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return zn(t,r).value[n]}}function Ln(t,n){var e;return("number"==typeof n?an:n instanceof Et?Hf:(e=Et(n))?(n=e,Hf):sn)(t,n)}function qn(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Dn(t){return at().transition(t)}function Un(){return++Sl}function On(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function Fn(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function In(t){return(1-Math.cos(Pl*t))/2}function Yn(t){return((t*=2)<=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}function Bn(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}function Hn(t){return(t=+t)<Ll?Hl*t*t:t<Dl?Hl*(t-=ql)*t+Ul:t<Fl?Hl*(t-=Ol)*t+Il:Hl*(t-=Yl)*t+Bl}function jn(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return Ql.time=mn(),Ql;return e}function Xn(t){return function(){return t}}function Vn(){t.event.stopImmediatePropagation()}function $n(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function Wn(t){return{type:t}}function Zn(){return!t.event.button}function Gn(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Qn(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function Jn(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Kn(n){function e(t){var e=t.property("__brush",a).selectAll(".overlay").data([Wn("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",uh.overlay).merge(e).each(function(){var t=Qn(this).extent;ct(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),t.selectAll(".selection").data([Wn("selection")]).enter().append("rect").attr("class","selection").attr("cursor",uh.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var i=t.selectAll(".handle").data(n.handles,function(t){return t.type});i.exit().remove(),i.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return uh[t.type]}),t.each(r).attr("fill","none").attr("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush touchstart.brush",u)}function r(){var t=ct(this),n=Qn(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?n[1][0]-h/2:n[0][0]-h/2}).attr("y",function(t){return"s"===t.type[0]?n[1][1]-h/2:n[0][1]-h/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+h:h}).attr("height",function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+h:h})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function i(t,n){return t.__brush.emitter||new o(t,n)}function o(t,n){this.that=t,this.args=n,this.state=t.__brush,this.active=0}function u(){function e(){var t=pt(w);!L||x||b||(Math.abs(t[0]-D[0])>Math.abs(t[1]-D[1])?b=!0:x=!0),D=t,m=!0,$n(),o()}function o(){var t;switch(_=D[0]-q[0],y=D[1]-q[1],T){case th:case Kl:N&&(_=Math.max(C-a,Math.min(P-p,_)),s=a+_,d=p+_),k&&(y=Math.max(z-l,Math.min(R-v,y)),h=l+y,g=v+y);break;case nh:N<0?(_=Math.max(C-a,Math.min(P-a,_)),s=a+_,d=p):N>0&&(_=Math.max(C-p,Math.min(P-p,_)),s=a,d=p+_),k<0?(y=Math.max(z-l,Math.min(R-l,y)),h=l+y,g=v):k>0&&(y=Math.max(z-v,Math.min(R-v,y)),h=l,g=v+y);break;case eh:N&&(s=Math.max(C,Math.min(P,a-_*N)),d=Math.max(C,Math.min(P,p+_*N))),k&&(h=Math.max(z,Math.min(R,l-y*k)),g=Math.max(z,Math.min(R,v+y*k)))}d<s&&(N*=-1,t=a,a=p,p=t,t=s,s=d,d=t,M in ah&&F.attr("cursor",uh[M=ah[M]])),g<h&&(k*=-1,t=l,l=v,v=t,t=h,h=g,g=t,M in ch&&F.attr("cursor",uh[M=ch[M]])),S.selection&&(A=S.selection),x&&(s=A[0][0],d=A[1][0]),b&&(h=A[0][1],g=A[1][1]),A[0][0]===s&&A[0][1]===h&&A[1][0]===d&&A[1][1]===g||(S.selection=[[s,h],[d,g]],r.call(w),U.brush())}function u(){if(Vn(),t.event.touches){if(t.event.touches.length)return;c&&clearTimeout(c),c=setTimeout(function(){c=null},500),O.on("touchmove.brush touchend.brush touchcancel.brush",null)}else yt(t.event.view,m),I.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);O.attr("pointer-events","all"),F.attr("cursor",uh.overlay),S.selection&&(A=S.selection),Jn(A)&&(S.selection=null,r.call(w)),U.end()}if(t.event.touches){if(t.event.changedTouches.length<t.event.touches.length)return $n()}else if(c)return;if(f.apply(this,arguments)){var a,s,l,h,p,d,v,g,_,y,m,x,b,w=this,M=t.event.target.__data__.type,T="selection"===(t.event.metaKey?M="overlay":M)?Kl:t.event.altKey?eh:nh,N=n===ih?null:sh[M],k=n===rh?null:fh[M],S=Qn(w),E=S.extent,A=S.selection,C=E[0][0],z=E[0][1],P=E[1][0],R=E[1][1],L=N&&k&&t.event.shiftKey,q=pt(w),D=q,U=i(w,arguments).beforestart();"overlay"===M?S.selection=A=[[a=n===ih?C:q[0],l=n===rh?z:q[1]],[p=n===ih?P:a,v=n===rh?R:l]]:(a=A[0][0],l=A[0][1],p=A[1][0],v=A[1][1]),s=a,h=l,d=p,g=v;var O=ct(w).attr("pointer-events","none"),F=O.selectAll(".overlay").attr("cursor",uh[M]);if(t.event.touches)O.on("touchmove.brush",e,!0).on("touchend.brush touchcancel.brush",u,!0);else{var I=ct(t.event.view).on("keydown.brush",function(){switch(t.event.keyCode){case 16:L=N&&k;break;case 18:T===nh&&(N&&(p=d-_*N,a=s+_*N),k&&(v=g-y*k,l=h+y*k),T=eh,o());break;case 32:T!==nh&&T!==eh||(N<0?p=d-_:N>0&&(a=s-_),k<0?v=g-y:k>0&&(l=h-y),T=th,F.attr("cursor",uh.selection),o());break;default:return}$n()},!0).on("keyup.brush",function(){switch(t.event.keyCode){case 16:L&&(x=b=L=!1,o());break;case 18:T===eh&&(N<0?p=d:N>0&&(a=s),k<0?v=g:k>0&&(l=h),T=nh,o());break;case 32:T===th&&(t.event.altKey?(N&&(p=d-_*N,a=s+_*N),k&&(v=g-y*k,l=h+y*k),T=eh):(N<0?p=d:N>0&&(a=s),k<0?v=g:k>0&&(l=h),T=nh),F.attr("cursor",uh[M]),o());break;default:return}$n()},!0).on("mousemove.brush",e,!0).on("mouseup.brush",u,!0);_t(t.event.view)}Vn(),Pn(w),r.call(w),U.start()}}function a(){var t=this.__brush||{selection:null};return t.extent=s.apply(this,arguments),t.dim=n,t}var c,s=Gn,f=Zn,l=N(e,"start","brush","end"),h=6;return e.move=function(t,e){t.selection?t.on("start.brush",function(){i(this,arguments).beforestart().start()}).on("interrupt.brush end.brush",function(){i(this,arguments).end()}).tween("brush",function(){function t(t){u.selection=1===t&&Jn(s)?null:f(t),r.call(o),a.brush()}var o=this,u=o.__brush,a=i(o,arguments),c=u.selection,s=n.input("function"==typeof e?e.apply(this,arguments):e,u.extent),f=fn(c,s);return c&&s?t:t(1)}):t.each(function(){var t=arguments,o=this.__brush,u=n.input("function"==typeof e?e.apply(this,t):e,o.extent),a=i(this,t).beforestart();Pn(this),o.selection=null==u||Jn(u)?null:u,r.call(this),a.start().brush().end()})},o.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(t){it(new function(t,n,e){this.target=t,this.type=n,this.selection=e}(e,t,n.output(this.state.selection)),l.apply,l,[t,this.that,this.args])}},e.extent=function(t){return arguments.length?(s="function"==typeof t?t:Xn([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),e):s},e.filter=function(t){return arguments.length?(f="function"==typeof t?t:Xn(!!t),e):f},e.handleSize=function(t){return arguments.length?(h=+t,e):h},e.on=function(){var t=l.on.apply(l,arguments);return t===l?e:t},e}function te(t){return function(){return t}}function ne(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function ee(){return new ne}function re(t){return t.source}function ie(t){return t.target}function oe(t){return t.radius}function ue(t){return t.startAngle}function ae(t){return t.endAngle}function ce(){}function se(t,n){var e=new ce;if(t instanceof ce)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var u in t)e.set(u,t[u]);return e}function fe(){return{}}function le(t,n,e){t[n]=e}function he(){return se()}function pe(t,n,e){t.set(n,e)}function de(){}function ve(t,n){var e=new de;if(t instanceof de)t.each(function(t){e.add(t)});else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else for(;++r<i;)e.add(n(t[r],r,t))}return e}function ge(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}")}function _e(t){function n(t,n){function e(){if(s)return Mh;if(f)return f=!1,wh;var n,e,r=a;if(t.charCodeAt(r)===Th){for(;a++<u&&t.charCodeAt(a)!==Th||t.charCodeAt(++a)===Th;);return(n=a)>=u?s=!0:(e=t.charCodeAt(a++))===Nh?f=!0:e===kh&&(f=!0,t.charCodeAt(a)===Nh&&++a),t.slice(r+1,n-1).replace(/""/g,'"')}for(;a<u;){if((e=t.charCodeAt(n=a++))===Nh)f=!0;else if(e===kh)f=!0,t.charCodeAt(a)===Nh&&++a;else if(e!==o)continue;return t.slice(r,n)}return s=!0,t.slice(r,u)}var r,i=[],u=t.length,a=0,c=0,s=u<=0,f=!1;for(t.charCodeAt(u-1)===Nh&&--u,t.charCodeAt(u-1)===kh&&--u;(r=e())!==Mh;){for(var l=[];r!==wh&&r!==Mh;)l.push(r),r=e();n&&null==(l=n(l,c++))||i.push(l)}return i}function e(n){return n.map(r).join(t)}function r(t){return null==t?"":i.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}var i=new RegExp('["'+t+"\n\r]"),o=t.charCodeAt(0);return{parse:function(t,e){var r,i,o=n(t,function(t,n){if(r)return r(t,n-1);i=t,r=e?function(t,n){var e=ge(t);return function(r,i){return n(e(r),i,t)}}(t,e):ge(t)});return o.columns=i||[],o},parseRows:n,format:function(n,e){return null==e&&(e=function(t){var n=Object.create(null),e=[];return t.forEach(function(t){for(var r in t)r in n||e.push(n[r]=r)}),e}(n)),[e.map(r).join(t)].concat(n.map(function(n){return e.map(function(t){return r(n[t])}).join(t)})).join("\n")},formatRows:function(t){return t.map(e).join("\n")}}}function ye(t){return function(){return t}}function me(){return 1e-6*(Math.random()-.5)}function xe(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,u,a,c,s,f,l,h,p=t._root,d={data:r},v=t._x0,g=t._y0,_=t._x1,y=t._y1;if(!p)return t._root=d,t;for(;p.length;)if((s=n>=(o=(v+_)/2))?v=o:_=o,(f=e>=(u=(g+y)/2))?g=u:y=u,i=p,!(p=p[l=f<<1|s]))return i[l]=d,t;if(a=+t._x.call(null,p.data),c=+t._y.call(null,p.data),n===a&&e===c)return d.next=p,i?i[l]=d:t._root=d,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(s=n>=(o=(v+_)/2))?v=o:_=o,(f=e>=(u=(g+y)/2))?g=u:y=u}while((l=f<<1|s)==(h=(c>=u)<<1|a>=o));return i[h]=p,i[l]=d,t}function be(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function we(t){return t[0]}function Me(t){return t[1]}function Te(t,n,e){var r=new Ne(null==n?we:n,null==e?Me:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Ne(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function ke(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}function Se(t){return t.x+t.vx}function Ee(t){return t.y+t.vy}function Ae(t){return t.index}function Ce(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}function ze(t){return t.x}function Pe(t){return t.y}function Re(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Le(t){return(t=Re(Math.abs(t)))?t[1]:NaN}function qe(t,n){var e=Re(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}function De(t){return new Ue(t)}function Ue(t){if(!(n=Bh.exec(t)))throw new Error("invalid format: "+t);var n,e=n[1]||" ",r=n[2]||">",i=n[3]||"-",o=n[4]||"",u=!!n[5],a=n[6]&&+n[6],c=!!n[7],s=n[8]&&+n[8].slice(1),f=n[9]||"";"n"===f?(c=!0,f="g"):Yh[f]||(f=""),(u||"0"===e&&"="===r)&&(u=!0,e="0",r="="),this.fill=e,this.align=r,this.sign=i,this.symbol=o,this.zero=u,this.width=a,this.comma=c,this.precision=s,this.type=f}function Oe(t){return t}function Fe(t){function n(t){function n(t){var n,r,u,f=g,x=_;if("c"===v)x=y(t)+x,t="";else{var b=(t=+t)<0;if(t=y(Math.abs(t),d),b&&0==+t&&(b=!1),f=(b?"("===s?s:"-":"-"===s||"("===s?"":s)+f,x=("s"===v?jh[8+Oh/3]:"")+x+(b&&"("===s?")":""),m)for(n=-1,r=t.length;++n<r;)if(48>(u=t.charCodeAt(n))||u>57){x=(46===u?i+t.slice(n+1):t.slice(n))+x,t=t.slice(0,n);break}}p&&!l&&(t=e(t,1/0));var w=f.length+t.length+x.length,M=w<h?new Array(h-w+1).join(a):"";switch(p&&l&&(t=e(M+t,M.length?h-x.length:1/0),M=""),c){case"<":t=f+t+x+M;break;case"=":t=f+M+t+x;break;case"^":t=M.slice(0,w=M.length>>1)+f+t+x+M.slice(w);break;default:t=M+f+t+x}return o(t)}var a=(t=De(t)).fill,c=t.align,s=t.sign,f=t.symbol,l=t.zero,h=t.width,p=t.comma,d=t.precision,v=t.type,g="$"===f?r[0]:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",_="$"===f?r[1]:/[%p]/.test(v)?u:"",y=Yh[v],m=!v||/[defgprs%]/.test(v);return d=null==d?v?6:12:/[gprs]/.test(v)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),n.toString=function(){return t+""},n}var e=t.grouping&&t.thousands?function(t,n){return function(e,r){for(var i=e.length,o=[],u=0,a=t[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(e.substring(i-=a,i+a)),!((c+=a+1)>r));)a=t[u=(u+1)%t.length];return o.reverse().join(n)}}(t.grouping,t.thousands):Oe,r=t.currency,i=t.decimal,o=t.numerals?function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(t.numerals):Oe,u=t.percent||"%";return{format:n,formatPrefix:function(t,e){var r=n((t=De(t),t.type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Le(e)/3))),o=Math.pow(10,-i),u=jh[8+i/3];return function(t){return r(o*t)+u}}}}function Ie(n){return Hh=Fe(n),t.format=Hh.format,t.formatPrefix=Hh.formatPrefix,Hh}function Ye(t){return Math.max(0,-Le(Math.abs(t)))}function Be(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Le(n)/3)))-Le(Math.abs(t)))}function He(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Le(n)-Le(t))+1}function je(){return new Xe}function Xe(){this.reset()}function Ve(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}function $e(t){return t>1?0:t<-1?Np:Math.acos(t)}function We(t){return t>1?kp:t<-1?-kp:Math.asin(t)}function Ze(t){return(t=Fp(t/2))*t}function Ge(){}function Qe(t,n){t&&jp.hasOwnProperty(t.type)&&jp[t.type](t,n)}function Je(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function Ke(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)Je(t[e],n,1);n.polygonEnd()}function tr(t,n){t&&Hp.hasOwnProperty(t.type)?Hp[t.type](t,n):Qe(t,n)}function nr(){$p.point=rr}function er(){ir(Xh,Vh)}function rr(t,n){$p.point=ir,Xh=t,Vh=n,$h=t*=Cp,Wh=Lp(n=(n*=Cp)/2+Sp),Zh=Fp(n)}function ir(t,n){n=(n*=Cp)/2+Sp;var e=(t*=Cp)-$h,r=e>=0?1:-1,i=r*e,o=Lp(n),u=Fp(n),a=Zh*u,c=Wh*o+a*Lp(i),s=a*r*Fp(i);Xp.add(Rp(s,c)),$h=t,Wh=o,Zh=u}function or(t){return[Rp(t[1],t[0]),We(t[2])]}function ur(t){var n=t[0],e=t[1],r=Lp(e);return[r*Lp(n),r*Fp(n),Fp(e)]}function ar(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function cr(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function sr(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function fr(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function lr(t){var n=Yp(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function hr(t,n){ip.push(op=[Gh=t,Jh=t]),n<Qh&&(Qh=n),n>Kh&&(Kh=n)}function pr(t,n){var e=ur([t*Cp,n*Cp]);if(rp){var r=cr(rp,e),i=cr([r[1],-r[0],0],r);lr(i),i=or(i);var o,u=t-tp,a=u>0?1:-1,c=i[0]*Ap*a,s=zp(u)>180;s^(a*tp<c&&c<a*t)?(o=i[1]*Ap)>Kh&&(Kh=o):(c=(c+360)%360-180,s^(a*tp<c&&c<a*t)?(o=-i[1]*Ap)<Qh&&(Qh=o):(n<Qh&&(Qh=n),n>Kh&&(Kh=n))),s?t<tp?mr(Gh,t)>mr(Gh,Jh)&&(Jh=t):mr(t,Jh)>mr(Gh,Jh)&&(Gh=t):Jh>=Gh?(t<Gh&&(Gh=t),t>Jh&&(Jh=t)):t>tp?mr(Gh,t)>mr(Gh,Jh)&&(Jh=t):mr(t,Jh)>mr(Gh,Jh)&&(Gh=t)}else ip.push(op=[Gh=t,Jh=t]);n<Qh&&(Qh=n),n>Kh&&(Kh=n),rp=e,tp=t}function dr(){Zp.point=pr}function vr(){op[0]=Gh,op[1]=Jh,Zp.point=hr,rp=null}function gr(t,n){if(rp){var e=t-tp;Wp.add(zp(e)>180?e+(e>0?360:-360):e)}else np=t,ep=n;$p.point(t,n),pr(t,n)}function _r(){$p.lineStart()}function yr(){gr(np,ep),$p.lineEnd(),zp(Wp)>Mp&&(Gh=-(Jh=180)),op[0]=Gh,op[1]=Jh,rp=null}function mr(t,n){return(n-=t)<0?n+360:n}function xr(t,n){return t[0]-n[0]}function br(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}function wr(t,n){t*=Cp;var e=Lp(n*=Cp);Mr(e*Lp(t),e*Fp(t),Fp(n))}function Mr(t,n,e){cp+=(t-cp)/++up,sp+=(n-sp)/up,fp+=(e-fp)/up}function Tr(){Gp.point=Nr}function Nr(t,n){t*=Cp;var e=Lp(n*=Cp);mp=e*Lp(t),xp=e*Fp(t),bp=Fp(n),Gp.point=kr,Mr(mp,xp,bp)}function kr(t,n){t*=Cp;var e=Lp(n*=Cp),r=e*Lp(t),i=e*Fp(t),o=Fp(n),u=Rp(Yp((u=xp*o-bp*i)*u+(u=bp*r-mp*o)*u+(u=mp*i-xp*r)*u),mp*r+xp*i+bp*o);ap+=u,lp+=u*(mp+(mp=r)),hp+=u*(xp+(xp=i)),pp+=u*(bp+(bp=o)),Mr(mp,xp,bp)}function Sr(){Gp.point=wr}function Er(){Gp.point=Cr}function Ar(){zr(_p,yp),Gp.point=wr}function Cr(t,n){_p=t,yp=n,t*=Cp,n*=Cp,Gp.point=zr;var e=Lp(n);mp=e*Lp(t),xp=e*Fp(t),bp=Fp(n),Mr(mp,xp,bp)}function zr(t,n){t*=Cp;var e=Lp(n*=Cp),r=e*Lp(t),i=e*Fp(t),o=Fp(n),u=xp*o-bp*i,a=bp*r-mp*o,c=mp*i-xp*r,s=Yp(u*u+a*a+c*c),f=We(s),l=s&&-f/s;dp+=l*u,vp+=l*a,gp+=l*c,ap+=f,lp+=f*(mp+(mp=r)),hp+=f*(xp+(xp=i)),pp+=f*(bp+(bp=o)),Mr(mp,xp,bp)}function Pr(t){return function(){return t}}function Rr(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function Lr(t,n){return[t>Np?t-Ep:t<-Np?t+Ep:t,n]}function qr(t,n,e){return(t%=Ep)?n||e?Rr(Ur(t),Or(n,e)):Ur(t):n||e?Or(n,e):Lr}function Dr(t){return function(n,e){return n+=t,[n>Np?n-Ep:n<-Np?n+Ep:n,e]}}function Ur(t){var n=Dr(t);return n.invert=Dr(-t),n}function Or(t,n){function e(t,n){var e=Lp(n),a=Lp(t)*e,c=Fp(t)*e,s=Fp(n),f=s*r+a*i;return[Rp(c*o-f*u,a*r-s*i),We(f*o+c*u)]}var r=Lp(t),i=Fp(t),o=Lp(n),u=Fp(n);return e.invert=function(t,n){var e=Lp(n),a=Lp(t)*e,c=Fp(t)*e,s=Fp(n),f=s*o-c*u;return[Rp(c*o+s*u,a*r+f*i),We(f*r-a*i)]},e}function Fr(t){function n(n){return n=t(n[0]*Cp,n[1]*Cp),n[0]*=Ap,n[1]*=Ap,n}return t=qr(t[0]*Cp,t[1]*Cp,t.length>2?t[2]*Cp:0),n.invert=function(n){return n=t.invert(n[0]*Cp,n[1]*Cp),n[0]*=Ap,n[1]*=Ap,n},n}function Ir(t,n,e,r,i,o){if(e){var u=Lp(n),a=Fp(n),c=r*e;null==i?(i=n+r*Ep,o=n-c/2):(i=Yr(u,i),o=Yr(u,o),(r>0?i<o:i>o)&&(i+=r*Ep));for(var s,f=i;r>0?f>o:f<o;f-=c)s=or([u,-a*Lp(f),-a*Fp(f)]),t.point(s[0],s[1])}}function Yr(t,n){(n=ur(n))[0]-=t,lr(n);var e=$e(-n[1]);return((-n[2]<0?-e:e)+Ep-Mp)%Ep}function Br(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:Ge,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Hr(t,n){return zp(t[0]-n[0])<Mp&&zp(t[1]-n[1])<Mp}function jr(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Xr(t,n,e,r,i){var o,u,a=[],c=[];if(t.forEach(function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],u=t[n];if(Hr(r,u)){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else a.push(e=new jr(r,t,null,!0)),c.push(e.o=new jr(r,null,e,!1)),a.push(e=new jr(u,t,null,!1)),c.push(e.o=new jr(u,null,e,!0))}}),a.length){for(c.sort(n),Vr(a),Vr(c),o=0,u=c.length;o<u;++o)c[o].e=e=!e;for(var s,f,l=a[0];;){for(var h=l,p=!0;h.v;)if((h=h.n)===l)return;s=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(p)for(o=0,u=s.length;o<u;++o)i.point((f=s[o])[0],f[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(p)for(s=h.p.z,o=s.length-1;o>=0;--o)i.point((f=s[o])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}s=(h=h.o).z,p=!p}while(!h.v);i.lineEnd()}}}function Vr(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}function $r(t,n){var e=n[0],r=n[1],i=[Fp(e),-Lp(e),0],o=0,u=0;cd.reset();for(var a=0,c=t.length;a<c;++a)if(f=(s=t[a]).length)for(var s,f,l=s[f-1],h=l[0],p=l[1]/2+Sp,d=Fp(p),v=Lp(p),g=0;g<f;++g,h=y,d=x,v=b,l=_){var _=s[g],y=_[0],m=_[1]/2+Sp,x=Fp(m),b=Lp(m),w=y-h,M=w>=0?1:-1,T=M*w,N=T>Np,k=d*x;if(cd.add(Rp(k*M*Fp(T),v*b+k*Lp(T))),o+=N?w+M*Ep:w,N^h>=e^y>=e){var S=cr(ur(l),ur(_));lr(S);var E=cr(i,S);lr(E);var A=(N^w>=0?-1:1)*We(E[2]);(r>A||r===A&&(S[0]||S[1]))&&(u+=N^w>=0?1:-1)}}return(o<-Mp||o<Mp&&cd<-Mp)^1&u}function Wr(t,n,e,r){return function(i){function o(n,e){t(n,e)&&i.point(n,e)}function u(t,n){v.point(t,n)}function a(){x.point=u,v.lineStart()}function c(){x.point=o,v.lineEnd()}function s(t,n){d.push([t,n]),y.point(t,n)}function f(){y.lineStart(),d=[]}function l(){s(d[0][0],d[0][1]),y.lineEnd();var t,n,e,r,o=y.clean(),u=_.result(),a=u.length;if(d.pop(),h.push(d),d=null,a)if(1&o){if(e=u[0],(n=e.length-1)>0){for(m||(i.polygonStart(),m=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else a>1&&2&o&&u.push(u.pop().concat(u.shift())),p.push(u.filter(Zr))}var h,p,d,v=n(i),_=Br(),y=n(_),m=!1,x={point:o,lineStart:a,lineEnd:c,polygonStart:function(){x.point=s,x.lineStart=f,x.lineEnd=l,p=[],h=[]},polygonEnd:function(){x.point=o,x.lineStart=a,x.lineEnd=c,p=g(p);var t=$r(h,r);p.length?(m||(i.polygonStart(),m=!0),Xr(p,Gr,t,e,i)):t&&(m||(i.polygonStart(),m=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),m&&(i.polygonEnd(),m=!1),p=h=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};return x}}function Zr(t){return t.length>1}function Gr(t,n){return((t=t.x)[0]<0?t[1]-kp-Mp:kp-t[1])-((n=n.x)[0]<0?n[1]-kp-Mp:kp-n[1])}function Qr(t){function n(t,n){return Lp(t)*Lp(n)>i}function e(t,n,e){var r=[1,0,0],o=cr(ur(t),ur(n)),u=ar(o,o),a=o[0],c=u-a*a;if(!c)return!e&&t;var s=i*u/c,f=-i*a/c,l=cr(r,o),h=fr(r,s);sr(h,fr(o,f));var p=l,d=ar(h,p),v=ar(p,p),g=d*d-v*(ar(h,h)-1);if(!(g<0)){var _=Yp(g),y=fr(p,(-d-_)/v);if(sr(y,h),y=or(y),!e)return y;var m,x=t[0],b=n[0],w=t[1],M=n[1];b<x&&(m=x,x=b,b=m);var T=b-x,N=zp(T-Np)<Mp;if(!N&&M<w&&(m=w,w=M,M=m),N||T<Mp?N?w+M>0^y[1]<(zp(y[0]-x)<Mp?w:M):w<=y[1]&&y[1]<=M:T>Np^(x<=y[0]&&y[0]<=b)){var k=fr(p,(-d+_)/v);return sr(k,h),[y,or(k)]}}}function r(n,e){var r=u?t:Np-t,i=0;return n<-r?i|=1:n>r&&(i|=2),e<-r?i|=4:e>r&&(i|=8),i}var i=Lp(t),o=6*Cp,u=i>0,a=zp(i)>Mp;return Wr(n,function(t){var i,o,c,s,f;return{lineStart:function(){s=c=!1,f=1},point:function(l,h){var p,d=[l,h],v=n(l,h),g=u?v?0:r(l,h):v?r(l+(l<0?Np:-Np),h):0;if(!i&&(s=c=v)&&t.lineStart(),v!==c&&(!(p=e(i,d))||Hr(i,p)||Hr(d,p))&&(d[0]+=Mp,d[1]+=Mp,v=n(d[0],d[1])),v!==c)f=0,v?(t.lineStart(),p=e(d,i),t.point(p[0],p[1])):(p=e(i,d),t.point(p[0],p[1]),t.lineEnd()),i=p;else if(a&&i&&u^v){var _;g&o||!(_=e(d,i,!0))||(f=0,u?(t.lineStart(),t.point(_[0][0],_[0][1]),t.point(_[1][0],_[1][1]),t.lineEnd()):(t.point(_[1][0],_[1][1]),t.lineEnd(),t.lineStart(),t.point(_[0][0],_[0][1])))}!v||i&&Hr(i,d)||t.point(d[0],d[1]),i=d,c=v,o=g},lineEnd:function(){c&&t.lineEnd(),i=null},clean:function(){return f|(s&&c)<<1}}},function(n,e,r,i){Ir(i,t,o,r,n,e)},u?[0,-t]:[-Np,t-Np])}function Jr(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,a,s){var f=0,l=0;if(null==i||(f=u(i,a))!==(l=u(o,a))||c(i,o)<0^a>0)do{s.point(0===f||3===f?t:e,f>1?r:n)}while((f=(f+a+4)%4)!==l);else s.point(o[0],o[1])}function u(r,i){return zp(r[0]-t)<Mp?i>0?0:3:zp(r[0]-e)<Mp?i>0?2:1:zp(r[1]-n)<Mp?i>0?1:0:i>0?3:2}function a(t,n){return c(t.x,n.x)}function c(t,n){var e=u(t,1),r=u(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(u){function c(t,n){i(t,n)&&w.point(t,n)}function s(o,u){var a=i(o,u);if(l&&h.push([o,u]),x)p=o,d=u,v=a,x=!1,a&&(w.lineStart(),w.point(o,u));else if(a&&m)w.point(o,u);else{var c=[_=Math.max(ld,Math.min(fd,_)),y=Math.max(ld,Math.min(fd,y))],s=[o=Math.max(ld,Math.min(fd,o)),u=Math.max(ld,Math.min(fd,u))];!function(t,n,e,r,i,o){var u,a=t[0],c=t[1],s=0,f=1,l=n[0]-a,h=n[1]-c;if(u=e-a,l||!(u>0)){if(u/=l,l<0){if(u<s)return;u<f&&(f=u)}else if(l>0){if(u>f)return;u>s&&(s=u)}if(u=i-a,l||!(u<0)){if(u/=l,l<0){if(u>f)return;u>s&&(s=u)}else if(l>0){if(u<s)return;u<f&&(f=u)}if(u=r-c,h||!(u>0)){if(u/=h,h<0){if(u<s)return;u<f&&(f=u)}else if(h>0){if(u>f)return;u>s&&(s=u)}if(u=o-c,h||!(u<0)){if(u/=h,h<0){if(u>f)return;u>s&&(s=u)}else if(h>0){if(u<s)return;u<f&&(f=u)}return s>0&&(t[0]=a+s*l,t[1]=c+s*h),f<1&&(n[0]=a+f*l,n[1]=c+f*h),!0}}}}}(c,s,t,n,e,r)?a&&(w.lineStart(),w.point(o,u),b=!1):(m||(w.lineStart(),w.point(c[0],c[1])),w.point(s[0],s[1]),a||w.lineEnd(),b=!1)}_=o,y=u,m=a}var f,l,h,p,d,v,_,y,m,x,b,w=u,M=Br(),T={point:c,lineStart:function(){T.point=s,l&&l.push(h=[]),x=!0,m=!1,_=y=NaN},lineEnd:function(){f&&(s(p,d),v&&m&&M.rejoin(),f.push(M.result())),T.point=c,m&&w.lineEnd()},polygonStart:function(){w=M,f=[],l=[],b=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=l.length;e<i;++e)for(var o,u,a=l[e],c=1,s=a.length,f=a[0],h=f[0],p=f[1];c<s;++c)o=h,u=p,h=(f=a[c])[0],p=f[1],u<=r?p>r&&(h-o)*(r-u)>(p-u)*(t-o)&&++n:p<=r&&(h-o)*(r-u)<(p-u)*(t-o)&&--n;return n}(),e=b&&n,i=(f=g(f)).length;(e||i)&&(u.polygonStart(),e&&(u.lineStart(),o(null,null,1,u),u.lineEnd()),i&&Xr(f,a,n,o,u),u.polygonEnd()),w=u,f=l=h=null}};return T}}function Kr(){pd.point=pd.lineEnd=Ge}function ti(t,n){Qp=t*=Cp,Jp=Fp(n*=Cp),Kp=Lp(n),pd.point=ni}function ni(t,n){t*=Cp;var e=Fp(n*=Cp),r=Lp(n),i=zp(t-Qp),o=Lp(i),u=r*Fp(i),a=Kp*e-Jp*r*o,c=Jp*e+Kp*r*o;hd.add(Rp(Yp(u*u+a*a),c)),Qp=t,Jp=e,Kp=r}function ei(t){return hd.reset(),tr(t,pd),+hd}function ri(t,n){return dd[0]=t,dd[1]=n,ei(vd)}function ii(t,n){return!(!t||!_d.hasOwnProperty(t.type))&&_d[t.type](t,n)}function oi(t,n){return 0===ri(t,n)}function ui(t,n){var e=ri(t[0],t[1]);return ri(t[0],n)+ri(n,t[1])<=e+Mp}function ai(t,n){return!!$r(t.map(ci),si(n))}function ci(t){return(t=t.map(si)).pop(),t}function si(t){return[t[0]*Cp,t[1]*Cp]}function fi(t,n,e){var r=f(t,n-Mp,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function li(t,n,e){var r=f(t,n-Mp,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function hi(){function t(){return{type:"MultiLineString",coordinates:n()}}function n(){return f(qp(o/_)*_,i,_).map(p).concat(f(qp(s/y)*y,c,y).map(d)).concat(f(qp(r/v)*v,e,v).filter(function(t){return zp(t%_)>Mp}).map(l)).concat(f(qp(a/g)*g,u,g).filter(function(t){return zp(t%y)>Mp}).map(h))}var e,r,i,o,u,a,c,s,l,h,p,d,v=10,g=v,_=90,y=360,m=2.5;return t.lines=function(){return n().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[p(o).concat(d(c).slice(1),p(i).reverse().slice(1),d(s).reverse().slice(1))]}},t.extent=function(n){return arguments.length?t.extentMajor(n).extentMinor(n):t.extentMinor()},t.extentMajor=function(n){return arguments.length?(o=+n[0][0],i=+n[1][0],s=+n[0][1],c=+n[1][1],o>i&&(n=o,o=i,i=n),s>c&&(n=s,s=c,c=n),t.precision(m)):[[o,s],[i,c]]},t.extentMinor=function(n){return arguments.length?(r=+n[0][0],e=+n[1][0],a=+n[0][1],u=+n[1][1],r>e&&(n=r,r=e,e=n),a>u&&(n=a,a=u,u=n),t.precision(m)):[[r,a],[e,u]]},t.step=function(n){return arguments.length?t.stepMajor(n).stepMinor(n):t.stepMinor()},t.stepMajor=function(n){return arguments.length?(_=+n[0],y=+n[1],t):[_,y]},t.stepMinor=function(n){return arguments.length?(v=+n[0],g=+n[1],t):[v,g]},t.precision=function(n){return arguments.length?(m=+n,l=fi(a,u,90),h=li(r,e,m),p=fi(s,c,90),d=li(o,i,m),t):m},t.extentMajor([[-180,-90+Mp],[180,90-Mp]]).extentMinor([[-180,-80-Mp],[180,80+Mp]])}function pi(t){return t}function di(){xd.point=vi}function vi(t,n){xd.point=gi,td=ed=t,nd=rd=n}function gi(t,n){md.add(rd*t-ed*n),ed=t,rd=n}function _i(){gi(td,nd)}function yi(t,n){kd+=t,Sd+=n,++Ed}function mi(){qd.point=xi}function xi(t,n){qd.point=bi,yi(ud=t,ad=n)}function bi(t,n){var e=t-ud,r=n-ad,i=Yp(e*e+r*r);Ad+=i*(ud+t)/2,Cd+=i*(ad+n)/2,zd+=i,yi(ud=t,ad=n)}function wi(){qd.point=yi}function Mi(){qd.point=Ni}function Ti(){ki(id,od)}function Ni(t,n){qd.point=ki,yi(id=ud=t,od=ad=n)}function ki(t,n){var e=t-ud,r=n-ad,i=Yp(e*e+r*r);Ad+=i*(ud+t)/2,Cd+=i*(ad+n)/2,zd+=i,Pd+=(i=ad*t-ud*n)*(ud+t),Rd+=i*(ad+n),Ld+=3*i,yi(ud=t,ad=n)}function Si(t){this._context=t}function Ei(t,n){Bd.point=Ai,Ud=Fd=t,Od=Id=n}function Ai(t,n){Fd-=t,Id-=n,Yd.add(Yp(Fd*Fd+Id*Id)),Fd=t,Id=n}function Ci(){this._string=[]}function zi(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Pi(t){return function(n){var e=new Ri;for(var r in t)e[r]=t[r];return e.stream=n,e}}function Ri(){}function Li(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),tr(e,t.stream(Nd)),n(Nd.result()),null!=r&&t.clipExtent(r),t}function qi(t,n,e){return Li(t,function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),u=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,a=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([u,a])},e)}function Di(t,n,e){return qi(t,[[0,0],n],e)}function Ui(t,n,e){return Li(t,function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,u=-i*e[0][1];t.scale(150*i).translate([o,u])},e)}function Oi(t,n,e){return Li(t,function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],u=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,u])},e)}function Fi(t,n){return+n?function(t,n){function e(r,i,o,u,a,c,s,f,l,h,p,d,v,g){var _=s-r,y=f-i,m=_*_+y*y;if(m>4*n&&v--){var x=u+h,b=a+p,w=c+d,M=Yp(x*x+b*b+w*w),T=We(w/=M),N=zp(zp(w)-1)<Mp||zp(o-l)<Mp?(o+l)/2:Rp(b,x),k=t(N,T),S=k[0],E=k[1],A=S-r,C=E-i,z=y*A-_*C;(z*z/m>n||zp((_*A+y*C)/m-.5)>.3||u*h+a*p+c*d<jd)&&(e(r,i,o,u,a,c,S,E,N,x/=M,b/=M,w,v,g),g.point(S,E),e(S,E,N,x,b,w,s,f,l,h,p,d,v,g))}}return function(n){function r(e,r){e=t(e,r),n.point(e[0],e[1])}function i(){_=NaN,w.point=o,n.lineStart()}function o(r,i){var o=ur([r,i]),u=t(r,i);e(_,y,g,m,x,b,_=u[0],y=u[1],g=r,m=o[0],x=o[1],b=o[2],Hd,n),n.point(_,y)}function u(){w.point=r,n.lineEnd()}function a(){i(),w.point=c,w.lineEnd=s}function c(t,n){o(f=t,n),l=_,h=y,p=m,d=x,v=b,w.point=o}function s(){e(_,y,g,m,x,b,l,h,f,p,d,v,Hd,n),w.lineEnd=u,u()}var f,l,h,p,d,v,g,_,y,m,x,b,w={point:r,lineStart:i,lineEnd:u,polygonStart:function(){n.polygonStart(),w.lineStart=a},polygonEnd:function(){n.polygonEnd(),w.lineStart=i}};return w}}(t,n):function(t){return Pi({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}function Ii(t){return Yi(function(){return t})()}function Yi(t){function n(t){return t=s(t[0]*Cp,t[1]*Cp),[t[0]*v+u,a-t[1]*v]}function e(t,n){return t=o(t,n),[t[0]*v+u,a-t[1]*v]}function r(){s=Rr(c=qr(x,b,w),o);var t=o(y,m);return u=g-t[0]*v,a=_+t[1]*v,i()}function i(){return p=d=null,n}var o,u,a,c,s,f,l,h,p,d,v=150,g=480,_=250,y=0,m=0,x=0,b=0,w=0,M=null,T=sd,N=null,k=pi,S=.5,E=Fi(e,S);return n.stream=function(t){return p&&d===t?p:p=Xd(function(t){return Pi({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(c)(T(E(k(d=t)))))},n.preclip=function(t){return arguments.length?(T=t,M=void 0,i()):T},n.postclip=function(t){return arguments.length?(k=t,N=f=l=h=null,i()):k},n.clipAngle=function(t){return arguments.length?(T=+t?Qr(M=t*Cp):(M=null,sd),i()):M*Ap},n.clipExtent=function(t){return arguments.length?(k=null==t?(N=f=l=h=null,pi):Jr(N=+t[0][0],f=+t[0][1],l=+t[1][0],h=+t[1][1]),i()):null==N?null:[[N,f],[l,h]]},n.scale=function(t){return arguments.length?(v=+t,r()):v},n.translate=function(t){return arguments.length?(g=+t[0],_=+t[1],r()):[g,_]},n.center=function(t){return arguments.length?(y=t[0]%360*Cp,m=t[1]%360*Cp,r()):[y*Ap,m*Ap]},n.rotate=function(t){return arguments.length?(x=t[0]%360*Cp,b=t[1]%360*Cp,w=t.length>2?t[2]%360*Cp:0,r()):[x*Ap,b*Ap,w*Ap]},n.precision=function(t){return arguments.length?(E=Fi(e,S=t*t),i()):Yp(S)},n.fitExtent=function(t,e){return qi(n,t,e)},n.fitSize=function(t,e){return Di(n,t,e)},n.fitWidth=function(t,e){return Ui(n,t,e)},n.fitHeight=function(t,e){return Oi(n,t,e)},function(){return o=t.apply(this,arguments),n.invert=o.invert&&function(t){return(t=s.invert((t[0]-u)/v,(a-t[1])/v))&&[t[0]*Ap,t[1]*Ap]},r()}}function Bi(t){var n=0,e=Np/3,r=Yi(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Cp,e=t[1]*Cp):[n*Ap,e*Ap]},i}function Hi(t,n){function e(t,n){var e=Yp(o-2*i*Fp(n))/i;return[e*Fp(t*=i),u-e*Lp(t)]}var r=Fp(t),i=(r+Fp(n))/2;if(zp(i)<Mp)return function(t){function n(t,n){return[t*e,Fp(n)/e]}var e=Lp(t);return n.invert=function(t,n){return[t/e,We(n*e)]},n}(t);var o=1+r*(2*i-r),u=Yp(o)/i;return e.invert=function(t,n){var e=u-n;return[Rp(t,zp(e))/i*Ip(e),We((o-(t*t+e*e)*i*i)/(2*i))]},e}function ji(){return Bi(Hi).scale(155.424).center([0,33.6442])}function Xi(){return ji().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Vi(t){return function(n,e){var r=Lp(n),i=Lp(e),o=t(r*i);return[o*i*Fp(n),o*Fp(e)]}}function $i(t){return function(n,e){var r=Yp(n*n+e*e),i=t(r),o=Fp(i),u=Lp(i);return[Rp(n*o,r*u),We(r&&e*o/r)]}}function Wi(t,n){return[t,Up(Bp((kp+n)/2))]}function Zi(t){function n(){var n=Np*a(),u=o(Fr(o.rotate()).invert([0,0]));return s(null==f?[[u[0]-n,u[1]-n],[u[0]+n,u[1]+n]]:t===Wi?[[Math.max(u[0]-n,f),e],[Math.min(u[0]+n,r),i]]:[[f,Math.max(u[1]-n,e)],[r,Math.min(u[1]+n,i)]])}var e,r,i,o=Ii(t),u=o.center,a=o.scale,c=o.translate,s=o.clipExtent,f=null;return o.scale=function(t){return arguments.length?(a(t),n()):a()},o.translate=function(t){return arguments.length?(c(t),n()):c()},o.center=function(t){return arguments.length?(u(t),n()):u()},o.clipExtent=function(t){return arguments.length?(null==t?f=e=r=i=null:(f=+t[0][0],e=+t[0][1],r=+t[1][0],i=+t[1][1]),n()):null==f?null:[[f,e],[r,i]]},n()}function Gi(t){return Bp((kp+t)/2)}function Qi(t,n){function e(t,n){o>0?n<-kp+Mp&&(n=-kp+Mp):n>kp-Mp&&(n=kp-Mp);var e=o/Op(Gi(n),i);return[e*Fp(i*t),o-e*Lp(i*t)]}var r=Lp(t),i=t===n?Fp(t):Up(r/Lp(n))/Up(Gi(n)/Gi(t)),o=r*Op(Gi(t),i)/i;return i?(e.invert=function(t,n){var e=o-n,r=Ip(i)*Yp(t*t+e*e);return[Rp(t,zp(e))/i*Ip(e),2*Pp(Op(o/r,1/i))-kp]},e):Wi}function Ji(t,n){return[t,n]}function Ki(t,n){function e(t,n){var e=o-n,r=i*t;return[e*Fp(r),o-e*Lp(r)]}var r=Lp(t),i=t===n?Fp(t):(r-Lp(n))/(n-t),o=r/i+t;return zp(i)<Mp?Ji:(e.invert=function(t,n){var e=o-n;return[Rp(t,zp(e))/i*Ip(e),o-Ip(i)*Yp(t*t+e*e)]},e)}function to(t,n){var e=Lp(n),r=Lp(t)*e;return[e*Fp(t)/r,Fp(n)/r]}function no(t,n,e,r){return 1===t&&1===n&&0===e&&0===r?pi:Pi({point:function(i,o){this.stream.point(i*t+e,o*n+r)}})}function eo(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function ro(t,n){return[Lp(n)*Fp(t),Fp(n)]}function io(t,n){var e=Lp(n),r=1+Lp(t)*e;return[e*Fp(t)/r,Fp(n)/r]}function oo(t,n){return[Up(Bp((kp+n)/2)),-t]}function uo(t,n){return t.parent===n.parent?1:2}function ao(t,n){return t+n.x}function co(t,n){return Math.max(t,n.y)}function so(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function fo(t,n){var e,r,i,o,u,a=new vo(t),c=+t.value&&(a.value=t.value),s=[a];for(null==n&&(n=lo);e=s.pop();)if(c&&(e.value=+e.data.value),(i=n(e.data))&&(u=i.length))for(e.children=new Array(u),o=u-1;o>=0;--o)s.push(r=e.children[o]=new vo(i[o])),r.parent=e,r.depth=e.depth+1;return a.eachBefore(po)}function lo(t){return t.children}function ho(t){t.data=t.data.data}function po(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function vo(t){this.data=t,this.depth=this.height=0,this.parent=null}function go(t){for(var n,e,r=0,i=(t=function(t){for(var n,e,r=t.length;r;)e=Math.random()*r--|0,n=t[r],t[r]=t[e],t[e]=n;return t}(Wd.call(t))).length,o=[];r<i;)n=t[r],e&&yo(e,n)?++r:(e=function(t){switch(t.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(t[0]);case 2:return xo(t[0],t[1]);case 3:return bo(t[0],t[1],t[2])}}(o=function(t,n){var e,r;if(mo(n,t))return[n];for(e=0;e<t.length;++e)if(_o(n,t[e])&&mo(xo(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(_o(xo(t[e],t[r]),n)&&_o(xo(t[e],n),t[r])&&_o(xo(t[r],n),t[e])&&mo(bo(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}(o,n)),r=0);return e}function _o(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function yo(t,n){var e=t.r-n.r+1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function mo(t,n){for(var e=0;e<n.length;++e)if(!yo(t,n[e]))return!1;return!0}function xo(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,u=n.y,a=n.r,c=o-e,s=u-r,f=a-i,l=Math.sqrt(c*c+s*s);return{x:(e+o+c/l*f)/2,y:(r+u+s/l*f)/2,r:(l+i+a)/2}}function bo(t,n,e){var r=t.x,i=t.y,o=t.r,u=n.x,a=n.y,c=n.r,s=e.x,f=e.y,l=e.r,h=r-u,p=r-s,d=i-a,v=i-f,g=c-o,_=l-o,y=r*r+i*i-o*o,m=y-u*u-a*a+c*c,x=y-s*s-f*f+l*l,b=p*d-h*v,w=(d*x-v*m)/(2*b)-r,M=(v*g-d*_)/b,T=(p*m-h*x)/(2*b)-i,N=(h*_-p*g)/b,k=M*M+N*N-1,S=2*(o+w*M+T*N),E=w*w+T*T-o*o,A=-(k?(S+Math.sqrt(S*S-4*k*E))/(2*k):E/S);return{x:r+w+M*A,y:i+T+N*A,r:A}}function wo(t,n,e){var r=t.x,i=t.y,o=n.r+e.r,u=t.r+e.r,a=n.x-r,c=n.y-i,s=a*a+c*c;if(s){var f=.5+((u*=u)-(o*=o))/(2*s),l=Math.sqrt(Math.max(0,2*o*(u+s)-(u-=s)*u-o*o))/(2*s);e.x=r+f*a+l*c,e.y=i+f*c-l*a}else e.x=r+u,e.y=i}function Mo(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r+n.r;return i*i-1e-6>e*e+r*r}function To(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function No(t){this._=t,this.next=null,this.previous=null}function ko(t){if(!(i=t.length))return 0;var n,e,r,i,o,u,a,c,s,f,l;if(n=t[0],n.x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;wo(e,n,r=t[2]),n=new No(n),e=new No(e),r=new No(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(a=3;a<i;++a){wo(n._,e._,r=t[a]),r=new No(r),c=e.next,s=n.previous,f=e._.r,l=n._.r;do{if(f<=l){if(Mo(c._,r._)){e=c,n.next=e,e.previous=n,--a;continue t}f+=c._.r,c=c.next}else{if(Mo(s._,r._)){(n=s).next=e,e.previous=n,--a;continue t}l+=s._.r,s=s.previous}}while(c!==s.next);for(r.previous=n,r.next=e,n.next=e.previous=e=r,o=To(n);(r=r.next)!==e;)(u=To(r))<o&&(n=r,o=u);e=n.next}for(n=[e._],r=e;(r=r.next)!==e;)n.push(r._);for(r=go(n),a=0;a<i;++a)n=t[a],n.x-=r.x,n.y-=r.y;return r.r}function So(t){if("function"!=typeof t)throw new Error;return t}function Eo(){return 0}function Ao(t){return function(){return t}}function Co(t){return Math.sqrt(t.value)}function zo(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function Po(t,n){return function(e){if(r=e.children){var r,i,o,u=r.length,a=t(e)*n||0;if(a)for(i=0;i<u;++i)r[i].r+=a;if(o=ko(r),a)for(i=0;i<u;++i)r[i].r-=a;e.r=o+a}}}function Ro(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function Lo(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function qo(t,n,e,r,i){for(var o,u=t.children,a=-1,c=u.length,s=t.value&&(r-n)/t.value;++a<c;)(o=u[a]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*s}function Do(t){return t.id}function Uo(t){return t.parentId}function Oo(t,n){return t.parent===n.parent?1:2}function Fo(t){var n=t.children;return n?n[0]:t.t}function Io(t){var n=t.children;return n?n[n.length-1]:t.t}function Yo(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function Bo(t,n,e){return t.a.parent===n.parent?t.a:e}function Ho(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function jo(t,n,e,r,i){for(var o,u=t.children,a=-1,c=u.length,s=t.value&&(i-e)/t.value;++a<c;)(o=u[a]).x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*s}function Xo(t,n,e,r,i,o){for(var u,a,c,s,f,l,h,p,d,v,g,_=[],y=n.children,m=0,x=0,b=y.length,w=n.value;m<b;){c=i-e,s=o-r;do{f=y[x++].value}while(!f&&x<b);for(l=h=f,g=f*f*(v=Math.max(s/c,c/s)/(w*t)),d=Math.max(h/g,g/l);x<b;++x){if(f+=a=y[x].value,a<l&&(l=a),a>h&&(h=a),g=f*f*v,(p=Math.max(h/g,g/l))>d){f-=a;break}d=p}_.push(u={value:f,dice:c<s,children:y.slice(m,x)}),u.dice?qo(u,e,r,i,w?r+=s*f/w:o):jo(u,e,r,w?e+=c*f/w:i,o),w-=f,m=x}return _}function Vo(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function $o(t,n){return t[0]-n[0]||t[1]-n[1]}function Wo(t){for(var n=t.length,e=[0,1],r=2,i=2;i<n;++i){for(;r>1&&Vo(t[e[r-2]],t[e[r-1]],t[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function Zo(t){this._size=t,this._call=this._error=null,this._tasks=[],this._data=[],this._waiting=this._active=this._ended=this._start=0}function Go(t){if(!t._start)try{(function(t){for(;t._start=t._waiting&&t._active<t._size;){var n=t._ended+t._active,e=t._tasks[n],r=e.length-1,i=e[r];e[r]=function(t,n){return function(e,r){t._tasks[n]&&(--t._active,++t._ended,t._tasks[n]=null,null==t._error&&(null!=e?Qo(t,e):(t._data[n]=r,t._waiting?Go(t):Jo(t))))}}(t,n),--t._waiting,++t._active,e=i.apply(null,e),t._tasks[n]&&(t._tasks[n]=e||ev)}})(t)}catch(n){if(t._tasks[t._ended+t._active-1])Qo(t,n);else if(!t._data)throw n}}function Qo(t,n){var e,r=t._tasks.length;for(t._error=n,t._data=void 0,t._waiting=NaN;--r>=0;)if((e=t._tasks[r])&&(t._tasks[r]=null,e.abort))try{e.abort()}catch(n){}t._active=NaN,Jo(t)}function Jo(t){if(!t._active&&t._call){var n=t._data;t._data=void 0,t._call(t._error,n)}}function Ko(t){if(null==t)t=1/0;else if(!((t=+t)>=1))throw new Error("invalid concurrency");return new Zo(t)}function tu(){return Math.random()}function nu(t,n){function e(t){var n,e=s.status;if(!e&&function(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}(s)||e>=200&&e<300||304===e){if(o)try{n=o.call(r,s)}catch(t){return void a.call("error",r,t)}else n=s;a.call("load",r,n)}else a.call("error",r,t)}var r,i,o,u,a=N("beforesend","progress","load","error"),c=se(),s=new XMLHttpRequest,f=null,l=null,h=0;if("undefined"==typeof XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=s.ontimeout=e:s.onreadystatechange=function(t){s.readyState>3&&e(t)},s.onprogress=function(t){a.call("progress",r,t)},r={header:function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?c.get(t):(null==n?c.remove(t):c.set(t,n+""),r)},mimeType:function(t){return arguments.length?(i=null==t?null:t+"",r):i},responseType:function(t){return arguments.length?(u=t,r):u},timeout:function(t){return arguments.length?(h=+t,r):h},user:function(t){return arguments.length<1?f:(f=null==t?null:t+"",r)},password:function(t){return arguments.length<1?l:(l=null==t?null:t+"",r)},response:function(t){return o=t,r},get:function(t,n){return r.send("GET",t,n)},post:function(t,n){return r.send("POST",t,n)},send:function(n,e,o){return s.open(n,t,!0,f,l),null==i||c.has("accept")||c.set("accept",i+",*/*"),s.setRequestHeader&&c.each(function(t,n){s.setRequestHeader(n,t)}),null!=i&&s.overrideMimeType&&s.overrideMimeType(i),null!=u&&(s.responseType=u),h>0&&(s.timeout=h),null==o&&"function"==typeof e&&(o=e,e=null),null!=o&&1===o.length&&(o=function(t){return function(n,e){t(null==n?e:null)}}(o)),null!=o&&r.on("error",o).on("load",function(t){o(null,t)}),a.call("beforesend",r,s),s.send(null==e?null:e),r},abort:function(){return s.abort(),r},on:function(){var t=a.on.apply(a,arguments);return t===a?r:t}},null!=n){if("function"!=typeof n)throw new Error("invalid callback: "+n);return r.get(n)}return r}function eu(t,n){return function(e,r){var i=nu(e).mimeType(t).response(n);if(null!=r){if("function"!=typeof r)throw new Error("invalid callback: "+r);return i.get(r)}return i}}function ru(t,n){return function(e,r,i){arguments.length<3&&(i=r,r=null);var o=nu(e).mimeType(t);return o.row=function(t){return arguments.length?o.response(function(t,n){return function(e){return t(e.responseText,n)}}(n,r=t)):r},o.row(r),i?o.get(i):o}}function iu(t){function n(n){var o=n+"",u=e.get(o);if(!u){if(i!==yv)return i;e.set(o,u=r.push(n))}return t[(u-1)%t.length]}var e=se(),r=[],i=yv;return t=null==t?[]:_v.call(t),n.domain=function(t){if(!arguments.length)return r.slice();r=[],e=se();for(var i,o,u=-1,a=t.length;++u<a;)e.has(o=(i=t[u])+"")||e.set(o,r.push(i));return n},n.range=function(e){return arguments.length?(t=_v.call(e),n):t.slice()},n.unknown=function(t){return arguments.length?(i=t,n):i},n.copy=function(){return iu().domain(r).range(t).unknown(i)},n}function ou(){function t(){var t=i().length,r=u[1]<u[0],h=u[r-0],p=u[1-r];n=(p-h)/Math.max(1,t-c+2*s),a&&(n=Math.floor(n)),h+=(p-h-n*(t-c))*l,e=n*(1-c),a&&(h=Math.round(h),e=Math.round(e));var d=f(t).map(function(t){return h+n*t});return o(r?d.reverse():d)}var n,e,r=iu().unknown(void 0),i=r.domain,o=r.range,u=[0,1],a=!1,c=0,s=0,l=.5;return delete r.unknown,r.domain=function(n){return arguments.length?(i(n),t()):i()},r.range=function(n){return arguments.length?(u=[+n[0],+n[1]],t()):u.slice()},r.rangeRound=function(n){return u=[+n[0],+n[1]],a=!0,t()},r.bandwidth=function(){return e},r.step=function(){return n},r.round=function(n){return arguments.length?(a=!!n,t()):a},r.padding=function(n){return arguments.length?(c=s=Math.max(0,Math.min(1,n)),t()):c},r.paddingInner=function(n){return arguments.length?(c=Math.max(0,Math.min(1,n)),t()):c},r.paddingOuter=function(n){return arguments.length?(s=Math.max(0,Math.min(1,n)),t()):s},r.align=function(n){return arguments.length?(l=Math.max(0,Math.min(1,n)),t()):l},r.copy=function(){return ou().domain(i()).range(u).round(a).paddingInner(c).paddingOuter(s).align(l)},t()}function uu(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return uu(n())},t}function au(t){return function(){return t}}function cu(t){return+t}function su(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:au(n)}function fu(t,n,e,r){var i=t[0],o=t[1],u=n[0],a=n[1];return o<i?(i=e(o,i),u=r(a,u)):(i=e(i,o),u=r(u,a)),function(t){return u(i(t))}}function lu(t,n,e,r){var i=Math.min(t.length,n.length)-1,o=new Array(i),u=new Array(i),a=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<i;)o[a]=e(t[a],t[a+1]),u[a]=r(n[a],n[a+1]);return function(n){var e=Os(t,n,1,i)-1;return u[e](o[e](n))}}function hu(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp())}function pu(t,n){function e(){return i=Math.min(a.length,c.length)>2?lu:fu,o=u=null,r}function r(n){return(o||(o=i(a,c,f?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}(t):t,s)))(+n)}var i,o,u,a=mv,c=mv,s=fn,f=!1;return r.invert=function(t){return(u||(u=i(c,a,su,f?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}(n):n)))(+t)},r.domain=function(t){return arguments.length?(a=gv.call(t,cu),e()):a.slice()},r.range=function(t){return arguments.length?(c=_v.call(t),e()):c.slice()},r.rangeRound=function(t){return c=_v.call(t),s=ln,e()},r.clamp=function(t){return arguments.length?(f=!!t,e()):f},r.interpolate=function(t){return arguments.length?(s=t,e()):s},e()}function du(n){var e=n.domain;return n.ticks=function(t){var n=e();return l(n[0],n[n.length-1],null==t?10:t)},n.tickFormat=function(n,r){return function(n,e,r){var i,o=n[0],u=n[n.length-1],a=p(o,u,null==e?10:e);switch((r=De(null==r?",f":r)).type){case"s":var c=Math.max(Math.abs(o),Math.abs(u));return null!=r.precision||isNaN(i=Be(a,c))||(r.precision=i),t.formatPrefix(r,c);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=He(a,Math.max(Math.abs(o),Math.abs(u))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Ye(a))||(r.precision=i-2*("%"===r.type))}return t.format(r)}(e(),n,r)},n.nice=function(t){null==t&&(t=10);var r,i=e(),o=0,u=i.length-1,a=i[o],c=i[u];return c<a&&(r=a,a=c,c=r,r=o,o=u,u=r),(r=h(a,c,t))>0?r=h(a=Math.floor(a/r)*r,c=Math.ceil(c/r)*r,t):r<0&&(r=h(a=Math.ceil(a*r)/r,c=Math.floor(c*r)/r,t)),r>0?(i[o]=Math.floor(a/r)*r,i[u]=Math.ceil(c/r)*r,e(i)):r<0&&(i[o]=Math.ceil(a*r)/r,i[u]=Math.floor(c*r)/r,e(i)),n},n}function vu(){var t=pu(su,an);return t.copy=function(){return hu(t,vu())},du(t)}function gu(){function t(t){return+t}var n=[0,1];return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=gv.call(e,cu),t):n.slice()},t.copy=function(){return gu().domain(n)},du(t)}function _u(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],u=t[i];return u<o&&(e=r,r=i,i=e,e=o,o=u,u=e),t[r]=n.floor(o),t[i]=n.ceil(u),t}function yu(t,n){return(n=Math.log(n/t))?function(e){return Math.log(e/t)/n}:au(n)}function mu(t,n){return t<0?function(e){return-Math.pow(-n,e)*Math.pow(-t,1-e)}:function(e){return Math.pow(n,e)*Math.pow(t,1-e)}}function xu(t){return isFinite(t)?+("1e"+t):t<0?0:t}function bu(t){return 10===t?xu:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}function wu(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}function Mu(t){return function(n){return-t(-n)}}function Tu(){function n(){return o=wu(i),u=bu(i),r()[0]<0&&(o=Mu(o),u=Mu(u)),e}var e=pu(yu,mu).domain([1,10]),r=e.domain,i=10,o=wu(10),u=bu(10);return e.base=function(t){return arguments.length?(i=+t,n()):i},e.domain=function(t){return arguments.length?(r(t),n()):r()},e.ticks=function(t){var n,e=r(),a=e[0],c=e[e.length-1];(n=c<a)&&(p=a,a=c,c=p);var s,f,h,p=o(a),d=o(c),v=null==t?10:+t,g=[];if(!(i%1)&&d-p<v){if(p=Math.round(p)-1,d=Math.round(d)+1,a>0){for(;p<d;++p)for(f=1,s=u(p);f<i;++f)if(!((h=s*f)<a)){if(h>c)break;g.push(h)}}else for(;p<d;++p)for(f=i-1,s=u(p);f>=1;--f)if(!((h=s*f)<a)){if(h>c)break;g.push(h)}}else g=l(p,d,Math.min(d-p,v)).map(u);return n?g.reverse():g},e.tickFormat=function(n,r){if(null==r&&(r=10===i?".0e":","),"function"!=typeof r&&(r=t.format(r)),n===1/0)return r;null==n&&(n=10);var a=Math.max(1,i*n/e.ticks().length);return function(t){var n=t/u(Math.round(o(t)));return n*i<i-.5&&(n*=i),n<=a?r(t):""}},e.nice=function(){return r(_u(r(),{floor:function(t){return u(Math.floor(o(t)))},ceil:function(t){return u(Math.ceil(o(t)))}}))},e.copy=function(){return hu(e,Tu().base(i))},e}function Nu(t,n){return t<0?-Math.pow(-t,n):Math.pow(t,n)}function ku(){var t=1,n=pu(function(n,e){return(e=Nu(e,t)-(n=Nu(n,t)))?function(r){return(Nu(r,t)-n)/e}:au(e)},function(n,e){return e=Nu(e,t)-(n=Nu(n,t)),function(r){return Nu(n+e*r,1/t)}}),e=n.domain;return n.exponent=function(n){return arguments.length?(t=+n,e(e())):t},n.copy=function(){return hu(n,ku().exponent(t))},du(n)}function Su(){function t(){var t=0,n=Math.max(1,i.length);for(o=new Array(n-1);++t<n;)o[t-1]=v(r,t/n);return e}function e(t){if(!isNaN(t=+t))return i[Os(o,t)]}var r=[],i=[],o=[];return e.invertExtent=function(t){var n=i.indexOf(t);return n<0?[NaN,NaN]:[n>0?o[n-1]:r[0],n<o.length?o[n]:r[r.length-1]]},e.domain=function(e){if(!arguments.length)return r.slice();r=[];for(var i,o=0,u=e.length;o<u;++o)null==(i=e[o])||isNaN(i=+i)||r.push(i);return r.sort(n),t()},e.range=function(n){return arguments.length?(i=_v.call(n),t()):i.slice()},e.quantiles=function(){return o.slice()},e.copy=function(){return Su().domain(r).range(i)},e}function Eu(){function t(t){if(t<=t)return u[Os(o,t,0,i)]}function n(){var n=-1;for(o=new Array(i);++n<i;)o[n]=((n+1)*r-(n-i)*e)/(i+1);return t}var e=0,r=1,i=1,o=[.5],u=[0,1];return t.domain=function(t){return arguments.length?(e=+t[0],r=+t[1],n()):[e,r]},t.range=function(t){return arguments.length?(i=(u=_v.call(t)).length-1,n()):u.slice()},t.invertExtent=function(t){var n=u.indexOf(t);return n<0?[NaN,NaN]:n<1?[e,o[0]]:n>=i?[o[i-1],r]:[o[n-1],o[n]]},t.copy=function(){return Eu().domain([e,r]).range(u)},du(t)}function Au(){function t(t){if(t<=t)return e[Os(n,t,0,r)]}var n=[.5],e=[0,1],r=1;return t.domain=function(i){return arguments.length?(n=_v.call(i),r=Math.min(n.length,e.length-1),t):n.slice()},t.range=function(i){return arguments.length?(e=_v.call(i),r=Math.min(n.length,e.length-1),t):e.slice()},t.invertExtent=function(t){var r=e.indexOf(t);return[n[r-1],n[r]]},t.copy=function(){return Au().domain(n).range(e)},t}function Cu(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var u,a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=function(e){return Cu(function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return xv.setTime(+n),bv.setTime(+r),t(xv),t(bv),Math.floor(e(xv,bv))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}function zu(t){return Cu(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Tv)/Nv})}function Pu(t){return Cu(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/Nv})}function Ru(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Lu(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function qu(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function Du(t){function n(t,n){return function(e){var r,i,o,u=[],a=-1,c=0,s=t.length;for(e instanceof Date||(e=new Date(+e));++a<s;)37===t.charCodeAt(a)&&(u.push(t.slice(c,a)),null!=(i=Mg[r=t.charAt(++a)])?r=t.charAt(++a):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),u.push(r),c=a+1);return u.push(t.slice(c,a)),u.join("")}}function e(t,n){return function(e){var i,o,u=qu(1900);if(r(u,t,e+="",0)!=e.length)return null;if("Q"in u)return new Date(u.Q);if("p"in u&&(u.H=u.H%12+12*u.p),"V"in u){if(u.V<1||u.V>53)return null;"w"in u||(u.w=1),"Z"in u?(i=(o=(i=Lu(qu(u.y))).getUTCDay())>4||0===o?og.ceil(i):og(i),i=eg.offset(i,7*(u.V-1)),u.y=i.getUTCFullYear(),u.m=i.getUTCMonth(),u.d=i.getUTCDate()+(u.w+6)%7):(i=(o=(i=n(qu(u.y))).getDay())>4||0===o?qv.ceil(i):qv(i),i=Pv.offset(i,7*(u.V-1)),u.y=i.getFullYear(),u.m=i.getMonth(),u.d=i.getDate()+(u.w+6)%7)}else("W"in u||"U"in u)&&("w"in u||(u.w="u"in u?u.u%7:"W"in u?1:0),o="Z"in u?Lu(qu(u.y)).getUTCDay():n(qu(u.y)).getDay(),u.m=0,u.d="W"in u?(u.w+6)%7+7*u.W-(o+5)%7:u.w+7*u.U-(o+6)%7);return"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,Lu(u)):n(u)}}function r(t,n,e,r){for(var i,o,u=0,a=n.length,c=e.length;u<a;){if(r>=c)return-1;if(37===(i=n.charCodeAt(u++))){if(i=n.charAt(u++),!(o=T[i in Mg?n.charAt(u++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}var i=t.dateTime,o=t.date,u=t.time,a=t.periods,c=t.days,s=t.shortDays,f=t.months,l=t.shortMonths,h=Fu(a),p=Iu(a),d=Fu(c),v=Iu(c),g=Fu(s),_=Iu(s),y=Fu(f),m=Iu(f),x=Fu(l),b=Iu(l),w={a:function(t){return s[t.getDay()]},A:function(t){return c[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return f[t.getMonth()]},c:null,d:ua,e:ua,f:la,H:aa,I:ca,j:sa,L:fa,m:ha,M:pa,p:function(t){return a[+(t.getHours()>=12)]},Q:Ya,s:Ba,S:da,u:va,U:ga,V:_a,w:ya,W:ma,x:null,X:null,y:xa,Y:ba,Z:wa,"%":Ia},M={a:function(t){return s[t.getUTCDay()]},A:function(t){return c[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return f[t.getUTCMonth()]},c:null,d:Ma,e:Ma,f:Ea,H:Ta,I:Na,j:ka,L:Sa,m:Aa,M:Ca,p:function(t){return a[+(t.getUTCHours()>=12)]},Q:Ya,s:Ba,S:za,u:Pa,U:Ra,V:La,w:qa,W:Da,x:null,X:null,y:Ua,Y:Oa,Z:Fa,"%":Ia},T={a:function(t,n,e){var r=g.exec(n.slice(e));return r?(t.w=_[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=v[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=x.exec(n.slice(e));return r?(t.m=b[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=y.exec(n.slice(e));return r?(t.m=m[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,n,e){return r(t,i,n,e)},d:Gu,e:Gu,f:ea,H:Ju,I:Ju,j:Qu,L:na,m:Zu,M:Ku,p:function(t,n,e){var r=h.exec(n.slice(e));return r?(t.p=p[r[0].toLowerCase()],e+r[0].length):-1},Q:ia,s:oa,S:ta,u:Bu,U:Hu,V:ju,w:Yu,W:Xu,x:function(t,n,e){return r(t,o,n,e)},X:function(t,n,e){return r(t,u,n,e)},y:$u,Y:Vu,Z:Wu,"%":ra};return w.x=n(o,w),w.X=n(u,w),w.c=n(i,w),M.x=n(o,M),M.X=n(u,M),M.c=n(i,M),{format:function(t){var e=n(t+="",w);return e.toString=function(){return t},e},parse:function(t){var n=e(t+="",Ru);return n.toString=function(){return t},n},utcFormat:function(t){var e=n(t+="",M);return e.toString=function(){return t},e},utcParse:function(t){var n=e(t,Lu);return n.toString=function(){return t},n}}}function Uu(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Ou(t){return t.replace(kg,"\\$&")}function Fu(t){return new RegExp("^(?:"+t.map(Ou).join("|")+")","i")}function Iu(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function Yu(t,n,e){var r=Tg.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Bu(t,n,e){var r=Tg.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Hu(t,n,e){var r=Tg.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function ju(t,n,e){var r=Tg.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function Xu(t,n,e){var r=Tg.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function Vu(t,n,e){var r=Tg.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function $u(t,n,e){var r=Tg.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function Wu(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Zu(t,n,e){var r=Tg.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function Gu(t,n,e){var r=Tg.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Qu(t,n,e){var r=Tg.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Ju(t,n,e){var r=Tg.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Ku(t,n,e){var r=Tg.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ta(t,n,e){var r=Tg.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function na(t,n,e){var r=Tg.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function ea(t,n,e){var r=Tg.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function ra(t,n,e){var r=Ng.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function ia(t,n,e){var r=Tg.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function oa(t,n,e){var r=Tg.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function ua(t,n){return Uu(t.getDate(),n,2)}function aa(t,n){return Uu(t.getHours(),n,2)}function ca(t,n){return Uu(t.getHours()%12||12,n,2)}function sa(t,n){return Uu(1+Pv.count(Gv(t),t),n,3)}function fa(t,n){return Uu(t.getMilliseconds(),n,3)}function la(t,n){return fa(t,n)+"000"}function ha(t,n){return Uu(t.getMonth()+1,n,2)}function pa(t,n){return Uu(t.getMinutes(),n,2)}function da(t,n){return Uu(t.getSeconds(),n,2)}function va(t){var n=t.getDay();return 0===n?7:n}function ga(t,n){return Uu(Lv.count(Gv(t),t),n,2)}function _a(t,n){var e=t.getDay();return t=e>=4||0===e?Ov(t):Ov.ceil(t),Uu(Ov.count(Gv(t),t)+(4===Gv(t).getDay()),n,2)}function ya(t){return t.getDay()}function ma(t,n){return Uu(qv.count(Gv(t),t),n,2)}function xa(t,n){return Uu(t.getFullYear()%100,n,2)}function ba(t,n){return Uu(t.getFullYear()%1e4,n,4)}function wa(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Uu(n/60|0,"0",2)+Uu(n%60,"0",2)}function Ma(t,n){return Uu(t.getUTCDate(),n,2)}function Ta(t,n){return Uu(t.getUTCHours(),n,2)}function Na(t,n){return Uu(t.getUTCHours()%12||12,n,2)}function ka(t,n){return Uu(1+eg.count(xg(t),t),n,3)}function Sa(t,n){return Uu(t.getUTCMilliseconds(),n,3)}function Ea(t,n){return Sa(t,n)+"000"}function Aa(t,n){return Uu(t.getUTCMonth()+1,n,2)}function Ca(t,n){return Uu(t.getUTCMinutes(),n,2)}function za(t,n){return Uu(t.getUTCSeconds(),n,2)}function Pa(t){var n=t.getUTCDay();return 0===n?7:n}function Ra(t,n){return Uu(ig.count(xg(t),t),n,2)}function La(t,n){var e=t.getUTCDay();return t=e>=4||0===e?cg(t):cg.ceil(t),Uu(cg.count(xg(t),t)+(4===xg(t).getUTCDay()),n,2)}function qa(t){return t.getUTCDay()}function Da(t,n){return Uu(og.count(xg(t),t),n,2)}function Ua(t,n){return Uu(t.getUTCFullYear()%100,n,2)}function Oa(t,n){return Uu(t.getUTCFullYear()%1e4,n,4)}function Fa(){return"+0000"}function Ia(){return"%"}function Ya(t){return+t}function Ba(t){return Math.floor(+t/1e3)}function Ha(n){return bg=Du(n),t.timeFormat=bg.format,t.timeParse=bg.parse,t.utcFormat=bg.utcFormat,t.utcParse=bg.utcParse,bg}function ja(t){return new Date(t)}function Xa(t){return t instanceof Date?+t:+new Date(+t)}function Va(t,n,r,i,o,u,a,c,s){function f(e){return(a(e)<e?g:u(e)<e?_:o(e)<e?y:i(e)<e?m:n(e)<e?r(e)<e?x:b:t(e)<e?w:M)(e)}function l(n,r,i,o){if(null==n&&(n=10),"number"==typeof n){var u=Math.abs(i-r)/n,a=e(function(t){return t[2]}).right(T,u);a===T.length?(o=p(r/Dg,i/Dg,n),n=t):a?(o=(a=T[u/T[a-1][2]<T[a][2]/u?a-1:a])[1],n=a[0]):(o=Math.max(p(r,i,n),1),n=c)}return null==o?n:n.every(o)}var h=pu(su,an),d=h.invert,v=h.domain,g=s(".%L"),_=s(":%S"),y=s("%I:%M"),m=s("%I %p"),x=s("%a %d"),b=s("%b %d"),w=s("%B"),M=s("%Y"),T=[[a,1,Cg],[a,5,5*Cg],[a,15,15*Cg],[a,30,30*Cg],[u,1,zg],[u,5,5*zg],[u,15,15*zg],[u,30,30*zg],[o,1,Pg],[o,3,3*Pg],[o,6,6*Pg],[o,12,12*Pg],[i,1,Rg],[i,2,2*Rg],[r,1,Lg],[n,1,qg],[n,3,3*qg],[t,1,Dg]];return h.invert=function(t){return new Date(d(t))},h.domain=function(t){return arguments.length?v(gv.call(t,Xa)):v().map(ja)},h.ticks=function(t,n){var e,r=v(),i=r[0],o=r[r.length-1],u=o<i;return u&&(e=i,i=o,o=e),e=l(t,i,o,n),e=e?e.range(i,o+1):[],u?e.reverse():e},h.tickFormat=function(t,n){return null==n?f:s(n)},h.nice=function(t,n){var e=v();return(t=l(t,e[0],e[e.length-1],n))?v(_u(e,t)):h},h.copy=function(){return hu(h,Va(t,n,r,i,o,u,a,c,s))},h}function $a(t){return t.match(/.{6}/g).map(function(t){return"#"+t})}function Wa(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}function Za(t){function n(n){var o=(n-e)/(r-e);return t(i?Math.max(0,Math.min(1,o)):o)}var e=0,r=1,i=!1;return n.domain=function(t){return arguments.length?(e=+t[0],r=+t[1],n):[e,r]},n.clamp=function(t){return arguments.length?(i=!!t,n):i},n.interpolator=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Za(t).domain([e,r]).clamp(i)},du(n)}function Ga(t){return function(){return t}}function Qa(t){return t>=1?i_:t<=-1?-i_:Math.asin(t)}function Ja(t){return t.innerRadius}function Ka(t){return t.outerRadius}function tc(t){return t.startAngle}function nc(t){return t.endAngle}function ec(t){return t&&t.padAngle}function rc(t,n,e,r,i,o,u){var a=t-e,c=n-r,s=(u?o:-o)/n_(a*a+c*c),f=s*c,l=-s*a,h=t+f,p=n+l,d=e+f,v=r+l,g=(h+d)/2,_=(p+v)/2,y=d-h,m=v-p,x=y*y+m*m,b=i-o,w=h*v-d*p,M=(m<0?-1:1)*n_(Jg(0,b*b*x-w*w)),T=(w*m-y*M)/x,N=(-w*y-m*M)/x,k=(w*m+y*M)/x,S=(-w*y+m*M)/x,E=T-g,A=N-_,C=k-g,z=S-_;return E*E+A*A>C*C+z*z&&(T=k,N=S),{cx:T,cy:N,x01:-f,y01:-l,x11:T*(i/b-1),y11:N*(i/b-1)}}function ic(t){this._context=t}function oc(t){return new ic(t)}function uc(t){return t[0]}function ac(t){return t[1]}function cc(){function t(t){var a,c,s,f=t.length,l=!1;for(null==i&&(u=o(s=ee())),a=0;a<=f;++a)!(a<f&&r(c=t[a],a,t))===l&&((l=!l)?u.lineStart():u.lineEnd()),l&&u.point(+n(c,a,t),+e(c,a,t));if(s)return u=null,s+""||null}var n=uc,e=ac,r=Ga(!0),i=null,o=oc,u=null;return t.x=function(e){return arguments.length?(n="function"==typeof e?e:Ga(+e),t):n},t.y=function(n){return arguments.length?(e="function"==typeof n?n:Ga(+n),t):e},t.defined=function(n){return arguments.length?(r="function"==typeof n?n:Ga(!!n),t):r},t.curve=function(n){return arguments.length?(o=n,null!=i&&(u=o(i)),t):o},t.context=function(n){return arguments.length?(null==n?i=u=null:u=o(i=n),t):i},t}function sc(){function t(t){var n,f,l,h,p,d=t.length,v=!1,g=new Array(d),_=new Array(d);for(null==a&&(s=c(p=ee())),n=0;n<=d;++n){if(!(n<d&&u(h=t[n],n,t))===v)if(v=!v)f=n,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),l=n-1;l>=f;--l)s.point(g[l],_[l]);s.lineEnd(),s.areaEnd()}v&&(g[n]=+e(h,n,t),_[n]=+i(h,n,t),s.point(r?+r(h,n,t):g[n],o?+o(h,n,t):_[n]))}if(p)return s=null,p+""||null}function n(){return cc().defined(u).curve(c).context(a)}var e=uc,r=null,i=Ga(0),o=ac,u=Ga(!0),a=null,c=oc,s=null;return t.x=function(n){return arguments.length?(e="function"==typeof n?n:Ga(+n),r=null,t):e},t.x0=function(n){return arguments.length?(e="function"==typeof n?n:Ga(+n),t):e},t.x1=function(n){return arguments.length?(r=null==n?null:"function"==typeof n?n:Ga(+n),t):r},t.y=function(n){return arguments.length?(i="function"==typeof n?n:Ga(+n),o=null,t):i},t.y0=function(n){return arguments.length?(i="function"==typeof n?n:Ga(+n),t):i},t.y1=function(n){return arguments.length?(o=null==n?null:"function"==typeof n?n:Ga(+n),t):o},t.lineX0=t.lineY0=function(){return n().x(e).y(i)},t.lineY1=function(){return n().x(e).y(o)},t.lineX1=function(){return n().x(r).y(i)},t.defined=function(n){return arguments.length?(u="function"==typeof n?n:Ga(!!n),t):u},t.curve=function(n){return arguments.length?(c=n,null!=a&&(s=c(a)),t):c},t.context=function(n){return arguments.length?(null==n?a=s=null:s=c(a=n),t):a},t}function fc(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function lc(t){return t}function hc(t){this._curve=t}function pc(t){function n(n){return new hc(t(n))}return n._curve=t,n}function dc(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(pc(t)):n()._curve},t}function vc(){return dc(cc().curve(u_))}function gc(){var t=sc().curve(u_),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return dc(e())},delete t.lineX0,t.lineEndAngle=function(){return dc(r())},delete t.lineX1,t.lineInnerRadius=function(){return dc(i())},delete t.lineY0,t.lineOuterRadius=function(){return dc(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(pc(t)):n()._curve},t}function _c(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}function yc(t){return t.source}function mc(t){return t.target}function xc(t){function n(){var n,a=a_.call(arguments),c=e.apply(this,a),s=r.apply(this,a);if(u||(u=n=ee()),t(u,+i.apply(this,(a[0]=c,a)),+o.apply(this,a),+i.apply(this,(a[0]=s,a)),+o.apply(this,a)),n)return u=null,n+""||null}var e=yc,r=mc,i=uc,o=ac,u=null;return n.source=function(t){return arguments.length?(e=t,n):e},n.target=function(t){return arguments.length?(r=t,n):r},n.x=function(t){return arguments.length?(i="function"==typeof t?t:Ga(+t),n):i},n.y=function(t){return arguments.length?(o="function"==typeof t?t:Ga(+t),n):o},n.context=function(t){return arguments.length?(u=null==t?null:t,n):u},n}function bc(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function wc(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n,e=(e+i)/2,r,e,r,i)}function Mc(t,n,e,r,i){var o=_c(n,e),u=_c(n,e=(e+i)/2),a=_c(r,e),c=_c(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(u[0],u[1],a[0],a[1],c[0],c[1])}function Tc(){}function Nc(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function kc(t){this._context=t}function Sc(t){this._context=t}function Ec(t){this._context=t}function Ac(t,n){this._basis=new kc(t),this._beta=n}function Cc(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function zc(t,n){this._context=t,this._k=(1-n)/6}function Pc(t,n){this._context=t,this._k=(1-n)/6}function Rc(t,n){this._context=t,this._k=(1-n)/6}function Lc(t,n,e){var r=t._x1,i=t._y1,o=t._x2,u=t._y2;if(t._l01_a>e_){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>e_){var s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,f=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-n*t._l12_2a)/f,u=(u*s+t._y1*t._l23_2a-e*t._l12_2a)/f}t._context.bezierCurveTo(r,i,o,u,t._x2,t._y2)}function qc(t,n){this._context=t,this._alpha=n}function Dc(t,n){this._context=t,this._alpha=n}function Uc(t,n){this._context=t,this._alpha=n}function Oc(t){this._context=t}function Fc(t){return t<0?-1:1}function Ic(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),u=(e-t._y1)/(i||r<0&&-0),a=(o*i+u*r)/(r+i);return(Fc(o)+Fc(u))*Math.min(Math.abs(o),Math.abs(u),.5*Math.abs(a))||0}function Yc(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function Bc(t,n,e){var r=t._x0,i=t._y0,o=t._x1,u=t._y1,a=(o-r)/3;t._context.bezierCurveTo(r+a,i+a*n,o-a,u-a*e,o,u)}function Hc(t){this._context=t}function jc(t){this._context=new Xc(t)}function Xc(t){this._context=t}function Vc(t){this._context=t}function $c(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),u=new Array(r);for(i[0]=0,o[0]=2,u[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,o[n]=4,u[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,u[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)e=i[n]/o[n-1],o[n]-=e,u[n]-=e*u[n-1];for(i[r-1]=u[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(u[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}function Wc(t,n){this._context=t,this._t=n}function Zc(t,n){if((i=t.length)>1)for(var e,r,i,o=1,u=t[n[0]],a=u.length;o<i;++o)for(r=u,u=t[n[o]],e=0;e<a;++e)u[e][1]+=u[e][0]=isNaN(r[e][1])?r[e][0]:r[e][1]}function Gc(t){for(var n=t.length,e=new Array(n);--n>=0;)e[n]=n;return e}function Qc(t,n){return t[n]}function Jc(t){var n=t.map(Kc);return Gc(t).sort(function(t,e){return n[t]-n[e]})}function Kc(t){for(var n,e=0,r=-1,i=t.length;++r<i;)(n=+t[r][1])&&(e+=n);return e}function ts(t){return function(){return t}}function ns(t){return t[0]}function es(t){return t[1]}function rs(){this._=null}function is(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function os(t,n){var e=n,r=n.R,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function us(t,n){var e=n,r=n.L,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function as(t){for(;t.L;)t=t.L;return t}function cs(t,n,e,r){var i=[null,null],o=D_.push(i)-1;return i.left=t,i.right=n,e&&fs(i,t,n,e),r&&fs(i,n,t,r),L_[t.index].halfedges.push(o),L_[n.index].halfedges.push(o),i}function ss(t,n,e){var r=[n,e];return r.left=t,r}function fs(t,n,e,r){t[0]||t[1]?t.left===e?t[1]=r:t[0]=r:(t[0]=r,t.left=n,t.right=e)}function ls(t,n,e,r,i){var o,u=t[0],a=t[1],c=u[0],s=u[1],f=0,l=1,h=a[0]-c,p=a[1]-s;if(o=n-c,h||!(o>0)){if(o/=h,h<0){if(o<f)return;o<l&&(l=o)}else if(h>0){if(o>l)return;o>f&&(f=o)}if(o=r-c,h||!(o<0)){if(o/=h,h<0){if(o>l)return;o>f&&(f=o)}else if(h>0){if(o<f)return;o<l&&(l=o)}if(o=e-s,p||!(o>0)){if(o/=p,p<0){if(o<f)return;o<l&&(l=o)}else if(p>0){if(o>l)return;o>f&&(f=o)}if(o=i-s,p||!(o<0)){if(o/=p,p<0){if(o>l)return;o>f&&(f=o)}else if(p>0){if(o<f)return;o<l&&(l=o)}return!(f>0||l<1)||(f>0&&(t[0]=[c+f*h,s+f*p]),l<1&&(t[1]=[c+l*h,s+l*p]),!0)}}}}}function hs(t,n,e,r,i){var o=t[1];if(o)return!0;var u,a,c=t[0],s=t.left,f=t.right,l=s[0],h=s[1],p=f[0],d=f[1],v=(l+p)/2,g=(h+d)/2;if(d===h){if(v<n||v>=r)return;if(l>p){if(c){if(c[1]>=i)return}else c=[v,e];o=[v,i]}else{if(c){if(c[1]<e)return}else c=[v,i];o=[v,e]}}else if(u=(l-p)/(d-h),a=g-u*v,u<-1||u>1)if(l>p){if(c){if(c[1]>=i)return}else c=[(e-a)/u,e];o=[(i-a)/u,i]}else{if(c){if(c[1]<e)return}else c=[(i-a)/u,i];o=[(e-a)/u,e]}else if(h<d){if(c){if(c[0]>=r)return}else c=[n,u*n+a];o=[r,u*r+a]}else{if(c){if(c[0]<n)return}else c=[r,u*r+a];o=[n,u*n+a]}return t[0]=c,t[1]=o,!0}function ps(t,n){var e=t.site,r=n.left,i=n.right;return e===i&&(i=r,r=e),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(e===r?(r=n[1],i=n[0]):(r=n[0],i=n[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function ds(t,n){return n[+(n.left!==t.site)]}function vs(t,n){return n[+(n.left===t.site)]}function gs(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,o=e.site;if(r!==o){var u=i[0],a=i[1],c=r[0]-u,s=r[1]-a,f=o[0]-u,l=o[1]-a,h=2*(c*l-s*f);if(!(h>=-I_)){var p=c*c+s*s,d=f*f+l*l,v=(l*p-s*d)/h,g=(c*d-f*p)/h,_=U_.pop()||new function(){is(this),this.x=this.y=this.arc=this.site=this.cy=null};_.arc=t,_.site=i,_.x=v+u,_.y=(_.cy=g+a)+Math.sqrt(v*v+g*g),t.circle=_;for(var y=null,m=q_._;m;)if(_.y<m.y||_.y===m.y&&_.x<=m.x){if(!m.L){y=m.P;break}m=m.L}else{if(!m.R){y=m;break}m=m.R}q_.insert(y,_),y||(P_=_)}}}}function _s(t){var n=t.circle;n&&(n.P||(P_=n.N),q_.remove(n),U_.push(n),is(n),t.circle=null)}function ys(t){var n=O_.pop()||new function(){is(this),this.edge=this.site=this.circle=null};return n.site=t,n}function ms(t){_s(t),R_.remove(t),O_.push(t),is(t)}function xs(t){var n=t.circle,e=n.x,r=n.cy,i=[e,r],o=t.P,u=t.N,a=[t];ms(t);for(var c=o;c.circle&&Math.abs(e-c.circle.x)<F_&&Math.abs(r-c.circle.cy)<F_;)o=c.P,a.unshift(c),ms(c),c=o;a.unshift(c),_s(c);for(var s=u;s.circle&&Math.abs(e-s.circle.x)<F_&&Math.abs(r-s.circle.cy)<F_;)u=s.N,a.push(s),ms(s),s=u;a.push(s),_s(s);var f,l=a.length;for(f=1;f<l;++f)s=a[f],c=a[f-1],fs(s.edge,c.site,s.site,i);c=a[0],(s=a[l-1]).edge=cs(c.site,s.site,null,i),gs(c),gs(s)}function bs(t){for(var n,e,r,i,o=t[0],u=t[1],a=R_._;a;)if((r=ws(a,u)-o)>F_)a=a.L;else{if(!((i=o-function(t,n){var e=t.N;if(e)return ws(e,n);var r=t.site;return r[1]===n?r[0]:1/0}(a,u))>F_)){r>-F_?(n=a.P,e=a):i>-F_?(n=a,e=a.N):n=e=a;break}if(!a.R){n=a;break}a=a.R}(function(t){L_[t.index]={site:t,halfedges:[]}})(t);var c=ys(t);if(R_.insert(n,c),n||e){if(n===e)return _s(n),e=ys(n.site),R_.insert(c,e),c.edge=e.edge=cs(n.site,c.site),gs(n),void gs(e);if(e){_s(n),_s(e);var s=n.site,f=s[0],l=s[1],h=t[0]-f,p=t[1]-l,d=e.site,v=d[0]-f,g=d[1]-l,_=2*(h*g-p*v),y=h*h+p*p,m=v*v+g*g,x=[(g*y-p*m)/_+f,(h*m-v*y)/_+l];fs(e.edge,s,d,x),c.edge=cs(s,t,null,x),e.edge=cs(t,d,null,x),gs(n),gs(e)}else c.edge=cs(n.site,c.site)}}function ws(t,n){var e=t.site,r=e[0],i=e[1],o=i-n;if(!o)return r;var u=t.P;if(!u)return-1/0;var a=(e=u.site)[0],c=e[1],s=c-n;if(!s)return a;var f=a-r,l=1/o-1/s,h=f/s;return l?(-h+Math.sqrt(h*h-2*l*(f*f/(-2*s)-c+s/2+i-o/2)))/l+r:(r+a)/2}function Ms(t,n,e){return(t[0]-e[0])*(n[1]-t[1])-(t[0]-n[0])*(e[1]-t[1])}function Ts(t,n){return n[1]-t[1]||n[0]-t[0]}function Ns(t,n){var e,r,i,o=t.sort(Ts).pop();for(D_=[],L_=new Array(t.length),R_=new rs,q_=new rs;;)if(i=P_,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===e&&o[1]===r||(bs(o),e=o[0],r=o[1]),o=t.pop();else{if(!i)break;xs(i.arc)}if(function(){for(var t,n,e,r,i=0,o=L_.length;i<o;++i)if((t=L_[i])&&(r=(n=t.halfedges).length)){var u=new Array(r),a=new Array(r);for(e=0;e<r;++e)u[e]=e,a[e]=ps(t,D_[n[e]]);for(u.sort(function(t,n){return a[n]-a[t]}),e=0;e<r;++e)a[e]=n[u[e]];for(e=0;e<r;++e)n[e]=a[e]}}(),n){var u=+n[0][0],a=+n[0][1],c=+n[1][0],s=+n[1][1];(function(t,n,e,r){for(var i,o=D_.length;o--;)hs(i=D_[o],t,n,e,r)&&ls(i,t,n,e,r)&&(Math.abs(i[0][0]-i[1][0])>F_||Math.abs(i[0][1]-i[1][1])>F_)||delete D_[o]})(u,a,c,s),function(t,n,e,r){var i,o,u,a,c,s,f,l,h,p,d,v,g=L_.length,_=!0;for(i=0;i<g;++i)if(o=L_[i]){for(u=o.site,a=(c=o.halfedges).length;a--;)D_[c[a]]||c.splice(a,1);for(a=0,s=c.length;a<s;)d=(p=vs(o,D_[c[a]]))[0],v=p[1],l=(f=ds(o,D_[c[++a%s]]))[0],h=f[1],(Math.abs(d-l)>F_||Math.abs(v-h)>F_)&&(c.splice(a,0,D_.push(ss(u,p,Math.abs(d-t)<F_&&r-v>F_?[t,Math.abs(l-t)<F_?h:r]:Math.abs(v-r)<F_&&e-d>F_?[Math.abs(h-r)<F_?l:e,r]:Math.abs(d-e)<F_&&v-n>F_?[e,Math.abs(l-e)<F_?h:n]:Math.abs(v-n)<F_&&d-t>F_?[Math.abs(h-n)<F_?l:t,n]:null))-1),++s);s&&(_=!1)}if(_){var y,m,x,b=1/0;for(i=0,_=null;i<g;++i)(o=L_[i])&&(x=(y=(u=o.site)[0]-t)*y+(m=u[1]-n)*m)<b&&(b=x,_=o);if(_){var w=[t,n],M=[t,r],T=[e,r],N=[e,n];_.halfedges.push(D_.push(ss(u=_.site,w,M))-1,D_.push(ss(u,M,T))-1,D_.push(ss(u,T,N))-1,D_.push(ss(u,N,w))-1)}}for(i=0;i<g;++i)(o=L_[i])&&(o.halfedges.length||delete L_[i])}(u,a,c,s)}this.edges=D_,this.cells=L_,R_=q_=D_=L_=null}function ks(t){return function(){return t}}function Ss(t,n,e){this.k=t,this.x=n,this.y=e}function Es(t){return t.__zoom||Y_}function As(){t.event.stopImmediatePropagation()}function Cs(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function zs(){return!t.event.button}function Ps(){var t,n,e=this;return e instanceof SVGElement?(t=(e=e.ownerSVGElement||e).width.baseVal.value,n=e.height.baseVal.value):(t=e.clientWidth,n=e.clientHeight),[[0,0],[t,n]]}function Rs(){return this.__zoom||Y_}function Ls(){return-t.event.deltaY*(t.event.deltaMode?120:1)/500}function qs(){return"ontouchstart"in this}function Ds(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],u=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),u>o?(o+u)/2:Math.min(0,o)||Math.max(0,u))}var Us=e(n),Os=Us.right,Fs=Us.left,Is=Array.prototype,Ys=Is.slice,Bs=Is.map,Hs=Math.sqrt(50),js=Math.sqrt(10),Xs=Math.sqrt(2),Vs=Array.prototype.slice,$s=1,Ws=2,Zs=3,Gs=4,Qs=1e-6,Js={value:function(){}};k.prototype=N.prototype={constructor:k,on:function(t,n){var e,r=this._,i=function(t,n){return t.trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}(t+"",r),o=-1,u=i.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<u;)if(e=(t=i[o]).type)r[e]=S(r[e],t.name,n);else if(null==n)for(e in r)r[e]=S(r[e],t.name,null);return this}for(;++o<u;)if((e=(t=i[o]).type)&&(e=function(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}(r[e],t.name)))return e}},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new k(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var Ks="http://www.w3.org/1999/xhtml",tf={svg:"http://www.w3.org/2000/svg",xhtml:Ks,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},nf=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var ef=document.documentElement;if(!ef.matches){var rf=ef.webkitMatchesSelector||ef.msMatchesSelector||ef.mozMatchesSelector||ef.oMatchesSelector;nf=function(t){return function(){return rf.call(this,t)}}}}var of=nf;q.prototype={constructor:q,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var uf="$";H.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var af={};if(t.event=null,"undefined"!=typeof document){"onmouseenter"in document.documentElement||(af={mouseenter:"mouseover",mouseleave:"mouseout"})}var cf=[null];ut.prototype=at.prototype={constructor:ut,select:function(t){"function"!=typeof t&&(t=z(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,a=n[i],c=a.length,s=r[i]=new Array(c),f=0;f<c;++f)(o=a[f])&&(u=t.call(o,o.__data__,f,a))&&("__data__"in o&&(u.__data__=o.__data__),s[f]=u);return new ut(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=R(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var u,a=n[o],c=a.length,s=0;s<c;++s)(u=a[s])&&(r.push(t.call(u,u.__data__,s,a)),i.push(u));return new ut(r,i)},filter:function(t){"function"!=typeof t&&(t=of(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,c=r[i]=[],s=0;s<a;++s)(o=u[s])&&t.call(o,o.__data__,s,u)&&c.push(o);return new ut(r,this._parents)},data:function(t,n){if(!t)return p=new Array(this.size()),s=-1,this.each(function(t){p[++s]=t}),p;var e=n?U:D,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var o=i.length,u=new Array(o),a=new Array(o),c=new Array(o),s=0;s<o;++s){var f=r[s],l=i[s],h=l.length,p=t.call(f,f&&f.__data__,s,r),d=p.length,v=a[s]=new Array(d),g=u[s]=new Array(d);e(f,l,v,g,c[s]=new Array(h),p,n);for(var _,y,m=0,x=0;m<d;++m)if(_=v[m]){for(m>=x&&(x=m+1);!(y=g[x])&&++x<d;);_._next=y||null}}return u=new ut(u,r),u._enter=a,u._exit=c,u},enter:function(){return new ut(this._enter||this._groups.map(L),this._parents)},exit:function(){return new ut(this._exit||this._groups.map(L),this._parents)},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var c,s=n[a],f=e[a],l=s.length,h=u[a]=new Array(l),p=0;p<l;++p)(c=s[p]||f[p])&&(h[p]=c);for(;a<r;++a)u[a]=n[a];return new ut(u,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=O);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var u,a=e[o],c=a.length,s=i[o]=new Array(c),f=0;f<c;++f)(u=a[f])&&(s[f]=u);s.sort(n)}return new ut(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],u=0,a=o.length;u<a;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},attr:function(t,n){var e=E(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}:function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):I(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=Y(t+"");if(arguments.length<2){for(var r=B(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?j:X)(this,t)}}:n?function(t){return function(){j(this,t)}}:function(t){return function(){X(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?V:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?$:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(W)},lower:function(){return this.each(Z)},append:function(t){var n="function"==typeof t?t:A(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:A(t),r=null==n?G:"function"==typeof n?n:z(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Q)},clone:function(t){return this.select(t?K:J)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),u=o.length;if(!(arguments.length<2)){for(a=n?rt:et,null==e&&(e=!1),r=0;r<u;++r)this.each(a(o[r],n,e));return this}var a=this.node().__on;if(a)for(var c,s=0,f=a.length;s<f;++s)for(r=0,c=a[s];r<u;++r)if((i=o[r]).type===c.type&&i.name===c.name)return c.value},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return ot(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return ot(this,t,n)}})(t,n))}};var sf=0;ft.prototype=st.prototype={constructor:ft,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}},xt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var ff="\\s*([+-]?\\d+)\\s*",lf="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",hf="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",pf=/^#([0-9a-f]{3})$/,df=/^#([0-9a-f]{6})$/,vf=new RegExp("^rgb\\("+[ff,ff,ff]+"\\)$"),gf=new RegExp("^rgb\\("+[hf,hf,hf]+"\\)$"),_f=new RegExp("^rgba\\("+[ff,ff,ff,lf]+"\\)$"),yf=new RegExp("^rgba\\("+[hf,hf,hf,lf]+"\\)$"),mf=new RegExp("^hsl\\("+[lf,hf,hf]+"\\)$"),xf=new RegExp("^hsla\\("+[lf,hf,hf,lf]+"\\)$"),bf={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Nt(St,Et,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),Nt(Rt,Pt,kt(St,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Rt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Rt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Nt(Dt,qt,kt(St,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Dt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Dt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Rt(Ut(t>=240?t-240:t+120,i,r),Ut(t,i,r),Ut(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var wf=Math.PI/180,Mf=180/Math.PI,Tf=.95047,Nf=1,kf=1.08883,Sf=4/29,Ef=6/29,Af=3*Ef*Ef,Cf=Ef*Ef*Ef;Nt(It,Ft,kt(St,{brighter:function(t){return new It(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new It(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=Nf*Bt(t),n=Tf*Bt(n),e=kf*Bt(e),new Rt(Ht(3.2404542*n-1.5371385*t-.4985314*e),Ht(-.969266*n+1.8760108*t+.041556*e),Ht(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),Nt(Vt,Xt,kt(St,{brighter:function(t){return new Vt(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Vt(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Ot(this).rgb()}}));var zf=-.29227,Pf=-.90649,Rf=1.97294,Lf=Rf*Pf,qf=1.78277*Rf,Df=1.78277*zf- -.14861*Pf;Nt(Wt,$t,kt(St,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Wt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Wt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*wf,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Rt(255*(n+e*(-.14861*r+1.78277*i)),255*(n+e*(zf*r+Pf*i)),255*(n+e*(Rf*r)),this.opacity)}}));var Uf,Of,Ff,If,Yf,Bf,Hf=function t(n){function e(t,n){var e=r((t=Pt(t)).r,(n=Pt(n)).r),i=r(t.g,n.g),o=r(t.b,n.b),u=en(t.opacity,n.opacity);return function(n){return t.r=e(n),t.g=i(n),t.b=o(n),t.opacity=u(n),t+""}}var r=nn(n);return e.gamma=t,e}(1),jf=rn(Gt),Xf=rn(Qt),Vf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$f=new RegExp(Vf.source,"g"),Wf=180/Math.PI,Zf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Gf=pn(function(t){return"none"===t?Zf:(Uf||(Uf=document.createElement("DIV"),Of=document.documentElement,Ff=document.defaultView),Uf.style.transform=t,t=Ff.getComputedStyle(Of.appendChild(Uf),null).getPropertyValue("transform"),Of.removeChild(Uf),t=t.slice(7,-1).split(","),hn(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),Qf=pn(function(t){return null==t?Zf:(If||(If=document.createElementNS("http://www.w3.org/2000/svg","g")),If.setAttribute("transform",t),(t=If.transform.baseVal.consolidate())?(t=t.matrix,hn(t.a,t.b,t.c,t.d,t.e,t.f)):Zf)},", ",")",")"),Jf=Math.SQRT2,Kf=2,tl=4,nl=1e-12,el=gn(tn),rl=gn(en),il=_n(tn),ol=_n(en),ul=yn(tn),al=yn(en),cl=0,sl=0,fl=0,ll=1e3,hl=0,pl=0,dl=0,vl="object"==typeof performance&&performance.now?performance:Date,gl="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};bn.prototype=wn.prototype={constructor:bn,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?mn():+e)+(null==n?0:+n),this._next||Bf===this||(Bf?Bf._next=this:Yf=this,Bf=this),this._call=t,this._time=e,kn()},stop:function(){this._call&&(this._call=null,this._time=1/0,kn())}};var _l=N("start","end","interrupt"),yl=[],ml=0,xl=1,bl=2,wl=3,Ml=4,Tl=5,Nl=6,kl=at.prototype.constructor,Sl=0,El=at.prototype;qn.prototype=Dn.prototype={constructor:qn,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=z(t));for(var r=this._groups,i=r.length,o=new Array(i),u=0;u<i;++u)for(var a,c,s=r[u],f=s.length,l=o[u]=new Array(f),h=0;h<f;++h)(a=s[h])&&(c=t.call(a,a.__data__,h,s))&&("__data__"in a&&(c.__data__=a.__data__),l[h]=c,En(l[h],n,e,h,l,zn(a,e)));return new qn(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=R(t));for(var r=this._groups,i=r.length,o=[],u=[],a=0;a<i;++a)for(var c,s=r[a],f=s.length,l=0;l<f;++l)if(c=s[l]){for(var h,p=t.call(c,c.__data__,l,s),d=zn(c,e),v=0,g=p.length;v<g;++v)(h=p[v])&&En(h,n,e,v,p,d);o.push(p),u.push(c)}return new qn(o,u,n,e)},filter:function(t){"function"!=typeof t&&(t=of(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,c=r[i]=[],s=0;s<a;++s)(o=u[s])&&t.call(o,o.__data__,s,u)&&c.push(o);return new qn(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var c,s=n[a],f=e[a],l=s.length,h=u[a]=new Array(l),p=0;p<l;++p)(c=s[p]||f[p])&&(h[p]=c);for(;a<r;++a)u[a]=n[a];return new qn(u,this._parents,this._name,this._id)},selection:function(){return new kl(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=Un(),r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],c=a.length,s=0;s<c;++s)if(u=a[s]){var f=zn(u,n);En(u,t,e,s,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new qn(r,this._parents,t,e)},call:El.call,nodes:El.nodes,node:El.node,size:El.size,empty:El.empty,each:El.each,on:function(t,n){var e=this._id;return arguments.length<2?zn(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}(n)?An:Cn;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}(e,t,n))},attr:function(t,n){var e=E(t),r="transform"===e?Qf:Ln;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var u,a=e(this);if(null!=a)return(u=this.getAttributeNS(t.space,t.local))===a?null:u===r&&a===i?o:o=n(r=u,i=a);this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,i,o;return function(){var u,a=e(this);if(null!=a)return(u=this.getAttribute(t))===a?null:u===r&&a===i?o:o=n(r=u,i=a);this.removeAttribute(t)}})(e,r,Rn(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}:function(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}})(e,r,n+""))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=E(t);return this.tween(e,(r.local?function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}:function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e})(r,n))},style:function(t,n,e){var r="transform"==(t+="")?Gf:Ln;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=I(this,t),u=(this.style.removeProperty(t),I(this,t));return o===u?null:o===e&&u===r?i:i=n(e=o,r=u)}}(t,r)).on("end.style."+t,function(t){return function(){this.style.removeProperty(t)}}(t)):this.styleTween(t,"function"==typeof n?function(t,n,e){var r,i,o;return function(){var u=I(this,t),a=e(this);return null==a&&(this.style.removeProperty(t),a=I(this,t)),u===a?null:u===r&&a===i?o:o=n(r=u,i=a)}}(t,r,Rn(this,"style."+t,n)):function(t,n,e){var r,i;return function(){var o=I(this,t);return o===e?null:o===r?i:i=n(r=o,e)}}(t,r,n+""),e)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Rn(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=zn(this.node(),e).tween,o=0,u=i.length;o<u;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?function(t,n){var e,r;return function(){var i=Cn(this,t),o=i.tween;if(o!==e)for(var u=0,a=(r=e=o).length;u<a;++u)if(r[u].name===n){(r=r.slice()).splice(u,1);break}i.tween=r}}:function(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Cn(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},c=0,s=i.length;c<s;++c)if(i[c].name===n){i[c]=a;break}c===s&&i.push(a)}o.tween=i}})(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){An(this,t).delay=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){An(this,t).delay=n}})(n,t)):zn(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){Cn(this,t).duration=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){Cn(this,t).duration=n}})(n,t)):zn(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){Cn(this,t).ease=n}}(n,t)):zn(this.node(),n).ease}};var Al=function t(n){function e(t){return Math.pow(t,n)}return n=+n,e.exponent=t,e}(3),Cl=function t(n){function e(t){return 1-Math.pow(1-t,n)}return n=+n,e.exponent=t,e}(3),zl=function t(n){function e(t){return((t*=2)<=1?Math.pow(t,n):2-Math.pow(2-t,n))/2}return n=+n,e.exponent=t,e}(3),Pl=Math.PI,Rl=Pl/2,Ll=4/11,ql=6/11,Dl=8/11,Ul=.75,Ol=9/11,Fl=10/11,Il=.9375,Yl=21/22,Bl=63/64,Hl=1/Ll/Ll,jl=function t(n){function e(t){return t*t*((n+1)*t-n)}return n=+n,e.overshoot=t,e}(1.70158),Xl=function t(n){function e(t){return--t*t*((n+1)*t+n)+1}return n=+n,e.overshoot=t,e}(1.70158),Vl=function t(n){function e(t){return((t*=2)<1?t*t*((n+1)*t-n):(t-=2)*t*((n+1)*t+n)+2)/2}return n=+n,e.overshoot=t,e}(1.70158),$l=2*Math.PI,Wl=function t(n,e){function r(t){return n*Math.pow(2,10*--t)*Math.sin((i-t)/e)}var i=Math.asin(1/(n=Math.max(1,n)))*(e/=$l);return r.amplitude=function(n){return t(n,e*$l)},r.period=function(e){return t(n,e)},r}(1,.3),Zl=function t(n,e){function r(t){return 1-n*Math.pow(2,-10*(t=+t))*Math.sin((t+i)/e)}var i=Math.asin(1/(n=Math.max(1,n)))*(e/=$l);return r.amplitude=function(n){return t(n,e*$l)},r.period=function(e){return t(n,e)},r}(1,.3),Gl=function t(n,e){function r(t){return((t=2*t-1)<0?n*Math.pow(2,10*t)*Math.sin((i-t)/e):2-n*Math.pow(2,-10*t)*Math.sin((i+t)/e))/2}var i=Math.asin(1/(n=Math.max(1,n)))*(e/=$l);return r.amplitude=function(n){return t(n,e*$l)},r.period=function(e){return t(n,e)},r}(1,.3),Ql={time:null,delay:0,duration:250,ease:Fn};at.prototype.interrupt=function(t){return this.each(function(){Pn(this,t)})},at.prototype.transition=function(t){var n,e;t instanceof qn?(n=t._id,t=t._name):(n=Un(),(e=Ql).time=mn(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],c=a.length,s=0;s<c;++s)(u=a[s])&&En(u,t,n,s,a,e||jn(u,n));return new qn(r,this._parents,t,n)};var Jl=[null],Kl={name:"drag"},th={name:"space"},nh={name:"handle"},eh={name:"center"},rh={name:"x",handles:["e","w"].map(Wn),input:function(t,n){return t&&[[t[0],n[0][1]],[t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},ih={name:"y",handles:["n","s"].map(Wn),input:function(t,n){return t&&[[n[0][0],t[0]],[n[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},oh={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(Wn),input:function(t){return t},output:function(t){return t}},uh={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},ah={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},ch={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},sh={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},fh={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1},lh=Math.cos,hh=Math.sin,ph=Math.PI,dh=ph/2,vh=2*ph,gh=Math.max,_h=Array.prototype.slice,yh=Math.PI,mh=2*yh,xh=mh-1e-6;ne.prototype=ee.prototype={constructor:ne,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,o){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var o=this._x1,u=this._y1,a=e-t,c=r-n,s=o-t,f=u-n,l=s*s+f*f;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(l>1e-6)if(Math.abs(f*a-c*s)>1e-6&&i){var h=e-o,p=r-u,d=a*a+c*c,v=h*h+p*p,g=Math.sqrt(d),_=Math.sqrt(l),y=i*Math.tan((yh-Math.acos((d+l-v)/(2*g*_)))/2),m=y/_,x=y/g;Math.abs(m-1)>1e-6&&(this._+="L"+(t+m*s)+","+(n+m*f)),this._+="A"+i+","+i+",0,0,"+ +(f*h>s*p)+","+(this._x1=t+x*a)+","+(this._y1=n+x*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n;var u=(e=+e)*Math.cos(r),a=e*Math.sin(r),c=t+u,s=n+a,f=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+s:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+c+","+s),e&&(l<0&&(l=l%mh+mh),l>xh?this._+="A"+e+","+e+",0,1,"+f+","+(t-u)+","+(n-a)+"A"+e+","+e+",0,1,"+f+","+(this._x1=c)+","+(this._y1=s):l>1e-6&&(this._+="A"+e+","+e+",0,"+ +(l>=yh)+","+f+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};ce.prototype=se.prototype={constructor:ce,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var bh=se.prototype;de.prototype=ve.prototype={constructor:de,has:bh.has,add:function(t){return t+="",this["$"+t]=t,this},remove:bh.remove,clear:bh.clear,values:bh.keys,size:bh.size,empty:bh.empty,each:bh.each};var wh={},Mh={},Th=34,Nh=10,kh=13,Sh=_e(","),Eh=Sh.parse,Ah=Sh.parseRows,Ch=Sh.format,zh=Sh.formatRows,Ph=_e("\t"),Rh=Ph.parse,Lh=Ph.parseRows,qh=Ph.format,Dh=Ph.formatRows,Uh=Te.prototype=Ne.prototype;Uh.copy=function(){var t,n,e=new Ne(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=ke(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=ke(n));return e},Uh.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return xe(this.cover(n,e),n,e,t)},Uh.addAll=function(t){var n,e,r,i,o=t.length,u=new Array(o),a=new Array(o),c=1/0,s=1/0,f=-1/0,l=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(u[e]=r,a[e]=i,r<c&&(c=r),r>f&&(f=r),i<s&&(s=i),i>l&&(l=i));for(f<c&&(c=this._x0,f=this._x1),l<s&&(s=this._y0,l=this._y1),this.cover(c,s).cover(f,l),e=0;e<o;++e)xe(this,u[e],a[e],t[e]);return this},Uh.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{if(!(e>t||t>i||r>n||n>o))return this;var u,a,c=i-e,s=this._root;switch(a=(n<(r+o)/2)<<1|t<(e+i)/2){case 0:do{u=new Array(4),u[a]=s,s=u}while(c*=2,i=e+c,o=r+c,t>i||n>o);break;case 1:do{u=new Array(4),u[a]=s,s=u}while(c*=2,e=i-c,o=r+c,e>t||n>o);break;case 2:do{u=new Array(4),u[a]=s,s=u}while(c*=2,i=e+c,r=o-c,t>i||r>n);break;case 3:do{u=new Array(4),u[a]=s,s=u}while(c*=2,e=i-c,r=o-c,e>t||r>n)}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},Uh.data=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},Uh.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Uh.find=function(t,n,e){var r,i,o,u,a,c,s,f=this._x0,l=this._y0,h=this._x1,p=this._y1,d=[],v=this._root;for(v&&d.push(new be(v,f,l,h,p)),null==e?e=1/0:(f=t-e,l=n-e,h=t+e,p=n+e,e*=e);c=d.pop();)if(!(!(v=c.node)||(i=c.x0)>h||(o=c.y0)>p||(u=c.x1)<f||(a=c.y1)<l))if(v.length){var g=(i+u)/2,_=(o+a)/2;d.push(new be(v[3],g,_,u,a),new be(v[2],i,_,g,a),new be(v[1],g,o,u,_),new be(v[0],i,o,g,_)),(s=(n>=_)<<1|t>=g)&&(c=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=c)}else{var y=t-+this._x.call(null,v.data),m=n-+this._y.call(null,v.data),x=y*y+m*m;if(x<e){var b=Math.sqrt(e=x);f=t-b,l=n-b,h=t+b,p=n+b,r=v.data}}return r},Uh.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(u=+this._y.call(null,t)))return this;var n,e,r,i,o,u,a,c,s,f,l,h,p=this._root,d=this._x0,v=this._y0,g=this._x1,_=this._y1;if(!p)return this;if(p.length)for(;;){if((s=o>=(a=(d+g)/2))?d=a:g=a,(f=u>=(c=(v+_)/2))?v=c:_=c,n=p,!(p=p[l=f<<1|s]))return this;if(!p.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;p.data!==t;)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(e?e[h]=p:this._root=p),this):(this._root=i,this)},Uh.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},Uh.root=function(){return this._root},Uh.size=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},Uh.visit=function(t){var n,e,r,i,o,u,a=[],c=this._root;for(c&&a.push(new be(c,this._x0,this._y0,this._x1,this._y1));n=a.pop();)if(!t(c=n.node,r=n.x0,i=n.y0,o=n.x1,u=n.y1)&&c.length){var s=(r+o)/2,f=(i+u)/2;(e=c[3])&&a.push(new be(e,s,f,o,u)),(e=c[2])&&a.push(new be(e,r,f,s,u)),(e=c[1])&&a.push(new be(e,s,i,o,f)),(e=c[0])&&a.push(new be(e,r,i,s,f))}return this},Uh.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new be(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,u=n.x0,a=n.y0,c=n.x1,s=n.y1,f=(u+c)/2,l=(a+s)/2;(o=i[0])&&e.push(new be(o,u,a,f,l)),(o=i[1])&&e.push(new be(o,f,a,c,l)),(o=i[2])&&e.push(new be(o,u,l,f,s)),(o=i[3])&&e.push(new be(o,f,l,c,s))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},Uh.x=function(t){return arguments.length?(this._x=t,this):this._x},Uh.y=function(t){return arguments.length?(this._y=t,this):this._y};var Oh,Fh=10,Ih=Math.PI*(3-Math.sqrt(5)),Yh={"":function(t,n){t:for(var e,r=(t=t.toPrecision(n)).length,i=1,o=-1;i<r;++i)switch(t[i]){case".":o=e=i;break;case"0":0===o&&(o=i),e=i;break;case"e":break t;default:o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t},"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return qe(100*t,n)},r:qe,s:function(t,n){var e=Re(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Oh=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return o===u?r:o>u?r+new Array(o-u+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Re(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Bh=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;De.prototype=Ue.prototype,Ue.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var Hh,jh=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];Ie({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),Xe.prototype={constructor:Xe,reset:function(){this.s=this.t=0},add:function(t){Ve(wp,t,this.t),Ve(this,wp.s,this.s),this.s?this.t+=wp.t:this.s=wp.t},valueOf:function(){return this.s}};var Xh,Vh,$h,Wh,Zh,Gh,Qh,Jh,Kh,tp,np,ep,rp,ip,op,up,ap,cp,sp,fp,lp,hp,pp,dp,vp,gp,_p,yp,mp,xp,bp,wp=new Xe,Mp=1e-6,Tp=1e-12,Np=Math.PI,kp=Np/2,Sp=Np/4,Ep=2*Np,Ap=180/Np,Cp=Np/180,zp=Math.abs,Pp=Math.atan,Rp=Math.atan2,Lp=Math.cos,qp=Math.ceil,Dp=Math.exp,Up=Math.log,Op=Math.pow,Fp=Math.sin,Ip=Math.sign||function(t){return t>0?1:t<0?-1:0},Yp=Math.sqrt,Bp=Math.tan,Hp={Feature:function(t,n){Qe(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)Qe(e[r].geometry,n)}},jp={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){Je(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Je(e[r],n,0)},Polygon:function(t,n){Ke(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Ke(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)Qe(e[r],n)}},Xp=je(),Vp=je(),$p={point:Ge,lineStart:Ge,lineEnd:Ge,polygonStart:function(){Xp.reset(),$p.lineStart=nr,$p.lineEnd=er},polygonEnd:function(){var t=+Xp;Vp.add(t<0?Ep+t:t),this.lineStart=this.lineEnd=this.point=Ge},sphere:function(){Vp.add(Ep)}},Wp=je(),Zp={point:hr,lineStart:dr,lineEnd:vr,polygonStart:function(){Zp.point=gr,Zp.lineStart=_r,Zp.lineEnd=yr,Wp.reset(),$p.polygonStart()},polygonEnd:function(){$p.polygonEnd(),Zp.point=hr,Zp.lineStart=dr,Zp.lineEnd=vr,Xp<0?(Gh=-(Jh=180),Qh=-(Kh=90)):Wp>Mp?Kh=90:Wp<-Mp&&(Qh=-90),op[0]=Gh,op[1]=Jh}},Gp={sphere:Ge,point:wr,lineStart:Tr,lineEnd:Sr,polygonStart:function(){Gp.lineStart=Er,Gp.lineEnd=Ar},polygonEnd:function(){Gp.lineStart=Tr,Gp.lineEnd=Sr}};Lr.invert=Lr;var Qp,Jp,Kp,td,nd,ed,rd,id,od,ud,ad,cd=je(),sd=Wr(function(){return!0},function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,u){var a=o>0?Np:-Np,c=zp(o-e);zp(c-Np)<Mp?(t.point(e,r=(r+u)/2>0?kp:-kp),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),n=0):i!==a&&c>=Np&&(zp(e-i)<Mp&&(e-=i*Mp),zp(o-a)<Mp&&(o-=a*Mp),r=function(t,n,e,r){var i,o,u=Fp(t-e);return zp(u)>Mp?Pp((Fp(n)*(o=Lp(r))*Fp(e)-Fp(r)*(i=Lp(n))*Fp(t))/(i*o*u)):(n+r)/2}(e,r,o,u),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),n=0),t.point(e=o,r=u),i=a},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}},function(t,n,e,r){var i;if(null==t)i=e*kp,r.point(-Np,i),r.point(0,i),r.point(Np,i),r.point(Np,0),r.point(Np,-i),r.point(0,-i),r.point(-Np,-i),r.point(-Np,0),r.point(-Np,i);else if(zp(t[0]-n[0])>Mp){var o=t[0]<n[0]?Np:-Np;i=e*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])},[-Np,-kp]),fd=1e9,ld=-fd,hd=je(),pd={sphere:Ge,point:Ge,lineStart:function(){pd.point=ti,pd.lineEnd=Kr},lineEnd:Ge,polygonStart:Ge,polygonEnd:Ge},dd=[null,null],vd={type:"LineString",coordinates:dd},gd={Feature:function(t,n){return ii(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)if(ii(e[r].geometry,n))return!0;return!1}},_d={Sphere:function(){return!0},Point:function(t,n){return oi(t.coordinates,n)},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(oi(e[r],n))return!0;return!1},LineString:function(t,n){return ui(t.coordinates,n)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(ui(e[r],n))return!0;return!1},Polygon:function(t,n){return ai(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(ai(e[r],n))return!0;return!1},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)if(ii(e[r],n))return!0;return!1}},yd=je(),md=je(),xd={point:Ge,lineStart:Ge,lineEnd:Ge,polygonStart:function(){xd.lineStart=di,xd.lineEnd=_i},polygonEnd:function(){xd.lineStart=xd.lineEnd=xd.point=Ge,yd.add(zp(md)),md.reset()},result:function(){var t=yd/2;return yd.reset(),t}},bd=1/0,wd=bd,Md=-bd,Td=Md,Nd={point:function(t,n){t<bd&&(bd=t),t>Md&&(Md=t),n<wd&&(wd=n),n>Td&&(Td=n)},lineStart:Ge,lineEnd:Ge,polygonStart:Ge,polygonEnd:Ge,result:function(){var t=[[bd,wd],[Md,Td]];return Md=Td=-(wd=bd=1/0),t}},kd=0,Sd=0,Ed=0,Ad=0,Cd=0,zd=0,Pd=0,Rd=0,Ld=0,qd={point:yi,lineStart:mi,lineEnd:wi,polygonStart:function(){qd.lineStart=Mi,qd.lineEnd=Ti},polygonEnd:function(){qd.point=yi,qd.lineStart=mi,qd.lineEnd=wi},result:function(){var t=Ld?[Pd/Ld,Rd/Ld]:zd?[Ad/zd,Cd/zd]:Ed?[kd/Ed,Sd/Ed]:[NaN,NaN];return kd=Sd=Ed=Ad=Cd=zd=Pd=Rd=Ld=0,t}};Si.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,Ep)}},result:Ge};var Dd,Ud,Od,Fd,Id,Yd=je(),Bd={point:Ge,lineStart:function(){Bd.point=Ei},lineEnd:function(){Dd&&Ai(Ud,Od),Bd.point=Ge},polygonStart:function(){Dd=!0},polygonEnd:function(){Dd=null},result:function(){var t=+Yd;return Yd.reset(),t}};Ci.prototype={_radius:4.5,_circle:zi(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=zi(this._radius)),this._string.push("M",t,",",n,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Ri.prototype={constructor:Ri,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Hd=16,jd=Lp(30*Cp),Xd=Pi({point:function(t,n){this.stream.point(t*Cp,n*Cp)}}),Vd=Vi(function(t){return Yp(2/(1+t))});Vd.invert=$i(function(t){return 2*We(t/2)});var $d=Vi(function(t){return(t=$e(t))&&t/Fp(t)});$d.invert=$i(function(t){return t}),Wi.invert=function(t,n){return[t,2*Pp(Dp(n))-kp]},Ji.invert=Ji,to.invert=$i(Pp),eo.invert=function(t,n){var e,r=n,i=25;do{var o=r*r,u=o*o;r-=e=(r*(1.007226+o*(.015085+u*(.028874*o-.044475-.005916*u)))-n)/(1.007226+o*(.045255+u*(.259866*o-.311325-.005916*11*u)))}while(zp(e)>Mp&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},ro.invert=$i(We),io.invert=$i(function(t){return 2*Pp(t)}),oo.invert=function(t,n){return[-n,2*Pp(Dp(t))-kp]},vo.prototype=fo.prototype={constructor:vo,count:function(){return this.eachAfter(so)},each:function(t){var n,e,r,i,o=this,u=[o];do{for(n=u.reverse(),u=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;r<i;++r)u.push(e[r])}while(u.length);return this},eachAfter:function(t){for(var n,e,r,i=this,o=[i],u=[];i=o.pop();)if(u.push(i),n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e]);for(;i=u.pop();)t(i);return this},eachBefore:function(t){for(var n,e,r=this,i=[r];r=i.pop();)if(t(r),n=r.children)for(e=n.length-1;e>=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each(function(n){t.push(n)}),t},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return fo(this).eachBefore(ho)}};var Wd=Array.prototype.slice,Zd="$",Gd={depth:-1},Qd={};Ho.prototype=Object.create(vo.prototype);var Jd=(1+Math.sqrt(5))/2,Kd=function t(n){function e(t,e,r,i,o){Xo(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(Jd),tv=function t(n){function e(t,e,r,i,o){if((u=t._squarify)&&u.ratio===n)for(var u,a,c,s,f,l=-1,h=u.length,p=t.value;++l<h;){for(c=(a=u[l]).children,s=a.value=0,f=c.length;s<f;++s)a.value+=c[s].value;a.dice?qo(a,e,r,i,r+=(o-r)*a.value/p):jo(a,e,r,e+=(i-e)*a.value/p,o),p-=a.value}else t._squarify=u=Xo(n,t,e,r,i,o),u.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(Jd),nv=[].slice,ev={};Zo.prototype=Ko.prototype={constructor:Zo,defer:function(t){if("function"!=typeof t)throw new Error("invalid callback");if(this._call)throw new Error("defer after await");if(null!=this._error)return this;var n=nv.call(arguments,1);return n.push(t),++this._waiting,this._tasks.push(n),Go(this),this},abort:function(){return null==this._error&&Qo(this,new Error("abort")),this},await:function(t){if("function"!=typeof t)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=function(n,e){t.apply(null,[n].concat(e))},Jo(this),this},awaitAll:function(t){if("function"!=typeof t)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=t,Jo(this),this}};var rv=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,1===arguments.length?(e=t,t=0):e-=t,function(){return n()*e+t}}return e.source=t,e}(tu),iv=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(tu),ov=function t(n){function e(){var t=iv.source(n).apply(this,arguments);return function(){return Math.exp(t())}}return e.source=t,e}(tu),uv=function t(n){function e(t){return function(){for(var e=0,r=0;r<t;++r)e+=n();return e}}return e.source=t,e}(tu),av=function t(n){function e(t){var e=uv.source(n)(t);return function(){return e()/t}}return e.source=t,e}(tu),cv=function t(n){function e(t){return function(){return-Math.log(1-n())/t}}return e.source=t,e}(tu),sv=eu("text/html",function(t){return document.createRange().createContextualFragment(t.responseText)}),fv=eu("application/json",function(t){return JSON.parse(t.responseText)}),lv=eu("text/plain",function(t){return t.responseText}),hv=eu("application/xml",function(t){var n=t.responseXML;if(!n)throw new Error("parse error");return n}),pv=ru("text/csv",Eh),dv=ru("text/tab-separated-values",Rh),vv=Array.prototype,gv=vv.map,_v=vv.slice,yv={name:"implicit"},mv=[0,1],xv=new Date,bv=new Date,wv=Cu(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});wv.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Cu(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):wv:null};var Mv=wv.range,Tv=6e4,Nv=6048e5,kv=Cu(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),Sv=kv.range,Ev=Cu(function(t){t.setTime(Math.floor(t/Tv)*Tv)},function(t,n){t.setTime(+t+n*Tv)},function(t,n){return(n-t)/Tv},function(t){return t.getMinutes()}),Av=Ev.range,Cv=Cu(function(t){var n=t.getTimezoneOffset()*Tv%36e5;n<0&&(n+=36e5),t.setTime(36e5*Math.floor((+t-n)/36e5)+n)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()}),zv=Cv.range,Pv=Cu(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Tv)/864e5},function(t){return t.getDate()-1}),Rv=Pv.range,Lv=zu(0),qv=zu(1),Dv=zu(2),Uv=zu(3),Ov=zu(4),Fv=zu(5),Iv=zu(6),Yv=Lv.range,Bv=qv.range,Hv=Dv.range,jv=Uv.range,Xv=Ov.range,Vv=Fv.range,$v=Iv.range,Wv=Cu(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),Zv=Wv.range,Gv=Cu(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});Gv.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Cu(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};var Qv=Gv.range,Jv=Cu(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*Tv)},function(t,n){return(n-t)/Tv},function(t){return t.getUTCMinutes()}),Kv=Jv.range,tg=Cu(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()}),ng=tg.range,eg=Cu(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1}),rg=eg.range,ig=Pu(0),og=Pu(1),ug=Pu(2),ag=Pu(3),cg=Pu(4),sg=Pu(5),fg=Pu(6),lg=ig.range,hg=og.range,pg=ug.range,dg=ag.range,vg=cg.range,gg=sg.range,_g=fg.range,yg=Cu(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),mg=yg.range,xg=Cu(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});xg.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Cu(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};var bg,wg=xg.range,Mg={"-":"",_:" ",0:"0"},Tg=/^\s*\d+/,Ng=/^%/,kg=/[\\^$*+?|[\]().{}]/g;Ha({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Sg="%Y-%m-%dT%H:%M:%S.%LZ",Eg=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat(Sg),Ag=+new Date("2000-01-01T00:00:00.000Z")?function(t){var n=new Date(t);return isNaN(n)?null:n}:t.utcParse(Sg),Cg=1e3,zg=60*Cg,Pg=60*zg,Rg=24*Pg,Lg=7*Rg,qg=30*Rg,Dg=365*Rg,Ug=$a("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Og=$a("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),Fg=$a("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),Ig=$a("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),Yg=al($t(300,.5,0),$t(-240,.5,1)),Bg=al($t(-100,.75,.35),$t(80,1.5,.8)),Hg=al($t(260,.75,.35),$t(80,1.5,.8)),jg=$t(),Xg=Wa($a("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Vg=Wa($a("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),$g=Wa($a("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Wg=Wa($a("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),Zg=Math.abs,Gg=Math.atan2,Qg=Math.cos,Jg=Math.max,Kg=Math.min,t_=Math.sin,n_=Math.sqrt,e_=1e-12,r_=Math.PI,i_=r_/2,o_=2*r_;ic.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var u_=pc(oc);hc.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var a_=Array.prototype.slice,c_={draw:function(t,n){var e=Math.sqrt(n/r_);t.moveTo(e,0),t.arc(0,0,e,0,o_)}},s_={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},f_=Math.sqrt(1/3),l_=2*f_,h_={draw:function(t,n){var e=Math.sqrt(n/l_),r=e*f_;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},p_=Math.sin(r_/10)/Math.sin(7*r_/10),d_=Math.sin(o_/10)*p_,v_=-Math.cos(o_/10)*p_,g_={draw:function(t,n){var e=Math.sqrt(.8908130915292852*n),r=d_*e,i=v_*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var u=o_*o/5,a=Math.cos(u),c=Math.sin(u);t.lineTo(c*e,-a*e),t.lineTo(a*r-c*i,c*r+a*i)}t.closePath()}},__={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},y_=Math.sqrt(3),m_={draw:function(t,n){var e=-Math.sqrt(n/(3*y_));t.moveTo(0,2*e),t.lineTo(-y_*e,-e),t.lineTo(y_*e,-e),t.closePath()}},x_=Math.sqrt(3)/2,b_=1/Math.sqrt(12),w_=3*(b_/2+1),M_={draw:function(t,n){var e=Math.sqrt(n/w_),r=e/2,i=e*b_,o=r,u=e*b_+e,a=-o,c=u;t.moveTo(r,i),t.lineTo(o,u),t.lineTo(a,c),t.lineTo(-.5*r-x_*i,x_*r+-.5*i),t.lineTo(-.5*o-x_*u,x_*o+-.5*u),t.lineTo(-.5*a-x_*c,x_*a+-.5*c),t.lineTo(-.5*r+x_*i,-.5*i-x_*r),t.lineTo(-.5*o+x_*u,-.5*u-x_*o),t.lineTo(-.5*a+x_*c,-.5*c-x_*a),t.closePath()}},T_=[c_,s_,h_,__,g_,m_,M_];kc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Nc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Nc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Sc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Nc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Ec.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Nc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Ac.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],u=t[e]-i,a=n[e]-o,c=-1;++c<=e;)r=c/e,this._basis.point(this._beta*t[c]+(1-this._beta)*(i+r*u),this._beta*n[c]+(1-this._beta)*(o+r*a));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var N_=function t(n){function e(t){return 1===n?new kc(t):new Ac(t,n)}return e.beta=function(n){return t(+n)},e}(.85);zc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Cc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Cc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var k_=function t(n){function e(t){return new zc(t,n)}return e.tension=function(n){return t(+n)},e}(0);Pc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Cc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var S_=function t(n){function e(t){return new Pc(t,n)}return e.tension=function(n){return t(+n)},e}(0);Rc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Cc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var E_=function t(n){function e(t){return new Rc(t,n)}return e.tension=function(n){return t(+n)},e}(0);qc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Lc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var A_=function t(n){function e(t){return n?new qc(t,n):new zc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);Dc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Lc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var C_=function t(n){function e(t){return n?new Dc(t,n):new Pc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);Uc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Lc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var z_=function t(n){function e(t){return n?new Uc(t,n):new Rc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);Oc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},Hc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Bc(this,this._t0,Yc(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(t=+t,n=+n,t!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,Bc(this,Yc(this,e=Ic(this,t,n)),e);break;default:Bc(this,this._t0,e=Ic(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(jc.prototype=Object.create(Hc.prototype)).point=function(t,n){Hc.prototype.point.call(this,n,t)},Xc.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},Vc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=$c(t),i=$c(n),o=0,u=1;u<e;++o,++u)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[u],n[u]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},Wc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}},rs.prototype={constructor:rs,insert:function(t,n){var e,r,i;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=as(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(i=r.R)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.R&&(os(this,e),e=(t=e).U),e.C=!1,r.C=!0,us(this,r)):(i=r.L)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.L&&(us(this,e),e=(t=e).U),e.C=!1,r.C=!0,os(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,i=t.U,o=t.L,u=t.R;if(e=o?u?as(u):o:u,i?i.L===t?i.L=e:i.R=e:this._=e,o&&u?(r=e.C,e.C=t.C,e.L=o,o.U=e,e!==u?(i=e.U,e.U=t.U,t=e.R,i.L=t,e.R=u,u.U=e):(e.U=i,i=e,t=e.R)):(r=t.C,t=e),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((n=i.R).C&&(n.C=!1,i.C=!0,os(this,i),n=i.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,us(this,n),n=i.R),n.C=i.C,i.C=n.R.C=!1,os(this,i),t=this._;break}}else if((n=i.L).C&&(n.C=!1,i.C=!0,us(this,i),n=i.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,os(this,n),n=i.L),n.C=i.C,i.C=n.L.C=!1,us(this,i),t=this._;break}n.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var P_,R_,L_,q_,D_,U_=[],O_=[],F_=1e-6,I_=1e-12;Ns.prototype={constructor:Ns,polygons:function(){var t=this.edges;return this.cells.map(function(n){var e=n.halfedges.map(function(e){return ds(n,t[e])});return e.data=n.site.data,e})},triangles:function(){var t=[],n=this.edges;return this.cells.forEach(function(e,r){if(o=(i=e.halfedges).length)for(var i,o,u,a=e.site,c=-1,s=n[i[o-1]],f=s.left===a?s.right:s.left;++c<o;)u=f,f=(s=n[i[c]]).left===a?s.right:s.left,u&&f&&r<u.index&&r<f.index&&Ms(a,u,f)<0&&t.push([a.data,u.data,f.data])}),t},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(t,n,e){for(var r,i,o=this,u=o._found||0,a=o.cells.length;!(i=o.cells[u]);)if(++u>=a)return null;var c=t-i.site[0],s=n-i.site[1],f=c*c+s*s;do{i=o.cells[r=u],u=null,i.halfedges.forEach(function(e){var r=o.edges[e],a=r.left;if(a!==i.site&&a||(a=r.right)){var c=t-a[0],s=n-a[1],l=c*c+s*s;l<f&&(f=l,u=a.index)}})}while(null!==u);return o._found=r,null==e||f<=e*e?i.site:null}},Ss.prototype={constructor:Ss,scale:function(t){return 1===t?this:new Ss(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Ss(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Y_=new Ss(1,0,0);Es.prototype=Ss.prototype,t.version="4.13.0",t.bisect=Os,t.bisectRight=Os,t.bisectLeft=Fs,t.ascending=n,t.bisector=e,t.cross=function(t,n,e){var i,o,u,a,c=t.length,s=n.length,f=new Array(c*s);for(null==e&&(e=r),i=u=0;i<c;++i)for(a=t[i],o=0;o<s;++o,++u)f[u]=e(a,n[o]);return f},t.descending=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},t.deviation=u,t.extent=a,t.histogram=function(){function t(t){var i,o,u=t.length,a=new Array(u);for(i=0;i<u;++i)a[i]=n(t[i],i,t);var c=e(a),s=c[0],l=c[1],h=r(a,s,l);Array.isArray(h)||(h=p(s,l,h),h=f(Math.ceil(s/h)*h,Math.floor(l/h)*h,h));for(var d=h.length;h[0]<=s;)h.shift(),--d;for(;h[d-1]>l;)h.pop(),--d;var v,g=new Array(d+1);for(i=0;i<=d;++i)(v=g[i]=[]).x0=i>0?h[i-1]:s,v.x1=i<d?h[i]:l;for(i=0;i<u;++i)s<=(o=a[i])&&o<=l&&g[Os(h,o,0,d)].push(t[i]);return g}var n=s,e=a,r=d;return t.value=function(e){return arguments.length?(n="function"==typeof e?e:c(e),t):n},t.domain=function(n){return arguments.length?(e="function"==typeof n?n:c([n[0],n[1]]),t):e},t.thresholds=function(n){return arguments.length?(r="function"==typeof n?n:Array.isArray(n)?c(Ys.call(n)):c(n),t):r},t},t.thresholdFreedmanDiaconis=function(t,e,r){return t=Bs.call(t,i).sort(n),Math.ceil((r-e)/(2*(v(t,.75)-v(t,.25))*Math.pow(t.length,-1/3)))},t.thresholdScott=function(t,n,e){return Math.ceil((e-n)/(3.5*u(t)*Math.pow(t.length,-1/3)))},t.thresholdSturges=d,t.max=function(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&e>r&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&e>r&&(r=e);return r},t.mean=function(t,n){var e,r=t.length,o=r,u=-1,a=0;if(null==n)for(;++u<r;)isNaN(e=i(t[u]))?--o:a+=e;else for(;++u<r;)isNaN(e=i(n(t[u],u,t)))?--o:a+=e;if(o)return a/o},t.median=function(t,e){var r,o=t.length,u=-1,a=[];if(null==e)for(;++u<o;)isNaN(r=i(t[u]))||a.push(r);else for(;++u<o;)isNaN(r=i(e(t[u],u,t)))||a.push(r);return v(a.sort(n),.5)},t.merge=g,t.min=_,t.pairs=function(t,n){null==n&&(n=r);for(var e=0,i=t.length-1,o=t[0],u=new Array(i<0?0:i);e<i;)u[e]=n(o,o=t[++e]);return u},t.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},t.quantile=v,t.range=f,t.scan=function(t,e){if(r=t.length){var r,i,o=0,u=0,a=t[u];for(null==e&&(e=n);++o<r;)(e(i=t[o],a)<0||0!==e(a,a))&&(a=i,u=o);return 0===e(a,a)?u:void 0}},t.shuffle=function(t,n,e){for(var r,i,o=(null==e?t.length:e)-(n=null==n?0:+n);o;)i=Math.random()*o--|0,r=t[o+n],t[o+n]=t[i+n],t[i+n]=r;return t},t.sum=function(t,n){var e,r=t.length,i=-1,o=0;if(null==n)for(;++i<r;)(e=+t[i])&&(o+=e);else for(;++i<r;)(e=+n(t[i],i,t))&&(o+=e);return o},t.ticks=l,t.tickIncrement=h,t.tickStep=p,t.transpose=y,t.variance=o,t.zip=function(){return y(arguments)},t.axisTop=function(t){return T($s,t)},t.axisRight=function(t){return T(Ws,t)},t.axisBottom=function(t){return T(Zs,t)},t.axisLeft=function(t){return T(Gs,t)},t.brush=function(){return Kn(oh)},t.brushX=function(){return Kn(rh)},t.brushY=function(){return Kn(ih)},t.brushSelection=function(t){var n=t.__brush;return n?n.dim.output(n.selection):null},t.chord=function(){function t(t){var o,u,a,c,s,l,h=t.length,p=[],d=f(h),v=[],g=[],_=g.groups=new Array(h),y=new Array(h*h);for(o=0,s=-1;++s<h;){for(u=0,l=-1;++l<h;)u+=t[s][l];p.push(u),v.push(f(h)),o+=u}for(e&&d.sort(function(t,n){return e(p[t],p[n])}),r&&v.forEach(function(n,e){n.sort(function(n,i){return r(t[e][n],t[e][i])})}),c=(o=gh(0,vh-n*h)/o)?n:vh/h,u=0,s=-1;++s<h;){for(a=u,l=-1;++l<h;){var m=d[s],x=v[m][l],b=t[m][x],w=u,M=u+=b*o;y[x*h+m]={index:m,subindex:x,startAngle:w,endAngle:M,value:b}}_[m]={index:m,startAngle:a,endAngle:u,value:p[m]},u+=c}for(s=-1;++s<h;)for(l=s-1;++l<h;){var T=y[l*h+s],N=y[s*h+l];(T.value||N.value)&&g.push(T.value<N.value?{source:N,target:T}:{source:T,target:N})}return i?g.sort(i):g}var n=0,e=null,r=null,i=null;return t.padAngle=function(e){return arguments.length?(n=gh(0,e),t):n},t.sortGroups=function(n){return arguments.length?(e=n,t):e},t.sortSubgroups=function(n){return arguments.length?(r=n,t):r},t.sortChords=function(n){return arguments.length?(null==n?i=null:(i=function(t){return function(n,e){return t(n.source.value+n.target.value,e.source.value+e.target.value)}}(n))._=n,t):i&&i._},t},t.ribbon=function(){function t(){var t,a=_h.call(arguments),c=n.apply(this,a),s=e.apply(this,a),f=+r.apply(this,(a[0]=c,a)),l=i.apply(this,a)-dh,h=o.apply(this,a)-dh,p=f*lh(l),d=f*hh(l),v=+r.apply(this,(a[0]=s,a)),g=i.apply(this,a)-dh,_=o.apply(this,a)-dh;if(u||(u=t=ee()),u.moveTo(p,d),u.arc(0,0,f,l,h),l===g&&h===_||(u.quadraticCurveTo(0,0,v*lh(g),v*hh(g)),u.arc(0,0,v,g,_)),u.quadraticCurveTo(0,0,p,d),u.closePath(),t)return u=null,t+""||null}var n=re,e=ie,r=oe,i=ue,o=ae,u=null;return t.radius=function(n){return arguments.length?(r="function"==typeof n?n:te(+n),t):r},t.startAngle=function(n){return arguments.length?(i="function"==typeof n?n:te(+n),t):i},t.endAngle=function(n){return arguments.length?(o="function"==typeof n?n:te(+n),t):o},t.source=function(e){return arguments.length?(n=e,t):n},t.target=function(n){return arguments.length?(e=n,t):e},t.context=function(n){return arguments.length?(u=null==n?null:n,t):u},t},t.nest=function(){function t(n,i,u,a){if(i>=o.length)return null!=e&&n.sort(e),null!=r?r(n):n;for(var c,s,f,l=-1,h=n.length,p=o[i++],d=se(),v=u();++l<h;)(f=d.get(c=p(s=n[l])+""))?f.push(s):d.set(c,[s]);return d.each(function(n,e){a(v,e,t(n,i,u,a))}),v}function n(t,e){if(++e>o.length)return t;var i,a=u[e-1];return null!=r&&e>=o.length?i=t.entries():(i=[],t.each(function(t,r){i.push({key:r,values:n(t,e)})})),null!=a?i.sort(function(t,n){return a(t.key,n.key)}):i}var e,r,i,o=[],u=[];return i={object:function(n){return t(n,0,fe,le)},map:function(n){return t(n,0,he,pe)},entries:function(e){return n(t(e,0,he,pe),0)},key:function(t){return o.push(t),i},sortKeys:function(t){return u[o.length-1]=t,i},sortValues:function(t){return e=t,i},rollup:function(t){return r=t,i}}},t.set=ve,t.map=se,t.keys=function(t){var n=[];for(var e in t)n.push(e);return n},t.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},t.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},t.color=Et,t.rgb=Pt,t.hsl=qt,t.lab=Ft,t.hcl=Xt,t.cubehelix=$t,t.dispatch=N,t.drag=function(){function n(t){t.on("mousedown.drag",e).filter(g).on("touchstart.drag",o).on("touchmove.drag",u).on("touchend.drag touchcancel.drag",a).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function e(){if(!h&&p.apply(this,arguments)){var n=c("mouse",d.apply(this,arguments),pt,this,arguments);n&&(ct(t.event.view).on("mousemove.drag",r,!0).on("mouseup.drag",i,!0),_t(t.event.view),vt(),l=!1,s=t.event.clientX,f=t.event.clientY,n("start"))}}function r(){if(gt(),!l){var n=t.event.clientX-s,e=t.event.clientY-f;l=n*n+e*e>x}_.mouse("drag")}function i(){ct(t.event.view).on("mousemove.drag mouseup.drag",null),yt(t.event.view,l),gt(),_.mouse("end")}function o(){if(p.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=d.apply(this,arguments),o=r.length;for(n=0;n<o;++n)(e=c(r[n].identifier,i,dt,this,arguments))&&(vt(),e("start"))}}function u(){var n,e,r=t.event.changedTouches,i=r.length;for(n=0;n<i;++n)(e=_[r[n].identifier])&&(gt(),e("drag"))}function a(){var n,e,r=t.event.changedTouches,i=r.length;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),n=0;n<i;++n)(e=_[r[n].identifier])&&(vt(),e("end"))}function c(e,r,i,o,u){var a,c,s,f=i(r,e),l=y.copy();if(it(new xt(n,"beforestart",a,e,m,f[0],f[1],0,0,l),function(){return null!=(t.event.subject=a=v.apply(o,u))&&(c=a.x-f[0]||0,s=a.y-f[1]||0,!0)}))return function t(h){var p,d=f;switch(h){case"start":_[e]=t,p=m++;break;case"end":delete _[e],--m;case"drag":f=i(r,e),p=m}it(new xt(n,h,a,e,p,f[0]+c,f[1]+s,f[0]-d[0],f[1]-d[1],l),l.apply,l,[h,o,u])}}var s,f,l,h,p=bt,d=wt,v=Mt,g=Tt,_={},y=N("start","drag","end"),m=0,x=0;return n.filter=function(t){return arguments.length?(p="function"==typeof t?t:mt(!!t),n):p},n.container=function(t){return arguments.length?(d="function"==typeof t?t:mt(t),n):d},n.subject=function(t){return arguments.length?(v="function"==typeof t?t:mt(t),n):v},n.touchable=function(t){return arguments.length?(g="function"==typeof t?t:mt(!!t),n):g},n.on=function(){var t=y.on.apply(y,arguments);return t===y?n:t},n.clickDistance=function(t){return arguments.length?(x=(t=+t)*t,n):Math.sqrt(x)},n},t.dragDisable=_t,t.dragEnable=yt,t.dsvFormat=_e,t.csvParse=Eh,t.csvParseRows=Ah,t.csvFormat=Ch,t.csvFormatRows=zh,t.tsvParse=Rh,t.tsvParseRows=Lh,t.tsvFormat=qh,t.tsvFormatRows=Dh,t.easeLinear=function(t){return+t},t.easeQuad=On,t.easeQuadIn=function(t){return t*t},t.easeQuadOut=function(t){return t*(2-t)},t.easeQuadInOut=On,t.easeCubic=Fn,t.easeCubicIn=function(t){return t*t*t},t.easeCubicOut=function(t){return--t*t*t+1},t.easeCubicInOut=Fn,t.easePoly=zl,t.easePolyIn=Al,t.easePolyOut=Cl,t.easePolyInOut=zl,t.easeSin=In,t.easeSinIn=function(t){return 1-Math.cos(t*Rl)},t.easeSinOut=function(t){return Math.sin(t*Rl)},t.easeSinInOut=In,t.easeExp=Yn,t.easeExpIn=function(t){return Math.pow(2,10*t-10)},t.easeExpOut=function(t){return 1-Math.pow(2,-10*t)},t.easeExpInOut=Yn,t.easeCircle=Bn,t.easeCircleIn=function(t){return 1-Math.sqrt(1-t*t)},t.easeCircleOut=function(t){return Math.sqrt(1- --t*t)},t.easeCircleInOut=Bn,t.easeBounce=Hn,t.easeBounceIn=function(t){return 1-Hn(1-t)},t.easeBounceOut=Hn,t.easeBounceInOut=function(t){return((t*=2)<=1?1-Hn(1-t):Hn(t-1)+1)/2},t.easeBack=Vl,t.easeBackIn=jl,t.easeBackOut=Xl,t.easeBackInOut=Vl,t.easeElastic=Zl,t.easeElasticIn=Wl,t.easeElasticOut=Zl,t.easeElasticInOut=Gl,t.forceCenter=function(t,n){function e(){var e,i,o=r.length,u=0,a=0;for(e=0;e<o;++e)u+=(i=r[e]).x,a+=i.y;for(u=u/o-t,a=a/o-n,e=0;e<o;++e)(i=r[e]).x-=u,i.y-=a}var r;return null==t&&(t=0),null==n&&(n=0),e.initialize=function(t){r=t},e.x=function(n){return arguments.length?(t=+n,e):t},e.y=function(t){return arguments.length?(n=+t,e):n},e},t.forceCollide=function(t){function n(){for(var t,n,r,c,s,f,l,h=i.length,p=0;p<a;++p)for(n=Te(i,Se,Ee).visitAfter(e),t=0;t<h;++t)r=i[t],f=o[r.index],l=f*f,c=r.x+r.vx,s=r.y+r.vy,n.visit(function(t,n,e,i,o){var a=t.data,h=t.r,p=f+h;if(!a)return n>c+p||i<c-p||e>s+p||o<s-p;if(a.index>r.index){var d=c-a.x-a.vx,v=s-a.y-a.vy,g=d*d+v*v;g<p*p&&(0===d&&(d=me(),g+=d*d),0===v&&(v=me(),g+=v*v),g=(p-(g=Math.sqrt(g)))/g*u,r.vx+=(d*=g)*(p=(h*=h)/(l+h)),r.vy+=(v*=g)*p,a.vx-=d*(p=1-p),a.vy-=v*p)}})}function e(t){if(t.data)return t.r=o[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function r(){if(i){var n,e,r=i.length;for(o=new Array(r),n=0;n<r;++n)e=i[n],o[e.index]=+t(e,n,i)}}var i,o,u=1,a=1;return"function"!=typeof t&&(t=ye(null==t?1:+t)),n.initialize=function(t){i=t,r()},n.iterations=function(t){return arguments.length?(a=+t,n):a},n.strength=function(t){return arguments.length?(u=+t,n):u},n.radius=function(e){return arguments.length?(t="function"==typeof e?e:ye(+e),r(),n):t},n},t.forceLink=function(t){function n(n){for(var e=0,r=t.length;e<p;++e)for(var i,a,c,f,l,h,d,v=0;v<r;++v)a=(i=t[v]).source,f=(c=i.target).x+c.vx-a.x-a.vx||me(),l=c.y+c.vy-a.y-a.vy||me(),f*=h=((h=Math.sqrt(f*f+l*l))-u[v])/h*n*o[v],l*=h,c.vx-=f*(d=s[v]),c.vy-=l*d,a.vx+=f*(d=1-d),a.vy+=l*d}function e(){if(a){var n,e,l=a.length,h=t.length,p=se(a,f);for(n=0,c=new Array(l);n<h;++n)(e=t[n]).index=n,"object"!=typeof e.source&&(e.source=Ce(p,e.source)),"object"!=typeof e.target&&(e.target=Ce(p,e.target)),c[e.source.index]=(c[e.source.index]||0)+1,c[e.target.index]=(c[e.target.index]||0)+1;for(n=0,s=new Array(h);n<h;++n)e=t[n],s[n]=c[e.source.index]/(c[e.source.index]+c[e.target.index]);o=new Array(h),r(),u=new Array(h),i()}}function r(){if(a)for(var n=0,e=t.length;n<e;++n)o[n]=+l(t[n],n,t)}function i(){if(a)for(var n=0,e=t.length;n<e;++n)u[n]=+h(t[n],n,t)}var o,u,a,c,s,f=Ae,l=function(t){return 1/Math.min(c[t.source.index],c[t.target.index])},h=ye(30),p=1;return null==t&&(t=[]),n.initialize=function(t){a=t,e()},n.links=function(r){return arguments.length?(t=r,e(),n):t},n.id=function(t){return arguments.length?(f=t,n):f},n.iterations=function(t){return arguments.length?(p=+t,n):p},n.strength=function(t){return arguments.length?(l="function"==typeof t?t:ye(+t),r(),n):l},n.distance=function(t){return arguments.length?(h="function"==typeof t?t:ye(+t),i(),n):h},n},t.forceManyBody=function(){function t(t){var n,a=i.length,c=Te(i,ze,Pe).visitAfter(e);for(u=t,n=0;n<a;++n)o=i[n],c.visit(r)}function n(){if(i){var t,n,e=i.length;for(a=new Array(e),t=0;t<e;++t)n=i[t],a[n.index]=+c(n,t,i)}}function e(t){var n,e,r,i,o,u=0,c=0;if(t.length){for(r=i=o=0;o<4;++o)(n=t[o])&&(e=Math.abs(n.value))&&(u+=n.value,c+=e,r+=e*n.x,i+=e*n.y);t.x=r/c,t.y=i/c}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=a[n.data.index]}while(n=n.next)}t.value=u}function r(t,n,e,r){if(!t.value)return!0;var i=t.x-o.x,c=t.y-o.y,h=r-n,p=i*i+c*c;if(h*h/l<p)return p<f&&(0===i&&(i=me(),p+=i*i),0===c&&(c=me(),p+=c*c),p<s&&(p=Math.sqrt(s*p)),o.vx+=i*t.value*u/p,o.vy+=c*t.value*u/p),!0;if(!(t.length||p>=f)){(t.data!==o||t.next)&&(0===i&&(i=me(),p+=i*i),0===c&&(c=me(),p+=c*c),p<s&&(p=Math.sqrt(s*p)));do{t.data!==o&&(h=a[t.data.index]*u/p,o.vx+=i*h,o.vy+=c*h)}while(t=t.next)}}var i,o,u,a,c=ye(-30),s=1,f=1/0,l=.81;return t.initialize=function(t){i=t,n()},t.strength=function(e){return arguments.length?(c="function"==typeof e?e:ye(+e),n(),t):c},t.distanceMin=function(n){return arguments.length?(s=n*n,t):Math.sqrt(s)},t.distanceMax=function(n){return arguments.length?(f=n*n,t):Math.sqrt(f)},t.theta=function(n){return arguments.length?(l=n*n,t):Math.sqrt(l)},t},t.forceRadial=function(t,n,e){function r(t){for(var r=0,i=o.length;r<i;++r){var c=o[r],s=c.x-n||1e-6,f=c.y-e||1e-6,l=Math.sqrt(s*s+f*f),h=(a[r]-l)*u[r]*t/l;c.vx+=s*h,c.vy+=f*h}}function i(){if(o){var n,e=o.length;for(u=new Array(e),a=new Array(e),n=0;n<e;++n)a[n]=+t(o[n],n,o),u[n]=isNaN(a[n])?0:+c(o[n],n,o)}}var o,u,a,c=ye(.1);return"function"!=typeof t&&(t=ye(+t)),null==n&&(n=0),null==e&&(e=0),r.initialize=function(t){o=t,i()},r.strength=function(t){return arguments.length?(c="function"==typeof t?t:ye(+t),i(),r):c},r.radius=function(n){return arguments.length?(t="function"==typeof n?n:ye(+n),i(),r):t},r.x=function(t){return arguments.length?(n=+t,r):n},r.y=function(t){return arguments.length?(e=+t,r):e},r},t.forceSimulation=function(t){function n(){e(),p.call("tick",o),u<a&&(h.stop(),p.call("end",o))}function e(){var n,e,r=t.length;for(u+=(s-u)*c,l.each(function(t){t(u)}),n=0;n<r;++n)null==(e=t[n]).fx?e.x+=e.vx*=f:(e.x=e.fx,e.vx=0),null==e.fy?e.y+=e.vy*=f:(e.y=e.fy,e.vy=0)}function r(){for(var n,e=0,r=t.length;e<r;++e){if(n=t[e],n.index=e,isNaN(n.x)||isNaN(n.y)){var i=Fh*Math.sqrt(e),o=e*Ih;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function i(n){return n.initialize&&n.initialize(t),n}var o,u=1,a=.001,c=1-Math.pow(a,1/300),s=0,f=.6,l=se(),h=wn(n),p=N("tick","end");return null==t&&(t=[]),r(),o={tick:e,restart:function(){return h.restart(n),o},stop:function(){return h.stop(),o},nodes:function(n){return arguments.length?(t=n,r(),l.each(i),o):t},alpha:function(t){return arguments.length?(u=+t,o):u},alphaMin:function(t){return arguments.length?(a=+t,o):a},alphaDecay:function(t){return arguments.length?(c=+t,o):+c},alphaTarget:function(t){return arguments.length?(s=+t,o):s},velocityDecay:function(t){return arguments.length?(f=1-t,o):1-f},force:function(t,n){return arguments.length>1?(null==n?l.remove(t):l.set(t,i(n)),o):l.get(t)},find:function(n,e,r){var i,o,u,a,c,s=0,f=t.length;for(null==r?r=1/0:r*=r,s=0;s<f;++s)(u=(i=n-(a=t[s]).x)*i+(o=e-a.y)*o)<r&&(c=a,r=u);return c},on:function(t,n){return arguments.length>1?(p.on(t,n),o):p.on(t)}}},t.forceX=function(t){function n(t){for(var n,e=0,u=r.length;e<u;++e)(n=r[e]).vx+=(o[e]-n.x)*i[e]*t}function e(){if(r){var n,e=r.length;for(i=new Array(e),o=new Array(e),n=0;n<e;++n)i[n]=isNaN(o[n]=+t(r[n],n,r))?0:+u(r[n],n,r)}}var r,i,o,u=ye(.1);return"function"!=typeof t&&(t=ye(null==t?0:+t)),n.initialize=function(t){r=t,e()},n.strength=function(t){return arguments.length?(u="function"==typeof t?t:ye(+t),e(),n):u},n.x=function(r){return arguments.length?(t="function"==typeof r?r:ye(+r),e(),n):t},n},t.forceY=function(t){function n(t){for(var n,e=0,u=r.length;e<u;++e)(n=r[e]).vy+=(o[e]-n.y)*i[e]*t}function e(){if(r){var n,e=r.length;for(i=new Array(e),o=new Array(e),n=0;n<e;++n)i[n]=isNaN(o[n]=+t(r[n],n,r))?0:+u(r[n],n,r)}}var r,i,o,u=ye(.1);return"function"!=typeof t&&(t=ye(null==t?0:+t)),n.initialize=function(t){r=t,e()},n.strength=function(t){return arguments.length?(u="function"==typeof t?t:ye(+t),e(),n):u},n.y=function(r){return arguments.length?(t="function"==typeof r?r:ye(+r),e(),n):t},n},t.formatDefaultLocale=Ie,t.formatLocale=Fe,t.formatSpecifier=De,t.precisionFixed=Ye,t.precisionPrefix=Be,t.precisionRound=He,t.geoArea=function(t){return Vp.reset(),tr(t,$p),2*Vp},t.geoBounds=function(t){var n,e,r,i,o,u,a;if(Kh=Jh=-(Gh=Qh=1/0),ip=[],tr(t,Zp),e=ip.length){for(ip.sort(xr),n=1,o=[r=ip[0]];n<e;++n)br(r,(i=ip[n])[0])||br(r,i[1])?(mr(r[0],i[1])>mr(r[0],r[1])&&(r[1]=i[1]),mr(i[0],r[1])>mr(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(u=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(a=mr(r[1],i[0]))>u&&(u=a,Gh=i[0],Jh=r[1])}return ip=op=null,Gh===1/0||Qh===1/0?[[NaN,NaN],[NaN,NaN]]:[[Gh,Qh],[Jh,Kh]]},t.geoCentroid=function(t){up=ap=cp=sp=fp=lp=hp=pp=dp=vp=gp=0,tr(t,Gp);var n=dp,e=vp,r=gp,i=n*n+e*e+r*r;return i<Tp&&(n=lp,e=hp,r=pp,ap<Mp&&(n=cp,e=sp,r=fp),(i=n*n+e*e+r*r)<Tp)?[NaN,NaN]:[Rp(e,n)*Ap,We(r/Yp(i))*Ap]},t.geoCircle=function(){function t(){var t=r.apply(this,arguments),a=i.apply(this,arguments)*Cp,c=o.apply(this,arguments)*Cp;return n=[],e=qr(-t[0]*Cp,-t[1]*Cp,0).invert,Ir(u,a,c,1),t={type:"Polygon",coordinates:[n]},n=e=null,t}var n,e,r=Pr([0,0]),i=Pr(90),o=Pr(6),u={point:function(t,r){n.push(t=e(t,r)),t[0]*=Ap,t[1]*=Ap}};return t.center=function(n){return arguments.length?(r="function"==typeof n?n:Pr([+n[0],+n[1]]),t):r},t.radius=function(n){return arguments.length?(i="function"==typeof n?n:Pr(+n),t):i},t.precision=function(n){return arguments.length?(o="function"==typeof n?n:Pr(+n),t):o},t},t.geoClipAntimeridian=sd,t.geoClipCircle=Qr,t.geoClipExtent=function(){var t,n,e,r=0,i=0,o=960,u=500;return e={stream:function(e){return t&&n===e?t:t=Jr(r,i,o,u)(n=e)},extent:function(a){return arguments.length?(r=+a[0][0],i=+a[0][1],o=+a[1][0],u=+a[1][1],t=n=null,e):[[r,i],[o,u]]}}},t.geoClipRectangle=Jr,t.geoContains=function(t,n){return(t&&gd.hasOwnProperty(t.type)?gd[t.type]:ii)(t,n)},t.geoDistance=ri,t.geoGraticule=hi,t.geoGraticule10=function(){return hi()()},t.geoInterpolate=function(t,n){var e=t[0]*Cp,r=t[1]*Cp,i=n[0]*Cp,o=n[1]*Cp,u=Lp(r),a=Fp(r),c=Lp(o),s=Fp(o),f=u*Lp(e),l=u*Fp(e),h=c*Lp(i),p=c*Fp(i),d=2*We(Yp(Ze(o-r)+u*c*Ze(i-e))),v=Fp(d),g=d?function(t){var n=Fp(t*=d)/v,e=Fp(d-t)/v,r=e*f+n*h,i=e*l+n*p,o=e*a+n*s;return[Rp(i,r)*Ap,Rp(o,Yp(r*r+i*i))*Ap]}:function(){return[e*Ap,r*Ap]};return g.distance=d,g},t.geoLength=ei,t.geoPath=function(t,n){function e(t){return t&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),tr(t,r(i))),i.result()}var r,i,o=4.5;return e.area=function(t){return tr(t,r(xd)),xd.result()},e.measure=function(t){return tr(t,r(Bd)),Bd.result()},e.bounds=function(t){return tr(t,r(Nd)),Nd.result()},e.centroid=function(t){return tr(t,r(qd)),qd.result()},e.projection=function(n){return arguments.length?(r=null==n?(t=null,pi):(t=n).stream,e):t},e.context=function(t){return arguments.length?(i=null==t?(n=null,new Ci):new Si(n=t),"function"!=typeof o&&i.pointRadius(o),e):n},e.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(i.pointRadius(+t),+t),e):o},e.projection(t).context(n)},t.geoAlbers=Xi,t.geoAlbersUsa=function(){function t(t){var n=t[0],e=t[1];return a=null,i.point(n,e),a||(o.point(n,e),a)||(u.point(n,e),a)}function n(){return e=r=null,t}var e,r,i,o,u,a,c=Xi(),s=ji().rotate([154,0]).center([-2,58.5]).parallels([55,65]),f=ji().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){a=[t,n]}};return t.invert=function(t){var n=c.scale(),e=c.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?f:c).invert(t)},t.stream=function(t){return e&&r===t?e:e=function(t){var n=t.length;return{point:function(e,r){for(var i=-1;++i<n;)t[i].point(e,r)},sphere:function(){for(var e=-1;++e<n;)t[e].sphere()},lineStart:function(){for(var e=-1;++e<n;)t[e].lineStart()},lineEnd:function(){for(var e=-1;++e<n;)t[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<n;)t[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<n;)t[e].polygonEnd()}}}([c.stream(r=t),s.stream(t),f.stream(t)])},t.precision=function(t){return arguments.length?(c.precision(t),s.precision(t),f.precision(t),n()):c.precision()},t.scale=function(n){return arguments.length?(c.scale(n),s.scale(.35*n),f.scale(n),t.translate(c.translate())):c.scale()},t.translate=function(t){if(!arguments.length)return c.translate();var e=c.scale(),r=+t[0],a=+t[1];return i=c.translate(t).clipExtent([[r-.455*e,a-.238*e],[r+.455*e,a+.238*e]]).stream(l),o=s.translate([r-.307*e,a+.201*e]).clipExtent([[r-.425*e+Mp,a+.12*e+Mp],[r-.214*e-Mp,a+.234*e-Mp]]).stream(l),u=f.translate([r-.205*e,a+.212*e]).clipExtent([[r-.214*e+Mp,a+.166*e+Mp],[r-.115*e-Mp,a+.234*e-Mp]]).stream(l),n()},t.fitExtent=function(n,e){return qi(t,n,e)},t.fitSize=function(n,e){return Di(t,n,e)},t.fitWidth=function(n,e){return Ui(t,n,e)},t.fitHeight=function(n,e){return Oi(t,n,e)},t.scale(1070)},t.geoAzimuthalEqualArea=function(){return Ii(Vd).scale(124.75).clipAngle(179.999)},t.geoAzimuthalEqualAreaRaw=Vd,t.geoAzimuthalEquidistant=function(){return Ii($d).scale(79.4188).clipAngle(179.999)},t.geoAzimuthalEquidistantRaw=$d,t.geoConicConformal=function(){return Bi(Qi).scale(109.5).parallels([30,30])},t.geoConicConformalRaw=Qi,t.geoConicEqualArea=ji,t.geoConicEqualAreaRaw=Hi,t.geoConicEquidistant=function(){return Bi(Ki).scale(131.154).center([0,13.9389])},t.geoConicEquidistantRaw=Ki,t.geoEquirectangular=function(){return Ii(Ji).scale(152.63)},t.geoEquirectangularRaw=Ji,t.geoGnomonic=function(){return Ii(to).scale(144.049).clipAngle(60)},t.geoGnomonicRaw=to,t.geoIdentity=function(){function t(){return i=o=null,u}var n,e,r,i,o,u,a=1,c=0,s=0,f=1,l=1,h=pi,p=null,d=pi;return u={stream:function(t){return i&&o===t?i:i=h(d(o=t))},postclip:function(i){return arguments.length?(d=i,p=n=e=r=null,t()):d},clipExtent:function(i){return arguments.length?(d=null==i?(p=n=e=r=null,pi):Jr(p=+i[0][0],n=+i[0][1],e=+i[1][0],r=+i[1][1]),t()):null==p?null:[[p,n],[e,r]]},scale:function(n){return arguments.length?(h=no((a=+n)*f,a*l,c,s),t()):a},translate:function(n){return arguments.length?(h=no(a*f,a*l,c=+n[0],s=+n[1]),t()):[c,s]},reflectX:function(n){return arguments.length?(h=no(a*(f=n?-1:1),a*l,c,s),t()):f<0},reflectY:function(n){return arguments.length?(h=no(a*f,a*(l=n?-1:1),c,s),t()):l<0},fitExtent:function(t,n){return qi(u,t,n)},fitSize:function(t,n){return Di(u,t,n)},fitWidth:function(t,n){return Ui(u,t,n)},fitHeight:function(t,n){return Oi(u,t,n)}}},t.geoProjection=Ii,t.geoProjectionMutator=Yi,t.geoMercator=function(){return Zi(Wi).scale(961/Ep)},t.geoMercatorRaw=Wi,t.geoNaturalEarth1=function(){return Ii(eo).scale(175.295)},t.geoNaturalEarth1Raw=eo,t.geoOrthographic=function(){return Ii(ro).scale(249.5).clipAngle(90+Mp)},t.geoOrthographicRaw=ro,t.geoStereographic=function(){return Ii(io).scale(250).clipAngle(142)},t.geoStereographicRaw=io,t.geoTransverseMercator=function(){var t=Zi(oo),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):(t=n(),[t[1],-t[0]])},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):(t=e(),[t[0],t[1],t[2]-90])},e([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=oo,t.geoRotation=Fr,t.geoStream=tr,t.geoTransform=function(t){return{stream:Pi(t)}},t.cluster=function(){function t(t){var o,u=0;t.eachAfter(function(t){var e=t.children;e?(t.x=function(t){return t.reduce(ao,0)/t.length}(e),t.y=function(t){return 1+t.reduce(co,0)}(e)):(t.x=o?u+=n(t,o):0,t.y=0,o=t)});var a=function(t){for(var n;n=t.children;)t=n[0];return t}(t),c=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(t),s=a.x-n(a,c)/2,f=c.x+n(c,a)/2;return t.eachAfter(i?function(n){n.x=(n.x-t.x)*e,n.y=(t.y-n.y)*r}:function(n){n.x=(n.x-s)/(f-s)*e,n.y=(1-(t.y?n.y/t.y:1))*r})}var n=uo,e=1,r=1,i=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(n){return arguments.length?(i=!1,e=+n[0],r=+n[1],t):i?null:[e,r]},t.nodeSize=function(n){return arguments.length?(i=!0,e=+n[0],r=+n[1],t):i?[e,r]:null},t},t.hierarchy=fo,t.pack=function(){function t(t){return t.x=e/2,t.y=r/2,n?t.eachBefore(zo(n)).eachAfter(Po(i,.5)).eachBefore(Ro(1)):t.eachBefore(zo(Co)).eachAfter(Po(Eo,1)).eachAfter(Po(i,t.r/Math.min(e,r))).eachBefore(Ro(Math.min(e,r)/(2*t.r))),t}var n=null,e=1,r=1,i=Eo;return t.radius=function(e){return arguments.length?(n=function(t){return null==t?null:So(t)}(e),t):n},t.size=function(n){return arguments.length?(e=+n[0],r=+n[1],t):[e,r]},t.padding=function(n){return arguments.length?(i="function"==typeof n?n:Ao(+n),t):i},t},t.packSiblings=function(t){return ko(t),t},t.packEnclose=go,t.partition=function(){function t(t){var o=t.height+1;return t.x0=t.y0=r,t.x1=n,t.y1=e/o,t.eachBefore(function(t,n){return function(e){e.children&&qo(e,e.x0,t*(e.depth+1)/n,e.x1,t*(e.depth+2)/n);var i=e.x0,o=e.y0,u=e.x1-r,a=e.y1-r;u<i&&(i=u=(i+u)/2),a<o&&(o=a=(o+a)/2),e.x0=i,e.y0=o,e.x1=u,e.y1=a}}(e,o)),i&&t.eachBefore(Lo),t}var n=1,e=1,r=0,i=!1;return t.round=function(n){return arguments.length?(i=!!n,t):i},t.size=function(r){return arguments.length?(n=+r[0],e=+r[1],t):[n,e]},t.padding=function(n){return arguments.length?(r=+n,t):r},t},t.stratify=function(){function t(t){var r,i,o,u,a,c,s,f=t.length,l=new Array(f),h={};for(i=0;i<f;++i)r=t[i],a=l[i]=new vo(r),null!=(c=n(r,i,t))&&(c+="")&&(h[s=Zd+(a.id=c)]=s in h?Qd:a);for(i=0;i<f;++i)if(a=l[i],null!=(c=e(t[i],i,t))&&(c+="")){if(!(u=h[Zd+c]))throw new Error("missing: "+c);if(u===Qd)throw new Error("ambiguous: "+c);u.children?u.children.push(a):u.children=[a],a.parent=u}else{if(o)throw new Error("multiple roots");o=a}if(!o)throw new Error("no root");if(o.parent=Gd,o.eachBefore(function(t){t.depth=t.parent.depth+1,--f}).eachBefore(po),o.parent=null,f>0)throw new Error("cycle");return o}var n=Do,e=Uo;return t.id=function(e){return arguments.length?(n=So(e),t):n},t.parentId=function(n){return arguments.length?(e=So(n),t):e},t},t.tree=function(){function t(t){var c=function(t){for(var n,e,r,i,o,u=new Ho(t,0),a=[u];n=a.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)a.push(e=n.children[i]=new Ho(r[i],i)),e.parent=n;return(u.parent=new Ho(null,0)).children=[u],u}(t);if(c.eachAfter(n),c.parent.m=-c.z,c.eachBefore(e),a)t.eachBefore(r);else{var s=t,f=t,l=t;t.eachBefore(function(t){t.x<s.x&&(s=t),t.x>f.x&&(f=t),t.depth>l.depth&&(l=t)});var h=s===f?1:i(s,f)/2,p=h-s.x,d=o/(f.x+h+p),v=u/(l.depth||1);t.eachBefore(function(t){t.x=(t.x+p)*d,t.y=t.depth*v})}return t}function n(t){var n=t.children,e=t.parent.children,r=t.i?e[t.i-1]:null;if(n){(function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)})(t);var o=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+i(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+i(t._,r._));t.parent.A=function(t,n,e){if(n){for(var r,o=t,u=t,a=n,c=o.parent.children[0],s=o.m,f=u.m,l=a.m,h=c.m;a=Io(a),o=Fo(o),a&&o;)c=Fo(c),(u=Io(u)).a=t,(r=a.z+l-o.z-s+i(a._,o._))>0&&(Yo(Bo(a,t,e),t,r),s+=r,f+=r),l+=a.m,s+=o.m,h+=c.m,f+=u.m;a&&!Io(u)&&(u.t=a,u.m+=l-f),o&&!Fo(c)&&(c.t=o,c.m+=s-h,e=t)}return e}(t,r,t.parent.A||e[0])}function e(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function r(t){t.x*=o,t.y=t.depth*u}var i=Oo,o=1,u=1,a=null;return t.separation=function(n){return arguments.length?(i=n,t):i},t.size=function(n){return arguments.length?(a=!1,o=+n[0],u=+n[1],t):a?null:[o,u]},t.nodeSize=function(n){return arguments.length?(a=!0,o=+n[0],u=+n[1],t):a?[o,u]:null},t},t.treemap=function(){function t(t){return t.x0=t.y0=0,t.x1=i,t.y1=o,t.eachBefore(n),u=[0],r&&t.eachBefore(Lo),t}function n(t){var n=u[t.depth],r=t.x0+n,i=t.y0+n,o=t.x1-n,h=t.y1-n;o<r&&(r=o=(r+o)/2),h<i&&(i=h=(i+h)/2),t.x0=r,t.y0=i,t.x1=o,t.y1=h,t.children&&(n=u[t.depth+1]=a(t)/2,r+=l(t)-n,i+=c(t)-n,o-=s(t)-n,h-=f(t)-n,o<r&&(r=o=(r+o)/2),h<i&&(i=h=(i+h)/2),e(t,r,i,o,h))}var e=Kd,r=!1,i=1,o=1,u=[0],a=Eo,c=Eo,s=Eo,f=Eo,l=Eo;return t.round=function(n){return arguments.length?(r=!!n,t):r},t.size=function(n){return arguments.length?(i=+n[0],o=+n[1],t):[i,o]},t.tile=function(n){return arguments.length?(e=So(n),t):e},t.padding=function(n){return arguments.length?t.paddingInner(n).paddingOuter(n):t.paddingInner()},t.paddingInner=function(n){return arguments.length?(a="function"==typeof n?n:Ao(+n),t):a},t.paddingOuter=function(n){return arguments.length?t.paddingTop(n).paddingRight(n).paddingBottom(n).paddingLeft(n):t.paddingTop()},t.paddingTop=function(n){return arguments.length?(c="function"==typeof n?n:Ao(+n),t):c},t.paddingRight=function(n){return arguments.length?(s="function"==typeof n?n:Ao(+n),t):s},t.paddingBottom=function(n){return arguments.length?(f="function"==typeof n?n:Ao(+n),t):f},t.paddingLeft=function(n){return arguments.length?(l="function"==typeof n?n:Ao(+n),t):l},t},t.treemapBinary=function(t,n,e,r,i){function o(t,n,e,r,i,u,a){if(t>=n-1){var s=c[t];return s.x0=r,s.y0=i,s.x1=u,void(s.y1=a)}for(var l=f[t],h=e/2+l,p=t+1,d=n-1;p<d;){var v=p+d>>>1;f[v]<h?p=v+1:d=v}h-f[p-1]<f[p]-h&&t+1<p&&--p;var g=f[p]-l,_=e-g;if(u-r>a-i){var y=(r*_+u*g)/e;o(t,p,g,r,i,y,a),o(p,n,_,y,i,u,a)}else{var m=(i*_+a*g)/e;o(t,p,g,r,i,u,m),o(p,n,_,r,m,u,a)}}var u,a,c=t.children,s=c.length,f=new Array(s+1);for(f[0]=a=u=0;u<s;++u)f[u+1]=a+=c[u].value;o(0,s,t.value,n,e,r,i)},t.treemapDice=qo,t.treemapSlice=jo,t.treemapSliceDice=function(t,n,e,r,i){(1&t.depth?jo:qo)(t,n,e,r,i)},t.treemapSquarify=Kd,t.treemapResquarify=tv,t.interpolate=fn,t.interpolateArray=on,t.interpolateBasis=Gt,t.interpolateBasisClosed=Qt,t.interpolateDate=un,t.interpolateNumber=an,t.interpolateObject=cn,t.interpolateRound=ln,t.interpolateString=sn,t.interpolateTransformCss=Gf,t.interpolateTransformSvg=Qf,t.interpolateZoom=vn,t.interpolateRgb=Hf,t.interpolateRgbBasis=jf,t.interpolateRgbBasisClosed=Xf,t.interpolateHsl=el,t.interpolateHslLong=rl,t.interpolateLab=function(t,n){var e=en((t=Ft(t)).l,(n=Ft(n)).l),r=en(t.a,n.a),i=en(t.b,n.b),o=en(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},t.interpolateHcl=il,t.interpolateHclLong=ol,t.interpolateCubehelix=ul,t.interpolateCubehelixLong=al,t.quantize=function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e},t.path=ee,t.polygonArea=function(t){for(var n,e=-1,r=t.length,i=t[r-1],o=0;++e<r;)n=i,i=t[e],o+=n[1]*i[0]-n[0]*i[1];return o/2},t.polygonCentroid=function(t){for(var n,e,r=-1,i=t.length,o=0,u=0,a=t[i-1],c=0;++r<i;)n=a,a=t[r],c+=e=n[0]*a[1]-a[0]*n[1],o+=(n[0]+a[0])*e,u+=(n[1]+a[1])*e;return c*=3,[o/c,u/c]},t.polygonHull=function(t){if((e=t.length)<3)return null;var n,e,r=new Array(e),i=new Array(e);for(n=0;n<e;++n)r[n]=[+t[n][0],+t[n][1],n];for(r.sort($o),n=0;n<e;++n)i[n]=[r[n][0],-r[n][1]];var o=Wo(r),u=Wo(i),a=u[0]===o[0],c=u[u.length-1]===o[o.length-1],s=[];for(n=o.length-1;n>=0;--n)s.push(t[r[o[n]][2]]);for(n=+a;n<u.length-c;++n)s.push(t[r[u[n]][2]]);return s},t.polygonContains=function(t,n){for(var e,r,i=t.length,o=t[i-1],u=n[0],a=n[1],c=o[0],s=o[1],f=!1,l=0;l<i;++l)e=(o=t[l])[0],(r=o[1])>a!=s>a&&u<(c-e)*(a-r)/(s-r)+e&&(f=!f),c=e,s=r;return f},t.polygonLength=function(t){for(var n,e,r=-1,i=t.length,o=t[i-1],u=o[0],a=o[1],c=0;++r<i;)n=u,e=a,n-=u=(o=t[r])[0],e-=a=o[1],c+=Math.sqrt(n*n+e*e);return c},t.quadtree=Te,t.queue=Ko,t.randomUniform=rv,t.randomNormal=iv,t.randomLogNormal=ov,t.randomBates=av,t.randomIrwinHall=uv,t.randomExponential=cv,t.request=nu,t.html=sv,t.json=fv,t.text=lv,t.xml=hv,t.csv=pv,t.tsv=dv,t.scaleBand=ou,t.scalePoint=function(){return uu(ou().paddingInner(1))},t.scaleIdentity=gu,t.scaleLinear=vu,t.scaleLog=Tu,t.scaleOrdinal=iu,t.scaleImplicit=yv,t.scalePow=ku,t.scaleSqrt=function(){return ku().exponent(.5)},t.scaleQuantile=Su,t.scaleQuantize=Eu,t.scaleThreshold=Au,t.scaleTime=function(){return Va(Gv,Wv,Lv,Pv,Cv,Ev,kv,wv,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},t.scaleUtc=function(){return Va(xg,yg,ig,eg,tg,Jv,kv,wv,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},t.schemeCategory10=Ug,t.schemeCategory20b=Og,t.schemeCategory20c=Fg,t.schemeCategory20=Ig,t.interpolateCubehelixDefault=Yg,t.interpolateRainbow=function(t){(t<0||t>1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return jg.h=360*t-100,jg.s=1.5-1.5*n,jg.l=.8-.9*n,jg+""},t.interpolateWarm=Bg,t.interpolateCool=Hg,t.interpolateViridis=Xg,t.interpolateMagma=Vg,t.interpolateInferno=$g,t.interpolatePlasma=Wg,t.scaleSequential=Za,t.create=function(t){return ct(A(t).call(document.documentElement))},t.creator=A,t.local=st,t.matcher=of,t.mouse=pt,t.namespace=E,t.namespaces=tf,t.clientPoint=ht,t.select=ct,t.selectAll=function(t){return"string"==typeof t?new ut([document.querySelectorAll(t)],[document.documentElement]):new ut([null==t?[]:t],cf)},t.selection=at,t.selector=z,t.selectorAll=R,t.style=I,t.touch=dt,t.touches=function(t,n){null==n&&(n=lt().touches);for(var e=0,r=n?n.length:0,i=new Array(r);e<r;++e)i[e]=ht(t,n[e]);return i},t.window=F,t.customEvent=it,t.arc=function(){function t(){var t,s,f=+n.apply(this,arguments),l=+e.apply(this,arguments),h=o.apply(this,arguments)-i_,p=u.apply(this,arguments)-i_,d=Zg(p-h),v=p>h;if(c||(c=t=ee()),l<f&&(s=l,l=f,f=s),l>e_)if(d>o_-e_)c.moveTo(l*Qg(h),l*t_(h)),c.arc(0,0,l,h,p,!v),f>e_&&(c.moveTo(f*Qg(p),f*t_(p)),c.arc(0,0,f,p,h,v));else{var g,_,y=h,m=p,x=h,b=p,w=d,M=d,T=a.apply(this,arguments)/2,N=T>e_&&(i?+i.apply(this,arguments):n_(f*f+l*l)),k=Kg(Zg(l-f)/2,+r.apply(this,arguments)),S=k,E=k;if(N>e_){var A=Qa(N/f*t_(T)),C=Qa(N/l*t_(T));(w-=2*A)>e_?(A*=v?1:-1,x+=A,b-=A):(w=0,x=b=(h+p)/2),(M-=2*C)>e_?(C*=v?1:-1,y+=C,m-=C):(M=0,y=m=(h+p)/2)}var z=l*Qg(y),P=l*t_(y),R=f*Qg(b),L=f*t_(b);if(k>e_){var q=l*Qg(m),D=l*t_(m),U=f*Qg(x),O=f*t_(x);if(d<r_){var F=w>e_?function(t,n,e,r,i,o,u,a){var c=e-t,s=r-n,f=u-i,l=a-o,h=(f*(n-o)-l*(t-i))/(l*c-f*s);return[t+h*c,n+h*s]}(z,P,U,O,q,D,R,L):[R,L],I=z-F[0],Y=P-F[1],B=q-F[0],H=D-F[1],j=1/t_(function(t){return t>1?0:t<-1?r_:Math.acos(t)}((I*B+Y*H)/(n_(I*I+Y*Y)*n_(B*B+H*H)))/2),X=n_(F[0]*F[0]+F[1]*F[1]);S=Kg(k,(f-X)/(j-1)),E=Kg(k,(l-X)/(j+1))}}M>e_?E>e_?(g=rc(U,O,z,P,l,E,v),_=rc(q,D,R,L,l,E,v),c.moveTo(g.cx+g.x01,g.cy+g.y01),E<k?c.arc(g.cx,g.cy,E,Gg(g.y01,g.x01),Gg(_.y01,_.x01),!v):(c.arc(g.cx,g.cy,E,Gg(g.y01,g.x01),Gg(g.y11,g.x11),!v),c.arc(0,0,l,Gg(g.cy+g.y11,g.cx+g.x11),Gg(_.cy+_.y11,_.cx+_.x11),!v),c.arc(_.cx,_.cy,E,Gg(_.y11,_.x11),Gg(_.y01,_.x01),!v))):(c.moveTo(z,P),c.arc(0,0,l,y,m,!v)):c.moveTo(z,P),f>e_&&w>e_?S>e_?(g=rc(R,L,q,D,f,-S,v),_=rc(z,P,U,O,f,-S,v),c.lineTo(g.cx+g.x01,g.cy+g.y01),S<k?c.arc(g.cx,g.cy,S,Gg(g.y01,g.x01),Gg(_.y01,_.x01),!v):(c.arc(g.cx,g.cy,S,Gg(g.y01,g.x01),Gg(g.y11,g.x11),!v),c.arc(0,0,f,Gg(g.cy+g.y11,g.cx+g.x11),Gg(_.cy+_.y11,_.cx+_.x11),v),c.arc(_.cx,_.cy,S,Gg(_.y11,_.x11),Gg(_.y01,_.x01),!v))):c.arc(0,0,f,b,x,v):c.lineTo(R,L)}else c.moveTo(0,0);if(c.closePath(),t)return c=null,t+""||null}var n=Ja,e=Ka,r=Ga(0),i=null,o=tc,u=nc,a=ec,c=null;return t.centroid=function(){var t=(+n.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+o.apply(this,arguments)+ +u.apply(this,arguments))/2-r_/2;return[Qg(r)*t,t_(r)*t]},t.innerRadius=function(e){return arguments.length?(n="function"==typeof e?e:Ga(+e),t):n},t.outerRadius=function(n){return arguments.length?(e="function"==typeof n?n:Ga(+n),t):e},t.cornerRadius=function(n){return arguments.length?(r="function"==typeof n?n:Ga(+n),t):r},t.padRadius=function(n){return arguments.length?(i=null==n?null:"function"==typeof n?n:Ga(+n),t):i},t.startAngle=function(n){return arguments.length?(o="function"==typeof n?n:Ga(+n),t):o},t.endAngle=function(n){return arguments.length?(u="function"==typeof n?n:Ga(+n),t):u},t.padAngle=function(n){return arguments.length?(a="function"==typeof n?n:Ga(+n),t):a},t.context=function(n){return arguments.length?(c=null==n?null:n,t):c},t},t.area=sc,t.line=cc,t.pie=function(){function t(t){var a,c,s,f,l,h=t.length,p=0,d=new Array(h),v=new Array(h),g=+i.apply(this,arguments),_=Math.min(o_,Math.max(-o_,o.apply(this,arguments)-g)),y=Math.min(Math.abs(_)/h,u.apply(this,arguments)),m=y*(_<0?-1:1);for(a=0;a<h;++a)(l=v[d[a]=a]=+n(t[a],a,t))>0&&(p+=l);for(null!=e?d.sort(function(t,n){return e(v[t],v[n])}):null!=r&&d.sort(function(n,e){return r(t[n],t[e])}),a=0,s=p?(_-h*m)/p:0;a<h;++a,g=f)c=d[a],f=g+((l=v[c])>0?l*s:0)+m,v[c]={data:t[c],index:a,value:l,startAngle:g,endAngle:f,padAngle:y};return v}var n=lc,e=fc,r=null,i=Ga(0),o=Ga(o_),u=Ga(0);return t.value=function(e){return arguments.length?(n="function"==typeof e?e:Ga(+e),t):n},t.sortValues=function(n){return arguments.length?(e=n,r=null,t):e},t.sort=function(n){return arguments.length?(r=n,e=null,t):r},t.startAngle=function(n){return arguments.length?(i="function"==typeof n?n:Ga(+n),t):i},t.endAngle=function(n){return arguments.length?(o="function"==typeof n?n:Ga(+n),t):o},t.padAngle=function(n){return arguments.length?(u="function"==typeof n?n:Ga(+n),t):u},t},t.areaRadial=gc,t.radialArea=gc,t.lineRadial=vc,t.radialLine=vc,t.pointRadial=_c,t.linkHorizontal=function(){return xc(bc)},t.linkVertical=function(){return xc(wc)},t.linkRadial=function(){var t=xc(Mc);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.symbol=function(){function t(){var t;if(r||(r=t=ee()),n.apply(this,arguments).draw(r,+e.apply(this,arguments)),t)return r=null,t+""||null}var n=Ga(c_),e=Ga(64),r=null;return t.type=function(e){return arguments.length?(n="function"==typeof e?e:Ga(e),t):n},t.size=function(n){return arguments.length?(e="function"==typeof n?n:Ga(+n),t):e},t.context=function(n){return arguments.length?(r=null==n?null:n,t):r},t},t.symbols=T_,t.symbolCircle=c_,t.symbolCross=s_,t.symbolDiamond=h_,t.symbolSquare=__,t.symbolStar=g_,t.symbolTriangle=m_,t.symbolWye=M_,t.curveBasisClosed=function(t){return new Sc(t)},t.curveBasisOpen=function(t){return new Ec(t)},t.curveBasis=function(t){return new kc(t)},t.curveBundle=N_,t.curveCardinalClosed=S_,t.curveCardinalOpen=E_,t.curveCardinal=k_,t.curveCatmullRomClosed=C_,t.curveCatmullRomOpen=z_,t.curveCatmullRom=A_,t.curveLinearClosed=function(t){return new Oc(t)},t.curveLinear=oc,t.curveMonotoneX=function(t){return new Hc(t)},t.curveMonotoneY=function(t){return new jc(t)},t.curveNatural=function(t){return new Vc(t)},t.curveStep=function(t){return new Wc(t,.5)},t.curveStepAfter=function(t){return new Wc(t,1)},t.curveStepBefore=function(t){return new Wc(t,0)},t.stack=function(){function t(t){var o,u,a=n.apply(this,arguments),c=t.length,s=a.length,f=new Array(s);for(o=0;o<s;++o){for(var l,h=a[o],p=f[o]=new Array(c),d=0;d<c;++d)p[d]=l=[0,+i(t[d],h,d,t)],l.data=t[d];p.key=h}for(o=0,u=e(f);o<s;++o)f[u[o]].index=o;return r(f,u),f}var n=Ga([]),e=Gc,r=Zc,i=Qc;return t.keys=function(e){return arguments.length?(n="function"==typeof e?e:Ga(a_.call(e)),t):n},t.value=function(n){return arguments.length?(i="function"==typeof n?n:Ga(+n),t):i},t.order=function(n){return arguments.length?(e=null==n?Gc:"function"==typeof n?n:Ga(a_.call(n)),t):e},t.offset=function(n){return arguments.length?(r=null==n?Zc:n,t):r},t},t.stackOffsetExpand=function(t,n){if((r=t.length)>0){for(var e,r,i,o=0,u=t[0].length;o<u;++o){for(i=e=0;e<r;++e)i+=t[e][o][1]||0;if(i)for(e=0;e<r;++e)t[e][o][1]/=i}Zc(t,n)}},t.stackOffsetDiverging=function(t,n){if((a=t.length)>1)for(var e,r,i,o,u,a,c=0,s=t[n[0]].length;c<s;++c)for(o=u=0,e=0;e<a;++e)(i=(r=t[n[e]][c])[1]-r[0])>=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=u,r[0]=u+=i):r[0]=o},t.stackOffsetNone=Zc,t.stackOffsetSilhouette=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r<o;++r){for(var u=0,a=0;u<e;++u)a+=t[u][r][1]||0;i[r][1]+=i[r][0]=-a/2}Zc(t,n)}},t.stackOffsetWiggle=function(t,n){if((i=t.length)>0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,u=1;u<r;++u){for(var a=0,c=0,s=0;a<i;++a){for(var f=t[n[a]],l=f[u][1]||0,h=(l-(f[u-1][1]||0))/2,p=0;p<a;++p){var d=t[n[p]];h+=(d[u][1]||0)-(d[u-1][1]||0)}c+=l,s+=h*l}e[u-1][1]+=e[u-1][0]=o,c&&(o-=s/c)}e[u-1][1]+=e[u-1][0]=o,Zc(t,n)}},t.stackOrderAscending=Jc,t.stackOrderDescending=function(t){return Jc(t).reverse()},t.stackOrderInsideOut=function(t){var n,e,r=t.length,i=t.map(Kc),o=Gc(t).sort(function(t,n){return i[n]-i[t]}),u=0,a=0,c=[],s=[];for(n=0;n<r;++n)e=o[n],u<a?(u+=i[e],c.push(e)):(a+=i[e],s.push(e));return s.reverse().concat(c)},t.stackOrderNone=Gc,t.stackOrderReverse=function(t){return Gc(t).reverse()},t.timeInterval=Cu,t.timeMillisecond=wv,t.timeMilliseconds=Mv,t.utcMillisecond=wv,t.utcMilliseconds=Mv,t.timeSecond=kv,t.timeSeconds=Sv,t.utcSecond=kv,t.utcSeconds=Sv,t.timeMinute=Ev,t.timeMinutes=Av,t.timeHour=Cv,t.timeHours=zv,t.timeDay=Pv,t.timeDays=Rv,t.timeWeek=Lv,t.timeWeeks=Yv,t.timeSunday=Lv,t.timeSundays=Yv,t.timeMonday=qv,t.timeMondays=Bv,t.timeTuesday=Dv,t.timeTuesdays=Hv,t.timeWednesday=Uv,t.timeWednesdays=jv,t.timeThursday=Ov,t.timeThursdays=Xv,t.timeFriday=Fv,t.timeFridays=Vv,t.timeSaturday=Iv,t.timeSaturdays=$v,t.timeMonth=Wv,t.timeMonths=Zv,t.timeYear=Gv,t.timeYears=Qv,t.utcMinute=Jv,t.utcMinutes=Kv,t.utcHour=tg,t.utcHours=ng,t.utcDay=eg,t.utcDays=rg,t.utcWeek=ig,t.utcWeeks=lg,t.utcSunday=ig,t.utcSundays=lg,t.utcMonday=og,t.utcMondays=hg,t.utcTuesday=ug,t.utcTuesdays=pg,t.utcWednesday=ag,t.utcWednesdays=dg,t.utcThursday=cg,t.utcThursdays=vg,t.utcFriday=sg,t.utcFridays=gg,t.utcSaturday=fg,t.utcSaturdays=_g,t.utcMonth=yg,t.utcMonths=mg,t.utcYear=xg,t.utcYears=wg,t.timeFormatDefaultLocale=Ha,t.timeFormatLocale=Du,t.isoFormat=Eg,t.isoParse=Ag,t.now=mn,t.timer=wn,t.timerFlush=Mn,t.timeout=Sn,t.interval=function(t,n,e){var r=new bn,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?mn():+e,r.restart(function o(u){u+=i,r.restart(o,i+=n,e),t(u)},n,e),r)},t.transition=Dn,t.active=function(t,n){var e,r,i=t.__transition;if(i){n=null==n?null:n+"";for(r in i)if((e=i[r]).state>xl&&e.name===n)return new qn([[t]],Jl,n,+r)}return null},t.interrupt=Pn,t.voronoi=function(){function t(t){return new Ns(t.map(function(r,i){var o=[Math.round(n(r,i,t)/F_)*F_,Math.round(e(r,i,t)/F_)*F_];return o.index=i,o.data=r,o}),r)}var n=ns,e=es,r=null;return t.polygons=function(n){return t(n).polygons()},t.links=function(n){return t(n).links()},t.triangles=function(n){return t(n).triangles()},t.x=function(e){return arguments.length?(n="function"==typeof e?e:ts(+e),t):n},t.y=function(n){return arguments.length?(e="function"==typeof n?n:ts(+n),t):e},t.extent=function(n){return arguments.length?(r=null==n?null:[[+n[0][0],+n[0][1]],[+n[1][0],+n[1][1]]],t):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},t.size=function(n){return arguments.length?(r=null==n?null:[[0,0],[+n[0],+n[1]]],t):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},t},t.zoom=function(){function n(t){t.property("__zoom",Rs).on("wheel.zoom",c).on("mousedown.zoom",s).on("dblclick.zoom",f).filter(x).on("touchstart.zoom",l).on("touchmove.zoom",h).on("touchend.zoom touchcancel.zoom",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function e(t,n){return(n=Math.max(b[0],Math.min(b[1],n)))===t.k?t:new Ss(n,t.x,t.y)}function r(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new Ss(t.k,r,i)}function i(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function o(t,n,e){t.on("start.zoom",function(){u(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){u(this,arguments).end()}).tween("zoom",function(){var t=arguments,r=u(this,t),o=_.apply(this,t),a=e||i(o),c=Math.max(o[1][0]-o[0][0],o[1][1]-o[0][1]),s=this.__zoom,f="function"==typeof n?n.apply(this,t):n,l=T(s.invert(a).concat(c/s.k),f.invert(a).concat(c/f.k));return function(t){if(1===t)t=f;else{var n=l(t),e=c/n[2];t=new Ss(e,a[0]-n[0]*e,a[1]-n[1]*e)}r.zoom(null,t)}})}function u(t,n){for(var e,r=0,i=k.length;r<i;++r)if((e=k[r]).that===t)return e;return new a(t,n)}function a(t,n){this.that=t,this.args=n,this.index=-1,this.active=0,this.extent=_.apply(t,n)}function c(){if(g.apply(this,arguments)){var t=u(this,arguments),n=this.__zoom,i=Math.max(b[0],Math.min(b[1],n.k*Math.pow(2,m.apply(this,arguments)))),o=pt(this);if(t.wheel)t.mouse[0][0]===o[0]&&t.mouse[0][1]===o[1]||(t.mouse[1]=n.invert(t.mouse[0]=o)),clearTimeout(t.wheel);else{if(n.k===i)return;t.mouse=[o,n.invert(o)],Pn(this),t.start()}Cs(),t.wheel=setTimeout(function(){t.wheel=null,t.end()},A),t.zoom("mouse",y(r(e(n,i),t.mouse[0],t.mouse[1]),t.extent,w))}}function s(){if(!v&&g.apply(this,arguments)){var n=u(this,arguments),e=ct(t.event.view).on("mousemove.zoom",function(){if(Cs(),!n.moved){var e=t.event.clientX-o,i=t.event.clientY-a;n.moved=e*e+i*i>C}n.zoom("mouse",y(r(n.that.__zoom,n.mouse[0]=pt(n.that),n.mouse[1]),n.extent,w))},!0).on("mouseup.zoom",function(){e.on("mousemove.zoom mouseup.zoom",null),yt(t.event.view,n.moved),Cs(),n.end()},!0),i=pt(this),o=t.event.clientX,a=t.event.clientY;_t(t.event.view),As(),n.mouse=[i,this.__zoom.invert(i)],Pn(this),n.start()}}function f(){if(g.apply(this,arguments)){var i=this.__zoom,u=pt(this),a=i.invert(u),c=i.k*(t.event.shiftKey?.5:2),s=y(r(e(i,c),u,a),_.apply(this,arguments),w);Cs(),M>0?ct(this).transition().duration(M).call(o,s,u):ct(this).call(n.transform,s)}}function l(){if(g.apply(this,arguments)){var n,e,r,i,o=u(this,arguments),a=t.event.changedTouches,c=a.length;for(As(),e=0;e<c;++e)i=[i=dt(this,a,(r=a[e]).identifier),this.__zoom.invert(i),r.identifier],o.touch0?o.touch1||(o.touch1=i):(o.touch0=i,n=!0);if(d&&(d=clearTimeout(d),!o.touch1))return o.end(),void((i=ct(this).on("dblclick.zoom"))&&i.apply(this,arguments));n&&(d=setTimeout(function(){d=null},E),Pn(this),o.start())}}function h(){var n,i,o,a,c=u(this,arguments),s=t.event.changedTouches,f=s.length;for(Cs(),d&&(d=clearTimeout(d)),n=0;n<f;++n)o=dt(this,s,(i=s[n]).identifier),c.touch0&&c.touch0[2]===i.identifier?c.touch0[0]=o:c.touch1&&c.touch1[2]===i.identifier&&(c.touch1[0]=o);if(i=c.that.__zoom,c.touch1){var l=c.touch0[0],h=c.touch0[1],p=c.touch1[0],v=c.touch1[1],g=(g=p[0]-l[0])*g+(g=p[1]-l[1])*g,_=(_=v[0]-h[0])*_+(_=v[1]-h[1])*_;i=e(i,Math.sqrt(g/_)),o=[(l[0]+p[0])/2,(l[1]+p[1])/2],a=[(h[0]+v[0])/2,(h[1]+v[1])/2]}else{if(!c.touch0)return;o=c.touch0[0],a=c.touch0[1]}c.zoom("touch",y(r(i,o,a),c.extent,w))}function p(){var n,e,r=u(this,arguments),i=t.event.changedTouches,o=i.length;for(As(),v&&clearTimeout(v),v=setTimeout(function(){v=null},E),n=0;n<o;++n)e=i[n],r.touch0&&r.touch0[2]===e.identifier?delete r.touch0:r.touch1&&r.touch1[2]===e.identifier&&delete r.touch1;r.touch1&&!r.touch0&&(r.touch0=r.touch1,delete r.touch1),r.touch0?r.touch0[1]=this.__zoom.invert(r.touch0[0]):r.end()}var d,v,g=zs,_=Ps,y=Ds,m=Ls,x=qs,b=[0,1/0],w=[[-1/0,-1/0],[1/0,1/0]],M=250,T=vn,k=[],S=N("start","zoom","end"),E=500,A=150,C=0;return n.transform=function(t,n){var e=t.selection?t.selection():t;e.property("__zoom",Rs),t!==e?o(t,n):e.interrupt().each(function(){u(this,arguments).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()})},n.scaleBy=function(t,e){n.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)})},n.scaleTo=function(t,o){n.transform(t,function(){var t=_.apply(this,arguments),n=this.__zoom,u=i(t),a=n.invert(u),c="function"==typeof o?o.apply(this,arguments):o;return y(r(e(n,c),u,a),t,w)})},n.translateBy=function(t,e,r){n.transform(t,function(){return y(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof r?r.apply(this,arguments):r),_.apply(this,arguments),w)})},n.translateTo=function(t,e,r){n.transform(t,function(){var t=_.apply(this,arguments),n=this.__zoom,o=i(t);return y(Y_.translate(o[0],o[1]).scale(n.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof r?-r.apply(this,arguments):-r),t,w)})},a.prototype={start:function(){return 1==++this.active&&(this.index=k.push(this)-1,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(k.splice(this.index,1),this.index=-1,this.emit("end")),this},emit:function(t){it(new function(t,n,e){this.target=t,this.type=n,this.transform=e}(n,t,this.that.__zoom),S.apply,S,[t,this.that,this.args])}},n.wheelDelta=function(t){return arguments.length?(m="function"==typeof t?t:ks(+t),n):m},n.filter=function(t){return arguments.length?(g="function"==typeof t?t:ks(!!t),n):g},n.touchable=function(t){return arguments.length?(x="function"==typeof t?t:ks(!!t),n):x},n.extent=function(t){return arguments.length?(_="function"==typeof t?t:ks([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),n):_},n.scaleExtent=function(t){return arguments.length?(b[0]=+t[0],b[1]=+t[1],n):[b[0],b[1]]},n.translateExtent=function(t){return arguments.length?(w[0][0]=+t[0][0],w[1][0]=+t[1][0],w[0][1]=+t[0][1],w[1][1]=+t[1][1],n):[[w[0][0],w[0][1]],[w[1][0],w[1][1]]]},n.constrain=function(t){return arguments.length?(y=t,n):y},n.duration=function(t){return arguments.length?(M=+t,n):M},n.interpolate=function(t){return arguments.length?(T=t,n):T},n.on=function(){var t=S.on.apply(S,arguments);return t===S?n:t},n.clickDistance=function(t){return arguments.length?(C=(t=+t)*t,n):Math.sqrt(C)},n},t.zoomTransform=Es,t.zoomIdentity=Y_,Object.defineProperty(t,"__esModule",{value:!0})});
\ No newline at end of file
diff --git a/sourcecodes/scripts/dagre.js b/sourcecodes/scripts/dagre.js
new file mode 100644
index 00000000..830997be
--- /dev/null
+++ b/sourcecodes/scripts/dagre.js
@@ -0,0 +1,16396 @@
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.dagre=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+/*
+Copyright (c) 2012-2014 Chris Pettitt
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+module.exports = {
+  graphlib: require("./lib/graphlib"),
+
+  layout: require("./lib/layout"),
+  debug: require("./lib/debug"),
+  util: {
+    time: require("./lib/util").time,
+    notime: require("./lib/util").notime
+  },
+  version: require("./lib/version")
+};
+
+},{"./lib/debug":6,"./lib/graphlib":7,"./lib/layout":9,"./lib/util":29,"./lib/version":30}],2:[function(require,module,exports){
+"use strict";
+
+var _ = require("./lodash"),
+    greedyFAS = require("./greedy-fas");
+
+module.exports = {
+  run: run,
+  undo: undo
+};
+
+function run(g) {
+  var fas = (g.graph().acyclicer === "greedy"
+                ? greedyFAS(g, weightFn(g))
+                : dfsFAS(g));
+  _.each(fas, function(e) {
+    var label = g.edge(e);
+    g.removeEdge(e);
+    label.forwardName = e.name;
+    label.reversed = true;
+    g.setEdge(e.w, e.v, label, _.uniqueId("rev"));
+  });
+
+  function weightFn(g) {
+    return function(e) {
+      return g.edge(e).weight;
+    };
+  }
+}
+
+function dfsFAS(g) {
+  var fas = [],
+      stack = {},
+      visited = {};
+
+  function dfs(v) {
+    if (_.has(visited, v)) {
+      return;
+    }
+    visited[v] = true;
+    stack[v] = true;
+    _.each(g.outEdges(v), function(e) {
+      if (_.has(stack, e.w)) {
+        fas.push(e);
+      } else {
+        dfs(e.w);
+      }
+    });
+    delete stack[v];
+  }
+
+  _.each(g.nodes(), dfs);
+  return fas;
+}
+
+function undo(g) {
+  _.each(g.edges(), function(e) {
+    var label = g.edge(e);
+    if (label.reversed) {
+      g.removeEdge(e);
+
+      var forwardName = label.forwardName;
+      delete label.reversed;
+      delete label.forwardName;
+      g.setEdge(e.w, e.v, label, forwardName);
+    }
+  });
+}
+
+},{"./greedy-fas":8,"./lodash":10}],3:[function(require,module,exports){
+var _ = require("./lodash"),
+    util = require("./util");
+
+module.exports = addBorderSegments;
+
+function addBorderSegments(g) {
+  function dfs(v) {
+    var children = g.children(v),
+        node = g.node(v);
+    if (children.length) {
+      _.each(children, dfs);
+    }
+
+    if (_.has(node, "minRank")) {
+      node.borderLeft = [];
+      node.borderRight = [];
+      for (var rank = node.minRank, maxRank = node.maxRank + 1;
+           rank < maxRank;
+           ++rank) {
+        addBorderNode(g, "borderLeft", "_bl", v, node, rank);
+        addBorderNode(g, "borderRight", "_br", v, node, rank);
+      }
+    }
+  }
+
+  _.each(g.children(), dfs);
+}
+
+function addBorderNode(g, prop, prefix, sg, sgNode, rank) {
+  var label = { width: 0, height: 0, rank: rank, borderType: prop },
+      prev = sgNode[prop][rank - 1],
+      curr = util.addDummyNode(g, "border", label, prefix);
+  sgNode[prop][rank] = curr;
+  g.setParent(curr, sg);
+  if (prev) {
+    g.setEdge(prev, curr, { weight: 1 });
+  }
+}
+
+},{"./lodash":10,"./util":29}],4:[function(require,module,exports){
+"use strict";
+
+var _ = require("./lodash");
+
+module.exports = {
+  adjust: adjust,
+  undo: undo
+};
+
+function adjust(g) {
+  var rankDir = g.graph().rankdir.toLowerCase();
+  if (rankDir === "lr" || rankDir === "rl") {
+    swapWidthHeight(g);
+  }
+}
+
+function undo(g) {
+  var rankDir = g.graph().rankdir.toLowerCase();
+  if (rankDir === "bt" || rankDir === "rl") {
+    reverseY(g);
+  }
+
+  if (rankDir === "lr" || rankDir === "rl") {
+    swapXY(g);
+    swapWidthHeight(g);
+  }
+}
+
+function swapWidthHeight(g) {
+  _.each(g.nodes(), function(v) { swapWidthHeightOne(g.node(v)); });
+  _.each(g.edges(), function(e) { swapWidthHeightOne(g.edge(e)); });
+}
+
+function swapWidthHeightOne(attrs) {
+  var w = attrs.width;
+  attrs.width = attrs.height;
+  attrs.height = w;
+}
+
+function reverseY(g) {
+  _.each(g.nodes(), function(v) { reverseYOne(g.node(v)); });
+
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e);
+    _.each(edge.points, reverseYOne);
+    if (_.has(edge, "y")) {
+      reverseYOne(edge);
+    }
+  });
+}
+
+function reverseYOne(attrs) {
+  attrs.y = -attrs.y;
+}
+
+function swapXY(g) {
+  _.each(g.nodes(), function(v) { swapXYOne(g.node(v)); });
+
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e);
+    _.each(edge.points, swapXYOne);
+    if (_.has(edge, "x")) {
+      swapXYOne(edge);
+    }
+  });
+}
+
+function swapXYOne(attrs) {
+  var x = attrs.x;
+  attrs.x = attrs.y;
+  attrs.y = x;
+}
+
+},{"./lodash":10}],5:[function(require,module,exports){
+/*
+ * Simple doubly linked list implementation derived from Cormen, et al.,
+ * "Introduction to Algorithms".
+ */
+
+module.exports = List;
+
+function List() {
+  var sentinel = {};
+  sentinel._next = sentinel._prev = sentinel;
+  this._sentinel = sentinel;
+}
+
+List.prototype.dequeue = function() {
+  var sentinel = this._sentinel,
+      entry = sentinel._prev;
+  if (entry !== sentinel) {
+    unlink(entry);
+    return entry;
+  }
+};
+
+List.prototype.enqueue = function(entry) {
+  var sentinel = this._sentinel;
+  if (entry._prev && entry._next) {
+    unlink(entry);
+  }
+  entry._next = sentinel._next;
+  sentinel._next._prev = entry;
+  sentinel._next = entry;
+  entry._prev = sentinel;
+};
+
+List.prototype.toString = function() {
+  var strs = [],
+      sentinel = this._sentinel,
+      curr = sentinel._prev;
+  while (curr !== sentinel) {
+    strs.push(JSON.stringify(curr, filterOutLinks));
+    curr = curr._prev;
+  }
+  return "[" + strs.join(", ") + "]";
+};
+
+function unlink(entry) {
+  entry._prev._next = entry._next;
+  entry._next._prev = entry._prev;
+  delete entry._next;
+  delete entry._prev;
+}
+
+function filterOutLinks(k, v) {
+  if (k !== "_next" && k !== "_prev") {
+    return v;
+  }
+}
+
+},{}],6:[function(require,module,exports){
+var _ = require("./lodash"),
+    util = require("./util"),
+    Graph = require("./graphlib").Graph;
+
+module.exports = {
+  debugOrdering: debugOrdering
+};
+
+/* istanbul ignore next */
+function debugOrdering(g) {
+  var layerMatrix = util.buildLayerMatrix(g);
+
+  var h = new Graph({ compound: true, multigraph: true }).setGraph({});
+
+  _.each(g.nodes(), function(v) {
+    h.setNode(v, { label: v });
+    h.setParent(v, "layer" + g.node(v).rank);
+  });
+
+  _.each(g.edges(), function(e) {
+    h.setEdge(e.v, e.w, {}, e.name);
+  });
+
+  _.each(layerMatrix, function(layer, i) {
+    var layerV = "layer" + i;
+    h.setNode(layerV, { rank: "same" });
+    _.reduce(layer, function(u, v) {
+      h.setEdge(u, v, { style: "invis" });
+      return v;
+    });
+  });
+
+  return h;
+}
+
+},{"./graphlib":7,"./lodash":10,"./util":29}],7:[function(require,module,exports){
+/* global window */
+
+var graphlib;
+
+if (typeof require === "function") {
+  try {
+    graphlib = require("graphlib");
+  } catch (e) {}
+}
+
+if (!graphlib) {
+  graphlib = window.graphlib;
+}
+
+module.exports = graphlib;
+
+},{"graphlib":31}],8:[function(require,module,exports){
+var _ = require("./lodash"),
+    Graph = require("./graphlib").Graph,
+    List = require("./data/list");
+
+/*
+ * A greedy heuristic for finding a feedback arc set for a graph. A feedback
+ * arc set is a set of edges that can be removed to make a graph acyclic.
+ * The algorithm comes from: P. Eades, X. Lin, and W. F. Smyth, "A fast and
+ * effective heuristic for the feedback arc set problem." This implementation
+ * adjusts that from the paper to allow for weighted edges.
+ */
+module.exports = greedyFAS;
+
+var DEFAULT_WEIGHT_FN = _.constant(1);
+
+function greedyFAS(g, weightFn) {
+  if (g.nodeCount() <= 1) {
+    return [];
+  }
+  var state = buildState(g, weightFn || DEFAULT_WEIGHT_FN);
+  var results = doGreedyFAS(state.graph, state.buckets, state.zeroIdx);
+
+  // Expand multi-edges
+  return _.flatten(_.map(results, function(e) {
+    return g.outEdges(e.v, e.w);
+  }), true);
+}
+
+function doGreedyFAS(g, buckets, zeroIdx) {
+  var results = [],
+      sources = buckets[buckets.length - 1],
+      sinks = buckets[0];
+
+  var entry;
+  while (g.nodeCount()) {
+    while ((entry = sinks.dequeue()))   { removeNode(g, buckets, zeroIdx, entry); }
+    while ((entry = sources.dequeue())) { removeNode(g, buckets, zeroIdx, entry); }
+    if (g.nodeCount()) {
+      for (var i = buckets.length - 2; i > 0; --i) {
+        entry = buckets[i].dequeue();
+        if (entry) {
+          results = results.concat(removeNode(g, buckets, zeroIdx, entry, true));
+          break;
+        }
+      }
+    }
+  }
+
+  return results;
+}
+
+function removeNode(g, buckets, zeroIdx, entry, collectPredecessors) {
+  var results = collectPredecessors ? [] : undefined;
+
+  _.each(g.inEdges(entry.v), function(edge) {
+    var weight = g.edge(edge),
+        uEntry = g.node(edge.v);
+
+    if (collectPredecessors) {
+      results.push({ v: edge.v, w: edge.w });
+    }
+
+    uEntry.out -= weight;
+    assignBucket(buckets, zeroIdx, uEntry);
+  });
+
+  _.each(g.outEdges(entry.v), function(edge) {
+    var weight = g.edge(edge),
+        w = edge.w,
+        wEntry = g.node(w);
+    wEntry["in"] -= weight;
+    assignBucket(buckets, zeroIdx, wEntry);
+  });
+
+  g.removeNode(entry.v);
+
+  return results;
+}
+
+function buildState(g, weightFn) {
+  var fasGraph = new Graph(),
+      maxIn = 0,
+      maxOut = 0;
+
+  _.each(g.nodes(), function(v) {
+    fasGraph.setNode(v, { v: v, "in": 0, out: 0 });
+  });
+
+  // Aggregate weights on nodes, but also sum the weights across multi-edges
+  // into a single edge for the fasGraph.
+  _.each(g.edges(), function(e) {
+    var prevWeight = fasGraph.edge(e.v, e.w) || 0,
+        weight = weightFn(e),
+        edgeWeight = prevWeight + weight;
+    fasGraph.setEdge(e.v, e.w, edgeWeight);
+    maxOut = Math.max(maxOut, fasGraph.node(e.v).out += weight);
+    maxIn  = Math.max(maxIn,  fasGraph.node(e.w)["in"]  += weight);
+  });
+
+  var buckets = _.range(maxOut + maxIn + 3).map(function() { return new List(); });
+  var zeroIdx = maxIn + 1;
+
+  _.each(fasGraph.nodes(), function(v) {
+    assignBucket(buckets, zeroIdx, fasGraph.node(v));
+  });
+
+  return { graph: fasGraph, buckets: buckets, zeroIdx: zeroIdx };
+}
+
+function assignBucket(buckets, zeroIdx, entry) {
+  if (!entry.out) {
+    buckets[0].enqueue(entry);
+  } else if (!entry["in"]) {
+    buckets[buckets.length - 1].enqueue(entry);
+  } else {
+    buckets[entry.out - entry["in"] + zeroIdx].enqueue(entry);
+  }
+}
+
+},{"./data/list":5,"./graphlib":7,"./lodash":10}],9:[function(require,module,exports){
+"use strict";
+
+var _ = require("./lodash"),
+    acyclic = require("./acyclic"),
+    normalize = require("./normalize"),
+    rank = require("./rank"),
+    normalizeRanks = require("./util").normalizeRanks,
+    parentDummyChains = require("./parent-dummy-chains"),
+    removeEmptyRanks = require("./util").removeEmptyRanks,
+    nestingGraph = require("./nesting-graph"),
+    addBorderSegments = require("./add-border-segments"),
+    coordinateSystem = require("./coordinate-system"),
+    order = require("./order"),
+    position = require("./position"),
+    util = require("./util"),
+    Graph = require("./graphlib").Graph;
+
+module.exports = layout;
+
+function layout(g, opts) {
+  var time = opts && opts.debugTiming ? util.time : util.notime;
+  time("layout", function() {
+    var layoutGraph = time("  buildLayoutGraph",
+                               function() { return buildLayoutGraph(g); });
+    time("  runLayout",        function() { runLayout(layoutGraph, time); });
+    time("  updateInputGraph", function() { updateInputGraph(g, layoutGraph); });
+  });
+}
+
+function runLayout(g, time) {
+  time("    makeSpaceForEdgeLabels", function() { makeSpaceForEdgeLabels(g); });
+  time("    removeSelfEdges",        function() { removeSelfEdges(g); });
+  time("    acyclic",                function() { acyclic.run(g); });
+  time("    nestingGraph.run",       function() { nestingGraph.run(g); });
+  time("    rank",                   function() { rank(util.asNonCompoundGraph(g)); });
+  time("    injectEdgeLabelProxies", function() { injectEdgeLabelProxies(g); });
+  time("    removeEmptyRanks",       function() { removeEmptyRanks(g); });
+  time("    nestingGraph.cleanup",   function() { nestingGraph.cleanup(g); });
+  time("    normalizeRanks",         function() { normalizeRanks(g); });
+  time("    assignRankMinMax",       function() { assignRankMinMax(g); });
+  time("    removeEdgeLabelProxies", function() { removeEdgeLabelProxies(g); });
+  time("    normalize.run",          function() { normalize.run(g); });
+  time("    parentDummyChains",      function() { parentDummyChains(g); });
+  time("    addBorderSegments",      function() { addBorderSegments(g); });
+  time("    order",                  function() { order(g); });
+  time("    insertSelfEdges",        function() { insertSelfEdges(g); });
+  time("    adjustCoordinateSystem", function() { coordinateSystem.adjust(g); });
+  time("    position",               function() { position(g); });
+  time("    positionSelfEdges",      function() { positionSelfEdges(g); });
+  time("    removeBorderNodes",      function() { removeBorderNodes(g); });
+  time("    normalize.undo",         function() { normalize.undo(g); });
+  time("    fixupEdgeLabelCoords",   function() { fixupEdgeLabelCoords(g); });
+  time("    undoCoordinateSystem",   function() { coordinateSystem.undo(g); });
+  time("    translateGraph",         function() { translateGraph(g); });
+  time("    assignNodeIntersects",   function() { assignNodeIntersects(g); });
+  time("    reversePoints",          function() { reversePointsForReversedEdges(g); });
+  time("    acyclic.undo",           function() { acyclic.undo(g); });
+}
+
+/*
+ * Copies final layout information from the layout graph back to the input
+ * graph. This process only copies whitelisted attributes from the layout graph
+ * to the input graph, so it serves as a good place to determine what
+ * attributes can influence layout.
+ */
+function updateInputGraph(inputGraph, layoutGraph) {
+  _.each(inputGraph.nodes(), function(v) {
+    var inputLabel = inputGraph.node(v),
+        layoutLabel = layoutGraph.node(v);
+
+    if (inputLabel) {
+      inputLabel.x = layoutLabel.x;
+      inputLabel.y = layoutLabel.y;
+
+      if (layoutGraph.children(v).length) {
+        inputLabel.width = layoutLabel.width;
+        inputLabel.height = layoutLabel.height;
+      }
+    }
+  });
+
+  _.each(inputGraph.edges(), function(e) {
+    var inputLabel = inputGraph.edge(e),
+        layoutLabel = layoutGraph.edge(e);
+
+    inputLabel.points = layoutLabel.points;
+    if (_.has(layoutLabel, "x")) {
+      inputLabel.x = layoutLabel.x;
+      inputLabel.y = layoutLabel.y;
+    }
+  });
+
+  inputGraph.graph().width = layoutGraph.graph().width;
+  inputGraph.graph().height = layoutGraph.graph().height;
+}
+
+var graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"],
+    graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" },
+    graphAttrs = ["acyclicer", "ranker", "rankdir", "align"],
+    nodeNumAttrs = ["width", "height"],
+    nodeDefaults = { width: 0, height: 0 },
+    edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"],
+    edgeDefaults = {
+      minlen: 1, weight: 1, width: 0, height: 0,
+      labeloffset: 10, labelpos: "r"
+    },
+    edgeAttrs = ["labelpos"];
+
+/*
+ * Constructs a new graph from the input graph, which can be used for layout.
+ * This process copies only whitelisted attributes from the input graph to the
+ * layout graph. Thus this function serves as a good place to determine what
+ * attributes can influence layout.
+ */
+function buildLayoutGraph(inputGraph) {
+  var g = new Graph({ multigraph: true, compound: true }),
+      graph = canonicalize(inputGraph.graph());
+
+  g.setGraph(_.merge({},
+    graphDefaults,
+    selectNumberAttrs(graph, graphNumAttrs),
+    _.pick(graph, graphAttrs)));
+
+  _.each(inputGraph.nodes(), function(v) {
+    var node = canonicalize(inputGraph.node(v));
+    g.setNode(v, _.defaults(selectNumberAttrs(node, nodeNumAttrs), nodeDefaults));
+    g.setParent(v, inputGraph.parent(v));
+  });
+
+  _.each(inputGraph.edges(), function(e) {
+    var edge = canonicalize(inputGraph.edge(e));
+    g.setEdge(e, _.merge({},
+      edgeDefaults,
+      selectNumberAttrs(edge, edgeNumAttrs),
+      _.pick(edge, edgeAttrs)));
+  });
+
+  return g;
+}
+
+/*
+ * This idea comes from the Gansner paper: to account for edge labels in our
+ * layout we split each rank in half by doubling minlen and halving ranksep.
+ * Then we can place labels at these mid-points between nodes.
+ *
+ * We also add some minimal padding to the width to push the label for the edge
+ * away from the edge itself a bit.
+ */
+function makeSpaceForEdgeLabels(g) {
+  var graph = g.graph();
+  graph.ranksep /= 2;
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e);
+    edge.minlen *= 2;
+    if (edge.labelpos.toLowerCase() !== "c") {
+      if (graph.rankdir === "TB" || graph.rankdir === "BT") {
+        edge.width += edge.labeloffset;
+      } else {
+        edge.height += edge.labeloffset;
+      }
+    }
+  });
+}
+
+/*
+ * Creates temporary dummy nodes that capture the rank in which each edge's
+ * label is going to, if it has one of non-zero width and height. We do this
+ * so that we can safely remove empty ranks while preserving balance for the
+ * label's position.
+ */
+function injectEdgeLabelProxies(g) {
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e);
+    if (edge.width && edge.height) {
+      var v = g.node(e.v),
+          w = g.node(e.w),
+          label = { rank: (w.rank - v.rank) / 2 + v.rank, e: e };
+      util.addDummyNode(g, "edge-proxy", label, "_ep");
+    }
+  });
+}
+
+function assignRankMinMax(g) {
+  var maxRank = 0;
+  _.each(g.nodes(), function(v) {
+    var node = g.node(v);
+    if (node.borderTop) {
+      node.minRank = g.node(node.borderTop).rank;
+      node.maxRank = g.node(node.borderBottom).rank;
+      maxRank = _.max(maxRank, node.maxRank);
+    }
+  });
+  g.graph().maxRank = maxRank;
+}
+
+function removeEdgeLabelProxies(g) {
+  _.each(g.nodes(), function(v) {
+    var node = g.node(v);
+    if (node.dummy === "edge-proxy") {
+      g.edge(node.e).labelRank = node.rank;
+      g.removeNode(v);
+    }
+  });
+}
+
+function translateGraph(g) {
+  var minX = Number.POSITIVE_INFINITY,
+      maxX = 0,
+      minY = Number.POSITIVE_INFINITY,
+      maxY = 0,
+      graphLabel = g.graph(),
+      marginX = graphLabel.marginx || 0,
+      marginY = graphLabel.marginy || 0;
+
+  function getExtremes(attrs) {
+    var x = attrs.x,
+        y = attrs.y,
+        w = attrs.width,
+        h = attrs.height;
+    minX = Math.min(minX, x - w / 2);
+    maxX = Math.max(maxX, x + w / 2);
+    minY = Math.min(minY, y - h / 2);
+    maxY = Math.max(maxY, y + h / 2);
+  }
+
+  _.each(g.nodes(), function(v) { getExtremes(g.node(v)); });
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e);
+    if (_.has(edge, "x")) {
+      getExtremes(edge);
+    }
+  });
+
+  minX -= marginX;
+  minY -= marginY;
+
+  _.each(g.nodes(), function(v) {
+    var node = g.node(v);
+    node.x -= minX;
+    node.y -= minY;
+  });
+
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e);
+    _.each(edge.points, function(p) {
+      p.x -= minX;
+      p.y -= minY;
+    });
+    if (_.has(edge, "x")) { edge.x -= minX; }
+    if (_.has(edge, "y")) { edge.y -= minY; }
+  });
+
+  graphLabel.width = maxX - minX + marginX;
+  graphLabel.height = maxY - minY + marginY;
+}
+
+function assignNodeIntersects(g) {
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e),
+        nodeV = g.node(e.v),
+        nodeW = g.node(e.w),
+        p1, p2;
+    if (!edge.points) {
+      edge.points = [];
+      p1 = nodeW;
+      p2 = nodeV;
+    } else {
+      p1 = edge.points[0];
+      p2 = edge.points[edge.points.length - 1];
+    }
+    edge.points.unshift(util.intersectRect(nodeV, p1));
+    edge.points.push(util.intersectRect(nodeW, p2));
+  });
+}
+
+function fixupEdgeLabelCoords(g) {
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e);
+    if (_.has(edge, "x")) {
+      if (edge.labelpos === "l" || edge.labelpos === "r") {
+        edge.width -= edge.labeloffset;
+      }
+      switch (edge.labelpos) {
+        case "l": edge.x -= edge.width / 2 + edge.labeloffset; break;
+        case "r": edge.x += edge.width / 2 + edge.labeloffset; break;
+      }
+    }
+  });
+}
+
+function reversePointsForReversedEdges(g) {
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e);
+    if (edge.reversed) {
+      edge.points.reverse();
+    }
+  });
+}
+
+function removeBorderNodes(g) {
+  _.each(g.nodes(), function(v) {
+    if (g.children(v).length) {
+      var node = g.node(v),
+          t = g.node(node.borderTop),
+          b = g.node(node.borderBottom),
+          l = g.node(_.last(node.borderLeft)),
+          r = g.node(_.last(node.borderRight));
+
+      node.width = Math.abs(r.x - l.x);
+      node.height = Math.abs(b.y - t.y);
+      node.x = l.x + node.width / 2;
+      node.y = t.y + node.height / 2;
+    }
+  });
+
+  _.each(g.nodes(), function(v) {
+    if (g.node(v).dummy === "border") {
+      g.removeNode(v);
+    }
+  });
+}
+
+function removeSelfEdges(g) {
+  _.each(g.edges(), function(e) {
+    if (e.v === e.w) {
+      var node = g.node(e.v);
+      if (!node.selfEdges) {
+        node.selfEdges = [];
+      }
+      node.selfEdges.push({ e: e, label: g.edge(e) });
+      g.removeEdge(e);
+    }
+  });
+}
+
+function insertSelfEdges(g) {
+  var layers = util.buildLayerMatrix(g);
+  _.each(layers, function(layer) {
+    var orderShift = 0;
+    _.each(layer, function(v, i) {
+      var node = g.node(v);
+      node.order = i + orderShift;
+      _.each(node.selfEdges, function(selfEdge) {
+        util.addDummyNode(g, "selfedge", {
+          width: selfEdge.label.width,
+          height: selfEdge.label.height,
+          rank: node.rank,
+          order: i + (++orderShift),
+          e: selfEdge.e,
+          label: selfEdge.label
+        }, "_se");
+      });
+      delete node.selfEdges;
+    });
+  });
+}
+
+function positionSelfEdges(g) {
+  _.each(g.nodes(), function(v) {
+    var node = g.node(v);
+    if (node.dummy === "selfedge") {
+      var selfNode = g.node(node.e.v),
+          x = selfNode.x + selfNode.width / 2,
+          y = selfNode.y,
+          dx = node.x - x,
+          dy = selfNode.height / 2;
+      g.setEdge(node.e, node.label);
+      g.removeNode(v);
+      node.label.points = [
+        { x: x + 2 * dx / 3, y: y - dy },
+        { x: x + 5 * dx / 6, y: y - dy },
+        { x: x +     dx    , y: y },
+        { x: x + 5 * dx / 6, y: y + dy },
+        { x: x + 2 * dx / 3, y: y + dy },
+      ];
+      node.label.x = node.x;
+      node.label.y = node.y;
+    }
+  });
+}
+
+function selectNumberAttrs(obj, attrs) {
+  return _.mapValues(_.pick(obj, attrs), Number);
+}
+
+function canonicalize(attrs) {
+  var newAttrs = {};
+  _.each(attrs, function(v, k) {
+    newAttrs[k.toLowerCase()] = v;
+  });
+  return newAttrs;
+}
+
+},{"./acyclic":2,"./add-border-segments":3,"./coordinate-system":4,"./graphlib":7,"./lodash":10,"./nesting-graph":11,"./normalize":12,"./order":17,"./parent-dummy-chains":22,"./position":24,"./rank":26,"./util":29}],10:[function(require,module,exports){
+/* global window */
+
+var lodash;
+
+if (typeof require === "function") {
+  try {
+    lodash = require("lodash");
+  } catch (e) {}
+}
+
+if (!lodash) {
+  lodash = window._;
+}
+
+module.exports = lodash;
+
+},{"lodash":51}],11:[function(require,module,exports){
+var _ = require("./lodash"),
+    util = require("./util");
+
+module.exports = {
+  run: run,
+  cleanup: cleanup
+};
+
+/*
+ * A nesting graph creates dummy nodes for the tops and bottoms of subgraphs,
+ * adds appropriate edges to ensure that all cluster nodes are placed between
+ * these boundries, and ensures that the graph is connected.
+ *
+ * In addition we ensure, through the use of the minlen property, that nodes
+ * and subgraph border nodes to not end up on the same rank.
+ *
+ * Preconditions:
+ *
+ *    1. Input graph is a DAG
+ *    2. Nodes in the input graph has a minlen attribute
+ *
+ * Postconditions:
+ *
+ *    1. Input graph is connected.
+ *    2. Dummy nodes are added for the tops and bottoms of subgraphs.
+ *    3. The minlen attribute for nodes is adjusted to ensure nodes do not
+ *       get placed on the same rank as subgraph border nodes.
+ *
+ * The nesting graph idea comes from Sander, "Layout of Compound Directed
+ * Graphs."
+ */
+function run(g) {
+  var root = util.addDummyNode(g, "root", {}, "_root"),
+      depths = treeDepths(g),
+      height = _.max(depths) - 1,
+      nodeSep = 2 * height + 1;
+
+  g.graph().nestingRoot = root;
+
+  // Multiply minlen by nodeSep to align nodes on non-border ranks.
+  _.each(g.edges(), function(e) { g.edge(e).minlen *= nodeSep; });
+
+  // Calculate a weight that is sufficient to keep subgraphs vertically compact
+  var weight = sumWeights(g) + 1;
+
+  // Create border nodes and link them up
+  _.each(g.children(), function(child) {
+    dfs(g, root, nodeSep, weight, height, depths, child);
+  });
+
+  // Save the multiplier for node layers for later removal of empty border
+  // layers.
+  g.graph().nodeRankFactor = nodeSep;
+}
+
+function dfs(g, root, nodeSep, weight, height, depths, v) {
+  var children = g.children(v);
+  if (!children.length) {
+    if (v !== root) {
+      g.setEdge(root, v, { weight: 0, minlen: nodeSep });
+    }
+    return;
+  }
+
+  var top = util.addBorderNode(g, "_bt"),
+      bottom = util.addBorderNode(g, "_bb"),
+      label = g.node(v);
+
+  g.setParent(top, v);
+  label.borderTop = top;
+  g.setParent(bottom, v);
+  label.borderBottom = bottom;
+
+  _.each(children, function(child) {
+    dfs(g, root, nodeSep, weight, height, depths, child);
+
+    var childNode = g.node(child),
+        childTop = childNode.borderTop ? childNode.borderTop : child,
+        childBottom = childNode.borderBottom ? childNode.borderBottom : child,
+        thisWeight = childNode.borderTop ? weight : 2 * weight,
+        minlen = childTop !== childBottom ? 1 : height - depths[v] + 1;
+
+    g.setEdge(top, childTop, {
+      weight: thisWeight,
+      minlen: minlen,
+      nestingEdge: true
+    });
+
+    g.setEdge(childBottom, bottom, {
+      weight: thisWeight,
+      minlen: minlen,
+      nestingEdge: true
+    });
+  });
+
+  if (!g.parent(v)) {
+    g.setEdge(root, top, { weight: 0, minlen: height + depths[v] });
+  }
+}
+
+function treeDepths(g) {
+  var depths = {};
+  function dfs(v, depth) {
+    var children = g.children(v);
+    if (children && children.length) {
+      _.each(children, function(child) {
+        dfs(child, depth + 1);
+      });
+    }
+    depths[v] = depth;
+  }
+  _.each(g.children(), function(v) { dfs(v, 1); });
+  return depths;
+}
+
+function sumWeights(g) {
+  return _.reduce(g.edges(), function(acc, e) {
+    return acc + g.edge(e).weight;
+  }, 0);
+}
+
+function cleanup(g) {
+  var graphLabel = g.graph();
+  g.removeNode(graphLabel.nestingRoot);
+  delete graphLabel.nestingRoot;
+  _.each(g.edges(), function(e) {
+    var edge = g.edge(e);
+    if (edge.nestingEdge) {
+      g.removeEdge(e);
+    }
+  });
+}
+
+},{"./lodash":10,"./util":29}],12:[function(require,module,exports){
+"use strict";
+
+var _ = require("./lodash"),
+    util = require("./util");
+
+module.exports = {
+  run: run,
+  undo: undo
+};
+
+/*
+ * Breaks any long edges in the graph into short segments that span 1 layer
+ * each. This operation is undoable with the denormalize function.
+ *
+ * Pre-conditions:
+ *
+ *    1. The input graph is a DAG.
+ *    2. Each node in the graph has a "rank" property.
+ *
+ * Post-condition:
+ *
+ *    1. All edges in the graph have a length of 1.
+ *    2. Dummy nodes are added where edges have been split into segments.
+ *    3. The graph is augmented with a "dummyChains" attribute which contains
+ *       the first dummy in each chain of dummy nodes produced.
+ */
+function run(g) {
+  g.graph().dummyChains = [];
+  _.each(g.edges(), function(edge) { normalizeEdge(g, edge); });
+}
+
+function normalizeEdge(g, e) {
+  var v = e.v,
+      vRank = g.node(v).rank,
+      w = e.w,
+      wRank = g.node(w).rank,
+      name = e.name,
+      edgeLabel = g.edge(e),
+      labelRank = edgeLabel.labelRank;
+
+  if (wRank === vRank + 1) return;
+
+  g.removeEdge(e);
+
+  var dummy, attrs, i;
+  for (i = 0, ++vRank; vRank < wRank; ++i, ++vRank) {
+    edgeLabel.points = [];
+    attrs = {
+      width: 0, height: 0,
+      edgeLabel: edgeLabel, edgeObj: e,
+      rank: vRank
+    };
+    dummy = util.addDummyNode(g, "edge", attrs, "_d");
+    if (vRank === labelRank) {
+      attrs.width = edgeLabel.width;
+      attrs.height = edgeLabel.height;
+      attrs.dummy = "edge-label";
+      attrs.labelpos = edgeLabel.labelpos;
+    }
+    g.setEdge(v, dummy, { weight: edgeLabel.weight }, name);
+    if (i === 0) {
+      g.graph().dummyChains.push(dummy);
+    }
+    v = dummy;
+  }
+
+  g.setEdge(v, w, { weight: edgeLabel.weight }, name);
+}
+
+function undo(g) {
+  _.each(g.graph().dummyChains, function(v) {
+    var node = g.node(v),
+        origLabel = node.edgeLabel,
+        w;
+    g.setEdge(node.edgeObj, origLabel);
+    while (node.dummy) {
+      w = g.successors(v)[0];
+      g.removeNode(v);
+      origLabel.points.push({ x: node.x, y: node.y });
+      if (node.dummy === "edge-label") {
+        origLabel.x = node.x;
+        origLabel.y = node.y;
+        origLabel.width = node.width;
+        origLabel.height = node.height;
+      }
+      v = w;
+      node = g.node(v);
+    }
+  });
+}
+
+},{"./lodash":10,"./util":29}],13:[function(require,module,exports){
+var _ = require("../lodash");
+
+module.exports = addSubgraphConstraints;
+
+function addSubgraphConstraints(g, cg, vs) {
+  var prev = {},
+      rootPrev;
+
+  _.each(vs, function(v) {
+    var child = g.parent(v),
+        parent,
+        prevChild;
+    while (child) {
+      parent = g.parent(child);
+      if (parent) {
+        prevChild = prev[parent];
+        prev[parent] = child;
+      } else {
+        prevChild = rootPrev;
+        rootPrev = child;
+      }
+      if (prevChild && prevChild !== child) {
+        cg.setEdge(prevChild, child);
+        return;
+      }
+      child = parent;
+    }
+  });
+
+  /*
+  function dfs(v) {
+    var children = v ? g.children(v) : g.children();
+    if (children.length) {
+      var min = Number.POSITIVE_INFINITY,
+          subgraphs = [];
+      _.each(children, function(child) {
+        var childMin = dfs(child);
+        if (g.children(child).length) {
+          subgraphs.push({ v: child, order: childMin });
+        }
+        min = Math.min(min, childMin);
+      });
+      _.reduce(_.sortBy(subgraphs, "order"), function(prev, curr) {
+        cg.setEdge(prev.v, curr.v);
+        return curr;
+      });
+      return min;
+    }
+    return g.node(v).order;
+  }
+  dfs(undefined);
+  */
+}
+
+},{"../lodash":10}],14:[function(require,module,exports){
+var _ = require("../lodash");
+
+module.exports = barycenter;
+
+function barycenter(g, movable) {
+  return _.map(movable, function(v) {
+    var inV = g.inEdges(v);
+    if (!inV.length) {
+      return { v: v };
+    } else {
+      var result = _.reduce(inV, function(acc, e) {
+        var edge = g.edge(e),
+            nodeU = g.node(e.v);
+        return {
+          sum: acc.sum + (edge.weight * nodeU.order),
+          weight: acc.weight + edge.weight
+        };
+      }, { sum: 0, weight: 0 });
+
+      return {
+        v: v,
+        barycenter: result.sum / result.weight,
+        weight: result.weight
+      };
+    }
+  });
+}
+
+
+},{"../lodash":10}],15:[function(require,module,exports){
+var _ = require("../lodash"),
+    Graph = require("../graphlib").Graph;
+
+module.exports = buildLayerGraph;
+
+/*
+ * Constructs a graph that can be used to sort a layer of nodes. The graph will
+ * contain all base and subgraph nodes from the request layer in their original
+ * hierarchy and any edges that are incident on these nodes and are of the type
+ * requested by the "relationship" parameter.
+ *
+ * Nodes from the requested rank that do not have parents are assigned a root
+ * node in the output graph, which is set in the root graph attribute. This
+ * makes it easy to walk the hierarchy of movable nodes during ordering.
+ *
+ * Pre-conditions:
+ *
+ *    1. Input graph is a DAG
+ *    2. Base nodes in the input graph have a rank attribute
+ *    3. Subgraph nodes in the input graph has minRank and maxRank attributes
+ *    4. Edges have an assigned weight
+ *
+ * Post-conditions:
+ *
+ *    1. Output graph has all nodes in the movable rank with preserved
+ *       hierarchy.
+ *    2. Root nodes in the movable layer are made children of the node
+ *       indicated by the root attribute of the graph.
+ *    3. Non-movable nodes incident on movable nodes, selected by the
+ *       relationship parameter, are included in the graph (without hierarchy).
+ *    4. Edges incident on movable nodes, selected by the relationship
+ *       parameter, are added to the output graph.
+ *    5. The weights for copied edges are aggregated as need, since the output
+ *       graph is not a multi-graph.
+ */
+function buildLayerGraph(g, rank, relationship) {
+  var root = createRootNode(g),
+      result = new Graph({ compound: true }).setGraph({ root: root })
+                  .setDefaultNodeLabel(function(v) { return g.node(v); });
+
+  _.each(g.nodes(), function(v) {
+    var node = g.node(v),
+        parent = g.parent(v);
+
+    if (node.rank === rank || node.minRank <= rank && rank <= node.maxRank) {
+      result.setNode(v);
+      result.setParent(v, parent || root);
+
+      // This assumes we have only short edges!
+      _.each(g[relationship](v), function(e) {
+        var u = e.v === v ? e.w : e.v,
+            edge = result.edge(u, v),
+            weight = !_.isUndefined(edge) ? edge.weight : 0;
+        result.setEdge(u, v, { weight: g.edge(e).weight + weight });
+      });
+
+      if (_.has(node, "minRank")) {
+        result.setNode(v, {
+          borderLeft: node.borderLeft[rank],
+          borderRight: node.borderRight[rank]
+        });
+      }
+    }
+  });
+
+  return result;
+}
+
+function createRootNode(g) {
+  var v;
+  while (g.hasNode((v = _.uniqueId("_root"))));
+  return v;
+}
+
+},{"../graphlib":7,"../lodash":10}],16:[function(require,module,exports){
+"use strict";
+
+var _ = require("../lodash");
+
+module.exports = crossCount;
+
+/*
+ * A function that takes a layering (an array of layers, each with an array of
+ * ordererd nodes) and a graph and returns a weighted crossing count.
+ *
+ * Pre-conditions:
+ *
+ *    1. Input graph must be simple (not a multigraph), directed, and include
+ *       only simple edges.
+ *    2. Edges in the input graph must have assigned weights.
+ *
+ * Post-conditions:
+ *
+ *    1. The graph and layering matrix are left unchanged.
+ *
+ * This algorithm is derived from Barth, et al., "Bilayer Cross Counting."
+ */
+function crossCount(g, layering) {
+  var cc = 0;
+  for (var i = 1; i < layering.length; ++i) {
+    cc += twoLayerCrossCount(g, layering[i-1], layering[i]);
+  }
+  return cc;
+}
+
+function twoLayerCrossCount(g, northLayer, southLayer) {
+  // Sort all of the edges between the north and south layers by their position
+  // in the north layer and then the south. Map these edges to the position of
+  // their head in the south layer.
+  var southPos = _.zipObject(southLayer,
+                             _.map(southLayer, function (v, i) { return i; }));
+  var southEntries = _.flatten(_.map(northLayer, function(v) {
+    return _.chain(g.outEdges(v))
+            .map(function(e) {
+              return { pos: southPos[e.w], weight: g.edge(e).weight };
+            })
+            .sortBy("pos")
+            .value();
+  }), true);
+
+  // Build the accumulator tree
+  var firstIndex = 1;
+  while (firstIndex < southLayer.length) firstIndex <<= 1;
+  var treeSize = 2 * firstIndex - 1;
+  firstIndex -= 1;
+  var tree = _.map(new Array(treeSize), function() { return 0; });
+
+  // Calculate the weighted crossings
+  var cc = 0;
+  _.each(southEntries.forEach(function(entry) {
+    var index = entry.pos + firstIndex;
+    tree[index] += entry.weight;
+    var weightSum = 0;
+    while (index > 0) {
+      if (index % 2) {
+        weightSum += tree[index + 1];
+      }
+      index = (index - 1) >> 1;
+      tree[index] += entry.weight;
+    }
+    cc += entry.weight * weightSum;
+  }));
+
+  return cc;
+}
+
+},{"../lodash":10}],17:[function(require,module,exports){
+"use strict";
+
+var _ = require("../lodash"),
+    initOrder = require("./init-order"),
+    crossCount = require("./cross-count"),
+    sortSubgraph = require("./sort-subgraph"),
+    buildLayerGraph = require("./build-layer-graph"),
+    addSubgraphConstraints = require("./add-subgraph-constraints"),
+    Graph = require("../graphlib").Graph,
+    util = require("../util");
+
+module.exports = order;
+
+/*
+ * Applies heuristics to minimize edge crossings in the graph and sets the best
+ * order solution as an order attribute on each node.
+ *
+ * Pre-conditions:
+ *
+ *    1. Graph must be DAG
+ *    2. Graph nodes must be objects with a "rank" attribute
+ *    3. Graph edges must have the "weight" attribute
+ *
+ * Post-conditions:
+ *
+ *    1. Graph nodes will have an "order" attribute based on the results of the
+ *       algorithm.
+ */
+function order(g) {
+  var maxRank = util.maxRank(g),
+      downLayerGraphs = buildLayerGraphs(g, _.range(1, maxRank + 1), "inEdges"),
+      upLayerGraphs = buildLayerGraphs(g, _.range(maxRank - 1, -1, -1), "outEdges");
+
+  var layering = initOrder(g);
+  assignOrder(g, layering);
+
+  var bestCC = Number.POSITIVE_INFINITY,
+      best;
+
+  for (var i = 0, lastBest = 0; lastBest < 4; ++i, ++lastBest) {
+    sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2);
+
+    layering = util.buildLayerMatrix(g);
+    var cc = crossCount(g, layering);
+    if (cc < bestCC) {
+      lastBest = 0;
+      best = _.cloneDeep(layering);
+      bestCC = cc;
+    }
+  }
+
+  assignOrder(g, best);
+}
+
+function buildLayerGraphs(g, ranks, relationship) {
+  return _.map(ranks, function(rank) {
+    return buildLayerGraph(g, rank, relationship);
+  });
+}
+
+function sweepLayerGraphs(layerGraphs, biasRight) {
+  var cg = new Graph();
+  _.each(layerGraphs, function(lg) {
+    var root = lg.graph().root;
+    var sorted = sortSubgraph(lg, root, cg, biasRight);
+    _.each(sorted.vs, function(v, i) {
+      lg.node(v).order = i;
+    });
+    addSubgraphConstraints(lg, cg, sorted.vs);
+  });
+}
+
+function assignOrder(g, layering) {
+  _.each(layering, function(layer) {
+    _.each(layer, function(v, i) {
+      g.node(v).order = i;
+    });
+  });
+}
+
+},{"../graphlib":7,"../lodash":10,"../util":29,"./add-subgraph-constraints":13,"./build-layer-graph":15,"./cross-count":16,"./init-order":18,"./sort-subgraph":20}],18:[function(require,module,exports){
+"use strict";
+
+var _ = require("../lodash");
+
+module.exports = initOrder;
+
+/*
+ * Assigns an initial order value for each node by performing a DFS search
+ * starting from nodes in the first rank. Nodes are assigned an order in their
+ * rank as they are first visited.
+ *
+ * This approach comes from Gansner, et al., "A Technique for Drawing Directed
+ * Graphs."
+ *
+ * Returns a layering matrix with an array per layer and each layer sorted by
+ * the order of its nodes.
+ */
+function initOrder(g) {
+  var visited = {},
+      simpleNodes = _.filter(g.nodes(), function(v) {
+        return !g.children(v).length;
+      }),
+      maxRank = _.max(_.map(simpleNodes, function(v) { return g.node(v).rank; })),
+      layers = _.map(_.range(maxRank + 1), function() { return []; });
+
+  function dfs(v) {
+    if (_.has(visited, v)) return;
+    visited[v] = true;
+    var node = g.node(v);
+    layers[node.rank].push(v);
+    _.each(g.successors(v), dfs);
+  }
+
+  var orderedVs = _.sortBy(simpleNodes, function(v) { return g.node(v).rank; });
+  _.each(orderedVs, dfs);
+
+  return layers;
+}
+
+},{"../lodash":10}],19:[function(require,module,exports){
+"use strict";
+
+var _ = require("../lodash");
+
+module.exports = resolveConflicts;
+
+/*
+ * Given a list of entries of the form {v, barycenter, weight} and a
+ * constraint graph this function will resolve any conflicts between the
+ * constraint graph and the barycenters for the entries. If the barycenters for
+ * an entry would violate a constraint in the constraint graph then we coalesce
+ * the nodes in the conflict into a new node that respects the contraint and
+ * aggregates barycenter and weight information.
+ *
+ * This implementation is based on the description in Forster, "A Fast and
+ * Simple Hueristic for Constrained Two-Level Crossing Reduction," thought it
+ * differs in some specific details.
+ *
+ * Pre-conditions:
+ *
+ *    1. Each entry has the form {v, barycenter, weight}, or if the node has
+ *       no barycenter, then {v}.
+ *
+ * Returns:
+ *
+ *    A new list of entries of the form {vs, i, barycenter, weight}. The list
+ *    `vs` may either be a singleton or it may be an aggregation of nodes
+ *    ordered such that they do not violate constraints from the constraint
+ *    graph. The property `i` is the lowest original index of any of the
+ *    elements in `vs`.
+ */
+function resolveConflicts(entries, cg) {
+  var mappedEntries = {};
+  _.each(entries, function(entry, i) {
+    var tmp = mappedEntries[entry.v] = {
+      indegree: 0,
+      "in": [],
+      out: [],
+      vs: [entry.v],
+      i: i
+    };
+    if (!_.isUndefined(entry.barycenter)) {
+      tmp.barycenter = entry.barycenter;
+      tmp.weight = entry.weight;
+    }
+  });
+
+  _.each(cg.edges(), function(e) {
+    var entryV = mappedEntries[e.v],
+        entryW = mappedEntries[e.w];
+    if (!_.isUndefined(entryV) && !_.isUndefined(entryW)) {
+      entryW.indegree++;
+      entryV.out.push(mappedEntries[e.w]);
+    }
+  });
+
+  var sourceSet = _.filter(mappedEntries, function(entry) {
+    return !entry.indegree;
+  });
+
+  return doResolveConflicts(sourceSet);
+}
+
+function doResolveConflicts(sourceSet) {
+  var entries = [];
+
+  function handleIn(vEntry) {
+    return function(uEntry) {
+      if (uEntry.merged) {
+        return;
+      }
+      if (_.isUndefined(uEntry.barycenter) ||
+          _.isUndefined(vEntry.barycenter) ||
+          uEntry.barycenter >= vEntry.barycenter) {
+        mergeEntries(vEntry, uEntry);
+      }
+    };
+  }
+
+  function handleOut(vEntry) {
+    return function(wEntry) {
+      wEntry["in"].push(vEntry);
+      if (--wEntry.indegree === 0) {
+        sourceSet.push(wEntry);
+      }
+    };
+  }
+
+  while (sourceSet.length) {
+    var entry = sourceSet.pop();
+    entries.push(entry);
+    _.each(entry["in"].reverse(), handleIn(entry));
+    _.each(entry.out, handleOut(entry));
+  }
+
+  return _.chain(entries)
+          .filter(function(entry) { return !entry.merged; })
+          .map(function(entry) {
+            return _.pick(entry, ["vs", "i", "barycenter", "weight"]);
+          })
+          .value();
+}
+
+function mergeEntries(target, source) {
+  var sum = 0,
+      weight = 0;
+
+  if (target.weight) {
+    sum += target.barycenter * target.weight;
+    weight += target.weight;
+  }
+
+  if (source.weight) {
+    sum += source.barycenter * source.weight;
+    weight += source.weight;
+  }
+
+  target.vs = source.vs.concat(target.vs);
+  target.barycenter = sum / weight;
+  target.weight = weight;
+  target.i = Math.min(source.i, target.i);
+  source.merged = true;
+}
+
+},{"../lodash":10}],20:[function(require,module,exports){
+var _ = require("../lodash"),
+    barycenter = require("./barycenter"),
+    resolveConflicts = require("./resolve-conflicts"),
+    sort = require("./sort");
+
+module.exports = sortSubgraph;
+
+function sortSubgraph(g, v, cg, biasRight) {
+  var movable = g.children(v),
+      node = g.node(v),
+      bl = node ? node.borderLeft : undefined,
+      br = node ? node.borderRight: undefined,
+      subgraphs = {};
+
+  if (bl) {
+    movable = _.filter(movable, function(w) {
+      return w !== bl && w !== br;
+    });
+  }
+
+  var barycenters = barycenter(g, movable);
+  _.each(barycenters, function(entry) {
+    if (g.children(entry.v).length) {
+      var subgraphResult = sortSubgraph(g, entry.v, cg, biasRight);
+      subgraphs[entry.v] = subgraphResult;
+      if (_.has(subgraphResult, "barycenter")) {
+        mergeBarycenters(entry, subgraphResult);
+      }
+    }
+  });
+
+  var entries = resolveConflicts(barycenters, cg);
+  expandSubgraphs(entries, subgraphs);
+
+  var result = sort(entries, biasRight);
+
+  if (bl) {
+    result.vs = _.flatten([bl, result.vs, br], true);
+    if (g.predecessors(bl).length) {
+      var blPred = g.node(g.predecessors(bl)[0]),
+          brPred = g.node(g.predecessors(br)[0]);
+      if (!_.has(result, "barycenter")) {
+        result.barycenter = 0;
+        result.weight = 0;
+      }
+      result.barycenter = (result.barycenter * result.weight +
+                           blPred.order + brPred.order) / (result.weight + 2);
+      result.weight += 2;
+    }
+  }
+
+  return result;
+}
+
+function expandSubgraphs(entries, subgraphs) {
+  _.each(entries, function(entry) {
+    entry.vs = _.flatten(entry.vs.map(function(v) {
+      if (subgraphs[v]) {
+        return subgraphs[v].vs;
+      }
+      return v;
+    }), true);
+  });
+}
+
+function mergeBarycenters(target, other) {
+  if (!_.isUndefined(target.barycenter)) {
+    target.barycenter = (target.barycenter * target.weight +
+                         other.barycenter * other.weight) /
+                        (target.weight + other.weight);
+    target.weight += other.weight;
+  } else {
+    target.barycenter = other.barycenter;
+    target.weight = other.weight;
+  }
+}
+
+},{"../lodash":10,"./barycenter":14,"./resolve-conflicts":19,"./sort":21}],21:[function(require,module,exports){
+var _ = require("../lodash"),
+    util = require("../util");
+
+module.exports = sort;
+
+function sort(entries, biasRight) {
+  var parts = util.partition(entries, function(entry) {
+    return _.has(entry, "barycenter");
+  });
+  var sortable = parts.lhs,
+      unsortable = _.sortBy(parts.rhs, function(entry) { return -entry.i; }),
+      vs = [],
+      sum = 0,
+      weight = 0,
+      vsIndex = 0;
+
+  sortable.sort(compareWithBias(!!biasRight));
+
+  vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
+
+  _.each(sortable, function (entry) {
+    vsIndex += entry.vs.length;
+    vs.push(entry.vs);
+    sum += entry.barycenter * entry.weight;
+    weight += entry.weight;
+    vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
+  });
+
+  var result = { vs: _.flatten(vs, true) };
+  if (weight) {
+    result.barycenter = sum / weight;
+    result.weight = weight;
+  }
+  return result;
+}
+
+function consumeUnsortable(vs, unsortable, index) {
+  var last;
+  while (unsortable.length && (last = _.last(unsortable)).i <= index) {
+    unsortable.pop();
+    vs.push(last.vs);
+    index++;
+  }
+  return index;
+}
+
+function compareWithBias(bias) {
+  return function(entryV, entryW) {
+    if (entryV.barycenter < entryW.barycenter) {
+      return -1;
+    } else if (entryV.barycenter > entryW.barycenter) {
+      return 1;
+    }
+
+    return !bias ? entryV.i - entryW.i : entryW.i - entryV.i;
+  };
+}
+
+},{"../lodash":10,"../util":29}],22:[function(require,module,exports){
+var _ = require("./lodash");
+
+module.exports = parentDummyChains;
+
+function parentDummyChains(g) {
+  var postorderNums = postorder(g);
+
+  _.each(g.graph().dummyChains, function(v) {
+    var node = g.node(v),
+        edgeObj = node.edgeObj,
+        pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w),
+        path = pathData.path,
+        lca = pathData.lca,
+        pathIdx = 0,
+        pathV = path[pathIdx],
+        ascending = true;
+
+    while (v !== edgeObj.w) {
+      node = g.node(v);
+
+      if (ascending) {
+        while ((pathV = path[pathIdx]) !== lca &&
+               g.node(pathV).maxRank < node.rank) {
+          pathIdx++;
+        }
+
+        if (pathV === lca) {
+          ascending = false;
+        }
+      }
+
+      if (!ascending) {
+        while (pathIdx < path.length - 1 &&
+               g.node(pathV = path[pathIdx + 1]).minRank <= node.rank) {
+          pathIdx++;
+        }
+        pathV = path[pathIdx];
+      }
+
+      g.setParent(v, pathV);
+      v = g.successors(v)[0];
+    }
+  });
+}
+
+// Find a path from v to w through the lowest common ancestor (LCA). Return the
+// full path and the LCA.
+function findPath(g, postorderNums, v, w) {
+  var vPath = [],
+      wPath = [],
+      low = Math.min(postorderNums[v].low, postorderNums[w].low),
+      lim = Math.max(postorderNums[v].lim, postorderNums[w].lim),
+      parent,
+      lca;
+
+  // Traverse up from v to find the LCA
+  parent = v;
+  do {
+    parent = g.parent(parent);
+    vPath.push(parent);
+  } while (parent &&
+           (postorderNums[parent].low > low || lim > postorderNums[parent].lim));
+  lca = parent;
+
+  // Traverse from w to LCA
+  parent = w;
+  while ((parent = g.parent(parent)) !== lca) {
+    wPath.push(parent);
+  }
+
+  return { path: vPath.concat(wPath.reverse()), lca: lca };
+}
+
+function postorder(g) {
+  var result = {},
+      lim = 0;
+
+  function dfs(v) {
+    var low = lim;
+    _.each(g.children(v), dfs);
+    result[v] = { low: low, lim: lim++ };
+  }
+  _.each(g.children(), dfs);
+
+  return result;
+}
+
+},{"./lodash":10}],23:[function(require,module,exports){
+"use strict";
+
+var _ = require("../lodash"),
+    Graph = require("../graphlib").Graph,
+    util = require("../util");
+
+/*
+ * This module provides coordinate assignment based on Brandes and Köpf, "Fast
+ * and Simple Horizontal Coordinate Assignment."
+ */
+
+module.exports = {
+  positionX: positionX,
+  findType1Conflicts: findType1Conflicts,
+  findType2Conflicts: findType2Conflicts,
+  addConflict: addConflict,
+  hasConflict: hasConflict,
+  verticalAlignment: verticalAlignment,
+  horizontalCompaction: horizontalCompaction,
+  alignCoordinates: alignCoordinates,
+  findSmallestWidthAlignment: findSmallestWidthAlignment,
+  balance: balance
+};
+
+/*
+ * Marks all edges in the graph with a type-1 conflict with the "type1Conflict"
+ * property. A type-1 conflict is one where a non-inner segment crosses an
+ * inner segment. An inner segment is an edge with both incident nodes marked
+ * with the "dummy" property.
+ *
+ * This algorithm scans layer by layer, starting with the second, for type-1
+ * conflicts between the current layer and the previous layer. For each layer
+ * it scans the nodes from left to right until it reaches one that is incident
+ * on an inner segment. It then scans predecessors to determine if they have
+ * edges that cross that inner segment. At the end a final scan is done for all
+ * nodes on the current rank to see if they cross the last visited inner
+ * segment.
+ *
+ * This algorithm (safely) assumes that a dummy node will only be incident on a
+ * single node in the layers being scanned.
+ */
+function findType1Conflicts(g, layering) {
+  var conflicts = {};
+
+  function visitLayer(prevLayer, layer) {
+    var
+      // last visited node in the previous layer that is incident on an inner
+      // segment.
+      k0 = 0,
+      // Tracks the last node in this layer scanned for crossings with a type-1
+      // segment.
+      scanPos = 0,
+      prevLayerLength = prevLayer.length,
+      lastNode = _.last(layer);
+
+    _.each(layer, function(v, i) {
+      var w = findOtherInnerSegmentNode(g, v),
+          k1 = w ? g.node(w).order : prevLayerLength;
+
+      if (w || v === lastNode) {
+        _.each(layer.slice(scanPos, i +1), function(scanNode) {
+          _.each(g.predecessors(scanNode), function(u) {
+            var uLabel = g.node(u),
+                uPos = uLabel.order;
+            if ((uPos < k0 || k1 < uPos) &&
+                !(uLabel.dummy && g.node(scanNode).dummy)) {
+              addConflict(conflicts, u, scanNode);
+            }
+          });
+        });
+        scanPos = i + 1;
+        k0 = k1;
+      }
+    });
+
+    return layer;
+  }
+
+  _.reduce(layering, visitLayer);
+  return conflicts;
+}
+
+function findType2Conflicts(g, layering) {
+  var conflicts = {};
+
+  function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) {
+    var v;
+    _.each(_.range(southPos, southEnd), function(i) {
+      v = south[i];
+      if (g.node(v).dummy) {
+        _.each(g.predecessors(v), function(u) {
+          var uNode = g.node(u);
+          if (uNode.dummy &&
+              (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) {
+            addConflict(conflicts, u, v);
+          }
+        });
+      }
+    });
+  }
+
+
+  function visitLayer(north, south) {
+    var prevNorthPos = -1,
+        nextNorthPos,
+        southPos = 0;
+
+    _.each(south, function(v, southLookahead) {
+      if (g.node(v).dummy === "border") {
+        var predecessors = g.predecessors(v);
+        if (predecessors.length) {
+          nextNorthPos = g.node(predecessors[0]).order;
+          scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos);
+          southPos = southLookahead;
+          prevNorthPos = nextNorthPos;
+        }
+      }
+      scan(south, southPos, south.length, nextNorthPos, north.length);
+    });
+
+    return south;
+  }
+
+  _.reduce(layering, visitLayer);
+  return conflicts;
+}
+
+function findOtherInnerSegmentNode(g, v) {
+  if (g.node(v).dummy) {
+    return _.find(g.predecessors(v), function(u) {
+      return g.node(u).dummy;
+    });
+  }
+}
+
+function addConflict(conflicts, v, w) {
+  if (v > w) {
+    var tmp = v;
+    v = w;
+    w = tmp;
+  }
+
+  var conflictsV = conflicts[v];
+  if (!conflictsV) {
+    conflicts[v] = conflictsV = {};
+  }
+  conflictsV[w] = true;
+}
+
+function hasConflict(conflicts, v, w) {
+  if (v > w) {
+    var tmp = v;
+    v = w;
+    w = tmp;
+  }
+  return _.has(conflicts[v], w);
+}
+
+/*
+ * Try to align nodes into vertical "blocks" where possible. This algorithm
+ * attempts to align a node with one of its median neighbors. If the edge
+ * connecting a neighbor is a type-1 conflict then we ignore that possibility.
+ * If a previous node has already formed a block with a node after the node
+ * we're trying to form a block with, we also ignore that possibility - our
+ * blocks would be split in that scenario.
+ */
+function verticalAlignment(g, layering, conflicts, neighborFn) {
+  var root = {},
+      align = {},
+      pos = {};
+
+  // We cache the position here based on the layering because the graph and
+  // layering may be out of sync. The layering matrix is manipulated to
+  // generate different extreme alignments.
+  _.each(layering, function(layer) {
+    _.each(layer, function(v, order) {
+      root[v] = v;
+      align[v] = v;
+      pos[v] = order;
+    });
+  });
+
+  _.each(layering, function(layer) {
+    var prevIdx = -1;
+    _.each(layer, function(v) {
+      var ws = neighborFn(v);
+      if (ws.length) {
+        ws = _.sortBy(ws, function(w) { return pos[w]; });
+        var mp = (ws.length - 1) / 2;
+        for (var i = Math.floor(mp), il = Math.ceil(mp); i <= il; ++i) {
+          var w = ws[i];
+          if (align[v] === v &&
+              prevIdx < pos[w] &&
+              !hasConflict(conflicts, v, w)) {
+            align[w] = v;
+            align[v] = root[v] = root[w];
+            prevIdx = pos[w];
+          }
+        }
+      }
+    });
+  });
+
+  return { root: root, align: align };
+}
+
+function horizontalCompaction(g, layering, root, align, reverseSep) {
+  // This portion of the algorithm differs from BK due to a number of problems.
+  // Instead of their algorithm we construct a new block graph and do two
+  // sweeps. The first sweep places blocks with the smallest possible
+  // coordinates. The second sweep removes unused space by moving blocks to the
+  // greatest coordinates without violating separation.
+  var xs = {},
+      blockG = buildBlockGraph(g, layering, root, reverseSep);
+
+  // First pass, assign smallest coordinates via DFS
+  var visited = {};
+  function pass1(v) {
+    if (!_.has(visited, v)) {
+      visited[v] = true;
+      xs[v] = _.reduce(blockG.inEdges(v), function(max, e) {
+        pass1(e.v);
+        return Math.max(max, xs[e.v] + blockG.edge(e));
+      }, 0);
+    }
+  }
+  _.each(blockG.nodes(), pass1);
+
+  var borderType = reverseSep ? "borderLeft" : "borderRight";
+  function pass2(v) {
+    if (visited[v] !== 2) {
+      visited[v]++;
+      var node = g.node(v);
+      var min = _.reduce(blockG.outEdges(v), function(min, e) {
+        pass2(e.w);
+        return Math.min(min, xs[e.w] - blockG.edge(e));
+      }, Number.POSITIVE_INFINITY);
+      if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) {
+        xs[v] = Math.max(xs[v], min);
+      }
+    }
+  }
+  _.each(blockG.nodes(), pass2);
+
+  // Assign x coordinates to all nodes
+  _.each(align, function(v) {
+    xs[v] = xs[root[v]];
+  });
+
+  return xs;
+}
+
+
+function buildBlockGraph(g, layering, root, reverseSep) {
+  var blockGraph = new Graph(),
+      graphLabel = g.graph(),
+      sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
+
+  _.each(layering, function(layer) {
+    var u;
+    _.each(layer, function(v) {
+      var vRoot = root[v];
+      blockGraph.setNode(vRoot);
+      if (u) {
+        var uRoot = root[u],
+            prevMax = blockGraph.edge(uRoot, vRoot);
+        blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g, v, u), prevMax || 0));
+      }
+      u = v;
+    });
+  });
+
+  return blockGraph;
+}
+
+/*
+ * Returns the alignment that has the smallest width of the given alignments.
+ */
+function findSmallestWidthAlignment(g, xss) {
+  return _.min(xss, function(xs) {
+    var min = _.min(xs, function(x, v) { return x - width(g, v) / 2; }),
+        max = _.max(xs, function(x, v) { return x + width(g, v) / 2; });
+    return max - min;
+  });
+}
+
+/*
+ * Align the coordinates of each of the layout alignments such that
+ * left-biased alignments have their minimum coordinate at the same point as
+ * the minimum coordinate of the smallest width alignment and right-biased
+ * alignments have their maximum coordinate at the same point as the maximum
+ * coordinate of the smallest width alignment.
+ */
+function alignCoordinates(xss, alignTo) {
+  var alignToMin = _.min(alignTo),
+      alignToMax = _.max(alignTo);
+
+  _.each(["u", "d"], function(vert) {
+    _.each(["l", "r"], function(horiz) {
+      var alignment = vert + horiz,
+          xs = xss[alignment],
+          delta;
+      if (xs === alignTo) return;
+
+      delta = horiz === "l" ? alignToMin - _.min(xs) : alignToMax - _.max(xs);
+
+      if (delta) {
+        xss[alignment] = _.mapValues(xs, function(x) { return x + delta; });
+      }
+    });
+  });
+}
+
+function balance(xss, align) {
+  return _.mapValues(xss.ul, function(ignore, v) {
+    if (align) {
+      return xss[align.toLowerCase()][v];
+    } else {
+      var xs = _.sortBy(_.pluck(xss, v));
+      return (xs[1] + xs[2]) / 2;
+    }
+  });
+}
+
+function positionX(g) {
+  var layering = util.buildLayerMatrix(g),
+      conflicts = _.merge(findType1Conflicts(g, layering),
+                          findType2Conflicts(g, layering));
+
+  var xss = {},
+      adjustedLayering;
+  _.each(["u", "d"], function(vert) {
+    adjustedLayering = vert === "u" ? layering : _.values(layering).reverse();
+    _.each(["l", "r"], function(horiz) {
+      if (horiz === "r") {
+        adjustedLayering = _.map(adjustedLayering, function(inner) {
+          return _.values(inner).reverse();
+        });
+      }
+
+      var neighborFn = _.bind(vert === "u" ? g.predecessors : g.successors, g);
+      var align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn);
+      var xs = horizontalCompaction(g, adjustedLayering,
+                                    align.root, align.align,
+                                    horiz === "r");
+      if (horiz === "r") {
+        xs = _.mapValues(xs, function(x) { return -x; });
+      }
+      xss[vert + horiz] = xs;
+    });
+  });
+
+  var smallestWidth = findSmallestWidthAlignment(g, xss);
+  alignCoordinates(xss, smallestWidth);
+  return balance(xss, g.graph().align);
+}
+
+function sep(nodeSep, edgeSep, reverseSep) {
+  return function(g, v, w) {
+    var vLabel = g.node(v),
+        wLabel = g.node(w),
+        sum = 0,
+        delta;
+
+    sum += vLabel.width / 2;
+    if (_.has(vLabel, "labelpos")) {
+      switch (vLabel.labelpos.toLowerCase()) {
+        case "l": delta = -vLabel.width / 2; break;
+        case "r": delta = vLabel.width / 2; break;
+      }
+    }
+    if (delta) {
+      sum += reverseSep ? delta : -delta;
+    }
+    delta = 0;
+
+    sum += (vLabel.dummy ? edgeSep : nodeSep) / 2;
+    sum += (wLabel.dummy ? edgeSep : nodeSep) / 2;
+
+    sum += wLabel.width / 2;
+    if (_.has(wLabel, "labelpos")) {
+      switch (wLabel.labelpos.toLowerCase()) {
+        case "l": delta = wLabel.width / 2; break;
+        case "r": delta = -wLabel.width / 2; break;
+      }
+    }
+    if (delta) {
+      sum += reverseSep ? delta : -delta;
+    }
+    delta = 0;
+
+    return sum;
+  };
+}
+
+function width(g, v) {
+  return g.node(v).width;
+}
+
+},{"../graphlib":7,"../lodash":10,"../util":29}],24:[function(require,module,exports){
+"use strict";
+
+var _ = require("../lodash"),
+    util = require("../util"),
+    positionX = require("./bk").positionX;
+
+module.exports = position;
+
+function position(g) {
+  g = util.asNonCompoundGraph(g);
+
+  positionY(g);
+  _.each(positionX(g), function(x, v) {
+    g.node(v).x = x;
+  });
+}
+
+function positionY(g) {
+  var layering = util.buildLayerMatrix(g),
+      rankSep = g.graph().ranksep,
+      prevY = 0;
+  _.each(layering, function(layer) {
+    var maxHeight = _.max(_.map(layer, function(v) { return g.node(v).height; }));
+    _.each(layer, function(v) {
+      g.node(v).y = prevY + maxHeight / 2;
+    });
+    prevY += maxHeight + rankSep;
+  });
+}
+
+
+},{"../lodash":10,"../util":29,"./bk":23}],25:[function(require,module,exports){
+"use strict";
+
+var _ = require("../lodash"),
+    Graph = require("../graphlib").Graph,
+    slack = require("./util").slack;
+
+module.exports = feasibleTree;
+
+/*
+ * Constructs a spanning tree with tight edges and adjusted the input node's
+ * ranks to achieve this. A tight edge is one that is has a length that matches
+ * its "minlen" attribute.
+ *
+ * The basic structure for this function is derived from Gansner, et al., "A
+ * Technique for Drawing Directed Graphs."
+ *
+ * Pre-conditions:
+ *
+ *    1. Graph must be a DAG.
+ *    2. Graph must be connected.
+ *    3. Graph must have at least one node.
+ *    5. Graph nodes must have been previously assigned a "rank" property that
+ *       respects the "minlen" property of incident edges.
+ *    6. Graph edges must have a "minlen" property.
+ *
+ * Post-conditions:
+ *
+ *    - Graph nodes will have their rank adjusted to ensure that all edges are
+ *      tight.
+ *
+ * Returns a tree (undirected graph) that is constructed using only "tight"
+ * edges.
+ */
+function feasibleTree(g) {
+  var t = new Graph({ directed: false });
+
+  // Choose arbitrary node from which to start our tree
+  var start = g.nodes()[0],
+      size = g.nodeCount();
+  t.setNode(start, {});
+
+  var edge, delta;
+  while (tightTree(t, g) < size) {
+    edge = findMinSlackEdge(t, g);
+    delta = t.hasNode(edge.v) ? slack(g, edge) : -slack(g, edge);
+    shiftRanks(t, g, delta);
+  }
+
+  return t;
+}
+
+/*
+ * Finds a maximal tree of tight edges and returns the number of nodes in the
+ * tree.
+ */
+function tightTree(t, g) {
+  function dfs(v) {
+    _.each(g.nodeEdges(v), function(e) {
+      var edgeV = e.v,
+          w = (v === edgeV) ? e.w : edgeV;
+      if (!t.hasNode(w) && !slack(g, e)) {
+        t.setNode(w, {});
+        t.setEdge(v, w, {});
+        dfs(w);
+      }
+    });
+  }
+
+  _.each(t.nodes(), dfs);
+  return t.nodeCount();
+}
+
+/*
+ * Finds the edge with the smallest slack that is incident on tree and returns
+ * it.
+ */
+function findMinSlackEdge(t, g) {
+  return _.min(g.edges(), function(e) {
+    if (t.hasNode(e.v) !== t.hasNode(e.w)) {
+      return slack(g, e);
+    }
+  });
+}
+
+function shiftRanks(t, g, delta) {
+  _.each(t.nodes(), function(v) {
+    g.node(v).rank += delta;
+  });
+}
+
+},{"../graphlib":7,"../lodash":10,"./util":28}],26:[function(require,module,exports){
+"use strict";
+
+var rankUtil = require("./util"),
+    longestPath = rankUtil.longestPath,
+    feasibleTree = require("./feasible-tree"),
+    networkSimplex = require("./network-simplex");
+
+module.exports = rank;
+
+/*
+ * Assigns a rank to each node in the input graph that respects the "minlen"
+ * constraint specified on edges between nodes.
+ *
+ * This basic structure is derived from Gansner, et al., "A Technique for
+ * Drawing Directed Graphs."
+ *
+ * Pre-conditions:
+ *
+ *    1. Graph must be a connected DAG
+ *    2. Graph nodes must be objects
+ *    3. Graph edges must have "weight" and "minlen" attributes
+ *
+ * Post-conditions:
+ *
+ *    1. Graph nodes will have a "rank" attribute based on the results of the
+ *       algorithm. Ranks can start at any index (including negative), we'll
+ *       fix them up later.
+ */
+function rank(g) {
+  switch(g.graph().ranker) {
+    case "network-simplex": networkSimplexRanker(g); break;
+    case "tight-tree": tightTreeRanker(g); break;
+    case "longest-path": longestPathRanker(g); break;
+    default: networkSimplexRanker(g);
+  }
+}
+
+// A fast and simple ranker, but results are far from optimal.
+var longestPathRanker = longestPath;
+
+function tightTreeRanker(g) {
+  longestPath(g);
+  feasibleTree(g);
+}
+
+function networkSimplexRanker(g) {
+  networkSimplex(g);
+}
+
+},{"./feasible-tree":25,"./network-simplex":27,"./util":28}],27:[function(require,module,exports){
+"use strict";
+
+var _ = require("../lodash"),
+    feasibleTree = require("./feasible-tree"),
+    slack = require("./util").slack,
+    initRank = require("./util").longestPath,
+    preorder = require("../graphlib").alg.preorder,
+    postorder = require("../graphlib").alg.postorder,
+    simplify = require("../util").simplify;
+
+module.exports = networkSimplex;
+
+// Expose some internals for testing purposes
+networkSimplex.initLowLimValues = initLowLimValues;
+networkSimplex.initCutValues = initCutValues;
+networkSimplex.calcCutValue = calcCutValue;
+networkSimplex.leaveEdge = leaveEdge;
+networkSimplex.enterEdge = enterEdge;
+networkSimplex.exchangeEdges = exchangeEdges;
+
+/*
+ * The network simplex algorithm assigns ranks to each node in the input graph
+ * and iteratively improves the ranking to reduce the length of edges.
+ *
+ * Preconditions:
+ *
+ *    1. The input graph must be a DAG.
+ *    2. All nodes in the graph must have an object value.
+ *    3. All edges in the graph must have "minlen" and "weight" attributes.
+ *
+ * Postconditions:
+ *
+ *    1. All nodes in the graph will have an assigned "rank" attribute that has
+ *       been optimized by the network simplex algorithm. Ranks start at 0.
+ *
+ *
+ * A rough sketch of the algorithm is as follows:
+ *
+ *    1. Assign initial ranks to each node. We use the longest path algorithm,
+ *       which assigns ranks to the lowest position possible. In general this
+ *       leads to very wide bottom ranks and unnecessarily long edges.
+ *    2. Construct a feasible tight tree. A tight tree is one such that all
+ *       edges in the tree have no slack (difference between length of edge
+ *       and minlen for the edge). This by itself greatly improves the assigned
+ *       rankings by shorting edges.
+ *    3. Iteratively find edges that have negative cut values. Generally a
+ *       negative cut value indicates that the edge could be removed and a new
+ *       tree edge could be added to produce a more compact graph.
+ *
+ * Much of the algorithms here are derived from Gansner, et al., "A Technique
+ * for Drawing Directed Graphs." The structure of the file roughly follows the
+ * structure of the overall algorithm.
+ */
+function networkSimplex(g) {
+  g = simplify(g);
+  initRank(g);
+  var t = feasibleTree(g);
+  initLowLimValues(t);
+  initCutValues(t, g);
+
+  var e, f;
+  while ((e = leaveEdge(t))) {
+    f = enterEdge(t, g, e);
+    exchangeEdges(t, g, e, f);
+  }
+}
+
+/*
+ * Initializes cut values for all edges in the tree.
+ */
+function initCutValues(t, g) {
+  var vs = postorder(t, t.nodes());
+  vs = vs.slice(0, vs.length - 1);
+  _.each(vs, function(v) {
+    assignCutValue(t, g, v);
+  });
+}
+
+function assignCutValue(t, g, child) {
+  var childLab = t.node(child),
+      parent = childLab.parent;
+  t.edge(child, parent).cutvalue = calcCutValue(t, g, child);
+}
+
+/*
+ * Given the tight tree, its graph, and a child in the graph calculate and
+ * return the cut value for the edge between the child and its parent.
+ */
+function calcCutValue(t, g, child) {
+  var childLab = t.node(child),
+      parent = childLab.parent,
+      // True if the child is on the tail end of the edge in the directed graph
+      childIsTail = true,
+      // The graph's view of the tree edge we're inspecting
+      graphEdge = g.edge(child, parent),
+      // The accumulated cut value for the edge between this node and its parent
+      cutValue = 0;
+
+  if (!graphEdge) {
+    childIsTail = false;
+    graphEdge = g.edge(parent, child);
+  }
+
+  cutValue = graphEdge.weight;
+
+  _.each(g.nodeEdges(child), function(e) {
+    var isOutEdge = e.v === child,
+        other = isOutEdge ? e.w : e.v;
+
+    if (other !== parent) {
+      var pointsToHead = isOutEdge === childIsTail,
+          otherWeight = g.edge(e).weight;
+
+      cutValue += pointsToHead ? otherWeight : -otherWeight;
+      if (isTreeEdge(t, child, other)) {
+        var otherCutValue = t.edge(child, other).cutvalue;
+        cutValue += pointsToHead ? -otherCutValue : otherCutValue;
+      }
+    }
+  });
+
+  return cutValue;
+}
+
+function initLowLimValues(tree, root) {
+  if (arguments.length < 2) {
+    root = tree.nodes()[0];
+  }
+  dfsAssignLowLim(tree, {}, 1, root);
+}
+
+function dfsAssignLowLim(tree, visited, nextLim, v, parent) {
+  var low = nextLim,
+      label = tree.node(v);
+
+  visited[v] = true;
+  _.each(tree.neighbors(v), function(w) {
+    if (!_.has(visited, w)) {
+      nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v);
+    }
+  });
+
+  label.low = low;
+  label.lim = nextLim++;
+  if (parent) {
+    label.parent = parent;
+  } else {
+    // TODO should be able to remove this when we incrementally update low lim
+    delete label.parent;
+  }
+
+  return nextLim;
+}
+
+function leaveEdge(tree) {
+  return _.find(tree.edges(), function(e) {
+    return tree.edge(e).cutvalue < 0;
+  });
+}
+
+function enterEdge(t, g, edge) {
+  var v = edge.v,
+      w = edge.w;
+
+  // For the rest of this function we assume that v is the tail and w is the
+  // head, so if we don't have this edge in the graph we should flip it to
+  // match the correct orientation.
+  if (!g.hasEdge(v, w)) {
+    v = edge.w;
+    w = edge.v;
+  }
+
+  var vLabel = t.node(v),
+      wLabel = t.node(w),
+      tailLabel = vLabel,
+      flip = false;
+
+  // If the root is in the tail of the edge then we need to flip the logic that
+  // checks for the head and tail nodes in the candidates function below.
+  if (vLabel.lim > wLabel.lim) {
+    tailLabel = wLabel;
+    flip = true;
+  }
+
+  var candidates = _.filter(g.edges(), function(edge) {
+    return flip === isDescendant(t, t.node(edge.v), tailLabel) &&
+           flip !== isDescendant(t, t.node(edge.w), tailLabel);
+  });
+
+  return _.min(candidates, function(edge) { return slack(g, edge); });
+}
+
+function exchangeEdges(t, g, e, f) {
+  var v = e.v,
+      w = e.w;
+  t.removeEdge(v, w);
+  t.setEdge(f.v, f.w, {});
+  initLowLimValues(t);
+  initCutValues(t, g);
+  updateRanks(t, g);
+}
+
+function updateRanks(t, g) {
+  var root = _.find(t.nodes(), function(v) { return !g.node(v).parent; }),
+      vs = preorder(t, root);
+  vs = vs.slice(1);
+  _.each(vs, function(v) {
+    var parent = t.node(v).parent,
+        edge = g.edge(v, parent),
+        flipped = false;
+
+    if (!edge) {
+      edge = g.edge(parent, v);
+      flipped = true;
+    }
+
+    g.node(v).rank = g.node(parent).rank + (flipped ? edge.minlen : -edge.minlen);
+  });
+}
+
+/*
+ * Returns true if the edge is in the tree.
+ */
+function isTreeEdge(tree, u, v) {
+  return tree.hasEdge(u, v);
+}
+
+/*
+ * Returns true if the specified node is descendant of the root node per the
+ * assigned low and lim attributes in the tree.
+ */
+function isDescendant(tree, vLabel, rootLabel) {
+  return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;
+}
+
+},{"../graphlib":7,"../lodash":10,"../util":29,"./feasible-tree":25,"./util":28}],28:[function(require,module,exports){
+"use strict";
+
+var _ = require("../lodash");
+
+module.exports = {
+  longestPath: longestPath,
+  slack: slack
+};
+
+/*
+ * Initializes ranks for the input graph using the longest path algorithm. This
+ * algorithm scales well and is fast in practice, it yields rather poor
+ * solutions. Nodes are pushed to the lowest layer possible, leaving the bottom
+ * ranks wide and leaving edges longer than necessary. However, due to its
+ * speed, this algorithm is good for getting an initial ranking that can be fed
+ * into other algorithms.
+ *
+ * This algorithm does not normalize layers because it will be used by other
+ * algorithms in most cases. If using this algorithm directly, be sure to
+ * run normalize at the end.
+ *
+ * Pre-conditions:
+ *
+ *    1. Input graph is a DAG.
+ *    2. Input graph node labels can be assigned properties.
+ *
+ * Post-conditions:
+ *
+ *    1. Each node will be assign an (unnormalized) "rank" property.
+ */
+function longestPath(g) {
+  var visited = {};
+
+  function dfs(v) {
+    var label = g.node(v);
+    if (_.has(visited, v)) {
+      return label.rank;
+    }
+    visited[v] = true;
+
+    var rank = _.min(_.map(g.outEdges(v), function(e) {
+      return dfs(e.w) - g.edge(e).minlen;
+    }));
+
+    if (rank === Number.POSITIVE_INFINITY) {
+      rank = 0;
+    }
+
+    return (label.rank = rank);
+  }
+
+  _.each(g.sources(), dfs);
+}
+
+/*
+ * Returns the amount of slack for the given edge. The slack is defined as the
+ * difference between the length of the edge and its minimum length.
+ */
+function slack(g, e) {
+  return g.node(e.w).rank - g.node(e.v).rank - g.edge(e).minlen;
+}
+
+},{"../lodash":10}],29:[function(require,module,exports){
+"use strict";
+
+var _ = require("./lodash"),
+    Graph = require("./graphlib").Graph;
+
+module.exports = {
+  addDummyNode: addDummyNode,
+  simplify: simplify,
+  asNonCompoundGraph: asNonCompoundGraph,
+  successorWeights: successorWeights,
+  predecessorWeights: predecessorWeights,
+  intersectRect: intersectRect,
+  buildLayerMatrix: buildLayerMatrix,
+  normalizeRanks: normalizeRanks,
+  removeEmptyRanks: removeEmptyRanks,
+  addBorderNode: addBorderNode,
+  maxRank: maxRank,
+  partition: partition,
+  time: time,
+  notime: notime
+};
+
+/*
+ * Adds a dummy node to the graph and return v.
+ */
+function addDummyNode(g, type, attrs, name) {
+  var v;
+  do {
+    v = _.uniqueId(name);
+  } while (g.hasNode(v));
+
+  attrs.dummy = type;
+  g.setNode(v, attrs);
+  return v;
+}
+
+/*
+ * Returns a new graph with only simple edges. Handles aggregation of data
+ * associated with multi-edges.
+ */
+function simplify(g) {
+  var simplified = new Graph().setGraph(g.graph());
+  _.each(g.nodes(), function(v) { simplified.setNode(v, g.node(v)); });
+  _.each(g.edges(), function(e) {
+    var simpleLabel = simplified.edge(e.v, e.w) || { weight: 0, minlen: 1 },
+        label = g.edge(e);
+    simplified.setEdge(e.v, e.w, {
+      weight: simpleLabel.weight + label.weight,
+      minlen: Math.max(simpleLabel.minlen, label.minlen)
+    });
+  });
+  return simplified;
+}
+
+function asNonCompoundGraph(g) {
+  var simplified = new Graph({ multigraph: g.isMultigraph() }).setGraph(g.graph());
+  _.each(g.nodes(), function(v) {
+    if (!g.children(v).length) {
+      simplified.setNode(v, g.node(v));
+    }
+  });
+  _.each(g.edges(), function(e) {
+    simplified.setEdge(e, g.edge(e));
+  });
+  return simplified;
+}
+
+function successorWeights(g) {
+  var weightMap = _.map(g.nodes(), function(v) {
+    var sucs = {};
+    _.each(g.outEdges(v), function(e) {
+      sucs[e.w] = (sucs[e.w] || 0) + g.edge(e).weight;
+    });
+    return sucs;
+  });
+  return _.zipObject(g.nodes(), weightMap);
+}
+
+function predecessorWeights(g) {
+  var weightMap = _.map(g.nodes(), function(v) {
+    var preds = {};
+    _.each(g.inEdges(v), function(e) {
+      preds[e.v] = (preds[e.v] || 0) + g.edge(e).weight;
+    });
+    return preds;
+  });
+  return _.zipObject(g.nodes(), weightMap);
+}
+
+/*
+ * Finds where a line starting at point ({x, y}) would intersect a rectangle
+ * ({x, y, width, height}) if it were pointing at the rectangle's center.
+ */
+function intersectRect(rect, point) {
+  var x = rect.x;
+  var y = rect.y;
+
+  // Rectangle intersection algorithm from:
+  // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
+  var dx = point.x - x;
+  var dy = point.y - y;
+  var w = rect.width / 2;
+  var h = rect.height / 2;
+
+  if (!dx && !dy) {
+    throw new Error("Not possible to find intersection inside of the rectangle");
+  }
+
+  var sx, sy;
+  if (Math.abs(dy) * w > Math.abs(dx) * h) {
+    // Intersection is top or bottom of rect.
+    if (dy < 0) {
+      h = -h;
+    }
+    sx = h * dx / dy;
+    sy = h;
+  } else {
+    // Intersection is left or right of rect.
+    if (dx < 0) {
+      w = -w;
+    }
+    sx = w;
+    sy = w * dy / dx;
+  }
+
+  return { x: x + sx, y: y + sy };
+}
+
+/*
+ * Given a DAG with each node assigned "rank" and "order" properties, this
+ * function will produce a matrix with the ids of each node.
+ */
+function buildLayerMatrix(g) {
+  var layering = _.map(_.range(maxRank(g) + 1), function() { return []; });
+  _.each(g.nodes(), function(v) {
+    var node = g.node(v),
+        rank = node.rank;
+    if (!_.isUndefined(rank)) {
+      layering[rank][node.order] = v;
+    }
+  });
+  return layering;
+}
+
+/*
+ * Adjusts the ranks for all nodes in the graph such that all nodes v have
+ * rank(v) >= 0 and at least one node w has rank(w) = 0.
+ */
+function normalizeRanks(g) {
+  var min = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));
+  _.each(g.nodes(), function(v) {
+    var node = g.node(v);
+    if (_.has(node, "rank")) {
+      node.rank -= min;
+    }
+  });
+}
+
+function removeEmptyRanks(g) {
+  // Ranks may not start at 0, so we need to offset them
+  var offset = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));
+
+  var layers = [];
+  _.each(g.nodes(), function(v) {
+    var rank = g.node(v).rank - offset;
+    if (!layers[rank]) {
+      layers[rank] = [];
+    }
+    layers[rank].push(v);
+  });
+
+  var delta = 0,
+      nodeRankFactor = g.graph().nodeRankFactor;
+  _.each(layers, function(vs, i) {
+    if (_.isUndefined(vs) && i % nodeRankFactor !== 0) {
+      --delta;
+    } else if (delta) {
+      _.each(vs, function(v) { g.node(v).rank += delta; });
+    }
+  });
+}
+
+function addBorderNode(g, prefix, rank, order) {
+  var node = {
+    width: 0,
+    height: 0
+  };
+  if (arguments.length >= 4) {
+    node.rank = rank;
+    node.order = order;
+  }
+  return addDummyNode(g, "border", node, prefix);
+}
+
+function maxRank(g) {
+  return _.max(_.map(g.nodes(), function(v) {
+    var rank = g.node(v).rank;
+    if (!_.isUndefined(rank)) {
+      return rank;
+    }
+  }));
+}
+
+/*
+ * Partition a collection into two groups: `lhs` and `rhs`. If the supplied
+ * function returns true for an entry it goes into `lhs`. Otherwise it goes
+ * into `rhs.
+ */
+function partition(collection, fn) {
+  var result = { lhs: [], rhs: [] };
+  _.each(collection, function(value) {
+    if (fn(value)) {
+      result.lhs.push(value);
+    } else {
+      result.rhs.push(value);
+    }
+  });
+  return result;
+}
+
+/*
+ * Returns a new function that wraps `fn` with a timer. The wrapper logs the
+ * time it takes to execute the function.
+ */
+function time(name, fn) {
+  var start = _.now();
+  try {
+    return fn();
+  } finally {
+    console.log(name + " time: " + (_.now() - start) + "ms");
+  }
+}
+
+function notime(name, fn) {
+  return fn();
+}
+
+},{"./graphlib":7,"./lodash":10}],30:[function(require,module,exports){
+module.exports = "0.7.4";
+
+},{}],31:[function(require,module,exports){
+/**
+ * Copyright (c) 2014, Chris Pettitt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var lib = require("./lib");
+
+module.exports = {
+  Graph: lib.Graph,
+  json: require("./lib/json"),
+  alg: require("./lib/alg"),
+  version: lib.version
+};
+
+},{"./lib":47,"./lib/alg":38,"./lib/json":48}],32:[function(require,module,exports){
+var _ = require("../lodash");
+
+module.exports = components;
+
+function components(g) {
+  var visited = {},
+      cmpts = [],
+      cmpt;
+
+  function dfs(v) {
+    if (_.has(visited, v)) return;
+    visited[v] = true;
+    cmpt.push(v);
+    _.each(g.successors(v), dfs);
+    _.each(g.predecessors(v), dfs);
+  }
+
+  _.each(g.nodes(), function(v) {
+    cmpt = [];
+    dfs(v);
+    if (cmpt.length) {
+      cmpts.push(cmpt);
+    }
+  });
+
+  return cmpts;
+}
+
+},{"../lodash":49}],33:[function(require,module,exports){
+var _ = require("../lodash");
+
+module.exports = dfs;
+
+/*
+ * A helper that preforms a pre- or post-order traversal on the input graph
+ * and returns the nodes in the order they were visited. This algorithm treats
+ * the input as undirected.
+ *
+ * Order must be one of "pre" or "post".
+ */
+function dfs(g, vs, order) {
+  if (!_.isArray(vs)) {
+    vs = [vs];
+  }
+
+  var acc = [],
+      visited = {};
+  _.each(vs, function(v) {
+    if (!g.hasNode(v)) {
+      throw new Error("Graph does not have node: " + v);
+    }
+
+    doDfs(g, v, order === "post", visited, acc);
+  });
+  return acc;
+}
+
+function doDfs(g, v, postorder, visited, acc) {
+  if (!_.has(visited, v)) {
+    visited[v] = true;
+
+    if (!postorder) { acc.push(v); }
+    _.each(g.neighbors(v), function(w) {
+      doDfs(g, w, postorder, visited, acc);
+    });
+    if (postorder) { acc.push(v); }
+  }
+}
+
+},{"../lodash":49}],34:[function(require,module,exports){
+var dijkstra = require("./dijkstra"),
+    _ = require("../lodash");
+
+module.exports = dijkstraAll;
+
+function dijkstraAll(g, weightFunc, edgeFunc) {
+  return _.transform(g.nodes(), function(acc, v) {
+    acc[v] = dijkstra(g, v, weightFunc, edgeFunc);
+  }, {});
+}
+
+},{"../lodash":49,"./dijkstra":35}],35:[function(require,module,exports){
+var _ = require("../lodash"),
+    PriorityQueue = require("../data/priority-queue");
+
+module.exports = dijkstra;
+
+var DEFAULT_WEIGHT_FUNC = _.constant(1);
+
+function dijkstra(g, source, weightFn, edgeFn) {
+  return runDijkstra(g, String(source),
+                     weightFn || DEFAULT_WEIGHT_FUNC,
+                     edgeFn || function(v) { return g.outEdges(v); });
+}
+
+function runDijkstra(g, source, weightFn, edgeFn) {
+  var results = {},
+      pq = new PriorityQueue(),
+      v, vEntry;
+
+  var updateNeighbors = function(edge) {
+    var w = edge.v !== v ? edge.v : edge.w,
+        wEntry = results[w],
+        weight = weightFn(edge),
+        distance = vEntry.distance + weight;
+
+    if (weight < 0) {
+      throw new Error("dijkstra does not allow negative edge weights. " +
+                      "Bad edge: " + edge + " Weight: " + weight);
+    }
+
+    if (distance < wEntry.distance) {
+      wEntry.distance = distance;
+      wEntry.predecessor = v;
+      pq.decrease(w, distance);
+    }
+  };
+
+  g.nodes().forEach(function(v) {
+    var distance = v === source ? 0 : Number.POSITIVE_INFINITY;
+    results[v] = { distance: distance };
+    pq.add(v, distance);
+  });
+
+  while (pq.size() > 0) {
+    v = pq.removeMin();
+    vEntry = results[v];
+    if (vEntry.distance === Number.POSITIVE_INFINITY) {
+      break;
+    }
+
+    edgeFn(v).forEach(updateNeighbors);
+  }
+
+  return results;
+}
+
+},{"../data/priority-queue":45,"../lodash":49}],36:[function(require,module,exports){
+var _ = require("../lodash"),
+    tarjan = require("./tarjan");
+
+module.exports = findCycles;
+
+function findCycles(g) {
+  return _.filter(tarjan(g), function(cmpt) {
+    return cmpt.length > 1 || (cmpt.length === 1 && g.hasEdge(cmpt[0], cmpt[0]));
+  });
+}
+
+},{"../lodash":49,"./tarjan":43}],37:[function(require,module,exports){
+var _ = require("../lodash");
+
+module.exports = floydWarshall;
+
+var DEFAULT_WEIGHT_FUNC = _.constant(1);
+
+function floydWarshall(g, weightFn, edgeFn) {
+  return runFloydWarshall(g,
+                          weightFn || DEFAULT_WEIGHT_FUNC,
+                          edgeFn || function(v) { return g.outEdges(v); });
+}
+
+function runFloydWarshall(g, weightFn, edgeFn) {
+  var results = {},
+      nodes = g.nodes();
+
+  nodes.forEach(function(v) {
+    results[v] = {};
+    results[v][v] = { distance: 0 };
+    nodes.forEach(function(w) {
+      if (v !== w) {
+        results[v][w] = { distance: Number.POSITIVE_INFINITY };
+      }
+    });
+    edgeFn(v).forEach(function(edge) {
+      var w = edge.v === v ? edge.w : edge.v,
+          d = weightFn(edge);
+      results[v][w] = { distance: d, predecessor: v };
+    });
+  });
+
+  nodes.forEach(function(k) {
+    var rowK = results[k];
+    nodes.forEach(function(i) {
+      var rowI = results[i];
+      nodes.forEach(function(j) {
+        var ik = rowI[k];
+        var kj = rowK[j];
+        var ij = rowI[j];
+        var altDistance = ik.distance + kj.distance;
+        if (altDistance < ij.distance) {
+          ij.distance = altDistance;
+          ij.predecessor = kj.predecessor;
+        }
+      });
+    });
+  });
+
+  return results;
+}
+
+},{"../lodash":49}],38:[function(require,module,exports){
+module.exports = {
+  components: require("./components"),
+  dijkstra: require("./dijkstra"),
+  dijkstraAll: require("./dijkstra-all"),
+  findCycles: require("./find-cycles"),
+  floydWarshall: require("./floyd-warshall"),
+  isAcyclic: require("./is-acyclic"),
+  postorder: require("./postorder"),
+  preorder: require("./preorder"),
+  prim: require("./prim"),
+  tarjan: require("./tarjan"),
+  topsort: require("./topsort")
+};
+
+},{"./components":32,"./dijkstra":35,"./dijkstra-all":34,"./find-cycles":36,"./floyd-warshall":37,"./is-acyclic":39,"./postorder":40,"./preorder":41,"./prim":42,"./tarjan":43,"./topsort":44}],39:[function(require,module,exports){
+var topsort = require("./topsort");
+
+module.exports = isAcyclic;
+
+function isAcyclic(g) {
+  try {
+    topsort(g);
+  } catch (e) {
+    if (e instanceof topsort.CycleException) {
+      return false;
+    }
+    throw e;
+  }
+  return true;
+}
+
+},{"./topsort":44}],40:[function(require,module,exports){
+var dfs = require("./dfs");
+
+module.exports = postorder;
+
+function postorder(g, vs) {
+  return dfs(g, vs, "post");
+}
+
+},{"./dfs":33}],41:[function(require,module,exports){
+var dfs = require("./dfs");
+
+module.exports = preorder;
+
+function preorder(g, vs) {
+  return dfs(g, vs, "pre");
+}
+
+},{"./dfs":33}],42:[function(require,module,exports){
+var _ = require("../lodash"),
+    Graph = require("../graph"),
+    PriorityQueue = require("../data/priority-queue");
+
+module.exports = prim;
+
+function prim(g, weightFunc) {
+  var result = new Graph(),
+      parents = {},
+      pq = new PriorityQueue(),
+      v;
+
+  function updateNeighbors(edge) {
+    var w = edge.v === v ? edge.w : edge.v,
+        pri = pq.priority(w);
+    if (pri !== undefined) {
+      var edgeWeight = weightFunc(edge);
+      if (edgeWeight < pri) {
+        parents[w] = v;
+        pq.decrease(w, edgeWeight);
+      }
+    }
+  }
+
+  if (g.nodeCount() === 0) {
+    return result;
+  }
+
+  _.each(g.nodes(), function(v) {
+    pq.add(v, Number.POSITIVE_INFINITY);
+    result.setNode(v);
+  });
+
+  // Start from an arbitrary node
+  pq.decrease(g.nodes()[0], 0);
+
+  var init = false;
+  while (pq.size() > 0) {
+    v = pq.removeMin();
+    if (_.has(parents, v)) {
+      result.setEdge(v, parents[v]);
+    } else if (init) {
+      throw new Error("Input graph is not connected: " + g);
+    } else {
+      init = true;
+    }
+
+    g.nodeEdges(v).forEach(updateNeighbors);
+  }
+
+  return result;
+}
+
+},{"../data/priority-queue":45,"../graph":46,"../lodash":49}],43:[function(require,module,exports){
+var _ = require("../lodash");
+
+module.exports = tarjan;
+
+function tarjan(g) {
+  var index = 0,
+      stack = [],
+      visited = {}, // node id -> { onStack, lowlink, index }
+      results = [];
+
+  function dfs(v) {
+    var entry = visited[v] = {
+      onStack: true,
+      lowlink: index,
+      index: index++
+    };
+    stack.push(v);
+
+    g.successors(v).forEach(function(w) {
+      if (!_.has(visited, w)) {
+        dfs(w);
+        entry.lowlink = Math.min(entry.lowlink, visited[w].lowlink);
+      } else if (visited[w].onStack) {
+        entry.lowlink = Math.min(entry.lowlink, visited[w].index);
+      }
+    });
+
+    if (entry.lowlink === entry.index) {
+      var cmpt = [],
+          w;
+      do {
+        w = stack.pop();
+        visited[w].onStack = false;
+        cmpt.push(w);
+      } while (v !== w);
+      results.push(cmpt);
+    }
+  }
+
+  g.nodes().forEach(function(v) {
+    if (!_.has(visited, v)) {
+      dfs(v);
+    }
+  });
+
+  return results;
+}
+
+},{"../lodash":49}],44:[function(require,module,exports){
+var _ = require("../lodash");
+
+module.exports = topsort;
+topsort.CycleException = CycleException;
+
+function topsort(g) {
+  var visited = {},
+      stack = {},
+      results = [];
+
+  function visit(node) {
+    if (_.has(stack, node)) {
+      throw new CycleException();
+    }
+
+    if (!_.has(visited, node)) {
+      stack[node] = true;
+      visited[node] = true;
+      _.each(g.predecessors(node), visit);
+      delete stack[node];
+      results.push(node);
+    }
+  }
+
+  _.each(g.sinks(), visit);
+
+  if (_.size(visited) !== g.nodeCount()) {
+    throw new CycleException();
+  }
+
+  return results;
+}
+
+function CycleException() {}
+
+},{"../lodash":49}],45:[function(require,module,exports){
+var _ = require("../lodash");
+
+module.exports = PriorityQueue;
+
+/**
+ * A min-priority queue data structure. This algorithm is derived from Cormen,
+ * et al., "Introduction to Algorithms". The basic idea of a min-priority
+ * queue is that you can efficiently (in O(1) time) get the smallest key in
+ * the queue. Adding and removing elements takes O(log n) time. A key can
+ * have its priority decreased in O(log n) time.
+ */
+function PriorityQueue() {
+  this._arr = [];
+  this._keyIndices = {};
+}
+
+/**
+ * Returns the number of elements in the queue. Takes `O(1)` time.
+ */
+PriorityQueue.prototype.size = function() {
+  return this._arr.length;
+};
+
+/**
+ * Returns the keys that are in the queue. Takes `O(n)` time.
+ */
+PriorityQueue.prototype.keys = function() {
+  return this._arr.map(function(x) { return x.key; });
+};
+
+/**
+ * Returns `true` if **key** is in the queue and `false` if not.
+ */
+PriorityQueue.prototype.has = function(key) {
+  return _.has(this._keyIndices, key);
+};
+
+/**
+ * Returns the priority for **key**. If **key** is not present in the queue
+ * then this function returns `undefined`. Takes `O(1)` time.
+ *
+ * @param {Object} key
+ */
+PriorityQueue.prototype.priority = function(key) {
+  var index = this._keyIndices[key];
+  if (index !== undefined) {
+    return this._arr[index].priority;
+  }
+};
+
+/**
+ * Returns the key for the minimum element in this queue. If the queue is
+ * empty this function throws an Error. Takes `O(1)` time.
+ */
+PriorityQueue.prototype.min = function() {
+  if (this.size() === 0) {
+    throw new Error("Queue underflow");
+  }
+  return this._arr[0].key;
+};
+
+/**
+ * Inserts a new key into the priority queue. If the key already exists in
+ * the queue this function returns `false`; otherwise it will return `true`.
+ * Takes `O(n)` time.
+ *
+ * @param {Object} key the key to add
+ * @param {Number} priority the initial priority for the key
+ */
+PriorityQueue.prototype.add = function(key, priority) {
+  var keyIndices = this._keyIndices;
+  key = String(key);
+  if (!_.has(keyIndices, key)) {
+    var arr = this._arr;
+    var index = arr.length;
+    keyIndices[key] = index;
+    arr.push({key: key, priority: priority});
+    this._decrease(index);
+    return true;
+  }
+  return false;
+};
+
+/**
+ * Removes and returns the smallest key in the queue. Takes `O(log n)` time.
+ */
+PriorityQueue.prototype.removeMin = function() {
+  this._swap(0, this._arr.length - 1);
+  var min = this._arr.pop();
+  delete this._keyIndices[min.key];
+  this._heapify(0);
+  return min.key;
+};
+
+/**
+ * Decreases the priority for **key** to **priority**. If the new priority is
+ * greater than the previous priority, this function will throw an Error.
+ *
+ * @param {Object} key the key for which to raise priority
+ * @param {Number} priority the new priority for the key
+ */
+PriorityQueue.prototype.decrease = function(key, priority) {
+  var index = this._keyIndices[key];
+  if (priority > this._arr[index].priority) {
+    throw new Error("New priority is greater than current priority. " +
+        "Key: " + key + " Old: " + this._arr[index].priority + " New: " + priority);
+  }
+  this._arr[index].priority = priority;
+  this._decrease(index);
+};
+
+PriorityQueue.prototype._heapify = function(i) {
+  var arr = this._arr;
+  var l = 2 * i,
+      r = l + 1,
+      largest = i;
+  if (l < arr.length) {
+    largest = arr[l].priority < arr[largest].priority ? l : largest;
+    if (r < arr.length) {
+      largest = arr[r].priority < arr[largest].priority ? r : largest;
+    }
+    if (largest !== i) {
+      this._swap(i, largest);
+      this._heapify(largest);
+    }
+  }
+};
+
+PriorityQueue.prototype._decrease = function(index) {
+  var arr = this._arr;
+  var priority = arr[index].priority;
+  var parent;
+  while (index !== 0) {
+    parent = index >> 1;
+    if (arr[parent].priority < priority) {
+      break;
+    }
+    this._swap(index, parent);
+    index = parent;
+  }
+};
+
+PriorityQueue.prototype._swap = function(i, j) {
+  var arr = this._arr;
+  var keyIndices = this._keyIndices;
+  var origArrI = arr[i];
+  var origArrJ = arr[j];
+  arr[i] = origArrJ;
+  arr[j] = origArrI;
+  keyIndices[origArrJ.key] = i;
+  keyIndices[origArrI.key] = j;
+};
+
+},{"../lodash":49}],46:[function(require,module,exports){
+"use strict";
+
+var _ = require("./lodash");
+
+module.exports = Graph;
+
+var DEFAULT_EDGE_NAME = "\x00",
+    GRAPH_NODE = "\x00",
+    EDGE_KEY_DELIM = "\x01";
+
+// Implementation notes:
+//
+//  * Node id query functions should return string ids for the nodes
+//  * Edge id query functions should return an "edgeObj", edge object, that is
+//    composed of enough information to uniquely identify an edge: {v, w, name}.
+//  * Internally we use an "edgeId", a stringified form of the edgeObj, to
+//    reference edges. This is because we need a performant way to look these
+//    edges up and, object properties, which have string keys, are the closest
+//    we're going to get to a performant hashtable in JavaScript.
+
+function Graph(opts) {
+  this._isDirected = _.has(opts, "directed") ? opts.directed : true;
+  this._isMultigraph = _.has(opts, "multigraph") ? opts.multigraph : false;
+  this._isCompound = _.has(opts, "compound") ? opts.compound : false;
+
+  // Label for the graph itself
+  this._label = undefined;
+
+  // Defaults to be set when creating a new node
+  this._defaultNodeLabelFn = _.constant(undefined);
+
+  // Defaults to be set when creating a new edge
+  this._defaultEdgeLabelFn = _.constant(undefined);
+
+  // v -> label
+  this._nodes = {};
+
+  if (this._isCompound) {
+    // v -> parent
+    this._parent = {};
+
+    // v -> children
+    this._children = {};
+    this._children[GRAPH_NODE] = {};
+  }
+
+  // v -> edgeObj
+  this._in = {};
+
+  // u -> v -> Number
+  this._preds = {};
+
+  // v -> edgeObj
+  this._out = {};
+
+  // v -> w -> Number
+  this._sucs = {};
+
+  // e -> edgeObj
+  this._edgeObjs = {};
+
+  // e -> label
+  this._edgeLabels = {};
+}
+
+/* Number of nodes in the graph. Should only be changed by the implementation. */
+Graph.prototype._nodeCount = 0;
+
+/* Number of edges in the graph. Should only be changed by the implementation. */
+Graph.prototype._edgeCount = 0;
+
+
+/* === Graph functions ========= */
+
+Graph.prototype.isDirected = function() {
+  return this._isDirected;
+};
+
+Graph.prototype.isMultigraph = function() {
+  return this._isMultigraph;
+};
+
+Graph.prototype.isCompound = function() {
+  return this._isCompound;
+};
+
+Graph.prototype.setGraph = function(label) {
+  this._label = label;
+  return this;
+};
+
+Graph.prototype.graph = function() {
+  return this._label;
+};
+
+
+/* === Node functions ========== */
+
+Graph.prototype.setDefaultNodeLabel = function(newDefault) {
+  if (!_.isFunction(newDefault)) {
+    newDefault = _.constant(newDefault);
+  }
+  this._defaultNodeLabelFn = newDefault;
+  return this;
+};
+
+Graph.prototype.nodeCount = function() {
+  return this._nodeCount;
+};
+
+Graph.prototype.nodes = function() {
+  return _.keys(this._nodes);
+};
+
+Graph.prototype.sources = function() {
+  return _.filter(this.nodes(), function(v) {
+    return _.isEmpty(this._in[v]);
+  }, this);
+};
+
+Graph.prototype.sinks = function() {
+  return _.filter(this.nodes(), function(v) {
+    return _.isEmpty(this._out[v]);
+  }, this);
+};
+
+Graph.prototype.setNodes = function(vs, value) {
+  var args = arguments;
+  _.each(vs, function(v) {
+    if (args.length > 1) {
+      this.setNode(v, value);
+    } else {
+      this.setNode(v);
+    }
+  }, this);
+  return this;
+};
+
+Graph.prototype.setNode = function(v, value) {
+  if (_.has(this._nodes, v)) {
+    if (arguments.length > 1) {
+      this._nodes[v] = value;
+    }
+    return this;
+  }
+
+  this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);
+  if (this._isCompound) {
+    this._parent[v] = GRAPH_NODE;
+    this._children[v] = {};
+    this._children[GRAPH_NODE][v] = true;
+  }
+  this._in[v] = {};
+  this._preds[v] = {};
+  this._out[v] = {};
+  this._sucs[v] = {};
+  ++this._nodeCount;
+  return this;
+};
+
+Graph.prototype.node = function(v) {
+  return this._nodes[v];
+};
+
+Graph.prototype.hasNode = function(v) {
+  return _.has(this._nodes, v);
+};
+
+Graph.prototype.removeNode =  function(v) {
+  var self = this;
+  if (_.has(this._nodes, v)) {
+    var removeEdge = function(e) { self.removeEdge(self._edgeObjs[e]); };
+    delete this._nodes[v];
+    if (this._isCompound) {
+      this._removeFromParentsChildList(v);
+      delete this._parent[v];
+      _.each(this.children(v), function(child) {
+        this.setParent(child);
+      }, this);
+      delete this._children[v];
+    }
+    _.each(_.keys(this._in[v]), removeEdge);
+    delete this._in[v];
+    delete this._preds[v];
+    _.each(_.keys(this._out[v]), removeEdge);
+    delete this._out[v];
+    delete this._sucs[v];
+    --this._nodeCount;
+  }
+  return this;
+};
+
+Graph.prototype.setParent = function(v, parent) {
+  if (!this._isCompound) {
+    throw new Error("Cannot set parent in a non-compound graph");
+  }
+
+  if (_.isUndefined(parent)) {
+    parent = GRAPH_NODE;
+  } else {
+    // Coerce parent to string
+    parent += "";
+    for (var ancestor = parent;
+         !_.isUndefined(ancestor);
+         ancestor = this.parent(ancestor)) {
+      if (ancestor === v) {
+        throw new Error("Setting " + parent+ " as parent of " + v +
+                        " would create create a cycle");
+      }
+    }
+
+    this.setNode(parent);
+  }
+
+  this.setNode(v);
+  this._removeFromParentsChildList(v);
+  this._parent[v] = parent;
+  this._children[parent][v] = true;
+  return this;
+};
+
+Graph.prototype._removeFromParentsChildList = function(v) {
+  delete this._children[this._parent[v]][v];
+};
+
+Graph.prototype.parent = function(v) {
+  if (this._isCompound) {
+    var parent = this._parent[v];
+    if (parent !== GRAPH_NODE) {
+      return parent;
+    }
+  }
+};
+
+Graph.prototype.children = function(v) {
+  if (_.isUndefined(v)) {
+    v = GRAPH_NODE;
+  }
+
+  if (this._isCompound) {
+    var children = this._children[v];
+    if (children) {
+      return _.keys(children);
+    }
+  } else if (v === GRAPH_NODE) {
+    return this.nodes();
+  } else if (this.hasNode(v)) {
+    return [];
+  }
+};
+
+Graph.prototype.predecessors = function(v) {
+  var predsV = this._preds[v];
+  if (predsV) {
+    return _.keys(predsV);
+  }
+};
+
+Graph.prototype.successors = function(v) {
+  var sucsV = this._sucs[v];
+  if (sucsV) {
+    return _.keys(sucsV);
+  }
+};
+
+Graph.prototype.neighbors = function(v) {
+  var preds = this.predecessors(v);
+  if (preds) {
+    return _.union(preds, this.successors(v));
+  }
+};
+
+/* === Edge functions ========== */
+
+Graph.prototype.setDefaultEdgeLabel = function(newDefault) {
+  if (!_.isFunction(newDefault)) {
+    newDefault = _.constant(newDefault);
+  }
+  this._defaultEdgeLabelFn = newDefault;
+  return this;
+};
+
+Graph.prototype.edgeCount = function() {
+  return this._edgeCount;
+};
+
+Graph.prototype.edges = function() {
+  return _.values(this._edgeObjs);
+};
+
+Graph.prototype.setPath = function(vs, value) {
+  var self = this,
+      args = arguments;
+  _.reduce(vs, function(v, w) {
+    if (args.length > 1) {
+      self.setEdge(v, w, value);
+    } else {
+      self.setEdge(v, w);
+    }
+    return w;
+  });
+  return this;
+};
+
+/*
+ * setEdge(v, w, [value, [name]])
+ * setEdge({ v, w, [name] }, [value])
+ */
+Graph.prototype.setEdge = function() {
+  var v, w, name, value,
+      valueSpecified = false;
+
+  if (_.isPlainObject(arguments[0])) {
+    v = arguments[0].v;
+    w = arguments[0].w;
+    name = arguments[0].name;
+    if (arguments.length === 2) {
+      value = arguments[1];
+      valueSpecified = true;
+    }
+  } else {
+    v = arguments[0];
+    w = arguments[1];
+    name = arguments[3];
+    if (arguments.length > 2) {
+      value = arguments[2];
+      valueSpecified = true;
+    }
+  }
+
+  v = "" + v;
+  w = "" + w;
+  if (!_.isUndefined(name)) {
+    name = "" + name;
+  }
+
+  var e = edgeArgsToId(this._isDirected, v, w, name);
+  if (_.has(this._edgeLabels, e)) {
+    if (valueSpecified) {
+      this._edgeLabels[e] = value;
+    }
+    return this;
+  }
+
+  if (!_.isUndefined(name) && !this._isMultigraph) {
+    throw new Error("Cannot set a named edge when isMultigraph = false");
+  }
+
+  // It didn't exist, so we need to create it.
+  // First ensure the nodes exist.
+  this.setNode(v);
+  this.setNode(w);
+
+  this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);
+
+  var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);
+  // Ensure we add undirected edges in a consistent way.
+  v = edgeObj.v;
+  w = edgeObj.w;
+
+  Object.freeze(edgeObj);
+  this._edgeObjs[e] = edgeObj;
+  incrementOrInitEntry(this._preds[w], v);
+  incrementOrInitEntry(this._sucs[v], w);
+  this._in[w][e] = edgeObj;
+  this._out[v][e] = edgeObj;
+  this._edgeCount++;
+  return this;
+};
+
+Graph.prototype.edge = function(v, w, name) {
+  var e = (arguments.length === 1
+            ? edgeObjToId(this._isDirected, arguments[0])
+            : edgeArgsToId(this._isDirected, v, w, name));
+  return this._edgeLabels[e];
+};
+
+Graph.prototype.hasEdge = function(v, w, name) {
+  var e = (arguments.length === 1
+            ? edgeObjToId(this._isDirected, arguments[0])
+            : edgeArgsToId(this._isDirected, v, w, name));
+  return _.has(this._edgeLabels, e);
+};
+
+Graph.prototype.removeEdge = function(v, w, name) {
+  var e = (arguments.length === 1
+            ? edgeObjToId(this._isDirected, arguments[0])
+            : edgeArgsToId(this._isDirected, v, w, name)),
+      edge = this._edgeObjs[e];
+  if (edge) {
+    v = edge.v;
+    w = edge.w;
+    delete this._edgeLabels[e];
+    delete this._edgeObjs[e];
+    decrementOrRemoveEntry(this._preds[w], v);
+    decrementOrRemoveEntry(this._sucs[v], w);
+    delete this._in[w][e];
+    delete this._out[v][e];
+    this._edgeCount--;
+  }
+  return this;
+};
+
+Graph.prototype.inEdges = function(v, u) {
+  var inV = this._in[v];
+  if (inV) {
+    var edges = _.values(inV);
+    if (!u) {
+      return edges;
+    }
+    return _.filter(edges, function(edge) { return edge.v === u; });
+  }
+};
+
+Graph.prototype.outEdges = function(v, w) {
+  var outV = this._out[v];
+  if (outV) {
+    var edges = _.values(outV);
+    if (!w) {
+      return edges;
+    }
+    return _.filter(edges, function(edge) { return edge.w === w; });
+  }
+};
+
+Graph.prototype.nodeEdges = function(v, w) {
+  var inEdges = this.inEdges(v, w);
+  if (inEdges) {
+    return inEdges.concat(this.outEdges(v, w));
+  }
+};
+
+function incrementOrInitEntry(map, k) {
+  if (_.has(map, k)) {
+    map[k]++;
+  } else {
+    map[k] = 1;
+  }
+}
+
+function decrementOrRemoveEntry(map, k) {
+  if (!--map[k]) { delete map[k]; }
+}
+
+function edgeArgsToId(isDirected, v, w, name) {
+  if (!isDirected && v > w) {
+    var tmp = v;
+    v = w;
+    w = tmp;
+  }
+  return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM +
+             (_.isUndefined(name) ? DEFAULT_EDGE_NAME : name);
+}
+
+function edgeArgsToObj(isDirected, v, w, name) {
+  if (!isDirected && v > w) {
+    var tmp = v;
+    v = w;
+    w = tmp;
+  }
+  var edgeObj =  { v: v, w: w };
+  if (name) {
+    edgeObj.name = name;
+  }
+  return edgeObj;
+}
+
+function edgeObjToId(isDirected, edgeObj) {
+  return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);
+}
+
+},{"./lodash":49}],47:[function(require,module,exports){
+// Includes only the "core" of graphlib
+module.exports = {
+  Graph: require("./graph"),
+  version: require("./version")
+};
+
+},{"./graph":46,"./version":50}],48:[function(require,module,exports){
+var _ = require("./lodash"),
+    Graph = require("./graph");
+
+module.exports = {
+  write: write,
+  read: read
+};
+
+function write(g) {
+  var json = {
+    options: {
+      directed: g.isDirected(),
+      multigraph: g.isMultigraph(),
+      compound: g.isCompound()
+    },
+    nodes: writeNodes(g),
+    edges: writeEdges(g)
+  };
+  if (!_.isUndefined(g.graph())) {
+    json.value = _.clone(g.graph());
+  }
+  return json;
+}
+
+function writeNodes(g) {
+  return _.map(g.nodes(), function(v) {
+    var nodeValue = g.node(v),
+        parent = g.parent(v),
+        node = { v: v };
+    if (!_.isUndefined(nodeValue)) {
+      node.value = nodeValue;
+    }
+    if (!_.isUndefined(parent)) {
+      node.parent = parent;
+    }
+    return node;
+  });
+}
+
+function writeEdges(g) {
+  return _.map(g.edges(), function(e) {
+    var edgeValue = g.edge(e),
+        edge = { v: e.v, w: e.w };
+    if (!_.isUndefined(e.name)) {
+      edge.name = e.name;
+    }
+    if (!_.isUndefined(edgeValue)) {
+      edge.value = edgeValue;
+    }
+    return edge;
+  });
+}
+
+function read(json) {
+  var g = new Graph(json.options).setGraph(json.value);
+  _.each(json.nodes, function(entry) {
+    g.setNode(entry.v, entry.value);
+    if (entry.parent) {
+      g.setParent(entry.v, entry.parent);
+    }
+  });
+  _.each(json.edges, function(entry) {
+    g.setEdge({ v: entry.v, w: entry.w, name: entry.name }, entry.value);
+  });
+  return g;
+}
+
+},{"./graph":46,"./lodash":49}],49:[function(require,module,exports){
+module.exports=require(10)
+},{"/Users/cpettitt/projects/dagre/lib/lodash.js":10,"lodash":51}],50:[function(require,module,exports){
+module.exports = '1.0.5';
+
+},{}],51:[function(require,module,exports){
+(function (global){
+/**
+ * @license
+ * lodash 3.10.0 (Custom Build) <https://lodash.com/>
+ * Build: `lodash modern -d -o ./index.js`
+ * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
+ * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license <https://lodash.com/license>
+ */
+;(function() {
+
+  /** Used as a safe reference for `undefined` in pre-ES5 environments. */
+  var undefined;
+
+  /** Used as the semantic version number. */
+  var VERSION = '3.10.0';
+
+  /** Used to compose bitmasks for wrapper metadata. */
+  var BIND_FLAG = 1,
+      BIND_KEY_FLAG = 2,
+      CURRY_BOUND_FLAG = 4,
+      CURRY_FLAG = 8,
+      CURRY_RIGHT_FLAG = 16,
+      PARTIAL_FLAG = 32,
+      PARTIAL_RIGHT_FLAG = 64,
+      ARY_FLAG = 128,
+      REARG_FLAG = 256;
+
+  /** Used as default options for `_.trunc`. */
+  var DEFAULT_TRUNC_LENGTH = 30,
+      DEFAULT_TRUNC_OMISSION = '...';
+
+  /** Used to detect when a function becomes hot. */
+  var HOT_COUNT = 150,
+      HOT_SPAN = 16;
+
+  /** Used as the size to enable large array optimizations. */
+  var LARGE_ARRAY_SIZE = 200;
+
+  /** Used to indicate the type of lazy iteratees. */
+  var LAZY_FILTER_FLAG = 1,
+      LAZY_MAP_FLAG = 2;
+
+  /** Used as the `TypeError` message for "Functions" methods. */
+  var FUNC_ERROR_TEXT = 'Expected a function';
+
+  /** Used as the internal argument placeholder. */
+  var PLACEHOLDER = '__lodash_placeholder__';
+
+  /** `Object#toString` result references. */
+  var argsTag = '[object Arguments]',
+      arrayTag = '[object Array]',
+      boolTag = '[object Boolean]',
+      dateTag = '[object Date]',
+      errorTag = '[object Error]',
+      funcTag = '[object Function]',
+      mapTag = '[object Map]',
+      numberTag = '[object Number]',
+      objectTag = '[object Object]',
+      regexpTag = '[object RegExp]',
+      setTag = '[object Set]',
+      stringTag = '[object String]',
+      weakMapTag = '[object WeakMap]';
+
+  var arrayBufferTag = '[object ArrayBuffer]',
+      float32Tag = '[object Float32Array]',
+      float64Tag = '[object Float64Array]',
+      int8Tag = '[object Int8Array]',
+      int16Tag = '[object Int16Array]',
+      int32Tag = '[object Int32Array]',
+      uint8Tag = '[object Uint8Array]',
+      uint8ClampedTag = '[object Uint8ClampedArray]',
+      uint16Tag = '[object Uint16Array]',
+      uint32Tag = '[object Uint32Array]';
+
+  /** Used to match empty string literals in compiled template source. */
+  var reEmptyStringLeading = /\b__p \+= '';/g,
+      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
+      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
+
+  /** Used to match HTML entities and HTML characters. */
+  var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
+      reUnescapedHtml = /[&<>"'`]/g,
+      reHasEscapedHtml = RegExp(reEscapedHtml.source),
+      reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
+
+  /** Used to match template delimiters. */
+  var reEscape = /<%-([\s\S]+?)%>/g,
+      reEvaluate = /<%([\s\S]+?)%>/g,
+      reInterpolate = /<%=([\s\S]+?)%>/g;
+
+  /** Used to match property names within property paths. */
+  var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
+      reIsPlainProp = /^\w*$/,
+      rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
+
+  /**
+   * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns)
+   * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).
+   */
+  var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,
+      reHasRegExpChars = RegExp(reRegExpChars.source);
+
+  /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */
+  var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g;
+
+  /** Used to match backslashes in property paths. */
+  var reEscapeChar = /\\(\\)?/g;
+
+  /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */
+  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
+
+  /** Used to match `RegExp` flags from their coerced string values. */
+  var reFlags = /\w*$/;
+
+  /** Used to detect hexadecimal string values. */
+  var reHasHexPrefix = /^0[xX]/;
+
+  /** Used to detect host constructors (Safari > 5). */
+  var reIsHostCtor = /^\[object .+?Constructor\]$/;
+
+  /** Used to detect unsigned integer values. */
+  var reIsUint = /^\d+$/;
+
+  /** Used to match latin-1 supplementary letters (excluding mathematical operators). */
+  var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
+
+  /** Used to ensure capturing order of template delimiters. */
+  var reNoMatch = /($^)/;
+
+  /** Used to match unescaped characters in compiled string literals. */
+  var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
+
+  /** Used to match words to create compound words. */
+  var reWords = (function() {
+    var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
+        lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
+
+    return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
+  }());
+
+  /** Used to assign default `context` object properties. */
+  var contextProps = [
+    'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
+    'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
+    'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite',
+    'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
+    'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap'
+  ];
+
+  /** Used to make template sourceURLs easier to identify. */
+  var templateCounter = -1;
+
+  /** Used to identify `toStringTag` values of typed arrays. */
+  var typedArrayTags = {};
+  typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
+  typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
+  typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
+  typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
+  typedArrayTags[uint32Tag] = true;
+  typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
+  typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
+  typedArrayTags[dateTag] = typedArrayTags[errorTag] =
+  typedArrayTags[funcTag] = typedArrayTags[mapTag] =
+  typedArrayTags[numberTag] = typedArrayTags[objectTag] =
+  typedArrayTags[regexpTag] = typedArrayTags[setTag] =
+  typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
+
+  /** Used to identify `toStringTag` values supported by `_.clone`. */
+  var cloneableTags = {};
+  cloneableTags[argsTag] = cloneableTags[arrayTag] =
+  cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
+  cloneableTags[dateTag] = cloneableTags[float32Tag] =
+  cloneableTags[float64Tag] = cloneableTags[int8Tag] =
+  cloneableTags[int16Tag] = cloneableTags[int32Tag] =
+  cloneableTags[numberTag] = cloneableTags[objectTag] =
+  cloneableTags[regexpTag] = cloneableTags[stringTag] =
+  cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
+  cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
+  cloneableTags[errorTag] = cloneableTags[funcTag] =
+  cloneableTags[mapTag] = cloneableTags[setTag] =
+  cloneableTags[weakMapTag] = false;
+
+  /** Used to map latin-1 supplementary letters to basic latin letters. */
+  var deburredLetters = {
+    '\xc0': 'A',  '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
+    '\xe0': 'a',  '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
+    '\xc7': 'C',  '\xe7': 'c',
+    '\xd0': 'D',  '\xf0': 'd',
+    '\xc8': 'E',  '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
+    '\xe8': 'e',  '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
+    '\xcC': 'I',  '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
+    '\xeC': 'i',  '\xed': 'i', '\xee': 'i', '\xef': 'i',
+    '\xd1': 'N',  '\xf1': 'n',
+    '\xd2': 'O',  '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
+    '\xf2': 'o',  '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
+    '\xd9': 'U',  '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
+    '\xf9': 'u',  '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
+    '\xdd': 'Y',  '\xfd': 'y', '\xff': 'y',
+    '\xc6': 'Ae', '\xe6': 'ae',
+    '\xde': 'Th', '\xfe': 'th',
+    '\xdf': 'ss'
+  };
+
+  /** Used to map characters to HTML entities. */
+  var htmlEscapes = {
+    '&': '&amp;',
+    '<': '&lt;',
+    '>': '&gt;',
+    '"': '&quot;',
+    "'": '&#39;',
+    '`': '&#96;'
+  };
+
+  /** Used to map HTML entities to characters. */
+  var htmlUnescapes = {
+    '&amp;': '&',
+    '&lt;': '<',
+    '&gt;': '>',
+    '&quot;': '"',
+    '&#39;': "'",
+    '&#96;': '`'
+  };
+
+  /** Used to determine if values are of the language type `Object`. */
+  var objectTypes = {
+    'function': true,
+    'object': true
+  };
+
+  /** Used to escape characters for inclusion in compiled regexes. */
+  var regexpEscapes = {
+    '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34',
+    '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39',
+    'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46',
+    'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66',
+    'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78'
+  };
+
+  /** Used to escape characters for inclusion in compiled string literals. */
+  var stringEscapes = {
+    '\\': '\\',
+    "'": "'",
+    '\n': 'n',
+    '\r': 'r',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+
+  /** Detect free variable `exports`. */
+  var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
+
+  /** Detect free variable `module`. */
+  var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
+
+  /** Detect free variable `global` from Node.js. */
+  var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
+
+  /** Detect free variable `self`. */
+  var freeSelf = objectTypes[typeof self] && self && self.Object && self;
+
+  /** Detect free variable `window`. */
+  var freeWindow = objectTypes[typeof window] && window && window.Object && window;
+
+  /** Detect the popular CommonJS extension `module.exports`. */
+  var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
+
+  /**
+   * Used as a reference to the global object.
+   *
+   * The `this` value is used if it's the global object to avoid Greasemonkey's
+   * restricted `window` object, otherwise the `window` object is used.
+   */
+  var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * The base implementation of `compareAscending` which compares values and
+   * sorts them in ascending order without guaranteeing a stable sort.
+   *
+   * @private
+   * @param {*} value The value to compare.
+   * @param {*} other The other value to compare.
+   * @returns {number} Returns the sort order indicator for `value`.
+   */
+  function baseCompareAscending(value, other) {
+    if (value !== other) {
+      var valIsNull = value === null,
+          valIsUndef = value === undefined,
+          valIsReflexive = value === value;
+
+      var othIsNull = other === null,
+          othIsUndef = other === undefined,
+          othIsReflexive = other === other;
+
+      if ((value > other && !othIsNull) || !valIsReflexive ||
+          (valIsNull && !othIsUndef && othIsReflexive) ||
+          (valIsUndef && othIsReflexive)) {
+        return 1;
+      }
+      if ((value < other && !valIsNull) || !othIsReflexive ||
+          (othIsNull && !valIsUndef && valIsReflexive) ||
+          (othIsUndef && valIsReflexive)) {
+        return -1;
+      }
+    }
+    return 0;
+  }
+
+  /**
+   * The base implementation of `_.findIndex` and `_.findLastIndex` without
+   * support for callback shorthands and `this` binding.
+   *
+   * @private
+   * @param {Array} array The array to search.
+   * @param {Function} predicate The function invoked per iteration.
+   * @param {boolean} [fromRight] Specify iterating from right to left.
+   * @returns {number} Returns the index of the matched value, else `-1`.
+   */
+  function baseFindIndex(array, predicate, fromRight) {
+    var length = array.length,
+        index = fromRight ? length : -1;
+
+    while ((fromRight ? index-- : ++index < length)) {
+      if (predicate(array[index], index, array)) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * The base implementation of `_.indexOf` without support for binary searches.
+   *
+   * @private
+   * @param {Array} array The array to search.
+   * @param {*} value The value to search for.
+   * @param {number} fromIndex The index to search from.
+   * @returns {number} Returns the index of the matched value, else `-1`.
+   */
+  function baseIndexOf(array, value, fromIndex) {
+    if (value !== value) {
+      return indexOfNaN(array, fromIndex);
+    }
+    var index = fromIndex - 1,
+        length = array.length;
+
+    while (++index < length) {
+      if (array[index] === value) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * The base implementation of `_.isFunction` without support for environments
+   * with incorrect `typeof` results.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+   */
+  function baseIsFunction(value) {
+    // Avoid a Chakra JIT bug in compatibility modes of IE 11.
+    // See https://github.com/jashkenas/underscore/issues/1621 for more details.
+    return typeof value == 'function' || false;
+  }
+
+  /**
+   * Converts `value` to a string if it's not one. An empty string is returned
+   * for `null` or `undefined` values.
+   *
+   * @private
+   * @param {*} value The value to process.
+   * @returns {string} Returns the string.
+   */
+  function baseToString(value) {
+    return value == null ? '' : (value + '');
+  }
+
+  /**
+   * Used by `_.trim` and `_.trimLeft` to get the index of the first character
+   * of `string` that is not found in `chars`.
+   *
+   * @private
+   * @param {string} string The string to inspect.
+   * @param {string} chars The characters to find.
+   * @returns {number} Returns the index of the first character not found in `chars`.
+   */
+  function charsLeftIndex(string, chars) {
+    var index = -1,
+        length = string.length;
+
+    while (++index < length && chars.indexOf(string.charAt(index)) > -1) {}
+    return index;
+  }
+
+  /**
+   * Used by `_.trim` and `_.trimRight` to get the index of the last character
+   * of `string` that is not found in `chars`.
+   *
+   * @private
+   * @param {string} string The string to inspect.
+   * @param {string} chars The characters to find.
+   * @returns {number} Returns the index of the last character not found in `chars`.
+   */
+  function charsRightIndex(string, chars) {
+    var index = string.length;
+
+    while (index-- && chars.indexOf(string.charAt(index)) > -1) {}
+    return index;
+  }
+
+  /**
+   * Used by `_.sortBy` to compare transformed elements of a collection and stable
+   * sort them in ascending order.
+   *
+   * @private
+   * @param {Object} object The object to compare.
+   * @param {Object} other The other object to compare.
+   * @returns {number} Returns the sort order indicator for `object`.
+   */
+  function compareAscending(object, other) {
+    return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
+  }
+
+  /**
+   * Used by `_.sortByOrder` to compare multiple properties of a value to another
+   * and stable sort them.
+   *
+   * If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise,
+   * a value is sorted in ascending order if its corresponding order is "asc", and
+   * descending if "desc".
+   *
+   * @private
+   * @param {Object} object The object to compare.
+   * @param {Object} other The other object to compare.
+   * @param {boolean[]} orders The order to sort by for each property.
+   * @returns {number} Returns the sort order indicator for `object`.
+   */
+  function compareMultiple(object, other, orders) {
+    var index = -1,
+        objCriteria = object.criteria,
+        othCriteria = other.criteria,
+        length = objCriteria.length,
+        ordersLength = orders.length;
+
+    while (++index < length) {
+      var result = baseCompareAscending(objCriteria[index], othCriteria[index]);
+      if (result) {
+        if (index >= ordersLength) {
+          return result;
+        }
+        var order = orders[index];
+        return result * ((order === 'asc' || order === true) ? 1 : -1);
+      }
+    }
+    // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
+    // that causes it, under certain circumstances, to provide the same value for
+    // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
+    // for more details.
+    //
+    // This also ensures a stable sort in V8 and other engines.
+    // See https://code.google.com/p/v8/issues/detail?id=90 for more details.
+    return object.index - other.index;
+  }
+
+  /**
+   * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
+   *
+   * @private
+   * @param {string} letter The matched letter to deburr.
+   * @returns {string} Returns the deburred letter.
+   */
+  function deburrLetter(letter) {
+    return deburredLetters[letter];
+  }
+
+  /**
+   * Used by `_.escape` to convert characters to HTML entities.
+   *
+   * @private
+   * @param {string} chr The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  function escapeHtmlChar(chr) {
+    return htmlEscapes[chr];
+  }
+
+  /**
+   * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes.
+   *
+   * @private
+   * @param {string} chr The matched character to escape.
+   * @param {string} leadingChar The capture group for a leading character.
+   * @param {string} whitespaceChar The capture group for a whitespace character.
+   * @returns {string} Returns the escaped character.
+   */
+  function escapeRegExpChar(chr, leadingChar, whitespaceChar) {
+    if (leadingChar) {
+      chr = regexpEscapes[chr];
+    } else if (whitespaceChar) {
+      chr = stringEscapes[chr];
+    }
+    return '\\' + chr;
+  }
+
+  /**
+   * Used by `_.template` to escape characters for inclusion in compiled string literals.
+   *
+   * @private
+   * @param {string} chr The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  function escapeStringChar(chr) {
+    return '\\' + stringEscapes[chr];
+  }
+
+  /**
+   * Gets the index at which the first occurrence of `NaN` is found in `array`.
+   *
+   * @private
+   * @param {Array} array The array to search.
+   * @param {number} fromIndex The index to search from.
+   * @param {boolean} [fromRight] Specify iterating from right to left.
+   * @returns {number} Returns the index of the matched `NaN`, else `-1`.
+   */
+  function indexOfNaN(array, fromIndex, fromRight) {
+    var length = array.length,
+        index = fromIndex + (fromRight ? 0 : -1);
+
+    while ((fromRight ? index-- : ++index < length)) {
+      var other = array[index];
+      if (other !== other) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * Checks if `value` is object-like.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+   */
+  function isObjectLike(value) {
+    return !!value && typeof value == 'object';
+  }
+
+  /**
+   * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
+   * character code is whitespace.
+   *
+   * @private
+   * @param {number} charCode The character code to inspect.
+   * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.
+   */
+  function isSpace(charCode) {
+    return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
+      (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
+  }
+
+  /**
+   * Replaces all `placeholder` elements in `array` with an internal placeholder
+   * and returns an array of their indexes.
+   *
+   * @private
+   * @param {Array} array The array to modify.
+   * @param {*} placeholder The placeholder to replace.
+   * @returns {Array} Returns the new array of placeholder indexes.
+   */
+  function replaceHolders(array, placeholder) {
+    var index = -1,
+        length = array.length,
+        resIndex = -1,
+        result = [];
+
+    while (++index < length) {
+      if (array[index] === placeholder) {
+        array[index] = PLACEHOLDER;
+        result[++resIndex] = index;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * An implementation of `_.uniq` optimized for sorted arrays without support
+   * for callback shorthands and `this` binding.
+   *
+   * @private
+   * @param {Array} array The array to inspect.
+   * @param {Function} [iteratee] The function invoked per iteration.
+   * @returns {Array} Returns the new duplicate-value-free array.
+   */
+  function sortedUniq(array, iteratee) {
+    var seen,
+        index = -1,
+        length = array.length,
+        resIndex = -1,
+        result = [];
+
+    while (++index < length) {
+      var value = array[index],
+          computed = iteratee ? iteratee(value, index, array) : value;
+
+      if (!index || seen !== computed) {
+        seen = computed;
+        result[++resIndex] = value;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace
+   * character of `string`.
+   *
+   * @private
+   * @param {string} string The string to inspect.
+   * @returns {number} Returns the index of the first non-whitespace character.
+   */
+  function trimmedLeftIndex(string) {
+    var index = -1,
+        length = string.length;
+
+    while (++index < length && isSpace(string.charCodeAt(index))) {}
+    return index;
+  }
+
+  /**
+   * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace
+   * character of `string`.
+   *
+   * @private
+   * @param {string} string The string to inspect.
+   * @returns {number} Returns the index of the last non-whitespace character.
+   */
+  function trimmedRightIndex(string) {
+    var index = string.length;
+
+    while (index-- && isSpace(string.charCodeAt(index))) {}
+    return index;
+  }
+
+  /**
+   * Used by `_.unescape` to convert HTML entities to characters.
+   *
+   * @private
+   * @param {string} chr The matched character to unescape.
+   * @returns {string} Returns the unescaped character.
+   */
+  function unescapeHtmlChar(chr) {
+    return htmlUnescapes[chr];
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Create a new pristine `lodash` function using the given `context` object.
+   *
+   * @static
+   * @memberOf _
+   * @category Utility
+   * @param {Object} [context=root] The context object.
+   * @returns {Function} Returns a new `lodash` function.
+   * @example
+   *
+   * _.mixin({ 'foo': _.constant('foo') });
+   *
+   * var lodash = _.runInContext();
+   * lodash.mixin({ 'bar': lodash.constant('bar') });
+   *
+   * _.isFunction(_.foo);
+   * // => true
+   * _.isFunction(_.bar);
+   * // => false
+   *
+   * lodash.isFunction(lodash.foo);
+   * // => false
+   * lodash.isFunction(lodash.bar);
+   * // => true
+   *
+   * // using `context` to mock `Date#getTime` use in `_.now`
+   * var mock = _.runInContext({
+   *   'Date': function() {
+   *     return { 'getTime': getTimeMock };
+   *   }
+   * });
+   *
+   * // or creating a suped-up `defer` in Node.js
+   * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
+   */
+  function runInContext(context) {
+    // Avoid issues with some ES3 environments that attempt to use values, named
+    // after built-in constructors like `Object`, for the creation of literals.
+    // ES5 clears this up by stating that literals must use built-in constructors.
+    // See https://es5.github.io/#x11.1.5 for more details.
+    context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
+
+    /** Native constructor references. */
+    var Array = context.Array,
+        Date = context.Date,
+        Error = context.Error,
+        Function = context.Function,
+        Math = context.Math,
+        Number = context.Number,
+        Object = context.Object,
+        RegExp = context.RegExp,
+        String = context.String,
+        TypeError = context.TypeError;
+
+    /** Used for native method references. */
+    var arrayProto = Array.prototype,
+        objectProto = Object.prototype,
+        stringProto = String.prototype;
+
+    /** Used to resolve the decompiled source of functions. */
+    var fnToString = Function.prototype.toString;
+
+    /** Used to check objects for own properties. */
+    var hasOwnProperty = objectProto.hasOwnProperty;
+
+    /** Used to generate unique IDs. */
+    var idCounter = 0;
+
+    /**
+     * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+     * of values.
+     */
+    var objToString = objectProto.toString;
+
+    /** Used to restore the original `_` reference in `_.noConflict`. */
+    var oldDash = root._;
+
+    /** Used to detect if a method is native. */
+    var reIsNative = RegExp('^' +
+      fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
+      .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
+    );
+
+    /** Native method references. */
+    var ArrayBuffer = context.ArrayBuffer,
+        clearTimeout = context.clearTimeout,
+        parseFloat = context.parseFloat,
+        pow = Math.pow,
+        propertyIsEnumerable = objectProto.propertyIsEnumerable,
+        Set = getNative(context, 'Set'),
+        setTimeout = context.setTimeout,
+        splice = arrayProto.splice,
+        Uint8Array = context.Uint8Array,
+        WeakMap = getNative(context, 'WeakMap');
+
+    /* Native method references for those with the same name as other `lodash` methods. */
+    var nativeCeil = Math.ceil,
+        nativeCreate = getNative(Object, 'create'),
+        nativeFloor = Math.floor,
+        nativeIsArray = getNative(Array, 'isArray'),
+        nativeIsFinite = context.isFinite,
+        nativeKeys = getNative(Object, 'keys'),
+        nativeMax = Math.max,
+        nativeMin = Math.min,
+        nativeNow = getNative(Date, 'now'),
+        nativeParseInt = context.parseInt,
+        nativeRandom = Math.random;
+
+    /** Used as references for `-Infinity` and `Infinity`. */
+    var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
+        POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
+
+    /** Used as references for the maximum length and index of an array. */
+    var MAX_ARRAY_LENGTH = 4294967295,
+        MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
+        HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
+
+    /**
+     * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
+     * of an array-like value.
+     */
+    var MAX_SAFE_INTEGER = 9007199254740991;
+
+    /** Used to store function metadata. */
+    var metaMap = WeakMap && new WeakMap;
+
+    /** Used to lookup unminified function names. */
+    var realNames = {};
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` object which wraps `value` to enable implicit chaining.
+     * Methods that operate on and return arrays, collections, and functions can
+     * be chained together. Methods that retrieve a single value or may return a
+     * primitive value will automatically end the chain returning the unwrapped
+     * value. Explicit chaining may be enabled using `_.chain`. The execution of
+     * chained methods is lazy, that is, execution is deferred until `_#value`
+     * is implicitly or explicitly called.
+     *
+     * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
+     * fusion is an optimization strategy which merge iteratee calls; this can help
+     * to avoid the creation of intermediate data structures and greatly reduce the
+     * number of iteratee executions.
+     *
+     * Chaining is supported in custom builds as long as the `_#value` method is
+     * directly or indirectly included in the build.
+     *
+     * In addition to lodash methods, wrappers have `Array` and `String` methods.
+     *
+     * The wrapper `Array` methods are:
+     * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
+     * `splice`, and `unshift`
+     *
+     * The wrapper `String` methods are:
+     * `replace` and `split`
+     *
+     * The wrapper methods that support shortcut fusion are:
+     * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
+     * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
+     * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
+     * and `where`
+     *
+     * The chainable wrapper methods are:
+     * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
+     * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
+     * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
+     * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,
+     * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,
+     * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
+     * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
+     * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,
+     * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,
+     * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
+     * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
+     * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,
+     * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,
+     * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
+     * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
+     * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
+     * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
+     *
+     * The wrapper methods that are **not** chainable by default are:
+     * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
+     * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
+     * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
+     * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
+     * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
+     * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
+     * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
+     * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
+     * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
+     * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
+     * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
+     * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
+     * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
+     * `unescape`, `uniqueId`, `value`, and `words`
+     *
+     * The wrapper method `sample` will return a wrapped value when `n` is provided,
+     * otherwise an unwrapped value is returned.
+     *
+     * @name _
+     * @constructor
+     * @category Chain
+     * @param {*} value The value to wrap in a `lodash` instance.
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var wrapped = _([1, 2, 3]);
+     *
+     * // returns an unwrapped value
+     * wrapped.reduce(function(total, n) {
+     *   return total + n;
+     * });
+     * // => 6
+     *
+     * // returns a wrapped value
+     * var squares = wrapped.map(function(n) {
+     *   return n * n;
+     * });
+     *
+     * _.isArray(squares);
+     * // => false
+     *
+     * _.isArray(squares.value());
+     * // => true
+     */
+    function lodash(value) {
+      if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
+        if (value instanceof LodashWrapper) {
+          return value;
+        }
+        if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
+          return wrapperClone(value);
+        }
+      }
+      return new LodashWrapper(value);
+    }
+
+    /**
+     * The function whose prototype all chaining wrappers inherit from.
+     *
+     * @private
+     */
+    function baseLodash() {
+      // No operation performed.
+    }
+
+    /**
+     * The base constructor for creating `lodash` wrapper objects.
+     *
+     * @private
+     * @param {*} value The value to wrap.
+     * @param {boolean} [chainAll] Enable chaining for all wrapper methods.
+     * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.
+     */
+    function LodashWrapper(value, chainAll, actions) {
+      this.__wrapped__ = value;
+      this.__actions__ = actions || [];
+      this.__chain__ = !!chainAll;
+    }
+
+    /**
+     * An object environment feature flags.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    var support = lodash.support = {};
+
+    /**
+     * By default, the template delimiters used by lodash are like those in
+     * embedded Ruby (ERB). Change the following template settings to use
+     * alternative delimiters.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    lodash.templateSettings = {
+
+      /**
+       * Used to detect `data` property values to be HTML-escaped.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'escape': reEscape,
+
+      /**
+       * Used to detect code to be evaluated.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'evaluate': reEvaluate,
+
+      /**
+       * Used to detect `data` property values to inject.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'interpolate': reInterpolate,
+
+      /**
+       * Used to reference the data object in the template text.
+       *
+       * @memberOf _.templateSettings
+       * @type string
+       */
+      'variable': '',
+
+      /**
+       * Used to import variables into the compiled template.
+       *
+       * @memberOf _.templateSettings
+       * @type Object
+       */
+      'imports': {
+
+        /**
+         * A reference to the `lodash` function.
+         *
+         * @memberOf _.templateSettings.imports
+         * @type Function
+         */
+        '_': lodash
+      }
+    };
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
+     *
+     * @private
+     * @param {*} value The value to wrap.
+     */
+    function LazyWrapper(value) {
+      this.__wrapped__ = value;
+      this.__actions__ = [];
+      this.__dir__ = 1;
+      this.__filtered__ = false;
+      this.__iteratees__ = [];
+      this.__takeCount__ = POSITIVE_INFINITY;
+      this.__views__ = [];
+    }
+
+    /**
+     * Creates a clone of the lazy wrapper object.
+     *
+     * @private
+     * @name clone
+     * @memberOf LazyWrapper
+     * @returns {Object} Returns the cloned `LazyWrapper` object.
+     */
+    function lazyClone() {
+      var result = new LazyWrapper(this.__wrapped__);
+      result.__actions__ = arrayCopy(this.__actions__);
+      result.__dir__ = this.__dir__;
+      result.__filtered__ = this.__filtered__;
+      result.__iteratees__ = arrayCopy(this.__iteratees__);
+      result.__takeCount__ = this.__takeCount__;
+      result.__views__ = arrayCopy(this.__views__);
+      return result;
+    }
+
+    /**
+     * Reverses the direction of lazy iteration.
+     *
+     * @private
+     * @name reverse
+     * @memberOf LazyWrapper
+     * @returns {Object} Returns the new reversed `LazyWrapper` object.
+     */
+    function lazyReverse() {
+      if (this.__filtered__) {
+        var result = new LazyWrapper(this);
+        result.__dir__ = -1;
+        result.__filtered__ = true;
+      } else {
+        result = this.clone();
+        result.__dir__ *= -1;
+      }
+      return result;
+    }
+
+    /**
+     * Extracts the unwrapped value from its lazy wrapper.
+     *
+     * @private
+     * @name value
+     * @memberOf LazyWrapper
+     * @returns {*} Returns the unwrapped value.
+     */
+    function lazyValue() {
+      var array = this.__wrapped__.value(),
+          dir = this.__dir__,
+          isArr = isArray(array),
+          isRight = dir < 0,
+          arrLength = isArr ? array.length : 0,
+          view = getView(0, arrLength, this.__views__),
+          start = view.start,
+          end = view.end,
+          length = end - start,
+          index = isRight ? end : (start - 1),
+          iteratees = this.__iteratees__,
+          iterLength = iteratees.length,
+          resIndex = 0,
+          takeCount = nativeMin(length, this.__takeCount__);
+
+      if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {
+        return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);
+      }
+      var result = [];
+
+      outer:
+      while (length-- && resIndex < takeCount) {
+        index += dir;
+
+        var iterIndex = -1,
+            value = array[index];
+
+        while (++iterIndex < iterLength) {
+          var data = iteratees[iterIndex],
+              iteratee = data.iteratee,
+              type = data.type,
+              computed = iteratee(value);
+
+          if (type == LAZY_MAP_FLAG) {
+            value = computed;
+          } else if (!computed) {
+            if (type == LAZY_FILTER_FLAG) {
+              continue outer;
+            } else {
+              break outer;
+            }
+          }
+        }
+        result[resIndex++] = value;
+      }
+      return result;
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a cache object to store key/value pairs.
+     *
+     * @private
+     * @static
+     * @name Cache
+     * @memberOf _.memoize
+     */
+    function MapCache() {
+      this.__data__ = {};
+    }
+
+    /**
+     * Removes `key` and its value from the cache.
+     *
+     * @private
+     * @name delete
+     * @memberOf _.memoize.Cache
+     * @param {string} key The key of the value to remove.
+     * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`.
+     */
+    function mapDelete(key) {
+      return this.has(key) && delete this.__data__[key];
+    }
+
+    /**
+     * Gets the cached value for `key`.
+     *
+     * @private
+     * @name get
+     * @memberOf _.memoize.Cache
+     * @param {string} key The key of the value to get.
+     * @returns {*} Returns the cached value.
+     */
+    function mapGet(key) {
+      return key == '__proto__' ? undefined : this.__data__[key];
+    }
+
+    /**
+     * Checks if a cached value for `key` exists.
+     *
+     * @private
+     * @name has
+     * @memberOf _.memoize.Cache
+     * @param {string} key The key of the entry to check.
+     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+     */
+    function mapHas(key) {
+      return key != '__proto__' && hasOwnProperty.call(this.__data__, key);
+    }
+
+    /**
+     * Sets `value` to `key` of the cache.
+     *
+     * @private
+     * @name set
+     * @memberOf _.memoize.Cache
+     * @param {string} key The key of the value to cache.
+     * @param {*} value The value to cache.
+     * @returns {Object} Returns the cache object.
+     */
+    function mapSet(key, value) {
+      if (key != '__proto__') {
+        this.__data__[key] = value;
+      }
+      return this;
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     *
+     * Creates a cache object to store unique values.
+     *
+     * @private
+     * @param {Array} [values] The values to cache.
+     */
+    function SetCache(values) {
+      var length = values ? values.length : 0;
+
+      this.data = { 'hash': nativeCreate(null), 'set': new Set };
+      while (length--) {
+        this.push(values[length]);
+      }
+    }
+
+    /**
+     * Checks if `value` is in `cache` mimicking the return signature of
+     * `_.indexOf` by returning `0` if the value is found, else `-1`.
+     *
+     * @private
+     * @param {Object} cache The cache to search.
+     * @param {*} value The value to search for.
+     * @returns {number} Returns `0` if `value` is found, else `-1`.
+     */
+    function cacheIndexOf(cache, value) {
+      var data = cache.data,
+          result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
+
+      return result ? 0 : -1;
+    }
+
+    /**
+     * Adds `value` to the cache.
+     *
+     * @private
+     * @name push
+     * @memberOf SetCache
+     * @param {*} value The value to cache.
+     */
+    function cachePush(value) {
+      var data = this.data;
+      if (typeof value == 'string' || isObject(value)) {
+        data.set.add(value);
+      } else {
+        data.hash[value] = true;
+      }
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a new array joining `array` with `other`.
+     *
+     * @private
+     * @param {Array} array The array to join.
+     * @param {Array} other The other array to join.
+     * @returns {Array} Returns the new concatenated array.
+     */
+    function arrayConcat(array, other) {
+      var index = -1,
+          length = array.length,
+          othIndex = -1,
+          othLength = other.length,
+          result = Array(length + othLength);
+
+      while (++index < length) {
+        result[index] = array[index];
+      }
+      while (++othIndex < othLength) {
+        result[index++] = other[othIndex];
+      }
+      return result;
+    }
+
+    /**
+     * Copies the values of `source` to `array`.
+     *
+     * @private
+     * @param {Array} source The array to copy values from.
+     * @param {Array} [array=[]] The array to copy values to.
+     * @returns {Array} Returns `array`.
+     */
+    function arrayCopy(source, array) {
+      var index = -1,
+          length = source.length;
+
+      array || (array = Array(length));
+      while (++index < length) {
+        array[index] = source[index];
+      }
+      return array;
+    }
+
+    /**
+     * A specialized version of `_.forEach` for arrays without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Array} Returns `array`.
+     */
+    function arrayEach(array, iteratee) {
+      var index = -1,
+          length = array.length;
+
+      while (++index < length) {
+        if (iteratee(array[index], index, array) === false) {
+          break;
+        }
+      }
+      return array;
+    }
+
+    /**
+     * A specialized version of `_.forEachRight` for arrays without support for
+     * callback shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Array} Returns `array`.
+     */
+    function arrayEachRight(array, iteratee) {
+      var length = array.length;
+
+      while (length--) {
+        if (iteratee(array[length], length, array) === false) {
+          break;
+        }
+      }
+      return array;
+    }
+
+    /**
+     * A specialized version of `_.every` for arrays without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {boolean} Returns `true` if all elements pass the predicate check,
+     *  else `false`.
+     */
+    function arrayEvery(array, predicate) {
+      var index = -1,
+          length = array.length;
+
+      while (++index < length) {
+        if (!predicate(array[index], index, array)) {
+          return false;
+        }
+      }
+      return true;
+    }
+
+    /**
+     * A specialized version of `baseExtremum` for arrays which invokes `iteratee`
+     * with one argument: (value).
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {Function} comparator The function used to compare values.
+     * @param {*} exValue The initial extremum value.
+     * @returns {*} Returns the extremum value.
+     */
+    function arrayExtremum(array, iteratee, comparator, exValue) {
+      var index = -1,
+          length = array.length,
+          computed = exValue,
+          result = computed;
+
+      while (++index < length) {
+        var value = array[index],
+            current = +iteratee(value);
+
+        if (comparator(current, computed)) {
+          computed = current;
+          result = value;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * A specialized version of `_.filter` for arrays without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {Array} Returns the new filtered array.
+     */
+    function arrayFilter(array, predicate) {
+      var index = -1,
+          length = array.length,
+          resIndex = -1,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index];
+        if (predicate(value, index, array)) {
+          result[++resIndex] = value;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * A specialized version of `_.map` for arrays without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Array} Returns the new mapped array.
+     */
+    function arrayMap(array, iteratee) {
+      var index = -1,
+          length = array.length,
+          result = Array(length);
+
+      while (++index < length) {
+        result[index] = iteratee(array[index], index, array);
+      }
+      return result;
+    }
+
+    /**
+     * Appends the elements of `values` to `array`.
+     *
+     * @private
+     * @param {Array} array The array to modify.
+     * @param {Array} values The values to append.
+     * @returns {Array} Returns `array`.
+     */
+    function arrayPush(array, values) {
+      var index = -1,
+          length = values.length,
+          offset = array.length;
+
+      while (++index < length) {
+        array[offset + index] = values[index];
+      }
+      return array;
+    }
+
+    /**
+     * A specialized version of `_.reduce` for arrays without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {*} [accumulator] The initial value.
+     * @param {boolean} [initFromArray] Specify using the first element of `array`
+     *  as the initial value.
+     * @returns {*} Returns the accumulated value.
+     */
+    function arrayReduce(array, iteratee, accumulator, initFromArray) {
+      var index = -1,
+          length = array.length;
+
+      if (initFromArray && length) {
+        accumulator = array[++index];
+      }
+      while (++index < length) {
+        accumulator = iteratee(accumulator, array[index], index, array);
+      }
+      return accumulator;
+    }
+
+    /**
+     * A specialized version of `_.reduceRight` for arrays without support for
+     * callback shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {*} [accumulator] The initial value.
+     * @param {boolean} [initFromArray] Specify using the last element of `array`
+     *  as the initial value.
+     * @returns {*} Returns the accumulated value.
+     */
+    function arrayReduceRight(array, iteratee, accumulator, initFromArray) {
+      var length = array.length;
+      if (initFromArray && length) {
+        accumulator = array[--length];
+      }
+      while (length--) {
+        accumulator = iteratee(accumulator, array[length], length, array);
+      }
+      return accumulator;
+    }
+
+    /**
+     * A specialized version of `_.some` for arrays without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {boolean} Returns `true` if any element passes the predicate check,
+     *  else `false`.
+     */
+    function arraySome(array, predicate) {
+      var index = -1,
+          length = array.length;
+
+      while (++index < length) {
+        if (predicate(array[index], index, array)) {
+          return true;
+        }
+      }
+      return false;
+    }
+
+    /**
+     * A specialized version of `_.sum` for arrays without support for callback
+     * shorthands and `this` binding..
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {number} Returns the sum.
+     */
+    function arraySum(array, iteratee) {
+      var length = array.length,
+          result = 0;
+
+      while (length--) {
+        result += +iteratee(array[length]) || 0;
+      }
+      return result;
+    }
+
+    /**
+     * Used by `_.defaults` to customize its `_.assign` use.
+     *
+     * @private
+     * @param {*} objectValue The destination object property value.
+     * @param {*} sourceValue The source object property value.
+     * @returns {*} Returns the value to assign to the destination object.
+     */
+    function assignDefaults(objectValue, sourceValue) {
+      return objectValue === undefined ? sourceValue : objectValue;
+    }
+
+    /**
+     * Used by `_.template` to customize its `_.assign` use.
+     *
+     * **Note:** This function is like `assignDefaults` except that it ignores
+     * inherited property values when checking if a property is `undefined`.
+     *
+     * @private
+     * @param {*} objectValue The destination object property value.
+     * @param {*} sourceValue The source object property value.
+     * @param {string} key The key associated with the object and source values.
+     * @param {Object} object The destination object.
+     * @returns {*} Returns the value to assign to the destination object.
+     */
+    function assignOwnDefaults(objectValue, sourceValue, key, object) {
+      return (objectValue === undefined || !hasOwnProperty.call(object, key))
+        ? sourceValue
+        : objectValue;
+    }
+
+    /**
+     * A specialized version of `_.assign` for customizing assigned values without
+     * support for argument juggling, multiple sources, and `this` binding `customizer`
+     * functions.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @param {Function} customizer The function to customize assigned values.
+     * @returns {Object} Returns `object`.
+     */
+    function assignWith(object, source, customizer) {
+      var index = -1,
+          props = keys(source),
+          length = props.length;
+
+      while (++index < length) {
+        var key = props[index],
+            value = object[key],
+            result = customizer(value, source[key], key, object, source);
+
+        if ((result === result ? (result !== value) : (value === value)) ||
+            (value === undefined && !(key in object))) {
+          object[key] = result;
+        }
+      }
+      return object;
+    }
+
+    /**
+     * The base implementation of `_.assign` without support for argument juggling,
+     * multiple sources, and `customizer` functions.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @returns {Object} Returns `object`.
+     */
+    function baseAssign(object, source) {
+      return source == null
+        ? object
+        : baseCopy(source, keys(source), object);
+    }
+
+    /**
+     * The base implementation of `_.at` without support for string collections
+     * and individual key arguments.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {number[]|string[]} props The property names or indexes of elements to pick.
+     * @returns {Array} Returns the new array of picked elements.
+     */
+    function baseAt(collection, props) {
+      var index = -1,
+          isNil = collection == null,
+          isArr = !isNil && isArrayLike(collection),
+          length = isArr ? collection.length : 0,
+          propsLength = props.length,
+          result = Array(propsLength);
+
+      while(++index < propsLength) {
+        var key = props[index];
+        if (isArr) {
+          result[index] = isIndex(key, length) ? collection[key] : undefined;
+        } else {
+          result[index] = isNil ? undefined : collection[key];
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Copies properties of `source` to `object`.
+     *
+     * @private
+     * @param {Object} source The object to copy properties from.
+     * @param {Array} props The property names to copy.
+     * @param {Object} [object={}] The object to copy properties to.
+     * @returns {Object} Returns `object`.
+     */
+    function baseCopy(source, props, object) {
+      object || (object = {});
+
+      var index = -1,
+          length = props.length;
+
+      while (++index < length) {
+        var key = props[index];
+        object[key] = source[key];
+      }
+      return object;
+    }
+
+    /**
+     * The base implementation of `_.callback` which supports specifying the
+     * number of arguments to provide to `func`.
+     *
+     * @private
+     * @param {*} [func=_.identity] The value to convert to a callback.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {number} [argCount] The number of arguments to provide to `func`.
+     * @returns {Function} Returns the callback.
+     */
+    function baseCallback(func, thisArg, argCount) {
+      var type = typeof func;
+      if (type == 'function') {
+        return thisArg === undefined
+          ? func
+          : bindCallback(func, thisArg, argCount);
+      }
+      if (func == null) {
+        return identity;
+      }
+      if (type == 'object') {
+        return baseMatches(func);
+      }
+      return thisArg === undefined
+        ? property(func)
+        : baseMatchesProperty(func, thisArg);
+    }
+
+    /**
+     * The base implementation of `_.clone` without support for argument juggling
+     * and `this` binding `customizer` functions.
+     *
+     * @private
+     * @param {*} value The value to clone.
+     * @param {boolean} [isDeep] Specify a deep clone.
+     * @param {Function} [customizer] The function to customize cloning values.
+     * @param {string} [key] The key of `value`.
+     * @param {Object} [object] The object `value` belongs to.
+     * @param {Array} [stackA=[]] Tracks traversed source objects.
+     * @param {Array} [stackB=[]] Associates clones with source counterparts.
+     * @returns {*} Returns the cloned value.
+     */
+    function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
+      var result;
+      if (customizer) {
+        result = object ? customizer(value, key, object) : customizer(value);
+      }
+      if (result !== undefined) {
+        return result;
+      }
+      if (!isObject(value)) {
+        return value;
+      }
+      var isArr = isArray(value);
+      if (isArr) {
+        result = initCloneArray(value);
+        if (!isDeep) {
+          return arrayCopy(value, result);
+        }
+      } else {
+        var tag = objToString.call(value),
+            isFunc = tag == funcTag;
+
+        if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
+          result = initCloneObject(isFunc ? {} : value);
+          if (!isDeep) {
+            return baseAssign(result, value);
+          }
+        } else {
+          return cloneableTags[tag]
+            ? initCloneByTag(value, tag, isDeep)
+            : (object ? value : {});
+        }
+      }
+      // Check for circular references and return its corresponding clone.
+      stackA || (stackA = []);
+      stackB || (stackB = []);
+
+      var length = stackA.length;
+      while (length--) {
+        if (stackA[length] == value) {
+          return stackB[length];
+        }
+      }
+      // Add the source value to the stack of traversed objects and associate it with its clone.
+      stackA.push(value);
+      stackB.push(result);
+
+      // Recursively populate clone (susceptible to call stack limits).
+      (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
+        result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.create` without support for assigning
+     * properties to the created object.
+     *
+     * @private
+     * @param {Object} prototype The object to inherit from.
+     * @returns {Object} Returns the new object.
+     */
+    var baseCreate = (function() {
+      function object() {}
+      return function(prototype) {
+        if (isObject(prototype)) {
+          object.prototype = prototype;
+          var result = new object;
+          object.prototype = undefined;
+        }
+        return result || {};
+      };
+    }());
+
+    /**
+     * The base implementation of `_.delay` and `_.defer` which accepts an index
+     * of where to slice the arguments to provide to `func`.
+     *
+     * @private
+     * @param {Function} func The function to delay.
+     * @param {number} wait The number of milliseconds to delay invocation.
+     * @param {Object} args The arguments provide to `func`.
+     * @returns {number} Returns the timer id.
+     */
+    function baseDelay(func, wait, args) {
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      return setTimeout(function() { func.apply(undefined, args); }, wait);
+    }
+
+    /**
+     * The base implementation of `_.difference` which accepts a single array
+     * of values to exclude.
+     *
+     * @private
+     * @param {Array} array The array to inspect.
+     * @param {Array} values The values to exclude.
+     * @returns {Array} Returns the new array of filtered values.
+     */
+    function baseDifference(array, values) {
+      var length = array ? array.length : 0,
+          result = [];
+
+      if (!length) {
+        return result;
+      }
+      var index = -1,
+          indexOf = getIndexOf(),
+          isCommon = indexOf == baseIndexOf,
+          cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
+          valuesLength = values.length;
+
+      if (cache) {
+        indexOf = cacheIndexOf;
+        isCommon = false;
+        values = cache;
+      }
+      outer:
+      while (++index < length) {
+        var value = array[index];
+
+        if (isCommon && value === value) {
+          var valuesIndex = valuesLength;
+          while (valuesIndex--) {
+            if (values[valuesIndex] === value) {
+              continue outer;
+            }
+          }
+          result.push(value);
+        }
+        else if (indexOf(values, value, 0) < 0) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.forEach` without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Array|Object|string} Returns `collection`.
+     */
+    var baseEach = createBaseEach(baseForOwn);
+
+    /**
+     * The base implementation of `_.forEachRight` without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Array|Object|string} Returns `collection`.
+     */
+    var baseEachRight = createBaseEach(baseForOwnRight, true);
+
+    /**
+     * The base implementation of `_.every` without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {boolean} Returns `true` if all elements pass the predicate check,
+     *  else `false`
+     */
+    function baseEvery(collection, predicate) {
+      var result = true;
+      baseEach(collection, function(value, index, collection) {
+        result = !!predicate(value, index, collection);
+        return result;
+      });
+      return result;
+    }
+
+    /**
+     * Gets the extremum value of `collection` invoking `iteratee` for each value
+     * in `collection` to generate the criterion by which the value is ranked.
+     * The `iteratee` is invoked with three arguments: (value, index|key, collection).
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {Function} comparator The function used to compare values.
+     * @param {*} exValue The initial extremum value.
+     * @returns {*} Returns the extremum value.
+     */
+    function baseExtremum(collection, iteratee, comparator, exValue) {
+      var computed = exValue,
+          result = computed;
+
+      baseEach(collection, function(value, index, collection) {
+        var current = +iteratee(value, index, collection);
+        if (comparator(current, computed) || (current === exValue && current === result)) {
+          computed = current;
+          result = value;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.fill` without an iteratee call guard.
+     *
+     * @private
+     * @param {Array} array The array to fill.
+     * @param {*} value The value to fill `array` with.
+     * @param {number} [start=0] The start position.
+     * @param {number} [end=array.length] The end position.
+     * @returns {Array} Returns `array`.
+     */
+    function baseFill(array, value, start, end) {
+      var length = array.length;
+
+      start = start == null ? 0 : (+start || 0);
+      if (start < 0) {
+        start = -start > length ? 0 : (length + start);
+      }
+      end = (end === undefined || end > length) ? length : (+end || 0);
+      if (end < 0) {
+        end += length;
+      }
+      length = start > end ? 0 : (end >>> 0);
+      start >>>= 0;
+
+      while (start < length) {
+        array[start++] = value;
+      }
+      return array;
+    }
+
+    /**
+     * The base implementation of `_.filter` without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {Array} Returns the new filtered array.
+     */
+    function baseFilter(collection, predicate) {
+      var result = [];
+      baseEach(collection, function(value, index, collection) {
+        if (predicate(value, index, collection)) {
+          result.push(value);
+        }
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
+     * without support for callback shorthands and `this` binding, which iterates
+     * over `collection` using the provided `eachFunc`.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to search.
+     * @param {Function} predicate The function invoked per iteration.
+     * @param {Function} eachFunc The function to iterate over `collection`.
+     * @param {boolean} [retKey] Specify returning the key of the found element
+     *  instead of the element itself.
+     * @returns {*} Returns the found element or its key, else `undefined`.
+     */
+    function baseFind(collection, predicate, eachFunc, retKey) {
+      var result;
+      eachFunc(collection, function(value, key, collection) {
+        if (predicate(value, key, collection)) {
+          result = retKey ? key : value;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.flatten` with added support for restricting
+     * flattening and specifying the start index.
+     *
+     * @private
+     * @param {Array} array The array to flatten.
+     * @param {boolean} [isDeep] Specify a deep flatten.
+     * @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
+     * @param {Array} [result=[]] The initial result value.
+     * @returns {Array} Returns the new flattened array.
+     */
+    function baseFlatten(array, isDeep, isStrict, result) {
+      result || (result = []);
+
+      var index = -1,
+          length = array.length;
+
+      while (++index < length) {
+        var value = array[index];
+        if (isObjectLike(value) && isArrayLike(value) &&
+            (isStrict || isArray(value) || isArguments(value))) {
+          if (isDeep) {
+            // Recursively flatten arrays (susceptible to call stack limits).
+            baseFlatten(value, isDeep, isStrict, result);
+          } else {
+            arrayPush(result, value);
+          }
+        } else if (!isStrict) {
+          result[result.length] = value;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `baseForIn` and `baseForOwn` which iterates
+     * over `object` properties returned by `keysFunc` invoking `iteratee` for
+     * each property. Iteratee functions may exit iteration early by explicitly
+     * returning `false`.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {Function} keysFunc The function to get the keys of `object`.
+     * @returns {Object} Returns `object`.
+     */
+    var baseFor = createBaseFor();
+
+    /**
+     * This function is like `baseFor` except that it iterates over properties
+     * in the opposite order.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {Function} keysFunc The function to get the keys of `object`.
+     * @returns {Object} Returns `object`.
+     */
+    var baseForRight = createBaseFor(true);
+
+    /**
+     * The base implementation of `_.forIn` without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Object} Returns `object`.
+     */
+    function baseForIn(object, iteratee) {
+      return baseFor(object, iteratee, keysIn);
+    }
+
+    /**
+     * The base implementation of `_.forOwn` without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Object} Returns `object`.
+     */
+    function baseForOwn(object, iteratee) {
+      return baseFor(object, iteratee, keys);
+    }
+
+    /**
+     * The base implementation of `_.forOwnRight` without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Object} Returns `object`.
+     */
+    function baseForOwnRight(object, iteratee) {
+      return baseForRight(object, iteratee, keys);
+    }
+
+    /**
+     * The base implementation of `_.functions` which creates an array of
+     * `object` function property names filtered from those provided.
+     *
+     * @private
+     * @param {Object} object The object to inspect.
+     * @param {Array} props The property names to filter.
+     * @returns {Array} Returns the new array of filtered property names.
+     */
+    function baseFunctions(object, props) {
+      var index = -1,
+          length = props.length,
+          resIndex = -1,
+          result = [];
+
+      while (++index < length) {
+        var key = props[index];
+        if (isFunction(object[key])) {
+          result[++resIndex] = key;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `get` without support for string paths
+     * and default values.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {Array} path The path of the property to get.
+     * @param {string} [pathKey] The key representation of path.
+     * @returns {*} Returns the resolved value.
+     */
+    function baseGet(object, path, pathKey) {
+      if (object == null) {
+        return;
+      }
+      if (pathKey !== undefined && pathKey in toObject(object)) {
+        path = [pathKey];
+      }
+      var index = 0,
+          length = path.length;
+
+      while (object != null && index < length) {
+        object = object[path[index++]];
+      }
+      return (index && index == length) ? object : undefined;
+    }
+
+    /**
+     * The base implementation of `_.isEqual` without support for `this` binding
+     * `customizer` functions.
+     *
+     * @private
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @param {Function} [customizer] The function to customize comparing values.
+     * @param {boolean} [isLoose] Specify performing partial comparisons.
+     * @param {Array} [stackA] Tracks traversed `value` objects.
+     * @param {Array} [stackB] Tracks traversed `other` objects.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     */
+    function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
+      if (value === other) {
+        return true;
+      }
+      if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
+        return value !== value && other !== other;
+      }
+      return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
+    }
+
+    /**
+     * A specialized version of `baseIsEqual` for arrays and objects which performs
+     * deep comparisons and tracks traversed objects enabling objects with circular
+     * references to be compared.
+     *
+     * @private
+     * @param {Object} object The object to compare.
+     * @param {Object} other The other object to compare.
+     * @param {Function} equalFunc The function to determine equivalents of values.
+     * @param {Function} [customizer] The function to customize comparing objects.
+     * @param {boolean} [isLoose] Specify performing partial comparisons.
+     * @param {Array} [stackA=[]] Tracks traversed `value` objects.
+     * @param {Array} [stackB=[]] Tracks traversed `other` objects.
+     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+     */
+    function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
+      var objIsArr = isArray(object),
+          othIsArr = isArray(other),
+          objTag = arrayTag,
+          othTag = arrayTag;
+
+      if (!objIsArr) {
+        objTag = objToString.call(object);
+        if (objTag == argsTag) {
+          objTag = objectTag;
+        } else if (objTag != objectTag) {
+          objIsArr = isTypedArray(object);
+        }
+      }
+      if (!othIsArr) {
+        othTag = objToString.call(other);
+        if (othTag == argsTag) {
+          othTag = objectTag;
+        } else if (othTag != objectTag) {
+          othIsArr = isTypedArray(other);
+        }
+      }
+      var objIsObj = objTag == objectTag,
+          othIsObj = othTag == objectTag,
+          isSameTag = objTag == othTag;
+
+      if (isSameTag && !(objIsArr || objIsObj)) {
+        return equalByTag(object, other, objTag);
+      }
+      if (!isLoose) {
+        var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
+            othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
+
+        if (objIsWrapped || othIsWrapped) {
+          return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
+        }
+      }
+      if (!isSameTag) {
+        return false;
+      }
+      // Assume cyclic values are equal.
+      // For more information on detecting circular references see https://es5.github.io/#JO.
+      stackA || (stackA = []);
+      stackB || (stackB = []);
+
+      var length = stackA.length;
+      while (length--) {
+        if (stackA[length] == object) {
+          return stackB[length] == other;
+        }
+      }
+      // Add `object` and `other` to the stack of traversed objects.
+      stackA.push(object);
+      stackB.push(other);
+
+      var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
+
+      stackA.pop();
+      stackB.pop();
+
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.isMatch` without support for callback
+     * shorthands and `this` binding.
+     *
+     * @private
+     * @param {Object} object The object to inspect.
+     * @param {Array} matchData The propery names, values, and compare flags to match.
+     * @param {Function} [customizer] The function to customize comparing objects.
+     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+     */
+    function baseIsMatch(object, matchData, customizer) {
+      var index = matchData.length,
+          length = index,
+          noCustomizer = !customizer;
+
+      if (object == null) {
+        return !length;
+      }
+      object = toObject(object);
+      while (index--) {
+        var data = matchData[index];
+        if ((noCustomizer && data[2])
+              ? data[1] !== object[data[0]]
+              : !(data[0] in object)
+            ) {
+          return false;
+        }
+      }
+      while (++index < length) {
+        data = matchData[index];
+        var key = data[0],
+            objValue = object[key],
+            srcValue = data[1];
+
+        if (noCustomizer && data[2]) {
+          if (objValue === undefined && !(key in object)) {
+            return false;
+          }
+        } else {
+          var result = customizer ? customizer(objValue, srcValue, key) : undefined;
+          if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
+            return false;
+          }
+        }
+      }
+      return true;
+    }
+
+    /**
+     * The base implementation of `_.map` without support for callback shorthands
+     * and `this` binding.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Array} Returns the new mapped array.
+     */
+    function baseMap(collection, iteratee) {
+      var index = -1,
+          result = isArrayLike(collection) ? Array(collection.length) : [];
+
+      baseEach(collection, function(value, key, collection) {
+        result[++index] = iteratee(value, key, collection);
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.matches` which does not clone `source`.
+     *
+     * @private
+     * @param {Object} source The object of property values to match.
+     * @returns {Function} Returns the new function.
+     */
+    function baseMatches(source) {
+      var matchData = getMatchData(source);
+      if (matchData.length == 1 && matchData[0][2]) {
+        var key = matchData[0][0],
+            value = matchData[0][1];
+
+        return function(object) {
+          if (object == null) {
+            return false;
+          }
+          return object[key] === value && (value !== undefined || (key in toObject(object)));
+        };
+      }
+      return function(object) {
+        return baseIsMatch(object, matchData);
+      };
+    }
+
+    /**
+     * The base implementation of `_.matchesProperty` which does not clone `srcValue`.
+     *
+     * @private
+     * @param {string} path The path of the property to get.
+     * @param {*} srcValue The value to compare.
+     * @returns {Function} Returns the new function.
+     */
+    function baseMatchesProperty(path, srcValue) {
+      var isArr = isArray(path),
+          isCommon = isKey(path) && isStrictComparable(srcValue),
+          pathKey = (path + '');
+
+      path = toPath(path);
+      return function(object) {
+        if (object == null) {
+          return false;
+        }
+        var key = pathKey;
+        object = toObject(object);
+        if ((isArr || !isCommon) && !(key in object)) {
+          object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
+          if (object == null) {
+            return false;
+          }
+          key = last(path);
+          object = toObject(object);
+        }
+        return object[key] === srcValue
+          ? (srcValue !== undefined || (key in object))
+          : baseIsEqual(srcValue, object[key], undefined, true);
+      };
+    }
+
+    /**
+     * The base implementation of `_.merge` without support for argument juggling,
+     * multiple sources, and `this` binding `customizer` functions.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @param {Function} [customizer] The function to customize merged values.
+     * @param {Array} [stackA=[]] Tracks traversed source objects.
+     * @param {Array} [stackB=[]] Associates values with source counterparts.
+     * @returns {Object} Returns `object`.
+     */
+    function baseMerge(object, source, customizer, stackA, stackB) {
+      if (!isObject(object)) {
+        return object;
+      }
+      var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
+          props = isSrcArr ? undefined : keys(source);
+
+      arrayEach(props || source, function(srcValue, key) {
+        if (props) {
+          key = srcValue;
+          srcValue = source[key];
+        }
+        if (isObjectLike(srcValue)) {
+          stackA || (stackA = []);
+          stackB || (stackB = []);
+          baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
+        }
+        else {
+          var value = object[key],
+              result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
+              isCommon = result === undefined;
+
+          if (isCommon) {
+            result = srcValue;
+          }
+          if ((result !== undefined || (isSrcArr && !(key in object))) &&
+              (isCommon || (result === result ? (result !== value) : (value === value)))) {
+            object[key] = result;
+          }
+        }
+      });
+      return object;
+    }
+
+    /**
+     * A specialized version of `baseMerge` for arrays and objects which performs
+     * deep merges and tracks traversed objects enabling objects with circular
+     * references to be merged.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @param {string} key The key of the value to merge.
+     * @param {Function} mergeFunc The function to merge values.
+     * @param {Function} [customizer] The function to customize merged values.
+     * @param {Array} [stackA=[]] Tracks traversed source objects.
+     * @param {Array} [stackB=[]] Associates values with source counterparts.
+     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+     */
+    function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
+      var length = stackA.length,
+          srcValue = source[key];
+
+      while (length--) {
+        if (stackA[length] == srcValue) {
+          object[key] = stackB[length];
+          return;
+        }
+      }
+      var value = object[key],
+          result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
+          isCommon = result === undefined;
+
+      if (isCommon) {
+        result = srcValue;
+        if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
+          result = isArray(value)
+            ? value
+            : (isArrayLike(value) ? arrayCopy(value) : []);
+        }
+        else if (isPlainObject(srcValue) || isArguments(srcValue)) {
+          result = isArguments(value)
+            ? toPlainObject(value)
+            : (isPlainObject(value) ? value : {});
+        }
+        else {
+          isCommon = false;
+        }
+      }
+      // Add the source value to the stack of traversed objects and associate
+      // it with its merged value.
+      stackA.push(srcValue);
+      stackB.push(result);
+
+      if (isCommon) {
+        // Recursively merge objects and arrays (susceptible to call stack limits).
+        object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
+      } else if (result === result ? (result !== value) : (value === value)) {
+        object[key] = result;
+      }
+    }
+
+    /**
+     * The base implementation of `_.property` without support for deep paths.
+     *
+     * @private
+     * @param {string} key The key of the property to get.
+     * @returns {Function} Returns the new function.
+     */
+    function baseProperty(key) {
+      return function(object) {
+        return object == null ? undefined : object[key];
+      };
+    }
+
+    /**
+     * A specialized version of `baseProperty` which supports deep paths.
+     *
+     * @private
+     * @param {Array|string} path The path of the property to get.
+     * @returns {Function} Returns the new function.
+     */
+    function basePropertyDeep(path) {
+      var pathKey = (path + '');
+      path = toPath(path);
+      return function(object) {
+        return baseGet(object, path, pathKey);
+      };
+    }
+
+    /**
+     * The base implementation of `_.pullAt` without support for individual
+     * index arguments and capturing the removed elements.
+     *
+     * @private
+     * @param {Array} array The array to modify.
+     * @param {number[]} indexes The indexes of elements to remove.
+     * @returns {Array} Returns `array`.
+     */
+    function basePullAt(array, indexes) {
+      var length = array ? indexes.length : 0;
+      while (length--) {
+        var index = indexes[length];
+        if (index != previous && isIndex(index)) {
+          var previous = index;
+          splice.call(array, index, 1);
+        }
+      }
+      return array;
+    }
+
+    /**
+     * The base implementation of `_.random` without support for argument juggling
+     * and returning floating-point numbers.
+     *
+     * @private
+     * @param {number} min The minimum possible value.
+     * @param {number} max The maximum possible value.
+     * @returns {number} Returns the random number.
+     */
+    function baseRandom(min, max) {
+      return min + nativeFloor(nativeRandom() * (max - min + 1));
+    }
+
+    /**
+     * The base implementation of `_.reduce` and `_.reduceRight` without support
+     * for callback shorthands and `this` binding, which iterates over `collection`
+     * using the provided `eachFunc`.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {*} accumulator The initial value.
+     * @param {boolean} initFromCollection Specify using the first or last element
+     *  of `collection` as the initial value.
+     * @param {Function} eachFunc The function to iterate over `collection`.
+     * @returns {*} Returns the accumulated value.
+     */
+    function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
+      eachFunc(collection, function(value, index, collection) {
+        accumulator = initFromCollection
+          ? (initFromCollection = false, value)
+          : iteratee(accumulator, value, index, collection);
+      });
+      return accumulator;
+    }
+
+    /**
+     * The base implementation of `setData` without support for hot loop detection.
+     *
+     * @private
+     * @param {Function} func The function to associate metadata with.
+     * @param {*} data The metadata.
+     * @returns {Function} Returns `func`.
+     */
+    var baseSetData = !metaMap ? identity : function(func, data) {
+      metaMap.set(func, data);
+      return func;
+    };
+
+    /**
+     * The base implementation of `_.slice` without an iteratee call guard.
+     *
+     * @private
+     * @param {Array} array The array to slice.
+     * @param {number} [start=0] The start position.
+     * @param {number} [end=array.length] The end position.
+     * @returns {Array} Returns the slice of `array`.
+     */
+    function baseSlice(array, start, end) {
+      var index = -1,
+          length = array.length;
+
+      start = start == null ? 0 : (+start || 0);
+      if (start < 0) {
+        start = -start > length ? 0 : (length + start);
+      }
+      end = (end === undefined || end > length) ? length : (+end || 0);
+      if (end < 0) {
+        end += length;
+      }
+      length = start > end ? 0 : ((end - start) >>> 0);
+      start >>>= 0;
+
+      var result = Array(length);
+      while (++index < length) {
+        result[index] = array[index + start];
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.some` without support for callback shorthands
+     * and `this` binding.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {boolean} Returns `true` if any element passes the predicate check,
+     *  else `false`.
+     */
+    function baseSome(collection, predicate) {
+      var result;
+
+      baseEach(collection, function(value, index, collection) {
+        result = predicate(value, index, collection);
+        return !result;
+      });
+      return !!result;
+    }
+
+    /**
+     * The base implementation of `_.sortBy` which uses `comparer` to define
+     * the sort order of `array` and replaces criteria objects with their
+     * corresponding values.
+     *
+     * @private
+     * @param {Array} array The array to sort.
+     * @param {Function} comparer The function to define sort order.
+     * @returns {Array} Returns `array`.
+     */
+    function baseSortBy(array, comparer) {
+      var length = array.length;
+
+      array.sort(comparer);
+      while (length--) {
+        array[length] = array[length].value;
+      }
+      return array;
+    }
+
+    /**
+     * The base implementation of `_.sortByOrder` without param guards.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
+     * @param {boolean[]} orders The sort orders of `iteratees`.
+     * @returns {Array} Returns the new sorted array.
+     */
+    function baseSortByOrder(collection, iteratees, orders) {
+      var callback = getCallback(),
+          index = -1;
+
+      iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); });
+
+      var result = baseMap(collection, function(value) {
+        var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });
+        return { 'criteria': criteria, 'index': ++index, 'value': value };
+      });
+
+      return baseSortBy(result, function(object, other) {
+        return compareMultiple(object, other, orders);
+      });
+    }
+
+    /**
+     * The base implementation of `_.sum` without support for callback shorthands
+     * and `this` binding.
+     *
+     * @private
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {number} Returns the sum.
+     */
+    function baseSum(collection, iteratee) {
+      var result = 0;
+      baseEach(collection, function(value, index, collection) {
+        result += +iteratee(value, index, collection) || 0;
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.uniq` without support for callback shorthands
+     * and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to inspect.
+     * @param {Function} [iteratee] The function invoked per iteration.
+     * @returns {Array} Returns the new duplicate-value-free array.
+     */
+    function baseUniq(array, iteratee) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = array.length,
+          isCommon = indexOf == baseIndexOf,
+          isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
+          seen = isLarge ? createCache() : null,
+          result = [];
+
+      if (seen) {
+        indexOf = cacheIndexOf;
+        isCommon = false;
+      } else {
+        isLarge = false;
+        seen = iteratee ? [] : result;
+      }
+      outer:
+      while (++index < length) {
+        var value = array[index],
+            computed = iteratee ? iteratee(value, index, array) : value;
+
+        if (isCommon && value === value) {
+          var seenIndex = seen.length;
+          while (seenIndex--) {
+            if (seen[seenIndex] === computed) {
+              continue outer;
+            }
+          }
+          if (iteratee) {
+            seen.push(computed);
+          }
+          result.push(value);
+        }
+        else if (indexOf(seen, computed, 0) < 0) {
+          if (iteratee || isLarge) {
+            seen.push(computed);
+          }
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.values` and `_.valuesIn` which creates an
+     * array of `object` property values corresponding to the property names
+     * of `props`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {Array} props The property names to get values for.
+     * @returns {Object} Returns the array of property values.
+     */
+    function baseValues(object, props) {
+      var index = -1,
+          length = props.length,
+          result = Array(length);
+
+      while (++index < length) {
+        result[index] = object[props[index]];
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`,
+     * and `_.takeWhile` without support for callback shorthands and `this` binding.
+     *
+     * @private
+     * @param {Array} array The array to query.
+     * @param {Function} predicate The function invoked per iteration.
+     * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Array} Returns the slice of `array`.
+     */
+    function baseWhile(array, predicate, isDrop, fromRight) {
+      var length = array.length,
+          index = fromRight ? length : -1;
+
+      while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}
+      return isDrop
+        ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
+        : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
+    }
+
+    /**
+     * The base implementation of `wrapperValue` which returns the result of
+     * performing a sequence of actions on the unwrapped `value`, where each
+     * successive action is supplied the return value of the previous.
+     *
+     * @private
+     * @param {*} value The unwrapped value.
+     * @param {Array} actions Actions to peform to resolve the unwrapped value.
+     * @returns {*} Returns the resolved value.
+     */
+    function baseWrapperValue(value, actions) {
+      var result = value;
+      if (result instanceof LazyWrapper) {
+        result = result.value();
+      }
+      var index = -1,
+          length = actions.length;
+
+      while (++index < length) {
+        var action = actions[index];
+        result = action.func.apply(action.thisArg, arrayPush([result], action.args));
+      }
+      return result;
+    }
+
+    /**
+     * Performs a binary search of `array` to determine the index at which `value`
+     * should be inserted into `array` in order to maintain its sort order.
+     *
+     * @private
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {boolean} [retHighest] Specify returning the highest qualified index.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     */
+    function binaryIndex(array, value, retHighest) {
+      var low = 0,
+          high = array ? array.length : low;
+
+      if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
+        while (low < high) {
+          var mid = (low + high) >>> 1,
+              computed = array[mid];
+
+          if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
+            low = mid + 1;
+          } else {
+            high = mid;
+          }
+        }
+        return high;
+      }
+      return binaryIndexBy(array, value, identity, retHighest);
+    }
+
+    /**
+     * This function is like `binaryIndex` except that it invokes `iteratee` for
+     * `value` and each element of `array` to compute their sort ranking. The
+     * iteratee is invoked with one argument; (value).
+     *
+     * @private
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {boolean} [retHighest] Specify returning the highest qualified index.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     */
+    function binaryIndexBy(array, value, iteratee, retHighest) {
+      value = iteratee(value);
+
+      var low = 0,
+          high = array ? array.length : 0,
+          valIsNaN = value !== value,
+          valIsNull = value === null,
+          valIsUndef = value === undefined;
+
+      while (low < high) {
+        var mid = nativeFloor((low + high) / 2),
+            computed = iteratee(array[mid]),
+            isDef = computed !== undefined,
+            isReflexive = computed === computed;
+
+        if (valIsNaN) {
+          var setLow = isReflexive || retHighest;
+        } else if (valIsNull) {
+          setLow = isReflexive && isDef && (retHighest || computed != null);
+        } else if (valIsUndef) {
+          setLow = isReflexive && (retHighest || isDef);
+        } else if (computed == null) {
+          setLow = false;
+        } else {
+          setLow = retHighest ? (computed <= value) : (computed < value);
+        }
+        if (setLow) {
+          low = mid + 1;
+        } else {
+          high = mid;
+        }
+      }
+      return nativeMin(high, MAX_ARRAY_INDEX);
+    }
+
+    /**
+     * A specialized version of `baseCallback` which only supports `this` binding
+     * and specifying the number of arguments to provide to `func`.
+     *
+     * @private
+     * @param {Function} func The function to bind.
+     * @param {*} thisArg The `this` binding of `func`.
+     * @param {number} [argCount] The number of arguments to provide to `func`.
+     * @returns {Function} Returns the callback.
+     */
+    function bindCallback(func, thisArg, argCount) {
+      if (typeof func != 'function') {
+        return identity;
+      }
+      if (thisArg === undefined) {
+        return func;
+      }
+      switch (argCount) {
+        case 1: return function(value) {
+          return func.call(thisArg, value);
+        };
+        case 3: return function(value, index, collection) {
+          return func.call(thisArg, value, index, collection);
+        };
+        case 4: return function(accumulator, value, index, collection) {
+          return func.call(thisArg, accumulator, value, index, collection);
+        };
+        case 5: return function(value, other, key, object, source) {
+          return func.call(thisArg, value, other, key, object, source);
+        };
+      }
+      return function() {
+        return func.apply(thisArg, arguments);
+      };
+    }
+
+    /**
+     * Creates a clone of the given array buffer.
+     *
+     * @private
+     * @param {ArrayBuffer} buffer The array buffer to clone.
+     * @returns {ArrayBuffer} Returns the cloned array buffer.
+     */
+    function bufferClone(buffer) {
+      var result = new ArrayBuffer(buffer.byteLength),
+          view = new Uint8Array(result);
+
+      view.set(new Uint8Array(buffer));
+      return result;
+    }
+
+    /**
+     * Creates an array that is the composition of partially applied arguments,
+     * placeholders, and provided arguments into a single array of arguments.
+     *
+     * @private
+     * @param {Array|Object} args The provided arguments.
+     * @param {Array} partials The arguments to prepend to those provided.
+     * @param {Array} holders The `partials` placeholder indexes.
+     * @returns {Array} Returns the new array of composed arguments.
+     */
+    function composeArgs(args, partials, holders) {
+      var holdersLength = holders.length,
+          argsIndex = -1,
+          argsLength = nativeMax(args.length - holdersLength, 0),
+          leftIndex = -1,
+          leftLength = partials.length,
+          result = Array(leftLength + argsLength);
+
+      while (++leftIndex < leftLength) {
+        result[leftIndex] = partials[leftIndex];
+      }
+      while (++argsIndex < holdersLength) {
+        result[holders[argsIndex]] = args[argsIndex];
+      }
+      while (argsLength--) {
+        result[leftIndex++] = args[argsIndex++];
+      }
+      return result;
+    }
+
+    /**
+     * This function is like `composeArgs` except that the arguments composition
+     * is tailored for `_.partialRight`.
+     *
+     * @private
+     * @param {Array|Object} args The provided arguments.
+     * @param {Array} partials The arguments to append to those provided.
+     * @param {Array} holders The `partials` placeholder indexes.
+     * @returns {Array} Returns the new array of composed arguments.
+     */
+    function composeArgsRight(args, partials, holders) {
+      var holdersIndex = -1,
+          holdersLength = holders.length,
+          argsIndex = -1,
+          argsLength = nativeMax(args.length - holdersLength, 0),
+          rightIndex = -1,
+          rightLength = partials.length,
+          result = Array(argsLength + rightLength);
+
+      while (++argsIndex < argsLength) {
+        result[argsIndex] = args[argsIndex];
+      }
+      var offset = argsIndex;
+      while (++rightIndex < rightLength) {
+        result[offset + rightIndex] = partials[rightIndex];
+      }
+      while (++holdersIndex < holdersLength) {
+        result[offset + holders[holdersIndex]] = args[argsIndex++];
+      }
+      return result;
+    }
+
+    /**
+     * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function.
+     *
+     * @private
+     * @param {Function} setter The function to set keys and values of the accumulator object.
+     * @param {Function} [initializer] The function to initialize the accumulator object.
+     * @returns {Function} Returns the new aggregator function.
+     */
+    function createAggregator(setter, initializer) {
+      return function(collection, iteratee, thisArg) {
+        var result = initializer ? initializer() : {};
+        iteratee = getCallback(iteratee, thisArg, 3);
+
+        if (isArray(collection)) {
+          var index = -1,
+              length = collection.length;
+
+          while (++index < length) {
+            var value = collection[index];
+            setter(result, value, iteratee(value, index, collection), collection);
+          }
+        } else {
+          baseEach(collection, function(value, key, collection) {
+            setter(result, value, iteratee(value, key, collection), collection);
+          });
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
+     *
+     * @private
+     * @param {Function} assigner The function to assign values.
+     * @returns {Function} Returns the new assigner function.
+     */
+    function createAssigner(assigner) {
+      return restParam(function(object, sources) {
+        var index = -1,
+            length = object == null ? 0 : sources.length,
+            customizer = length > 2 ? sources[length - 2] : undefined,
+            guard = length > 2 ? sources[2] : undefined,
+            thisArg = length > 1 ? sources[length - 1] : undefined;
+
+        if (typeof customizer == 'function') {
+          customizer = bindCallback(customizer, thisArg, 5);
+          length -= 2;
+        } else {
+          customizer = typeof thisArg == 'function' ? thisArg : undefined;
+          length -= (customizer ? 1 : 0);
+        }
+        if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+          customizer = length < 3 ? undefined : customizer;
+          length = 1;
+        }
+        while (++index < length) {
+          var source = sources[index];
+          if (source) {
+            assigner(object, source, customizer);
+          }
+        }
+        return object;
+      });
+    }
+
+    /**
+     * Creates a `baseEach` or `baseEachRight` function.
+     *
+     * @private
+     * @param {Function} eachFunc The function to iterate over a collection.
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Function} Returns the new base function.
+     */
+    function createBaseEach(eachFunc, fromRight) {
+      return function(collection, iteratee) {
+        var length = collection ? getLength(collection) : 0;
+        if (!isLength(length)) {
+          return eachFunc(collection, iteratee);
+        }
+        var index = fromRight ? length : -1,
+            iterable = toObject(collection);
+
+        while ((fromRight ? index-- : ++index < length)) {
+          if (iteratee(iterable[index], index, iterable) === false) {
+            break;
+          }
+        }
+        return collection;
+      };
+    }
+
+    /**
+     * Creates a base function for `_.forIn` or `_.forInRight`.
+     *
+     * @private
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Function} Returns the new base function.
+     */
+    function createBaseFor(fromRight) {
+      return function(object, iteratee, keysFunc) {
+        var iterable = toObject(object),
+            props = keysFunc(object),
+            length = props.length,
+            index = fromRight ? length : -1;
+
+        while ((fromRight ? index-- : ++index < length)) {
+          var key = props[index];
+          if (iteratee(iterable[key], key, iterable) === false) {
+            break;
+          }
+        }
+        return object;
+      };
+    }
+
+    /**
+     * Creates a function that wraps `func` and invokes it with the `this`
+     * binding of `thisArg`.
+     *
+     * @private
+     * @param {Function} func The function to bind.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @returns {Function} Returns the new bound function.
+     */
+    function createBindWrapper(func, thisArg) {
+      var Ctor = createCtorWrapper(func);
+
+      function wrapper() {
+        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+        return fn.apply(thisArg, arguments);
+      }
+      return wrapper;
+    }
+
+    /**
+     * Creates a `Set` cache object to optimize linear searches of large arrays.
+     *
+     * @private
+     * @param {Array} [values] The values to cache.
+     * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
+     */
+    function createCache(values) {
+      return (nativeCreate && Set) ? new SetCache(values) : null;
+    }
+
+    /**
+     * Creates a function that produces compound words out of the words in a
+     * given string.
+     *
+     * @private
+     * @param {Function} callback The function to combine each word.
+     * @returns {Function} Returns the new compounder function.
+     */
+    function createCompounder(callback) {
+      return function(string) {
+        var index = -1,
+            array = words(deburr(string)),
+            length = array.length,
+            result = '';
+
+        while (++index < length) {
+          result = callback(result, array[index], index);
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function that produces an instance of `Ctor` regardless of
+     * whether it was invoked as part of a `new` expression or by `call` or `apply`.
+     *
+     * @private
+     * @param {Function} Ctor The constructor to wrap.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createCtorWrapper(Ctor) {
+      return function() {
+        // Use a `switch` statement to work with class constructors.
+        // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
+        // for more details.
+        var args = arguments;
+        switch (args.length) {
+          case 0: return new Ctor;
+          case 1: return new Ctor(args[0]);
+          case 2: return new Ctor(args[0], args[1]);
+          case 3: return new Ctor(args[0], args[1], args[2]);
+          case 4: return new Ctor(args[0], args[1], args[2], args[3]);
+          case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
+          case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
+          case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
+        }
+        var thisBinding = baseCreate(Ctor.prototype),
+            result = Ctor.apply(thisBinding, args);
+
+        // Mimic the constructor's `return` behavior.
+        // See https://es5.github.io/#x13.2.2 for more details.
+        return isObject(result) ? result : thisBinding;
+      };
+    }
+
+    /**
+     * Creates a `_.curry` or `_.curryRight` function.
+     *
+     * @private
+     * @param {boolean} flag The curry bit flag.
+     * @returns {Function} Returns the new curry function.
+     */
+    function createCurry(flag) {
+      function curryFunc(func, arity, guard) {
+        if (guard && isIterateeCall(func, arity, guard)) {
+          arity = undefined;
+        }
+        var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity);
+        result.placeholder = curryFunc.placeholder;
+        return result;
+      }
+      return curryFunc;
+    }
+
+    /**
+     * Creates a `_.defaults` or `_.defaultsDeep` function.
+     *
+     * @private
+     * @param {Function} assigner The function to assign values.
+     * @param {Function} customizer The function to customize assigned values.
+     * @returns {Function} Returns the new defaults function.
+     */
+    function createDefaults(assigner, customizer) {
+      return restParam(function(args) {
+        var object = args[0];
+        if (object == null) {
+          return object;
+        }
+        args.push(customizer);
+        return assigner.apply(undefined, args);
+      });
+    }
+
+    /**
+     * Creates a `_.max` or `_.min` function.
+     *
+     * @private
+     * @param {Function} comparator The function used to compare values.
+     * @param {*} exValue The initial extremum value.
+     * @returns {Function} Returns the new extremum function.
+     */
+    function createExtremum(comparator, exValue) {
+      return function(collection, iteratee, thisArg) {
+        if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
+          iteratee = undefined;
+        }
+        iteratee = getCallback(iteratee, thisArg, 3);
+        if (iteratee.length == 1) {
+          collection = isArray(collection) ? collection : toIterable(collection);
+          var result = arrayExtremum(collection, iteratee, comparator, exValue);
+          if (!(collection.length && result === exValue)) {
+            return result;
+          }
+        }
+        return baseExtremum(collection, iteratee, comparator, exValue);
+      };
+    }
+
+    /**
+     * Creates a `_.find` or `_.findLast` function.
+     *
+     * @private
+     * @param {Function} eachFunc The function to iterate over a collection.
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Function} Returns the new find function.
+     */
+    function createFind(eachFunc, fromRight) {
+      return function(collection, predicate, thisArg) {
+        predicate = getCallback(predicate, thisArg, 3);
+        if (isArray(collection)) {
+          var index = baseFindIndex(collection, predicate, fromRight);
+          return index > -1 ? collection[index] : undefined;
+        }
+        return baseFind(collection, predicate, eachFunc);
+      };
+    }
+
+    /**
+     * Creates a `_.findIndex` or `_.findLastIndex` function.
+     *
+     * @private
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Function} Returns the new find function.
+     */
+    function createFindIndex(fromRight) {
+      return function(array, predicate, thisArg) {
+        if (!(array && array.length)) {
+          return -1;
+        }
+        predicate = getCallback(predicate, thisArg, 3);
+        return baseFindIndex(array, predicate, fromRight);
+      };
+    }
+
+    /**
+     * Creates a `_.findKey` or `_.findLastKey` function.
+     *
+     * @private
+     * @param {Function} objectFunc The function to iterate over an object.
+     * @returns {Function} Returns the new find function.
+     */
+    function createFindKey(objectFunc) {
+      return function(object, predicate, thisArg) {
+        predicate = getCallback(predicate, thisArg, 3);
+        return baseFind(object, predicate, objectFunc, true);
+      };
+    }
+
+    /**
+     * Creates a `_.flow` or `_.flowRight` function.
+     *
+     * @private
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Function} Returns the new flow function.
+     */
+    function createFlow(fromRight) {
+      return function() {
+        var wrapper,
+            length = arguments.length,
+            index = fromRight ? length : -1,
+            leftIndex = 0,
+            funcs = Array(length);
+
+        while ((fromRight ? index-- : ++index < length)) {
+          var func = funcs[leftIndex++] = arguments[index];
+          if (typeof func != 'function') {
+            throw new TypeError(FUNC_ERROR_TEXT);
+          }
+          if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {
+            wrapper = new LodashWrapper([], true);
+          }
+        }
+        index = wrapper ? -1 : length;
+        while (++index < length) {
+          func = funcs[index];
+
+          var funcName = getFuncName(func),
+              data = funcName == 'wrapper' ? getData(func) : undefined;
+
+          if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
+            wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
+          } else {
+            wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
+          }
+        }
+        return function() {
+          var args = arguments,
+              value = args[0];
+
+          if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
+            return wrapper.plant(value).value();
+          }
+          var index = 0,
+              result = length ? funcs[index].apply(this, args) : value;
+
+          while (++index < length) {
+            result = funcs[index].call(this, result);
+          }
+          return result;
+        };
+      };
+    }
+
+    /**
+     * Creates a function for `_.forEach` or `_.forEachRight`.
+     *
+     * @private
+     * @param {Function} arrayFunc The function to iterate over an array.
+     * @param {Function} eachFunc The function to iterate over a collection.
+     * @returns {Function} Returns the new each function.
+     */
+    function createForEach(arrayFunc, eachFunc) {
+      return function(collection, iteratee, thisArg) {
+        return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
+          ? arrayFunc(collection, iteratee)
+          : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
+      };
+    }
+
+    /**
+     * Creates a function for `_.forIn` or `_.forInRight`.
+     *
+     * @private
+     * @param {Function} objectFunc The function to iterate over an object.
+     * @returns {Function} Returns the new each function.
+     */
+    function createForIn(objectFunc) {
+      return function(object, iteratee, thisArg) {
+        if (typeof iteratee != 'function' || thisArg !== undefined) {
+          iteratee = bindCallback(iteratee, thisArg, 3);
+        }
+        return objectFunc(object, iteratee, keysIn);
+      };
+    }
+
+    /**
+     * Creates a function for `_.forOwn` or `_.forOwnRight`.
+     *
+     * @private
+     * @param {Function} objectFunc The function to iterate over an object.
+     * @returns {Function} Returns the new each function.
+     */
+    function createForOwn(objectFunc) {
+      return function(object, iteratee, thisArg) {
+        if (typeof iteratee != 'function' || thisArg !== undefined) {
+          iteratee = bindCallback(iteratee, thisArg, 3);
+        }
+        return objectFunc(object, iteratee);
+      };
+    }
+
+    /**
+     * Creates a function for `_.mapKeys` or `_.mapValues`.
+     *
+     * @private
+     * @param {boolean} [isMapKeys] Specify mapping keys instead of values.
+     * @returns {Function} Returns the new map function.
+     */
+    function createObjectMapper(isMapKeys) {
+      return function(object, iteratee, thisArg) {
+        var result = {};
+        iteratee = getCallback(iteratee, thisArg, 3);
+
+        baseForOwn(object, function(value, key, object) {
+          var mapped = iteratee(value, key, object);
+          key = isMapKeys ? mapped : key;
+          value = isMapKeys ? value : mapped;
+          result[key] = value;
+        });
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function for `_.padLeft` or `_.padRight`.
+     *
+     * @private
+     * @param {boolean} [fromRight] Specify padding from the right.
+     * @returns {Function} Returns the new pad function.
+     */
+    function createPadDir(fromRight) {
+      return function(string, length, chars) {
+        string = baseToString(string);
+        return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);
+      };
+    }
+
+    /**
+     * Creates a `_.partial` or `_.partialRight` function.
+     *
+     * @private
+     * @param {boolean} flag The partial bit flag.
+     * @returns {Function} Returns the new partial function.
+     */
+    function createPartial(flag) {
+      var partialFunc = restParam(function(func, partials) {
+        var holders = replaceHolders(partials, partialFunc.placeholder);
+        return createWrapper(func, flag, undefined, partials, holders);
+      });
+      return partialFunc;
+    }
+
+    /**
+     * Creates a function for `_.reduce` or `_.reduceRight`.
+     *
+     * @private
+     * @param {Function} arrayFunc The function to iterate over an array.
+     * @param {Function} eachFunc The function to iterate over a collection.
+     * @returns {Function} Returns the new each function.
+     */
+    function createReduce(arrayFunc, eachFunc) {
+      return function(collection, iteratee, accumulator, thisArg) {
+        var initFromArray = arguments.length < 3;
+        return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
+          ? arrayFunc(collection, iteratee, accumulator, initFromArray)
+          : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
+      };
+    }
+
+    /**
+     * Creates a function that wraps `func` and invokes it with optional `this`
+     * binding of, partial application, and currying.
+     *
+     * @private
+     * @param {Function|string} func The function or method name to reference.
+     * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {Array} [partials] The arguments to prepend to those provided to the new function.
+     * @param {Array} [holders] The `partials` placeholder indexes.
+     * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
+     * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
+     * @param {Array} [argPos] The argument positions of the new function.
+     * @param {number} [ary] The arity cap of `func`.
+     * @param {number} [arity] The arity of `func`.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
+      var isAry = bitmask & ARY_FLAG,
+          isBind = bitmask & BIND_FLAG,
+          isBindKey = bitmask & BIND_KEY_FLAG,
+          isCurry = bitmask & CURRY_FLAG,
+          isCurryBound = bitmask & CURRY_BOUND_FLAG,
+          isCurryRight = bitmask & CURRY_RIGHT_FLAG,
+          Ctor = isBindKey ? undefined : createCtorWrapper(func);
+
+      function wrapper() {
+        // Avoid `arguments` object use disqualifying optimizations by
+        // converting it to an array before providing it to other functions.
+        var length = arguments.length,
+            index = length,
+            args = Array(length);
+
+        while (index--) {
+          args[index] = arguments[index];
+        }
+        if (partials) {
+          args = composeArgs(args, partials, holders);
+        }
+        if (partialsRight) {
+          args = composeArgsRight(args, partialsRight, holdersRight);
+        }
+        if (isCurry || isCurryRight) {
+          var placeholder = wrapper.placeholder,
+              argsHolders = replaceHolders(args, placeholder);
+
+          length -= argsHolders.length;
+          if (length < arity) {
+            var newArgPos = argPos ? arrayCopy(argPos) : undefined,
+                newArity = nativeMax(arity - length, 0),
+                newsHolders = isCurry ? argsHolders : undefined,
+                newHoldersRight = isCurry ? undefined : argsHolders,
+                newPartials = isCurry ? args : undefined,
+                newPartialsRight = isCurry ? undefined : args;
+
+            bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
+            bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
+
+            if (!isCurryBound) {
+              bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
+            }
+            var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
+                result = createHybridWrapper.apply(undefined, newData);
+
+            if (isLaziable(func)) {
+              setData(result, newData);
+            }
+            result.placeholder = placeholder;
+            return result;
+          }
+        }
+        var thisBinding = isBind ? thisArg : this,
+            fn = isBindKey ? thisBinding[func] : func;
+
+        if (argPos) {
+          args = reorder(args, argPos);
+        }
+        if (isAry && ary < args.length) {
+          args.length = ary;
+        }
+        if (this && this !== root && this instanceof wrapper) {
+          fn = Ctor || createCtorWrapper(func);
+        }
+        return fn.apply(thisBinding, args);
+      }
+      return wrapper;
+    }
+
+    /**
+     * Creates the padding required for `string` based on the given `length`.
+     * The `chars` string is truncated if the number of characters exceeds `length`.
+     *
+     * @private
+     * @param {string} string The string to create padding for.
+     * @param {number} [length=0] The padding length.
+     * @param {string} [chars=' '] The string used as padding.
+     * @returns {string} Returns the pad for `string`.
+     */
+    function createPadding(string, length, chars) {
+      var strLength = string.length;
+      length = +length;
+
+      if (strLength >= length || !nativeIsFinite(length)) {
+        return '';
+      }
+      var padLength = length - strLength;
+      chars = chars == null ? ' ' : (chars + '');
+      return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength);
+    }
+
+    /**
+     * Creates a function that wraps `func` and invokes it with the optional `this`
+     * binding of `thisArg` and the `partials` prepended to those provided to
+     * the wrapper.
+     *
+     * @private
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
+     * @param {*} thisArg The `this` binding of `func`.
+     * @param {Array} partials The arguments to prepend to those provided to the new function.
+     * @returns {Function} Returns the new bound function.
+     */
+    function createPartialWrapper(func, bitmask, thisArg, partials) {
+      var isBind = bitmask & BIND_FLAG,
+          Ctor = createCtorWrapper(func);
+
+      function wrapper() {
+        // Avoid `arguments` object use disqualifying optimizations by
+        // converting it to an array before providing it `func`.
+        var argsIndex = -1,
+            argsLength = arguments.length,
+            leftIndex = -1,
+            leftLength = partials.length,
+            args = Array(leftLength + argsLength);
+
+        while (++leftIndex < leftLength) {
+          args[leftIndex] = partials[leftIndex];
+        }
+        while (argsLength--) {
+          args[leftIndex++] = arguments[++argsIndex];
+        }
+        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+        return fn.apply(isBind ? thisArg : this, args);
+      }
+      return wrapper;
+    }
+
+    /**
+     * Creates a `_.ceil`, `_.floor`, or `_.round` function.
+     *
+     * @private
+     * @param {string} methodName The name of the `Math` method to use when rounding.
+     * @returns {Function} Returns the new round function.
+     */
+    function createRound(methodName) {
+      var func = Math[methodName];
+      return function(number, precision) {
+        precision = precision === undefined ? 0 : (+precision || 0);
+        if (precision) {
+          precision = pow(10, precision);
+          return func(number * precision) / precision;
+        }
+        return func(number);
+      };
+    }
+
+    /**
+     * Creates a `_.sortedIndex` or `_.sortedLastIndex` function.
+     *
+     * @private
+     * @param {boolean} [retHighest] Specify returning the highest qualified index.
+     * @returns {Function} Returns the new index function.
+     */
+    function createSortedIndex(retHighest) {
+      return function(array, value, iteratee, thisArg) {
+        var callback = getCallback(iteratee);
+        return (iteratee == null && callback === baseCallback)
+          ? binaryIndex(array, value, retHighest)
+          : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest);
+      };
+    }
+
+    /**
+     * Creates a function that either curries or invokes `func` with optional
+     * `this` binding and partially applied arguments.
+     *
+     * @private
+     * @param {Function|string} func The function or method name to reference.
+     * @param {number} bitmask The bitmask of flags.
+     *  The bitmask may be composed of the following flags:
+     *     1 - `_.bind`
+     *     2 - `_.bindKey`
+     *     4 - `_.curry` or `_.curryRight` of a bound function
+     *     8 - `_.curry`
+     *    16 - `_.curryRight`
+     *    32 - `_.partial`
+     *    64 - `_.partialRight`
+     *   128 - `_.rearg`
+     *   256 - `_.ary`
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {Array} [partials] The arguments to be partially applied.
+     * @param {Array} [holders] The `partials` placeholder indexes.
+     * @param {Array} [argPos] The argument positions of the new function.
+     * @param {number} [ary] The arity cap of `func`.
+     * @param {number} [arity] The arity of `func`.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
+      var isBindKey = bitmask & BIND_KEY_FLAG;
+      if (!isBindKey && typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      var length = partials ? partials.length : 0;
+      if (!length) {
+        bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
+        partials = holders = undefined;
+      }
+      length -= (holders ? holders.length : 0);
+      if (bitmask & PARTIAL_RIGHT_FLAG) {
+        var partialsRight = partials,
+            holdersRight = holders;
+
+        partials = holders = undefined;
+      }
+      var data = isBindKey ? undefined : getData(func),
+          newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
+
+      if (data) {
+        mergeData(newData, data);
+        bitmask = newData[1];
+        arity = newData[9];
+      }
+      newData[9] = arity == null
+        ? (isBindKey ? 0 : func.length)
+        : (nativeMax(arity - length, 0) || 0);
+
+      if (bitmask == BIND_FLAG) {
+        var result = createBindWrapper(newData[0], newData[2]);
+      } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
+        result = createPartialWrapper.apply(undefined, newData);
+      } else {
+        result = createHybridWrapper.apply(undefined, newData);
+      }
+      var setter = data ? baseSetData : setData;
+      return setter(result, newData);
+    }
+
+    /**
+     * A specialized version of `baseIsEqualDeep` for arrays with support for
+     * partial deep comparisons.
+     *
+     * @private
+     * @param {Array} array The array to compare.
+     * @param {Array} other The other array to compare.
+     * @param {Function} equalFunc The function to determine equivalents of values.
+     * @param {Function} [customizer] The function to customize comparing arrays.
+     * @param {boolean} [isLoose] Specify performing partial comparisons.
+     * @param {Array} [stackA] Tracks traversed `value` objects.
+     * @param {Array} [stackB] Tracks traversed `other` objects.
+     * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
+     */
+    function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
+      var index = -1,
+          arrLength = array.length,
+          othLength = other.length;
+
+      if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
+        return false;
+      }
+      // Ignore non-index properties.
+      while (++index < arrLength) {
+        var arrValue = array[index],
+            othValue = other[index],
+            result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
+
+        if (result !== undefined) {
+          if (result) {
+            continue;
+          }
+          return false;
+        }
+        // Recursively compare arrays (susceptible to call stack limits).
+        if (isLoose) {
+          if (!arraySome(other, function(othValue) {
+                return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
+              })) {
+            return false;
+          }
+        } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
+          return false;
+        }
+      }
+      return true;
+    }
+
+    /**
+     * A specialized version of `baseIsEqualDeep` for comparing objects of
+     * the same `toStringTag`.
+     *
+     * **Note:** This function only supports comparing values with tags of
+     * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
+     *
+     * @private
+     * @param {Object} object The object to compare.
+     * @param {Object} other The other object to compare.
+     * @param {string} tag The `toStringTag` of the objects to compare.
+     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+     */
+    function equalByTag(object, other, tag) {
+      switch (tag) {
+        case boolTag:
+        case dateTag:
+          // Coerce dates and booleans to numbers, dates to milliseconds and booleans
+          // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
+          return +object == +other;
+
+        case errorTag:
+          return object.name == other.name && object.message == other.message;
+
+        case numberTag:
+          // Treat `NaN` vs. `NaN` as equal.
+          return (object != +object)
+            ? other != +other
+            : object == +other;
+
+        case regexpTag:
+        case stringTag:
+          // Coerce regexes to strings and treat strings primitives and string
+          // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
+          return object == (other + '');
+      }
+      return false;
+    }
+
+    /**
+     * A specialized version of `baseIsEqualDeep` for objects with support for
+     * partial deep comparisons.
+     *
+     * @private
+     * @param {Object} object The object to compare.
+     * @param {Object} other The other object to compare.
+     * @param {Function} equalFunc The function to determine equivalents of values.
+     * @param {Function} [customizer] The function to customize comparing values.
+     * @param {boolean} [isLoose] Specify performing partial comparisons.
+     * @param {Array} [stackA] Tracks traversed `value` objects.
+     * @param {Array} [stackB] Tracks traversed `other` objects.
+     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+     */
+    function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
+      var objProps = keys(object),
+          objLength = objProps.length,
+          othProps = keys(other),
+          othLength = othProps.length;
+
+      if (objLength != othLength && !isLoose) {
+        return false;
+      }
+      var index = objLength;
+      while (index--) {
+        var key = objProps[index];
+        if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
+          return false;
+        }
+      }
+      var skipCtor = isLoose;
+      while (++index < objLength) {
+        key = objProps[index];
+        var objValue = object[key],
+            othValue = other[key],
+            result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
+
+        // Recursively compare objects (susceptible to call stack limits).
+        if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
+          return false;
+        }
+        skipCtor || (skipCtor = key == 'constructor');
+      }
+      if (!skipCtor) {
+        var objCtor = object.constructor,
+            othCtor = other.constructor;
+
+        // Non `Object` object instances with different constructors are not equal.
+        if (objCtor != othCtor &&
+            ('constructor' in object && 'constructor' in other) &&
+            !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
+              typeof othCtor == 'function' && othCtor instanceof othCtor)) {
+          return false;
+        }
+      }
+      return true;
+    }
+
+    /**
+     * Gets the appropriate "callback" function. If the `_.callback` method is
+     * customized this function returns the custom method, otherwise it returns
+     * the `baseCallback` function. If arguments are provided the chosen function
+     * is invoked with them and its result is returned.
+     *
+     * @private
+     * @returns {Function} Returns the chosen function or its result.
+     */
+    function getCallback(func, thisArg, argCount) {
+      var result = lodash.callback || callback;
+      result = result === callback ? baseCallback : result;
+      return argCount ? result(func, thisArg, argCount) : result;
+    }
+
+    /**
+     * Gets metadata for `func`.
+     *
+     * @private
+     * @param {Function} func The function to query.
+     * @returns {*} Returns the metadata for `func`.
+     */
+    var getData = !metaMap ? noop : function(func) {
+      return metaMap.get(func);
+    };
+
+    /**
+     * Gets the name of `func`.
+     *
+     * @private
+     * @param {Function} func The function to query.
+     * @returns {string} Returns the function name.
+     */
+    function getFuncName(func) {
+      var result = func.name,
+          array = realNames[result],
+          length = array ? array.length : 0;
+
+      while (length--) {
+        var data = array[length],
+            otherFunc = data.func;
+        if (otherFunc == null || otherFunc == func) {
+          return data.name;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
+     * customized this function returns the custom method, otherwise it returns
+     * the `baseIndexOf` function. If arguments are provided the chosen function
+     * is invoked with them and its result is returned.
+     *
+     * @private
+     * @returns {Function|number} Returns the chosen function or its result.
+     */
+    function getIndexOf(collection, target, fromIndex) {
+      var result = lodash.indexOf || indexOf;
+      result = result === indexOf ? baseIndexOf : result;
+      return collection ? result(collection, target, fromIndex) : result;
+    }
+
+    /**
+     * Gets the "length" property value of `object`.
+     *
+     * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
+     * that affects Safari on at least iOS 8.1-8.3 ARM64.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {*} Returns the "length" value.
+     */
+    var getLength = baseProperty('length');
+
+    /**
+     * Gets the propery names, values, and compare flags of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the match data of `object`.
+     */
+    function getMatchData(object) {
+      var result = pairs(object),
+          length = result.length;
+
+      while (length--) {
+        result[length][2] = isStrictComparable(result[length][1]);
+      }
+      return result;
+    }
+
+    /**
+     * Gets the native function at `key` of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {string} key The key of the method to get.
+     * @returns {*} Returns the function if it's native, else `undefined`.
+     */
+    function getNative(object, key) {
+      var value = object == null ? undefined : object[key];
+      return isNative(value) ? value : undefined;
+    }
+
+    /**
+     * Gets the view, applying any `transforms` to the `start` and `end` positions.
+     *
+     * @private
+     * @param {number} start The start of the view.
+     * @param {number} end The end of the view.
+     * @param {Array} transforms The transformations to apply to the view.
+     * @returns {Object} Returns an object containing the `start` and `end`
+     *  positions of the view.
+     */
+    function getView(start, end, transforms) {
+      var index = -1,
+          length = transforms.length;
+
+      while (++index < length) {
+        var data = transforms[index],
+            size = data.size;
+
+        switch (data.type) {
+          case 'drop':      start += size; break;
+          case 'dropRight': end -= size; break;
+          case 'take':      end = nativeMin(end, start + size); break;
+          case 'takeRight': start = nativeMax(start, end - size); break;
+        }
+      }
+      return { 'start': start, 'end': end };
+    }
+
+    /**
+     * Initializes an array clone.
+     *
+     * @private
+     * @param {Array} array The array to clone.
+     * @returns {Array} Returns the initialized clone.
+     */
+    function initCloneArray(array) {
+      var length = array.length,
+          result = new array.constructor(length);
+
+      // Add array properties assigned by `RegExp#exec`.
+      if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
+        result.index = array.index;
+        result.input = array.input;
+      }
+      return result;
+    }
+
+    /**
+     * Initializes an object clone.
+     *
+     * @private
+     * @param {Object} object The object to clone.
+     * @returns {Object} Returns the initialized clone.
+     */
+    function initCloneObject(object) {
+      var Ctor = object.constructor;
+      if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
+        Ctor = Object;
+      }
+      return new Ctor;
+    }
+
+    /**
+     * Initializes an object clone based on its `toStringTag`.
+     *
+     * **Note:** This function only supports cloning values with tags of
+     * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
+     *
+     * @private
+     * @param {Object} object The object to clone.
+     * @param {string} tag The `toStringTag` of the object to clone.
+     * @param {boolean} [isDeep] Specify a deep clone.
+     * @returns {Object} Returns the initialized clone.
+     */
+    function initCloneByTag(object, tag, isDeep) {
+      var Ctor = object.constructor;
+      switch (tag) {
+        case arrayBufferTag:
+          return bufferClone(object);
+
+        case boolTag:
+        case dateTag:
+          return new Ctor(+object);
+
+        case float32Tag: case float64Tag:
+        case int8Tag: case int16Tag: case int32Tag:
+        case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
+          var buffer = object.buffer;
+          return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
+
+        case numberTag:
+        case stringTag:
+          return new Ctor(object);
+
+        case regexpTag:
+          var result = new Ctor(object.source, reFlags.exec(object));
+          result.lastIndex = object.lastIndex;
+      }
+      return result;
+    }
+
+    /**
+     * Invokes the method at `path` on `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path of the method to invoke.
+     * @param {Array} args The arguments to invoke the method with.
+     * @returns {*} Returns the result of the invoked method.
+     */
+    function invokePath(object, path, args) {
+      if (object != null && !isKey(path, object)) {
+        path = toPath(path);
+        object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
+        path = last(path);
+      }
+      var func = object == null ? object : object[path];
+      return func == null ? undefined : func.apply(object, args);
+    }
+
+    /**
+     * Checks if `value` is array-like.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+     */
+    function isArrayLike(value) {
+      return value != null && isLength(getLength(value));
+    }
+
+    /**
+     * Checks if `value` is a valid array-like index.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+     * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+     */
+    function isIndex(value, length) {
+      value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
+      length = length == null ? MAX_SAFE_INTEGER : length;
+      return value > -1 && value % 1 == 0 && value < length;
+    }
+
+    /**
+     * Checks if the provided arguments are from an iteratee call.
+     *
+     * @private
+     * @param {*} value The potential iteratee value argument.
+     * @param {*} index The potential iteratee index or key argument.
+     * @param {*} object The potential iteratee object argument.
+     * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
+     */
+    function isIterateeCall(value, index, object) {
+      if (!isObject(object)) {
+        return false;
+      }
+      var type = typeof index;
+      if (type == 'number'
+          ? (isArrayLike(object) && isIndex(index, object.length))
+          : (type == 'string' && index in object)) {
+        var other = object[index];
+        return value === value ? (value === other) : (other !== other);
+      }
+      return false;
+    }
+
+    /**
+     * Checks if `value` is a property name and not a property path.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @param {Object} [object] The object to query keys on.
+     * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
+     */
+    function isKey(value, object) {
+      var type = typeof value;
+      if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
+        return true;
+      }
+      if (isArray(value)) {
+        return false;
+      }
+      var result = !reIsDeepProp.test(value);
+      return result || (object != null && value in toObject(object));
+    }
+
+    /**
+     * Checks if `func` has a lazy counterpart.
+     *
+     * @private
+     * @param {Function} func The function to check.
+     * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
+     */
+    function isLaziable(func) {
+      var funcName = getFuncName(func);
+      if (!(funcName in LazyWrapper.prototype)) {
+        return false;
+      }
+      var other = lodash[funcName];
+      if (func === other) {
+        return true;
+      }
+      var data = getData(other);
+      return !!data && func === data[0];
+    }
+
+    /**
+     * Checks if `value` is a valid array-like length.
+     *
+     * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+     */
+    function isLength(value) {
+      return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+    }
+
+    /**
+     * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` if suitable for strict
+     *  equality comparisons, else `false`.
+     */
+    function isStrictComparable(value) {
+      return value === value && !isObject(value);
+    }
+
+    /**
+     * Merges the function metadata of `source` into `data`.
+     *
+     * Merging metadata reduces the number of wrappers required to invoke a function.
+     * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
+     * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
+     * augment function arguments, making the order in which they are executed important,
+     * preventing the merging of metadata. However, we make an exception for a safe
+     * common case where curried functions have `_.ary` and or `_.rearg` applied.
+     *
+     * @private
+     * @param {Array} data The destination metadata.
+     * @param {Array} source The source metadata.
+     * @returns {Array} Returns `data`.
+     */
+    function mergeData(data, source) {
+      var bitmask = data[1],
+          srcBitmask = source[1],
+          newBitmask = bitmask | srcBitmask,
+          isCommon = newBitmask < ARY_FLAG;
+
+      var isCombo =
+        (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
+        (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
+        (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
+
+      // Exit early if metadata can't be merged.
+      if (!(isCommon || isCombo)) {
+        return data;
+      }
+      // Use source `thisArg` if available.
+      if (srcBitmask & BIND_FLAG) {
+        data[2] = source[2];
+        // Set when currying a bound function.
+        newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
+      }
+      // Compose partial arguments.
+      var value = source[3];
+      if (value) {
+        var partials = data[3];
+        data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
+        data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
+      }
+      // Compose partial right arguments.
+      value = source[5];
+      if (value) {
+        partials = data[5];
+        data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
+        data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
+      }
+      // Use source `argPos` if available.
+      value = source[7];
+      if (value) {
+        data[7] = arrayCopy(value);
+      }
+      // Use source `ary` if it's smaller.
+      if (srcBitmask & ARY_FLAG) {
+        data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
+      }
+      // Use source `arity` if one is not provided.
+      if (data[9] == null) {
+        data[9] = source[9];
+      }
+      // Use source `func` and merge bitmasks.
+      data[0] = source[0];
+      data[1] = newBitmask;
+
+      return data;
+    }
+
+    /**
+     * Used by `_.defaultsDeep` to customize its `_.merge` use.
+     *
+     * @private
+     * @param {*} objectValue The destination object property value.
+     * @param {*} sourceValue The source object property value.
+     * @returns {*} Returns the value to assign to the destination object.
+     */
+    function mergeDefaults(objectValue, sourceValue) {
+      return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults);
+    }
+
+    /**
+     * A specialized version of `_.pick` which picks `object` properties specified
+     * by `props`.
+     *
+     * @private
+     * @param {Object} object The source object.
+     * @param {string[]} props The property names to pick.
+     * @returns {Object} Returns the new object.
+     */
+    function pickByArray(object, props) {
+      object = toObject(object);
+
+      var index = -1,
+          length = props.length,
+          result = {};
+
+      while (++index < length) {
+        var key = props[index];
+        if (key in object) {
+          result[key] = object[key];
+        }
+      }
+      return result;
+    }
+
+    /**
+     * A specialized version of `_.pick` which picks `object` properties `predicate`
+     * returns truthy for.
+     *
+     * @private
+     * @param {Object} object The source object.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {Object} Returns the new object.
+     */
+    function pickByCallback(object, predicate) {
+      var result = {};
+      baseForIn(object, function(value, key, object) {
+        if (predicate(value, key, object)) {
+          result[key] = value;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * Reorder `array` according to the specified indexes where the element at
+     * the first index is assigned as the first element, the element at
+     * the second index is assigned as the second element, and so on.
+     *
+     * @private
+     * @param {Array} array The array to reorder.
+     * @param {Array} indexes The arranged array indexes.
+     * @returns {Array} Returns `array`.
+     */
+    function reorder(array, indexes) {
+      var arrLength = array.length,
+          length = nativeMin(indexes.length, arrLength),
+          oldArray = arrayCopy(array);
+
+      while (length--) {
+        var index = indexes[length];
+        array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
+      }
+      return array;
+    }
+
+    /**
+     * Sets metadata for `func`.
+     *
+     * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
+     * period of time, it will trip its breaker and transition to an identity function
+     * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)
+     * for more details.
+     *
+     * @private
+     * @param {Function} func The function to associate metadata with.
+     * @param {*} data The metadata.
+     * @returns {Function} Returns `func`.
+     */
+    var setData = (function() {
+      var count = 0,
+          lastCalled = 0;
+
+      return function(key, value) {
+        var stamp = now(),
+            remaining = HOT_SPAN - (stamp - lastCalled);
+
+        lastCalled = stamp;
+        if (remaining > 0) {
+          if (++count >= HOT_COUNT) {
+            return key;
+          }
+        } else {
+          count = 0;
+        }
+        return baseSetData(key, value);
+      };
+    }());
+
+    /**
+     * A fallback implementation of `Object.keys` which creates an array of the
+     * own enumerable property names of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names.
+     */
+    function shimKeys(object) {
+      var props = keysIn(object),
+          propsLength = props.length,
+          length = propsLength && object.length;
+
+      var allowIndexes = !!length && isLength(length) &&
+        (isArray(object) || isArguments(object));
+
+      var index = -1,
+          result = [];
+
+      while (++index < propsLength) {
+        var key = props[index];
+        if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
+          result.push(key);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Converts `value` to an array-like object if it's not one.
+     *
+     * @private
+     * @param {*} value The value to process.
+     * @returns {Array|Object} Returns the array-like object.
+     */
+    function toIterable(value) {
+      if (value == null) {
+        return [];
+      }
+      if (!isArrayLike(value)) {
+        return values(value);
+      }
+      return isObject(value) ? value : Object(value);
+    }
+
+    /**
+     * Converts `value` to an object if it's not one.
+     *
+     * @private
+     * @param {*} value The value to process.
+     * @returns {Object} Returns the object.
+     */
+    function toObject(value) {
+      return isObject(value) ? value : Object(value);
+    }
+
+    /**
+     * Converts `value` to property path array if it's not one.
+     *
+     * @private
+     * @param {*} value The value to process.
+     * @returns {Array} Returns the property path array.
+     */
+    function toPath(value) {
+      if (isArray(value)) {
+        return value;
+      }
+      var result = [];
+      baseToString(value).replace(rePropName, function(match, number, quote, string) {
+        result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
+      });
+      return result;
+    }
+
+    /**
+     * Creates a clone of `wrapper`.
+     *
+     * @private
+     * @param {Object} wrapper The wrapper to clone.
+     * @returns {Object} Returns the cloned wrapper.
+     */
+    function wrapperClone(wrapper) {
+      return wrapper instanceof LazyWrapper
+        ? wrapper.clone()
+        : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array of elements split into groups the length of `size`.
+     * If `collection` can't be split evenly, the final chunk will be the remaining
+     * elements.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to process.
+     * @param {number} [size=1] The length of each chunk.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Array} Returns the new array containing chunks.
+     * @example
+     *
+     * _.chunk(['a', 'b', 'c', 'd'], 2);
+     * // => [['a', 'b'], ['c', 'd']]
+     *
+     * _.chunk(['a', 'b', 'c', 'd'], 3);
+     * // => [['a', 'b', 'c'], ['d']]
+     */
+    function chunk(array, size, guard) {
+      if (guard ? isIterateeCall(array, size, guard) : size == null) {
+        size = 1;
+      } else {
+        size = nativeMax(nativeFloor(size) || 1, 1);
+      }
+      var index = 0,
+          length = array ? array.length : 0,
+          resIndex = -1,
+          result = Array(nativeCeil(length / size));
+
+      while (index < length) {
+        result[++resIndex] = baseSlice(array, index, (index += size));
+      }
+      return result;
+    }
+
+    /**
+     * Creates an array with all falsey values removed. The values `false`, `null`,
+     * `0`, `""`, `undefined`, and `NaN` are falsey.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to compact.
+     * @returns {Array} Returns the new array of filtered values.
+     * @example
+     *
+     * _.compact([0, 1, false, 2, '', 3]);
+     * // => [1, 2, 3]
+     */
+    function compact(array) {
+      var index = -1,
+          length = array ? array.length : 0,
+          resIndex = -1,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index];
+        if (value) {
+          result[++resIndex] = value;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Creates an array of unique `array` values not included in the other
+     * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+     * for equality comparisons.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {...Array} [values] The arrays of values to exclude.
+     * @returns {Array} Returns the new array of filtered values.
+     * @example
+     *
+     * _.difference([1, 2, 3], [4, 2]);
+     * // => [1, 3]
+     */
+    var difference = restParam(function(array, values) {
+      return (isObjectLike(array) && isArrayLike(array))
+        ? baseDifference(array, baseFlatten(values, false, true))
+        : [];
+    });
+
+    /**
+     * Creates a slice of `array` with `n` elements dropped from the beginning.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {number} [n=1] The number of elements to drop.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.drop([1, 2, 3]);
+     * // => [2, 3]
+     *
+     * _.drop([1, 2, 3], 2);
+     * // => [3]
+     *
+     * _.drop([1, 2, 3], 5);
+     * // => []
+     *
+     * _.drop([1, 2, 3], 0);
+     * // => [1, 2, 3]
+     */
+    function drop(array, n, guard) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return [];
+      }
+      if (guard ? isIterateeCall(array, n, guard) : n == null) {
+        n = 1;
+      }
+      return baseSlice(array, n < 0 ? 0 : n);
+    }
+
+    /**
+     * Creates a slice of `array` with `n` elements dropped from the end.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {number} [n=1] The number of elements to drop.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.dropRight([1, 2, 3]);
+     * // => [1, 2]
+     *
+     * _.dropRight([1, 2, 3], 2);
+     * // => [1]
+     *
+     * _.dropRight([1, 2, 3], 5);
+     * // => []
+     *
+     * _.dropRight([1, 2, 3], 0);
+     * // => [1, 2, 3]
+     */
+    function dropRight(array, n, guard) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return [];
+      }
+      if (guard ? isIterateeCall(array, n, guard) : n == null) {
+        n = 1;
+      }
+      n = length - (+n || 0);
+      return baseSlice(array, 0, n < 0 ? 0 : n);
+    }
+
+    /**
+     * Creates a slice of `array` excluding elements dropped from the end.
+     * Elements are dropped until `predicate` returns falsey. The predicate is
+     * bound to `thisArg` and invoked with three arguments: (value, index, array).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that match the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.dropRightWhile([1, 2, 3], function(n) {
+     *   return n > 1;
+     * });
+     * // => [1]
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': true },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': false }
+     * ];
+     *
+     * // using the `_.matches` callback shorthand
+     * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
+     * // => ['barney', 'fred']
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.pluck(_.dropRightWhile(users, 'active', false), 'user');
+     * // => ['barney']
+     *
+     * // using the `_.property` callback shorthand
+     * _.pluck(_.dropRightWhile(users, 'active'), 'user');
+     * // => ['barney', 'fred', 'pebbles']
+     */
+    function dropRightWhile(array, predicate, thisArg) {
+      return (array && array.length)
+        ? baseWhile(array, getCallback(predicate, thisArg, 3), true, true)
+        : [];
+    }
+
+    /**
+     * Creates a slice of `array` excluding elements dropped from the beginning.
+     * Elements are dropped until `predicate` returns falsey. The predicate is
+     * bound to `thisArg` and invoked with three arguments: (value, index, array).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.dropWhile([1, 2, 3], function(n) {
+     *   return n < 3;
+     * });
+     * // => [3]
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': false },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': true }
+     * ];
+     *
+     * // using the `_.matches` callback shorthand
+     * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');
+     * // => ['fred', 'pebbles']
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.pluck(_.dropWhile(users, 'active', false), 'user');
+     * // => ['pebbles']
+     *
+     * // using the `_.property` callback shorthand
+     * _.pluck(_.dropWhile(users, 'active'), 'user');
+     * // => ['barney', 'fred', 'pebbles']
+     */
+    function dropWhile(array, predicate, thisArg) {
+      return (array && array.length)
+        ? baseWhile(array, getCallback(predicate, thisArg, 3), true)
+        : [];
+    }
+
+    /**
+     * Fills elements of `array` with `value` from `start` up to, but not
+     * including, `end`.
+     *
+     * **Note:** This method mutates `array`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to fill.
+     * @param {*} value The value to fill `array` with.
+     * @param {number} [start=0] The start position.
+     * @param {number} [end=array.length] The end position.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = [1, 2, 3];
+     *
+     * _.fill(array, 'a');
+     * console.log(array);
+     * // => ['a', 'a', 'a']
+     *
+     * _.fill(Array(3), 2);
+     * // => [2, 2, 2]
+     *
+     * _.fill([4, 6, 8], '*', 1, 2);
+     * // => [4, '*', 8]
+     */
+    function fill(array, value, start, end) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return [];
+      }
+      if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
+        start = 0;
+        end = length;
+      }
+      return baseFill(array, value, start, end);
+    }
+
+    /**
+     * This method is like `_.find` except that it returns the index of the first
+     * element `predicate` returns truthy for instead of the element itself.
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to search.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': false },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': true }
+     * ];
+     *
+     * _.findIndex(users, function(chr) {
+     *   return chr.user == 'barney';
+     * });
+     * // => 0
+     *
+     * // using the `_.matches` callback shorthand
+     * _.findIndex(users, { 'user': 'fred', 'active': false });
+     * // => 1
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.findIndex(users, 'active', false);
+     * // => 0
+     *
+     * // using the `_.property` callback shorthand
+     * _.findIndex(users, 'active');
+     * // => 2
+     */
+    var findIndex = createFindIndex();
+
+    /**
+     * This method is like `_.findIndex` except that it iterates over elements
+     * of `collection` from right to left.
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to search.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': true },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': false }
+     * ];
+     *
+     * _.findLastIndex(users, function(chr) {
+     *   return chr.user == 'pebbles';
+     * });
+     * // => 2
+     *
+     * // using the `_.matches` callback shorthand
+     * _.findLastIndex(users, { 'user': 'barney', 'active': true });
+     * // => 0
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.findLastIndex(users, 'active', false);
+     * // => 2
+     *
+     * // using the `_.property` callback shorthand
+     * _.findLastIndex(users, 'active');
+     * // => 0
+     */
+    var findLastIndex = createFindIndex(true);
+
+    /**
+     * Gets the first element of `array`.
+     *
+     * @static
+     * @memberOf _
+     * @alias head
+     * @category Array
+     * @param {Array} array The array to query.
+     * @returns {*} Returns the first element of `array`.
+     * @example
+     *
+     * _.first([1, 2, 3]);
+     * // => 1
+     *
+     * _.first([]);
+     * // => undefined
+     */
+    function first(array) {
+      return array ? array[0] : undefined;
+    }
+
+    /**
+     * Flattens a nested array. If `isDeep` is `true` the array is recursively
+     * flattened, otherwise it is only flattened a single level.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to flatten.
+     * @param {boolean} [isDeep] Specify a deep flatten.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Array} Returns the new flattened array.
+     * @example
+     *
+     * _.flatten([1, [2, 3, [4]]]);
+     * // => [1, 2, 3, [4]]
+     *
+     * // using `isDeep`
+     * _.flatten([1, [2, 3, [4]]], true);
+     * // => [1, 2, 3, 4]
+     */
+    function flatten(array, isDeep, guard) {
+      var length = array ? array.length : 0;
+      if (guard && isIterateeCall(array, isDeep, guard)) {
+        isDeep = false;
+      }
+      return length ? baseFlatten(array, isDeep) : [];
+    }
+
+    /**
+     * Recursively flattens a nested array.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to recursively flatten.
+     * @returns {Array} Returns the new flattened array.
+     * @example
+     *
+     * _.flattenDeep([1, [2, 3, [4]]]);
+     * // => [1, 2, 3, 4]
+     */
+    function flattenDeep(array) {
+      var length = array ? array.length : 0;
+      return length ? baseFlatten(array, true) : [];
+    }
+
+    /**
+     * Gets the index at which the first occurrence of `value` is found in `array`
+     * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+     * for equality comparisons. If `fromIndex` is negative, it is used as the offset
+     * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
+     * performs a faster binary search.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to search.
+     * @param {*} value The value to search for.
+     * @param {boolean|number} [fromIndex=0] The index to search from or `true`
+     *  to perform a binary search on a sorted array.
+     * @returns {number} Returns the index of the matched value, else `-1`.
+     * @example
+     *
+     * _.indexOf([1, 2, 1, 2], 2);
+     * // => 1
+     *
+     * // using `fromIndex`
+     * _.indexOf([1, 2, 1, 2], 2, 2);
+     * // => 3
+     *
+     * // performing a binary search
+     * _.indexOf([1, 1, 2, 2], 2, true);
+     * // => 2
+     */
+    function indexOf(array, value, fromIndex) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return -1;
+      }
+      if (typeof fromIndex == 'number') {
+        fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
+      } else if (fromIndex) {
+        var index = binaryIndex(array, value);
+        if (index < length &&
+            (value === value ? (value === array[index]) : (array[index] !== array[index]))) {
+          return index;
+        }
+        return -1;
+      }
+      return baseIndexOf(array, value, fromIndex || 0);
+    }
+
+    /**
+     * Gets all but the last element of `array`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.initial([1, 2, 3]);
+     * // => [1, 2]
+     */
+    function initial(array) {
+      return dropRight(array, 1);
+    }
+
+    /**
+     * Creates an array of unique values that are included in all of the provided
+     * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+     * for equality comparisons.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @returns {Array} Returns the new array of shared values.
+     * @example
+     * _.intersection([1, 2], [4, 2], [2, 1]);
+     * // => [2]
+     */
+    var intersection = restParam(function(arrays) {
+      var othLength = arrays.length,
+          othIndex = othLength,
+          caches = Array(length),
+          indexOf = getIndexOf(),
+          isCommon = indexOf == baseIndexOf,
+          result = [];
+
+      while (othIndex--) {
+        var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
+        caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
+      }
+      var array = arrays[0],
+          index = -1,
+          length = array ? array.length : 0,
+          seen = caches[0];
+
+      outer:
+      while (++index < length) {
+        value = array[index];
+        if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
+          var othIndex = othLength;
+          while (--othIndex) {
+            var cache = caches[othIndex];
+            if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {
+              continue outer;
+            }
+          }
+          if (seen) {
+            seen.push(value);
+          }
+          result.push(value);
+        }
+      }
+      return result;
+    });
+
+    /**
+     * Gets the last element of `array`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @returns {*} Returns the last element of `array`.
+     * @example
+     *
+     * _.last([1, 2, 3]);
+     * // => 3
+     */
+    function last(array) {
+      var length = array ? array.length : 0;
+      return length ? array[length - 1] : undefined;
+    }
+
+    /**
+     * This method is like `_.indexOf` except that it iterates over elements of
+     * `array` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to search.
+     * @param {*} value The value to search for.
+     * @param {boolean|number} [fromIndex=array.length-1] The index to search from
+     *  or `true` to perform a binary search on a sorted array.
+     * @returns {number} Returns the index of the matched value, else `-1`.
+     * @example
+     *
+     * _.lastIndexOf([1, 2, 1, 2], 2);
+     * // => 3
+     *
+     * // using `fromIndex`
+     * _.lastIndexOf([1, 2, 1, 2], 2, 2);
+     * // => 1
+     *
+     * // performing a binary search
+     * _.lastIndexOf([1, 1, 2, 2], 2, true);
+     * // => 3
+     */
+    function lastIndexOf(array, value, fromIndex) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return -1;
+      }
+      var index = length;
+      if (typeof fromIndex == 'number') {
+        index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1;
+      } else if (fromIndex) {
+        index = binaryIndex(array, value, true) - 1;
+        var other = array[index];
+        if (value === value ? (value === other) : (other !== other)) {
+          return index;
+        }
+        return -1;
+      }
+      if (value !== value) {
+        return indexOfNaN(array, index, true);
+      }
+      while (index--) {
+        if (array[index] === value) {
+          return index;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * Removes all provided values from `array` using
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+     * for equality comparisons.
+     *
+     * **Note:** Unlike `_.without`, this method mutates `array`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @param {...*} [values] The values to remove.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = [1, 2, 3, 1, 2, 3];
+     *
+     * _.pull(array, 2, 3);
+     * console.log(array);
+     * // => [1, 1]
+     */
+    function pull() {
+      var args = arguments,
+          array = args[0];
+
+      if (!(array && array.length)) {
+        return array;
+      }
+      var index = 0,
+          indexOf = getIndexOf(),
+          length = args.length;
+
+      while (++index < length) {
+        var fromIndex = 0,
+            value = args[index];
+
+        while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {
+          splice.call(array, fromIndex, 1);
+        }
+      }
+      return array;
+    }
+
+    /**
+     * Removes elements from `array` corresponding to the given indexes and returns
+     * an array of the removed elements. Indexes may be specified as an array of
+     * indexes or as individual arguments.
+     *
+     * **Note:** Unlike `_.at`, this method mutates `array`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @param {...(number|number[])} [indexes] The indexes of elements to remove,
+     *  specified as individual indexes or arrays of indexes.
+     * @returns {Array} Returns the new array of removed elements.
+     * @example
+     *
+     * var array = [5, 10, 15, 20];
+     * var evens = _.pullAt(array, 1, 3);
+     *
+     * console.log(array);
+     * // => [5, 15]
+     *
+     * console.log(evens);
+     * // => [10, 20]
+     */
+    var pullAt = restParam(function(array, indexes) {
+      indexes = baseFlatten(indexes);
+
+      var result = baseAt(array, indexes);
+      basePullAt(array, indexes.sort(baseCompareAscending));
+      return result;
+    });
+
+    /**
+     * Removes all elements from `array` that `predicate` returns truthy for
+     * and returns an array of the removed elements. The predicate is bound to
+     * `thisArg` and invoked with three arguments: (value, index, array).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * **Note:** Unlike `_.filter`, this method mutates `array`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Array} Returns the new array of removed elements.
+     * @example
+     *
+     * var array = [1, 2, 3, 4];
+     * var evens = _.remove(array, function(n) {
+     *   return n % 2 == 0;
+     * });
+     *
+     * console.log(array);
+     * // => [1, 3]
+     *
+     * console.log(evens);
+     * // => [2, 4]
+     */
+    function remove(array, predicate, thisArg) {
+      var result = [];
+      if (!(array && array.length)) {
+        return result;
+      }
+      var index = -1,
+          indexes = [],
+          length = array.length;
+
+      predicate = getCallback(predicate, thisArg, 3);
+      while (++index < length) {
+        var value = array[index];
+        if (predicate(value, index, array)) {
+          result.push(value);
+          indexes.push(index);
+        }
+      }
+      basePullAt(array, indexes);
+      return result;
+    }
+
+    /**
+     * Gets all but the first element of `array`.
+     *
+     * @static
+     * @memberOf _
+     * @alias tail
+     * @category Array
+     * @param {Array} array The array to query.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.rest([1, 2, 3]);
+     * // => [2, 3]
+     */
+    function rest(array) {
+      return drop(array, 1);
+    }
+
+    /**
+     * Creates a slice of `array` from `start` up to, but not including, `end`.
+     *
+     * **Note:** This method is used instead of `Array#slice` to support node
+     * lists in IE < 9 and to ensure dense arrays are returned.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to slice.
+     * @param {number} [start=0] The start position.
+     * @param {number} [end=array.length] The end position.
+     * @returns {Array} Returns the slice of `array`.
+     */
+    function slice(array, start, end) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return [];
+      }
+      if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
+        start = 0;
+        end = length;
+      }
+      return baseSlice(array, start, end);
+    }
+
+    /**
+     * Uses a binary search to determine the lowest index at which `value` should
+     * be inserted into `array` in order to maintain its sort order. If an iteratee
+     * function is provided it is invoked for `value` and each element of `array`
+     * to compute their sort ranking. The iteratee is bound to `thisArg` and
+     * invoked with one argument; (value).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     * @example
+     *
+     * _.sortedIndex([30, 50], 40);
+     * // => 1
+     *
+     * _.sortedIndex([4, 4, 5, 5], 5);
+     * // => 2
+     *
+     * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };
+     *
+     * // using an iteratee function
+     * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {
+     *   return this.data[word];
+     * }, dict);
+     * // => 1
+     *
+     * // using the `_.property` callback shorthand
+     * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
+     * // => 1
+     */
+    var sortedIndex = createSortedIndex();
+
+    /**
+     * This method is like `_.sortedIndex` except that it returns the highest
+     * index at which `value` should be inserted into `array` in order to
+     * maintain its sort order.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     * @example
+     *
+     * _.sortedLastIndex([4, 4, 5, 5], 5);
+     * // => 4
+     */
+    var sortedLastIndex = createSortedIndex(true);
+
+    /**
+     * Creates a slice of `array` with `n` elements taken from the beginning.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {number} [n=1] The number of elements to take.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.take([1, 2, 3]);
+     * // => [1]
+     *
+     * _.take([1, 2, 3], 2);
+     * // => [1, 2]
+     *
+     * _.take([1, 2, 3], 5);
+     * // => [1, 2, 3]
+     *
+     * _.take([1, 2, 3], 0);
+     * // => []
+     */
+    function take(array, n, guard) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return [];
+      }
+      if (guard ? isIterateeCall(array, n, guard) : n == null) {
+        n = 1;
+      }
+      return baseSlice(array, 0, n < 0 ? 0 : n);
+    }
+
+    /**
+     * Creates a slice of `array` with `n` elements taken from the end.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {number} [n=1] The number of elements to take.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.takeRight([1, 2, 3]);
+     * // => [3]
+     *
+     * _.takeRight([1, 2, 3], 2);
+     * // => [2, 3]
+     *
+     * _.takeRight([1, 2, 3], 5);
+     * // => [1, 2, 3]
+     *
+     * _.takeRight([1, 2, 3], 0);
+     * // => []
+     */
+    function takeRight(array, n, guard) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return [];
+      }
+      if (guard ? isIterateeCall(array, n, guard) : n == null) {
+        n = 1;
+      }
+      n = length - (+n || 0);
+      return baseSlice(array, n < 0 ? 0 : n);
+    }
+
+    /**
+     * Creates a slice of `array` with elements taken from the end. Elements are
+     * taken until `predicate` returns falsey. The predicate is bound to `thisArg`
+     * and invoked with three arguments: (value, index, array).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.takeRightWhile([1, 2, 3], function(n) {
+     *   return n > 1;
+     * });
+     * // => [2, 3]
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': true },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': false }
+     * ];
+     *
+     * // using the `_.matches` callback shorthand
+     * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
+     * // => ['pebbles']
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.pluck(_.takeRightWhile(users, 'active', false), 'user');
+     * // => ['fred', 'pebbles']
+     *
+     * // using the `_.property` callback shorthand
+     * _.pluck(_.takeRightWhile(users, 'active'), 'user');
+     * // => []
+     */
+    function takeRightWhile(array, predicate, thisArg) {
+      return (array && array.length)
+        ? baseWhile(array, getCallback(predicate, thisArg, 3), false, true)
+        : [];
+    }
+
+    /**
+     * Creates a slice of `array` with elements taken from the beginning. Elements
+     * are taken until `predicate` returns falsey. The predicate is bound to
+     * `thisArg` and invoked with three arguments: (value, index, array).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.takeWhile([1, 2, 3], function(n) {
+     *   return n < 3;
+     * });
+     * // => [1, 2]
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': false },
+     *   { 'user': 'fred',    'active': false},
+     *   { 'user': 'pebbles', 'active': true }
+     * ];
+     *
+     * // using the `_.matches` callback shorthand
+     * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');
+     * // => ['barney']
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.pluck(_.takeWhile(users, 'active', false), 'user');
+     * // => ['barney', 'fred']
+     *
+     * // using the `_.property` callback shorthand
+     * _.pluck(_.takeWhile(users, 'active'), 'user');
+     * // => []
+     */
+    function takeWhile(array, predicate, thisArg) {
+      return (array && array.length)
+        ? baseWhile(array, getCallback(predicate, thisArg, 3))
+        : [];
+    }
+
+    /**
+     * Creates an array of unique values, in order, from all of the provided arrays
+     * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+     * for equality comparisons.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @returns {Array} Returns the new array of combined values.
+     * @example
+     *
+     * _.union([1, 2], [4, 2], [2, 1]);
+     * // => [1, 2, 4]
+     */
+    var union = restParam(function(arrays) {
+      return baseUniq(baseFlatten(arrays, false, true));
+    });
+
+    /**
+     * Creates a duplicate-free version of an array, using
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+     * for equality comparisons, in which only the first occurence of each element
+     * is kept. Providing `true` for `isSorted` performs a faster search algorithm
+     * for sorted arrays. If an iteratee function is provided it is invoked for
+     * each element in the array to generate the criterion by which uniqueness
+     * is computed. The `iteratee` is bound to `thisArg` and invoked with three
+     * arguments: (value, index, array).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias unique
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {boolean} [isSorted] Specify the array is sorted.
+     * @param {Function|Object|string} [iteratee] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Array} Returns the new duplicate-value-free array.
+     * @example
+     *
+     * _.uniq([2, 1, 2]);
+     * // => [2, 1]
+     *
+     * // using `isSorted`
+     * _.uniq([1, 1, 2], true);
+     * // => [1, 2]
+     *
+     * // using an iteratee function
+     * _.uniq([1, 2.5, 1.5, 2], function(n) {
+     *   return this.floor(n);
+     * }, Math);
+     * // => [1, 2.5]
+     *
+     * // using the `_.property` callback shorthand
+     * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+     * // => [{ 'x': 1 }, { 'x': 2 }]
+     */
+    function uniq(array, isSorted, iteratee, thisArg) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return [];
+      }
+      if (isSorted != null && typeof isSorted != 'boolean') {
+        thisArg = iteratee;
+        iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
+        isSorted = false;
+      }
+      var callback = getCallback();
+      if (!(iteratee == null && callback === baseCallback)) {
+        iteratee = callback(iteratee, thisArg, 3);
+      }
+      return (isSorted && getIndexOf() == baseIndexOf)
+        ? sortedUniq(array, iteratee)
+        : baseUniq(array, iteratee);
+    }
+
+    /**
+     * This method is like `_.zip` except that it accepts an array of grouped
+     * elements and creates an array regrouping the elements to their pre-zip
+     * configuration.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array of grouped elements to process.
+     * @returns {Array} Returns the new array of regrouped elements.
+     * @example
+     *
+     * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
+     * // => [['fred', 30, true], ['barney', 40, false]]
+     *
+     * _.unzip(zipped);
+     * // => [['fred', 'barney'], [30, 40], [true, false]]
+     */
+    function unzip(array) {
+      if (!(array && array.length)) {
+        return [];
+      }
+      var index = -1,
+          length = 0;
+
+      array = arrayFilter(array, function(group) {
+        if (isArrayLike(group)) {
+          length = nativeMax(group.length, length);
+          return true;
+        }
+      });
+      var result = Array(length);
+      while (++index < length) {
+        result[index] = arrayMap(array, baseProperty(index));
+      }
+      return result;
+    }
+
+    /**
+     * This method is like `_.unzip` except that it accepts an iteratee to specify
+     * how regrouped values should be combined. The `iteratee` is bound to `thisArg`
+     * and invoked with four arguments: (accumulator, value, index, group).
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array of grouped elements to process.
+     * @param {Function} [iteratee] The function to combine regrouped values.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Array} Returns the new array of regrouped elements.
+     * @example
+     *
+     * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
+     * // => [[1, 10, 100], [2, 20, 200]]
+     *
+     * _.unzipWith(zipped, _.add);
+     * // => [3, 30, 300]
+     */
+    function unzipWith(array, iteratee, thisArg) {
+      var length = array ? array.length : 0;
+      if (!length) {
+        return [];
+      }
+      var result = unzip(array);
+      if (iteratee == null) {
+        return result;
+      }
+      iteratee = bindCallback(iteratee, thisArg, 4);
+      return arrayMap(result, function(group) {
+        return arrayReduce(group, iteratee, undefined, true);
+      });
+    }
+
+    /**
+     * Creates an array excluding all provided values using
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+     * for equality comparisons.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {Array} array The array to filter.
+     * @param {...*} [values] The values to exclude.
+     * @returns {Array} Returns the new array of filtered values.
+     * @example
+     *
+     * _.without([1, 2, 1, 3], 1, 2);
+     * // => [3]
+     */
+    var without = restParam(function(array, values) {
+      return isArrayLike(array)
+        ? baseDifference(array, values)
+        : [];
+    });
+
+    /**
+     * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
+     * of the provided arrays.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @returns {Array} Returns the new array of values.
+     * @example
+     *
+     * _.xor([1, 2], [4, 2]);
+     * // => [1, 4]
+     */
+    function xor() {
+      var index = -1,
+          length = arguments.length;
+
+      while (++index < length) {
+        var array = arguments[index];
+        if (isArrayLike(array)) {
+          var result = result
+            ? arrayPush(baseDifference(result, array), baseDifference(array, result))
+            : array;
+        }
+      }
+      return result ? baseUniq(result) : [];
+    }
+
+    /**
+     * Creates an array of grouped elements, the first of which contains the first
+     * elements of the given arrays, the second of which contains the second elements
+     * of the given arrays, and so on.
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {...Array} [arrays] The arrays to process.
+     * @returns {Array} Returns the new array of grouped elements.
+     * @example
+     *
+     * _.zip(['fred', 'barney'], [30, 40], [true, false]);
+     * // => [['fred', 30, true], ['barney', 40, false]]
+     */
+    var zip = restParam(unzip);
+
+    /**
+     * The inverse of `_.pairs`; this method returns an object composed from arrays
+     * of property names and values. Provide either a single two dimensional array,
+     * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names
+     * and one of corresponding values.
+     *
+     * @static
+     * @memberOf _
+     * @alias object
+     * @category Array
+     * @param {Array} props The property names.
+     * @param {Array} [values=[]] The property values.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * _.zipObject([['fred', 30], ['barney', 40]]);
+     * // => { 'fred': 30, 'barney': 40 }
+     *
+     * _.zipObject(['fred', 'barney'], [30, 40]);
+     * // => { 'fred': 30, 'barney': 40 }
+     */
+    function zipObject(props, values) {
+      var index = -1,
+          length = props ? props.length : 0,
+          result = {};
+
+      if (length && !values && !isArray(props[0])) {
+        values = [];
+      }
+      while (++index < length) {
+        var key = props[index];
+        if (values) {
+          result[key] = values[index];
+        } else if (key) {
+          result[key[0]] = key[1];
+        }
+      }
+      return result;
+    }
+
+    /**
+     * This method is like `_.zip` except that it accepts an iteratee to specify
+     * how grouped values should be combined. The `iteratee` is bound to `thisArg`
+     * and invoked with four arguments: (accumulator, value, index, group).
+     *
+     * @static
+     * @memberOf _
+     * @category Array
+     * @param {...Array} [arrays] The arrays to process.
+     * @param {Function} [iteratee] The function to combine grouped values.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Array} Returns the new array of grouped elements.
+     * @example
+     *
+     * _.zipWith([1, 2], [10, 20], [100, 200], _.add);
+     * // => [111, 222]
+     */
+    var zipWith = restParam(function(arrays) {
+      var length = arrays.length,
+          iteratee = length > 2 ? arrays[length - 2] : undefined,
+          thisArg = length > 1 ? arrays[length - 1] : undefined;
+
+      if (length > 2 && typeof iteratee == 'function') {
+        length -= 2;
+      } else {
+        iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;
+        thisArg = undefined;
+      }
+      arrays.length = length;
+      return unzipWith(arrays, iteratee, thisArg);
+    });
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` object that wraps `value` with explicit method
+     * chaining enabled.
+     *
+     * @static
+     * @memberOf _
+     * @category Chain
+     * @param {*} value The value to wrap.
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'age': 36 },
+     *   { 'user': 'fred',    'age': 40 },
+     *   { 'user': 'pebbles', 'age': 1 }
+     * ];
+     *
+     * var youngest = _.chain(users)
+     *   .sortBy('age')
+     *   .map(function(chr) {
+     *     return chr.user + ' is ' + chr.age;
+     *   })
+     *   .first()
+     *   .value();
+     * // => 'pebbles is 1'
+     */
+    function chain(value) {
+      var result = lodash(value);
+      result.__chain__ = true;
+      return result;
+    }
+
+    /**
+     * This method invokes `interceptor` and returns `value`. The interceptor is
+     * bound to `thisArg` and invoked with one argument; (value). The purpose of
+     * this method is to "tap into" a method chain in order to perform operations
+     * on intermediate results within the chain.
+     *
+     * @static
+     * @memberOf _
+     * @category Chain
+     * @param {*} value The value to provide to `interceptor`.
+     * @param {Function} interceptor The function to invoke.
+     * @param {*} [thisArg] The `this` binding of `interceptor`.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * _([1, 2, 3])
+     *  .tap(function(array) {
+     *    array.pop();
+     *  })
+     *  .reverse()
+     *  .value();
+     * // => [2, 1]
+     */
+    function tap(value, interceptor, thisArg) {
+      interceptor.call(thisArg, value);
+      return value;
+    }
+
+    /**
+     * This method is like `_.tap` except that it returns the result of `interceptor`.
+     *
+     * @static
+     * @memberOf _
+     * @category Chain
+     * @param {*} value The value to provide to `interceptor`.
+     * @param {Function} interceptor The function to invoke.
+     * @param {*} [thisArg] The `this` binding of `interceptor`.
+     * @returns {*} Returns the result of `interceptor`.
+     * @example
+     *
+     * _('  abc  ')
+     *  .chain()
+     *  .trim()
+     *  .thru(function(value) {
+     *    return [value];
+     *  })
+     *  .value();
+     * // => ['abc']
+     */
+    function thru(value, interceptor, thisArg) {
+      return interceptor.call(thisArg, value);
+    }
+
+    /**
+     * Enables explicit method chaining on the wrapper object.
+     *
+     * @name chain
+     * @memberOf _
+     * @category Chain
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36 },
+     *   { 'user': 'fred',   'age': 40 }
+     * ];
+     *
+     * // without explicit chaining
+     * _(users).first();
+     * // => { 'user': 'barney', 'age': 36 }
+     *
+     * // with explicit chaining
+     * _(users).chain()
+     *   .first()
+     *   .pick('user')
+     *   .value();
+     * // => { 'user': 'barney' }
+     */
+    function wrapperChain() {
+      return chain(this);
+    }
+
+    /**
+     * Executes the chained sequence and returns the wrapped result.
+     *
+     * @name commit
+     * @memberOf _
+     * @category Chain
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var array = [1, 2];
+     * var wrapped = _(array).push(3);
+     *
+     * console.log(array);
+     * // => [1, 2]
+     *
+     * wrapped = wrapped.commit();
+     * console.log(array);
+     * // => [1, 2, 3]
+     *
+     * wrapped.last();
+     * // => 3
+     *
+     * console.log(array);
+     * // => [1, 2, 3]
+     */
+    function wrapperCommit() {
+      return new LodashWrapper(this.value(), this.__chain__);
+    }
+
+    /**
+     * Creates a new array joining a wrapped array with any additional arrays
+     * and/or values.
+     *
+     * @name concat
+     * @memberOf _
+     * @category Chain
+     * @param {...*} [values] The values to concatenate.
+     * @returns {Array} Returns the new concatenated array.
+     * @example
+     *
+     * var array = [1];
+     * var wrapped = _(array).concat(2, [3], [[4]]);
+     *
+     * console.log(wrapped.value());
+     * // => [1, 2, 3, [4]]
+     *
+     * console.log(array);
+     * // => [1]
+     */
+    var wrapperConcat = restParam(function(values) {
+      values = baseFlatten(values);
+      return this.thru(function(array) {
+        return arrayConcat(isArray(array) ? array : [toObject(array)], values);
+      });
+    });
+
+    /**
+     * Creates a clone of the chained sequence planting `value` as the wrapped value.
+     *
+     * @name plant
+     * @memberOf _
+     * @category Chain
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var array = [1, 2];
+     * var wrapped = _(array).map(function(value) {
+     *   return Math.pow(value, 2);
+     * });
+     *
+     * var other = [3, 4];
+     * var otherWrapped = wrapped.plant(other);
+     *
+     * otherWrapped.value();
+     * // => [9, 16]
+     *
+     * wrapped.value();
+     * // => [1, 4]
+     */
+    function wrapperPlant(value) {
+      var result,
+          parent = this;
+
+      while (parent instanceof baseLodash) {
+        var clone = wrapperClone(parent);
+        if (result) {
+          previous.__wrapped__ = clone;
+        } else {
+          result = clone;
+        }
+        var previous = clone;
+        parent = parent.__wrapped__;
+      }
+      previous.__wrapped__ = value;
+      return result;
+    }
+
+    /**
+     * Reverses the wrapped array so the first element becomes the last, the
+     * second element becomes the second to last, and so on.
+     *
+     * **Note:** This method mutates the wrapped array.
+     *
+     * @name reverse
+     * @memberOf _
+     * @category Chain
+     * @returns {Object} Returns the new reversed `lodash` wrapper instance.
+     * @example
+     *
+     * var array = [1, 2, 3];
+     *
+     * _(array).reverse().value()
+     * // => [3, 2, 1]
+     *
+     * console.log(array);
+     * // => [3, 2, 1]
+     */
+    function wrapperReverse() {
+      var value = this.__wrapped__;
+
+      var interceptor = function(value) {
+        return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();
+      };
+      if (value instanceof LazyWrapper) {
+        var wrapped = value;
+        if (this.__actions__.length) {
+          wrapped = new LazyWrapper(this);
+        }
+        wrapped = wrapped.reverse();
+        wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
+        return new LodashWrapper(wrapped, this.__chain__);
+      }
+      return this.thru(interceptor);
+    }
+
+    /**
+     * Produces the result of coercing the unwrapped value to a string.
+     *
+     * @name toString
+     * @memberOf _
+     * @category Chain
+     * @returns {string} Returns the coerced string value.
+     * @example
+     *
+     * _([1, 2, 3]).toString();
+     * // => '1,2,3'
+     */
+    function wrapperToString() {
+      return (this.value() + '');
+    }
+
+    /**
+     * Executes the chained sequence to extract the unwrapped value.
+     *
+     * @name value
+     * @memberOf _
+     * @alias run, toJSON, valueOf
+     * @category Chain
+     * @returns {*} Returns the resolved unwrapped value.
+     * @example
+     *
+     * _([1, 2, 3]).value();
+     * // => [1, 2, 3]
+     */
+    function wrapperValue() {
+      return baseWrapperValue(this.__wrapped__, this.__actions__);
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array of elements corresponding to the given keys, or indexes,
+     * of `collection`. Keys may be specified as individual arguments or as arrays
+     * of keys.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {...(number|number[]|string|string[])} [props] The property names
+     *  or indexes of elements to pick, specified individually or in arrays.
+     * @returns {Array} Returns the new array of picked elements.
+     * @example
+     *
+     * _.at(['a', 'b', 'c'], [0, 2]);
+     * // => ['a', 'c']
+     *
+     * _.at(['barney', 'fred', 'pebbles'], 0, 2);
+     * // => ['barney', 'pebbles']
+     */
+    var at = restParam(function(collection, props) {
+      return baseAt(collection, baseFlatten(props));
+    });
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of `collection` through `iteratee`. The corresponding value
+     * of each key is the number of times the key was returned by `iteratee`.
+     * The `iteratee` is bound to `thisArg` and invoked with three arguments:
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(n) {
+     *   return Math.floor(n);
+     * });
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(n) {
+     *   return this.floor(n);
+     * }, Math);
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy(['one', 'two', 'three'], 'length');
+     * // => { '3': 2, '5': 1 }
+     */
+    var countBy = createAggregator(function(result, value, key) {
+      hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);
+    });
+
+    /**
+     * Checks if `predicate` returns truthy for **all** elements of `collection`.
+     * The predicate is bound to `thisArg` and invoked with three arguments:
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias all
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {boolean} Returns `true` if all elements pass the predicate check,
+     *  else `false`.
+     * @example
+     *
+     * _.every([true, 1, null, 'yes'], Boolean);
+     * // => false
+     *
+     * var users = [
+     *   { 'user': 'barney', 'active': false },
+     *   { 'user': 'fred',   'active': false }
+     * ];
+     *
+     * // using the `_.matches` callback shorthand
+     * _.every(users, { 'user': 'barney', 'active': false });
+     * // => false
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.every(users, 'active', false);
+     * // => true
+     *
+     * // using the `_.property` callback shorthand
+     * _.every(users, 'active');
+     * // => false
+     */
+    function every(collection, predicate, thisArg) {
+      var func = isArray(collection) ? arrayEvery : baseEvery;
+      if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
+        predicate = undefined;
+      }
+      if (typeof predicate != 'function' || thisArg !== undefined) {
+        predicate = getCallback(predicate, thisArg, 3);
+      }
+      return func(collection, predicate);
+    }
+
+    /**
+     * Iterates over elements of `collection`, returning an array of all elements
+     * `predicate` returns truthy for. The predicate is bound to `thisArg` and
+     * invoked with three arguments: (value, index|key, collection).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias select
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Array} Returns the new filtered array.
+     * @example
+     *
+     * _.filter([4, 5, 6], function(n) {
+     *   return n % 2 == 0;
+     * });
+     * // => [4, 6]
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36, 'active': true },
+     *   { 'user': 'fred',   'age': 40, 'active': false }
+     * ];
+     *
+     * // using the `_.matches` callback shorthand
+     * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');
+     * // => ['barney']
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.pluck(_.filter(users, 'active', false), 'user');
+     * // => ['fred']
+     *
+     * // using the `_.property` callback shorthand
+     * _.pluck(_.filter(users, 'active'), 'user');
+     * // => ['barney']
+     */
+    function filter(collection, predicate, thisArg) {
+      var func = isArray(collection) ? arrayFilter : baseFilter;
+      predicate = getCallback(predicate, thisArg, 3);
+      return func(collection, predicate);
+    }
+
+    /**
+     * Iterates over elements of `collection`, returning the first element
+     * `predicate` returns truthy for. The predicate is bound to `thisArg` and
+     * invoked with three arguments: (value, index|key, collection).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias detect
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to search.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {*} Returns the matched element, else `undefined`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'age': 36, 'active': true },
+     *   { 'user': 'fred',    'age': 40, 'active': false },
+     *   { 'user': 'pebbles', 'age': 1,  'active': true }
+     * ];
+     *
+     * _.result(_.find(users, function(chr) {
+     *   return chr.age < 40;
+     * }), 'user');
+     * // => 'barney'
+     *
+     * // using the `_.matches` callback shorthand
+     * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
+     * // => 'pebbles'
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.result(_.find(users, 'active', false), 'user');
+     * // => 'fred'
+     *
+     * // using the `_.property` callback shorthand
+     * _.result(_.find(users, 'active'), 'user');
+     * // => 'barney'
+     */
+    var find = createFind(baseEach);
+
+    /**
+     * This method is like `_.find` except that it iterates over elements of
+     * `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to search.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {*} Returns the matched element, else `undefined`.
+     * @example
+     *
+     * _.findLast([1, 2, 3, 4], function(n) {
+     *   return n % 2 == 1;
+     * });
+     * // => 3
+     */
+    var findLast = createFind(baseEachRight, true);
+
+    /**
+     * Performs a deep comparison between each element in `collection` and the
+     * source object, returning the first element that has equivalent property
+     * values.
+     *
+     * **Note:** This method supports comparing arrays, booleans, `Date` objects,
+     * numbers, `Object` objects, regexes, and strings. Objects are compared by
+     * their own, not inherited, enumerable properties. For comparing a single
+     * own or inherited property value see `_.matchesProperty`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to search.
+     * @param {Object} source The object of property values to match.
+     * @returns {*} Returns the matched element, else `undefined`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36, 'active': true },
+     *   { 'user': 'fred',   'age': 40, 'active': false }
+     * ];
+     *
+     * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user');
+     * // => 'barney'
+     *
+     * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user');
+     * // => 'fred'
+     */
+    function findWhere(collection, source) {
+      return find(collection, baseMatches(source));
+    }
+
+    /**
+     * Iterates over elements of `collection` invoking `iteratee` for each element.
+     * The `iteratee` is bound to `thisArg` and invoked with three arguments:
+     * (value, index|key, collection). Iteratee functions may exit iteration early
+     * by explicitly returning `false`.
+     *
+     * **Note:** As with other "Collections" methods, objects with a "length" property
+     * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
+     * may be used for object iteration.
+     *
+     * @static
+     * @memberOf _
+     * @alias each
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Array|Object|string} Returns `collection`.
+     * @example
+     *
+     * _([1, 2]).forEach(function(n) {
+     *   console.log(n);
+     * }).value();
+     * // => logs each value from left to right and returns the array
+     *
+     * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
+     *   console.log(n, key);
+     * });
+     * // => logs each value-key pair and returns the object (iteration order is not guaranteed)
+     */
+    var forEach = createForEach(arrayEach, baseEach);
+
+    /**
+     * This method is like `_.forEach` except that it iterates over elements of
+     * `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias eachRight
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Array|Object|string} Returns `collection`.
+     * @example
+     *
+     * _([1, 2]).forEachRight(function(n) {
+     *   console.log(n);
+     * }).value();
+     * // => logs each value from right to left and returns the array
+     */
+    var forEachRight = createForEach(arrayEachRight, baseEachRight);
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of `collection` through `iteratee`. The corresponding value
+     * of each key is an array of the elements responsible for generating the key.
+     * The `iteratee` is bound to `thisArg` and invoked with three arguments:
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(n) {
+     *   return Math.floor(n);
+     * });
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(n) {
+     *   return this.floor(n);
+     * }, Math);
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * // using the `_.property` callback shorthand
+     * _.groupBy(['one', 'two', 'three'], 'length');
+     * // => { '3': ['one', 'two'], '5': ['three'] }
+     */
+    var groupBy = createAggregator(function(result, value, key) {
+      if (hasOwnProperty.call(result, key)) {
+        result[key].push(value);
+      } else {
+        result[key] = [value];
+      }
+    });
+
+    /**
+     * Checks if `value` is in `collection` using
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+     * for equality comparisons. If `fromIndex` is negative, it is used as the offset
+     * from the end of `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @alias contains, include
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to search.
+     * @param {*} target The value to search for.
+     * @param {number} [fromIndex=0] The index to search from.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
+     * @returns {boolean} Returns `true` if a matching element is found, else `false`.
+     * @example
+     *
+     * _.includes([1, 2, 3], 1);
+     * // => true
+     *
+     * _.includes([1, 2, 3], 1, 2);
+     * // => false
+     *
+     * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
+     * // => true
+     *
+     * _.includes('pebbles', 'eb');
+     * // => true
+     */
+    function includes(collection, target, fromIndex, guard) {
+      var length = collection ? getLength(collection) : 0;
+      if (!isLength(length)) {
+        collection = values(collection);
+        length = collection.length;
+      }
+      if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
+        fromIndex = 0;
+      } else {
+        fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
+      }
+      return (typeof collection == 'string' || !isArray(collection) && isString(collection))
+        ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
+        : (!!length && getIndexOf(collection, target, fromIndex) > -1);
+    }
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of `collection` through `iteratee`. The corresponding value
+     * of each key is the last element responsible for generating the key. The
+     * iteratee function is bound to `thisArg` and invoked with three arguments:
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * var keyData = [
+     *   { 'dir': 'left', 'code': 97 },
+     *   { 'dir': 'right', 'code': 100 }
+     * ];
+     *
+     * _.indexBy(keyData, 'dir');
+     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
+     *
+     * _.indexBy(keyData, function(object) {
+     *   return String.fromCharCode(object.code);
+     * });
+     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+     *
+     * _.indexBy(keyData, function(object) {
+     *   return this.fromCharCode(object.code);
+     * }, String);
+     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+     */
+    var indexBy = createAggregator(function(result, value, key) {
+      result[key] = value;
+    });
+
+    /**
+     * Invokes the method at `path` of each element in `collection`, returning
+     * an array of the results of each invoked method. Any additional arguments
+     * are provided to each invoked method. If `methodName` is a function it is
+     * invoked for, and `this` bound to, each element in `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Array|Function|string} path The path of the method to invoke or
+     *  the function invoked per iteration.
+     * @param {...*} [args] The arguments to invoke the method with.
+     * @returns {Array} Returns the array of results.
+     * @example
+     *
+     * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
+     * // => [[1, 5, 7], [1, 2, 3]]
+     *
+     * _.invoke([123, 456], String.prototype.split, '');
+     * // => [['1', '2', '3'], ['4', '5', '6']]
+     */
+    var invoke = restParam(function(collection, path, args) {
+      var index = -1,
+          isFunc = typeof path == 'function',
+          isProp = isKey(path),
+          result = isArrayLike(collection) ? Array(collection.length) : [];
+
+      baseEach(collection, function(value) {
+        var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);
+        result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
+      });
+      return result;
+    });
+
+    /**
+     * Creates an array of values by running each element in `collection` through
+     * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
+     * arguments: (value, index|key, collection).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * Many lodash methods are guarded to work as iteratees for methods like
+     * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
+     *
+     * The guarded methods are:
+     * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
+     * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
+     * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
+     * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
+     * `sum`, `uniq`, and `words`
+     *
+     * @static
+     * @memberOf _
+     * @alias collect
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Array} Returns the new mapped array.
+     * @example
+     *
+     * function timesThree(n) {
+     *   return n * 3;
+     * }
+     *
+     * _.map([1, 2], timesThree);
+     * // => [3, 6]
+     *
+     * _.map({ 'a': 1, 'b': 2 }, timesThree);
+     * // => [3, 6] (iteration order is not guaranteed)
+     *
+     * var users = [
+     *   { 'user': 'barney' },
+     *   { 'user': 'fred' }
+     * ];
+     *
+     * // using the `_.property` callback shorthand
+     * _.map(users, 'user');
+     * // => ['barney', 'fred']
+     */
+    function map(collection, iteratee, thisArg) {
+      var func = isArray(collection) ? arrayMap : baseMap;
+      iteratee = getCallback(iteratee, thisArg, 3);
+      return func(collection, iteratee);
+    }
+
+    /**
+     * Creates an array of elements split into two groups, the first of which
+     * contains elements `predicate` returns truthy for, while the second of which
+     * contains elements `predicate` returns falsey for. The predicate is bound
+     * to `thisArg` and invoked with three arguments: (value, index|key, collection).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Array} Returns the array of grouped elements.
+     * @example
+     *
+     * _.partition([1, 2, 3], function(n) {
+     *   return n % 2;
+     * });
+     * // => [[1, 3], [2]]
+     *
+     * _.partition([1.2, 2.3, 3.4], function(n) {
+     *   return this.floor(n) % 2;
+     * }, Math);
+     * // => [[1.2, 3.4], [2.3]]
+     *
+     * var users = [
+     *   { 'user': 'barney',  'age': 36, 'active': false },
+     *   { 'user': 'fred',    'age': 40, 'active': true },
+     *   { 'user': 'pebbles', 'age': 1,  'active': false }
+     * ];
+     *
+     * var mapper = function(array) {
+     *   return _.pluck(array, 'user');
+     * };
+     *
+     * // using the `_.matches` callback shorthand
+     * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper);
+     * // => [['pebbles'], ['barney', 'fred']]
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.map(_.partition(users, 'active', false), mapper);
+     * // => [['barney', 'pebbles'], ['fred']]
+     *
+     * // using the `_.property` callback shorthand
+     * _.map(_.partition(users, 'active'), mapper);
+     * // => [['fred'], ['barney', 'pebbles']]
+     */
+    var partition = createAggregator(function(result, value, key) {
+      result[key ? 0 : 1].push(value);
+    }, function() { return [[], []]; });
+
+    /**
+     * Gets the property value of `path` from all elements in `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Array|string} path The path of the property to pluck.
+     * @returns {Array} Returns the property values.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36 },
+     *   { 'user': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.pluck(users, 'user');
+     * // => ['barney', 'fred']
+     *
+     * var userIndex = _.indexBy(users, 'user');
+     * _.pluck(userIndex, 'age');
+     * // => [36, 40] (iteration order is not guaranteed)
+     */
+    function pluck(collection, path) {
+      return map(collection, property(path));
+    }
+
+    /**
+     * Reduces `collection` to a value which is the accumulated result of running
+     * each element in `collection` through `iteratee`, where each successive
+     * invocation is supplied the return value of the previous. If `accumulator`
+     * is not provided the first element of `collection` is used as the initial
+     * value. The `iteratee` is bound to `thisArg` and invoked with four arguments:
+     * (accumulator, value, index|key, collection).
+     *
+     * Many lodash methods are guarded to work as iteratees for methods like
+     * `_.reduce`, `_.reduceRight`, and `_.transform`.
+     *
+     * The guarded methods are:
+     * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`,
+     * and `sortByOrder`
+     *
+     * @static
+     * @memberOf _
+     * @alias foldl, inject
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [accumulator] The initial value.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * _.reduce([1, 2], function(total, n) {
+     *   return total + n;
+     * });
+     * // => 3
+     *
+     * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {
+     *   result[key] = n * 3;
+     *   return result;
+     * }, {});
+     * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed)
+     */
+    var reduce = createReduce(arrayReduce, baseEach);
+
+    /**
+     * This method is like `_.reduce` except that it iterates over elements of
+     * `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias foldr
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [accumulator] The initial value.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var array = [[0, 1], [2, 3], [4, 5]];
+     *
+     * _.reduceRight(array, function(flattened, other) {
+     *   return flattened.concat(other);
+     * }, []);
+     * // => [4, 5, 2, 3, 0, 1]
+     */
+    var reduceRight = createReduce(arrayReduceRight, baseEachRight);
+
+    /**
+     * The opposite of `_.filter`; this method returns the elements of `collection`
+     * that `predicate` does **not** return truthy for.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Array} Returns the new filtered array.
+     * @example
+     *
+     * _.reject([1, 2, 3, 4], function(n) {
+     *   return n % 2 == 0;
+     * });
+     * // => [1, 3]
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36, 'active': false },
+     *   { 'user': 'fred',   'age': 40, 'active': true }
+     * ];
+     *
+     * // using the `_.matches` callback shorthand
+     * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');
+     * // => ['barney']
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.pluck(_.reject(users, 'active', false), 'user');
+     * // => ['fred']
+     *
+     * // using the `_.property` callback shorthand
+     * _.pluck(_.reject(users, 'active'), 'user');
+     * // => ['barney']
+     */
+    function reject(collection, predicate, thisArg) {
+      var func = isArray(collection) ? arrayFilter : baseFilter;
+      predicate = getCallback(predicate, thisArg, 3);
+      return func(collection, function(value, index, collection) {
+        return !predicate(value, index, collection);
+      });
+    }
+
+    /**
+     * Gets a random element or `n` random elements from a collection.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to sample.
+     * @param {number} [n] The number of elements to sample.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {*} Returns the random sample(s).
+     * @example
+     *
+     * _.sample([1, 2, 3, 4]);
+     * // => 2
+     *
+     * _.sample([1, 2, 3, 4], 2);
+     * // => [3, 1]
+     */
+    function sample(collection, n, guard) {
+      if (guard ? isIterateeCall(collection, n, guard) : n == null) {
+        collection = toIterable(collection);
+        var length = collection.length;
+        return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
+      }
+      var index = -1,
+          result = toArray(collection),
+          length = result.length,
+          lastIndex = length - 1;
+
+      n = nativeMin(n < 0 ? 0 : (+n || 0), length);
+      while (++index < n) {
+        var rand = baseRandom(index, lastIndex),
+            value = result[rand];
+
+        result[rand] = result[index];
+        result[index] = value;
+      }
+      result.length = n;
+      return result;
+    }
+
+    /**
+     * Creates an array of shuffled values, using a version of the
+     * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to shuffle.
+     * @returns {Array} Returns the new shuffled array.
+     * @example
+     *
+     * _.shuffle([1, 2, 3, 4]);
+     * // => [4, 1, 3, 2]
+     */
+    function shuffle(collection) {
+      return sample(collection, POSITIVE_INFINITY);
+    }
+
+    /**
+     * Gets the size of `collection` by returning its length for array-like
+     * values or the number of own enumerable properties for objects.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to inspect.
+     * @returns {number} Returns the size of `collection`.
+     * @example
+     *
+     * _.size([1, 2, 3]);
+     * // => 3
+     *
+     * _.size({ 'a': 1, 'b': 2 });
+     * // => 2
+     *
+     * _.size('pebbles');
+     * // => 7
+     */
+    function size(collection) {
+      var length = collection ? getLength(collection) : 0;
+      return isLength(length) ? length : keys(collection).length;
+    }
+
+    /**
+     * Checks if `predicate` returns truthy for **any** element of `collection`.
+     * The function returns as soon as it finds a passing value and does not iterate
+     * over the entire collection. The predicate is bound to `thisArg` and invoked
+     * with three arguments: (value, index|key, collection).
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias any
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {boolean} Returns `true` if any element passes the predicate check,
+     *  else `false`.
+     * @example
+     *
+     * _.some([null, 0, 'yes', false], Boolean);
+     * // => true
+     *
+     * var users = [
+     *   { 'user': 'barney', 'active': true },
+     *   { 'user': 'fred',   'active': false }
+     * ];
+     *
+     * // using the `_.matches` callback shorthand
+     * _.some(users, { 'user': 'barney', 'active': false });
+     * // => false
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.some(users, 'active', false);
+     * // => true
+     *
+     * // using the `_.property` callback shorthand
+     * _.some(users, 'active');
+     * // => true
+     */
+    function some(collection, predicate, thisArg) {
+      var func = isArray(collection) ? arraySome : baseSome;
+      if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
+        predicate = undefined;
+      }
+      if (typeof predicate != 'function' || thisArg !== undefined) {
+        predicate = getCallback(predicate, thisArg, 3);
+      }
+      return func(collection, predicate);
+    }
+
+    /**
+     * Creates an array of elements, sorted in ascending order by the results of
+     * running each element in a collection through `iteratee`. This method performs
+     * a stable sort, that is, it preserves the original sort order of equal elements.
+     * The `iteratee` is bound to `thisArg` and invoked with three arguments:
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Array} Returns the new sorted array.
+     * @example
+     *
+     * _.sortBy([1, 2, 3], function(n) {
+     *   return Math.sin(n);
+     * });
+     * // => [3, 1, 2]
+     *
+     * _.sortBy([1, 2, 3], function(n) {
+     *   return this.sin(n);
+     * }, Math);
+     * // => [3, 1, 2]
+     *
+     * var users = [
+     *   { 'user': 'fred' },
+     *   { 'user': 'pebbles' },
+     *   { 'user': 'barney' }
+     * ];
+     *
+     * // using the `_.property` callback shorthand
+     * _.pluck(_.sortBy(users, 'user'), 'user');
+     * // => ['barney', 'fred', 'pebbles']
+     */
+    function sortBy(collection, iteratee, thisArg) {
+      if (collection == null) {
+        return [];
+      }
+      if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
+        iteratee = undefined;
+      }
+      var index = -1;
+      iteratee = getCallback(iteratee, thisArg, 3);
+
+      var result = baseMap(collection, function(value, key, collection) {
+        return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };
+      });
+      return baseSortBy(result, compareAscending);
+    }
+
+    /**
+     * This method is like `_.sortBy` except that it can sort by multiple iteratees
+     * or property names.
+     *
+     * If a property name is provided for an iteratee the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If an object is provided for an iteratee the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees
+     *  The iteratees to sort by, specified as individual values or arrays of values.
+     * @returns {Array} Returns the new sorted array.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'fred',   'age': 48 },
+     *   { 'user': 'barney', 'age': 36 },
+     *   { 'user': 'fred',   'age': 42 },
+     *   { 'user': 'barney', 'age': 34 }
+     * ];
+     *
+     * _.map(_.sortByAll(users, ['user', 'age']), _.values);
+     * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
+     *
+     * _.map(_.sortByAll(users, 'user', function(chr) {
+     *   return Math.floor(chr.age / 10);
+     * }), _.values);
+     * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+     */
+    var sortByAll = restParam(function(collection, iteratees) {
+      if (collection == null) {
+        return [];
+      }
+      var guard = iteratees[2];
+      if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) {
+        iteratees.length = 1;
+      }
+      return baseSortByOrder(collection, baseFlatten(iteratees), []);
+    });
+
+    /**
+     * This method is like `_.sortByAll` except that it allows specifying the
+     * sort orders of the iteratees to sort by. If `orders` is unspecified, all
+     * values are sorted in ascending order. Otherwise, a value is sorted in
+     * ascending order if its corresponding order is "asc", and descending if "desc".
+     *
+     * If a property name is provided for an iteratee the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If an object is provided for an iteratee the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
+     * @param {boolean[]} [orders] The sort orders of `iteratees`.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
+     * @returns {Array} Returns the new sorted array.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'fred',   'age': 48 },
+     *   { 'user': 'barney', 'age': 34 },
+     *   { 'user': 'fred',   'age': 42 },
+     *   { 'user': 'barney', 'age': 36 }
+     * ];
+     *
+     * // sort by `user` in ascending order and by `age` in descending order
+     * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values);
+     * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+     */
+    function sortByOrder(collection, iteratees, orders, guard) {
+      if (collection == null) {
+        return [];
+      }
+      if (guard && isIterateeCall(iteratees, orders, guard)) {
+        orders = undefined;
+      }
+      if (!isArray(iteratees)) {
+        iteratees = iteratees == null ? [] : [iteratees];
+      }
+      if (!isArray(orders)) {
+        orders = orders == null ? [] : [orders];
+      }
+      return baseSortByOrder(collection, iteratees, orders);
+    }
+
+    /**
+     * Performs a deep comparison between each element in `collection` and the
+     * source object, returning an array of all elements that have equivalent
+     * property values.
+     *
+     * **Note:** This method supports comparing arrays, booleans, `Date` objects,
+     * numbers, `Object` objects, regexes, and strings. Objects are compared by
+     * their own, not inherited, enumerable properties. For comparing a single
+     * own or inherited property value see `_.matchesProperty`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to search.
+     * @param {Object} source The object of property values to match.
+     * @returns {Array} Returns the new filtered array.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] },
+     *   { 'user': 'fred',   'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] }
+     * ];
+     *
+     * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user');
+     * // => ['barney']
+     *
+     * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user');
+     * // => ['fred']
+     */
+    function where(collection, source) {
+      return filter(collection, baseMatches(source));
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Gets the number of milliseconds that have elapsed since the Unix epoch
+     * (1 January 1970 00:00:00 UTC).
+     *
+     * @static
+     * @memberOf _
+     * @category Date
+     * @example
+     *
+     * _.defer(function(stamp) {
+     *   console.log(_.now() - stamp);
+     * }, _.now());
+     * // => logs the number of milliseconds it took for the deferred function to be invoked
+     */
+    var now = nativeNow || function() {
+      return new Date().getTime();
+    };
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * The opposite of `_.before`; this method creates a function that invokes
+     * `func` once it is called `n` or more times.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {number} n The number of calls before `func` is invoked.
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var saves = ['profile', 'settings'];
+     *
+     * var done = _.after(saves.length, function() {
+     *   console.log('done saving!');
+     * });
+     *
+     * _.forEach(saves, function(type) {
+     *   asyncSave({ 'type': type, 'complete': done });
+     * });
+     * // => logs 'done saving!' after the two async saves have completed
+     */
+    function after(n, func) {
+      if (typeof func != 'function') {
+        if (typeof n == 'function') {
+          var temp = n;
+          n = func;
+          func = temp;
+        } else {
+          throw new TypeError(FUNC_ERROR_TEXT);
+        }
+      }
+      n = nativeIsFinite(n = +n) ? n : 0;
+      return function() {
+        if (--n < 1) {
+          return func.apply(this, arguments);
+        }
+      };
+    }
+
+    /**
+     * Creates a function that accepts up to `n` arguments ignoring any
+     * additional arguments.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to cap arguments for.
+     * @param {number} [n=func.length] The arity cap.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * _.map(['6', '8', '10'], _.ary(parseInt, 1));
+     * // => [6, 8, 10]
+     */
+    function ary(func, n, guard) {
+      if (guard && isIterateeCall(func, n, guard)) {
+        n = undefined;
+      }
+      n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);
+      return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
+    }
+
+    /**
+     * Creates a function that invokes `func`, with the `this` binding and arguments
+     * of the created function, while it is called less than `n` times. Subsequent
+     * calls to the created function return the result of the last `func` invocation.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {number} n The number of calls at which `func` is no longer invoked.
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * jQuery('#add').on('click', _.before(5, addContactToList));
+     * // => allows adding up to 4 contacts to the list
+     */
+    function before(n, func) {
+      var result;
+      if (typeof func != 'function') {
+        if (typeof n == 'function') {
+          var temp = n;
+          n = func;
+          func = temp;
+        } else {
+          throw new TypeError(FUNC_ERROR_TEXT);
+        }
+      }
+      return function() {
+        if (--n > 0) {
+          result = func.apply(this, arguments);
+        }
+        if (n <= 1) {
+          func = undefined;
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function that invokes `func` with the `this` binding of `thisArg`
+     * and prepends any additional `_.bind` arguments to those provided to the
+     * bound function.
+     *
+     * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
+     * may be used as a placeholder for partially applied arguments.
+     *
+     * **Note:** Unlike native `Function#bind` this method does not set the "length"
+     * property of bound functions.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to bind.
+     * @param {*} thisArg The `this` binding of `func`.
+     * @param {...*} [partials] The arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var greet = function(greeting, punctuation) {
+     *   return greeting + ' ' + this.user + punctuation;
+     * };
+     *
+     * var object = { 'user': 'fred' };
+     *
+     * var bound = _.bind(greet, object, 'hi');
+     * bound('!');
+     * // => 'hi fred!'
+     *
+     * // using placeholders
+     * var bound = _.bind(greet, object, _, '!');
+     * bound('hi');
+     * // => 'hi fred!'
+     */
+    var bind = restParam(function(func, thisArg, partials) {
+      var bitmask = BIND_FLAG;
+      if (partials.length) {
+        var holders = replaceHolders(partials, bind.placeholder);
+        bitmask |= PARTIAL_FLAG;
+      }
+      return createWrapper(func, bitmask, thisArg, partials, holders);
+    });
+
+    /**
+     * Binds methods of an object to the object itself, overwriting the existing
+     * method. Method names may be specified as individual arguments or as arrays
+     * of method names. If no method names are provided all enumerable function
+     * properties, own and inherited, of `object` are bound.
+     *
+     * **Note:** This method does not set the "length" property of bound functions.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Object} object The object to bind and assign the bound methods to.
+     * @param {...(string|string[])} [methodNames] The object method names to bind,
+     *  specified as individual method names or arrays of method names.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var view = {
+     *   'label': 'docs',
+     *   'onClick': function() {
+     *     console.log('clicked ' + this.label);
+     *   }
+     * };
+     *
+     * _.bindAll(view);
+     * jQuery('#docs').on('click', view.onClick);
+     * // => logs 'clicked docs' when the element is clicked
+     */
+    var bindAll = restParam(function(object, methodNames) {
+      methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object);
+
+      var index = -1,
+          length = methodNames.length;
+
+      while (++index < length) {
+        var key = methodNames[index];
+        object[key] = createWrapper(object[key], BIND_FLAG, object);
+      }
+      return object;
+    });
+
+    /**
+     * Creates a function that invokes the method at `object[key]` and prepends
+     * any additional `_.bindKey` arguments to those provided to the bound function.
+     *
+     * This method differs from `_.bind` by allowing bound functions to reference
+     * methods that may be redefined or don't yet exist.
+     * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
+     * for more details.
+     *
+     * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
+     * builds, may be used as a placeholder for partially applied arguments.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Object} object The object the method belongs to.
+     * @param {string} key The key of the method.
+     * @param {...*} [partials] The arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var object = {
+     *   'user': 'fred',
+     *   'greet': function(greeting, punctuation) {
+     *     return greeting + ' ' + this.user + punctuation;
+     *   }
+     * };
+     *
+     * var bound = _.bindKey(object, 'greet', 'hi');
+     * bound('!');
+     * // => 'hi fred!'
+     *
+     * object.greet = function(greeting, punctuation) {
+     *   return greeting + 'ya ' + this.user + punctuation;
+     * };
+     *
+     * bound('!');
+     * // => 'hiya fred!'
+     *
+     * // using placeholders
+     * var bound = _.bindKey(object, 'greet', _, '!');
+     * bound('hi');
+     * // => 'hiya fred!'
+     */
+    var bindKey = restParam(function(object, key, partials) {
+      var bitmask = BIND_FLAG | BIND_KEY_FLAG;
+      if (partials.length) {
+        var holders = replaceHolders(partials, bindKey.placeholder);
+        bitmask |= PARTIAL_FLAG;
+      }
+      return createWrapper(key, bitmask, object, partials, holders);
+    });
+
+    /**
+     * Creates a function that accepts one or more arguments of `func` that when
+     * called either invokes `func` returning its result, if all `func` arguments
+     * have been provided, or returns a function that accepts one or more of the
+     * remaining `func` arguments, and so on. The arity of `func` may be specified
+     * if `func.length` is not sufficient.
+     *
+     * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
+     * may be used as a placeholder for provided arguments.
+     *
+     * **Note:** This method does not set the "length" property of curried functions.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to curry.
+     * @param {number} [arity=func.length] The arity of `func`.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Function} Returns the new curried function.
+     * @example
+     *
+     * var abc = function(a, b, c) {
+     *   return [a, b, c];
+     * };
+     *
+     * var curried = _.curry(abc);
+     *
+     * curried(1)(2)(3);
+     * // => [1, 2, 3]
+     *
+     * curried(1, 2)(3);
+     * // => [1, 2, 3]
+     *
+     * curried(1, 2, 3);
+     * // => [1, 2, 3]
+     *
+     * // using placeholders
+     * curried(1)(_, 3)(2);
+     * // => [1, 2, 3]
+     */
+    var curry = createCurry(CURRY_FLAG);
+
+    /**
+     * This method is like `_.curry` except that arguments are applied to `func`
+     * in the manner of `_.partialRight` instead of `_.partial`.
+     *
+     * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
+     * builds, may be used as a placeholder for provided arguments.
+     *
+     * **Note:** This method does not set the "length" property of curried functions.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to curry.
+     * @param {number} [arity=func.length] The arity of `func`.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Function} Returns the new curried function.
+     * @example
+     *
+     * var abc = function(a, b, c) {
+     *   return [a, b, c];
+     * };
+     *
+     * var curried = _.curryRight(abc);
+     *
+     * curried(3)(2)(1);
+     * // => [1, 2, 3]
+     *
+     * curried(2, 3)(1);
+     * // => [1, 2, 3]
+     *
+     * curried(1, 2, 3);
+     * // => [1, 2, 3]
+     *
+     * // using placeholders
+     * curried(3)(1, _)(2);
+     * // => [1, 2, 3]
+     */
+    var curryRight = createCurry(CURRY_RIGHT_FLAG);
+
+    /**
+     * Creates a debounced function that delays invoking `func` until after `wait`
+     * milliseconds have elapsed since the last time the debounced function was
+     * invoked. The debounced function comes with a `cancel` method to cancel
+     * delayed invocations. Provide an options object to indicate that `func`
+     * should be invoked on the leading and/or trailing edge of the `wait` timeout.
+     * Subsequent calls to the debounced function return the result of the last
+     * `func` invocation.
+     *
+     * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
+     * on the trailing edge of the timeout only if the the debounced function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
+     * for details over the differences between `_.debounce` and `_.throttle`.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to debounce.
+     * @param {number} [wait=0] The number of milliseconds to delay.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.leading=false] Specify invoking on the leading
+     *  edge of the timeout.
+     * @param {number} [options.maxWait] The maximum time `func` is allowed to be
+     *  delayed before it is invoked.
+     * @param {boolean} [options.trailing=true] Specify invoking on the trailing
+     *  edge of the timeout.
+     * @returns {Function} Returns the new debounced function.
+     * @example
+     *
+     * // avoid costly calculations while the window size is in flux
+     * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
+     *
+     * // invoke `sendMail` when the click event is fired, debouncing subsequent calls
+     * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
+     *   'leading': true,
+     *   'trailing': false
+     * }));
+     *
+     * // ensure `batchLog` is invoked once after 1 second of debounced calls
+     * var source = new EventSource('/stream');
+     * jQuery(source).on('message', _.debounce(batchLog, 250, {
+     *   'maxWait': 1000
+     * }));
+     *
+     * // cancel a debounced call
+     * var todoChanges = _.debounce(batchLog, 1000);
+     * Object.observe(models.todo, todoChanges);
+     *
+     * Object.observe(models, function(changes) {
+     *   if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {
+     *     todoChanges.cancel();
+     *   }
+     * }, ['delete']);
+     *
+     * // ...at some point `models.todo` is changed
+     * models.todo.completed = true;
+     *
+     * // ...before 1 second has passed `models.todo` is deleted
+     * // which cancels the debounced `todoChanges` call
+     * delete models.todo;
+     */
+    function debounce(func, wait, options) {
+      var args,
+          maxTimeoutId,
+          result,
+          stamp,
+          thisArg,
+          timeoutId,
+          trailingCall,
+          lastCalled = 0,
+          maxWait = false,
+          trailing = true;
+
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      wait = wait < 0 ? 0 : (+wait || 0);
+      if (options === true) {
+        var leading = true;
+        trailing = false;
+      } else if (isObject(options)) {
+        leading = !!options.leading;
+        maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
+        trailing = 'trailing' in options ? !!options.trailing : trailing;
+      }
+
+      function cancel() {
+        if (timeoutId) {
+          clearTimeout(timeoutId);
+        }
+        if (maxTimeoutId) {
+          clearTimeout(maxTimeoutId);
+        }
+        lastCalled = 0;
+        maxTimeoutId = timeoutId = trailingCall = undefined;
+      }
+
+      function complete(isCalled, id) {
+        if (id) {
+          clearTimeout(id);
+        }
+        maxTimeoutId = timeoutId = trailingCall = undefined;
+        if (isCalled) {
+          lastCalled = now();
+          result = func.apply(thisArg, args);
+          if (!timeoutId && !maxTimeoutId) {
+            args = thisArg = undefined;
+          }
+        }
+      }
+
+      function delayed() {
+        var remaining = wait - (now() - stamp);
+        if (remaining <= 0 || remaining > wait) {
+          complete(trailingCall, maxTimeoutId);
+        } else {
+          timeoutId = setTimeout(delayed, remaining);
+        }
+      }
+
+      function maxDelayed() {
+        complete(trailing, timeoutId);
+      }
+
+      function debounced() {
+        args = arguments;
+        stamp = now();
+        thisArg = this;
+        trailingCall = trailing && (timeoutId || !leading);
+
+        if (maxWait === false) {
+          var leadingCall = leading && !timeoutId;
+        } else {
+          if (!maxTimeoutId && !leading) {
+            lastCalled = stamp;
+          }
+          var remaining = maxWait - (stamp - lastCalled),
+              isCalled = remaining <= 0 || remaining > maxWait;
+
+          if (isCalled) {
+            if (maxTimeoutId) {
+              maxTimeoutId = clearTimeout(maxTimeoutId);
+            }
+            lastCalled = stamp;
+            result = func.apply(thisArg, args);
+          }
+          else if (!maxTimeoutId) {
+            maxTimeoutId = setTimeout(maxDelayed, remaining);
+          }
+        }
+        if (isCalled && timeoutId) {
+          timeoutId = clearTimeout(timeoutId);
+        }
+        else if (!timeoutId && wait !== maxWait) {
+          timeoutId = setTimeout(delayed, wait);
+        }
+        if (leadingCall) {
+          isCalled = true;
+          result = func.apply(thisArg, args);
+        }
+        if (isCalled && !timeoutId && !maxTimeoutId) {
+          args = thisArg = undefined;
+        }
+        return result;
+      }
+      debounced.cancel = cancel;
+      return debounced;
+    }
+
+    /**
+     * Defers invoking the `func` until the current call stack has cleared. Any
+     * additional arguments are provided to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to defer.
+     * @param {...*} [args] The arguments to invoke the function with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.defer(function(text) {
+     *   console.log(text);
+     * }, 'deferred');
+     * // logs 'deferred' after one or more milliseconds
+     */
+    var defer = restParam(function(func, args) {
+      return baseDelay(func, 1, args);
+    });
+
+    /**
+     * Invokes `func` after `wait` milliseconds. Any additional arguments are
+     * provided to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to delay.
+     * @param {number} wait The number of milliseconds to delay invocation.
+     * @param {...*} [args] The arguments to invoke the function with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.delay(function(text) {
+     *   console.log(text);
+     * }, 1000, 'later');
+     * // => logs 'later' after one second
+     */
+    var delay = restParam(function(func, wait, args) {
+      return baseDelay(func, wait, args);
+    });
+
+    /**
+     * Creates a function that returns the result of invoking the provided
+     * functions with the `this` binding of the created function, where each
+     * successive invocation is supplied the return value of the previous.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {...Function} [funcs] Functions to invoke.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * function square(n) {
+     *   return n * n;
+     * }
+     *
+     * var addSquare = _.flow(_.add, square);
+     * addSquare(1, 2);
+     * // => 9
+     */
+    var flow = createFlow();
+
+    /**
+     * This method is like `_.flow` except that it creates a function that
+     * invokes the provided functions from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias backflow, compose
+     * @category Function
+     * @param {...Function} [funcs] Functions to invoke.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * function square(n) {
+     *   return n * n;
+     * }
+     *
+     * var addSquare = _.flowRight(square, _.add);
+     * addSquare(1, 2);
+     * // => 9
+     */
+    var flowRight = createFlow(true);
+
+    /**
+     * Creates a function that memoizes the result of `func`. If `resolver` is
+     * provided it determines the cache key for storing the result based on the
+     * arguments provided to the memoized function. By default, the first argument
+     * provided to the memoized function is coerced to a string and used as the
+     * cache key. The `func` is invoked with the `this` binding of the memoized
+     * function.
+     *
+     * **Note:** The cache is exposed as the `cache` property on the memoized
+     * function. Its creation may be customized by replacing the `_.memoize.Cache`
+     * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
+     * method interface of `get`, `has`, and `set`.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to have its output memoized.
+     * @param {Function} [resolver] The function to resolve the cache key.
+     * @returns {Function} Returns the new memoizing function.
+     * @example
+     *
+     * var upperCase = _.memoize(function(string) {
+     *   return string.toUpperCase();
+     * });
+     *
+     * upperCase('fred');
+     * // => 'FRED'
+     *
+     * // modifying the result cache
+     * upperCase.cache.set('fred', 'BARNEY');
+     * upperCase('fred');
+     * // => 'BARNEY'
+     *
+     * // replacing `_.memoize.Cache`
+     * var object = { 'user': 'fred' };
+     * var other = { 'user': 'barney' };
+     * var identity = _.memoize(_.identity);
+     *
+     * identity(object);
+     * // => { 'user': 'fred' }
+     * identity(other);
+     * // => { 'user': 'fred' }
+     *
+     * _.memoize.Cache = WeakMap;
+     * var identity = _.memoize(_.identity);
+     *
+     * identity(object);
+     * // => { 'user': 'fred' }
+     * identity(other);
+     * // => { 'user': 'barney' }
+     */
+    function memoize(func, resolver) {
+      if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      var memoized = function() {
+        var args = arguments,
+            key = resolver ? resolver.apply(this, args) : args[0],
+            cache = memoized.cache;
+
+        if (cache.has(key)) {
+          return cache.get(key);
+        }
+        var result = func.apply(this, args);
+        memoized.cache = cache.set(key, result);
+        return result;
+      };
+      memoized.cache = new memoize.Cache;
+      return memoized;
+    }
+
+    /**
+     * Creates a function that runs each argument through a corresponding
+     * transform function.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to wrap.
+     * @param {...(Function|Function[])} [transforms] The functions to transform
+     * arguments, specified as individual functions or arrays of functions.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * function doubled(n) {
+     *   return n * 2;
+     * }
+     *
+     * function square(n) {
+     *   return n * n;
+     * }
+     *
+     * var modded = _.modArgs(function(x, y) {
+     *   return [x, y];
+     * }, square, doubled);
+     *
+     * modded(1, 2);
+     * // => [1, 4]
+     *
+     * modded(5, 10);
+     * // => [25, 20]
+     */
+    var modArgs = restParam(function(func, transforms) {
+      transforms = baseFlatten(transforms);
+      if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      var length = transforms.length;
+      return restParam(function(args) {
+        var index = nativeMin(args.length, length);
+        while (index--) {
+          args[index] = transforms[index](args[index]);
+        }
+        return func.apply(this, args);
+      });
+    });
+
+    /**
+     * Creates a function that negates the result of the predicate `func`. The
+     * `func` predicate is invoked with the `this` binding and arguments of the
+     * created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} predicate The predicate to negate.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * function isEven(n) {
+     *   return n % 2 == 0;
+     * }
+     *
+     * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
+     * // => [1, 3, 5]
+     */
+    function negate(predicate) {
+      if (typeof predicate != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      return function() {
+        return !predicate.apply(this, arguments);
+      };
+    }
+
+    /**
+     * Creates a function that is restricted to invoking `func` once. Repeat calls
+     * to the function return the value of the first call. The `func` is invoked
+     * with the `this` binding and arguments of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var initialize = _.once(createApplication);
+     * initialize();
+     * initialize();
+     * // `initialize` invokes `createApplication` once
+     */
+    function once(func) {
+      return before(2, func);
+    }
+
+    /**
+     * Creates a function that invokes `func` with `partial` arguments prepended
+     * to those provided to the new function. This method is like `_.bind` except
+     * it does **not** alter the `this` binding.
+     *
+     * The `_.partial.placeholder` value, which defaults to `_` in monolithic
+     * builds, may be used as a placeholder for partially applied arguments.
+     *
+     * **Note:** This method does not set the "length" property of partially
+     * applied functions.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [partials] The arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var greet = function(greeting, name) {
+     *   return greeting + ' ' + name;
+     * };
+     *
+     * var sayHelloTo = _.partial(greet, 'hello');
+     * sayHelloTo('fred');
+     * // => 'hello fred'
+     *
+     * // using placeholders
+     * var greetFred = _.partial(greet, _, 'fred');
+     * greetFred('hi');
+     * // => 'hi fred'
+     */
+    var partial = createPartial(PARTIAL_FLAG);
+
+    /**
+     * This method is like `_.partial` except that partially applied arguments
+     * are appended to those provided to the new function.
+     *
+     * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
+     * builds, may be used as a placeholder for partially applied arguments.
+     *
+     * **Note:** This method does not set the "length" property of partially
+     * applied functions.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [partials] The arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var greet = function(greeting, name) {
+     *   return greeting + ' ' + name;
+     * };
+     *
+     * var greetFred = _.partialRight(greet, 'fred');
+     * greetFred('hi');
+     * // => 'hi fred'
+     *
+     * // using placeholders
+     * var sayHelloTo = _.partialRight(greet, 'hello', _);
+     * sayHelloTo('fred');
+     * // => 'hello fred'
+     */
+    var partialRight = createPartial(PARTIAL_RIGHT_FLAG);
+
+    /**
+     * Creates a function that invokes `func` with arguments arranged according
+     * to the specified indexes where the argument value at the first index is
+     * provided as the first argument, the argument value at the second index is
+     * provided as the second argument, and so on.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to rearrange arguments for.
+     * @param {...(number|number[])} indexes The arranged argument indexes,
+     *  specified as individual indexes or arrays of indexes.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var rearged = _.rearg(function(a, b, c) {
+     *   return [a, b, c];
+     * }, 2, 0, 1);
+     *
+     * rearged('b', 'c', 'a')
+     * // => ['a', 'b', 'c']
+     *
+     * var map = _.rearg(_.map, [1, 0]);
+     * map(function(n) {
+     *   return n * 3;
+     * }, [1, 2, 3]);
+     * // => [3, 6, 9]
+     */
+    var rearg = restParam(function(func, indexes) {
+      return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
+    });
+
+    /**
+     * Creates a function that invokes `func` with the `this` binding of the
+     * created function and arguments from `start` and beyond provided as an array.
+     *
+     * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to apply a rest parameter to.
+     * @param {number} [start=func.length-1] The start position of the rest parameter.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var say = _.restParam(function(what, names) {
+     *   return what + ' ' + _.initial(names).join(', ') +
+     *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
+     * });
+     *
+     * say('hello', 'fred', 'barney', 'pebbles');
+     * // => 'hello fred, barney, & pebbles'
+     */
+    function restParam(func, start) {
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
+      return function() {
+        var args = arguments,
+            index = -1,
+            length = nativeMax(args.length - start, 0),
+            rest = Array(length);
+
+        while (++index < length) {
+          rest[index] = args[start + index];
+        }
+        switch (start) {
+          case 0: return func.call(this, rest);
+          case 1: return func.call(this, args[0], rest);
+          case 2: return func.call(this, args[0], args[1], rest);
+        }
+        var otherArgs = Array(start + 1);
+        index = -1;
+        while (++index < start) {
+          otherArgs[index] = args[index];
+        }
+        otherArgs[start] = rest;
+        return func.apply(this, otherArgs);
+      };
+    }
+
+    /**
+     * Creates a function that invokes `func` with the `this` binding of the created
+     * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).
+     *
+     * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator).
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to spread arguments over.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var say = _.spread(function(who, what) {
+     *   return who + ' says ' + what;
+     * });
+     *
+     * say(['fred', 'hello']);
+     * // => 'fred says hello'
+     *
+     * // with a Promise
+     * var numbers = Promise.all([
+     *   Promise.resolve(40),
+     *   Promise.resolve(36)
+     * ]);
+     *
+     * numbers.then(_.spread(function(x, y) {
+     *   return x + y;
+     * }));
+     * // => a Promise of 76
+     */
+    function spread(func) {
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      return function(array) {
+        return func.apply(this, array);
+      };
+    }
+
+    /**
+     * Creates a throttled function that only invokes `func` at most once per
+     * every `wait` milliseconds. The throttled function comes with a `cancel`
+     * method to cancel delayed invocations. Provide an options object to indicate
+     * that `func` should be invoked on the leading and/or trailing edge of the
+     * `wait` timeout. Subsequent calls to the throttled function return the
+     * result of the last `func` call.
+     *
+     * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
+     * on the trailing edge of the timeout only if the the throttled function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
+     * for details over the differences between `_.throttle` and `_.debounce`.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to throttle.
+     * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.leading=true] Specify invoking on the leading
+     *  edge of the timeout.
+     * @param {boolean} [options.trailing=true] Specify invoking on the trailing
+     *  edge of the timeout.
+     * @returns {Function} Returns the new throttled function.
+     * @example
+     *
+     * // avoid excessively updating the position while scrolling
+     * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
+     *
+     * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes
+     * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
+     *   'trailing': false
+     * }));
+     *
+     * // cancel a trailing throttled call
+     * jQuery(window).on('popstate', throttled.cancel);
+     */
+    function throttle(func, wait, options) {
+      var leading = true,
+          trailing = true;
+
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      if (options === false) {
+        leading = false;
+      } else if (isObject(options)) {
+        leading = 'leading' in options ? !!options.leading : leading;
+        trailing = 'trailing' in options ? !!options.trailing : trailing;
+      }
+      return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing });
+    }
+
+    /**
+     * Creates a function that provides `value` to the wrapper function as its
+     * first argument. Any additional arguments provided to the function are
+     * appended to those provided to the wrapper function. The wrapper is invoked
+     * with the `this` binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Function
+     * @param {*} value The value to wrap.
+     * @param {Function} wrapper The wrapper function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var p = _.wrap(_.escape, function(func, text) {
+     *   return '<p>' + func(text) + '</p>';
+     * });
+     *
+     * p('fred, barney, & pebbles');
+     * // => '<p>fred, barney, &amp; pebbles</p>'
+     */
+    function wrap(value, wrapper) {
+      wrapper = wrapper == null ? identity : wrapper;
+      return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []);
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
+     * otherwise they are assigned by reference. If `customizer` is provided it is
+     * invoked to produce the cloned values. If `customizer` returns `undefined`
+     * cloning is handled by the method instead. The `customizer` is bound to
+     * `thisArg` and invoked with two argument; (value [, index|key, object]).
+     *
+     * **Note:** This method is loosely based on the
+     * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
+     * The enumerable properties of `arguments` objects and objects created by
+     * constructors other than `Object` are cloned to plain `Object` objects. An
+     * empty object is returned for uncloneable values such as functions, DOM nodes,
+     * Maps, Sets, and WeakMaps.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to clone.
+     * @param {boolean} [isDeep] Specify a deep clone.
+     * @param {Function} [customizer] The function to customize cloning values.
+     * @param {*} [thisArg] The `this` binding of `customizer`.
+     * @returns {*} Returns the cloned value.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney' },
+     *   { 'user': 'fred' }
+     * ];
+     *
+     * var shallow = _.clone(users);
+     * shallow[0] === users[0];
+     * // => true
+     *
+     * var deep = _.clone(users, true);
+     * deep[0] === users[0];
+     * // => false
+     *
+     * // using a customizer callback
+     * var el = _.clone(document.body, function(value) {
+     *   if (_.isElement(value)) {
+     *     return value.cloneNode(false);
+     *   }
+     * });
+     *
+     * el === document.body
+     * // => false
+     * el.nodeName
+     * // => BODY
+     * el.childNodes.length;
+     * // => 0
+     */
+    function clone(value, isDeep, customizer, thisArg) {
+      if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
+        isDeep = false;
+      }
+      else if (typeof isDeep == 'function') {
+        thisArg = customizer;
+        customizer = isDeep;
+        isDeep = false;
+      }
+      return typeof customizer == 'function'
+        ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1))
+        : baseClone(value, isDeep);
+    }
+
+    /**
+     * Creates a deep clone of `value`. If `customizer` is provided it is invoked
+     * to produce the cloned values. If `customizer` returns `undefined` cloning
+     * is handled by the method instead. The `customizer` is bound to `thisArg`
+     * and invoked with two argument; (value [, index|key, object]).
+     *
+     * **Note:** This method is loosely based on the
+     * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
+     * The enumerable properties of `arguments` objects and objects created by
+     * constructors other than `Object` are cloned to plain `Object` objects. An
+     * empty object is returned for uncloneable values such as functions, DOM nodes,
+     * Maps, Sets, and WeakMaps.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to deep clone.
+     * @param {Function} [customizer] The function to customize cloning values.
+     * @param {*} [thisArg] The `this` binding of `customizer`.
+     * @returns {*} Returns the deep cloned value.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney' },
+     *   { 'user': 'fred' }
+     * ];
+     *
+     * var deep = _.cloneDeep(users);
+     * deep[0] === users[0];
+     * // => false
+     *
+     * // using a customizer callback
+     * var el = _.cloneDeep(document.body, function(value) {
+     *   if (_.isElement(value)) {
+     *     return value.cloneNode(true);
+     *   }
+     * });
+     *
+     * el === document.body
+     * // => false
+     * el.nodeName
+     * // => BODY
+     * el.childNodes.length;
+     * // => 20
+     */
+    function cloneDeep(value, customizer, thisArg) {
+      return typeof customizer == 'function'
+        ? baseClone(value, true, bindCallback(customizer, thisArg, 1))
+        : baseClone(value, true);
+    }
+
+    /**
+     * Checks if `value` is greater than `other`.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.
+     * @example
+     *
+     * _.gt(3, 1);
+     * // => true
+     *
+     * _.gt(3, 3);
+     * // => false
+     *
+     * _.gt(1, 3);
+     * // => false
+     */
+    function gt(value, other) {
+      return value > other;
+    }
+
+    /**
+     * Checks if `value` is greater than or equal to `other`.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.
+     * @example
+     *
+     * _.gte(3, 1);
+     * // => true
+     *
+     * _.gte(3, 3);
+     * // => true
+     *
+     * _.gte(1, 3);
+     * // => false
+     */
+    function gte(value, other) {
+      return value >= other;
+    }
+
+    /**
+     * Checks if `value` is classified as an `arguments` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+     * @example
+     *
+     * _.isArguments(function() { return arguments; }());
+     * // => true
+     *
+     * _.isArguments([1, 2, 3]);
+     * // => false
+     */
+    function isArguments(value) {
+      return isObjectLike(value) && isArrayLike(value) &&
+        hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
+    }
+
+    /**
+     * Checks if `value` is classified as an `Array` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+     * @example
+     *
+     * _.isArray([1, 2, 3]);
+     * // => true
+     *
+     * _.isArray(function() { return arguments; }());
+     * // => false
+     */
+    var isArray = nativeIsArray || function(value) {
+      return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
+    };
+
+    /**
+     * Checks if `value` is classified as a boolean primitive or object.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+     * @example
+     *
+     * _.isBoolean(false);
+     * // => true
+     *
+     * _.isBoolean(null);
+     * // => false
+     */
+    function isBoolean(value) {
+      return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);
+    }
+
+    /**
+     * Checks if `value` is classified as a `Date` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+     * @example
+     *
+     * _.isDate(new Date);
+     * // => true
+     *
+     * _.isDate('Mon April 23 2012');
+     * // => false
+     */
+    function isDate(value) {
+      return isObjectLike(value) && objToString.call(value) == dateTag;
+    }
+
+    /**
+     * Checks if `value` is a DOM element.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
+     * @example
+     *
+     * _.isElement(document.body);
+     * // => true
+     *
+     * _.isElement('<body>');
+     * // => false
+     */
+    function isElement(value) {
+      return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
+    }
+
+    /**
+     * Checks if `value` is empty. A value is considered empty unless it is an
+     * `arguments` object, array, string, or jQuery-like collection with a length
+     * greater than `0` or an object with own enumerable properties.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {Array|Object|string} value The value to inspect.
+     * @returns {boolean} Returns `true` if `value` is empty, else `false`.
+     * @example
+     *
+     * _.isEmpty(null);
+     * // => true
+     *
+     * _.isEmpty(true);
+     * // => true
+     *
+     * _.isEmpty(1);
+     * // => true
+     *
+     * _.isEmpty([1, 2, 3]);
+     * // => false
+     *
+     * _.isEmpty({ 'a': 1 });
+     * // => false
+     */
+    function isEmpty(value) {
+      if (value == null) {
+        return true;
+      }
+      if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
+          (isObjectLike(value) && isFunction(value.splice)))) {
+        return !value.length;
+      }
+      return !keys(value).length;
+    }
+
+    /**
+     * Performs a deep comparison between two values to determine if they are
+     * equivalent. If `customizer` is provided it is invoked to compare values.
+     * If `customizer` returns `undefined` comparisons are handled by the method
+     * instead. The `customizer` is bound to `thisArg` and invoked with three
+     * arguments: (value, other [, index|key]).
+     *
+     * **Note:** This method supports comparing arrays, booleans, `Date` objects,
+     * numbers, `Object` objects, regexes, and strings. Objects are compared by
+     * their own, not inherited, enumerable properties. Functions and DOM nodes
+     * are **not** supported. Provide a customizer function to extend support
+     * for comparing other values.
+     *
+     * @static
+     * @memberOf _
+     * @alias eq
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @param {Function} [customizer] The function to customize value comparisons.
+     * @param {*} [thisArg] The `this` binding of `customizer`.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     * @example
+     *
+     * var object = { 'user': 'fred' };
+     * var other = { 'user': 'fred' };
+     *
+     * object == other;
+     * // => false
+     *
+     * _.isEqual(object, other);
+     * // => true
+     *
+     * // using a customizer callback
+     * var array = ['hello', 'goodbye'];
+     * var other = ['hi', 'goodbye'];
+     *
+     * _.isEqual(array, other, function(value, other) {
+     *   if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
+     *     return true;
+     *   }
+     * });
+     * // => true
+     */
+    function isEqual(value, other, customizer, thisArg) {
+      customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
+      var result = customizer ? customizer(value, other) : undefined;
+      return  result === undefined ? baseIsEqual(value, other, customizer) : !!result;
+    }
+
+    /**
+     * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
+     * `SyntaxError`, `TypeError`, or `URIError` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
+     * @example
+     *
+     * _.isError(new Error);
+     * // => true
+     *
+     * _.isError(Error);
+     * // => false
+     */
+    function isError(value) {
+      return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;
+    }
+
+    /**
+     * Checks if `value` is a finite primitive number.
+     *
+     * **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite).
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
+     * @example
+     *
+     * _.isFinite(10);
+     * // => true
+     *
+     * _.isFinite('10');
+     * // => false
+     *
+     * _.isFinite(true);
+     * // => false
+     *
+     * _.isFinite(Object(10));
+     * // => false
+     *
+     * _.isFinite(Infinity);
+     * // => false
+     */
+    function isFinite(value) {
+      return typeof value == 'number' && nativeIsFinite(value);
+    }
+
+    /**
+     * Checks if `value` is classified as a `Function` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+     * @example
+     *
+     * _.isFunction(_);
+     * // => true
+     *
+     * _.isFunction(/abc/);
+     * // => false
+     */
+    function isFunction(value) {
+      // The use of `Object#toString` avoids issues with the `typeof` operator
+      // in older versions of Chrome and Safari which return 'function' for regexes
+      // and Safari 8 equivalents which return 'object' for typed array constructors.
+      return isObject(value) && objToString.call(value) == funcTag;
+    }
+
+    /**
+     * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
+     * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+     * @example
+     *
+     * _.isObject({});
+     * // => true
+     *
+     * _.isObject([1, 2, 3]);
+     * // => true
+     *
+     * _.isObject(1);
+     * // => false
+     */
+    function isObject(value) {
+      // Avoid a V8 JIT bug in Chrome 19-20.
+      // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
+      var type = typeof value;
+      return !!value && (type == 'object' || type == 'function');
+    }
+
+    /**
+     * Performs a deep comparison between `object` and `source` to determine if
+     * `object` contains equivalent property values. If `customizer` is provided
+     * it is invoked to compare values. If `customizer` returns `undefined`
+     * comparisons are handled by the method instead. The `customizer` is bound
+     * to `thisArg` and invoked with three arguments: (value, other, index|key).
+     *
+     * **Note:** This method supports comparing properties of arrays, booleans,
+     * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions
+     * and DOM nodes are **not** supported. Provide a customizer function to extend
+     * support for comparing other values.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {Object} object The object to inspect.
+     * @param {Object} source The object of property values to match.
+     * @param {Function} [customizer] The function to customize value comparisons.
+     * @param {*} [thisArg] The `this` binding of `customizer`.
+     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+     * @example
+     *
+     * var object = { 'user': 'fred', 'age': 40 };
+     *
+     * _.isMatch(object, { 'age': 40 });
+     * // => true
+     *
+     * _.isMatch(object, { 'age': 36 });
+     * // => false
+     *
+     * // using a customizer callback
+     * var object = { 'greeting': 'hello' };
+     * var source = { 'greeting': 'hi' };
+     *
+     * _.isMatch(object, source, function(value, other) {
+     *   return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;
+     * });
+     * // => true
+     */
+    function isMatch(object, source, customizer, thisArg) {
+      customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
+      return baseIsMatch(object, getMatchData(source), customizer);
+    }
+
+    /**
+     * Checks if `value` is `NaN`.
+     *
+     * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4)
+     * which returns `true` for `undefined` and other non-numeric values.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+     * @example
+     *
+     * _.isNaN(NaN);
+     * // => true
+     *
+     * _.isNaN(new Number(NaN));
+     * // => true
+     *
+     * isNaN(undefined);
+     * // => true
+     *
+     * _.isNaN(undefined);
+     * // => false
+     */
+    function isNaN(value) {
+      // An `NaN` primitive is the only value that is not equal to itself.
+      // Perform the `toStringTag` check first to avoid errors with some host objects in IE.
+      return isNumber(value) && value != +value;
+    }
+
+    /**
+     * Checks if `value` is a native function.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
+     * @example
+     *
+     * _.isNative(Array.prototype.push);
+     * // => true
+     *
+     * _.isNative(_);
+     * // => false
+     */
+    function isNative(value) {
+      if (value == null) {
+        return false;
+      }
+      if (isFunction(value)) {
+        return reIsNative.test(fnToString.call(value));
+      }
+      return isObjectLike(value) && reIsHostCtor.test(value);
+    }
+
+    /**
+     * Checks if `value` is `null`.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
+     * @example
+     *
+     * _.isNull(null);
+     * // => true
+     *
+     * _.isNull(void 0);
+     * // => false
+     */
+    function isNull(value) {
+      return value === null;
+    }
+
+    /**
+     * Checks if `value` is classified as a `Number` primitive or object.
+     *
+     * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
+     * as numbers, use the `_.isFinite` method.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+     * @example
+     *
+     * _.isNumber(8.4);
+     * // => true
+     *
+     * _.isNumber(NaN);
+     * // => true
+     *
+     * _.isNumber('8.4');
+     * // => false
+     */
+    function isNumber(value) {
+      return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
+    }
+
+    /**
+     * Checks if `value` is a plain object, that is, an object created by the
+     * `Object` constructor or one with a `[[Prototype]]` of `null`.
+     *
+     * **Note:** This method assumes objects created by the `Object` constructor
+     * have no inherited enumerable properties.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     * }
+     *
+     * _.isPlainObject(new Foo);
+     * // => false
+     *
+     * _.isPlainObject([1, 2, 3]);
+     * // => false
+     *
+     * _.isPlainObject({ 'x': 0, 'y': 0 });
+     * // => true
+     *
+     * _.isPlainObject(Object.create(null));
+     * // => true
+     */
+    function isPlainObject(value) {
+      var Ctor;
+
+      // Exit early for non `Object` objects.
+      if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
+          (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
+        return false;
+      }
+      // IE < 9 iterates inherited properties before own properties. If the first
+      // iterated property is an object's own property then there are no inherited
+      // enumerable properties.
+      var result;
+      // In most environments an object's own properties are iterated before
+      // its inherited properties. If the last iterated property is an object's
+      // own property then there are no inherited enumerable properties.
+      baseForIn(value, function(subValue, key) {
+        result = key;
+      });
+      return result === undefined || hasOwnProperty.call(value, result);
+    }
+
+    /**
+     * Checks if `value` is classified as a `RegExp` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+     * @example
+     *
+     * _.isRegExp(/abc/);
+     * // => true
+     *
+     * _.isRegExp('/abc/');
+     * // => false
+     */
+    function isRegExp(value) {
+      return isObject(value) && objToString.call(value) == regexpTag;
+    }
+
+    /**
+     * Checks if `value` is classified as a `String` primitive or object.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+     * @example
+     *
+     * _.isString('abc');
+     * // => true
+     *
+     * _.isString(1);
+     * // => false
+     */
+    function isString(value) {
+      return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
+    }
+
+    /**
+     * Checks if `value` is classified as a typed array.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+     * @example
+     *
+     * _.isTypedArray(new Uint8Array);
+     * // => true
+     *
+     * _.isTypedArray([]);
+     * // => false
+     */
+    function isTypedArray(value) {
+      return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
+    }
+
+    /**
+     * Checks if `value` is `undefined`.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
+     * @example
+     *
+     * _.isUndefined(void 0);
+     * // => true
+     *
+     * _.isUndefined(null);
+     * // => false
+     */
+    function isUndefined(value) {
+      return value === undefined;
+    }
+
+    /**
+     * Checks if `value` is less than `other`.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.
+     * @example
+     *
+     * _.lt(1, 3);
+     * // => true
+     *
+     * _.lt(3, 3);
+     * // => false
+     *
+     * _.lt(3, 1);
+     * // => false
+     */
+    function lt(value, other) {
+      return value < other;
+    }
+
+    /**
+     * Checks if `value` is less than or equal to `other`.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.
+     * @example
+     *
+     * _.lte(1, 3);
+     * // => true
+     *
+     * _.lte(3, 3);
+     * // => true
+     *
+     * _.lte(3, 1);
+     * // => false
+     */
+    function lte(value, other) {
+      return value <= other;
+    }
+
+    /**
+     * Converts `value` to an array.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to convert.
+     * @returns {Array} Returns the converted array.
+     * @example
+     *
+     * (function() {
+     *   return _.toArray(arguments).slice(1);
+     * }(1, 2, 3));
+     * // => [2, 3]
+     */
+    function toArray(value) {
+      var length = value ? getLength(value) : 0;
+      if (!isLength(length)) {
+        return values(value);
+      }
+      if (!length) {
+        return [];
+      }
+      return arrayCopy(value);
+    }
+
+    /**
+     * Converts `value` to a plain object flattening inherited enumerable
+     * properties of `value` to own properties of the plain object.
+     *
+     * @static
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to convert.
+     * @returns {Object} Returns the converted plain object.
+     * @example
+     *
+     * function Foo() {
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.assign({ 'a': 1 }, new Foo);
+     * // => { 'a': 1, 'b': 2 }
+     *
+     * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
+     * // => { 'a': 1, 'b': 2, 'c': 3 }
+     */
+    function toPlainObject(value) {
+      return baseCopy(value, keysIn(value));
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Recursively merges own enumerable properties of the source object(s), that
+     * don't resolve to `undefined` into the destination object. Subsequent sources
+     * overwrite property assignments of previous sources. If `customizer` is
+     * provided it is invoked to produce the merged values of the destination and
+     * source properties. If `customizer` returns `undefined` merging is handled
+     * by the method instead. The `customizer` is bound to `thisArg` and invoked
+     * with five arguments: (objectValue, sourceValue, key, object, source).
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} [sources] The source objects.
+     * @param {Function} [customizer] The function to customize assigned values.
+     * @param {*} [thisArg] The `this` binding of `customizer`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var users = {
+     *   'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
+     * };
+     *
+     * var ages = {
+     *   'data': [{ 'age': 36 }, { 'age': 40 }]
+     * };
+     *
+     * _.merge(users, ages);
+     * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
+     *
+     * // using a customizer callback
+     * var object = {
+     *   'fruits': ['apple'],
+     *   'vegetables': ['beet']
+     * };
+     *
+     * var other = {
+     *   'fruits': ['banana'],
+     *   'vegetables': ['carrot']
+     * };
+     *
+     * _.merge(object, other, function(a, b) {
+     *   if (_.isArray(a)) {
+     *     return a.concat(b);
+     *   }
+     * });
+     * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
+     */
+    var merge = createAssigner(baseMerge);
+
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object. Subsequent sources overwrite property assignments of previous sources.
+     * If `customizer` is provided it is invoked to produce the assigned values.
+     * The `customizer` is bound to `thisArg` and invoked with five arguments:
+     * (objectValue, sourceValue, key, object, source).
+     *
+     * **Note:** This method mutates `object` and is based on
+     * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
+     *
+     * @static
+     * @memberOf _
+     * @alias extend
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} [sources] The source objects.
+     * @param {Function} [customizer] The function to customize assigned values.
+     * @param {*} [thisArg] The `this` binding of `customizer`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
+     * // => { 'user': 'fred', 'age': 40 }
+     *
+     * // using a customizer callback
+     * var defaults = _.partialRight(_.assign, function(value, other) {
+     *   return _.isUndefined(value) ? other : value;
+     * });
+     *
+     * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
+     * // => { 'user': 'barney', 'age': 36 }
+     */
+    var assign = createAssigner(function(object, source, customizer) {
+      return customizer
+        ? assignWith(object, source, customizer)
+        : baseAssign(object, source);
+    });
+
+    /**
+     * Creates an object that inherits from the given `prototype` object. If a
+     * `properties` object is provided its own enumerable properties are assigned
+     * to the created object.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} prototype The object to inherit from.
+     * @param {Object} [properties] The properties to assign to the object.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * function Circle() {
+     *   Shape.call(this);
+     * }
+     *
+     * Circle.prototype = _.create(Shape.prototype, {
+     *   'constructor': Circle
+     * });
+     *
+     * var circle = new Circle;
+     * circle instanceof Circle;
+     * // => true
+     *
+     * circle instanceof Shape;
+     * // => true
+     */
+    function create(prototype, properties, guard) {
+      var result = baseCreate(prototype);
+      if (guard && isIterateeCall(prototype, properties, guard)) {
+        properties = undefined;
+      }
+      return properties ? baseAssign(result, properties) : result;
+    }
+
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object for all destination properties that resolve to `undefined`. Once a
+     * property is set, additional values of the same property are ignored.
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} [sources] The source objects.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
+     * // => { 'user': 'barney', 'age': 36 }
+     */
+    var defaults = createDefaults(assign, assignDefaults);
+
+    /**
+     * This method is like `_.defaults` except that it recursively assigns
+     * default properties.
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} [sources] The source objects.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
+     * // => { 'user': { 'name': 'barney', 'age': 36 } }
+     *
+     */
+    var defaultsDeep = createDefaults(merge, mergeDefaults);
+
+    /**
+     * This method is like `_.find` except that it returns the key of the first
+     * element `predicate` returns truthy for instead of the element itself.
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to search.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
+     * @example
+     *
+     * var users = {
+     *   'barney':  { 'age': 36, 'active': true },
+     *   'fred':    { 'age': 40, 'active': false },
+     *   'pebbles': { 'age': 1,  'active': true }
+     * };
+     *
+     * _.findKey(users, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => 'barney' (iteration order is not guaranteed)
+     *
+     * // using the `_.matches` callback shorthand
+     * _.findKey(users, { 'age': 1, 'active': true });
+     * // => 'pebbles'
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.findKey(users, 'active', false);
+     * // => 'fred'
+     *
+     * // using the `_.property` callback shorthand
+     * _.findKey(users, 'active');
+     * // => 'barney'
+     */
+    var findKey = createFindKey(baseForOwn);
+
+    /**
+     * This method is like `_.findKey` except that it iterates over elements of
+     * a collection in the opposite order.
+     *
+     * If a property name is provided for `predicate` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `predicate` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to search.
+     * @param {Function|Object|string} [predicate=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
+     * @example
+     *
+     * var users = {
+     *   'barney':  { 'age': 36, 'active': true },
+     *   'fred':    { 'age': 40, 'active': false },
+     *   'pebbles': { 'age': 1,  'active': true }
+     * };
+     *
+     * _.findLastKey(users, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => returns `pebbles` assuming `_.findKey` returns `barney`
+     *
+     * // using the `_.matches` callback shorthand
+     * _.findLastKey(users, { 'age': 36, 'active': true });
+     * // => 'barney'
+     *
+     * // using the `_.matchesProperty` callback shorthand
+     * _.findLastKey(users, 'active', false);
+     * // => 'fred'
+     *
+     * // using the `_.property` callback shorthand
+     * _.findLastKey(users, 'active');
+     * // => 'pebbles'
+     */
+    var findLastKey = createFindKey(baseForOwnRight);
+
+    /**
+     * Iterates over own and inherited enumerable properties of an object invoking
+     * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked
+     * with three arguments: (value, key, object). Iteratee functions may exit
+     * iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.forIn(new Foo, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)
+     */
+    var forIn = createForIn(baseFor);
+
+    /**
+     * This method is like `_.forIn` except that it iterates over properties of
+     * `object` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.forInRight(new Foo, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
+     */
+    var forInRight = createForIn(baseForRight);
+
+    /**
+     * Iterates over own enumerable properties of an object invoking `iteratee`
+     * for each property. The `iteratee` is bound to `thisArg` and invoked with
+     * three arguments: (value, key, object). Iteratee functions may exit iteration
+     * early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.forOwn(new Foo, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'a' and 'b' (iteration order is not guaranteed)
+     */
+    var forOwn = createForOwn(baseForOwn);
+
+    /**
+     * This method is like `_.forOwn` except that it iterates over properties of
+     * `object` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.forOwnRight(new Foo, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
+     */
+    var forOwnRight = createForOwn(baseForOwnRight);
+
+    /**
+     * Creates an array of function property names from all enumerable properties,
+     * own and inherited, of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @alias methods
+     * @category Object
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns the new array of property names.
+     * @example
+     *
+     * _.functions(_);
+     * // => ['after', 'ary', 'assign', ...]
+     */
+    function functions(object) {
+      return baseFunctions(object, keysIn(object));
+    }
+
+    /**
+     * Gets the property value at `path` of `object`. If the resolved value is
+     * `undefined` the `defaultValue` is used in its place.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path of the property to get.
+     * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
+     * @returns {*} Returns the resolved value.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+     *
+     * _.get(object, 'a[0].b.c');
+     * // => 3
+     *
+     * _.get(object, ['a', '0', 'b', 'c']);
+     * // => 3
+     *
+     * _.get(object, 'a.b.c', 'default');
+     * // => 'default'
+     */
+    function get(object, path, defaultValue) {
+      var result = object == null ? undefined : baseGet(object, toPath(path), path + '');
+      return result === undefined ? defaultValue : result;
+    }
+
+    /**
+     * Checks if `path` is a direct property.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path to check.
+     * @returns {boolean} Returns `true` if `path` is a direct property, else `false`.
+     * @example
+     *
+     * var object = { 'a': { 'b': { 'c': 3 } } };
+     *
+     * _.has(object, 'a');
+     * // => true
+     *
+     * _.has(object, 'a.b.c');
+     * // => true
+     *
+     * _.has(object, ['a', 'b', 'c']);
+     * // => true
+     */
+    function has(object, path) {
+      if (object == null) {
+        return false;
+      }
+      var result = hasOwnProperty.call(object, path);
+      if (!result && !isKey(path)) {
+        path = toPath(path);
+        object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
+        if (object == null) {
+          return false;
+        }
+        path = last(path);
+        result = hasOwnProperty.call(object, path);
+      }
+      return result || (isLength(object.length) && isIndex(path, object.length) &&
+        (isArray(object) || isArguments(object)));
+    }
+
+    /**
+     * Creates an object composed of the inverted keys and values of `object`.
+     * If `object` contains duplicate values, subsequent values overwrite property
+     * assignments of previous values unless `multiValue` is `true`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to invert.
+     * @param {boolean} [multiValue] Allow multiple values per key.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Object} Returns the new inverted object.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': 2, 'c': 1 };
+     *
+     * _.invert(object);
+     * // => { '1': 'c', '2': 'b' }
+     *
+     * // with `multiValue`
+     * _.invert(object, true);
+     * // => { '1': ['a', 'c'], '2': ['b'] }
+     */
+    function invert(object, multiValue, guard) {
+      if (guard && isIterateeCall(object, multiValue, guard)) {
+        multiValue = undefined;
+      }
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = {};
+
+      while (++index < length) {
+        var key = props[index],
+            value = object[key];
+
+        if (multiValue) {
+          if (hasOwnProperty.call(result, value)) {
+            result[value].push(key);
+          } else {
+            result[value] = [key];
+          }
+        }
+        else {
+          result[value] = key;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Creates an array of the own enumerable property names of `object`.
+     *
+     * **Note:** Non-object values are coerced to objects. See the
+     * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
+     * for more details.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.keys(new Foo);
+     * // => ['a', 'b'] (iteration order is not guaranteed)
+     *
+     * _.keys('hi');
+     * // => ['0', '1']
+     */
+    var keys = !nativeKeys ? shimKeys : function(object) {
+      var Ctor = object == null ? undefined : object.constructor;
+      if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
+          (typeof object != 'function' && isArrayLike(object))) {
+        return shimKeys(object);
+      }
+      return isObject(object) ? nativeKeys(object) : [];
+    };
+
+    /**
+     * Creates an array of the own and inherited enumerable property names of `object`.
+     *
+     * **Note:** Non-object values are coerced to objects.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.keysIn(new Foo);
+     * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
+     */
+    function keysIn(object) {
+      if (object == null) {
+        return [];
+      }
+      if (!isObject(object)) {
+        object = Object(object);
+      }
+      var length = object.length;
+      length = (length && isLength(length) &&
+        (isArray(object) || isArguments(object)) && length) || 0;
+
+      var Ctor = object.constructor,
+          index = -1,
+          isProto = typeof Ctor == 'function' && Ctor.prototype === object,
+          result = Array(length),
+          skipIndexes = length > 0;
+
+      while (++index < length) {
+        result[index] = (index + '');
+      }
+      for (var key in object) {
+        if (!(skipIndexes && isIndex(key, length)) &&
+            !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
+          result.push(key);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The opposite of `_.mapValues`; this method creates an object with the
+     * same values as `object` and keys generated by running each own enumerable
+     * property of `object` through `iteratee`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Object} Returns the new mapped object.
+     * @example
+     *
+     * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
+     *   return key + value;
+     * });
+     * // => { 'a1': 1, 'b2': 2 }
+     */
+    var mapKeys = createObjectMapper(true);
+
+    /**
+     * Creates an object with the same keys as `object` and values generated by
+     * running each own enumerable property of `object` through `iteratee`. The
+     * iteratee function is bound to `thisArg` and invoked with three arguments:
+     * (value, key, object).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+     *  per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Object} Returns the new mapped object.
+     * @example
+     *
+     * _.mapValues({ 'a': 1, 'b': 2 }, function(n) {
+     *   return n * 3;
+     * });
+     * // => { 'a': 3, 'b': 6 }
+     *
+     * var users = {
+     *   'fred':    { 'user': 'fred',    'age': 40 },
+     *   'pebbles': { 'user': 'pebbles', 'age': 1 }
+     * };
+     *
+     * // using the `_.property` callback shorthand
+     * _.mapValues(users, 'age');
+     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
+     */
+    var mapValues = createObjectMapper();
+
+    /**
+     * The opposite of `_.pick`; this method creates an object composed of the
+     * own and inherited enumerable properties of `object` that are not omitted.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The source object.
+     * @param {Function|...(string|string[])} [predicate] The function invoked per
+     *  iteration or property names to omit, specified as individual property
+     *  names or arrays of property names.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * var object = { 'user': 'fred', 'age': 40 };
+     *
+     * _.omit(object, 'age');
+     * // => { 'user': 'fred' }
+     *
+     * _.omit(object, _.isNumber);
+     * // => { 'user': 'fred' }
+     */
+    var omit = restParam(function(object, props) {
+      if (object == null) {
+        return {};
+      }
+      if (typeof props[0] != 'function') {
+        var props = arrayMap(baseFlatten(props), String);
+        return pickByArray(object, baseDifference(keysIn(object), props));
+      }
+      var predicate = bindCallback(props[0], props[1], 3);
+      return pickByCallback(object, function(value, key, object) {
+        return !predicate(value, key, object);
+      });
+    });
+
+    /**
+     * Creates a two dimensional array of the key-value pairs for `object`,
+     * e.g. `[[key1, value1], [key2, value2]]`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the new array of key-value pairs.
+     * @example
+     *
+     * _.pairs({ 'barney': 36, 'fred': 40 });
+     * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
+     */
+    function pairs(object) {
+      object = toObject(object);
+
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = Array(length);
+
+      while (++index < length) {
+        var key = props[index];
+        result[index] = [key, object[key]];
+      }
+      return result;
+    }
+
+    /**
+     * Creates an object composed of the picked `object` properties. Property
+     * names may be specified as individual arguments or as arrays of property
+     * names. If `predicate` is provided it is invoked for each property of `object`
+     * picking the properties `predicate` returns truthy for. The predicate is
+     * bound to `thisArg` and invoked with three arguments: (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The source object.
+     * @param {Function|...(string|string[])} [predicate] The function invoked per
+     *  iteration or property names to pick, specified as individual property
+     *  names or arrays of property names.
+     * @param {*} [thisArg] The `this` binding of `predicate`.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * var object = { 'user': 'fred', 'age': 40 };
+     *
+     * _.pick(object, 'user');
+     * // => { 'user': 'fred' }
+     *
+     * _.pick(object, _.isString);
+     * // => { 'user': 'fred' }
+     */
+    var pick = restParam(function(object, props) {
+      if (object == null) {
+        return {};
+      }
+      return typeof props[0] == 'function'
+        ? pickByCallback(object, bindCallback(props[0], props[1], 3))
+        : pickByArray(object, baseFlatten(props));
+    });
+
+    /**
+     * This method is like `_.get` except that if the resolved value is a function
+     * it is invoked with the `this` binding of its parent object and its result
+     * is returned.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path of the property to resolve.
+     * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
+     * @returns {*} Returns the resolved value.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
+     *
+     * _.result(object, 'a[0].b.c1');
+     * // => 3
+     *
+     * _.result(object, 'a[0].b.c2');
+     * // => 4
+     *
+     * _.result(object, 'a.b.c', 'default');
+     * // => 'default'
+     *
+     * _.result(object, 'a.b.c', _.constant('default'));
+     * // => 'default'
+     */
+    function result(object, path, defaultValue) {
+      var result = object == null ? undefined : object[path];
+      if (result === undefined) {
+        if (object != null && !isKey(path, object)) {
+          path = toPath(path);
+          object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
+          result = object == null ? undefined : object[last(path)];
+        }
+        result = result === undefined ? defaultValue : result;
+      }
+      return isFunction(result) ? result.call(object) : result;
+    }
+
+    /**
+     * Sets the property value of `path` on `object`. If a portion of `path`
+     * does not exist it is created.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to augment.
+     * @param {Array|string} path The path of the property to set.
+     * @param {*} value The value to set.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+     *
+     * _.set(object, 'a[0].b.c', 4);
+     * console.log(object.a[0].b.c);
+     * // => 4
+     *
+     * _.set(object, 'x[0].y.z', 5);
+     * console.log(object.x[0].y.z);
+     * // => 5
+     */
+    function set(object, path, value) {
+      if (object == null) {
+        return object;
+      }
+      var pathKey = (path + '');
+      path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path);
+
+      var index = -1,
+          length = path.length,
+          lastIndex = length - 1,
+          nested = object;
+
+      while (nested != null && ++index < length) {
+        var key = path[index];
+        if (isObject(nested)) {
+          if (index == lastIndex) {
+            nested[key] = value;
+          } else if (nested[key] == null) {
+            nested[key] = isIndex(path[index + 1]) ? [] : {};
+          }
+        }
+        nested = nested[key];
+      }
+      return object;
+    }
+
+    /**
+     * An alternative to `_.reduce`; this method transforms `object` to a new
+     * `accumulator` object which is the result of running each of its own enumerable
+     * properties through `iteratee`, with each invocation potentially mutating
+     * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked
+     * with four arguments: (accumulator, value, key, object). Iteratee functions
+     * may exit iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Array|Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [accumulator] The custom accumulator value.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * _.transform([2, 3, 4], function(result, n) {
+     *   result.push(n *= n);
+     *   return n % 2 == 0;
+     * });
+     * // => [4, 9]
+     *
+     * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {
+     *   result[key] = n * 3;
+     * });
+     * // => { 'a': 3, 'b': 6 }
+     */
+    function transform(object, iteratee, accumulator, thisArg) {
+      var isArr = isArray(object) || isTypedArray(object);
+      iteratee = getCallback(iteratee, thisArg, 4);
+
+      if (accumulator == null) {
+        if (isArr || isObject(object)) {
+          var Ctor = object.constructor;
+          if (isArr) {
+            accumulator = isArray(object) ? new Ctor : [];
+          } else {
+            accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
+          }
+        } else {
+          accumulator = {};
+        }
+      }
+      (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {
+        return iteratee(accumulator, value, index, object);
+      });
+      return accumulator;
+    }
+
+    /**
+     * Creates an array of the own enumerable property values of `object`.
+     *
+     * **Note:** Non-object values are coerced to objects.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property values.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.values(new Foo);
+     * // => [1, 2] (iteration order is not guaranteed)
+     *
+     * _.values('hi');
+     * // => ['h', 'i']
+     */
+    function values(object) {
+      return baseValues(object, keys(object));
+    }
+
+    /**
+     * Creates an array of the own and inherited enumerable property values
+     * of `object`.
+     *
+     * **Note:** Non-object values are coerced to objects.
+     *
+     * @static
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property values.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.valuesIn(new Foo);
+     * // => [1, 2, 3] (iteration order is not guaranteed)
+     */
+    function valuesIn(object) {
+      return baseValues(object, keysIn(object));
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Checks if `n` is between `start` and up to but not including, `end`. If
+     * `end` is not specified it is set to `start` with `start` then set to `0`.
+     *
+     * @static
+     * @memberOf _
+     * @category Number
+     * @param {number} n The number to check.
+     * @param {number} [start=0] The start of the range.
+     * @param {number} end The end of the range.
+     * @returns {boolean} Returns `true` if `n` is in the range, else `false`.
+     * @example
+     *
+     * _.inRange(3, 2, 4);
+     * // => true
+     *
+     * _.inRange(4, 8);
+     * // => true
+     *
+     * _.inRange(4, 2);
+     * // => false
+     *
+     * _.inRange(2, 2);
+     * // => false
+     *
+     * _.inRange(1.2, 2);
+     * // => true
+     *
+     * _.inRange(5.2, 4);
+     * // => false
+     */
+    function inRange(value, start, end) {
+      start = +start || 0;
+      if (end === undefined) {
+        end = start;
+        start = 0;
+      } else {
+        end = +end || 0;
+      }
+      return value >= nativeMin(start, end) && value < nativeMax(start, end);
+    }
+
+    /**
+     * Produces a random number between `min` and `max` (inclusive). If only one
+     * argument is provided a number between `0` and the given number is returned.
+     * If `floating` is `true`, or either `min` or `max` are floats, a floating-point
+     * number is returned instead of an integer.
+     *
+     * @static
+     * @memberOf _
+     * @category Number
+     * @param {number} [min=0] The minimum possible value.
+     * @param {number} [max=1] The maximum possible value.
+     * @param {boolean} [floating] Specify returning a floating-point number.
+     * @returns {number} Returns the random number.
+     * @example
+     *
+     * _.random(0, 5);
+     * // => an integer between 0 and 5
+     *
+     * _.random(5);
+     * // => also an integer between 0 and 5
+     *
+     * _.random(5, true);
+     * // => a floating-point number between 0 and 5
+     *
+     * _.random(1.2, 5.2);
+     * // => a floating-point number between 1.2 and 5.2
+     */
+    function random(min, max, floating) {
+      if (floating && isIterateeCall(min, max, floating)) {
+        max = floating = undefined;
+      }
+      var noMin = min == null,
+          noMax = max == null;
+
+      if (floating == null) {
+        if (noMax && typeof min == 'boolean') {
+          floating = min;
+          min = 1;
+        }
+        else if (typeof max == 'boolean') {
+          floating = max;
+          noMax = true;
+        }
+      }
+      if (noMin && noMax) {
+        max = 1;
+        noMax = false;
+      }
+      min = +min || 0;
+      if (noMax) {
+        max = min;
+        min = 0;
+      } else {
+        max = +max || 0;
+      }
+      if (floating || min % 1 || max % 1) {
+        var rand = nativeRandom();
+        return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max);
+      }
+      return baseRandom(min, max);
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the camel cased string.
+     * @example
+     *
+     * _.camelCase('Foo Bar');
+     * // => 'fooBar'
+     *
+     * _.camelCase('--foo-bar');
+     * // => 'fooBar'
+     *
+     * _.camelCase('__foo_bar__');
+     * // => 'fooBar'
+     */
+    var camelCase = createCompounder(function(result, word, index) {
+      word = word.toLowerCase();
+      return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);
+    });
+
+    /**
+     * Capitalizes the first character of `string`.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to capitalize.
+     * @returns {string} Returns the capitalized string.
+     * @example
+     *
+     * _.capitalize('fred');
+     * // => 'Fred'
+     */
+    function capitalize(string) {
+      string = baseToString(string);
+      return string && (string.charAt(0).toUpperCase() + string.slice(1));
+    }
+
+    /**
+     * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
+     * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to deburr.
+     * @returns {string} Returns the deburred string.
+     * @example
+     *
+     * _.deburr('déjà vu');
+     * // => 'deja vu'
+     */
+    function deburr(string) {
+      string = baseToString(string);
+      return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
+    }
+
+    /**
+     * Checks if `string` ends with the given target string.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to search.
+     * @param {string} [target] The string to search for.
+     * @param {number} [position=string.length] The position to search from.
+     * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`.
+     * @example
+     *
+     * _.endsWith('abc', 'c');
+     * // => true
+     *
+     * _.endsWith('abc', 'b');
+     * // => false
+     *
+     * _.endsWith('abc', 'b', 2);
+     * // => true
+     */
+    function endsWith(string, target, position) {
+      string = baseToString(string);
+      target = (target + '');
+
+      var length = string.length;
+      position = position === undefined
+        ? length
+        : nativeMin(position < 0 ? 0 : (+position || 0), length);
+
+      position -= target.length;
+      return position >= 0 && string.indexOf(target, position) == position;
+    }
+
+    /**
+     * Converts the characters "&", "<", ">", '"', "'", and "\`", in `string` to
+     * their corresponding HTML entities.
+     *
+     * **Note:** No other characters are escaped. To escape additional characters
+     * use a third-party library like [_he_](https://mths.be/he).
+     *
+     * Though the ">" character is escaped for symmetry, characters like
+     * ">" and "/" don't need escaping in HTML and have no special meaning
+     * unless they're part of a tag or unquoted attribute value.
+     * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
+     * (under "semi-related fun fact") for more details.
+     *
+     * Backticks are escaped because in Internet Explorer < 9, they can break out
+     * of attribute values or HTML comments. See [#59](https://html5sec.org/#59),
+     * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
+     * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)
+     * for more details.
+     *
+     * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)
+     * to reduce XSS vectors.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to escape.
+     * @returns {string} Returns the escaped string.
+     * @example
+     *
+     * _.escape('fred, barney, & pebbles');
+     * // => 'fred, barney, &amp; pebbles'
+     */
+    function escape(string) {
+      // Reset `lastIndex` because in IE < 9 `String#replace` does not.
+      string = baseToString(string);
+      return (string && reHasUnescapedHtml.test(string))
+        ? string.replace(reUnescapedHtml, escapeHtmlChar)
+        : string;
+    }
+
+    /**
+     * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",
+     * "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to escape.
+     * @returns {string} Returns the escaped string.
+     * @example
+     *
+     * _.escapeRegExp('[lodash](https://lodash.com/)');
+     * // => '\[lodash\]\(https:\/\/lodash\.com\/\)'
+     */
+    function escapeRegExp(string) {
+      string = baseToString(string);
+      return (string && reHasRegExpChars.test(string))
+        ? string.replace(reRegExpChars, escapeRegExpChar)
+        : (string || '(?:)');
+    }
+
+    /**
+     * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the kebab cased string.
+     * @example
+     *
+     * _.kebabCase('Foo Bar');
+     * // => 'foo-bar'
+     *
+     * _.kebabCase('fooBar');
+     * // => 'foo-bar'
+     *
+     * _.kebabCase('__foo_bar__');
+     * // => 'foo-bar'
+     */
+    var kebabCase = createCompounder(function(result, word, index) {
+      return result + (index ? '-' : '') + word.toLowerCase();
+    });
+
+    /**
+     * Pads `string` on the left and right sides if it's shorter than `length`.
+     * Padding characters are truncated if they can't be evenly divided by `length`.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to pad.
+     * @param {number} [length=0] The padding length.
+     * @param {string} [chars=' '] The string used as padding.
+     * @returns {string} Returns the padded string.
+     * @example
+     *
+     * _.pad('abc', 8);
+     * // => '  abc   '
+     *
+     * _.pad('abc', 8, '_-');
+     * // => '_-abc_-_'
+     *
+     * _.pad('abc', 3);
+     * // => 'abc'
+     */
+    function pad(string, length, chars) {
+      string = baseToString(string);
+      length = +length;
+
+      var strLength = string.length;
+      if (strLength >= length || !nativeIsFinite(length)) {
+        return string;
+      }
+      var mid = (length - strLength) / 2,
+          leftLength = nativeFloor(mid),
+          rightLength = nativeCeil(mid);
+
+      chars = createPadding('', rightLength, chars);
+      return chars.slice(0, leftLength) + string + chars;
+    }
+
+    /**
+     * Pads `string` on the left side if it's shorter than `length`. Padding
+     * characters are truncated if they exceed `length`.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to pad.
+     * @param {number} [length=0] The padding length.
+     * @param {string} [chars=' '] The string used as padding.
+     * @returns {string} Returns the padded string.
+     * @example
+     *
+     * _.padLeft('abc', 6);
+     * // => '   abc'
+     *
+     * _.padLeft('abc', 6, '_-');
+     * // => '_-_abc'
+     *
+     * _.padLeft('abc', 3);
+     * // => 'abc'
+     */
+    var padLeft = createPadDir();
+
+    /**
+     * Pads `string` on the right side if it's shorter than `length`. Padding
+     * characters are truncated if they exceed `length`.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to pad.
+     * @param {number} [length=0] The padding length.
+     * @param {string} [chars=' '] The string used as padding.
+     * @returns {string} Returns the padded string.
+     * @example
+     *
+     * _.padRight('abc', 6);
+     * // => 'abc   '
+     *
+     * _.padRight('abc', 6, '_-');
+     * // => 'abc_-_'
+     *
+     * _.padRight('abc', 3);
+     * // => 'abc'
+     */
+    var padRight = createPadDir(true);
+
+    /**
+     * Converts `string` to an integer of the specified radix. If `radix` is
+     * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
+     * in which case a `radix` of `16` is used.
+     *
+     * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E)
+     * of `parseInt`.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} string The string to convert.
+     * @param {number} [radix] The radix to interpret `value` by.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {number} Returns the converted integer.
+     * @example
+     *
+     * _.parseInt('08');
+     * // => 8
+     *
+     * _.map(['6', '08', '10'], _.parseInt);
+     * // => [6, 8, 10]
+     */
+    function parseInt(string, radix, guard) {
+      // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
+      // Chrome fails to trim leading <BOM> whitespace characters.
+      // See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
+      if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
+        radix = 0;
+      } else if (radix) {
+        radix = +radix;
+      }
+      string = trim(string);
+      return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
+    }
+
+    /**
+     * Repeats the given string `n` times.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to repeat.
+     * @param {number} [n=0] The number of times to repeat the string.
+     * @returns {string} Returns the repeated string.
+     * @example
+     *
+     * _.repeat('*', 3);
+     * // => '***'
+     *
+     * _.repeat('abc', 2);
+     * // => 'abcabc'
+     *
+     * _.repeat('abc', 0);
+     * // => ''
+     */
+    function repeat(string, n) {
+      var result = '';
+      string = baseToString(string);
+      n = +n;
+      if (n < 1 || !string || !nativeIsFinite(n)) {
+        return result;
+      }
+      // Leverage the exponentiation by squaring algorithm for a faster repeat.
+      // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
+      do {
+        if (n % 2) {
+          result += string;
+        }
+        n = nativeFloor(n / 2);
+        string += string;
+      } while (n);
+
+      return result;
+    }
+
+    /**
+     * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the snake cased string.
+     * @example
+     *
+     * _.snakeCase('Foo Bar');
+     * // => 'foo_bar'
+     *
+     * _.snakeCase('fooBar');
+     * // => 'foo_bar'
+     *
+     * _.snakeCase('--foo-bar');
+     * // => 'foo_bar'
+     */
+    var snakeCase = createCompounder(function(result, word, index) {
+      return result + (index ? '_' : '') + word.toLowerCase();
+    });
+
+    /**
+     * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the start cased string.
+     * @example
+     *
+     * _.startCase('--foo-bar');
+     * // => 'Foo Bar'
+     *
+     * _.startCase('fooBar');
+     * // => 'Foo Bar'
+     *
+     * _.startCase('__foo_bar__');
+     * // => 'Foo Bar'
+     */
+    var startCase = createCompounder(function(result, word, index) {
+      return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));
+    });
+
+    /**
+     * Checks if `string` starts with the given target string.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to search.
+     * @param {string} [target] The string to search for.
+     * @param {number} [position=0] The position to search from.
+     * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`.
+     * @example
+     *
+     * _.startsWith('abc', 'a');
+     * // => true
+     *
+     * _.startsWith('abc', 'b');
+     * // => false
+     *
+     * _.startsWith('abc', 'b', 1);
+     * // => true
+     */
+    function startsWith(string, target, position) {
+      string = baseToString(string);
+      position = position == null
+        ? 0
+        : nativeMin(position < 0 ? 0 : (+position || 0), string.length);
+
+      return string.lastIndexOf(target, position) == position;
+    }
+
+    /**
+     * Creates a compiled template function that can interpolate data properties
+     * in "interpolate" delimiters, HTML-escape interpolated data properties in
+     * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
+     * properties may be accessed as free variables in the template. If a setting
+     * object is provided it takes precedence over `_.templateSettings` values.
+     *
+     * **Note:** In the development build `_.template` utilizes
+     * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
+     * for easier debugging.
+     *
+     * For more information on precompiling templates see
+     * [lodash's custom builds documentation](https://lodash.com/custom-builds).
+     *
+     * For more information on Chrome extension sandboxes see
+     * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The template string.
+     * @param {Object} [options] The options object.
+     * @param {RegExp} [options.escape] The HTML "escape" delimiter.
+     * @param {RegExp} [options.evaluate] The "evaluate" delimiter.
+     * @param {Object} [options.imports] An object to import into the template as free variables.
+     * @param {RegExp} [options.interpolate] The "interpolate" delimiter.
+     * @param {string} [options.sourceURL] The sourceURL of the template's compiled source.
+     * @param {string} [options.variable] The data object variable name.
+     * @param- {Object} [otherOptions] Enables the legacy `options` param signature.
+     * @returns {Function} Returns the compiled template function.
+     * @example
+     *
+     * // using the "interpolate" delimiter to create a compiled template
+     * var compiled = _.template('hello <%= user %>!');
+     * compiled({ 'user': 'fred' });
+     * // => 'hello fred!'
+     *
+     * // using the HTML "escape" delimiter to escape data property values
+     * var compiled = _.template('<b><%- value %></b>');
+     * compiled({ 'value': '<script>' });
+     * // => '<b>&lt;script&gt;</b>'
+     *
+     * // using the "evaluate" delimiter to execute JavaScript and generate HTML
+     * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
+     * compiled({ 'users': ['fred', 'barney'] });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // using the internal `print` function in "evaluate" delimiters
+     * var compiled = _.template('<% print("hello " + user); %>!');
+     * compiled({ 'user': 'barney' });
+     * // => 'hello barney!'
+     *
+     * // using the ES delimiter as an alternative to the default "interpolate" delimiter
+     * var compiled = _.template('hello ${ user }!');
+     * compiled({ 'user': 'pebbles' });
+     * // => 'hello pebbles!'
+     *
+     * // using custom template delimiters
+     * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
+     * var compiled = _.template('hello {{ user }}!');
+     * compiled({ 'user': 'mustache' });
+     * // => 'hello mustache!'
+     *
+     * // using backslashes to treat delimiters as plain text
+     * var compiled = _.template('<%= "\\<%- value %\\>" %>');
+     * compiled({ 'value': 'ignored' });
+     * // => '<%- value %>'
+     *
+     * // using the `imports` option to import `jQuery` as `jq`
+     * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
+     * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
+     * compiled({ 'users': ['fred', 'barney'] });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // using the `sourceURL` option to specify a custom sourceURL for the template
+     * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
+     * compiled(data);
+     * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
+     *
+     * // using the `variable` option to ensure a with-statement isn't used in the compiled template
+     * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
+     * compiled.source;
+     * // => function(data) {
+     * //   var __t, __p = '';
+     * //   __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
+     * //   return __p;
+     * // }
+     *
+     * // using the `source` property to inline compiled templates for meaningful
+     * // line numbers in error messages and a stack trace
+     * fs.writeFileSync(path.join(cwd, 'jst.js'), '\
+     *   var JST = {\
+     *     "main": ' + _.template(mainText).source + '\
+     *   };\
+     * ');
+     */
+    function template(string, options, otherOptions) {
+      // Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/)
+      // and Laura Doktorova's doT.js (https://github.com/olado/doT).
+      var settings = lodash.templateSettings;
+
+      if (otherOptions && isIterateeCall(string, options, otherOptions)) {
+        options = otherOptions = undefined;
+      }
+      string = baseToString(string);
+      options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);
+
+      var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults),
+          importsKeys = keys(imports),
+          importsValues = baseValues(imports, importsKeys);
+
+      var isEscaping,
+          isEvaluating,
+          index = 0,
+          interpolate = options.interpolate || reNoMatch,
+          source = "__p += '";
+
+      // Compile the regexp to match each delimiter.
+      var reDelimiters = RegExp(
+        (options.escape || reNoMatch).source + '|' +
+        interpolate.source + '|' +
+        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
+        (options.evaluate || reNoMatch).source + '|$'
+      , 'g');
+
+      // Use a sourceURL for easier debugging.
+      var sourceURL = '//# sourceURL=' +
+        ('sourceURL' in options
+          ? options.sourceURL
+          : ('lodash.templateSources[' + (++templateCounter) + ']')
+        ) + '\n';
+
+      string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
+        interpolateValue || (interpolateValue = esTemplateValue);
+
+        // Escape characters that can't be included in string literals.
+        source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
+
+        // Replace delimiters with snippets.
+        if (escapeValue) {
+          isEscaping = true;
+          source += "' +\n__e(" + escapeValue + ") +\n'";
+        }
+        if (evaluateValue) {
+          isEvaluating = true;
+          source += "';\n" + evaluateValue + ";\n__p += '";
+        }
+        if (interpolateValue) {
+          source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
+        }
+        index = offset + match.length;
+
+        // The JS engine embedded in Adobe products requires returning the `match`
+        // string in order to produce the correct `offset` value.
+        return match;
+      });
+
+      source += "';\n";
+
+      // If `variable` is not specified wrap a with-statement around the generated
+      // code to add the data object to the top of the scope chain.
+      var variable = options.variable;
+      if (!variable) {
+        source = 'with (obj) {\n' + source + '\n}\n';
+      }
+      // Cleanup code by stripping empty strings.
+      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
+        .replace(reEmptyStringMiddle, '$1')
+        .replace(reEmptyStringTrailing, '$1;');
+
+      // Frame code as the function body.
+      source = 'function(' + (variable || 'obj') + ') {\n' +
+        (variable
+          ? ''
+          : 'obj || (obj = {});\n'
+        ) +
+        "var __t, __p = ''" +
+        (isEscaping
+           ? ', __e = _.escape'
+           : ''
+        ) +
+        (isEvaluating
+          ? ', __j = Array.prototype.join;\n' +
+            "function print() { __p += __j.call(arguments, '') }\n"
+          : ';\n'
+        ) +
+        source +
+        'return __p\n}';
+
+      var result = attempt(function() {
+        return Function(importsKeys, sourceURL + 'return ' + source).apply(undefined, importsValues);
+      });
+
+      // Provide the compiled function's source by its `toString` method or
+      // the `source` property as a convenience for inlining compiled templates.
+      result.source = source;
+      if (isError(result)) {
+        throw result;
+      }
+      return result;
+    }
+
+    /**
+     * Removes leading and trailing whitespace or specified characters from `string`.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to trim.
+     * @param {string} [chars=whitespace] The characters to trim.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {string} Returns the trimmed string.
+     * @example
+     *
+     * _.trim('  abc  ');
+     * // => 'abc'
+     *
+     * _.trim('-_-abc-_-', '_-');
+     * // => 'abc'
+     *
+     * _.map(['  foo  ', '  bar  '], _.trim);
+     * // => ['foo', 'bar']
+     */
+    function trim(string, chars, guard) {
+      var value = string;
+      string = baseToString(string);
+      if (!string) {
+        return string;
+      }
+      if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
+        return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1);
+      }
+      chars = (chars + '');
+      return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1);
+    }
+
+    /**
+     * Removes leading whitespace or specified characters from `string`.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to trim.
+     * @param {string} [chars=whitespace] The characters to trim.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {string} Returns the trimmed string.
+     * @example
+     *
+     * _.trimLeft('  abc  ');
+     * // => 'abc  '
+     *
+     * _.trimLeft('-_-abc-_-', '_-');
+     * // => 'abc-_-'
+     */
+    function trimLeft(string, chars, guard) {
+      var value = string;
+      string = baseToString(string);
+      if (!string) {
+        return string;
+      }
+      if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
+        return string.slice(trimmedLeftIndex(string));
+      }
+      return string.slice(charsLeftIndex(string, (chars + '')));
+    }
+
+    /**
+     * Removes trailing whitespace or specified characters from `string`.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to trim.
+     * @param {string} [chars=whitespace] The characters to trim.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {string} Returns the trimmed string.
+     * @example
+     *
+     * _.trimRight('  abc  ');
+     * // => '  abc'
+     *
+     * _.trimRight('-_-abc-_-', '_-');
+     * // => '-_-abc'
+     */
+    function trimRight(string, chars, guard) {
+      var value = string;
+      string = baseToString(string);
+      if (!string) {
+        return string;
+      }
+      if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
+        return string.slice(0, trimmedRightIndex(string) + 1);
+      }
+      return string.slice(0, charsRightIndex(string, (chars + '')) + 1);
+    }
+
+    /**
+     * Truncates `string` if it's longer than the given maximum string length.
+     * The last characters of the truncated string are replaced with the omission
+     * string which defaults to "...".
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to truncate.
+     * @param {Object|number} [options] The options object or maximum string length.
+     * @param {number} [options.length=30] The maximum string length.
+     * @param {string} [options.omission='...'] The string to indicate text is omitted.
+     * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {string} Returns the truncated string.
+     * @example
+     *
+     * _.trunc('hi-diddly-ho there, neighborino');
+     * // => 'hi-diddly-ho there, neighbo...'
+     *
+     * _.trunc('hi-diddly-ho there, neighborino', 24);
+     * // => 'hi-diddly-ho there, n...'
+     *
+     * _.trunc('hi-diddly-ho there, neighborino', {
+     *   'length': 24,
+     *   'separator': ' '
+     * });
+     * // => 'hi-diddly-ho there,...'
+     *
+     * _.trunc('hi-diddly-ho there, neighborino', {
+     *   'length': 24,
+     *   'separator': /,? +/
+     * });
+     * // => 'hi-diddly-ho there...'
+     *
+     * _.trunc('hi-diddly-ho there, neighborino', {
+     *   'omission': ' [...]'
+     * });
+     * // => 'hi-diddly-ho there, neig [...]'
+     */
+    function trunc(string, options, guard) {
+      if (guard && isIterateeCall(string, options, guard)) {
+        options = undefined;
+      }
+      var length = DEFAULT_TRUNC_LENGTH,
+          omission = DEFAULT_TRUNC_OMISSION;
+
+      if (options != null) {
+        if (isObject(options)) {
+          var separator = 'separator' in options ? options.separator : separator;
+          length = 'length' in options ? (+options.length || 0) : length;
+          omission = 'omission' in options ? baseToString(options.omission) : omission;
+        } else {
+          length = +options || 0;
+        }
+      }
+      string = baseToString(string);
+      if (length >= string.length) {
+        return string;
+      }
+      var end = length - omission.length;
+      if (end < 1) {
+        return omission;
+      }
+      var result = string.slice(0, end);
+      if (separator == null) {
+        return result + omission;
+      }
+      if (isRegExp(separator)) {
+        if (string.slice(end).search(separator)) {
+          var match,
+              newEnd,
+              substring = string.slice(0, end);
+
+          if (!separator.global) {
+            separator = RegExp(separator.source, (reFlags.exec(separator) || '') + 'g');
+          }
+          separator.lastIndex = 0;
+          while ((match = separator.exec(substring))) {
+            newEnd = match.index;
+          }
+          result = result.slice(0, newEnd == null ? end : newEnd);
+        }
+      } else if (string.indexOf(separator, end) != end) {
+        var index = result.lastIndexOf(separator);
+        if (index > -1) {
+          result = result.slice(0, index);
+        }
+      }
+      return result + omission;
+    }
+
+    /**
+     * The inverse of `_.escape`; this method converts the HTML entities
+     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, `&#39;`, and `&#96;` in `string` to their
+     * corresponding characters.
+     *
+     * **Note:** No other HTML entities are unescaped. To unescape additional HTML
+     * entities use a third-party library like [_he_](https://mths.be/he).
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to unescape.
+     * @returns {string} Returns the unescaped string.
+     * @example
+     *
+     * _.unescape('fred, barney, &amp; pebbles');
+     * // => 'fred, barney, & pebbles'
+     */
+    function unescape(string) {
+      string = baseToString(string);
+      return (string && reHasEscapedHtml.test(string))
+        ? string.replace(reEscapedHtml, unescapeHtmlChar)
+        : string;
+    }
+
+    /**
+     * Splits `string` into an array of its words.
+     *
+     * @static
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to inspect.
+     * @param {RegExp|string} [pattern] The pattern to match words.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Array} Returns the words of `string`.
+     * @example
+     *
+     * _.words('fred, barney, & pebbles');
+     * // => ['fred', 'barney', 'pebbles']
+     *
+     * _.words('fred, barney, & pebbles', /[^, ]+/g);
+     * // => ['fred', 'barney', '&', 'pebbles']
+     */
+    function words(string, pattern, guard) {
+      if (guard && isIterateeCall(string, pattern, guard)) {
+        pattern = undefined;
+      }
+      string = baseToString(string);
+      return string.match(pattern || reWords) || [];
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Attempts to invoke `func`, returning either the result or the caught error
+     * object. Any additional arguments are provided to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {Function} func The function to attempt.
+     * @returns {*} Returns the `func` result or error object.
+     * @example
+     *
+     * // avoid throwing errors for invalid selectors
+     * var elements = _.attempt(function(selector) {
+     *   return document.querySelectorAll(selector);
+     * }, '>_>');
+     *
+     * if (_.isError(elements)) {
+     *   elements = [];
+     * }
+     */
+    var attempt = restParam(function(func, args) {
+      try {
+        return func.apply(undefined, args);
+      } catch(e) {
+        return isError(e) ? e : new Error(e);
+      }
+    });
+
+    /**
+     * Creates a function that invokes `func` with the `this` binding of `thisArg`
+     * and arguments of the created function. If `func` is a property name the
+     * created callback returns the property value for a given element. If `func`
+     * is an object the created callback returns `true` for elements that contain
+     * the equivalent object properties, otherwise it returns `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias iteratee
+     * @category Utility
+     * @param {*} [func=_.identity] The value to convert to a callback.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+     * @returns {Function} Returns the callback.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36 },
+     *   { 'user': 'fred',   'age': 40 }
+     * ];
+     *
+     * // wrap to create custom callback shorthands
+     * _.callback = _.wrap(_.callback, function(callback, func, thisArg) {
+     *   var match = /^(.+?)__([gl]t)(.+)$/.exec(func);
+     *   if (!match) {
+     *     return callback(func, thisArg);
+     *   }
+     *   return function(object) {
+     *     return match[2] == 'gt'
+     *       ? object[match[1]] > match[3]
+     *       : object[match[1]] < match[3];
+     *   };
+     * });
+     *
+     * _.filter(users, 'age__gt36');
+     * // => [{ 'user': 'fred', 'age': 40 }]
+     */
+    function callback(func, thisArg, guard) {
+      if (guard && isIterateeCall(func, thisArg, guard)) {
+        thisArg = undefined;
+      }
+      return isObjectLike(func)
+        ? matches(func)
+        : baseCallback(func, thisArg);
+    }
+
+    /**
+     * Creates a function that returns `value`.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {*} value The value to return from the new function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var object = { 'user': 'fred' };
+     * var getter = _.constant(object);
+     *
+     * getter() === object;
+     * // => true
+     */
+    function constant(value) {
+      return function() {
+        return value;
+      };
+    }
+
+    /**
+     * This method returns the first argument provided to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {*} value Any value.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * var object = { 'user': 'fred' };
+     *
+     * _.identity(object) === object;
+     * // => true
+     */
+    function identity(value) {
+      return value;
+    }
+
+    /**
+     * Creates a function that performs a deep comparison between a given object
+     * and `source`, returning `true` if the given object has equivalent property
+     * values, else `false`.
+     *
+     * **Note:** This method supports comparing arrays, booleans, `Date` objects,
+     * numbers, `Object` objects, regexes, and strings. Objects are compared by
+     * their own, not inherited, enumerable properties. For comparing a single
+     * own or inherited property value see `_.matchesProperty`.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {Object} source The object of property values to match.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36, 'active': true },
+     *   { 'user': 'fred',   'age': 40, 'active': false }
+     * ];
+     *
+     * _.filter(users, _.matches({ 'age': 40, 'active': false }));
+     * // => [{ 'user': 'fred', 'age': 40, 'active': false }]
+     */
+    function matches(source) {
+      return baseMatches(baseClone(source, true));
+    }
+
+    /**
+     * Creates a function that compares the property value of `path` on a given
+     * object to `value`.
+     *
+     * **Note:** This method supports comparing arrays, booleans, `Date` objects,
+     * numbers, `Object` objects, regexes, and strings. Objects are compared by
+     * their own, not inherited, enumerable properties.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {Array|string} path The path of the property to get.
+     * @param {*} srcValue The value to match.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney' },
+     *   { 'user': 'fred' }
+     * ];
+     *
+     * _.find(users, _.matchesProperty('user', 'fred'));
+     * // => { 'user': 'fred' }
+     */
+    function matchesProperty(path, srcValue) {
+      return baseMatchesProperty(path, baseClone(srcValue, true));
+    }
+
+    /**
+     * Creates a function that invokes the method at `path` on a given object.
+     * Any additional arguments are provided to the invoked method.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {Array|string} path The path of the method to invoke.
+     * @param {...*} [args] The arguments to invoke the method with.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var objects = [
+     *   { 'a': { 'b': { 'c': _.constant(2) } } },
+     *   { 'a': { 'b': { 'c': _.constant(1) } } }
+     * ];
+     *
+     * _.map(objects, _.method('a.b.c'));
+     * // => [2, 1]
+     *
+     * _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
+     * // => [1, 2]
+     */
+    var method = restParam(function(path, args) {
+      return function(object) {
+        return invokePath(object, path, args);
+      };
+    });
+
+    /**
+     * The opposite of `_.method`; this method creates a function that invokes
+     * the method at a given path on `object`. Any additional arguments are
+     * provided to the invoked method.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {Object} object The object to query.
+     * @param {...*} [args] The arguments to invoke the method with.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var array = _.times(3, _.constant),
+     *     object = { 'a': array, 'b': array, 'c': array };
+     *
+     * _.map(['a[2]', 'c[0]'], _.methodOf(object));
+     * // => [2, 0]
+     *
+     * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
+     * // => [2, 0]
+     */
+    var methodOf = restParam(function(object, args) {
+      return function(path) {
+        return invokePath(object, path, args);
+      };
+    });
+
+    /**
+     * Adds all own enumerable function properties of a source object to the
+     * destination object. If `object` is a function then methods are added to
+     * its prototype as well.
+     *
+     * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
+     * avoid conflicts caused by modifying the original.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {Function|Object} [object=lodash] The destination object.
+     * @param {Object} source The object of functions to add.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.chain=true] Specify whether the functions added
+     *  are chainable.
+     * @returns {Function|Object} Returns `object`.
+     * @example
+     *
+     * function vowels(string) {
+     *   return _.filter(string, function(v) {
+     *     return /[aeiou]/i.test(v);
+     *   });
+     * }
+     *
+     * _.mixin({ 'vowels': vowels });
+     * _.vowels('fred');
+     * // => ['e']
+     *
+     * _('fred').vowels().value();
+     * // => ['e']
+     *
+     * _.mixin({ 'vowels': vowels }, { 'chain': false });
+     * _('fred').vowels();
+     * // => ['e']
+     */
+    function mixin(object, source, options) {
+      if (options == null) {
+        var isObj = isObject(source),
+            props = isObj ? keys(source) : undefined,
+            methodNames = (props && props.length) ? baseFunctions(source, props) : undefined;
+
+        if (!(methodNames ? methodNames.length : isObj)) {
+          methodNames = false;
+          options = source;
+          source = object;
+          object = this;
+        }
+      }
+      if (!methodNames) {
+        methodNames = baseFunctions(source, keys(source));
+      }
+      var chain = true,
+          index = -1,
+          isFunc = isFunction(object),
+          length = methodNames.length;
+
+      if (options === false) {
+        chain = false;
+      } else if (isObject(options) && 'chain' in options) {
+        chain = options.chain;
+      }
+      while (++index < length) {
+        var methodName = methodNames[index],
+            func = source[methodName];
+
+        object[methodName] = func;
+        if (isFunc) {
+          object.prototype[methodName] = (function(func) {
+            return function() {
+              var chainAll = this.__chain__;
+              if (chain || chainAll) {
+                var result = object(this.__wrapped__),
+                    actions = result.__actions__ = arrayCopy(this.__actions__);
+
+                actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
+                result.__chain__ = chainAll;
+                return result;
+              }
+              return func.apply(object, arrayPush([this.value()], arguments));
+            };
+          }(func));
+        }
+      }
+      return object;
+    }
+
+    /**
+     * Reverts the `_` variable to its previous value and returns a reference to
+     * the `lodash` function.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @returns {Function} Returns the `lodash` function.
+     * @example
+     *
+     * var lodash = _.noConflict();
+     */
+    function noConflict() {
+      root._ = oldDash;
+      return this;
+    }
+
+    /**
+     * A no-operation function that returns `undefined` regardless of the
+     * arguments it receives.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @example
+     *
+     * var object = { 'user': 'fred' };
+     *
+     * _.noop(object) === undefined;
+     * // => true
+     */
+    function noop() {
+      // No operation performed.
+    }
+
+    /**
+     * Creates a function that returns the property value at `path` on a
+     * given object.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {Array|string} path The path of the property to get.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var objects = [
+     *   { 'a': { 'b': { 'c': 2 } } },
+     *   { 'a': { 'b': { 'c': 1 } } }
+     * ];
+     *
+     * _.map(objects, _.property('a.b.c'));
+     * // => [2, 1]
+     *
+     * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
+     * // => [1, 2]
+     */
+    function property(path) {
+      return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
+    }
+
+    /**
+     * The opposite of `_.property`; this method creates a function that returns
+     * the property value at a given path on `object`.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {Object} object The object to query.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var array = [0, 1, 2],
+     *     object = { 'a': array, 'b': array, 'c': array };
+     *
+     * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
+     * // => [2, 0]
+     *
+     * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
+     * // => [2, 0]
+     */
+    function propertyOf(object) {
+      return function(path) {
+        return baseGet(object, toPath(path), path + '');
+      };
+    }
+
+    /**
+     * Creates an array of numbers (positive and/or negative) progressing from
+     * `start` up to, but not including, `end`. If `end` is not specified it is
+     * set to `start` with `start` then set to `0`. If `end` is less than `start`
+     * a zero-length range is created unless a negative `step` is specified.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {number} [start=0] The start of the range.
+     * @param {number} end The end of the range.
+     * @param {number} [step=1] The value to increment or decrement by.
+     * @returns {Array} Returns the new array of numbers.
+     * @example
+     *
+     * _.range(4);
+     * // => [0, 1, 2, 3]
+     *
+     * _.range(1, 5);
+     * // => [1, 2, 3, 4]
+     *
+     * _.range(0, 20, 5);
+     * // => [0, 5, 10, 15]
+     *
+     * _.range(0, -4, -1);
+     * // => [0, -1, -2, -3]
+     *
+     * _.range(1, 4, 0);
+     * // => [1, 1, 1]
+     *
+     * _.range(0);
+     * // => []
+     */
+    function range(start, end, step) {
+      if (step && isIterateeCall(start, end, step)) {
+        end = step = undefined;
+      }
+      start = +start || 0;
+      step = step == null ? 1 : (+step || 0);
+
+      if (end == null) {
+        end = start;
+        start = 0;
+      } else {
+        end = +end || 0;
+      }
+      // Use `Array(length)` so engines like Chakra and V8 avoid slower modes.
+      // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details.
+      var index = -1,
+          length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
+          result = Array(length);
+
+      while (++index < length) {
+        result[index] = start;
+        start += step;
+      }
+      return result;
+    }
+
+    /**
+     * Invokes the iteratee function `n` times, returning an array of the results
+     * of each invocation. The `iteratee` is bound to `thisArg` and invoked with
+     * one argument; (index).
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {number} n The number of times to invoke `iteratee`.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {Array} Returns the array of results.
+     * @example
+     *
+     * var diceRolls = _.times(3, _.partial(_.random, 1, 6, false));
+     * // => [3, 6, 4]
+     *
+     * _.times(3, function(n) {
+     *   mage.castSpell(n);
+     * });
+     * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2`
+     *
+     * _.times(3, function(n) {
+     *   this.cast(n);
+     * }, mage);
+     * // => also invokes `mage.castSpell(n)` three times
+     */
+    function times(n, iteratee, thisArg) {
+      n = nativeFloor(n);
+
+      // Exit early to avoid a JSC JIT bug in Safari 8
+      // where `Array(0)` is treated as `Array(1)`.
+      if (n < 1 || !nativeIsFinite(n)) {
+        return [];
+      }
+      var index = -1,
+          result = Array(nativeMin(n, MAX_ARRAY_LENGTH));
+
+      iteratee = bindCallback(iteratee, thisArg, 1);
+      while (++index < n) {
+        if (index < MAX_ARRAY_LENGTH) {
+          result[index] = iteratee(index);
+        } else {
+          iteratee(index);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Generates a unique ID. If `prefix` is provided the ID is appended to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utility
+     * @param {string} [prefix] The value to prefix the ID with.
+     * @returns {string} Returns the unique ID.
+     * @example
+     *
+     * _.uniqueId('contact_');
+     * // => 'contact_104'
+     *
+     * _.uniqueId();
+     * // => '105'
+     */
+    function uniqueId(prefix) {
+      var id = ++idCounter;
+      return baseToString(prefix) + id;
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Adds two numbers.
+     *
+     * @static
+     * @memberOf _
+     * @category Math
+     * @param {number} augend The first number to add.
+     * @param {number} addend The second number to add.
+     * @returns {number} Returns the sum.
+     * @example
+     *
+     * _.add(6, 4);
+     * // => 10
+     */
+    function add(augend, addend) {
+      return (+augend || 0) + (+addend || 0);
+    }
+
+    /**
+     * Calculates `n` rounded up to `precision`.
+     *
+     * @static
+     * @memberOf _
+     * @category Math
+     * @param {number} n The number to round up.
+     * @param {number} [precision=0] The precision to round up to.
+     * @returns {number} Returns the rounded up number.
+     * @example
+     *
+     * _.ceil(4.006);
+     * // => 5
+     *
+     * _.ceil(6.004, 2);
+     * // => 6.01
+     *
+     * _.ceil(6040, -2);
+     * // => 6100
+     */
+    var ceil = createRound('ceil');
+
+    /**
+     * Calculates `n` rounded down to `precision`.
+     *
+     * @static
+     * @memberOf _
+     * @category Math
+     * @param {number} n The number to round down.
+     * @param {number} [precision=0] The precision to round down to.
+     * @returns {number} Returns the rounded down number.
+     * @example
+     *
+     * _.floor(4.006);
+     * // => 4
+     *
+     * _.floor(0.046, 2);
+     * // => 0.04
+     *
+     * _.floor(4060, -2);
+     * // => 4000
+     */
+    var floor = createRound('floor');
+
+    /**
+     * Gets the maximum value of `collection`. If `collection` is empty or falsey
+     * `-Infinity` is returned. If an iteratee function is provided it is invoked
+     * for each value in `collection` to generate the criterion by which the value
+     * is ranked. The `iteratee` is bound to `thisArg` and invoked with three
+     * arguments: (value, index, collection).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Math
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [iteratee] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {*} Returns the maximum value.
+     * @example
+     *
+     * _.max([4, 2, 8, 6]);
+     * // => 8
+     *
+     * _.max([]);
+     * // => -Infinity
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36 },
+     *   { 'user': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.max(users, function(chr) {
+     *   return chr.age;
+     * });
+     * // => { 'user': 'fred', 'age': 40 }
+     *
+     * // using the `_.property` callback shorthand
+     * _.max(users, 'age');
+     * // => { 'user': 'fred', 'age': 40 }
+     */
+    var max = createExtremum(gt, NEGATIVE_INFINITY);
+
+    /**
+     * Gets the minimum value of `collection`. If `collection` is empty or falsey
+     * `Infinity` is returned. If an iteratee function is provided it is invoked
+     * for each value in `collection` to generate the criterion by which the value
+     * is ranked. The `iteratee` is bound to `thisArg` and invoked with three
+     * arguments: (value, index, collection).
+     *
+     * If a property name is provided for `iteratee` the created `_.property`
+     * style callback returns the property value of the given element.
+     *
+     * If a value is also provided for `thisArg` the created `_.matchesProperty`
+     * style callback returns `true` for elements that have a matching property
+     * value, else `false`.
+     *
+     * If an object is provided for `iteratee` the created `_.matches` style
+     * callback returns `true` for elements that have the properties of the given
+     * object, else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Math
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [iteratee] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {*} Returns the minimum value.
+     * @example
+     *
+     * _.min([4, 2, 8, 6]);
+     * // => 2
+     *
+     * _.min([]);
+     * // => Infinity
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36 },
+     *   { 'user': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.min(users, function(chr) {
+     *   return chr.age;
+     * });
+     * // => { 'user': 'barney', 'age': 36 }
+     *
+     * // using the `_.property` callback shorthand
+     * _.min(users, 'age');
+     * // => { 'user': 'barney', 'age': 36 }
+     */
+    var min = createExtremum(lt, POSITIVE_INFINITY);
+
+    /**
+     * Calculates `n` rounded to `precision`.
+     *
+     * @static
+     * @memberOf _
+     * @category Math
+     * @param {number} n The number to round.
+     * @param {number} [precision=0] The precision to round to.
+     * @returns {number} Returns the rounded number.
+     * @example
+     *
+     * _.round(4.006);
+     * // => 4
+     *
+     * _.round(4.006, 2);
+     * // => 4.01
+     *
+     * _.round(4060, -2);
+     * // => 4100
+     */
+    var round = createRound('round');
+
+    /**
+     * Gets the sum of the values in `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @category Math
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [iteratee] The function invoked per iteration.
+     * @param {*} [thisArg] The `this` binding of `iteratee`.
+     * @returns {number} Returns the sum.
+     * @example
+     *
+     * _.sum([4, 6]);
+     * // => 10
+     *
+     * _.sum({ 'a': 4, 'b': 6 });
+     * // => 10
+     *
+     * var objects = [
+     *   { 'n': 4 },
+     *   { 'n': 6 }
+     * ];
+     *
+     * _.sum(objects, function(object) {
+     *   return object.n;
+     * });
+     * // => 10
+     *
+     * // using the `_.property` callback shorthand
+     * _.sum(objects, 'n');
+     * // => 10
+     */
+    function sum(collection, iteratee, thisArg) {
+      if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
+        iteratee = undefined;
+      }
+      iteratee = getCallback(iteratee, thisArg, 3);
+      return iteratee.length == 1
+        ? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee)
+        : baseSum(collection, iteratee);
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    // Ensure wrappers are instances of `baseLodash`.
+    lodash.prototype = baseLodash.prototype;
+
+    LodashWrapper.prototype = baseCreate(baseLodash.prototype);
+    LodashWrapper.prototype.constructor = LodashWrapper;
+
+    LazyWrapper.prototype = baseCreate(baseLodash.prototype);
+    LazyWrapper.prototype.constructor = LazyWrapper;
+
+    // Add functions to the `Map` cache.
+    MapCache.prototype['delete'] = mapDelete;
+    MapCache.prototype.get = mapGet;
+    MapCache.prototype.has = mapHas;
+    MapCache.prototype.set = mapSet;
+
+    // Add functions to the `Set` cache.
+    SetCache.prototype.push = cachePush;
+
+    // Assign cache to `_.memoize`.
+    memoize.Cache = MapCache;
+
+    // Add functions that return wrapped values when chaining.
+    lodash.after = after;
+    lodash.ary = ary;
+    lodash.assign = assign;
+    lodash.at = at;
+    lodash.before = before;
+    lodash.bind = bind;
+    lodash.bindAll = bindAll;
+    lodash.bindKey = bindKey;
+    lodash.callback = callback;
+    lodash.chain = chain;
+    lodash.chunk = chunk;
+    lodash.compact = compact;
+    lodash.constant = constant;
+    lodash.countBy = countBy;
+    lodash.create = create;
+    lodash.curry = curry;
+    lodash.curryRight = curryRight;
+    lodash.debounce = debounce;
+    lodash.defaults = defaults;
+    lodash.defaultsDeep = defaultsDeep;
+    lodash.defer = defer;
+    lodash.delay = delay;
+    lodash.difference = difference;
+    lodash.drop = drop;
+    lodash.dropRight = dropRight;
+    lodash.dropRightWhile = dropRightWhile;
+    lodash.dropWhile = dropWhile;
+    lodash.fill = fill;
+    lodash.filter = filter;
+    lodash.flatten = flatten;
+    lodash.flattenDeep = flattenDeep;
+    lodash.flow = flow;
+    lodash.flowRight = flowRight;
+    lodash.forEach = forEach;
+    lodash.forEachRight = forEachRight;
+    lodash.forIn = forIn;
+    lodash.forInRight = forInRight;
+    lodash.forOwn = forOwn;
+    lodash.forOwnRight = forOwnRight;
+    lodash.functions = functions;
+    lodash.groupBy = groupBy;
+    lodash.indexBy = indexBy;
+    lodash.initial = initial;
+    lodash.intersection = intersection;
+    lodash.invert = invert;
+    lodash.invoke = invoke;
+    lodash.keys = keys;
+    lodash.keysIn = keysIn;
+    lodash.map = map;
+    lodash.mapKeys = mapKeys;
+    lodash.mapValues = mapValues;
+    lodash.matches = matches;
+    lodash.matchesProperty = matchesProperty;
+    lodash.memoize = memoize;
+    lodash.merge = merge;
+    lodash.method = method;
+    lodash.methodOf = methodOf;
+    lodash.mixin = mixin;
+    lodash.modArgs = modArgs;
+    lodash.negate = negate;
+    lodash.omit = omit;
+    lodash.once = once;
+    lodash.pairs = pairs;
+    lodash.partial = partial;
+    lodash.partialRight = partialRight;
+    lodash.partition = partition;
+    lodash.pick = pick;
+    lodash.pluck = pluck;
+    lodash.property = property;
+    lodash.propertyOf = propertyOf;
+    lodash.pull = pull;
+    lodash.pullAt = pullAt;
+    lodash.range = range;
+    lodash.rearg = rearg;
+    lodash.reject = reject;
+    lodash.remove = remove;
+    lodash.rest = rest;
+    lodash.restParam = restParam;
+    lodash.set = set;
+    lodash.shuffle = shuffle;
+    lodash.slice = slice;
+    lodash.sortBy = sortBy;
+    lodash.sortByAll = sortByAll;
+    lodash.sortByOrder = sortByOrder;
+    lodash.spread = spread;
+    lodash.take = take;
+    lodash.takeRight = takeRight;
+    lodash.takeRightWhile = takeRightWhile;
+    lodash.takeWhile = takeWhile;
+    lodash.tap = tap;
+    lodash.throttle = throttle;
+    lodash.thru = thru;
+    lodash.times = times;
+    lodash.toArray = toArray;
+    lodash.toPlainObject = toPlainObject;
+    lodash.transform = transform;
+    lodash.union = union;
+    lodash.uniq = uniq;
+    lodash.unzip = unzip;
+    lodash.unzipWith = unzipWith;
+    lodash.values = values;
+    lodash.valuesIn = valuesIn;
+    lodash.where = where;
+    lodash.without = without;
+    lodash.wrap = wrap;
+    lodash.xor = xor;
+    lodash.zip = zip;
+    lodash.zipObject = zipObject;
+    lodash.zipWith = zipWith;
+
+    // Add aliases.
+    lodash.backflow = flowRight;
+    lodash.collect = map;
+    lodash.compose = flowRight;
+    lodash.each = forEach;
+    lodash.eachRight = forEachRight;
+    lodash.extend = assign;
+    lodash.iteratee = callback;
+    lodash.methods = functions;
+    lodash.object = zipObject;
+    lodash.select = filter;
+    lodash.tail = rest;
+    lodash.unique = uniq;
+
+    // Add functions to `lodash.prototype`.
+    mixin(lodash, lodash);
+
+    /*------------------------------------------------------------------------*/
+
+    // Add functions that return unwrapped values when chaining.
+    lodash.add = add;
+    lodash.attempt = attempt;
+    lodash.camelCase = camelCase;
+    lodash.capitalize = capitalize;
+    lodash.ceil = ceil;
+    lodash.clone = clone;
+    lodash.cloneDeep = cloneDeep;
+    lodash.deburr = deburr;
+    lodash.endsWith = endsWith;
+    lodash.escape = escape;
+    lodash.escapeRegExp = escapeRegExp;
+    lodash.every = every;
+    lodash.find = find;
+    lodash.findIndex = findIndex;
+    lodash.findKey = findKey;
+    lodash.findLast = findLast;
+    lodash.findLastIndex = findLastIndex;
+    lodash.findLastKey = findLastKey;
+    lodash.findWhere = findWhere;
+    lodash.first = first;
+    lodash.floor = floor;
+    lodash.get = get;
+    lodash.gt = gt;
+    lodash.gte = gte;
+    lodash.has = has;
+    lodash.identity = identity;
+    lodash.includes = includes;
+    lodash.indexOf = indexOf;
+    lodash.inRange = inRange;
+    lodash.isArguments = isArguments;
+    lodash.isArray = isArray;
+    lodash.isBoolean = isBoolean;
+    lodash.isDate = isDate;
+    lodash.isElement = isElement;
+    lodash.isEmpty = isEmpty;
+    lodash.isEqual = isEqual;
+    lodash.isError = isError;
+    lodash.isFinite = isFinite;
+    lodash.isFunction = isFunction;
+    lodash.isMatch = isMatch;
+    lodash.isNaN = isNaN;
+    lodash.isNative = isNative;
+    lodash.isNull = isNull;
+    lodash.isNumber = isNumber;
+    lodash.isObject = isObject;
+    lodash.isPlainObject = isPlainObject;
+    lodash.isRegExp = isRegExp;
+    lodash.isString = isString;
+    lodash.isTypedArray = isTypedArray;
+    lodash.isUndefined = isUndefined;
+    lodash.kebabCase = kebabCase;
+    lodash.last = last;
+    lodash.lastIndexOf = lastIndexOf;
+    lodash.lt = lt;
+    lodash.lte = lte;
+    lodash.max = max;
+    lodash.min = min;
+    lodash.noConflict = noConflict;
+    lodash.noop = noop;
+    lodash.now = now;
+    lodash.pad = pad;
+    lodash.padLeft = padLeft;
+    lodash.padRight = padRight;
+    lodash.parseInt = parseInt;
+    lodash.random = random;
+    lodash.reduce = reduce;
+    lodash.reduceRight = reduceRight;
+    lodash.repeat = repeat;
+    lodash.result = result;
+    lodash.round = round;
+    lodash.runInContext = runInContext;
+    lodash.size = size;
+    lodash.snakeCase = snakeCase;
+    lodash.some = some;
+    lodash.sortedIndex = sortedIndex;
+    lodash.sortedLastIndex = sortedLastIndex;
+    lodash.startCase = startCase;
+    lodash.startsWith = startsWith;
+    lodash.sum = sum;
+    lodash.template = template;
+    lodash.trim = trim;
+    lodash.trimLeft = trimLeft;
+    lodash.trimRight = trimRight;
+    lodash.trunc = trunc;
+    lodash.unescape = unescape;
+    lodash.uniqueId = uniqueId;
+    lodash.words = words;
+
+    // Add aliases.
+    lodash.all = every;
+    lodash.any = some;
+    lodash.contains = includes;
+    lodash.eq = isEqual;
+    lodash.detect = find;
+    lodash.foldl = reduce;
+    lodash.foldr = reduceRight;
+    lodash.head = first;
+    lodash.include = includes;
+    lodash.inject = reduce;
+
+    mixin(lodash, (function() {
+      var source = {};
+      baseForOwn(lodash, function(func, methodName) {
+        if (!lodash.prototype[methodName]) {
+          source[methodName] = func;
+        }
+      });
+      return source;
+    }()), false);
+
+    /*------------------------------------------------------------------------*/
+
+    // Add functions capable of returning wrapped and unwrapped values when chaining.
+    lodash.sample = sample;
+
+    lodash.prototype.sample = function(n) {
+      if (!this.__chain__ && n == null) {
+        return sample(this.value());
+      }
+      return this.thru(function(value) {
+        return sample(value, n);
+      });
+    };
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * The semantic version number.
+     *
+     * @static
+     * @memberOf _
+     * @type string
+     */
+    lodash.VERSION = VERSION;
+
+    // Assign default placeholders.
+    arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
+      lodash[methodName].placeholder = lodash;
+    });
+
+    // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
+    arrayEach(['drop', 'take'], function(methodName, index) {
+      LazyWrapper.prototype[methodName] = function(n) {
+        var filtered = this.__filtered__;
+        if (filtered && !index) {
+          return new LazyWrapper(this);
+        }
+        n = n == null ? 1 : nativeMax(nativeFloor(n) || 0, 0);
+
+        var result = this.clone();
+        if (filtered) {
+          result.__takeCount__ = nativeMin(result.__takeCount__, n);
+        } else {
+          result.__views__.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') });
+        }
+        return result;
+      };
+
+      LazyWrapper.prototype[methodName + 'Right'] = function(n) {
+        return this.reverse()[methodName](n).reverse();
+      };
+    });
+
+    // Add `LazyWrapper` methods that accept an `iteratee` value.
+    arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
+      var type = index + 1,
+          isFilter = type != LAZY_MAP_FLAG;
+
+      LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
+        var result = this.clone();
+        result.__iteratees__.push({ 'iteratee': getCallback(iteratee, thisArg, 1), 'type': type });
+        result.__filtered__ = result.__filtered__ || isFilter;
+        return result;
+      };
+    });
+
+    // Add `LazyWrapper` methods for `_.first` and `_.last`.
+    arrayEach(['first', 'last'], function(methodName, index) {
+      var takeName = 'take' + (index ? 'Right' : '');
+
+      LazyWrapper.prototype[methodName] = function() {
+        return this[takeName](1).value()[0];
+      };
+    });
+
+    // Add `LazyWrapper` methods for `_.initial` and `_.rest`.
+    arrayEach(['initial', 'rest'], function(methodName, index) {
+      var dropName = 'drop' + (index ? '' : 'Right');
+
+      LazyWrapper.prototype[methodName] = function() {
+        return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
+      };
+    });
+
+    // Add `LazyWrapper` methods for `_.pluck` and `_.where`.
+    arrayEach(['pluck', 'where'], function(methodName, index) {
+      var operationName = index ? 'filter' : 'map',
+          createCallback = index ? baseMatches : property;
+
+      LazyWrapper.prototype[methodName] = function(value) {
+        return this[operationName](createCallback(value));
+      };
+    });
+
+    LazyWrapper.prototype.compact = function() {
+      return this.filter(identity);
+    };
+
+    LazyWrapper.prototype.reject = function(predicate, thisArg) {
+      predicate = getCallback(predicate, thisArg, 1);
+      return this.filter(function(value) {
+        return !predicate(value);
+      });
+    };
+
+    LazyWrapper.prototype.slice = function(start, end) {
+      start = start == null ? 0 : (+start || 0);
+
+      var result = this;
+      if (result.__filtered__ && (start > 0 || end < 0)) {
+        return new LazyWrapper(result);
+      }
+      if (start < 0) {
+        result = result.takeRight(-start);
+      } else if (start) {
+        result = result.drop(start);
+      }
+      if (end !== undefined) {
+        end = (+end || 0);
+        result = end < 0 ? result.dropRight(-end) : result.take(end - start);
+      }
+      return result;
+    };
+
+    LazyWrapper.prototype.takeRightWhile = function(predicate, thisArg) {
+      return this.reverse().takeWhile(predicate, thisArg).reverse();
+    };
+
+    LazyWrapper.prototype.toArray = function() {
+      return this.take(POSITIVE_INFINITY);
+    };
+
+    // Add `LazyWrapper` methods to `lodash.prototype`.
+    baseForOwn(LazyWrapper.prototype, function(func, methodName) {
+      var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName),
+          retUnwrapped = /^(?:first|last)$/.test(methodName),
+          lodashFunc = lodash[retUnwrapped ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName];
+
+      if (!lodashFunc) {
+        return;
+      }
+      lodash.prototype[methodName] = function() {
+        var args = retUnwrapped ? [1] : arguments,
+            chainAll = this.__chain__,
+            value = this.__wrapped__,
+            isHybrid = !!this.__actions__.length,
+            isLazy = value instanceof LazyWrapper,
+            iteratee = args[0],
+            useLazy = isLazy || isArray(value);
+
+        if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
+          // Avoid lazy use if the iteratee has a "length" value other than `1`.
+          isLazy = useLazy = false;
+        }
+        var interceptor = function(value) {
+          return (retUnwrapped && chainAll)
+            ? lodashFunc(value, 1)[0]
+            : lodashFunc.apply(undefined, arrayPush([value], args));
+        };
+
+        var action = { 'func': thru, 'args': [interceptor], 'thisArg': undefined },
+            onlyLazy = isLazy && !isHybrid;
+
+        if (retUnwrapped && !chainAll) {
+          if (onlyLazy) {
+            value = value.clone();
+            value.__actions__.push(action);
+            return func.call(value);
+          }
+          return lodashFunc.call(undefined, this.value())[0];
+        }
+        if (!retUnwrapped && useLazy) {
+          value = onlyLazy ? value : new LazyWrapper(this);
+          var result = func.apply(value, args);
+          result.__actions__.push(action);
+          return new LodashWrapper(result, chainAll);
+        }
+        return this.thru(interceptor);
+      };
+    });
+
+    // Add `Array` and `String` methods to `lodash.prototype`.
+    arrayEach(['join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) {
+      var func = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName],
+          chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
+          retUnwrapped = /^(?:join|pop|replace|shift)$/.test(methodName);
+
+      lodash.prototype[methodName] = function() {
+        var args = arguments;
+        if (retUnwrapped && !this.__chain__) {
+          return func.apply(this.value(), args);
+        }
+        return this[chainName](function(value) {
+          return func.apply(value, args);
+        });
+      };
+    });
+
+    // Map minified function names to their real names.
+    baseForOwn(LazyWrapper.prototype, function(func, methodName) {
+      var lodashFunc = lodash[methodName];
+      if (lodashFunc) {
+        var key = lodashFunc.name,
+            names = realNames[key] || (realNames[key] = []);
+
+        names.push({ 'name': methodName, 'func': lodashFunc });
+      }
+    });
+
+    realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }];
+
+    // Add functions to the lazy wrapper.
+    LazyWrapper.prototype.clone = lazyClone;
+    LazyWrapper.prototype.reverse = lazyReverse;
+    LazyWrapper.prototype.value = lazyValue;
+
+    // Add chaining functions to the `lodash` wrapper.
+    lodash.prototype.chain = wrapperChain;
+    lodash.prototype.commit = wrapperCommit;
+    lodash.prototype.concat = wrapperConcat;
+    lodash.prototype.plant = wrapperPlant;
+    lodash.prototype.reverse = wrapperReverse;
+    lodash.prototype.toString = wrapperToString;
+    lodash.prototype.run = lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
+
+    // Add function aliases to the `lodash` wrapper.
+    lodash.prototype.collect = lodash.prototype.map;
+    lodash.prototype.head = lodash.prototype.first;
+    lodash.prototype.select = lodash.prototype.filter;
+    lodash.prototype.tail = lodash.prototype.rest;
+
+    return lodash;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  // Export lodash.
+  var _ = runInContext();
+
+  // Some AMD build optimizers like r.js check for condition patterns like the following:
+  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+    // Expose lodash to the global object when an AMD loader is present to avoid
+    // errors in cases where lodash is loaded by a script tag and not intended
+    // as an AMD module. See http://requirejs.org/docs/errors.html#mismatch for
+    // more details.
+    root._ = _;
+
+    // Define as an anonymous module so, through path mapping, it can be
+    // referenced as the "underscore" module.
+    define(function() {
+      return _;
+    });
+  }
+  // Check for `exports` after `define` in case a build optimizer adds an `exports` object.
+  else if (freeExports && freeModule) {
+    // Export for Node.js or RingoJS.
+    if (moduleExports) {
+      (freeModule.exports = _)._ = _;
+    }
+    // Export for Rhino with CommonJS support.
+    else {
+      freeExports._ = _;
+    }
+  }
+  else {
+    // Export for a browser or Rhino.
+    root._ = _;
+  }
+}.call(this));
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}]},{},[1])(1)
+});
\ No newline at end of file
diff --git a/sourcecodes/scripts/font-awesome.css b/sourcecodes/scripts/font-awesome.css
new file mode 100644
index 00000000..b6ca4377
--- /dev/null
+++ b/sourcecodes/scripts/font-awesome.css
@@ -0,0 +1,821 @@
+/*!
+ *  Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome
+ *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
+ */
+/* FONT PATH
+ * -------------------------- */
+@font-face {
+  font-family: 'FontAwesome';
+  src: url('./fontawesome-webfont.eot?v=4.0.3');
+  src: url('./fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('./fontawesome-webfont.woff?v=4.0.3') format('woff'), url('./fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('./fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
+  font-weight: normal;
+  font-style: normal;
+}
+.fa {
+  display: inline-block;
+  font-family: FontAwesome;
+  font-style: normal;
+  font-weight: normal;
+  line-height: 1;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+/* makes the font 33% larger relative to the icon container */
+.fa-lg {
+  font-size: 1.3333333333333333em;
+  line-height: 0.75em;
+  vertical-align: -15%;
+}
+.fa-2x {
+  font-size: 2em;
+}
+.fa-3x {
+  font-size: 3em;
+}
+.fa-4x {
+  font-size: 4em;
+}
+.fa-5x {
+  font-size: 5em;
+}
+.fa-fw {
+  width: 1.2857142857142858em;
+  text-align: center;
+}
+.fa-ul {
+  padding-left: 0;
+  margin-left: 2.142857142857143em;
+  list-style-type: none;
+}
+.fa-ul > li {
+  position: relative;
+}
+.fa-li {
+  position: absolute;
+  left: -2.142857142857143em;
+  width: 2.142857142857143em;
+  top: 0.14285714285714285em;
+  text-align: center;
+}
+.fa-li.fa-lg {
+  left: -1.8571428571428572em;
+}
+.fa-border {
+  padding: .2em .25em .15em;
+  border: solid 0.08em #eeeeee;
+  border-radius: .1em;
+}
+.pull-right {
+  float: right;
+}
+.pull-left {
+  float: left;
+}
+.fa.pull-left {
+  margin-right: .3em;
+}
+.fa.pull-right {
+  margin-left: .3em;
+}
+.fa-spin {
+  -webkit-animation: spin 2s infinite linear;
+  -moz-animation: spin 2s infinite linear;
+  -o-animation: spin 2s infinite linear;
+  animation: spin 2s infinite linear;
+}
+@-moz-keyframes spin {
+  0% {
+    -moz-transform: rotate(0deg);
+  }
+  100% {
+    -moz-transform: rotate(359deg);
+  }
+}
+@-webkit-keyframes spin {
+  0% {
+    -webkit-transform: rotate(0deg);
+  }
+  100% {
+    -webkit-transform: rotate(359deg);
+  }
+}
+@-o-keyframes spin {
+  0% {
+    -o-transform: rotate(0deg);
+  }
+  100% {
+    -o-transform: rotate(359deg);
+  }
+}
+@-ms-keyframes spin {
+  0% {
+    -ms-transform: rotate(0deg);
+  }
+  100% {
+    -ms-transform: rotate(359deg);
+  }
+}
+@keyframes spin {
+  0% {
+    transform: rotate(0deg);
+  }
+  100% {
+    transform: rotate(359deg);
+  }
+}
+.fa-rotate-90 {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
+  -webkit-transform: rotate(90deg);
+  -moz-transform: rotate(90deg);
+  -ms-transform: rotate(90deg);
+  -o-transform: rotate(90deg);
+  transform: rotate(90deg);
+}
+.fa-rotate-180 {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
+  -webkit-transform: rotate(180deg);
+  -moz-transform: rotate(180deg);
+  -ms-transform: rotate(180deg);
+  -o-transform: rotate(180deg);
+  transform: rotate(180deg);
+}
+.fa-rotate-270 {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
+  -webkit-transform: rotate(270deg);
+  -moz-transform: rotate(270deg);
+  -ms-transform: rotate(270deg);
+  -o-transform: rotate(270deg);
+  transform: rotate(270deg);
+}
+.fa-flip-horizontal {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);
+  -webkit-transform: scale(-1, 1);
+  -moz-transform: scale(-1, 1);
+  -ms-transform: scale(-1, 1);
+  -o-transform: scale(-1, 1);
+  transform: scale(-1, 1);
+}
+.fa-flip-vertical {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);
+  -webkit-transform: scale(1, -1);
+  -moz-transform: scale(1, -1);
+  -ms-transform: scale(1, -1);
+  -o-transform: scale(1, -1);
+  transform: scale(1, -1);
+}
+.fa-stack {
+  position: relative;
+  display: inline-block;
+  width: 2em;
+  height: 2em;
+  line-height: 2em;
+  vertical-align: middle;
+}
+.fa-stack-1x,
+.fa-stack-2x {
+  position: absolute;
+  left: 0;
+  width: 100%;
+  text-align: center;
+}
+.fa-stack-1x {
+  line-height: inherit;
+}
+.fa-stack-2x {
+  font-size: 2em;
+}
+.fa-inverse {
+  color: #ffffff;
+}
+/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen
+   readers do not read off random characters that represent icons */
+.fa-glass:before {
+  content: "\f000";
+}
+.fa-music:before {
+  content: "\f001";
+}
+.fa-search:before {
+  content: "\f002";
+}
+.fa-envelope-o:before {
+  content: "\f003";
+}
+.fa-heart:before {
+  content: "\f004";
+}
+.fa-star:before {
+  content: "\f005";
+}
+.fa-star-o:before {
+  content: "\f006";
+}
+.fa-user:before {
+  content: "\f007";
+}
+.fa-film:before {
+  content: "\f008";
+}
+.fa-th-large:before {
+  content: "\f009";
+}
+.fa-th:before {
+  content: "\f00a";
+}
+.fa-th-list:before {
+  content: "\f00b";
+}
+.fa-check:before {
+  content: "\f00c";
+}
+.fa-times:before {
+  content: "\f00d";
+}
+.fa-search-plus:before {
+  content: "\f00e";
+}
+.fa-search-minus:before {
+  content: "\f010";
+}
+.fa-power-off:before {
+  content: "\f011";
+}
+.fa-signal:before {
+  content: "\f012";
+}
+.fa-gear:before,
+.fa-cog:before {
+  content: "\f013";
+}
+.fa-trash-o:before {
+  content: "\f014";
+}
+.fa-home:before {
+  content: "\f015";
+}
+.fa-file-o:before {
+  content: "\f016";
+}
+.fa-clock-o:before {
+  content: "\f017";
+}
+.fa-road:before {
+  content: "\f018";
+}
+.fa-download:before {
+  content: "\f019";
+}
+.fa-arrow-circle-o-down:before {
+  content: "\f01a";
+}
+.fa-arrow-circle-o-up:before {
+  content: "\f01b";
+}
+.fa-inbox:before {
+  content: "\f01c";
+}
+.fa-play-circle-o:before {
+  content: "\f01d";
+}
+.fa-rotate-right:before,
+.fa-repeat:before {
+  content: "\f01e";
+}
+.fa-refresh:before {
+  content: "\f021";
+}
+.fa-list-alt:before {
+  content: "\f022";
+}
+.fa-lock:before {
+  content: "\f023";
+}
+.fa-flag:before {
+  content: "\f024";
+}
+.fa-headphones:before {
+  content: "\f025";
+}
+.fa-volume-off:before {
+  content: "\f026";
+}
+.fa-volume-down:before {
+  content: "\f027";
+}
+.fa-volume-up:before {
+  content: "\f028";
+}
+.fa-qrcode:before {
+  content: "\f029";
+}
+.fa-barcode:before {
+  content: "\f02a";
+}
+.fa-tag:before {
+  content: "\f02b";
+}
+.fa-tags:before {
+  content: "\f02c";
+}
+.fa-book:before {
+  content: "\f02d";
+}
+.fa-bookmark:before {
+  content: "\f02e";
+}
+.fa-print:before {
+  content: "\f02f";
+}
+.fa-camera:before {
+  content: "\f030";
+}
+.fa-font:before {
+  content: "\f031";
+}
+.fa-bold:before {
+  content: "\f032";
+}
+.fa-italic:before {
+  content: "\f033";
+}
+.fa-text-height:before {
+  content: "\f034";
+}
+.fa-text-width:before {
+  content: "\f035";
+}
+.fa-align-left:before {
+  content: "\f036";
+}
+.fa-align-center:before {
+  content: "\f037";
+}
+.fa-align-right:before {
+  content: "\f038";
+}
+.fa-align-justify:before {
+  content: "\f039";
+}
+.fa-list:before {
+  content: "\f03a";
+}
+.fa-dedent:before,
+.fa-outdent:before {
+  content: "\f03b";
+}
+.fa-indent:before {
+  content: "\f03c";
+}
+.fa-video-camera:before {
+  content: "\f03d";
+}
+.fa-picture-o:before {
+  content: "\f03e";
+}
+.fa-pencil:before {
+  content: "\f040";
+}
+.fa-map-marker:before {
+  content: "\f041";
+}
+.fa-adjust:before {
+  content: "\f042";
+}
+.fa-tint:before {
+  content: "\f043";
+}
+.fa-edit:before,
+.fa-pencil-square-o:before {
+  content: "\f044";
+}
+.fa-share-square-o:before {
+  content: "\f045";
+}
+.fa-check-square-o:before {
+  content: "\f046";
+}
+.fa-arrows:before {
+  content: "\f047";
+}
+.fa-step-backward:before {
+  content: "\f048";
+}
+.fa-fast-backward:before {
+  content: "\f049";
+}
+.fa-backward:before {
+  content: "\f04a";
+}
+.fa-play:before {
+  content: "\f04b";
+}
+.fa-pause:before {
+  content: "\f04c";
+}
+.fa-stop:before {
+  content: "\f04d";
+}
+.fa-forward:before {
+  content: "\f04e";
+}
+.fa-fast-forward:before {
+  content: "\f050";
+}
+.fa-step-forward:before {
+  content: "\f051";
+}
+.fa-eject:before {
+  content: "\f052";
+}
+.fa-chevron-left:before {
+  content: "\f053";
+}
+.fa-chevron-right:before {
+  content: "\f054";
+}
+.fa-plus-circle:before {
+  content: "\f055";
+}
+.fa-minus-circle:before {
+  content: "\f056";
+}
+.fa-times-circle:before {
+  content: "\f057";
+}
+.fa-check-circle:before {
+  content: "\f058";
+}
+.fa-question-circle:before {
+  content: "\f059";
+}
+.fa-info-circle:before {
+  content: "\f05a";
+}
+.fa-crosshairs:before {
+  content: "\f05b";
+}
+.fa-times-circle-o:before {
+  content: "\f05c";
+}
+.fa-check-circle-o:before {
+  content: "\f05d";
+}
+.fa-ban:before {
+  content: "\f05e";
+}
+.fa-arrow-left:before {
+  content: "\f060";
+}
+.fa-arrow-right:before {
+  content: "\f061";
+}
+.fa-arrow-up:before {
+  content: "\f062";
+}
+.fa-arrow-down:before {
+  content: "\f063";
+}
+.fa-mail-forward:before,
+.fa-share:before {
+  content: "\f064";
+}
+.fa-expand:before {
+  content: "\f065";
+}
+.fa-compress:before {
+  content: "\f066";
+}
+.fa-plus:before {
+  content: "\f067";
+}
+.fa-minus:before {
+  content: "\f068";
+}
+.fa-asterisk:before {
+  content: "\f069";
+}
+.fa-exclamation-circle:before {
+  content: "\f06a";
+}
+.fa-gift:before {
+  cont  content: "\f06d";
+}
+.fa-eye:before {
+  content: "\f06e";
+}
+.fa-eye-sla  content: "\f07c";
+}
+.fa-arrows-v:before {
+  content: "\f07d";
+}
+.fa-arrows-h:before {
+  content: "\f07e";
+}
+.fa-bar-chart-o:before {
+  content: "\f080";
+}
+.fa-twitter-square:before {
+  content: "\f081";
+}
+.fa-facebook-square:before {
+  content: "\f082";
+}
+.fa-c  content: "\f084";
+}
+.fa-gears:before,
+.fa-cogs:before {
+  content:   content: "\f091";
+}
+.fa-github-square:before {
+  conte}
+.fa-credit-card:before {
+  content: "\f09d";
+}
+.fa-rss:before {
+  content: "\f09e";
+}
+.fa-hdd-o:before {
+  content: "\f}
+.fa-certificate.fa-wrench:before {
+  content: "\f0ad";
+}
+.fa-tasks:before {
+  content: "\f0ae";
+}
+.fa-filter:before {
+  content: "\f0b0";
+}
+.fa-briefcase:before {
+  content: "\f0b1";
+}
+.fa-arrows-alt:before {
+  content: "\f0b2";
+}
+.fa-group:before,
+.fa-users:before {
+  content: "\f0c0";
+}
+.fa-chai.fa-cut:before,
+.fa-scissors:before {
+  content: .fa-files-o:before {
+  content: "\f0c5";
+}
+.fa-paperclip:before {
+  content: "\f0c6";
+}
+.fa-save:before,
+.fa-floppy-o:before {
+  content: "\f0c7";
+}
+.fa-square:before {
+  content: "\f0c8";
+}
+.fa-bars:before {
+  content: "\f0c9";
+}
+.fa-list-ul:before {
+  content: "\f0ca";
+}
+.fa-list-ol:before {
+  content: "\f0cb";
+}
+.fa-strikethrough:before {
+  content: "\f0cc";
+}
+.fa-underline:before {
+  content: "\f0cd";
+}
+.fa-table:before {
+  content: "\f0ce";
+}
+.fa-magic:before {
+  content: "\f0d0";
+}
+.fa-truck:before {
+  content: "\f0d1";
+}
+.fa-pinterest:before {
+  content: "\f0d2";
+}
+.fa-pinterest-square:before {
+  content: "\f0d3";
+}
+.fa-google-plus-square:before {
+  content: "\f0d4";
+}
+.fa-google-plus:before {
+  content: "\f0d5";
+}
+.fa-money:before {
+  content: "\f0d6";
+}
+.fa-caret-down:before {
+  content: "\f0d7";
+}
+.fa-caret-up:before {
+  content: "\f0d8";
+}
+.fa-caret-left:before {
+  content: }
+.fa-ambulance:before {
+  content: "\f0f9";
+}
+.}
+.fa-h-square:before {
+  content: "\f0fd";
+}
+.fa-plus-square:before {
+  content: "\f0fe";
+}
+.}
+.fa-angle-left:before {
+  content: "\f104";
+}
+.fa-angle-right:before {
+  content: "\f105";
+}
+.fa-angle-up:before {
+  content: "\f106";
+}
+.fa-angle-down:before {
+  content: "\f107";
+}
+.fa-desktop:before {
+  content: "\f108";
+}
+.fa-laptop:before {
+  content: "\f109";
+}
+.fa-tablet:before {
+  content: .fa-frown-o:before {
+  content: "\f119";
+}
+.fa-meh-.fa-star-half-o:before {
+  content: "\f123";
+}
+.fa-location-arrow:before {
+  content: "}
+.fa-puzzle-piece:before {
+  content: "\f12e";
+}
+.fa-microphone:before {
+  content: "\f130";
+}
+.fa-microphone-slash:before {
+  content: "\f131";
+}
+.fa-shield:before {
+  content: "\f132";
+}
+.fa-calendar-o:before {
+  content: "\f133";
+}
+.fa-fire-extinguisher:before {
+  content: "\f134";
+}
+.fa-rocket:before {
+  content: "\f135";
+}
+.fa-maxcdn:before {
+  content: "\f136";
+}
+.fa}
+.fa-html5:before {
+  content: "\f13b";
+}
+.fa-css3:before {
+  content: "\f1.fa-minus-square-o:before {
+  content: "\f147";
+}
+.fa-level-up:before {
+  content: "\f148";
+}
+.fa-level-down:before {
+  content: "\f149";
+}
+.fa-check-square:before {
+  content: "\f14a";
+}
+.fa-pencil-square:before {
+  content: "\f14b";
+}
+.fa-external-link-square:before {
+  content: "\f14c";
+}
+.fa-share-square:before {
+  content: "\f14d";
+}
+.fa-compass:before {
+  content: "\f14e";
+}
+.fa-toggle-down:before,
+.fa-caret-square-o-down:before {
+  content: "\f150";
+}
+.fa-toggle-up:before,
+.fa-caret-square-o-up:before {
+  content: "\f151";
+}
+.fa-toggle-right:before,
+.fa-caret-square-o-right:before {
+  content: "\f152";
+}
+.fa-euro:before,
+.fa-eur:before {
+  content: "\f153";
+}
+.fa-gbp:before {
+  content: "\f154";
+}
+.fa-dollar:before,
+.fa-usd:before {
+  content: "\f155";
+}
+.fa-rupee:before,
+.fa-inr:before {
+  content: "\f156";
+}
+.fa-cny:before,
+.fa-rmb:before,
+.fa-yen:before,
+.fa-jpy:before {
+  content: "\f157";
+}
+.fa-ruble:before,
+.fa-rouble:before,
+.fa-rub:before {
+  content: "\f158";
+}
+.fa-won:before,
+.fa-krw:before {
+  content: "\f159";
+}
+.fa-bitcoin:before,
+.fa-btc:befo}
+.fa-thumbs-up:before {
+  content: "\f164";.fa-thumbs-down:before {
+  content: "\f165";
+}
+.fa-youtube-square:before {
+  content: "\f166";
+}
+.fa-youtube:before {
+  content: "\f167";
+}
+.fa-xing:before {
+  content: "\f168";
+}
+.fa-xing-square:before {  content: "\f177";
+}
+.fa-long-arr  content: "\f185";
+}
+.fa-moon-o:before {
+  content: "\f186";
+}
+.fa-archive:before {
+  content: "\f187";
+}
+.fa-bug:before {
+  content: "\f188";
+}
+.fa-vk:before {
+  content: "\f189";
+}
+.fa-weibo:before {
+  content: "\f18a";
+}
+.fa-renren:before {
+  content: "\f18b";
+}
+.fa-pagelines:before {
+  content: "\f18c";
+}
+.fa-stack-exchange:before {
+  content: "\f18d";
+}
+.fa-arrow-circle-o-right:before {
+  content: "\f18e";
+}
+.fa-arrow-circle-o-left:before {
+  content: "\f190";
+}
+.fa-toggle-left:before,
+.fa-caret-square-o-left:before {
+  content: "\f191";
+}
+.fa-dot-circle-o:before {
+  content: "\f192";
+}
+.fa-wheelchair:before {
+  content: "\f193";
+}
+.fa-vimeo-square:before {
+  content: "\f194";
+}
+.fa-turkish-lira:before,
+.fa-try:before {
+  content: "\f195";
+}
+.fa-plus-square-o:before {
+  content: "\f196";
+}
diff --git a/sourcecodes/scripts/font-awesome.css~ b/sourcecodes/scripts/font-awesome.css~
new file mode 100644
index 00000000..46ca5253
--- /dev/null
+++ b/sourcecodes/scripts/font-awesome.css~
@@ -0,0 +1,821 @@
+/*!
+ *  Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome
+ *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
+ */
+/* FONT PATH
+ * -------------------------- */
+@font-face {
+  font-family: 'FontAwesome';
+  src: url('../fonts/fontawesome-webfont.eot?v=4.0.3');
+  src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
+  font-weight: normal;
+  font-style: normal;
+}
+.fa {
+  display: inline-block;
+  font-family: FontAwesome;
+  font-style: normal;
+  font-weight: normal;
+  line-height: 1;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+/* makes the font 33% larger relative to the icon container */
+.fa-lg {
+  font-size: 1.3333333333333333em;
+  line-height: 0.75em;
+  vertical-align: -15%;
+}
+.fa-2x {
+  font-size: 2em;
+}
+.fa-3x {
+  font-size: 3em;
+}
+.fa-4x {
+  font-size: 4em;
+}
+.fa-5x {
+  font-size: 5em;
+}
+.fa-fw {
+  width: 1.2857142857142858em;
+  text-align: center;
+}
+.fa-ul {
+  padding-left: 0;
+  margin-left: 2.142857142857143em;
+  list-style-type: none;
+}
+.fa-ul > li {
+  position: relative;
+}
+.fa-li {
+  position: absolute;
+  left: -2.142857142857143em;
+  width: 2.142857142857143em;
+  top: 0.14285714285714285em;
+  text-align: center;
+}
+.fa-li.fa-lg {
+  left: -1.8571428571428572em;
+}
+.fa-border {
+  padding: .2em .25em .15em;
+  border: solid 0.08em #eeeeee;
+  border-radius: .1em;
+}
+.pull-right {
+  float: right;
+}
+.pull-left {
+  float: left;
+}
+.fa.pull-left {
+  margin-right: .3em;
+}
+.fa.pull-right {
+  margin-left: .3em;
+}
+.fa-spin {
+  -webkit-animation: spin 2s infinite linear;
+  -moz-animation: spin 2s infinite linear;
+  -o-animation: spin 2s infinite linear;
+  animation: spin 2s infinite linear;
+}
+@-moz-keyframes spin {
+  0% {
+    -moz-transform: rotate(0deg);
+  }
+  100% {
+    -moz-transform: rotate(359deg);
+  }
+}
+@-webkit-keyframes spin {
+  0% {
+    -webkit-transform: rotate(0deg);
+  }
+  100% {
+    -webkit-transform: rotate(359deg);
+  }
+}
+@-o-keyframes spin {
+  0% {
+    -o-transform: rotate(0deg);
+  }
+  100% {
+    -o-transform: rotate(359deg);
+  }
+}
+@-ms-keyframes spin {
+  0% {
+    -ms-transform: rotate(0deg);
+  }
+  100% {
+    -ms-transform: rotate(359deg);
+  }
+}
+@keyframes spin {
+  0% {
+    transform: rotate(0deg);
+  }
+  100% {
+    transform: rotate(359deg);
+  }
+}
+.fa-rotate-90 {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
+  -webkit-transform: rotate(90deg);
+  -moz-transform: rotate(90deg);
+  -ms-transform: rotate(90deg);
+  -o-transform: rotate(90deg);
+  transform: rotate(90deg);
+}
+.fa-rotate-180 {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
+  -webkit-transform: rotate(180deg);
+  -moz-transform: rotate(180deg);
+  -ms-transform: rotate(180deg);
+  -o-transform: rotate(180deg);
+  transform: rotate(180deg);
+}
+.fa-rotate-270 {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
+  -webkit-transform: rotate(270deg);
+  -moz-transform: rotate(270deg);
+  -ms-transform: rotate(270deg);
+  -o-transform: rotate(270deg);
+  transform: rotate(270deg);
+}
+.fa-flip-horizontal {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);
+  -webkit-transform: scale(-1, 1);
+  -moz-transform: scale(-1, 1);
+  -ms-transform: scale(-1, 1);
+  -o-transform: scale(-1, 1);
+  transform: scale(-1, 1);
+}
+.fa-flip-vertical {
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);
+  -webkit-transform: scale(1, -1);
+  -moz-transform: scale(1, -1);
+  -ms-transform: scale(1, -1);
+  -o-transform: scale(1, -1);
+  transform: scale(1, -1);
+}
+.fa-stack {
+  position: relative;
+  display: inline-block;
+  width: 2em;
+  height: 2em;
+  line-height: 2em;
+  vertical-align: middle;
+}
+.fa-stack-1x,
+.fa-stack-2x {
+  position: absolute;
+  left: 0;
+  width: 100%;
+  text-align: center;
+}
+.fa-stack-1x {
+  line-height: inherit;
+}
+.fa-stack-2x {
+  font-size: 2em;
+}
+.fa-inverse {
+  color: #ffffff;
+}
+/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen
+   readers do not read off random characters that represent icons */
+.fa-glass:before {
+  content: "\f000";
+}
+.fa-music:before {
+  content: "\f001";
+}
+.fa-search:before {
+  content: "\f002";
+}
+.fa-envelope-o:before {
+  content: "\f003";
+}
+.fa-heart:before {
+  content: "\f004";
+}
+.fa-star:before {
+  content: "\f005";
+}
+.fa-star-o:before {
+  content: "\f006";
+}
+.fa-user:before {
+  content: "\f007";
+}
+.fa-film:before {
+  content: "\f008";
+}
+.fa-th-large:before {
+  content: "\f009";
+}
+.fa-th:before {
+  content: "\f00a";
+}
+.fa-th-list:before {
+  content: "\f00b";
+}
+.fa-check:before {
+  content: "\f00c";
+}
+.fa-times:before {
+  content: "\f00d";
+}
+.fa-search-plus:before {
+  content: "\f00e";
+}
+.fa-search-minus:before {
+  content: "\f010";
+}
+.fa-power-off:before {
+  content: "\f011";
+}
+.fa-signal:before {
+  content: "\f012";
+}
+.fa-gear:before,
+.fa-cog:before {
+  content: "\f013";
+}
+.fa-trash-o:before {
+  content: "\f014";
+}
+.fa-home:before {
+  content: "\f015";
+}
+.fa-file-o:before {
+  content: "\f016";
+}
+.fa-clock-o:before {
+  content: "\f017";
+}
+.fa-road:before {
+  content: "\f018";
+}
+.fa-download:before {
+  content: "\f019";
+}
+.fa-arrow-circle-o-down:before {
+  content: "\f01a";
+}
+.fa-arrow-circle-o-up:before {
+  content: "\f01b";
+}
+.fa-inbox:before {
+  content: "\f01c";
+}
+.fa-play-circle-o:before {
+  content: "\f01d";
+}
+.fa-rotate-right:before,
+.fa-repeat:before {
+  content: "\f01e";
+}
+.fa-refresh:before {
+  content: "\f021";
+}
+.fa-list-alt:before {
+  content: "\f022";
+}
+.fa-lock:before {
+  content: "\f023";
+}
+.fa-flag:before {
+  content: "\f024";
+}
+.fa-headphones:before {
+  content: "\f025";
+}
+.fa-volume-off:before {
+  content: "\f026";
+}
+.fa-volume-down:before {
+  content: "\f027";
+}
+.fa-volume-up:before {
+  content: "\f028";
+}
+.fa-qrcode:before {
+  content: "\f029";
+}
+.fa-barcode:before {
+  content: "\f02a";
+}
+.fa-tag:before {
+  content: "\f02b";
+}
+.fa-tags:before {
+  content: "\f02c";
+}
+.fa-book:before {
+  content: "\f02d";
+}
+.fa-bookmark:before {
+  content: "\f02e";
+}
+.fa-print:before {
+  content: "\f02f";
+}
+.fa-camera:before {
+  content: "\f030";
+}
+.fa-font:before {
+  content: "\f031";
+}
+.fa-bold:before {
+  content: "\f032";
+}
+.fa-italic:before {
+  content: "\f033";
+}
+.fa-text-height:before {
+  content: "\f034";
+}
+.fa-text-width:before {
+  content: "\f035";
+}
+.fa-align-left:before {
+  content: "\f036";
+}
+.fa-align-center:before {
+  content: "\f037";
+}
+.fa-align-right:before {
+  content: "\f038";
+}
+.fa-align-justify:before {
+  content: "\f039";
+}
+.fa-list:before {
+  content: "\f03a";
+}
+.fa-dedent:before,
+.fa-outdent:before {
+  content: "\f03b";
+}
+.fa-indent:before {
+  content: "\f03c";
+}
+.fa-video-camera:before {
+  content: "\f03d";
+}
+.fa-picture-o:before {
+  content: "\f03e";
+}
+.fa-pencil:before {
+  content: "\f040";
+}
+.fa-map-marker:before {
+  content: "\f041";
+}
+.fa-adjust:before {
+  content: "\f042";
+}
+.fa-tint:before {
+  content: "\f043";
+}
+.fa-edit:before,
+.fa-pencil-square-o:before {
+  content: "\f044";
+}
+.fa-share-square-o:before {
+  content: "\f045";
+}
+.fa-check-square-o:before {
+  content: "\f046";
+}
+.fa-arrows:before {
+  content: "\f047";
+}
+.fa-step-backward:before {
+  content: "\f048";
+}
+.fa-fast-backward:before {
+  content: "\f049";
+}
+.fa-backward:before {
+  content: "\f04a";
+}
+.fa-play:before {
+  content: "\f04b";
+}
+.fa-pause:before {
+  content: "\f04c";
+}
+.fa-stop:before {
+  content: "\f04d";
+}
+.fa-forward:before {
+  content: "\f04e";
+}
+.fa-fast-forward:before {
+  content: "\f050";
+}
+.fa-step-forward:before {
+  content: "\f051";
+}
+.fa-eject:before {
+  content: "\f052";
+}
+.fa-chevron-left:before {
+  content: "\f053";
+}
+.fa-chevron-right:before {
+  content: "\f054";
+}
+.fa-plus-circle:before {
+  content: "\f055";
+}
+.fa-minus-circle:before {
+  content: "\f056";
+}
+.fa-times-circle:before {
+  content: "\f057";
+}
+.fa-check-circle:before {
+  content: "\f058";
+}
+.fa-question-circle:before {
+  content: "\f059";
+}
+.fa-info-circle:before {
+  content: "\f05a";
+}
+.fa-crosshairs:before {
+  content: "\f05b";
+}
+.fa-times-circle-o:before {
+  content: "\f05c";
+}
+.fa-check-circle-o:before {
+  content: "\f05d";
+}
+.fa-ban:before {
+  content: "\f05e";
+}
+.fa-arrow-left:before {
+  content: "\f060";
+}
+.fa-arrow-right:before {
+  content: "\f061";
+}
+.fa-arrow-up:before {
+  content: "\f062";
+}
+.fa-arrow-down:before {
+  content: "\f063";
+}
+.fa-mail-forward:before,
+.fa-share:before {
+  content: "\f064";
+}
+.fa-expand:before {
+  content: "\f065";
+}
+.fa-compress:before {
+  content: "\f066";
+}
+.fa-plus:before {
+  content: "\f067";
+}
+.fa-minus:before {
+  content: "\f068";
+}
+.fa-asterisk:before {
+  content: "\f069";
+}
+.fa-exclamation-circle:before {
+  content: "\f06a";
+}
+.fa-gift:before {
+  cont  content: "\f06d";
+}
+.fa-eye:before {
+  content: "\f06e";
+}
+.fa-eye-sla  content: "\f07c";
+}
+.fa-arrows-v:before {
+  content: "\f07d";
+}
+.fa-arrows-h:before {
+  content: "\f07e";
+}
+.fa-bar-chart-o:before {
+  content: "\f080";
+}
+.fa-twitter-square:before {
+  content: "\f081";
+}
+.fa-facebook-square:before {
+  content: "\f082";
+}
+.fa-c  content: "\f084";
+}
+.fa-gears:before,
+.fa-cogs:before {
+  content:   content: "\f091";
+}
+.fa-github-square:before {
+  conte}
+.fa-credit-card:before {
+  content: "\f09d";
+}
+.fa-rss:before {
+  content: "\f09e";
+}
+.fa-hdd-o:before {
+  content: "\f}
+.fa-certificate.fa-wrench:before {
+  content: "\f0ad";
+}
+.fa-tasks:before {
+  content: "\f0ae";
+}
+.fa-filter:before {
+  content: "\f0b0";
+}
+.fa-briefcase:before {
+  content: "\f0b1";
+}
+.fa-arrows-alt:before {
+  content: "\f0b2";
+}
+.fa-group:before,
+.fa-users:before {
+  content: "\f0c0";
+}
+.fa-chai.fa-cut:before,
+.fa-scissors:before {
+  content: .fa-files-o:before {
+  content: "\f0c5";
+}
+.fa-paperclip:before {
+  content: "\f0c6";
+}
+.fa-save:before,
+.fa-floppy-o:before {
+  content: "\f0c7";
+}
+.fa-square:before {
+  content: "\f0c8";
+}
+.fa-bars:before {
+  content: "\f0c9";
+}
+.fa-list-ul:before {
+  content: "\f0ca";
+}
+.fa-list-ol:before {
+  content: "\f0cb";
+}
+.fa-strikethrough:before {
+  content: "\f0cc";
+}
+.fa-underline:before {
+  content: "\f0cd";
+}
+.fa-table:before {
+  content: "\f0ce";
+}
+.fa-magic:before {
+  content: "\f0d0";
+}
+.fa-truck:before {
+  content: "\f0d1";
+}
+.fa-pinterest:before {
+  content: "\f0d2";
+}
+.fa-pinterest-square:before {
+  content: "\f0d3";
+}
+.fa-google-plus-square:before {
+  content: "\f0d4";
+}
+.fa-google-plus:before {
+  content: "\f0d5";
+}
+.fa-money:before {
+  content: "\f0d6";
+}
+.fa-caret-down:before {
+  content: "\f0d7";
+}
+.fa-caret-up:before {
+  content: "\f0d8";
+}
+.fa-caret-left:before {
+  content: }
+.fa-ambulance:before {
+  content: "\f0f9";
+}
+.}
+.fa-h-square:before {
+  content: "\f0fd";
+}
+.fa-plus-square:before {
+  content: "\f0fe";
+}
+.}
+.fa-angle-left:before {
+  content: "\f104";
+}
+.fa-angle-right:before {
+  content: "\f105";
+}
+.fa-angle-up:before {
+  content: "\f106";
+}
+.fa-angle-down:before {
+  content: "\f107";
+}
+.fa-desktop:before {
+  content: "\f108";
+}
+.fa-laptop:before {
+  content: "\f109";
+}
+.fa-tablet:before {
+  content: .fa-frown-o:before {
+  content: "\f119";
+}
+.fa-meh-.fa-star-half-o:before {
+  content: "\f123";
+}
+.fa-location-arrow:before {
+  content: "}
+.fa-puzzle-piece:before {
+  content: "\f12e";
+}
+.fa-microphone:before {
+  content: "\f130";
+}
+.fa-microphone-slash:before {
+  content: "\f131";
+}
+.fa-shield:before {
+  content: "\f132";
+}
+.fa-calendar-o:before {
+  content: "\f133";
+}
+.fa-fire-extinguisher:before {
+  content: "\f134";
+}
+.fa-rocket:before {
+  content: "\f135";
+}
+.fa-maxcdn:before {
+  content: "\f136";
+}
+.fa}
+.fa-html5:before {
+  content: "\f13b";
+}
+.fa-css3:before {
+  content: "\f1.fa-minus-square-o:before {
+  content: "\f147";
+}
+.fa-level-up:before {
+  content: "\f148";
+}
+.fa-level-down:before {
+  content: "\f149";
+}
+.fa-check-square:before {
+  content: "\f14a";
+}
+.fa-pencil-square:before {
+  content: "\f14b";
+}
+.fa-external-link-square:before {
+  content: "\f14c";
+}
+.fa-share-square:before {
+  content: "\f14d";
+}
+.fa-compass:before {
+  content: "\f14e";
+}
+.fa-toggle-down:before,
+.fa-caret-square-o-down:before {
+  content: "\f150";
+}
+.fa-toggle-up:before,
+.fa-caret-square-o-up:before {
+  content: "\f151";
+}
+.fa-toggle-right:before,
+.fa-caret-square-o-right:before {
+  content: "\f152";
+}
+.fa-euro:before,
+.fa-eur:before {
+  content: "\f153";
+}
+.fa-gbp:before {
+  content: "\f154";
+}
+.fa-dollar:before,
+.fa-usd:before {
+  content: "\f155";
+}
+.fa-rupee:before,
+.fa-inr:before {
+  content: "\f156";
+}
+.fa-cny:before,
+.fa-rmb:before,
+.fa-yen:before,
+.fa-jpy:before {
+  content: "\f157";
+}
+.fa-ruble:before,
+.fa-rouble:before,
+.fa-rub:before {
+  content: "\f158";
+}
+.fa-won:before,
+.fa-krw:before {
+  content: "\f159";
+}
+.fa-bitcoin:before,
+.fa-btc:befo}
+.fa-thumbs-up:before {
+  content: "\f164";.fa-thumbs-down:before {
+  content: "\f165";
+}
+.fa-youtube-square:before {
+  content: "\f166";
+}
+.fa-youtube:before {
+  content: "\f167";
+}
+.fa-xing:before {
+  content: "\f168";
+}
+.fa-xing-square:before {  content: "\f177";
+}
+.fa-long-arr  content: "\f185";
+}
+.fa-moon-o:before {
+  content: "\f186";
+}
+.fa-archive:before {
+  content: "\f187";
+}
+.fa-bug:before {
+  content: "\f188";
+}
+.fa-vk:before {
+  content: "\f189";
+}
+.fa-weibo:before {
+  content: "\f18a";
+}
+.fa-renren:before {
+  content: "\f18b";
+}
+.fa-pagelines:before {
+  content: "\f18c";
+}
+.fa-stack-exchange:before {
+  content: "\f18d";
+}
+.fa-arrow-circle-o-right:before {
+  content: "\f18e";
+}
+.fa-arrow-circle-o-left:before {
+  content: "\f190";
+}
+.fa-toggle-left:before,
+.fa-caret-square-o-left:before {
+  content: "\f191";
+}
+.fa-dot-circle-o:before {
+  content: "\f192";
+}
+.fa-wheelchair:before {
+  content: "\f193";
+}
+.fa-vimeo-square:before {
+  content: "\f194";
+}
+.fa-turkish-lira:before,
+.fa-try:before {
+  content: "\f195";
+}
+.fa-plus-square-o:before {
+  content: "\f196";
+}
diff --git a/sourcecodes/scripts/fontawesome-webfont.eot b/sourcecodes/scripts/fontawesome-webfont.eot
new file mode 100644
index 00000000..7c79c6a6
--- /dev/null
+++ b/sourcecodes/scripts/fontawesome-webfont.eot
Binary files differdiff --git a/sourcecodes/scripts/fontawesome-webfont.svg b/sourcecodes/scripts/fontawesome-webfont.svg
new file mode 100644
index 00000000..7811ad1f
--- /dev/null
+++ b/sourcecodes/scripts/fontawesome-webfont.svg
@@ -0,0 +1,63 @@
+
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata></metadata>
+<defs>
+<font id="fontawesomeregular" horiz-adv-x="1536" >
+<font-face units-per-em="1792" ascent="1536" descent="-256" />
+<missing-glyph horiz-adv-x="448" />
+<glyph unicode=" "  horiz-adv-x="448" />
+<glyph unicode="&#x09;" horiz-adv-x="448" />
+<glyph unicode="&#xa0;" horiz-adv-x="448" />
+<glyph unicode="&#xa8;" horiz-adv-x="1792" />
+<glyph unicode="&#xa9;" horiz-adv-x="1792" />
+<glyph unicode="&#xae;" horiz-adv-x="1792" />
+<glyph unicode="&#xb4;" horiz-adv-x="1792" />
+<glyph unicode="&#xc6;" horiz-adv-x="1792" />
+<glyph unicode="&#x2000;" horiz-adv-x="768" />
+<glyph unicode="&#x2001;" />
+<glyph unicode="&#x2002;" horiz-adv-x="768" />
+<glyph unicode="&#x2003;" />
+<glyph unicode="&#x2004;" horiz-adv-x="512" />
+<glyph unicode="&#x2005;" horiz-adv-x="384" />
+<glyph unicode="&#x2006;" horiz-adv-x="256" />
+<glyph unicode="&#x2007;" horiz-adv-x="256" />
+<glyph unicode="&#x2008;" horiz-adv-x="192" />
+<glyph unicode="&#x2009;" horiz-adv-x="307" />
+<glyph unicode="&#x200a;" horiz-adv-x="85" />
+<glyph unicode="&#x202f;" horiz-adv-x="307" />
+<glyph unicode="&#x205f;" horiz-adv-x="384" />
+<glyph unicode="&#x2122;" horiz-adv-x="1792" />
+<glyph unicode="&#x221e;" horiz-adv-x="1792" />
+<glyph unicode="&#x2260;" horiz-adv-x="1792" />
+<glyph unicode="&#xe000;" horiz-adv-x="500" d="M0 0z" />
+<glyph unicode="&#xf000;" horiz-adv-x="1792" d="M1699 1350q0 -35 -43 -78l-632 -632v-768h320q26 0 45 -19t19 -45t-19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45t45 19h320v768l-632 632q-43 43 -43 78q0 23 18 36.5t38 17.5t43 4h1408q23 0 43 -4t38 -17.5t18 -36.5z" />
+<glyph unicode="&#xf001;" d="M1536 1312v-1120q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v537l-768 -237v-709q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89 t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v967q0 31 19 56.5t49 35.5l832 256q12 4 28 4q40 0 68 -28t28 -68z" />
+<glyph unicode="&#xf002;" horiz-adv-x="1664" d="M1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1664 -128q0 -52 -38 -90t-90 -38q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5 t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z" />
+<glyph unicode="&#xf003;" horiz-adv-x="1792" d="M1664 32v768q-32 -36 -69 -66q-268 -206 -426 -338q-51 -43 -83 -67t-86.5 -48.5t-102.5 -24.5h-1h-1q-48 0 -102.5 24.5t-86.5 48.5t-83 67q-158 132 -426 338q-37 30 -69 66v-768q0 -13 9.5 -22.5t22.5 -9.5h1472q13 0 22.5 9.5t9.5 22.5zM1664 1083v11v13.5t-0.5 13 t-3 12.5t-5.5 9t-9 7.5t-14 2.5h-1472q-13 0 -22.5 -9.5t-9.5 -22.5q0 -168 147 -284q193 -152 401 -317q6 -5 35 -29.5t46 -37.5t44.5 -31.5t50.5 -27.5t43 -9h1h1q20 0 43 9t50.5 27.5t44.5 31.5t46 37.5t35 29.5q208 165 401 317q54 43 100.5 115.5t46.5 131.5z M1792 1120v-1088q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1472q66 0 113 -47t47 -113z" />
+<glyph unicode="&#xf004;" horiz-adv-x="1792" d="M896 -128q-26 0 -44 18l-624 602q-10 8 -27.5 26t-55.5 65.5t-68 97.5t-53.5 121t-23.5 138q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5q224 0 351 -124t127 -344q0 -221 -229 -450l-623 -600 q-18 -18 -44 -18z" />
+<glyph unicode="&#xf005;" horiz-adv-x="1664" d="M1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -21 -10.5 -35.5t-30.5 -14.5q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455 l502 -73q56 -9 56 -46z" />
+<glyph unicode="&#xf006;" horiz-adv-x="1664" d="M1137 532l306 297l-422 62l-189 382l-189 -382l-422 -62l306 -297l-73 -421l378 199l377 -199zM1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -50 -41 -50q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500 l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455l502 -73q56 -9 56 -46z" />
+<glyph unicode="&#xf007;" horiz-adv-x="1408" d="M1408 131q0 -120 -73 -189.5t-194 -69.5h-874q-121 0 -194 69.5t-73 189.5q0 53 3.5 103.5t14 109t26.5 108.5t43 97.5t62 81t85.5 53.5t1<glyph unicode="&#xf016;" horiz-adv-x="1280" d="M128 0h1024v768h-416q-40 0 -68 28t-28 68v416h-512v-1280zM768 896h376q-10 29 -22 41l-313 313q-12 12 -41 22v-376zM1280 864v-896q0 -<glyph unicode="&#xf019;" horiz-adv-x="1664" d<glyph unicode="&#xf035;" d="M81 1407l54 -27q2<glyph unicode="&#xf057;" d="M1149 414q0 26 -19 45l-181 181l181 181q19 19 19 45q0 27 -19 46l-90 90q-19 19 -46 19q-26 0 -45 -19l-181 -181l-181 181q-19 19 -45 19q-27 0 -46 -19l-90 -90q-19 -19 -19 -46q0 -26 19 -45l181 -181l-181 -181q-19 -19 -19 -45q0 -27 19 -46l90 -90q19 -19 46 -19 q26 0 45 19l181 181l181 -181q19 -19 45 -19q27 0 46 19l90 90q19 19 19 46zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
+<glyph unicode="&#xf058;" d="M1284 802q0 28 -18 46l-91 90q-19 19 -45 19t-45 -19l-408 -407l-226 226q-19 19 -45 19t-45 -19l-91 -90q-18 -18 -18 -46q0 -27 18 -45l362 -362q19 -19 45 -19q27 0 46 19l543 543q18 18 18 45zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
+<glyph unicode="&#xf059;" d="M896 160v192q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h192q14 0 23 9t9 23zM1152 832q0 88 -55.5 163t-138.5 116t-170 41q-243 0 -371 -213q-15 -24 8 -42l132 -100q7 -6 19 -6q16 0 25 12q53 68 86 92q34 24 86 24q48 0 85.5 -26t37.5 -59 q0 -38 -20 -61t-68 -45q-63 -28 -115.5 -86.5t-52.5 -125.5v-36q0 -14 9 -23t23 -9h192q14 0 23 9t9 23q0 19 21.5 49.5t54.5 49.5q32 18 49 28.5t46 35t44.5 48t28 60.5t12.5 81zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
+<glyph unicode="&#xf05a;" d="M1024 160v160q0 14 -9 23t-23 9h-96v512q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h96v-320h-96q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h448q14 0 23 9t9 23zM896 1056v160q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23 t23 -9h192q14 0 23 9t9 23zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
+<glyph unicode="&#xf05b;" d="M1197 512h-109q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h109q-32 108 -112.5 188.5t-188.5 112.5v-109q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v109q-108 -32 -188.5 -112.5t-112.5 -188.5h109q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-109 q32 -108 112.5 -188.5t188.5 -112.5v109q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-109q108 32 188.5 112.5t112.5 188.5zM1536 704v-128q0 -26 -19 -45t-45 -19h-143q-37 -161 -154.5 -278.5t-278.5 -154.5v-143q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v143 q-161 37 -278.5 154.5t-154.5 278.5h-143q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h143q37 161 154.5 278.5t278.5 154.5v143q0<glyph unicode="&#xf05c;" d="M1097 457l-146 -146q-10 -10 -23 -10t-23 10l-137 137l-137 -137q-10 -10 -23 -10t-23 10l-146 146q-10 10 -10 23t10 23l137 137l-137 137q-10 10 -10 23t10 23l146 146q10 10 23 10t23 -10l137 -137l137 137q10 10 23 10t23 -10l146 -146q10 -10 10 -23t-10 -23 l-137 -137l137 -137q10 -10 10 -23t-10 -<glyph unicode="&#xf060;" d="M1536 640v-128q0 -53 -32.5 -90.5t-84.5 -37.5h-704l293 -294q38 -36 38 -90t-38 -90l-75 -76q-37 -37 -90 -37q-52 0 -91 37l-651 652q-37 37 -37 90q0 52 37 91l651 650q38 38 91 38q52 0 90 -38l75 -74q38 -38 38 -91t-38 -91l-293 -293h704q52 0 84.5 -37.5 t32.5 -90.5z" />
+<glyph unicode="&#xf061;" d="M1472 576q0 -54 -37 -91l-651 -651q-39 -37 -91 -37q-51 0 -90 37l-75 75q-38 38 -38 91t38 91l293 293h-704q-52 0 -84.5 37.5t-32.5 90.5v128q0 53 32.5 90.5t84.5 37.5h704l-293 294q-38 36 -38 90t38 90l75 75q38 38 90 38q53 0 91 -38l651 -651q37 -35 37 -90z" />
+<glyph unicode="&#xf062;" horiz-adv-x="1664" d="M1611 565q0 -51 -37 -90l-75 -75q-38 -38 -91 -38q-54 0 -90 38l-294 293v-704q0 -52 -37.5 -84.5t-90.5 -32.5h-128q-53 0 -90.5 32.5t-37.5 84.5v704l-294 -293q-36 -38 -90 -38t-90 38l-75 75q-38 38 -38 90q0 53 38 91l651 651q35 37 90 37q54 0 91 -37l651 -651 q37 -39 37 -91z" />
+<glyph unicode="&#xf063;" horiz-adv-x="1664" d="M1611 704q0 -53 -<glyph unicode="&#xf084;" horiz-adv-x="1792" d="M832 1024q0 80 -56 136t-136 56t-136 -56t-56 -136q0 -42 19 -83q-41 19 -83 19q-80 0 -136 -56<glyph unicode="&#xf0a5;" horiz-adv-x="1792" d="M<glyph unicode="&#xf0a6;" d="M1280 -64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 700q0 189 -167 189q-26 0 -56 -5q-16 30 -52.5 47.5t-73.5 17.5t-69 -18q-50 53 -119 53qt-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45z" />
+<glyph unicode="&#xf0b0123t56 -148 q4 -48 -10 -97q4 -1 12 -5l110 -66l690 387q14 8 31 8q16 0 29 -7l128 -64 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5 t-9.5 22.5v192q0 14 9 2d="M1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103q-111 0 -218 32q59 93 78 1de="&#xf0d9;" horiz-adv-x="640"06 -75 -181t-181 -75t-181 75t-75 181h-448q-52 0 -<glyph unicode="&#xf0f8;" horiz-adv-x="1408" d="M384 224v-64q0 -13 -9.5 -22.5t-22.-203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 8<glyph unicode="&#xf10a;" horiz-adv-x="1152" d="M640 128q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1024 288v960q0 13 -9.5 22.5t-22.5 9.5h-832q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h832q13 0 22.5 9.5t9.5 22.5zM1152 1248v-1088q0 -66 -47 -113t-113 -47h-832 q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h832q66 0 113 -47t47 -113z" />
+<glyph unicode="&#xf10b;" horiz-adv-x="768" d="M464 128q0 33 -23.5 56.5t-56.5 23.5t-56.5 -23.5t-23.5 -56.5t23.5 -56.5t56.5 -23.5t56.5 23.5t23.5 56.5zM672 288v704q0 13 -9.5 22.5t-22.5 9.5h-512q-13 0 -22.5 -9.5t-9.5 -22.5v-704q0 -13 9.5 -22.5t22.5 -9.5h512q13 0 22.5 9.5t9.5 22.5zM480 113<glyph unicode="&#xf10d;" horiz-adv-x="1664" d="M768 576v-384q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v704q0 104 40.5 198.5t109.5 163.5t163.5 109.5t198.5 40.5h64q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-64q-106 0 -181 -75t-75 -181v-32q0 -40 28 -68t68 -28h224q80 0 136 -56t56 -136z M1664 576v-384q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v704q0 104 40.5 198.5t109.5 163.5t163.5 109.5t198.5 40.5h64q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-64q-106 0 -181 -75t-75 <glyph unicode="&#xf110;" horiz-adv-x="1568" d="M496 192q0 -60 -42.5 -102t-101.5 -42q-60 0 -102 42t-42 102t42 102t102 42q59 0 101.5 -42t42.5 -102zM928 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM320 640q0 -66 -47 -113t-113 -47t-113 47t-47 113 t47 113t113 47t113 -47t47 -113zM1360 192q0 -46 -33 -79t-79 -33t-79 33t-33 79t33 79t79 33t79 -33t33 -79zM528 1088q0 -73 -51.5 -124.5t-124.5 -51.5t-<glyph unicode="&#xf11b;" horiz-adv-x="1920" d="M832 448v128q0 14 -9 23t-23 9h-192v192q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-192h-192q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h192v-192q0 -14 9 -23t23 -9h128q14 0 23 9t9 23v192h192q14 0 23 9t9 23zM1408 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.<glyph unicode="&#xf11c;" horiz-adv-x="1920" d="M384 368v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM512 624v-96q0 -16 -16 -16h-224q-16 0 -16 16v96q0 16 16 16h224q16 0 16 -16zM384 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1408 368v-96q0 -16 -16 -16 h-864q-16 0 -16 16v96q0 16 16 16h864q16 0 16 -16zM768 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM640 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1024 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16 h96q16 0 16 -16zM896 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1280 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1664 368v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1152 880v-96 q0 -16 -16 -16h-96q-16 0 -16 16v96q<glyph unicode="&#xf11d;" horiz-adv-x="1792" d="M1664 491v616q-169 -91 -306 -91q-82 0 -145 32q-100 49 -184 76.5t-178 27.5q-173 0 -403 -127v-599q245 113 433 113q55 0 103.5 -7.5t98 -26t77 -31t82.5 -39.5l28 -14q44 -22 101 -22q120 0 293 92zM320 1280q0 -35 -17.5 -64t-46.5 -46v-1266q0 -14 -9 -23t-23 -9 h-64q-14<glyph unicode="&#xf12e;" horiz-adv-x="1664" d="M1664 438q0 -81 -44.5 -135t-123.5 -54q-41 0 -77.5" />
+<glyph unicode="&#xf137; 68t68 28h192q40 0 68 -28t28 -68zM384 1312v-192q0 -40 -28 -68t-68 -28h-192 q-40  -110.5q0 -181 167 -404q10 -12 25 -12q7 0 13 3q22 9 19 33q-44 354 62 473q46 52 13110q167 -178 459 -536q14 -16 4 -34q-8 -18 -29 -18h-195q-16 0 -25 12q-306 367 -498 572 218l-12 47q-2 16 -2 20h-4l-3 -20q0 -1 -3.5 -18t-7.5 -29zM736 96q0 -12 -10 -24l- -135 t-134.5 -57h-277q4 -14 8 -24t11 -22t10 -18<glyph unicode="&#xf186;" d="M1262 233q-54 -9 -110 -9q-182 0 -337 90t-245 245t-90 337q0 192 104 357q-201 -60 -328.5 -229t-127.5 -384q0 -130 51 -248.5t13<glyph unicode="&#xf18c;" horiz-adv-x="1408" d="M1402 433q-32 -80 -76 -138t-91 -88.5t-99 -46.5t-101.5 -14.5t-96.5 8.5t-86.5 22t-69.5 27.5t-46 22.5l-17 10q-113 -228 -289.5 -359.5t-384.5 -132.5q-19 0 -32 13t-13 32t13 31.5t32 12.5q173 1<glyph unicode="&#xf191;" d="M1024 960v-640q0 -26 -19 -45t-45 -19q-20 0 -37 12l-448 320q-27 19 -27 52t27 52l448 320q17 12 37 12q26 0 45 -19t19 -45zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5z M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" />
+<glyph unicode="&#xf197;" horiz-adv-x="1792" />
+<glyph unicode="&#xf198;" horiz-adv-x="1792" />
+<glyph unicode="&#xf199;" horiz-adv-x="1792" />
+<glyph unicode="&#xf19a;" horiz-adv-x="1792" />
+<glyph unicode="&#xf19b;" horiz-adv-x="1792" />
+<glyph unicode="&#xf19c;" horiz-adv-x="1792" />
+<glyph unicode="&#xf19d;" horiz-adv-x="1792" />
+<glyph unicode="&#xf19e;" horiz-adv-x="1792" />
+<glyph unicode="&#xf500;" horiz-adv-x="1792" />
+</font>
+</defs></svg> 
diff --git a/sourcecodes/scripts/fontawesome-webfont.ttf b/sourcecodes/scripts/fontawesome-webfont.ttf
new file mode 100644
index 00000000..e89738de
--- /dev/null
+++ b/sourcecodes/scripts/fontawesome-webfont.ttf
Binary files differdiff --git a/sourcecodes/scripts/fontawesome-webfont.woff b/sourcecodes/scripts/fontawesome-webfont.woff
new file mode 100644
index 00000000..8c1748aa
--- /dev/null
+++ b/sourcecodes/scripts/fontawesome-webfont.woff
Binary files differdiff --git a/sourcecodes/scripts/jquery.min.js b/sourcecodes/scripts/jquery.min.js
new file mode 100644
index 00000000..f6a6a99e
--- /dev/null
+++ b/sourcecodes/scripts/jquery.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */
+!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?a<0?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"label"in b&&b.disabled===a||"form"in b&&b.disabled===a||"form"in b&&b.disabled===!1&&(b.isDisabled===a||b.isDisabled!==!a&&("label"in b||!ea(b))!==a)}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e)}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,
+r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c||"false"!==c&&("null"===c?null:+c+""===c?+c:X.test(c)?JSON.parse(c):c)}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),Z(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=Z(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=V.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var $=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,_=new RegExp("^(?:([+-])=|)("+$+")([a-z%]*)$","i"),aa=["Top","Right","Bottom","Left"],ba=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},ca=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function da(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&_.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var ea={};function fa(a){var b,c=a.ownerDocument,d=a.nodeName,e=ea[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),ea[d]=e,e)}function ga(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ba(d)&&(e[f]=fa(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ga(this,!0)},hide:function(){return ga(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ba(this)?r(this).show():r(this).hide()})}});var ha=/^(?:checkbox|radio)$/i,ia=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;c<d;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var na=/<|&#?\w+;/;function oa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(na.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ia.exec(f)||["",""])[1].toLowerCase(),i=ka[h]||ka._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;c<h;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?r(e,this).index(i)>-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==va()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===va()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&r.nodeName(this,"input"))return this.click(),!1},_default:function(a){return r.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ta:ua,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:ua,isPropagationStopped:ua,isImmediatePropagationStopped:ua,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ta,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ta,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ta,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&qa.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&ra.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return wa(this,a,b,c,d)},one:function(a,b,c,d){return wa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=ua),this.each(function(){r.event.remove(this,a,c,b)})}});var xa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/<script|<style|<link/i,za=/checked\s*(?:[^=]|=\s*.checked.)/i,Aa=/^true\/(.*)/,Ba=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ga(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ha.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ha(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,la(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ea),l=0;l<i;l++)j=h[l],ja.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ba,""),k))}return a}function Ia(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(la(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&ma(la(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(xa,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;d<e;d++)Ga(f[d],g[d]);if(b)if(c)for(f=f||la(a),g=g||la(h),d=0,e=f.length;d<e;d++)Fa(f[d],g[d]);else Fa(a,h);return g=la(h,"script"),g.length>0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(la(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(la(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ja=/^margin/,Ka=new RegExp("^("+$+")(?!px)[a-z%]+$","i"),La=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",pa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,pa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Ma(a,b,c){var d,e,f,g,h=a.style;return c=c||La(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ka.test(g)&&Ja.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Na(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Oa=/^(none|table(?!-c[ea]).+)/,Pa={position:"absolute",visibility:"hidden",display:"block"},Qa={letterSpacing:"0",fontWeight:"400"},Ra=["Webkit","Moz","ms"],Sa=d.createElement("div").style;function Ta(a){if(a in Sa)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ra.length;while(c--)if(a=Ra[c]+b,a in Sa)return a}function Ua(a,b,c){var d=_.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Va(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+aa[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+aa[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+aa[f]+"Width",!0,e))):(g+=r.css(a,"padding"+aa[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+aa[f]+"Width",!0,e)));return g}function Wa(a,b,c){var d,e=!0,f=La(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),d<=0||null==d){if(d=Ma(a,b,f),(d<0||null==d)&&(d=a.style[b]),Ka.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Va(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ma(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=_.exec(c))&&e[1]&&(c=da(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Ma(a,b,d)),"normal"===e&&b in Qa&&(e=Qa[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Oa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Wa(a,b,d):ca(a,Pa,function(){return Wa(a,b,d)})},set:function(a,c,d){var e,f=d&&La(a),g=d&&Va(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=_.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ua(a,c,g)}}}),r.cssHooks.marginLeft=Na(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Ma(a,"marginLeft"))||a.getBoundingClientRect().left-ca(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+aa[d]+b]=f[d]||f[d-2]||f[0];return e}},Ja.test(a)||(r.cssHooks[a+b].set=Ua)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=La(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Xa(a,b,c,d,e){return new Xa.prototype.init(a,b,c,d,e)}r.Tween=Xa,Xa.prototype={constructor:Xa,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Xa.propHooks[this.prop];return a&&a.get?a.get(this):Xa.propHooks._default.get(this)},run:function(a){var b,c=Xa.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Xa.propHooks._default.set(this),this}},Xa.prototype.init.prototype=Xa.prototype,Xa.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Xa.propHooks.scrollTop=Xa.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Xa.prototype.init,r.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=/queueHooks$/;function ab(){Za&&(a.requestAnimationFrame(ab),r.fx.tick())}function bb(){return a.setTimeout(function(){Ya=void 0}),Ya=r.now()}function cb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=aa[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function db(a,b,c){for(var d,e=(gb.tweeners[b]||[]).concat(gb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function eb(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&ba(a),q=V.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],$a.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ga([a],!0),j=a.style.display||j,k=r.css(a,"display"),ga([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=V.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ga([a],!0),m.done(function(){p||ga([a]),V.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=db(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function fb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function gb(a,b,c){var d,e,f=0,g=gb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Ya||bb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Ya||bb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(fb(k,j.opts.specialEasing);f<g;f++)if(d=gb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,db,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}r.Animation=r.extend(gb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return da(c.elem,a,_.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(K);for(var c,d=0,e=a.length;d<e;d++)c=a[d],gb.tweeners[c]=gb.tweeners[c]||[],gb.tweeners[c].unshift(b)},prefilters:[eb],prefilter:function(a,b){b?gb.prefilters.unshift(a):gb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:e.duration="number"==typeof e.duration?e.duration:e.duration in r.fx.speeds?r.fx.speeds[e.duration]:r.fx.speeds._default,null!=e.queue&&e.queue!==!0||(e.queue="fx"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ba).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=gb(this,r.extend({},a),f);(e||V.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&_a.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=V.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(cb(b,!0),a,d,e)}}),r.each({slideDown:cb("show"),slideUp:cb("hide"),slideToggle:cb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Ya=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),Ya=void 0},r.fx.timer=function(a){r.timers.push(a),a()?r.fx.start():r.timers.pop()},r.fx.interval=13,r.fx.start=function(){Za||(Za=a.requestAnimationFrame?a.requestAnimationFrame(ab):a.setInterval(r.fx.tick,r.fx.interval))},r.fx.stop=function(){a.cancelAnimationFrame?a.cancelAnimationFrame(Za):a.clearInterval(Za),Za=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var hb,ib=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?hb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);
+if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),hb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ib[b]||r.find.attr;ib[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=ib[g],ib[g]=e,e=null!=c(a,b,d)?g:null,ib[g]=f),e}});var jb=/^(?:input|select|textarea|button)$/i,kb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):jb.test(a.nodeName)||kb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;function mb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,mb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,mb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,mb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=mb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(c)+" ").replace(lb," ").indexOf(b)>-1)return!0;return!1}});var nb=/\r/g,ob=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(nb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(ob," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,g=f?null:[],h=f?e+1:d.length,i=e<0?h:f?e:0;i<h;i++)if(c=d[i],(c.selected||i===e)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,""),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Qb=[],Rb=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Qb.pop()||r.expando+"_"+rb++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Rb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rb.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Rb,"$1"+e):b.jsonp!==!1&&(b.url+=(sb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Qb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=oa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=r.trim(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length};function Sb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=Sb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||pa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=Sb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Na(o.pixelPosition,function(a,c){if(c)return c=Ma(a,b),Ka.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),r.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Tb=a.jQuery,Ub=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Ub),b&&a.jQuery===r&&(a.jQuery=Tb),r},b||(a.jQuery=a.$=r),r});
diff --git a/sourcecodes/scripts/lodash.js b/sourcecodes/scripts/lodash.js
new file mode 100644
index 00000000..cd8df6fe
--- /dev/null
+++ b/sourcecodes/scripts/lodash.js
@@ -0,0 +1,17105 @@
+/**
+ * @license
+ * Lodash <https://lodash.com/>
+ * Copyright JS Foundation and other contributors <https://js.foundation/>
+ * Released under MIT license <https://lodash.com/license>
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+;(function() {
+
+  /** Used as a safe reference for `undefined` in pre-ES5 environments. */
+  var undefined;
+
+  /** Used as the semantic version number. */
+  var VERSION = '4.17.10';
+
+  /** Used as the size to enable large array optimizations. */
+  var LARGE_ARRAY_SIZE = 200;
+
+  /** Error message constants. */
+  var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
+      FUNC_ERROR_TEXT = 'Expected a function';
+
+  /** Used to stand-in for `undefined` hash values. */
+  var HASH_UNDEFINED = '__lodash_hash_undefined__';
+
+  /** Used as the maximum memoize cache size. */
+  var MAX_MEMOIZE_SIZE = 500;
+
+  /** Used as the internal argument placeholder. */
+  var PLACEHOLDER = '__lodash_placeholder__';
+
+  /** Used to compose bitmasks for cloning. */
+  var CLONE_DEEP_FLAG = 1,
+      CLONE_FLAT_FLAG = 2,
+      CLONE_SYMBOLS_FLAG = 4;
+
+  /** Used to compose bitmasks for value comparisons. */
+  var COMPARE_PARTIAL_FLAG = 1,
+      COMPARE_UNORDERED_FLAG = 2;
+
+  /** Used to compose bitmasks for function metadata. */
+  var WRAP_BIND_FLAG = 1,
+      WRAP_BIND_KEY_FLAG = 2,
+      WRAP_CURRY_BOUND_FLAG = 4,
+      WRAP_CURRY_FLAG = 8,
+      WRAP_CURRY_RIGHT_FLAG = 16,
+      WRAP_PARTIAL_FLAG = 32,
+      WRAP_PARTIAL_RIGHT_FLAG = 64,
+      WRAP_ARY_FLAG = 128,
+      WRAP_REARG_FLAG = 256,
+      WRAP_FLIP_FLAG = 512;
+
+  /** Used as default options for `_.truncate`. */
+  var DEFAULT_TRUNC_LENGTH = 30,
+      DEFAULT_TRUNC_OMISSION = '...';
+
+  /** Used to detect hot functions by number of calls within a span of milliseconds. */
+  var HOT_COUNT = 800,
+      HOT_SPAN = 16;
+
+  /** Used to indicate the type of lazy iteratees. */
+  var LAZY_FILTER_FLAG = 1,
+      LAZY_MAP_FLAG = 2,
+      LAZY_WHILE_FLAG = 3;
+
+  /** Used as references for various `Number` constants. */
+  var INFINITY = 1 / 0,
+      MAX_SAFE_INTEGER = 9007199254740991,
+      MAX_INTEGER = 1.7976931348623157e+308,
+      NAN = 0 / 0;
+
+  /** Used as references for the maximum length and index of an array. */
+  var MAX_ARRAY_LENGTH = 4294967295,
+      MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
+      HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
+
+  /** Used to associate wrap methods with their bit flags. */
+  var wrapFlags = [
+    ['ary', WRAP_ARY_FLAG],
+    ['bind', WRAP_BIND_FLAG],
+    ['bindKey', WRAP_BIND_KEY_FLAG],
+    ['curry', WRAP_CURRY_FLAG],
+    ['curryRight', WRAP_CURRY_RIGHT_FLAG],
+    ['flip', WRAP_FLIP_FLAG],
+    ['partial', WRAP_PARTIAL_FLAG],
+    ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
+    ['rearg', WRAP_REARG_FLAG]
+  ];
+
+  /** `Object#toString` result references. */
+  var argsTag = '[object Arguments]',
+      arrayTag = '[object Array]',
+      asyncTag = '[object AsyncFunction]',
+      boolTag = '[object Boolean]',
+      dateTag = '[object Date]',
+      domExcTag = '[object DOMException]',
+      errorTag = '[object Error]',
+      funcTag = '[object Function]',
+      genTag = '[object GeneratorFunction]',
+      mapTag = '[object Map]',
+      numberTag = '[object Number]',
+      nullTag = '[object Null]',
+      objectTag = '[object Object]',
+      promiseTag = '[object Promise]',
+      proxyTag = '[object Proxy]',
+      regexpTag = '[object RegExp]',
+      setTag = '[object Set]',
+      stringTag = '[object String]',
+      symbolTag = '[object Symbol]',
+      undefinedTag = '[object Undefined]',
+      weakMapTag = '[object WeakMap]',
+      weakSetTag = '[object WeakSet]';
+
+  var arrayBufferTag = '[object ArrayBuffer]',
+      dataViewTag = '[object DataView]',
+      float32Tag = '[object Float32Array]',
+      float64Tag = '[object Float64Array]',
+      int8Tag = '[object Int8Array]',
+      int16Tag = '[object Int16Array]',
+      int32Tag = '[object Int32Array]',
+      uint8Tag = '[object Uint8Array]',
+      uint8ClampedTag = '[object Uint8ClampedArray]',
+      uint16Tag = '[object Uint16Array]',
+      uint32Tag = '[object Uint32Array]';
+
+  /** Used to match empty string literals in compiled template source. */
+  var reEmptyStringLeading = /\b__p \+= '';/g,
+      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
+      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
+
+  /** Used to match HTML entities and HTML characters. */
+  var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
+      reUnescapedHtml = /[&<>"']/g,
+      reHasEscapedHtml = RegExp(reEscapedHtml.source),
+      reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
+
+  /** Used to match template delimiters. */
+  var reEscape = /<%-([\s\S]+?)%>/g,
+      reEvaluate = /<%([\s\S]+?)%>/g,
+      reInterpolate = /<%=([\s\S]+?)%>/g;
+
+  /** Used to match property names within property paths. */
+  var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
+      reIsPlainProp = /^\w*$/,
+      rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
+
+  /**
+   * Used to match `RegExp`
+   * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
+   */
+  var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
+      reHasRegExpChar = RegExp(reRegExpChar.source);
+
+  /** Used to match leading and trailing whitespace. */
+  var reTrim = /^\s+|\s+$/g,
+      reTrimStart = /^\s+/,
+      reTrimEnd = /\s+$/;
+
+  /** Used to match wrap detail comments. */
+  var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
+      reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
+      reSplitDetails = /,? & /;
+
+  /** Used to match words composed of alphanumeric characters. */
+  var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
+
+  /** Used to match backslashes in property paths. */
+  var reEscapeChar = /\\(\\)?/g;
+
+  /**
+   * Used to match
+   * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
+   */
+  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
+
+  /** Used to match `RegExp` flags from their coerced string values. */
+  var reFlags = /\w*$/;
+
+  /** Used to detect bad signed hexadecimal string values. */
+  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
+
+  /** Used to detect binary string values. */
+  var reIsBinary = /^0b[01]+$/i;
+
+  /** Used to detect host constructors (Safari). */
+  var reIsHostCtor = /^\[object .+?Constructor\]$/;
+
+  /** Used to detect octal string values. */
+  var reIsOctal = /^0o[0-7]+$/i;
+
+  /** Used to detect unsigned integer values. */
+  var reIsUint = /^(?:0|[1-9]\d*)$/;
+
+  /** Used to match Latin Unicode letters (excluding mathematical operators). */
+  var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
+
+  /** Used to ensure capturing order of template delimiters. */
+  var reNoMatch = /($^)/;
+
+  /** Used to match unescaped characters in compiled string literals. */
+  var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
+
+  /** Used to compose unicode character classes. */
+  var rsAstralRange = '\\ud800-\\udfff',
+      rsComboMarksRange = '\\u0300-\\u036f',
+      reComboHalfMarksRange = '\\ufe20-\\ufe2f',
+      rsComboSymbolsRange = '\\u20d0-\\u20ff',
+      rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
+      rsDingbatRange = '\\u2700-\\u27bf',
+      rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
+      rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
+      rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
+      rsPunctuationRange = '\\u2000-\\u206f',
+      rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
+      rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
+      rsVarRange = '\\ufe0e\\ufe0f',
+      rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
+
+  /** Used to compose unicode capture groups. */
+  var rsApos = "['\u2019]",
+      rsAstral = '[' + rsAstralRange + ']',
+      rsBreak = '[' + rsBreakRange + ']',
+      rsCombo = '[' + rsComboRange + ']',
+      rsDigits = '\\d+',
+      rsDingbat = '[' + rsDingbatRange + ']',
+      rsLower = '[' + rsLowerRange + ']',
+      rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
+      rsFitz = '\\ud83c[\\udffb-\\udfff]',
+      rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
+      rsNonAstral = '[^' + rsAstralRange + ']',
+      rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
+      rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
+      rsUpper = '[' + rsUpperRange + ']',
+      rsZWJ = '\\u200d';
+
+  /** Used to compose unicode regexes. */
+  var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
+      rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
+      rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
+      rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
+      reOptMod = rsModifier + '?',
+      rsOptVar = '[' + rsVarRange + ']?',
+      rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
+      rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
+      rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
+      rsSeq = rsOptVar + reOptMod + rsOptJoin,
+      rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
+      rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
+
+  /** Used to match apostrophes. */
+  var reApos = RegExp(rsApos, 'g');
+
+  /**
+   * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
+   * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
+   */
+  var reComboMark = RegExp(rsCombo, 'g');
+
+  /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
+  var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
+
+  /** Used to match complex or compound words. */
+  var reUnicodeWord = RegExp([
+    rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
+    rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
+    rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
+    rsUpper + '+' + rsOptContrUpper,
+    rsOrdUpper,
+    rsOrdLower,
+    rsDigits,
+    rsEmoji
+  ].join('|'), 'g');
+
+  /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
+  var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange  + rsComboRange + rsVarRange + ']');
+
+  /** Used to detect strings that need a more robust regexp to match words. */
+  var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
+
+  /** Used to assign default `context` object properties. */
+  var contextProps = [
+    'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
+    'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
+    'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
+    'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
+    '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
+  ];
+
+  /** Used to make template sourceURLs easier to identify. */
+  var templateCounter = -1;
+
+  /** Used to identify `toStringTag` values of typed arrays. */
+  var typedArrayTags = {};
+  typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
+  typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
+  typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
+  typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
+  typedArrayTags[uint32Tag] = true;
+  typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
+  typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
+  typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
+  typedArrayTags[errorTag] = typedArrayTags[funcTag] =
+  typedArrayTags[mapTag] = typedArrayTags[numberTag] =
+  typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
+  typedArrayTags[setTag] = typedArrayTags[stringTag] =
+  typedArrayTags[weakMapTag] = false;
+
+  /** Used to identify `toStringTag` values supported by `_.clone`. */
+  var cloneableTags = {};
+  cloneableTags[argsTag] = cloneableTags[arrayTag] =
+  cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
+  cloneableTags[boolTag] = cloneableTags[dateTag] =
+  cloneableTags[float32Tag] = cloneableTags[float64Tag] =
+  cloneableTags[int8Tag] = cloneableTags[int16Tag] =
+  cloneableTags[int32Tag] = cloneableTags[mapTag] =
+  cloneableTags[numberTag] = cloneableTags[objectTag] =
+  cloneableTags[regexpTag] = cloneableTags[setTag] =
+  cloneableTags[stringTag] = cloneableTags[symbolTag] =
+  cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
+  cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
+  cloneableTags[errorTag] = cloneableTags[funcTag] =
+  cloneableTags[weakMapTag] = false;
+
+  /** Used to map Latin Unicode letters to basic Latin letters. */
+  var deburredLetters = {
+    // Latin-1 Supplement block.
+    '\xc0': 'A',  '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
+    '\xe0': 'a',  '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
+    '\xc7': 'C',  '\xe7': 'c',
+    '\xd0': 'D',  '\xf0': 'd',
+    '\xc8': 'E',  '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
+    '\xe8': 'e',  '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
+    '\xcc': 'I',  '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
+    '\xec': 'i',  '\xed': 'i', '\xee': 'i', '\xef': 'i',
+    '\xd1': 'N',  '\xf1': 'n',
+    '\xd2': 'O',  '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
+    '\xf2': 'o',  '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
+    '\xd9': 'U',  '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
+    '\xf9': 'u',  '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
+    '\xdd': 'Y',  '\xfd': 'y', '\xff': 'y',
+    '\xc6': 'Ae', '\xe6': 'ae',
+    '\xde': 'Th', '\xfe': 'th',
+    '\xdf': 'ss',
+    // Latin Extended-A block.
+    '\u0100': 'A',  '\u0102': 'A', '\u0104': 'A',
+    '\u0101': 'a',  '\u0103': 'a', '\u0105': 'a',
+    '\u0106': 'C',  '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
+    '\u0107': 'c',  '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
+    '\u010e': 'D',  '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
+    '\u0112': 'E',  '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
+    '\u0113': 'e',  '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
+    '\u011c': 'G',  '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
+    '\u011d': 'g',  '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
+    '\u0124': 'H',  '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
+    '\u0128': 'I',  '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
+    '\u0129': 'i',  '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
+    '\u0134': 'J',  '\u0135': 'j',
+    '\u0136': 'K',  '\u0137': 'k', '\u0138': 'k',
+    '\u0139': 'L',  '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
+    '\u013a': 'l',  '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
+    '\u0143': 'N',  '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
+    '\u0144': 'n',  '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
+    '\u014c': 'O',  '\u014e': 'O', '\u0150': 'O',
+    '\u014d': 'o',  '\u014f': 'o', '\u0151': 'o',
+    '\u0154': 'R',  '\u0156': 'R', '\u0158': 'R',
+    '\u0155': 'r',  '\u0157': 'r', '\u0159': 'r',
+    '\u015a': 'S',  '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
+    '\u015b': 's',  '\u015d': 's', '\u015f': 's', '\u0161': 's',
+    '\u0162': 'T',  '\u0164': 'T', '\u0166': 'T',
+    '\u0163': 't',  '\u0165': 't', '\u0167': 't',
+    '\u0168': 'U',  '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
+    '\u0169': 'u',  '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
+    '\u0174': 'W',  '\u0175': 'w',
+    '\u0176': 'Y',  '\u0177': 'y', '\u0178': 'Y',
+    '\u0179': 'Z',  '\u017b': 'Z', '\u017d': 'Z',
+    '\u017a': 'z',  '\u017c': 'z', '\u017e': 'z',
+    '\u0132': 'IJ', '\u0133': 'ij',
+    '\u0152': 'Oe', '\u0153': 'oe',
+    '\u0149': "'n", '\u017f': 's'
+  };
+
+  /** Used to map characters to HTML entities. */
+  var htmlEscapes = {
+    '&': '&amp;',
+    '<': '&lt;',
+    '>': '&gt;',
+    '"': '&quot;',
+    "'": '&#39;'
+  };
+
+  /** Used to map HTML entities to characters. */
+  var htmlUnescapes = {
+    '&amp;': '&',
+    '&lt;': '<',
+    '&gt;': '>',
+    '&quot;': '"',
+    '&#39;': "'"
+  };
+
+  /** Used to escape characters for inclusion in compiled string literals. */
+  var stringEscapes = {
+    '\\': '\\',
+    "'": "'",
+    '\n': 'n',
+    '\r': 'r',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+
+  /** Built-in method references without a dependency on `root`. */
+  var freeParseFloat = parseFloat,
+      freeParseInt = parseInt;
+
+  /** Detect free variable `global` from Node.js. */
+  var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
+
+  /** Detect free variable `self`. */
+  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+  /** Used as a reference to the global object. */
+  var root = freeGlobal || freeSelf || Function('return this')();
+
+  /** Detect free variable `exports`. */
+  var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
+
+  /** Detect free variable `module`. */
+  var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
+
+  /** Detect the popular CommonJS extension `module.exports`. */
+  var moduleExports = freeModule && freeModule.exports === freeExports;
+
+  /** Detect free variable `process` from Node.js. */
+  var freeProcess = moduleExports && freeGlobal.process;
+
+  /** Used to access faster Node.js helpers. */
+  var nodeUtil = (function() {
+    try {
+      // Use `util.types` for Node.js 10+.
+      var types = freeModule && freeModule.require && freeModule.require('util').types;
+
+      if (types) {
+        return types;
+      }
+
+      // Legacy `process.binding('util')` for Node.js < 10.
+      return freeProcess && freeProcess.binding && freeProcess.binding('util');
+    } catch (e) {}
+  }());
+
+  /* Node.js helper references. */
+  var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
+      nodeIsDate = nodeUtil && nodeUtil.isDate,
+      nodeIsMap = nodeUtil && nodeUtil.isMap,
+      nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
+      nodeIsSet = nodeUtil && nodeUtil.isSet,
+      nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * A faster alternative to `Function#apply`, this function invokes `func`
+   * with the `this` binding of `thisArg` and the arguments of `args`.
+   *
+   * @private
+   * @param {Function} func The function to invoke.
+   * @param {*} thisArg The `this` binding of `func`.
+   * @param {Array} args The arguments to invoke `func` with.
+   * @returns {*} Returns the result of `func`.
+   */
+  function apply(func, thisArg, args) {
+    switch (args.length) {
+      case 0: return func.call(thisArg);
+      case 1: return func.call(thisArg, args[0]);
+      case 2: return func.call(thisArg, args[0], args[1]);
+      case 3: return func.call(thisArg, args[0], args[1], args[2]);
+    }
+    return func.apply(thisArg, args);
+  }
+
+  /**
+   * A specialized version of `baseAggregator` for arrays.
+   *
+   * @private
+   * @param {Array} [array] The array to iterate over.
+   * @param {Function} setter The function to set `accumulator` values.
+   * @param {Function} iteratee The iteratee to transform keys.
+   * @param {Object} accumulator The initial aggregated object.
+   * @returns {Function} Returns `accumulator`.
+   */
+  function arrayAggregator(array, setter, iteratee, accumulator) {
+    var index = -1,
+        length = array == null ? 0 : array.length;
+
+    while (++index < length) {
+      var value = array[index];
+      setter(accumulator, value, iteratee(value), array);
+    }
+    return accumulator;
+  }
+
+  /**
+   * A specialized version of `_.forEach` for arrays without support for
+   * iteratee shorthands.
+   *
+   * @private
+   * @param {Array} [array] The array to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @returns {Array} Returns `array`.
+   */
+  function arrayEach(array, iteratee) {
+    var index = -1,
+        length = array == null ? 0 : array.length;
+
+    while (++index < length) {
+      if (iteratee(array[index], index, array) === false) {
+        break;
+      }
+    }
+    return array;
+  }
+
+  /**
+   * A specialized version of `_.forEachRight` for arrays without support for
+   * iteratee shorthands.
+   *
+   * @private
+   * @param {Array} [array] The array to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @returns {Array} Returns `array`.
+   */
+  function arrayEachRight(array, iteratee) {
+    var length = array == null ? 0 : array.length;
+
+    while (length--) {
+      if (iteratee(array[length], length, array) === false) {
+        break;
+      }
+    }
+    return array;
+  }
+
+  /**
+   * A specialized version of `_.every` for arrays without support for
+   * iteratee shorthands.
+   *
+   * @private
+   * @param {Array} [array] The array to iterate over.
+   * @param {Function} predicate The function invoked per iteration.
+   * @returns {boolean} Returns `true` if all elements pass the predicate check,
+   *  else `false`.
+   */
+  function arrayEvery(array, predicate) {
+    var index = -1,
+        length = array == null ? 0 : array.length;
+
+    while (++index < length) {
+      if (!predicate(array[index], index, array)) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  /**
+   * A specialized version of `_.filter` for arrays without support for
+   * iteratee shorthands.
+   *
+   * @private
+   * @param {Array} [array] The array to iterate over.
+   * @param {Function} predicate The function invoked per iteration.
+   * @returns {Array} Returns the new filtered array.
+   */
+  function arrayFilter(array, predicate) {
+    var index = -1,
+        length = array == null ? 0 : array.length,
+        resIndex = 0,
+        result = [];
+
+    while (++index < length) {
+      var value = array[index];
+      if (predicate(value, index, array)) {
+        result[resIndex++] = value;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * A specialized version of `_.includes` for arrays without support for
+   * specifying an index to search from.
+   *
+   * @private
+   * @param {Array} [array] The array to inspect.
+   * @param {*} target The value to search for.
+   * @returns {boolean} Returns `true` if `target` is found, else `false`.
+   */
+  function arrayIncludes(array, value) {
+    var length = array == null ? 0 : array.length;
+    return !!length && baseIndexOf(array, value, 0) > -1;
+  }
+
+  /**
+   * This function is like `arrayIncludes` except that it accepts a comparator.
+   *
+   * @private
+   * @param {Array} [array] The array to inspect.
+   * @param {*} target The value to search for.
+   * @param {Function} comparator The comparator invoked per element.
+   * @returns {boolean} Returns `true` if `target` is found, else `false`.
+   */
+  function arrayIncludesWith(array, value, comparator) {
+    var index = -1,
+        length = array == null ? 0 : array.length;
+
+    while (++index < length) {
+      if (comparator(value, array[index])) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * A specialized version of `_.map` for arrays without support for iteratee
+   * shorthands.
+   *
+   * @private
+   * @param {Array} [array] The array to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @returns {Array} Returns the new mapped array.
+   */
+  function arrayMap(array, iteratee) {
+    var index = -1,
+        length = array == null ? 0 : array.length,
+        result = Array(length);
+
+    while (++index < length) {
+      result[index] = iteratee(array[index], index, array);
+    }
+    return result;
+  }
+
+  /**
+   * Appends the elements of `values` to `array`.
+   *
+   * @private
+   * @param {Array} array The array to modify.
+   * @param {Array} values The values to append.
+   * @returns {Array} Returns `array`.
+   */
+  function arrayPush(array, values) {
+    var index = -1,
+        length = values.length,
+        offset = array.length;
+
+    while (++index < length) {
+      array[offset + index] = values[index];
+    }
+    return array;
+  }
+
+  /**
+   * A specialized version of `_.reduce` for arrays without support for
+   * iteratee shorthands.
+   *
+   * @private
+   * @param {Array} [array] The array to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @param {*} [accumulator] The initial value.
+   * @param {boolean} [initAccum] Specify using the first element of `array` as
+   *  the initial value.
+   * @returns {*} Returns the accumulated value.
+   */
+  function arrayReduce(array, iteratee, accumulator, initAccum) {
+    var index = -1,
+        length = array == null ? 0 : array.length;
+
+    if (initAccum && length) {
+      accumulator = array[++index];
+    }
+    while (++index < length) {
+      accumulator = iteratee(accumulator, array[index], index, array);
+    }
+    return accumulator;
+  }
+
+  /**
+   * A specialized version of `_.reduceRight` for arrays without support for
+   * iteratee shorthands.
+   *
+   * @private
+   * @param {Array} [array] The array to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @param {*} [accumulator] The initial value.
+   * @param {boolean} [initAccum] Specify using the last element of `array` as
+   *  the initial value.
+   * @returns {*} Returns the accumulated value.
+   */
+  function arrayReduceRight(array, iteratee, accumulator, initAccum) {
+    var length = array == null ? 0 : array.length;
+    if (initAccum && length) {
+      accumulator = array[--length];
+    }
+    while (length--) {
+      accumulator = iteratee(accumulator, array[length], length, array);
+    }
+    return accumulator;
+  }
+
+  /**
+   * A specialized version of `_.some` for arrays without support for iteratee
+   * shorthands.
+   *
+   * @private
+   * @param {Array} [array] The array to iterate over.
+   * @param {Function} predicate The function invoked per iteration.
+   * @returns {boolean} Returns `true` if any element passes the predicate check,
+   *  else `false`.
+   */
+  function arraySome(array, predicate) {
+    var index = -1,
+        length = array == null ? 0 : array.length;
+
+    while (++index < length) {
+      if (predicate(array[index], index, array)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * Gets the size of an ASCII `string`.
+   *
+   * @private
+   * @param {string} string The string inspect.
+   * @returns {number} Returns the string size.
+   */
+  var asciiSize = baseProperty('length');
+
+  /**
+   * Converts an ASCII `string` to an array.
+   *
+   * @private
+   * @param {string} string The string to convert.
+   * @returns {Array} Returns the converted array.
+   */
+  function asciiToArray(string) {
+    return string.split('');
+  }
+
+  /**
+   * Splits an ASCII `string` into an array of its words.
+   *
+   * @private
+   * @param {string} The string to inspect.
+   * @returns {Array} Returns the words of `string`.
+   */
+  function asciiWords(string) {
+    return string.match(reAsciiWord) || [];
+  }
+
+  /**
+   * The base implementation of methods like `_.findKey` and `_.findLastKey`,
+   * without support for iteratee shorthands, which iterates over `collection`
+   * using `eachFunc`.
+   *
+   * @private
+   * @param {Array|Object} collection The collection to inspect.
+   * @param {Function} predicate The function invoked per iteration.
+   * @param {Function} eachFunc The function to iterate over `collection`.
+   * @returns {*} Returns the found element or its key, else `undefined`.
+   */
+  function baseFindKey(collection, predicate, eachFunc) {
+    var result;
+    eachFunc(collection, function(value, key, collection) {
+      if (predicate(value, key, collection)) {
+        result = key;
+        return false;
+      }
+    });
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.findIndex` and `_.findLastIndex` without
+   * support for iteratee shorthands.
+   *
+   * @private
+   * @param {Array} array The array to inspect.
+   * @param {Function} predicate The function invoked per iteration.
+   * @param {number} fromIndex The index to search from.
+   * @param {boolean} [fromRight] Specify iterating from right to left.
+   * @returns {number} Returns the index of the matched value, else `-1`.
+   */
+  function baseFindIndex(array, predicate, fromIndex, fromRight) {
+    var length = array.length,
+        index = fromIndex + (fromRight ? 1 : -1);
+
+    while ((fromRight ? index-- : ++index < length)) {
+      if (predicate(array[index], index, array)) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
+   *
+   * @private
+   * @param {Array} array The array to inspect.
+   * @param {*} value The value to search for.
+   * @param {number} fromIndex The index to search from.
+   * @returns {number} Returns the index of the matched value, else `-1`.
+   */
+  function baseIndexOf(array, value, fromIndex) {
+    return value === value
+      ? strictIndexOf(array, value, fromIndex)
+      : baseFindIndex(array, baseIsNaN, fromIndex);
+  }
+
+  /**
+   * This function is like `baseIndexOf` except that it accepts a comparator.
+   *
+   * @private
+   * @param {Array} array The array to inspect.
+   * @param {*} value The value to search for.
+   * @param {number} fromIndex The index to search from.
+   * @param {Function} comparator The comparator invoked per element.
+   * @returns {number} Returns the index of the matched value, else `-1`.
+   */
+  function baseIndexOfWith(array, value, fromIndex, comparator) {
+    var index = fromIndex - 1,
+        length = array.length;
+
+    while (++index < length) {
+      if (comparator(array[index], value)) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * The base implementation of `_.isNaN` without support for number objects.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+   */
+  function baseIsNaN(value) {
+    return value !== value;
+  }
+
+  /**
+   * The base implementation of `_.mean` and `_.meanBy` without support for
+   * iteratee shorthands.
+   *
+   * @private
+   * @param {Array} array The array to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @returns {number} Returns the mean.
+   */
+  function baseMean(array, iteratee) {
+    var length = array == null ? 0 : array.length;
+    return length ? (baseSum(array, iteratee) / length) : NAN;
+  }
+
+  /**
+   * The base implementation of `_.property` without support for deep paths.
+   *
+   * @private
+   * @param {string} key The key of the property to get.
+   * @returns {Function} Returns the new accessor function.
+   */
+  function baseProperty(key) {
+    return function(object) {
+      return object == null ? undefined : object[key];
+    };
+  }
+
+  /**
+   * The base implementation of `_.propertyOf` without support for deep paths.
+   *
+   * @private
+   * @param {Object} object The object to query.
+   * @returns {Function} Returns the new accessor function.
+   */
+  function basePropertyOf(object) {
+    return function(key) {
+      return object == null ? undefined : object[key];
+    };
+  }
+
+  /**
+   * The base implementation of `_.reduce` and `_.reduceRight`, without support
+   * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
+   *
+   * @private
+   * @param {Array|Object} collection The collection to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @param {*} accumulator The initial value.
+   * @param {boolean} initAccum Specify using the first or last element of
+   *  `collection` as the initial value.
+   * @param {Function} eachFunc The function to iterate over `collection`.
+   * @returns {*} Returns the accumulated value.
+   */
+  function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
+    eachFunc(collection, function(value, index, collection) {
+      accumulator = initAccum
+        ? (initAccum = false, value)
+        : iteratee(accumulator, value, index, collection);
+    });
+    return accumulator;
+  }
+
+  /**
+   * The base implementation of `_.sortBy` which uses `comparer` to define the
+   * sort order of `array` and replaces criteria objects with their corresponding
+   * values.
+   *
+   * @private
+   * @param {Array} array The array to sort.
+   * @param {Function} comparer The function to define sort order.
+   * @returns {Array} Returns `array`.
+   */
+  function baseSortBy(array, comparer) {
+    var length = array.length;
+
+    array.sort(comparer);
+    while (length--) {
+      array[length] = array[length].value;
+    }
+    return array;
+  }
+
+  /**
+   * The base implementation of `_.sum` and `_.sumBy` without support for
+   * iteratee shorthands.
+   *
+   * @private
+   * @param {Array} array The array to iterate over.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @returns {number} Returns the sum.
+   */
+  function baseSum(array, iteratee) {
+    var result,
+        index = -1,
+        length = array.length;
+
+    while (++index < length) {
+      var current = iteratee(array[index]);
+      if (current !== undefined) {
+        result = result === undefined ? current : (result + current);
+      }
+    }
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.times` without support for iteratee shorthands
+   * or max array length checks.
+   *
+   * @private
+   * @param {number} n The number of times to invoke `iteratee`.
+   * @param {Function} iteratee The function invoked per iteration.
+   * @returns {Array} Returns the array of results.
+   */
+  function baseTimes(n, iteratee) {
+    var index = -1,
+        result = Array(n);
+
+    while (++index < n) {
+      result[index] = iteratee(index);
+    }
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
+   * of key-value pairs for `object` corresponding to the property names of `props`.
+   *
+   * @private
+   * @param {Object} object The object to query.
+   * @param {Array} props The property names to get values for.
+   * @returns {Object} Returns the key-value pairs.
+   */
+  function baseToPairs(object, props) {
+    return arrayMap(props, function(key) {
+      return [key, object[key]];
+    });
+  }
+
+  /**
+   * The base implementation of `_.unary` without support for storing metadata.
+   *
+   * @private
+   * @param {Function} func The function to cap arguments for.
+   * @returns {Function} Returns the new capped function.
+   */
+  function baseUnary(func) {
+    return function(value) {
+      return func(value);
+    };
+  }
+
+  /**
+   * The base implementation of `_.values` and `_.valuesIn` which creates an
+   * array of `object` property values corresponding to the property names
+   * of `props`.
+   *
+   * @private
+   * @param {Object} object The object to query.
+   * @param {Array} props The property names to get values for.
+   * @returns {Object} Returns the array of property values.
+   */
+  function baseValues(object, props) {
+    return arrayMap(props, function(key) {
+      return object[key];
+    });
+  }
+
+  /**
+   * Checks if a `cache` value for `key` exists.
+   *
+   * @private
+   * @param {Object} cache The cache to query.
+   * @param {string} key The key of the entry to check.
+   * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+   */
+  function cacheHas(cache, key) {
+    return cache.has(key);
+  }
+
+  /**
+   * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
+   * that is not found in the character symbols.
+   *
+   * @private
+   * @param {Array} strSymbols The string symbols to inspect.
+   * @param {Array} chrSymbols The character symbols to find.
+   * @returns {number} Returns the index of the first unmatched string symbol.
+   */
+  function charsStartIndex(strSymbols, chrSymbols) {
+    var index = -1,
+        length = strSymbols.length;
+
+    while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
+    return index;
+  }
+
+  /**
+   * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
+   * that is not found in the character symbols.
+   *
+   * @private
+   * @param {Array} strSymbols The string symbols to inspect.
+   * @param {Array} chrSymbols The character symbols to find.
+   * @returns {number} Returns the index of the last unmatched string symbol.
+   */
+  function charsEndIndex(strSymbols, chrSymbols) {
+    var index = strSymbols.length;
+
+    while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
+    return index;
+  }
+
+  /**
+   * Gets the number of `placeholder` occurrences in `array`.
+   *
+   * @private
+   * @param {Array} array The array to inspect.
+   * @param {*} placeholder The placeholder to search for.
+   * @returns {number} Returns the placeholder count.
+   */
+  function countHolders(array, placeholder) {
+    var length = array.length,
+        result = 0;
+
+    while (length--) {
+      if (array[length] === placeholder) {
+        ++result;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
+   * letters to basic Latin letters.
+   *
+   * @private
+   * @param {string} letter The matched letter to deburr.
+   * @returns {string} Returns the deburred letter.
+   */
+  var deburrLetter = basePropertyOf(deburredLetters);
+
+  /**
+   * Used by `_.escape` to convert characters to HTML entities.
+   *
+   * @private
+   * @param {string} chr The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  var escapeHtmlChar = basePropertyOf(htmlEscapes);
+
+  /**
+   * Used by `_.template` to escape characters for inclusion in compiled string literals.
+   *
+   * @private
+   * @param {string} chr The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  function escapeStringChar(chr) {
+    return '\\' + stringEscapes[chr];
+  }
+
+  /**
+   * Gets the value at `key` of `object`.
+   *
+   * @private
+   * @param {Object} [object] The object to query.
+   * @param {string} key The key of the property to get.
+   * @returns {*} Returns the property value.
+   */
+  function getValue(object, key) {
+    return object == null ? undefined : object[key];
+  }
+
+  /**
+   * Checks if `string` contains Unicode symbols.
+   *
+   * @private
+   * @param {string} string The string to inspect.
+   * @returns {boolean} Returns `true` if a symbol is found, else `false`.
+   */
+  function hasUnicode(string) {
+    return reHasUnicode.test(string);
+  }
+
+  /**
+   * Checks if `string` contains a word composed of Unicode symbols.
+   *
+   * @private
+   * @param {string} string The string to inspect.
+   * @returns {boolean} Returns `true` if a word is found, else `false`.
+   */
+  function hasUnicodeWord(string) {
+    return reHasUnicodeWord.test(string);
+  }
+
+  /**
+   * Converts `iterator` to an array.
+   *
+   * @private
+   * @param {Object} iterator The iterator to convert.
+   * @returns {Array} Returns the converted array.
+   */
+  function iteratorToArray(iterator) {
+    var data,
+        result = [];
+
+    while (!(data = iterator.next()).done) {
+      result.push(data.value);
+    }
+    return result;
+  }
+
+  /**
+   * Converts `map` to its key-value pairs.
+   *
+   * @private
+   * @param {Object} map The map to convert.
+   * @returns {Array} Returns the key-value pairs.
+   */
+  function mapToArray(map) {
+    var index = -1,
+        result = Array(map.size);
+
+    map.forEach(function(value, key) {
+      result[++index] = [key, value];
+    });
+    return result;
+  }
+
+  /**
+   * Creates a unary function that invokes `func` with its argument transformed.
+   *
+   * @private
+   * @param {Function} func The function to wrap.
+   * @param {Function} transform The argument transform.
+   * @returns {Function} Returns the new function.
+   */
+  function overArg(func, transform) {
+    return function(arg) {
+      return func(transform(arg));
+    };
+  }
+
+  /**
+   * Replaces all `placeholder` elements in `array` with an internal placeholder
+   * and returns an array of their indexes.
+   *
+   * @private
+   * @param {Array} array The array to modify.
+   * @param {*} placeholder The placeholder to replace.
+   * @returns {Array} Returns the new array of placeholder indexes.
+   */
+  function replaceHolders(array, placeholder) {
+    var index = -1,
+        length = array.length,
+        resIndex = 0,
+        result = [];
+
+    while (++index < length) {
+      var value = array[index];
+      if (value === placeholder || value === PLACEHOLDER) {
+        array[index] = PLACEHOLDER;
+        result[resIndex++] = index;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Gets the value at `key`, unless `key` is "__proto__".
+   *
+   * @private
+   * @param {Object} object The object to query.
+   * @param {string} key The key of the property to get.
+   * @returns {*} Returns the property value.
+   */
+  function safeGet(object, key) {
+    return key == '__proto__'
+      ? undefined
+      : object[key];
+  }
+
+  /**
+   * Converts `set` to an array of its values.
+   *
+   * @private
+   * @param {Object} set The set to convert.
+   * @returns {Array} Returns the values.
+   */
+  function setToArray(set) {
+    var index = -1,
+        result = Array(set.size);
+
+    set.forEach(function(value) {
+      result[++index] = value;
+    });
+    return result;
+  }
+
+  /**
+   * Converts `set` to its value-value pairs.
+   *
+   * @private
+   * @param {Object} set The set to convert.
+   * @returns {Array} Returns the value-value pairs.
+   */
+  function setToPairs(set) {
+    var index = -1,
+        result = Array(set.size);
+
+    set.forEach(function(value) {
+      result[++index] = [value, value];
+    });
+    return result;
+  }
+
+  /**
+   * A specialized version of `_.indexOf` which performs strict equality
+   * comparisons of values, i.e. `===`.
+   *
+   * @private
+   * @param {Array} array The array to inspect.
+   * @param {*} value The value to search for.
+   * @param {number} fromIndex The index to search from.
+   * @returns {number} Returns the index of the matched value, else `-1`.
+   */
+  function strictIndexOf(array, value, fromIndex) {
+    var index = fromIndex - 1,
+        length = array.length;
+
+    while (++index < length) {
+      if (array[index] === value) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * A specialized version of `_.lastIndexOf` which performs strict equality
+   * comparisons of values, i.e. `===`.
+   *
+   * @private
+   * @param {Array} array The array to inspect.
+   * @param {*} value The value to search for.
+   * @param {number} fromIndex The index to search from.
+   * @returns {number} Returns the index of the matched value, else `-1`.
+   */
+  function strictLastIndexOf(array, value, fromIndex) {
+    var index = fromIndex + 1;
+    while (index--) {
+      if (array[index] === value) {
+        return index;
+      }
+    }
+    return index;
+  }
+
+  /**
+   * Gets the number of symbols in `string`.
+   *
+   * @private
+   * @param {string} string The string to inspect.
+   * @returns {number} Returns the string size.
+   */
+  function stringSize(string) {
+    return hasUnicode(string)
+      ? unicodeSize(string)
+      : asciiSize(string);
+  }
+
+  /**
+   * Converts `string` to an array.
+   *
+   * @private
+   * @param {string} string The string to convert.
+   * @returns {Array} Returns the converted array.
+   */
+  function stringToArray(string) {
+    return hasUnicode(string)
+      ? unicodeToArray(string)
+      : asciiToArray(string);
+  }
+
+  /**
+   * Used by `_.unescape` to convert HTML entities to characters.
+   *
+   * @private
+   * @param {string} chr The matched character to unescape.
+   * @returns {string} Returns the unescaped character.
+   */
+  var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
+
+  /**
+   * Gets the size of a Unicode `string`.
+   *
+   * @private
+   * @param {string} string The string inspect.
+   * @returns {number} Returns the string size.
+   */
+  function unicodeSize(string) {
+    var result = reUnicode.lastIndex = 0;
+    while (reUnicode.test(string)) {
+      ++result;
+    }
+    return result;
+  }
+
+  /**
+   * Converts a Unicode `string` to an array.
+   *
+   * @private
+   * @param {string} string The string to convert.
+   * @returns {Array} Returns the converted array.
+   */
+  function unicodeToArray(string) {
+    return string.match(reUnicode) || [];
+  }
+
+  /**
+   * Splits a Unicode `string` into an array of its words.
+   *
+   * @private
+   * @param {string} The string to inspect.
+   * @returns {Array} Returns the words of `string`.
+   */
+  function unicodeWords(string) {
+    return string.match(reUnicodeWord) || [];
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Create a new pristine `lodash` function using the `context` object.
+   *
+   * @static
+   * @memberOf _
+   * @since 1.1.0
+   * @category Util
+   * @param {Object} [context=root] The context object.
+   * @returns {Function} Returns a new `lodash` function.
+   * @example
+   *
+   * _.mixin({ 'foo': _.constant('foo') });
+   *
+   * var lodash = _.runInContext();
+   * lodash.mixin({ 'bar': lodash.constant('bar') });
+   *
+   * _.isFunction(_.foo);
+   * // => true
+   * _.isFunction(_.bar);
+   * // => false
+   *
+   * lodash.isFunction(lodash.foo);
+   * // => false
+   * lodash.isFunction(lodash.bar);
+   * // => true
+   *
+   * // Create a suped-up `defer` in Node.js.
+   * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
+   */
+  var runInContext = (function runInContext(context) {
+    context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
+
+    /** Built-in constructor references. */
+    var Array = context.Array,
+        Date = context.Date,
+        Error = context.Error,
+        Function = context.Function,
+        Math = context.Math,
+        Object = context.Object,
+        RegExp = context.RegExp,
+        String = context.String,
+        TypeError = context.TypeError;
+
+    /** Used for built-in method references. */
+    var arrayProto = Array.prototype,
+        funcProto = Function.prototype,
+        objectProto = Object.prototype;
+
+    /** Used to detect overreaching core-js shims. */
+    var coreJsData = context['__core-js_shared__'];
+
+    /** Used to resolve the decompiled source of functions. */
+    var funcToString = funcProto.toString;
+
+    /** Used to check objects for own properties. */
+    var hasOwnProperty = objectProto.hasOwnProperty;
+
+    /** Used to generate unique IDs. */
+    var idCounter = 0;
+
+    /** Used to detect methods masquerading as native. */
+    var maskSrcKey = (function() {
+      var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
+      return uid ? ('Symbol(src)_1.' + uid) : '';
+    }());
+
+    /**
+     * Used to resolve the
+     * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+     * of values.
+     */
+    var nativeObjectToString = objectProto.toString;
+
+    /** Used to infer the `Object` constructor. */
+    var objectCtorString = funcToString.call(Object);
+
+    /** Used to restore the original `_` reference in `_.noConflict`. */
+    var oldDash = root._;
+
+    /** Used to detect if a method is native. */
+    var reIsNative = RegExp('^' +
+      funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
+      .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
+    );
+
+    /** Built-in value references. */
+    var Buffer = moduleExports ? context.Buffer : undefined,
+        Symbol = context.Symbol,
+        Uint8Array = context.Uint8Array,
+        allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
+        getPrototype = overArg(Object.getPrototypeOf, Object),
+        objectCreate = Object.create,
+        propertyIsEnumerable = objectProto.propertyIsEnumerable,
+        splice = arrayProto.splice,
+        spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
+        symIterator = Symbol ? Symbol.iterator : undefined,
+        symToStringTag = Symbol ? Symbol.toStringTag : undefined;
+
+    var defineProperty = (function() {
+      try {
+        var func = getNative(Object, 'defineProperty');
+        func({}, '', {});
+        return func;
+      } catch (e) {}
+    }());
+
+    /** Mocked built-ins. */
+    var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
+        ctxNow = Date && Date.now !== root.Date.now && Date.now,
+        ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
+
+    /* Built-in method references for those with the same name as other `lodash` methods. */
+    var nativeCeil = Math.ceil,
+        nativeFloor = Math.floor,
+        nativeGetSymbols = Object.getOwnPropertySymbols,
+        nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
+        nativeIsFinite = context.isFinite,
+        nativeJoin = arrayProto.join,
+        nativeKeys = overArg(Object.keys, Object),
+        nativeMax = Math.max,
+        nativeMin = Math.min,
+        nativeNow = Date.now,
+        nativeParseInt = context.parseInt,
+        nativeRandom = Math.random,
+        nativeReverse = arrayProto.reverse;
+
+    /* Built-in method references that are verified to be native. */
+    var DataView = getNative(context, 'DataView'),
+        Map = getNative(context, 'Map'),
+        Promise = getNative(context, 'Promise'),
+        Set = getNative(context, 'Set'),
+        WeakMap = getNative(context, 'WeakMap'),
+        nativeCreate = getNative(Object, 'create');
+
+    /** Used to store function metadata. */
+    var metaMap = WeakMap && new WeakMap;
+
+    /** Used to lookup unminified function names. */
+    var realNames = {};
+
+    /** Used to detect maps, sets, and weakmaps. */
+    var dataViewCtorString = toSource(DataView),
+        mapCtorString = toSource(Map),
+        promiseCtorString = toSource(Promise),
+        setCtorString = toSource(Set),
+        weakMapCtorString = toSource(WeakMap);
+
+    /** Used to convert symbols to primitives and strings. */
+    var symbolProto = Symbol ? Symbol.prototype : undefined,
+        symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
+        symbolToString = symbolProto ? symbolProto.toString : undefined;
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` object which wraps `value` to enable implicit method
+     * chain sequences. Methods that operate on and return arrays, collections,
+     * and functions can be chained together. Methods that retrieve a single value
+     * or may return a primitive value will automatically end the chain sequence
+     * and return the unwrapped value. Otherwise, the value must be unwrapped
+     * with `_#value`.
+     *
+     * Explicit chain sequences, which must be unwrapped with `_#value`, may be
+     * enabled using `_.chain`.
+     *
+     * The execution of chained methods is lazy, that is, it's deferred until
+     * `_#value` is implicitly or explicitly called.
+     *
+     * Lazy evaluation allows several methods to support shortcut fusion.
+     * Shortcut fusion is an optimization to merge iteratee calls; this avoids
+     * the creation of intermediate arrays and can greatly reduce the number of
+     * iteratee executions. Sections of a chain sequence qualify for shortcut
+     * fusion if the section is applied to an array and iteratees accept only
+     * one argument. The heuristic for whether a section qualifies for shortcut
+     * fusion is subject to change.
+     *
+     * Chaining is supported in custom builds as long as the `_#value` method is
+     * directly or indirectly included in the build.
+     *
+     * In addition to lodash methods, wrappers have `Array` and `String` methods.
+     *
+     * The wrapper `Array` methods are:
+     * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
+     *
+     * The wrapper `String` methods are:
+     * `replace` and `split`
+     *
+     * The wrapper methods that support shortcut fusion are:
+     * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
+     * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
+     * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
+     *
+     * The chainable wrapper methods are:
+     * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
+     * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
+     * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
+     * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
+     * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
+     * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
+     * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
+     * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
+     * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
+     * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
+     * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
+     * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
+     * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
+     * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
+     * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
+     * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
+     * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
+     * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
+     * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
+     * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
+     * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
+     * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
+     * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
+     * `zipObject`, `zipObjectDeep`, and `zipWith`
+     *
+     * The wrapper methods that are **not** chainable by default are:
+     * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
+     * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
+     * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
+     * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
+     * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
+     * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
+     * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
+     * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
+     * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
+     * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
+     * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
+     * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
+     * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
+     * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
+     * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
+     * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
+     * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
+     * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
+     * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
+     * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
+     * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
+     * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
+     * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
+     * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
+     * `upperFirst`, `value`, and `words`
+     *
+     * @name _
+     * @constructor
+     * @category Seq
+     * @param {*} value The value to wrap in a `lodash` instance.
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * function square(n) {
+     *   return n * n;
+     * }
+     *
+     * var wrapped = _([1, 2, 3]);
+     *
+     * // Returns an unwrapped value.
+     * wrapped.reduce(_.add);
+     * // => 6
+     *
+     * // Returns a wrapped value.
+     * var squares = wrapped.map(square);
+     *
+     * _.isArray(squares);
+     * // => false
+     *
+     * _.isArray(squares.value());
+     * // => true
+     */
+    function lodash(value) {
+      if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
+        if (value instanceof LodashWrapper) {
+          return value;
+        }
+        if (hasOwnProperty.call(value, '__wrapped__')) {
+          return wrapperClone(value);
+        }
+      }
+      return new LodashWrapper(value);
+    }
+
+    /**
+     * The base implementation of `_.create` without support for assigning
+     * properties to the created object.
+     *
+     * @private
+     * @param {Object} proto The object to inherit from.
+     * @returns {Object} Returns the new object.
+     */
+    var baseCreate = (function() {
+      function object() {}
+      return function(proto) {
+        if (!isObject(proto)) {
+          return {};
+        }
+        if (objectCreate) {
+          return objectCreate(proto);
+        }
+        object.prototype = proto;
+        var result = new object;
+        object.prototype = undefined;
+        return result;
+      };
+    }());
+
+    /**
+     * The function whose prototype chain sequence wrappers inherit from.
+     *
+     * @private
+     */
+    function baseLodash() {
+      // No operation performed.
+    }
+
+    /**
+     * The base constructor for creating `lodash` wrapper objects.
+     *
+     * @private
+     * @param {*} value The value to wrap.
+     * @param {boolean} [chainAll] Enable explicit method chain sequences.
+     */
+    function LodashWrapper(value, chainAll) {
+      this.__wrapped__ = value;
+      this.__actions__ = [];
+      this.__chain__ = !!chainAll;
+      this.__index__ = 0;
+      this.__values__ = undefined;
+    }
+
+    /**
+     * By default, the template delimiters used by lodash are like those in
+     * embedded Ruby (ERB) as well as ES2015 template strings. Change the
+     * following template settings to use alternative delimiters.
+     *
+     * @static
+     * @memberOf _
+     * @type {Object}
+     */
+    lodash.templateSettings = {
+
+      /**
+       * Used to detect `data` property values to be HTML-escaped.
+       *
+       * @memberOf _.templateSettings
+       * @type {RegExp}
+       */
+      'escape': reEscape,
+
+      /**
+       * Used to detect code to be evaluated.
+       *
+       * @memberOf _.templateSettings
+       * @type {RegExp}
+       */
+      'evaluate': reEvaluate,
+
+      /**
+       * Used to detect `data` property values to inject.
+       *
+       * @memberOf _.templateSettings
+       * @type {RegExp}
+       */
+      'interpolate': reInterpolate,
+
+      /**
+       * Used to reference the data object in the template text.
+       *
+       * @memberOf _.templateSettings
+       * @type {string}
+       */
+      'variable': '',
+
+      /**
+       * Used to import variables into the compiled template.
+       *
+       * @memberOf _.templateSettings
+       * @type {Object}
+       */
+      'imports': {
+
+        /**
+         * A reference to the `lodash` function.
+         *
+         * @memberOf _.templateSettings.imports
+         * @type {Function}
+         */
+        '_': lodash
+      }
+    };
+
+    // Ensure wrappers are instances of `baseLodash`.
+    lodash.prototype = baseLodash.prototype;
+    lodash.prototype.constructor = lodash;
+
+    LodashWrapper.prototype = baseCreate(baseLodash.prototype);
+    LodashWrapper.prototype.constructor = LodashWrapper;
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
+     *
+     * @private
+     * @constructor
+     * @param {*} value The value to wrap.
+     */
+    function LazyWrapper(value) {
+      this.__wrapped__ = value;
+      this.__actions__ = [];
+      this.__dir__ = 1;
+      this.__filtered__ = false;
+      this.__iteratees__ = [];
+      this.__takeCount__ = MAX_ARRAY_LENGTH;
+      this.__views__ = [];
+    }
+
+    /**
+     * Creates a clone of the lazy wrapper object.
+     *
+     * @private
+     * @name clone
+     * @memberOf LazyWrapper
+     * @returns {Object} Returns the cloned `LazyWrapper` object.
+     */
+    function lazyClone() {
+      var result = new LazyWrapper(this.__wrapped__);
+      result.__actions__ = copyArray(this.__actions__);
+      result.__dir__ = this.__dir__;
+      result.__filtered__ = this.__filtered__;
+      result.__iteratees__ = copyArray(this.__iteratees__);
+      result.__takeCount__ = this.__takeCount__;
+      result.__views__ = copyArray(this.__views__);
+      return result;
+    }
+
+    /**
+     * Reverses the direction of lazy iteration.
+     *
+     * @private
+     * @name reverse
+     * @memberOf LazyWrapper
+     * @returns {Object} Returns the new reversed `LazyWrapper` object.
+     */
+    function lazyReverse() {
+      if (this.__filtered__) {
+        var result = new LazyWrapper(this);
+        result.__dir__ = -1;
+        result.__filtered__ = true;
+      } else {
+        result = this.clone();
+        result.__dir__ *= -1;
+      }
+      return result;
+    }
+
+    /**
+     * Extracts the unwrapped value from its lazy wrapper.
+     *
+     * @private
+     * @name value
+     * @memberOf LazyWrapper
+     * @returns {*} Returns the unwrapped value.
+     */
+    function lazyValue() {
+      var array = this.__wrapped__.value(),
+          dir = this.__dir__,
+          isArr = isArray(array),
+          isRight = dir < 0,
+          arrLength = isArr ? array.length : 0,
+          view = getView(0, arrLength, this.__views__),
+          start = view.start,
+          end = view.end,
+          length = end - start,
+          index = isRight ? end : (start - 1),
+          iteratees = this.__iteratees__,
+          iterLength = iteratees.length,
+          resIndex = 0,
+          takeCount = nativeMin(length, this.__takeCount__);
+
+      if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
+        return baseWrapperValue(array, this.__actions__);
+      }
+      var result = [];
+
+      outer:
+      while (length-- && resIndex < takeCount) {
+        index += dir;
+
+        var iterIndex = -1,
+            value = array[index];
+
+        while (++iterIndex < iterLength) {
+          var data = iteratees[iterIndex],
+              iteratee = data.iteratee,
+              type = data.type,
+              computed = iteratee(value);
+
+          if (type == LAZY_MAP_FLAG) {
+            value = computed;
+          } else if (!computed) {
+            if (type == LAZY_FILTER_FLAG) {
+              continue outer;
+            } else {
+              break outer;
+            }
+          }
+        }
+        result[resIndex++] = value;
+      }
+      return result;
+    }
+
+    // Ensure `LazyWrapper` is an instance of `baseLodash`.
+    LazyWrapper.prototype = baseCreate(baseLodash.prototype);
+    LazyWrapper.prototype.constructor = LazyWrapper;
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a hash object.
+     *
+     * @private
+     * @constructor
+     * @param {Array} [entries] The key-value pairs to cache.
+     */
+    function Hash(entries) {
+      var index = -1,
+          length = entries == null ? 0 : entries.length;
+
+      this.clear();
+      while (++index < length) {
+        var entry = entries[index];
+        this.set(entry[0], entry[1]);
+      }
+    }
+
+    /**
+     * Removes all key-value entries from the hash.
+     *
+     * @private
+     * @name clear
+     * @memberOf Hash
+     */
+    function hashClear() {
+      this.__data__ = nativeCreate ? nativeCreate(null) : {};
+      this.size = 0;
+    }
+
+    /**
+     * Removes `key` and its value from the hash.
+     *
+     * @private
+     * @name delete
+     * @memberOf Hash
+     * @param {Object} hash The hash to modify.
+     * @param {string} key The key of the value to remove.
+     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+     */
+    function hashDelete(key) {
+      var result = this.has(key) && delete this.__data__[key];
+      this.size -= result ? 1 : 0;
+      return result;
+    }
+
+    /**
+     * Gets the hash value for `key`.
+     *
+     * @private
+     * @name get
+     * @memberOf Hash
+     * @param {string} key The key of the value to get.
+     * @returns {*} Returns the entry value.
+     */
+    function hashGet(key) {
+      var data = this.__data__;
+      if (nativeCreate) {
+        var result = data[key];
+        return result === HASH_UNDEFINED ? undefined : result;
+      }
+      return hasOwnProperty.call(data, key) ? data[key] : undefined;
+    }
+
+    /**
+     * Checks if a hash value for `key` exists.
+     *
+     * @private
+     * @name has
+     * @memberOf Hash
+     * @param {string} key The key of the entry to check.
+     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+     */
+    function hashHas(key) {
+      var data = this.__data__;
+      return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
+    }
+
+    /**
+     * Sets the hash `key` to `value`.
+     *
+     * @private
+     * @name set
+     * @memberOf Hash
+     * @param {string} key The key of the value to set.
+     * @param {*} value The value to set.
+     * @returns {Object} Returns the hash instance.
+     */
+    function hashSet(key, value) {
+      var data = this.__data__;
+      this.size += this.has(key) ? 0 : 1;
+      data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
+      return this;
+    }
+
+    // Add methods to `Hash`.
+    Hash.prototype.clear = hashClear;
+    Hash.prototype['delete'] = hashDelete;
+    Hash.prototype.get = hashGet;
+    Hash.prototype.has = hashHas;
+    Hash.prototype.set = hashSet;
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates an list cache object.
+     *
+     * @private
+     * @constructor
+     * @param {Array} [entries] The key-value pairs to cache.
+     */
+    function ListCache(entries) {
+      var index = -1,
+          length = entries == null ? 0 : entries.length;
+
+      this.clear();
+      while (++index < length) {
+        var entry = entries[index];
+        this.set(entry[0], entry[1]);
+      }
+    }
+
+    /**
+     * Removes all key-value entries from the list cache.
+     *
+     * @private
+     * @name clear
+     * @memberOf ListCache
+     */
+    function listCacheClear() {
+      this.__data__ = [];
+      this.size = 0;
+    }
+
+    /**
+     * Removes `key` and its value from the list cache.
+     *
+     * @private
+     * @name delete
+     * @memberOf ListCache
+     * @param {string} key The key of the value to remove.
+     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+     */
+    function listCacheDelete(key) {
+      var data = this.__data__,
+          index = assocIndexOf(data, key);
+
+      if (index < 0) {
+        return false;
+      }
+      var lastIndex = data.length - 1;
+      if (index == lastIndex) {
+        data.pop();
+      } else {
+        splice.call(data, index, 1);
+      }
+      --this.size;
+      return true;
+    }
+
+    /**
+     * Gets the list cache value for `key`.
+     *
+     * @private
+     * @name get
+     * @memberOf ListCache
+     * @param {string} key The key of the value to get.
+     * @returns {*} Returns the entry value.
+     */
+    function listCacheGet(key) {
+      var data = this.__data__,
+          index = assocIndexOf(data, key);
+
+      return index < 0 ? undefined : data[index][1];
+    }
+
+    /**
+     * Checks if a list cache value for `key` exists.
+     *
+     * @private
+     * @name has
+     * @memberOf ListCache
+     * @param {string} key The key of the entry to check.
+     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+     */
+    function listCacheHas(key) {
+      return assocIndexOf(this.__data__, key) > -1;
+    }
+
+    /**
+     * Sets the list cache `key` to `value`.
+     *
+     * @private
+     * @name set
+     * @memberOf ListCache
+     * @param {string} key The key of the value to set.
+     * @param {*} value The value to set.
+     * @returns {Object} Returns the list cache instance.
+     */
+    function listCacheSet(key, value) {
+      var data = this.__data__,
+          index = assocIndexOf(data, key);
+
+      if (index < 0) {
+        ++this.size;
+        data.push([key, value]);
+      } else {
+        data[index][1] = value;
+      }
+      return this;
+    }
+
+    // Add methods to `ListCache`.
+    ListCache.prototype.clear = listCacheClear;
+    ListCache.prototype['delete'] = listCacheDelete;
+    ListCache.prototype.get = listCacheGet;
+    ListCache.prototype.has = listCacheHas;
+    ListCache.prototype.set = listCacheSet;
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a map cache object to store key-value pairs.
+     *
+     * @private
+     * @constructor
+     * @param {Array} [entries] The key-value pairs to cache.
+     */
+    function MapCache(entries) {
+      var index = -1,
+          length = entries == null ? 0 : entries.length;
+
+      this.clear();
+      while (++index < length) {
+        var entry = entries[index];
+        this.set(entry[0], entry[1]);
+      }
+    }
+
+    /**
+     * Removes all key-value entries from the map.
+     *
+     * @private
+     * @name clear
+     * @memberOf MapCache
+     */
+    function mapCacheClear() {
+      this.size = 0;
+      this.__data__ = {
+        'hash': new Hash,
+        'map': new (Map || ListCache),
+        'string': new Hash
+      };
+    }
+
+    /**
+     * Removes `key` and its value from the map.
+     *
+     * @private
+     * @name delete
+     * @memberOf MapCache
+     * @param {string} key The key of the value to remove.
+     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+     */
+    function mapCacheDelete(key) {
+      var result = getMapData(this, key)['delete'](key);
+      this.size -= result ? 1 : 0;
+      return result;
+    }
+
+    /**
+     * Gets the map value for `key`.
+     *
+     * @private
+     * @name get
+     * @memberOf MapCache
+     * @param {string} key The key of the value to get.
+     * @returns {*} Returns the entry value.
+     */
+    function mapCacheGet(key) {
+      return getMapData(this, key).get(key);
+    }
+
+    /**
+     * Checks if a map value for `key` exists.
+     *
+     * @private
+     * @name has
+     * @memberOf MapCache
+     * @param {string} key The key of the entry to check.
+     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+     */
+    function mapCacheHas(key) {
+      return getMapData(this, key).has(key);
+    }
+
+    /**
+     * Sets the map `key` to `value`.
+     *
+     * @private
+     * @name set
+     * @memberOf MapCache
+     * @param {string} key The key of the value to set.
+     * @param {*} value The value to set.
+     * @returns {Object} Returns the map cache instance.
+     */
+    function mapCacheSet(key, value) {
+      var data = getMapData(this, key),
+          size = data.size;
+
+      data.set(key, value);
+      this.size += data.size == size ? 0 : 1;
+      return this;
+    }
+
+    // Add methods to `MapCache`.
+    MapCache.prototype.clear = mapCacheClear;
+    MapCache.prototype['delete'] = mapCacheDelete;
+    MapCache.prototype.get = mapCacheGet;
+    MapCache.prototype.has = mapCacheHas;
+    MapCache.prototype.set = mapCacheSet;
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     *
+     * Creates an array cache object to store unique values.
+     *
+     * @private
+     * @constructor
+     * @param {Array} [values] The values to cache.
+     */
+    function SetCache(values) {
+      var index = -1,
+          length = values == null ? 0 : values.length;
+
+      this.__data__ = new MapCache;
+      while (++index < length) {
+        this.add(values[index]);
+      }
+    }
+
+    /**
+     * Adds `value` to the array cache.
+     *
+     * @private
+     * @name add
+     * @memberOf SetCache
+     * @alias push
+     * @param {*} value The value to cache.
+     * @returns {Object} Returns the cache instance.
+     */
+    function setCacheAdd(value) {
+      this.__data__.set(value, HASH_UNDEFINED);
+      return this;
+    }
+
+    /**
+     * Checks if `value` is in the array cache.
+     *
+     * @private
+     * @name has
+     * @memberOf SetCache
+     * @param {*} value The value to search for.
+     * @returns {number} Returns `true` if `value` is found, else `false`.
+     */
+    function setCacheHas(value) {
+      return this.__data__.has(value);
+    }
+
+    // Add methods to `SetCache`.
+    SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
+    SetCache.prototype.has = setCacheHas;
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a stack cache object to store key-value pairs.
+     *
+     * @private
+     * @constructor
+     * @param {Array} [entries] The key-value pairs to cache.
+     */
+    function Stack(entries) {
+      var data = this.__data__ = new ListCache(entries);
+      this.size = data.size;
+    }
+
+    /**
+     * Removes all key-value entries from the stack.
+     *
+     * @private
+     * @name clear
+     * @memberOf Stack
+     */
+    function stackClear() {
+      this.__data__ = new ListCache;
+      this.size = 0;
+    }
+
+    /**
+     * Removes `key` and its value from the stack.
+     *
+     * @private
+     * @name delete
+     * @memberOf Stack
+     * @param {string} key The key of the value to remove.
+     * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+     */
+    function stackDelete(key) {
+      var data = this.__data__,
+          result = data['delete'](key);
+
+      this.size = data.size;
+      return result;
+    }
+
+    /**
+     * Gets the stack value for `key`.
+     *
+     * @private
+     * @name get
+     * @memberOf Stack
+     * @param {string} key The key of the value to get.
+     * @returns {*} Returns the entry value.
+     */
+    function stackGet(key) {
+      return this.__data__.get(key);
+    }
+
+    /**
+     * Checks if a stack value for `key` exists.
+     *
+     * @private
+     * @name has
+     * @memberOf Stack
+     * @param {string} key The key of the entry to check.
+     * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+     */
+    function stackHas(key) {
+      return this.__data__.has(key);
+    }
+
+    /**
+     * Sets the stack `key` to `value`.
+     *
+     * @private
+     * @name set
+     * @memberOf Stack
+     * @param {string} key The key of the value to set.
+     * @param {*} value The value to set.
+     * @returns {Object} Returns the stack cache instance.
+     */
+    function stackSet(key, value) {
+      var data = this.__data__;
+      if (data instanceof ListCache) {
+        var pairs = data.__data__;
+        if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
+          pairs.push([key, value]);
+          this.size = ++data.size;
+          return this;
+        }
+        data = this.__data__ = new MapCache(pairs);
+      }
+      data.set(key, value);
+      this.size = data.size;
+      return this;
+    }
+
+    // Add methods to `Stack`.
+    Stack.prototype.clear = stackClear;
+    Stack.prototype['delete'] = stackDelete;
+    Stack.prototype.get = stackGet;
+    Stack.prototype.has = stackHas;
+    Stack.prototype.set = stackSet;
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array of the enumerable property names of the array-like `value`.
+     *
+     * @private
+     * @param {*} value The value to query.
+     * @param {boolean} inherited Specify returning inherited property names.
+     * @returns {Array} Returns the array of property names.
+     */
+    function arrayLikeKeys(value, inherited) {
+      var isArr = isArray(value),
+          isArg = !isArr && isArguments(value),
+          isBuff = !isArr && !isArg && isBuffer(value),
+          isType = !isArr && !isArg && !isBuff && isTypedArray(value),
+          skipIndexes = isArr || isArg || isBuff || isType,
+          result = skipIndexes ? baseTimes(value.length, String) : [],
+          length = result.length;
+
+      for (var key in value) {
+        if ((inherited || hasOwnProperty.call(value, key)) &&
+            !(skipIndexes && (
+               // Safari 9 has enumerable `arguments.length` in strict mode.
+               key == 'length' ||
+               // Node.js 0.10 has enumerable non-index properties on buffers.
+               (isBuff && (key == 'offset' || key == 'parent')) ||
+               // PhantomJS 2 has enumerable non-index properties on typed arrays.
+               (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
+               // Skip index properties.
+               isIndex(key, length)
+            ))) {
+          result.push(key);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * A specialized version of `_.sample` for arrays.
+     *
+     * @private
+     * @param {Array} array The array to sample.
+     * @returns {*} Returns the random element.
+     */
+    function arraySample(array) {
+      var length = array.length;
+      return length ? array[baseRandom(0, length - 1)] : undefined;
+    }
+
+    /**
+     * A specialized version of `_.sampleSize` for arrays.
+     *
+     * @private
+     * @param {Array} array The array to sample.
+     * @param {number} n The number of elements to sample.
+     * @returns {Array} Returns the random elements.
+     */
+    function arraySampleSize(array, n) {
+      return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
+    }
+
+    /**
+     * A specialized version of `_.shuffle` for arrays.
+     *
+     * @private
+     * @param {Array} array The array to shuffle.
+     * @returns {Array} Returns the new shuffled array.
+     */
+    function arrayShuffle(array) {
+      return shuffleSelf(copyArray(array));
+    }
+
+    /**
+     * This function is like `assignValue` except that it doesn't assign
+     * `undefined` values.
+     *
+     * @private
+     * @param {Object} object The object to modify.
+     * @param {string} key The key of the property to assign.
+     * @param {*} value The value to assign.
+     */
+    function assignMergeValue(object, key, value) {
+      if ((value !== undefined && !eq(object[key], value)) ||
+          (value === undefined && !(key in object))) {
+        baseAssignValue(object, key, value);
+      }
+    }
+
+    /**
+     * Assigns `value` to `key` of `object` if the existing value is not equivalent
+     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * for equality comparisons.
+     *
+     * @private
+     * @param {Object} object The object to modify.
+     * @param {string} key The key of the property to assign.
+     * @param {*} value The value to assign.
+     */
+    function assignValue(object, key, value) {
+      var objValue = object[key];
+      if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
+          (value === undefined && !(key in object))) {
+        baseAssignValue(object, key, value);
+      }
+    }
+
+    /**
+     * Gets the index at which the `key` is found in `array` of key-value pairs.
+     *
+     * @private
+     * @param {Array} array The array to inspect.
+     * @param {*} key The key to search for.
+     * @returns {number} Returns the index of the matched value, else `-1`.
+     */
+    function assocIndexOf(array, key) {
+      var length = array.length;
+      while (length--) {
+        if (eq(array[length][0], key)) {
+          return length;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * Aggregates elements of `collection` on `accumulator` with keys transformed
+     * by `iteratee` and values set by `setter`.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} setter The function to set `accumulator` values.
+     * @param {Function} iteratee The iteratee to transform keys.
+     * @param {Object} accumulator The initial aggregated object.
+     * @returns {Function} Returns `accumulator`.
+     */
+    function baseAggregator(collection, setter, iteratee, accumulator) {
+      baseEach(collection, function(value, key, collection) {
+        setter(accumulator, value, iteratee(value), collection);
+      });
+      return accumulator;
+    }
+
+    /**
+     * The base implementation of `_.assign` without support for multiple sources
+     * or `customizer` functions.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @returns {Object} Returns `object`.
+     */
+    function baseAssign(object, source) {
+      return object && copyObject(source, keys(source), object);
+    }
+
+    /**
+     * The base implementation of `_.assignIn` without support for multiple sources
+     * or `customizer` functions.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @returns {Object} Returns `object`.
+     */
+    function baseAssignIn(object, source) {
+      return object && copyObject(source, keysIn(source), object);
+    }
+
+    /**
+     * The base implementation of `assignValue` and `assignMergeValue` without
+     * value checks.
+     *
+     * @private
+     * @param {Object} object The object to modify.
+     * @param {string} key The key of the property to assign.
+     * @param {*} value The value to assign.
+     */
+    function baseAssignValue(object, key, value) {
+      if (key == '__proto__' && defineProperty) {
+        defineProperty(object, key, {
+          'configurable': true,
+          'enumerable': true,
+          'value': value,
+          'writable': true
+        });
+      } else {
+        object[key] = value;
+      }
+    }
+
+    /**
+     * The base implementation of `_.at` without support for individual paths.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {string[]} paths The property paths to pick.
+     * @returns {Array} Returns the picked elements.
+     */
+    function baseAt(object, paths) {
+      var index = -1,
+          length = paths.length,
+          result = Array(length),
+          skip = object == null;
+
+      while (++index < length) {
+        result[index] = skip ? undefined : get(object, paths[index]);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.clamp` which doesn't coerce arguments.
+     *
+     * @private
+     * @param {number} number The number to clamp.
+     * @param {number} [lower] The lower bound.
+     * @param {number} upper The upper bound.
+     * @returns {number} Returns the clamped number.
+     */
+    function baseClamp(number, lower, upper) {
+      if (number === number) {
+        if (upper !== undefined) {
+          number = number <= upper ? number : upper;
+        }
+        if (lower !== undefined) {
+          number = number >= lower ? number : lower;
+        }
+      }
+      return number;
+    }
+
+    /**
+     * The base implementation of `_.clone` and `_.cloneDeep` which tracks
+     * traversed objects.
+     *
+     * @private
+     * @param {*} value The value to clone.
+     * @param {boolean} bitmask The bitmask flags.
+     *  1 - Deep clone
+     *  2 - Flatten inherited properties
+     *  4 - Clone symbols
+     * @param {Function} [customizer] The function to customize cloning.
+     * @param {string} [key] The key of `value`.
+     * @param {Object} [object] The parent object of `value`.
+     * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
+     * @returns {*} Returns the cloned value.
+     */
+    function baseClone(value, bitmask, customizer, key, object, stack) {
+      var result,
+          isDeep = bitmask & CLONE_DEEP_FLAG,
+          isFlat = bitmask & CLONE_FLAT_FLAG,
+          isFull = bitmask & CLONE_SYMBOLS_FLAG;
+
+      if (customizer) {
+        result = object ? customizer(value, key, object, stack) : customizer(value);
+      }
+      if (result !== undefined) {
+        return result;
+      }
+      if (!isObject(value)) {
+        return value;
+      }
+      var isArr = isArray(value);
+      if (isArr) {
+        result = initCloneArray(value);
+        if (!isDeep) {
+          return copyArray(value, result);
+        }
+      } else {
+        var tag = getTag(value),
+            isFunc = tag == funcTag || tag == genTag;
+
+        if (isBuffer(value)) {
+          return cloneBuffer(value, isDeep);
+        }
+        if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
+          result = (isFlat || isFunc) ? {} : initCloneObject(value);
+          if (!isDeep) {
+            return isFlat
+              ? copySymbolsIn(value, baseAssignIn(result, value))
+              : copySymbols(value, baseAssign(result, value));
+          }
+        } else {
+          if (!cloneableTags[tag]) {
+            return object ? value : {};
+          }
+          result = initCloneByTag(value, tag, isDeep);
+        }
+      }
+      // Check for circular references and return its corresponding clone.
+      stack || (stack = new Stack);
+      var stacked = stack.get(value);
+      if (stacked) {
+        return stacked;
+      }
+      stack.set(value, result);
+
+      if (isSet(value)) {
+        value.forEach(function(subValue) {
+          result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
+        });
+
+        return result;
+      }
+
+      if (isMap(value)) {
+        value.forEach(function(subValue, key) {
+          result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
+        });
+
+        return result;
+      }
+
+      var keysFunc = isFull
+        ? (isFlat ? getAllKeysIn : getAllKeys)
+        : (isFlat ? keysIn : keys);
+
+      var props = isArr ? undefined : keysFunc(value);
+      arrayEach(props || value, function(subValue, key) {
+        if (props) {
+          key = subValue;
+          subValue = value[key];
+        }
+        // Recursively populate clone (susceptible to call stack limits).
+        assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.conforms` which doesn't clone `source`.
+     *
+     * @private
+     * @param {Object} source The object of property predicates to conform to.
+     * @returns {Function} Returns the new spec function.
+     */
+    function baseConforms(source) {
+      var props = keys(source);
+      return function(object) {
+        return baseConformsTo(object, source, props);
+      };
+    }
+
+    /**
+     * The base implementation of `_.conformsTo` which accepts `props` to check.
+     *
+     * @private
+     * @param {Object} object The object to inspect.
+     * @param {Object} source The object of property predicates to conform to.
+     * @returns {boolean} Returns `true` if `object` conforms, else `false`.
+     */
+    function baseConformsTo(object, source, props) {
+      var length = props.length;
+      if (object == null) {
+        return !length;
+      }
+      object = Object(object);
+      while (length--) {
+        var key = props[length],
+            predicate = source[key],
+            value = object[key];
+
+        if ((value === undefined && !(key in object)) || !predicate(value)) {
+          return false;
+        }
+      }
+      return true;
+    }
+
+    /**
+     * The base implementation of `_.delay` and `_.defer` which accepts `args`
+     * to provide to `func`.
+     *
+     * @private
+     * @param {Function} func The function to delay.
+     * @param {number} wait The number of milliseconds to delay invocation.
+     * @param {Array} args The arguments to provide to `func`.
+     * @returns {number|Object} Returns the timer id or timeout object.
+     */
+    function baseDelay(func, wait, args) {
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      return setTimeout(function() { func.apply(undefined, args); }, wait);
+    }
+
+    /**
+     * The base implementation of methods like `_.difference` without support
+     * for excluding multiple arrays or iteratee shorthands.
+     *
+     * @private
+     * @param {Array} array The array to inspect.
+     * @param {Array} values The values to exclude.
+     * @param {Function} [iteratee] The iteratee invoked per element.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns the new array of filtered values.
+     */
+    function baseDifference(array, values, iteratee, comparator) {
+      var index = -1,
+          includes = arrayIncludes,
+          isCommon = true,
+          length = array.length,
+          result = [],
+          valuesLength = values.length;
+
+      if (!length) {
+        return result;
+      }
+      if (iteratee) {
+        values = arrayMap(values, baseUnary(iteratee));
+      }
+      if (comparator) {
+        includes = arrayIncludesWith;
+        isCommon = false;
+      }
+      else if (values.length >= LARGE_ARRAY_SIZE) {
+        includes = cacheHas;
+        isCommon = false;
+        values = new SetCache(values);
+      }
+      outer:
+      while (++index < length) {
+        var value = array[index],
+            computed = iteratee == null ? value : iteratee(value);
+
+        value = (comparator || value !== 0) ? value : 0;
+        if (isCommon && computed === computed) {
+          var valuesIndex = valuesLength;
+          while (valuesIndex--) {
+            if (values[valuesIndex] === computed) {
+              continue outer;
+            }
+          }
+          result.push(value);
+        }
+        else if (!includes(values, computed, comparator)) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.forEach` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Array|Object} Returns `collection`.
+     */
+    var baseEach = createBaseEach(baseForOwn);
+
+    /**
+     * The base implementation of `_.forEachRight` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Array|Object} Returns `collection`.
+     */
+    var baseEachRight = createBaseEach(baseForOwnRight, true);
+
+    /**
+     * The base implementation of `_.every` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {boolean} Returns `true` if all elements pass the predicate check,
+     *  else `false`
+     */
+    function baseEvery(collection, predicate) {
+      var result = true;
+      baseEach(collection, function(value, index, collection) {
+        result = !!predicate(value, index, collection);
+        return result;
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of methods like `_.max` and `_.min` which accepts a
+     * `comparator` to determine the extremum value.
+     *
+     * @private
+     * @param {Array} array The array to iterate over.
+     * @param {Function} iteratee The iteratee invoked per iteration.
+     * @param {Function} comparator The comparator used to compare values.
+     * @returns {*} Returns the extremum value.
+     */
+    function baseExtremum(array, iteratee, comparator) {
+      var index = -1,
+          length = array.length;
+
+      while (++index < length) {
+        var value = array[index],
+            current = iteratee(value);
+
+        if (current != null && (computed === undefined
+              ? (current === current && !isSymbol(current))
+              : comparator(current, computed)
+            )) {
+          var computed = current,
+              result = value;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.fill` without an iteratee call guard.
+     *
+     * @private
+     * @param {Array} array The array to fill.
+     * @param {*} value The value to fill `array` with.
+     * @param {number} [start=0] The start position.
+     * @param {number} [end=array.length] The end position.
+     * @returns {Array} Returns `array`.
+     */
+    function baseFill(array, value, start, end) {
+      var length = array.length;
+
+      start = toInteger(start);
+      if (start < 0) {
+        start = -start > length ? 0 : (length + start);
+      }
+      end = (end === undefined || end > length) ? length : toInteger(end);
+      if (end < 0) {
+        end += length;
+      }
+      end = start > end ? 0 : toLength(end);
+      while (start < end) {
+        array[start++] = value;
+      }
+      return array;
+    }
+
+    /**
+     * The base implementation of `_.filter` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {Array} Returns the new filtered array.
+     */
+    function baseFilter(collection, predicate) {
+      var result = [];
+      baseEach(collection, function(value, index, collection) {
+        if (predicate(value, index, collection)) {
+          result.push(value);
+        }
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.flatten` with support for restricting flattening.
+     *
+     * @private
+     * @param {Array} array The array to flatten.
+     * @param {number} depth The maximum recursion depth.
+     * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
+     * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
+     * @param {Array} [result=[]] The initial result value.
+     * @returns {Array} Returns the new flattened array.
+     */
+    function baseFlatten(array, depth, predicate, isStrict, result) {
+      var index = -1,
+          length = array.length;
+
+      predicate || (predicate = isFlattenable);
+      result || (result = []);
+
+      while (++index < length) {
+        var value = array[index];
+        if (depth > 0 && predicate(value)) {
+          if (depth > 1) {
+            // Recursively flatten arrays (susceptible to call stack limits).
+            baseFlatten(value, depth - 1, predicate, isStrict, result);
+          } else {
+            arrayPush(result, value);
+          }
+        } else if (!isStrict) {
+          result[result.length] = value;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `baseForOwn` which iterates over `object`
+     * properties returned by `keysFunc` and invokes `iteratee` for each property.
+     * Iteratee functions may exit iteration early by explicitly returning `false`.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {Function} keysFunc The function to get the keys of `object`.
+     * @returns {Object} Returns `object`.
+     */
+    var baseFor = createBaseFor();
+
+    /**
+     * This function is like `baseFor` except that it iterates over properties
+     * in the opposite order.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @param {Function} keysFunc The function to get the keys of `object`.
+     * @returns {Object} Returns `object`.
+     */
+    var baseForRight = createBaseFor(true);
+
+    /**
+     * The base implementation of `_.forOwn` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Object} Returns `object`.
+     */
+    function baseForOwn(object, iteratee) {
+      return object && baseFor(object, iteratee, keys);
+    }
+
+    /**
+     * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Object} Returns `object`.
+     */
+    function baseForOwnRight(object, iteratee) {
+      return object && baseForRight(object, iteratee, keys);
+    }
+
+    /**
+     * The base implementation of `_.functions` which creates an array of
+     * `object` function property names filtered from `props`.
+     *
+     * @private
+     * @param {Object} object The object to inspect.
+     * @param {Array} props The property names to filter.
+     * @returns {Array} Returns the function names.
+     */
+    function baseFunctions(object, props) {
+      return arrayFilter(props, function(key) {
+        return isFunction(object[key]);
+      });
+    }
+
+    /**
+     * The base implementation of `_.get` without support for default values.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path of the property to get.
+     * @returns {*} Returns the resolved value.
+     */
+    function baseGet(object, path) {
+      path = castPath(path, object);
+
+      var index = 0,
+          length = path.length;
+
+      while (object != null && index < length) {
+        object = object[toKey(path[index++])];
+      }
+      return (index && index == length) ? object : undefined;
+    }
+
+    /**
+     * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
+     * `keysFunc` and `symbolsFunc` to get the enumerable property names and
+     * symbols of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {Function} keysFunc The function to get the keys of `object`.
+     * @param {Function} symbolsFunc The function to get the symbols of `object`.
+     * @returns {Array} Returns the array of property names and symbols.
+     */
+    function baseGetAllKeys(object, keysFunc, symbolsFunc) {
+      var result = keysFunc(object);
+      return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
+    }
+
+    /**
+     * The base implementation of `getTag` without fallbacks for buggy environments.
+     *
+     * @private
+     * @param {*} value The value to query.
+     * @returns {string} Returns the `toStringTag`.
+     */
+    function baseGetTag(value) {
+      if (value == null) {
+        return value === undefined ? undefinedTag : nullTag;
+      }
+      return (symToStringTag && symToStringTag in Object(value))
+        ? getRawTag(value)
+        : objectToString(value);
+    }
+
+    /**
+     * The base implementation of `_.gt` which doesn't coerce arguments.
+     *
+     * @private
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is greater than `other`,
+     *  else `false`.
+     */
+    function baseGt(value, other) {
+      return value > other;
+    }
+
+    /**
+     * The base implementation of `_.has` without support for deep paths.
+     *
+     * @private
+     * @param {Object} [object] The object to query.
+     * @param {Array|string} key The key to check.
+     * @returns {boolean} Returns `true` if `key` exists, else `false`.
+     */
+    function baseHas(object, key) {
+      return object != null && hasOwnProperty.call(object, key);
+    }
+
+    /**
+     * The base implementation of `_.hasIn` without support for deep paths.
+     *
+     * @private
+     * @param {Object} [object] The object to query.
+     * @param {Array|string} key The key to check.
+     * @returns {boolean} Returns `true` if `key` exists, else `false`.
+     */
+    function baseHasIn(object, key) {
+      return object != null && key in Object(object);
+    }
+
+    /**
+     * The base implementation of `_.inRange` which doesn't coerce arguments.
+     *
+     * @private
+     * @param {number} number The number to check.
+     * @param {number} start The start of the range.
+     * @param {number} end The end of the range.
+     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
+     */
+    function baseInRange(number, start, end) {
+      return number >= nativeMin(start, end) && number < nativeMax(start, end);
+    }
+
+    /**
+     * The base implementation of methods like `_.intersection`, without support
+     * for iteratee shorthands, that accepts an array of arrays to inspect.
+     *
+     * @private
+     * @param {Array} arrays The arrays to inspect.
+     * @param {Function} [iteratee] The iteratee invoked per element.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns the new array of shared values.
+     */
+    function baseIntersection(arrays, iteratee, comparator) {
+      var includes = comparator ? arrayIncludesWith : arrayIncludes,
+          length = arrays[0].length,
+          othLength = arrays.length,
+          othIndex = othLength,
+          caches = Array(othLength),
+          maxLength = Infinity,
+          result = [];
+
+      while (othIndex--) {
+        var array = arrays[othIndex];
+        if (othIndex && iteratee) {
+          array = arrayMap(array, baseUnary(iteratee));
+        }
+        maxLength = nativeMin(array.length, maxLength);
+        caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
+          ? new SetCache(othIndex && array)
+          : undefined;
+      }
+      array = arrays[0];
+
+      var index = -1,
+          seen = caches[0];
+
+      outer:
+      while (++index < length && result.length < maxLength) {
+        var value = array[index],
+            computed = iteratee ? iteratee(value) : value;
+
+        value = (comparator || value !== 0) ? value : 0;
+        if (!(seen
+              ? cacheHas(seen, computed)
+              : includes(result, computed, comparator)
+            )) {
+          othIndex = othLength;
+          while (--othIndex) {
+            var cache = caches[othIndex];
+            if (!(cache
+                  ? cacheHas(cache, computed)
+                  : includes(arrays[othIndex], computed, comparator))
+                ) {
+              continue outer;
+            }
+          }
+          if (seen) {
+            seen.push(computed);
+          }
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.invert` and `_.invertBy` which inverts
+     * `object` with values transformed by `iteratee` and set by `setter`.
+     *
+     * @private
+     * @param {Object} object The object to iterate over.
+     * @param {Function} setter The function to set `accumulator` values.
+     * @param {Function} iteratee The iteratee to transform values.
+     * @param {Object} accumulator The initial inverted object.
+     * @returns {Function} Returns `accumulator`.
+     */
+    function baseInverter(object, setter, iteratee, accumulator) {
+      baseForOwn(object, function(value, key, object) {
+        setter(accumulator, iteratee(value), key, object);
+      });
+      return accumulator;
+    }
+
+    /**
+     * The base implementation of `_.invoke` without support for individual
+     * method arguments.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path of the method to invoke.
+     * @param {Array} args The arguments to invoke the method with.
+     * @returns {*} Returns the result of the invoked method.
+     */
+    function baseInvoke(object, path, args) {
+      path = castPath(path, object);
+      object = parent(object, path);
+      var func = object == null ? object : object[toKey(last(path))];
+      return func == null ? undefined : apply(func, object, args);
+    }
+
+    /**
+     * The base implementation of `_.isArguments`.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+     */
+    function baseIsArguments(value) {
+      return isObjectLike(value) && baseGetTag(value) == argsTag;
+    }
+
+    /**
+     * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
+     */
+    function baseIsArrayBuffer(value) {
+      return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
+    }
+
+    /**
+     * The base implementation of `_.isDate` without Node.js optimizations.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+     */
+    function baseIsDate(value) {
+      return isObjectLike(value) && baseGetTag(value) == dateTag;
+    }
+
+    /**
+     * The base implementation of `_.isEqual` which supports partial comparisons
+     * and tracks traversed objects.
+     *
+     * @private
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @param {boolean} bitmask The bitmask flags.
+     *  1 - Unordered comparison
+     *  2 - Partial comparison
+     * @param {Function} [customizer] The function to customize comparisons.
+     * @param {Object} [stack] Tracks traversed `value` and `other` objects.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     */
+    function baseIsEqual(value, other, bitmask, customizer, stack) {
+      if (value === other) {
+        return true;
+      }
+      if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
+        return value !== value && other !== other;
+      }
+      return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
+    }
+
+    /**
+     * A specialized version of `baseIsEqual` for arrays and objects which performs
+     * deep comparisons and tracks traversed objects enabling objects with circular
+     * references to be compared.
+     *
+     * @private
+     * @param {Object} object The object to compare.
+     * @param {Object} other The other object to compare.
+     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+     * @param {Function} customizer The function to customize comparisons.
+     * @param {Function} equalFunc The function to determine equivalents of values.
+     * @param {Object} [stack] Tracks traversed `object` and `other` objects.
+     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+     */
+    function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
+      var objIsArr = isArray(object),
+          othIsArr = isArray(other),
+          objTag = objIsArr ? arrayTag : getTag(object),
+          othTag = othIsArr ? arrayTag : getTag(other);
+
+      objTag = objTag == argsTag ? objectTag : objTag;
+      othTag = othTag == argsTag ? objectTag : othTag;
+
+      var objIsObj = objTag == objectTag,
+          othIsObj = othTag == objectTag,
+          isSameTag = objTag == othTag;
+
+      if (isSameTag && isBuffer(object)) {
+        if (!isBuffer(other)) {
+          return false;
+        }
+        objIsArr = true;
+        objIsObj = false;
+      }
+      if (isSameTag && !objIsObj) {
+        stack || (stack = new Stack);
+        return (objIsArr || isTypedArray(object))
+          ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
+          : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
+      }
+      if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
+        var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
+            othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
+
+        if (objIsWrapped || othIsWrapped) {
+          var objUnwrapped = objIsWrapped ? object.value() : object,
+              othUnwrapped = othIsWrapped ? other.value() : other;
+
+          stack || (stack = new Stack);
+          return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
+        }
+      }
+      if (!isSameTag) {
+        return false;
+      }
+      stack || (stack = new Stack);
+      return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
+    }
+
+    /**
+     * The base implementation of `_.isMap` without Node.js optimizations.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a map, else `false`.
+     */
+    function baseIsMap(value) {
+      return isObjectLike(value) && getTag(value) == mapTag;
+    }
+
+    /**
+     * The base implementation of `_.isMatch` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Object} object The object to inspect.
+     * @param {Object} source The object of property values to match.
+     * @param {Array} matchData The property names, values, and compare flags to match.
+     * @param {Function} [customizer] The function to customize comparisons.
+     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+     */
+    function baseIsMatch(object, source, matchData, customizer) {
+      var index = matchData.length,
+          length = index,
+          noCustomizer = !customizer;
+
+      if (object == null) {
+        return !length;
+      }
+      object = Object(object);
+      while (index--) {
+        var data = matchData[index];
+        if ((noCustomizer && data[2])
+              ? data[1] !== object[data[0]]
+              : !(data[0] in object)
+            ) {
+          return false;
+        }
+      }
+      while (++index < length) {
+        data = matchData[index];
+        var key = data[0],
+            objValue = object[key],
+            srcValue = data[1];
+
+        if (noCustomizer && data[2]) {
+          if (objValue === undefined && !(key in object)) {
+            return false;
+          }
+        } else {
+          var stack = new Stack;
+          if (customizer) {
+            var result = customizer(objValue, srcValue, key, object, source, stack);
+          }
+          if (!(result === undefined
+                ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
+                : result
+              )) {
+            return false;
+          }
+        }
+      }
+      return true;
+    }
+
+    /**
+     * The base implementation of `_.isNative` without bad shim checks.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a native function,
+     *  else `false`.
+     */
+    function baseIsNative(value) {
+      if (!isObject(value) || isMasked(value)) {
+        return false;
+      }
+      var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
+      return pattern.test(toSource(value));
+    }
+
+    /**
+     * The base implementation of `_.isRegExp` without Node.js optimizations.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
+     */
+    function baseIsRegExp(value) {
+      return isObjectLike(value) && baseGetTag(value) == regexpTag;
+    }
+
+    /**
+     * The base implementation of `_.isSet` without Node.js optimizations.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a set, else `false`.
+     */
+    function baseIsSet(value) {
+      return isObjectLike(value) && getTag(value) == setTag;
+    }
+
+    /**
+     * The base implementation of `_.isTypedArray` without Node.js optimizations.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
+     */
+    function baseIsTypedArray(value) {
+      return isObjectLike(value) &&
+        isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
+    }
+
+    /**
+     * The base implementation of `_.iteratee`.
+     *
+     * @private
+     * @param {*} [value=_.identity] The value to convert to an iteratee.
+     * @returns {Function} Returns the iteratee.
+     */
+    function baseIteratee(value) {
+      // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
+      // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
+      if (typeof value == 'function') {
+        return value;
+      }
+      if (value == null) {
+        return identity;
+      }
+      if (typeof value == 'object') {
+        return isArray(value)
+          ? baseMatchesProperty(value[0], value[1])
+          : baseMatches(value);
+      }
+      return property(value);
+    }
+
+    /**
+     * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names.
+     */
+    function baseKeys(object) {
+      if (!isPrototype(object)) {
+        return nativeKeys(object);
+      }
+      var result = [];
+      for (var key in Object(object)) {
+        if (hasOwnProperty.call(object, key) && key != 'constructor') {
+          result.push(key);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names.
+     */
+    function baseKeysIn(object) {
+      if (!isObject(object)) {
+        return nativeKeysIn(object);
+      }
+      var isProto = isPrototype(object),
+          result = [];
+
+      for (var key in object) {
+        if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
+          result.push(key);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.lt` which doesn't coerce arguments.
+     *
+     * @private
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is less than `other`,
+     *  else `false`.
+     */
+    function baseLt(value, other) {
+      return value < other;
+    }
+
+    /**
+     * The base implementation of `_.map` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} iteratee The function invoked per iteration.
+     * @returns {Array} Returns the new mapped array.
+     */
+    function baseMap(collection, iteratee) {
+      var index = -1,
+          result = isArrayLike(collection) ? Array(collection.length) : [];
+
+      baseEach(collection, function(value, key, collection) {
+        result[++index] = iteratee(value, key, collection);
+      });
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.matches` which doesn't clone `source`.
+     *
+     * @private
+     * @param {Object} source The object of property values to match.
+     * @returns {Function} Returns the new spec function.
+     */
+    function baseMatches(source) {
+      var matchData = getMatchData(source);
+      if (matchData.length == 1 && matchData[0][2]) {
+        return matchesStrictComparable(matchData[0][0], matchData[0][1]);
+      }
+      return function(object) {
+        return object === source || baseIsMatch(object, source, matchData);
+      };
+    }
+
+    /**
+     * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
+     *
+     * @private
+     * @param {string} path The path of the property to get.
+     * @param {*} srcValue The value to match.
+     * @returns {Function} Returns the new spec function.
+     */
+    function baseMatchesProperty(path, srcValue) {
+      if (isKey(path) && isStrictComparable(srcValue)) {
+        return matchesStrictComparable(toKey(path), srcValue);
+      }
+      return function(object) {
+        var objValue = get(object, path);
+        return (objValue === undefined && objValue === srcValue)
+          ? hasIn(object, path)
+          : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
+      };
+    }
+
+    /**
+     * The base implementation of `_.merge` without support for multiple sources.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @param {number} srcIndex The index of `source`.
+     * @param {Function} [customizer] The function to customize merged values.
+     * @param {Object} [stack] Tracks traversed source values and their merged
+     *  counterparts.
+     */
+    function baseMerge(object, source, srcIndex, customizer, stack) {
+      if (object === source) {
+        return;
+      }
+      baseFor(source, function(srcValue, key) {
+        if (isObject(srcValue)) {
+          stack || (stack = new Stack);
+          baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
+        }
+        else {
+          var newValue = customizer
+            ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
+            : undefined;
+
+          if (newValue === undefined) {
+            newValue = srcValue;
+          }
+          assignMergeValue(object, key, newValue);
+        }
+      }, keysIn);
+    }
+
+    /**
+     * A specialized version of `baseMerge` for arrays and objects which performs
+     * deep merges and tracks traversed objects enabling objects with circular
+     * references to be merged.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @param {string} key The key of the value to merge.
+     * @param {number} srcIndex The index of `source`.
+     * @param {Function} mergeFunc The function to merge values.
+     * @param {Function} [customizer] The function to customize assigned values.
+     * @param {Object} [stack] Tracks traversed source values and their merged
+     *  counterparts.
+     */
+    function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
+      var objValue = safeGet(object, key),
+          srcValue = safeGet(source, key),
+          stacked = stack.get(srcValue);
+
+      if (stacked) {
+        assignMergeValue(object, key, stacked);
+        return;
+      }
+      var newValue = customizer
+        ? customizer(objValue, srcValue, (key + ''), object, source, stack)
+        : undefined;
+
+      var isCommon = newValue === undefined;
+
+      if (isCommon) {
+        var isArr = isArray(srcValue),
+            isBuff = !isArr && isBuffer(srcValue),
+            isTyped = !isArr && !isBuff && isTypedArray(srcValue);
+
+        newValue = srcValue;
+        if (isArr || isBuff || isTyped) {
+          if (isArray(objValue)) {
+            newValue = objValue;
+          }
+          else if (isArrayLikeObject(objValue)) {
+            newValue = copyArray(objValue);
+          }
+          else if (isBuff) {
+            isCommon = false;
+            newValue = cloneBuffer(srcValue, true);
+          }
+          else if (isTyped) {
+            isCommon = false;
+            newValue = cloneTypedArray(srcValue, true);
+          }
+          else {
+            newValue = [];
+          }
+        }
+        else if (isPlainObject(srcValue) || isArguments(srcValue)) {
+          newValue = objValue;
+          if (isArguments(objValue)) {
+            newValue = toPlainObject(objValue);
+          }
+          else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
+            newValue = initCloneObject(srcValue);
+          }
+        }
+        else {
+          isCommon = false;
+        }
+      }
+      if (isCommon) {
+        // Recursively merge objects and arrays (susceptible to call stack limits).
+        stack.set(srcValue, newValue);
+        mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
+        stack['delete'](srcValue);
+      }
+      assignMergeValue(object, key, newValue);
+    }
+
+    /**
+     * The base implementation of `_.nth` which doesn't coerce arguments.
+     *
+     * @private
+     * @param {Array} array The array to query.
+     * @param {number} n The index of the element to return.
+     * @returns {*} Returns the nth element of `array`.
+     */
+    function baseNth(array, n) {
+      var length = array.length;
+      if (!length) {
+        return;
+      }
+      n += n < 0 ? length : 0;
+      return isIndex(n, length) ? array[n] : undefined;
+    }
+
+    /**
+     * The base implementation of `_.orderBy` without param guards.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
+     * @param {string[]} orders The sort orders of `iteratees`.
+     * @returns {Array} Returns the new sorted array.
+     */
+    function baseOrderBy(collection, iteratees, orders) {
+      var index = -1;
+      iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
+
+      var result = baseMap(collection, function(value, key, collection) {
+        var criteria = arrayMap(iteratees, function(iteratee) {
+          return iteratee(value);
+        });
+        return { 'criteria': criteria, 'index': ++index, 'value': value };
+      });
+
+      return baseSortBy(result, function(object, other) {
+        return compareMultiple(object, other, orders);
+      });
+    }
+
+    /**
+     * The base implementation of `_.pick` without support for individual
+     * property identifiers.
+     *
+     * @private
+     * @param {Object} object The source object.
+     * @param {string[]} paths The property paths to pick.
+     * @returns {Object} Returns the new object.
+     */
+    function basePick(object, paths) {
+      return basePickBy(object, paths, function(value, path) {
+        return hasIn(object, path);
+      });
+    }
+
+    /**
+     * The base implementation of  `_.pickBy` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Object} object The source object.
+     * @param {string[]} paths The property paths to pick.
+     * @param {Function} predicate The function invoked per property.
+     * @returns {Object} Returns the new object.
+     */
+    function basePickBy(object, paths, predicate) {
+      var index = -1,
+          length = paths.length,
+          result = {};
+
+      while (++index < length) {
+        var path = paths[index],
+            value = baseGet(object, path);
+
+        if (predicate(value, path)) {
+          baseSet(result, castPath(path, object), value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * A specialized version of `baseProperty` which supports deep paths.
+     *
+     * @private
+     * @param {Array|string} path The path of the property to get.
+     * @returns {Function} Returns the new accessor function.
+     */
+    function basePropertyDeep(path) {
+      return function(object) {
+        return baseGet(object, path);
+      };
+    }
+
+    /**
+     * The base implementation of `_.pullAllBy` without support for iteratee
+     * shorthands.
+     *
+     * @private
+     * @param {Array} array The array to modify.
+     * @param {Array} values The values to remove.
+     * @param {Function} [iteratee] The iteratee invoked per element.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns `array`.
+     */
+    function basePullAll(array, values, iteratee, comparator) {
+      var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
+          index = -1,
+          length = values.length,
+          seen = array;
+
+      if (array === values) {
+        values = copyArray(values);
+      }
+      if (iteratee) {
+        seen = arrayMap(array, baseUnary(iteratee));
+      }
+      while (++index < length) {
+        var fromIndex = 0,
+            value = values[index],
+            computed = iteratee ? iteratee(value) : value;
+
+        while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
+          if (seen !== array) {
+            splice.call(seen, fromIndex, 1);
+          }
+          splice.call(array, fromIndex, 1);
+        }
+      }
+      return array;
+    }
+
+    /**
+     * The base implementation of `_.pullAt` without support for individual
+     * indexes or capturing the removed elements.
+     *
+     * @private
+     * @param {Array} array The array to modify.
+     * @param {number[]} indexes The indexes of elements to remove.
+     * @returns {Array} Returns `array`.
+     */
+    function basePullAt(array, indexes) {
+      var length = array ? indexes.length : 0,
+          lastIndex = length - 1;
+
+      while (length--) {
+        var index = indexes[length];
+        if (length == lastIndex || index !== previous) {
+          var previous = index;
+          if (isIndex(index)) {
+            splice.call(array, index, 1);
+          } else {
+            baseUnset(array, index);
+          }
+        }
+      }
+      return array;
+    }
+
+    /**
+     * The base implementation of `_.random` without support for returning
+     * floating-point numbers.
+     *
+     * @private
+     * @param {number} lower The lower bound.
+     * @param {number} upper The upper bound.
+     * @returns {number} Returns the random number.
+     */
+    function baseRandom(lower, upper) {
+      return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
+    }
+
+    /**
+     * The base implementation of `_.range` and `_.rangeRight` which doesn't
+     * coerce arguments.
+     *
+     * @private
+     * @param {number} start The start of the range.
+     * @param {number} end The end of the range.
+     * @param {number} step The value to increment or decrement by.
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Array} Returns the range of numbers.
+     */
+    function baseRange(start, end, step, fromRight) {
+      var index = -1,
+          length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
+          result = Array(length);
+
+      while (length--) {
+        result[fromRight ? length : ++index] = start;
+        start += step;
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.repeat` which doesn't coerce arguments.
+     *
+     * @private
+     * @param {string} string The string to repeat.
+     * @param {number} n The number of times to repeat the string.
+     * @returns {string} Returns the repeated string.
+     */
+    function baseRepeat(string, n) {
+      var result = '';
+      if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
+        return result;
+      }
+      // Leverage the exponentiation by squaring algorithm for a faster repeat.
+      // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
+      do {
+        if (n % 2) {
+          result += string;
+        }
+        n = nativeFloor(n / 2);
+        if (n) {
+          string += string;
+        }
+      } while (n);
+
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.rest` which doesn't validate or coerce arguments.
+     *
+     * @private
+     * @param {Function} func The function to apply a rest parameter to.
+     * @param {number} [start=func.length-1] The start position of the rest parameter.
+     * @returns {Function} Returns the new function.
+     */
+    function baseRest(func, start) {
+      return setToString(overRest(func, start, identity), func + '');
+    }
+
+    /**
+     * The base implementation of `_.sample`.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to sample.
+     * @returns {*} Returns the random element.
+     */
+    function baseSample(collection) {
+      return arraySample(values(collection));
+    }
+
+    /**
+     * The base implementation of `_.sampleSize` without param guards.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to sample.
+     * @param {number} n The number of elements to sample.
+     * @returns {Array} Returns the random elements.
+     */
+    function baseSampleSize(collection, n) {
+      var array = values(collection);
+      return shuffleSelf(array, baseClamp(n, 0, array.length));
+    }
+
+    /**
+     * The base implementation of `_.set`.
+     *
+     * @private
+     * @param {Object} object The object to modify.
+     * @param {Array|string} path The path of the property to set.
+     * @param {*} value The value to set.
+     * @param {Function} [customizer] The function to customize path creation.
+     * @returns {Object} Returns `object`.
+     */
+    function baseSet(object, path, value, customizer) {
+      if (!isObject(object)) {
+        return object;
+      }
+      path = castPath(path, object);
+
+      var index = -1,
+          length = path.length,
+          lastIndex = length - 1,
+          nested = object;
+
+      while (nested != null && ++index < length) {
+        var key = toKey(path[index]),
+            newValue = value;
+
+        if (index != lastIndex) {
+          var objValue = nested[key];
+          newValue = customizer ? customizer(objValue, key, nested) : undefined;
+          if (newValue === undefined) {
+            newValue = isObject(objValue)
+              ? objValue
+              : (isIndex(path[index + 1]) ? [] : {});
+          }
+        }
+        assignValue(nested, key, newValue);
+        nested = nested[key];
+      }
+      return object;
+    }
+
+    /**
+     * The base implementation of `setData` without support for hot loop shorting.
+     *
+     * @private
+     * @param {Function} func The function to associate metadata with.
+     * @param {*} data The metadata.
+     * @returns {Function} Returns `func`.
+     */
+    var baseSetData = !metaMap ? identity : function(func, data) {
+      metaMap.set(func, data);
+      return func;
+    };
+
+    /**
+     * The base implementation of `setToString` without support for hot loop shorting.
+     *
+     * @private
+     * @param {Function} func The function to modify.
+     * @param {Function} string The `toString` result.
+     * @returns {Function} Returns `func`.
+     */
+    var baseSetToString = !defineProperty ? identity : function(func, string) {
+      return defineProperty(func, 'toString', {
+        'configurable': true,
+        'enumerable': false,
+        'value': constant(string),
+        'writable': true
+      });
+    };
+
+    /**
+     * The base implementation of `_.shuffle`.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to shuffle.
+     * @returns {Array} Returns the new shuffled array.
+     */
+    function baseShuffle(collection) {
+      return shuffleSelf(values(collection));
+    }
+
+    /**
+     * The base implementation of `_.slice` without an iteratee call guard.
+     *
+     * @private
+     * @param {Array} array The array to slice.
+     * @param {number} [start=0] The start position.
+     * @param {number} [end=array.length] The end position.
+     * @returns {Array} Returns the slice of `array`.
+     */
+    function baseSlice(array, start, end) {
+      var index = -1,
+          length = array.length;
+
+      if (start < 0) {
+        start = -start > length ? 0 : (length + start);
+      }
+      end = end > length ? length : end;
+      if (end < 0) {
+        end += length;
+      }
+      length = start > end ? 0 : ((end - start) >>> 0);
+      start >>>= 0;
+
+      var result = Array(length);
+      while (++index < length) {
+        result[index] = array[index + start];
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.some` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} predicate The function invoked per iteration.
+     * @returns {boolean} Returns `true` if any element passes the predicate check,
+     *  else `false`.
+     */
+    function baseSome(collection, predicate) {
+      var result;
+
+      baseEach(collection, function(value, index, collection) {
+        result = predicate(value, index, collection);
+        return !result;
+      });
+      return !!result;
+    }
+
+    /**
+     * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
+     * performs a binary search of `array` to determine the index at which `value`
+     * should be inserted into `array` in order to maintain its sort order.
+     *
+     * @private
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {boolean} [retHighest] Specify returning the highest qualified index.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     */
+    function baseSortedIndex(array, value, retHighest) {
+      var low = 0,
+          high = array == null ? low : array.length;
+
+      if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
+        while (low < high) {
+          var mid = (low + high) >>> 1,
+              computed = array[mid];
+
+          if (computed !== null && !isSymbol(computed) &&
+              (retHighest ? (computed <= value) : (computed < value))) {
+            low = mid + 1;
+          } else {
+            high = mid;
+          }
+        }
+        return high;
+      }
+      return baseSortedIndexBy(array, value, identity, retHighest);
+    }
+
+    /**
+     * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
+     * which invokes `iteratee` for `value` and each element of `array` to compute
+     * their sort ranking. The iteratee is invoked with one argument; (value).
+     *
+     * @private
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {Function} iteratee The iteratee invoked per element.
+     * @param {boolean} [retHighest] Specify returning the highest qualified index.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     */
+    function baseSortedIndexBy(array, value, iteratee, retHighest) {
+      value = iteratee(value);
+
+      var low = 0,
+          high = array == null ? 0 : array.length,
+          valIsNaN = value !== value,
+          valIsNull = value === null,
+          valIsSymbol = isSymbol(value),
+          valIsUndefined = value === undefined;
+
+      while (low < high) {
+        var mid = nativeFloor((low + high) / 2),
+            computed = iteratee(array[mid]),
+            othIsDefined = computed !== undefined,
+            othIsNull = computed === null,
+            othIsReflexive = computed === computed,
+            othIsSymbol = isSymbol(computed);
+
+        if (valIsNaN) {
+          var setLow = retHighest || othIsReflexive;
+        } else if (valIsUndefined) {
+          setLow = othIsReflexive && (retHighest || othIsDefined);
+        } else if (valIsNull) {
+          setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
+        } else if (valIsSymbol) {
+          setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
+        } else if (othIsNull || othIsSymbol) {
+          setLow = false;
+        } else {
+          setLow = retHighest ? (computed <= value) : (computed < value);
+        }
+        if (setLow) {
+          low = mid + 1;
+        } else {
+          high = mid;
+        }
+      }
+      return nativeMin(high, MAX_ARRAY_INDEX);
+    }
+
+    /**
+     * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
+     * support for iteratee shorthands.
+     *
+     * @private
+     * @param {Array} array The array to inspect.
+     * @param {Function} [iteratee] The iteratee invoked per element.
+     * @returns {Array} Returns the new duplicate free array.
+     */
+    function baseSortedUniq(array, iteratee) {
+      var index = -1,
+          length = array.length,
+          resIndex = 0,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index],
+            computed = iteratee ? iteratee(value) : value;
+
+        if (!index || !eq(computed, seen)) {
+          var seen = computed;
+          result[resIndex++] = value === 0 ? 0 : value;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.toNumber` which doesn't ensure correct
+     * conversions of binary, hexadecimal, or octal string values.
+     *
+     * @private
+     * @param {*} value The value to process.
+     * @returns {number} Returns the number.
+     */
+    function baseToNumber(value) {
+      if (typeof value == 'number') {
+        return value;
+      }
+      if (isSymbol(value)) {
+        return NAN;
+      }
+      return +value;
+    }
+
+    /**
+     * The base implementation of `_.toString` which doesn't convert nullish
+     * values to empty strings.
+     *
+     * @private
+     * @param {*} value The value to process.
+     * @returns {string} Returns the string.
+     */
+    function baseToString(value) {
+      // Exit early for strings to avoid a performance hit in some environments.
+      if (typeof value == 'string') {
+        return value;
+      }
+      if (isArray(value)) {
+        // Recursively convert values (susceptible to call stack limits).
+        return arrayMap(value, baseToString) + '';
+      }
+      if (isSymbol(value)) {
+        return symbolToString ? symbolToString.call(value) : '';
+      }
+      var result = (value + '');
+      return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+    }
+
+    /**
+     * The base implementation of `_.uniqBy` without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Array} array The array to inspect.
+     * @param {Function} [iteratee] The iteratee invoked per element.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns the new duplicate free array.
+     */
+    function baseUniq(array, iteratee, comparator) {
+      var index = -1,
+          includes = arrayIncludes,
+          length = array.length,
+          isCommon = true,
+          result = [],
+          seen = result;
+
+      if (comparator) {
+        isCommon = false;
+        includes = arrayIncludesWith;
+      }
+      else if (length >= LARGE_ARRAY_SIZE) {
+        var set = iteratee ? null : createSet(array);
+        if (set) {
+          return setToArray(set);
+        }
+        isCommon = false;
+        includes = cacheHas;
+        seen = new SetCache;
+      }
+      else {
+        seen = iteratee ? [] : result;
+      }
+      outer:
+      while (++index < length) {
+        var value = array[index],
+            computed = iteratee ? iteratee(value) : value;
+
+        value = (comparator || value !== 0) ? value : 0;
+        if (isCommon && computed === computed) {
+          var seenIndex = seen.length;
+          while (seenIndex--) {
+            if (seen[seenIndex] === computed) {
+              continue outer;
+            }
+          }
+          if (iteratee) {
+            seen.push(computed);
+          }
+          result.push(value);
+        }
+        else if (!includes(seen, computed, comparator)) {
+          if (seen !== result) {
+            seen.push(computed);
+          }
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.unset`.
+     *
+     * @private
+     * @param {Object} object The object to modify.
+     * @param {Array|string} path The property path to unset.
+     * @returns {boolean} Returns `true` if the property is deleted, else `false`.
+     */
+    function baseUnset(object, path) {
+      path = castPath(path, object);
+      object = parent(object, path);
+      return object == null || delete object[toKey(last(path))];
+    }
+
+    /**
+     * The base implementation of `_.update`.
+     *
+     * @private
+     * @param {Object} object The object to modify.
+     * @param {Array|string} path The path of the property to update.
+     * @param {Function} updater The function to produce the updated value.
+     * @param {Function} [customizer] The function to customize path creation.
+     * @returns {Object} Returns `object`.
+     */
+    function baseUpdate(object, path, updater, customizer) {
+      return baseSet(object, path, updater(baseGet(object, path)), customizer);
+    }
+
+    /**
+     * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
+     * without support for iteratee shorthands.
+     *
+     * @private
+     * @param {Array} array The array to query.
+     * @param {Function} predicate The function invoked per iteration.
+     * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Array} Returns the slice of `array`.
+     */
+    function baseWhile(array, predicate, isDrop, fromRight) {
+      var length = array.length,
+          index = fromRight ? length : -1;
+
+      while ((fromRight ? index-- : ++index < length) &&
+        predicate(array[index], index, array)) {}
+
+      return isDrop
+        ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
+        : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
+    }
+
+    /**
+     * The base implementation of `wrapperValue` which returns the result of
+     * performing a sequence of actions on the unwrapped `value`, where each
+     * successive action is supplied the return value of the previous.
+     *
+     * @private
+     * @param {*} value The unwrapped value.
+     * @param {Array} actions Actions to perform to resolve the unwrapped value.
+     * @returns {*} Returns the resolved value.
+     */
+    function baseWrapperValue(value, actions) {
+      var result = value;
+      if (result instanceof LazyWrapper) {
+        result = result.value();
+      }
+      return arrayReduce(actions, function(result, action) {
+        return action.func.apply(action.thisArg, arrayPush([result], action.args));
+      }, result);
+    }
+
+    /**
+     * The base implementation of methods like `_.xor`, without support for
+     * iteratee shorthands, that accepts an array of arrays to inspect.
+     *
+     * @private
+     * @param {Array} arrays The arrays to inspect.
+     * @param {Function} [iteratee] The iteratee invoked per element.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns the new array of values.
+     */
+    function baseXor(arrays, iteratee, comparator) {
+      var length = arrays.length;
+      if (length < 2) {
+        return length ? baseUniq(arrays[0]) : [];
+      }
+      var index = -1,
+          result = Array(length);
+
+      while (++index < length) {
+        var array = arrays[index],
+            othIndex = -1;
+
+        while (++othIndex < length) {
+          if (othIndex != index) {
+            result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
+          }
+        }
+      }
+      return baseUniq(baseFlatten(result, 1), iteratee, comparator);
+    }
+
+    /**
+     * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
+     *
+     * @private
+     * @param {Array} props The property identifiers.
+     * @param {Array} values The property values.
+     * @param {Function} assignFunc The function to assign values.
+     * @returns {Object} Returns the new object.
+     */
+    function baseZipObject(props, values, assignFunc) {
+      var index = -1,
+          length = props.length,
+          valsLength = values.length,
+          result = {};
+
+      while (++index < length) {
+        var value = index < valsLength ? values[index] : undefined;
+        assignFunc(result, props[index], value);
+      }
+      return result;
+    }
+
+    /**
+     * Casts `value` to an empty array if it's not an array like object.
+     *
+     * @private
+     * @param {*} value The value to inspect.
+     * @returns {Array|Object} Returns the cast array-like object.
+     */
+    function castArrayLikeObject(value) {
+      return isArrayLikeObject(value) ? value : [];
+    }
+
+    /**
+     * Casts `value` to `identity` if it's not a function.
+     *
+     * @private
+     * @param {*} value The value to inspect.
+     * @returns {Function} Returns cast function.
+     */
+    function castFunction(value) {
+      return typeof value == 'function' ? value : identity;
+    }
+
+    /**
+     * Casts `value` to a path array if it's not one.
+     *
+     * @private
+     * @param {*} value The value to inspect.
+     * @param {Object} [object] The object to query keys on.
+     * @returns {Array} Returns the cast property path array.
+     */
+    function castPath(value, object) {
+      if (isArray(value)) {
+        return value;
+      }
+      return isKey(value, object) ? [value] : stringToPath(toString(value));
+    }
+
+    /**
+     * A `baseRest` alias which can be replaced with `identity` by module
+     * replacement plugins.
+     *
+     * @private
+     * @type {Function}
+     * @param {Function} func The function to apply a rest parameter to.
+     * @returns {Function} Returns the new function.
+     */
+    var castRest = baseRest;
+
+    /**
+     * Casts `array` to a slice if it's needed.
+     *
+     * @private
+     * @param {Array} array The array to inspect.
+     * @param {number} start The start position.
+     * @param {number} [end=array.length] The end position.
+     * @returns {Array} Returns the cast slice.
+     */
+    function castSlice(array, start, end) {
+      var length = array.length;
+      end = end === undefined ? length : end;
+      return (!start && end >= length) ? array : baseSlice(array, start, end);
+    }
+
+    /**
+     * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
+     *
+     * @private
+     * @param {number|Object} id The timer id or timeout object of the timer to clear.
+     */
+    var clearTimeout = ctxClearTimeout || function(id) {
+      return root.clearTimeout(id);
+    };
+
+    /**
+     * Creates a clone of  `buffer`.
+     *
+     * @private
+     * @param {Buffer} buffer The buffer to clone.
+     * @param {boolean} [isDeep] Specify a deep clone.
+     * @returns {Buffer} Returns the cloned buffer.
+     */
+    function cloneBuffer(buffer, isDeep) {
+      if (isDeep) {
+        return buffer.slice();
+      }
+      var length = buffer.length,
+          result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
+
+      buffer.copy(result);
+      return result;
+    }
+
+    /**
+     * Creates a clone of `arrayBuffer`.
+     *
+     * @private
+     * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
+     * @returns {ArrayBuffer} Returns the cloned array buffer.
+     */
+    function cloneArrayBuffer(arrayBuffer) {
+      var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
+      new Uint8Array(result).set(new Uint8Array(arrayBuffer));
+      return result;
+    }
+
+    /**
+     * Creates a clone of `dataView`.
+     *
+     * @private
+     * @param {Object} dataView The data view to clone.
+     * @param {boolean} [isDeep] Specify a deep clone.
+     * @returns {Object} Returns the cloned data view.
+     */
+    function cloneDataView(dataView, isDeep) {
+      var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
+      return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
+    }
+
+    /**
+     * Creates a clone of `regexp`.
+     *
+     * @private
+     * @param {Object} regexp The regexp to clone.
+     * @returns {Object} Returns the cloned regexp.
+     */
+    function cloneRegExp(regexp) {
+      var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
+      result.lastIndex = regexp.lastIndex;
+      return result;
+    }
+
+    /**
+     * Creates a clone of the `symbol` object.
+     *
+     * @private
+     * @param {Object} symbol The symbol object to clone.
+     * @returns {Object} Returns the cloned symbol object.
+     */
+    function cloneSymbol(symbol) {
+      return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
+    }
+
+    /**
+     * Creates a clone of `typedArray`.
+     *
+     * @private
+     * @param {Object} typedArray The typed array to clone.
+     * @param {boolean} [isDeep] Specify a deep clone.
+     * @returns {Object} Returns the cloned typed array.
+     */
+    function cloneTypedArray(typedArray, isDeep) {
+      var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
+      return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
+    }
+
+    /**
+     * Compares values to sort them in ascending order.
+     *
+     * @private
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {number} Returns the sort order indicator for `value`.
+     */
+    function compareAscending(value, other) {
+      if (value !== other) {
+        var valIsDefined = value !== undefined,
+            valIsNull = value === null,
+            valIsReflexive = value === value,
+            valIsSymbol = isSymbol(value);
+
+        var othIsDefined = other !== undefined,
+            othIsNull = other === null,
+            othIsReflexive = other === other,
+            othIsSymbol = isSymbol(other);
+
+        if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
+            (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
+            (valIsNull && othIsDefined && othIsReflexive) ||
+            (!valIsDefined && othIsReflexive) ||
+            !valIsReflexive) {
+          return 1;
+        }
+        if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
+            (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
+            (othIsNull && valIsDefined && valIsReflexive) ||
+            (!othIsDefined && valIsReflexive) ||
+            !othIsReflexive) {
+          return -1;
+        }
+      }
+      return 0;
+    }
+
+    /**
+     * Used by `_.orderBy` to compare multiple properties of a value to another
+     * and stable sort them.
+     *
+     * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
+     * specify an order of "desc" for descending or "asc" for ascending sort order
+     * of corresponding values.
+     *
+     * @private
+     * @param {Object} object The object to compare.
+     * @param {Object} other The other object to compare.
+     * @param {boolean[]|string[]} orders The order to sort by for each property.
+     * @returns {number} Returns the sort order indicator for `object`.
+     */
+    function compareMultiple(object, other, orders) {
+      var index = -1,
+          objCriteria = object.criteria,
+          othCriteria = other.criteria,
+          length = objCriteria.length,
+          ordersLength = orders.length;
+
+      while (++index < length) {
+        var result = compareAscending(objCriteria[index], othCriteria[index]);
+        if (result) {
+          if (index >= ordersLength) {
+            return result;
+          }
+          var order = orders[index];
+          return result * (order == 'desc' ? -1 : 1);
+        }
+      }
+      // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
+      // that causes it, under certain circumstances, to provide the same value for
+      // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
+      // for more details.
+      //
+      // This also ensures a stable sort in V8 and other engines.
+      // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
+      return object.index - other.index;
+    }
+
+    /**
+     * Creates an array that is the composition of partially applied arguments,
+     * placeholders, and provided arguments into a single array of arguments.
+     *
+     * @private
+     * @param {Array} args The provided arguments.
+     * @param {Array} partials The arguments to prepend to those provided.
+     * @param {Array} holders The `partials` placeholder indexes.
+     * @params {boolean} [isCurried] Specify composing for a curried function.
+     * @returns {Array} Returns the new array of composed arguments.
+     */
+    function composeArgs(args, partials, holders, isCurried) {
+      var argsIndex = -1,
+          argsLength = args.length,
+          holdersLength = holders.length,
+          leftIndex = -1,
+          leftLength = partials.length,
+          rangeLength = nativeMax(argsLength - holdersLength, 0),
+          result = Array(leftLength + rangeLength),
+          isUncurried = !isCurried;
+
+      while (++leftIndex < leftLength) {
+        result[leftIndex] = partials[leftIndex];
+      }
+      while (++argsIndex < holdersLength) {
+        if (isUncurried || argsIndex < argsLength) {
+          result[holders[argsIndex]] = args[argsIndex];
+        }
+      }
+      while (rangeLength--) {
+        result[leftIndex++] = args[argsIndex++];
+      }
+      return result;
+    }
+
+    /**
+     * This function is like `composeArgs` except that the arguments composition
+     * is tailored for `_.partialRight`.
+     *
+     * @private
+     * @param {Array} args The provided arguments.
+     * @param {Array} partials The arguments to append to those provided.
+     * @param {Array} holders The `partials` placeholder indexes.
+     * @params {boolean} [isCurried] Specify composing for a curried function.
+     * @returns {Array} Returns the new array of composed arguments.
+     */
+    function composeArgsRight(args, partials, holders, isCurried) {
+      var argsIndex = -1,
+          argsLength = args.length,
+          holdersIndex = -1,
+          holdersLength = holders.length,
+          rightIndex = -1,
+          rightLength = partials.length,
+          rangeLength = nativeMax(argsLength - holdersLength, 0),
+          result = Array(rangeLength + rightLength),
+          isUncurried = !isCurried;
+
+      while (++argsIndex < rangeLength) {
+        result[argsIndex] = args[argsIndex];
+      }
+      var offset = argsIndex;
+      while (++rightIndex < rightLength) {
+        result[offset + rightIndex] = partials[rightIndex];
+      }
+      while (++holdersIndex < holdersLength) {
+        if (isUncurried || argsIndex < argsLength) {
+          result[offset + holders[holdersIndex]] = args[argsIndex++];
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Copies the values of `source` to `array`.
+     *
+     * @private
+     * @param {Array} source The array to copy values from.
+     * @param {Array} [array=[]] The array to copy values to.
+     * @returns {Array} Returns `array`.
+     */
+    function copyArray(source, array) {
+      var index = -1,
+          length = source.length;
+
+      array || (array = Array(length));
+      while (++index < length) {
+        array[index] = source[index];
+      }
+      return array;
+    }
+
+    /**
+     * Copies properties of `source` to `object`.
+     *
+     * @private
+     * @param {Object} source The object to copy properties from.
+     * @param {Array} props The property identifiers to copy.
+     * @param {Object} [object={}] The object to copy properties to.
+     * @param {Function} [customizer] The function to customize copied values.
+     * @returns {Object} Returns `object`.
+     */
+    function copyObject(source, props, object, customizer) {
+      var isNew = !object;
+      object || (object = {});
+
+      var index = -1,
+          length = props.length;
+
+      while (++index < length) {
+        var key = props[index];
+
+        var newValue = customizer
+          ? customizer(object[key], source[key], key, object, source)
+          : undefined;
+
+        if (newValue === undefined) {
+          newValue = source[key];
+        }
+        if (isNew) {
+          baseAssignValue(object, key, newValue);
+        } else {
+          assignValue(object, key, newValue);
+        }
+      }
+      return object;
+    }
+
+    /**
+     * Copies own symbols of `source` to `object`.
+     *
+     * @private
+     * @param {Object} source The object to copy symbols from.
+     * @param {Object} [object={}] The object to copy symbols to.
+     * @returns {Object} Returns `object`.
+     */
+    function copySymbols(source, object) {
+      return copyObject(source, getSymbols(source), object);
+    }
+
+    /**
+     * Copies own and inherited symbols of `source` to `object`.
+     *
+     * @private
+     * @param {Object} source The object to copy symbols from.
+     * @param {Object} [object={}] The object to copy symbols to.
+     * @returns {Object} Returns `object`.
+     */
+    function copySymbolsIn(source, object) {
+      return copyObject(source, getSymbolsIn(source), object);
+    }
+
+    /**
+     * Creates a function like `_.groupBy`.
+     *
+     * @private
+     * @param {Function} setter The function to set accumulator values.
+     * @param {Function} [initializer] The accumulator object initializer.
+     * @returns {Function} Returns the new aggregator function.
+     */
+    function createAggregator(setter, initializer) {
+      return function(collection, iteratee) {
+        var func = isArray(collection) ? arrayAggregator : baseAggregator,
+            accumulator = initializer ? initializer() : {};
+
+        return func(collection, setter, getIteratee(iteratee, 2), accumulator);
+      };
+    }
+
+    /**
+     * Creates a function like `_.assign`.
+     *
+     * @private
+     * @param {Function} assigner The function to assign values.
+     * @returns {Function} Returns the new assigner function.
+     */
+    function createAssigner(assigner) {
+      return baseRest(function(object, sources) {
+        var index = -1,
+            length = sources.length,
+            customizer = length > 1 ? sources[length - 1] : undefined,
+            guard = length > 2 ? sources[2] : undefined;
+
+        customizer = (assigner.length > 3 && typeof customizer == 'function')
+          ? (length--, customizer)
+          : undefined;
+
+        if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+          customizer = length < 3 ? undefined : customizer;
+          length = 1;
+        }
+        object = Object(object);
+        while (++index < length) {
+          var source = sources[index];
+          if (source) {
+            assigner(object, source, index, customizer);
+          }
+        }
+        return object;
+      });
+    }
+
+    /**
+     * Creates a `baseEach` or `baseEachRight` function.
+     *
+     * @private
+     * @param {Function} eachFunc The function to iterate over a collection.
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Function} Returns the new base function.
+     */
+    function createBaseEach(eachFunc, fromRight) {
+      return function(collection, iteratee) {
+        if (collection == null) {
+          return collection;
+        }
+        if (!isArrayLike(collection)) {
+          return eachFunc(collection, iteratee);
+        }
+        var length = collection.length,
+            index = fromRight ? length : -1,
+            iterable = Object(collection);
+
+        while ((fromRight ? index-- : ++index < length)) {
+          if (iteratee(iterable[index], index, iterable) === false) {
+            break;
+          }
+        }
+        return collection;
+      };
+    }
+
+    /**
+     * Creates a base function for methods like `_.forIn` and `_.forOwn`.
+     *
+     * @private
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Function} Returns the new base function.
+     */
+    function createBaseFor(fromRight) {
+      return function(object, iteratee, keysFunc) {
+        var index = -1,
+            iterable = Object(object),
+            props = keysFunc(object),
+            length = props.length;
+
+        while (length--) {
+          var key = props[fromRight ? length : ++index];
+          if (iteratee(iterable[key], key, iterable) === false) {
+            break;
+          }
+        }
+        return object;
+      };
+    }
+
+    /**
+     * Creates a function that wraps `func` to invoke it with the optional `this`
+     * binding of `thisArg`.
+     *
+     * @private
+     * @param {Function} func The function to wrap.
+     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createBind(func, bitmask, thisArg) {
+      var isBind = bitmask & WRAP_BIND_FLAG,
+          Ctor = createCtor(func);
+
+      function wrapper() {
+        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+        return fn.apply(isBind ? thisArg : this, arguments);
+      }
+      return wrapper;
+    }
+
+    /**
+     * Creates a function like `_.lowerFirst`.
+     *
+     * @private
+     * @param {string} methodName The name of the `String` case method to use.
+     * @returns {Function} Returns the new case function.
+     */
+    function createCaseFirst(methodName) {
+      return function(string) {
+        string = toString(string);
+
+        var strSymbols = hasUnicode(string)
+          ? stringToArray(string)
+          : undefined;
+
+        var chr = strSymbols
+          ? strSymbols[0]
+          : string.charAt(0);
+
+        var trailing = strSymbols
+          ? castSlice(strSymbols, 1).join('')
+          : string.slice(1);
+
+        return chr[methodName]() + trailing;
+      };
+    }
+
+    /**
+     * Creates a function like `_.camelCase`.
+     *
+     * @private
+     * @param {Function} callback The function to combine each word.
+     * @returns {Function} Returns the new compounder function.
+     */
+    function createCompounder(callback) {
+      return function(string) {
+        return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
+      };
+    }
+
+    /**
+     * Creates a function that produces an instance of `Ctor` regardless of
+     * whether it was invoked as part of a `new` expression or by `call` or `apply`.
+     *
+     * @private
+     * @param {Function} Ctor The constructor to wrap.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createCtor(Ctor) {
+      return function() {
+        // Use a `switch` statement to work with class constructors. See
+        // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
+        // for more details.
+        var args = arguments;
+        switch (args.length) {
+          case 0: return new Ctor;
+          case 1: return new Ctor(args[0]);
+          case 2: return new Ctor(args[0], args[1]);
+          case 3: return new Ctor(args[0], args[1], args[2]);
+          case 4: return new Ctor(args[0], args[1], args[2], args[3]);
+          case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
+          case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
+          case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
+        }
+        var thisBinding = baseCreate(Ctor.prototype),
+            result = Ctor.apply(thisBinding, args);
+
+        // Mimic the constructor's `return` behavior.
+        // See https://es5.github.io/#x13.2.2 for more details.
+        return isObject(result) ? result : thisBinding;
+      };
+    }
+
+    /**
+     * Creates a function that wraps `func` to enable currying.
+     *
+     * @private
+     * @param {Function} func The function to wrap.
+     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+     * @param {number} arity The arity of `func`.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createCurry(func, bitmask, arity) {
+      var Ctor = createCtor(func);
+
+      function wrapper() {
+        var length = arguments.length,
+            args = Array(length),
+            index = length,
+            placeholder = getHolder(wrapper);
+
+        while (index--) {
+          args[index] = arguments[index];
+        }
+        var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
+          ? []
+          : replaceHolders(args, placeholder);
+
+        length -= holders.length;
+        if (length < arity) {
+          return createRecurry(
+            func, bitmask, createHybrid, wrapper.placeholder, undefined,
+            args, holders, undefined, undefined, arity - length);
+        }
+        var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+        return apply(fn, this, args);
+      }
+      return wrapper;
+    }
+
+    /**
+     * Creates a `_.find` or `_.findLast` function.
+     *
+     * @private
+     * @param {Function} findIndexFunc The function to find the collection index.
+     * @returns {Function} Returns the new find function.
+     */
+    function createFind(findIndexFunc) {
+      return function(collection, predicate, fromIndex) {
+        var iterable = Object(collection);
+        if (!isArrayLike(collection)) {
+          var iteratee = getIteratee(predicate, 3);
+          collection = keys(collection);
+          predicate = function(key) { return iteratee(iterable[key], key, iterable); };
+        }
+        var index = findIndexFunc(collection, predicate, fromIndex);
+        return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
+      };
+    }
+
+    /**
+     * Creates a `_.flow` or `_.flowRight` function.
+     *
+     * @private
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Function} Returns the new flow function.
+     */
+    function createFlow(fromRight) {
+      return flatRest(function(funcs) {
+        var length = funcs.length,
+            index = length,
+            prereq = LodashWrapper.prototype.thru;
+
+        if (fromRight) {
+          funcs.reverse();
+        }
+        while (index--) {
+          var func = funcs[index];
+          if (typeof func != 'function') {
+            throw new TypeError(FUNC_ERROR_TEXT);
+          }
+          if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
+            var wrapper = new LodashWrapper([], true);
+          }
+        }
+        index = wrapper ? index : length;
+        while (++index < length) {
+          func = funcs[index];
+
+          var funcName = getFuncName(func),
+              data = funcName == 'wrapper' ? getData(func) : undefined;
+
+          if (data && isLaziable(data[0]) &&
+                data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
+                !data[4].length && data[9] == 1
+              ) {
+            wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
+          } else {
+            wrapper = (func.length == 1 && isLaziable(func))
+              ? wrapper[funcName]()
+              : wrapper.thru(func);
+          }
+        }
+        return function() {
+          var args = arguments,
+              value = args[0];
+
+          if (wrapper && args.length == 1 && isArray(value)) {
+            return wrapper.plant(value).value();
+          }
+          var index = 0,
+              result = length ? funcs[index].apply(this, args) : value;
+
+          while (++index < length) {
+            result = funcs[index].call(this, result);
+          }
+          return result;
+        };
+      });
+    }
+
+    /**
+     * Creates a function that wraps `func` to invoke it with optional `this`
+     * binding of `thisArg`, partial application, and currying.
+     *
+     * @private
+     * @param {Function|string} func The function or method name to wrap.
+     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {Array} [partials] The arguments to prepend to those provided to
+     *  the new function.
+     * @param {Array} [holders] The `partials` placeholder indexes.
+     * @param {Array} [partialsRight] The arguments to append to those provided
+     *  to the new function.
+     * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
+     * @param {Array} [argPos] The argument positions of the new function.
+     * @param {number} [ary] The arity cap of `func`.
+     * @param {number} [arity] The arity of `func`.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
+      var isAry = bitmask & WRAP_ARY_FLAG,
+          isBind = bitmask & WRAP_BIND_FLAG,
+          isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
+          isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
+          isFlip = bitmask & WRAP_FLIP_FLAG,
+          Ctor = isBindKey ? undefined : createCtor(func);
+
+      function wrapper() {
+        var length = arguments.length,
+            args = Array(length),
+            index = length;
+
+        while (index--) {
+          args[index] = arguments[index];
+        }
+        if (isCurried) {
+          var placeholder = getHolder(wrapper),
+              holdersCount = countHolders(args, placeholder);
+        }
+        if (partials) {
+          args = composeArgs(args, partials, holders, isCurried);
+        }
+        if (partialsRight) {
+          args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
+        }
+        length -= holdersCount;
+        if (isCurried && length < arity) {
+          var newHolders = replaceHolders(args, placeholder);
+          return createRecurry(
+            func, bitmask, createHybrid, wrapper.placeholder, thisArg,
+            args, newHolders, argPos, ary, arity - length
+          );
+        }
+        var thisBinding = isBind ? thisArg : this,
+            fn = isBindKey ? thisBinding[func] : func;
+
+        length = args.length;
+        if (argPos) {
+          args = reorder(args, argPos);
+        } else if (isFlip && length > 1) {
+          args.reverse();
+        }
+        if (isAry && ary < length) {
+          args.length = ary;
+        }
+        if (this && this !== root && this instanceof wrapper) {
+          fn = Ctor || createCtor(fn);
+        }
+        return fn.apply(thisBinding, args);
+      }
+      return wrapper;
+    }
+
+    /**
+     * Creates a function like `_.invertBy`.
+     *
+     * @private
+     * @param {Function} setter The function to set accumulator values.
+     * @param {Function} toIteratee The function to resolve iteratees.
+     * @returns {Function} Returns the new inverter function.
+     */
+    function createInverter(setter, toIteratee) {
+      return function(object, iteratee) {
+        return baseInverter(object, setter, toIteratee(iteratee), {});
+      };
+    }
+
+    /**
+     * Creates a function that performs a mathematical operation on two values.
+     *
+     * @private
+     * @param {Function} operator The function to perform the operation.
+     * @param {number} [defaultValue] The value used for `undefined` arguments.
+     * @returns {Function} Returns the new mathematical operation function.
+     */
+    function createMathOperation(operator, defaultValue) {
+      return function(value, other) {
+        var result;
+        if (value === undefined && other === undefined) {
+          return defaultValue;
+        }
+        if (value !== undefined) {
+          result = value;
+        }
+        if (other !== undefined) {
+          if (result === undefined) {
+            return other;
+          }
+          if (typeof value == 'string' || typeof other == 'string') {
+            value = baseToString(value);
+            other = baseToString(other);
+          } else {
+            value = baseToNumber(value);
+            other = baseToNumber(other);
+          }
+          result = operator(value, other);
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function like `_.over`.
+     *
+     * @private
+     * @param {Function} arrayFunc The function to iterate over iteratees.
+     * @returns {Function} Returns the new over function.
+     */
+    function createOver(arrayFunc) {
+      return flatRest(function(iteratees) {
+        iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
+        return baseRest(function(args) {
+          var thisArg = this;
+          return arrayFunc(iteratees, function(iteratee) {
+            return apply(iteratee, thisArg, args);
+          });
+        });
+      });
+    }
+
+    /**
+     * Creates the padding for `string` based on `length`. The `chars` string
+     * is truncated if the number of characters exceeds `length`.
+     *
+     * @private
+     * @param {number} length The padding length.
+     * @param {string} [chars=' '] The string used as padding.
+     * @returns {string} Returns the padding for `string`.
+     */
+    function createPadding(length, chars) {
+      chars = chars === undefined ? ' ' : baseToString(chars);
+
+      var charsLength = chars.length;
+      if (charsLength < 2) {
+        return charsLength ? baseRepeat(chars, length) : chars;
+      }
+      var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
+      return hasUnicode(chars)
+        ? castSlice(stringToArray(result), 0, length).join('')
+        : result.slice(0, length);
+    }
+
+    /**
+     * Creates a function that wraps `func` to invoke it with the `this` binding
+     * of `thisArg` and `partials` prepended to the arguments it receives.
+     *
+     * @private
+     * @param {Function} func The function to wrap.
+     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+     * @param {*} thisArg The `this` binding of `func`.
+     * @param {Array} partials The arguments to prepend to those provided to
+     *  the new function.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createPartial(func, bitmask, thisArg, partials) {
+      var isBind = bitmask & WRAP_BIND_FLAG,
+          Ctor = createCtor(func);
+
+      function wrapper() {
+        var argsIndex = -1,
+            argsLength = arguments.length,
+            leftIndex = -1,
+            leftLength = partials.length,
+            args = Array(leftLength + argsLength),
+            fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+
+        while (++leftIndex < leftLength) {
+          args[leftIndex] = partials[leftIndex];
+        }
+        while (argsLength--) {
+          args[leftIndex++] = arguments[++argsIndex];
+        }
+        return apply(fn, isBind ? thisArg : this, args);
+      }
+      return wrapper;
+    }
+
+    /**
+     * Creates a `_.range` or `_.rangeRight` function.
+     *
+     * @private
+     * @param {boolean} [fromRight] Specify iterating from right to left.
+     * @returns {Function} Returns the new range function.
+     */
+    function createRange(fromRight) {
+      return function(start, end, step) {
+        if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
+          end = step = undefined;
+        }
+        // Ensure the sign of `-0` is preserved.
+        start = toFinite(start);
+        if (end === undefined) {
+          end = start;
+          start = 0;
+        } else {
+          end = toFinite(end);
+        }
+        step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
+        return baseRange(start, end, step, fromRight);
+      };
+    }
+
+    /**
+     * Creates a function that performs a relational operation on two values.
+     *
+     * @private
+     * @param {Function} operator The function to perform the operation.
+     * @returns {Function} Returns the new relational operation function.
+     */
+    function createRelationalOperation(operator) {
+      return function(value, other) {
+        if (!(typeof value == 'string' && typeof other == 'string')) {
+          value = toNumber(value);
+          other = toNumber(other);
+        }
+        return operator(value, other);
+      };
+    }
+
+    /**
+     * Creates a function that wraps `func` to continue currying.
+     *
+     * @private
+     * @param {Function} func The function to wrap.
+     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+     * @param {Function} wrapFunc The function to create the `func` wrapper.
+     * @param {*} placeholder The placeholder value.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {Array} [partials] The arguments to prepend to those provided to
+     *  the new function.
+     * @param {Array} [holders] The `partials` placeholder indexes.
+     * @param {Array} [argPos] The argument positions of the new function.
+     * @param {number} [ary] The arity cap of `func`.
+     * @param {number} [arity] The arity of `func`.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
+      var isCurry = bitmask & WRAP_CURRY_FLAG,
+          newHolders = isCurry ? holders : undefined,
+          newHoldersRight = isCurry ? undefined : holders,
+          newPartials = isCurry ? partials : undefined,
+          newPartialsRight = isCurry ? undefined : partials;
+
+      bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
+      bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
+
+      if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
+        bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
+      }
+      var newData = [
+        func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
+        newHoldersRight, argPos, ary, arity
+      ];
+
+      var result = wrapFunc.apply(undefined, newData);
+      if (isLaziable(func)) {
+        setData(result, newData);
+      }
+      result.placeholder = placeholder;
+      return setWrapToString(result, func, bitmask);
+    }
+
+    /**
+     * Creates a function like `_.round`.
+     *
+     * @private
+     * @param {string} methodName The name of the `Math` method to use when rounding.
+     * @returns {Function} Returns the new round function.
+     */
+    function createRound(methodName) {
+      var func = Math[methodName];
+      return function(number, precision) {
+        number = toNumber(number);
+        precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
+        if (precision) {
+          // Shift with exponential notation to avoid floating-point issues.
+          // See [MDN](https://mdn.io/round#Examples) for more details.
+          var pair = (toString(number) + 'e').split('e'),
+              value = func(pair[0] + 'e' + (+pair[1] + precision));
+
+          pair = (toString(value) + 'e').split('e');
+          return +(pair[0] + 'e' + (+pair[1] - precision));
+        }
+        return func(number);
+      };
+    }
+
+    /**
+     * Creates a set object of `values`.
+     *
+     * @private
+     * @param {Array} values The values to add to the set.
+     * @returns {Object} Returns the new set.
+     */
+    var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
+      return new Set(values);
+    };
+
+    /**
+     * Creates a `_.toPairs` or `_.toPairsIn` function.
+     *
+     * @private
+     * @param {Function} keysFunc The function to get the keys of a given object.
+     * @returns {Function} Returns the new pairs function.
+     */
+    function createToPairs(keysFunc) {
+      return function(object) {
+        var tag = getTag(object);
+        if (tag == mapTag) {
+          return mapToArray(object);
+        }
+        if (tag == setTag) {
+          return setToPairs(object);
+        }
+        return baseToPairs(object, keysFunc(object));
+      };
+    }
+
+    /**
+     * Creates a function that either curries or invokes `func` with optional
+     * `this` binding and partially applied arguments.
+     *
+     * @private
+     * @param {Function|string} func The function or method name to wrap.
+     * @param {number} bitmask The bitmask flags.
+     *    1 - `_.bind`
+     *    2 - `_.bindKey`
+     *    4 - `_.curry` or `_.curryRight` of a bound function
+     *    8 - `_.curry`
+     *   16 - `_.curryRight`
+     *   32 - `_.partial`
+     *   64 - `_.partialRight`
+     *  128 - `_.rearg`
+     *  256 - `_.ary`
+     *  512 - `_.flip`
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {Array} [partials] The arguments to be partially applied.
+     * @param {Array} [holders] The `partials` placeholder indexes.
+     * @param {Array} [argPos] The argument positions of the new function.
+     * @param {number} [ary] The arity cap of `func`.
+     * @param {number} [arity] The arity of `func`.
+     * @returns {Function} Returns the new wrapped function.
+     */
+    function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
+      var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
+      if (!isBindKey && typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      var length = partials ? partials.length : 0;
+      if (!length) {
+        bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
+        partials = holders = undefined;
+      }
+      ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
+      arity = arity === undefined ? arity : toInteger(arity);
+      length -= holders ? holders.length : 0;
+
+      if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
+        var partialsRight = partials,
+            holdersRight = holders;
+
+        partials = holders = undefined;
+      }
+      var data = isBindKey ? undefined : getData(func);
+
+      var newData = [
+        func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
+        argPos, ary, arity
+      ];
+
+      if (data) {
+        mergeData(newData, data);
+      }
+      func = newData[0];
+      bitmask = newData[1];
+      thisArg = newData[2];
+      partials = newData[3];
+      holders = newData[4];
+      arity = newData[9] = newData[9] === undefined
+        ? (isBindKey ? 0 : func.length)
+        : nativeMax(newData[9] - length, 0);
+
+      if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
+        bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
+      }
+      if (!bitmask || bitmask == WRAP_BIND_FLAG) {
+        var result = createBind(func, bitmask, thisArg);
+      } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
+        result = createCurry(func, bitmask, arity);
+      } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
+        result = createPartial(func, bitmask, thisArg, partials);
+      } else {
+        result = createHybrid.apply(undefined, newData);
+      }
+      var setter = data ? baseSetData : setData;
+      return setWrapToString(setter(result, newData), func, bitmask);
+    }
+
+    /**
+     * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
+     * of source objects to the destination object for all destination properties
+     * that resolve to `undefined`.
+     *
+     * @private
+     * @param {*} objValue The destination value.
+     * @param {*} srcValue The source value.
+     * @param {string} key The key of the property to assign.
+     * @param {Object} object The parent object of `objValue`.
+     * @returns {*} Returns the value to assign.
+     */
+    function customDefaultsAssignIn(objValue, srcValue, key, object) {
+      if (objValue === undefined ||
+          (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
+        return srcValue;
+      }
+      return objValue;
+    }
+
+    /**
+     * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
+     * objects into destination objects that are passed thru.
+     *
+     * @private
+     * @param {*} objValue The destination value.
+     * @param {*} srcValue The source value.
+     * @param {string} key The key of the property to merge.
+     * @param {Object} object The parent object of `objValue`.
+     * @param {Object} source The parent object of `srcValue`.
+     * @param {Object} [stack] Tracks traversed source values and their merged
+     *  counterparts.
+     * @returns {*} Returns the value to assign.
+     */
+    function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
+      if (isObject(objValue) && isObject(srcValue)) {
+        // Recursively merge objects and arrays (susceptible to call stack limits).
+        stack.set(srcValue, objValue);
+        baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
+        stack['delete'](srcValue);
+      }
+      return objValue;
+    }
+
+    /**
+     * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
+     * objects.
+     *
+     * @private
+     * @param {*} value The value to inspect.
+     * @param {string} key The key of the property to inspect.
+     * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
+     */
+    function customOmitClone(value) {
+      return isPlainObject(value) ? undefined : value;
+    }
+
+    /**
+     * A specialized version of `baseIsEqualDeep` for arrays with support for
+     * partial deep comparisons.
+     *
+     * @private
+     * @param {Array} array The array to compare.
+     * @param {Array} other The other array to compare.
+     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+     * @param {Function} customizer The function to customize comparisons.
+     * @param {Function} equalFunc The function to determine equivalents of values.
+     * @param {Object} stack Tracks traversed `array` and `other` objects.
+     * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
+     */
+    function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
+      var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
+          arrLength = array.length,
+          othLength = other.length;
+
+      if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
+        return false;
+      }
+      // Assume cyclic values are equal.
+      var stacked = stack.get(array);
+      if (stacked && stack.get(other)) {
+        return stacked == other;
+      }
+      var index = -1,
+          result = true,
+          seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
+
+      stack.set(array, other);
+      stack.set(other, array);
+
+      // Ignore non-index properties.
+      while (++index < arrLength) {
+        var arrValue = array[index],
+            othValue = other[index];
+
+        if (customizer) {
+          var compared = isPartial
+            ? customizer(othValue, arrValue, index, other, array, stack)
+            : customizer(arrValue, othValue, index, array, other, stack);
+        }
+        if (compared !== undefined) {
+          if (compared) {
+            continue;
+          }
+          result = false;
+          break;
+        }
+        // Recursively compare arrays (susceptible to call stack limits).
+        if (seen) {
+          if (!arraySome(other, function(othValue, othIndex) {
+                if (!cacheHas(seen, othIndex) &&
+                    (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
+                  return seen.push(othIndex);
+                }
+              })) {
+            result = false;
+            break;
+          }
+        } else if (!(
+              arrValue === othValue ||
+                equalFunc(arrValue, othValue, bitmask, customizer, stack)
+            )) {
+          result = false;
+          break;
+        }
+      }
+      stack['delete'](array);
+      stack['delete'](other);
+      return result;
+    }
+
+    /**
+     * A specialized version of `baseIsEqualDeep` for comparing objects of
+     * the same `toStringTag`.
+     *
+     * **Note:** This function only supports comparing values with tags of
+     * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
+     *
+     * @private
+     * @param {Object} object The object to compare.
+     * @param {Object} other The other object to compare.
+     * @param {string} tag The `toStringTag` of the objects to compare.
+     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+     * @param {Function} customizer The function to customize comparisons.
+     * @param {Function} equalFunc The function to determine equivalents of values.
+     * @param {Object} stack Tracks traversed `object` and `other` objects.
+     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+     */
+    function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
+      switch (tag) {
+        case dataViewTag:
+          if ((object.byteLength != other.byteLength) ||
+              (object.byteOffset != other.byteOffset)) {
+            return false;
+          }
+          object = object.buffer;
+          other = other.buffer;
+
+        case arrayBufferTag:
+          if ((object.byteLength != other.byteLength) ||
+              !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
+            return false;
+          }
+          return true;
+
+        case boolTag:
+        case dateTag:
+        case numberTag:
+          // Coerce booleans to `1` or `0` and dates to milliseconds.
+          // Invalid dates are coerced to `NaN`.
+          return eq(+object, +other);
+
+        case errorTag:
+          return object.name == other.name && object.message == other.message;
+
+        case regexpTag:
+        case stringTag:
+          // Coerce regexes to strings and treat strings, primitives and objects,
+          // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
+          // for more details.
+          return object == (other + '');
+
+        case mapTag:
+          var convert = mapToArray;
+
+        case setTag:
+          var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
+          convert || (convert = setToArray);
+
+          if (object.size != other.size && !isPartial) {
+            return false;
+          }
+          // Assume cyclic values are equal.
+          var stacked = stack.get(object);
+          if (stacked) {
+            return stacked == other;
+          }
+          bitmask |= COMPARE_UNORDERED_FLAG;
+
+          // Recursively compare objects (susceptible to call stack limits).
+          stack.set(object, other);
+          var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
+          stack['delete'](object);
+          return result;
+
+        case symbolTag:
+          if (symbolValueOf) {
+            return symbolValueOf.call(object) == symbolValueOf.call(other);
+          }
+      }
+      return false;
+    }
+
+    /**
+     * A specialized version of `baseIsEqualDeep` for objects with support for
+     * partial deep comparisons.
+     *
+     * @private
+     * @param {Object} object The object to compare.
+     * @param {Object} other The other object to compare.
+     * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+     * @param {Function} customizer The function to customize comparisons.
+     * @param {Function} equalFunc The function to determine equivalents of values.
+     * @param {Object} stack Tracks traversed `object` and `other` objects.
+     * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+     */
+    function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
+      var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
+          objProps = getAllKeys(object),
+          objLength = objProps.length,
+          othProps = getAllKeys(other),
+          othLength = othProps.length;
+
+      if (objLength != othLength && !isPartial) {
+        return false;
+      }
+      var index = objLength;
+      while (index--) {
+        var key = objProps[index];
+        if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
+          return false;
+        }
+      }
+      // Assume cyclic values are equal.
+      var stacked = stack.get(object);
+      if (stacked && stack.get(other)) {
+        return stacked == other;
+      }
+      var result = true;
+      stack.set(object, other);
+      stack.set(other, object);
+
+      var skipCtor = isPartial;
+      while (++index < objLength) {
+        key = objProps[index];
+        var objValue = object[key],
+            othValue = other[key];
+
+        if (customizer) {
+          var compared = isPartial
+            ? customizer(othValue, objValue, key, other, object, stack)
+            : customizer(objValue, othValue, key, object, other, stack);
+        }
+        // Recursively compare objects (susceptible to call stack limits).
+        if (!(compared === undefined
+              ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
+              : compared
+            )) {
+          result = false;
+          break;
+        }
+        skipCtor || (skipCtor = key == 'constructor');
+      }
+      if (result && !skipCtor) {
+        var objCtor = object.constructor,
+            othCtor = other.constructor;
+
+        // Non `Object` object instances with different constructors are not equal.
+        if (objCtor != othCtor &&
+            ('constructor' in object && 'constructor' in other) &&
+            !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
+              typeof othCtor == 'function' && othCtor instanceof othCtor)) {
+          result = false;
+        }
+      }
+      stack['delete'](object);
+      stack['delete'](other);
+      return result;
+    }
+
+    /**
+     * A specialized version of `baseRest` which flattens the rest array.
+     *
+     * @private
+     * @param {Function} func The function to apply a rest parameter to.
+     * @returns {Function} Returns the new function.
+     */
+    function flatRest(func) {
+      return setToString(overRest(func, undefined, flatten), func + '');
+    }
+
+    /**
+     * Creates an array of own enumerable property names and symbols of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names and symbols.
+     */
+    function getAllKeys(object) {
+      return baseGetAllKeys(object, keys, getSymbols);
+    }
+
+    /**
+     * Creates an array of own and inherited enumerable property names and
+     * symbols of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names and symbols.
+     */
+    function getAllKeysIn(object) {
+      return baseGetAllKeys(object, keysIn, getSymbolsIn);
+    }
+
+    /**
+     * Gets metadata for `func`.
+     *
+     * @private
+     * @param {Function} func The function to query.
+     * @returns {*} Returns the metadata for `func`.
+     */
+    var getData = !metaMap ? noop : function(func) {
+      return metaMap.get(func);
+    };
+
+    /**
+     * Gets the name of `func`.
+     *
+     * @private
+     * @param {Function} func The function to query.
+     * @returns {string} Returns the function name.
+     */
+    function getFuncName(func) {
+      var result = (func.name + ''),
+          array = realNames[result],
+          length = hasOwnProperty.call(realNames, result) ? array.length : 0;
+
+      while (length--) {
+        var data = array[length],
+            otherFunc = data.func;
+        if (otherFunc == null || otherFunc == func) {
+          return data.name;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Gets the argument placeholder value for `func`.
+     *
+     * @private
+     * @param {Function} func The function to inspect.
+     * @returns {*} Returns the placeholder value.
+     */
+    function getHolder(func) {
+      var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
+      return object.placeholder;
+    }
+
+    /**
+     * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
+     * this function returns the custom method, otherwise it returns `baseIteratee`.
+     * If arguments are provided, the chosen function is invoked with them and
+     * its result is returned.
+     *
+     * @private
+     * @param {*} [value] The value to convert to an iteratee.
+     * @param {number} [arity] The arity of the created iteratee.
+     * @returns {Function} Returns the chosen function or its result.
+     */
+    function getIteratee() {
+      var result = lodash.iteratee || iteratee;
+      result = result === iteratee ? baseIteratee : result;
+      return arguments.length ? result(arguments[0], arguments[1]) : result;
+    }
+
+    /**
+     * Gets the data for `map`.
+     *
+     * @private
+     * @param {Object} map The map to query.
+     * @param {string} key The reference key.
+     * @returns {*} Returns the map data.
+     */
+    function getMapData(map, key) {
+      var data = map.__data__;
+      return isKeyable(key)
+        ? data[typeof key == 'string' ? 'string' : 'hash']
+        : data.map;
+    }
+
+    /**
+     * Gets the property names, values, and compare flags of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the match data of `object`.
+     */
+    function getMatchData(object) {
+      var result = keys(object),
+          length = result.length;
+
+      while (length--) {
+        var key = result[length],
+            value = object[key];
+
+        result[length] = [key, value, isStrictComparable(value)];
+      }
+      return result;
+    }
+
+    /**
+     * Gets the native function at `key` of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {string} key The key of the method to get.
+     * @returns {*} Returns the function if it's native, else `undefined`.
+     */
+    function getNative(object, key) {
+      var value = getValue(object, key);
+      return baseIsNative(value) ? value : undefined;
+    }
+
+    /**
+     * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
+     *
+     * @private
+     * @param {*} value The value to query.
+     * @returns {string} Returns the raw `toStringTag`.
+     */
+    function getRawTag(value) {
+      var isOwn = hasOwnProperty.call(value, symToStringTag),
+          tag = value[symToStringTag];
+
+      try {
+        value[symToStringTag] = undefined;
+        var unmasked = true;
+      } catch (e) {}
+
+      var result = nativeObjectToString.call(value);
+      if (unmasked) {
+        if (isOwn) {
+          value[symToStringTag] = tag;
+        } else {
+          delete value[symToStringTag];
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Creates an array of the own enumerable symbols of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of symbols.
+     */
+    var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
+      if (object == null) {
+        return [];
+      }
+      object = Object(object);
+      return arrayFilter(nativeGetSymbols(object), function(symbol) {
+        return propertyIsEnumerable.call(object, symbol);
+      });
+    };
+
+    /**
+     * Creates an array of the own and inherited enumerable symbols of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of symbols.
+     */
+    var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
+      var result = [];
+      while (object) {
+        arrayPush(result, getSymbols(object));
+        object = getPrototype(object);
+      }
+      return result;
+    };
+
+    /**
+     * Gets the `toStringTag` of `value`.
+     *
+     * @private
+     * @param {*} value The value to query.
+     * @returns {string} Returns the `toStringTag`.
+     */
+    var getTag = baseGetTag;
+
+    // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
+    if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
+        (Map && getTag(new Map) != mapTag) ||
+        (Promise && getTag(Promise.resolve()) != promiseTag) ||
+        (Set && getTag(new Set) != setTag) ||
+        (WeakMap && getTag(new WeakMap) != weakMapTag)) {
+      getTag = function(value) {
+        var result = baseGetTag(value),
+            Ctor = result == objectTag ? value.constructor : undefined,
+            ctorString = Ctor ? toSource(Ctor) : '';
+
+        if (ctorString) {
+          switch (ctorString) {
+            case dataViewCtorString: return dataViewTag;
+            case mapCtorString: return mapTag;
+            case promiseCtorString: return promiseTag;
+            case setCtorString: return setTag;
+            case weakMapCtorString: return weakMapTag;
+          }
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Gets the view, applying any `transforms` to the `start` and `end` positions.
+     *
+     * @private
+     * @param {number} start The start of the view.
+     * @param {number} end The end of the view.
+     * @param {Array} transforms The transformations to apply to the view.
+     * @returns {Object} Returns an object containing the `start` and `end`
+     *  positions of the view.
+     */
+    function getView(start, end, transforms) {
+      var index = -1,
+          length = transforms.length;
+
+      while (++index < length) {
+        var data = transforms[index],
+            size = data.size;
+
+        switch (data.type) {
+          case 'drop':      start += size; break;
+          case 'dropRight': end -= size; break;
+          case 'take':      end = nativeMin(end, start + size); break;
+          case 'takeRight': start = nativeMax(start, end - size); break;
+        }
+      }
+      return { 'start': start, 'end': end };
+    }
+
+    /**
+     * Extracts wrapper details from the `source` body comment.
+     *
+     * @private
+     * @param {string} source The source to inspect.
+     * @returns {Array} Returns the wrapper details.
+     */
+    function getWrapDetails(source) {
+      var match = source.match(reWrapDetails);
+      return match ? match[1].split(reSplitDetails) : [];
+    }
+
+    /**
+     * Checks if `path` exists on `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path to check.
+     * @param {Function} hasFunc The function to check properties.
+     * @returns {boolean} Returns `true` if `path` exists, else `false`.
+     */
+    function hasPath(object, path, hasFunc) {
+      path = castPath(path, object);
+
+      var index = -1,
+          length = path.length,
+          result = false;
+
+      while (++index < length) {
+        var key = toKey(path[index]);
+        if (!(result = object != null && hasFunc(object, key))) {
+          break;
+        }
+        object = object[key];
+      }
+      if (result || ++index != length) {
+        return result;
+      }
+      length = object == null ? 0 : object.length;
+      return !!length && isLength(length) && isIndex(key, length) &&
+        (isArray(object) || isArguments(object));
+    }
+
+    /**
+     * Initializes an array clone.
+     *
+     * @private
+     * @param {Array} array The array to clone.
+     * @returns {Array} Returns the initialized clone.
+     */
+    function initCloneArray(array) {
+      var length = array.length,
+          result = new array.constructor(length);
+
+      // Add properties assigned by `RegExp#exec`.
+      if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
+        result.index = array.index;
+        result.input = array.input;
+      }
+      return result;
+    }
+
+    /**
+     * Initializes an object clone.
+     *
+     * @private
+     * @param {Object} object The object to clone.
+     * @returns {Object} Returns the initialized clone.
+     */
+    function initCloneObject(object) {
+      return (typeof object.constructor == 'function' && !isPrototype(object))
+        ? baseCreate(getPrototype(object))
+        : {};
+    }
+
+    /**
+     * Initializes an object clone based on its `toStringTag`.
+     *
+     * **Note:** This function only supports cloning values with tags of
+     * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
+     *
+     * @private
+     * @param {Object} object The object to clone.
+     * @param {string} tag The `toStringTag` of the object to clone.
+     * @param {boolean} [isDeep] Specify a deep clone.
+     * @returns {Object} Returns the initialized clone.
+     */
+    function initCloneByTag(object, tag, isDeep) {
+      var Ctor = object.constructor;
+      switch (tag) {
+        case arrayBufferTag:
+          return cloneArrayBuffer(object);
+
+        case boolTag:
+        case dateTag:
+          return new Ctor(+object);
+
+        case dataViewTag:
+          return cloneDataView(object, isDeep);
+
+        case float32Tag: case float64Tag:
+        case int8Tag: case int16Tag: case int32Tag:
+        case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
+          return cloneTypedArray(object, isDeep);
+
+        case mapTag:
+          return new Ctor;
+
+        case numberTag:
+        case stringTag:
+          return new Ctor(object);
+
+        case regexpTag:
+          return cloneRegExp(object);
+
+        case setTag:
+          return new Ctor;
+
+        case symbolTag:
+          return cloneSymbol(object);
+      }
+    }
+
+    /**
+     * Inserts wrapper `details` in a comment at the top of the `source` body.
+     *
+     * @private
+     * @param {string} source The source to modify.
+     * @returns {Array} details The details to insert.
+     * @returns {string} Returns the modified source.
+     */
+    function insertWrapDetails(source, details) {
+      var length = details.length;
+      if (!length) {
+        return source;
+      }
+      var lastIndex = length - 1;
+      details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
+      details = details.join(length > 2 ? ', ' : ' ');
+      return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
+    }
+
+    /**
+     * Checks if `value` is a flattenable `arguments` object or array.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
+     */
+    function isFlattenable(value) {
+      return isArray(value) || isArguments(value) ||
+        !!(spreadableSymbol && value && value[spreadableSymbol]);
+    }
+
+    /**
+     * Checks if `value` is a valid array-like index.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+     * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+     */
+    function isIndex(value, length) {
+      var type = typeof value;
+      length = length == null ? MAX_SAFE_INTEGER : length;
+
+      return !!length &&
+        (type == 'number' ||
+          (type != 'symbol' && reIsUint.test(value))) &&
+            (value > -1 && value % 1 == 0 && value < length);
+    }
+
+    /**
+     * Checks if the given arguments are from an iteratee call.
+     *
+     * @private
+     * @param {*} value The potential iteratee value argument.
+     * @param {*} index The potential iteratee index or key argument.
+     * @param {*} object The potential iteratee object argument.
+     * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
+     *  else `false`.
+     */
+    function isIterateeCall(value, index, object) {
+      if (!isObject(object)) {
+        return false;
+      }
+      var type = typeof index;
+      if (type == 'number'
+            ? (isArrayLike(object) && isIndex(index, object.length))
+            : (type == 'string' && index in object)
+          ) {
+        return eq(object[index], value);
+      }
+      return false;
+    }
+
+    /**
+     * Checks if `value` is a property name and not a property path.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @param {Object} [object] The object to query keys on.
+     * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
+     */
+    function isKey(value, object) {
+      if (isArray(value)) {
+        return false;
+      }
+      var type = typeof value;
+      if (type == 'number' || type == 'symbol' || type == 'boolean' ||
+          value == null || isSymbol(value)) {
+        return true;
+      }
+      return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
+        (object != null && value in Object(object));
+    }
+
+    /**
+     * Checks if `value` is suitable for use as unique object key.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
+     */
+    function isKeyable(value) {
+      var type = typeof value;
+      return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
+        ? (value !== '__proto__')
+        : (value === null);
+    }
+
+    /**
+     * Checks if `func` has a lazy counterpart.
+     *
+     * @private
+     * @param {Function} func The function to check.
+     * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
+     *  else `false`.
+     */
+    function isLaziable(func) {
+      var funcName = getFuncName(func),
+          other = lodash[funcName];
+
+      if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
+        return false;
+      }
+      if (func === other) {
+        return true;
+      }
+      var data = getData(other);
+      return !!data && func === data[0];
+    }
+
+    /**
+     * Checks if `func` has its source masked.
+     *
+     * @private
+     * @param {Function} func The function to check.
+     * @returns {boolean} Returns `true` if `func` is masked, else `false`.
+     */
+    function isMasked(func) {
+      return !!maskSrcKey && (maskSrcKey in func);
+    }
+
+    /**
+     * Checks if `func` is capable of being masked.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
+     */
+    var isMaskable = coreJsData ? isFunction : stubFalse;
+
+    /**
+     * Checks if `value` is likely a prototype object.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
+     */
+    function isPrototype(value) {
+      var Ctor = value && value.constructor,
+          proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
+
+      return value === proto;
+    }
+
+    /**
+     * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` if suitable for strict
+     *  equality comparisons, else `false`.
+     */
+    function isStrictComparable(value) {
+      return value === value && !isObject(value);
+    }
+
+    /**
+     * A specialized version of `matchesProperty` for source values suitable
+     * for strict equality comparisons, i.e. `===`.
+     *
+     * @private
+     * @param {string} key The key of the property to get.
+     * @param {*} srcValue The value to match.
+     * @returns {Function} Returns the new spec function.
+     */
+    function matchesStrictComparable(key, srcValue) {
+      return function(object) {
+        if (object == null) {
+          return false;
+        }
+        return object[key] === srcValue &&
+          (srcValue !== undefined || (key in Object(object)));
+      };
+    }
+
+    /**
+     * A specialized version of `_.memoize` which clears the memoized function's
+     * cache when it exceeds `MAX_MEMOIZE_SIZE`.
+     *
+     * @private
+     * @param {Function} func The function to have its output memoized.
+     * @returns {Function} Returns the new memoized function.
+     */
+    function memoizeCapped(func) {
+      var result = memoize(func, function(key) {
+        if (cache.size === MAX_MEMOIZE_SIZE) {
+          cache.clear();
+        }
+        return key;
+      });
+
+      var cache = result.cache;
+      return result;
+    }
+
+    /**
+     * Merges the function metadata of `source` into `data`.
+     *
+     * Merging metadata reduces the number of wrappers used to invoke a function.
+     * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
+     * may be applied regardless of execution order. Methods like `_.ary` and
+     * `_.rearg` modify function arguments, making the order in which they are
+     * executed important, preventing the merging of metadata. However, we make
+     * an exception for a safe combined case where curried functions have `_.ary`
+     * and or `_.rearg` applied.
+     *
+     * @private
+     * @param {Array} data The destination metadata.
+     * @param {Array} source The source metadata.
+     * @returns {Array} Returns `data`.
+     */
+    function mergeData(data, source) {
+      var bitmask = data[1],
+          srcBitmask = source[1],
+          newBitmask = bitmask | srcBitmask,
+          isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
+
+      var isCombo =
+        ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
+        ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
+        ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
+
+      // Exit early if metadata can't be merged.
+      if (!(isCommon || isCombo)) {
+        return data;
+      }
+      // Use source `thisArg` if available.
+      if (srcBitmask & WRAP_BIND_FLAG) {
+        data[2] = source[2];
+        // Set when currying a bound function.
+        newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
+      }
+      // Compose partial arguments.
+      var value = source[3];
+      if (value) {
+        var partials = data[3];
+        data[3] = partials ? composeArgs(partials, value, source[4]) : value;
+        data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
+      }
+      // Compose partial right arguments.
+      value = source[5];
+      if (value) {
+        partials = data[5];
+        data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
+        data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
+      }
+      // Use source `argPos` if available.
+      value = source[7];
+      if (value) {
+        data[7] = value;
+      }
+      // Use source `ary` if it's smaller.
+      if (srcBitmask & WRAP_ARY_FLAG) {
+        data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
+      }
+      // Use source `arity` if one is not provided.
+      if (data[9] == null) {
+        data[9] = source[9];
+      }
+      // Use source `func` and merge bitmasks.
+      data[0] = source[0];
+      data[1] = newBitmask;
+
+      return data;
+    }
+
+    /**
+     * This function is like
+     * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
+     * except that it includes inherited enumerable properties.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names.
+     */
+    function nativeKeysIn(object) {
+      var result = [];
+      if (object != null) {
+        for (var key in Object(object)) {
+          result.push(key);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Converts `value` to a string using `Object.prototype.toString`.
+     *
+     * @private
+     * @param {*} value The value to convert.
+     * @returns {string} Returns the converted string.
+     */
+    function objectToString(value) {
+      return nativeObjectToString.call(value);
+    }
+
+    /**
+     * A specialized version of `baseRest` which transforms the rest array.
+     *
+     * @private
+     * @param {Function} func The function to apply a rest parameter to.
+     * @param {number} [start=func.length-1] The start position of the rest parameter.
+     * @param {Function} transform The rest array transform.
+     * @returns {Function} Returns the new function.
+     */
+    function overRest(func, start, transform) {
+      start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
+      return function() {
+        var args = arguments,
+            index = -1,
+            length = nativeMax(args.length - start, 0),
+            array = Array(length);
+
+        while (++index < length) {
+          array[index] = args[start + index];
+        }
+        index = -1;
+        var otherArgs = Array(start + 1);
+        while (++index < start) {
+          otherArgs[index] = args[index];
+        }
+        otherArgs[start] = transform(array);
+        return apply(func, this, otherArgs);
+      };
+    }
+
+    /**
+     * Gets the parent value at `path` of `object`.
+     *
+     * @private
+     * @param {Object} object The object to query.
+     * @param {Array} path The path to get the parent value of.
+     * @returns {*} Returns the parent value.
+     */
+    function parent(object, path) {
+      return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
+    }
+
+    /**
+     * Reorder `array` according to the specified indexes where the element at
+     * the first index is assigned as the first element, the element at
+     * the second index is assigned as the second element, and so on.
+     *
+     * @private
+     * @param {Array} array The array to reorder.
+     * @param {Array} indexes The arranged array indexes.
+     * @returns {Array} Returns `array`.
+     */
+    function reorder(array, indexes) {
+      var arrLength = array.length,
+          length = nativeMin(indexes.length, arrLength),
+          oldArray = copyArray(array);
+
+      while (length--) {
+        var index = indexes[length];
+        array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
+      }
+      return array;
+    }
+
+    /**
+     * Sets metadata for `func`.
+     *
+     * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
+     * period of time, it will trip its breaker and transition to an identity
+     * function to avoid garbage collection pauses in V8. See
+     * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
+     * for more details.
+     *
+     * @private
+     * @param {Function} func The function to associate metadata with.
+     * @param {*} data The metadata.
+     * @returns {Function} Returns `func`.
+     */
+    var setData = shortOut(baseSetData);
+
+    /**
+     * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
+     *
+     * @private
+     * @param {Function} func The function to delay.
+     * @param {number} wait The number of milliseconds to delay invocation.
+     * @returns {number|Object} Returns the timer id or timeout object.
+     */
+    var setTimeout = ctxSetTimeout || function(func, wait) {
+      return root.setTimeout(func, wait);
+    };
+
+    /**
+     * Sets the `toString` method of `func` to return `string`.
+     *
+     * @private
+     * @param {Function} func The function to modify.
+     * @param {Function} string The `toString` result.
+     * @returns {Function} Returns `func`.
+     */
+    var setToString = shortOut(baseSetToString);
+
+    /**
+     * Sets the `toString` method of `wrapper` to mimic the source of `reference`
+     * with wrapper details in a comment at the top of the source body.
+     *
+     * @private
+     * @param {Function} wrapper The function to modify.
+     * @param {Function} reference The reference function.
+     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+     * @returns {Function} Returns `wrapper`.
+     */
+    function setWrapToString(wrapper, reference, bitmask) {
+      var source = (reference + '');
+      return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
+    }
+
+    /**
+     * Creates a function that'll short out and invoke `identity` instead
+     * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
+     * milliseconds.
+     *
+     * @private
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new shortable function.
+     */
+    function shortOut(func) {
+      var count = 0,
+          lastCalled = 0;
+
+      return function() {
+        var stamp = nativeNow(),
+            remaining = HOT_SPAN - (stamp - lastCalled);
+
+        lastCalled = stamp;
+        if (remaining > 0) {
+          if (++count >= HOT_COUNT) {
+            return arguments[0];
+          }
+        } else {
+          count = 0;
+        }
+        return func.apply(undefined, arguments);
+      };
+    }
+
+    /**
+     * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
+     *
+     * @private
+     * @param {Array} array The array to shuffle.
+     * @param {number} [size=array.length] The size of `array`.
+     * @returns {Array} Returns `array`.
+     */
+    function shuffleSelf(array, size) {
+      var index = -1,
+          length = array.length,
+          lastIndex = length - 1;
+
+      size = size === undefined ? length : size;
+      while (++index < size) {
+        var rand = baseRandom(index, lastIndex),
+            value = array[rand];
+
+        array[rand] = array[index];
+        array[index] = value;
+      }
+      array.length = size;
+      return array;
+    }
+
+    /**
+     * Converts `string` to a property path array.
+     *
+     * @private
+     * @param {string} string The string to convert.
+     * @returns {Array} Returns the property path array.
+     */
+    var stringToPath = memoizeCapped(function(string) {
+      var result = [];
+      if (string.charCodeAt(0) === 46 /* . */) {
+        result.push('');
+      }
+      string.replace(rePropName, function(match, number, quote, subString) {
+        result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
+      });
+      return result;
+    });
+
+    /**
+     * Converts `value` to a string key if it's not a string or symbol.
+     *
+     * @private
+     * @param {*} value The value to inspect.
+     * @returns {string|symbol} Returns the key.
+     */
+    function toKey(value) {
+      if (typeof value == 'string' || isSymbol(value)) {
+        return value;
+      }
+      var result = (value + '');
+      return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+    }
+
+    /**
+     * Converts `func` to its source code.
+     *
+     * @private
+     * @param {Function} func The function to convert.
+     * @returns {string} Returns the source code.
+     */
+    function toSource(func) {
+      if (func != null) {
+        try {
+          return funcToString.call(func);
+        } catch (e) {}
+        try {
+          return (func + '');
+        } catch (e) {}
+      }
+      return '';
+    }
+
+    /**
+     * Updates wrapper `details` based on `bitmask` flags.
+     *
+     * @private
+     * @returns {Array} details The details to modify.
+     * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+     * @returns {Array} Returns `details`.
+     */
+    function updateWrapDetails(details, bitmask) {
+      arrayEach(wrapFlags, function(pair) {
+        var value = '_.' + pair[0];
+        if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
+          details.push(value);
+        }
+      });
+      return details.sort();
+    }
+
+    /**
+     * Creates a clone of `wrapper`.
+     *
+     * @private
+     * @param {Object} wrapper The wrapper to clone.
+     * @returns {Object} Returns the cloned wrapper.
+     */
+    function wrapperClone(wrapper) {
+      if (wrapper instanceof LazyWrapper) {
+        return wrapper.clone();
+      }
+      var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
+      result.__actions__ = copyArray(wrapper.__actions__);
+      result.__index__  = wrapper.__index__;
+      result.__values__ = wrapper.__values__;
+      return result;
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array of elements split into groups the length of `size`.
+     * If `array` can't be split evenly, the final chunk will be the remaining
+     * elements.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to process.
+     * @param {number} [size=1] The length of each chunk
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Array} Returns the new array of chunks.
+     * @example
+     *
+     * _.chunk(['a', 'b', 'c', 'd'], 2);
+     * // => [['a', 'b'], ['c', 'd']]
+     *
+     * _.chunk(['a', 'b', 'c', 'd'], 3);
+     * // => [['a', 'b', 'c'], ['d']]
+     */
+    function chunk(array, size, guard) {
+      if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
+        size = 1;
+      } else {
+        size = nativeMax(toInteger(size), 0);
+      }
+      var length = array == null ? 0 : array.length;
+      if (!length || size < 1) {
+        return [];
+      }
+      var index = 0,
+          resIndex = 0,
+          result = Array(nativeCeil(length / size));
+
+      while (index < length) {
+        result[resIndex++] = baseSlice(array, index, (index += size));
+      }
+      return result;
+    }
+
+    /**
+     * Creates an array with all falsey values removed. The values `false`, `null`,
+     * `0`, `""`, `undefined`, and `NaN` are falsey.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to compact.
+     * @returns {Array} Returns the new array of filtered values.
+     * @example
+     *
+     * _.compact([0, 1, false, 2, '', 3]);
+     * // => [1, 2, 3]
+     */
+    function compact(array) {
+      var index = -1,
+          length = array == null ? 0 : array.length,
+          resIndex = 0,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index];
+        if (value) {
+          result[resIndex++] = value;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Creates a new array concatenating `array` with any additional arrays
+     * and/or values.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to concatenate.
+     * @param {...*} [values] The values to concatenate.
+     * @returns {Array} Returns the new concatenated array.
+     * @example
+     *
+     * var array = [1];
+     * var other = _.concat(array, 2, [3], [[4]]);
+     *
+     * console.log(other);
+     * // => [1, 2, 3, [4]]
+     *
+     * console.log(array);
+     * // => [1]
+     */
+    function concat() {
+      var length = arguments.length;
+      if (!length) {
+        return [];
+      }
+      var args = Array(length - 1),
+          array = arguments[0],
+          index = length;
+
+      while (index--) {
+        args[index - 1] = arguments[index];
+      }
+      return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
+    }
+
+    /**
+     * Creates an array of `array` values not included in the other given arrays
+     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * for equality comparisons. The order and references of result values are
+     * determined by the first array.
+     *
+     * **Note:** Unlike `_.pullAll`, this method returns a new array.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {...Array} [values] The values to exclude.
+     * @returns {Array} Returns the new array of filtered values.
+     * @see _.without, _.xor
+     * @example
+     *
+     * _.difference([2, 1], [2, 3]);
+     * // => [1]
+     */
+    var difference = baseRest(function(array, values) {
+      return isArrayLikeObject(array)
+        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
+        : [];
+    });
+
+    /**
+     * This method is like `_.difference` except that it accepts `iteratee` which
+     * is invoked for each element of `array` and `values` to generate the criterion
+     * by which they're compared. The order and references of result values are
+     * determined by the first array. The iteratee is invoked with one argument:
+     * (value).
+     *
+     * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {...Array} [values] The values to exclude.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {Array} Returns the new array of filtered values.
+     * @example
+     *
+     * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
+     * // => [1.2]
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
+     * // => [{ 'x': 2 }]
+     */
+    var differenceBy = baseRest(function(array, values) {
+      var iteratee = last(values);
+      if (isArrayLikeObject(iteratee)) {
+        iteratee = undefined;
+      }
+      return isArrayLikeObject(array)
+        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
+        : [];
+    });
+
+    /**
+     * This method is like `_.difference` except that it accepts `comparator`
+     * which is invoked to compare elements of `array` to `values`. The order and
+     * references of result values are determined by the first array. The comparator
+     * is invoked with two arguments: (arrVal, othVal).
+     *
+     * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {...Array} [values] The values to exclude.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns the new array of filtered values.
+     * @example
+     *
+     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+     *
+     * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
+     * // => [{ 'x': 2, 'y': 1 }]
+     */
+    var differenceWith = baseRest(function(array, values) {
+      var comparator = last(values);
+      if (isArrayLikeObject(comparator)) {
+        comparator = undefined;
+      }
+      return isArrayLikeObject(array)
+        ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
+        : [];
+    });
+
+    /**
+     * Creates a slice of `array` with `n` elements dropped from the beginning.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.5.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {number} [n=1] The number of elements to drop.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.drop([1, 2, 3]);
+     * // => [2, 3]
+     *
+     * _.drop([1, 2, 3], 2);
+     * // => [3]
+     *
+     * _.drop([1, 2, 3], 5);
+     * // => []
+     *
+     * _.drop([1, 2, 3], 0);
+     * // => [1, 2, 3]
+     */
+    function drop(array, n, guard) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return [];
+      }
+      n = (guard || n === undefined) ? 1 : toInteger(n);
+      return baseSlice(array, n < 0 ? 0 : n, length);
+    }
+
+    /**
+     * Creates a slice of `array` with `n` elements dropped from the end.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {number} [n=1] The number of elements to drop.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.dropRight([1, 2, 3]);
+     * // => [1, 2]
+     *
+     * _.dropRight([1, 2, 3], 2);
+     * // => [1]
+     *
+     * _.dropRight([1, 2, 3], 5);
+     * // => []
+     *
+     * _.dropRight([1, 2, 3], 0);
+     * // => [1, 2, 3]
+     */
+    function dropRight(array, n, guard) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return [];
+      }
+      n = (guard || n === undefined) ? 1 : toInteger(n);
+      n = length - n;
+      return baseSlice(array, 0, n < 0 ? 0 : n);
+    }
+
+    /**
+     * Creates a slice of `array` excluding elements dropped from the end.
+     * Elements are dropped until `predicate` returns falsey. The predicate is
+     * invoked with three arguments: (value, index, array).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': true },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': false }
+     * ];
+     *
+     * _.dropRightWhile(users, function(o) { return !o.active; });
+     * // => objects for ['barney']
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
+     * // => objects for ['barney', 'fred']
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.dropRightWhile(users, ['active', false]);
+     * // => objects for ['barney']
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.dropRightWhile(users, 'active');
+     * // => objects for ['barney', 'fred', 'pebbles']
+     */
+    function dropRightWhile(array, predicate) {
+      return (array && array.length)
+        ? baseWhile(array, getIteratee(predicate, 3), true, true)
+        : [];
+    }
+
+    /**
+     * Creates a slice of `array` excluding elements dropped from the beginning.
+     * Elements are dropped until `predicate` returns falsey. The predicate is
+     * invoked with three arguments: (value, index, array).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': false },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': true }
+     * ];
+     *
+     * _.dropWhile(users, function(o) { return !o.active; });
+     * // => objects for ['pebbles']
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.dropWhile(users, { 'user': 'barney', 'active': false });
+     * // => objects for ['fred', 'pebbles']
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.dropWhile(users, ['active', false]);
+     * // => objects for ['pebbles']
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.dropWhile(users, 'active');
+     * // => objects for ['barney', 'fred', 'pebbles']
+     */
+    function dropWhile(array, predicate) {
+      return (array && array.length)
+        ? baseWhile(array, getIteratee(predicate, 3), true)
+        : [];
+    }
+
+    /**
+     * Fills elements of `array` with `value` from `start` up to, but not
+     * including, `end`.
+     *
+     * **Note:** This method mutates `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.2.0
+     * @category Array
+     * @param {Array} array The array to fill.
+     * @param {*} value The value to fill `array` with.
+     * @param {number} [start=0] The start position.
+     * @param {number} [end=array.length] The end position.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = [1, 2, 3];
+     *
+     * _.fill(array, 'a');
+     * console.log(array);
+     * // => ['a', 'a', 'a']
+     *
+     * _.fill(Array(3), 2);
+     * // => [2, 2, 2]
+     *
+     * _.fill([4, 6, 8, 10], '*', 1, 3);
+     * // => [4, '*', '*', 10]
+     */
+    function fill(array, value, start, end) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return [];
+      }
+      if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
+        start = 0;
+        end = length;
+      }
+      return baseFill(array, value, start, end);
+    }
+
+    /**
+     * This method is like `_.find` except that it returns the index of the first
+     * element `predicate` returns truthy for instead of the element itself.
+     *
+     * @static
+     * @memberOf _
+     * @since 1.1.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @param {number} [fromIndex=0] The index to search from.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': false },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': true }
+     * ];
+     *
+     * _.findIndex(users, function(o) { return o.user == 'barney'; });
+     * // => 0
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.findIndex(users, { 'user': 'fred', 'active': false });
+     * // => 1
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.findIndex(users, ['active', false]);
+     * // => 0
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.findIndex(users, 'active');
+     * // => 2
+     */
+    function findIndex(array, predicate, fromIndex) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return -1;
+      }
+      var index = fromIndex == null ? 0 : toInteger(fromIndex);
+      if (index < 0) {
+        index = nativeMax(length + index, 0);
+      }
+      return baseFindIndex(array, getIteratee(predicate, 3), index);
+    }
+
+    /**
+     * This method is like `_.findIndex` except that it iterates over elements
+     * of `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @param {number} [fromIndex=array.length-1] The index to search from.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': true },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': false }
+     * ];
+     *
+     * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
+     * // => 2
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.findLastIndex(users, { 'user': 'barney', 'active': true });
+     * // => 0
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.findLastIndex(users, ['active', false]);
+     * // => 2
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.findLastIndex(users, 'active');
+     * // => 0
+     */
+    function findLastIndex(array, predicate, fromIndex) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return -1;
+      }
+      var index = length - 1;
+      if (fromIndex !== undefined) {
+        index = toInteger(fromIndex);
+        index = fromIndex < 0
+          ? nativeMax(length + index, 0)
+          : nativeMin(index, length - 1);
+      }
+      return baseFindIndex(array, getIteratee(predicate, 3), index, true);
+    }
+
+    /**
+     * Flattens `array` a single level deep.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to flatten.
+     * @returns {Array} Returns the new flattened array.
+     * @example
+     *
+     * _.flatten([1, [2, [3, [4]], 5]]);
+     * // => [1, 2, [3, [4]], 5]
+     */
+    function flatten(array) {
+      var length = array == null ? 0 : array.length;
+      return length ? baseFlatten(array, 1) : [];
+    }
+
+    /**
+     * Recursively flattens `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to flatten.
+     * @returns {Array} Returns the new flattened array.
+     * @example
+     *
+     * _.flattenDeep([1, [2, [3, [4]], 5]]);
+     * // => [1, 2, 3, 4, 5]
+     */
+    function flattenDeep(array) {
+      var length = array == null ? 0 : array.length;
+      return length ? baseFlatten(array, INFINITY) : [];
+    }
+
+    /**
+     * Recursively flatten `array` up to `depth` times.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.4.0
+     * @category Array
+     * @param {Array} array The array to flatten.
+     * @param {number} [depth=1] The maximum recursion depth.
+     * @returns {Array} Returns the new flattened array.
+     * @example
+     *
+     * var array = [1, [2, [3, [4]], 5]];
+     *
+     * _.flattenDepth(array, 1);
+     * // => [1, 2, [3, [4]], 5]
+     *
+     * _.flattenDepth(array, 2);
+     * // => [1, 2, 3, [4], 5]
+     */
+    function flattenDepth(array, depth) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return [];
+      }
+      depth = depth === undefined ? 1 : toInteger(depth);
+      return baseFlatten(array, depth);
+    }
+
+    /**
+     * The inverse of `_.toPairs`; this method returns an object composed
+     * from key-value `pairs`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} pairs The key-value pairs.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * _.fromPairs([['a', 1], ['b', 2]]);
+     * // => { 'a': 1, 'b': 2 }
+     */
+    function fromPairs(pairs) {
+      var index = -1,
+          length = pairs == null ? 0 : pairs.length,
+          result = {};
+
+      while (++index < length) {
+        var pair = pairs[index];
+        result[pair[0]] = pair[1];
+      }
+      return result;
+    }
+
+    /**
+     * Gets the first element of `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @alias first
+     * @category Array
+     * @param {Array} array The array to query.
+     * @returns {*} Returns the first element of `array`.
+     * @example
+     *
+     * _.head([1, 2, 3]);
+     * // => 1
+     *
+     * _.head([]);
+     * // => undefined
+     */
+    function head(array) {
+      return (array && array.length) ? array[0] : undefined;
+    }
+
+    /**
+     * Gets the index at which the first occurrence of `value` is found in `array`
+     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * for equality comparisons. If `fromIndex` is negative, it's used as the
+     * offset from the end of `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {*} value The value to search for.
+     * @param {number} [fromIndex=0] The index to search from.
+     * @returns {number} Returns the index of the matched value, else `-1`.
+     * @example
+     *
+     * _.indexOf([1, 2, 1, 2], 2);
+     * // => 1
+     *
+     * // Search from the `fromIndex`.
+     * _.indexOf([1, 2, 1, 2], 2, 2);
+     * // => 3
+     */
+    function indexOf(array, value, fromIndex) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return -1;
+      }
+      var index = fromIndex == null ? 0 : toInteger(fromIndex);
+      if (index < 0) {
+        index = nativeMax(length + index, 0);
+      }
+      return baseIndexOf(array, value, index);
+    }
+
+    /**
+     * Gets all but the last element of `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.initial([1, 2, 3]);
+     * // => [1, 2]
+     */
+    function initial(array) {
+      var length = array == null ? 0 : array.length;
+      return length ? baseSlice(array, 0, -1) : [];
+    }
+
+    /**
+     * Creates an array of unique values that are included in all given arrays
+     * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * for equality comparisons. The order and references of result values are
+     * determined by the first array.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @returns {Array} Returns the new array of intersecting values.
+     * @example
+     *
+     * _.intersection([2, 1], [2, 3]);
+     * // => [2]
+     */
+    var intersection = baseRest(function(arrays) {
+      var mapped = arrayMap(arrays, castArrayLikeObject);
+      return (mapped.length && mapped[0] === arrays[0])
+        ? baseIntersection(mapped)
+        : [];
+    });
+
+    /**
+     * This method is like `_.intersection` except that it accepts `iteratee`
+     * which is invoked for each element of each `arrays` to generate the criterion
+     * by which they're compared. The order and references of result values are
+     * determined by the first array. The iteratee is invoked with one argument:
+     * (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {Array} Returns the new array of intersecting values.
+     * @example
+     *
+     * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
+     * // => [2.1]
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
+     * // => [{ 'x': 1 }]
+     */
+    var intersectionBy = baseRest(function(arrays) {
+      var iteratee = last(arrays),
+          mapped = arrayMap(arrays, castArrayLikeObject);
+
+      if (iteratee === last(mapped)) {
+        iteratee = undefined;
+      } else {
+        mapped.pop();
+      }
+      return (mapped.length && mapped[0] === arrays[0])
+        ? baseIntersection(mapped, getIteratee(iteratee, 2))
+        : [];
+    });
+
+    /**
+     * This method is like `_.intersection` except that it accepts `comparator`
+     * which is invoked to compare elements of `arrays`. The order and references
+     * of result values are determined by the first array. The comparator is
+     * invoked with two arguments: (arrVal, othVal).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns the new array of intersecting values.
+     * @example
+     *
+     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
+     *
+     * _.intersectionWith(objects, others, _.isEqual);
+     * // => [{ 'x': 1, 'y': 2 }]
+     */
+    var intersectionWith = baseRest(function(arrays) {
+      var comparator = last(arrays),
+          mapped = arrayMap(arrays, castArrayLikeObject);
+
+      comparator = typeof comparator == 'function' ? comparator : undefined;
+      if (comparator) {
+        mapped.pop();
+      }
+      return (mapped.length && mapped[0] === arrays[0])
+        ? baseIntersection(mapped, undefined, comparator)
+        : [];
+    });
+
+    /**
+     * Converts all elements in `array` into a string separated by `separator`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to convert.
+     * @param {string} [separator=','] The element separator.
+     * @returns {string} Returns the joined string.
+     * @example
+     *
+     * _.join(['a', 'b', 'c'], '~');
+     * // => 'a~b~c'
+     */
+    function join(array, separator) {
+      return array == null ? '' : nativeJoin.call(array, separator);
+    }
+
+    /**
+     * Gets the last element of `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @returns {*} Returns the last element of `array`.
+     * @example
+     *
+     * _.last([1, 2, 3]);
+     * // => 3
+     */
+    function last(array) {
+      var length = array == null ? 0 : array.length;
+      return length ? array[length - 1] : undefined;
+    }
+
+    /**
+     * This method is like `_.indexOf` except that it iterates over elements of
+     * `array` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {*} value The value to search for.
+     * @param {number} [fromIndex=array.length-1] The index to search from.
+     * @returns {number} Returns the index of the matched value, else `-1`.
+     * @example
+     *
+     * _.lastIndexOf([1, 2, 1, 2], 2);
+     * // => 3
+     *
+     * // Search from the `fromIndex`.
+     * _.lastIndexOf([1, 2, 1, 2], 2, 2);
+     * // => 1
+     */
+    function lastIndexOf(array, value, fromIndex) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return -1;
+      }
+      var index = length;
+      if (fromIndex !== undefined) {
+        index = toInteger(fromIndex);
+        index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
+      }
+      return value === value
+        ? strictLastIndexOf(array, value, index)
+        : baseFindIndex(array, baseIsNaN, index, true);
+    }
+
+    /**
+     * Gets the element at index `n` of `array`. If `n` is negative, the nth
+     * element from the end is returned.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.11.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {number} [n=0] The index of the element to return.
+     * @returns {*} Returns the nth element of `array`.
+     * @example
+     *
+     * var array = ['a', 'b', 'c', 'd'];
+     *
+     * _.nth(array, 1);
+     * // => 'b'
+     *
+     * _.nth(array, -2);
+     * // => 'c';
+     */
+    function nth(array, n) {
+      return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
+    }
+
+    /**
+     * Removes all given values from `array` using
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * for equality comparisons.
+     *
+     * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
+     * to remove elements from an array by predicate.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @param {...*} [values] The values to remove.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
+     *
+     * _.pull(array, 'a', 'c');
+     * console.log(array);
+     * // => ['b', 'b']
+     */
+    var pull = baseRest(pullAll);
+
+    /**
+     * This method is like `_.pull` except that it accepts an array of values to remove.
+     *
+     * **Note:** Unlike `_.difference`, this method mutates `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @param {Array} values The values to remove.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
+     *
+     * _.pullAll(array, ['a', 'c']);
+     * console.log(array);
+     * // => ['b', 'b']
+     */
+    function pullAll(array, values) {
+      return (array && array.length && values && values.length)
+        ? basePullAll(array, values)
+        : array;
+    }
+
+    /**
+     * This method is like `_.pullAll` except that it accepts `iteratee` which is
+     * invoked for each element of `array` and `values` to generate the criterion
+     * by which they're compared. The iteratee is invoked with one argument: (value).
+     *
+     * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @param {Array} values The values to remove.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
+     *
+     * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
+     * console.log(array);
+     * // => [{ 'x': 2 }]
+     */
+    function pullAllBy(array, values, iteratee) {
+      return (array && array.length && values && values.length)
+        ? basePullAll(array, values, getIteratee(iteratee, 2))
+        : array;
+    }
+
+    /**
+     * This method is like `_.pullAll` except that it accepts `comparator` which
+     * is invoked to compare elements of `array` to `values`. The comparator is
+     * invoked with two arguments: (arrVal, othVal).
+     *
+     * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.6.0
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @param {Array} values The values to remove.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
+     *
+     * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
+     * console.log(array);
+     * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
+     */
+    function pullAllWith(array, values, comparator) {
+      return (array && array.length && values && values.length)
+        ? basePullAll(array, values, undefined, comparator)
+        : array;
+    }
+
+    /**
+     * Removes elements from `array` corresponding to `indexes` and returns an
+     * array of removed elements.
+     *
+     * **Note:** Unlike `_.at`, this method mutates `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @param {...(number|number[])} [indexes] The indexes of elements to remove.
+     * @returns {Array} Returns the new array of removed elements.
+     * @example
+     *
+     * var array = ['a', 'b', 'c', 'd'];
+     * var pulled = _.pullAt(array, [1, 3]);
+     *
+     * console.log(array);
+     * // => ['a', 'c']
+     *
+     * console.log(pulled);
+     * // => ['b', 'd']
+     */
+    var pullAt = flatRest(function(array, indexes) {
+      var length = array == null ? 0 : array.length,
+          result = baseAt(array, indexes);
+
+      basePullAt(array, arrayMap(indexes, function(index) {
+        return isIndex(index, length) ? +index : index;
+      }).sort(compareAscending));
+
+      return result;
+    });
+
+    /**
+     * Removes all elements from `array` that `predicate` returns truthy for
+     * and returns an array of the removed elements. The predicate is invoked
+     * with three arguments: (value, index, array).
+     *
+     * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
+     * to pull elements from an array by value.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the new array of removed elements.
+     * @example
+     *
+     * var array = [1, 2, 3, 4];
+     * var evens = _.remove(array, function(n) {
+     *   return n % 2 == 0;
+     * });
+     *
+     * console.log(array);
+     * // => [1, 3]
+     *
+     * console.log(evens);
+     * // => [2, 4]
+     */
+    function remove(array, predicate) {
+      var result = [];
+      if (!(array && array.length)) {
+        return result;
+      }
+      var index = -1,
+          indexes = [],
+          length = array.length;
+
+      predicate = getIteratee(predicate, 3);
+      while (++index < length) {
+        var value = array[index];
+        if (predicate(value, index, array)) {
+          result.push(value);
+          indexes.push(index);
+        }
+      }
+      basePullAt(array, indexes);
+      return result;
+    }
+
+    /**
+     * Reverses `array` so that the first element becomes the last, the second
+     * element becomes the second to last, and so on.
+     *
+     * **Note:** This method mutates `array` and is based on
+     * [`Array#reverse`](https://mdn.io/Array/reverse).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to modify.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = [1, 2, 3];
+     *
+     * _.reverse(array);
+     * // => [3, 2, 1]
+     *
+     * console.log(array);
+     * // => [3, 2, 1]
+     */
+    function reverse(array) {
+      return array == null ? array : nativeReverse.call(array);
+    }
+
+    /**
+     * Creates a slice of `array` from `start` up to, but not including, `end`.
+     *
+     * **Note:** This method is used instead of
+     * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
+     * returned.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to slice.
+     * @param {number} [start=0] The start position.
+     * @param {number} [end=array.length] The end position.
+     * @returns {Array} Returns the slice of `array`.
+     */
+    function slice(array, start, end) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return [];
+      }
+      if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
+        start = 0;
+        end = length;
+      }
+      else {
+        start = start == null ? 0 : toInteger(start);
+        end = end === undefined ? length : toInteger(end);
+      }
+      return baseSlice(array, start, end);
+    }
+
+    /**
+     * Uses a binary search to determine the lowest index at which `value`
+     * should be inserted into `array` in order to maintain its sort order.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     * @example
+     *
+     * _.sortedIndex([30, 50], 40);
+     * // => 1
+     */
+    function sortedIndex(array, value) {
+      return baseSortedIndex(array, value);
+    }
+
+    /**
+     * This method is like `_.sortedIndex` except that it accepts `iteratee`
+     * which is invoked for `value` and each element of `array` to compute their
+     * sort ranking. The iteratee is invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     * @example
+     *
+     * var objects = [{ 'x': 4 }, { 'x': 5 }];
+     *
+     * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
+     * // => 0
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
+     * // => 0
+     */
+    function sortedIndexBy(array, value, iteratee) {
+      return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
+    }
+
+    /**
+     * This method is like `_.indexOf` except that it performs a binary
+     * search on a sorted `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {*} value The value to search for.
+     * @returns {number} Returns the index of the matched value, else `-1`.
+     * @example
+     *
+     * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
+     * // => 1
+     */
+    function sortedIndexOf(array, value) {
+      var length = array == null ? 0 : array.length;
+      if (length) {
+        var index = baseSortedIndex(array, value);
+        if (index < length && eq(array[index], value)) {
+          return index;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * This method is like `_.sortedIndex` except that it returns the highest
+     * index at which `value` should be inserted into `array` in order to
+     * maintain its sort order.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     * @example
+     *
+     * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
+     * // => 4
+     */
+    function sortedLastIndex(array, value) {
+      return baseSortedIndex(array, value, true);
+    }
+
+    /**
+     * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
+     * which is invoked for `value` and each element of `array` to compute their
+     * sort ranking. The iteratee is invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The sorted array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     * @example
+     *
+     * var objects = [{ 'x': 4 }, { 'x': 5 }];
+     *
+     * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
+     * // => 1
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
+     * // => 1
+     */
+    function sortedLastIndexBy(array, value, iteratee) {
+      return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
+    }
+
+    /**
+     * This method is like `_.lastIndexOf` except that it performs a binary
+     * search on a sorted `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {*} value The value to search for.
+     * @returns {number} Returns the index of the matched value, else `-1`.
+     * @example
+     *
+     * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
+     * // => 3
+     */
+    function sortedLastIndexOf(array, value) {
+      var length = array == null ? 0 : array.length;
+      if (length) {
+        var index = baseSortedIndex(array, value, true) - 1;
+        if (eq(array[index], value)) {
+          return index;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * This method is like `_.uniq` except that it's designed and optimized
+     * for sorted arrays.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @returns {Array} Returns the new duplicate free array.
+     * @example
+     *
+     * _.sortedUniq([1, 1, 2]);
+     * // => [1, 2]
+     */
+    function sortedUniq(array) {
+      return (array && array.length)
+        ? baseSortedUniq(array)
+        : [];
+    }
+
+    /**
+     * This method is like `_.uniqBy` except that it's designed and optimized
+     * for sorted arrays.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {Function} [iteratee] The iteratee invoked per element.
+     * @returns {Array} Returns the new duplicate free array.
+     * @example
+     *
+     * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
+     * // => [1.1, 2.3]
+     */
+    function sortedUniqBy(array, iteratee) {
+      return (array && array.length)
+        ? baseSortedUniq(array, getIteratee(iteratee, 2))
+        : [];
+    }
+
+    /**
+     * Gets all but the first element of `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.tail([1, 2, 3]);
+     * // => [2, 3]
+     */
+    function tail(array) {
+      var length = array == null ? 0 : array.length;
+      return length ? baseSlice(array, 1, length) : [];
+    }
+
+    /**
+     * Creates a slice of `array` with `n` elements taken from the beginning.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {number} [n=1] The number of elements to take.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.take([1, 2, 3]);
+     * // => [1]
+     *
+     * _.take([1, 2, 3], 2);
+     * // => [1, 2]
+     *
+     * _.take([1, 2, 3], 5);
+     * // => [1, 2, 3]
+     *
+     * _.take([1, 2, 3], 0);
+     * // => []
+     */
+    function take(array, n, guard) {
+      if (!(array && array.length)) {
+        return [];
+      }
+      n = (guard || n === undefined) ? 1 : toInteger(n);
+      return baseSlice(array, 0, n < 0 ? 0 : n);
+    }
+
+    /**
+     * Creates a slice of `array` with `n` elements taken from the end.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {number} [n=1] The number of elements to take.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * _.takeRight([1, 2, 3]);
+     * // => [3]
+     *
+     * _.takeRight([1, 2, 3], 2);
+     * // => [2, 3]
+     *
+     * _.takeRight([1, 2, 3], 5);
+     * // => [1, 2, 3]
+     *
+     * _.takeRight([1, 2, 3], 0);
+     * // => []
+     */
+    function takeRight(array, n, guard) {
+      var length = array == null ? 0 : array.length;
+      if (!length) {
+        return [];
+      }
+      n = (guard || n === undefined) ? 1 : toInteger(n);
+      n = length - n;
+      return baseSlice(array, n < 0 ? 0 : n, length);
+    }
+
+    /**
+     * Creates a slice of `array` with elements taken from the end. Elements are
+     * taken until `predicate` returns falsey. The predicate is invoked with
+     * three arguments: (value, index, array).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': true },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': false }
+     * ];
+     *
+     * _.takeRightWhile(users, function(o) { return !o.active; });
+     * // => objects for ['fred', 'pebbles']
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
+     * // => objects for ['pebbles']
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.takeRightWhile(users, ['active', false]);
+     * // => objects for ['fred', 'pebbles']
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.takeRightWhile(users, 'active');
+     * // => []
+     */
+    function takeRightWhile(array, predicate) {
+      return (array && array.length)
+        ? baseWhile(array, getIteratee(predicate, 3), false, true)
+        : [];
+    }
+
+    /**
+     * Creates a slice of `array` with elements taken from the beginning. Elements
+     * are taken until `predicate` returns falsey. The predicate is invoked with
+     * three arguments: (value, index, array).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Array
+     * @param {Array} array The array to query.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the slice of `array`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'active': false },
+     *   { 'user': 'fred',    'active': false },
+     *   { 'user': 'pebbles', 'active': true }
+     * ];
+     *
+     * _.takeWhile(users, function(o) { return !o.active; });
+     * // => objects for ['barney', 'fred']
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.takeWhile(users, { 'user': 'barney', 'active': false });
+     * // => objects for ['barney']
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.takeWhile(users, ['active', false]);
+     * // => objects for ['barney', 'fred']
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.takeWhile(users, 'active');
+     * // => []
+     */
+    function takeWhile(array, predicate) {
+      return (array && array.length)
+        ? baseWhile(array, getIteratee(predicate, 3))
+        : [];
+    }
+
+    /**
+     * Creates an array of unique values, in order, from all given arrays using
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * for equality comparisons.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @returns {Array} Returns the new array of combined values.
+     * @example
+     *
+     * _.union([2], [1, 2]);
+     * // => [2, 1]
+     */
+    var union = baseRest(function(arrays) {
+      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
+    });
+
+    /**
+     * This method is like `_.union` except that it accepts `iteratee` which is
+     * invoked for each element of each `arrays` to generate the criterion by
+     * which uniqueness is computed. Result values are chosen from the first
+     * array in which the value occurs. The iteratee is invoked with one argument:
+     * (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {Array} Returns the new array of combined values.
+     * @example
+     *
+     * _.unionBy([2.1], [1.2, 2.3], Math.floor);
+     * // => [2.1, 1.2]
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
+     * // => [{ 'x': 1 }, { 'x': 2 }]
+     */
+    var unionBy = baseRest(function(arrays) {
+      var iteratee = last(arrays);
+      if (isArrayLikeObject(iteratee)) {
+        iteratee = undefined;
+      }
+      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
+    });
+
+    /**
+     * This method is like `_.union` except that it accepts `comparator` which
+     * is invoked to compare elements of `arrays`. Result values are chosen from
+     * the first array in which the value occurs. The comparator is invoked
+     * with two arguments: (arrVal, othVal).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns the new array of combined values.
+     * @example
+     *
+     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
+     *
+     * _.unionWith(objects, others, _.isEqual);
+     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
+     */
+    var unionWith = baseRest(function(arrays) {
+      var comparator = last(arrays);
+      comparator = typeof comparator == 'function' ? comparator : undefined;
+      return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
+    });
+
+    /**
+     * Creates a duplicate-free version of an array, using
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * for equality comparisons, in which only the first occurrence of each element
+     * is kept. The order of result values is determined by the order they occur
+     * in the array.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @returns {Array} Returns the new duplicate free array.
+     * @example
+     *
+     * _.uniq([2, 1, 2]);
+     * // => [2, 1]
+     */
+    function uniq(array) {
+      return (array && array.length) ? baseUniq(array) : [];
+    }
+
+    /**
+     * This method is like `_.uniq` except that it accepts `iteratee` which is
+     * invoked for each element in `array` to generate the criterion by which
+     * uniqueness is computed. The order of result values is determined by the
+     * order they occur in the array. The iteratee is invoked with one argument:
+     * (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {Array} Returns the new duplicate free array.
+     * @example
+     *
+     * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
+     * // => [2.1, 1.2]
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+     * // => [{ 'x': 1 }, { 'x': 2 }]
+     */
+    function uniqBy(array, iteratee) {
+      return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
+    }
+
+    /**
+     * This method is like `_.uniq` except that it accepts `comparator` which
+     * is invoked to compare elements of `array`. The order of result values is
+     * determined by the order they occur in the array.The comparator is invoked
+     * with two arguments: (arrVal, othVal).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns the new duplicate free array.
+     * @example
+     *
+     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
+     *
+     * _.uniqWith(objects, _.isEqual);
+     * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
+     */
+    function uniqWith(array, comparator) {
+      comparator = typeof comparator == 'function' ? comparator : undefined;
+      return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
+    }
+
+    /**
+     * This method is like `_.zip` except that it accepts an array of grouped
+     * elements and creates an array regrouping the elements to their pre-zip
+     * configuration.
+     *
+     * @static
+     * @memberOf _
+     * @since 1.2.0
+     * @category Array
+     * @param {Array} array The array of grouped elements to process.
+     * @returns {Array} Returns the new array of regrouped elements.
+     * @example
+     *
+     * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
+     * // => [['a', 1, true], ['b', 2, false]]
+     *
+     * _.unzip(zipped);
+     * // => [['a', 'b'], [1, 2], [true, false]]
+     */
+    function unzip(array) {
+      if (!(array && array.length)) {
+        return [];
+      }
+      var length = 0;
+      array = arrayFilter(array, function(group) {
+        if (isArrayLikeObject(group)) {
+          length = nativeMax(group.length, length);
+          return true;
+        }
+      });
+      return baseTimes(length, function(index) {
+        return arrayMap(array, baseProperty(index));
+      });
+    }
+
+    /**
+     * This method is like `_.unzip` except that it accepts `iteratee` to specify
+     * how regrouped values should be combined. The iteratee is invoked with the
+     * elements of each group: (...group).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.8.0
+     * @category Array
+     * @param {Array} array The array of grouped elements to process.
+     * @param {Function} [iteratee=_.identity] The function to combine
+     *  regrouped values.
+     * @returns {Array} Returns the new array of regrouped elements.
+     * @example
+     *
+     * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
+     * // => [[1, 10, 100], [2, 20, 200]]
+     *
+     * _.unzipWith(zipped, _.add);
+     * // => [3, 30, 300]
+     */
+    function unzipWith(array, iteratee) {
+      if (!(array && array.length)) {
+        return [];
+      }
+      var result = unzip(array);
+      if (iteratee == null) {
+        return result;
+      }
+      return arrayMap(result, function(group) {
+        return apply(iteratee, undefined, group);
+      });
+    }
+
+    /**
+     * Creates an array excluding all given values using
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * for equality comparisons.
+     *
+     * **Note:** Unlike `_.pull`, this method returns a new array.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {Array} array The array to inspect.
+     * @param {...*} [values] The values to exclude.
+     * @returns {Array} Returns the new array of filtered values.
+     * @see _.difference, _.xor
+     * @example
+     *
+     * _.without([2, 1, 2, 3], 1, 2);
+     * // => [3]
+     */
+    var without = baseRest(function(array, values) {
+      return isArrayLikeObject(array)
+        ? baseDifference(array, values)
+        : [];
+    });
+
+    /**
+     * Creates an array of unique values that is the
+     * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
+     * of the given arrays. The order of result values is determined by the order
+     * they occur in the arrays.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.4.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @returns {Array} Returns the new array of filtered values.
+     * @see _.difference, _.without
+     * @example
+     *
+     * _.xor([2, 1], [2, 3]);
+     * // => [1, 3]
+     */
+    var xor = baseRest(function(arrays) {
+      return baseXor(arrayFilter(arrays, isArrayLikeObject));
+    });
+
+    /**
+     * This method is like `_.xor` except that it accepts `iteratee` which is
+     * invoked for each element of each `arrays` to generate the criterion by
+     * which by which they're compared. The order of result values is determined
+     * by the order they occur in the arrays. The iteratee is invoked with one
+     * argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {Array} Returns the new array of filtered values.
+     * @example
+     *
+     * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
+     * // => [1.2, 3.4]
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
+     * // => [{ 'x': 2 }]
+     */
+    var xorBy = baseRest(function(arrays) {
+      var iteratee = last(arrays);
+      if (isArrayLikeObject(iteratee)) {
+        iteratee = undefined;
+      }
+      return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
+    });
+
+    /**
+     * This method is like `_.xor` except that it accepts `comparator` which is
+     * invoked to compare elements of `arrays`. The order of result values is
+     * determined by the order they occur in the arrays. The comparator is invoked
+     * with two arguments: (arrVal, othVal).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to inspect.
+     * @param {Function} [comparator] The comparator invoked per element.
+     * @returns {Array} Returns the new array of filtered values.
+     * @example
+     *
+     * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+     * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
+     *
+     * _.xorWith(objects, others, _.isEqual);
+     * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
+     */
+    var xorWith = baseRest(function(arrays) {
+      var comparator = last(arrays);
+      comparator = typeof comparator == 'function' ? comparator : undefined;
+      return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
+    });
+
+    /**
+     * Creates an array of grouped elements, the first of which contains the
+     * first elements of the given arrays, the second of which contains the
+     * second elements of the given arrays, and so on.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to process.
+     * @returns {Array} Returns the new array of grouped elements.
+     * @example
+     *
+     * _.zip(['a', 'b'], [1, 2], [true, false]);
+     * // => [['a', 1, true], ['b', 2, false]]
+     */
+    var zip = baseRest(unzip);
+
+    /**
+     * This method is like `_.fromPairs` except that it accepts two arrays,
+     * one of property identifiers and one of corresponding values.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.4.0
+     * @category Array
+     * @param {Array} [props=[]] The property identifiers.
+     * @param {Array} [values=[]] The property values.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * _.zipObject(['a', 'b'], [1, 2]);
+     * // => { 'a': 1, 'b': 2 }
+     */
+    function zipObject(props, values) {
+      return baseZipObject(props || [], values || [], assignValue);
+    }
+
+    /**
+     * This method is like `_.zipObject` except that it supports property paths.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.1.0
+     * @category Array
+     * @param {Array} [props=[]] The property identifiers.
+     * @param {Array} [values=[]] The property values.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
+     * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
+     */
+    function zipObjectDeep(props, values) {
+      return baseZipObject(props || [], values || [], baseSet);
+    }
+
+    /**
+     * This method is like `_.zip` except that it accepts `iteratee` to specify
+     * how grouped values should be combined. The iteratee is invoked with the
+     * elements of each group: (...group).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.8.0
+     * @category Array
+     * @param {...Array} [arrays] The arrays to process.
+     * @param {Function} [iteratee=_.identity] The function to combine
+     *  grouped values.
+     * @returns {Array} Returns the new array of grouped elements.
+     * @example
+     *
+     * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
+     *   return a + b + c;
+     * });
+     * // => [111, 222]
+     */
+    var zipWith = baseRest(function(arrays) {
+      var length = arrays.length,
+          iteratee = length > 1 ? arrays[length - 1] : undefined;
+
+      iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
+      return unzipWith(arrays, iteratee);
+    });
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` wrapper instance that wraps `value` with explicit method
+     * chain sequences enabled. The result of such sequences must be unwrapped
+     * with `_#value`.
+     *
+     * @static
+     * @memberOf _
+     * @since 1.3.0
+     * @category Seq
+     * @param {*} value The value to wrap.
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'age': 36 },
+     *   { 'user': 'fred',    'age': 40 },
+     *   { 'user': 'pebbles', 'age': 1 }
+     * ];
+     *
+     * var youngest = _
+     *   .chain(users)
+     *   .sortBy('age')
+     *   .map(function(o) {
+     *     return o.user + ' is ' + o.age;
+     *   })
+     *   .head()
+     *   .value();
+     * // => 'pebbles is 1'
+     */
+    function chain(value) {
+      var result = lodash(value);
+      result.__chain__ = true;
+      return result;
+    }
+
+    /**
+     * This method invokes `interceptor` and returns `value`. The interceptor
+     * is invoked with one argument; (value). The purpose of this method is to
+     * "tap into" a method chain sequence in order to modify intermediate results.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Seq
+     * @param {*} value The value to provide to `interceptor`.
+     * @param {Function} interceptor The function to invoke.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * _([1, 2, 3])
+     *  .tap(function(array) {
+     *    // Mutate input array.
+     *    array.pop();
+     *  })
+     *  .reverse()
+     *  .value();
+     * // => [2, 1]
+     */
+    function tap(value, interceptor) {
+      interceptor(value);
+      return value;
+    }
+
+    /**
+     * This method is like `_.tap` except that it returns the result of `interceptor`.
+     * The purpose of this method is to "pass thru" values replacing intermediate
+     * results in a method chain sequence.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Seq
+     * @param {*} value The value to provide to `interceptor`.
+     * @param {Function} interceptor The function to invoke.
+     * @returns {*} Returns the result of `interceptor`.
+     * @example
+     *
+     * _('  abc  ')
+     *  .chain()
+     *  .trim()
+     *  .thru(function(value) {
+     *    return [value];
+     *  })
+     *  .value();
+     * // => ['abc']
+     */
+    function thru(value, interceptor) {
+      return interceptor(value);
+    }
+
+    /**
+     * This method is the wrapper version of `_.at`.
+     *
+     * @name at
+     * @memberOf _
+     * @since 1.0.0
+     * @category Seq
+     * @param {...(string|string[])} [paths] The property paths to pick.
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
+     *
+     * _(object).at(['a[0].b.c', 'a[1]']).value();
+     * // => [3, 4]
+     */
+    var wrapperAt = flatRest(function(paths) {
+      var length = paths.length,
+          start = length ? paths[0] : 0,
+          value = this.__wrapped__,
+          interceptor = function(object) { return baseAt(object, paths); };
+
+      if (length > 1 || this.__actions__.length ||
+          !(value instanceof LazyWrapper) || !isIndex(start)) {
+        return this.thru(interceptor);
+      }
+      value = value.slice(start, +start + (length ? 1 : 0));
+      value.__actions__.push({
+        'func': thru,
+        'args': [interceptor],
+        'thisArg': undefined
+      });
+      return new LodashWrapper(value, this.__chain__).thru(function(array) {
+        if (length && !array.length) {
+          array.push(undefined);
+        }
+        return array;
+      });
+    });
+
+    /**
+     * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
+     *
+     * @name chain
+     * @memberOf _
+     * @since 0.1.0
+     * @category Seq
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36 },
+     *   { 'user': 'fred',   'age': 40 }
+     * ];
+     *
+     * // A sequence without explicit chaining.
+     * _(users).head();
+     * // => { 'user': 'barney', 'age': 36 }
+     *
+     * // A sequence with explicit chaining.
+     * _(users)
+     *   .chain()
+     *   .head()
+     *   .pick('user')
+     *   .value();
+     * // => { 'user': 'barney' }
+     */
+    function wrapperChain() {
+      return chain(this);
+    }
+
+    /**
+     * Executes the chain sequence and returns the wrapped result.
+     *
+     * @name commit
+     * @memberOf _
+     * @since 3.2.0
+     * @category Seq
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var array = [1, 2];
+     * var wrapped = _(array).push(3);
+     *
+     * console.log(array);
+     * // => [1, 2]
+     *
+     * wrapped = wrapped.commit();
+     * console.log(array);
+     * // => [1, 2, 3]
+     *
+     * wrapped.last();
+     * // => 3
+     *
+     * console.log(array);
+     * // => [1, 2, 3]
+     */
+    function wrapperCommit() {
+      return new LodashWrapper(this.value(), this.__chain__);
+    }
+
+    /**
+     * Gets the next value on a wrapped object following the
+     * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
+     *
+     * @name next
+     * @memberOf _
+     * @since 4.0.0
+     * @category Seq
+     * @returns {Object} Returns the next iterator value.
+     * @example
+     *
+     * var wrapped = _([1, 2]);
+     *
+     * wrapped.next();
+     * // => { 'done': false, 'value': 1 }
+     *
+     * wrapped.next();
+     * // => { 'done': false, 'value': 2 }
+     *
+     * wrapped.next();
+     * // => { 'done': true, 'value': undefined }
+     */
+    function wrapperNext() {
+      if (this.__values__ === undefined) {
+        this.__values__ = toArray(this.value());
+      }
+      var done = this.__index__ >= this.__values__.length,
+          value = done ? undefined : this.__values__[this.__index__++];
+
+      return { 'done': done, 'value': value };
+    }
+
+    /**
+     * Enables the wrapper to be iterable.
+     *
+     * @name Symbol.iterator
+     * @memberOf _
+     * @since 4.0.0
+     * @category Seq
+     * @returns {Object} Returns the wrapper object.
+     * @example
+     *
+     * var wrapped = _([1, 2]);
+     *
+     * wrapped[Symbol.iterator]() === wrapped;
+     * // => true
+     *
+     * Array.from(wrapped);
+     * // => [1, 2]
+     */
+    function wrapperToIterator() {
+      return this;
+    }
+
+    /**
+     * Creates a clone of the chain sequence planting `value` as the wrapped value.
+     *
+     * @name plant
+     * @memberOf _
+     * @since 3.2.0
+     * @category Seq
+     * @param {*} value The value to plant.
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * function square(n) {
+     *   return n * n;
+     * }
+     *
+     * var wrapped = _([1, 2]).map(square);
+     * var other = wrapped.plant([3, 4]);
+     *
+     * other.value();
+     * // => [9, 16]
+     *
+     * wrapped.value();
+     * // => [1, 4]
+     */
+    function wrapperPlant(value) {
+      var result,
+          parent = this;
+
+      while (parent instanceof baseLodash) {
+        var clone = wrapperClone(parent);
+        clone.__index__ = 0;
+        clone.__values__ = undefined;
+        if (result) {
+          previous.__wrapped__ = clone;
+        } else {
+          result = clone;
+        }
+        var previous = clone;
+        parent = parent.__wrapped__;
+      }
+      previous.__wrapped__ = value;
+      return result;
+    }
+
+    /**
+     * This method is the wrapper version of `_.reverse`.
+     *
+     * **Note:** This method mutates the wrapped array.
+     *
+     * @name reverse
+     * @memberOf _
+     * @since 0.1.0
+     * @category Seq
+     * @returns {Object} Returns the new `lodash` wrapper instance.
+     * @example
+     *
+     * var array = [1, 2, 3];
+     *
+     * _(array).reverse().value()
+     * // => [3, 2, 1]
+     *
+     * console.log(array);
+     * // => [3, 2, 1]
+     */
+    function wrapperReverse() {
+      var value = this.__wrapped__;
+      if (value instanceof LazyWrapper) {
+        var wrapped = value;
+        if (this.__actions__.length) {
+          wrapped = new LazyWrapper(this);
+        }
+        wrapped = wrapped.reverse();
+        wrapped.__actions__.push({
+          'func': thru,
+          'args': [reverse],
+          'thisArg': undefined
+        });
+        return new LodashWrapper(wrapped, this.__chain__);
+      }
+      return this.thru(reverse);
+    }
+
+    /**
+     * Executes the chain sequence to resolve the unwrapped value.
+     *
+     * @name value
+     * @memberOf _
+     * @since 0.1.0
+     * @alias toJSON, valueOf
+     * @category Seq
+     * @returns {*} Returns the resolved unwrapped value.
+     * @example
+     *
+     * _([1, 2, 3]).value();
+     * // => [1, 2, 3]
+     */
+    function wrapperValue() {
+      return baseWrapperValue(this.__wrapped__, this.__actions__);
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of `collection` thru `iteratee`. The corresponding value of
+     * each key is the number of times the key was returned by `iteratee`. The
+     * iteratee is invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 0.5.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.countBy([6.1, 4.2, 6.3], Math.floor);
+     * // => { '4': 1, '6': 2 }
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.countBy(['one', 'two', 'three'], 'length');
+     * // => { '3': 2, '5': 1 }
+     */
+    var countBy = createAggregator(function(result, value, key) {
+      if (hasOwnProperty.call(result, key)) {
+        ++result[key];
+      } else {
+        baseAssignValue(result, key, 1);
+      }
+    });
+
+    /**
+     * Checks if `predicate` returns truthy for **all** elements of `collection`.
+     * Iteration is stopped once `predicate` returns falsey. The predicate is
+     * invoked with three arguments: (value, index|key, collection).
+     *
+     * **Note:** This method returns `true` for
+     * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
+     * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
+     * elements of empty collections.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {boolean} Returns `true` if all elements pass the predicate check,
+     *  else `false`.
+     * @example
+     *
+     * _.every([true, 1, null, 'yes'], Boolean);
+     * // => false
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36, 'active': false },
+     *   { 'user': 'fred',   'age': 40, 'active': false }
+     * ];
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.every(users, { 'user': 'barney', 'active': false });
+     * // => false
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.every(users, ['active', false]);
+     * // => true
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.every(users, 'active');
+     * // => false
+     */
+    function every(collection, predicate, guard) {
+      var func = isArray(collection) ? arrayEvery : baseEvery;
+      if (guard && isIterateeCall(collection, predicate, guard)) {
+        predicate = undefined;
+      }
+      return func(collection, getIteratee(predicate, 3));
+    }
+
+    /**
+     * Iterates over elements of `collection`, returning an array of all elements
+     * `predicate` returns truthy for. The predicate is invoked with three
+     * arguments: (value, index|key, collection).
+     *
+     * **Note:** Unlike `_.remove`, this method returns a new array.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the new filtered array.
+     * @see _.reject
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36, 'active': true },
+     *   { 'user': 'fred',   'age': 40, 'active': false }
+     * ];
+     *
+     * _.filter(users, function(o) { return !o.active; });
+     * // => objects for ['fred']
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.filter(users, { 'age': 36, 'active': true });
+     * // => objects for ['barney']
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.filter(users, ['active', false]);
+     * // => objects for ['fred']
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.filter(users, 'active');
+     * // => objects for ['barney']
+     */
+    function filter(collection, predicate) {
+      var func = isArray(collection) ? arrayFilter : baseFilter;
+      return func(collection, getIteratee(predicate, 3));
+    }
+
+    /**
+     * Iterates over elements of `collection`, returning the first element
+     * `predicate` returns truthy for. The predicate is invoked with three
+     * arguments: (value, index|key, collection).
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to inspect.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @param {number} [fromIndex=0] The index to search from.
+     * @returns {*} Returns the matched element, else `undefined`.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'age': 36, 'active': true },
+     *   { 'user': 'fred',    'age': 40, 'active': false },
+     *   { 'user': 'pebbles', 'age': 1,  'active': true }
+     * ];
+     *
+     * _.find(users, function(o) { return o.age < 40; });
+     * // => object for 'barney'
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.find(users, { 'age': 1, 'active': true });
+     * // => object for 'pebbles'
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.find(users, ['active', false]);
+     * // => object for 'fred'
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.find(users, 'active');
+     * // => object for 'barney'
+     */
+    var find = createFind(findIndex);
+
+    /**
+     * This method is like `_.find` except that it iterates over elements of
+     * `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to inspect.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @param {number} [fromIndex=collection.length-1] The index to search from.
+     * @returns {*} Returns the matched element, else `undefined`.
+     * @example
+     *
+     * _.findLast([1, 2, 3, 4], function(n) {
+     *   return n % 2 == 1;
+     * });
+     * // => 3
+     */
+    var findLast = createFind(findLastIndex);
+
+    /**
+     * Creates a flattened array of values by running each element in `collection`
+     * thru `iteratee` and flattening the mapped results. The iteratee is invoked
+     * with three arguments: (value, index|key, collection).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the new flattened array.
+     * @example
+     *
+     * function duplicate(n) {
+     *   return [n, n];
+     * }
+     *
+     * _.flatMap([1, 2], duplicate);
+     * // => [1, 1, 2, 2]
+     */
+    function flatMap(collection, iteratee) {
+      return baseFlatten(map(collection, iteratee), 1);
+    }
+
+    /**
+     * This method is like `_.flatMap` except that it recursively flattens the
+     * mapped results.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.7.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the new flattened array.
+     * @example
+     *
+     * function duplicate(n) {
+     *   return [[[n, n]]];
+     * }
+     *
+     * _.flatMapDeep([1, 2], duplicate);
+     * // => [1, 1, 2, 2]
+     */
+    function flatMapDeep(collection, iteratee) {
+      return baseFlatten(map(collection, iteratee), INFINITY);
+    }
+
+    /**
+     * This method is like `_.flatMap` except that it recursively flattens the
+     * mapped results up to `depth` times.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.7.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {number} [depth=1] The maximum recursion depth.
+     * @returns {Array} Returns the new flattened array.
+     * @example
+     *
+     * function duplicate(n) {
+     *   return [[[n, n]]];
+     * }
+     *
+     * _.flatMapDepth([1, 2], duplicate, 2);
+     * // => [[1, 1], [2, 2]]
+     */
+    function flatMapDepth(collection, iteratee, depth) {
+      depth = depth === undefined ? 1 : toInteger(depth);
+      return baseFlatten(map(collection, iteratee), depth);
+    }
+
+    /**
+     * Iterates over elements of `collection` and invokes `iteratee` for each element.
+     * The iteratee is invoked with three arguments: (value, index|key, collection).
+     * Iteratee functions may exit iteration early by explicitly returning `false`.
+     *
+     * **Note:** As with other "Collections" methods, objects with a "length"
+     * property are iterated like arrays. To avoid this behavior use `_.forIn`
+     * or `_.forOwn` for object iteration.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @alias each
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Array|Object} Returns `collection`.
+     * @see _.forEachRight
+     * @example
+     *
+     * _.forEach([1, 2], function(value) {
+     *   console.log(value);
+     * });
+     * // => Logs `1` then `2`.
+     *
+     * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => Logs 'a' then 'b' (iteration order is not guaranteed).
+     */
+    function forEach(collection, iteratee) {
+      var func = isArray(collection) ? arrayEach : baseEach;
+      return func(collection, getIteratee(iteratee, 3));
+    }
+
+    /**
+     * This method is like `_.forEach` except that it iterates over elements of
+     * `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @alias eachRight
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Array|Object} Returns `collection`.
+     * @see _.forEach
+     * @example
+     *
+     * _.forEachRight([1, 2], function(value) {
+     *   console.log(value);
+     * });
+     * // => Logs `2` then `1`.
+     */
+    function forEachRight(collection, iteratee) {
+      var func = isArray(collection) ? arrayEachRight : baseEachRight;
+      return func(collection, getIteratee(iteratee, 3));
+    }
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of `collection` thru `iteratee`. The order of grouped values
+     * is determined by the order they occur in `collection`. The corresponding
+     * value of each key is an array of elements responsible for generating the
+     * key. The iteratee is invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.groupBy([6.1, 4.2, 6.3], Math.floor);
+     * // => { '4': [4.2], '6': [6.1, 6.3] }
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.groupBy(['one', 'two', 'three'], 'length');
+     * // => { '3': ['one', 'two'], '5': ['three'] }
+     */
+    var groupBy = createAggregator(function(result, value, key) {
+      if (hasOwnProperty.call(result, key)) {
+        result[key].push(value);
+      } else {
+        baseAssignValue(result, key, [value]);
+      }
+    });
+
+    /**
+     * Checks if `value` is in `collection`. If `collection` is a string, it's
+     * checked for a substring of `value`, otherwise
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * is used for equality comparisons. If `fromIndex` is negative, it's used as
+     * the offset from the end of `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to inspect.
+     * @param {*} value The value to search for.
+     * @param {number} [fromIndex=0] The index to search from.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
+     * @returns {boolean} Returns `true` if `value` is found, else `false`.
+     * @example
+     *
+     * _.includes([1, 2, 3], 1);
+     * // => true
+     *
+     * _.includes([1, 2, 3], 1, 2);
+     * // => false
+     *
+     * _.includes({ 'a': 1, 'b': 2 }, 1);
+     * // => true
+     *
+     * _.includes('abcd', 'bc');
+     * // => true
+     */
+    function includes(collection, value, fromIndex, guard) {
+      collection = isArrayLike(collection) ? collection : values(collection);
+      fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
+
+      var length = collection.length;
+      if (fromIndex < 0) {
+        fromIndex = nativeMax(length + fromIndex, 0);
+      }
+      return isString(collection)
+        ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
+        : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
+    }
+
+    /**
+     * Invokes the method at `path` of each element in `collection`, returning
+     * an array of the results of each invoked method. Any additional arguments
+     * are provided to each invoked method. If `path` is a function, it's invoked
+     * for, and `this` bound to, each element in `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Array|Function|string} path The path of the method to invoke or
+     *  the function invoked per iteration.
+     * @param {...*} [args] The arguments to invoke each method with.
+     * @returns {Array} Returns the array of results.
+     * @example
+     *
+     * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
+     * // => [[1, 5, 7], [1, 2, 3]]
+     *
+     * _.invokeMap([123, 456], String.prototype.split, '');
+     * // => [['1', '2', '3'], ['4', '5', '6']]
+     */
+    var invokeMap = baseRest(function(collection, path, args) {
+      var index = -1,
+          isFunc = typeof path == 'function',
+          result = isArrayLike(collection) ? Array(collection.length) : [];
+
+      baseEach(collection, function(value) {
+        result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
+      });
+      return result;
+    });
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of `collection` thru `iteratee`. The corresponding value of
+     * each key is the last element responsible for generating the key. The
+     * iteratee is invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * var array = [
+     *   { 'dir': 'left', 'code': 97 },
+     *   { 'dir': 'right', 'code': 100 }
+     * ];
+     *
+     * _.keyBy(array, function(o) {
+     *   return String.fromCharCode(o.code);
+     * });
+     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+     *
+     * _.keyBy(array, 'dir');
+     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
+     */
+    var keyBy = createAggregator(function(result, value, key) {
+      baseAssignValue(result, key, value);
+    });
+
+    /**
+     * Creates an array of values by running each element in `collection` thru
+     * `iteratee`. The iteratee is invoked with three arguments:
+     * (value, index|key, collection).
+     *
+     * Many lodash methods are guarded to work as iteratees for methods like
+     * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
+     *
+     * The guarded methods are:
+     * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
+     * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
+     * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
+     * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the new mapped array.
+     * @example
+     *
+     * function square(n) {
+     *   return n * n;
+     * }
+     *
+     * _.map([4, 8], square);
+     * // => [16, 64]
+     *
+     * _.map({ 'a': 4, 'b': 8 }, square);
+     * // => [16, 64] (iteration order is not guaranteed)
+     *
+     * var users = [
+     *   { 'user': 'barney' },
+     *   { 'user': 'fred' }
+     * ];
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.map(users, 'user');
+     * // => ['barney', 'fred']
+     */
+    function map(collection, iteratee) {
+      var func = isArray(collection) ? arrayMap : baseMap;
+      return func(collection, getIteratee(iteratee, 3));
+    }
+
+    /**
+     * This method is like `_.sortBy` except that it allows specifying the sort
+     * orders of the iteratees to sort by. If `orders` is unspecified, all values
+     * are sorted in ascending order. Otherwise, specify an order of "desc" for
+     * descending or "asc" for ascending sort order of corresponding values.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
+     *  The iteratees to sort by.
+     * @param {string[]} [orders] The sort orders of `iteratees`.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
+     * @returns {Array} Returns the new sorted array.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'fred',   'age': 48 },
+     *   { 'user': 'barney', 'age': 34 },
+     *   { 'user': 'fred',   'age': 40 },
+     *   { 'user': 'barney', 'age': 36 }
+     * ];
+     *
+     * // Sort by `user` in ascending order and by `age` in descending order.
+     * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
+     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
+     */
+    function orderBy(collection, iteratees, orders, guard) {
+      if (collection == null) {
+        return [];
+      }
+      if (!isArray(iteratees)) {
+        iteratees = iteratees == null ? [] : [iteratees];
+      }
+      orders = guard ? undefined : orders;
+      if (!isArray(orders)) {
+        orders = orders == null ? [] : [orders];
+      }
+      return baseOrderBy(collection, iteratees, orders);
+    }
+
+    /**
+     * Creates an array of elements split into two groups, the first of which
+     * contains elements `predicate` returns truthy for, the second of which
+     * contains elements `predicate` returns falsey for. The predicate is
+     * invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the array of grouped elements.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney',  'age': 36, 'active': false },
+     *   { 'user': 'fred',    'age': 40, 'active': true },
+     *   { 'user': 'pebbles', 'age': 1,  'active': false }
+     * ];
+     *
+     * _.partition(users, function(o) { return o.active; });
+     * // => objects for [['fred'], ['barney', 'pebbles']]
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.partition(users, { 'age': 1, 'active': false });
+     * // => objects for [['pebbles'], ['barney', 'fred']]
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.partition(users, ['active', false]);
+     * // => objects for [['barney', 'pebbles'], ['fred']]
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.partition(users, 'active');
+     * // => objects for [['fred'], ['barney', 'pebbles']]
+     */
+    var partition = createAggregator(function(result, value, key) {
+      result[key ? 0 : 1].push(value);
+    }, function() { return [[], []]; });
+
+    /**
+     * Reduces `collection` to a value which is the accumulated result of running
+     * each element in `collection` thru `iteratee`, where each successive
+     * invocation is supplied the return value of the previous. If `accumulator`
+     * is not given, the first element of `collection` is used as the initial
+     * value. The iteratee is invoked with four arguments:
+     * (accumulator, value, index|key, collection).
+     *
+     * Many lodash methods are guarded to work as iteratees for methods like
+     * `_.reduce`, `_.reduceRight`, and `_.transform`.
+     *
+     * The guarded methods are:
+     * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
+     * and `sortBy`
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [accumulator] The initial value.
+     * @returns {*} Returns the accumulated value.
+     * @see _.reduceRight
+     * @example
+     *
+     * _.reduce([1, 2], function(sum, n) {
+     *   return sum + n;
+     * }, 0);
+     * // => 3
+     *
+     * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
+     *   (result[value] || (result[value] = [])).push(key);
+     *   return result;
+     * }, {});
+     * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
+     */
+    function reduce(collection, iteratee, accumulator) {
+      var func = isArray(collection) ? arrayReduce : baseReduce,
+          initAccum = arguments.length < 3;
+
+      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
+    }
+
+    /**
+     * This method is like `_.reduce` except that it iterates over elements of
+     * `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [accumulator] The initial value.
+     * @returns {*} Returns the accumulated value.
+     * @see _.reduce
+     * @example
+     *
+     * var array = [[0, 1], [2, 3], [4, 5]];
+     *
+     * _.reduceRight(array, function(flattened, other) {
+     *   return flattened.concat(other);
+     * }, []);
+     * // => [4, 5, 2, 3, 0, 1]
+     */
+    function reduceRight(collection, iteratee, accumulator) {
+      var func = isArray(collection) ? arrayReduceRight : baseReduce,
+          initAccum = arguments.length < 3;
+
+      return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
+    }
+
+    /**
+     * The opposite of `_.filter`; this method returns the elements of `collection`
+     * that `predicate` does **not** return truthy for.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the new filtered array.
+     * @see _.filter
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36, 'active': false },
+     *   { 'user': 'fred',   'age': 40, 'active': true }
+     * ];
+     *
+     * _.reject(users, function(o) { return !o.active; });
+     * // => objects for ['fred']
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.reject(users, { 'age': 40, 'active': true });
+     * // => objects for ['barney']
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.reject(users, ['active', false]);
+     * // => objects for ['fred']
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.reject(users, 'active');
+     * // => objects for ['barney']
+     */
+    function reject(collection, predicate) {
+      var func = isArray(collection) ? arrayFilter : baseFilter;
+      return func(collection, negate(getIteratee(predicate, 3)));
+    }
+
+    /**
+     * Gets a random element from `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to sample.
+     * @returns {*} Returns the random element.
+     * @example
+     *
+     * _.sample([1, 2, 3, 4]);
+     * // => 2
+     */
+    function sample(collection) {
+      var func = isArray(collection) ? arraySample : baseSample;
+      return func(collection);
+    }
+
+    /**
+     * Gets `n` random elements at unique keys from `collection` up to the
+     * size of `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to sample.
+     * @param {number} [n=1] The number of elements to sample.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Array} Returns the random elements.
+     * @example
+     *
+     * _.sampleSize([1, 2, 3], 2);
+     * // => [3, 1]
+     *
+     * _.sampleSize([1, 2, 3], 4);
+     * // => [2, 3, 1]
+     */
+    function sampleSize(collection, n, guard) {
+      if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
+        n = 1;
+      } else {
+        n = toInteger(n);
+      }
+      var func = isArray(collection) ? arraySampleSize : baseSampleSize;
+      return func(collection, n);
+    }
+
+    /**
+     * Creates an array of shuffled values, using a version of the
+     * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to shuffle.
+     * @returns {Array} Returns the new shuffled array.
+     * @example
+     *
+     * _.shuffle([1, 2, 3, 4]);
+     * // => [4, 1, 3, 2]
+     */
+    function shuffle(collection) {
+      var func = isArray(collection) ? arrayShuffle : baseShuffle;
+      return func(collection);
+    }
+
+    /**
+     * Gets the size of `collection` by returning its length for array-like
+     * values or the number of own enumerable string keyed properties for objects.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object|string} collection The collection to inspect.
+     * @returns {number} Returns the collection size.
+     * @example
+     *
+     * _.size([1, 2, 3]);
+     * // => 3
+     *
+     * _.size({ 'a': 1, 'b': 2 });
+     * // => 2
+     *
+     * _.size('pebbles');
+     * // => 7
+     */
+    function size(collection) {
+      if (collection == null) {
+        return 0;
+      }
+      if (isArrayLike(collection)) {
+        return isString(collection) ? stringSize(collection) : collection.length;
+      }
+      var tag = getTag(collection);
+      if (tag == mapTag || tag == setTag) {
+        return collection.size;
+      }
+      return baseKeys(collection).length;
+    }
+
+    /**
+     * Checks if `predicate` returns truthy for **any** element of `collection`.
+     * Iteration is stopped once `predicate` returns truthy. The predicate is
+     * invoked with three arguments: (value, index|key, collection).
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {boolean} Returns `true` if any element passes the predicate check,
+     *  else `false`.
+     * @example
+     *
+     * _.some([null, 0, 'yes', false], Boolean);
+     * // => true
+     *
+     * var users = [
+     *   { 'user': 'barney', 'active': true },
+     *   { 'user': 'fred',   'active': false }
+     * ];
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.some(users, { 'user': 'barney', 'active': false });
+     * // => false
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.some(users, ['active', false]);
+     * // => true
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.some(users, 'active');
+     * // => true
+     */
+    function some(collection, predicate, guard) {
+      var func = isArray(collection) ? arraySome : baseSome;
+      if (guard && isIterateeCall(collection, predicate, guard)) {
+        predicate = undefined;
+      }
+      return func(collection, getIteratee(predicate, 3));
+    }
+
+    /**
+     * Creates an array of elements, sorted in ascending order by the results of
+     * running each element in a collection thru each iteratee. This method
+     * performs a stable sort, that is, it preserves the original sort order of
+     * equal elements. The iteratees are invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Collection
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {...(Function|Function[])} [iteratees=[_.identity]]
+     *  The iteratees to sort by.
+     * @returns {Array} Returns the new sorted array.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'fred',   'age': 48 },
+     *   { 'user': 'barney', 'age': 36 },
+     *   { 'user': 'fred',   'age': 40 },
+     *   { 'user': 'barney', 'age': 34 }
+     * ];
+     *
+     * _.sortBy(users, [function(o) { return o.user; }]);
+     * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
+     *
+     * _.sortBy(users, ['user', 'age']);
+     * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
+     */
+    var sortBy = baseRest(function(collection, iteratees) {
+      if (collection == null) {
+        return [];
+      }
+      var length = iteratees.length;
+      if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
+        iteratees = [];
+      } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
+        iteratees = [iteratees[0]];
+      }
+      return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
+    });
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Gets the timestamp of the number of milliseconds that have elapsed since
+     * the Unix epoch (1 January 1970 00:00:00 UTC).
+     *
+     * @static
+     * @memberOf _
+     * @since 2.4.0
+     * @category Date
+     * @returns {number} Returns the timestamp.
+     * @example
+     *
+     * _.defer(function(stamp) {
+     *   console.log(_.now() - stamp);
+     * }, _.now());
+     * // => Logs the number of milliseconds it took for the deferred invocation.
+     */
+    var now = ctxNow || function() {
+      return root.Date.now();
+    };
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * The opposite of `_.before`; this method creates a function that invokes
+     * `func` once it's called `n` or more times.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Function
+     * @param {number} n The number of calls before `func` is invoked.
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var saves = ['profile', 'settings'];
+     *
+     * var done = _.after(saves.length, function() {
+     *   console.log('done saving!');
+     * });
+     *
+     * _.forEach(saves, function(type) {
+     *   asyncSave({ 'type': type, 'complete': done });
+     * });
+     * // => Logs 'done saving!' after the two async saves have completed.
+     */
+    function after(n, func) {
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      n = toInteger(n);
+      return function() {
+        if (--n < 1) {
+          return func.apply(this, arguments);
+        }
+      };
+    }
+
+    /**
+     * Creates a function that invokes `func`, with up to `n` arguments,
+     * ignoring any additional arguments.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Function
+     * @param {Function} func The function to cap arguments for.
+     * @param {number} [n=func.length] The arity cap.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Function} Returns the new capped function.
+     * @example
+     *
+     * _.map(['6', '8', '10'], _.ary(parseInt, 1));
+     * // => [6, 8, 10]
+     */
+    function ary(func, n, guard) {
+      n = guard ? undefined : n;
+      n = (func && n == null) ? func.length : n;
+      return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
+    }
+
+    /**
+     * Creates a function that invokes `func`, with the `this` binding and arguments
+     * of the created function, while it's called less than `n` times. Subsequent
+     * calls to the created function return the result of the last `func` invocation.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Function
+     * @param {number} n The number of calls at which `func` is no longer invoked.
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * jQuery(element).on('click', _.before(5, addContactToList));
+     * // => Allows adding up to 4 contacts to the list.
+     */
+    function before(n, func) {
+      var result;
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      n = toInteger(n);
+      return function() {
+        if (--n > 0) {
+          result = func.apply(this, arguments);
+        }
+        if (n <= 1) {
+          func = undefined;
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function that invokes `func` with the `this` binding of `thisArg`
+     * and `partials` prepended to the arguments it receives.
+     *
+     * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
+     * may be used as a placeholder for partially applied arguments.
+     *
+     * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
+     * property of bound functions.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Function
+     * @param {Function} func The function to bind.
+     * @param {*} thisArg The `this` binding of `func`.
+     * @param {...*} [partials] The arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * function greet(greeting, punctuation) {
+     *   return greeting + ' ' + this.user + punctuation;
+     * }
+     *
+     * var object = { 'user': 'fred' };
+     *
+     * var bound = _.bind(greet, object, 'hi');
+     * bound('!');
+     * // => 'hi fred!'
+     *
+     * // Bound with placeholders.
+     * var bound = _.bind(greet, object, _, '!');
+     * bound('hi');
+     * // => 'hi fred!'
+     */
+    var bind = baseRest(function(func, thisArg, partials) {
+      var bitmask = WRAP_BIND_FLAG;
+      if (partials.length) {
+        var holders = replaceHolders(partials, getHolder(bind));
+        bitmask |= WRAP_PARTIAL_FLAG;
+      }
+      return createWrap(func, bitmask, thisArg, partials, holders);
+    });
+
+    /**
+     * Creates a function that invokes the method at `object[key]` with `partials`
+     * prepended to the arguments it receives.
+     *
+     * This method differs from `_.bind` by allowing bound functions to reference
+     * methods that may be redefined or don't yet exist. See
+     * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
+     * for more details.
+     *
+     * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
+     * builds, may be used as a placeholder for partially applied arguments.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.10.0
+     * @category Function
+     * @param {Object} object The object to invoke the method on.
+     * @param {string} key The key of the method.
+     * @param {...*} [partials] The arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var object = {
+     *   'user': 'fred',
+     *   'greet': function(greeting, punctuation) {
+     *     return greeting + ' ' + this.user + punctuation;
+     *   }
+     * };
+     *
+     * var bound = _.bindKey(object, 'greet', 'hi');
+     * bound('!');
+     * // => 'hi fred!'
+     *
+     * object.greet = function(greeting, punctuation) {
+     *   return greeting + 'ya ' + this.user + punctuation;
+     * };
+     *
+     * bound('!');
+     * // => 'hiya fred!'
+     *
+     * // Bound with placeholders.
+     * var bound = _.bindKey(object, 'greet', _, '!');
+     * bound('hi');
+     * // => 'hiya fred!'
+     */
+    var bindKey = baseRest(function(object, key, partials) {
+      var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
+      if (partials.length) {
+        var holders = replaceHolders(partials, getHolder(bindKey));
+        bitmask |= WRAP_PARTIAL_FLAG;
+      }
+      return createWrap(key, bitmask, object, partials, holders);
+    });
+
+    /**
+     * Creates a function that accepts arguments of `func` and either invokes
+     * `func` returning its result, if at least `arity` number of arguments have
+     * been provided, or returns a function that accepts the remaining `func`
+     * arguments, and so on. The arity of `func` may be specified if `func.length`
+     * is not sufficient.
+     *
+     * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
+     * may be used as a placeholder for provided arguments.
+     *
+     * **Note:** This method doesn't set the "length" property of curried functions.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @category Function
+     * @param {Function} func The function to curry.
+     * @param {number} [arity=func.length] The arity of `func`.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Function} Returns the new curried function.
+     * @example
+     *
+     * var abc = function(a, b, c) {
+     *   return [a, b, c];
+     * };
+     *
+     * var curried = _.curry(abc);
+     *
+     * curried(1)(2)(3);
+     * // => [1, 2, 3]
+     *
+     * curried(1, 2)(3);
+     * // => [1, 2, 3]
+     *
+     * curried(1, 2, 3);
+     * // => [1, 2, 3]
+     *
+     * // Curried with placeholders.
+     * curried(1)(_, 3)(2);
+     * // => [1, 2, 3]
+     */
+    function curry(func, arity, guard) {
+      arity = guard ? undefined : arity;
+      var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
+      result.placeholder = curry.placeholder;
+      return result;
+    }
+
+    /**
+     * This method is like `_.curry` except that arguments are applied to `func`
+     * in the manner of `_.partialRight` instead of `_.partial`.
+     *
+     * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
+     * builds, may be used as a placeholder for provided arguments.
+     *
+     * **Note:** This method doesn't set the "length" property of curried functions.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Function
+     * @param {Function} func The function to curry.
+     * @param {number} [arity=func.length] The arity of `func`.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Function} Returns the new curried function.
+     * @example
+     *
+     * var abc = function(a, b, c) {
+     *   return [a, b, c];
+     * };
+     *
+     * var curried = _.curryRight(abc);
+     *
+     * curried(3)(2)(1);
+     * // => [1, 2, 3]
+     *
+     * curried(2, 3)(1);
+     * // => [1, 2, 3]
+     *
+     * curried(1, 2, 3);
+     * // => [1, 2, 3]
+     *
+     * // Curried with placeholders.
+     * curried(3)(1, _)(2);
+     * // => [1, 2, 3]
+     */
+    function curryRight(func, arity, guard) {
+      arity = guard ? undefined : arity;
+      var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
+      result.placeholder = curryRight.placeholder;
+      return result;
+    }
+
+    /**
+     * Creates a debounced function that delays invoking `func` until after `wait`
+     * milliseconds have elapsed since the last time the debounced function was
+     * invoked. The debounced function comes with a `cancel` method to cancel
+     * delayed `func` invocations and a `flush` method to immediately invoke them.
+     * Provide `options` to indicate whether `func` should be invoked on the
+     * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
+     * with the last arguments provided to the debounced function. Subsequent
+     * calls to the debounced function return the result of the last `func`
+     * invocation.
+     *
+     * **Note:** If `leading` and `trailing` options are `true`, `func` is
+     * invoked on the trailing edge of the timeout only if the debounced function
+     * is invoked more than once during the `wait` timeout.
+     *
+     * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
+     * until to the next tick, similar to `setTimeout` with a timeout of `0`.
+     *
+     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
+     * for details over the differences between `_.debounce` and `_.throttle`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Function
+     * @param {Function} func The function to debounce.
+     * @param {number} [wait=0] The number of milliseconds to delay.
+     * @param {Object} [options={}] The options object.
+     * @param {boolean} [options.leading=false]
+     *  Specify invoking on the leading edge of the timeout.
+     * @param {number} [options.maxWait]
+     *  The maximum time `func` is allowed to be delayed before it's invoked.
+     * @param {boolean} [options.trailing=true]
+     *  Specify invoking on the trailing edge of the timeout.
+     * @returns {Function} Returns the new debounced function.
+     * @example
+     *
+     * // Avoid costly calculations while the window size is in flux.
+     * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
+     *
+     * // Invoke `sendMail` when clicked, debouncing subsequent calls.
+     * jQuery(element).on('click', _.debounce(sendMail, 300, {
+     *   'leading': true,
+     *   'trailing': false
+     * }));
+     *
+     * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
+     * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
+     * var source = new EventSource('/stream');
+     * jQuery(source).on('message', debounced);
+     *
+     * // Cancel the trailing debounced invocation.
+     * jQuery(window).on('popstate', debounced.cancel);
+     */
+    function debounce(func, wait, options) {
+      var lastArgs,
+          lastThis,
+          maxWait,
+          result,
+          timerId,
+          lastCallTime,
+          lastInvokeTime = 0,
+          leading = false,
+          maxing = false,
+          trailing = true;
+
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      wait = toNumber(wait) || 0;
+      if (isObject(options)) {
+        leading = !!options.leading;
+        maxing = 'maxWait' in options;
+        maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
+        trailing = 'trailing' in options ? !!options.trailing : trailing;
+      }
+
+      function invokeFunc(time) {
+        var args = lastArgs,
+            thisArg = lastThis;
+
+        lastArgs = lastThis = undefined;
+        lastInvokeTime = time;
+        result = func.apply(thisArg, args);
+        return result;
+      }
+
+      function leadingEdge(time) {
+        // Reset any `maxWait` timer.
+        lastInvokeTime = time;
+        // Start the timer for the trailing edge.
+        timerId = setTimeout(timerExpired, wait);
+        // Invoke the leading edge.
+        return leading ? invokeFunc(time) : result;
+      }
+
+      function remainingWait(time) {
+        var timeSinceLastCall = time - lastCallTime,
+            timeSinceLastInvoke = time - lastInvokeTime,
+            timeWaiting = wait - timeSinceLastCall;
+
+        return maxing
+          ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
+          : timeWaiting;
+      }
+
+      function shouldInvoke(time) {
+        var timeSinceLastCall = time - lastCallTime,
+            timeSinceLastInvoke = time - lastInvokeTime;
+
+        // Either this is the first call, activity has stopped and we're at the
+        // trailing edge, the system time has gone backwards and we're treating
+        // it as the trailing edge, or we've hit the `maxWait` limit.
+        return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
+          (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
+      }
+
+      function timerExpired() {
+        var time = now();
+        if (shouldInvoke(time)) {
+          return trailingEdge(time);
+        }
+        // Restart the timer.
+        timerId = setTimeout(timerExpired, remainingWait(time));
+      }
+
+      function trailingEdge(time) {
+        timerId = undefined;
+
+        // Only invoke if we have `lastArgs` which means `func` has been
+        // debounced at least once.
+        if (trailing && lastArgs) {
+          return invokeFunc(time);
+        }
+        lastArgs = lastThis = undefined;
+        return result;
+      }
+
+      function cancel() {
+        if (timerId !== undefined) {
+          clearTimeout(timerId);
+        }
+        lastInvokeTime = 0;
+        lastArgs = lastCallTime = lastThis = timerId = undefined;
+      }
+
+      function flush() {
+        return timerId === undefined ? result : trailingEdge(now());
+      }
+
+      function debounced() {
+        var time = now(),
+            isInvoking = shouldInvoke(time);
+
+        lastArgs = arguments;
+        lastThis = this;
+        lastCallTime = time;
+
+        if (isInvoking) {
+          if (timerId === undefined) {
+            return leadingEdge(lastCallTime);
+          }
+          if (maxing) {
+            // Handle invocations in a tight loop.
+            timerId = setTimeout(timerExpired, wait);
+            return invokeFunc(lastCallTime);
+          }
+        }
+        if (timerId === undefined) {
+          timerId = setTimeout(timerExpired, wait);
+        }
+        return result;
+      }
+      debounced.cancel = cancel;
+      debounced.flush = flush;
+      return debounced;
+    }
+
+    /**
+     * Defers invoking the `func` until the current call stack has cleared. Any
+     * additional arguments are provided to `func` when it's invoked.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Function
+     * @param {Function} func The function to defer.
+     * @param {...*} [args] The arguments to invoke `func` with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.defer(function(text) {
+     *   console.log(text);
+     * }, 'deferred');
+     * // => Logs 'deferred' after one millisecond.
+     */
+    var defer = baseRest(function(func, args) {
+      return baseDelay(func, 1, args);
+    });
+
+    /**
+     * Invokes `func` after `wait` milliseconds. Any additional arguments are
+     * provided to `func` when it's invoked.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Function
+     * @param {Function} func The function to delay.
+     * @param {number} wait The number of milliseconds to delay invocation.
+     * @param {...*} [args] The arguments to invoke `func` with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.delay(function(text) {
+     *   console.log(text);
+     * }, 1000, 'later');
+     * // => Logs 'later' after one second.
+     */
+    var delay = baseRest(function(func, wait, args) {
+      return baseDelay(func, toNumber(wait) || 0, args);
+    });
+
+    /**
+     * Creates a function that invokes `func` with arguments reversed.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Function
+     * @param {Function} func The function to flip arguments for.
+     * @returns {Function} Returns the new flipped function.
+     * @example
+     *
+     * var flipped = _.flip(function() {
+     *   return _.toArray(arguments);
+     * });
+     *
+     * flipped('a', 'b', 'c', 'd');
+     * // => ['d', 'c', 'b', 'a']
+     */
+    function flip(func) {
+      return createWrap(func, WRAP_FLIP_FLAG);
+    }
+
+    /**
+     * Creates a function that memoizes the result of `func`. If `resolver` is
+     * provided, it determines the cache key for storing the result based on the
+     * arguments provided to the memoized function. By default, the first argument
+     * provided to the memoized function is used as the map cache key. The `func`
+     * is invoked with the `this` binding of the memoized function.
+     *
+     * **Note:** The cache is exposed as the `cache` property on the memoized
+     * function. Its creation may be customized by replacing the `_.memoize.Cache`
+     * constructor with one whose instances implement the
+     * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
+     * method interface of `clear`, `delete`, `get`, `has`, and `set`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Function
+     * @param {Function} func The function to have its output memoized.
+     * @param {Function} [resolver] The function to resolve the cache key.
+     * @returns {Function} Returns the new memoized function.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': 2 };
+     * var other = { 'c': 3, 'd': 4 };
+     *
+     * var values = _.memoize(_.values);
+     * values(object);
+     * // => [1, 2]
+     *
+     * values(other);
+     * // => [3, 4]
+     *
+     * object.a = 2;
+     * values(object);
+     * // => [1, 2]
+     *
+     * // Modify the result cache.
+     * values.cache.set(object, ['a', 'b']);
+     * values(object);
+     * // => ['a', 'b']
+     *
+     * // Replace `_.memoize.Cache`.
+     * _.memoize.Cache = WeakMap;
+     */
+    function memoize(func, resolver) {
+      if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      var memoized = function() {
+        var args = arguments,
+            key = resolver ? resolver.apply(this, args) : args[0],
+            cache = memoized.cache;
+
+        if (cache.has(key)) {
+          return cache.get(key);
+        }
+        var result = func.apply(this, args);
+        memoized.cache = cache.set(key, result) || cache;
+        return result;
+      };
+      memoized.cache = new (memoize.Cache || MapCache);
+      return memoized;
+    }
+
+    // Expose `MapCache`.
+    memoize.Cache = MapCache;
+
+    /**
+     * Creates a function that negates the result of the predicate `func`. The
+     * `func` predicate is invoked with the `this` binding and arguments of the
+     * created function.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Function
+     * @param {Function} predicate The predicate to negate.
+     * @returns {Function} Returns the new negated function.
+     * @example
+     *
+     * function isEven(n) {
+     *   return n % 2 == 0;
+     * }
+     *
+     * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
+     * // => [1, 3, 5]
+     */
+    function negate(predicate) {
+      if (typeof predicate != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      return function() {
+        var args = arguments;
+        switch (args.length) {
+          case 0: return !predicate.call(this);
+          case 1: return !predicate.call(this, args[0]);
+          case 2: return !predicate.call(this, args[0], args[1]);
+          case 3: return !predicate.call(this, args[0], args[1], args[2]);
+        }
+        return !predicate.apply(this, args);
+      };
+    }
+
+    /**
+     * Creates a function that is restricted to invoking `func` once. Repeat calls
+     * to the function return the value of the first invocation. The `func` is
+     * invoked with the `this` binding and arguments of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Function
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var initialize = _.once(createApplication);
+     * initialize();
+     * initialize();
+     * // => `createApplication` is invoked once
+     */
+    function once(func) {
+      return before(2, func);
+    }
+
+    /**
+     * Creates a function that invokes `func` with its arguments transformed.
+     *
+     * @static
+     * @since 4.0.0
+     * @memberOf _
+     * @category Function
+     * @param {Function} func The function to wrap.
+     * @param {...(Function|Function[])} [transforms=[_.identity]]
+     *  The argument transforms.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * function doubled(n) {
+     *   return n * 2;
+     * }
+     *
+     * function square(n) {
+     *   return n * n;
+     * }
+     *
+     * var func = _.overArgs(function(x, y) {
+     *   return [x, y];
+     * }, [square, doubled]);
+     *
+     * func(9, 3);
+     * // => [81, 6]
+     *
+     * func(10, 5);
+     * // => [100, 10]
+     */
+    var overArgs = castRest(function(func, transforms) {
+      transforms = (transforms.length == 1 && isArray(transforms[0]))
+        ? arrayMap(transforms[0], baseUnary(getIteratee()))
+        : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
+
+      var funcsLength = transforms.length;
+      return baseRest(function(args) {
+        var index = -1,
+            length = nativeMin(args.length, funcsLength);
+
+        while (++index < length) {
+          args[index] = transforms[index].call(this, args[index]);
+        }
+        return apply(func, this, args);
+      });
+    });
+
+    /**
+     * Creates a function that invokes `func` with `partials` prepended to the
+     * arguments it receives. This method is like `_.bind` except it does **not**
+     * alter the `this` binding.
+     *
+     * The `_.partial.placeholder` value, which defaults to `_` in monolithic
+     * builds, may be used as a placeholder for partially applied arguments.
+     *
+     * **Note:** This method doesn't set the "length" property of partially
+     * applied functions.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.2.0
+     * @category Function
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [partials] The arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * function greet(greeting, name) {
+     *   return greeting + ' ' + name;
+     * }
+     *
+     * var sayHelloTo = _.partial(greet, 'hello');
+     * sayHelloTo('fred');
+     * // => 'hello fred'
+     *
+     * // Partially applied with placeholders.
+     * var greetFred = _.partial(greet, _, 'fred');
+     * greetFred('hi');
+     * // => 'hi fred'
+     */
+    var partial = baseRest(function(func, partials) {
+      var holders = replaceHolders(partials, getHolder(partial));
+      return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
+    });
+
+    /**
+     * This method is like `_.partial` except that partially applied arguments
+     * are appended to the arguments it receives.
+     *
+     * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
+     * builds, may be used as a placeholder for partially applied arguments.
+     *
+     * **Note:** This method doesn't set the "length" property of partially
+     * applied functions.
+     *
+     * @static
+     * @memberOf _
+     * @since 1.0.0
+     * @category Function
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [partials] The arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * function greet(greeting, name) {
+     *   return greeting + ' ' + name;
+     * }
+     *
+     * var greetFred = _.partialRight(greet, 'fred');
+     * greetFred('hi');
+     * // => 'hi fred'
+     *
+     * // Partially applied with placeholders.
+     * var sayHelloTo = _.partialRight(greet, 'hello', _);
+     * sayHelloTo('fred');
+     * // => 'hello fred'
+     */
+    var partialRight = baseRest(function(func, partials) {
+      var holders = replaceHolders(partials, getHolder(partialRight));
+      return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
+    });
+
+    /**
+     * Creates a function that invokes `func` with arguments arranged according
+     * to the specified `indexes` where the argument value at the first index is
+     * provided as the first argument, the argument value at the second index is
+     * provided as the second argument, and so on.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Function
+     * @param {Function} func The function to rearrange arguments for.
+     * @param {...(number|number[])} indexes The arranged argument indexes.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var rearged = _.rearg(function(a, b, c) {
+     *   return [a, b, c];
+     * }, [2, 0, 1]);
+     *
+     * rearged('b', 'c', 'a')
+     * // => ['a', 'b', 'c']
+     */
+    var rearg = flatRest(function(func, indexes) {
+      return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
+    });
+
+    /**
+     * Creates a function that invokes `func` with the `this` binding of the
+     * created function and arguments from `start` and beyond provided as
+     * an array.
+     *
+     * **Note:** This method is based on the
+     * [rest parameter](https://mdn.io/rest_parameters).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Function
+     * @param {Function} func The function to apply a rest parameter to.
+     * @param {number} [start=func.length-1] The start position of the rest parameter.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var say = _.rest(function(what, names) {
+     *   return what + ' ' + _.initial(names).join(', ') +
+     *     (_.size(names) > 1 ? ', & ' : '') + _.last(names);
+     * });
+     *
+     * say('hello', 'fred', 'barney', 'pebbles');
+     * // => 'hello fred, barney, & pebbles'
+     */
+    function rest(func, start) {
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      start = start === undefined ? start : toInteger(start);
+      return baseRest(func, start);
+    }
+
+    /**
+     * Creates a function that invokes `func` with the `this` binding of the
+     * create function and an array of arguments much like
+     * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
+     *
+     * **Note:** This method is based on the
+     * [spread operator](https://mdn.io/spread_operator).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.2.0
+     * @category Function
+     * @param {Function} func The function to spread arguments over.
+     * @param {number} [start=0] The start position of the spread.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var say = _.spread(function(who, what) {
+     *   return who + ' says ' + what;
+     * });
+     *
+     * say(['fred', 'hello']);
+     * // => 'fred says hello'
+     *
+     * var numbers = Promise.all([
+     *   Promise.resolve(40),
+     *   Promise.resolve(36)
+     * ]);
+     *
+     * numbers.then(_.spread(function(x, y) {
+     *   return x + y;
+     * }));
+     * // => a Promise of 76
+     */
+    function spread(func, start) {
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      start = start == null ? 0 : nativeMax(toInteger(start), 0);
+      return baseRest(function(args) {
+        var array = args[start],
+            otherArgs = castSlice(args, 0, start);
+
+        if (array) {
+          arrayPush(otherArgs, array);
+        }
+        return apply(func, this, otherArgs);
+      });
+    }
+
+    /**
+     * Creates a throttled function that only invokes `func` at most once per
+     * every `wait` milliseconds. The throttled function comes with a `cancel`
+     * method to cancel delayed `func` invocations and a `flush` method to
+     * immediately invoke them. Provide `options` to indicate whether `func`
+     * should be invoked on the leading and/or trailing edge of the `wait`
+     * timeout. The `func` is invoked with the last arguments provided to the
+     * throttled function. Subsequent calls to the throttled function return the
+     * result of the last `func` invocation.
+     *
+     * **Note:** If `leading` and `trailing` options are `true`, `func` is
+     * invoked on the trailing edge of the timeout only if the throttled function
+     * is invoked more than once during the `wait` timeout.
+     *
+     * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
+     * until to the next tick, similar to `setTimeout` with a timeout of `0`.
+     *
+     * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
+     * for details over the differences between `_.throttle` and `_.debounce`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Function
+     * @param {Function} func The function to throttle.
+     * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
+     * @param {Object} [options={}] The options object.
+     * @param {boolean} [options.leading=true]
+     *  Specify invoking on the leading edge of the timeout.
+     * @param {boolean} [options.trailing=true]
+     *  Specify invoking on the trailing edge of the timeout.
+     * @returns {Function} Returns the new throttled function.
+     * @example
+     *
+     * // Avoid excessively updating the position while scrolling.
+     * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
+     *
+     * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
+     * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
+     * jQuery(element).on('click', throttled);
+     *
+     * // Cancel the trailing throttled invocation.
+     * jQuery(window).on('popstate', throttled.cancel);
+     */
+    function throttle(func, wait, options) {
+      var leading = true,
+          trailing = true;
+
+      if (typeof func != 'function') {
+        throw new TypeError(FUNC_ERROR_TEXT);
+      }
+      if (isObject(options)) {
+        leading = 'leading' in options ? !!options.leading : leading;
+        trailing = 'trailing' in options ? !!options.trailing : trailing;
+      }
+      return debounce(func, wait, {
+        'leading': leading,
+        'maxWait': wait,
+        'trailing': trailing
+      });
+    }
+
+    /**
+     * Creates a function that accepts up to one argument, ignoring any
+     * additional arguments.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Function
+     * @param {Function} func The function to cap arguments for.
+     * @returns {Function} Returns the new capped function.
+     * @example
+     *
+     * _.map(['6', '8', '10'], _.unary(parseInt));
+     * // => [6, 8, 10]
+     */
+    function unary(func) {
+      return ary(func, 1);
+    }
+
+    /**
+     * Creates a function that provides `value` to `wrapper` as its first
+     * argument. Any additional arguments provided to the function are appended
+     * to those provided to the `wrapper`. The wrapper is invoked with the `this`
+     * binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Function
+     * @param {*} value The value to wrap.
+     * @param {Function} [wrapper=identity] The wrapper function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var p = _.wrap(_.escape, function(func, text) {
+     *   return '<p>' + func(text) + '</p>';
+     * });
+     *
+     * p('fred, barney, & pebbles');
+     * // => '<p>fred, barney, &amp; pebbles</p>'
+     */
+    function wrap(value, wrapper) {
+      return partial(castFunction(wrapper), value);
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Casts `value` as an array if it's not one.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.4.0
+     * @category Lang
+     * @param {*} value The value to inspect.
+     * @returns {Array} Returns the cast array.
+     * @example
+     *
+     * _.castArray(1);
+     * // => [1]
+     *
+     * _.castArray({ 'a': 1 });
+     * // => [{ 'a': 1 }]
+     *
+     * _.castArray('abc');
+     * // => ['abc']
+     *
+     * _.castArray(null);
+     * // => [null]
+     *
+     * _.castArray(undefined);
+     * // => [undefined]
+     *
+     * _.castArray();
+     * // => []
+     *
+     * var array = [1, 2, 3];
+     * console.log(_.castArray(array) === array);
+     * // => true
+     */
+    function castArray() {
+      if (!arguments.length) {
+        return [];
+      }
+      var value = arguments[0];
+      return isArray(value) ? value : [value];
+    }
+
+    /**
+     * Creates a shallow clone of `value`.
+     *
+     * **Note:** This method is loosely based on the
+     * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
+     * and supports cloning arrays, array buffers, booleans, date objects, maps,
+     * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
+     * arrays. The own enumerable properties of `arguments` objects are cloned
+     * as plain objects. An empty object is returned for uncloneable values such
+     * as error objects, functions, DOM nodes, and WeakMaps.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to clone.
+     * @returns {*} Returns the cloned value.
+     * @see _.cloneDeep
+     * @example
+     *
+     * var objects = [{ 'a': 1 }, { 'b': 2 }];
+     *
+     * var shallow = _.clone(objects);
+     * console.log(shallow[0] === objects[0]);
+     * // => true
+     */
+    function clone(value) {
+      return baseClone(value, CLONE_SYMBOLS_FLAG);
+    }
+
+    /**
+     * This method is like `_.clone` except that it accepts `customizer` which
+     * is invoked to produce the cloned value. If `customizer` returns `undefined`,
+     * cloning is handled by the method instead. The `customizer` is invoked with
+     * up to four arguments; (value [, index|key, object, stack]).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to clone.
+     * @param {Function} [customizer] The function to customize cloning.
+     * @returns {*} Returns the cloned value.
+     * @see _.cloneDeepWith
+     * @example
+     *
+     * function customizer(value) {
+     *   if (_.isElement(value)) {
+     *     return value.cloneNode(false);
+     *   }
+     * }
+     *
+     * var el = _.cloneWith(document.body, customizer);
+     *
+     * console.log(el === document.body);
+     * // => false
+     * console.log(el.nodeName);
+     * // => 'BODY'
+     * console.log(el.childNodes.length);
+     * // => 0
+     */
+    function cloneWith(value, customizer) {
+      customizer = typeof customizer == 'function' ? customizer : undefined;
+      return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
+    }
+
+    /**
+     * This method is like `_.clone` except that it recursively clones `value`.
+     *
+     * @static
+     * @memberOf _
+     * @since 1.0.0
+     * @category Lang
+     * @param {*} value The value to recursively clone.
+     * @returns {*} Returns the deep cloned value.
+     * @see _.clone
+     * @example
+     *
+     * var objects = [{ 'a': 1 }, { 'b': 2 }];
+     *
+     * var deep = _.cloneDeep(objects);
+     * console.log(deep[0] === objects[0]);
+     * // => false
+     */
+    function cloneDeep(value) {
+      return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
+    }
+
+    /**
+     * This method is like `_.cloneWith` except that it recursively clones `value`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to recursively clone.
+     * @param {Function} [customizer] The function to customize cloning.
+     * @returns {*} Returns the deep cloned value.
+     * @see _.cloneWith
+     * @example
+     *
+     * function customizer(value) {
+     *   if (_.isElement(value)) {
+     *     return value.cloneNode(true);
+     *   }
+     * }
+     *
+     * var el = _.cloneDeepWith(document.body, customizer);
+     *
+     * console.log(el === document.body);
+     * // => false
+     * console.log(el.nodeName);
+     * // => 'BODY'
+     * console.log(el.childNodes.length);
+     * // => 20
+     */
+    function cloneDeepWith(value, customizer) {
+      customizer = typeof customizer == 'function' ? customizer : undefined;
+      return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
+    }
+
+    /**
+     * Checks if `object` conforms to `source` by invoking the predicate
+     * properties of `source` with the corresponding property values of `object`.
+     *
+     * **Note:** This method is equivalent to `_.conforms` when `source` is
+     * partially applied.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.14.0
+     * @category Lang
+     * @param {Object} object The object to inspect.
+     * @param {Object} source The object of property predicates to conform to.
+     * @returns {boolean} Returns `true` if `object` conforms, else `false`.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': 2 };
+     *
+     * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
+     * // => true
+     *
+     * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
+     * // => false
+     */
+    function conformsTo(object, source) {
+      return source == null || baseConformsTo(object, source, keys(source));
+    }
+
+    /**
+     * Performs a
+     * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+     * comparison between two values to determine if they are equivalent.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     * @example
+     *
+     * var object = { 'a': 1 };
+     * var other = { 'a': 1 };
+     *
+     * _.eq(object, object);
+     * // => true
+     *
+     * _.eq(object, other);
+     * // => false
+     *
+     * _.eq('a', 'a');
+     * // => true
+     *
+     * _.eq('a', Object('a'));
+     * // => false
+     *
+     * _.eq(NaN, NaN);
+     * // => true
+     */
+    function eq(value, other) {
+      return value === other || (value !== value && other !== other);
+    }
+
+    /**
+     * Checks if `value` is greater than `other`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.9.0
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is greater than `other`,
+     *  else `false`.
+     * @see _.lt
+     * @example
+     *
+     * _.gt(3, 1);
+     * // => true
+     *
+     * _.gt(3, 3);
+     * // => false
+     *
+     * _.gt(1, 3);
+     * // => false
+     */
+    var gt = createRelationalOperation(baseGt);
+
+    /**
+     * Checks if `value` is greater than or equal to `other`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.9.0
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is greater than or equal to
+     *  `other`, else `false`.
+     * @see _.lte
+     * @example
+     *
+     * _.gte(3, 1);
+     * // => true
+     *
+     * _.gte(3, 3);
+     * // => true
+     *
+     * _.gte(1, 3);
+     * // => false
+     */
+    var gte = createRelationalOperation(function(value, other) {
+      return value >= other;
+    });
+
+    /**
+     * Checks if `value` is likely an `arguments` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+     *  else `false`.
+     * @example
+     *
+     * _.isArguments(function() { return arguments; }());
+     * // => true
+     *
+     * _.isArguments([1, 2, 3]);
+     * // => false
+     */
+    var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
+      return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
+        !propertyIsEnumerable.call(value, 'callee');
+    };
+
+    /**
+     * Checks if `value` is classified as an `Array` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an array, else `false`.
+     * @example
+     *
+     * _.isArray([1, 2, 3]);
+     * // => true
+     *
+     * _.isArray(document.body.children);
+     * // => false
+     *
+     * _.isArray('abc');
+     * // => false
+     *
+     * _.isArray(_.noop);
+     * // => false
+     */
+    var isArray = Array.isArray;
+
+    /**
+     * Checks if `value` is classified as an `ArrayBuffer` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.3.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
+     * @example
+     *
+     * _.isArrayBuffer(new ArrayBuffer(2));
+     * // => true
+     *
+     * _.isArrayBuffer(new Array(2));
+     * // => false
+     */
+    var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
+
+    /**
+     * Checks if `value` is array-like. A value is considered array-like if it's
+     * not a function and has a `value.length` that's an integer greater than or
+     * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+     * @example
+     *
+     * _.isArrayLike([1, 2, 3]);
+     * // => true
+     *
+     * _.isArrayLike(document.body.children);
+     * // => true
+     *
+     * _.isArrayLike('abc');
+     * // => true
+     *
+     * _.isArrayLike(_.noop);
+     * // => false
+     */
+    function isArrayLike(value) {
+      return value != null && isLength(value.length) && !isFunction(value);
+    }
+
+    /**
+     * This method is like `_.isArrayLike` except that it also checks if `value`
+     * is an object.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an array-like object,
+     *  else `false`.
+     * @example
+     *
+     * _.isArrayLikeObject([1, 2, 3]);
+     * // => true
+     *
+     * _.isArrayLikeObject(document.body.children);
+     * // => true
+     *
+     * _.isArrayLikeObject('abc');
+     * // => false
+     *
+     * _.isArrayLikeObject(_.noop);
+     * // => false
+     */
+    function isArrayLikeObject(value) {
+      return isObjectLike(value) && isArrayLike(value);
+    }
+
+    /**
+     * Checks if `value` is classified as a boolean primitive or object.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
+     * @example
+     *
+     * _.isBoolean(false);
+     * // => true
+     *
+     * _.isBoolean(null);
+     * // => false
+     */
+    function isBoolean(value) {
+      return value === true || value === false ||
+        (isObjectLike(value) && baseGetTag(value) == boolTag);
+    }
+
+    /**
+     * Checks if `value` is a buffer.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.3.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
+     * @example
+     *
+     * _.isBuffer(new Buffer(2));
+     * // => true
+     *
+     * _.isBuffer(new Uint8Array(2));
+     * // => false
+     */
+    var isBuffer = nativeIsBuffer || stubFalse;
+
+    /**
+     * Checks if `value` is classified as a `Date` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+     * @example
+     *
+     * _.isDate(new Date);
+     * // => true
+     *
+     * _.isDate('Mon April 23 2012');
+     * // => false
+     */
+    var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
+
+    /**
+     * Checks if `value` is likely a DOM element.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
+     * @example
+     *
+     * _.isElement(document.body);
+     * // => true
+     *
+     * _.isElement('<body>');
+     * // => false
+     */
+    function isElement(value) {
+      return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
+    }
+
+    /**
+     * Checks if `value` is an empty object, collection, map, or set.
+     *
+     * Objects are considered empty if they have no own enumerable string keyed
+     * properties.
+     *
+     * Array-like values such as `arguments` objects, arrays, buffers, strings, or
+     * jQuery-like collections are considered empty if they have a `length` of `0`.
+     * Similarly, maps and sets are considered empty if they have a `size` of `0`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is empty, else `false`.
+     * @example
+     *
+     * _.isEmpty(null);
+     * // => true
+     *
+     * _.isEmpty(true);
+     * // => true
+     *
+     * _.isEmpty(1);
+     * // => true
+     *
+     * _.isEmpty([1, 2, 3]);
+     * // => false
+     *
+     * _.isEmpty({ 'a': 1 });
+     * // => false
+     */
+    function isEmpty(value) {
+      if (value == null) {
+        return true;
+      }
+      if (isArrayLike(value) &&
+          (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
+            isBuffer(value) || isTypedArray(value) || isArguments(value))) {
+        return !value.length;
+      }
+      var tag = getTag(value);
+      if (tag == mapTag || tag == setTag) {
+        return !value.size;
+      }
+      if (isPrototype(value)) {
+        return !baseKeys(value).length;
+      }
+      for (var key in value) {
+        if (hasOwnProperty.call(value, key)) {
+          return false;
+        }
+      }
+      return true;
+    }
+
+    /**
+     * Performs a deep comparison between two values to determine if they are
+     * equivalent.
+     *
+     * **Note:** This method supports comparing arrays, array buffers, booleans,
+     * date objects, error objects, maps, numbers, `Object` objects, regexes,
+     * sets, strings, symbols, and typed arrays. `Object` objects are compared
+     * by their own, not inherited, enumerable properties. Functions and DOM
+     * nodes are compared by strict equality, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     * @example
+     *
+     * var object = { 'a': 1 };
+     * var other = { 'a': 1 };
+     *
+     * _.isEqual(object, other);
+     * // => true
+     *
+     * object === other;
+     * // => false
+     */
+    function isEqual(value, other) {
+      return baseIsEqual(value, other);
+    }
+
+    /**
+     * This method is like `_.isEqual` except that it accepts `customizer` which
+     * is invoked to compare values. If `customizer` returns `undefined`, comparisons
+     * are handled by the method instead. The `customizer` is invoked with up to
+     * six arguments: (objValue, othValue [, index|key, object, other, stack]).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @param {Function} [customizer] The function to customize comparisons.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     * @example
+     *
+     * function isGreeting(value) {
+     *   return /^h(?:i|ello)$/.test(value);
+     * }
+     *
+     * function customizer(objValue, othValue) {
+     *   if (isGreeting(objValue) && isGreeting(othValue)) {
+     *     return true;
+     *   }
+     * }
+     *
+     * var array = ['hello', 'goodbye'];
+     * var other = ['hi', 'goodbye'];
+     *
+     * _.isEqualWith(array, other, customizer);
+     * // => true
+     */
+    function isEqualWith(value, other, customizer) {
+      customizer = typeof customizer == 'function' ? customizer : undefined;
+      var result = customizer ? customizer(value, other) : undefined;
+      return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
+    }
+
+    /**
+     * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
+     * `SyntaxError`, `TypeError`, or `URIError` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
+     * @example
+     *
+     * _.isError(new Error);
+     * // => true
+     *
+     * _.isError(Error);
+     * // => false
+     */
+    function isError(value) {
+      if (!isObjectLike(value)) {
+        return false;
+      }
+      var tag = baseGetTag(value);
+      return tag == errorTag || tag == domExcTag ||
+        (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
+    }
+
+    /**
+     * Checks if `value` is a finite primitive number.
+     *
+     * **Note:** This method is based on
+     * [`Number.isFinite`](https://mdn.io/Number/isFinite).
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
+     * @example
+     *
+     * _.isFinite(3);
+     * // => true
+     *
+     * _.isFinite(Number.MIN_VALUE);
+     * // => true
+     *
+     * _.isFinite(Infinity);
+     * // => false
+     *
+     * _.isFinite('3');
+     * // => false
+     */
+    function isFinite(value) {
+      return typeof value == 'number' && nativeIsFinite(value);
+    }
+
+    /**
+     * Checks if `value` is classified as a `Function` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a function, else `false`.
+     * @example
+     *
+     * _.isFunction(_);
+     * // => true
+     *
+     * _.isFunction(/abc/);
+     * // => false
+     */
+    function isFunction(value) {
+      if (!isObject(value)) {
+        return false;
+      }
+      // The use of `Object#toString` avoids issues with the `typeof` operator
+      // in Safari 9 which returns 'object' for typed arrays and other constructors.
+      var tag = baseGetTag(value);
+      return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
+    }
+
+    /**
+     * Checks if `value` is an integer.
+     *
+     * **Note:** This method is based on
+     * [`Number.isInteger`](https://mdn.io/Number/isInteger).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
+     * @example
+     *
+     * _.isInteger(3);
+     * // => true
+     *
+     * _.isInteger(Number.MIN_VALUE);
+     * // => false
+     *
+     * _.isInteger(Infinity);
+     * // => false
+     *
+     * _.isInteger('3');
+     * // => false
+     */
+    function isInteger(value) {
+      return typeof value == 'number' && value == toInteger(value);
+    }
+
+    /**
+     * Checks if `value` is a valid array-like length.
+     *
+     * **Note:** This method is loosely based on
+     * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+     * @example
+     *
+     * _.isLength(3);
+     * // => true
+     *
+     * _.isLength(Number.MIN_VALUE);
+     * // => false
+     *
+     * _.isLength(Infinity);
+     * // => false
+     *
+     * _.isLength('3');
+     * // => false
+     */
+    function isLength(value) {
+      return typeof value == 'number' &&
+        value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+    }
+
+    /**
+     * Checks if `value` is the
+     * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
+     * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+     * @example
+     *
+     * _.isObject({});
+     * // => true
+     *
+     * _.isObject([1, 2, 3]);
+     * // => true
+     *
+     * _.isObject(_.noop);
+     * // => true
+     *
+     * _.isObject(null);
+     * // => false
+     */
+    function isObject(value) {
+      var type = typeof value;
+      return value != null && (type == 'object' || type == 'function');
+    }
+
+    /**
+     * Checks if `value` is object-like. A value is object-like if it's not `null`
+     * and has a `typeof` result of "object".
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+     * @example
+     *
+     * _.isObjectLike({});
+     * // => true
+     *
+     * _.isObjectLike([1, 2, 3]);
+     * // => true
+     *
+     * _.isObjectLike(_.noop);
+     * // => false
+     *
+     * _.isObjectLike(null);
+     * // => false
+     */
+    function isObjectLike(value) {
+      return value != null && typeof value == 'object';
+    }
+
+    /**
+     * Checks if `value` is classified as a `Map` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.3.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a map, else `false`.
+     * @example
+     *
+     * _.isMap(new Map);
+     * // => true
+     *
+     * _.isMap(new WeakMap);
+     * // => false
+     */
+    var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
+
+    /**
+     * Performs a partial deep comparison between `object` and `source` to
+     * determine if `object` contains equivalent property values.
+     *
+     * **Note:** This method is equivalent to `_.matches` when `source` is
+     * partially applied.
+     *
+     * Partial comparisons will match empty array and empty object `source`
+     * values against any array or object value, respectively. See `_.isEqual`
+     * for a list of supported value comparisons.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Lang
+     * @param {Object} object The object to inspect.
+     * @param {Object} source The object of property values to match.
+     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': 2 };
+     *
+     * _.isMatch(object, { 'b': 2 });
+     * // => true
+     *
+     * _.isMatch(object, { 'b': 1 });
+     * // => false
+     */
+    function isMatch(object, source) {
+      return object === source || baseIsMatch(object, source, getMatchData(source));
+    }
+
+    /**
+     * This method is like `_.isMatch` except that it accepts `customizer` which
+     * is invoked to compare values. If `customizer` returns `undefined`, comparisons
+     * are handled by the method instead. The `customizer` is invoked with five
+     * arguments: (objValue, srcValue, index|key, object, source).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {Object} object The object to inspect.
+     * @param {Object} source The object of property values to match.
+     * @param {Function} [customizer] The function to customize comparisons.
+     * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+     * @example
+     *
+     * function isGreeting(value) {
+     *   return /^h(?:i|ello)$/.test(value);
+     * }
+     *
+     * function customizer(objValue, srcValue) {
+     *   if (isGreeting(objValue) && isGreeting(srcValue)) {
+     *     return true;
+     *   }
+     * }
+     *
+     * var object = { 'greeting': 'hello' };
+     * var source = { 'greeting': 'hi' };
+     *
+     * _.isMatchWith(object, source, customizer);
+     * // => true
+     */
+    function isMatchWith(object, source, customizer) {
+      customizer = typeof customizer == 'function' ? customizer : undefined;
+      return baseIsMatch(object, source, getMatchData(source), customizer);
+    }
+
+    /**
+     * Checks if `value` is `NaN`.
+     *
+     * **Note:** This method is based on
+     * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
+     * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
+     * `undefined` and other non-number values.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+     * @example
+     *
+     * _.isNaN(NaN);
+     * // => true
+     *
+     * _.isNaN(new Number(NaN));
+     * // => true
+     *
+     * isNaN(undefined);
+     * // => true
+     *
+     * _.isNaN(undefined);
+     * // => false
+     */
+    function isNaN(value) {
+      // An `NaN` primitive is the only value that is not equal to itself.
+      // Perform the `toStringTag` check first to avoid errors with some
+      // ActiveX objects in IE.
+      return isNumber(value) && value != +value;
+    }
+
+    /**
+     * Checks if `value` is a pristine native function.
+     *
+     * **Note:** This method can't reliably detect native functions in the presence
+     * of the core-js package because core-js circumvents this kind of detection.
+     * Despite multiple requests, the core-js maintainer has made it clear: any
+     * attempt to fix the detection will be obstructed. As a result, we're left
+     * with little choice but to throw an error. Unfortunately, this also affects
+     * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
+     * which rely on core-js.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a native function,
+     *  else `false`.
+     * @example
+     *
+     * _.isNative(Array.prototype.push);
+     * // => true
+     *
+     * _.isNative(_);
+     * // => false
+     */
+    function isNative(value) {
+      if (isMaskable(value)) {
+        throw new Error(CORE_ERROR_TEXT);
+      }
+      return baseIsNative(value);
+    }
+
+    /**
+     * Checks if `value` is `null`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
+     * @example
+     *
+     * _.isNull(null);
+     * // => true
+     *
+     * _.isNull(void 0);
+     * // => false
+     */
+    function isNull(value) {
+      return value === null;
+    }
+
+    /**
+     * Checks if `value` is `null` or `undefined`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
+     * @example
+     *
+     * _.isNil(null);
+     * // => true
+     *
+     * _.isNil(void 0);
+     * // => true
+     *
+     * _.isNil(NaN);
+     * // => false
+     */
+    function isNil(value) {
+      return value == null;
+    }
+
+    /**
+     * Checks if `value` is classified as a `Number` primitive or object.
+     *
+     * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
+     * classified as numbers, use the `_.isFinite` method.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a number, else `false`.
+     * @example
+     *
+     * _.isNumber(3);
+     * // => true
+     *
+     * _.isNumber(Number.MIN_VALUE);
+     * // => true
+     *
+     * _.isNumber(Infinity);
+     * // => true
+     *
+     * _.isNumber('3');
+     * // => false
+     */
+    function isNumber(value) {
+      return typeof value == 'number' ||
+        (isObjectLike(value) && baseGetTag(value) == numberTag);
+    }
+
+    /**
+     * Checks if `value` is a plain object, that is, an object created by the
+     * `Object` constructor or one with a `[[Prototype]]` of `null`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.8.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     * }
+     *
+     * _.isPlainObject(new Foo);
+     * // => false
+     *
+     * _.isPlainObject([1, 2, 3]);
+     * // => false
+     *
+     * _.isPlainObject({ 'x': 0, 'y': 0 });
+     * // => true
+     *
+     * _.isPlainObject(Object.create(null));
+     * // => true
+     */
+    function isPlainObject(value) {
+      if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
+        return false;
+      }
+      var proto = getPrototype(value);
+      if (proto === null) {
+        return true;
+      }
+      var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
+      return typeof Ctor == 'function' && Ctor instanceof Ctor &&
+        funcToString.call(Ctor) == objectCtorString;
+    }
+
+    /**
+     * Checks if `value` is classified as a `RegExp` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.1.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
+     * @example
+     *
+     * _.isRegExp(/abc/);
+     * // => true
+     *
+     * _.isRegExp('/abc/');
+     * // => false
+     */
+    var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
+
+    /**
+     * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
+     * double precision number which isn't the result of a rounded unsafe integer.
+     *
+     * **Note:** This method is based on
+     * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
+     * @example
+     *
+     * _.isSafeInteger(3);
+     * // => true
+     *
+     * _.isSafeInteger(Number.MIN_VALUE);
+     * // => false
+     *
+     * _.isSafeInteger(Infinity);
+     * // => false
+     *
+     * _.isSafeInteger('3');
+     * // => false
+     */
+    function isSafeInteger(value) {
+      return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
+    }
+
+    /**
+     * Checks if `value` is classified as a `Set` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.3.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a set, else `false`.
+     * @example
+     *
+     * _.isSet(new Set);
+     * // => true
+     *
+     * _.isSet(new WeakSet);
+     * // => false
+     */
+    var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
+
+    /**
+     * Checks if `value` is classified as a `String` primitive or object.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a string, else `false`.
+     * @example
+     *
+     * _.isString('abc');
+     * // => true
+     *
+     * _.isString(1);
+     * // => false
+     */
+    function isString(value) {
+      return typeof value == 'string' ||
+        (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
+    }
+
+    /**
+     * Checks if `value` is classified as a `Symbol` primitive or object.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
+     * @example
+     *
+     * _.isSymbol(Symbol.iterator);
+     * // => true
+     *
+     * _.isSymbol('abc');
+     * // => false
+     */
+    function isSymbol(value) {
+      return typeof value == 'symbol' ||
+        (isObjectLike(value) && baseGetTag(value) == symbolTag);
+    }
+
+    /**
+     * Checks if `value` is classified as a typed array.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
+     * @example
+     *
+     * _.isTypedArray(new Uint8Array);
+     * // => true
+     *
+     * _.isTypedArray([]);
+     * // => false
+     */
+    var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
+
+    /**
+     * Checks if `value` is `undefined`.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
+     * @example
+     *
+     * _.isUndefined(void 0);
+     * // => true
+     *
+     * _.isUndefined(null);
+     * // => false
+     */
+    function isUndefined(value) {
+      return value === undefined;
+    }
+
+    /**
+     * Checks if `value` is classified as a `WeakMap` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.3.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
+     * @example
+     *
+     * _.isWeakMap(new WeakMap);
+     * // => true
+     *
+     * _.isWeakMap(new Map);
+     * // => false
+     */
+    function isWeakMap(value) {
+      return isObjectLike(value) && getTag(value) == weakMapTag;
+    }
+
+    /**
+     * Checks if `value` is classified as a `WeakSet` object.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.3.0
+     * @category Lang
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
+     * @example
+     *
+     * _.isWeakSet(new WeakSet);
+     * // => true
+     *
+     * _.isWeakSet(new Set);
+     * // => false
+     */
+    function isWeakSet(value) {
+      return isObjectLike(value) && baseGetTag(value) == weakSetTag;
+    }
+
+    /**
+     * Checks if `value` is less than `other`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.9.0
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is less than `other`,
+     *  else `false`.
+     * @see _.gt
+     * @example
+     *
+     * _.lt(1, 3);
+     * // => true
+     *
+     * _.lt(3, 3);
+     * // => false
+     *
+     * _.lt(3, 1);
+     * // => false
+     */
+    var lt = createRelationalOperation(baseLt);
+
+    /**
+     * Checks if `value` is less than or equal to `other`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.9.0
+     * @category Lang
+     * @param {*} value The value to compare.
+     * @param {*} other The other value to compare.
+     * @returns {boolean} Returns `true` if `value` is less than or equal to
+     *  `other`, else `false`.
+     * @see _.gte
+     * @example
+     *
+     * _.lte(1, 3);
+     * // => true
+     *
+     * _.lte(3, 3);
+     * // => true
+     *
+     * _.lte(3, 1);
+     * // => false
+     */
+    var lte = createRelationalOperation(function(value, other) {
+      return value <= other;
+    });
+
+    /**
+     * Converts `value` to an array.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Lang
+     * @param {*} value The value to convert.
+     * @returns {Array} Returns the converted array.
+     * @example
+     *
+     * _.toArray({ 'a': 1, 'b': 2 });
+     * // => [1, 2]
+     *
+     * _.toArray('abc');
+     * // => ['a', 'b', 'c']
+     *
+     * _.toArray(1);
+     * // => []
+     *
+     * _.toArray(null);
+     * // => []
+     */
+    function toArray(value) {
+      if (!value) {
+        return [];
+      }
+      if (isArrayLike(value)) {
+        return isString(value) ? stringToArray(value) : copyArray(value);
+      }
+      if (symIterator && value[symIterator]) {
+        return iteratorToArray(value[symIterator]());
+      }
+      var tag = getTag(value),
+          func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
+
+      return func(value);
+    }
+
+    /**
+     * Converts `value` to a finite number.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.12.0
+     * @category Lang
+     * @param {*} value The value to convert.
+     * @returns {number} Returns the converted number.
+     * @example
+     *
+     * _.toFinite(3.2);
+     * // => 3.2
+     *
+     * _.toFinite(Number.MIN_VALUE);
+     * // => 5e-324
+     *
+     * _.toFinite(Infinity);
+     * // => 1.7976931348623157e+308
+     *
+     * _.toFinite('3.2');
+     * // => 3.2
+     */
+    function toFinite(value) {
+      if (!value) {
+        return value === 0 ? value : 0;
+      }
+      value = toNumber(value);
+      if (value === INFINITY || value === -INFINITY) {
+        var sign = (value < 0 ? -1 : 1);
+        return sign * MAX_INTEGER;
+      }
+      return value === value ? value : 0;
+    }
+
+    /**
+     * Converts `value` to an integer.
+     *
+     * **Note:** This method is loosely based on
+     * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to convert.
+     * @returns {number} Returns the converted integer.
+     * @example
+     *
+     * _.toInteger(3.2);
+     * // => 3
+     *
+     * _.toInteger(Number.MIN_VALUE);
+     * // => 0
+     *
+     * _.toInteger(Infinity);
+     * // => 1.7976931348623157e+308
+     *
+     * _.toInteger('3.2');
+     * // => 3
+     */
+    function toInteger(value) {
+      var result = toFinite(value),
+          remainder = result % 1;
+
+      return result === result ? (remainder ? result - remainder : result) : 0;
+    }
+
+    /**
+     * Converts `value` to an integer suitable for use as the length of an
+     * array-like object.
+     *
+     * **Note:** This method is based on
+     * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to convert.
+     * @returns {number} Returns the converted integer.
+     * @example
+     *
+     * _.toLength(3.2);
+     * // => 3
+     *
+     * _.toLength(Number.MIN_VALUE);
+     * // => 0
+     *
+     * _.toLength(Infinity);
+     * // => 4294967295
+     *
+     * _.toLength('3.2');
+     * // => 3
+     */
+    function toLength(value) {
+      return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
+    }
+
+    /**
+     * Converts `value` to a number.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to process.
+     * @returns {number} Returns the number.
+     * @example
+     *
+     * _.toNumber(3.2);
+     * // => 3.2
+     *
+     * _.toNumber(Number.MIN_VALUE);
+     * // => 5e-324
+     *
+     * _.toNumber(Infinity);
+     * // => Infinity
+     *
+     * _.toNumber('3.2');
+     * // => 3.2
+     */
+    function toNumber(value) {
+      if (typeof value == 'number') {
+        return value;
+      }
+      if (isSymbol(value)) {
+        return NAN;
+      }
+      if (isObject(value)) {
+        var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
+        value = isObject(other) ? (other + '') : other;
+      }
+      if (typeof value != 'string') {
+        return value === 0 ? value : +value;
+      }
+      value = value.replace(reTrim, '');
+      var isBinary = reIsBinary.test(value);
+      return (isBinary || reIsOctal.test(value))
+        ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
+        : (reIsBadHex.test(value) ? NAN : +value);
+    }
+
+    /**
+     * Converts `value` to a plain object flattening inherited enumerable string
+     * keyed properties of `value` to own properties of the plain object.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Lang
+     * @param {*} value The value to convert.
+     * @returns {Object} Returns the converted plain object.
+     * @example
+     *
+     * function Foo() {
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.assign({ 'a': 1 }, new Foo);
+     * // => { 'a': 1, 'b': 2 }
+     *
+     * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
+     * // => { 'a': 1, 'b': 2, 'c': 3 }
+     */
+    function toPlainObject(value) {
+      return copyObject(value, keysIn(value));
+    }
+
+    /**
+     * Converts `value` to a safe integer. A safe integer can be compared and
+     * represented correctly.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to convert.
+     * @returns {number} Returns the converted integer.
+     * @example
+     *
+     * _.toSafeInteger(3.2);
+     * // => 3
+     *
+     * _.toSafeInteger(Number.MIN_VALUE);
+     * // => 0
+     *
+     * _.toSafeInteger(Infinity);
+     * // => 9007199254740991
+     *
+     * _.toSafeInteger('3.2');
+     * // => 3
+     */
+    function toSafeInteger(value) {
+      return value
+        ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
+        : (value === 0 ? value : 0);
+    }
+
+    /**
+     * Converts `value` to a string. An empty string is returned for `null`
+     * and `undefined` values. The sign of `-0` is preserved.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Lang
+     * @param {*} value The value to convert.
+     * @returns {string} Returns the converted string.
+     * @example
+     *
+     * _.toString(null);
+     * // => ''
+     *
+     * _.toString(-0);
+     * // => '-0'
+     *
+     * _.toString([1, 2, 3]);
+     * // => '1,2,3'
+     */
+    function toString(value) {
+      return value == null ? '' : baseToString(value);
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Assigns own enumerable string keyed properties of source objects to the
+     * destination object. Source objects are applied from left to right.
+     * Subsequent sources overwrite property assignments of previous sources.
+     *
+     * **Note:** This method mutates `object` and is loosely based on
+     * [`Object.assign`](https://mdn.io/Object/assign).
+     *
+     * @static
+     * @memberOf _
+     * @since 0.10.0
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} [sources] The source objects.
+     * @returns {Object} Returns `object`.
+     * @see _.assignIn
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     * }
+     *
+     * function Bar() {
+     *   this.c = 3;
+     * }
+     *
+     * Foo.prototype.b = 2;
+     * Bar.prototype.d = 4;
+     *
+     * _.assign({ 'a': 0 }, new Foo, new Bar);
+     * // => { 'a': 1, 'c': 3 }
+     */
+    var assign = createAssigner(function(object, source) {
+      if (isPrototype(source) || isArrayLike(source)) {
+        copyObject(source, keys(source), object);
+        return;
+      }
+      for (var key in source) {
+        if (hasOwnProperty.call(source, key)) {
+          assignValue(object, key, source[key]);
+        }
+      }
+    });
+
+    /**
+     * This method is like `_.assign` except that it iterates over own and
+     * inherited source properties.
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @alias extend
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} [sources] The source objects.
+     * @returns {Object} Returns `object`.
+     * @see _.assign
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     * }
+     *
+     * function Bar() {
+     *   this.c = 3;
+     * }
+     *
+     * Foo.prototype.b = 2;
+     * Bar.prototype.d = 4;
+     *
+     * _.assignIn({ 'a': 0 }, new Foo, new Bar);
+     * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
+     */
+    var assignIn = createAssigner(function(object, source) {
+      copyObject(source, keysIn(source), object);
+    });
+
+    /**
+     * This method is like `_.assignIn` except that it accepts `customizer`
+     * which is invoked to produce the assigned values. If `customizer` returns
+     * `undefined`, assignment is handled by the method instead. The `customizer`
+     * is invoked with five arguments: (objValue, srcValue, key, object, source).
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @alias extendWith
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} sources The source objects.
+     * @param {Function} [customizer] The function to customize assigned values.
+     * @returns {Object} Returns `object`.
+     * @see _.assignWith
+     * @example
+     *
+     * function customizer(objValue, srcValue) {
+     *   return _.isUndefined(objValue) ? srcValue : objValue;
+     * }
+     *
+     * var defaults = _.partialRight(_.assignInWith, customizer);
+     *
+     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+     * // => { 'a': 1, 'b': 2 }
+     */
+    var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
+      copyObject(source, keysIn(source), object, customizer);
+    });
+
+    /**
+     * This method is like `_.assign` except that it accepts `customizer`
+     * which is invoked to produce the assigned values. If `customizer` returns
+     * `undefined`, assignment is handled by the method instead. The `customizer`
+     * is invoked with five arguments: (objValue, srcValue, key, object, source).
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} sources The source objects.
+     * @param {Function} [customizer] The function to customize assigned values.
+     * @returns {Object} Returns `object`.
+     * @see _.assignInWith
+     * @example
+     *
+     * function customizer(objValue, srcValue) {
+     *   return _.isUndefined(objValue) ? srcValue : objValue;
+     * }
+     *
+     * var defaults = _.partialRight(_.assignWith, customizer);
+     *
+     * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+     * // => { 'a': 1, 'b': 2 }
+     */
+    var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
+      copyObject(source, keys(source), object, customizer);
+    });
+
+    /**
+     * Creates an array of values corresponding to `paths` of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 1.0.0
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {...(string|string[])} [paths] The property paths to pick.
+     * @returns {Array} Returns the picked values.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
+     *
+     * _.at(object, ['a[0].b.c', 'a[1]']);
+     * // => [3, 4]
+     */
+    var at = flatRest(baseAt);
+
+    /**
+     * Creates an object that inherits from the `prototype` object. If a
+     * `properties` object is given, its own enumerable string keyed properties
+     * are assigned to the created object.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.3.0
+     * @category Object
+     * @param {Object} prototype The object to inherit from.
+     * @param {Object} [properties] The properties to assign to the object.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * function Circle() {
+     *   Shape.call(this);
+     * }
+     *
+     * Circle.prototype = _.create(Shape.prototype, {
+     *   'constructor': Circle
+     * });
+     *
+     * var circle = new Circle;
+     * circle instanceof Circle;
+     * // => true
+     *
+     * circle instanceof Shape;
+     * // => true
+     */
+    function create(prototype, properties) {
+      var result = baseCreate(prototype);
+      return properties == null ? result : baseAssign(result, properties);
+    }
+
+    /**
+     * Assigns own and inherited enumerable string keyed properties of source
+     * objects to the destination object for all destination properties that
+     * resolve to `undefined`. Source objects are applied from left to right.
+     * Once a property is set, additional values of the same property are ignored.
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} [sources] The source objects.
+     * @returns {Object} Returns `object`.
+     * @see _.defaultsDeep
+     * @example
+     *
+     * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+     * // => { 'a': 1, 'b': 2 }
+     */
+    var defaults = baseRest(function(object, sources) {
+      object = Object(object);
+
+      var index = -1;
+      var length = sources.length;
+      var guard = length > 2 ? sources[2] : undefined;
+
+      if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+        length = 1;
+      }
+
+      while (++index < length) {
+        var source = sources[index];
+        var props = keysIn(source);
+        var propsIndex = -1;
+        var propsLength = props.length;
+
+        while (++propsIndex < propsLength) {
+          var key = props[propsIndex];
+          var value = object[key];
+
+          if (value === undefined ||
+              (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
+            object[key] = source[key];
+          }
+        }
+      }
+
+      return object;
+    });
+
+    /**
+     * This method is like `_.defaults` except that it recursively assigns
+     * default properties.
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.10.0
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} [sources] The source objects.
+     * @returns {Object} Returns `object`.
+     * @see _.defaults
+     * @example
+     *
+     * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
+     * // => { 'a': { 'b': 2, 'c': 3 } }
+     */
+    var defaultsDeep = baseRest(function(args) {
+      args.push(undefined, customDefaultsMerge);
+      return apply(mergeWith, undefined, args);
+    });
+
+    /**
+     * This method is like `_.find` except that it returns the key of the first
+     * element `predicate` returns truthy for instead of the element itself.
+     *
+     * @static
+     * @memberOf _
+     * @since 1.1.0
+     * @category Object
+     * @param {Object} object The object to inspect.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {string|undefined} Returns the key of the matched element,
+     *  else `undefined`.
+     * @example
+     *
+     * var users = {
+     *   'barney':  { 'age': 36, 'active': true },
+     *   'fred':    { 'age': 40, 'active': false },
+     *   'pebbles': { 'age': 1,  'active': true }
+     * };
+     *
+     * _.findKey(users, function(o) { return o.age < 40; });
+     * // => 'barney' (iteration order is not guaranteed)
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.findKey(users, { 'age': 1, 'active': true });
+     * // => 'pebbles'
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.findKey(users, ['active', false]);
+     * // => 'fred'
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.findKey(users, 'active');
+     * // => 'barney'
+     */
+    function findKey(object, predicate) {
+      return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
+    }
+
+    /**
+     * This method is like `_.findKey` except that it iterates over elements of
+     * a collection in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @category Object
+     * @param {Object} object The object to inspect.
+     * @param {Function} [predicate=_.identity] The function invoked per iteration.
+     * @returns {string|undefined} Returns the key of the matched element,
+     *  else `undefined`.
+     * @example
+     *
+     * var users = {
+     *   'barney':  { 'age': 36, 'active': true },
+     *   'fred':    { 'age': 40, 'active': false },
+     *   'pebbles': { 'age': 1,  'active': true }
+     * };
+     *
+     * _.findLastKey(users, function(o) { return o.age < 40; });
+     * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.findLastKey(users, { 'age': 36, 'active': true });
+     * // => 'barney'
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.findLastKey(users, ['active', false]);
+     * // => 'fred'
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.findLastKey(users, 'active');
+     * // => 'pebbles'
+     */
+    function findLastKey(object, predicate) {
+      return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
+    }
+
+    /**
+     * Iterates over own and inherited enumerable string keyed properties of an
+     * object and invokes `iteratee` for each property. The iteratee is invoked
+     * with three arguments: (value, key, object). Iteratee functions may exit
+     * iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.3.0
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Object} Returns `object`.
+     * @see _.forInRight
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.forIn(new Foo, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
+     */
+    function forIn(object, iteratee) {
+      return object == null
+        ? object
+        : baseFor(object, getIteratee(iteratee, 3), keysIn);
+    }
+
+    /**
+     * This method is like `_.forIn` except that it iterates over properties of
+     * `object` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Object} Returns `object`.
+     * @see _.forIn
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.forInRight(new Foo, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
+     */
+    function forInRight(object, iteratee) {
+      return object == null
+        ? object
+        : baseForRight(object, getIteratee(iteratee, 3), keysIn);
+    }
+
+    /**
+     * Iterates over own enumerable string keyed properties of an object and
+     * invokes `iteratee` for each property. The iteratee is invoked with three
+     * arguments: (value, key, object). Iteratee functions may exit iteration
+     * early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.3.0
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Object} Returns `object`.
+     * @see _.forOwnRight
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.forOwn(new Foo, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => Logs 'a' then 'b' (iteration order is not guaranteed).
+     */
+    function forOwn(object, iteratee) {
+      return object && baseForOwn(object, getIteratee(iteratee, 3));
+    }
+
+    /**
+     * This method is like `_.forOwn` except that it iterates over properties of
+     * `object` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.0.0
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Object} Returns `object`.
+     * @see _.forOwn
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.forOwnRight(new Foo, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
+     */
+    function forOwnRight(object, iteratee) {
+      return object && baseForOwnRight(object, getIteratee(iteratee, 3));
+    }
+
+    /**
+     * Creates an array of function property names from own enumerable properties
+     * of `object`.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns the function names.
+     * @see _.functionsIn
+     * @example
+     *
+     * function Foo() {
+     *   this.a = _.constant('a');
+     *   this.b = _.constant('b');
+     * }
+     *
+     * Foo.prototype.c = _.constant('c');
+     *
+     * _.functions(new Foo);
+     * // => ['a', 'b']
+     */
+    function functions(object) {
+      return object == null ? [] : baseFunctions(object, keys(object));
+    }
+
+    /**
+     * Creates an array of function property names from own and inherited
+     * enumerable properties of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Object
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns the function names.
+     * @see _.functions
+     * @example
+     *
+     * function Foo() {
+     *   this.a = _.constant('a');
+     *   this.b = _.constant('b');
+     * }
+     *
+     * Foo.prototype.c = _.constant('c');
+     *
+     * _.functionsIn(new Foo);
+     * // => ['a', 'b', 'c']
+     */
+    function functionsIn(object) {
+      return object == null ? [] : baseFunctions(object, keysIn(object));
+    }
+
+    /**
+     * Gets the value at `path` of `object`. If the resolved value is
+     * `undefined`, the `defaultValue` is returned in its place.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.7.0
+     * @category Object
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path of the property to get.
+     * @param {*} [defaultValue] The value returned for `undefined` resolved values.
+     * @returns {*} Returns the resolved value.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+     *
+     * _.get(object, 'a[0].b.c');
+     * // => 3
+     *
+     * _.get(object, ['a', '0', 'b', 'c']);
+     * // => 3
+     *
+     * _.get(object, 'a.b.c', 'default');
+     * // => 'default'
+     */
+    function get(object, path, defaultValue) {
+      var result = object == null ? undefined : baseGet(object, path);
+      return result === undefined ? defaultValue : result;
+    }
+
+    /**
+     * Checks if `path` is a direct property of `object`.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path to check.
+     * @returns {boolean} Returns `true` if `path` exists, else `false`.
+     * @example
+     *
+     * var object = { 'a': { 'b': 2 } };
+     * var other = _.create({ 'a': _.create({ 'b': 2 }) });
+     *
+     * _.has(object, 'a');
+     * // => true
+     *
+     * _.has(object, 'a.b');
+     * // => true
+     *
+     * _.has(object, ['a', 'b']);
+     * // => true
+     *
+     * _.has(other, 'a');
+     * // => false
+     */
+    function has(object, path) {
+      return object != null && hasPath(object, path, baseHas);
+    }
+
+    /**
+     * Checks if `path` is a direct or inherited property of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Object
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path to check.
+     * @returns {boolean} Returns `true` if `path` exists, else `false`.
+     * @example
+     *
+     * var object = _.create({ 'a': _.create({ 'b': 2 }) });
+     *
+     * _.hasIn(object, 'a');
+     * // => true
+     *
+     * _.hasIn(object, 'a.b');
+     * // => true
+     *
+     * _.hasIn(object, ['a', 'b']);
+     * // => true
+     *
+     * _.hasIn(object, 'b');
+     * // => false
+     */
+    function hasIn(object, path) {
+      return object != null && hasPath(object, path, baseHasIn);
+    }
+
+    /**
+     * Creates an object composed of the inverted keys and values of `object`.
+     * If `object` contains duplicate values, subsequent values overwrite
+     * property assignments of previous values.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.7.0
+     * @category Object
+     * @param {Object} object The object to invert.
+     * @returns {Object} Returns the new inverted object.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': 2, 'c': 1 };
+     *
+     * _.invert(object);
+     * // => { '1': 'c', '2': 'b' }
+     */
+    var invert = createInverter(function(result, value, key) {
+      if (value != null &&
+          typeof value.toString != 'function') {
+        value = nativeObjectToString.call(value);
+      }
+
+      result[value] = key;
+    }, constant(identity));
+
+    /**
+     * This method is like `_.invert` except that the inverted object is generated
+     * from the results of running each element of `object` thru `iteratee`. The
+     * corresponding inverted value of each inverted key is an array of keys
+     * responsible for generating the inverted value. The iteratee is invoked
+     * with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.1.0
+     * @category Object
+     * @param {Object} object The object to invert.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {Object} Returns the new inverted object.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': 2, 'c': 1 };
+     *
+     * _.invertBy(object);
+     * // => { '1': ['a', 'c'], '2': ['b'] }
+     *
+     * _.invertBy(object, function(value) {
+     *   return 'group' + value;
+     * });
+     * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
+     */
+    var invertBy = createInverter(function(result, value, key) {
+      if (value != null &&
+          typeof value.toString != 'function') {
+        value = nativeObjectToString.call(value);
+      }
+
+      if (hasOwnProperty.call(result, value)) {
+        result[value].push(key);
+      } else {
+        result[value] = [key];
+      }
+    }, getIteratee);
+
+    /**
+     * Invokes the method at `path` of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Object
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path of the method to invoke.
+     * @param {...*} [args] The arguments to invoke the method with.
+     * @returns {*} Returns the result of the invoked method.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
+     *
+     * _.invoke(object, 'a[0].b.c.slice', 1, 3);
+     * // => [2, 3]
+     */
+    var invoke = baseRest(baseInvoke);
+
+    /**
+     * Creates an array of the own enumerable property names of `object`.
+     *
+     * **Note:** Non-object values are coerced to objects. See the
+     * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
+     * for more details.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.keys(new Foo);
+     * // => ['a', 'b'] (iteration order is not guaranteed)
+     *
+     * _.keys('hi');
+     * // => ['0', '1']
+     */
+    function keys(object) {
+      return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
+    }
+
+    /**
+     * Creates an array of the own and inherited enumerable property names of `object`.
+     *
+     * **Note:** Non-object values are coerced to objects.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property names.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.keysIn(new Foo);
+     * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
+     */
+    function keysIn(object) {
+      return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
+    }
+
+    /**
+     * The opposite of `_.mapValues`; this method creates an object with the
+     * same values as `object` and keys generated by running each own enumerable
+     * string keyed property of `object` thru `iteratee`. The iteratee is invoked
+     * with three arguments: (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.8.0
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Object} Returns the new mapped object.
+     * @see _.mapValues
+     * @example
+     *
+     * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
+     *   return key + value;
+     * });
+     * // => { 'a1': 1, 'b2': 2 }
+     */
+    function mapKeys(object, iteratee) {
+      var result = {};
+      iteratee = getIteratee(iteratee, 3);
+
+      baseForOwn(object, function(value, key, object) {
+        baseAssignValue(result, iteratee(value, key, object), value);
+      });
+      return result;
+    }
+
+    /**
+     * Creates an object with the same keys as `object` and values generated
+     * by running each own enumerable string keyed property of `object` thru
+     * `iteratee`. The iteratee is invoked with three arguments:
+     * (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @since 2.4.0
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Object} Returns the new mapped object.
+     * @see _.mapKeys
+     * @example
+     *
+     * var users = {
+     *   'fred':    { 'user': 'fred',    'age': 40 },
+     *   'pebbles': { 'user': 'pebbles', 'age': 1 }
+     * };
+     *
+     * _.mapValues(users, function(o) { return o.age; });
+     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.mapValues(users, 'age');
+     * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
+     */
+    function mapValues(object, iteratee) {
+      var result = {};
+      iteratee = getIteratee(iteratee, 3);
+
+      baseForOwn(object, function(value, key, object) {
+        baseAssignValue(result, key, iteratee(value, key, object));
+      });
+      return result;
+    }
+
+    /**
+     * This method is like `_.assign` except that it recursively merges own and
+     * inherited enumerable string keyed properties of source objects into the
+     * destination object. Source properties that resolve to `undefined` are
+     * skipped if a destination value exists. Array and plain object properties
+     * are merged recursively. Other objects and value types are overridden by
+     * assignment. Source objects are applied from left to right. Subsequent
+     * sources overwrite property assignments of previous sources.
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.5.0
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} [sources] The source objects.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var object = {
+     *   'a': [{ 'b': 2 }, { 'd': 4 }]
+     * };
+     *
+     * var other = {
+     *   'a': [{ 'c': 3 }, { 'e': 5 }]
+     * };
+     *
+     * _.merge(object, other);
+     * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
+     */
+    var merge = createAssigner(function(object, source, srcIndex) {
+      baseMerge(object, source, srcIndex);
+    });
+
+    /**
+     * This method is like `_.merge` except that it accepts `customizer` which
+     * is invoked to produce the merged values of the destination and source
+     * properties. If `customizer` returns `undefined`, merging is handled by the
+     * method instead. The `customizer` is invoked with six arguments:
+     * (objValue, srcValue, key, object, source, stack).
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Object
+     * @param {Object} object The destination object.
+     * @param {...Object} sources The source objects.
+     * @param {Function} customizer The function to customize assigned values.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function customizer(objValue, srcValue) {
+     *   if (_.isArray(objValue)) {
+     *     return objValue.concat(srcValue);
+     *   }
+     * }
+     *
+     * var object = { 'a': [1], 'b': [2] };
+     * var other = { 'a': [3], 'b': [4] };
+     *
+     * _.mergeWith(object, other, customizer);
+     * // => { 'a': [1, 3], 'b': [2, 4] }
+     */
+    var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
+      baseMerge(object, source, srcIndex, customizer);
+    });
+
+    /**
+     * The opposite of `_.pick`; this method creates an object composed of the
+     * own and inherited enumerable property paths of `object` that are not omitted.
+     *
+     * **Note:** This method is considerably slower than `_.pick`.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The source object.
+     * @param {...(string|string[])} [paths] The property paths to omit.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': '2', 'c': 3 };
+     *
+     * _.omit(object, ['a', 'c']);
+     * // => { 'b': '2' }
+     */
+    var omit = flatRest(function(object, paths) {
+      var result = {};
+      if (object == null) {
+        return result;
+      }
+      var isDeep = false;
+      paths = arrayMap(paths, function(path) {
+        path = castPath(path, object);
+        isDeep || (isDeep = path.length > 1);
+        return path;
+      });
+      copyObject(object, getAllKeysIn(object), result);
+      if (isDeep) {
+        result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
+      }
+      var length = paths.length;
+      while (length--) {
+        baseUnset(result, paths[length]);
+      }
+      return result;
+    });
+
+    /**
+     * The opposite of `_.pickBy`; this method creates an object composed of
+     * the own and inherited enumerable string keyed properties of `object` that
+     * `predicate` doesn't return truthy for. The predicate is invoked with two
+     * arguments: (value, key).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Object
+     * @param {Object} object The source object.
+     * @param {Function} [predicate=_.identity] The function invoked per property.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': '2', 'c': 3 };
+     *
+     * _.omitBy(object, _.isNumber);
+     * // => { 'b': '2' }
+     */
+    function omitBy(object, predicate) {
+      return pickBy(object, negate(getIteratee(predicate)));
+    }
+
+    /**
+     * Creates an object composed of the picked `object` properties.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The source object.
+     * @param {...(string|string[])} [paths] The property paths to pick.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': '2', 'c': 3 };
+     *
+     * _.pick(object, ['a', 'c']);
+     * // => { 'a': 1, 'c': 3 }
+     */
+    var pick = flatRest(function(object, paths) {
+      return object == null ? {} : basePick(object, paths);
+    });
+
+    /**
+     * Creates an object composed of the `object` properties `predicate` returns
+     * truthy for. The predicate is invoked with two arguments: (value, key).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Object
+     * @param {Object} object The source object.
+     * @param {Function} [predicate=_.identity] The function invoked per property.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * var object = { 'a': 1, 'b': '2', 'c': 3 };
+     *
+     * _.pickBy(object, _.isNumber);
+     * // => { 'a': 1, 'c': 3 }
+     */
+    function pickBy(object, predicate) {
+      if (object == null) {
+        return {};
+      }
+      var props = arrayMap(getAllKeysIn(object), function(prop) {
+        return [prop];
+      });
+      predicate = getIteratee(predicate);
+      return basePickBy(object, props, function(value, path) {
+        return predicate(value, path[0]);
+      });
+    }
+
+    /**
+     * This method is like `_.get` except that if the resolved value is a
+     * function it's invoked with the `this` binding of its parent object and
+     * its result is returned.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @param {Array|string} path The path of the property to resolve.
+     * @param {*} [defaultValue] The value returned for `undefined` resolved values.
+     * @returns {*} Returns the resolved value.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
+     *
+     * _.result(object, 'a[0].b.c1');
+     * // => 3
+     *
+     * _.result(object, 'a[0].b.c2');
+     * // => 4
+     *
+     * _.result(object, 'a[0].b.c3', 'default');
+     * // => 'default'
+     *
+     * _.result(object, 'a[0].b.c3', _.constant('default'));
+     * // => 'default'
+     */
+    function result(object, path, defaultValue) {
+      path = castPath(path, object);
+
+      var index = -1,
+          length = path.length;
+
+      // Ensure the loop is entered when path is empty.
+      if (!length) {
+        length = 1;
+        object = undefined;
+      }
+      while (++index < length) {
+        var value = object == null ? undefined : object[toKey(path[index])];
+        if (value === undefined) {
+          index = length;
+          value = defaultValue;
+        }
+        object = isFunction(value) ? value.call(object) : value;
+      }
+      return object;
+    }
+
+    /**
+     * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
+     * it's created. Arrays are created for missing index properties while objects
+     * are created for all other missing properties. Use `_.setWith` to customize
+     * `path` creation.
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.7.0
+     * @category Object
+     * @param {Object} object The object to modify.
+     * @param {Array|string} path The path of the property to set.
+     * @param {*} value The value to set.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+     *
+     * _.set(object, 'a[0].b.c', 4);
+     * console.log(object.a[0].b.c);
+     * // => 4
+     *
+     * _.set(object, ['x', '0', 'y', 'z'], 5);
+     * console.log(object.x[0].y.z);
+     * // => 5
+     */
+    function set(object, path, value) {
+      return object == null ? object : baseSet(object, path, value);
+    }
+
+    /**
+     * This method is like `_.set` except that it accepts `customizer` which is
+     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`
+     * path creation is handled by the method instead. The `customizer` is invoked
+     * with three arguments: (nsValue, key, nsObject).
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Object
+     * @param {Object} object The object to modify.
+     * @param {Array|string} path The path of the property to set.
+     * @param {*} value The value to set.
+     * @param {Function} [customizer] The function to customize assigned values.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var object = {};
+     *
+     * _.setWith(object, '[0][1]', 'a', Object);
+     * // => { '0': { '1': 'a' } }
+     */
+    function setWith(object, path, value, customizer) {
+      customizer = typeof customizer == 'function' ? customizer : undefined;
+      return object == null ? object : baseSet(object, path, value, customizer);
+    }
+
+    /**
+     * Creates an array of own enumerable string keyed-value pairs for `object`
+     * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
+     * entries are returned.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @alias entries
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the key-value pairs.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.toPairs(new Foo);
+     * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
+     */
+    var toPairs = createToPairs(keys);
+
+    /**
+     * Creates an array of own and inherited enumerable string keyed-value pairs
+     * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
+     * or set, its entries are returned.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @alias entriesIn
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the key-value pairs.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.toPairsIn(new Foo);
+     * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
+     */
+    var toPairsIn = createToPairs(keysIn);
+
+    /**
+     * An alternative to `_.reduce`; this method transforms `object` to a new
+     * `accumulator` object which is the result of running each of its own
+     * enumerable string keyed properties thru `iteratee`, with each invocation
+     * potentially mutating the `accumulator` object. If `accumulator` is not
+     * provided, a new object with the same `[[Prototype]]` will be used. The
+     * iteratee is invoked with four arguments: (accumulator, value, key, object).
+     * Iteratee functions may exit iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @since 1.3.0
+     * @category Object
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @param {*} [accumulator] The custom accumulator value.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * _.transform([2, 3, 4], function(result, n) {
+     *   result.push(n *= n);
+     *   return n % 2 == 0;
+     * }, []);
+     * // => [4, 9]
+     *
+     * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
+     *   (result[value] || (result[value] = [])).push(key);
+     * }, {});
+     * // => { '1': ['a', 'c'], '2': ['b'] }
+     */
+    function transform(object, iteratee, accumulator) {
+      var isArr = isArray(object),
+          isArrLike = isArr || isBuffer(object) || isTypedArray(object);
+
+      iteratee = getIteratee(iteratee, 4);
+      if (accumulator == null) {
+        var Ctor = object && object.constructor;
+        if (isArrLike) {
+          accumulator = isArr ? new Ctor : [];
+        }
+        else if (isObject(object)) {
+          accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
+        }
+        else {
+          accumulator = {};
+        }
+      }
+      (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
+        return iteratee(accumulator, value, index, object);
+      });
+      return accumulator;
+    }
+
+    /**
+     * Removes the property at `path` of `object`.
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Object
+     * @param {Object} object The object to modify.
+     * @param {Array|string} path The path of the property to unset.
+     * @returns {boolean} Returns `true` if the property is deleted, else `false`.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c': 7 } }] };
+     * _.unset(object, 'a[0].b.c');
+     * // => true
+     *
+     * console.log(object);
+     * // => { 'a': [{ 'b': {} }] };
+     *
+     * _.unset(object, ['a', '0', 'b', 'c']);
+     * // => true
+     *
+     * console.log(object);
+     * // => { 'a': [{ 'b': {} }] };
+     */
+    function unset(object, path) {
+      return object == null ? true : baseUnset(object, path);
+    }
+
+    /**
+     * This method is like `_.set` except that accepts `updater` to produce the
+     * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
+     * is invoked with one argument: (value).
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.6.0
+     * @category Object
+     * @param {Object} object The object to modify.
+     * @param {Array|string} path The path of the property to set.
+     * @param {Function} updater The function to produce the updated value.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+     *
+     * _.update(object, 'a[0].b.c', function(n) { return n * n; });
+     * console.log(object.a[0].b.c);
+     * // => 9
+     *
+     * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
+     * console.log(object.x[0].y.z);
+     * // => 0
+     */
+    function update(object, path, updater) {
+      return object == null ? object : baseUpdate(object, path, castFunction(updater));
+    }
+
+    /**
+     * This method is like `_.update` except that it accepts `customizer` which is
+     * invoked to produce the objects of `path`.  If `customizer` returns `undefined`
+     * path creation is handled by the method instead. The `customizer` is invoked
+     * with three arguments: (nsValue, key, nsObject).
+     *
+     * **Note:** This method mutates `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.6.0
+     * @category Object
+     * @param {Object} object The object to modify.
+     * @param {Array|string} path The path of the property to set.
+     * @param {Function} updater The function to produce the updated value.
+     * @param {Function} [customizer] The function to customize assigned values.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var object = {};
+     *
+     * _.updateWith(object, '[0][1]', _.constant('a'), Object);
+     * // => { '0': { '1': 'a' } }
+     */
+    function updateWith(object, path, updater, customizer) {
+      customizer = typeof customizer == 'function' ? customizer : undefined;
+      return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
+    }
+
+    /**
+     * Creates an array of the own enumerable string keyed property values of `object`.
+     *
+     * **Note:** Non-object values are coerced to objects.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property values.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.values(new Foo);
+     * // => [1, 2] (iteration order is not guaranteed)
+     *
+     * _.values('hi');
+     * // => ['h', 'i']
+     */
+    function values(object) {
+      return object == null ? [] : baseValues(object, keys(object));
+    }
+
+    /**
+     * Creates an array of the own and inherited enumerable string keyed property
+     * values of `object`.
+     *
+     * **Note:** Non-object values are coerced to objects.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Object
+     * @param {Object} object The object to query.
+     * @returns {Array} Returns the array of property values.
+     * @example
+     *
+     * function Foo() {
+     *   this.a = 1;
+     *   this.b = 2;
+     * }
+     *
+     * Foo.prototype.c = 3;
+     *
+     * _.valuesIn(new Foo);
+     * // => [1, 2, 3] (iteration order is not guaranteed)
+     */
+    function valuesIn(object) {
+      return object == null ? [] : baseValues(object, keysIn(object));
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Clamps `number` within the inclusive `lower` and `upper` bounds.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Number
+     * @param {number} number The number to clamp.
+     * @param {number} [lower] The lower bound.
+     * @param {number} upper The upper bound.
+     * @returns {number} Returns the clamped number.
+     * @example
+     *
+     * _.clamp(-10, -5, 5);
+     * // => -5
+     *
+     * _.clamp(10, -5, 5);
+     * // => 5
+     */
+    function clamp(number, lower, upper) {
+      if (upper === undefined) {
+        upper = lower;
+        lower = undefined;
+      }
+      if (upper !== undefined) {
+        upper = toNumber(upper);
+        upper = upper === upper ? upper : 0;
+      }
+      if (lower !== undefined) {
+        lower = toNumber(lower);
+        lower = lower === lower ? lower : 0;
+      }
+      return baseClamp(toNumber(number), lower, upper);
+    }
+
+    /**
+     * Checks if `n` is between `start` and up to, but not including, `end`. If
+     * `end` is not specified, it's set to `start` with `start` then set to `0`.
+     * If `start` is greater than `end` the params are swapped to support
+     * negative ranges.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.3.0
+     * @category Number
+     * @param {number} number The number to check.
+     * @param {number} [start=0] The start of the range.
+     * @param {number} end The end of the range.
+     * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
+     * @see _.range, _.rangeRight
+     * @example
+     *
+     * _.inRange(3, 2, 4);
+     * // => true
+     *
+     * _.inRange(4, 8);
+     * // => true
+     *
+     * _.inRange(4, 2);
+     * // => false
+     *
+     * _.inRange(2, 2);
+     * // => false
+     *
+     * _.inRange(1.2, 2);
+     * // => true
+     *
+     * _.inRange(5.2, 4);
+     * // => false
+     *
+     * _.inRange(-3, -2, -6);
+     * // => true
+     */
+    function inRange(number, start, end) {
+      start = toFinite(start);
+      if (end === undefined) {
+        end = start;
+        start = 0;
+      } else {
+        end = toFinite(end);
+      }
+      number = toNumber(number);
+      return baseInRange(number, start, end);
+    }
+
+    /**
+     * Produces a random number between the inclusive `lower` and `upper` bounds.
+     * If only one argument is provided a number between `0` and the given number
+     * is returned. If `floating` is `true`, or either `lower` or `upper` are
+     * floats, a floating-point number is returned instead of an integer.
+     *
+     * **Note:** JavaScript follows the IEEE-754 standard for resolving
+     * floating-point values which can produce unexpected results.
+     *
+     * @static
+     * @memberOf _
+     * @since 0.7.0
+     * @category Number
+     * @param {number} [lower=0] The lower bound.
+     * @param {number} [upper=1] The upper bound.
+     * @param {boolean} [floating] Specify returning a floating-point number.
+     * @returns {number} Returns the random number.
+     * @example
+     *
+     * _.random(0, 5);
+     * // => an integer between 0 and 5
+     *
+     * _.random(5);
+     * // => also an integer between 0 and 5
+     *
+     * _.random(5, true);
+     * // => a floating-point number between 0 and 5
+     *
+     * _.random(1.2, 5.2);
+     * // => a floating-point number between 1.2 and 5.2
+     */
+    function random(lower, upper, floating) {
+      if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
+        upper = floating = undefined;
+      }
+      if (floating === undefined) {
+        if (typeof upper == 'boolean') {
+          floating = upper;
+          upper = undefined;
+        }
+        else if (typeof lower == 'boolean') {
+          floating = lower;
+          lower = undefined;
+        }
+      }
+      if (lower === undefined && upper === undefined) {
+        lower = 0;
+        upper = 1;
+      }
+      else {
+        lower = toFinite(lower);
+        if (upper === undefined) {
+          upper = lower;
+          lower = 0;
+        } else {
+          upper = toFinite(upper);
+        }
+      }
+      if (lower > upper) {
+        var temp = lower;
+        lower = upper;
+        upper = temp;
+      }
+      if (floating || lower % 1 || upper % 1) {
+        var rand = nativeRandom();
+        return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
+      }
+      return baseRandom(lower, upper);
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the camel cased string.
+     * @example
+     *
+     * _.camelCase('Foo Bar');
+     * // => 'fooBar'
+     *
+     * _.camelCase('--foo-bar--');
+     * // => 'fooBar'
+     *
+     * _.camelCase('__FOO_BAR__');
+     * // => 'fooBar'
+     */
+    var camelCase = createCompounder(function(result, word, index) {
+      word = word.toLowerCase();
+      return result + (index ? capitalize(word) : word);
+    });
+
+    /**
+     * Converts the first character of `string` to upper case and the remaining
+     * to lower case.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to capitalize.
+     * @returns {string} Returns the capitalized string.
+     * @example
+     *
+     * _.capitalize('FRED');
+     * // => 'Fred'
+     */
+    function capitalize(string) {
+      return upperFirst(toString(string).toLowerCase());
+    }
+
+    /**
+     * Deburrs `string` by converting
+     * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
+     * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
+     * letters to basic Latin letters and removing
+     * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to deburr.
+     * @returns {string} Returns the deburred string.
+     * @example
+     *
+     * _.deburr('déjà vu');
+     * // => 'deja vu'
+     */
+    function deburr(string) {
+      string = toString(string);
+      return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
+    }
+
+    /**
+     * Checks if `string` ends with the given target string.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to inspect.
+     * @param {string} [target] The string to search for.
+     * @param {number} [position=string.length] The position to search up to.
+     * @returns {boolean} Returns `true` if `string` ends with `target`,
+     *  else `false`.
+     * @example
+     *
+     * _.endsWith('abc', 'c');
+     * // => true
+     *
+     * _.endsWith('abc', 'b');
+     * // => false
+     *
+     * _.endsWith('abc', 'b', 2);
+     * // => true
+     */
+    function endsWith(string, target, position) {
+      string = toString(string);
+      target = baseToString(target);
+
+      var length = string.length;
+      position = position === undefined
+        ? length
+        : baseClamp(toInteger(position), 0, length);
+
+      var end = position;
+      position -= target.length;
+      return position >= 0 && string.slice(position, end) == target;
+    }
+
+    /**
+     * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
+     * corresponding HTML entities.
+     *
+     * **Note:** No other characters are escaped. To escape additional
+     * characters use a third-party library like [_he_](https://mths.be/he).
+     *
+     * Though the ">" character is escaped for symmetry, characters like
+     * ">" and "/" don't need escaping in HTML and have no special meaning
+     * unless they're part of a tag or unquoted attribute value. See
+     * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
+     * (under "semi-related fun fact") for more details.
+     *
+     * When working with HTML you should always
+     * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
+     * XSS vectors.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The string to escape.
+     * @returns {string} Returns the escaped string.
+     * @example
+     *
+     * _.escape('fred, barney, & pebbles');
+     * // => 'fred, barney, &amp; pebbles'
+     */
+    function escape(string) {
+      string = toString(string);
+      return (string && reHasUnescapedHtml.test(string))
+        ? string.replace(reUnescapedHtml, escapeHtmlChar)
+        : string;
+    }
+
+    /**
+     * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
+     * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to escape.
+     * @returns {string} Returns the escaped string.
+     * @example
+     *
+     * _.escapeRegExp('[lodash](https://lodash.com/)');
+     * // => '\[lodash\]\(https://lodash\.com/\)'
+     */
+    function escapeRegExp(string) {
+      string = toString(string);
+      return (string && reHasRegExpChar.test(string))
+        ? string.replace(reRegExpChar, '\\$&')
+        : string;
+    }
+
+    /**
+     * Converts `string` to
+     * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the kebab cased string.
+     * @example
+     *
+     * _.kebabCase('Foo Bar');
+     * // => 'foo-bar'
+     *
+     * _.kebabCase('fooBar');
+     * // => 'foo-bar'
+     *
+     * _.kebabCase('__FOO_BAR__');
+     * // => 'foo-bar'
+     */
+    var kebabCase = createCompounder(function(result, word, index) {
+      return result + (index ? '-' : '') + word.toLowerCase();
+    });
+
+    /**
+     * Converts `string`, as space separated words, to lower case.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the lower cased string.
+     * @example
+     *
+     * _.lowerCase('--Foo-Bar--');
+     * // => 'foo bar'
+     *
+     * _.lowerCase('fooBar');
+     * // => 'foo bar'
+     *
+     * _.lowerCase('__FOO_BAR__');
+     * // => 'foo bar'
+     */
+    var lowerCase = createCompounder(function(result, word, index) {
+      return result + (index ? ' ' : '') + word.toLowerCase();
+    });
+
+    /**
+     * Converts the first character of `string` to lower case.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the converted string.
+     * @example
+     *
+     * _.lowerFirst('Fred');
+     * // => 'fred'
+     *
+     * _.lowerFirst('FRED');
+     * // => 'fRED'
+     */
+    var lowerFirst = createCaseFirst('toLowerCase');
+
+    /**
+     * Pads `string` on the left and right sides if it's shorter than `length`.
+     * Padding characters are truncated if they can't be evenly divided by `length`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to pad.
+     * @param {number} [length=0] The padding length.
+     * @param {string} [chars=' '] The string used as padding.
+     * @returns {string} Returns the padded string.
+     * @example
+     *
+     * _.pad('abc', 8);
+     * // => '  abc   '
+     *
+     * _.pad('abc', 8, '_-');
+     * // => '_-abc_-_'
+     *
+     * _.pad('abc', 3);
+     * // => 'abc'
+     */
+    function pad(string, length, chars) {
+      string = toString(string);
+      length = toInteger(length);
+
+      var strLength = length ? stringSize(string) : 0;
+      if (!length || strLength >= length) {
+        return string;
+      }
+      var mid = (length - strLength) / 2;
+      return (
+        createPadding(nativeFloor(mid), chars) +
+        string +
+        createPadding(nativeCeil(mid), chars)
+      );
+    }
+
+    /**
+     * Pads `string` on the right side if it's shorter than `length`. Padding
+     * characters are truncated if they exceed `length`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to pad.
+     * @param {number} [length=0] The padding length.
+     * @param {string} [chars=' '] The string used as padding.
+     * @returns {string} Returns the padded string.
+     * @example
+     *
+     * _.padEnd('abc', 6);
+     * // => 'abc   '
+     *
+     * _.padEnd('abc', 6, '_-');
+     * // => 'abc_-_'
+     *
+     * _.padEnd('abc', 3);
+     * // => 'abc'
+     */
+    function padEnd(string, length, chars) {
+      string = toString(string);
+      length = toInteger(length);
+
+      var strLength = length ? stringSize(string) : 0;
+      return (length && strLength < length)
+        ? (string + createPadding(length - strLength, chars))
+        : string;
+    }
+
+    /**
+     * Pads `string` on the left side if it's shorter than `length`. Padding
+     * characters are truncated if they exceed `length`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to pad.
+     * @param {number} [length=0] The padding length.
+     * @param {string} [chars=' '] The string used as padding.
+     * @returns {string} Returns the padded string.
+     * @example
+     *
+     * _.padStart('abc', 6);
+     * // => '   abc'
+     *
+     * _.padStart('abc', 6, '_-');
+     * // => '_-_abc'
+     *
+     * _.padStart('abc', 3);
+     * // => 'abc'
+     */
+    function padStart(string, length, chars) {
+      string = toString(string);
+      length = toInteger(length);
+
+      var strLength = length ? stringSize(string) : 0;
+      return (length && strLength < length)
+        ? (createPadding(length - strLength, chars) + string)
+        : string;
+    }
+
+    /**
+     * Converts `string` to an integer of the specified radix. If `radix` is
+     * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
+     * hexadecimal, in which case a `radix` of `16` is used.
+     *
+     * **Note:** This method aligns with the
+     * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
+     *
+     * @static
+     * @memberOf _
+     * @since 1.1.0
+     * @category String
+     * @param {string} string The string to convert.
+     * @param {number} [radix=10] The radix to interpret `value` by.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {number} Returns the converted integer.
+     * @example
+     *
+     * _.parseInt('08');
+     * // => 8
+     *
+     * _.map(['6', '08', '10'], _.parseInt);
+     * // => [6, 8, 10]
+     */
+    function parseInt(string, radix, guard) {
+      if (guard || radix == null) {
+        radix = 0;
+      } else if (radix) {
+        radix = +radix;
+      }
+      return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
+    }
+
+    /**
+     * Repeats the given string `n` times.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to repeat.
+     * @param {number} [n=1] The number of times to repeat the string.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {string} Returns the repeated string.
+     * @example
+     *
+     * _.repeat('*', 3);
+     * // => '***'
+     *
+     * _.repeat('abc', 2);
+     * // => 'abcabc'
+     *
+     * _.repeat('abc', 0);
+     * // => ''
+     */
+    function repeat(string, n, guard) {
+      if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
+        n = 1;
+      } else {
+        n = toInteger(n);
+      }
+      return baseRepeat(toString(string), n);
+    }
+
+    /**
+     * Replaces matches for `pattern` in `string` with `replacement`.
+     *
+     * **Note:** This method is based on
+     * [`String#replace`](https://mdn.io/String/replace).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to modify.
+     * @param {RegExp|string} pattern The pattern to replace.
+     * @param {Function|string} replacement The match replacement.
+     * @returns {string} Returns the modified string.
+     * @example
+     *
+     * _.replace('Hi Fred', 'Fred', 'Barney');
+     * // => 'Hi Barney'
+     */
+    function replace() {
+      var args = arguments,
+          string = toString(args[0]);
+
+      return args.length < 3 ? string : string.replace(args[1], args[2]);
+    }
+
+    /**
+     * Converts `string` to
+     * [snake case](https://en.wikipedia.org/wiki/Snake_case).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the snake cased string.
+     * @example
+     *
+     * _.snakeCase('Foo Bar');
+     * // => 'foo_bar'
+     *
+     * _.snakeCase('fooBar');
+     * // => 'foo_bar'
+     *
+     * _.snakeCase('--FOO-BAR--');
+     * // => 'foo_bar'
+     */
+    var snakeCase = createCompounder(function(result, word, index) {
+      return result + (index ? '_' : '') + word.toLowerCase();
+    });
+
+    /**
+     * Splits `string` by `separator`.
+     *
+     * **Note:** This method is based on
+     * [`String#split`](https://mdn.io/String/split).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to split.
+     * @param {RegExp|string} separator The separator pattern to split by.
+     * @param {number} [limit] The length to truncate results to.
+     * @returns {Array} Returns the string segments.
+     * @example
+     *
+     * _.split('a-b-c', '-', 2);
+     * // => ['a', 'b']
+     */
+    function split(string, separator, limit) {
+      if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
+        separator = limit = undefined;
+      }
+      limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
+      if (!limit) {
+        return [];
+      }
+      string = toString(string);
+      if (string && (
+            typeof separator == 'string' ||
+            (separator != null && !isRegExp(separator))
+          )) {
+        separator = baseToString(separator);
+        if (!separator && hasUnicode(string)) {
+          return castSlice(stringToArray(string), 0, limit);
+        }
+      }
+      return string.split(separator, limit);
+    }
+
+    /**
+     * Converts `string` to
+     * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
+     *
+     * @static
+     * @memberOf _
+     * @since 3.1.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the start cased string.
+     * @example
+     *
+     * _.startCase('--foo-bar--');
+     * // => 'Foo Bar'
+     *
+     * _.startCase('fooBar');
+     * // => 'Foo Bar'
+     *
+     * _.startCase('__FOO_BAR__');
+     * // => 'FOO BAR'
+     */
+    var startCase = createCompounder(function(result, word, index) {
+      return result + (index ? ' ' : '') + upperFirst(word);
+    });
+
+    /**
+     * Checks if `string` starts with the given target string.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to inspect.
+     * @param {string} [target] The string to search for.
+     * @param {number} [position=0] The position to search from.
+     * @returns {boolean} Returns `true` if `string` starts with `target`,
+     *  else `false`.
+     * @example
+     *
+     * _.startsWith('abc', 'a');
+     * // => true
+     *
+     * _.startsWith('abc', 'b');
+     * // => false
+     *
+     * _.startsWith('abc', 'b', 1);
+     * // => true
+     */
+    function startsWith(string, target, position) {
+      string = toString(string);
+      position = position == null
+        ? 0
+        : baseClamp(toInteger(position), 0, string.length);
+
+      target = baseToString(target);
+      return string.slice(position, position + target.length) == target;
+    }
+
+    /**
+     * Creates a compiled template function that can interpolate data properties
+     * in "interpolate" delimiters, HTML-escape interpolated data properties in
+     * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
+     * properties may be accessed as free variables in the template. If a setting
+     * object is given, it takes precedence over `_.templateSettings` values.
+     *
+     * **Note:** In the development build `_.template` utilizes
+     * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
+     * for easier debugging.
+     *
+     * For more information on precompiling templates see
+     * [lodash's custom builds documentation](https://lodash.com/custom-builds).
+     *
+     * For more information on Chrome extension sandboxes see
+     * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category String
+     * @param {string} [string=''] The template string.
+     * @param {Object} [options={}] The options object.
+     * @param {RegExp} [options.escape=_.templateSettings.escape]
+     *  The HTML "escape" delimiter.
+     * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
+     *  The "evaluate" delimiter.
+     * @param {Object} [options.imports=_.templateSettings.imports]
+     *  An object to import into the template as free variables.
+     * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
+     *  The "interpolate" delimiter.
+     * @param {string} [options.sourceURL='lodash.templateSources[n]']
+     *  The sourceURL of the compiled template.
+     * @param {string} [options.variable='obj']
+     *  The data object variable name.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Function} Returns the compiled template function.
+     * @example
+     *
+     * // Use the "interpolate" delimiter to create a compiled template.
+     * var compiled = _.template('hello <%= user %>!');
+     * compiled({ 'user': 'fred' });
+     * // => 'hello fred!'
+     *
+     * // Use the HTML "escape" delimiter to escape data property values.
+     * var compiled = _.template('<b><%- value %></b>');
+     * compiled({ 'value': '<script>' });
+     * // => '<b>&lt;script&gt;</b>'
+     *
+     * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
+     * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
+     * compiled({ 'users': ['fred', 'barney'] });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // Use the internal `print` function in "evaluate" delimiters.
+     * var compiled = _.template('<% print("hello " + user); %>!');
+     * compiled({ 'user': 'barney' });
+     * // => 'hello barney!'
+     *
+     * // Use the ES template literal delimiter as an "interpolate" delimiter.
+     * // Disable support by replacing the "interpolate" delimiter.
+     * var compiled = _.template('hello ${ user }!');
+     * compiled({ 'user': 'pebbles' });
+     * // => 'hello pebbles!'
+     *
+     * // Use backslashes to treat delimiters as plain text.
+     * var compiled = _.template('<%= "\\<%- value %\\>" %>');
+     * compiled({ 'value': 'ignored' });
+     * // => '<%- value %>'
+     *
+     * // Use the `imports` option to import `jQuery` as `jq`.
+     * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
+     * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
+     * compiled({ 'users': ['fred', 'barney'] });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // Use the `sourceURL` option to specify a custom sourceURL for the template.
+     * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
+     * compiled(data);
+     * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
+     *
+     * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
+     * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
+     * compiled.source;
+     * // => function(data) {
+     * //   var __t, __p = '';
+     * //   __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
+     * //   return __p;
+     * // }
+     *
+     * // Use custom template delimiters.
+     * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
+     * var compiled = _.template('hello {{ user }}!');
+     * compiled({ 'user': 'mustache' });
+     * // => 'hello mustache!'
+     *
+     * // Use the `source` property to inline compiled templates for meaningful
+     * // line numbers in error messages and stack traces.
+     * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
+     *   var JST = {\
+     *     "main": ' + _.template(mainText).source + '\
+     *   };\
+     * ');
+     */
+    function template(string, options, guard) {
+      // Based on John Resig's `tmpl` implementation
+      // (http://ejohn.org/blog/javascript-micro-templating/)
+      // and Laura Doktorova's doT.js (https://github.com/olado/doT).
+      var settings = lodash.templateSettings;
+
+      if (guard && isIterateeCall(string, options, guard)) {
+        options = undefined;
+      }
+      string = toString(string);
+      options = assignInWith({}, options, settings, customDefaultsAssignIn);
+
+      var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
+          importsKeys = keys(imports),
+          importsValues = baseValues(imports, importsKeys);
+
+      var isEscaping,
+          isEvaluating,
+          index = 0,
+          interpolate = options.interpolate || reNoMatch,
+          source = "__p += '";
+
+      // Compile the regexp to match each delimiter.
+      var reDelimiters = RegExp(
+        (options.escape || reNoMatch).source + '|' +
+        interpolate.source + '|' +
+        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
+        (options.evaluate || reNoMatch).source + '|$'
+      , 'g');
+
+      // Use a sourceURL for easier debugging.
+      var sourceURL = '//# sourceURL=' +
+        ('sourceURL' in options
+          ? options.sourceURL
+          : ('lodash.templateSources[' + (++templateCounter) + ']')
+        ) + '\n';
+
+      string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
+        interpolateValue || (interpolateValue = esTemplateValue);
+
+        // Escape characters that can't be included in string literals.
+        source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
+
+        // Replace delimiters with snippets.
+        if (escapeValue) {
+          isEscaping = true;
+          source += "' +\n__e(" + escapeValue + ") +\n'";
+        }
+        if (evaluateValue) {
+          isEvaluating = true;
+          source += "';\n" + evaluateValue + ";\n__p += '";
+        }
+        if (interpolateValue) {
+          source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
+        }
+        index = offset + match.length;
+
+        // The JS engine embedded in Adobe products needs `match` returned in
+        // order to produce the correct `offset` value.
+        return match;
+      });
+
+      source += "';\n";
+
+      // If `variable` is not specified wrap a with-statement around the generated
+      // code to add the data object to the top of the scope chain.
+      var variable = options.variable;
+      if (!variable) {
+        source = 'with (obj) {\n' + source + '\n}\n';
+      }
+      // Cleanup code by stripping empty strings.
+      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
+        .replace(reEmptyStringMiddle, '$1')
+        .replace(reEmptyStringTrailing, '$1;');
+
+      // Frame code as the function body.
+      source = 'function(' + (variable || 'obj') + ') {\n' +
+        (variable
+          ? ''
+          : 'obj || (obj = {});\n'
+        ) +
+        "var __t, __p = ''" +
+        (isEscaping
+           ? ', __e = _.escape'
+           : ''
+        ) +
+        (isEvaluating
+          ? ', __j = Array.prototype.join;\n' +
+            "function print() { __p += __j.call(arguments, '') }\n"
+          : ';\n'
+        ) +
+        source +
+        'return __p\n}';
+
+      var result = attempt(function() {
+        return Function(importsKeys, sourceURL + 'return ' + source)
+          .apply(undefined, importsValues);
+      });
+
+      // Provide the compiled function's source by its `toString` method or
+      // the `source` property as a convenience for inlining compiled templates.
+      result.source = source;
+      if (isError(result)) {
+        throw result;
+      }
+      return result;
+    }
+
+    /**
+     * Converts `string`, as a whole, to lower case just like
+     * [String#toLowerCase](https://mdn.io/toLowerCase).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the lower cased string.
+     * @example
+     *
+     * _.toLower('--Foo-Bar--');
+     * // => '--foo-bar--'
+     *
+     * _.toLower('fooBar');
+     * // => 'foobar'
+     *
+     * _.toLower('__FOO_BAR__');
+     * // => '__foo_bar__'
+     */
+    function toLower(value) {
+      return toString(value).toLowerCase();
+    }
+
+    /**
+     * Converts `string`, as a whole, to upper case just like
+     * [String#toUpperCase](https://mdn.io/toUpperCase).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the upper cased string.
+     * @example
+     *
+     * _.toUpper('--foo-bar--');
+     * // => '--FOO-BAR--'
+     *
+     * _.toUpper('fooBar');
+     * // => 'FOOBAR'
+     *
+     * _.toUpper('__foo_bar__');
+     * // => '__FOO_BAR__'
+     */
+    function toUpper(value) {
+      return toString(value).toUpperCase();
+    }
+
+    /**
+     * Removes leading and trailing whitespace or specified characters from `string`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to trim.
+     * @param {string} [chars=whitespace] The characters to trim.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {string} Returns the trimmed string.
+     * @example
+     *
+     * _.trim('  abc  ');
+     * // => 'abc'
+     *
+     * _.trim('-_-abc-_-', '_-');
+     * // => 'abc'
+     *
+     * _.map(['  foo  ', '  bar  '], _.trim);
+     * // => ['foo', 'bar']
+     */
+    function trim(string, chars, guard) {
+      string = toString(string);
+      if (string && (guard || chars === undefined)) {
+        return string.replace(reTrim, '');
+      }
+      if (!string || !(chars = baseToString(chars))) {
+        return string;
+      }
+      var strSymbols = stringToArray(string),
+          chrSymbols = stringToArray(chars),
+          start = charsStartIndex(strSymbols, chrSymbols),
+          end = charsEndIndex(strSymbols, chrSymbols) + 1;
+
+      return castSlice(strSymbols, start, end).join('');
+    }
+
+    /**
+     * Removes trailing whitespace or specified characters from `string`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to trim.
+     * @param {string} [chars=whitespace] The characters to trim.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {string} Returns the trimmed string.
+     * @example
+     *
+     * _.trimEnd('  abc  ');
+     * // => '  abc'
+     *
+     * _.trimEnd('-_-abc-_-', '_-');
+     * // => '-_-abc'
+     */
+    function trimEnd(string, chars, guard) {
+      string = toString(string);
+      if (string && (guard || chars === undefined)) {
+        return string.replace(reTrimEnd, '');
+      }
+      if (!string || !(chars = baseToString(chars))) {
+        return string;
+      }
+      var strSymbols = stringToArray(string),
+          end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
+
+      return castSlice(strSymbols, 0, end).join('');
+    }
+
+    /**
+     * Removes leading whitespace or specified characters from `string`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to trim.
+     * @param {string} [chars=whitespace] The characters to trim.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {string} Returns the trimmed string.
+     * @example
+     *
+     * _.trimStart('  abc  ');
+     * // => 'abc  '
+     *
+     * _.trimStart('-_-abc-_-', '_-');
+     * // => 'abc-_-'
+     */
+    function trimStart(string, chars, guard) {
+      string = toString(string);
+      if (string && (guard || chars === undefined)) {
+        return string.replace(reTrimStart, '');
+      }
+      if (!string || !(chars = baseToString(chars))) {
+        return string;
+      }
+      var strSymbols = stringToArray(string),
+          start = charsStartIndex(strSymbols, stringToArray(chars));
+
+      return castSlice(strSymbols, start).join('');
+    }
+
+    /**
+     * Truncates `string` if it's longer than the given maximum string length.
+     * The last characters of the truncated string are replaced with the omission
+     * string which defaults to "...".
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to truncate.
+     * @param {Object} [options={}] The options object.
+     * @param {number} [options.length=30] The maximum string length.
+     * @param {string} [options.omission='...'] The string to indicate text is omitted.
+     * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
+     * @returns {string} Returns the truncated string.
+     * @example
+     *
+     * _.truncate('hi-diddly-ho there, neighborino');
+     * // => 'hi-diddly-ho there, neighbo...'
+     *
+     * _.truncate('hi-diddly-ho there, neighborino', {
+     *   'length': 24,
+     *   'separator': ' '
+     * });
+     * // => 'hi-diddly-ho there,...'
+     *
+     * _.truncate('hi-diddly-ho there, neighborino', {
+     *   'length': 24,
+     *   'separator': /,? +/
+     * });
+     * // => 'hi-diddly-ho there...'
+     *
+     * _.truncate('hi-diddly-ho there, neighborino', {
+     *   'omission': ' [...]'
+     * });
+     * // => 'hi-diddly-ho there, neig [...]'
+     */
+    function truncate(string, options) {
+      var length = DEFAULT_TRUNC_LENGTH,
+          omission = DEFAULT_TRUNC_OMISSION;
+
+      if (isObject(options)) {
+        var separator = 'separator' in options ? options.separator : separator;
+        length = 'length' in options ? toInteger(options.length) : length;
+        omission = 'omission' in options ? baseToString(options.omission) : omission;
+      }
+      string = toString(string);
+
+      var strLength = string.length;
+      if (hasUnicode(string)) {
+        var strSymbols = stringToArray(string);
+        strLength = strSymbols.length;
+      }
+      if (length >= strLength) {
+        return string;
+      }
+      var end = length - stringSize(omission);
+      if (end < 1) {
+        return omission;
+      }
+      var result = strSymbols
+        ? castSlice(strSymbols, 0, end).join('')
+        : string.slice(0, end);
+
+      if (separator === undefined) {
+        return result + omission;
+      }
+      if (strSymbols) {
+        end += (result.length - end);
+      }
+      if (isRegExp(separator)) {
+        if (string.slice(end).search(separator)) {
+          var match,
+              substring = result;
+
+          if (!separator.global) {
+            separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
+          }
+          separator.lastIndex = 0;
+          while ((match = separator.exec(substring))) {
+            var newEnd = match.index;
+          }
+          result = result.slice(0, newEnd === undefined ? end : newEnd);
+        }
+      } else if (string.indexOf(baseToString(separator), end) != end) {
+        var index = result.lastIndexOf(separator);
+        if (index > -1) {
+          result = result.slice(0, index);
+        }
+      }
+      return result + omission;
+    }
+
+    /**
+     * The inverse of `_.escape`; this method converts the HTML entities
+     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
+     * their corresponding characters.
+     *
+     * **Note:** No other HTML entities are unescaped. To unescape additional
+     * HTML entities use a third-party library like [_he_](https://mths.be/he).
+     *
+     * @static
+     * @memberOf _
+     * @since 0.6.0
+     * @category String
+     * @param {string} [string=''] The string to unescape.
+     * @returns {string} Returns the unescaped string.
+     * @example
+     *
+     * _.unescape('fred, barney, &amp; pebbles');
+     * // => 'fred, barney, & pebbles'
+     */
+    function unescape(string) {
+      string = toString(string);
+      return (string && reHasEscapedHtml.test(string))
+        ? string.replace(reEscapedHtml, unescapeHtmlChar)
+        : string;
+    }
+
+    /**
+     * Converts `string`, as space separated words, to upper case.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the upper cased string.
+     * @example
+     *
+     * _.upperCase('--foo-bar');
+     * // => 'FOO BAR'
+     *
+     * _.upperCase('fooBar');
+     * // => 'FOO BAR'
+     *
+     * _.upperCase('__foo_bar__');
+     * // => 'FOO BAR'
+     */
+    var upperCase = createCompounder(function(result, word, index) {
+      return result + (index ? ' ' : '') + word.toUpperCase();
+    });
+
+    /**
+     * Converts the first character of `string` to upper case.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category String
+     * @param {string} [string=''] The string to convert.
+     * @returns {string} Returns the converted string.
+     * @example
+     *
+     * _.upperFirst('fred');
+     * // => 'Fred'
+     *
+     * _.upperFirst('FRED');
+     * // => 'FRED'
+     */
+    var upperFirst = createCaseFirst('toUpperCase');
+
+    /**
+     * Splits `string` into an array of its words.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category String
+     * @param {string} [string=''] The string to inspect.
+     * @param {RegExp|string} [pattern] The pattern to match words.
+     * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+     * @returns {Array} Returns the words of `string`.
+     * @example
+     *
+     * _.words('fred, barney, & pebbles');
+     * // => ['fred', 'barney', 'pebbles']
+     *
+     * _.words('fred, barney, & pebbles', /[^, ]+/g);
+     * // => ['fred', 'barney', '&', 'pebbles']
+     */
+    function words(string, pattern, guard) {
+      string = toString(string);
+      pattern = guard ? undefined : pattern;
+
+      if (pattern === undefined) {
+        return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
+      }
+      return string.match(pattern) || [];
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Attempts to invoke `func`, returning either the result or the caught error
+     * object. Any additional arguments are provided to `func` when it's invoked.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Util
+     * @param {Function} func The function to attempt.
+     * @param {...*} [args] The arguments to invoke `func` with.
+     * @returns {*} Returns the `func` result or error object.
+     * @example
+     *
+     * // Avoid throwing errors for invalid selectors.
+     * var elements = _.attempt(function(selector) {
+     *   return document.querySelectorAll(selector);
+     * }, '>_>');
+     *
+     * if (_.isError(elements)) {
+     *   elements = [];
+     * }
+     */
+    var attempt = baseRest(function(func, args) {
+      try {
+        return apply(func, undefined, args);
+      } catch (e) {
+        return isError(e) ? e : new Error(e);
+      }
+    });
+
+    /**
+     * Binds methods of an object to the object itself, overwriting the existing
+     * method.
+     *
+     * **Note:** This method doesn't set the "length" property of bound functions.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Util
+     * @param {Object} object The object to bind and assign the bound methods to.
+     * @param {...(string|string[])} methodNames The object method names to bind.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var view = {
+     *   'label': 'docs',
+     *   'click': function() {
+     *     console.log('clicked ' + this.label);
+     *   }
+     * };
+     *
+     * _.bindAll(view, ['click']);
+     * jQuery(element).on('click', view.click);
+     * // => Logs 'clicked docs' when clicked.
+     */
+    var bindAll = flatRest(function(object, methodNames) {
+      arrayEach(methodNames, function(key) {
+        key = toKey(key);
+        baseAssignValue(object, key, bind(object[key], object));
+      });
+      return object;
+    });
+
+    /**
+     * Creates a function that iterates over `pairs` and invokes the corresponding
+     * function of the first predicate to return truthy. The predicate-function
+     * pairs are invoked with the `this` binding and arguments of the created
+     * function.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Util
+     * @param {Array} pairs The predicate-function pairs.
+     * @returns {Function} Returns the new composite function.
+     * @example
+     *
+     * var func = _.cond([
+     *   [_.matches({ 'a': 1 }),           _.constant('matches A')],
+     *   [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
+     *   [_.stubTrue,                      _.constant('no match')]
+     * ]);
+     *
+     * func({ 'a': 1, 'b': 2 });
+     * // => 'matches A'
+     *
+     * func({ 'a': 0, 'b': 1 });
+     * // => 'matches B'
+     *
+     * func({ 'a': '1', 'b': '2' });
+     * // => 'no match'
+     */
+    function cond(pairs) {
+      var length = pairs == null ? 0 : pairs.length,
+          toIteratee = getIteratee();
+
+      pairs = !length ? [] : arrayMap(pairs, function(pair) {
+        if (typeof pair[1] != 'function') {
+          throw new TypeError(FUNC_ERROR_TEXT);
+        }
+        return [toIteratee(pair[0]), pair[1]];
+      });
+
+      return baseRest(function(args) {
+        var index = -1;
+        while (++index < length) {
+          var pair = pairs[index];
+          if (apply(pair[0], this, args)) {
+            return apply(pair[1], this, args);
+          }
+        }
+      });
+    }
+
+    /**
+     * Creates a function that invokes the predicate properties of `source` with
+     * the corresponding property values of a given object, returning `true` if
+     * all predicates return truthy, else `false`.
+     *
+     * **Note:** The created function is equivalent to `_.conformsTo` with
+     * `source` partially applied.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Util
+     * @param {Object} source The object of property predicates to conform to.
+     * @returns {Function} Returns the new spec function.
+     * @example
+     *
+     * var objects = [
+     *   { 'a': 2, 'b': 1 },
+     *   { 'a': 1, 'b': 2 }
+     * ];
+     *
+     * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
+     * // => [{ 'a': 1, 'b': 2 }]
+     */
+    function conforms(source) {
+      return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
+    }
+
+    /**
+     * Creates a function that returns `value`.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.4.0
+     * @category Util
+     * @param {*} value The value to return from the new function.
+     * @returns {Function} Returns the new constant function.
+     * @example
+     *
+     * var objects = _.times(2, _.constant({ 'a': 1 }));
+     *
+     * console.log(objects);
+     * // => [{ 'a': 1 }, { 'a': 1 }]
+     *
+     * console.log(objects[0] === objects[1]);
+     * // => true
+     */
+    function constant(value) {
+      return function() {
+        return value;
+      };
+    }
+
+    /**
+     * Checks `value` to determine whether a default value should be returned in
+     * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
+     * or `undefined`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.14.0
+     * @category Util
+     * @param {*} value The value to check.
+     * @param {*} defaultValue The default value.
+     * @returns {*} Returns the resolved value.
+     * @example
+     *
+     * _.defaultTo(1, 10);
+     * // => 1
+     *
+     * _.defaultTo(undefined, 10);
+     * // => 10
+     */
+    function defaultTo(value, defaultValue) {
+      return (value == null || value !== value) ? defaultValue : value;
+    }
+
+    /**
+     * Creates a function that returns the result of invoking the given functions
+     * with the `this` binding of the created function, where each successive
+     * invocation is supplied the return value of the previous.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Util
+     * @param {...(Function|Function[])} [funcs] The functions to invoke.
+     * @returns {Function} Returns the new composite function.
+     * @see _.flowRight
+     * @example
+     *
+     * function square(n) {
+     *   return n * n;
+     * }
+     *
+     * var addSquare = _.flow([_.add, square]);
+     * addSquare(1, 2);
+     * // => 9
+     */
+    var flow = createFlow();
+
+    /**
+     * This method is like `_.flow` except that it creates a function that
+     * invokes the given functions from right to left.
+     *
+     * @static
+     * @since 3.0.0
+     * @memberOf _
+     * @category Util
+     * @param {...(Function|Function[])} [funcs] The functions to invoke.
+     * @returns {Function} Returns the new composite function.
+     * @see _.flow
+     * @example
+     *
+     * function square(n) {
+     *   return n * n;
+     * }
+     *
+     * var addSquare = _.flowRight([square, _.add]);
+     * addSquare(1, 2);
+     * // => 9
+     */
+    var flowRight = createFlow(true);
+
+    /**
+     * This method returns the first argument it receives.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Util
+     * @param {*} value Any value.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * var object = { 'a': 1 };
+     *
+     * console.log(_.identity(object) === object);
+     * // => true
+     */
+    function identity(value) {
+      return value;
+    }
+
+    /**
+     * Creates a function that invokes `func` with the arguments of the created
+     * function. If `func` is a property name, the created function returns the
+     * property value for a given element. If `func` is an array or object, the
+     * created function returns `true` for elements that contain the equivalent
+     * source properties, otherwise it returns `false`.
+     *
+     * @static
+     * @since 4.0.0
+     * @memberOf _
+     * @category Util
+     * @param {*} [func=_.identity] The value to convert to a callback.
+     * @returns {Function} Returns the callback.
+     * @example
+     *
+     * var users = [
+     *   { 'user': 'barney', 'age': 36, 'active': true },
+     *   { 'user': 'fred',   'age': 40, 'active': false }
+     * ];
+     *
+     * // The `_.matches` iteratee shorthand.
+     * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
+     * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
+     *
+     * // The `_.matchesProperty` iteratee shorthand.
+     * _.filter(users, _.iteratee(['user', 'fred']));
+     * // => [{ 'user': 'fred', 'age': 40 }]
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.map(users, _.iteratee('user'));
+     * // => ['barney', 'fred']
+     *
+     * // Create custom iteratee shorthands.
+     * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
+     *   return !_.isRegExp(func) ? iteratee(func) : function(string) {
+     *     return func.test(string);
+     *   };
+     * });
+     *
+     * _.filter(['abc', 'def'], /ef/);
+     * // => ['def']
+     */
+    function iteratee(func) {
+      return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
+    }
+
+    /**
+     * Creates a function that performs a partial deep comparison between a given
+     * object and `source`, returning `true` if the given object has equivalent
+     * property values, else `false`.
+     *
+     * **Note:** The created function is equivalent to `_.isMatch` with `source`
+     * partially applied.
+     *
+     * Partial comparisons will match empty array and empty object `source`
+     * values against any array or object value, respectively. See `_.isEqual`
+     * for a list of supported value comparisons.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Util
+     * @param {Object} source The object of property values to match.
+     * @returns {Function} Returns the new spec function.
+     * @example
+     *
+     * var objects = [
+     *   { 'a': 1, 'b': 2, 'c': 3 },
+     *   { 'a': 4, 'b': 5, 'c': 6 }
+     * ];
+     *
+     * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
+     * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
+     */
+    function matches(source) {
+      return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
+    }
+
+    /**
+     * Creates a function that performs a partial deep comparison between the
+     * value at `path` of a given object to `srcValue`, returning `true` if the
+     * object value is equivalent, else `false`.
+     *
+     * **Note:** Partial comparisons will match empty array and empty object
+     * `srcValue` values against any array or object value, respectively. See
+     * `_.isEqual` for a list of supported value comparisons.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.2.0
+     * @category Util
+     * @param {Array|string} path The path of the property to get.
+     * @param {*} srcValue The value to match.
+     * @returns {Function} Returns the new spec function.
+     * @example
+     *
+     * var objects = [
+     *   { 'a': 1, 'b': 2, 'c': 3 },
+     *   { 'a': 4, 'b': 5, 'c': 6 }
+     * ];
+     *
+     * _.find(objects, _.matchesProperty('a', 4));
+     * // => { 'a': 4, 'b': 5, 'c': 6 }
+     */
+    function matchesProperty(path, srcValue) {
+      return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
+    }
+
+    /**
+     * Creates a function that invokes the method at `path` of a given object.
+     * Any additional arguments are provided to the invoked method.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.7.0
+     * @category Util
+     * @param {Array|string} path The path of the method to invoke.
+     * @param {...*} [args] The arguments to invoke the method with.
+     * @returns {Function} Returns the new invoker function.
+     * @example
+     *
+     * var objects = [
+     *   { 'a': { 'b': _.constant(2) } },
+     *   { 'a': { 'b': _.constant(1) } }
+     * ];
+     *
+     * _.map(objects, _.method('a.b'));
+     * // => [2, 1]
+     *
+     * _.map(objects, _.method(['a', 'b']));
+     * // => [2, 1]
+     */
+    var method = baseRest(function(path, args) {
+      return function(object) {
+        return baseInvoke(object, path, args);
+      };
+    });
+
+    /**
+     * The opposite of `_.method`; this method creates a function that invokes
+     * the method at a given path of `object`. Any additional arguments are
+     * provided to the invoked method.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.7.0
+     * @category Util
+     * @param {Object} object The object to query.
+     * @param {...*} [args] The arguments to invoke the method with.
+     * @returns {Function} Returns the new invoker function.
+     * @example
+     *
+     * var array = _.times(3, _.constant),
+     *     object = { 'a': array, 'b': array, 'c': array };
+     *
+     * _.map(['a[2]', 'c[0]'], _.methodOf(object));
+     * // => [2, 0]
+     *
+     * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
+     * // => [2, 0]
+     */
+    var methodOf = baseRest(function(object, args) {
+      return function(path) {
+        return baseInvoke(object, path, args);
+      };
+    });
+
+    /**
+     * Adds all own enumerable string keyed function properties of a source
+     * object to the destination object. If `object` is a function, then methods
+     * are added to its prototype as well.
+     *
+     * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
+     * avoid conflicts caused by modifying the original.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Util
+     * @param {Function|Object} [object=lodash] The destination object.
+     * @param {Object} source The object of functions to add.
+     * @param {Object} [options={}] The options object.
+     * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
+     * @returns {Function|Object} Returns `object`.
+     * @example
+     *
+     * function vowels(string) {
+     *   return _.filter(string, function(v) {
+     *     return /[aeiou]/i.test(v);
+     *   });
+     * }
+     *
+     * _.mixin({ 'vowels': vowels });
+     * _.vowels('fred');
+     * // => ['e']
+     *
+     * _('fred').vowels().value();
+     * // => ['e']
+     *
+     * _.mixin({ 'vowels': vowels }, { 'chain': false });
+     * _('fred').vowels();
+     * // => ['e']
+     */
+    function mixin(object, source, options) {
+      var props = keys(source),
+          methodNames = baseFunctions(source, props);
+
+      if (options == null &&
+          !(isObject(source) && (methodNames.length || !props.length))) {
+        options = source;
+        source = object;
+        object = this;
+        methodNames = baseFunctions(source, keys(source));
+      }
+      var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
+          isFunc = isFunction(object);
+
+      arrayEach(methodNames, function(methodName) {
+        var func = source[methodName];
+        object[methodName] = func;
+        if (isFunc) {
+          object.prototype[methodName] = function() {
+            var chainAll = this.__chain__;
+            if (chain || chainAll) {
+              var result = object(this.__wrapped__),
+                  actions = result.__actions__ = copyArray(this.__actions__);
+
+              actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
+              result.__chain__ = chainAll;
+              return result;
+            }
+            return func.apply(object, arrayPush([this.value()], arguments));
+          };
+        }
+      });
+
+      return object;
+    }
+
+    /**
+     * Reverts the `_` variable to its previous value and returns a reference to
+     * the `lodash` function.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Util
+     * @returns {Function} Returns the `lodash` function.
+     * @example
+     *
+     * var lodash = _.noConflict();
+     */
+    function noConflict() {
+      if (root._ === this) {
+        root._ = oldDash;
+      }
+      return this;
+    }
+
+    /**
+     * This method returns `undefined`.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.3.0
+     * @category Util
+     * @example
+     *
+     * _.times(2, _.noop);
+     * // => [undefined, undefined]
+     */
+    function noop() {
+      // No operation performed.
+    }
+
+    /**
+     * Creates a function that gets the argument at index `n`. If `n` is negative,
+     * the nth argument from the end is returned.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Util
+     * @param {number} [n=0] The index of the argument to return.
+     * @returns {Function} Returns the new pass-thru function.
+     * @example
+     *
+     * var func = _.nthArg(1);
+     * func('a', 'b', 'c', 'd');
+     * // => 'b'
+     *
+     * var func = _.nthArg(-2);
+     * func('a', 'b', 'c', 'd');
+     * // => 'c'
+     */
+    function nthArg(n) {
+      n = toInteger(n);
+      return baseRest(function(args) {
+        return baseNth(args, n);
+      });
+    }
+
+    /**
+     * Creates a function that invokes `iteratees` with the arguments it receives
+     * and returns their results.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Util
+     * @param {...(Function|Function[])} [iteratees=[_.identity]]
+     *  The iteratees to invoke.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var func = _.over([Math.max, Math.min]);
+     *
+     * func(1, 2, 3, 4);
+     * // => [4, 1]
+     */
+    var over = createOver(arrayMap);
+
+    /**
+     * Creates a function that checks if **all** of the `predicates` return
+     * truthy when invoked with the arguments it receives.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Util
+     * @param {...(Function|Function[])} [predicates=[_.identity]]
+     *  The predicates to check.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var func = _.overEvery([Boolean, isFinite]);
+     *
+     * func('1');
+     * // => true
+     *
+     * func(null);
+     * // => false
+     *
+     * func(NaN);
+     * // => false
+     */
+    var overEvery = createOver(arrayEvery);
+
+    /**
+     * Creates a function that checks if **any** of the `predicates` return
+     * truthy when invoked with the arguments it receives.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Util
+     * @param {...(Function|Function[])} [predicates=[_.identity]]
+     *  The predicates to check.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var func = _.overSome([Boolean, isFinite]);
+     *
+     * func('1');
+     * // => true
+     *
+     * func(null);
+     * // => true
+     *
+     * func(NaN);
+     * // => false
+     */
+    var overSome = createOver(arraySome);
+
+    /**
+     * Creates a function that returns the value at `path` of a given object.
+     *
+     * @static
+     * @memberOf _
+     * @since 2.4.0
+     * @category Util
+     * @param {Array|string} path The path of the property to get.
+     * @returns {Function} Returns the new accessor function.
+     * @example
+     *
+     * var objects = [
+     *   { 'a': { 'b': 2 } },
+     *   { 'a': { 'b': 1 } }
+     * ];
+     *
+     * _.map(objects, _.property('a.b'));
+     * // => [2, 1]
+     *
+     * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
+     * // => [1, 2]
+     */
+    function property(path) {
+      return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
+    }
+
+    /**
+     * The opposite of `_.property`; this method creates a function that returns
+     * the value at a given path of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.0.0
+     * @category Util
+     * @param {Object} object The object to query.
+     * @returns {Function} Returns the new accessor function.
+     * @example
+     *
+     * var array = [0, 1, 2],
+     *     object = { 'a': array, 'b': array, 'c': array };
+     *
+     * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
+     * // => [2, 0]
+     *
+     * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
+     * // => [2, 0]
+     */
+    function propertyOf(object) {
+      return function(path) {
+        return object == null ? undefined : baseGet(object, path);
+      };
+    }
+
+    /**
+     * Creates an array of numbers (positive and/or negative) progressing from
+     * `start` up to, but not including, `end`. A step of `-1` is used if a negative
+     * `start` is specified without an `end` or `step`. If `end` is not specified,
+     * it's set to `start` with `start` then set to `0`.
+     *
+     * **Note:** JavaScript follows the IEEE-754 standard for resolving
+     * floating-point values which can produce unexpected results.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Util
+     * @param {number} [start=0] The start of the range.
+     * @param {number} end The end of the range.
+     * @param {number} [step=1] The value to increment or decrement by.
+     * @returns {Array} Returns the range of numbers.
+     * @see _.inRange, _.rangeRight
+     * @example
+     *
+     * _.range(4);
+     * // => [0, 1, 2, 3]
+     *
+     * _.range(-4);
+     * // => [0, -1, -2, -3]
+     *
+     * _.range(1, 5);
+     * // => [1, 2, 3, 4]
+     *
+     * _.range(0, 20, 5);
+     * // => [0, 5, 10, 15]
+     *
+     * _.range(0, -4, -1);
+     * // => [0, -1, -2, -3]
+     *
+     * _.range(1, 4, 0);
+     * // => [1, 1, 1]
+     *
+     * _.range(0);
+     * // => []
+     */
+    var range = createRange();
+
+    /**
+     * This method is like `_.range` except that it populates values in
+     * descending order.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Util
+     * @param {number} [start=0] The start of the range.
+     * @param {number} end The end of the range.
+     * @param {number} [step=1] The value to increment or decrement by.
+     * @returns {Array} Returns the range of numbers.
+     * @see _.inRange, _.range
+     * @example
+     *
+     * _.rangeRight(4);
+     * // => [3, 2, 1, 0]
+     *
+     * _.rangeRight(-4);
+     * // => [-3, -2, -1, 0]
+     *
+     * _.rangeRight(1, 5);
+     * // => [4, 3, 2, 1]
+     *
+     * _.rangeRight(0, 20, 5);
+     * // => [15, 10, 5, 0]
+     *
+     * _.rangeRight(0, -4, -1);
+     * // => [-3, -2, -1, 0]
+     *
+     * _.rangeRight(1, 4, 0);
+     * // => [1, 1, 1]
+     *
+     * _.rangeRight(0);
+     * // => []
+     */
+    var rangeRight = createRange(true);
+
+    /**
+     * This method returns a new empty array.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.13.0
+     * @category Util
+     * @returns {Array} Returns the new empty array.
+     * @example
+     *
+     * var arrays = _.times(2, _.stubArray);
+     *
+     * console.log(arrays);
+     * // => [[], []]
+     *
+     * console.log(arrays[0] === arrays[1]);
+     * // => false
+     */
+    function stubArray() {
+      return [];
+    }
+
+    /**
+     * This method returns `false`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.13.0
+     * @category Util
+     * @returns {boolean} Returns `false`.
+     * @example
+     *
+     * _.times(2, _.stubFalse);
+     * // => [false, false]
+     */
+    function stubFalse() {
+      return false;
+    }
+
+    /**
+     * This method returns a new empty object.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.13.0
+     * @category Util
+     * @returns {Object} Returns the new empty object.
+     * @example
+     *
+     * var objects = _.times(2, _.stubObject);
+     *
+     * console.log(objects);
+     * // => [{}, {}]
+     *
+     * console.log(objects[0] === objects[1]);
+     * // => false
+     */
+    function stubObject() {
+      return {};
+    }
+
+    /**
+     * This method returns an empty string.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.13.0
+     * @category Util
+     * @returns {string} Returns the empty string.
+     * @example
+     *
+     * _.times(2, _.stubString);
+     * // => ['', '']
+     */
+    function stubString() {
+      return '';
+    }
+
+    /**
+     * This method returns `true`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.13.0
+     * @category Util
+     * @returns {boolean} Returns `true`.
+     * @example
+     *
+     * _.times(2, _.stubTrue);
+     * // => [true, true]
+     */
+    function stubTrue() {
+      return true;
+    }
+
+    /**
+     * Invokes the iteratee `n` times, returning an array of the results of
+     * each invocation. The iteratee is invoked with one argument; (index).
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Util
+     * @param {number} n The number of times to invoke `iteratee`.
+     * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+     * @returns {Array} Returns the array of results.
+     * @example
+     *
+     * _.times(3, String);
+     * // => ['0', '1', '2']
+     *
+     *  _.times(4, _.constant(0));
+     * // => [0, 0, 0, 0]
+     */
+    function times(n, iteratee) {
+      n = toInteger(n);
+      if (n < 1 || n > MAX_SAFE_INTEGER) {
+        return [];
+      }
+      var index = MAX_ARRAY_LENGTH,
+          length = nativeMin(n, MAX_ARRAY_LENGTH);
+
+      iteratee = getIteratee(iteratee);
+      n -= MAX_ARRAY_LENGTH;
+
+      var result = baseTimes(length, iteratee);
+      while (++index < n) {
+        iteratee(index);
+      }
+      return result;
+    }
+
+    /**
+     * Converts `value` to a property path array.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Util
+     * @param {*} value The value to convert.
+     * @returns {Array} Returns the new property path array.
+     * @example
+     *
+     * _.toPath('a.b.c');
+     * // => ['a', 'b', 'c']
+     *
+     * _.toPath('a[0].b.c');
+     * // => ['a', '0', 'b', 'c']
+     */
+    function toPath(value) {
+      if (isArray(value)) {
+        return arrayMap(value, toKey);
+      }
+      return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
+    }
+
+    /**
+     * Generates a unique ID. If `prefix` is given, the ID is appended to it.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Util
+     * @param {string} [prefix=''] The value to prefix the ID with.
+     * @returns {string} Returns the unique ID.
+     * @example
+     *
+     * _.uniqueId('contact_');
+     * // => 'contact_104'
+     *
+     * _.uniqueId();
+     * // => '105'
+     */
+    function uniqueId(prefix) {
+      var id = ++idCounter;
+      return toString(prefix) + id;
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * Adds two numbers.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.4.0
+     * @category Math
+     * @param {number} augend The first number in an addition.
+     * @param {number} addend The second number in an addition.
+     * @returns {number} Returns the total.
+     * @example
+     *
+     * _.add(6, 4);
+     * // => 10
+     */
+    var add = createMathOperation(function(augend, addend) {
+      return augend + addend;
+    }, 0);
+
+    /**
+     * Computes `number` rounded up to `precision`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.10.0
+     * @category Math
+     * @param {number} number The number to round up.
+     * @param {number} [precision=0] The precision to round up to.
+     * @returns {number} Returns the rounded up number.
+     * @example
+     *
+     * _.ceil(4.006);
+     * // => 5
+     *
+     * _.ceil(6.004, 2);
+     * // => 6.01
+     *
+     * _.ceil(6040, -2);
+     * // => 6100
+     */
+    var ceil = createRound('ceil');
+
+    /**
+     * Divide two numbers.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.7.0
+     * @category Math
+     * @param {number} dividend The first number in a division.
+     * @param {number} divisor The second number in a division.
+     * @returns {number} Returns the quotient.
+     * @example
+     *
+     * _.divide(6, 4);
+     * // => 1.5
+     */
+    var divide = createMathOperation(function(dividend, divisor) {
+      return dividend / divisor;
+    }, 1);
+
+    /**
+     * Computes `number` rounded down to `precision`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.10.0
+     * @category Math
+     * @param {number} number The number to round down.
+     * @param {number} [precision=0] The precision to round down to.
+     * @returns {number} Returns the rounded down number.
+     * @example
+     *
+     * _.floor(4.006);
+     * // => 4
+     *
+     * _.floor(0.046, 2);
+     * // => 0.04
+     *
+     * _.floor(4060, -2);
+     * // => 4000
+     */
+    var floor = createRound('floor');
+
+    /**
+     * Computes the maximum value of `array`. If `array` is empty or falsey,
+     * `undefined` is returned.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Math
+     * @param {Array} array The array to iterate over.
+     * @returns {*} Returns the maximum value.
+     * @example
+     *
+     * _.max([4, 2, 8, 6]);
+     * // => 8
+     *
+     * _.max([]);
+     * // => undefined
+     */
+    function max(array) {
+      return (array && array.length)
+        ? baseExtremum(array, identity, baseGt)
+        : undefined;
+    }
+
+    /**
+     * This method is like `_.max` except that it accepts `iteratee` which is
+     * invoked for each element in `array` to generate the criterion by which
+     * the value is ranked. The iteratee is invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Math
+     * @param {Array} array The array to iterate over.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {*} Returns the maximum value.
+     * @example
+     *
+     * var objects = [{ 'n': 1 }, { 'n': 2 }];
+     *
+     * _.maxBy(objects, function(o) { return o.n; });
+     * // => { 'n': 2 }
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.maxBy(objects, 'n');
+     * // => { 'n': 2 }
+     */
+    function maxBy(array, iteratee) {
+      return (array && array.length)
+        ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
+        : undefined;
+    }
+
+    /**
+     * Computes the mean of the values in `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Math
+     * @param {Array} array The array to iterate over.
+     * @returns {number} Returns the mean.
+     * @example
+     *
+     * _.mean([4, 2, 8, 6]);
+     * // => 5
+     */
+    function mean(array) {
+      return baseMean(array, identity);
+    }
+
+    /**
+     * This method is like `_.mean` except that it accepts `iteratee` which is
+     * invoked for each element in `array` to generate the value to be averaged.
+     * The iteratee is invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.7.0
+     * @category Math
+     * @param {Array} array The array to iterate over.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {number} Returns the mean.
+     * @example
+     *
+     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
+     *
+     * _.meanBy(objects, function(o) { return o.n; });
+     * // => 5
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.meanBy(objects, 'n');
+     * // => 5
+     */
+    function meanBy(array, iteratee) {
+      return baseMean(array, getIteratee(iteratee, 2));
+    }
+
+    /**
+     * Computes the minimum value of `array`. If `array` is empty or falsey,
+     * `undefined` is returned.
+     *
+     * @static
+     * @since 0.1.0
+     * @memberOf _
+     * @category Math
+     * @param {Array} array The array to iterate over.
+     * @returns {*} Returns the minimum value.
+     * @example
+     *
+     * _.min([4, 2, 8, 6]);
+     * // => 2
+     *
+     * _.min([]);
+     * // => undefined
+     */
+    function min(array) {
+      return (array && array.length)
+        ? baseExtremum(array, identity, baseLt)
+        : undefined;
+    }
+
+    /**
+     * This method is like `_.min` except that it accepts `iteratee` which is
+     * invoked for each element in `array` to generate the criterion by which
+     * the value is ranked. The iteratee is invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Math
+     * @param {Array} array The array to iterate over.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {*} Returns the minimum value.
+     * @example
+     *
+     * var objects = [{ 'n': 1 }, { 'n': 2 }];
+     *
+     * _.minBy(objects, function(o) { return o.n; });
+     * // => { 'n': 1 }
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.minBy(objects, 'n');
+     * // => { 'n': 1 }
+     */
+    function minBy(array, iteratee) {
+      return (array && array.length)
+        ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
+        : undefined;
+    }
+
+    /**
+     * Multiply two numbers.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.7.0
+     * @category Math
+     * @param {number} multiplier The first number in a multiplication.
+     * @param {number} multiplicand The second number in a multiplication.
+     * @returns {number} Returns the product.
+     * @example
+     *
+     * _.multiply(6, 4);
+     * // => 24
+     */
+    var multiply = createMathOperation(function(multiplier, multiplicand) {
+      return multiplier * multiplicand;
+    }, 1);
+
+    /**
+     * Computes `number` rounded to `precision`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.10.0
+     * @category Math
+     * @param {number} number The number to round.
+     * @param {number} [precision=0] The precision to round to.
+     * @returns {number} Returns the rounded number.
+     * @example
+     *
+     * _.round(4.006);
+     * // => 4
+     *
+     * _.round(4.006, 2);
+     * // => 4.01
+     *
+     * _.round(4060, -2);
+     * // => 4100
+     */
+    var round = createRound('round');
+
+    /**
+     * Subtract two numbers.
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Math
+     * @param {number} minuend The first number in a subtraction.
+     * @param {number} subtrahend The second number in a subtraction.
+     * @returns {number} Returns the difference.
+     * @example
+     *
+     * _.subtract(6, 4);
+     * // => 2
+     */
+    var subtract = createMathOperation(function(minuend, subtrahend) {
+      return minuend - subtrahend;
+    }, 0);
+
+    /**
+     * Computes the sum of the values in `array`.
+     *
+     * @static
+     * @memberOf _
+     * @since 3.4.0
+     * @category Math
+     * @param {Array} array The array to iterate over.
+     * @returns {number} Returns the sum.
+     * @example
+     *
+     * _.sum([4, 2, 8, 6]);
+     * // => 20
+     */
+    function sum(array) {
+      return (array && array.length)
+        ? baseSum(array, identity)
+        : 0;
+    }
+
+    /**
+     * This method is like `_.sum` except that it accepts `iteratee` which is
+     * invoked for each element in `array` to generate the value to be summed.
+     * The iteratee is invoked with one argument: (value).
+     *
+     * @static
+     * @memberOf _
+     * @since 4.0.0
+     * @category Math
+     * @param {Array} array The array to iterate over.
+     * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+     * @returns {number} Returns the sum.
+     * @example
+     *
+     * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
+     *
+     * _.sumBy(objects, function(o) { return o.n; });
+     * // => 20
+     *
+     * // The `_.property` iteratee shorthand.
+     * _.sumBy(objects, 'n');
+     * // => 20
+     */
+    function sumBy(array, iteratee) {
+      return (array && array.length)
+        ? baseSum(array, getIteratee(iteratee, 2))
+        : 0;
+    }
+
+    /*------------------------------------------------------------------------*/
+
+    // Add methods that return wrapped values in chain sequences.
+    lodash.after = after;
+    lodash.ary = ary;
+    lodash.assign = assign;
+    lodash.assignIn = assignIn;
+    lodash.assignInWith = assignInWith;
+    lodash.assignWith = assignWith;
+    lodash.at = at;
+    lodash.before = before;
+    lodash.bind = bind;
+    lodash.bindAll = bindAll;
+    lodash.bindKey = bindKey;
+    lodash.castArray = castArray;
+    lodash.chain = chain;
+    lodash.chunk = chunk;
+    lodash.compact = compact;
+    lodash.concat = concat;
+    lodash.cond = cond;
+    lodash.conforms = conforms;
+    lodash.constant = constant;
+    lodash.countBy = countBy;
+    lodash.create = create;
+    lodash.curry = curry;
+    lodash.curryRight = curryRight;
+    lodash.debounce = debounce;
+    lodash.defaults = defaults;
+    lodash.defaultsDeep = defaultsDeep;
+    lodash.defer = defer;
+    lodash.delay = delay;
+    lodash.difference = difference;
+    lodash.differenceBy = differenceBy;
+    lodash.differenceWith = differenceWith;
+    lodash.drop = drop;
+    lodash.dropRight = dropRight;
+    lodash.dropRightWhile = dropRightWhile;
+    lodash.dropWhile = dropWhile;
+    lodash.fill = fill;
+    lodash.filter = filter;
+    lodash.flatMap = flatMap;
+    lodash.flatMapDeep = flatMapDeep;
+    lodash.flatMapDepth = flatMapDepth;
+    lodash.flatten = flatten;
+    lodash.flattenDeep = flattenDeep;
+    lodash.flattenDepth = flattenDepth;
+    lodash.flip = flip;
+    lodash.flow = flow;
+    lodash.flowRight = flowRight;
+    lodash.fromPairs = fromPairs;
+    lodash.functions = functions;
+    lodash.functionsIn = functionsIn;
+    lodash.groupBy = groupBy;
+    lodash.initial = initial;
+    lodash.intersection = intersection;
+    lodash.intersectionBy = intersectionBy;
+    lodash.intersectionWith = intersectionWith;
+    lodash.invert = invert;
+    lodash.invertBy = invertBy;
+    lodash.invokeMap = invokeMap;
+    lodash.iteratee = iteratee;
+    lodash.keyBy = keyBy;
+    lodash.keys = keys;
+    lodash.keysIn = keysIn;
+    lodash.map = map;
+    lodash.mapKeys = mapKeys;
+    lodash.mapValues = mapValues;
+    lodash.matches = matches;
+    lodash.matchesProperty = matchesProperty;
+    lodash.memoize = memoize;
+    lodash.merge = merge;
+    lodash.mergeWith = mergeWith;
+    lodash.method = method;
+    lodash.methodOf = methodOf;
+    lodash.mixin = mixin;
+    lodash.negate = negate;
+    lodash.nthArg = nthArg;
+    lodash.omit = omit;
+    lodash.omitBy = omitBy;
+    lodash.once = once;
+    lodash.orderBy = orderBy;
+    lodash.over = over;
+    lodash.overArgs = overArgs;
+    lodash.overEvery = overEvery;
+    lodash.overSome = overSome;
+    lodash.partial = partial;
+    lodash.partialRight = partialRight;
+    lodash.partition = partition;
+    lodash.pick = pick;
+    lodash.pickBy = pickBy;
+    lodash.property = property;
+    lodash.propertyOf = propertyOf;
+    lodash.pull = pull;
+    lodash.pullAll = pullAll;
+    lodash.pullAllBy = pullAllBy;
+    lodash.pullAllWith = pullAllWith;
+    lodash.pullAt = pullAt;
+    lodash.range = range;
+    lodash.rangeRight = rangeRight;
+    lodash.rearg = rearg;
+    lodash.reject = reject;
+    lodash.remove = remove;
+    lodash.rest = rest;
+    lodash.reverse = reverse;
+    lodash.sampleSize = sampleSize;
+    lodash.set = set;
+    lodash.setWith = setWith;
+    lodash.shuffle = shuffle;
+    lodash.slice = slice;
+    lodash.sortBy = sortBy;
+    lodash.sortedUniq = sortedUniq;
+    lodash.sortedUniqBy = sortedUniqBy;
+    lodash.split = split;
+    lodash.spread = spread;
+    lodash.tail = tail;
+    lodash.take = take;
+    lodash.takeRight = takeRight;
+    lodash.takeRightWhile = takeRightWhile;
+    lodash.takeWhile = takeWhile;
+    lodash.tap = tap;
+    lodash.throttle = throttle;
+    lodash.thru = thru;
+    lodash.toArray = toArray;
+    lodash.toPairs = toPairs;
+    lodash.toPairsIn = toPairsIn;
+    lodash.toPath = toPath;
+    lodash.toPlainObject = toPlainObject;
+    lodash.transform = transform;
+    lodash.unary = unary;
+    lodash.union = union;
+    lodash.unionBy = unionBy;
+    lodash.unionWith = unionWith;
+    lodash.uniq = uniq;
+    lodash.uniqBy = uniqBy;
+    lodash.uniqWith = uniqWith;
+    lodash.unset = unset;
+    lodash.unzip = unzip;
+    lodash.unzipWith = unzipWith;
+    lodash.update = update;
+    lodash.updateWith = updateWith;
+    lodash.values = values;
+    lodash.valuesIn = valuesIn;
+    lodash.without = without;
+    lodash.words = words;
+    lodash.wrap = wrap;
+    lodash.xor = xor;
+    lodash.xorBy = xorBy;
+    lodash.xorWith = xorWith;
+    lodash.zip = zip;
+    lodash.zipObject = zipObject;
+    lodash.zipObjectDeep = zipObjectDeep;
+    lodash.zipWith = zipWith;
+
+    // Add aliases.
+    lodash.entries = toPairs;
+    lodash.entriesIn = toPairsIn;
+    lodash.extend = assignIn;
+    lodash.extendWith = assignInWith;
+
+    // Add methods to `lodash.prototype`.
+    mixin(lodash, lodash);
+
+    /*------------------------------------------------------------------------*/
+
+    // Add methods that return unwrapped values in chain sequences.
+    lodash.add = add;
+    lodash.attempt = attempt;
+    lodash.camelCase = camelCase;
+    lodash.capitalize = capitalize;
+    lodash.ceil = ceil;
+    lodash.clamp = clamp;
+    lodash.clone = clone;
+    lodash.cloneDeep = cloneDeep;
+    lodash.cloneDeepWith = cloneDeepWith;
+    lodash.cloneWith = cloneWith;
+    lodash.conformsTo = conformsTo;
+    lodash.deburr = deburr;
+    lodash.defaultTo = defaultTo;
+    lodash.divide = divide;
+    lodash.endsWith = endsWith;
+    lodash.eq = eq;
+    lodash.escape = escape;
+    lodash.escapeRegExp = escapeRegExp;
+    lodash.every = every;
+    lodash.find = find;
+    lodash.findIndex = findIndex;
+    lodash.findKey = findKey;
+    lodash.findLast = findLast;
+    lodash.findLastIndex = findLastIndex;
+    lodash.findLastKey = findLastKey;
+    lodash.floor = floor;
+    lodash.forEach = forEach;
+    lodash.forEachRight = forEachRight;
+    lodash.forIn = forIn;
+    lodash.forInRight = forInRight;
+    lodash.forOwn = forOwn;
+    lodash.forOwnRight = forOwnRight;
+    lodash.get = get;
+    lodash.gt = gt;
+    lodash.gte = gte;
+    lodash.has = has;
+    lodash.hasIn = hasIn;
+    lodash.head = head;
+    lodash.identity = identity;
+    lodash.includes = includes;
+    lodash.indexOf = indexOf;
+    lodash.inRange = inRange;
+    lodash.invoke = invoke;
+    lodash.isArguments = isArguments;
+    lodash.isArray = isArray;
+    lodash.isArrayBuffer = isArrayBuffer;
+    lodash.isArrayLike = isArrayLike;
+    lodash.isArrayLikeObject = isArrayLikeObject;
+    lodash.isBoolean = isBoolean;
+    lodash.isBuffer = isBuffer;
+    lodash.isDate = isDate;
+    lodash.isElement = isElement;
+    lodash.isEmpty = isEmpty;
+    lodash.isEqual = isEqual;
+    lodash.isEqualWith = isEqualWith;
+    lodash.isError = isError;
+    lodash.isFinite = isFinite;
+    lodash.isFunction = isFunction;
+    lodash.isInteger = isInteger;
+    lodash.isLength = isLength;
+    lodash.isMap = isMap;
+    lodash.isMatch = isMatch;
+    lodash.isMatchWith = isMatchWith;
+    lodash.isNaN = isNaN;
+    lodash.isNative = isNative;
+    lodash.isNil = isNil;
+    lodash.isNull = isNull;
+    lodash.isNumber = isNumber;
+    lodash.isObject = isObject;
+    lodash.isObjectLike = isObjectLike;
+    lodash.isPlainObject = isPlainObject;
+    lodash.isRegExp = isRegExp;
+    lodash.isSafeInteger = isSafeInteger;
+    lodash.isSet = isSet;
+    lodash.isString = isString;
+    lodash.isSymbol = isSymbol;
+    lodash.isTypedArray = isTypedArray;
+    lodash.isUndefined = isUndefined;
+    lodash.isWeakMap = isWeakMap;
+    lodash.isWeakSet = isWeakSet;
+    lodash.join = join;
+    lodash.kebabCase = kebabCase;
+    lodash.last = last;
+    lodash.lastIndexOf = lastIndexOf;
+    lodash.lowerCase = lowerCase;
+    lodash.lowerFirst = lowerFirst;
+    lodash.lt = lt;
+    lodash.lte = lte;
+    lodash.max = max;
+    lodash.maxBy = maxBy;
+    lodash.mean = mean;
+    lodash.meanBy = meanBy;
+    lodash.min = min;
+    lodash.minBy = minBy;
+    lodash.stubArray = stubArray;
+    lodash.stubFalse = stubFalse;
+    lodash.stubObject = stubObject;
+    lodash.stubString = stubString;
+    lodash.stubTrue = stubTrue;
+    lodash.multiply = multiply;
+    lodash.nth = nth;
+    lodash.noConflict = noConflict;
+    lodash.noop = noop;
+    lodash.now = now;
+    lodash.pad = pad;
+    lodash.padEnd = padEnd;
+    lodash.padStart = padStart;
+    lodash.parseInt = parseInt;
+    lodash.random = random;
+    lodash.reduce = reduce;
+    lodash.reduceRight = reduceRight;
+    lodash.repeat = repeat;
+    lodash.replace = replace;
+    lodash.result = result;
+    lodash.round = round;
+    lodash.runInContext = runInContext;
+    lodash.sample = sample;
+    lodash.size = size;
+    lodash.snakeCase = snakeCase;
+    lodash.some = some;
+    lodash.sortedIndex = sortedIndex;
+    lodash.sortedIndexBy = sortedIndexBy;
+    lodash.sortedIndexOf = sortedIndexOf;
+    lodash.sortedLastIndex = sortedLastIndex;
+    lodash.sortedLastIndexBy = sortedLastIndexBy;
+    lodash.sortedLastIndexOf = sortedLastIndexOf;
+    lodash.startCase = startCase;
+    lodash.startsWith = startsWith;
+    lodash.subtract = subtract;
+    lodash.sum = sum;
+    lodash.sumBy = sumBy;
+    lodash.template = template;
+    lodash.times = times;
+    lodash.toFinite = toFinite;
+    lodash.toInteger = toInteger;
+    lodash.toLength = toLength;
+    lodash.toLower = toLower;
+    lodash.toNumber = toNumber;
+    lodash.toSafeInteger = toSafeInteger;
+    lodash.toString = toString;
+    lodash.toUpper = toUpper;
+    lodash.trim = trim;
+    lodash.trimEnd = trimEnd;
+    lodash.trimStart = trimStart;
+    lodash.truncate = truncate;
+    lodash.unescape = unescape;
+    lodash.uniqueId = uniqueId;
+    lodash.upperCase = upperCase;
+    lodash.upperFirst = upperFirst;
+
+    // Add aliases.
+    lodash.each = forEach;
+    lodash.eachRight = forEachRight;
+    lodash.first = head;
+
+    mixin(lodash, (function() {
+      var source = {};
+      baseForOwn(lodash, function(func, methodName) {
+        if (!hasOwnProperty.call(lodash.prototype, methodName)) {
+          source[methodName] = func;
+        }
+      });
+      return source;
+    }()), { 'chain': false });
+
+    /*------------------------------------------------------------------------*/
+
+    /**
+     * The semantic version number.
+     *
+     * @static
+     * @memberOf _
+     * @type {string}
+     */
+    lodash.VERSION = VERSION;
+
+    // Assign default placeholders.
+    arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
+      lodash[methodName].placeholder = lodash;
+    });
+
+    // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
+    arrayEach(['drop', 'take'], function(methodName, index) {
+      LazyWrapper.prototype[methodName] = function(n) {
+        n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
+
+        var result = (this.__filtered__ && !index)
+          ? new LazyWrapper(this)
+          : this.clone();
+
+        if (result.__filtered__) {
+          result.__takeCount__ = nativeMin(n, result.__takeCount__);
+        } else {
+          result.__views__.push({
+            'size': nativeMin(n, MAX_ARRAY_LENGTH),
+            'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
+          });
+        }
+        return result;
+      };
+
+      LazyWrapper.prototype[methodName + 'Right'] = function(n) {
+        return this.reverse()[methodName](n).reverse();
+      };
+    });
+
+    // Add `LazyWrapper` methods that accept an `iteratee` value.
+    arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
+      var type = index + 1,
+          isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
+
+      LazyWrapper.prototype[methodName] = function(iteratee) {
+        var result = this.clone();
+        result.__iteratees__.push({
+          'iteratee': getIteratee(iteratee, 3),
+          'type': type
+        });
+        result.__filtered__ = result.__filtered__ || isFilter;
+        return result;
+      };
+    });
+
+    // Add `LazyWrapper` methods for `_.head` and `_.last`.
+    arrayEach(['head', 'last'], function(methodName, index) {
+      var takeName = 'take' + (index ? 'Right' : '');
+
+      LazyWrapper.prototype[methodName] = function() {
+        return this[takeName](1).value()[0];
+      };
+    });
+
+    // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
+    arrayEach(['initial', 'tail'], function(methodName, index) {
+      var dropName = 'drop' + (index ? '' : 'Right');
+
+      LazyWrapper.prototype[methodName] = function() {
+        return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
+      };
+    });
+
+    LazyWrapper.prototype.compact = function() {
+      return this.filter(identity);
+    };
+
+    LazyWrapper.prototype.find = function(predicate) {
+      return this.filter(predicate).head();
+    };
+
+    LazyWrapper.prototype.findLast = function(predicate) {
+      return this.reverse().find(predicate);
+    };
+
+    LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
+      if (typeof path == 'function') {
+        return new LazyWrapper(this);
+      }
+      return this.map(function(value) {
+        return baseInvoke(value, path, args);
+      });
+    });
+
+    LazyWrapper.prototype.reject = function(predicate) {
+      return this.filter(negate(getIteratee(predicate)));
+    };
+
+    LazyWrapper.prototype.slice = function(start, end) {
+      start = toInteger(start);
+
+      var result = this;
+      if (result.__filtered__ && (start > 0 || end < 0)) {
+        return new LazyWrapper(result);
+      }
+      if (start < 0) {
+        result = result.takeRight(-start);
+      } else if (start) {
+        result = result.drop(start);
+      }
+      if (end !== undefined) {
+        end = toInteger(end);
+        result = end < 0 ? result.dropRight(-end) : result.take(end - start);
+      }
+      return result;
+    };
+
+    LazyWrapper.prototype.takeRightWhile = function(predicate) {
+      return this.reverse().takeWhile(predicate).reverse();
+    };
+
+    LazyWrapper.prototype.toArray = function() {
+      return this.take(MAX_ARRAY_LENGTH);
+    };
+
+    // Add `LazyWrapper` methods to `lodash.prototype`.
+    baseForOwn(LazyWrapper.prototype, function(func, methodName) {
+      var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
+          isTaker = /^(?:head|last)$/.test(methodName),
+          lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
+          retUnwrapped = isTaker || /^find/.test(methodName);
+
+      if (!lodashFunc) {
+        return;
+      }
+      lodash.prototype[methodName] = function() {
+        var value = this.__wrapped__,
+            args = isTaker ? [1] : arguments,
+            isLazy = value instanceof LazyWrapper,
+            iteratee = args[0],
+            useLazy = isLazy || isArray(value);
+
+        var interceptor = function(value) {
+          var result = lodashFunc.apply(lodash, arrayPush([value], args));
+          return (isTaker && chainAll) ? result[0] : result;
+        };
+
+        if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
+          // Avoid lazy use if the iteratee has a "length" value other than `1`.
+          isLazy = useLazy = false;
+        }
+        var chainAll = this.__chain__,
+            isHybrid = !!this.__actions__.length,
+            isUnwrapped = retUnwrapped && !chainAll,
+            onlyLazy = isLazy && !isHybrid;
+
+        if (!retUnwrapped && useLazy) {
+          value = onlyLazy ? value : new LazyWrapper(this);
+          var result = func.apply(value, args);
+          result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
+          return new LodashWrapper(result, chainAll);
+        }
+        if (isUnwrapped && onlyLazy) {
+          return func.apply(this, args);
+        }
+        result = this.thru(interceptor);
+        return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
+      };
+    });
+
+    // Add `Array` methods to `lodash.prototype`.
+    arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
+      var func = arrayProto[methodName],
+          chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
+          retUnwrapped = /^(?:pop|shift)$/.test(methodName);
+
+      lodash.prototype[methodName] = function() {
+        var args = arguments;
+        if (retUnwrapped && !this.__chain__) {
+          var value = this.value();
+          return func.apply(isArray(value) ? value : [], args);
+        }
+        return this[chainName](function(value) {
+          return func.apply(isArray(value) ? value : [], args);
+        });
+      };
+    });
+
+    // Map minified method names to their real names.
+    baseForOwn(LazyWrapper.prototype, function(func, methodName) {
+      var lodashFunc = lodash[methodName];
+      if (lodashFunc) {
+        var key = (lodashFunc.name + ''),
+            names = realNames[key] || (realNames[key] = []);
+
+        names.push({ 'name': methodName, 'func': lodashFunc });
+      }
+    });
+
+    realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
+      'name': 'wrapper',
+      'func': undefined
+    }];
+
+    // Add methods to `LazyWrapper`.
+    LazyWrapper.prototype.clone = lazyClone;
+    LazyWrapper.prototype.reverse = lazyReverse;
+    LazyWrapper.prototype.value = lazyValue;
+
+    // Add chain sequence methods to the `lodash` wrapper.
+    lodash.prototype.at = wrapperAt;
+    lodash.prototype.chain = wrapperChain;
+    lodash.prototype.commit = wrapperCommit;
+    lodash.prototype.next = wrapperNext;
+    lodash.prototype.plant = wrapperPlant;
+    lodash.prototype.reverse = wrapperReverse;
+    lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
+
+    // Add lazy aliases.
+    lodash.prototype.first = lodash.prototype.head;
+
+    if (symIterator) {
+      lodash.prototype[symIterator] = wrapperToIterator;
+    }
+    return lodash;
+  });
+
+  /*--------------------------------------------------------------------------*/
+
+  // Export lodash.
+  var _ = runInContext();
+
+  // Some AMD build optimizers, like r.js, check for condition patterns like:
+  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+    // Expose Lodash on the global object to prevent errors when Lodash is
+    // loaded by a script tag in the presence of an AMD loader.
+    // See http://requirejs.org/docs/errors.html#mismatch for more details.
+    // Use `_.noConflict` to remove Lodash from the global object.
+    root._ = _;
+
+    // Define as an anonymous module so, through path mapping, it can be
+    // referenced as the "underscore" module.
+    define(function() {
+      return _;
+    });
+  }
+  // Check for `exports` after `define` in case a build optimizer adds it.
+  else if (freeModule) {
+    // Export for Node.js.
+    (freeModule.exports = _)._ = _;
+    // Export for CommonJS support.
+    freeExports._ = _;
+  }
+  else {
+    // Export to the global object.
+    root._ = _;
+  }
+}.call(this));
diff --git a/sourcecodes/scripts/table.css b/sourcecodes/scripts/table.css
new file mode 100644
index 00000000..576f690f
--- /dev/null
+++ b/sourcecodes/scripts/table.css
@@ -0,0 +1,42 @@
+  * {
+margin: 0;
+padding: 0;
+}
+d3_table {
+width: 100%;
+  border-collapse: collapse;
+  margin: 8;
+}
+d3_caption {
+  font-size: 16pt;
+  text-align: left;
+}
+/* Zebra striping */
+d3_tr:nth-of-type(even) {
+background: LightGrey;
+}
+d3_th {
+background: #3071a9;
+color: white;
+font-size: 12pt;
+font-weight: normal;
+}
+
+d3_td, d3_th {
+padding: 6px;
+border: 1px solid #ccc;
+    text-align: center;
+}
+.horizontal-header {
+background: #3071a9;
+color: white;
+  font-size: 12pt;
+}
+.corner-header {
+background: LightGrey;
+color: black;
+  font-size: 12pt;
+}
+
+
+
diff --git a/sourcecodes/scripts/table.css~ b/sourcecodes/scripts/table.css~
new file mode 100644
index 00000000..576f690f
--- /dev/null
+++ b/sourcecodes/scripts/table.css~
@@ -0,0 +1,42 @@
+  * {
+margin: 0;
+padding: 0;
+}
+d3_table {
+width: 100%;
+  border-collapse: collapse;
+  margin: 8;
+}
+d3_caption {
+  font-size: 16pt;
+  text-align: left;
+}
+/* Zebra striping */
+d3_tr:nth-of-type(even) {
+background: LightGrey;
+}
+d3_th {
+background: #3071a9;
+color: white;
+font-size: 12pt;
+font-weight: normal;
+}
+
+d3_td, d3_th {
+padding: 6px;
+border: 1px solid #ccc;
+    text-align: center;
+}
+.horizontal-header {
+background: #3071a9;
+color: white;
+  font-size: 12pt;
+}
+.corner-header {
+background: LightGrey;
+color: black;
+  font-size: 12pt;
+}
+
+
+
diff --git a/sourcecodes/test_set_predictions.php b/sourcecodes/test_set_predictions.php
index b626dea3..ca76927b 100644
--- a/sourcecodes/test_set_predictions.php
+++ b/sourcecodes/test_set_predictions.php
@@ -1,4 +1,11 @@
-<?php 
+<head>
+<meta http-equiv='cache-control' content='no-cache'>
+<meta http-equiv='expires' content='0'>
+<meta http-equiv='pragma' content='no-cache'>
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+
+<?php
 include("header_new.inc");
 include("header_batchsearch.inc");
 include("input_validate.php");
@@ -6,47 +13,50 @@ if($_GET["My_key"]!="")
   $keyval=valid_keyval($_GET["My_key"]);
 if($_POST["My_key"]!="")
   $keyval=valid_keyval($_POST["My_key"]);
-$searchID="";
-$UploadValue="NO";
-$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
-$TextinFile="./data/".$keyval."ts_upload.txt";
 ?>
+</head>
 
 <?php
-if(isset($HTTP_POST_VARS["searchkey"]))
+$searchID="";
+$UploadValue="NO";
+$TextFile=$_FILES["MyFile"]["name"];
+//$TextinFile="./data/".$keyval."ts_upload.txt";
+$TextinFile="/var/lib/genenet/bnw/".$keyval."ts_upload.txt";
+
+if(isset($_POST["searchkey"]))
   {
-    $searchID=$HTTP_POST_VARS["searchkey"];
+    $searchID=$_POST["searchkey"];
 
   }
 
-if(isset($HTTP_POST_VARS["MyUpload"]))
+if(isset($_POST["MyUpload"]))
   {
-    $UploadValue=$HTTP_POST_VARS["MyUpload"];
+    $UploadValue=$_POST["MyUpload"];
     if ($UploadValue=="YES")
       {
         if($TextFile!="")
-	  {
-            $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
+          {
+            $sta=move_uploaded_file($_FILES['MyFile']['tmp_name'],$TextinFile);
             if(!$sta)
-	      {
+              {
                  echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>\
 ";
                  flush();
                  exit();
-	      }
+              }
             else
-	      {
+              {
                 $searchID=file_get_contents("$TextinFile");
                 //unlink($TextinFile);
 
-	      }
+              }
 
-	  }
+          }
 
        else
-	 {
+         {
            echo "<script type='text/javascript'> window.alert ('Sorry, please select upload file.')</script>";
-	 }
+         }
       }
   }
 
@@ -55,9 +65,7 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
 
 <!-- Site navigation menu -->
 <ul class="navbar2">
-  <li><p>Network ID:<br><?php print($keyval);?></p></li>
-</ul>
-<ul class="navbar">
+  <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
   <li><a href="javascript:void(0);"
   NAME="Network" title="Network" onClick=window.open("layout.php?My_key=<?php print($keyval);?>","_self");>Return to network</a>
   <li><a href="javascript:void(0);"
@@ -70,39 +78,55 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
 <!-- Main content -->
 
 <?php
-  $filename1="./data/".$keyval."ts_upload.txt";
-  $filename2="./data/".$keyval."ts_output.txt";
-if(file_exists($filename1))
+  //  $filename1="./data/".$keyval."ts_upload.txt";
+  //$filename2="./data/".$keyval."ts_output.txt";
+  $dir="/var/lib/genenet/bnw/";
+  $filename1=$keyval."ts_upload.txt";
+  $filename2=$keyval."ts_output.txt";
+$plotly_file=$keyval."ts_plotly.html";
+//$plotly_file_local="./data/".$keyval."ts_plotly.html";
+//$pred_file_local="./data/".$keyval."ts_output.txt";
+
+
+if(file_exists($dir.$filename1))
   {?>
 <br>
-Calculation submitted.
-<br>
-<a href="cv_predictions.php?My_key=<?php print($keyval);?>">Click to return to cross-validation and predictions menu</a>
+<a class=button3 href="cv_predictions.php?My_key=<?php print($keyval);?>">Calculation submitted. Click here to return to cross-validation and predictions menu.</a>
 <br>
 <?php
   }
-else if(file_exists($filename2))
-  {?>
-  <br>
-  <h2> <a href=<?php $d="./data/".$keyval."ts_output.txt"; print($d);?>>View predictions</a></h2>
-<?php
-   $plotly_file="./data/".$keyval."ts_plotly.html";
-   if(file_exists($plotly_file))
-     {?>
-     <div>
-	 <object type="text/html" data=<?php print($plotly_file);?> width="800" height="500" >
+else if(file_exists($dir.$plotly_file))
+  {
+  $table_text = json_encode(file("file://".$dir.$filename2));
+?>
+<div>
+         <object width="800" height="500" data=<?php include($dir.$plotly_file)?>
          </object>
      </div>
- <?php
-      }?>    
-  <br>
+     <div class="d3_table" id="table_div1">
+     <script type="text/javascript">
+       d3.text("", function(error,raw) {
+        var dsv=d3.dsvFormat("\t")
+	var data1 = <?php echo $table_text;?>;
+	var data2 = data1.join("");
+        var data=dsv.parse(data2)
+        var caption_text=data.pop()
+        if (error) throw error;
+        tabulate_caption("#table_div1",data,caption_text.CaseRow);
+      });
+</script>
+</div>
+  <a class=button2 href=<?php print("reroute.php?".$filename2);?>>Download predictions</a>
+<br>
+<br>
+
 <h3>Make a new set of predictions by submitting data file below</h3>
-<FORM name="key_search" enctype="multipart/form-data" ACTION="test_set_predictions.php" METHOD=POST>
+<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="test_set_predictions.php" METHOD=POST>
 <table>
 <tr>
 <td>
-<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 >
-<INPUT TYPE="submit" value="  Submit  " onclick="return Upload();">
+<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" id="MyFile_id" class="inputfile" onchange="upload_submit()">
+<label for="MyFile_id">Choose a file. . .</label>
 <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
 <INPUT TYPE="hidden" name="MyUpload" value="NO">
 </td>
@@ -116,7 +140,18 @@ else if(file_exists($filename2))
 </tr>
 </table>
 </FORM>
+<br>
+<br>
 </div>
+<script>
+ function upload_submit() {
+       Upload();
+       document.getElementById("in_form").submit();
+     }
+</script>
+  <br>
+
+
   <?php
    } else {
 ?>
@@ -124,12 +159,9 @@ else if(file_exists($filename2))
   To make prediction for several test cases, upload a file containing the test cases.
 <br>
 <br>
-    <FORM name="key_search" enctype="multipart/form-data" ACTION="test_set_predictions.php" METHOD=POST>
-<table>
-<tr>
-<td>
-<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 >
-<INPUT TYPE="submit" value="  Submit  " onclick="return Upload();">
+    <FORM name="key_search" id="in_form2" enctype="multipart/form-data" ACTION="test_set_predictions.php" METHOD=POST>
+<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" id="MyFile_id2" class="inputfile" onchange="upload_submit2()">
+<label for="MyFile_id2">Choose a file . . .</label>
 <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
 <INPUT TYPE="hidden" name="MyUpload" value="NO">
 </td>
@@ -144,6 +176,13 @@ else if(file_exists($filename2))
 </table>
 </FORM>
 </div>
+<script>
+   function upload_submit2() {
+      Upload();
+      document.getElementById("in_form2").submit();
+    }
+</script>
+
 <br>
 
 <?php
@@ -153,7 +192,8 @@ if($searchID!="")
 {
   if($UploadValue=="NO")
     {
-      $fpdata = fopen("./data/".$keyval."ts_input.txt","w");
+      //      $fpdata = fopen("./data/".$keyval."ts_input.txt","w");
+      $fpdata = fopen($dir.$keyval."ts_upload.txt","w");
       fwrite($fpdata,$searchID);
     }
   $command = './run_scripts/run_test_set '.$keyval;
diff --git a/sourcecodes/test_set_predictions_example.php b/sourcecodes/test_set_predictions_example.php
deleted file mode 100644
index 1ad96f80..00000000
--- a/sourcecodes/test_set_predictions_example.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php 
-include("header_new.inc");
-include("header_batchsearch.inc");
-include("input_validate.php");
-if($_GET["My_key"]!="")
-  $keyval=valid_keyval($_GET["My_key"]);
-if($_POST["My_key"]!="")
-  $keyval=valid_keyval($_POST["My_key"]);
-$searchID="";
-$UploadValue="NO";
-$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
-$TextinFile="./data/".$keyval."ts_upload.txt";
-?>
-
-<?php
-if(isset($HTTP_POST_VARS["searchkey"]))
-  {
-    $searchID=$HTTP_POST_VARS["searchkey"];
-
-  }
-
-if(isset($HTTP_POST_VARS["MyUpload"]))
-  {
-    $UploadValue=$HTTP_POST_VARS["MyUpload"];
-    if ($UploadValue=="YES")
-      {
-        if($TextFile!="")
-	  {
-            $sta=move_uploaded_file($HTTP_POST_FILES['MyFile']['tmp_name'],$TextinFile);
-            if(!$sta)
-	      {
-                 echo "<script type='text/javascript'> window.alert ('Sorry, error uploading $TextFile.')</script>\
-";
-                 flush();
-                 exit();
-	      }
-            else
-	      {
-                $searchID=file_get_contents("$TextinFile");
-                //unlink($TextinFile);
-
-	      }
-
-	  }
-
-       else
-	 {
-           echo "<script type='text/javascript'> window.alert ('Sorry, please select upload file.')</script>";
-	 }
-      }
-  }
-
-
-?>
-
-<!-- Site navigation menu -->
-<ul class="navbar2">
-  <li><p>Network ID:<br><?php print($keyval);?></p></li>
-</ul>
-<ul class="navbar">
-  <li><a href="javascript:void(0);"
-  NAME="Network" title="Network" onClick=window.open("layout_example.php?My_key=<?php print($keyval);?>","_self");>Return to network</a>
-  <li><a href="javascript:void(0);"
-  NAME="CV_predictions" title="CV_pred" onClick=window.open("cv_predictions_example.php?My_key=<?php print($keyval);?>","_self");>Return to validation and predictions menu</a>
-  <li><a href="help.php">Help</a>
-  <li><a href="home.php">Home</a>
-</ul>
-
-<div id="outer">
-<!-- Main content -->
-
-<?php
-  $filename1="./data/".$keyval."ts_upload.txt";
-  $filename2="./data/".$keyval."ts_output.txt";
-if(file_exists($filename1))
-  {?>
-<br>
-Calculation submitted.
-<br>
-<a href="cv_predictions_example.php?My_key=<?php print($keyval);?>">Click to return to cross-validation and predictions menu</a>
-<br>
-<?php
-  }
-else if(file_exists($filename2))
-  {?>
-  <br>
-  <h2> <a href=<?php $d="./data/".$keyval."ts_output.txt"; print($d);?>>View predictions</a></h2>
-  <br>
-<h3>Make a new set of predictions by submitting data file below</h3>
-<FORM name="key_search" enctype="multipart/form-data" ACTION="test_set_predictions_example.php" METHOD=POST>
-<table>
-<tr>
-<td>
-<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 >
-<INPUT TYPE="submit" value="  Submit  " onclick="return Upload();">
-<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-<INPUT TYPE="hidden" name="MyUpload" value="NO">
-</td>
-</tr>
-<tr>
-<!---
-<td align="left"><font color=#33339f><br>Content of uploaded data file:</font><br>
-     <textarea name="searchkey" rows="8" cols="100"><?PHP print($searchID)?> </textarea>
-</td>
----!>
-</tr>
-</table>
-</FORM>
-</div>
-  <?php
-   } else {
-?>
-<h2>Make predictions of test data file</h2>
-  To make prediction for several test cases, upload a file containing the test cases.
-<br>
-<br>
-    <FORM name="key_search" enctype="multipart/form-data" ACTION="test_set_predictions_example.php" METHOD=POST>
-<table>
-<tr>
-<td>
-<INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 >
-<INPUT TYPE="submit" value="  Submit  " onclick="return Upload();">
-<INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-<INPUT TYPE="hidden" name="MyUpload" value="NO">
-</td>
-</tr>
-<tr>
-<!---
-<td align="left"><font color=#33339f><br>Content of uploaded data file:</font><br>
-     <textarea name="searchkey" rows="8" cols="100"><?PHP print($searchID)?> </textarea>
-</td>
----!>
-</tr>
-</table>
-</FORM>
-</div>
-<br>
-
-<?php
-}
-
-if($searchID!="")
-{
-  if($UploadValue=="NO")
-    {
-      $fpdata = fopen("./data/".$keyval."ts_input.txt","w");
-      fwrite($fpdata,$searchID);
-    }
-  $command = './run_scripts/run_test_set '.$keyval;
-  $output = shell_exec("$command > /dev/null 2 > /dev/null &");
-  $pred_link='cv_predictions_example.php?My_key='.$keyval;
-}
-?>
-
-</div>
-</body>
-
-
diff --git a/sourcecodes/tier_description_processing_gom.php b/sourcecodes/tier_description_processing_gom.php
index de37d02a..9bba8fc9 100644
--- a/sourcecodes/tier_description_processing_gom.php
+++ b/sourcecodes/tier_description_processing_gom.php
@@ -6,12 +6,33 @@ function get_tier($keyval)
 {
 
 $tier=trim($_GET['tier']);
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 $tf=$dir.$keyval."tier.txt";
 $fpvar = fopen("$tf","w");
-
 fwrite($fpvar,"$tier");
 fclose($fpvar);
+
+$tierdesc=trim($_GET['tierdesc']);
+$tdf=$dir.$keyval."tierdesc.txt";
+$fpvard = fopen("$tdf","w");
+fwrite($fpvard,"$tierdesc");
+fclose($fpvard);
+
+$ban=trim($_GET['ban']);
+$banf=$dir.$keyval."ban.txt";
+$fpvarban = fopen("$banf","w");
+fwrite($fpvarban,"$ban");
+fclose($fpvarban);
+
+$white=trim($_GET['white']);
+$whitef=$dir.$keyval."white.txt";
+$fpvarwhite = fopen("$whitef","w");
+fwrite($fpvarwhite,"$white");
+fclose($fpvarwhite);
+
+
 }
 
 
@@ -47,7 +68,9 @@ function describe_tier($fpvar,$keyval)
 
 
 $tierdesc=trim($_GET['tierdesc']);
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 $tf=$dir.$keyval."tier.txt";
 $tier=file_get_contents("$tf");
 
@@ -135,9 +158,8 @@ $di++;
 }
 
 
-function banlist($fpvar)
+function banlist($fpvar,$ban)
 {
-$ban=trim($_GET['ban']);
 $data=array();
 $data=explode(",",$ban);
 $n=count($data);
@@ -158,10 +180,9 @@ for ($i=0;$i<$n;$i+=2)
 
 }
 
-function whitelist($fpvar)
+function whitelist($fpvar,$white)
 {
 
-$white=trim($_GET['white']);
 
 
 
@@ -189,12 +210,20 @@ if($d1!="" && $d2!="")
 /////////////////////Call functions//////////////////////
 
 
+$white=trim($_GET['white']);
+$ban=trim($_GET['ban']);
+
+get_tier($keyval);
+shell_exec('./run_scripts/run_settings '.$keyval);
 
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
 
 $sid1=$dir.$keyval."ban";
 $sid2=$dir.$keyval."white";
 
+
 $Textban=$sid1.".txt";
 $Textwhite=$sid2.".txt";
 $fpb = fopen($Textban,"w");
@@ -203,14 +232,13 @@ $datpost="From\tTo\n";
 fwrite($fpb,"$datpost");
 fwrite($fpw,"$datpost");
 
-get_tier($keyval);
 describe_tier($fpb,$keyval);
-banlist($fpb);
-whitelist($fpw);
+banlist($fpb,$ban);
+whitelist($fpw,$white);
 
 
 ////////////////////////////////////execute structurelearning/////////////////////////////////////////////////////////////////////////////////////////////
 ?>
 <script>
 window.open("executionprogress.php?My_key=<?php print($keyval);?>",'_self',false);
-</script>
\ No newline at end of file
+</script>
diff --git a/sourcecodes/ts_plotly.py b/sourcecodes/ts_plotly.py
index bd7d1405..cdd1321a 100644
--- a/sourcecodes/ts_plotly.py
+++ b/sourcecodes/ts_plotly.py
@@ -1,10 +1,7 @@
-#!/home/jziebart/python/Python-2.7.15/python
+#!/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3
 import os
 import sys
 
-#sys.path.append('/home/jziebart/.local/bin')
-#sys.path.append('/home/jziebart/.local/lib')
-
 import plotly
 import plotly.graph_objs as go
 import csv
@@ -16,21 +13,25 @@ outfile = netID+"ts_plotly.html"
  
 filename=netID+"ts_output.txt"
 f=open(filename,"r")
-#Read the first line to get the variable name
-line=f.readline()
-line = map(string.strip,line.strip().split(" "))
-varName = line[-1]
-
-print varName
+lines=f.readlines()
+#Read the last line to get the variable name
+line=lines.pop()
+#line = map(string.strip,line.strip().split(" "))
+line = line.strip().split(" ")
+varName = line[4][:-1]
+plot_title=varName+" Test Set Predictions"
+#print varName
+header=lines.pop(0)
 
 #Read type file to determine if it is continuous or discrete
 typefile = netID+"type.txt"
 tf=open(typefile,"r")
 line=tf.readline()
-varnames = map(string.strip,line.strip().split("\t"))
-print varnames
+#varnames = map(string.strip,line.strip().split("\t"))
+varnames = line.strip().split("\t")
 line=tf.readline()
-vartypes = map(string.strip,line.strip().split("\t"))
+#vartypes = map(string.strip,line.strip().split("\t"))
+vartypes = line.strip().split("\t")
 varindex = varnames.index(varName)
 cd_type = int(vartypes[varindex])
 
@@ -38,21 +39,33 @@ cd_type = int(vartypes[varindex])
 if cd_type == 1:
     #Make scatterplot for continuous_data
     #Read introductory lines from file
-    for i in range(6):
-        line = f.readline()
+#    for i in range(6):
+#        line = f.readline()
     #Read the data
     x = []
     y = []
-    line = f.readline()
-    while line:
-        line = map(string.strip,line.strip().split("\t"))
+#    line = f.readline()
+#    while line:
+    for line in lines:
+        #line = map(string.strip,line.strip().split("\t"))
+        line = line.strip().split("\t")
         if line[1] != 'NA':     
             x.append(float(line[1]))
             y.append(float(line[2]))
-        line=f.readline()
+#        line=f.readline()
 
     data = [go.Scatter(x=x,y=y,mode='markers')]
     layout = go.Layout(
+        title=plot_title,
+        titlefont=dict(
+            family='Arial, sans-serif',
+            size=24,
+            color='black'
+            ),
+	title_xref="paper",
+	title_x=0.5,
+	title_xanchor="center",
+	title_yanchor="middle",
         xaxis=dict(
             autorange=True,
             title='Actual values',
@@ -70,7 +83,8 @@ if cd_type == 1:
                 size=18,
                 color='black'
                 ),
-            )
+            ),
+        margin=dict(t=30,l=50,b=40)
         )
     fig = go.Figure(data=data, layout = layout)
     plotly.offline.plot(fig,filename=outfile)
@@ -78,17 +92,20 @@ if cd_type == 1:
 else:
     #Make bar chart for discrete data
     #Read introductory lines from file
-    for i in range(5):
-        line = f.readline()
+#    for i in range(5):
+#        line = f.readline()
     #Get names of states
-    line = map(string.strip,line.strip().split("\t"))
-    states = line[2:]
+    #header = map(string.strip,header.strip().split("\t"))
+    header = header.strip().split("\t")
+    states = header[2:]
     #Read the data
     actual = []
     predicted = []
-    line = f.readline()
-    while line:
-        line = map(string.strip,line.strip().split("\t"))
+#    line = f.readline()
+#    while line:
+    for line in lines:
+        #line = map(string.strip,line.strip().split("\t"))
+        line = line.strip().split("\t")
         if line[1] != 'NA':
             actual.append(line[1])
             predict_x = line[2:]
@@ -102,7 +119,7 @@ else:
             if len(max_items) > 1:
                 predicted.pop()
                 actual.pop()
-        line=f.readline()
+#        line=f.readline()
     
     #Go through states and get number of true positives, false positives, and false negatives
     tp_all = []
@@ -125,15 +142,22 @@ else:
         tp_all.append(tp)
         fn_all.append(fn)
         fp_all.append(fp)
-    print tp_all
-    print fn_all
-    print fp_all
     trace1 = go.Bar(x=states,y=tp_all,name="True Positives")
     trace2 = go.Bar(x=states,y=fn_all,name="False Negatives")
     trace3 = go.Bar(x=states,y=fp_all,name="False Positives")
     data = [trace1,trace2,trace3]
     layout = go.Layout(
         barmode='group',
+        title=plot_title,
+        titlefont=dict(
+            family='Arial, sans-serif',
+            size=24,
+            color='black'
+            ),
+	title_xref="paper",
+	title_x=0.5,
+	title_xanchor="center",
+	title_yanchor="middle",
         xaxis=dict(
             autorange=True,
             title='State',
@@ -151,7 +175,8 @@ else:
                 size=18,
                 color='black'
                 ),
-            )
+            ),
+        margin=dict(t=30,l=50,b=40)
     )
     fig = go.Figure(data=data, layout = layout)
     plotly.offline.plot(fig,filename=outfile)
diff --git a/sourcecodes/upload_structure_file.php b/sourcecodes/upload_structure_file.php
index 9eb6694b..35758533 100644
--- a/sourcecodes/upload_structure_file.php
+++ b/sourcecodes/upload_structure_file.php
@@ -1,3 +1,6 @@
+<meta charset="utf-8">
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
 <?php
   //Going to modify this so it just writes the uploaded data to a file.
   //Standardization and determining other factors will be performed in
@@ -10,7 +13,7 @@ include("input_validate.php");
 
 $searchID="";
 $UploadValue="NO";
-$TextFile=$HTTP_POST_FILES["MyFile"]["name"];
+$TextFile=$_FILES["MyFile"]["name"];
 
 
 /////////////Generate a random key/////////////////////
@@ -31,14 +34,19 @@ if($_POST["My_key"]!="")
 $keyval=valid_keyval($keyval);
 
 $sid=$keyval."continuous_input";
-$dir="./data/";
+//$dir="./data/";
+//$dir="/tmp/bnw/";
+$dir="/var/lib/genenet/bnw/";
+
+//$input_table_file="./data/".$keyval."input_table.txt";
+$input_table_file=$dir.$keyval."input_table.txt";
 
 $TextinFile=$dir.$sid."_orig.txt";
 
 
-if(isset($HTTP_POST_VARS["searchkey"]))
+if(isset($_POST["searchkey"]))
 {
-   $searchID=$HTTP_POST_VARS["searchkey"];
+   $searchID=$_POST["searchkey"];
 
 }
 
@@ -47,7 +55,7 @@ if($searchID=="")
 ?>
 
 <!-- Site navigation menu -->
-<ul class="navbar">
+<ul class="navbar2">
   <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
@@ -55,9 +63,9 @@ if($searchID=="")
 <?php
 }
 
-if(isset($HTTP_POST_VARS["MyUpload"]))
+if(isset($_POST["MyUpload"]))
 {
-   $UploadValue=$HTTP_POST_VARS["MyUpload"];
+   $UploadValue=$_POST["MyUpload"];
    if ($UploadValue=="YES")
    {
         if($TextFile!="")
@@ -88,32 +96,26 @@ if(isset($HTTP_POST_VARS["MyUpload"]))
 ?>
 <div id="outernew">
 <h2><font>Upload data file</font></h2>
-<FORM name="key_search" enctype="multipart/form-data" ACTION="upload_structure_file.php" METHOD=POST>
-
-<table align="left" cellspacing="3" cellpadding="1" border="0"  width="90%">
-<tr>
-   <td>
-       <INPUT style="background-color:#FFFFFF;color:#0000FF" type="file" name="MyFile" size=45 > 
-       <INPUT TYPE="submit" value="  Upload  " onclick="return Upload();">
-      <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-        <INPUT TYPE="hidden" name="MyUpload" value="NO"> 
-   </td>
-</tr>
-<tr>
-   <td><font color=#3735CA><br>Content of uploaded data file:</font><br>
-          <textarea name="searchkey" rows="10" cols="100"><?PHP print($searchID)?> </textarea>
-  </td>
-</tr>
-<tr>
-    <td>
-       <INPUT TYPE="submit" value="  Load example data  " onclick="return demo();">&nbsp&nbsp&nbsp
+<FORM name="key_search" id="in_form" enctype="multipart/form-data" ACTION="upload_structure_file.php" METHOD=POST>
+<INPUT style="background-color:#FFFFFF;" type="file" name="MyFile" id="MyFile_id" class="inputfile" onchange="upload_submit()" >
+<label for="MyFile_id">Choose a file. . .</label>
+  <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
+<INPUT TYPE="hidden" name="MyUpload" value="NO">
+  <textarea name="searchkey" style="display:none;"><?PHP print($searchID)?> </textarea>
+<br><br>
+  <INPUT TYPE="submit" class=button2 value="  Load example data  " onclick="return demo();">&nbsp&nbsp&nbsp
       <INPUT TYPE="hidden" NAME="My_key" value=<?php print($keyval) ?> >
-    </td>
-</tr>
-
-</table>
 </FORM>
 </div>
+<script>
+  function upload_submit() {
+    Upload();
+    document.getElementById("in_form").submit();
+  }
+</script>
+
+
+
 <?php
 
 if($searchID!="")
@@ -126,16 +128,39 @@ if($searchID!="")
   shell_exec('./run_scripts/run_prep_input '.$keyval);
 ?>
 <ul class="navbar2">
-  <li><a href="net_structure.php?My_key=<?php print($keyval);?>">Upload structure file</a>
-  <li><a href="javascript:void(0);"
-NAME="InputCheck" title="InputCheck"
-    onClick=window.open("input_check.php?My_key=<?php print($keyval);?>","Rat//ting","width=950,height=270,0,status=0,");>View uploaded variables and data</a>
-</ul>
-<ul class="navbar">
   <li><a href="help.php#file_format" target="_blank">Data formatting guidelines</a> 
   <li><a href="help.php" target="_blank">Help</a>
   <li><a href="home.php">Home</a>
 </ul>
+<div id="outernew_load">
+<br>
+<a class=button3 href="net_structure.php?My_key=<?php print($keyval);?>">Upload structure file</a>
+<br>
+<br>
+<p><h3>The variables in the data file have the following properties:
+<br></h3>
+<?php
+$table_text = json_encode(file("file://".$input_table_file));
+?>
+  <div class="d3_table" id="table_div1">
+  <script type="text/javascript">
+   d3.text("", function(error, raw_temp){
+       var dsv = d3.dsvFormat("\t");
+       var data1 = <?php echo $table_text?>;
+	var data2 = data1.join("");
+	 var data = dsv.parse(data2);
+	 var caption_text = data.pop();
+       if (error) throw error;
+       tabulate_caption("#table_div1",data,caption_text.Variable);
+     });
+</script>
+</div>
+<br><br><br></h3>
+</p>
+<br>
+
+
+
 <?php
 }
 ?>
diff --git a/sourcecodes/cv_predictions_example.php b/sourcecodes/view_distributions.php
index 10487de8..811f0c35 100644
--- a/sourcecodes/cv_predictions_example.php
+++ b/sourcecodes/view_distributions.php
@@ -13,7 +13,7 @@ $keyval=valid_keyval($_GET["My_key"]);
 </ul>
 <ul class="navbar">
   <li><a href="javascript:void(0);"
-    NAME="Network" title="Network" onClick=window.open("layout_example.php?My_key=<?php print($keyval);?>","_self");>Return to network</a>
+    NAME="Network" title="Network" onClick=window.open("layout.php?My_key=<?php print($keyval);?>","_self");>Return to network</a>
   <li><a href="help.php">Help</a>
   <li><a href="home.php">Home</a>
 
@@ -33,17 +33,17 @@ $keyval=valid_keyval($_GET["My_key"]);
 if(file_exists($loo_file1))
   {?>
 <li>1: Leave-one-out cross-validation predictions are being calculated.
-     <a href="cv_predictions_example.php?My_key=<?php print($keyval);?>">Refresh to update status</a>
+     <a href="cv_predictions.php?My_key=<?php print($keyval);?>">Refresh and update status</a>
 <br>
 </li>
   <?php
    } else if(file_exists($loo_file2)) {
    ?>   
-<li>1: <a href="cross_valid_example.php?My_key=<?php print($keyval);?>" target='_self'>Leave-one-out cross-validation results are available.</a></li>
+<li>1: <a href="cross_valid.php?My_key=<?php print($keyval);?>" target='_self'>Leave-one-out cross-validation results are available.</a></li>
   <?php
     } else {
   ?>
-  <li>1: <a href="cross_valid_example.php?My_key=<?php print($keyval);?>" target='_self'>Perform leave-one-out cross-validation</a></li>
+  <li>1: <a href="cross_valid.php?My_key=<?php print($keyval);?>" target='_self'>Perform leave-one-out cross-validation</a></li>
   <?php
     }
    ?>
@@ -53,17 +53,17 @@ if(file_exists($loo_file1))
 if(file_exists($kfold_file1))
   {?>
 <li>2: k-fold cross-validation predictions are being calculated.
-     <a href="cv_predictions_example.php?My_key=<?php print($keyval);?>">Refresh to update status</a>
+     <a href="cv_predictions.php?My_key=<?php print($keyval);?>">Refresh and update status</a>
 <br>
 </li>
   <?php
    } else if(file_exists($kfold_file2)) {
    ?>   
-<li>2: <a href="kfold_cv_example.php?My_key=<?php print($keyval);?>" target='_self'>k-fold cross-validation results are available</a></li>
+<li>2: <a href="kfold_cv.php?My_key=<?php print($keyval);?>" target='_self'>k-fold cross-validation results are available</a></li>
   <?php
     } else {
   ?>
-  <li>2: <a href="kfold_cv_example.php?My_key=<?php print($keyval);?>" target='_self'>Perform k-fold cross-validation</a></li>
+  <li>2: <a href="kfold_cv.php?My_key=<?php print($keyval);?>" target='_self'>Perform k-fold cross-validation</a></li>
   <?php
     }
    ?>
@@ -73,17 +73,17 @@ if(file_exists($kfold_file1))
 if(file_exists($ts_file1))
   {?>
 <li>3: Test set predictions are being calculated.
-     <a href="cv_predictions_example.php?My_key=<?php print($keyval);?>">Refresh to update status</a>
+     <a href="cv_predictions.php?My_key=<?php print($keyval);?>">Refresh and update status</a>
 <br>
 </li>
   <?php
    } else if(file_exists($ts_file2)) {
    ?>   
-<li>3: <a href="test_set_predictions_example.php?My_key=<?php print($keyval);?>" target='_self'>Test set predictions are available</a></li>
+<li>3: <a href="test_set_predictions.php?My_key=<?php print($keyval);?>" target='_self'>Test set predictions are available</a></li>
   <?php
     } else {
   ?>
-  <li>3: <a href="test_set_predictions_example.php?My_key=<?php print($keyval);?>" target='_self'>Make predictions using a test data set</a></li>
+  <li>3: <a href="test_set_predictions.php?My_key=<?php print($keyval);?>" target='_self'>Make predictions using a test data set</a></li>
   <?php
     }
    ?>
diff --git a/sourcecodes/view_input_data.php b/sourcecodes/view_input_data.php
new file mode 100644
index 00000000..bcf61a3a
--- /dev/null
+++ b/sourcecodes/view_input_data.php
@@ -0,0 +1,203 @@
+<head>
+<meta charset="utf-8">
+<script src="./scripts/d3.v4.min.js"></script>
+<?php 
+include("header_new.inc");
+include("input_validate.php");
+if($_GET["My_key"]!="")
+  $keyval=valid_keyval($_GET["My_key"]);
+if($_POST["My_key"]!="")
+  $keyval=valid_keyval($_POST["My_key"]);
+
+$input_table_file="./data/".$keyval."input_table.txt";
+$input_data_file="./data/".$keyval."continuous_input_orig.txt";
+
+
+?>
+
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+  
+  <!--[if !IE]><!-->
+  <style>
+  * { 
+margin: 0; 
+padding: 0; 
+}
+/* 
+   Generic Styling, for Desktops/Laptops 
+*/
+table { 
+width: 100%; 
+  border-collapse: collapse; 
+}
+/* Zebra striping */
+tr:nth-of-type(odd) { 
+background: LightGrey; 
+}
+th { 
+background: #3071a9; 
+color: white; 
+  font-size: 12pt; 
+}
+td, th { 
+padding: 6px; 
+border: 1px solid #ccc; 
+    text-align: left; 
+}
+
+th.des:after {
+content: "\21E9";
+}
+    
+th.aes:after {
+content: "\21E7";
+}
+
+/* 
+   Max width before this PARTICULAR table gets nasty
+   This query will take effect for any screen smaller than 760px
+   and also iPads specifically.
+*/
+@media 
+only screen and (max-width: 760px),
+  (min-device-width: 768px) and (max-device-width: 1024px)  {
+  
+  /* Force table to not be like tables anymore */
+  table, thead, tbody, th, td, tr { 
+  display: block; 
+  }
+  
+  /* Hide table headers (but not display: none;, for accessibility) */
+  thead tr { 
+  position: absolute;
+  top: -9999px;
+  left: -9999px;
+  }
+  
+  tr { border: 1px solid #ccc; }
+      
+      td { 
+      /* Behave  like a "row" */
+    border: none;
+      border-bottom: 1px solid #eee; 
+	position: relative;
+      padding-left: 50%; 
+    }
+    
+  td:before { 
+      /* Now like a table header */
+    position: absolute;
+      /* Top/left values mimic padding */
+    top: 6px;
+    left: 6px;
+    width: 45%; 
+      padding-right: 10px; 
+      white-space: nowrap;
+    }
+    
+    /*
+      Label the data
+    */
+  td:before {
+    content: attr(data-th) ": ";
+      font-weight: bold;
+    width: 6.5em;
+    display: inline-block;
+    }
+  }
+  
+  /* Smartphones (portrait and landscape) ----------- */
+  @media only screen
+    and (min-device-width : 320px)
+    and (max-device-width : 480px) {
+    body { 
+    padding: 0; 
+    margin: 0; 
+    width: 320px; }
+  }
+  
+  /* iPads (portrait and landscape) ----------- */
+  @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
+    body { 
+    width: 495px; 
+    }
+  }
+  
+  </style>
+      <!--<![endif]-->
+
+</head>
+
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><p>Network ID:<br><?php print($keyval);?></p></li>
+  <li><a href="help.php">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+<body>
+  <div id="violin_div">
+
+  <h1>D3.js Sortable & Responsive Table</h1>
+    
+  <p>Click the table header to sort data according to that column</p>
+
+  </div>
+  <script type="text/javascript">
+  d3.text("<?php print($input_table_file);?>", function(error, raw){
+  var dsv = d3.dsvFormat("\t")
+  var data = dsv.parse(raw)
+    var caption_text = data.pop();
+  console.log(caption_text.Variable);
+      if (error) throw error;
+      var sortAscending = true;
+      var table = d3.select('#violin_div').append('table');
+      var caption = table.append("caption").text(caption_text.Variable);
+      var titles = d3.keys(data[0]);
+      var headers = table.append('thead').append('tr')
+	.selectAll('th')
+	.data(titles).enter()
+	.append('th')
+	.text(function (d) {
+	    return d;
+	  })
+	.on('click', function (d) {
+	    headers.attr('class', 'header');
+	       
+	    if (sortAscending) {
+	      rows.sort(function(a, b) { return b[d] < a[d]; });
+	      sortAscending = false;
+	      this.className = 'aes';
+	    } else {
+	      rows.sort(function(a, b) { return b[d] > a[d]; });
+	      sortAscending = true;
+	      this.className = 'des';
+	    }
+	       
+	  });
+        
+      var rows = table.append('tbody').selectAll('tr')
+	.data(data).enter()
+	.append('tr');
+      rows.selectAll('td')
+	.data(function (d) {
+	    return titles.map(function (k) {
+		return { 'value': d[k], 'name': k};
+	      });
+	  }).enter()
+	.append('td')
+	.attr('data-th', function (d) {
+	    return d.name;
+	  })
+	.text(function (d) {
+	    return d.value;
+	  });
+    });
+ 
+
+</script>
+</div>
+</body>
+
+
diff --git a/sourcecodes/view_input_data_text.php b/sourcecodes/view_input_data_text.php
new file mode 100644
index 00000000..0f5e75c8
--- /dev/null
+++ b/sourcecodes/view_input_data_text.php
@@ -0,0 +1,62 @@
+<head>
+<meta charset="utf-8">
+<script src="./scripts/d3.v4.min.js"></script>
+<script src="./scripts/create_table.js"></script>
+<?php 
+include("header_new.inc");
+include("input_validate.php");
+if($_GET["My_key"]!="")
+  $keyval=valid_keyval($_GET["My_key"]);
+if($_POST["My_key"]!="")
+  $keyval=valid_keyval($_POST["My_key"]);
+
+$input_table_file="./data/".$keyval."input_table.txt";
+$input_data_file="./data/".$keyval."continuous_input_orig.txt";
+
+
+?>
+
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+</head>
+
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li><p>Network ID:<br><?php print($keyval);?></p></li>
+  <li><a href="help.php">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+<body>
+  <div id="table_div">
+  <div id="table_div1">
+  <script type="text/javascript">
+  d3.text("<?php print($input_table_file);?>", function(error, raw){
+  var dsv = d3.dsvFormat("\t")
+  var data = dsv.parse(raw)
+  var caption_text = data.pop();
+  if (error) throw error;
+      tabulate_caption("#table_div1",data,caption_text.Variable);
+    });
+</script>
+</div>
+<br>
+  <div id="table_div2">
+
+  <script type="text/javascript">
+
+  d3.text("<?php print($input_data_file);?>", function(error, raw){
+  var dsv = d3.dsvFormat("\t")
+  var data = dsv.parse(raw)
+  var caption_text = "Input data file:";
+      if (error) throw error;
+      tabulate_caption("#table_div2",data,caption_text);
+    });
+
+</script>
+ </div>
+
+</div>
+</body>
+
+
diff --git a/sourcecodes/violin.php b/sourcecodes/violin.php
new file mode 100644
index 00000000..5733dff3
--- /dev/null
+++ b/sourcecodes/violin.php
@@ -0,0 +1,57 @@
+<?php 
+include("header_new.inc");
+include("input_validate.php");
+include("reroute_image.php");
+if($_GET["My_key"]!="")
+  $keyval=valid_keyval($_GET["My_key"]);
+//if($_POST["My_key"]!="")
+//  $keyval=valid_keyval($_POST["My_key"]);
+
+$dir="/var/lib/genenet/bnw/";
+$plotly_file=$keyval."violin_plotly.html";
+$plotly_ev_file=$keyval."violin_plotly_evidence.html";
+//$plotly_file_tmp="/tmp/bnw/".$keyval."violin_plotly.html";
+//$plotly_ev_file_tmp="/tmp/bnw/".$keyval."violin_plotly_evidence.html";
+
+?>
+
+<!-- Site navigation menu -->
+<ul class="navbar2">
+  <li class="noHover"><p>Network ID:<br><?php print($keyval);?></p></li>
+  <li><a href="help.php">Help</a>
+  <li><a href="home.php">Home</a>
+</ul>
+
+
+
+
+<div id="violin_div">
+<!-- Main content -->
+<?php
+  if(file_exists($dir.$plotly_file))
+    {
+   $file_data=file_get_contents($dir.$plotly_file); 
+?>
+
+ <object width="100%" height="500" data=<?=$file_data?> 
+ </object>
+<?php
+    } else {
+?>
+   <div id="outernew">
+   <h3> No violin plot data file found. </h3>
+<?php
+}
+  if(file_exists($dir.$plotly_ev_file))
+    $ev_file_data=file_get_contents($dir.$plotly_ev_file);
+    {?>
+ <object width="100%" height="500" data=<?=$ev_file_data?>
+ </object>
+<?php
+    }
+?>
+
+</div>
+</body>
+
+
diff --git a/sourcecodes/violin_ev_plotly.py b/sourcecodes/violin_ev_plotly.py
new file mode 100644
index 00000000..69609d94
--- /dev/null
+++ b/sourcecodes/violin_ev_plotly.py
@@ -0,0 +1,137 @@
+#!/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3
+import os
+import sys
+import math
+#sys.path.append('/home/jziebart/.local/bin')
+#sys.path.append('/home/jziebart/.local/lib')
+
+import plotly
+import plotly.graph_objs as go
+import csv
+import string
+
+def mean_stdev(y):
+    mean = sum(y)
+    mean = sum(y)/len(y)
+    stdev = 0
+    for yi in y:
+        stdev = stdev + (yi - mean)**2
+    stdev = stdev/(len(y)-1)
+    stdev = math.sqrt(stdev)
+    return mean,stdev;
+
+def standardize(y):
+    mean,stdev = mean_stdev(y)
+    ystd = []
+    for yi in y:
+        yi = (yi - mean)/stdev
+        ystd.append(yi)
+    return ystd
+
+
+netID = sys.argv[-1]
+outfile = netID+"violin_plotly_evidence.html"
+
+ 
+filename=netID+"continuous_input.txt"
+f=open(filename,"r")
+#Read the first line to get the variable names
+line=f.readline()
+#line = map(string.strip,line.strip().split("\t"))
+varNames = line.strip().split("\t")
+#varNames = line
+line=f.readline()
+#line = map(string.strip,line.strip().split("\t"))
+line = line.strip().split("\t")
+for i in range(len(line)):
+    line[i] = int(line[i])
+cd_types = line
+cNames = []
+for i in range(len(varNames)):
+    if cd_types[i] == 1:
+        cNames.append(varNames[i])
+
+#Get the variables with evidence
+evfile=netID+"varname.txt"
+evf=open(evfile,"r")
+line=evf.readline()
+#ev_vars = map(string.strip,line.strip().split("\t"))
+ev_vars = line.strip().split("\t")
+keepVars = []
+for i in cNames:
+    if i not in ev_vars:
+        keepVars.append(i)
+
+#Read in original data
+data = []
+line = f.readline()
+while line:
+    #line = map(string.strip,line.strip().split("\t"))
+    line = line.strip().split("\t")
+    temp = []
+    for i in range(len(varNames)):
+       if cd_types[i] == 1:
+            temp.append(float(line[i]))
+    data.append(temp)
+    line = f.readline()
+
+#Read in data for violin plots
+filename2=netID+"violin_evidence.txt"
+f2=open(filename2,"r")
+line = f2.readline()
+pdf_varName = []
+pdf_data = []
+while line:
+    line = line.strip()
+    if line == "Data for new node":
+        line = f2.readline()
+        pdf_varName.append(line.strip())
+        line = f2.readline()
+        pdf_data.append([line.strip()])
+    else:
+        pdf_data[-1].append(float(line.strip()))
+    line = f2.readline()
+
+layout = go.Layout(
+    title="Distributions considering evidence",
+    titlefont=dict(
+        family='Arial, sans-serif',
+        size=24,
+        color='black'
+        ),
+    title_xref="paper",
+    title_x=0.5,
+    title_xanchor="center",
+    title_yanchor="middle",
+    yaxis=dict(title="Distributions of standardized data"),
+    legend=dict(orientation='h'),
+    margin=dict(t=40,l=70,b=40)
+)
+fig = go.Figure(layout=layout)
+
+icount = 0
+for i in range(len(keepVars)):
+    for j in range(len(cNames)):
+        if keepVars[i] == cNames[j]:
+            idata = j
+            break
+    for j in range(len(pdf_varName)):
+        if keepVars[i] == pdf_varName[j]:
+            ipdf = j
+            break
+    y = []
+    for j in range(len(data)):
+        y.append(data[j][idata])
+    y_stand = standardize(y)
+    #Add traces to violin plot
+    if icount == 0:
+        fig.add_trace(go.Violin(y=y_stand,x0=cNames[idata],side='negative',legendgroup='Data',name='Fit to original data',fillcolor='blue',line=dict(color='blue'),hoverinfo='none',points='all',scalegroup=cNames[idata]))
+        fig.add_trace(go.Violin(y=pdf_data[ipdf],x0=cNames[idata],side='positive',legendgroup='Network parameters considering evidence',name='Network parameters considering evidence',fillcolor='orange',line=dict(color='orange'),hoverinfo='none',points=False,scalegroup=cNames[idata]))
+        icount = 1
+    else:
+        fig.add_trace(go.Violin(y=y_stand,x0=cNames[idata],side='negative',legendgroup='Data',name='Data',fillcolor='blue',line=dict(color='blue'),showlegend=False,hoverinfo='none',points='all',scalegroup=cNames[idata]))
+        fig.add_trace(go.Violin(y=pdf_data[ipdf],x0=cNames[idata],side='positive',legendgroup='Network parameters considering evidence',name='Network parameters considering evidence',fillcolor='orange',line=dict(color='orange'),showlegend=False,hoverinfo='none',points=False,scalegroup=cNames[idata]))
+
+
+plotly.offline.plot(fig,filename=outfile)
+
diff --git a/sourcecodes/violin_int_plotly.py b/sourcecodes/violin_int_plotly.py
new file mode 100644
index 00000000..15889500
--- /dev/null
+++ b/sourcecodes/violin_int_plotly.py
@@ -0,0 +1,149 @@
+#!/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3
+import os
+import sys
+import math
+#sys.path.append('/home/jziebart/.local/bin')
+#sys.path.append('/home/jziebart/.local/lib')
+
+import plotly
+import plotly.graph_objs as go
+import csv
+import string
+
+def mean_stdev(y):
+    mean = sum(y)
+    mean = sum(y)/len(y)
+    stdev = 0
+    for yi in y:
+        stdev = stdev + (yi - mean)**2
+    stdev = stdev/(len(y)-1)
+    stdev = math.sqrt(stdev)
+    return mean,stdev;
+
+def standardize(y):
+    mean,stdev = mean_stdev(y)
+    ystd = []
+    for yi in y:
+        yi = (yi - mean)/stdev
+        ystd.append(yi)
+    return ystd
+
+
+netID = sys.argv[-1]
+outfile = netID+"violin_plotly_evidence.html"
+
+ 
+filename=netID+"continuous_input.txt"
+f=open(filename,"r")
+#Read the first line to get the variable names
+line=f.readline()
+#line = map(string.strip,line.strip().split("\t"))
+varNames = line.strip().split("\t")
+#varNames = line
+line=f.readline()
+#line = map(string.strip,line.strip().split("\t"))
+line = line.strip().split("\t")
+for i in range(len(line)):
+    line[i] = int(line[i])
+cd_types = line
+cNames = []
+for i in range(len(varNames)):
+    if cd_types[i] == 1:
+        cNames.append(varNames[i])
+
+#Get the variables impacted by intervention
+param_file = []
+intfile=netID+"parameters_ev.txt"
+intf=open(intfile,"r")
+line=intf.readline()
+while line:
+    #line = map(string.strip,line.strip().split("\t"))
+    line = line.strip().split("\t")
+    param_file.append(line)
+    line=intf.readline()
+keepVars = []
+temp=[]
+for i in range(len(param_file)):
+    if len(param_file[i][0]) == 0:
+        desc = temp[1][0].split()
+        if desc[0] == 'Mean':
+            temp2 = temp[0][0].split()
+            keepVars.append(temp2[0])
+        temp=[]
+    else:
+        temp.append(param_file[i])
+
+#Read in original data
+data = []
+line = f.readline()
+while line:
+    #line = map(string.strip,line.strip().split("\t"))
+    line = line.strip().split("\t")
+    temp = []
+    for i in range(len(varNames)):
+        if cd_types[i] == 1:
+            temp.append(float(line[i]))
+    data.append(temp)
+    line = f.readline()
+
+#Read in data for violin plots
+filename2=netID+"violin_evidence.txt"
+f2=open(filename2,"r")
+line = f2.readline()
+pdf_varName = []
+pdf_data = []
+while line:
+    line = line.strip()
+    if line == "Data for new node":
+        line = f2.readline()
+        pdf_varName.append(line.strip())
+        line = f2.readline()
+        pdf_data.append([line.strip()])
+    else:
+        pdf_data[-1].append(float(line.strip()))
+    line = f2.readline()
+
+
+layout = go.Layout(
+    title="Distributions after intervention",
+    titlefont=dict(
+        family='Arial, sans-serif',
+        size=24,
+        color='black'
+        ),
+    title_xref="paper",
+    title_x=0.5,
+    title_xanchor="center",
+    title_yanchor="middle",
+    yaxis=dict(title="Distributions of standardized data"),
+    legend=dict(orientation='h'),
+    margin=dict(t=40,l=70,b=40)
+)
+fig = go.Figure(layout=layout)
+
+icount = 0
+for i in range(len(keepVars)):
+    for j in range(len(cNames)):
+        if keepVars[i] == cNames[j]:
+            idata = j
+            break
+    for j in range(len(pdf_varName)):
+        if keepVars[i] == pdf_varName[j]:
+            ipdf = j
+            break
+    y = []
+    for j in range(len(data)):
+        y.append(data[j][idata])
+    y_stand = standardize(y)
+    #Add traces to violin plot
+    if icount == 0:
+        fig.add_trace(go.Violin(y=y_stand,x0=cNames[idata],side='negative',legendgroup='Data',name='Fit to original data',fillcolor='blue',line=dict(color='blue'),hoverinfo='none',points='all',scalegroup=cNames[idata]))
+        fig.add_trace(go.Violin(y=pdf_data[ipdf],x0=cNames[idata],side='positive',legendgroup='Network parameters after intervention',name='Network parameters after intervention',fillcolor='orange',line=dict(color='orange'),hoverinfo='none',points=False,scalegroup=cNames[idata]))
+        icount = 1
+    else:
+        fig.add_trace(go.Violin(y=y_stand,x0=cNames[idata],side='negative',legendgroup='Data',name='Data',fillcolor='blue',line=dict(color='blue'),showlegend=False,hoverinfo='none',points='all',scalegroup=cNames[idata]))
+        fig.add_trace(go.Violin(y=pdf_data[ipdf],x0=cNames[idata],side='positive',legendgroup='Network parameters after invervention',name='Network parameters after intervention',fillcolor='orange',line=dict(color='orange'),showlegend=False,hoverinfo='none',points=False,scalegroup=cNames[idata]))
+
+
+plotly.offline.plot(fig,filename=outfile)
+
diff --git a/sourcecodes/violin_plotly.py b/sourcecodes/violin_plotly.py
new file mode 100644
index 00000000..8e0f8ea2
--- /dev/null
+++ b/sourcecodes/violin_plotly.py
@@ -0,0 +1,123 @@
+#!/var/www/html/compbio/BNW_1.3/bnw-env/bin/python3
+import os
+import sys
+import math
+#sys.path.append('/home/jziebart/.local/bin')
+#sys.path.append('/home/jziebart/.local/lib')
+
+
+import plotly
+import plotly.graph_objs as go
+import csv
+import string
+
+def mean_stdev(y):
+    mean = sum(y)
+    mean = sum(y)/len(y)
+    stdev = 0
+    for yi in y:
+        stdev = stdev + (yi - mean)**2
+    stdev = stdev/(len(y)-1)
+    stdev = math.sqrt(stdev)
+    return mean,stdev;
+
+def standardize(y):
+    mean,stdev = mean_stdev(y)
+    ystd = []
+    for yi in y:
+        yi = (yi - mean)/stdev
+        ystd.append(yi)
+    return ystd
+
+
+netID = sys.argv[-1]
+outfile = netID+"violin_plotly.html"
+
+ 
+filename=netID+"continuous_input.txt"
+f=open(filename,"r")
+#Read the first line to get the variable names
+line=f.readline()
+#line = map(string.strip,line.strip().split("\t"))
+varNames = line.strip().split("\t")
+line=f.readline()
+#line = map(string.strip,line.strip().split("\t"))
+line = line.strip().split("\t")
+for i in range(len(line)):
+    line[i] = int(line[i])
+cd_types = line
+cNames = []
+for i in range(len(varNames)):
+    if cd_types[i] == 1:
+        cNames.append(varNames[i])
+
+#Read in original data
+data = []
+line = f.readline()
+while line:
+    #line = map(string.strip,line.strip().split("\t"))
+    line = line.strip().split("\t")
+    temp = []
+    for i in range(len(varNames)):
+        if cd_types[i] == 1:
+            temp.append(float(line[i]))
+    data.append(temp)
+    line = f.readline()
+
+#Read in data for violin plots
+filename2=netID+"violin_orig.txt"
+f2=open(filename2,"r")
+line = f2.readline()
+pdf_data = []
+while line:
+    line = line.strip()
+    if line == "Data for new node":
+        line = f2.readline()
+        pdf_data.append([line.strip()])
+    else:
+        pdf_data[-1].append(float(line.strip()))
+    line = f2.readline()
+
+pdf_data2 = []
+for i in range(len(cNames)):
+    for j in range(len(pdf_data)):
+        if cNames[i] == pdf_data[j][0]:
+            pdf_data2.append(pdf_data[j][1:])
+
+del pdf_data
+
+layout = go.Layout(
+    title="Original distributions",
+    titlefont=dict(
+        family='Arial, sans-serif',
+        size=24,
+        color='black'
+        ),
+    title_xref="paper",
+    title_x=0.5,
+    title_xanchor="center",
+    title_yanchor="middle",
+    yaxis=dict(title="Distributions of standardized data"),
+    legend=dict(orientation='h'),
+    margin=dict(t=40,l=70,b=40)
+)
+fig = go.Figure(layout=layout)
+
+for i in range(len(cNames)):
+    y = []
+    for j in range(len(data)):
+        y.append(data[j][i])
+    y_stand = standardize(y)
+    #Add traces to violin plot
+    if i == 1:
+        fig.add_trace(go.Violin(y=y_stand,x0=cNames[i],side='negative',legendgroup='Data',name='Fit to data',fillcolor='blue',line=dict(color='blue'),hoverinfo='none',points='all',scalegroup=cNames[i]))
+        fig.add_trace(go.Violin(y=pdf_data2[i],x0=cNames[i],side='positive',legendgroup='Network parameters',name='Network parameters',fillcolor='orange',line=dict(color='orange'),hoverinfo='none',points=False,scalegroup=cNames[i]))
+    else:
+        fig.add_trace(go.Violin(y=y_stand,x0=cNames[i],side='negative',legendgroup='Data',name='Data',fillcolor='blue',line=dict(color='blue'),showlegend=False,hoverinfo='none',points='all',scalegroup=cNames[i]))
+        fig.add_trace(go.Violin(y=pdf_data2[i],x0=cNames[i],side='positive',legendgroup='Network parameters',name='Network parameters',fillcolor='orange',line=dict(color='orange'),showlegend=False,hoverinfo='none',points=False,scalegroup=cNames[i]))
+
+
+fig.update_layout(title_xanchor="center")
+
+plotly.offline.plot(fig,filename=outfile)
+
diff --git a/sourcecodes/workflow.php b/sourcecodes/workflow.php
index 56b527d4..d5a868cb 100644
--- a/sourcecodes/workflow.php
+++ b/sourcecodes/workflow.php
@@ -8,8 +8,8 @@ include("header_new.inc");
 ?>
 
 <!-- Site navigation menu -->
-<ul class="navbar">
-  <li><a href="bn_file_load_gom.php">Learn a network model from data</a>
+<ul class="navbar2">
+  <li><a href="bn_file_load_gom.php">Load data and begin modeling</a>
   <li><a href="home_upload.php">Make predictions using a known structure</a>  
   <li><a href="help.php">Help</a>
   <li><a href="faq.php">FAQ</a>
@@ -21,22 +21,20 @@ include("header_new.inc");
 <div id="outer">
 <!-- Main content -->
 <br>
-<h1>Tutorials and example networks</h1>
-<br>
+<h2>Tutorials and example networks</h2>
 <br>
 <h3>Tutorials<br></h3>
 <p align="justify"> 
 <ul class="listbar">
-  <li>Tutorial 1: Using BNW to learn a network structure and make predictions with the model. [<a href="BNW_workflow_net1.htm">View tutorial</a>] [<a href="example.php?My_key=example2|hQG" target="_blank">View network</a>]</li>
-  <li>Tutorial 2:</a> A more in-depth look at the BNW structural constraint interface. [<a href="BNW_workflow_sci.htm">View tutorial</a>] [<a href="example.php?My_key=example_sci|Llu" target="_blank">View network</a>]</li>
+  <li>Tutorial 1: Using BNW to learn a network structure and make predictions with the model. [<a href="BNW_workflow_net1.htm" target="_blank">View tutorial</a>] [<a href="example.php?My_key=example2|hQG" target="_blank">View network</a>]</li>
+  <li>Tutorial 2:</a> A more in-depth look at the BNW structural constraint interface. [<a href="BNW_workflow_sci.htm" target="_blank">View tutorial</a>] [<a href="example.php?My_key=example_sci|Llu" target="_blank">View network</a>]</li>
 <!--  <li><a href="structure_learning2.htm">Work flow diagram 2:</a> Global optimal search based structure learning.
   <li><a href="Prediction.htm">Work flow diagram 3:</a> Entering evidence data and predictions.
 --> 
 </ul>
 </p>
 <br>
-<br>
-<h3>Examples<br></h3>
+<h3>Example networks<br></h3>
 <p align="justify"> 
 <ul class="listbar">
   <li>Example 1: Genetic network of immune-related gene in the spleens of BXD mice. [<a href="examples/spleen_immune_example.php">Description</a>]  [<a href="example.php?My_key=example_chr2_spleen|cuL" target="_blank">View network</a>]</li>