/* Generated by the Nim Compiler v2.2.8 */
var framePtr = null;
var excHandler = 0;
var lastJSError = null;
var NTI2097155 = {size: 0,kind: 31,base: null,node: null,finalizer: null};
var NTI2098592 = {size: 0, kind: 18, base: null, node: null, finalizer: null};
var NTI2097899 = {size: 0, kind: 17, base: null, node: null, finalizer: null};
var NTI2097907 = {size: 0, kind: 22, base: null, node: null, finalizer: null};
var NTI2097170 = {size: 0,kind: 29,base: null,node: null,finalizer: null};
var NTI2097906 = {size: 0, kind: 22, base: null, node: null, finalizer: null};
var NTI2097903 = {size: 0, kind: 17, base: null, node: null, finalizer: null};
var NTI2097904 = {size: 0, kind: 17, base: null, node: null, finalizer: null};
var NTI8388625 = {size: 0, kind: 17, base: null, node: null, finalizer: null};
var NTI2097169 = {size: 0,kind: 28,base: null,node: null,finalizer: null};
var NNI8388625 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []};
NTI8388625.node = NNI8388625;
var NNI2097904 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []};
NTI2097904.node = NNI2097904;
NTI2097906.base = NTI2097903;
NTI2097907.base = NTI2097903;
var NNI2097903 = {kind: 2, len: 5, offset: 0, typ: null, name: null, sons: [{kind: 1, offset: "parent", len: 0, typ: NTI2097906, name: "parent", sons: null}, 
{kind: 1, offset: "name", len: 0, typ: NTI2097170, name: "name", sons: null}, 
{kind: 1, offset: "message", len: 0, typ: NTI2097169, name: "msg", sons: null}, 
{kind: 1, offset: "trace", len: 0, typ: NTI2097169, name: "trace", sons: null}, 
{kind: 1, offset: "up", len: 0, typ: NTI2097907, name: "up", sons: null}]};
NTI2097903.node = NNI2097903;
var NNI2097899 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []};
NTI2097899.node = NNI2097899;
NTI2097903.base = NTI2097899;
NTI2097904.base = NTI2097903;
NTI8388625.base = NTI2097904;
var NNI2098592 = {kind: 2, len: 3, offset: 0, typ: null, name: null, sons: [{kind: 1, offset: "Field0", len: 0, typ: NTI2097170, name: "Field0", sons: null}, 
{kind: 1, offset: "Field1", len: 0, typ: NTI2097155, name: "Field1", sons: null}, 
{kind: 1, offset: "Field2", len: 0, typ: NTI2097170, name: "Field2", sons: null}]};
NTI2098592.node = NNI2098592;

function setConstr() {
        var result = {};
    for (var i = 0; i < arguments.length; ++i) {
      var x = arguments[i];
      if (typeof(x) == "object") {
        for (var j = x[0]; j <= x[1]; ++j) {
          result[j] = true;
        }
      } else {
        result[x] = true;
      }
    }
    return result;
  

  
}
var ConstSet1 = setConstr(17, 16, 4, 18, 27, 19, 23, 22, 21);

