+
    Ki7  c                   s   R t ^ RIt^ RIt^ RIt^ t^t^t^t^t	^t
]]]]]	]
.t^ t^t^t^t^t^t^t^t^t^	t^
t]]]]]]]]]]].t]R]R]R/t]P3                  4        U Uu/ uF  w  rWbK	  	  upp t]RR.]RR./t]P8                  ! R	4      t]P8                  ! R
P=                  RP?                  R ]PA                  4        4       4      RP?                  R ]PA                  4        4       4      R7      4      t!]P8                  ! RP=                  RP?                  R ]PA                  4        4       4      R7      4      t" ! R R]#4      t$ ! R R4      t%R# u upp i )zcProvides utilities for representing SteamIDs
See: https://developer.valvesoftware.com/wiki/SteamID
NZUZgZTZprofilesZidZgroupsZgidz(^STEAM_(?P<X>\d+):(?P<Y>\d+):(?P<Z>\d+)$zE.*/(?P<path>{paths})/\[(?P<type>[{type_chars}]):1:(?P<steamid>\d+)\]$|c              #   D   "   T F  pR P                  V4      x  K  	  R# 5ir    Njoin.0paths   & >/usr/lib/python3.14/site-packages/lutris/util/steam/steamid.py	<genexpr>r
   E        O4N5sxx4N    Z c              #   s$   "   T F  qx  K  	  R # 5iN )r   Zcr   r	   r
   r
   F   s     ?&>1&>s   )r   Z
type_charsz&.*/(?P<path>{paths})/(?P<steamid>\d+)$c              #   r   r   r   r   r   r	   r
   r
   K   r   r   )r   c                   s    ] tR t^PtRtRtR# )SteamIDErrorz0Raised when parsing or building invalid SteamIDsr   N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       r	   r   r   P   s    :r   r   c                   s   a  ] tR t^Tt o RtRt]]3R l4       t]]	]3R l4       t
]R 4       t]]	3R l4       tR t]R 4       tR	 tR
 tR tR tR tR tR tRR ltRtV tR# )SteamIDa/  Represents a SteamID

A SteamID is broken up into four components: a 32 bit account number,
a 20 bit "instance" identifier, a 4 bit account type and an 8 bit
"universe" identifier.

There are 10 known accounts types as listed below. Generally you won't
encounter types other than "individual" and "group".

+----------------+---------+---------------+---------------------------+
| Type           | Numeric | Can be mapped | Constant                  |
|                | value   | to URL        |                           |
+================+=========+===============+===========================+
| Invalid        | 0       | No            | ``TYPE_INVALID``          |
+----------------+---------+---------------+---------------------------+
| Individual     | 1       | Yes           | ``TYPE_INDIVIDUAL``       |
+----------------+---------+---------------+---------------------------+
| Multiseat      | 2       | No            | ``TYPE_MULTISEAT``        |
+----------------+---------+---------------+---------------------------+
| Game server    | 3       | No            | ``TYPE_GAME_SERVER``      |
+----------------+---------+---------------+---------------------------+
| Anonymous game | 4       | No            | ``TYPE_ANON_GAME_SERVER`` |
| server         |         |               |                           |
+----------------+---------+---------------+---------------------------+
| Pending        | 5       | No            | ``TYPE_PENDING``          |
+----------------+---------+---------------+---------------------------+
| Content server | 6       | No            | ``TYPE_CONTENT_SERVER``   |
+----------------+---------+---------------+---------------------------+
| Group          | 7       | Yes           | ``TYPE_CLAN``             |
+----------------+---------+---------------+---------------------------+
| Chat           | 8       | No            | ``TYPE_CHAT``             |
+----------------+---------+---------------+---------------------------+
| "P2P Super     | 9       | No            | ``TYPE_P2P_SUPER_SEEDER`` |
| Seeder"        |         |               |                           |
+----------------+---------+---------------+---------------------------+
| Anonymous user | 10      | No            | ``TYPE_ANON_USER``        |
+----------------+---------+---------------+---------------------------+


