
    3yi\                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlmZmZ d dlmZmZ d dlmZ d dlmZ d dlmZ d dlmZmZ d dlmZ d d	lmZmZ d
dlm Z  d
dl!m"Z"  G d dee          Z#ddZ$d de%de%de%fdZ&de%fdZ'd!de%de(fdZ)de%fdZ*d!de%de(de(fdZ+de%fdZ, ejZ                  d      Z.y)"    N)ForeStyle)distributionsversion)BytesIO)slugify)MkDocsConfig)
BasePluginevent_priority)get_yaml_loader)ZipFileZIP_DEFLATED   )
InfoConfig)get_exclusion_patternsc                   b     e Zd Z fdZd Z ed      d        Zd Zd Zd Z	de
d	efd
Z xZS )
InfoPluginc                 N    t        |   |i | d| _        g | _        g | _        y )NF)super__init__is_serveexclusion_patternsexcluded_entries)selfargskwargs	__class__s      ^/var/www/html/content_weaver/venv/lib/python3.12/site-packages/material/plugins/info/plugin.pyr   zInfoPlugin.__init__5   s0    $)&)  #% "    c                    |dk(  | _         y )Nserve)r   )r   commanddirtys      r   
on_startupzInfoPlugin.on_startup@   s    7*r   d   c                    | j                   j                  sy | j                   j                  s| j                  ry d}t	        j
                  |d      }|j                  j                  d      j                  dd      \  }}t        d      }|j                  |      s't        j                  d       | j                  ||       | j                   j                  st        j                  d       t        j!                  d	       |j"                  j$                  r%t        j                  d
       | j'                          |j(                  r%t        j                  d       | j'                          t+        |j,                        |_        t.        j0                  j3                  |j,                        }|j"                  j$                  r"t+        |j"                  j$                  |      }nd}|j4                  j                  d      }	|	r"t+        |	j                   j6                  |      }
