// Generated by Haxe 4.3.3
package _UnicodeString;

import haxe.root.*;

@SuppressWarnings(value={"rawtypes", "unchecked"})
public final class UnicodeString_Impl_
{
	
	
	public static java.lang.String charAt(java.lang.String this1, int index)
	{
		//line 150 "/usr/share/haxe/std/UnicodeString.hx"
		if (( index < 0 )) 
		{
			//line 151 "/usr/share/haxe/std/UnicodeString.hx"
			return "";
		}
		
		//line 152 "/usr/share/haxe/std/UnicodeString.hx"
		int unicodeOffset = 0;
		//line 153 "/usr/share/haxe/std/UnicodeString.hx"
		int nativeOffset = 0;
		//line 154 "/usr/share/haxe/std/UnicodeString.hx"
		while (( nativeOffset < this1.length() ))
		{
			//line 155 "/usr/share/haxe/std/UnicodeString.hx"
			int index1 = nativeOffset++;
			//line 155 "/usr/share/haxe/std/UnicodeString.hx"
			int c = ( (( index1 < this1.length() )) ? (((int) (((java.lang.String) (((java.lang.Object) (this1) )) ).charAt(index1)) )) : (-1) );
			//line 155 "/usr/share/haxe/std/UnicodeString.hx"
			if (( ( c >= 55296 ) && ( c <= 56319 ) )) 
			{
				//line 155 "/usr/share/haxe/std/UnicodeString.hx"
				int index2 = ( index1 + 1 );
				//line 155 "/usr/share/haxe/std/UnicodeString.hx"
				c = ( ( ( c - 55232 ) << 10 ) | ( (( (( index2 < this1.length() )) ? (((int) (((java.lang.String) (((java.lang.Object) (this1) )) ).charAt(index2)) )) : (-1) )) & 1023 ) );
			}
			
			//line 155 "/usr/share/haxe/std/UnicodeString.hx"
			int c1 = c;
			//line 156 "/usr/share/haxe/std/UnicodeString.hx"
			if (( unicodeOffset == index )) 
			{
				//line 157 "/usr/share/haxe/std/UnicodeString.hx"
				return new java.lang.String( java.lang.Character.toChars((int) c1) );
			}
			
			//line 159 "/usr/share/haxe/std/UnicodeString.hx"
			if (( c1 >= 65536 )) 
			{
				//line 160 "/usr/share/haxe/std/UnicodeString.hx"
				 ++ nativeOffset;
			}
			
			//line 162 "/usr/share/haxe/std/UnicodeString.hx"
			 ++ unicodeOffset;
		}
		
		//line 164 "/usr/share/haxe/std/UnicodeString.hx"
		return "";
	}
	
	
	public static int get_length(java.lang.String this1)
	{
		//line 421 "/usr/share/haxe/std/UnicodeString.hx"
		int l = 0;
		//line 422 "/usr/share/haxe/std/UnicodeString.hx"
		{
			//line 422 "/usr/share/haxe/std/UnicodeString.hx"
			int _g_offset = 0;
			//line 422 "/usr/share/haxe/std/UnicodeString.hx"
			java.lang.String _g_s = this1;
			//line 422 "/usr/share/haxe/std/UnicodeString.hx"
			while (( _g_offset < _g_s.length() ))
			{
				//line 422 "/usr/share/haxe/std/UnicodeString.hx"
				java.lang.String s = _g_s;
				//line 422 "/usr/share/haxe/std/UnicodeString.hx"
				int index = _g_offset++;
				//line 422 "/usr/share/haxe/std/UnicodeString.hx"
				int c = ( (( index < s.length() )) ? (((int) (((java.lang.String) (((java.lang.Object) (s) )) ).charAt(index)) )) : (-1) );
				//line 422 "/usr/share/haxe/std/UnicodeString.hx"
				if (( ( c >= 55296 ) && ( c <= 56319 ) )) 
				{
					//line 422 "/usr/share/haxe/std/UnicodeString.hx"
					int index1 = ( index + 1 );
					//line 639 "/usr/share/haxe/std/StringTools.hx"
					c = ( ( ( c - 55232 ) << 10 ) | ( (( (( index1 < s.length() )) ? (((int) (((java.lang.String) (((java.lang.Object) (s) )) ).charAt(index1)) )) : (-1) )) & 1023 ) );
				}
				
				//line 422 "/usr/share/haxe/std/UnicodeString.hx"
				int c1 = c;
				//line 422 "/usr/share/haxe/std/UnicodeString.hx"
				if (( c1 >= 65536 )) 
				{
					//line 422 "/usr/share/haxe/std/UnicodeString.hx"
					 ++ _g_offset;
				}
				
				//line 422 "/usr/share/haxe/std/UnicodeString.hx"
				int c2 = c1;
				//line 423 "/usr/share/haxe/std/UnicodeString.hx"
				 ++ l;
			}
			
		}
		
		//line 425 "/usr/share/haxe/std/UnicodeString.hx"
		return l;
	}
	
	
}