``TYPE_``-prefixed constants are provided by the :mod:`valve.steam.id`
module for the numerical values of each type.

All SteamIDs can be represented textually as well as by their numerical
components. This is typically in the STEAM_X:Y:Z form where X, Y, Z are
the "universe", "instance" and the account number respectively. There are
two special cases however. If the account type if invalid then "UNKNOWN"
is the textual representation. Similarly "STEAM_ID_PENDING" is used when
the type is pending.

As well as the the textual representation of SteamIDs there are also the
64 and 32 bit versions which contain the SteamID components encoded into
integers of corresponding width. However the 32-bit representation also
includes a letter to indicate account type.
zhttp://steamcommunity.com/c                s   \         P                  P                  V4      p\        P	                  VP
                  4      pV'       d   VP                  R4      \        \        VP                  R4      ,          ,          9  d2   \        P                  ! RP                  VP
                  4      ^R7       \        VP                  R4      4      pV^,          pWV,
          ^,          pV ! Wv\        VP                  R4      ,          V4      # \        P	                  VP
                  4      pV'       d   \        VP                  R4      4      pV^,          pVP                  R4      \        \        ,          9   d   V P                  V4      p\        pMAVP                  R4      \        \         ,          9   d   WV,
          R,
          ^,          p\         pV ! XVXV4      # \#        RP                  V4      4      h)a  Parse a Steam community URL into a :class:`.SteamID` instance

This takes a Steam community URL for a profile or group and converts
it to a SteamID. The type of the ID is infered from the type character
in 32-bit community urls (``[U:1:1]`` for example) or from the URL path
(``/profile`` or ``/groups``) for 64-bit URLs.

As there is no way to determine the universe directly from
URL it must be expliticly set, defaulting to
:data:`UNIVERSE_INDIVIDUAL`.

Raises :class:`.SteamIDError` if the URL cannot be parsed.
pathtypez4Community URL ({}) path doesn't match type character)Z
stacklevelsteamid         z Invalid Steam community URL ({}))urllibparseZurlparseCOMMUNITY32_REGEXmatchr   groupTYPE_URL_PATH_MAPLETTER_TYPE_MAPwarningsZwarnformatintCOMMUNITY64_REGEXTYPE_INDIVIDUALget_account_number_from_steamid	TYPE_CLANr   )	clssteam_iduniverseZurlr   r   instanceaccount_numberaccount_types	   &&&      r	   from_community_urlZSteamID.from_community_url   sx     ll##H-!''1{{6"*;OEKKX^L_<`*aaJQQRURZRZ[  %++i01G{H%0A5N~VAT1UW_``!''1%++i01G{H{{6"&7&HH!$!D!DW!M.V$(9)(DD")"47I"IQ!N(~xxHH=DDSIJJr   c                sH    V^,          pV P                  V4      pV ! WTW#4      # )zNCreate an instance of SteamID from a SteamID64. Only for normal user accounts.)r(   )r*   r   r/   r,   r-   r.   s   &&&&  r	   from_steamid64ZSteamID.from_steamid64   s*     Q;<<WE>\DDr   c                s@    V ^,          pW,
          R,
          ^,          # )z?Return account number from 64bit SteamID. For individuals only.        r   )r   r-   r   r	   r(   Z'SteamID.get_account_number_from_steamid   s!     Q;"%771<<r   c           
     s   VR8X  d   V ! ^ ^ \         ^ 4      # VR8X  d   V ! ^ ^ \        ^ 4      # \        P                  V4      pV'       g*   \	        RP                  V\        P                  4      4      hV ! \        VP                  R4      4      \        VP                  R4      4      V\        VP                  R4      4      4      # )ao  Parse a SteamID in the STEAM_X:Y:Z form

Takes a teaxtual SteamID in the form STEAM_X:Y:Z and returns
a corresponding :class:`.SteamID` instance. The X represents the
account's 'universe,' Z is the account number and Y is either 1 or 0.

As the account type cannot be directly inferred from the SteamID
it must be explicitly specified, defaulting to :data:`TYPE_INDIVIDUAL`.

