c o m m i t   3 5 8 9 9 9 8 a 2 d a b 2 9 4 d 4 0 2 a c 4 6 6 c 4 5 3 1 a 4 3 7 4 2 c 3 0 e 6 
 
 A u t h o r :   S y a m r a j   < f l u r a k n o w h o w @ g m a i l . c o m > 
 
 D a t e :       F r i   M a y   2 2   2 1 : 2 1 : 5 4   2 0 2 6   + 0 5 3 0 
 
 
 
         f e a t :   n a t i v e   t e r m i n a l   U I   a n d   U R L   l i n k s 
 
 
 
 d i f f   - - g i t   a / s r c / t e r m i n a l P a n e l . j s   b / s r c / t e r m i n a l P a n e l . j s 
 
 i n d e x   f 9 4 3 f 0 0 . . 9 3 a b 9 d f   1 0 0 6 4 4 
 
 - - -   a / s r c / t e r m i n a l P a n e l . j s 
 
 + + +   b / s r c / t e r m i n a l P a n e l . j s 
 
 @ @   - 8 3 , 6   + 8 3 , 8   @ @   r e s o l v e W e b v i e w V i e w ( w e b v i e w V i e w )   { 
 
       / /           R u n   a   s h e l l   c o m m a n d                                                                                                         
 
       _ r u n C o m m a n d ( c o m m a n d )   { 
 
           i f   ( ! c o m m a n d   | |   ! c o m m a n d . t r i m ( ) )   r e t u r n ; 
 
 +         t h i s . _ p r e v i o u s C o m m a n d   =   t h i s . _ c u r r e n t C o m m a n d   | |   n u l l ; 
 
 +         t h i s . _ c u r r e n t C o m m a n d   =   c o m m a n d ; 
 
           t h i s . _ k i l l C u r r e n t P r o c e s s ( ) ; 
 
   
 
           l e t   s t d e r r B u f f e r   =   ' ' ; 
 
 @ @   - 1 9 8 , 6   + 2 0 0 , 7   @ @   r e s o l v e W e b v i e w V i e w ( w e b v i e w V i e w )   { 
 
               t h i s . _ s t d e r r T i m e o u t   =   s e t T i m e o u t ( ( )   = >   { 
 
                   c o n s t   l i n e s   =   s t d e r r B u f f e r . s p l i t ( ' \ n ' ) . f i l t e r ( l   = >   l . t r i m ( ) . l e n g t h   >   0 ) ; 
 
                   i f   ( l i n e s . l e n g t h   >   4 )   { 
 
 +                     t h i s . _ k i l l C u r r e n t P r o c e s s ( ) ;   / /   A u t o - k i l l   s o   t h e   u s e r ' s   t e r m i n a l   u n f r e e z e s   a n d   a u t o r e l o a d   s t o p s   s p a m m i n g   t h e   A P I 
 
                       t h i s . _ a n a l y z e E r r o r s ( c o m m a n d ,   s t d o u t T a i l ,   s t d e r r B u f f e r ) ; 
 
                       s t d e r r B u f f e r   =   ' ' ;   / /   C l e a r   t o   p r e v e n t   d o u b l e   t r i g g e r i n g   o n   s a m e   e r r o r   b l o c k 
 
                   } 
 
 @ @   - 3 4 4 , 6   + 3 4 7 , 7   @ @   r e s o l v e W e b v i e w V i e w ( w e b v i e w V i e w )   { 
 
           t r y   { 
 
               c o n s t   e r r o r s   =   a w a i t   c a l l A I ( { 
 
                   c o m m a n d , 
 
 +                 p r e v i o u s C o m m a n d :   t h i s . _ p r e v i o u s C o m m a n d , 
 
                   s t d o u t C o n t e x t , 
 
                   s t d e r r C o n t e n t , 
 
                   a p i K e y :   s e t t i n g s . a p i K e y , 
 
 @ @   - 5 1 2 , 7   + 5 1 6 , 6   @ @   r e s o l v e W e b v i e w V i e w ( w e b v i e w V i e w )   { 
 
       # p r o m p t - p r e f i x   { 
 
           w h i t e - s p a c e :   p r e ; 
 
           f l e x - s h r i n k :   0 ; 
 
 -         u s e r - s e l e c t :   n o n e ; 
 
           c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i G r e e n ,   # 8 9 d 1 8 5 ) ; 
 
           f o n t - w e i g h t :   b o l d ; 
 
       } 
 
 @ @   - 7 8 4 , 7   + 7 8 7 , 1 5   @ @   f u n c t i o n   w r i t e ( t e x t ,   c l s )   { 
 
           i f   ( i   = = =   p a r t s . l e n g t h   -   1   & &   p a r t   = = =   ' ' )   r e t u r n ;   / /   t r a i l i n g   n e w l i n e 
 
           c o n s t   s p a n   =   d o c u m e n t . c r e a t e E l e m e n t ( ' s p a n ' ) ; 
 
           s p a n . c l a s s N a m e   =   ' l i n e   '   +   c l s ; 
 
 -         s p a n . t e x t C o n t e n t   =   p a r t ; 
 
 +         
 
 +         / /   P a r s e   l i n k s   ( h t t p : / /   o r   h t t p s : / / ) 
 
 +         c o n s t   u r l R e g e x   =   / ( h t t p s ? : \ \ / \ \ / [ ^ \ \ s ] + ) / g ; 
 
 +         i f   ( u r l R e g e x . t e s t ( p a r t ) )   { 
 
 +             s p a n . i n n e r H T M L   =   e s c ( p a r t ) . r e p l a c e ( u r l R e g e x ,   ' < a   h r e f = " $ 1 "   s t y l e = " c o l o r : v a r ( - - v s c o d e - t e x t L i n k - f o r e g r o u n d , # 3 7 9 4 f f ) ; t e x t - d e c o r a t i o n : n o n e ; " > $ 1 < / a > ' ) ; 
 
 +         }   e l s e   { 
 
 +             s p a n . t e x t C o n t e n t   =   p a r t ; 
 
 +         } 
 
 +         
 
           o u t p u t . i n s e r t B e f o r e ( s p a n ,   p r o m p t L i n e ) ; 
 
       } ) ; 
 
       s c r o l l T o B o t t o m ( ) ; 
 
 @ @   - 7 9 5 , 8   + 8 0 6 , 1 0   @ @   f u n c t i o n   s e t B u s y ( o n )   { 
 
       b u s y   =   o n ; 
 
       i f   ( o n )   { 
 
           c u r s o r E l . c l a s s L i s t . a d d ( ' b u s y ' ) ; 
 
 +         p r o m p t L i n e . s t y l e . d i s p l a y   =   ' n o n e ' ;   / /   h i d e   l i v e   p r o m p t   w h i l e   r u n n i n g 
 
       }   e l s e   { 
 
           c u r s o r E l . c l a s s L i s t . r e m o v e ( ' b u s y ' ) ; 
 
 +         p r o m p t L i n e . s t y l e . d i s p l a y   =   ' f l e x ' ;   / /   s h o w   l i v e   p r o m p t   a g a i n 
 
           c a p t u r e . f o c u s ( ) ; 
 
       } 
 
   } 
 
 
 
 c o m m i t   1 5 8 6 4 4 5 0 2 4 4 0 4 9 2 1 2 5 a 1 0 0 9 e 7 8 1 b 5 7 8 f 3 a 8 8 f e 7 9 
 
 A u t h o r :   S y a m r a j   < f l u r a k n o w h o w @ g m a i l . c o m > 
 
 D a t e :       F r i   M a y   2 2   1 7 : 0 8 : 5 7   2 0 2 6   + 0 5 3 0 
 
 
 
         I n i t i a l   c o m m i t :   A I   E r r o r   C h e c k l i s t e r   e x t e n s i o n 
 
 
 
 d i f f   - - g i t   a / s r c / t e r m i n a l P a n e l . j s   b / s r c / t e r m i n a l P a n e l . j s 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . f 9 4 3 f 0 0 
 
 - - -   / d e v / n u l l 
 
 + + +   b / s r c / t e r m i n a l P a n e l . j s 
 
 @ @   - 0 , 0   + 1 , 1 1 4 4   @ @ 
 
 + c o n s t   v s c o d e   =   r e q u i r e ( ' v s c o d e ' ) ; 
 
 + c o n s t   {   s p a w n   }     =   r e q u i r e ( ' c h i l d _ p r o c e s s ' ) ; 
 
 + c o n s t   p a t h               =   r e q u i r e ( ' p a t h ' ) ; 
 
 + c o n s t   {   c a l l A I   }   =   r e q u i r e ( ' . / a i C l i e n t ' ) ; 
 
 + 
 
 + c l a s s   T e r m i n a l P a n e l P r o v i d e r   { 
 
 + 
 
 + c o n s t r u c t o r ( c o n t e x t )   { 
 
 +     t h i s . _ c o n t e x t   =   c o n t e x t ; 
 
 +     t h i s . _ v i e w         =   n u l l ; 
 
 +     t h i s . _ c h i l d       =   n u l l ; 
 
 +     t h i s . _ c w d   =   v s c o d e . w o r k s p a c e . w o r k s p a c e F o l d e r s ? . [ 0 ] ? . u r i ? . f s P a t h   | |   r e q u i r e ( ' o s ' ) . h o m e d i r ( ) ; 
 
 +     t h i s . _ v e n v D i r   =   n u l l ; 
 
 +     t h i s . _ v e n v S c r i p t s   =   n u l l ; 
 
 +     t h i s . _ p r o m p t I n f o   =   t h i s . _ b u i l d P r o m p t I n f o ( ) ; 
 
 + } 
 
 + 
 
 + _ b u i l d P r o m p t I n f o ( )   { 
 
 +     c o n s t   o s       =   r e q u i r e ( ' o s ' ) ; 
 
 +     c o n s t   p a t h   =   r e q u i r e ( ' p a t h ' ) ; 
 
 +     c o n s t   i s W i n   =   o s . p l a t f o r m ( )   = = =   ' w i n 3 2 ' ; 
 
 + 
 
 +     / /   W i n d o w s :   " ( v e n v )   P S   C : \ P r o j e c t >   " ,   M a c / L i n u x :   " ( v e n v )   ~ / P r o j e c t   $   " 
 
 +     l e t   p r o m p t S t r   =   ' ' ; 
 
 +     l e t   v e n v P r e f i x   =   t h i s . _ v e n v D i r   ?   ` ( $ { p a t h . b a s e n a m e ( t h i s . _ v e n v D i r ) } )   `   :   ' ' ; 
 
 + 
 
 +     i f   ( i s W i n )   { 
 
 +         p r o m p t S t r   =   ` $ { v e n v P r e f i x } P S   $ { t h i s . _ c w d } >   ` ; 
 
 +     }   e l s e   { 
 
 +         c o n s t   w s F o l d e r   =   t h i s . _ c o n t e x t   ?   v s c o d e . w o r k s p a c e . w o r k s p a c e F o l d e r s ? . [ 0 ] ? . u r i ? . f s P a t h   :   n u l l ; 
 
 +         c o n s t   s h o r t P a t h   =   w s F o l d e r   ?   ' ~ / '   +   p a t h . b a s e n a m e ( w s F o l d e r )   :   ' ~ ' ; 
 
 +         p r o m p t S t r   =   ` $ { v e n v P r e f i x } $ { s h o r t P a t h }   $   ` ; 
 
 +     } 
 
 + 
 
 +     r e t u r n   {   p r o m p t S t r   } ; 
 
 + } 
 
 + 
 
 + r e s o l v e W e b v i e w V i e w ( w e b v i e w V i e w )   { 
 
 +     t h i s . _ v i e w   =   w e b v i e w V i e w ; 
 
 +     w e b v i e w V i e w . w e b v i e w . o p t i o n s   =   { 
 
 +         e n a b l e S c r i p t s :   t r u e , 
 
 +         l o c a l R e s o u r c e R o o t s :   [ 
 
 +             v s c o d e . U r i . j o i n P a t h ( t h i s . _ c o n t e x t . e x t e n s i o n U r i ,   ' m e d i a ' ) 
 
 +         ] 
 
 +     } ; 
 
 +     w e b v i e w V i e w . w e b v i e w . h t m l   =   t h i s . _ b u i l d H t m l ( w e b v i e w V i e w . w e b v i e w ) ; 
 
 + 
 
 +     / /   S i n g l e   m e s s a g e   h a n d l e r       f i r s t   o n e   r e g i s t e r e d   h a n d l e s   a l l   m e s s a g e s 
 
 +     w e b v i e w V i e w . w e b v i e w . o n D i d R e c e i v e M e s s a g e ( m s g   = >   t h i s . _ h a n d l e M e s s a g e ( m s g ) ) ; 
 
 + } 
 
 + 
 
 +     / /           M e s s a g e   h a n d l e r                                                                                                                 
 
 +     _ h a n d l e M e s s a g e ( m s g )   { 
 
 +         s w i t c h   ( m s g . t y p e )   { 
 
 +             c a s e   ' r u n C o m m a n d ' : 
 
 +                 t h i s . _ r u n C o m m a n d ( m s g . c o m m a n d ) ; 
 
 +                 b r e a k ; 
 
 + 
 
 +             c a s e   ' k i l l P r o c e s s ' : 
 
 +                 t h i s . _ k i l l C u r r e n t P r o c e s s ( ) ; 
 
 +                 b r e a k ; 
 
 + 
 
 +             c a s e   ' j u m p T o E r r o r ' : 
 
 +                 t h i s . _ j u m p T o F i l e ( m s g . f i l e P a t h ,   m s g . l i n e N u m b e r ) ; 
 
 +                 b r e a k ; 
 
 + 
 
 +             c a s e   ' r e q u e s t C o m p l e t i o n ' : 
 
 +                 t h i s . _ h a n d l e C o m p l e t i o n ( m s g . i n p u t ,   m s g . c u r s o r ) ; 
 
 +                 b r e a k ; 
 
 + 
 
 +             c a s e   ' s a v e S e t t i n g s ' : 
 
 +                 t h i s . _ s a v e S e t t i n g s ( m s g . a p i K e y ,   m s g . m o d e l ) ; 
 
 +                 b r e a k ; 
 
 + 
 
 +             c a s e   ' r e a d y ' : 
 
 +                 / /   S e n d   p r o m p t   i n f o   +   s a v e d   s e t t i n g s   a s   s o o n   a s   w e b v i e w   r e p o r t s   r e a d y 
 
 +                 t h i s . _ p o s t ( {   t y p e :   ' s e t P r o m p t ' ,   . . . t h i s . _ p r o m p t I n f o   } ) ; 
 
 +                 t h i s . _ s e n d S e t t i n g s T o W e b v i e w ( ) ; 
 
 +                 b r e a k ; 
 
 +         } 
 
 +     } 
 
 + 
 
 +     / /           R u n   a   s h e l l   c o m m a n d                                                                                                         
 
 +     _ r u n C o m m a n d ( c o m m a n d )   { 
 
 +         i f   ( ! c o m m a n d   | |   ! c o m m a n d . t r i m ( ) )   r e t u r n ; 
 
 +         t h i s . _ k i l l C u r r e n t P r o c e s s ( ) ; 
 
 + 
 
 +         l e t   s t d e r r B u f f e r   =   ' ' ; 
 
 +         l e t   s t d o u t T a i l       =   ' ' ; 
 
 + 
 
 +         c o n s t   o s   =   r e q u i r e ( ' o s ' ) ; 
 
 +         c o n s t   i s W i n   =   o s . p l a t f o r m ( )   = = =   ' w i n 3 2 ' ; 
 
 + 
 
 +         t h i s . _ p o s t ( { 
 
 +             t y p e :             ' c o m m a n d S t a r t ' , 
 
 +             c o m m a n d , 
 
 +             p r o m p t S t r :   t h i s . _ p r o m p t I n f o . p r o m p t S t r 
 
 +         } ) ; 
 
 + 
 
 +         i f   ( c o m m a n d . t r i m ( ) . s t a r t s W i t h ( ' c d   ' )   | |   c o m m a n d . t r i m ( )   = = =   ' c d ' )   { 
 
 +             c o n s t   f s   =   r e q u i r e ( ' f s ' ) ; 
 
 +             l e t   t a r g e t   =   c o m m a n d . t r i m ( ) . s u b s t r i n g ( 3 ) . t r i m ( ) ; 
 
 +             i f   ( ! t a r g e t   | |   t a r g e t   = = =   ' ~ ' )   t a r g e t   =   o s . h o m e d i r ( ) ; 
 
 + 
 
 +             i f   ( t a r g e t . s t a r t s W i t h ( ' " ' )   & &   t a r g e t . e n d s W i t h ( ' " ' ) )   t a r g e t   =   t a r g e t . s l i c e ( 1 ,   - 1 ) ; 
 
 +             i f   ( t a r g e t . s t a r t s W i t h ( " ' " )   & &   t a r g e t . e n d s W i t h ( " ' " ) )   t a r g e t   =   t a r g e t . s l i c e ( 1 ,   - 1 ) ; 
 
 + 
 
 +             c o n s t   r e s o l v e d   =   p a t h . r e s o l v e ( t h i s . _ c w d ,   t a r g e t ) ; 
 
 +             t r y   { 
 
 +                 c o n s t   s t a t   =   f s . s t a t S y n c ( r e s o l v e d ) ; 
 
 +                 i f   ( s t a t . i s D i r e c t o r y ( ) )   { 
 
 +                     t h i s . _ c w d   =   r e s o l v e d ; 
 
 +                     t h i s . _ p r o m p t I n f o   =   t h i s . _ b u i l d P r o m p t I n f o ( ) ; 
 
 +                     t h i s . _ p o s t ( {   t y p e :   ' s e t P r o m p t ' ,   . . . t h i s . _ p r o m p t I n f o   } ) ; 
 
 + 
 
 +                     / /   S y n c   w i t h   t h e   a c t u a l   V S   C o d e   i n t e g r a t e d   t e r m i n a l 
 
 +                     c o n s t   a c t i v e T e r m i n a l   =   v s c o d e . w i n d o w . a c t i v e T e r m i n a l ; 
 
 +                     i f   ( a c t i v e T e r m i n a l )   { 
 
 +                         a c t i v e T e r m i n a l . s e n d T e x t ( ` c d   " $ { t h i s . _ c w d } " ` ) ; 
 
 +                     } 
 
 +                 }   e l s e   { 
 
 +                     t h i s . _ p o s t ( {   t y p e :   ' s t d e r r ' ,   t e x t :   ` c d :   $ { t a r g e t } :   N o t   a   d i r e c t o r y \ n `   } ) ; 
 
 +                 } 
 
 +             }   c a t c h   ( e r r )   { 
 
 +                 t h i s . _ p o s t ( {   t y p e :   ' s t d e r r ' ,   t e x t :   ` c d :   $ { t a r g e t } :   N o   s u c h   f i l e   o r   d i r e c t o r y \ n `   } ) ; 
 
 +             } 
 
 +             
 
 +             t h i s . _ p o s t ( {   t y p e :   ' c o m m a n d E n d ' ,   e x i t C o d e :   n u l l   } ) ; 
 
 +             r e t u r n ; 
 
 +         } 
 
 + 
 
 +         / /   H a n d l e   v e n v   a c t i v a t i o n   n a t i v e l y 
 
 +         c o n s t   p a r t s   =   c o m m a n d . t r i m ( ) . s p l i t ( / \ s + / ) ; 
 
 +         l e t   m a y b e A c t i v a t e   =   ( p a r t s [ 0 ]   = = =   ' s o u r c e '   | |   p a r t s [ 0 ]   = = =   ' . ' )   ?   p a r t s [ 1 ]   :   p a r t s [ 0 ] ; 
 
 +         
 
 +         i f   ( m a y b e A c t i v a t e )   { 
 
 +             i f   ( m a y b e A c t i v a t e . t o L o w e r C a s e ( )   = = =   ' d e a c t i v a t e ' )   { 
 
 +                 t h i s . _ v e n v D i r   =   n u l l ; 
 
 +                 t h i s . _ v e n v S c r i p t s   =   n u l l ; 
 
 +                 t h i s . _ p r o m p t I n f o   =   t h i s . _ b u i l d P r o m p t I n f o ( ) ; 
 
 +                 t h i s . _ p o s t ( {   t y p e :   ' s e t P r o m p t ' ,   . . . t h i s . _ p r o m p t I n f o   } ) ; 
 
 +                 t h i s . _ p o s t ( {   t y p e :   ' s t d o u t ' ,   t e x t :   ` V i r t u a l   e n v i r o n m e n t   d e a c t i v a t e d . \ n `   } ) ; 
 
 +                 t h i s . _ p o s t ( {   t y p e :   ' c o m m a n d E n d ' ,   e x i t C o d e :   n u l l   } ) ; 
 
 +                 r e t u r n ; 
 
 +             } 
 
 +             
 
 +             i f   ( m a y b e A c t i v a t e . t o L o w e r C a s e ( ) . i n c l u d e s ( ' a c t i v a t e ' ) )   { 
 
 +                 c o n s t   f s   =   r e q u i r e ( ' f s ' ) ; 
 
 +                 l e t   r e s o l v e d   =   p a t h . r e s o l v e ( t h i s . _ c w d ,   m a y b e A c t i v a t e ) ; 
 
 +                 t r y   { 
 
 +                     i f   ( f s . e x i s t s S y n c ( r e s o l v e d )   & &   f s . s t a t S y n c ( r e s o l v e d ) . i s F i l e ( ) )   { 
 
 +                         c o n s t   s c r i p t s D i r   =   p a t h . d i r n a m e ( r e s o l v e d ) ; 
 
 +                         c o n s t   v e n v D i r   =   p a t h . d i r n a m e ( s c r i p t s D i r ) ; 
 
 +                         t h i s . _ v e n v D i r   =   v e n v D i r ; 
 
 +                         t h i s . _ v e n v S c r i p t s   =   s c r i p t s D i r ; 
 
 +                         
 
 +                         t h i s . _ p r o m p t I n f o   =   t h i s . _ b u i l d P r o m p t I n f o ( ) ; 
 
 +                         t h i s . _ p o s t ( {   t y p e :   ' s e t P r o m p t ' ,   . . . t h i s . _ p r o m p t I n f o   } ) ; 
 
 +                         t h i s . _ p o s t ( {   t y p e :   ' s t d o u t ' ,   t e x t :   ` V i r t u a l   e n v i r o n m e n t   a c t i v a t e d :   $ { v e n v D i r } \ n `   } ) ; 
 
 +                         t h i s . _ p o s t ( {   t y p e :   ' c o m m a n d E n d ' ,   e x i t C o d e :   n u l l   } ) ; 
 
 +                         r e t u r n ; 
 
 +                     } 
 
 +                 }   c a t c h ( e )   { } 
 
 +             } 
 
 +         } 
 
 + 
 
 +         / /   S e t   u p   e n v i r o n m e n t   f o r   s p a w n 
 
 +         c o n s t   e n v   =   O b j e c t . a s s i g n ( { } ,   p r o c e s s . e n v ) ; 
 
 +         i f   ( t h i s . _ v e n v D i r )   { 
 
 +                 e n v . V I R T U A L _ E N V   =   t h i s . _ v e n v D i r ; 
 
 +                 / /   F i n d   e x i s t i n g   P a t h / P A T H   k e y   ( W i n d o w s   i s   c a s e - i n s e n s i t i v e   b u t   p r o c e s s . e n v   p r e s e r v e s   c a s e ) 
 
 +                 c o n s t   p a t h K e y   =   O b j e c t . k e y s ( e n v ) . f i n d ( k   = >   k . t o L o w e r C a s e ( )   = = =   ' p a t h ' )   | |   ' P A T H ' ; 
 
 +                 e n v [ p a t h K e y ]   =   ` $ { t h i s . _ v e n v S c r i p t s } $ { p a t h . d e l i m i t e r } $ { e n v [ p a t h K e y ]   | |   ' ' } ` ; 
 
 +         } 
 
 + 
 
 +         t h i s . _ c h i l d   =   s p a w n ( c o m m a n d ,   [ ] ,   { 
 
 +             c w d :   t h i s . _ c w d , 
 
 +             s h e l l :   i s W i n   ?   ' p o w e r s h e l l . e x e '   :   t r u e , 
 
 +             e n v :   e n v , 
 
 +             s t d i o :   [ ' i g n o r e ' ,   ' p i p e ' ,   ' p i p e ' ] 
 
 +         } ) ; 
 
 + 
 
 +         c o n s t   c p   =   t h i s . _ c h i l d ; 
 
 + 
 
 +         c p . s t d o u t . o n ( ' d a t a ' ,   d a t a   = >   { 
 
 +             c o n s t   t e x t   =   d a t a . t o S t r i n g ( ) ; 
 
 +             s t d o u t T a i l   =   ( s t d o u t T a i l   +   t e x t ) . s l i c e ( - 5 0 0 ) ; 
 
 +             t h i s . _ p o s t ( {   t y p e :   ' s t d o u t ' ,   t e x t   } ) ; 
 
 +         } ) ; 
 
 + 
 
 +         c p . s t d e r r . o n ( ' d a t a ' ,   d a t a   = >   { 
 
 +             c o n s t   t e x t   =   d a t a . t o S t r i n g ( ) ; 
 
 +             s t d e r r B u f f e r   + =   t e x t ; 
 
 +             t h i s . _ p o s t ( {   t y p e :   ' s t d e r r ' ,   t e x t   } ) ; 
 
 + 
 
 +             / /   D e b o u n c e   l o g i c   t o   a n a l y z e   a c t i v e   t r a c e b a c k s   w h i l e   t h e   p r o c e s s   i s   s t i l l   r u n n i n g   ( e . g . ,   r u n s e r v e r ) 
 
 +             i f   ( t h i s . _ s t d e r r T i m e o u t )   c l e a r T i m e o u t ( t h i s . _ s t d e r r T i m e o u t ) ; 
 
 +             t h i s . _ s t d e r r T i m e o u t   =   s e t T i m e o u t ( ( )   = >   { 
 
 +                 c o n s t   l i n e s   =   s t d e r r B u f f e r . s p l i t ( ' \ n ' ) . f i l t e r ( l   = >   l . t r i m ( ) . l e n g t h   >   0 ) ; 
 
 +                 i f   ( l i n e s . l e n g t h   >   4 )   { 
 
 +                     t h i s . _ a n a l y z e E r r o r s ( c o m m a n d ,   s t d o u t T a i l ,   s t d e r r B u f f e r ) ; 
 
 +                     s t d e r r B u f f e r   =   ' ' ;   / /   C l e a r   t o   p r e v e n t   d o u b l e   t r i g g e r i n g   o n   s a m e   e r r o r   b l o c k 
 
 +                 } 
 
 +             } ,   8 0 0 ) ; 
 
 +         } ) ; 
 
 + 
 
 +         c p . o n ( ' c l o s e ' ,   e x i t C o d e   = >   { 
 
 +             i f   ( t h i s . _ c h i l d   ! = =   c p )   r e t u r n ; 
 
 +             t h i s . _ p o s t ( {   t y p e :   ' c o m m a n d E n d ' ,   e x i t C o d e   } ) ; 
 
 +             t h i s . _ c h i l d   =   n u l l ; 
 
 + 
 
 +             i f   ( t h i s . _ s t d e r r T i m e o u t )   c l e a r T i m e o u t ( t h i s . _ s t d e r r T i m e o u t ) ; 
 
 + 
 
 +             i f   ( s t d e r r B u f f e r . t r i m ( ) . l e n g t h   >   0 )   { 
 
 +                 c o n s t   l i n e s   =   s t d e r r B u f f e r . s p l i t ( ' \ n ' ) . f i l t e r ( l   = >   l . t r i m ( ) . l e n g t h   >   0 ) ; 
 
 +                 i f   ( l i n e s . l e n g t h   >   4 )   { 
 
 +                     t h i s . _ a n a l y z e E r r o r s ( c o m m a n d ,   s t d o u t T a i l ,   s t d e r r B u f f e r ) ; 
 
 +                 } 
 
 +             } 
 
 +         } ) ; 
 
 + 
 
 +         c p . o n ( ' e r r o r ' ,   e r r   = >   { 
 
 +             i f   ( t h i s . _ c h i l d   ! = =   c p )   r e t u r n ; 
 
 +             c o n s t   t e x t   =   ` [ E r r o r ]   $ { e r r . m e s s a g e } \ n ` ; 
 
 +             s t d e r r B u f f e r   + =   t e x t ; 
 
 +             t h i s . _ p o s t ( {   t y p e :   ' s t d e r r ' ,   t e x t   } ) ; 
 
 +             t h i s . _ p o s t ( {   t y p e :   ' c o m m a n d E n d ' ,   e x i t C o d e :   - 1   } ) ; 
 
 +             t h i s . _ c h i l d   =   n u l l ; 
 
 +             
 
 +             i f   ( t h i s . _ s t d e r r T i m e o u t )   c l e a r T i m e o u t ( t h i s . _ s t d e r r T i m e o u t ) ; 
 
 + 
 
 +             c o n s t   l i n e s   =   s t d e r r B u f f e r . s p l i t ( ' \ n ' ) . f i l t e r ( l   = >   l . t r i m ( ) . l e n g t h   >   0 ) ; 
 
 +             i f   ( l i n e s . l e n g t h   >   4 )   { 
 
 +                 t h i s . _ a n a l y z e E r r o r s ( c o m m a n d ,   s t d o u t T a i l ,   s t d e r r B u f f e r ) ; 
 
 +             } 
 
 +         } ) ; 
 
 +     } 
 
 + 
 
 +     / /           K i l l   t h e   r u n n i n g   p r o c e s s                                                                                               
 
 +     _ k i l l C u r r e n t P r o c e s s ( )   { 
 
 +         i f   ( t h i s . _ c h i l d )   { 
 
 +             i f   ( t h i s . _ s t d e r r T i m e o u t )   c l e a r T i m e o u t ( t h i s . _ s t d e r r T i m e o u t ) ; 
 
 +             t r y   { 
 
 +                 c o n s t   i s W i n   =   r e q u i r e ( ' o s ' ) . p l a t f o r m ( )   = = =   ' w i n 3 2 ' ; 
 
 +                 i f   ( i s W i n )   { 
 
 +                     / /   F o r c e   k i l l   p r o c e s s   t r e e   o n   W i n d o w s   s o   D j a n g o   r u n s e r v e r   d i e s   p r o p e r l y 
 
 +                     r e q u i r e ( ' c h i l d _ p r o c e s s ' ) . s p a w n ( ' t a s k k i l l ' ,   [ ' / p i d ' ,   t h i s . _ c h i l d . p i d ,   ' / f ' ,   ' / t ' ] ) ; 
 
 +                 }   e l s e   { 
 
 +                     t h i s . _ c h i l d . k i l l ( ' S I G K I L L ' ) ; 
 
 +                 } 
 
 +             }   c a t c h   ( e )   { } 
 
 + 
 
 +             t h i s . _ c h i l d   =   n u l l ; 
 
 +             t h i s . _ p o s t ( {   t y p e :   ' s t d e r r ' ,   t e x t :   ' \ n [ P r o c e s s   k i l l e d ] \ n '   } ) ; 
 
 +             t h i s . _ p o s t ( {   t y p e :   ' c o m m a n d E n d ' ,   e x i t C o d e :   n u l l   } ) ;   / /   F o r c e   u n f r e e z e   U I 
 
 +         } 
 
 +     } 
 
 + 
 
 +     / /           H a n d l e   T a b   C o m p l e t i o n                                                                                                     
 
 +     a s y n c   _ h a n d l e C o m p l e t i o n ( i n p u t S t r ,   c u r s o r )   { 
 
 +         c o n s t   f s   =   r e q u i r e ( ' f s ' ) ; 
 
 +         
 
 +         l e t   s t a r t   =   c u r s o r ; 
 
 +         w h i l e   ( s t a r t   >   0   & &   i n p u t S t r [ s t a r t   -   1 ]   ! = =   '   ' )   { 
 
 +             s t a r t - - ; 
 
 +         } 
 
 +         l e t   w o r d   =   i n p u t S t r . s u b s t r i n g ( s t a r t ,   c u r s o r ) ; 
 
 + 
 
 +         l e t   h a s Q u o t e   =   f a l s e ; 
 
 +         i f   ( w o r d . s t a r t s W i t h ( ' " ' )   | |   w o r d . s t a r t s W i t h ( " ' " ) )   { 
 
 +             h a s Q u o t e   =   w o r d [ 0 ] ; 
 
 +             w o r d   =   w o r d . s u b s t r i n g ( 1 ) ; 
 
 +         } 
 
 +         i f   ( ! w o r d )   w o r d   =   ' ' ; 
 
 + 
 
 +         l e t   d i r T o S e a r c h   =   t h i s . _ c w d ; 
 
 +         l e t   f i l e P r e f i x   =   w o r d ; 
 
 + 
 
 +         c o n s t   l a s t S l a s h   =   M a t h . m a x ( w o r d . l a s t I n d e x O f ( ' / ' ) ,   w o r d . l a s t I n d e x O f ( ' \ \ ' ) ) ; 
 
 +         i f   ( l a s t S l a s h   > =   0 )   { 
 
 +             c o n s t   r e l D i r   =   w o r d . s u b s t r i n g ( 0 ,   l a s t S l a s h ) ; 
 
 +             f i l e P r e f i x   =   w o r d . s u b s t r i n g ( l a s t S l a s h   +   1 ) ; 
 
 +             d i r T o S e a r c h   =   p a t h . r e s o l v e ( t h i s . _ c w d ,   r e l D i r ) ; 
 
 +         } 
 
 + 
 
 +         t r y   { 
 
 +             c o n s t   f i l e s   =   a w a i t   f s . p r o m i s e s . r e a d d i r ( d i r T o S e a r c h ) ; 
 
 +             c o n s t   m a t c h e s   =   f i l e s . f i l t e r ( f   = >   f . t o L o w e r C a s e ( ) . s t a r t s W i t h ( f i l e P r e f i x . t o L o w e r C a s e ( ) ) ) ; 
 
 +             
 
 +             i f   ( m a t c h e s . l e n g t h   = = =   1 )   { 
 
 +                 l e t   m a t c h   =   m a t c h e s [ 0 ] ; 
 
 +                 l e t   i s D i r   =   f a l s e ; 
 
 +                 t r y   { 
 
 +                     i s D i r   =   f s . s t a t S y n c ( p a t h . j o i n ( d i r T o S e a r c h ,   m a t c h ) ) . i s D i r e c t o r y ( ) ; 
 
 +                     i f   ( i s D i r )   m a t c h   + =   p a t h . s e p ; 
 
 +                 }   c a t c h   ( e )   { } 
 
 +                 
 
 +                 l e t   c o m p l e t i o n   =   m a t c h . s u b s t r i n g ( f i l e P r e f i x . l e n g t h ) ; 
 
 +                 i f   ( ! i s D i r   & &   h a s Q u o t e )   c o m p l e t i o n   + =   h a s Q u o t e ; 
 
 +                 i f   ( ! i s D i r )   c o m p l e t i o n   + =   '   ' ; 
 
 + 
 
 +                 t h i s . _ p o s t ( {   t y p e :   ' c o m p l e t i o n R e s u l t ' ,   c o m p l e t i o n   } ) ; 
 
 +             }   e l s e   i f   ( m a t c h e s . l e n g t h   >   1 )   { 
 
 +                 c o n s t   c o m m o n P r e f i x   =   t h i s . _ g e t C o m m o n P r e f i x ( m a t c h e s ) ; 
 
 +                 i f   ( c o m m o n P r e f i x . l e n g t h   >   f i l e P r e f i x . l e n g t h )   { 
 
 +                     c o n s t   c o m p l e t i o n   =   c o m m o n P r e f i x . s u b s t r i n g ( f i l e P r e f i x . l e n g t h ) ; 
 
 +                     t h i s . _ p o s t ( {   t y p e :   ' c o m p l e t i o n R e s u l t ' ,   c o m p l e t i o n   } ) ; 
 
 +                 }   e l s e   { 
 
 +                     t h i s . _ p o s t ( {   t y p e :   ' c o m p l e t i o n M a t c h e s ' ,   m a t c h e s   } ) ; 
 
 +                 } 
 
 +             } 
 
 +         }   c a t c h   ( e r r )   { 
 
 +             / /   I g n o r e 
 
 +         } 
 
 +     } 
 
 + 
 
 +     _ g e t C o m m o n P r e f i x ( w o r d s )   { 
 
 +         i f   ( ! w o r d s   | |   w o r d s . l e n g t h   = = =   0 )   r e t u r n   ' ' ; 
 
 +         l e t   p r e f i x   =   w o r d s [ 0 ] ; 
 
 +         f o r   ( l e t   i   =   1 ;   i   <   w o r d s . l e n g t h ;   i + + )   { 
 
 +             l e t   j   =   0 ; 
 
 +             w h i l e   ( j   <   p r e f i x . l e n g t h   & &   j   <   w o r d s [ i ] . l e n g t h   & &   p r e f i x [ j ] . t o L o w e r C a s e ( )   = = =   w o r d s [ i ] [ j ] . t o L o w e r C a s e ( ) )   { 
 
 +                 j + + ; 
 
 +             } 
 
 +             p r e f i x   =   p r e f i x . s u b s t r i n g ( 0 ,   j ) ; 
 
 +         } 
 
 +         r e t u r n   p r e f i x ; 
 
 +     } 
 
 + 
 
 +     / /           S e n d   e r r o r   t o   A I   a n d   d i s p l a y   c h e c k l i s t                                                                   
 
 +     a s y n c   _ a n a l y z e E r r o r s ( c o m m a n d ,   s t d o u t C o n t e x t ,   s t d e r r C o n t e n t )   { 
 
 +         t h i s . _ p o s t ( {   t y p e :   ' a n a l y z i n g '   } ) ; 
 
 + 
 
 +         c o n s t   s e t t i n g s   =   t h i s . _ l o a d S e t t i n g s ( ) ; 
 
 + 
 
 +         i f   ( ! s e t t i n g s . a p i K e y )   { 
 
 +             t h i s . _ p o s t ( { 
 
 +                 t y p e :   ' a n a l y s i s E r r o r ' , 
 
 +                 m e s s a g e :   ' N o   A P I   k e y   s e t .   T y p e   " s e t t i n g s "   t o   c o n f i g u r e . ' 
 
 +             } ) ; 
 
 +             r e t u r n ; 
 
 +         } 
 
 + 
 
 +         t r y   { 
 
 +             c o n s t   e r r o r s   =   a w a i t   c a l l A I ( { 
 
 +                 c o m m a n d , 
 
 +                 s t d o u t C o n t e x t , 
 
 +                 s t d e r r C o n t e n t , 
 
 +                 a p i K e y :   s e t t i n g s . a p i K e y , 
 
 +                 m o d e l :     ' g e m i n i - 2 . 5 - f l a s h - l i t e ' 
 
 +             } ) ; 
 
 + 
 
 +             t h i s . _ p o s t ( {   t y p e :   ' s h o w E r r o r s ' ,   e r r o r s   } ) ; 
 
 + 
 
 +         }   c a t c h   ( e r r )   { 
 
 +             t h i s . _ p o s t ( { 
 
 +                 t y p e :   ' a n a l y s i s E r r o r ' , 
 
 +                 m e s s a g e :   ` A I   c a l l   f a i l e d :   $ { e r r . m e s s a g e } ` 
 
 +             } ) ; 
 
 +         } 
 
 +     } 
 
 + 
 
 +     / /           C l i c k - t o - j u m p :   o p e n   f i l e   a n d   h i g h l i g h t   l i n e                                                         
 
 +     a s y n c   _ j u m p T o F i l e ( f i l e P a t h ,   l i n e N u m b e r )   { 
 
 +         t r y   { 
 
 +             l e t   r e s o l v e d P a t h   =   f i l e P a t h ; 
 
 +             i f   ( ! p a t h . i s A b s o l u t e ( f i l e P a t h ) )   { 
 
 +                 c o n s t   r o o t   =   v s c o d e . w o r k s p a c e . w o r k s p a c e F o l d e r s ? . [ 0 ] ? . u r i ? . f s P a t h ; 
 
 +                 i f   ( r o o t )   r e s o l v e d P a t h   =   p a t h . j o i n ( r o o t ,   f i l e P a t h ) ; 
 
 +             } 
 
 + 
 
 +             c o n s t   u r i   =   v s c o d e . U r i . f i l e ( r e s o l v e d P a t h ) ; 
 
 +             c o n s t   d o c   =   a w a i t   v s c o d e . w o r k s p a c e . o p e n T e x t D o c u m e n t ( u r i ) ; 
 
 + 
 
 +             c o n s t   e d i t o r   =   a w a i t   v s c o d e . w i n d o w . s h o w T e x t D o c u m e n t ( d o c ,   { 
 
 +                 p r e s e r v e F o c u s :   f a l s e , 
 
 +                 v i e w C o l u m n :   v s c o d e . V i e w C o l u m n . O n e 
 
 +             } ) ; 
 
 + 
 
 +             c o n s t   l i n e   =   M a t h . m a x ( 0 ,   l i n e N u m b e r   -   1 ) ; 
 
 +             c o n s t   r a n g e   =   n e w   v s c o d e . R a n g e ( l i n e ,   0 ,   l i n e ,   9 9 9 9 ) ; 
 
 +             e d i t o r . r e v e a l R a n g e ( r a n g e ,   v s c o d e . T e x t E d i t o r R e v e a l T y p e . I n C e n t e r ) ; 
 
 + 
 
 +             c o n s t   d e c o r a t i o n   =   v s c o d e . w i n d o w . c r e a t e T e x t E d i t o r D e c o r a t i o n T y p e ( { 
 
 +                 b a c k g r o u n d C o l o r :   n e w   v s c o d e . T h e m e C o l o r ( ' d i f f E d i t o r . r e m o v e d L i n e B a c k g r o u n d ' ) , 
 
 +                 i s W h o l e L i n e :   t r u e , 
 
 +                 b o r d e r W i d t h :   ' 0   0   0   3 p x ' , 
 
 +                 b o r d e r S t y l e :   ' s o l i d ' , 
 
 +                 b o r d e r C o l o r :   n e w   v s c o d e . T h e m e C o l o r ( ' e r r o r F o r e g r o u n d ' ) 
 
 +             } ) ; 
 
 + 
 
 +             e d i t o r . s e t D e c o r a t i o n s ( d e c o r a t i o n ,   [ r a n g e ] ) ; 
 
 +             s e t T i m e o u t ( ( )   = >   d e c o r a t i o n . d i s p o s e ( ) ,   5 0 0 0 ) ; 
 
 + 
 
 +         }   c a t c h   ( e r r )   { 
 
 +             v s c o d e . w i n d o w . s h o w E r r o r M e s s a g e ( 
 
 +                 ` A I   E r r o r   C h e c k l i s t :   C o u l d   n o t   o p e n   f i l e   " $ { f i l e P a t h } " :   $ { e r r . m e s s a g e } ` 
 
 +             ) ; 
 
 +         } 
 
 +     } 
 
 + 
 
 +     / /           S e t t i n g s   h e l p e r s                                                                                                               
 
 +     _ s a v e S e t t i n g s ( a p i K e y )   { 
 
 +         t h i s . _ c o n t e x t . g l o b a l S t a t e . u p d a t e ( ' a i e c . a p i K e y ' ,   a p i K e y ) ; 
 
 +         t h i s . _ p o s t ( {   t y p e :   ' s e t t i n g s S a v e d '   } ) ; 
 
 +     } 
 
 + 
 
 +     _ l o a d S e t t i n g s ( )   { 
 
 +         r e t u r n   { 
 
 +             a p i K e y :   t h i s . _ c o n t e x t . g l o b a l S t a t e . g e t ( ' a i e c . a p i K e y ' ,   ' ' ) 
 
 +         } ; 
 
 +     } 
 
 + 
 
 +     _ s e n d S e t t i n g s T o W e b v i e w ( )   { 
 
 +         c o n s t   s   =   t h i s . _ l o a d S e t t i n g s ( ) ; 
 
 +         t h i s . _ p o s t ( { 
 
 +             t y p e :         ' l o a d S e t t i n g s ' , 
 
 +             h a s K e y :     ! ! s . a p i K e y 
 
 +         } ) ; 
 
 +     } 
 
 + 
 
 +     / /           H e l p e r :   p o s t   a   m e s s a g e   t o   t h e   w e b v i e w                                                                     
 
 +     _ p o s t ( m e s s a g e )   { 
 
 +         t h i s . _ v i e w ? . w e b v i e w . p o s t M e s s a g e ( m e s s a g e ) ; 
 
 +     } 
 
 + 
 
 +     / /           B u i l d   t h e   f u l l   W e b v i e w   H T M L                                                                                         
 
 +     _ b u i l d H t m l ( w e b v i e w )   { 
 
 +     r e t u r n   ` < ! D O C T Y P E   h t m l > 
 
 + < h t m l   l a n g = " e n " > 
 
 + < h e a d > 
 
 + < m e t a   c h a r s e t = " U T F - 8 " > 
 
 + < m e t a   h t t p - e q u i v = " C o n t e n t - S e c u r i t y - P o l i c y " 
 
 +     c o n t e n t = " d e f a u l t - s r c   ' n o n e ' ;   s t y l e - s r c   ' u n s a f e - i n l i n e ' ;   s c r i p t - s r c   ' u n s a f e - i n l i n e ' ; " > 
 
 + < s t y l e > 
 
 +     / *         F u l l   r e s e t       w e   A R E   t h e   t e r m i n a l         * / 
 
 +     * ,   * : : b e f o r e ,   * : : a f t e r   {   b o x - s i z i n g :   b o r d e r - b o x ;   m a r g i n :   0 ;   p a d d i n g :   0 ;   } 
 
 + 
 
 +     h t m l ,   b o d y   { 
 
 +         w i d t h :   1 0 0 % ;   h e i g h t :   1 0 0 v h ; 
 
 +         o v e r f l o w :   h i d d e n ; 
 
 +         b a c k g r o u n d :   v a r ( - - v s c o d e - t e r m i n a l - b a c k g r o u n d ,   v a r ( - - v s c o d e - p a n e l - b a c k g r o u n d ,   # 1 e 1 e 1 e ) ) ; 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - f o r e g r o u n d ,   # c c c c c c ) ; 
 
 +         f o n t - f a m i l y :   v a r ( - - v s c o d e - e d i t o r - f o n t - f a m i l y , 
 
 +                                     ' C a s c a d i a   C o d e ' ,   ' C a s c a d i a   M o n o ' ,   C o n s o l a s , 
 
 +                                     ' C o u r i e r   N e w ' ,   m o n o s p a c e ) ; 
 
 +         f o n t - s i z e :   v a r ( - - v s c o d e - e d i t o r - f o n t - s i z e ,   1 3 p x ) ; 
 
 +         l i n e - h e i g h t :   1 . 4 5 ; 
 
 +         / *   C u r s o r   a l w a y s   t e x t - s t y l e   w h e n   h o v e r i n g   t h i s   " t e r m i n a l "   * / 
 
 +         c u r s o r :   t e x t ; 
 
 +     } 
 
 + 
 
 +     / *         T h e   h i d d e n   i n p u t   t h a t   c a p t u r e s   A L L   k e y s t r o k e s         * / 
 
 +     / *   I t ' s   r e a l   b u t   i n v i s i b l e       p o s i t i o n e d   o u t s i d e   v i e w p o r t   * / 
 
 +     # c a p t u r e   { 
 
 +         p o s i t i o n :   f i x e d ; 
 
 +         t o p :   - 9 9 9 9 p x ;   l e f t :   - 9 9 9 9 p x ; 
 
 +         w i d t h :   1 p x ;   h e i g h t :   1 p x ; 
 
 +         o p a c i t y :   0 ; 
 
 +         p o i n t e r - e v e n t s :   n o n e ; 
 
 +         / *   M u s t   N O T   b e   d i s p l a y : n o n e       h i d d e n   i n p u t s   d o n ' t   r e c e i v e   f o c u s   * / 
 
 +     } 
 
 + 
 
 +     / *         S i n g l e   s c r o l l a b l e   o u t p u t   a r e a       t h e   w h o l e   t e r m i n a l         * / 
 
 +     # o u t p u t   { 
 
 +         h e i g h t :   1 0 0 v h ; 
 
 +         o v e r f l o w - y :   a u t o ; 
 
 +         o v e r f l o w - x :   h i d d e n ; 
 
 +         p a d d i n g :   4 p x   1 0 p x   4 p x   1 0 p x ; 
 
 +         / *   T h i n   s c r o l l b a r   m a t c h i n g   V S   C o d e   t e r m i n a l   * / 
 
 +         s c r o l l b a r - w i d t h :   t h i n ; 
 
 +         s c r o l l b a r - c o l o r :   v a r ( - - v s c o d e - s c r o l l b a r S l i d e r - b a c k g r o u n d ,   # 4 2 4 2 4 2 )   t r a n s p a r e n t ; 
 
 +     } 
 
 +     # o u t p u t : : - w e b k i t - s c r o l l b a r   {   w i d t h :   6 p x ;   } 
 
 +     # o u t p u t : : - w e b k i t - s c r o l l b a r - t r a c k   {   b a c k g r o u n d :   t r a n s p a r e n t ;   } 
 
 +     # o u t p u t : : - w e b k i t - s c r o l l b a r - t h u m b   { 
 
 +         b a c k g r o u n d :   v a r ( - - v s c o d e - s c r o l l b a r S l i d e r - b a c k g r o u n d ,   # 4 2 4 2 4 2 ) ; 
 
 +         b o r d e r - r a d i u s :   3 p x ; 
 
 +     } 
 
 + 
 
 +     / *         E v e r y   o u t p u t   l i n e         * / 
 
 +     . l i n e   { 
 
 +         d i s p l a y :   b l o c k ; 
 
 +         w h i t e - s p a c e :   p r e - w r a p ; 
 
 +         w o r d - b r e a k :   b r e a k - a l l ; 
 
 +         m i n - h e i g h t :   1 . 4 5 e m ; 
 
 +     } 
 
 +     . s t d o u t   {   c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - f o r e g r o u n d ,   # c c c c c c ) ;   } 
 
 +     . s t d e r r   {   c o l o r :   v a r ( - - v s c o d e - t e r m i n a l C o m m a n d D e c o r a t i o n - e r r o r B a c k g r o u n d ,   # f 4 8 7 7 1 ) ;   } 
 
 +     . s y s t e m   { 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i C y a n ,   # 4 e c 9 b 0 ) ; 
 
 +         o p a c i t y :   0 . 7 5 ; 
 
 +     } 
 
 +     / *   T h e   e c h o e d   " $   c o m m a n d "   l i n e   a f t e r   p r e s s i n g   E n t e r   * / 
 
 +     . c m d - e c h o   { 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - f o r e g r o u n d ,   # c c c c c c ) ; 
 
 +     } 
 
 +     . e x i t - o k     {   c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i G r e e n ,     # 8 9 d 1 8 5 ) ;   o p a c i t y :   0 . 6 ;   } 
 
 +     . e x i t - e r r   {   c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i R e d ,         # f 4 8 7 7 1 ) ;   o p a c i t y :   0 . 6 ;   } 
 
 + 
 
 +     / *         T h e   l i v e   p r o m p t   l i n e   ( a l w a y s   a t   t h e   b o t t o m   o f   # o u t p u t )         * / 
 
 +     # p r o m p t - l i n e   { 
 
 +         d i s p l a y :   f l e x ; 
 
 +         a l i g n - i t e m s :   b a s e l i n e ; 
 
 +         m i n - h e i g h t :   1 . 4 5 e m ; 
 
 +         f l e x - w r a p :   n o w r a p ; 
 
 +         / *   T h i s   l i n e   i s   i n t e r a c t i v e       d o n ' t   l e t   i t   g e t   c u t   o f f   * / 
 
 +         p a d d i n g - b o t t o m :   4 p x ; 
 
 +     } 
 
 + 
 
 +     / *   u s e r @ h o s t : p a t h $       t h e   c o l o u r e d   p r e f i x   * / 
 
 +     # p r o m p t - p r e f i x   { 
 
 +         w h i t e - s p a c e :   p r e ; 
 
 +         f l e x - s h r i n k :   0 ; 
 
 +         u s e r - s e l e c t :   n o n e ; 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i G r e e n ,   # 8 9 d 1 8 5 ) ; 
 
 +         f o n t - w e i g h t :   b o l d ; 
 
 +     } 
 
 + 
 
 +     / *   T h e   t y p e d   t e x t   r e n d e r e d   i n l i n e   * / 
 
 +     # t y p e d - t e x t   { 
 
 +         w h i t e - s p a c e :   p r e ; 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - f o r e g r o u n d ,   # c c c c c c ) ; 
 
 +     } 
 
 + 
 
 +     / *   B l i n k i n g   b l o c k   c u r s o r       V S   C o d e   t e r m i n a l   s t y l e   * / 
 
 +     # c u r s o r   { 
 
 +         d i s p l a y :   i n l i n e - b l o c k ; 
 
 +         w i d t h :   0 . 6 c h ; 
 
 +         h e i g h t :   1 e m ; 
 
 +         b a c k g r o u n d :   v a r ( - - v s c o d e - t e r m i n a l C u r s o r - f o r e g r o u n d , 
 
 +                                         v a r ( - - v s c o d e - t e r m i n a l - f o r e g r o u n d ,   # a e a f a d ) ) ; 
 
 +         v e r t i c a l - a l i g n :   t e x t - b o t t o m ; 
 
 +         / *   B l i n k   j u s t   l i k e   a   r e a l   t e r m i n a l   c u r s o r   * / 
 
 +         a n i m a t i o n :   b l i n k - c u r s o r   1 s   s t e p - e n d   i n f i n i t e ; 
 
 +     } 
 
 +     / *   C u r s o r   g o e s   s o l i d   w h e n   p r o c e s s   i s   r u n n i n g   ( i n p u t   d i s a b l e d )   * / 
 
 +     # c u r s o r . b u s y   { 
 
 +         a n i m a t i o n :   n o n e ; 
 
 +         o p a c i t y :   0 . 4 ; 
 
 +     } 
 
 +     / *   C u r s o r   h i d d e n   i n   s e t t i n g s   m o d e   * / 
 
 +     # c u r s o r . h i d d e n   {   d i s p l a y :   n o n e ;   } 
 
 + 
 
 +     @ k e y f r a m e s   b l i n k - c u r s o r   { 
 
 +         0 % ,   1 0 0 %   {   o p a c i t y :   1 ;   } 
 
 +         5 0 %               {   o p a c i t y :   0 ;   } 
 
 +     } 
 
 + 
 
 +     / *         A I   e r r o r   c h e c k l i s t   b l o c k         * / 
 
 +     . c h e c k l i s t - b l o c k   { 
 
 +         m a r g i n :   4 p x   0 ; 
 
 +         b o r d e r - l e f t :   2 p x   s o l i d   v a r ( - - v s c o d e - t e r m i n a l - a n s i Y e l l o w ,   # d c d c a a ) ; 
 
 +         p a d d i n g - l e f t :   1 0 p x ; 
 
 +     } 
 
 +     . c h e c k l i s t - t i t l e   { 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i Y e l l o w ,   # d c d c a a ) ; 
 
 +         f o n t - w e i g h t :   b o l d ; 
 
 +         m a r g i n - b o t t o m :   2 p x ; 
 
 +         f o n t - s i z e :   0 . 9 2 e m ; 
 
 +     } 
 
 +     . e r r o r - i t e m   { 
 
 +         d i s p l a y :   f l e x ; 
 
 +         a l i g n - i t e m s :   b a s e l i n e ; 
 
 +         g a p :   8 p x ; 
 
 +         p a d d i n g :   1 p x   0 ; 
 
 +         c u r s o r :   p o i n t e r ; 
 
 +         b o r d e r - r a d i u s :   2 p x ; 
 
 +     } 
 
 +     . e r r o r - i t e m : h o v e r   {   b a c k g r o u n d :   r g b a ( 2 5 5 , 2 5 5 , 2 5 5 , 0 . 0 6 ) ;   } 
 
 +     . e r r o r - b u l l e t   {   c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i R e d ,   # f 4 8 7 7 1 ) ;   f l e x - s h r i n k :   0 ;   u s e r - s e l e c t :   n o n e ;   } 
 
 +     . e r r o r - s u m m a r y   {   c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - f o r e g r o u n d ,   # c c c c c c ) ;   f l e x :   1 ;   } 
 
 +     . e r r o r - l o c   { 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i B r i g h t B l a c k ,   # 6 6 6 ) ; 
 
 +         f o n t - s i z e :   0 . 8 8 e m ; 
 
 +         f l e x - s h r i n k :   0 ; 
 
 +         w h i t e - s p a c e :   n o w r a p ; 
 
 +     } 
 
 + 
 
 +     / *   A n a l y z i n g   s p i n n e r   * / 
 
 +     . a n a l y z i n g - l i n e   {   c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i C y a n ,   # 4 e c 9 b 0 ) ;   o p a c i t y :   0 . 8 ;   } 
 
 +     @ k e y f r a m e s   p u l s e   {   0 % , 1 0 0 % { o p a c i t y : 0 . 8 }   5 0 % { o p a c i t y : 0 . 3 }   } 
 
 +     . p u l s e   {   a n i m a t i o n :   p u l s e   1 s   e a s e - i n - o u t   i n f i n i t e ;   } 
 
 + 
 
 +     / *         I n l i n e   s e t t i n g s   p a n e l         * / 
 
 +     . s e t t i n g s - b l o c k   { 
 
 +         m a r g i n :   4 p x   0 ; 
 
 +         p a d d i n g :   8 p x   1 0 p x ; 
 
 +         b o r d e r :   1 p x   s o l i d   r g b a ( 2 5 5 , 2 5 5 , 2 5 5 , 0 . 1 ) ; 
 
 +         b o r d e r - r a d i u s :   3 p x ; 
 
 +         b a c k g r o u n d :   r g b a ( 0 , 0 , 0 , 0 . 2 5 ) ; 
 
 +         / *   C u r s o r   b a c k   t o   n o r m a l   i n s i d e   s e t t i n g s   * / 
 
 +         c u r s o r :   d e f a u l t ; 
 
 +     } 
 
 +     . s e t t i n g s - h e a d   { 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i C y a n ,   # 4 e c 9 b 0 ) ; 
 
 +         m a r g i n - b o t t o m :   6 p x ; 
 
 +         f o n t - w e i g h t :   b o l d ; 
 
 +         u s e r - s e l e c t :   n o n e ; 
 
 +     } 
 
 +     . s e t t i n g s - r o w   {   m a r g i n - b o t t o m :   6 p x ;   } 
 
 +     . s e t t i n g s - l a b e l   { 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i B r i g h t B l a c k ,   # 8 8 8 ) ; 
 
 +         f o n t - s i z e :   0 . 8 5 e m ; 
 
 +         d i s p l a y :   b l o c k ; 
 
 +         m a r g i n - b o t t o m :   2 p x ; 
 
 +     } 
 
 +     . s e t t i n g s - i n p u t   { 
 
 +         w i d t h :   1 0 0 % ; 
 
 +         b a c k g r o u n d :   r g b a ( 2 5 5 , 2 5 5 , 2 5 5 , 0 . 0 7 ) ; 
 
 +         b o r d e r :   1 p x   s o l i d   r g b a ( 2 5 5 , 2 5 5 , 2 5 5 , 0 . 1 5 ) ; 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - f o r e g r o u n d ,   # c c c ) ; 
 
 +         p a d d i n g :   3 p x   6 p x ; 
 
 +         b o r d e r - r a d i u s :   2 p x ; 
 
 +         f o n t - f a m i l y :   i n h e r i t ; 
 
 +         f o n t - s i z e :   i n h e r i t ; 
 
 +         o u t l i n e :   n o n e ; 
 
 +     } 
 
 +     . s e t t i n g s - i n p u t : f o c u s   {   b o r d e r - c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i C y a n ,   # 4 e c 9 b 0 ) ;   } 
 
 +     s e l e c t . s e t t i n g s - i n p u t   o p t i o n   {   b a c k g r o u n d :   # 1 e 1 e 1 e ;   } 
 
 +     . s a v e - b t n   { 
 
 +         b a c k g r o u n d :   t r a n s p a r e n t ; 
 
 +         b o r d e r :   1 p x   s o l i d   v a r ( - - v s c o d e - t e r m i n a l - a n s i C y a n ,   # 4 e c 9 b 0 ) ; 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i C y a n ,   # 4 e c 9 b 0 ) ; 
 
 +         p a d d i n g :   2 p x   1 0 p x ; 
 
 +         b o r d e r - r a d i u s :   2 p x ; 
 
 +         c u r s o r :   p o i n t e r ; 
 
 +         f o n t - f a m i l y :   i n h e r i t ; 
 
 +         f o n t - s i z e :   i n h e r i t ; 
 
 +         m a r g i n - t o p :   2 p x ; 
 
 +     } 
 
 +     . s a v e - b t n : h o v e r   {   b a c k g r o u n d :   r g b a ( 7 8 , 2 0 1 , 1 7 6 , 0 . 1 2 ) ;   } 
 
 +     . s a v e - o k   { 
 
 +         c o l o r :   v a r ( - - v s c o d e - t e r m i n a l - a n s i G r e e n ,   # 8 9 d 1 8 5 ) ; 
 
 +         m a r g i n - l e f t :   8 p x ; 
 
 +         d i s p l a y :   n o n e ; 
 
 +     } 
 
 + < / s t y l e > 
 
 + < / h e a d > 
 
 + < b o d y > 
 
 + 
 
 + < ! - -   H i d d e n   i n p u t       t h e   r e a l   k e y b o a r d   c a p t u r e   t a r g e t   - - > 
 
 + < i n p u t   i d = " c a p t u r e "   t y p e = " t e x t "   a u t o c o m p l e t e = " o f f "   a u t o c o r r e c t = " o f f " 
 
 +               a u t o c a p i t a l i z e = " o f f "   s p e l l c h e c k = " f a l s e "   a r i a - h i d d e n = " t r u e "   / > 
 
 + 
 
 + < ! - -   S i n g l e   s c r o l l a b l e   t e r m i n a l   s u r f a c e   - - > 
 
 + < d i v   i d = " o u t p u t " > 
 
 +     < s p a n   c l a s s = " l i n e   s y s t e m " > A I   E r r o r   C h e c k l i s t     ,%V%    s m a r t   c o m p i l e r   t e r m i n a l 
 
 + T y p e   a   c o m m a n d   a n d   p r e s s   E n t e r .   T y p e   ' s e t t i n g s '   t o   c o n f i g u r e   t h e   A I   k e y . 
 
 + T y p e   ' h e l p '   f o r   a   l i s t   o f   b u i l t - i n   c o m m a n d s . 
 
 + < / s p a n > 
 
 + 
 
 +     < ! - -   L i v e   p r o m p t   l i n e       a l w a y s   t h e   L A S T   c h i l d   o f   # o u t p u t   - - > 
 
 +     < d i v   i d = " p r o m p t - l i n e " > < s p a n   i d = " p r o m p t - p r e f i x " > P S   C : \ \ >   < / s p a n > < s p a n   i d = " t y p e d - t e x t " > < / s p a n > < s p a n   i d = " c u r s o r " > < / s p a n > < / d i v > 
 
 + < / d i v > 
 
 + 
 
 + < s c r i p t > 
 
 + c o n s t   v s c o d e       =   a c q u i r e V s C o d e A p i ( ) ; 
 
 + c o n s t   o u t p u t       =   d o c u m e n t . g e t E l e m e n t B y I d ( ' o u t p u t ' ) ; 
 
 + c o n s t   c a p t u r e     =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p t u r e ' ) ; 
 
 + c o n s t   t y p e d E l     =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t y p e d - t e x t ' ) ; 
 
 + c o n s t   c u r s o r E l   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c u r s o r ' ) ; 
 
 + c o n s t   p r o m p t L i n e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o m p t - l i n e ' ) ; 
 
 + 
 
 + / /         S t a t e                                                                                                                                             
 
 + l e t   c u r r e n t I n p u t   =   ' ' ;       / /   w h a t   t h e   u s e r   h a s   t y p e d   o n   t h e   c u r r e n t   l i n e 
 
 + l e t   c u r s o r P o s         =   0 ;         / /   c a r e t   p o s i t i o n   i n s i d e   c u r r e n t I n p u t 
 
 + l e t   h i s t o r y             =   [ ] ; 
 
 + l e t   h i s t I d x             =   - 1 ; 
 
 + l e t   h i s t D r a f t         =   ' ' ; 
 
 + l e t   b u s y                   =   f a l s e ;   / /   t r u e   w h i l e   a   c h i l d   p r o c e s s   i s   r u n n i n g 
 
 + 
 
 + / /         R e - r e n d e r   t h e   p r o m p t   l i n e   t o   m a t c h   c u r r e n t I n p u t   +   c u r s o r P o s                                 
 
 + f u n c t i o n   r e n d e r P r o m p t L i n e ( )   { 
 
 +     c o n s t   b e f o r e   =   c u r r e n t I n p u t . s l i c e ( 0 ,   c u r s o r P o s ) ; 
 
 +     c o n s t   a t C u r s o r   =   c u r r e n t I n p u t [ c u r s o r P o s ]   | |   ' ' ; 
 
 +     c o n s t   a f t e r     =   c u r r e n t I n p u t . s l i c e ( c u r s o r P o s   +   1 ) ; 
 
 + 
 
 +     / /   T h e   c u r s o r   b l o c k   s i t s   O N   t h e   c h a r a c t e r   a t   c u r s o r P o s   ( r e p l a c e   m o d e   v i s u a l ) 
 
 +     / /   I f   a t   e n d   o f   i n p u t ,   t h e   c u r s o r   b l o c k   i s   s h o w n   a f t e r   t h e   t e x t   ( e m p t y   c h a r   b e l o w ) 
 
 +     t y p e d E l . t e x t C o n t e n t   =   b e f o r e ; 
 
 + 
 
 +     / /   C u r s o r   c h a r a c t e r   s p a n :   s h o w   t h e   c h a r a c t e r   u n d e r   c u r s o r   ( o r   s p a c e   i f   a t   e n d ) 
 
 +     c u r s o r E l . t e x t C o n t e n t   =   a t C u r s o r   | |   '   ' ; 
 
 +     c u r s o r E l . s t y l e . c o l o r   = 
 
 +         a t C u r s o r 
 
 +             ?   ' v a r ( - - v s c o d e - t e r m i n a l - b a c k g r o u n d ,   # 1 e 1 e 1 e ) '     / /   c h a r a c t e r   r e n d e r e d   d a r k   o n   l i t   c u r s o r 
 
 +             :   ' t r a n s p a r e n t ' ; 
 
 + 
 
 +     / /   T h e   t e x t   t h a t   c o m e s   a f t e r   c u r s o r   p o s i t i o n 
 
 +     / /   W e   n e e d   a n   e x t r a   s p a n   f o r   t h e   " a f t e r "   t e x t       r e u s e   o r   c r e a t e 
 
 +     l e t   a f t e r E l   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' a f t e r - c u r s o r ' ) ; 
 
 +     i f   ( ! a f t e r E l )   { 
 
 +         a f t e r E l   =   d o c u m e n t . c r e a t e E l e m e n t ( ' s p a n ' ) ; 
 
 +         a f t e r E l . i d   =   ' a f t e r - c u r s o r ' ; 
 
 +         p r o m p t L i n e . a p p e n d C h i l d ( a f t e r E l ) ; 
 
 +     } 
 
 +     a f t e r E l . t e x t C o n t e n t   =   a f t e r ; 
 
 + } 
 
 + 
 
 + / /         C o m m i t   t h e   c u r r e n t   l i n e   ( u s e r   p r e s s e d   E n t e r )                                                               
 
 + f u n c t i o n   c o m m i t L i n e ( )   { 
 
 +     i f   ( b u s y )   r e t u r n ; 
 
 + 
 
 +     c o n s t   c m d   =   c u r r e n t I n p u t ; 
 
 + 
 
 +     / /   F r e e z e   t h e   p r o m p t   l i n e   i n t o   a   s t a t i c   o u t p u t   l i n e 
 
 +     c o n s t   e c h o   =   d o c u m e n t . c r e a t e E l e m e n t ( ' s p a n ' ) ; 
 
 +     e c h o . c l a s s N a m e   =   ' l i n e   c m d - e c h o ' ; 
 
 +     e c h o . t e x t C o n t e n t   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o m p t - p r e f i x ' ) . t e x t C o n t e n t   +   c m d ; 
 
 + 
 
 +     / /   R e p l a c e   t h e   l i v e   p r o m p t   l i n e   w i t h   t h e   f r o z e n   e c h o ,   t h e n   r e - a p p e n d   t h e   p r o m p t 
 
 +     o u t p u t . i n s e r t B e f o r e ( e c h o ,   p r o m p t L i n e ) ; 
 
 + 
 
 +     / /   R e s e t   l i v e   p r o m p t 
 
 +     c u r r e n t I n p u t   =   ' ' ; 
 
 +     c u r s o r P o s         =   0 ; 
 
 +     r e n d e r P r o m p t L i n e ( ) ; 
 
 +     s c r o l l T o B o t t o m ( ) ; 
 
 + 
 
 +     i f   ( ! c m d . t r i m ( ) )   r e t u r n ; 
 
 + 
 
 +     / /   H i s t o r y 
 
 +     i f   ( h i s t o r y [ h i s t o r y . l e n g t h   -   1 ]   ! = =   c m d )   h i s t o r y . p u s h ( c m d ) ; 
 
 +     h i s t I d x     =   - 1 ; 
 
 +     h i s t D r a f t   =   ' ' ; 
 
 + 
 
 +     h a n d l e C o m m a n d ( c m d ) ; 
 
 + } 
 
 + 
 
 + / /         B u i l t - i n   c o m m a n d s                                                                                                                     
 
 + f u n c t i o n   h a n d l e C o m m a n d ( c m d )   { 
 
 +     c o n s t   t   =   c m d . t r i m ( ) . t o L o w e r C a s e ( ) ; 
 
 + 
 
 +     i f   ( t   = = =   ' c l e a r '   | |   t   = = =   ' c l s ' )   { 
 
 +         / /   R e m o v e   e v e r y t h i n g   e x c e p t   t h e   p r o m p t   l i n e   i t s e l f 
 
 +         w h i l e   ( o u t p u t . f i r s t C h i l d   ! = =   p r o m p t L i n e )   { 
 
 +             o u t p u t . r e m o v e C h i l d ( o u t p u t . f i r s t C h i l d ) ; 
 
 +         } 
 
 +         r e t u r n ; 
 
 +     } 
 
 + 
 
 +     i f   ( t   = = =   ' h e l p ' )   { 
 
 +         a p p e n d L i n e s ( [ 
 
 +             '     c l e a r   /   c l s           c l e a r   t h e   t e r m i n a l ' , 
 
 +             '     s e t t i n g s                 s h o w   /   h i d e   A I   s e t t i n g s ' , 
 
 +             '     h e l p                         s h o w   t h i s   m e s s a g e ' , 
 
 +             '     C t r l + C                     k i l l   r u n n i n g   p r o c e s s ' , 
 
 +             '     C t r l + L                     c l e a r   t e r m i n a l ' , 
 
 +             '         /                           c o m m a n d   h i s t o r y ' , 
 
 +             '         /                           m o v e   c u r s o r   w i t h i n   l i n e ' , 
 
 +             '     H o m e   /   E n d             j u m p   t o   s t a r t   /   e n d   o f   l i n e ' , 
 
 +             ' A n y t h i n g   e l s e   i s   r u n   a s   a   r e a l   s h e l l   c o m m a n d . ' 
 
 +         ] ,   ' s y s t e m ' ) ; 
 
 +         r e t u r n ; 
 
 +     } 
 
 + 
 
 +     i f   ( t   = = =   ' s e t t i n g s ' )   { 
 
 +         t o g g l e S e t t i n g s ( ) ; 
 
 +         r e t u r n ; 
 
 +     } 
 
 + 
 
 +     / /   S h e l l   c o m m a n d 
 
 +     s e t B u s y ( t r u e ) ; 
 
 +     v s c o d e . p o s t M e s s a g e ( {   t y p e :   ' r u n C o m m a n d ' ,   c o m m a n d :   c m d   } ) ; 
 
 + } 
 
 + 
 
 + / /         A p p e n d   m u l t i p l e   t e x t   l i n e s   t o   o u t p u t                                                                               
 
 + f u n c t i o n   a p p e n d L i n e s ( l i n e s ,   c l s )   { 
 
 +     l i n e s . f o r E a c h ( t e x t   = >   { 
 
 +         c o n s t   s p a n   =   d o c u m e n t . c r e a t e E l e m e n t ( ' s p a n ' ) ; 
 
 +         s p a n . c l a s s N a m e   =   ' l i n e   '   +   c l s ; 
 
 +         s p a n . t e x t C o n t e n t   =   t e x t ; 
 
 +         o u t p u t . i n s e r t B e f o r e ( s p a n ,   p r o m p t L i n e ) ; 
 
 +     } ) ; 
 
 +     s c r o l l T o B o t t o m ( ) ; 
 
 + } 
 
 + 
 
 + / /         W r i t e   r a w   t e x t   ( m a y   c o n t a i n   \ \ n )   t o   o u t p u t                                                                     
 
 + f u n c t i o n   w r i t e ( t e x t ,   c l s )   { 
 
 +     / /   S p l i t   o n   a c t u a l   n e w l i n e s   i n   t h e   d a t a 
 
 +     c o n s t   p a r t s   =   t e x t . s p l i t ( ' \ \ n ' ) ; 
 
 +     p a r t s . f o r E a c h ( ( p a r t ,   i )   = >   { 
 
 +         i f   ( i   = = =   p a r t s . l e n g t h   -   1   & &   p a r t   = = =   ' ' )   r e t u r n ;   / /   t r a i l i n g   n e w l i n e 
 
 +         c o n s t   s p a n   =   d o c u m e n t . c r e a t e E l e m e n t ( ' s p a n ' ) ; 
 
 +         s p a n . c l a s s N a m e   =   ' l i n e   '   +   c l s ; 
 
 +         s p a n . t e x t C o n t e n t   =   p a r t ; 
 
 +         o u t p u t . i n s e r t B e f o r e ( s p a n ,   p r o m p t L i n e ) ; 
 
 +     } ) ; 
 
 +     s c r o l l T o B o t t o m ( ) ; 
 
 + } 
 
 + 
 
 + / /         T o g g l e   b u s y   s t a t e   ( d i s a b l e s   t y p i n g ,   s h o w s   s o l i d   c u r s o r )                                         
 
 + f u n c t i o n   s e t B u s y ( o n )   { 
 
 +     b u s y   =   o n ; 
 
 +     i f   ( o n )   { 
 
 +         c u r s o r E l . c l a s s L i s t . a d d ( ' b u s y ' ) ; 
 
 +     }   e l s e   { 
 
 +         c u r s o r E l . c l a s s L i s t . r e m o v e ( ' b u s y ' ) ; 
 
 +         c a p t u r e . f o c u s ( ) ; 
 
 +     } 
 
 + } 
 
 + 
 
 + / /         S e t t i n g s   p a n e l   ( i n l i n e ,   l i k e   a   t e r m i n a l   b l o c k )                                                           
 
 + f u n c t i o n   t o g g l e S e t t i n g s ( )   { 
 
 +     c o n s t   e x i s t i n g   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' s e t t i n g s - b l o c k ' ) ; 
 
 +     i f   ( e x i s t i n g )   {   e x i s t i n g . r e m o v e ( ) ;   r e t u r n ;   } 
 
 + 
 
 +     c o n s t   b l o c k   =   d o c u m e n t . c r e a t e E l e m e n t ( ' d i v ' ) ; 
 
 +     b l o c k . c l a s s N a m e   =   ' s e t t i n g s - b l o c k ' ; 
 
 +     b l o c k . i d   =   ' s e t t i n g s - b l o c k ' ; 
 
 + 
 
 +     b l o c k . i n n e r H T M L   =   \ ` 
 
 +         < d i v   c l a s s = " s e t t i n g s - h e a d " >       A I   s e t t i n g s     < s p a n   s t y l e = " o p a c i t y : 0 . 5 ; f o n t - w e i g h t : n o r m a l ; f o n t - s i z e : 0 . 8 5 e m " > ( t y p e   ' s e t t i n g s '   a g a i n   t o   c l o s e ) < / s p a n > < / d i v > 
 
 +         < d i v   c l a s s = " s e t t i n g s - r o w " > 
 
 +             < l a b e l   c l a s s = " s e t t i n g s - l a b e l " > G o o g l e   A I   S t u d i o   A P I   k e y     < a   h r e f = " h t t p s : / / a i s t u d i o . g o o g l e . c o m / a p i k e y "   s t y l e = " c o l o r : v a r ( - - v s c o d e - t e r m i n a l - a n s i C y a n , # 4 e c 9 b 0 ) ; f o n t - s i z e : 0 . 8 5 e m " >     g e t   f r e e   k e y < / a > < / l a b e l > 
 
 +             < i n p u t   c l a s s = " s e t t i n g s - i n p u t "   i d = " i n p - k e y "   t y p e = " p a s s w o r d "   p l a c e h o l d e r = " A I z a . . . "   / > 
 
 +         < / d i v > 
 
 +         < b u t t o n   c l a s s = " s a v e - b t n "   i d = " s a v e - b t n " > s a v e < / b u t t o n > 
 
 +         < s p a n   c l a s s = " s a v e - o k "   i d = " s a v e - o k " >     s a v e d < / s p a n > 
 
 +         < d i v   s t y l e = " c o l o r : v a r ( - - v s c o d e - t e r m i n a l - a n s i B r i g h t B l a c k , # 6 6 6 ) ; f o n t - s i z e : 0 . 8 2 e m ; m a r g i n - t o p : 6 p x " > 
 
 +             K e y   i s   s t o r e d   l o c a l l y   o n   y o u r   m a c h i n e   o n l y . 
 
 +         < / d i v > 
 
 +     \ ` ; 
 
 + 
 
 +     o u t p u t . i n s e r t B e f o r e ( b l o c k ,   p r o m p t L i n e ) ; 
 
 +     s c r o l l T o B o t t o m ( ) ; 
 
 + 
 
 +     d o c u m e n t . g e t E l e m e n t B y I d ( ' s a v e - b t n ' ) . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,   ( )   = >   { 
 
 +         v s c o d e . p o s t M e s s a g e ( { 
 
 +             t y p e :       ' s a v e S e t t i n g s ' , 
 
 +             a p i K e y :   d o c u m e n t . g e t E l e m e n t B y I d ( ' i n p - k e y ' ) . v a l u e . t r i m ( ) 
 
 +         } ) ; 
 
 +     } ) ; 
 
 + 
 
 +     / /   P r e - f i l l   f r o m   s a v e d   s e t t i n g s 
 
 +     v s c o d e . p o s t M e s s a g e ( {   t y p e :   ' r e a d y '   } ) ; 
 
 + } 
 
 + 
 
 + / /         R e n d e r   A I   e r r o r   c h e c k l i s t   i n l i n e                                                                                     
 
 + f u n c t i o n   r e n d e r C h e c k l i s t ( e r r o r s )   { 
 
 +     i f   ( ! e r r o r s   | |   e r r o r s . l e n g t h   = = =   0 )   r e t u r n ; 
 
 + 
 
 +     c o n s t   b l o c k   =   d o c u m e n t . c r e a t e E l e m e n t ( ' d i v ' ) ; 
 
 +     b l o c k . c l a s s N a m e   =   ' c h e c k l i s t - b l o c k ' ; 
 
 + 
 
 +     c o n s t   t i t l e   =   d o c u m e n t . c r e a t e E l e m e n t ( ' d i v ' ) ; 
 
 +     t i t l e . c l a s s N a m e   =   ' c h e c k l i s t - t i t l e ' ; 
 
 +     t i t l e . t e x t C o n t e n t   = 
 
 +         '       A I   f o u n d   '   +   e r r o r s . l e n g t h   +   '   i s s u e '   +   ( e r r o r s . l e n g t h   >   1   ?   ' s '   :   ' ' )   + 
 
 +         '       c l i c k   a n y   i t e m   t o   j u m p   t o   t h e   l i n e ' ; 
 
 +     b l o c k . a p p e n d C h i l d ( t i t l e ) ; 
 
 + 
 
 +     e r r o r s . f o r E a c h ( e r r   = >   { 
 
 +         c o n s t   i t e m   =   d o c u m e n t . c r e a t e E l e m e n t ( ' d i v ' ) ; 
 
 +         i t e m . c l a s s N a m e   =   ' e r r o r - i t e m ' ; 
 
 +         i t e m . i n n e r H T M L   = 
 
 +             ' < s p a n   c l a s s = " e r r o r - b u l l e t " >   < / s p a n > '   + 
 
 +             ' < s p a n   c l a s s = " e r r o r - s u m m a r y " > '   +   e s c ( e r r . s h o r t S u m m a r y )   +   ' < / s p a n > '   + 
 
 +             ' < s p a n   c l a s s = " e r r o r - l o c " > '   + 
 
 +                 ( e r r . f u l l F i l e P a t h 
 
 +                     ?   e s c ( s h o r t P a t h ( e r r . f u l l F i l e P a t h ) )   +   ' : '   +   e r r . l i n e N u m b e r 
 
 +                     :   ' ' )   + 
 
 +             ' < / s p a n > ' ; 
 
 + 
 
 +         i t e m . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,   ( )   = >   { 
 
 +             v s c o d e . p o s t M e s s a g e ( { 
 
 +                 t y p e :               ' j u m p T o E r r o r ' , 
 
 +                 f i l e P a t h :       e r r . f u l l F i l e P a t h , 
 
 +                 l i n e N u m b e r :   e r r . l i n e N u m b e r 
 
 +             } ) ; 
 
 +         } ) ; 
 
 +         b l o c k . a p p e n d C h i l d ( i t e m ) ; 
 
 +     } ) ; 
 
 + 
 
 +     o u t p u t . i n s e r t B e f o r e ( b l o c k ,   p r o m p t L i n e ) ; 
 
 +     s c r o l l T o B o t t o m ( ) ; 
 
 + } 
 
 + 
 
 + / /         K e y b o a r d   h a n d l i n g                                                                                                                     
 
 + c a p t u r e . a d d E v e n t L i s t e n e r ( ' k e y d o w n ' ,   e   = >   { 
 
 + 
 
 +     / /   C t r l + C       k i l l   p r o c e s s 
 
 +     i f   ( e . k e y   = = =   ' c '   & &   e . c t r l K e y )   { 
 
 +         i f   ( w i n d o w . g e t S e l e c t i o n ( ) . t o S t r i n g ( ) )   { 
 
 +             r e t u r n ;   / /   L e t   t h e   b r o w s e r   c o p y   t h e   s e l e c t e d   t e x t ! 
 
 +         } 
 
 + 
 
 +         e . p r e v e n t D e f a u l t ( ) ; 
 
 +         i f   ( b u s y )   { 
 
 +             v s c o d e . p o s t M e s s a g e ( {   t y p e :   ' k i l l P r o c e s s '   } ) ; 
 
 +         }   e l s e   { 
 
 +             / /   C l e a r   c u r r e n t   l i n e   ( C t r l + C   o n   e m p t y   p r o m p t   e c h o e s   ^ C ) 
 
 +             w r i t e ( 
 
 +                 d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o m p t - p r e f i x ' ) . t e x t C o n t e n t   +   c u r r e n t I n p u t   +   ' ^ C ' , 
 
 +                 ' c m d - e c h o ' 
 
 +             ) ; 
 
 +             c u r r e n t I n p u t   =   ' ' ;   c u r s o r P o s   =   0 ;   r e n d e r P r o m p t L i n e ( ) ; 
 
 +         } 
 
 +         r e t u r n ; 
 
 +     } 
 
 + 
 
 +     / /   C t r l + L       c l e a r 
 
 +     i f   ( e . k e y   = = =   ' l '   & &   e . c t r l K e y )   { 
 
 +         e . p r e v e n t D e f a u l t ( ) ; 
 
 +         w h i l e   ( o u t p u t . f i r s t C h i l d   ! = =   p r o m p t L i n e )   o u t p u t . r e m o v e C h i l d ( o u t p u t . f i r s t C h i l d ) ; 
 
 +         r e t u r n ; 
 
 +     } 
 
 + 
 
 +     i f   ( b u s y )   r e t u r n ;   / /   i g n o r e   t y p i n g   w h i l e   p r o c e s s   i s   r u n n i n g 
 
 + 
 
 +     s w i t c h   ( e . k e y )   { 
 
 +         c a s e   ' E n t e r ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             c o m m i t L i n e ( ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' B a c k s p a c e ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             i f   ( c u r s o r P o s   >   0 )   { 
 
 +                 c u r r e n t I n p u t   =   c u r r e n t I n p u t . s l i c e ( 0 ,   c u r s o r P o s   -   1 )   +   c u r r e n t I n p u t . s l i c e ( c u r s o r P o s ) ; 
 
 +                 c u r s o r P o s - - ; 
 
 +                 r e n d e r P r o m p t L i n e ( ) ; 
 
 +             } 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' D e l e t e ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             i f   ( c u r s o r P o s   <   c u r r e n t I n p u t . l e n g t h )   { 
 
 +                 c u r r e n t I n p u t   =   c u r r e n t I n p u t . s l i c e ( 0 ,   c u r s o r P o s )   +   c u r r e n t I n p u t . s l i c e ( c u r s o r P o s   +   1 ) ; 
 
 +                 r e n d e r P r o m p t L i n e ( ) ; 
 
 +             } 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' A r r o w L e f t ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             i f   ( e . c t r l K e y )   { 
 
 +                 / /   J u m p   w o r d   l e f t 
 
 +                 l e t   p   =   c u r s o r P o s   -   1 ; 
 
 +                 w h i l e   ( p   >   0   & &   c u r r e n t I n p u t [ p   -   1 ]   ! = =   '   ' )   p - - ; 
 
 +                 c u r s o r P o s   =   M a t h . m a x ( 0 ,   p ) ; 
 
 +             }   e l s e   { 
 
 +                 c u r s o r P o s   =   M a t h . m a x ( 0 ,   c u r s o r P o s   -   1 ) ; 
 
 +             } 
 
 +             r e n d e r P r o m p t L i n e ( ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' A r r o w R i g h t ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             i f   ( e . c t r l K e y )   { 
 
 +                 / /   J u m p   w o r d   r i g h t 
 
 +                 l e t   p   =   c u r s o r P o s   +   1 ; 
 
 +                 w h i l e   ( p   <   c u r r e n t I n p u t . l e n g t h   & &   c u r r e n t I n p u t [ p ]   ! = =   '   ' )   p + + ; 
 
 +                 c u r s o r P o s   =   M a t h . m i n ( c u r r e n t I n p u t . l e n g t h ,   p ) ; 
 
 +             }   e l s e   { 
 
 +                 c u r s o r P o s   =   M a t h . m i n ( c u r r e n t I n p u t . l e n g t h ,   c u r s o r P o s   +   1 ) ; 
 
 +             } 
 
 +             r e n d e r P r o m p t L i n e ( ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' H o m e ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             c u r s o r P o s   =   0 ; 
 
 +             r e n d e r P r o m p t L i n e ( ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' E n d ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             c u r s o r P o s   =   c u r r e n t I n p u t . l e n g t h ; 
 
 +             r e n d e r P r o m p t L i n e ( ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' T a b ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             i f   ( b u s y )   r e t u r n ; 
 
 +             v s c o d e . p o s t M e s s a g e ( {   t y p e :   ' r e q u e s t C o m p l e t i o n ' ,   i n p u t :   c u r r e n t I n p u t ,   c u r s o r :   c u r s o r P o s   } ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' A r r o w U p ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             i f   ( h i s t o r y . l e n g t h   = = =   0 )   b r e a k ; 
 
 +             i f   ( h i s t I d x   = = =   - 1 )   {   h i s t D r a f t   =   c u r r e n t I n p u t ;   h i s t I d x   =   h i s t o r y . l e n g t h   -   1 ;   } 
 
 +             e l s e   i f   ( h i s t I d x   >   0 )   h i s t I d x - - ; 
 
 +             c u r r e n t I n p u t   =   h i s t o r y [ h i s t I d x ] ; 
 
 +             c u r s o r P o s         =   c u r r e n t I n p u t . l e n g t h ; 
 
 +             r e n d e r P r o m p t L i n e ( ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' A r r o w D o w n ' : 
 
 +             e . p r e v e n t D e f a u l t ( ) ; 
 
 +             i f   ( h i s t I d x   = = =   - 1 )   b r e a k ; 
 
 +             i f   ( h i s t I d x   <   h i s t o r y . l e n g t h   -   1 )   { 
 
 +                 h i s t I d x + + ; 
 
 +                 c u r r e n t I n p u t   =   h i s t o r y [ h i s t I d x ] ; 
 
 +             }   e l s e   { 
 
 +                 h i s t I d x   =   - 1 ; 
 
 +                 c u r r e n t I n p u t   =   h i s t D r a f t ; 
 
 +             } 
 
 +             c u r s o r P o s   =   c u r r e n t I n p u t . l e n g t h ; 
 
 +             r e n d e r P r o m p t L i n e ( ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         d e f a u l t : 
 
 +             / /   P r i n t a b l e   c h a r a c t e r s       i n s e r t   a t   c u r s o r P o s 
 
 +             i f   ( e . k e y . l e n g t h   = = =   1   & &   ! e . c t r l K e y   & &   ! e . m e t a K e y )   { 
 
 +                 e . p r e v e n t D e f a u l t ( ) ; 
 
 +                 c u r r e n t I n p u t   =   c u r r e n t I n p u t . s l i c e ( 0 ,   c u r s o r P o s )   +   e . k e y   +   c u r r e n t I n p u t . s l i c e ( c u r s o r P o s ) ; 
 
 +                 c u r s o r P o s + + ; 
 
 +                 r e n d e r P r o m p t L i n e ( ) ; 
 
 +             } 
 
 +             b r e a k ; 
 
 +     } 
 
 + } ) ; 
 
 + 
 
 + / /   P r e v e n t   t h e   h i d d e n   i n p u t   f r o m   a c c u m u l a t i n g   t e x t   ( w e   h a n d l e   e v e r y t h i n g   i n   k e y d o w n ) 
 
 + c a p t u r e . a d d E v e n t L i s t e n e r ( ' i n p u t ' ,   e   = >   {   c a p t u r e . v a l u e   =   ' ' ;   } ) ; 
 
 + 
 
 + / /         M e s s a g e s   f r o m   e x t e n s i o n   h o s t                                                                                               
 
 + w i n d o w . a d d E v e n t L i s t e n e r ( ' m e s s a g e ' ,   e   = >   { 
 
 +     c o n s t   m s g   =   e . d a t a ; 
 
 +     s w i t c h   ( m s g . t y p e )   { 
 
 + 
 
 +         c a s e   ' s e t P r o m p t ' : 
 
 +             d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o m p t - p r e f i x ' ) . t e x t C o n t e n t   =   m s g . p r o m p t S t r ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' c o m m a n d S t a r t ' : 
 
 +             / /   T h e   e c h o e d   l i n e   i s   a l r e a d y   w r i t t e n   b y   c o m m i t L i n e ( ) ;   j u s t   s h o w   b u s y   s t a t e 
 
 +             s e t B u s y ( t r u e ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' s t d o u t ' : 
 
 +             w r i t e ( m s g . t e x t ,   ' s t d o u t ' ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' s t d e r r ' : 
 
 +             w r i t e ( m s g . t e x t ,   ' s t d e r r ' ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' c o m m a n d E n d ' : 
 
 +             s e t B u s y ( f a l s e ) ; 
 
 +             i f   ( m s g . e x i t C o d e   ! = =   0   & &   m s g . e x i t C o d e   ! = =   n u l l )   { 
 
 +                 w r i t e ( ' [ e x i t   '   +   m s g . e x i t C o d e   +   ' ] ' ,   ' e x i t - e r r ' ) ; 
 
 +             } 
 
 +             s c r o l l T o B o t t o m ( ) ; 
 
 +             b r e a k ; 
 
 + 
 
 +         c a s e   ' c o m p l e t i o n R e s u l t ' :   { 
 
 +             c o n s t   c o m p   =   m s g . c o m p l e t i o n ; 
 
 +             c u r r e n t I n p u t   =   c u r r e n t I n p u t . s l i c e ( 0 ,   c u r s o r P o s )   +   c o m p   +   c u r r e n t I n p u t . s l i c e ( c u r s o r P o s ) ; 
 
 +             c u r s o r P o s   + =   c o m p . l e n g t h ; 
 
 +             r e n d e r P r o m p t L i n e ( ) ; 
 
 +             b r e a k ; 
 
 +         } 
 
 + 
 
 +         c a s e   ' c o m p l e t i o n M a t c h e s ' :   { 
 
 +             c o n s t   s   =   d o c u m e n t . c r e a t e E l e m e n t ( ' s p a n ' ) ; 
 
 +             s . c l a s s N a m e   =   ' l i n e   s y s t e m ' ; 
 
 +             s . t e x t C o n t e n t   =   m s g . m a t c h e s . j o i n ( '     ' ) ; 
 
 +             o u t p u t . i n s e r t B e f o r e ( s ,   p r o m p t L i n e ) ; 
 
 +             s c r o l l T o B o t t o m ( ) ; 
 
 +             b r e a k ; 
 
 +         } 
 
 + 
 
 +         c a s e   ' a n a l y z i n g ' :   { 
 
 +             c o n s t   s   =   d o c u m e n t . c r e a t e E l e m e n t ( ' s p a n ' ) ; 
 
 +             s . c l a s s N a m e   =   ' l i n e   a n a l y z i n g - l i n e   p u l s e ' ; 
 
 +             s . i d   =   ' a n a l y z i n g - i n d i c a t o r ' ; 
 
 +             s . t e x t C o n t e n t   =   '  %  a n a l y z i n g   e r r o r s   w i t h   A I . . . ' ; 
 
 +             o u t p u t . i n s e r t B e f o r e ( s ,   p r o m p t L i n e ) ; 
 
 +             s c r o l l T o B o t t o m ( ) ; 
 
 +             b r e a k ; 
 
 +         } 
 
 + 
 
 +         c a s e   ' s h o w E r r o r s ' :   { 
 
 +             c o n s t   i n d   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' a n a l y z i n g - i n d i c a t o r ' ) ; 
 
 +             i f   ( i n d )   i n d . r e m o v e ( ) ; 
 
 +             r e n d e r C h e c k l i s t ( m s g . e r r o r s ) ; 
 
 +             b r e a k ; 
 
 +         } 
 
 + 
 
 +         c a s e   ' a n a l y s i s E r r o r ' :   { 
 
 +             c o n s t   i n d 2   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' a n a l y z i n g - i n d i c a t o r ' ) ; 
 
 +             i f   ( i n d 2 )   i n d 2 . r e m o v e ( ) ; 
 
 +             w r i t e ( ' [ A I ]   '   +   m s g . m e s s a g e ,   ' s y s t e m ' ) ; 
 
 +             b r e a k ; 
 
 +         } 
 
 + 
 
 +         c a s e   ' s e t t i n g s S a v e d ' :   { 
 
 +             c o n s t   o k   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' s a v e - o k ' ) ; 
 
 +             i f   ( o k )   {   o k . s t y l e . d i s p l a y   =   ' i n l i n e ' ;   s e t T i m e o u t ( ( )   = >   o k . s t y l e . d i s p l a y   =   ' n o n e ' ,   2 0 0 0 ) ;   } 
 
 +             b r e a k ; 
 
 +         } 
 
 + 
 
 +         c a s e   ' l o a d S e t t i n g s ' :   { 
 
 +             i f   ( m s g . h a s K e y )   { 
 
 +                 c o n s t   k   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' i n p - k e y ' ) ; 
 
 +                 i f   ( k )   k . p l a c e h o l d e r   =   ' ( k e y   s a v e d       p a s t e   t o   r e p l a c e ) ' ; 
 
 +             } 
 
 +             b r e a k ; 
 
 +         } 
 
 +     } 
 
 + } ) ; 
 
 + 
 
 + / /         C l i c k   a n y w h e r e       f o c u s   h i d d e n   c a p t u r e   i n p u t                                                                 
 
 + d o c u m e n t . a d d E v e n t L i s t e n e r ( ' c l i c k ' ,   e   = >   { 
 
 +     / /   I f   u s e r   i s   s e l e c t i n g   t e x t ,   d o n ' t   s t e a l   f o c u s 
 
 +     i f   ( w i n d o w . g e t S e l e c t i o n ( ) . t o S t r i n g ( ) )   r e t u r n ; 
 
 + 
 
 +     / /   D o n ' t   s t e a l   f o c u s   f r o m   s e t t i n g s   f o r m   e l e m e n t s 
 
 +     i f   ( e . t a r g e t . c l o s e s t ( ' . s e t t i n g s - i n p u t ' )   | | 
 
 +             e . t a r g e t . c l o s e s t ( ' . s a v e - b t n ' )   | | 
 
 +             e . t a r g e t . c l o s e s t ( ' a ' )   | | 
 
 +             e . t a r g e t . c l o s e s t ( ' . e r r o r - i t e m ' ) )   r e t u r n ; 
 
 +     c a p t u r e . f o c u s ( ) ; 
 
 + } ) ; 
 
 + 
 
 + / /         U t i l i t i e s                                                                                                                                     
 
 + f u n c t i o n   s c r o l l T o B o t t o m ( )   { 
 
 +     o u t p u t . s c r o l l T o p   =   o u t p u t . s c r o l l H e i g h t ; 
 
 + } 
 
 + 
 
 + f u n c t i o n   s h o r t P a t h ( p )   { 
 
 +     c o n s t   p a r t s   =   p . r e p l a c e ( / \ \ \ \ / g ,   ' / ' ) . s p l i t ( ' / ' ) . f i l t e r ( B o o l e a n ) ; 
 
 +     r e t u r n   p a r t s . l e n g t h   >   2   ?   ' . . . / '   +   p a r t s . s l i c e ( - 2 ) . j o i n ( ' / ' )   :   p ; 
 
 + } 
 
 + 
 
 + f u n c t i o n   e s c ( s )   { 
 
 +     r e t u r n   S t r i n g ( s ) 
 
 +         . r e p l a c e ( / & / g , ' & a m p ; ' ) . r e p l a c e ( / < / g , ' & l t ; ' ) 
 
 +         . r e p l a c e ( / > / g , ' & g t ; ' ) . r e p l a c e ( / " / g , ' & q u o t ; ' ) ; 
 
 + } 
 
 + 
 
 + / /         B o o t                                                                                                                                               
 
 + r e n d e r P r o m p t L i n e ( ) ; 
 
 + c a p t u r e . f o c u s ( ) ; 
 
 + v s c o d e . p o s t M e s s a g e ( {   t y p e :   ' r e a d y '   } ) ; 
 
 + < / s c r i p t > 
 
 + < / b o d y > 
 
 + < / h t m l > ` ; 
 
 +     } 
 
 + } 
 
 + 
 
 + m o d u l e . e x p o r t s   =   {   T e r m i n a l P a n e l P r o v i d e r   } ; 
 
 \   N o   n e w l i n e   a t   e n d   o f   f i l e 
 
 