function nimCopy(dest_p0, src_p1, ti_p2) {
  var result_2100080 = null;

    switch (ti_p2.kind) {
    case 21:
    case 22:
    case 23:
    case 5:
      if (!(isFatPointer__system_u2908(ti_p2))) {
      result_2100080 = src_p1;
      }
      else {
        result_2100080 = [src_p1[0], src_p1[1]];
      }
      
      break;
    case 19:
            if (dest_p0 === null || dest_p0 === undefined) {
        dest_p0 = {};
      }
      else {
        for (var key in dest_p0) { delete dest_p0[key]; }
      }
      for (var key in src_p1) { dest_p0[key] = src_p1[key]; }
      result_2100080 = dest_p0;
    
      break;
    case 18:
    case 17:
      if (!((ti_p2.base == null))) {
      result_2100080 = nimCopy(dest_p0, src_p1, ti_p2.base);
      }
      else {
      if ((ti_p2.kind == 17)) {
      result_2100080 = (dest_p0 === null || dest_p0 === undefined) ? {m_type: ti_p2} : dest_p0;
      }
      else {
        result_2100080 = (dest_p0 === null || dest_p0 === undefined) ? {} : dest_p0;
      }
      }
      nimCopyAux(result_2100080, src_p1, ti_p2.node);
      break;
    case 4:
    case 16:
            if(ArrayBuffer.isView(src_p1)) { 
        if(dest_p0 === null || dest_p0 === undefined || dest_p0.length != src_p1.length) {
          dest_p0 = new src_p1.constructor(src_p1);
        } else {
          dest_p0.set(src_p1, 0);
        }
        result_2100080 = dest_p0;
      } else {
        if (src_p1 === null) {
          result_2100080 = null;
        }
        else {
          if (dest_p0 === null || dest_p0 === undefined || dest_p0.length != src_p1.length) {
            dest_p0 = new Array(src_p1.length);
          }
          result_2100080 = dest_p0;
          for (var i = 0; i < src_p1.length; ++i) {
            result_2100080[i] = nimCopy(result_2100080[i], src_p1[i], ti_p2.base);
          }
        }
      }
    
      break;
    case 24:
    case 27:
            if (src_p1 === null) {
        result_2100080 = null;
      }
      else {
        if (dest_p0 === null || dest_p0 === undefined || dest_p0.length != src_p1.length) {
          dest_p0 = new Array(src_p1.length);
        }
        result_2100080 = dest_p0;
        for (var i = 0; i < src_p1.length; ++i) {
          result_2100080[i] = nimCopy(result_2100080[i], src_p1[i], ti_p2.base);
        }
      }
    
      break;
    case 28:
            if (src_p1 !== null) {
        result_2100080 = src_p1.slice(0);
      }
    
      break;
    default: 
      result_2100080 = src_p1;
      break;
    }

  return result_2100080;

}

function nimAddStrStr(x_p0, y_p1) {
      var L = y_p1.length;
  for (var i = 0; i < L; ++i) {
    x_p0.push(y_p1[i]);
  }
  

  
}

function arrayConstr(len_p0, value_p1, typ_p2) {
        var result = new Array(len_p0);
    for (var i = 0; i < len_p0; ++i) result[i] = nimCopy(null, value_p1, typ_p2);
    return result;
  

  
}

function mnewString(len_p0) {
        var result = new Array(len_p0);
    for (var i = 0; i < len_p0; i++) {result[i] = 0;}
    return result;
  

  
}

function cstrToNimstr(c_p0) {
      var ln = c_p0.length;
  var result = new Array(ln);
  var r = 0;
  for (var i = 0; i < ln; ++i) {
    var ch = c_p0.charCodeAt(i);

    if (ch < 128) {
      result[r] = ch;
    }
    else {
      if (ch < 2048) {
        result[r] = (ch >> 6) | 192;
      }
      else {
        if (ch < 55296 || ch >= 57344) {
          result[r] = (ch >> 12) | 224;
        }
        else {
            ++i;
            ch = 65536 + (((ch & 1023) << 10) | (c_p0.charCodeAt(i) & 1023));
            result[r] = (ch >> 18) | 240;
            ++r;
            result[r] = ((ch >> 12) & 63) | 128;
        }
        ++r;
        result[r] = ((ch >> 6) & 63) | 128;
      }
      ++r;
      result[r] = (ch & 63) | 128;
    }
    ++r;
  }
  return result;
  

  
}

function isObj(obj_p0, subclass_p1) {
  var result_2100193 = false;

  BeforeRet: {
    var x_2100194 = obj_p0;
    if ((x_2100194 == subclass_p1)) {
    result_2100193 = true;
    break BeforeRet;
    }
    
    Label1: {
        Label2: while (true) {
        if (!!((x_2100194 == subclass_p1))) break Label2;
          if ((x_2100194 == null)) {
          result_2100193 = false;
          break BeforeRet;
          }
          
          x_2100194 = x_2100194.base;
        }
    };
    result_2100193 = true;
    break BeforeRet;
  };

  return result_2100193;

}