The two special IDs ``STEAM_ID_PENDING`` and ``UNKNOWN`` are also
handled returning SteamID instances with the appropriate
types set (:data:`TYPE_PENDING` and :data:`TYPE_INVALID` respectively)
and with all other components of the ID set to zero.
STEAM_ID_PENDINGUNKNOWNzID '{}' doesn't match format {}ZZZYZX)	TYPE_PENDINGTYPE_INVALIDTEXTUAL_ID_REGEXr   r   r$   Zpatternr%   r    )r*   r+   r/   r   s   &&& r	   	from_textZSteamID.from_text   s    " ))q!\1--y q!\1-- &&x0@GGRbRjRjkll3u{{3'(#ekk#.>*?sSXS^S^_bScOdeer   c                sp   V\         9  d   \        R P                  V4      4      hV\        9  d   \        RP                  V4      4      hV^ 8  g   VR8  d   \        RP                  V4      4      hVR9  d   \        RP                  V4      4      h\	        V4      V n        W n        W0n        W@n        R# )zInvalid universe {}zInvalid type {}z Account number ({}) out of rangez&Expected instance to be 1 or 0, got {}Nl    )i   i    )		UNIVERSESr   r$   ACCOUNT_TYPESr%   r.   r-   r/   r,   )selfr.   r-   r/   r,   s   &&&&&r	   __init__ZSteamID.__init__   s    9$4;;HEFF},077EFFA+!=AHHXYY6!GNNxXYY!.1 ( r   c                s    \        4       P                  4        UUu/ uF   w  rVP                  R4      '       g   K  W!bK"  	  uppP                  V P                  V P                  4      # u uppi )zThe account type as a stringZTYPE_)ZglobalsZ	iteritemsZ
startswithZgetr/   )r;   kvs   &  r	   	type_nameZSteamID.type_name   sX     ")!4!4!6P!6!,,w:O!6PTTt00
 	
Ps
   A*A*c                s    V P                   \        8X  d   R# V P                   \        8X  d   R# RP                  V P                  V P
                  V P                  4      # )a  The textual representation of the SteamID

This is in the STEAM_X:Y:Z form and can be parsed by :meth:`.from_text`
to produce an equivalent :class:`.` instance. Alternately
``STEAM_ID_PENDING`` or ``UNKNOWN`` may be returned if the account
type is :data:`TYPE_PENDING` or :data:`TYPE_INVALID` respectively.

.. note::
    :meth:`.from_text` will still handle the ``STEAM_ID_PENDING`` and
    ``UNKNOWN`` cases.
r3   r4   zSTEAM_{}:{}:{})r/   r5   r6   r$   r,   r-   r.   r;      &r	   __str__ZSteamID.__str__   sI     ,%,&&t}}dmmTEXEXYYr   c                sJ   V P                   \        8X  d,   V P                  ^,          R,           V P                  ,           # V P                   \        8X  d,   V P                  ^,          R,           V P                  ,           # \        RP                  V P                  4      4      h)a   The 64 bit representation of the SteamID

64 bit SteamIDs are only valid for those with the type
:data:`TYPE_INDIVIDUAL` or :data:`TYPE_CLAN`. For all other types
:class:`.SteamIDError` will be raised.

The 64 bit representation is calculated by multiplying the account
number by two then adding the "instance" and then adding another
constant which varies based on the account type.

For :data:`TYPE_INDIVIDUAL` the constant is ``0x0110000100000000``,
whereas for :data:`TYPE_CLAN` it's ``0x0170000000000000``.
r2   r   z8Cannot create 64-bit identifier for SteamID with type {})r/   r'   r.   r-   r)   r   r$   r?   r@   rA   r	   __int__ZSteamID.__int__  s~     /''!+/AADMMQQ	)''!+/AADMMQQU\\]a]k]klmmr   c                s     V P                   VP                   8H  ;'       d\    V P                  VP                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P                  VP                  8H  #   \
         d     R # i ; i)F)r.   r-   r/   r   r,   ZAttributeErrorr;   Zother   &&r	   __eq__ZSteamID.__eq__  s    	##u';';; 4 4MMU^^34 4%%34 4 MMU^^3	  		s"   A>  A>  A> $A> >BBc                s    W8X  * # r   r   rD   rE   r	   __ne__ZSteamID.__ne__(  s      r   c                s     RP                  \        V P                  ,          V P                  4       4      #   \         d+   p\        RP                  T P                  4      4      ThRp?ii ; i)a  Returns the 32 bit community ID as a string

