+
    "i#                        R t ^ RIHt ^ RIt^ RIHt ^RIHtHt ^RI	H
t
 ^RIHt ^RIHt ^RIHt ]P"                  ! R	4      t]'       d   ^ R
IHt ^RIHt  ! R R]4      tR# )zClass for plugins in HACS.)annotationsN)TYPE_CHECKING)HacsCategoryHacsDispatchEvent)HacsException)
concurrent)
json_loads)HacsRepositoryz\D+)ResourceStorageCollection)HacsBasec                     a  ] tR t^tRtR V 3R llt]R 4       tR tR t	R t
]! ^
^R7      RR	 l4       tR
 tR R ltR R ltR R ltR R ltR R ltR R ltR R ltRtV ;t# )HacsPluginRepositoryzPlugins in HACS.c                    V ^8  d   QhRRRR/# )   hacsr   	full_namestr )formats   "5/config/custom_components/hacs/repositories/plugin.py__annotate__!HacsPluginRepository.__annotate__   s     1 1X 1# 1    c                0  < \         SV `  VR7       W P                  n        VP	                  4       V P                  n        RV P                  n        \        P                  V P                  n	        V P                  V P                  P                  n        R# )zInitialize.)r   N)super__init__datar   lowerfull_name_lower	file_namer   PLUGINcategory	localpathcontentpathlocal)selfr   r   	__class__s   &&&r   r   HacsPluginRepository.__init__   sd    d#'		$-OO$5		!"		)00		"&..r   c                    V P                   P                  P                   RV P                  P                  P                  R4      R,           2# )zReturn localpath.z/www/community//)r   coreconfig_pathr   r   splitr&   s   &r   r"   HacsPluginRepository.localpath"   sA     ))..,,-_TYY=P=P=V=VWZ=[\^=_<`aar   c                  "   V P                  4       G Rj  xL
  V P                  4        V P                  P                  P                  f6   \        V P                   RV P                  P                  RR4       R24      hV P                  P                  P                  R8X  d   RV P                  n	        V P                  P                  '       dm   V P                  P                   FR  pV P                  P                  P                  '       d   K+  V P                  P!                  RV P                  V4       KT  	  V P                  P"                  #  EL@5i)	z	Validate.N Repository structure for tags/  is not compliantreleaseTz%s %s)common_validateupdate_filenamesr#   r$   remoter   stringrefreplacesinglevalidateerrorsr   statusstartuploggererrorsuccess)r&   rC   s   & r   validate_repository(HacsPluginRepository.validate_repository'   s     ""$$$ 	<<##+;;-9$((:J:J7SU:V9WWhi  <<##y0"&DLL ==--yy''///KK%%gt{{EB . }}$$$% 	%s   EEB<E<EAEc                   "   V P                   P                  4       G Rj  xL
  V P                  4       G Rj  xL
  R#  L L5i)zRun post installation steps.N)r   $async_setup_frontend_endpoint_pluginupdate_dashboard_resourcesr/   s   &r   async_post_installation,HacsPluginRepository.async_post_installation>   s5     ii<<>>>--/// 	?/s   A?AAAAc                B   "   V P                  4       G Rj  xL
  R#  L5i)zRun post uninstall steps.N)remove_dashboard_resourcesr/   s   &r   async_post_uninstall)HacsPluginRepository.async_post_uninstallC   s     --///s   )concurrenttasksbackoff_timec                  "   V P                  W4      G Rj  xL
 '       g   V'       g   R# V P                  4        V P                  P                  P                  fP   V P
                  P                  P                  V P                   RV P                  P                  RR4       R24       V P                  P                  P                  R8X  d   RV P                  n        V P                  P                  '       d]   V P                  P                  \         P"                  RR	R
