+
    }i=                       a  R. t>0 t ^ RIt^ RIt^ RIt^ RIHtHtHtHt  ! R R]	4      t
 ! R R]	4      tR t ! R R	]	4      t^t/ t] ^ k R
 tR tR tR tR tR tR tR tR tR/R ltR0R ltR1R ltR/R ltR1R lt]P<                  P?                  R4      t ] '       Ed   ^ RI!t! ^ RI!H"t# ]%! ] R4      ;_uu_ 4       t&]!PN                  ! ]&]#R7      t(RRR4       . t)](R,           FZ  t*]*R,          t+]*P?                  R4      t,]*P?                  R 4      t-]*P?                  R!4      t.])P^                  ! ]
! ]+],]-].4      4       K\  	  . t0](R",           F~  t1]1R,          t+]1P?                  R#4      t2]1P?                  R$4      t3]1P?                  R%4      t4]1P?                  R&4      t5]1P?                  R'4      t6]0P^                  ! ]! ]+]2]3]4]5]64      4       K  	  . t7](R(,           Fl  t8]8R,          t+]8P?                  R)4      t9]8P?                  R*4      t:]8P?                  R+4      t;]8P?                  R,4      t<]7P^                  ! ]! ]+]9]:];]<4      4       Kn  	  A(A!A#R# ^ R-I=H7t7H0t0H)t) R#   ]$ d    ^ RI!H#t#  ELi ; i  + '       g   i     EL; i)2    N)AnyDictOptionalTuplec                   <   a  ] tR t^t o RR ltV 3R lR ltRtV tR# )UserAgentParserNc                `    \         P                  ! V4      V n        W n        W0n        W@n        R# )a  Initialize UserAgentParser.

Args:
  pattern: a regular expression string
  family_replacement: a string to override the matched family (optional)
  v1_replacement: a string to override the matched v1 (optional)
  v2_replacement: a string to override the matched v2 (optional)
N)recompileuser_agent_refamily_replacementv1_replacementv2_replacement)selfpatternr   r   r   s   &&&&&m/Users/ahmad/.openclaw/workspace/my-crawler/.venv/lib/python3.14/site-packages/ua_parser/user_agent_parser.py__init__UserAgentParser.__init__   s'      ZZ0"4,,    c          	         < V ^8  d   QhRS[ RS[S[S[ ,          S[S[ ,          S[S[ ,          S[S[ ,          3,          /#    user_agent_stringreturnstrr   r   )format__classdict__s   "r   __annotate__UserAgentParser.__annotate__   sC      "  "!$ "		
 "r   c                   Rw  r#rEV P                   P                  V4      pV'       EdZ   V P                  '       d_   \        P                  ! RV P                  4      '       d+   \        P                  ! RV^,          V P                  4      pMV P                  pM	V^,          pV P
                  '       d   V P
                  pM6VP                  '       d%   VP                  ^8  d   V^,          ;'       g    R pV P                  '       d   V P                  pM6VP                  '       d%   VP                  ^8  d   V^,          ;'       g    R pVP                  '       d%   VP                  ^8  d   V^,          ;'       g    R pW#WE3# )Nz\$1NNNN)r   searchr   r
   subr   	lastindexr   )r   r   familyv1v2v3matchs   &&     r   ParseUserAgentParser.Parse   s%    4B""))*;<5&&&99VT%<%<==VVFE!Hd6M6MNF!44Fq"""((U__%91X%%"""((U__%91X%%5??a#71X%%2!!r   )r   r   r   r   NNN__name__
__module____qualname____firstlineno__r   r+   __static_attributes____classdictcell__r   s   @r   r   r      s     -  "  "r   r   c                   <   a  ] tR t^;t o RR ltV 3R lR ltRtV tR# )OSParserNc                x    \         P                  ! V4      V n        W n        W0n        W@n        WPn        W`n        R# )a  Initialize UserAgentParser.

Args:
  pattern: a regular expression string
  os_replacement: a string to override the matched os (optional)
  os_v1_replacement: a string to override the matched v1 (optional)
  os_v2_replacement: a string to override the matched v2 (optional)
  os_v3_replacement: a string to override the matched v3 (optional)
  os_v4_replacement: a string to override the matched v4 (optional)
N)r
   r   r   os_replacementos_v1_replacementos_v2_replacementos_v3_replacementos_v4_replacement)r   r   r9   r:   r;   r<   r=   s   &&&&&&&r   r   OSParser.__init__<   s3    &  ZZ0,!2!2!2!2r   c          
         < V ^8  d   QhRS[ RS[S[S[ ,          S[S[ ,          S[S[ ,          S[S[ ,          S[S[ ,          3,          /# r   r   )r   r   s   "r   r   OSParser.__annotate__V   sJ     %. %.!$%.			
%.r   c                   Rw  r#rEpV P                   P                  V4      pV'       Ed   V P                  '       d   \        V P                  V4      pMVP                  '       d
   V^,          pV P
                  '       d   \        V P
                  V4      pM,VP                  '       d   VP                  ^8  d
   V^,          pV P                  '       d   \        V P                  V4      pM,VP                  '       d   VP                  ^8  d
   V^,          pV P                  '       d   \        V P                  V4      pM,VP                  '       d   VP                  ^8  d
   V^,          pV P                  '       d   \        V P                  V4      pM,VP                  '       d   VP                  ^8  d
   V^,          pW#WEV3# )NNNNNN)	r   r#   r9   MultiReplacer%   r:   r;   r<   r=   )r   r   osos_v1os_v2os_v3os_v4r*   s   &&      r   r+   OSParser.ParseV   sV    *F&5""))*;<5"""!$"5"5u=1X%%%$T%;%;UCU__%9a%%%$T%;%;UCU__%9a%%%$T%;%;UCU__%9a%%%$T%;%;UCU__%9a%--r   )r9   r:   r;   r<   r=   r   rB   r.   r5   s   @r   r7   r7   ;   s     34%. %.r   r7   c                 r   a V3R  lp\         P                  ! RW 4      P                  4       pT;'       g    R# )c                    < \        V ^,          4      ^,
          pSP                  4       pV\        V4      8  d	   W!,          # R# )    )intgroupslen)mindexgroupr*   s   &  r   _replMultiReplace.<locals>._repl   s6    AaD	A3u:<r   z\$(\d)N)r
   r$   strip)stringr*   rT   _strings   &f  r   rC   rC   ~   s/     ffY.446G??dr   c                   <   a  ] tR t^t o RR ltV 3R lR ltRtV tR# )DeviceParserNc                    \         P                  ! YR8X  d   \         P                  M^ 4      V n        W0n        W@n        WPn        R# )zInitialize UserAgentParser.

Args:
  pattern: a regular expression string
  device_replacement: a string to override the matched device (optional)
iN)r
   r   
IGNORECASEr   device_replacementbrand_replacementmodel_replacement)r   r   
regex_flagr^   r_   r`   s   &&&&&&r   r   DeviceParser.__init__   s9      ZZC&7R]]Q
 #5!2!2r   c                p   < V ^8  d   QhRS[ RS[S[S[ ,          S[S[ ,          S[S[ ,          3,          /# r   r   )r   r   s   "r   r   DeviceParser.__annotate__   s<     $ $!$$		
$r   c                   R R R rCpV P                   P                  V4      pV'       d   V P                  '       d   \        V P                  V4      pM	V^,          pV P                  '       d   \        V P                  V4      pV P
                  '       d   \        V P
                  V4      pM'\        VP                  4       4      ^ 8  d
   V^,          pW#V3# N)r   r#   r^   rC   r_   r`   rP   rO   )r   r   devicebrandmodelr*   s   &&    r   r+   DeviceParser.Parse   s      $T4u""))*;<&&&%d&=&=uEq%%%$T%;%;UC%%%$T%;%;UCU\\^$q(ae##r   )r_   r^   r`   r   r"   r.   r5   s   @r   rZ   rZ      s     3*$ $r   rZ   c                     \        V \        4      '       g   \        R V : 24      h\        P	                  V 4      pVe   V# \        \        4      \        8  d   \        P                  4        RV /;p\        V &   V# )z(Expected user agent to be a string, got rW   )
isinstancer   	TypeError_PARSE_CACHEgetrP   MAX_CACHE_SIZEclear)uaentryvs   &  r   _lookupru      sn    b#B2&IJJR E
<N*$b>)ARHr   c                 f    \        V 4      pVP                  V4      pV'       g   V! V 4      ;qCV&   V# rf   )ru   ro   )rr   keyfnrs   rs   &&&  r   _cachedrz      s0    BKE		#AB#JHr   c                   V'       d   \         P                  ! R\        ^R7       \        V 4      p\	        V4      ^8X  d   V# RV9  d   \        V 4      VR&   RV9  d   \        V 4      VR&   RV9  d   \        V 4      VR&   V# )z~Parse all the things
Args:
  user_agent_string: the full user agent string
Returns:
  A dictionary containing all parsed bits
)javascript overrides are not used anymorecategory
stacklevel
user_agentrD   rg   )warningswarnDeprecationWarningru   rP   _ParseUserAgent_ParseOS_ParseDevice)r   _jsParseBitsrs   s   &, r   r+   r+      s     7'	
 %&E
5zQ 5 -.?@l501du&'89hLr   c                n    V'       d   \         P                  ! R\        ^R7       \        V R\        4      # )zParses the user-agent string for user agent (browser) info.
Args:
  user_agent_string: The full user-agent string.
Returns:
  A dictionary containing parsed bits.
r|   r}   r   )r   r   r   rz   r   r   r   s   &,r   ParseUserAgentr      s.     7'	

 $lODDr   c           	          \          F!  pVP                  V 4      w  r#rEV'       g   K!   M	  X;'       g    R pRTRX;'       g    RRX;'       g    RRX;'       g    R/# )Otherr&   majorNminorpatch)USER_AGENT_PARSERSr+   )r   uaParserr&   r'   r(   r)   s   &     r   r   r     sg    &%^^,=>B6 '
 wF&ttt	 r   c                n    V'       d   \         P                  ! R\        ^R7       \        V R\        4      # )zParses the user-agent string for operating system info