This is only applicable for :data:`TYPE_INDIVIDUAL`,
:data:`TYPE_CLAN` and :data:`TYPE_CHAT` types. For any other types,
attempting to generate the 32-bit representation will result in
a :class:`.SteamIDError` being raised.
z	[{}:1:{}]z9Cannot create 32-bit indentifier for SteamID with type {}N)r$   TYPE_LETTER_MAPr/   get_32_bit_community_idKeyErrorr   r?   )r;   exr   r	   as_32ZSteamID.as_32+  sc    	%%od6G6G&H$JfJfJhii 	KRRSWSaSab	s   47 A,%A''A,c                sJ    V P                   ^,          V P                  ,           # )i   )r.   r-   r@   rA   r	   rI   ZSteamID.get_32_bit_community_id;  s    ##a'4==88r   c                s*    \        \        V 4      4      # )zReturns the 64 bit representation as a string

This is only possible if the ID type is :data:`TYPE_INDIVIDUAL` or
:data:`TYPE_CLAN`, otherwise :class:`.SteamIDError` is raised.
)Zstrr%   r@   rA   r	   as_64ZSteamID.as_64>  s     3t9~r   c                sl   V'       d   V P                   MV P                  p \        P                  P	                  V P
                  RP                  \        V P                  ,          ^ ,          V! 4       34      4      #   \         d+   p\        RP                  T P                  4      4      ThRp?ii ; i)au  Returns the full URL to the Steam Community page for the SteamID

This can either be generate a URL from the 64 bit representation
(the default) or the 32 bit one. Generating community URLs is only
supported for IDs of type :data:`TYPE_INDIVIDUAL` and
:data:`TYPE_CLAN`. Attempting to generate a URL for any other type
will result in a :class:`.SteamIDError` being raised.
Z/z)Cannot generate community URL for type {}N)rM   rL   r   r   Zurljoinbase_community_urlr   r!   r/   rJ   r   r$   r?   )r;   Zid64Z	path_funcrK   s   &&  r	   community_urlZSteamID.community_urlG  s     #'DJJDJJ		k<<''''3DTEVEV3WXY3Z\e\g2h)i   	kJQQRVR`R`abhjj	ks   AA> >B3	%B..B3)r.   r/   r-   r,   N)T)r   r   r   r   r   rN   ZclassmethodUNIVERSE_INDIVIDUALr0   r'   r1   Zstaticmethodr(   r8   r<   Zpropertyr?   rB   rC   rF   rG   rL   rI   rM   rO   r   Z__classdictcell__)Z__classdict__s   @r	   r   r   T   s     5p 63F &K &KP 2AL_ E E = =
 .= f f2! 
 
Z&n*	! 9k kr   r   )&r   ZreZurllib.parser   r#   rP   ZUNIVERSE_PUBLICZUNIVERSE_BETAZUNIVERSE_INTERNALZUNIVERSE_DEVZUNIVERSE_RCr9   r6   r'   ZTYPE_MULTISEATZTYPE_GAME_SERVERZTYPE_ANON_GAME_SERVERr5   ZTYPE_CONTENT_SERVERr)   Z	TYPE_CHATZTYPE_P2P_SUPER_SEEDERZTYPE_ANON_USERr:   rH   Zitemsr"   r!   Zcompiler7   r$   r   Zvaluesr   r&   Z
ValueErrorr   r   )r=   r>   s   00r	   <module>rQ      s   
     	    		   Sss
 %4$9$9$;<$;DA14$;< j$'%  
 ::IJ JJLSShhO4E4L4L4NOO77?o&<&<&>?? T   JJ-44hhO4E4L4L4NOO 5  ;: ;Ck Ck3 =s   !E