function toJSStr(s_p0) {
  var result_2099669 = null;

    var res_2099723 = newSeq__system_u2546((s_p0).length);
    var i_2099724 = 0;
    var j_2099725 = 0;
    Label1: {
        Label2: while (true) {
        if (!(i_2099724 < (s_p0).length)) break Label2;
          var c_2099726 = s_p0[i_2099724];
          if ((c_2099726 < 128)) {
          res_2099723[j_2099725] = String.fromCharCode(c_2099726);
          i_2099724 += 1;
          }
          else {
            var helper_2099752 = newSeq__system_u2546(0);
            Label3: {
                Label4: while (true) {
                if (!true) break Label4;
                  var code_2099753 = c_2099726.toString(16);
                  if ((((code_2099753) == null ? 0 : (code_2099753).length) == 1)) {
                  helper_2099752.push("%0");;
                  }
                  else {
                  helper_2099752.push("%");;
                  }
                  
                  helper_2099752.push(code_2099753);;
                  i_2099724 += 1;
                  if ((((s_p0).length <= i_2099724) || (s_p0[i_2099724] < 128))) {
                  break Label3;
                  }
                  
                  c_2099726 = s_p0[i_2099724];
                }
            };
++excHandler;
            try {
            res_2099723[j_2099725] = decodeURIComponent(helper_2099752.join(""));
--excHandler;
} catch (EXCEPTION) {
 var prevJSError = lastJSError;
 lastJSError = EXCEPTION;
 --excHandler;
            raiseDefect();
            res_2099723[j_2099725] = helper_2099752.join("");
            lastJSError = prevJSError;
            } finally {
            }
          }
          
          j_2099725 += 1;
        }
    };
    if (res_2099723.length < j_2099725) { for (var i = res_2099723.length ; i < j_2099725 ; ++i) res_2099723.push(null); }
               else { res_2099723.length = j_2099725; };
    result_2099669 = res_2099723.join("");

  return result_2099669;

}

function raiseException(e_p0, ename_p1) {
    e_p0.name = ename_p1;
    if ((excHandler == 0)) {
    unhandledException(e_p0);
    }
    
    e_p0.trace = nimCopy(null, rawWriteStackTrace__system_u2210(), NTI2097169);
    throw e_p0;

  
}

function makeNimstrLit(c_p0) {
      var result = [];
  for (var i = 0; i < c_p0.length; ++i) {
    result[i] = c_p0.charCodeAt(i);
  }
  return result;
  

  
}
var F = {procname: "module jsconsole", prev: framePtr, filename: "/build/nim/src/nim/lib/js/jsconsole.nim", line: 0};
framePtr = F;
framePtr = F.prev;
var F = {procname: "module jsconsole", prev: framePtr, filename: "/build/nim/src/nim/lib/js/jsconsole.nim", line: 0};
framePtr = F;
framePtr = F.prev;

function isFatPointer__system_u2908(ti_p0) {
  var result_2100062 = false;

  BeforeRet: {
    result_2100062 = !((ConstSet1[ti_p0.base.kind] != undefined));
    break BeforeRet;
  };

  return result_2100062;

}

function nimCopyAux(dest_p0, src_p1, n_p2) {
    switch (n_p2.kind) {
    case 0:
      break;
    case 1:
            dest_p0[n_p2.offset] = nimCopy(dest_p0[n_p2.offset], src_p1[n_p2.offset], n_p2.typ);
    
      break;
    case 2:
          for (var i = 0; i < n_p2.sons.length; i++) {
      nimCopyAux(dest_p0, src_p1, n_p2.sons[i]);
    }
    
      break;
    case 3:
            dest_p0[n_p2.offset] = nimCopy(dest_p0[n_p2.offset], src_p1[n_p2.offset], n_p2.typ);
      for (var i = 0; i < n_p2.sons.length; ++i) {
        nimCopyAux(dest_p0, src_p1, n_p2.sons[i][1]);
      }
    
      break;
    }

  
}