Args:
  user_agent_string: The full user-agent string.
Returns:
  A dictionary containing parsed bits.
r|   r}   rD   )r   r   r   rz   r   r   s   &,r   ParseOSr     s.     7'	

 $dH55r   c           
          \          F"  pVP                  V 4      w  r#rEpV'       g   K"   M	  X;'       g    R pRVRXRXRXRX/# )r   r&   r   r   r   patch_minor)
OS_PARSERSr+   )r   osParserrD   rE   rF   rG   rH   s   &      r   r   r   "  sZ    )18I)J&52  
wB"u r   c                n    V'       d   \         P                  ! R\        ^R7       \        V R\        4      # )zParses the user-agent string for device info.
Args:
    user_agent_string: The full user-agent string.
Returns:
    A dictionary containing parsed bits.
r|   r}   rg   )r   r   r   rz   r   r   s   &,r   ParseDevicer   1  s.     7'	

 $h==r   c                 t    \          F!  pVP                  V 4      w  r#pV'       g   K!   M	  Xf   RpRVRXRX/# )Nr   r&   rh   ri   )DEVICE_PARSERSr+   )r   deviceParserrg   rh   ri   s   &    r   r   r   A  sI    &+112CDu6 '
 ~fgugu==r   c                    V'       d7   V^ ,          P                  4       '       d   V  RV RV RV 2# V  RV RV V 2# V'       d   V  RV RV 2# V'       d   V  RV 2# V # )zPretty user agent string. .isdigitr&   r'   r(   r)   s   &&&&r   PrettyUserAgentr   M  s    	a5==??XQrd!B4q--XQrd!B4t,,	2$at$$	2$Mr   c           	         V'       d   V  RV RV RV RV 2	# V'       d7   V^ ,          P                  4       '       d   V  RV RV RV 2# V  RV RV V 2# V'       d   V  RV RV 2# V'       d   V  RV 2# V # )zPretty os string.r   r   r   )rD   rE   rF   rG   rH   s   &&&&&r   PrettyOSr   [  s    QugQugQugQug668T5'5'5'22T5'5'%11	QugQug&&	QugIr   c                    \         P                  ! R \        ^R7       Ve#   VR8w  d   TpRpRpRp	Ve   TpVe   TpVe   Tp	M+\         F!  p