nd}
t9        |j,                        }t;        |t<              s|g}t=        t?        t@        tB        jD                              }tA        t/        jF                               }t=        t?        t@        |j,                  |jH                  ||
g|D cg c]  }|j                  dd       c}            }|j(                  D ]   }t+        ||      }|jK                  |       " t=        |      D ]'  }|r|j                  |      s|jM                  |       ) |r&t        j                  d       | jO                  |       tQ               }tS        d      }t.        j0                  jU                  |      \  }}djW                  |tY        |d      g      }t[               | _.        g | _/        tA        |j`                        j                  |      r.| j\                  jK                  tc        |j`                               |D ]8  }|j                  |      s| j\                  jK                  tc        |             : t/        jd                  t/        jF                               D ]c  \  }}}|D ]X  }|jg                         dk7  rtA        |      }||vs'ti        d|        | j\                  jK                  tc        |             Z e |	rtk        jl                  |	j                   jn                  |
d      D ]]  }t.        j0                  jW                  |
|      }tq        |      }tc        |j`                        }| j\                  jK                  |       _ d}g }ts        |dtt        d      5 }t/        jd                  t/        jF                               D ]G  \  }}}d| }ti        |dd       t=        |      D ]U  }t.        j0                  jW                  ||      }| jw                  |      r|jM                  |       Fty        |d      sTd}W |D ]  }t.        j0                  jW                  ||      }| jw                  |      r5ty        |d      rd}t.        j0                  j{                  |t.        j0                  j|                        }|j                  |t.        j0                  jW                  ||              ti        dt        |      z  dd       J |j                  t.        j0                  jW                  |d      djW                  t        t               D  cg c])  } djW                  | j                  | j                  g      + c}                    	 t        j                         }!|j                  t.        j0                  jW                  |d!      t        j                  t        j                         t        j                         t        j                         t/        jF                         djW                  t        j                  d"   j                  t.        j                  d      d#   gt        j                  dd        t/        j                  d$d      t/        j                  d%d      t        j0                  | j^                  d&	t        d'(      j                  |!d              |j                  D ]q  }"d)|"j                  v rt        j                  nt        j                  }#|jK                  djW                  |#|"j                  dt        |"j                        g             s 	 d d d        |j                         }$t        | d*d+      5 }|j                  |j                                d d d        t        j!                  d,       ti        t        j                         |j                          |D ]  }%ti        d-|%         ti        t        j                         ti        djW                  d-j                  dt        |$j                  d.      g             ti        t        j                         |$j                  d/kD  rt        j                  d0       |rt        j                  d1       t        j                  d       y c c}w c c} w # t        $ r d }!Y ;w xY w# 1 sw Y   xY w# 1 sw Y   ExY w)2Nz<https://github.com/squidfunk/mkdocs-material/releases/latestF)allow_redirectslocation/r   zmkdocs-materialz%Please upgrade to the latest version.z'Started archive creation for bug reportz#Please remove 'custom_dir' setting.zPlease remove 'hooks' setting.
abs_prefix zmaterial/projectsINHERITz)One or more paths aren't children of rootz*
Please name your bug report (2-4 words): -z
pyvenv.cfgzPossible inactive venv: T)pathnameroot_dir	recursiveazProcessing: )endflush)log_warning zrequirements.lock.txt
z==USERNAMEzplatform.jsonr   
PYTHONPATHVIRTUAL_ENV)	systemarchitecturepythoncwdr"   zenv:$PYTHONPATHzenv:$VIRTUAL_ENVzsys.pathr      )defaultindentz/.z.zipwbzArchive successfully created:z  
   i@B z0Archive exceeds recommended maximum size of 1 MBzArchive contains dotpaths, which could contain sensitive information.
Please review them at the bottom of the list and share only necessary data to reproduce the issue.)bconfigenabledenabled_on_server   requestsgetheadersrsplitr   
startswithlogerror_help_on_versions_and_exitarchivesysexitinfotheme
custom_dir _help_on_customizations_and_exithooks_convert_to_absconfig_file_pathospathdirnamepluginsprojects_dir
_load_yaml
isinstancelistmap
capitalizesitePREFIXESgetcwddocs_dirappendremove_help_on_not_in_cwdr   inputsplitextjoinr   r   r   r   site_dir_resolve_patternwalklowerprintglobiglobprojects_config_files_get_project_configr   r   _is_excluded_is_dotpathrelpathcurdirwritelenwritestrsortedr   namegetpassgetuser	Exceptionjsondumpsplatformr>   python_versionargvsepgetenvstrreplacefilelistfilenamer   LIGHTYELLOW_EXLIGHTBLACK_EX_sizecompress_size	getbufferopengetvaluer   NORMALsort	RESET_ALLnbyteswarning)&r   rF   urlres_currentpresentconfig_file_parentabs_custom_dirprojects_pluginabs_projects_dirloaded_configssite_prefixesr@   cfgpaths_to_validatehookr\   rQ   exampleabs_rootdirnames	filenamesr   current_config_fileproject_configpatterncontains_dotpathfilesf	indicatorr   packageusernamer2   colorbufferfiles&                                         r   	on_configzInfoPlugin.on_configG   s	   {{""
 {{++ Mll3%8 [[__Z077Q?
7+,!!'*II=>++GW= {{""HHQK 	:; <<""II;<113 <<II67113
 #2&2I2I"JWW__V-D-DE <<"",''/N
  N !..,,-@A.&&33/ 
  " $F$;$;<.$/,-N
 ST]];<%
 !Z##OO	2

 1??cggi$?2
 "  LL 	+D"46HID$$T*	+
 *+ 	/D4??3/!((.	/
 IIAB$$%67 )EFWW%%g.
((GWWc%:;< #9": " foo&11#6##**+;FOO+LM
 " 	GDs#''../?/EF	G .0WWRYY[-A 		K)Hh	% K>>#|3!(+},4TF;<++223CD3IJK		K 

*11GG+  8
 ')ggll3CT&J#!45H!I*>+B+BC''..w78 "' Wc<7 V	1131E %B-(I*8*5	iT6 !N 0D77<<$7D ((. -  #4t<+/(0 & ?D77<<$7D ((.  #4t<+/( 77??4@DGGD"'',,w"=>?" cC	N*DAK%BP JJW&=>		&'4"# IIw||W__=>"  &"??,
 JJWo6

"*"3"3"5(0(=(=(?"*"9"9";!yy{#&88HHQK..rvvq9"=- XXab\- $ ,.99\2+F,.IImR,H$'HH,0,A,A "!" '(J/'. ZZ 04

0B,,"00 RWW1::s!//*&  	_V	r ""$WIT"D) 	(QGGG$$&'	( 	01ell 	

 	DBtf+	 	eoobgg!&&#&--$
  	 	eoo==7"KKJK KKH 	I @h"  &%&iV	 V	t	( 	(s]   k"B!k,Dk,.k	k,k-Gk, k9k,k)%k,(k))k,,k69lc                    t        t        j                         t        d       t        d       t        d       t        d       t        t        j                         t        d| d| d       t        t        j
                         t        d       t        t        j                         | j                  j                  rt        j                  d	       y y )
Nz;  When reporting issues, please first upgrade to the latestz>  version of Material for MkDocs, as the problem might alreadyz=  be fixed in the latest version. This helps reduce duplicatez(  efforts and saves us maintainers time.z  Please update from z to .z9  pip install --upgrade --force-reinstall mkdocs-materialr   )
rs   r   REDr   r   r   rF   archive_stop_on_violationrR   rS   )r   haveneeds      r   rP   z%InfoPlugin._help_on_versions_and_exitq  s    dhhKLNOMN89ell%dV4vQ78eooIKell ;;00HHQK 1r   c                    t        t        j                         t        d       t        d       t        d       t        d       t        t        j                         t        d       t        d       t        t        j
                         t        d       t        d       t        t        j                         t        d	       t        d
       t        t        j
                         t        d       t        d       t        d       t        d       t        t        j                         | j                  j                  rt        j                  d       y y )Nz;  When reporting issues, you must remove all customizationsz;  and check if the problem persists. If not, the problem isz;  caused by your overrides. Please understand that we can'tz4  help you debug your customizations. Please remove:z  - theme.custom_dirz	  - hooksz;  Additionally, please remove all third-party JavaScript orz4  CSS not explicitly mentioned in our documentation:z  - extra_cssz  - extra_javascriptz?  If you're using customizations from the theme's documentationz?  and you want to report a bug specific to those customizationsz?  then set the 'archive_stop_on_violation: false' option in thez  info plugin config.r   )rs   r   r   r   r   YELLOWr   rF   r   rR   rS   )r   s    r   rW   z+InfoPlugin._help_on_customizations_and_exit  s    dhhKLKLKLDEell$%kdkkKLDEello$%dkkOPOPOP%&eoo ;;00HHQK 1r   c                    t        t        j                         t        d       t        dt        j                          d       t        d       t        t
        j                         |D ]  }t        d|         t        d       t        d       t        d       t        d       t        d       t        t
        j                         | j                  j                  rt        j                  d	       y y )
Nz(  The current working (root) directory:
z    r8   z)  is not a parent of the following paths:z;
  To assure that all project files are found please adjustz=  your config or file structure and put everything within thez   root directory of the project.z<
  Please also make sure `mkdocs build` is run in the actualr   )rs   r   r   r[   rg   r   r   r   rF   r   rR   rS   )r   outside_rootr\   s      r   rk   zInfoPlugin._help_on_not_in_cwd  s    dhh9:RYY[M$%9:ell  	!DD- 	!LMMN01MN01eoo ;;00HHQK 1r   abspathreturnc                    t        |d      }| j                  D ]U  }t        j                  ||      st        j                  d| d|        | j                  j                  | d|         y t        j                  j                  |      ryt        j                  j                  |d      }t        j                  j                  |      r7t        j                  d|        | j                  j                  d	|        yy)
NTreturn_pathzExcluded pattern 'z': z - Fzsitemap.xml.gzzExcluded site_dir: zsitemap.xml.gz - )rp   r   researchrN   debugr   ri   r[   r\   isfilern   exists)r   r   pattern_pathr   
sitemap_gzs        r   rx   zInfoPlugin._is_excluded  s     (tD.. 	Gyy,/		.wis7)DE%%,,yL>-JK		 77>>'" WW\\'+;<
77>>*%II+G956!!((+<\N)KLr   )__name__
__module____qualname__r   r$   r   r   rP   rW   rk   r   boolrx   __classcell__)r   s   @r   r   r   2   sK    #+ Cd dR	"6,C D r   r   c                     t         j                  }| d|z  kD  rt         j                  }n| d|z  kD  rt         j                  }dD ]!  }t	        |       dk  r| | dd| c S | dz  } # y )Ni ia  )BkBMBGBTBPBEBZBg     @@z3.1fr7   )r   GREENr   r   abs)valuefactorr   units       r   r   r     sn    JJE	&	 $((%	%&.	 $++%? u:WU4L$00r   r\   r+   r   c                     t         j                  j                  |       r| S |t        j                         }t         j                  j	                  t         j                  j                  ||             S N)r[   r\   isabsrg   normpathrn   )r\   r+   s     r   rY   rY     sJ    	ww}}T4K		:77BGGLLT:;;r   abs_src_pathc                 N   t        | d      5 }|j                         }d d d        	 t        j                  t	                     xs i }d|v r|j                  d      }t        j                  j                  |       }t        ||      }t        j                  j                  |      rS||d<   t        j                  d|        t        |      }t        |t               r|g|}|S t        |t"              r||g}|S # 1 sw Y   xY w# t        j
                  $ r i }Y w xY w)N	utf-8-sigencoding)Loaderr-   r*   z&Loading inherited configuration file: )r   readyamlloadr   	YAMLErrorrJ   r[   r\   r]   rY   r   rN   r   r`   ra   rb   dict)r   r   sourceresultrz   parent_pathr   parents           r   r`   r`     s   	lk	2 d6O,=>D" F**Y'ggool3!'D77>>'" 'F9II>wiHI(F&$' *6* M FD) &)M+ 
 >> s   D #D  D	D$#D$r   r   c                 .   t        |       j                  t        t        j                               dd      }|j                  t        j                  d      j                  d      }|syt        j                  j                  |       s|dz   }|r|S d| S )Nr,   r   r)   ^)rd   r   r[   rg   r   rstripr\   r   )r   r   r\   s      r   rp   rp     sy    g&&z"))+'>AFD<<$++C0D 77>>'"cz4.avJ.r   project_config_filec                     t        | d      5 }t        |       }|j                  |       |j                          |cd d d        S # 1 sw Y   y xY w)Nr   r   )rZ   )r   r	   	load_filevalidate)r   r   rF   s      r   rw   rw     sL    	!K	8 D1DE 	  s   /AAr6   c                     t        | d      }|j                  d      j                  dd      d   }|j                  d      r|rt        j                  d|         yy)	NTr   r)   r   r:   r   z)The following .dotpath will be included: F)rp   r   rL   rM   rN   r   )r\   r6   
posix_pathr   s       r   ry   ry     sY    !$d;JS!((a04DsKKCD6JKr   c                 <    | r| d   j                         | dd  z   S | S )Nr   r   )upper)r\   s    r   rd   rd   +  s$    )-47==?T!"X%747r   zmkdocs.material.info)r   r   )F)/r   rt   r   loggingr[   r   r   rI   re   rR   r   coloramar   r   importlib.metadatar   r   ior   markdown.extensions.tocr   mkdocs.config.defaultsr	   mkdocs.pluginsr
   r   mkdocs.utils.yamlr   zipfiler   r   rF   r   patternsr   r   r   r   rY   r`   r   rp   rw   ry   rd   	getLoggerrN    r   r   <module>r     s   *     	  	   
    5  + / 5 - )  ,YJ' Y@<# <3 <# <S :/c / /S c   8S 8 g./r   