
    i                        S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	J
r
JrJrJrJr  \" SS9S	S
.SS jj5       rSS jr\" SS9" \5      rg)a  Multicast DNS Service Discovery for Python, v0.14-wmcbrine
Copyright 2003 Paul Scott-Murphy, 2014 William McBrine

This module provides a framework for the use of DNS Service Discovery
using IP multicast.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
    )annotations)	lru_cache   )BadTypeInNameException)_HAS_A_TO_Z_HAS_ASCII_CONTROL_CHARS_HAS_ONLY_A_TO_Z_NUM_HYPHEN&_HAS_ONLY_A_TO_Z_NUM_HYPHEN_UNDERSCORE_LOCAL_TRAILER_NONTCP_PROTOCOL_LOCAL_TRAILER_TCP_PROTOCOL_LOCAL_TRAILERi   )maxsizeT)strictc          	     l   [        U 5      S:  a  [        SU  S35      eU R                  [        [        45      (       a8  U S[        [        5      *  R                  S5      nU [        [        5      * S nSnOU(       a  [        SU  S[         S	[         S
35      eU R                  [        5      (       a;  U S[        [        5      *  R                  S5      nU [        [        5      * S-   S nSnO[        SU  S[         S
35      eU(       d  U(       GaB  UR                  5       nU(       d  [        S5      e[        U5      S:X  a!  [        US   5      S:X  a  [        SU  S35      eUS   S:w  a  [        SU S35      eUSS nU(       a  [        U5      S:  a  [        SU S35      eSU;   a  [        SU S35      eSUS   US   4;   a  [        SU S35      e[        R                  " U5      (       d  [        SU S35      eU(       a  [        O[        nUR                  U5      (       d(  [        U(       a  SU(       a  UOS S3S-   5      eS5      eOSnU(       aE  US   S:X  a<  UR                  5         [        U5      S:X  d  [        US   5      S:X  a  [        S5      e[        U5      S:  a  SR                  U5      /nU(       ae  [        US   R                  S 5      5      nUS!:  a  [        S"US    S
35      e[        R                  " US   5      (       a  [        S#US    S
35      eXS-   $ )$a  
Validate a fully qualified service name, instance or subtype. [rfc6763]

Returns fully qualified service name.

Domain names used by mDNS-SD take the following forms:

               <sn> . <_tcp|_udp> . local.
  <Instance> . <sn> . <_tcp|_udp> . local.
  <sub>._sub . <sn> . <_tcp|_udp> . local.

1) must end with 'local.'

  This is true because we are implementing mDNS and since the 'm' means
  multi-cast, the 'local.' domain is mandatory.

2) local is preceded with either '_udp.' or '_tcp.' unless
   strict is False

3) service name <sn> precedes <_tcp|_udp> unless
   strict is False

  The rules for Service Names [RFC6335] state that they may be no more
  than fifteen characters long (not counting the mandatory underscore),
  consisting of only letters, digits, and hyphens, must begin and end
  with a letter or digit, must not contain consecutive hyphens, and
  must contain at least one letter.

The instance name <Instance> and sub type <sub> may be up to 63 bytes.

The portion of the Service Instance Name is a user-
friendly name consisting of arbitrary Net-Unicode text [RFC5198]. It
MUST NOT contain ASCII control characters (byte values 0x00-0x1F and
0x7F) [RFC20] but otherwise is allowed to contain any characters,
without restriction, including spaces, uppercase, lowercase,
punctuation -- including dots -- accented characters, non-Roman text,
and anything else that may be represented using Net-Unicode.

:param type_: Type, SubType or service name to validate
:return: fully qualified service name (eg: _http._tcp.local.)
   zFull name (z) must be > 256 bytesN.TzType 'z' must end with 'z' or ''   FzNo Service name foundr   z' must not start with '.'_zService name (z) must start with '_'   z) must be <= 15 bytesz--z) must not contain '--'-z) may not start or end with '-'z.) must contain at least one letter (eg: 'A-Z') zA) must contain only these characters: A-Z, a-z, 0-9, hyphen ('-')z, underscore ('_')_subz_sub requires a subtype namezutf-8?   zToo long: 'z7Ascii control character 0x00-0x1F and 0x7F illegal in ')lenr   endswithr   r   splitr   popr   searchr	   r
   joinencoder   )	type_r   	remainingtrailerhas_protocolservice_nametest_service_nameallowed_characters_relengths	            K/home/sebas/venvs/catt/lib/python3.13/site-packages/zeroconf/_utils/name.pyservice_type_namer,   '   s   V 5zC${5'9N%OPP~~24RSTT=S!<==>DDSI	899;<	$UG +,F3Q2RRSU
 	
 
	'	'0S00177<	^,,q023$veW4EnEUUV%WXX }}()@AAy>Q3y|#4#9(6%8Q)RSS?c!(>,G\)]^^(,c+,r1(>:K9LLa)bcc$$(>:K9LLc)dee$Q'):2)>??(>:K9LLk)lmm!!"344( !2 33ab 
 ,2'7] 	 %++,=>>(  !f!2" E F. .0DE 
   ? Yr]f,y>Q#il"3q"8()GHH
9~XXi()	Yq\((12B;(;y|nA)FGG#**9Q<88(I)TU,WXY  !!    c                   U R                  S5      n[        U5      n[        5       n[        U5       HI  nXU-
  S-
  S nUS   R	                  S5      (       d    U$ UR                  SR                  U5      5        MK     U$ )z>Build a set of all possible types from a fully qualified name.r      Nr   r   )r   r   setrange
startswithaddr!   )namelabelslabel_counttypescountpartss         r+   possible_typesr:      s}    ZZ_Ff+KEE{#U*Q.01Qx""3''L 			#((5/"	 $
 Lr-   r   N)r#   strr   boolreturnr;   )r4   r;   r=   zset[str])__doc__
__future__r   	functoolsr   _exceptionsr   constr   r   r	   r
   r   r   r   r,   r:   cached_possible_types r-   r+   <module>rE      sZ   , #  0   348 {" {"|
 "#.~> r-   