function add__system_u1972(x_p0, x_p0_Idx, y_p1) {
          if (x_p0[x_p0_Idx] === null) { x_p0[x_p0_Idx] = []; }
      var off = x_p0[x_p0_Idx].length;
      x_p0[x_p0_Idx].length += y_p1.length;
      for (var i = 0; i < y_p1.length; ++i) {
        x_p0[x_p0_Idx][off+i] = y_p1.charCodeAt(i);
      }
    

  
}

function addChars__stdZprivateZdigitsutils_u202(result_p0, result_p0_Idx, x_p1, start_p2, n_p3) {
    var Temporary1;

    var old_20971728 = (result_p0[result_p0_Idx]).length;
    if (result_p0[result_p0_Idx].length < (Temporary1 = (old_20971728 + n_p3), Temporary1)) { for (var i = result_p0[result_p0_Idx].length; i < Temporary1; ++i) result_p0[result_p0_Idx].push(0); }
         else {result_p0[result_p0_Idx].length = Temporary1; };
    Label2: {
      var iHEX60gensym4_20971742 = 0;
      var i_42991652 = 0;
      Label3: {
          Label4: while (true) {
          if (!(i_42991652 < n_p3)) break Label4;
            iHEX60gensym4_20971742 = i_42991652;
            result_p0[result_p0_Idx][(old_20971728 + iHEX60gensym4_20971742)] = x_p1.charCodeAt((start_p2 + iHEX60gensym4_20971742));
            i_42991652 += 1;
          }
      };
    };

  
}

function addChars__stdZprivateZdigitsutils_u198(result_p0, result_p0_Idx, x_p1) {
    addChars__stdZprivateZdigitsutils_u202(result_p0, result_p0_Idx, x_p1, 0, ((x_p1) == null ? 0 : (x_p1).length));

  
}

function addInt__stdZprivateZdigitsutils_u223(result_p0, result_p0_Idx, x_p1) {
    addChars__stdZprivateZdigitsutils_u198(result_p0, result_p0_Idx, ((x_p1) + ""));

  
}

function addInt__stdZprivateZdigitsutils_u241(result_p0, result_p0_Idx, x_p1) {
    addInt__stdZprivateZdigitsutils_u223(result_p0, result_p0_Idx, BigInt(x_p1));

  
}

function HEX24__systemZdollars_u14(xHEX60gensym0_p0) {
  var result_24117264 = [[]];

  var F = {procname: "dollars.$", prev: framePtr, filename: "/build/nim/src/nim/lib/system/dollars.nim", line: 0};
  framePtr = F;
    F.line = 20;
    F.filename = "dollars.nim";
    result_24117264[0] = nimCopy(null, [], NTI2097169);
    F.line = 21;
    addInt__stdZprivateZdigitsutils_u241(result_24117264, 0, xHEX60gensym0_p0);
  framePtr = F.prev;

  return result_24117264[0];

}

