
    ^j                         d dl mZ d dlZd dlZd dlZd dlmZmZmZm	Z	m
Z
 ddlmZ ddlmZ  G d de      Z e        y)	    )absolute_importN)c_void_pc_size_tbyrefcreate_string_bufferCDLL   )JavaScriptInterpreter)templatec                   $     e Zd Z fdZd Z xZS )ChallengeInterpreterc                 ,    t         t        |   d       y )N
chakracore)superr   __init__)self	__class__s    _/var/www/lego-monitor/venv/lib/python3.12/site-packages/cloudscraper/interpreters/chakracore.pyr   zChallengeInterpreter.__init__   s    "D2<@    c           	         d }dD ]  }t         j                  j                  t         j                  j                  t        j                         |            sSt         j                  j                  t        j                         |      } |st
        j                  j                  d      }|sdt        _	        t        d      	 t        |      }t        j                  dk7  r&|j                  ddd       |j                  ddd       t!        t#        ||      j%                  d	            }t'               }|j)                  ddt+        |             t'               }|j-                  |t+        |             |j/                  |       t'               }	|j1                  d
t3        d
      t+        |	             t'               }
|j5                  |t3        |      ddt+        |
             t'               }|j7                  |
d|	dt+        |             t'               }|j9                  |t+        |             t;               }|j=                  |ddt+        |             t!        |j>                  dz         }|j=                  |t+        |      |j>                  dz   d       |jA                  |       |j>                  S # t        $ r& dt        _	        t        dj                  |            w xY w)N)zlibChakraCore.sozlibChakraCore.dylibzChakraCore.dll
ChakraCorer   zChakraCore library not found in current path or any of your system library paths, please download from https://www.github.com/VeNoMouS/cloudscraper/tree/ChakraCore/, or https://github.com/Microsoft/ChakraCore/z4There was an error loading the ChakraCore library {}win32r	      zutf-16ziuam-challenge.js)!ospathisfilejoingetcwdctypesutilfind_librarysystracebacklimitRuntimeErrorr   OSErrorformatplatformDllMainr   r   encoder   JsCreateRuntimer   JsCreateContextJsSetCurrentContextJsCreateStringlenJsCreateExternalArrayBufferJsRunJsConvertValueToStringr   JsCopyStringvalueJsDisposeRuntime)r   bodydomainchakraCoreLibrary_libraryFile
chakraCorescriptruntimecontextfnamescriptSourcejsResultresultJSStringstringLength	resultSTRs                  r   evalzChallengeInterpreter.eval   s|     Z 	Lww~~bggll299;EF$&GGLLl$K!	
 ! & 8 8 F !"C> 	q/0J
 <<7"q!Q'q!Q'%htV&<&C&CH&MN*""1aw8*""7E'N;&&w/
!!#$%L	
  z..K,	
 :q%uXG!))(E.4IJz1eL6IJ(););a)?@	)"		
 	##G,i  	q!"CU\\]nopp	qs   J= =/K,)__name__
__module____qualname__r   rC   __classcell__)r   s   @r   r   r      s    A
Jr   r   )
__future__r   r   r"   ctypes.utilr   r   r   r   r   r    r
   encapsulatedr   r    r   r   <module>rM      s5    & 	 
  H H # "
S0 Sp  r   