local function _0_(inv, craft)
  local function _1_(x)
    return inv:contains_item("input", x)
  end
  return all(_1_, craft.input)
end
check_craft = _0_
local function _1_(crafts, inv)
  local function _2_(x)
    return check_craft(inv, x)
  end
  return find(_2_, crafts)
end
get_craft = _1_
local function _2_(player)
  local inv = player:get_inventory()
  local recipe = get_craft(inv_crafts, inv)
  inv:set_list("output", {})
  if (recipe ~= nil) then
    for _, result in ipairs(recipe.output) do
      inv:add_item("output", result)
    end
    return nil
  end
end
update_preview = _2_
local function _3_(player, formname, fields)
  assert((nil ~= fields), ("Missing argument %s on %s:%s"):format("fields", "sources/mods/loria/craft.fnl", 19))
  assert((nil ~= formname), ("Missing argument %s on %s:%s"):format("formname", "sources/mods/loria/craft.fnl", 19))
  assert((nil ~= player), ("Missing argument %s on %s:%s"):format("player", "sources/mods/loria/craft.fnl", 19))
  if (fields.craft_it == "Craft") then
    local inv = player:get_inventory()
    local pos = player:get_pos()
    local recipe = get_craft(inv_crafts, inv)
    if (recipe ~= nil) then
      local function _4_(...)
        return inv:remove_item("input", ...)
      end
      foreach(_4_, recipe.input)
      local function _5_(result)
        assert((nil ~= result), ("Missing argument %s on %s:%s"):format("result", "sources/mods/loria/craft.fnl", 26))
        return add_or_drop(inv, "main", result, pos)
      end
      foreach(_5_, recipe.output)
    end
  end
  return update_preview(player)
end
minetest.register_on_player_receive_fields(_3_)
local function _4_(player, action, inventory, inventory_info)
  return update_preview(player)
end
return minetest.register_on_player_inventory_action(_4_)