function auxWriteStackTrace__system_u2112(f_p0) {
  var result_2099266 = [[]];

    var it_2099274 = f_p0;
    var i_2099275 = 0;
    var total_2099276 = 0;
    var tempFrames_2099277 = arrayConstr(64, {Field0: null, Field1: 0, Field2: null}, NTI2098592);
    Label1: {
        Label2: while (true) {
        if (!(!((it_2099274 == null)) && (i_2099275 <= 63))) break Label2;
          tempFrames_2099277[i_2099275].Field0 = it_2099274.procname;
          tempFrames_2099277[i_2099275].Field1 = it_2099274.line;
          tempFrames_2099277[i_2099275].Field2 = it_2099274.filename;
          i_2099275 += 1;
          total_2099276 += 1;
          it_2099274 = it_2099274.prev;
        }
    };
    Label3: {
        Label4: while (true) {
        if (!!((it_2099274 == null))) break Label4;
          total_2099276 += 1;
          it_2099274 = it_2099274.prev;
        }
    };
    result_2099266[0] = nimCopy(null, [], NTI2097169);
    if (!((total_2099276 == i_2099275))) {
    nimAddStrStr(result_2099266[0], [40]);;
    nimAddStrStr(result_2099266[0], HEX24__systemZdollars_u14((total_2099276 - i_2099275)));;
    nimAddStrStr(result_2099266[0], [32,99,97,108,108,115,32,111,109,105,116,116,101,100,41,32,46,46,46,10]);;
    }
    
    Label5: {
      var j_2099310 = 0;
      var colontmp__42991644 = 0;
      colontmp__42991644 = (i_2099275 - 1);
      var res_42991646 = colontmp__42991644;
      Label6: {
          Label7: while (true) {
          if (!(0 <= res_42991646)) break Label7;
            j_2099310 = res_42991646;
            nimAddStrStr(result_2099266[0], cstrToNimstr(tempFrames_2099277[j_2099310].Field2));;
            if ((0 < tempFrames_2099277[j_2099310].Field1)) {
            nimAddStrStr(result_2099266[0], [40]);;
            addInt__stdZprivateZdigitsutils_u241(result_2099266, 0, tempFrames_2099277[j_2099310].Field1);
            if (false) {
            nimAddStrStr(result_2099266[0], [44,32]);;
            addInt__stdZprivateZdigitsutils_u241(result_2099266, 0, 0);
            }
            
            nimAddStrStr(result_2099266[0], [41]);;
            }
            
            nimAddStrStr(result_2099266[0], [32,97,116,32]);;
            add__system_u1972(result_2099266, 0, tempFrames_2099277[j_2099310].Field0);
            nimAddStrStr(result_2099266[0], [10]);;
            res_42991646 -= 1;
          }
      };
    };

  return result_2099266[0];

}

function rawWriteStackTrace__system_u2210() {
  var result_2099363 = [];

    if (!((framePtr == null))) {
    result_2099363 = nimCopy(null, ([84,114,97,99,101,98,97,99,107,32,40,109,111,115,116,32,114,101,99,101,110,116,32,99,97,108,108,32,108,97,115,116,41,10]).concat(auxWriteStackTrace__system_u2112(framePtr)), NTI2097169);
    }
    else {
      result_2099363 = nimCopy(null, [78,111,32,115,116,97,99,107,32,116,114,97,99,101,98,97,99,107,32,97,118,97,105,108,97,98,108,101,10], NTI2097169);
    }
    

  return result_2099363;

}

function newSeq__system_u2546(len_p0) {
  var result_2099702 = [];

  var F = {procname: "newSeq.newSeq", prev: framePtr, filename: "/build/nim/src/nim/lib/system.nim", line: 0};
  framePtr = F;
    F.line = 651;
    F.filename = "system.nim";
    result_2099702 = new Array(len_p0); for (var i = 0 ; i < len_p0 ; ++i) { result_2099702[i] = null; }  framePtr = F.prev;

  return result_2099702;

}

function isNimException__system_u2043() {
    return lastJSError && lastJSError.m_type;

  
}

function getCurrentException() {
  var result_2099198 = null;

    if (isNimException__system_u2043()) {
    result_2099198 = lastJSError;
    }
    

  return result_2099198;

}

function raiseDefect() {
    if (isNimException__system_u2043()) {
    var e_2099414 = getCurrentException();
    if (isObj(e_2099414.m_type, NTI2097904)) {
    if ((excHandler == 0)) {
    unhandledException(e_2099414);
    }
    
    e_2099414.trace = nimCopy(null, rawWriteStackTrace__system_u2210(), NTI2097169);
    throw e_2099414;
    }
    
    }
    

  
}

