<commit_before>package;


import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.text.Font;
import flash.media.Sound;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import haxe.Unserializer;
import openfl.Assets;

#if (flash || js)
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLLoader;
#end

#if ios
import openfl.utils.SystemPath;
#end


@:access(flash.media.Sound)
class DefaultAssetLibrary extends AssetLibrary {
	
	
	public static var className (default, null) = new Map <String, Dynamic> ();
	public static var path (default, null) = new Map <String, String> ();
	public static var type (default, null) = new Map <String, AssetType> ();
	
	public function new () {
		
		super ();
		
		#if flash
		
		::if (assets != null)::::foreach assets::::if (embed)::className.set ("::id::", __ASSET__::flatName::);::else::path.set ("::id::", "::resourceName::");::end::
		type.set ("::id::", Reflect.field (AssetType, "::type::".toUpperCase ()));
		::end::::end::
		
		#elseif html5
		
		::if (assets != null)::::foreach assets::::if (embed)::::if (type == "font")::addEmbed("::id::", "::type::", __ASSET__::flatName::);
		::else::addExternal("::id::", "::type::", "::resourceName::");
		::end::::end::::end::::end::
		
		#else
		
		#if (windows || mac || linux)
		
		var loadManifest = false;
		::if (assets != null)::::foreach assets::::if (embed)::
		className.set ("::id::", __ASSET__::flatName::);
		type.set ("::id::", Reflect.field (AssetType, "::type::".toUpperCase ()));
		::else::loadManifest = true;
		::end::::end::::end::
		
		#else
		
		var loadManifest = true;
		
		#end
		
		if (loadManifest) {
			try {
				
				#if blackberry
				var bytes = ByteArray.readFile ("app/native/manifest");
				#elseif tizen
				var bytes = ByteArray.readFile ("../res/manifest");
				#elseif emscripten
				var bytes = ByteArray.readFile ("assets/manifest");
				#else
				var bytes = ByteArray.readFile ("manifest");
				#end
				
				if (bytes != null) {
					
					bytes.position = 0;
					
					if (bytes.length > 0) {
						
						var data = bytes.readUTFBytes (bytes.length);
						
						if (data != null && data.length > 0) {
							
							var unserializer = new Unserializer (data);
							
							unserializer.setResolver (cast { resolveEnum: resolveEnum, resolveClass: resolveClass });
							

							var manifest:Array<AssetData> = unserializer.unserialize();

							
							for (asset in manifest) {
								
								if (!className.exists(asset.id)) {
									
									path.set (asset.id, asset.path);
									type.set (asset.id, asset.type);
									
								}
							}
						
						}
					
					}
				
				} else {
				
					trace ("Warning: Could not load asset manifest (bytes was null)");
				
				}
			
			} catch (e:Dynamic) {<commit_msg>generic AssetData in manifest file<commit_after>package;


import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.text.Font;
import flash.media.Sound;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import haxe.Unserializer;
import openfl.Assets;

#if (flash || js)
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLLoader;
#end

#if ios
import openfl.utils.SystemPath;
#end


@:access(flash.media.Sound)
class DefaultAssetLibrary extends AssetLibrary {
	
	
	public static var className (default, null) = new Map <String, Dynamic> ();
	public static var path (default, null) = new Map <String, String> ();
	public static var type (default, null) = new Map <String, AssetType> ();
	
	public function new () {
		
		super ();
		
		#if flash
		
		::if (assets != null)::::foreach assets::::if (embed)::className.set ("::id::", __ASSET__::flatName::);::else::path.set ("::id::", "::resourceName::");::end::
		type.set ("::id::", Reflect.field (AssetType, "::type::".toUpperCase ()));
		::end::::end::
		
		#elseif html5
		
		::if (assets != null)::::foreach assets::::if (embed)::::if (type == "font")::addEmbed("::id::", "::type::", __ASSET__::flatName::);
		::else::addExternal("::id::", "::type::", "::resourceName::");
		::end::::end::::end::::end::
		
		#else
		
		#if (windows || mac || linux)
		
		var loadManifest = false;
		::if (assets != null)::::foreach assets::::if (embed)::
		className.set ("::id::", __ASSET__::flatName::);
		type.set ("::id::", Reflect.field (AssetType, "::type::".toUpperCase ()));
		::else::loadManifest = true;
		::end::::end::::end::
		
		#else
		
		var loadManifest = true;
		
		#end
		
		if (loadManifest) {
			try {
				
				#if blackberry
				var bytes = ByteArray.readFile ("app/native/manifest");
				#elseif tizen
				var bytes = ByteArray.readFile ("../res/manifest");
				#elseif emscripten
				var bytes = ByteArray.readFile ("assets/manifest");
				#else
				var bytes = ByteArray.readFile ("manifest");
				#end
				
				if (bytes != null) {
					
					bytes.position = 0;
					
					if (bytes.length > 0) {
						
						var data = bytes.readUTFBytes (bytes.length);
						
						if (data != null && data.length > 0) {
							
							var manifest:Array<Dynamic> = Unserializer.run(data);

							for (asset in manifest) {

								if (!className.exists(asset.id)) {
									
									path.set (asset.id, asset.path);
									type.set (asset.id, Type.createEnum(AssetType, asset.type));
									
								}
							}
						
						}
					
					}
				
				} else {
				
					trace ("Warning: Could not load asset manifest (bytes was null)");
				
				}
			
			} catch (e:Dynamic) {
{'fraction_non_alphanumeric': 0.17918763479511143, 'fraction_numerical': 0.0014378145219266715, 'mean_word_length': 3.0413943355119826, 'pattern_counts': {'":': 26, '<': 11, '<?xml version=': 0, '>': 15, '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': '3089616', 'n_tokens_mistral': 2343, 'n_tokens_neox': 1752, 'n_words': 428}