RRV P                  P$                  RV P                  P&                  /4       R# R#  ELF5i)zUpdate.Nr2   r3   r4   r5   r6   Tidi9  actionupdate
repositoryrepository_id)common_updater8   r#   r$   r9   r>   r?   appendr:   r;   r<   r=   r   	installedr   async_dispatchr   
REPOSITORYr   rS   )r&   ignore_issuesforces   &&&r   update_repository&HacsPluginRepository.update_repositoryG   s     ''===e 	<<##+MM  '';;-9$((:J:J7SU:V9WWhi <<##y0"&DLL 99II$$!,,$h $))"5"5#TYY\\	  >s!   E E	E E CE ?AE c                  "    V P                   P                  RV P                  4      G Rj  xL
 p\        VP                  4      pV'       d   VR,          V P
                  n        R# R#  L=  \         d     R# i ; i5i)zGet package content.zpackage.jsonNauthor)repository_objectget_contentsr;   r   r#   r   authorsBaseException)r&   packages   & r   get_package_content(HacsPluginRepository.get_package_contentd   sl     	 22??PTPXPXYYG 1G$+H$5		!  Z
  		s8   A?)A- A+9A- 'A?+A- -A<8A?;A<<A?c                   V ^8  d   QhRR/# r   returnNoner   )r   s   "r   r   r   o   s     $ $$ $r   c                v   V P                   P                  pV P                   P                  ;p'       d   V3pMrV P                  P                  P                  RR4       R2V P                  P                   R2V P                  P                   R2V P                  P                   R23pV'       g   V P                  P                  '       d   V P                  P                  ^ ,          pVP                  '       dw   V UUu. uF*  pVP                   F  pWVP                  8X  g   K  VNK  	  K,  	  upp;p'       d6   V^ ,          V P                  n	        RV P                  P                  n        R# V P                   Uu0 uF  qP                  kK  	  p	pV F  pWY9   d/   WPP                  n	        RV P                  P                  n         R# V'       d   KA  RV 2V	9   g   KM  VP                  R	4      R,          V P                  n	        R
V P                  P                  n         R# 	  R# u uppi u upi )zGet the filename to target.z	lovelace-r4   z.jsz.umd.jsz
-bundle.jsr6   Nzdist/r*   distr+   )repository_manifestcontent_in_rootfilenamer   namer<   releasesobjectsassetsr   r#   r$   r9   tree	full_pathr.   )
r&   rq   specific_filenamevalid_filenamesr6   rr   asset
assetnamesx	all_pathss
   &         r   r8   %HacsPluginRepository.update_filenameso   s   22BB $ 8 8 A AAA02O 99>>))+r:;3?99>>"#&99>>"'*99>>"*-	O }}$$$--//2>>> )8&(7H%,^^E#zz1 !%3 !(7& z  /9m		+3<))0*.))4)Q[[)	4'H$&.		#+-!!("?xj'9Y'F&.nnS&9"&=		#+1!!( (& 5s   !H0)
H0H6c                   V ^8  d   QhRR/# r   rl   r   r   )r   s   "r   r   r      s     D DS Dr   c                    V P                   ;'       g+    V P                  P                  ;'       g    V P                  pV P                  P                   \
        P                  RV4       2# )z-Get the HACS tag used by dashboard resources.r4   )display_installed_versionr   selected_tagdisplay_available_versionrS   HACSTAG_REPLACERsub)r&   versions   & r   #generate_dashboard_resource_hacstag8HacsPluginRepository.generate_dashboard_resource_hacstag   sd     ** . .yy%%. .-- 	
 )),, 0 4 4R ABCCr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     A As Ar   c                `    RV P                   P                  P                  R4      ^,           2# )%Get the dashboard resource namespace.z/hacsfiles/r*   )r   r   r.   r/   s   &r   %generate_dashboard_resource_namespace:HacsPluginRepository.generate_dashboard_resource_namespace   s*    TYY0066s;A>?@@r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     	
 	
 	
r   c                   V P                   P                  pRV9   d@   V P                  P                  RV P                  V4       VP                  R4      R,          pV P                  4        RV RV P                  4        2# )r   r*   z'%s have defined an invalid file name %sz	?hacstag=r+   )r   r   rB   warningr:   r.   r   r   )r&   rr   s   & r   generate_dashboard_resource_url4HacsPluginRepository.generate_dashboard_resource_url   sx    99&&(?KK I4;;X`a~~c*2.H99;<AhZ@@BCE	
r   c                   V ^8  d   QhRR/# )r   rl   z ResourceStorageCollection | Noner   )r   s   "r   r   r      s      'G r   c                J   V P                   P                  P                  ;p'       g)   V P                  P	                  RV P
                  4       R# VP                  R4      ;pf)   V P                  P                  RV P
                  4       R# V P                   P                  P                  R8  d   VP                  pMVP                  R4      pVf)   V P                  P                  RV P
                  4       R# \        VR4      '       d   VP                  f)   V P                  P                  R	V P
                  4       R# VP                  P                  R
