
    ^h                         S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
JrJr  SSKJrJr  SSK
Jr  \R"                  rSS	KJr  S
 r " S S\\\5      rSR-                  \" 5       \5      \4/rg)zWTornado handlers for the live notebook view.

This is a fork from jupyter/notebook#6.x
    )
namedtuple)webgen)_i18n)ensure_async)
path_regexFilesRedirectHandler)ExtensionHandlerMixinExtensionHandlerJinjaMixin)JupyterHandler)nbclassic_pathc                     SSK Jn Jn  [        SSS/5      nU" SSS9U" S	S
S9U" SSS9U" SSS9U" SSS9U" SSS9U" SSS9U" SSS9/n/ nU " 5        H}  nU" U5      nU" 5       n[	        USS 5      n[	        [        Xg5      SS 5      n	Uc  M:  X:w  d  MA  [        SR                  UUR                  5      5      n
UR                  U" XZ5      5        M     [        S U 5       5      nU H&  nUR                  U;  d  M  UR                  U5        M(     U" SSS9nX;   a  UR                  U5        U" SSS9nX;   a  UR                  U5        [        U5      $ )Nr   )get_export_namesget_exporterExporterInfonamedisplayhtmlzHTML (.html))r   r   latexzLaTeX (.tex)markdownzMarkdown (.md)notebookzNotebook (.ipynb)pdfzPDF via LaTeX (.pdf)rstzreST (.rst)scriptzScript (.txt)slideszReveal.js slides (.slides.html)export_from_notebookz{} ({})c              3   T   #    U  H  oR                   R                  5       v   M      g 7f)N)r   lower).0exporters     U/home/james-whalen/.local/lib/python3.13/site-packages/nbclassic/notebook/handlers.py	<genexpr>)get_frontend_exporters.<locals>.<genexpr>=   s      I6H(##%%6Hs   &(pythonzpython (.py)customzcustom (.txt))nbconvert.exporters.baser   r   r   getattrsuperr   formatfile_extensionappendsetr   removesorted)r   r   r   default_exportersfrontend_exportersr   exporter_classexporter_instanceux_namesuper_uxnamer   namesr    python_exportertemplate_exporters                  r!   get_frontend_exportersr8      s   G nvy.ABL 	&.9'>:*.>?*.AB%)?@%7(O<(,MN	  "%d+*,+-CTJu^G5t= 7#:I,,W->-M-MO PG%%l4&AB # I6HIIE%==%%%h/ &
 #.IO,!!/2 %(OL.!!"34$%%    c                   V    \ rS rSr\R
                  \R                  S 5       5       rSr	g)NotebookHandlerN   c              #      #    UR                  S5      nU R                  n [        UR                  USS95      v nWS   S:w  a  [        R                  " X5      v   UR                  SS	5      S
   nU R                  U R                  SUUSU R                  U R                  [        S95        g! [        R
                   aH  nUR                  S:X  a2  SUR                  S5      ;   a  [        R                  " X5      v    SnANe SnAff = f7f)zuget renders the notebook template if a name is given, or
redirects to the '/files/' handler if the name is not given./F)contenti  filesNtyper      znotebook.html)notebook_pathnotebook_namekill_kernelmathjax_urlmathjax_configr8   )stripcontents_managerr   getr   	HTTPErrorstatus_codesplitr	   redirect_to_filesrsplitwriterender_templaterG   rH   r8   )selfpathcmmodeler   s         r!   rK   NotebookHandler.getP   s     
 zz#""	&rvvdEv'BCCE =J&&88DD{{3"2&

4''6:6:49484D4D7;7J7J?U ( * 	 }} 	}}#4::c?(B*<<THH	s4   DB/ A3D/D=D DDDD N)
__name__
__module____qualname____firstlineno__r   authenticatedr   	coroutinerK   __static_attributes__rY   r9   r!   r;   r;   N   s&    ]]  r9   r;   z{}/notebooks{}N)__doc__collectionsr   tornador   r   jupyter_server.transutilsr   jupyter_server.utilsr   jupyter_server.base.handlersr   r	    jupyter_server.extension.handlerr
   r   r   rL   	nbclassicr   r8   r;   r)   default_handlersrY   r9   r!   <module>rj      sq    #  + J 8MM	 $/&d02G N n.
;_M r9   