import re, json
import quickjs
s=open('commonChunk.AUoCIbzg.js',encoding='utf-8',errors='ignore').read()
def brace_extract(src, start_key):
    i=src.find(start_key)
    assert i>=0, start_key
    j=src.find('{', i)
    depth=0; k=j
    instr=None; esc=False
    while k<len(src):
        c=src[k]
        if instr:
            if esc: esc=False
            elif c=='\\': esc=True
            elif c==instr: instr=None
        else:
            if c in '"\'`': instr=c
            elif c=='{': depth+=1
            elif c=='}':
                depth-=1
                if depth==0: return src[i:k+1]
        k+=1
    return src[i:]
kg=brace_extract(s,'function Kg')
mr=brace_extract(s,'function mr')
print('kg len',len(kg),'mr len',len(mr))
ctx=quickjs.Context()
ctx.eval(kg); ctx.eval(mr)
def Et(key, idx):
    return ctx.eval(f'mr({idx+196}, {json.dumps(key)})')
for k,i in [("n5]A",187),("Q9se",189),("F(ai",210),("!x&[",238),("^vv9",249),("AZtO",191),("(kpj",245),("bcY]",248),("suG5",194)]:
    try: print(f'Et({k!r},{i}) = {Et(k,i)!r}')
    except Exception as e: print(k,i,'ERR',e)
try:
    print('Nf =', repr("tgJt2ol!^E"+Et("n5]A",187)))
    print('ivstr =', repr("5421698523"+Et("^vv9",249)))
    import base64
    print('Bl =', repr(base64.b64decode("dGhhbmtzLH"+Et("AZtO",191)+Et("(kpj",245)).decode('utf-8','replace')))
    print('xf =', repr(Et("bcY]",248)+Et("suG5",194)+"c0dac989c896"))
except Exception as e: print('compose err',e)