function unhandledException(e_p0) {
    var buf_2099408 = [[]];
    if (!(((e_p0.message).length == 0))) {
    nimAddStrStr(buf_2099408[0], [69,114,114,111,114,58,32,117,110,104,97,110,100,108,101,100,32,101,120,99,101,112,116,105,111,110,58,32]);;
    nimAddStrStr(buf_2099408[0], e_p0.message);;
    }
    else {
    nimAddStrStr(buf_2099408[0], [69,114,114,111,114,58,32,117,110,104,97,110,100,108,101,100,32,101,120,99,101,112,116,105,111,110]);;
    }
    
    nimAddStrStr(buf_2099408[0], [32,91]);;
    add__system_u1972(buf_2099408, 0, e_p0.name);
    nimAddStrStr(buf_2099408[0], [93,10]);;
    nimAddStrStr(buf_2099408[0], rawWriteStackTrace__system_u2210());;
    var cbuf_2099409 = toJSStr(buf_2099408[0]);
    framePtr = null;
      if (typeof(Error) !== "undefined") {
    throw new Error(cbuf_2099409);
  }
  else {
    throw cbuf_2099409;
  }
  

  
}

function sysFatal__stdZassertions_u46(message_p1) {
  var F = {procname: "sysFatal.sysFatal", prev: framePtr, filename: "/build/nim/src/nim/lib/system/fatal.nim", line: 0};
  framePtr = F;
    F.line = 62;
    F.filename = "fatal.nim";
    raiseException({message: nimCopy(null, message_p1, NTI2097169), m_type: NTI8388625, parent: null, name: null, trace: [], up: null}, "AssertionDefect");
  framePtr = F.prev;

  
}

function raiseAssert__stdZassertions_u44(msg_p0) {
  var F = {procname: "assertions.raiseAssert", prev: framePtr, filename: "/build/nim/src/nim/lib/std/assertions.nim", line: 0};
  framePtr = F;
    F.line = 40;
    F.filename = "assertions.nim";
    sysFatal__stdZassertions_u46(msg_p0);
  framePtr = F.prev;

  
}

function failedAssertImpl__stdZassertions_u86(msg_p0) {
  var F = {procname: "assertions.failedAssertImpl", prev: framePtr, filename: "/build/nim/src/nim/lib/std/assertions.nim", line: 0};
  framePtr = F;
    F.line = 45;
    F.filename = "assertions.nim";
    raiseAssert__stdZassertions_u44(msg_p0);
  framePtr = F.prev;

  
}
var F = {procname: "module jsconsole_examples_2", prev: framePtr, filename: "/build/nim/src/nim/doc/html/nimcache/runnableExamples/jsconsole_examples_2.nim", line: 0};
framePtr = F;
F.line = 101;
F.filename = "jsconsole.nim";
console.assert(true, "[jsAssert] /build/nim/src/nim/doc/html/nimcache/runnableExamples/jsconsole_examples_2.nim(9, 10)","42 == 42");
F.line = 101;
console.assert(false, "[jsAssert] /build/nim/src/nim/doc/html/nimcache/runnableExamples/jsconsole_examples_2.nim(10, 10)","42 != 42");
F.line = 101;
console.assert(false, "[jsAssert] /build/nim/src/nim/doc/html/nimcache/runnableExamples/jsconsole_examples_2.nim(11, 10)","\'`\' == \'\\n\' and \'\\t\' == \'\\x00\'");
if (false) {
F.line = 101;
failedAssertImpl__stdZassertions_u86(makeNimstrLit("/build/nim/src/nim/doc/html/nimcache/runnableExamples/jsconsole_examples_2.nim(12, 3) `42 == 42` "));
}

framePtr = F.prev;
var F = {procname: "module jsconsole_examples_2", prev: framePtr, filename: "/build/nim/src/nim/doc/html/nimcache/runnableExamples/jsconsole_examples_2.nim", line: 0};
framePtr = F;
framePtr = F.prev;
var F = {procname: "module jsconsole_group1_examples", prev: framePtr, filename: "/build/nim/src/nim/doc/html/nimcache/runnableExamples/jsconsole_group1_examples.nim", line: 0};
framePtr = F;
framePtr = F.prev;
var F = {procname: "module jsconsole_group1_examples", prev: framePtr, filename: "/build/nim/src/nim/doc/html/nimcache/runnableExamples/jsconsole_group1_examples.nim", line: 0};
framePtr = F;
framePtr = F.prev;
