<commit_before>package openfl._internal.macros;

#if macro
import haxe.crypto.BaseCode;
import haxe.io.Bytes;
import haxe.macro.Context;
import haxe.macro.Expr;
import sys.io.File;

@SuppressWarnings("checkstyle:FieldDocComment")
class AssetsMacro
{
	private static var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
	private static var base64Encoder:BaseCode;
	#if 0
	private static var __suppressWarning:Array<Class<Dynamic>> = [Expr];
	#end

	private static function base64Encode(bytes:Bytes):String
	{
		var extension = (switch (bytes.length % 3)
		{
			case 1: "==";
			case 2: "=";
			default: "";
		});

		if (base64Encoder == null)
		{
			base64Encoder = new BaseCode(Bytes.ofString(base64Chars));
		}

		return base64Encoder.encodeBytes(bytes).toString() + extension;
	}

	macro public static function embedBitmap():Array<Field>
	{
		#if html5
		var fields = embedData(":bitmap", true);
		#else
		var fields = embedData(":bitmap");
		#end

		if (fields != null)
		{
			var constructor = macro
				{
					#if html5
					super(0, 0, transparent, fillRGBA);

					if (preload != null)
					{
						__fromImage(preload);
					}
					else
					{
						__loadFromBase64(haxe.Resource.getString(resourceName), resourceType).onComplete(function(b)
						{
							if (preload == null)
							{
								preload = b.image;
							}

							if (onload != null)
							{
								onload(b);
							}
						});<commit_msg>Sanity check for the "onload" parameter<commit_after>package openfl._internal.macros;

#if macro
import haxe.crypto.BaseCode;
import haxe.io.Bytes;
import haxe.macro.Context;
import haxe.macro.Expr;
import sys.io.File;

@SuppressWarnings("checkstyle:FieldDocComment")
class AssetsMacro
{
	private static var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
	private static var base64Encoder:BaseCode;
	#if 0
	private static var __suppressWarning:Array<Class<Dynamic>> = [Expr];
	#end

	private static function base64Encode(bytes:Bytes):String
	{
		var extension = (switch (bytes.length % 3)
		{
			case 1: "==";
			case 2: "=";
			default: "";
		});

		if (base64Encoder == null)
		{
			base64Encoder = new BaseCode(Bytes.ofString(base64Chars));
		}

		return base64Encoder.encodeBytes(bytes).toString() + extension;
	}

	macro public static function embedBitmap():Array<Field>
	{
		#if html5
		var fields = embedData(":bitmap", true);
		#else
		var fields = embedData(":bitmap");
		#end

		if (fields != null)
		{
			var constructor = macro
				{
					#if html5
					super(0, 0, transparent, fillRGBA);

					if (preload != null)
					{
						__fromImage(preload);
					}
					else
					{
						__loadFromBase64(haxe.Resource.getString(resourceName), resourceType).onComplete(function(b)
						{
							if (preload == null)
							{
								preload = b.image;
							}

							if (onload != null && Reflect.isFunction(onload))
							{
								onload(b);
							}
						});
{'fraction_non_alphanumeric': 0.12474645030425964, 'fraction_numerical': 0.022988505747126436, 'mean_word_length': 3.2821997105643996, 'pattern_counts': {'":': 4, '<': 9, '<?xml version=': 0, '>': 9, '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': '2261997', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1004, 'n_words': 208}