wL i`DdZddlZddlZddlmZej j ejjdZ ejZ e e j_ e e j_ e e j_ e e ge j_e jZdZdZdZej j ejjdZej,Ze e_ e ej.ej0e e ge_ej2Zej.e_ e ge_ej4Zde_ e ej6ge_ej8Ze e_ e e e ge_ej:Ze e_ ej<Zde_ e e e ge_ej>Zde_ e ge_ej@Z de _ e ge _d Z!e jEed Z#d Z$d Z%d Z&ejNde e e Z(e(e&Z)dZ*dZ+y)zBInputhook for OS X Calls NSApp / CoreFoundation APIs via ctypes. N)EventobjccHt|ts|jd}|S)zensure utf8 bytesutf8) isinstancebytesencode)ss h/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/IPython/terminal/pt_inputhooks/osx.py_utf8r s a  HHV  Hc>tjt|S)z)create a selector name (for ObjC methods))rsel_registerNamer )names r nrs  t --r c>tjt|S)zget an ObjC Class by name)r objc_getClassr ) classnames r Cr!s   eI. //r CoreFoundationkCFRunLoopCommonModesc|ttgtj_t t dt dS)z0Return the global NSApplication instance (NSApp) NSApplicationsharedApplicationvoid_pr objc_msgSendargtypesmsgrrr r _NSAppr"Ns-"(&!1D q!1%8#9 ::r c |tttttttttttg tj_t t dt dddddddddd }ttttgtj_t |t dt|dy)zWake the ApplicationNSEventz]otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:rNzpostEvent:atStart:Tr)NSAppevents r _waker(Ts  "D  )   B           E #)&&&!ADq%&u trRs1 {{v{{77?@ # &"$f-  .0(()A)ABR)ST'>>!'#)6<<PV"W&4&X&X#.4ll#+06x#,"0"P"P*.',2FNN+C(&4&X&X#.4#+06/G#,$88$#66!%vv6  $ $  X +FF%)"'-h#!" n6MN; =F)((vvvF)/:r