// Autogenerated by Kumi Codegen for schema KUMI_bd17a3ebee1bec4e58b72118d43e8c1c93bf773f257fc93d9c32a783d212ea4f
export class KumiCompiledModule {
  _next_state(input) {
    let out = [];
    let t285 = input["rows"];
    let t1539 = t285.length
    const t1540 = -1;
    const t1542 = 0;
    const t1546 = 1;
    const t1334 = 3;
    const t1339 = 2;
    let t1547 = t1539 - t1546;
    t285.forEach((rows_el_286, rows_i_287) => {
      let out_1 = [];
      let t1541 = rows_i_287 - t1540;
      let t1561 = rows_i_287 - t1546;
      let t1580 = ((rows_i_287 % t1539) + t1539) % t1539;
      let t1543 = t1541 >= t1542;
      let t1544 = t1541 < t1539;
      let t1549 = Math.min(Math.max(t1541, t1542), t1547);
      let t1563 = t1561 >= t1542;
      let t1564 = t1561 < t1539;
      let t1569 = Math.min(Math.max(t1561, t1542), t1547);
      let t1581 = t1580 + t1539;
      let t1545 = t1543 && t1544;
      let t1550 = t285[t1549]
      let t1565 = t1563 && t1564;
      let t1570 = t285[t1569]
      let t1582 = ((t1581 % t1539) + t1539) % t1539;
      let t1551 = t1550.length
      let t1571 = t1570.length
      let t1583 = t285[t1582]
      let t1584 = t1583.length
      let t1640 = t1551 - t1546;
      let t1696 = t1571 - t1546;
      let t1592 = t1584 - t1546;
      rows_el_286.forEach((col_el_288, col_i_289) => {
        let t1552 = ((col_i_289 % t1551) + t1551) % t1551;
        let t1553 = t1552 + t1551;
        let t1554 = ((t1553 % t1551) + t1551) % t1551;
        let t1555 = t1550[t1554]
        let t1557 = t1545 ? t1555 : t1542;
        let t1572 = ((col_i_289 % t1571) + t1571) % t1571;
        let t1573 = t1572 + t1571;
        let t1574 = ((t1573 % t1571) + t1571) % t1571;
        let t1575 = t1570[t1574]
        let t1577 = t1565 ? t1575 : t1542;
        let t1586 = col_i_289 - t1540;
        let t1588 = t1586 >= t1542;
        let t1589 = t1586 < t1584;
        let t1590 = t1588 && t1589;
        let t1594 = Math.min(Math.max(t1586, t1542), t1592);
        let t1595 = t1583[t1594]
        let t1597 = t1590 ? t1595 : t1542;
        let t1606 = col_i_289 - t1546;
        let t1608 = t1606 >= t1542;
        let t1609 = t1606 < t1584;
        let t1610 = t1608 && t1609;
        let t1614 = Math.min(Math.max(t1606, t1542), t1592);
        let t1615 = t1583[t1614]
        let t1617 = t1610 ? t1615 : t1542;
        let t1636 = t1586 < t1551;
        let t1637 = t1588 && t1636;
        let t1638 = t1545 && t1637;
        let t1642 = Math.min(Math.max(t1586, t1542), t1640);
        let t1643 = t1550[t1642]
        let t1645 = t1638 ? t1643 : t1542;
        let t1664 = t1606 < t1551;
        let t1665 = t1608 && t1664;
        let t1666 = t1545 && t1665;
        let t1670 = Math.min(Math.max(t1606, t1542), t1640);
        let t1671 = t1550[t1670]
        let t1673 = t1666 ? t1671 : t1542;
        let t1692 = t1586 < t1571;
        let t1693 = t1588 && t1692;
        let t1694 = t1565 && t1693;
        let t1698 = Math.min(Math.max(t1586, t1542), t1696);
        let t1699 = t1570[t1698]
        let t1701 = t1694 ? t1699 : t1542;
        let t1720 = t1606 < t1571;
        let t1721 = t1608 && t1720;
        let t1722 = t1565 && t1721;
        let t1726 = Math.min(Math.max(t1606, t1542), t1696);
        let t1727 = t1570[t1726]
        let t1729 = t1722 ? t1727 : t1542;
        let t1332 = [t1557, t1577, t1597, t1617, t1645, t1673, t1701, t1729];
        let t1333 = t1332.reduce((a, b) => a + b, 0);
        let t1335 = t1333 == t1334;
        let t1340 = t1333 == t1339;
        let t1344 = col_el_288 > t1542;
        let t1345 = t1340 && t1344;
        let t528 = t1335 || t1345;
        let t293 = t528 ? t1546 : t1542;
        out_1.push(t293);
      });
      out.push(out_1);
    });
    return out;
  }

}