8w  g   VP                  P                  ^8w  d)   V P                  P                  RV P
                  4       R# V# )zGet the resource handler.z%s Can not access the hass dataNlovelacez/%s Can not access the lovelace integration dataz	2025.1.99	resourcesz)%s Can not access the dashboard resourcesstorez/%s YAML mode detected, can not update resourceslovelace_resourcesz&%s Can not use the dashboard resources)r   hassr   rB   rC   r:   getr   r,   
ha_versionr   hasattrr   infokeyr   )r&   	hass_datalovelace_datar   s   &   r   _get_resource_handler*HacsPluginRepository._get_resource_handler   s=    "YY^^000	0KK?M&]]:66M?KK QSWS^S^_99>>$${2 &//I%))+6IKK KT[[Yy'**ioo.EKKNPTP[P[\??"66)//:Q:QUV:VKK H$++Vr   c                   V ^8  d   QhRR/# rk   r   )r   s   "r   r   r      s     N N$ Nr   c                  "   V P                  4       ;p'       g   R# VP                  '       g   VP                  4       G Rj  xL
  V P                  4       pV P	                  4       pVP                  4        Fw  pVR,          ;pP                  V4      '       g   K%  WS8w  dL   V P                  P                  RV P                  VV4       VP                  VR,          RV/4      G Rj  xL
   R# 	  V P                  P                  RV P                  V4       VP                  RRRV/4      G Rj  xL
  R#  L LQ L
5i)zUpdate dashboard resources.Nurlz5%s Updating existing dashboard resource from %s to %srS   z%s Adding dashboard resource %sres_typemodule)r   loaded
async_loadr   r   async_items
startswithrB   r   r:   async_update_itemasync_create_item)r&   r   	namespacer   entry	entry_urls   &     r   rI   /HacsPluginRepository.update_dashboard_resources   s    !7799	9&&(((>>@	224**,E"5\)	55i@@#KK$$O!	 $55eDkE3<PPP - 	:DKKM)):x*LMMM' ) Q
 	NsC   ,D>D>D8AD>AD>(D:)AD>1D<2D>:D><D>c                   V ^8  d   QhRR/# rk   r   )r   s   "r   r   r      s      $ r   c                  "   V P                  4       ;p'       g   R# VP                  '       g   VP                  4       G Rj  xL
  V P                  4       pVP	                  4        Fr  pVR,          P                  V4      '       g   K#  V P                  P                  RV P                  VR,          4       VP                  VR,          4      G Rj  xL
   R# 	  R#  L L5i)zRemove dashboard resources.Nr   z!%s Removing dashboard resource %srS   )
r   r   r   r   r   r   rB   r   r:   async_delete_item)r&   r   r   r   s   &   r   rM   /HacsPluginRepository.remove_dashboard_resources   s     !7799	9&&(((>>@	**,EU|&&y11  !DdkkSXY^S_`11%+>>>	 -	 ) ?s0   ,C#C#CAC#
A	C#C!C#!C#r   )FF)__name__
__module____qualname____firstlineno____doc__r   propertyr"   rE   rJ   rN   r   r_   rh   r8   r   r   r   r   rI   rM   __static_attributes____classcell__)r'   s   @r   r   r      s    1 1 b b%.0
0 3 48	$LDA	
@N6 r   r   )r   
__future__r   retypingr   enumsr   r   
exceptionsr   utils.decoratorr   
utils.jsonr   baser	   compiler   +homeassistant.components.lovelace.resourcesr
   r   r   r   r   r   <module>r      sF      " 	   3 & ( #  ::f% U`> `r   