V
P	                  V 4      w  rgrV'       g   K!   M	  V'       d^   VP                  R4      R8  dH   V P                  R4      R8  d2   RX: RX: R2p\        V4      pVR	,          pVR
,          pVR,          p	X;'       g    RXXX	3# )z#Use Parse (or a specialised parser)r   NrM   zChrome/chromeframezChrome Frame (r   )r   r   r   r   )r   r   r   r   r+   findr   )r   js_user_agent_stringjs_user_agent_familyjs_user_agent_v1js_user_agent_v2js_user_agent_v3r&   r'   r(   r)   parserua_dicts   &&&&&&      r   ParseWithJSOverridesr   k  s     MM-/Aa
 ',@B,F%'!B'!B'!B(F!'.?!@Fv ) 	 %%i025""=1B6+126 !56WWWWb"b((r   c                     \         P                  ! R \        ^R7       V'       d7   V^ ,          P                  4       '       d   V  RV RV RV 2# V  RV RV V 2# V'       d   V  RV RV 2# V'       d   V  RV 2# V # )zUse PrettyUserAgentr   r   r   )r   r   r   r   r   s   &&&&r   Prettyr     s    MM');J	a5==??XQrd!B4q--XQrd!B4t,,	2$at$$	2$Mr   c           
          \         P                  ! R \        ^R7       / pRVRVRVRVRV/pVP                  4        F  w  rV	f   K  V	R8w  g   K  WV&   K  	  V# )zNo use case anymorer   r   r   r   r   r   rM   )r   r   r   items)
r   r   r   r   r   r   filters
filterdictrw   values
   &&&&&&    r   
GetFiltersr     sq     MM');JG 4 4,,,J !&&(
" CL ) Nr   UA_PARSER_YAML)CSafeLoader)
SafeLoaderrb)Loaderuser_agent_parsersregexr   r   r   
os_parsersr9   r:   r;   r<   r=   device_parsersra   r^   r_   r`   )r   r   r   c                    V ^8  d   Qh/ ^ \         9   d,   \        \        \        \        \        3,          3,          ;R&   # )r   rn   )__conditional_annotations__r   r   r   )r   s   "r   r   r      s,    		t - ,d3S#X&' ,u 
r   r-   r"   rB   )?r   rD   r
   r   typingr   r   r   r   objectr   r7   rC   rZ   rp   rn   ru   rz   r+   r   r   r   r   r   r   r   r   r   r   r   environro   r   yamlr   r   ImportErroropenfploadregexesr   
_ua_parser_regex_family_replacement_v1_replacement_v2_replacementappendr   
_os_parser_os_replacement_os_v1_replacement_os_v2_replacement_os_v3_replacement_os_v4_replacementr   _device_parser_regex_flag_device_replacement_brand_replacement_model_replacementua_parser_builtins.regexesr   )r   s   @r   <module>r      s   		 	  - -1"f 1"h@.v @.F	-$6 -$` *, ,<E 6 > 	> *)Z2  01> $ 	3 
nd	#	#r))Bz2 
$ 233
G$(nn-AB$..)9:$..)9:!!+_o	
 4 Jl++
G$$..)9:'^^,?@'^^,?@'^^,?@'^^,?@""""		
 ,( N!"233($((6,001EF+//0CD+//0CD#""	
 4( 	 G  $##$ 
$	#	#s   (I ?I2I/.I/2J	