<commit_before>function renderWizard(){
  var pd = $("#wizard");
  var root = document.wizdata;

  var index =0;

  function handleNav(){
    var ele = $(this);
    //apply layer
    ele.children().show();
    ele.siblings().hide();
  }
  function handleChoice(){
    var ele = $(this);
    //apply layer
  }
  function renderSegment(element, data){
    if(data == undefined){
      return;
    }
    if("nav" in data){
      var nav = data.nav;
      for(var i = 0; i<nav.length; i++){
        var item = nav[i];
        var np = $("<div class='question' id='item"+(index++)+"' data-layers='"+item.layers+"'><span class='question-label'>"+item.question+"</span></div>");
        np.hide();
        np.on("click",handleNav);
        element.append(np);
        renderSegment(np,item.next);
      }
    }
    if("choice" in data){
      var choices = data.choice;
      for(var i = 0; i<choices.length; i++){
        var item = choices[i];
        var np = $("<div class='choice' id='item"+(index++)+"' data-layers='"+item.layers+"'><span class='choice-label'>"+item.label+"</span></div>");
        np.hide();
        np.on("click",handleChoice);
        element.append(np);
        renderSegment(np,item.next);
      }
    }
  }
  renderSegment(pd,root.wizard);
  pd.children().show();
}

function ShowWizard(){
  $('#home').hide();
  $("#wizard").show();
}

function PanelStateChange(){
  var pnl = $("#mainTitlePanel");
  if(pnl.hasClass("panelUp")){
    // put all the panels "down"
    $(".panelUp").hide();
    pnl.removeClass("panelUp").addClass("panelDown");
  } else {
    $(".panelDown").show();
    pnl.removeClass("panelDown").addClass("panelUp");
  }
}

$(document).ready(function(){

  if(document.wizdata){
    renderWizard();
  }
  $("#bottomMiddle").on("click",function(){
    PanelStateChange();
    ShowWizard();
  });
});
<commit_msg>Fix wizard interaction<commit_after>function renderWizard(){
  var pd = $("#wizard");
  var root = document.wizdata;

  var index =0;

  function handleNav(e){
    e.stopPropagation();
    var ele = $(this);
    //apply layer
    ele.children().show();
    ele.siblings().hide();
  }
  function handleChoice(e){
    e.stopPropagation();
    var ele = $(this);
    //apply layer
    var layers = ele.data("layers");
    for(var i=0;i<layers.length;i++){
      var layerid = layers[i];

    }
  }
  function renderSegment(element, data){
    if(data == undefined){
      return;
    }
    if("nav" in data){
      var nav = data.nav;
      for(var i = 0; i<nav.length; i++){
        var item = nav[i];
        var np = $("<div class='question' id='item"+(index++)+"' data-layers='"+item.layers+"'><span class='question-label'>"+item.question+"</span></div>");
        np.hide();
        np.on("click",handleNav);
        element.append(np);
        renderSegment(np,item.next);
      }
    }
    if("choice" in data){
      var choices = data.choice;
      for(var i = 0; i<choices.length; i++){
        var item = choices[i];
        var np = $("<div class='choice' id='item"+(index++)+"' data-layers='"+item.layers+"'><span class='choice-label'>"+item.label+"</span></div>");
        np.hide();
        np.on("click",handleChoice);
        element.append(np);
        renderSegment(np,item.next);
      }
    }
  }
  renderSegment(pd,root.wizard);
  pd.children().show();
}

function ShowWizard(){
  $('#home').hide();
  $("#wizard").show();
}

function PanelStateChange(){
  var pnl = $("#mainTitlePanel");
  if(pnl.hasClass("panelUp")){
    // put all the panels "down"
    $(".panelUp").hide();
    pnl.removeClass("panelUp").addClass("panelDown");
  } else {
    $(".panelDown").show();
    pnl.removeClass("panelDown").addClass("panelUp");
  }
}

$(document).ready(function(){

  if(document.wizdata){
    renderWizard();
  }
  $("#bottomMiddle").on("click",function(){
    PanelStateChange();
    ShowWizard();
  });
});

{'fraction_non_alphanumeric': 0.21443298969072164, 'fraction_numerical': 0.0018041237113402063, 'mean_word_length': 3.00515995872033, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2193979', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1289, 'n_words': 234}