# Path: resources/lib/kindleunpack/compatibility_utils.py
# PY2 = sys.version_info[0] == 2
# PY3 = sys.version_info[0] == 3
# ASCII_CHARS   = set(chr(x) for x in range(128))
# URL_SAFE      = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
#                     'abcdefghijklmnopqrstuvwxyz'
#                     '0123456789' '#' '_.-/~')
# IRI_UNSAFE = ASCII_CHARS - URL_SAFE
#     def bchr(s):
#     def bstr(s):
#     def bord(s):
#     def bchar(s):
#     def bchr(s):
#     def bstr(s):
#     def bord(s):
#     def bchar(s):
#     def lrange(*args, **kwargs):
#     def lzip(*args, **kwargs):
#     def lmap(*args, **kwargs):
#     def lfilter(*args, **kwargs):
# def hexlify(bdata):
# def utf8_str(p, enc='utf-8'):
# def unicode_str(p, enc='utf-8'):
# def quoteurl(href):
# def unquoteurl(href):
# def unescapeit(sval):
# def unicode_argv():
# def add_cp65001_codec():


from .compatibility_utils import PY2, text_type, bchr, bord
from itertools import cycle
import binascii
    mobilangdict = {
            54 : {0 : 'af'},  # Afrikaans
            28 : {0 : 'sq'},  # Albanian
             1 : {0 : 'ar' , 5 : 'ar-dz' , 15 : 'ar-bh' , 3 : 'ar-eg' , 2 : 'ar-iq',  11 : 'ar-jo' , 13 : 'ar-kw' , 12 : 'ar-lb' , 4: 'ar-ly',
                  6 : 'ar-ma' , 8 : 'ar-om' , 16 : 'ar-qa' , 1 : 'ar-sa' , 10 : 'ar-sy' , 7 : 'ar-tn' , 14 : 'ar-ae' , 9 : 'ar-ye'},
             # Arabic,  Arabic (Algeria),  Arabic (Bahrain),  Arabic (Egypt),  Arabic
             # (Iraq), Arabic (Jordan),  Arabic (Kuwait),  Arabic (Lebanon),  Arabic
             # (Libya), Arabic (Morocco),  Arabic (Oman),  Arabic (Qatar),  Arabic
             # (Saudi Arabia),  Arabic (Syria),  Arabic (Tunisia),  Arabic (United Arab
             # Emirates),  Arabic (Yemen)
            43 : {0 : 'hy'},  # Armenian
            77 : {0 : 'as'},  # Assamese
            44 : {0 : 'az'},  # "Azeri (IANA: Azerbaijani)
            45 : {0 : 'eu'},  # Basque
            35 : {0 : 'be'},  # Belarusian
            69 : {0 : 'bn'},  # Bengali
             2 : {0 : 'bg'},  # Bulgarian
             3 : {0 : 'ca'},  # Catalan
             4 : {0 : 'zh' , 3 : 'zh-hk' , 2 : 'zh-cn' , 4 : 'zh-sg' , 1 : 'zh-tw'},
            # Chinese,  Chinese (Hong Kong),  Chinese (PRC),  Chinese (Singapore),  Chinese (Taiwan)
            26 : {0 : 'hr', 3 : 'sr'},  # Croatian, Serbian
             5 : {0 : 'cs'},  # Czech
             6 : {0 : 'da'},  # Danish
            19 : {0: 'nl', 1 : 'nl' , 2 : 'nl-be'},  # Dutch / Flemish,  Dutch (Belgium)
             9 : {0: 'en', 1 : 'en' , 3 : 'en-au' , 40 : 'en-bz' , 4 : 'en-ca' , 6 : 'en-ie' , 8 : 'en-jm' , 5 : 'en-nz' , 13 : 'en-ph' ,
                  7 : 'en-za' , 11 : 'en-tt' , 2 : 'en-gb', 1 : 'en-us' , 12 : 'en-zw'},
             # English,  English (Australia),  English (Belize),  English (Canada),
             # English (Ireland),  English (Jamaica),  English (New Zealand),  English
             # (Philippines),  English (South Africa),  English (Trinidad),  English
             # (United Kingdom),  English (United States),  English (Zimbabwe)

# Path: resources/lib/kindleunpack/compatibility_utils.py
# PY2 = sys.version_info[0] == 2
# PY3 = sys.version_info[0] == 3
# ASCII_CHARS   = set(chr(x) for x in range(128))
# URL_SAFE      = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
#                     'abcdefghijklmnopqrstuvwxyz'
#                     '0123456789' '#' '_.-/~')
# IRI_UNSAFE = ASCII_CHARS - URL_SAFE
#     def bchr(s):
#     def bstr(s):
#     def bord(s):
#     def bchar(s):
#     def bchr(s):
#     def bstr(s):
#     def bord(s):
#     def bchar(s):
#     def lrange(*args, **kwargs):
#     def lzip(*args, **kwargs):
#     def lmap(*args, **kwargs):
#     def lfilter(*args, **kwargs):
# def hexlify(bdata):
# def utf8_str(p, enc='utf-8'):
# def unicode_str(p, enc='utf-8'):
# def quoteurl(href):
# def unquoteurl(href):
# def unescapeit(sval):
# def unicode_argv():
# def add_cp65001_codec():


# Path: resources/lib/kindleunpack/mobi_utils.py
from .compatibility_utils import PY2, text_type, bchr, bord
from itertools import cycle
import binascii

    mobilangdict = {
            54 : {0 : 'af'},  # Afrikaans
            28 : {0 : 'sq'},  # Albanian
             1 : {0 : 'ar' , 5 : 'ar-dz' , 15 : 'ar-bh' , 3 : 'ar-eg' , 2 : 'ar-iq',  11 : 'ar-jo' , 13 : 'ar-kw' , 12 : 'ar-lb' , 4: 'ar-ly',
                  6 : 'ar-ma' , 8 : 'ar-om' , 16 : 'ar-qa' , 1 : 'ar-sa' , 10 : 'ar-sy' , 7 : 'ar-tn' , 14 : 'ar-ae' , 9 : 'ar-ye'},
             # Arabic,  Arabic (Algeria),  Arabic (Bahrain),  Arabic (Egypt),  Arabic
             # (Iraq), Arabic (Jordan),  Arabic (Kuwait),  Arabic (Lebanon),  Arabic
             # (Libya), Arabic (Morocco),  Arabic (Oman),  Arabic (Qatar),  Arabic
             # (Saudi Arabia),  Arabic (Syria),  Arabic (Tunisia),  Arabic (United Arab
             # Emirates),  Arabic (Yemen)
            43 : {0 : 'hy'},  # Armenian
            77 : {0 : 'as'},  # Assamese
            44 : {0 : 'az'},  # "Azeri (IANA: Azerbaijani)
            45 : {0 : 'eu'},  # Basque
            35 : {0 : 'be'},  # Belarusian
            69 : {0 : 'bn'},  # Bengali
             2 : {0 : 'bg'},  # Bulgarian
             3 : {0 : 'ca'},  # Catalan
             4 : {0 : 'zh' , 3 : 'zh-hk' , 2 : 'zh-cn' , 4 : 'zh-sg' , 1 : 'zh-tw'},
            # Chinese,  Chinese (Hong Kong),  Chinese (PRC),  Chinese (Singapore),  Chinese (Taiwan)
            26 : {0 : 'hr', 3 : 'sr'},  # Croatian, Serbian
             5 : {0 : 'cs'},  # Czech
             6 : {0 : 'da'},  # Danish
            19 : {0: 'nl', 1 : 'nl' , 2 : 'nl-be'},  # Dutch / Flemish,  Dutch (Belgium)
             9 : {0: 'en', 1 : 'en' , 3 : 'en-au' , 40 : 'en-bz' , 4 : 'en-ca' , 6 : 'en-ie' , 8 : 'en-jm' , 5 : 'en-nz' , 13 : 'en-ph' ,
                  7 : 'en-za' , 11 : 'en-tt' , 2 : 'en-gb', 1 : 'en-us' , 12 : 'en-zw'},
             # English,  English (Australia),  English (Belize),  English (Canada),
             # English (Ireland),  English (Jamaica),  English (New Zealand),  English
             # (Philippines),  English (South Africa),  English (Trinidad),  English
             # (United Kingdom),  English (United States),  English (Zimbabwe)

            37 : {0 : 'et'},  # Estonian