Ë
    ûûàg¿: ã                   óV   — d Z 	 dZddlZddlZddlZddlZ G d„ d«      Z G d„ d«      Zy)ax  Diff Match and Patch
Copyright 2018 The diff-match-patch Authors.
https://github.com/google/diff-match-patch

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
zfraser@google.com (Neil Fraser)é    Nc                   ó4  — e Zd ZdZd„ ZdZdZdZd*d„Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z ej,                  d«      Z ej,                  d«      Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d „ Z#d!„ Z$d"„ Z%d+d#„Z&d$„ Z'd%„ Z(d&„ Z)d'„ Z*d(„ Z+d)„ Z,y),Údiff_match_patchzcClass containing the diff, match and patch methods.

    Also contains the behaviour settings.
    c                 óf   — d| _         d| _        d| _        d| _        d| _        d| _        d| _        y)z€Inits a diff_match_patch object with default settings.
        Redefine these in your program to override the defaults.
        ç      ð?é   g      à?iè  é    N)ÚDiff_TimeoutÚDiff_EditCostÚMatch_ThresholdÚMatch_DistanceÚPatch_DeleteThresholdÚPatch_MarginÚMatch_MaxBits©Úselfs    ú_/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/diff_match_patch/diff_match_patch.pyÚ__init__zdiff_match_patch.__init__(   sB   € ð  ˆÔàˆÔà"ˆÔð #ˆÔð
 &)ˆÔ"àˆÔð  ˆÕó    éÿÿÿÿé   r   Nc                 ó6  — |dk(  rA| j                   dk  rt        j                  }n!t        j                  «       | j                   z   }|dk(  s|dk(  rt	        d«      ‚||k(  r|r| j
                  |fgS g S | j                  ||«      }|d| }||d }||d }| j                  ||«      }|dk(  rd}n|| d }|d|  }|d|  }| j                  ||||«      }|r| j
                  |fg|dd |r|j                  | j
                  |f«       | j                  |«       |S )a¯  Find the differences between two texts.  Simplifies the problem by
          stripping any common prefix or suffix off the texts before diffing.

        Args:
          text1: Old string to be diffed.
          text2: New string to be diffed.
          checklines: Optional speedup flag.  If present and false, then don't run
            a line-level diff first to identify the changed areas.
            Defaults to true, which does a faster, slightly less optimal diff.
          deadline: Optional time when the diff should be complete by.  Used
            internally for recursive calls.  Users should set DiffTimeout instead.

        Returns:
          Array of changes.
        Nr   zNull inputs. (diff_main)Ú )r	   ÚsysÚmaxsizeÚtimeÚ
ValueErrorÚ
DIFF_EQUALÚdiff_commonPrefixÚdiff_commonSuffixÚdiff_computeÚappendÚdiff_cleanupMerge)	r   Útext1Útext2Ú
checklinesÚdeadlineÚcommonlengthÚcommonprefixÚcommonsuffixÚdiffss	            r   Ú	diff_mainzdiff_match_patch.diff_mainN   sY  € ð" �tÒà× Ñ  AÒ%ÜŸ;™;‘äŸ9™9›;¨×):Ñ):Ñ:�ð �DŠ=˜E TšMÜÐ7Ó8Ð8ð �EŠ>ÙØŸ™¨%Ð0Ð1Ð1ØˆIð ×-Ñ-¨e°UÓ;ˆØ˜]˜lÐ+ˆØ�l�mÐ$ˆØ�l�mÐ$ˆð ×-Ñ-¨e°UÓ;ˆØ˜1ÒØ‰Là  ,  Ð0ˆLØ˜.˜L˜=Ð)ˆEØ˜.˜L˜=Ð)ˆEð ×!Ñ! %¨°
¸HÓEˆñ ØŸ/™/¨<Ð8Ð9ˆE�"�1ˆIÙØ�L‰L˜$Ÿ/™/¨<Ð8Ô9Ø×Ñ˜uÔ%Øˆr   c                 óD  — |s| j                   |fgS |s| j                  |fgS t        |«      t        |«      kD  r||}}n||}}|j                  |«      }|dk7  r‚| j                   |d| f| j                  |f| j                   ||t        |«      z   d fg}t        |«      t        |«      kD  r.| j                  |d   d   f|d<   | j                  |d   d   f|d<   |S t        |«      dk(  r| j                  |f| j                   |fgS | j                  ||«      }	|	rE|	\  }
}}}}| j                  |
|||«      }| j                  ||||«      }|| j                  |fgz   |z   S |r/t        |«      dkD  r!t        |«      dkD  r| j                  |||«      S | j                  |||«      S )a  Find the differences between two texts.  Assumes that the texts do not
          have any common prefix or suffix.

        Args:
          text1: Old string to be diffed.
          text2: New string to be diffed.
          checklines: Speedup flag.  If false, then don't run a line-level diff
            first to identify the changed areas.
            If true, then run a faster, slightly less optimal diff.
          deadline: Time when the diff should be complete by.

        Returns:
          Array of changes.
        r   Nr   r   é   éd   )	ÚDIFF_INSERTÚDIFF_DELETEÚlenÚfindr   Údiff_halfMatchr+   Údiff_lineModeÚdiff_bisect)r   r#   r$   r%   r&   ÚlongtextÚ	shorttextÚir*   ÚhmÚtext1_aÚtext1_bÚtext2_aÚtext2_bÚ
mid_commonÚdiffs_aÚdiffs_bs                    r   r    zdiff_match_patch.diff_computeŠ   sÝ  € ñ à×%Ñ% uÐ-Ð.Ð.áà×%Ñ% uÐ-Ð.Ð.äˆu‹:œ˜E›
Ò"Ø%*¨E�y‰Xà%*¨E˜ˆYØ�M‰M˜)Ó$ˆØ�Š7ð ×!Ñ! 8¨B¨Q <Ð0Ø—‘ )Ð,Ø×!Ñ! 8¨A´°I³Ñ,>Ð,@Ð#AÐBðˆEô �5‹zœC ›JÒ&Ø ×,Ñ,¨e°A©h°q©kÐ:��a‘Ø ×,Ñ,¨e°A©h°q©kÐ:��a‘ØˆLäˆy‹>˜QÒð ×%Ñ% uÐ-°×0@Ñ0@À%Ð/HÐIÐIð × Ñ  ¨Ó.ˆÙà?AÑ<ˆW�g˜w¨°à—n‘n W¨g°zÀ8ÓLˆGØ—n‘n W¨g°zÀ8ÓLˆGà˜tŸ™°
Ð;Ð<Ñ<¸wÑFÐFáœ#˜e›* sÒ*¬s°5«z¸CÒ/?Ø×%Ñ% e¨U°HÓ=Ð=à×Ñ  u¨hÓ7Ð7r   c                 óž  — | j                  ||«      \  }}}| j                  ||d|«      }| j                  ||«       | j                  |«       |j	                  | j
                  df«       d}d}d}d}	d}
|t        |«      k  rº||   d   | j                  k(  r|dz  }|
||   d   z  }
n€||   d   | j                  k(  r|dz  }|	||   d   z  }	nZ||   d   | j
                  k(  rE|dk\  r8|dk\  r3| j                  |	|
d|«      }||||z
  |z
  | ||z
  |z
  t        |«      z   }d}d}d}	d}
|dz  }|t        |«      k  rŒº|j                  «        |S )ao  Do a quick line-level diff on both strings, then rediff the parts for
          greater accuracy.
          This speedup can produce non-minimal diffs.

        Args:
          text1: Old string to be diffed.
          text2: New string to be diffed.
          deadline: Time when the diff should be complete by.

        Returns:
          Array of changes.
        Fr   r   r   )
Údiff_linesToCharsr+   Údiff_charsToLinesÚdiff_cleanupSemanticr!   r   r1   r/   r0   Úpop)r   r#   r$   r&   Ú	linearrayr*   ÚpointerÚcount_deleteÚcount_insertÚtext_deleteÚtext_insertÚsubDiffs               r   r4   zdiff_match_patch.diff_lineModeÈ   s–  € ð %)×$:Ñ$:¸5À%Ó$HÑ!ˆ��yà—‘˜u e¨U°HÓ=ˆð 	×Ñ˜u iÔ0à×!Ñ! %Ô(ð 	�‰�d—o‘o rÐ*Ô+ØˆØˆØˆØˆØˆØœ˜E›
Ò"Ø�W‰~˜aÑ  D×$4Ñ$4Ò4Ø Ñ!�Ø˜u W™~¨aÑ0Ñ0‘Ø�w‘ Ñ" d×&6Ñ&6Ò6Ø Ñ!�Ø˜u W™~¨aÑ0Ñ0‘Ø�w‘ Ñ" d§o¡oÒ5à 1Ò$¨¸Ò):à"Ÿn™n¨[¸+ÀuÈhÓW�GØMT�E˜' LÑ0°<Ñ?À'ÐJØ%¨Ñ4°|ÑCÄcÈ'ÃlÑR�GØ �Ø �Ø �Ø �à�q‰LˆGð' œ˜E›
Ó"ð* 	�	‰	Œàˆr   c           	      ó  — t        |«      }t        |«      }||z   dz   dz  }|}d|z  }dg|z  }	d|	|dz   <   |	dd }
||z
  }|dz  dk7  }d}d}d}d}t        |«      D �]  }t        j                  «       |kD  r �nõt        | |z   |dz   |z
  d«      D ]Ò  }||z   }|| k(  s||k7  r|	|dz
     |	|dz      k  r	|	|dz      }n|	|dz
     dz   }||z
  }||k  r0||k  r+||   ||   k(  r |dz  }|dz  }||k  r||k  r||   ||   k(  rŒ ||	|<   ||kD  r|dz  }Œ‚||kD  r|dz  }Œ�|sŒ�||z   |z
  }|dk\  sŒž||k  sŒ¤|
|   dk7  sŒ­||
|   z
  }||k\  sŒ»| j                  |||||«      c c S  t        | |z   |dz   |z
  d«      D ]ì  }||z   }|| k(  s||k7  r|
|dz
     |
|dz      k  r	|
|dz      }n|
|dz
     dz   }||z
  }||k  r@||k  r;|| dz
     || dz
     k(  r(|dz  }|dz  }||k  r||k  r|| dz
     || dz
     k(  rŒ(||
|<   ||kD  r|dz  }Œ’||kD  r|dz  }Œ�|rŒ ||z   |z
  }|dk\  sŒ®||k  sŒ´|	|   dk7  sŒ½|	|   }||z   |z
  }||z
  }||k\  sŒÕ| j                  |||||«      c c S  �Œ | j                  |f| j
                  |fgS )a¡  Find the 'middle snake' of a diff, split the problem in two
          and return the recursively constructed diff.
          See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.

        Args:
          text1: Old string to be diffed.
          text2: New string to be diffed.
          deadline: Time at which to bail if not yet complete.

        Returns:
          Array of diff tuples.
        r   r-   r   r   N)r1   Úranger   Údiff_bisectSplitr0   r/   )r   r#   r$   r&   Útext1_lengthÚtext2_lengthÚmax_dÚv_offsetÚv_lengthÚv1Úv2ÚdeltaÚfrontÚk1startÚk1endÚk2startÚk2endÚdÚk1Ú	k1_offsetÚx1Úy1Ú	k2_offsetÚx2Úk2Úy2s                             r   r5   zdiff_match_patch.diff_bisect  s¿  € ô ˜5“zˆÜ˜5“zˆØ Ñ,¨qÑ0°QÑ6ˆØˆØ�u‘9ˆØˆT�H‰_ˆØˆˆ8�a‰<ÑØ‘ˆUˆØ˜|Ñ+ˆð ˜‘	˜Q‘ˆð ˆØˆØˆØˆÜ�u“ó A	YˆAä�y‰y‹{˜XÒ%Úô ˜Q˜B ™L¨!¨a©%°%©-¸Ó;ò Y�Ø$ r™M�	Ø˜!˜’8  a¢¨B¨y¸1©}Ñ,=ÀÀ9ÈqÁ=Ñ@QÒ,QØ˜I¨™MÑ*‘Bà˜I¨™MÑ*¨QÑ.�BØ˜"‘W�à˜Ò%¨"¨|Ò*;ÀÀbÁ	ÈUÐSUÉYÒ@Và˜!‘G�BØ˜!‘G�Bð ˜Ò%¨"¨|Ò*;ÀÀbÁ	ÈUÐSUÉYÓ@Vð !#��9‘Ø˜Ò$à˜Q‘J‘EØ˜,Ò&à˜q‘L‘GÚØ (¨5Ñ 0°2Ñ 5�IØ  A“~¨)°hÓ*>À2ÀiÁ=ÐTVÓCVà)¨B¨y©MÑ9˜Ø ›8à#'×#8Ñ#8¸ÀÀrÈ2ÈxÓ#XÔXð5Yô: ˜Q˜B ™L¨!¨a©%°%©-¸Ó;ò Y�Ø$ r™M�	Ø˜!˜’8  a¢¨B¨y¸1©}Ñ,=ÀÀ9ÈqÁ=Ñ@QÒ,QØ˜I¨™MÑ*‘Bà˜I¨™MÑ*¨QÑ.�BØ˜"‘W�à˜Ò%Ø˜\Ò)Ø˜r˜c A™g™¨%°°°a±©.Ò8à˜!‘G�BØ˜!‘G�Bð ˜Ò%Ø˜\Ò)Ø˜r˜c A™g™¨%°°°a±©.Ó8ð !#��9‘Ø˜Ò$à˜Q‘J‘EØ˜,Ò&à˜q‘L‘GÚØ (¨5Ñ 0°2Ñ 5�IØ  A“~¨)°hÓ*>À2ÀiÁ=ÐTVÓCVØ 	™]˜Ø%¨™]¨YÑ6˜à)¨BÑ.˜Ø ›8à#'×#8Ñ#8¸ÀÀrÈ2ÈxÓ#XÔXò=YðGA	YðJ ×!Ñ! 5Ð)¨D×,<Ñ,<¸eÐ+DÐEÐEr   c                 ó„   — |d| }|d| }||d }||d }	| j                  ||d|«      }
| j                  ||	d|«      }|
|z   S )a�  Given the location of the 'middle snake', split the diff in two parts
        and recurse.

        Args:
          text1: Old string to be diffed.
          text2: New string to be diffed.
          x: Index of split point in text1.
          y: Index of split point in text2.
          deadline: Time at which to bail if not yet complete.

        Returns:
          Array of diff tuples.
        NF)r+   )r   r#   r$   ÚxÚyr&   Útext1aÚtext2aÚtext1bÚtext2br*   Údiffsbs               r   rO   z!diff_match_patch.diff_bisectSpliti  sd   € ð �r˜�ˆØ�r˜�ˆØ�q�r�ˆØ�q�r�ˆð —‘˜v v¨u°hÓ?ˆØ—‘ ¨°°xÓ@ˆà�v‰~Ðr   c                 ór   ‡‡‡— g Ši Š‰j                  d«       ˆˆˆfd„}dŠ ||«      }dŠ ||«      }||‰fS )aÃ  Split two texts into an array of strings.  Reduce the texts to a string
        of hashes where each Unicode character represents one line.

        Args:
          text1: First string.
          text2: Second string.

        Returns:
          Three element tuple, containing the encoded text1, the encoded text2 and
          the array of unique strings.  The zeroth element of the array of unique
          strings is intentionally blank.
        r   c                 óì  •— g }d}d}|t        | «      dz
  k  rÌ| j                  d|«      }|dk(  rt        | «      dz
  }| ||dz    }|‰v r|j                  t        ‰|   «      «       nft        ‰«      ‰k(  r| |d }t        | «      }‰j                  |«       t        ‰«      dz
  ‰|<   |j                  t        t        ‰«      dz
  «      «       |dz   }|t        | «      dz
  k  rŒÌdj	                  |«      S )aK  Split a text into an array of strings.  Reduce the texts to a string
            of hashes where each Unicode character represents one line.
            Modifies linearray and linehash through being a closure.

            Args:
              text: String to encode.

            Returns:
              Encoded string.
            r   r   r   ú
Nr   )r1   r2   r!   ÚchrÚjoin)ÚtextÚcharsÚ	lineStartÚlineEndÚlineÚ	lineArrayÚlineHashÚmaxLiness        €€€r   Údiff_linesToCharsMungezBdiff_match_patch.diff_linesToChars.<locals>.diff_linesToCharsMunge–  sý   ø€ ð ˆEð ˆIØˆGØœC ›I¨™MÒ)ØŸ)™) D¨)Ó4�Ø˜b’=Ü! $›i¨!™m�GØ˜I¨°!©Ð4�à˜8Ñ#Ø—L‘L¤ X¨d¡^Ó!4Õ5ä˜9“~¨Ò1à# I JÐ/˜Ü"% d£)˜Ø×$Ñ$ TÔ*Ü%(¨£^°aÑ%7�H˜T‘NØ—L‘L¤¤S¨£^°aÑ%7Ó!8Ô9Ø# a™K�	ð! œC ›I¨™MÓ)ð" —7‘7˜5“>Ð!r   i*,
 iÿÿ )r!   )	r   r#   r$   r{   Úchars1Úchars2rx   ry   rz   s	         @@@r   rB   z"diff_match_patch.diff_linesToChars‚  sR   ú€ ð ˆ	Øˆð 	×Ñ˜Ôö"	"ðJ ˆÙ'¨Ó.ˆØˆÙ'¨Ó.ˆØ˜ 	Ð*Ð*r   c                 óÆ   — t        t        |«      «      D ]J  }g }||   d   D ]  }|j                  |t        |«         «       Œ! ||   d   dj	                  |«      f||<   ŒL y)zÅRehydrate the text in a diff from a string of line hashes to real lines
        of text.

        Args:
          diffs: Array of diff tuples.
          lineArray: Array of unique strings.
        r   r   r   N)rN   r1   r!   Úordrr   )r   r*   rx   r8   rs   Úchars         r   rC   z"diff_match_patch.diff_charsToLinesÁ  sk   € ô ”s˜5“zÓ"ò 	4ˆAØˆDØ˜a™ ™ò 2�Ø—‘˜I¤c¨$£iÑ0Õ1ð2à˜a™ ™ R§W¡W¨T£]Ð3ˆE�!ŠHñ		4r   c                 ó¾   — |r|r|d   |d   k7  ryd}t        t        |«      t        |«      «      }|}d}||k  r#||| ||| k(  r|}|}n|}||z
  dz  |z   }||k  rŒ#|S )zÛDetermine the common prefix of two strings.

        Args:
          text1: First string.
          text2: Second string.

        Returns:
          The number of characters common to the start of each string.
        r   r-   ©Úminr1   )r   r#   r$   Ú
pointerminÚ
pointermaxÚ
pointermidÚpointerstarts          r   r   z"diff_match_patch.diff_commonPrefixÏ  s“   € ñ ™E U¨1¡X°°q±Ò%9Øð ˆ
Üœ˜U›¤S¨£ZÓ0ˆ
Øˆ
ØˆØ˜:Ò%Ø�\ *Ð-°°|ÀJÐ1OÒOØ'�
Ø)‘à'�
Ø$ zÑ1°aÑ7¸*ÑDˆJð ˜:Ó%ð Ðr   c                 óò   — |r|r|d   |d   k7  ryd}t        t        |«      t        |«      «      }|}d}||k  r=|| t        |«      |z
   || t        |«      |z
   k(  r|}|}n|}||z
  dz  |z   }||k  rŒ=|S )zÙDetermine the common suffix of two strings.

        Args:
          text1: First string.
          text2: Second string.

        Returns:
          The number of characters common to the end of each string.
        r   r   r-   r‚   )r   r#   r$   r„   r…   r†   Ú
pointerends          r   r   z"diff_match_patch.diff_commonSuffixë  s¯   € ñ ™E U¨2¡Y°%¸±)Ò%;Øð ˆ
Üœ˜U›¤S¨£ZÓ0ˆ
Øˆ
Øˆ
Ø˜:Ò%à�z�k¤C¨£J°Ñ$;Ð<Ø˜*˜¤s¨5£z°JÑ'>Ð?ò@ð (�
Ø'‘
à'�
Ø$ zÑ1°aÑ7¸*ÑDˆJð ˜:Ó%ð Ðr   c                 ó  — t        |«      }t        |«      }|dk(  s|dk(  ry||kD  r|| d }n
||k  r|d| }t        ||«      }||k(  r|S d}d}	 || d }|j                  |«      }	|	dk(  r|S ||	z  }|	dk(  s|| d |d| k(  r|}|dz  }Œ<)a  Determine if the suffix of one string is the prefix of another.

        Args:
          text1 First string.
          text2 Second string.

        Returns:
          The number of characters common to the end of the first
          string and the start of the second string.
        r   Nr   r   )r1   rƒ   r2   )
r   r#   r$   rP   rQ   Útext_lengthÚbestÚlengthÚpatternÚfounds
             r   Údiff_commonOverlapz#diff_match_patch.diff_commonOverlap
  sÙ   € ô ˜5“zˆÜ˜5“zˆà˜1Ò °Ò 1Øà˜,Ò&Ø˜<˜-˜.Ð)‰EØ˜LÒ(Ø˜-˜<Ð(ˆEÜ˜,¨Ó5ˆà�EŠ>ØÐð
 ˆØˆØØ˜V˜G˜H�oˆGØ—J‘J˜wÓ'ˆEØ˜Š{Ø�Ø�e‰OˆFØ˜Šz˜U F 7 8˜_°°g°v°Ò>Ø�Ø˜!‘�ð r   c                 óä  ‡ — ‰ j                   dk  ryt        |«      t        |«      kD  r||}}n||}}t        |«      dk  st        |«      dz  t        |«      k  ryˆ fd„} |||t        |«      dz   dz  «      } |||t        |«      dz   dz  «      }|s|sy|s|}n'|s|}n"t        |d   «      t        |d   «      kD  r|}n|}t        |«      t        |«      kD  r	|\  }	}
}}}n|\  }}}	}
}|	|
|||fS )aÄ  Do the two texts share a substring which is at least half the length of
        the longer text?
        This speedup can produce non-minimal diffs.

        Args:
          text1: First string.
          text2: Second string.

        Returns:
          Five element Array, containing the prefix of text1, the suffix of text1,
          the prefix of text2, the suffix of text2 and the common middle.  Or None
          if there was no match.
        r   Nr   r-   c                 óº  •— | ||t        | «      dz  z    }d}|j                  |«      }|dk7  r�‰j                  | |d ||d «      }‰j                  | d| |d| «      }t        |«      ||z   k  r1|||z
  | ||||z    z   }| d||z
   }| ||z   d }	|d||z
   }
|||z   d }|j                  ||dz   «      }|dk7  rŒ�t        |«      dz  t        | «      k\  r	
|fS y)au  Does a substring of shorttext exist within longtext such that the
            substring is at least half the length of longtext?
            Closure, but does not reference any external variables.

            Args:
              longtext: Longer string.
              shorttext: Shorter string.
              i: Start index of quarter length substring within longtext.

            Returns:
              Five element Array, containing the prefix of longtext, the suffix of
              longtext, the prefix of shorttext, the suffix of shorttext and the
              common middle.  Or None if there was no match.
            r   r   r   Nr   r-   )r1   r2   r   r   )r6   r7   r8   ÚseedÚbest_commonÚjÚprefixLengthÚsuffixLengthÚbest_longtext_aÚbest_longtext_bÚbest_shorttext_aÚbest_shorttext_br   s               €r   Údiff_halfMatchIz8diff_match_patch.diff_halfMatch.<locals>.diff_halfMatchIL  sN  ø€ ð ˜A ¤C¨£M°QÑ$6Ñ 6Ð7ˆDØˆKØ—‘˜tÓ$ˆAØ�r’'Ø#×5Ñ5°h¸q¸r°lÀIÈaÈbÀMÓR�Ø#×5Ñ5°h¸rÀ°lÀIÈbÈqÀMÓR�Ü�{Ó# l°\Ñ&AÒAà! ! lÑ"2°QÐ7Ø# A¨¨LÑ(8Ð9ñ:ð  ð '/Ð/A°°\Ñ1AÐ&B�OØ&.¨q°<Ñ/?Ð/AÐ&B�OØ'0Ð1C°1°|Ñ3CÐ'DÐ$Ø'0°°\Ñ1AÐ1CÐ'DÐ$Ø—N‘N 4¨¨Q©Ó/�ð �r“'ô �;Ó !Ñ#¤s¨8£}Ò4à#Ø#Ø$Ø$Øðð ð r   é   r   )r	   r1   )r   r#   r$   r6   r7   rœ   Úhm1Úhm2r9   r:   r;   r<   r=   r>   s   `             r   r3   zdiff_match_patch.diff_halfMatch4  s  ø€ ð ×Ñ Ò!àÜˆu‹:œ˜E›
Ò"Ø%*¨E�y‰Xà%*¨E˜ˆYÜˆx‹=˜1Ò¤ I£°Ñ 2´S¸³]Ò BØô)	ñX ˜h¨	´C¸³MÀAÑ4EÈ!Ñ3KÓLˆá˜h¨	´C¸³MÀAÑ4EÈ!Ñ3KÓLˆÙ™3ØÙØ‰BÙØ‰Bô �3�q‘6‹{œS  Q¡›[Ò(Ø‘à�ô ˆu‹:œ˜E›
Ò"Ø?AÑ<ˆW�g˜w¨±à?AÑ<ˆW�g˜w¨°Ø˜ '¨7°JÐ?Ð?r   c                 ó`  — d}g }d}d}d\  }}d\  }}	|t        |«      k  �rM||   d   | j                  k(  r#|j                  |«       |d}}|	d}	}||   d   }�n ||   d   | j                  k(  r|t        ||   d   «      z  }n|	t        ||   d   «      z  }	|rÀt        |«      t	        ||«      k  r¨t        |«      t	        ||	«      k  r�|j                  |d   | j                  |f«       | j                  ||d   dz      d   f||d   dz   <   |j                  «        t        |«      r|j                  «        t        |«      r|d   }nd}d\  }}d\  }}	d}d}|dz  }|t        |«      k  r�ŒM|r| j                  |«       | j                  |«       d}|t        |«      k  �r‹||dz
     d   | j                  k(  �r\||   d   | j                  k(  �rF||dz
     d   }
||   d   }| j                  |
|«      }| j                  ||
«      }||k\  rƒ|t        |
«      dz  k\  s|t        |«      dz  k\  rã|j                  || j                  |d| f«       | j                  |
dt        |
«      |z
   f||dz
  <   | j                  ||d f||dz   <   |dz  }n‚|t        |
«      dz  k\  s|t        |«      dz  k\  r`|j                  || j                  |
d| f«       | j                  |dt        |«      |z
   f||dz
  <   | j                  |
|d f||dz   <   |dz  }|dz  }|dz  }|t        |«      k  r�ŒŠyy)	z‘Reduce the number of edits by eliminating semantically trivial
        equalities.

        Args:
          diffs: Array of diff tuples.
        FNr   )r   r   r   r   Tg       @)r1   r   r!   r/   ÚmaxÚinsertr0   rE   r"   Údiff_cleanupSemanticLosslessr�   )r   r*   ÚchangesÚ
equalitiesÚlastEqualityrG   Úlength_insertions1Úlength_deletions1Úlength_insertions2Úlength_deletions2ÚdeletionÚ	insertionÚoverlap_length1Úoverlap_length2s                 r   rD   z%diff_match_patch.diff_cleanupSemantic�  sä  € ð ˆØˆ
ØˆØˆà04Ñ-ÐÐ-à04Ñ-ÐÐ-Øœ˜E›
Ó"Ø�W‰~˜aÑ  D§O¡OÒ3Ø×!Ñ! 'Ô*Ø9KÈQÐ$6Ð"Ø7HÈ!Ð#4Ð!Ø$ W™~¨aÑ0’à˜‘> !Ñ$¨×(8Ñ(8Ò8Ø&¬#¨e°G©n¸QÑ.?Ó*@Ñ@Ñ&à%¬¨U°7©^¸AÑ->Ó)?Ñ?Ð%ñ !ä˜LÓ)¬SÐ1CÐEVÓ-WÒWô ˜LÓ)¬SÐ1CÐEVÓ-WÒWð —L‘L ¨B¡°$×2BÑ2BÀLÐ1QÔRð ×(Ñ(Ø˜j¨™n¨qÑ0Ñ1°!Ñ4ð1�E˜* R™.¨1Ñ,Ñ-ð
 —N‘NÔ$ä˜:”Ø"Ÿ™Ô(Ü˜:”Ø",¨R¡.™à"$˜à<@Ñ9Ð&Ð(9Ø<@Ñ9Ð&Ð(9Ø#'�LØ"�GØ�q‰LˆGðW œ˜E›
Ô"ñ\ Ø×"Ñ" 5Ô)Ø×)Ñ)¨%Ô0ð ˆØœ˜E›
Ó"à�g ‘kÑ" 1Ñ%¨×)9Ñ)9Ó9Ø˜'‘N 1Ñ%¨×)9Ñ)9Ó9à  ¨1¡Ñ-¨aÑ0�Ø! '™N¨1Ñ-�	Ø"&×"9Ñ"9¸(ÀIÓ"N�Ø"&×"9Ñ"9¸)ÀXÓ"N�Ø" oÒ5à'¬3¨x«=¸3Ñ+>Ò>Ø*¬c°)«n¸sÑ.BÒBð Ÿ™Ø# d§o¡o°yÐAQÀ/Ð7RÐ%Sôð !×,Ñ,Ø$Ð%F¤s¨8£}°Ñ'FÐGð.˜˜g¨™kÑ*ð
 !×,Ñ,Ø% oÐ&6Ð7ð.˜˜g¨™kÑ*ð   1™™ð (¬3¨x«=¸3Ñ+>Ò>Ø*¬c°)«n¸sÑ.BÒBð Ÿ™Ø# d§o¡o°xÐ@PÀÐ7QÐ%Rôð !×,Ñ,Ø%Ð&H¬¨I«¸Ñ(HÐIð.˜˜g¨™kÑ*ð
 !×,Ñ,Ø$ _Ð%5Ð6ð.˜˜g¨™kÑ*ð   1™˜Ø˜1‘�Ø�q‰LˆGð_ œ˜E›
Ö"r   c                 ó   ‡ — ˆ fd„}d}|t        |«      dz
  k  �rd||dz
     d   ‰ j                  k(  �r2||dz      d   ‰ j                  k(  �r||dz
     d   }||   d   }||dz      d   }‰ j                  ||«      }|r|| d }|d|  }||d|  z   }||z   }|}	|}
|} |||«       |||«      z   }|rU|rS|d   |d   k(  rH||d   z  }|dd |d   z   }|dd } |||«       |||«      z   }||k\  r|}|}	|}
|}|r|r|d   |d   k(  rŒH||dz
     d   |	k7  rO|	r||dz
     d   |	f||dz
  <   n||dz
  = |dz  }||   d   |
f||<   |r||dz      d   |f||dz   <   n||dz   = |dz  }|dz  }|t        |«      dz
  k  r�Œcyy)a	  Look for single edits surrounded on both sides by equalities
        which can be shifted sideways to align the edit to a word boundary.
        e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.

        Args:
          diffs: Array of diff tuples.
        c                 óª  •— | r|sy| d   }|d   }|j                  «        }|j                  «        }|xr |j                  «       }|xr |j                  «       }|xr |dk(  xs |dk(  }|xr |dk(  xs |dk(  }	|xr ‰j                  j                  | «      }
|	xr ‰j                  j                  |«      }|
s|ry|s|	ry|r|s|ry|s|ry	|s|ry
y)a�  Given two strings, compute a score representing whether the
            internal boundary falls on logical boundaries.
            Scores range from 6 (best) to 0 (worst).
            Closure, but does not reference any external variables.

            Args:
              one: First string.
              two: Second string.

            Returns:
              The score.
            é   r   r   úrp   é   r   r�   r-   r   )ÚisalnumÚisspaceÚBLANKLINEENDÚsearchÚBLANKLINESTARTÚmatch)ÚoneÚtwoÚchar1Úchar2ÚnonAlphaNumeric1ÚnonAlphaNumeric2Úwhitespace1Úwhitespace2Ú
lineBreak1Ú
lineBreak2Ú
blankLine1Ú
blankLine2r   s               €r   Údiff_cleanupSemanticScorezPdiff_match_patch.diff_cleanupSemanticLossless.<locals>.diff_cleanupSemanticScore  sñ   ø€ ñ ™càð ˜‘GˆEØ˜‘FˆEØ#(§=¡=£?Ð2ÐØ#(§=¡=£?Ð2ÐØ*Ò>¨u¯}©}«ˆKØ*Ò>¨u¯}©}«ˆKØ$ÒI¨%°4©-Ò*H¸5ÀD¹=ˆJØ$ÒI¨%°4©-Ò*H¸5ÀD¹=ˆJØ#ÒE¨×(9Ñ(9×(@Ñ(@ÀÓ(EˆJØ#ÒF¨×(;Ñ(;×(AÑ(AÀ#Ó(FˆJá™ZàÙ™zàÙ!©+¹+àÙ¡àÙ!Ñ%5àØr   r   r   N)r1   r   r   )r   r*   rÆ   rG   Ú	equality1ÚeditÚ	equality2ÚcommonOffsetÚcommonStringÚbestEquality1ÚbestEditÚbestEquality2Ú	bestScoreÚscores   `             r   r£   z-diff_match_patch.diff_cleanupSemanticLossless  s\  ø€ ô0	ðd ˆàœ˜E›
 Q™Ó&à�g ‘kÑ" 1Ñ%¨¯©Ó8Ø˜' A™+Ñ& qÑ)¨T¯_©_Ó<ð " '¨A¡+Ñ.¨qÑ1�	Ø˜W‘~ aÑ(�Ø! '¨A¡+Ñ.¨qÑ1�	ð  $×5Ñ5°iÀÓF�ÙØ#'¨¨¨Ð#7�LØ )¨.¨L¨=Ð 9�IØ'¨$¨~°°Ð*>Ñ>�DØ ,¨yÑ 8�Ið !*�Ø�Ø )�Ù5Ø˜tóá-¨d°IÓ>ñ?�	ñ ™y¨T°!©W¸	À!¹Ò-DØ  a¡Ñ(�IØ  ˜8 i°¡lÑ2�DØ )¨!¨" �IÙ5Ø! 4óá1°$¸	ÓBñC�Eð  	Ò)Ø$)˜	Ø(1˜Ø#'˜Ø(1˜ñ ™y¨T°!©W¸	À!¹Ó-Dð ˜ 1™Ñ% aÑ(¨MÒ9á$Ø.3°G¸a±KÑ.@ÀÑ.CÀ]Ð-S˜˜g¨™kÒ*à! '¨A¡+Ð.Ø 1™˜Ø&+¨G¡n°QÑ&7¸Ð%B�E˜'‘NÙ$Ø.3°G¸a±KÑ.@ÀÑ.CÀ]Ð-S˜˜g¨™kÒ*à! '¨A¡+Ð.Ø 1™˜Ø�q‰LˆGði œ˜E›
 Q™Ö&r   z\n\r?\n$z^\r?\n\r?\nc                 ó  — d}g }d}d}d}d}d}d}	|t        |«      k  �rU||   d   | j                  k(  rIt        ||   d   «      | j                  k  r"|s|	r|j                  |«       |}|	}||   d   }ng }d}dx}}	nâ||   d   | j                  k(  rd}	nd}|rÆ|r|r|r|	s)t        |«      | j                  dz  k  r£||z   |z   |	z   dk(  r•|j                  |d   | j                  |f«       | j                  ||d   dz      d   f||d   dz   <   |j                  «        d}|r	|rdx}}	g }n2t        |«      r|j                  «        t        |«      r|d   }nd}dx}}	d}|dz  }|t        |«      k  r�ŒU|r| j                  |«       yy)	z’Reduce the number of edits by eliminating operationally trivial
        equalities.

        Args:
          diffs: Array of diff tuples.
        FNr   r   Tr-   r�   r   )	r1   r   r
   r!   r0   r¢   r/   rE   r"   )
r   r*   r¤   r¥   r¦   rG   Úpre_insÚpre_delÚpost_insÚpost_dels
             r   Údiff_cleanupEfficiencyz'diff_match_patch.diff_cleanupEfficiency  sê  € ð ˆØˆ
ØˆØˆØˆØˆØˆØˆØœ˜E›
Ó"Ø�W‰~˜aÑ  D§O¡OÒ3Ü�u˜W‘~ aÑ(Ó)¨D×,>Ñ,>Ò>Ù¡ð ×%Ñ% gÔ.Ø&�GØ&�GØ#(¨¡>°!Ñ#4‘Lð "$�JØ#'�Là&+Ð+�™8à˜‘> !Ñ$¨×(8Ñ(8Ò8Ø#‘Hà#�Hñ  Ù¡©X¹(ä˜\Ó*¨T×-?Ñ-?À!Ñ-CÒCØ$ wÑ.°Ñ9¸HÑDÈÒJð —L‘L ¨B¡°$×2BÑ2BÀLÐ1QÔRð ×(Ñ(Ø˜j¨™n¨qÑ0Ñ1°!Ñ4ð1�E˜* R™.¨1Ñ,Ñ-ð —N‘NÔ$Ø#'�LÙ¡7à.2Ð2˜ 8Ø%'™
ä˜zœ?Ø&ŸN™NÔ,Ü˜zœ?Ø&0°¡n™Gà&(˜GØ.3Ð3˜ 8Ø"�GØ�q‰LˆGðu œ˜E›
Ô"ñx Ø×"Ñ" 5Õ)ð r   c           	      ó  — |j                  | j                  df«       d}d}d}d}d}|t        |«      k  �r$||   d   | j                  k(  r|dz  }|||   d   z  }|dz  }�nè||   d   | j                  k(  r|dz  }|||   d   z  }|dz  }�n¼||   d   | j                  k(  �r¦||z   dkD  �rJ|dk7  rÈ|dk7  rÃ| j                  ||«      }|dk7  ro||z
  |z
  dz
  }|dk\  r/||   d   | j                  k(  r||   d   ||   d   |d| z   f||<   n&|j                  d| j                  |d| f«       |dz  }||d }||d }| j                  ||«      }|dk7  r&||   d   || d ||   d   z   f||<   |d|  }|d|  }g }	t        |«      dk7  r|	j                  | j                  |f«       t        |«      dk7  r|	j                  | j                  |f«       |||z   z  }|	||||z   |z    |t        |	«      dz   z  }nK|dk7  rA||dz
     d   | j                  k(  r)||dz
     d   ||dz
     d   ||   d   z   f||dz
  <   ||= n|dz  }d}d}d}d}|t        |«      k  r�Œ$|d   d   dk(  r|j                  «        d}
d}|t        |«      dz
  k  �rb||dz
     d   | j                  k(  �r1||dz      d   | j                  k(  �r||   d   j                  ||dz
     d   «      rt||dz
     d   dk7  r]||   d   ||dz
     d   ||   d   dt        ||dz
     d   «        z   f||<   ||dz      d   ||dz
     d   ||dz      d   z   f||dz   <   ||dz
  = d}
n„||   d   j                  ||dz      d   «      rd||dz
     d   ||dz
     d   ||dz      d   z   f||dz
  <   ||   d   ||   d   t        ||dz      d   «      d ||dz      d   z   f||<   ||dz   = d}
|dz  }|t        |«      dz
  k  r�Œb|
r| j                  |«       yy)zÂReorder and merge like edit sections.  Merge equalities.
        Any edit section can move as long as it doesn't cross an equality.

        Args:
          diffs: Array of diff tuples.
        r   r   r   Nr   FT)r!   r   r1   r/   r0   r   r¢   r   rE   ÚendswithÚ
startswithr"   )r   r*   rG   rH   rI   rJ   rK   r'   rg   Únew_opsr¤   s              r   r"   z"diff_match_patch.diff_cleanupMergeÍ  sŽ  € ð 	�‰�d—o‘o rÐ*Ô+ØˆØˆØˆØˆØˆØœ˜E›
Ó"Ø�W‰~˜aÑ  D×$4Ñ$4Ò4Ø Ñ!�Ø˜u W™~¨aÑ0Ñ0�Ø˜1‘’Ø�w‘ Ñ" d×&6Ñ&6Ò6Ø Ñ!�Ø˜u W™~¨aÑ0Ñ0�Ø˜1‘’Ø�w‘ Ñ" d§o¡oÓ5à ,Ñ.°Ó2Ø# qÒ(¨\¸QÒ->à'+×'=Ñ'=¸kÈ;Ó'W˜Ø'¨1Ò,Ø '¨,Ñ 6¸Ñ EÈÑ I˜AØ  Ašv¨%°©(°1©+¸¿¹Ò*Hà$)¨!¡H¨Q¡KØ$)¨!¡H¨Q¡K°+¸m¸|Ð2LÑ$Lð,"  a¢ð
 !&§¡Ø$%¨¯©¸À]ÀlÐ9SÐ'Tô!"ð !(¨1¡ Ø*5°l°mÐ*D˜KØ*5°l°mÐ*D˜Kà'+×'=Ñ'=¸kÈ;Ó'W˜Ø'¨1Ò,à % g¡¨qÑ 1Ø +¨\¨M¨NÐ ;¸eÀG¹nÈQÑ>OÑ Oð.˜E '™Nð +6°n¸°}Ð*E˜KØ*5°n¸°}Ð*E˜Kà �GÜ˜;Ó'¨1Ò,ØŸ™¨×(8Ñ(8¸+Ð'FÔGÜ˜;Ó'¨1Ò,ØŸ™¨×(8Ñ(8¸+Ð'FÔGØ˜|¨lÑ:Ñ:�GØMT�E˜' G¨lÑ$:¸\Ñ$IÐJØœs 7›|¨aÑ/Ñ/‘GØ ’\ e¨G°a©KÑ&8¸Ñ&;¸t¿¹Ò&Nð ˜g¨™kÑ*¨1Ñ-Ø˜g¨™kÑ*¨1Ñ-°°g±¸qÑ0AÑAð*�E˜' A™+Ñ&ð ˜g™à˜q‘L�Gà �Ø �Ø �Ø �ðy œ˜E›
Ô"ð| �‰9�Q‰<˜2ÒØ�I‰IŒKð
 ˆØˆàœ˜E›
 Q™Ó&à�g ‘kÑ" 1Ñ%¨¯©Ó8Ø˜' A™+Ñ& qÑ)¨T¯_©_Ó<ð ˜‘> !Ñ$×-Ñ-¨e°G¸a±KÑ.@ÀÑ.CÔDà˜W q™[Ñ)¨!Ñ,°Ò2à! '™N¨1Ñ-Ø! '¨A¡+Ñ.¨qÑ1Ø# G™n¨QÑ/Ð0M´3°u¸WÀq¹[Ñ7IÈ!Ñ7LÓ3MÐ2MÐNñOð*˜˜g™ð " '¨A¡+Ñ.¨qÑ1Ø! '¨A¡+Ñ.¨qÑ1°E¸'ÀA¹+Ñ4FÀqÑ4IÑIð.˜˜g¨™kÑ*ð ˜g¨™kÐ*Ø"‘GØ˜7‘^ AÑ&×1Ñ1°%¸À!¹Ñ2DÀQÑ2GÔHð ˜g¨™kÑ*¨1Ñ-Ø˜g¨™kÑ*¨1Ñ-°°gÀ±kÑ0BÀ1Ñ0EÑEð*�E˜' A™+Ñ&ð
 ˜g™ qÑ)Ø˜g™ qÑ)¬#¨e°G¸a±KÑ.@ÀÑ.CÓ*DÐ*FÐGØ ¨!¡Ñ,¨QÑ/ñ0ð&�E˜'‘Nð
 ˜g¨™kÐ*Ø"�GØ�q‰LˆGðC œ˜E›
 Q™Ô&ñH Ø×"Ñ" 5Õ)ð r   c                 ó8  — d}d}d}d}t        t        |«      «      D ]O  }||   \  }}	|| j                  k7  r|t        |	«      z  }|| j                  k7  r|t        |	«      z  }||kD  r n|}|}ŒQ t        |«      k7  r||   d   | j                  k(  r|S |||z
  z   S )a  loc is a location in text1, compute and return the equivalent location
        in text2.  e.g. "The cat" vs "The big cat", 1->1, 5->8

        Args:
          diffs: Array of diff tuples.
          loc: Location within text1.

        Returns:
          Location within text2.
        r   )rN   r1   r/   r0   )
r   r*   Úlocr|   r}   Úlast_chars1Úlast_chars2rg   Úoprs   s
             r   Údiff_xIndexzdiff_match_patch.diff_xIndexH  sÁ   € ð ˆØˆØˆØˆÜ”s˜5“zÓ"ò 		!ˆAØ˜q™‰JˆR�Ø�T×%Ñ%Ò%Øœ#˜d›)Ñ#�Ø�T×%Ñ%Ò%Øœ#˜d›)Ñ#�Ø˜Š|ÙØ ˆKØ ‰Kð		!ô ˆu‹:˜Š?˜u Q™x¨™{¨d×.>Ñ.>Ò>àÐà˜c KÑ/Ñ0Ð0r   c                 ó¶  — g }|D ]Â  \  }}dt        |«      k(  rŒ|j                  dd«      j                  dd«      j                  dd«      j                  dd	«      }|| j                  k(  r|j                  d
|z  «       Œ{|| j                  k(  r|j                  d|z  «       ŒŸ|| j
                  k(  sŒ¯|j                  d|z  «       ŒÄ dj                  |«      S )zŸConvert a diff array into a pretty HTML report.

        Args:
          diffs: Array of diff tuples.

        Returns:
          HTML representation.
        r   ú&z&amp;ú<z&lt;ú>z&gt;rp   z
&para;<br>z)<ins style="background:#e6ffe6;">%s</ins>z)<del style="background:#ffe6e6;">%s</del>z<span>%s</span>r   )r1   Úreplacer/   r!   r0   r   rr   )r   r*   Úhtmlrß   Údatars   s         r   Údiff_prettyHtmlz diff_match_patch.diff_prettyHtmlh  sÑ   € ð ˆØò 	6‰HˆB�Ø”C˜“IŠ~Øà—‘˜S 'Ó*ß‘˜˜fÓ%ß‘˜˜fÓ%ß‘˜˜|Ó,ð	 ð �T×%Ñ%Ò%Ø—‘ÐGÈ$ÑNÕOØ�t×'Ñ'Ò'Ø—‘ÐGÈ$ÑNÕOØ�t—‘Ó&Ø—‘Ð-°Ñ4Õ5ð	6ð �w‰w�t‹}Ðr   c                 ó~   — g }|D ]&  \  }}|| j                   k7  sŒ|j                  |«       Œ( dj                  |«      S )zªCompute and return the source text (all equalities and deletions).

        Args:
          diffs: Array of diff tuples.

        Returns:
          Source text.
        r   )r/   r!   rr   ©r   r*   rs   rß   rç   s        r   Ú
diff_text1zdiff_match_patch.diff_text1ƒ  óF   € ð ˆØò 	"‰HˆB�Ø�T×%Ñ%Ó%Ø—‘˜DÕ!ð	"ð �w‰w�t‹}Ðr   c                 ó~   — g }|D ]&  \  }}|| j                   k7  sŒ|j                  |«       Œ( dj                  |«      S )zµCompute and return the destination text (all equalities and insertions).

        Args:
          diffs: Array of diff tuples.

        Returns:
          Destination text.
        r   )r0   r!   rr   rê   s        r   Ú
diff_text2zdiff_match_patch.diff_text2’  rì   r   c                 ó  — d}d}d}|D ]d  \  }}|| j                   k(  r|t        |«      z  }Œ$|| j                  k(  r|t        |«      z  }ŒB|| j                  k(  sŒR|t	        ||«      z  }d}d}Œf |t	        ||«      z  }|S )zÒCompute the Levenshtein distance; the number of inserted, deleted or
        substituted characters.

        Args:
          diffs: Array of diff tuples.

        Returns:
          Number of changes.
        r   )r/   r1   r0   r   r¡   )r   r*   ÚlevenshteinÚ
insertionsÚ	deletionsrß   rç   s          r   Údiff_levenshteinz!diff_match_patch.diff_levenshtein¡  sž   € ð ˆØˆ
Øˆ	Øò 		‰HˆB�Ø�T×%Ñ%Ò%Øœc $›iÑ'‘
Ø�t×'Ñ'Ò'ØœS ›YÑ&‘	Ø�t—‘Ó&àœs :¨yÓ9Ñ9�Ø�
Ø‘	ð		ð 	”s˜: yÓ1Ñ1ˆØÐr   c           	      óÞ  — g }|D ]Ö  \  }}|| j                   k(  rD|j                  d«      }|j                  dt        j                  j                  |d«      z   «       ŒY|| j                  k(  r0|j                  dt        |j                  d«      «      dz  z  «       Œ˜|| j                  k(  sŒ¨|j                  dt        |j                  d«      «      dz  z  «       ŒØ dj                  |«      S )	aw  Crush the diff into an encoded string which describes the operations
        required to transform text1 into text2.
        E.g. =3	-2	+ing  -> Keep 3 chars, delete 2 chars, insert 'ing'.
        Operations are tab-separated.  Inserted text is escaped using %xx notation.

        Args:
          diffs: Array of diff tuples.

        Returns:
          Delta text.
        úutf-8ú+ú!~*'();/?:@&=+$,# z-%dú	utf-16-ber-   z=%dú	)
r/   Úencoder!   ÚurllibÚparseÚquoter0   r1   r   rr   rê   s        r   Údiff_toDeltazdiff_match_patch.diff_toDelta»  sÏ   € ð ˆØò 	J‰HˆB�Ø�T×%Ñ%Ò%à—{‘{ 7Ó+�Ø—‘˜C¤&§,¡,×"4Ñ"4°TÐ;OÓ"PÑPÕQØ�t×'Ñ'Ò'Ø—‘˜E¤S¨¯©°[Ó)AÓ%BÀaÑ%GÑHÕIØ�t—‘Ó&Ø—‘˜E¤S¨¯©°[Ó)AÓ%BÀaÑ%GÑHÕIð	Jð �y‰y˜‹Ðr   c                 óÎ  — g }|j                  d«      }d}|j                  d«      }|D ]÷  }|dk(  rŒ	|dd }|d   dk(  r=t        j                  j	                  |«      }|j                  | j                  |f«       ŒS|d   dk(  s|d   d	k(  r…	 t        |«      }	|	dk  rt        d|z   «      ‚||||	dz  z    j                  d«      }
||	dz  z  }|d   d	k(  r|j                  | j                  |
f«       ŒÊ|j                  | j                  |
f«       Œèt        d|d   z   «      ‚ |t        |«      k7  rt        d|t        |«      fz  «      ‚|S # t        $ r t        d
|z   «      ‚w xY w)ab  Given the original text1, and an encoded string which describes the
        operations required to transform text1 into text2, compute the full diff.

        Args:
          text1: Source string for the diff.
          delta: Delta text.

        Returns:
          Array of diff tuples.

        Raises:
          ValueError: If invalid input.
        rø   r   rù   r   r   Nrö   ú-ú=z"Invalid number in diff_fromDelta: z#Negative number in diff_fromDelta: r-   z*Invalid diff operation in diff_fromDelta: z9Delta length (%d) does not equal source text length (%d).)rú   Úsplitrû   rü   Úunquoter!   r/   Úintr   Údecoder   r0   r1   )r   r#   rW   r*   Úas_utf16rG   ÚtokensÚtokenÚparamÚnrs   s              r   Údiff_fromDeltazdiff_match_patch.diff_fromDeltaÓ  s�  € ð ˆØ—<‘< Ó,ˆØˆØ—‘˜TÓ"ˆØò 	ˆEØ˜Š{àð ˜!˜"�IˆEØ�Q‰x˜3ŠÜŸ™×,Ñ,¨UÓ3�Ø—‘˜d×.Ñ.°Ð6Õ7Ø�q‘˜S’ E¨!¡H°¢OðSÜ˜E›
�Að �q’5Ü$Ð%JÈUÑ%RÓSÐSØ ¨'°A¸±E©/Ð:×AÑAÀ+ÓN�Ø˜1˜q™5Ñ �Ø˜‘8˜s’?Ø—L‘L $§/¡/°4Ð!8Õ9à—L‘L $×"2Ñ"2°DÐ!9Õ:ô !Ø@À5ÈÁ8ÑKóð ð3	ð8 ”c˜(“mÒ#ÜØKØœC ›MÐ*ñ+óð ð ˆøô) "ò SÜ$Ð%IÈEÑ%QÓRÐRðSús   ÂEÅE$c           	      óÒ   — |dk(  s|dk(  rt        d«      ‚t        dt        |t        |«      «      «      }||k(  ry|sy|||t        |«      z    |k(  r|S | j	                  |||«      }|S )a  Locate the best instance of 'pattern' in 'text' near 'loc'.

        Args:
          text: The text to search.
          pattern: The pattern to search for.
          loc: The location to search around.

        Returns:
          Best match index or -1.
        NzNull inputs. (match_main)r   r   )r   r¡   rƒ   r1   Úmatch_bitap)r   rs   rŽ   rÜ   r¹   s        r   Ú
match_mainzdiff_match_patch.match_main
  s|   € ð �4Š<˜7 dš?ÜÐ8Ó9Ð9ä�!”S˜œc $›iÓ(Ó)ˆØ�7Š?àÙàØ�#˜œc '›lÑ*Ð+¨wÒ6àˆJð ×$Ñ$ T¨7°CÓ8ˆEØˆLr   c                 óT  ‡ ‡‡— ‰ j                  ‰«      }ˆˆˆ fd„}‰ j                  }|j                  ‰‰«      }|dk7  rIt         |d|«      |«      }|j	                  ‰‰t        ‰«      z   «      }|dk7  rt         |d|«      |«      }dt        ‰«      dz
  z  }d}t        ‰«      t        |«      z   }	d}
t        t        ‰«      «      D �]\  }d}|	}||k  r% ||‰|z   «      |k  r|}n|}	|	|z
  dz  |z   }||k  rŒ%|}	t        d‰|z
  dz   «      }t        ‰|z   t        |«      «      t        ‰«      z   }dg|dz   z  }d|z  dz
  ||dz   <   t        ||dz
  d«      D ]µ  }t        |«      |dz
  k  rd}n|j                  ||dz
     d«      }|dk(  r||dz      dz  dz  |z  ||<   n2||dz      dz  dz  |z  |
|dz      |
|   z  dz  dz  z  |
|dz      z  ||<   ||   |z  sŒ„ |||dz
  «      }||k  sŒ–|}|dz
  }|‰kD  rt        dd‰z  |z
  «      }Œµ n  ||dz   ‰«      |kD  r |S |}
�Œ_ |S )a)  Locate the best instance of 'pattern' in 'text' near 'loc' using the
        Bitap algorithm.

        Args:
          text: The text to search.
          pattern: The pattern to search for.
          loc: The location to search around.

        Returns:
          Best match index or -1.
        c                 ó°   •— t        | «      t        ‰«      z  }t        ‰|z
  «      }‰j                  s
|xr dxs |S ||t        ‰j                  «      z  z   S )aI  Compute and return the score for a match with e errors and x location.
            Accesses loc and pattern through being a closure.

            Args:
              e: Number of errors in match.
              x: Location of match.

            Returns:
              Overall score for match (0.0 = good, 1.0 = bad).
            r   )Úfloatr1   Úabsr   )Úerg   ÚaccuracyÚ	proximityrÜ   rŽ   r   s       €€€r   Úmatch_bitapScorez6diff_match_patch.match_bitap.<locals>.match_bitapScore;  sX   ø€ ô ˜Q“x¤# g£,Ñ.ˆHÜ˜C !™G›ˆIØ×&Ò&à Ò( SÒ4¨HÐ4Ø˜y¬5°×1DÑ1DÓ+EÑEÑFÐFr   r   r   r   Nr-   )	Úmatch_alphabetr   r2   rƒ   Úrfindr1   rN   r¡   Úget)r   rs   rŽ   rÜ   Úsr  Úscore_thresholdÚbest_locÚ	matchmaskÚbin_maxÚlast_rdr]   Úbin_minÚbin_midÚstartÚfinishÚrdr•   Ú	charMatchrÐ   s   ` ``                r   r  zdiff_match_patch.match_bitap(  sÈ  ú€ ð" ×Ñ Ó(ˆö	Gð& ×.Ñ.ˆà—9‘9˜W cÓ*ˆØ�rŠ>Ü!Ñ"2°1°hÓ"?ÀÓQˆOà—z‘z '¨3´°W³Ñ+=Ó>ˆHØ˜2Š~Ü"%Ñ&6°q¸(Ó&CÀ_Ó"U�ð œ#˜g›,¨Ñ*Ñ+ˆ	Øˆä�g“,¤ T£Ñ*ˆàˆÜ”s˜7“|Ó$ó 3	ˆAð ˆGØˆGØ˜GÒ#Ù# A s¨W¡}Ó5¸ÒHØ%‘Gà%�GØ" WÑ,°Ñ2°WÑ<�ð ˜GÓ#ð ˆGÜ˜˜3 ™=¨1Ñ,Ó-ˆEÜ˜˜w™¬¨D«	Ó2´S¸³\ÑAˆFà�˜ ™
Ñ#ˆBØ 1™f¨™\ˆBˆv˜‰z‰NÜ˜6 5¨1¡9¨bÓ1ò "�Ü�t“9  A¡Ò%à !‘Ià !§¡ d¨1¨q©5¡k°1Ó 5�IØ˜’6Ø   Q¡™i¨1™n°Ñ1°YÑ>�B�q’Eð ˜a !™e™9¨™>¨QÑ.°)Ñ;Ø$ Q¨¡U™^¨g°a©jÑ8¸QÑ>À!ÑCñEà! ! a¡%™.ñ)ð �q‘Eð
 �a‘5˜9Ó$Ù,¨Q°°A±Ó6�Eð  Ó/à*/˜Ø#$ q¡5˜Ø# cš>ä$'¨¨1¨s©7°XÑ+=Ó$>™Eñ "ð7"ñ:    A¡ sÓ+¨oÒ=Øàˆð ŠGðg3	ðh ˆr   c                 ó˜   — i }|D ]  }d||<   Œ	 t        t        |«      «      D ]$  }|||   xx   dt        |«      |z
  dz
  z  z  cc<   Œ& |S )z¨Initialise the alphabet for the Bitap algorithm.

        Args:
          pattern: The text to encode.

        Returns:
          Hash of character locations.
        r   r   )rN   r1   )r   rŽ   r  r€   r8   s        r   r  zdiff_match_patch.match_alphabet•  sc   € ð ˆØò 	ˆDØˆAˆdŠGð	ä”s˜7“|Ó$ò 	9ˆAØˆg�a‰j‹M˜Q¤3 w£<°!Ñ#3°aÑ#7Ñ8Ñ8ŒMð	9àˆr   c                 ó  — t        |«      dk(  ry||j                  |j                  |j                  z    }d}|j                  |«      |j	                  |«      k7  rì| j
                  dk(  s2t        |«      | j
                  | j                  z
  | j                  z
  k  r«|| j                  z  }|t        d|j                  |z
  «      |j                  |j                  z   |z    }|j                  |«      |j	                  |«      k7  rC| j
                  dk(  rŒxt        |«      | j
                  | j                  z
  | j                  z
  k  rŒ«|| j                  z  }|t        d|j                  |z
  «      |j                   }|r| j                  |fg|j                  dd ||j                  |j                  z   |j                  |j                  z   |z    }|r'|j                  j                  | j                  |f«       |xj                  t        |«      z  c_        |xj                  t        |«      z  c_        |xj                  t        |«      t        |«      z   z  c_        |xj                  t        |«      t        |«      z   z  c_        y)zÀIncrease the context until it is unique,
        but don't let the pattern expand beyond Match_MaxBits.

        Args:
          patch: The patch to grow.
          text: Source text.
        r   N)r1   Ústart2Úlength1r2   r  r   r   r¡   r   r*   r!   Ústart1Úlength2)r   Úpatchrs   rŽ   ÚpaddingÚprefixÚsuffixs          r   Úpatch_addContextz!diff_match_patch.patch_addContext§  s  € ô ˆt‹9˜Š>ØØ�u—|‘| e§l¡l°U·]±]Ñ&BÐCˆØˆð �i‰i˜Ó  D§J¡J¨wÓ$7Ò7Ø×Ñ !Ò#Ü�7‹|˜d×0Ñ0°4×3DÑ3DÑDÀt×GXÑGXÑXÒXà�t×(Ñ(Ñ(ˆGØÜ�A�u—|‘| gÑ-Ó.°·±ÀÇÁÑ1MÐPWÑ1WðˆGð �i‰i˜Ó  D§J¡J¨wÓ$7Ò7Ø×Ñ !Ó#Ü�7‹|˜d×0Ñ0°4×3DÑ3DÑDÀt×GXÑGXÑXÓXð 	�4×$Ñ$Ñ$ˆð ”c˜!˜UŸ\™\¨GÑ3Ó4°u·|±|ÐDˆÙØ $§¡°Ð8Ð9ˆE�K‰K˜˜ˆOàØ�L‰L˜5Ÿ=™=Ñ(¨5¯<©<¸%¿-¹-Ñ+GÈ'Ñ+Qð
ˆñ Ø�K‰K×Ñ §¡°Ð8Ô9ð 	�Šœ˜F›Ñ#�Ø�Šœ˜F›Ñ#�à�Šœ˜V›¤s¨6£{Ñ2Ñ2�Ø�Šœ˜V›¤s¨6£{Ñ2Ñ2Žr   c                 ó†  — d}d}t        |t        «      rXt        |t        «      rH|€F|}| j                  ||d«      }t        |«      dkD  r²| j	                  |«       | j                  |«       n�t        |t        «      r|€|€|}| j                  |«      }ngt        |t        «      rt        |t        «      r|€|}|}n@t        |t        «      r%t        |t        «      rt        |t        «      r|}|}nt        d«      ‚|sg S g }t        «       }d}d}	|}
|}t        t        |«      «      D �]Z  }||   \  }}t        |j                  «      dk(  r|| j                  k7  r||_        |	|_        || j                  k(  rL|j                  j!                  ||   «       |xj"                  t        |«      z  c_        |d|	 |z   ||	d z   }�n|| j$                  k(  rT|xj&                  t        |«      z  c_        |j                  j!                  ||   «       |d|	 ||	t        |«      z   d z   }n­|| j                  k(  ržt        |«      d| j(                  z  k  rƒt        |j                  «      dk7  rkt        |«      |dz   k7  rZ|j                  j!                  ||   «       |xj&                  t        |«      z  c_        |xj"                  t        |«      z  c_        || j                  k(  rdt        |«      d| j(                  z  k\  rIt        |j                  «      dk7  r1| j+                  ||
«       |j!                  |«       t        «       }|}
|	}|| j                  k7  r|t        |«      z  }|| j$                  k7  s�ŒM|	t        |«      z  }	�Œ] t        |j                  «      dk7  r#| j+                  ||
«       |j!                  |«       |S )a_  Compute a list of patches to turn text1 into text2.
        Use diffs if provided, otherwise compute it ourselves.
        There are four ways to call this function, depending on what data is
        available to the caller:
        Method 1:
        a = text1, b = text2
        Method 2:
        a = diffs
        Method 3 (optimal):
        a = text1, b = diffs
        Method 4 (deprecated, use method 3):
        a = text1, b = text2, c = diffs

        Args:
          a: text1 (methods 1,3,4) or Array of diff tuples for text1 to
              text2 (method 2).
          b: text2 (methods 1,4) or Array of diff tuples for text1 to
              text2 (method 3) or undefined (method 2).
          c: Array of diff tuples for text1 to text2 (method 4) or
              undefined (methods 1,2,3).

        Returns:
          Array of Patch objects.
        NTr-   z"Unknown call format to patch_make.r   r   )Ú
isinstanceÚstrr+   r1   rD   rÖ   Úlistrë   r   Ú	patch_objrN   r*   r   r*  r(  r/   r!   r+  r0   r)  r   r0  )r   ÚaÚbÚcr#   r*   Úpatchesr,  Úchar_count1Úchar_count2Úprepatch_textÚpostpatch_textrg   Ú	diff_typeÚ	diff_texts                  r   Ú
patch_makezdiff_match_patch.patch_makeÓ  sj  € ð2 ˆØˆÜ�aœÔ¤*¨Q´Ô"4¸¸ð ˆEØ—N‘N 5¨!¨TÓ2ˆEÜ�5‹z˜AŠ~Ø×)Ñ)¨%Ô0Ø×+Ñ+¨EÕ2Ü˜œ4Ô  Q Y°1°9ð ˆEØ—O‘O EÓ*‰EÜ˜œ3Ô¤J¨q´$Ô$7¸A¸IàˆEØ‰EÜ˜œ3Ô¤J¨q´#Ô$6¼:ÀaÌÔ;Nð ˆEØ‰EäÐAÓBÐBáØˆIØˆÜ“ˆØˆØˆØˆØˆÜ”s˜5“zÓ"ó 3	.ˆAØ%*¨1¡XÑ"ˆY˜	Ü�5—;‘;Ó 1Ò$¨°d·o±oÒ)Eà*�”Ø*�”Ø˜D×,Ñ,Ò,à—‘×"Ñ" 5¨¡8Ô,Ø—’¤ Y£Ñ/•à" < KÐ0Øñ à$ [ \Ð2ñ3ò ð
 ˜d×.Ñ.Ò.à—’¤ Y£Ñ/•Ø—‘×"Ñ" 5¨¡8Ô,à" < KÐ0Ø$ [´3°y³>Ñ%AÐ%CÐDñEñ ð
 ˜TŸ_™_Ò,Ü˜	“N a¨$×*;Ñ*;Ñ&;Ò;Ü˜Ÿ™Ó$¨Ò)Ü˜“J ! a¡%Ò'ð —‘×"Ñ" 5¨¡8Ô,Ø—’¤ Y£Ñ/•Ø—’¤ Y£Ñ/•à˜DŸO™OÒ+´°I³À!Àd×FWÑFWÑBWÒ0Wä�u—{‘{Ó# qÒ(Ø×)Ñ)¨%°Ô?Ø—N‘N 5Ô)Ü%›K�Eð
 %3�MØ"-�Kð ˜D×,Ñ,Ò,Øœs 9›~Ñ-�Ø˜D×,Ñ,Ô,Øœs 9›~Ñ-’ðg3	.ôl ˆu�{‰{Ó˜qÒ Ø×!Ñ! %¨Ô7Ø�N‰N˜5Ô!Øˆr   c                 óþ   — g }|D ]u  }t        «       }|j                  dd |_        |j                  |_        |j                  |_        |j                  |_        |j
                  |_        |j                  |«       Œw |S )z¹Given an array of patches, return another array that is identical.

        Args:
          patches: Array of Patch objects.

        Returns:
          Array of Patch objects.
        N)r5  r*   r*  r(  r)  r+  r!   )r   r9  ÚpatchesCopyr,  Ú	patchCopys        r   Úpatch_deepCopyzdiff_match_patch.patch_deepCopyJ  st   € ð ˆØò 	*ˆEÜ!›ˆIà#Ÿk™k©!˜nˆIŒOØ$Ÿ|™|ˆIÔØ$Ÿ|™|ˆIÔØ %§¡ˆIÔØ %§¡ˆIÔØ×Ñ˜yÕ)ð	*ð Ðr   c                 ó
  — |s|g fS | j                  |«      }| j                  |«      }||z   |z   }| j                  |«       d}g }|D �]�  }|j                  |z   }| j	                  |j
                  «      }d}	t        |«      | j                  kD  rl| j                  ||d| j                   |«      }
|
dk7  rZ| j                  ||| j                   d |t        |«      z   | j                  z
  «      }	|	dk(  s|
|	k\  rd}
n| j                  |||«      }
|
dk(  r.|j                  d«       ||j                  |j                  z
  z  }Œú|j                  d«       |
|z
  }|	dk(  r||
|
t        |«      z    }n||
|	| j                  z    }||k(  r5|d|
 | j                  |j
                  «      z   ||
t        |«      z   d z   }�Œs| j                  ||d«      }t        |«      | j                  kD  r:| j                  |«      t        t        |«      «      z  | j                   kD  rd|d<   �ŒØ| j#                  |«       d}|j
                  D ]¤  \  }}|| j$                  k7  r| j'                  ||«      }|| j(                  k(  r|d|
z    |z   ||
|z   d z   }n<|| j*                  k(  r-|d|
z    ||
| j'                  ||t        |«      z   «      z   d z   }|| j*                  k7  sŒ—|t        |«      z  }Œ¦ �Œ  |t        |«      t        |«        }||fS )aW  Merge a set of patches onto the text.  Return a patched text, as well
        as a list of true/false values indicating which patches were applied.

        Args:
          patches: Array of Patch objects.
          text: Old text.

        Returns:
          Two element Array, containing the new text and an array of boolean values.
        r   r   NFT)rD  Úpatch_addPaddingÚpatch_splitMaxr(  rë   r*   r1   r   r  r!   r+  r)  rî   r+   ró   r  r   r£   r   rà   r/   r0   )r   r9  rs   ÚnullPaddingrW   Úresultsr,  Úexpected_locr#   Úend_locÚ	start_locr$   r*   Úindex1rß   rç   Úindex2s                    r   Úpatch_applyzdiff_match_patch.patch_apply_  ss  € ñ Ø˜"�:Ðð ×%Ñ% gÓ.ˆà×+Ñ+¨GÓ4ˆØ˜TÑ! KÑ/ˆØ×Ñ˜GÔ$ð ˆØˆØó I	4ˆEØ Ÿ<™<¨%Ñ/ˆLØ—O‘O E§K¡KÓ0ˆEØˆGÜ�5‹z˜D×.Ñ.Ò.ð !ŸO™OØ˜%Ð 4 $×"4Ñ"4Ð5°|ó�	ð  ’?Ø"Ÿo™oØØ˜t×1Ñ1Ð1Ð3Ð4Ø$¤s¨5£zÑ1°D×4FÑ4FÑFó�Gð
  "’}¨	°WÒ(<à$&™	à ŸO™O¨D°%¸ÓF�	Ø˜BŠà—‘˜uÔ%à˜Ÿ™¨¯©Ñ6Ñ6‘ð —‘˜tÔ$Ø! LÑ0�Ø˜b’=Ø  ¨Y¼¸U»Ñ-CÐD‘Eà  ¨W°t×7IÑ7IÑ-IÐJ�EØ˜E’>ð ˜Z˜iÐ(ØŸ/™/¨%¯+©+Ó6ñ7à˜y¬3¨u«:Ñ5Ð7Ð8ñ9ò ð !ŸN™N¨5°%¸Ó?�Eä˜E›
 T×%7Ñ%7Ò7Ø ×1Ñ1°%Ó8¼5ÄÀUÃÓ;LÑLØ×4Ñ4ò5ð ',˜ ›à×9Ñ9¸%Ô@Ø!"˜Ø(-¯©ò 4™H˜B Ø! T§_¡_Ò4Ø)-×)9Ñ)9¸%ÀÓ)H Ø! T×%5Ñ%5Ò5à$(Ð)=¨9°vÑ+=Ð$>Ø&*ñ%+à&*¨9°vÑ+=Ð+?Ð&@ñ%Añ !%ð
 "$ t×'7Ñ'7Ò!7à$(Ð)=¨9°vÑ+=Ð$>Ø&*Ø(1Ø*.×*:Ñ*:¸5À&Ì3ÈtË9ÑBTÓ*Uñ)Vð )Xð'&ñ%&ð !%ð  " T×%5Ñ%5Ó5Ø &¬#¨d«)Ñ 3¡ò%4ðoI	4ðV ”C˜Ó$¬¨KÓ(8Ð'8Ð9ˆØ�gˆÐr   c                 ó  — | j                   }d}t        d|dz   «      D ]  }|t        |«      z  }Œ |D ],  }|xj                  |z  c_        |xj                  |z  c_        Œ. |d   }|j
                  }|r|d   d   | j                  k7  rs|j                  d| j                  |f«       |xj                  |z  c_        |xj                  |z  c_        |xj                  |z  c_        |xj                  |z  c_	        n¦|t        |d   d   «      kD  r’|t        |d   d   «      z
  }|t        |d   d   «      d |d   d   z   }|d   d   |f|d<   |xj                  |z  c_        |xj                  |z  c_        |xj                  |z  c_        |xj                  |z  c_	        |d   }|j
                  }|r|d   d   | j                  k7  rI|j                  | j                  |f«       |xj                  |z  c_        |xj                  |z  c_	        |S |t        |d   d   «      kD  rY|t        |d   d   «      z
  }|d   d   |d| z   }|d   d   |f|d<   |xj                  |z  c_        |xj                  |z  c_	        |S )a  Add some padding on text start and end so that edges can match
        something.  Intended to be called only from within patch_apply.

        Args:
          patches: Array of Patch objects.

        Returns:
          The padding string added to each side.
        r   r   r   Nr   )r   rN   rq   r*  r(  r*   r   r¢   r)  r+  r1   r!   )	r   r9  ÚpaddingLengthrH  rg   r,  r*   ÚextraLengthÚnewTexts	            r   rF  z!diff_match_patch.patch_addPaddingÈ  sf  € ð ×)Ñ)ˆØˆÜ�q˜-¨!Ñ+Ó,ò 	"ˆAØœ3˜q›6Ñ!‰Kð	"ð ò 	*ˆEØ�LŠL˜MÑ)�LØ�LŠL˜MÑ)ŽLð	*ð
 ˜‘
ˆØ—‘ˆÙ˜˜a™ ™ t§¡Ò6à�L‰L˜˜TŸ_™_¨kÐ:Ô;Ø�LŠL˜MÑ)�LØ�LŠL˜MÑ)�LØ�MŠM˜]Ñ*�MØ�MŠM˜]Ñ*ŽMØœS  q¡¨!¡Ó-Ò-à'¬#¨e°A©h°q©kÓ*:Ñ:ˆKØ!¤# e¨A¡h¨q¡kÓ"2Ð"4Ð5¸¸a¹À¹ÑCˆGØ˜a™ ™ WÐ-ˆE�!‰HØ�LŠL˜KÑ'�LØ�LŠL˜KÑ'�LØ�MŠM˜[Ñ(�MØ�MŠM˜[Ñ(�Mð ˜‘ˆØ—‘ˆÙ˜˜b™	 !™¨¯©Ò7à�L‰L˜$Ÿ/™/¨;Ð7Ô8Ø�MŠM˜]Ñ*�MØ�MŠM˜]Ñ*�Mð Ðð œS  r¡¨1¡Ó.Ò.à'¬#¨e°B©i¸©lÓ*;Ñ;ˆKØ˜B‘i ‘l [°°+Ð%>Ñ>ˆGØ˜r™ 1™ wÐ/ˆE�"‰IØ�MŠM˜[Ñ(�MØ�MŠM˜[Ñ(�MàÐr   c                 óÚ	  — | j                   }|dk(  ryt        t        |«      «      D �]Á  }||   j                  |k  rŒ||   }||= |dz  }|j                  }|j
                  }d}t        |j                  «      dk7  sŒWt        «       }d}	|t        |«      z
  |_        |t        |«      z
  |_        |r>t        |«      x|_        |_        |j                  j                  | j                  |f«       t        |j                  «      dk7  �r�|j                  || j                  z
  k  �rr|j                  d   \  }
}|
| j                  k(  rd|xj                  t        |«      z  c_        |t        |«      z  }|j                  j                  |j                  j                  d«      «       d}	�n·|
| j                  k(  r¢t        |j                  «      dk(  rŠ|j                  d   d   | j                  k(  rkt        |«      d|z  kD  rZ|xj                  t        |«      z  c_        |t        |«      z  }d}	|j                  j                  |
|f«       |j                  d= �n|d||j                  z
  | j                  z
   }|xj                  t        |«      z  c_        |t        |«      z  }|
| j                  k(  r-|xj                  t        |«      z  c_        |t        |«      z  }nd}	|j                  j                  |
|f«       ||j                  d   d   k(  r|j                  d= n=|j                  d   d   |j                  d   d   t        |«      d f|j                  d<   t        |j                  «      dk7  r|j                  || j                  z
  k  r�Œr| j                  |j                  «      }|| j                   d }| j!                  |j                  «      d| j                   }|rÉ|xj                  t        |«      z  c_        |xj                  t        |«      z  c_        t        |j                  «      dk7  rN|j                  d   d   | j                  k(  r/| j                  |j                  d   d   |z   f|j                  d<   n'|j                  j                  | j                  |f«       |	s|dz  }|j#                  ||«       t        |j                  «      dk7  r�Œk�ŒÄ y)	zðLook through the patches and break up any which are longer than the
        maximum limit of the match algorithm.
        Intended to be called only from within patch_apply.

        Args:
          patches: Array of Patch objects.
        r   Nr   r   TFr-   r   )r   rN   r1   r)  r*  r(  r*   r5  r+  r!   r   r   r/   rE   r0   rî   rë   r¢   )r   r9  Ú
patch_sizerg   Úbigpatchr*  r(  Ú
precontextr,  Úemptyr>  r?  Úpostcontexts                r   rG  zdiff_match_patch.patch_splitMax  s9  € ð ×'Ñ'ˆ
Ø˜Š?ð Ü”s˜7“|Ó$ó S	-ˆAØ�q‰z×!Ñ! ZÒ/ØØ˜q‘zˆHà˜�
Ø�‰FˆAØ—_‘_ˆFØ—_‘_ˆFØˆJÜ�h—n‘nÓ%¨Ó*ä!›�Ø�Ø%¬¨J«Ñ7�”Ø%¬¨J«Ñ7�”ÙÜ47¸
³OÐC�E”M E¤MØ—K‘K×&Ñ&¨¯©¸Ð'DÔEô ˜Ÿ™Ó'¨1Ó,ØŸ™¨
°T×5FÑ5FÑ(FÓFà-5¯^©^¸AÑ->Ñ*�Y 	Ø  D×$4Ñ$4Ò4àŸš¬¨Y«Ñ7�Ø¤# i£.Ñ0˜ØŸ™×*Ñ*¨8¯>©>×+=Ñ+=¸aÓ+@ÔAØ %šà! T×%5Ñ%5Ò5Ü §¡Ó,°Ò1Ø!ŸK™K¨™N¨1Ñ-°·±Ò@Ü 	›N¨Q°©^Ò;ð Ÿš¬¨Y«Ñ7�Ø¤# i£.Ñ0˜Ø %˜ØŸ™×*Ñ*¨I°yÐ+AÔBØ$ŸN™N¨1Ò-ð %.ØL˜j¨5¯=©=Ñ8¸4×;LÑ;LÑLð%˜	ð Ÿš¬¨Y«Ñ7�Ø¤# i£.Ñ0˜Ø$¨¯©Ò7Ø!ŸMšM¬S°«^Ñ;�MØ"¤c¨)£nÑ4™Fà$)˜EàŸ™×*Ñ*¨I°yÐ+AÔBØ$¨¯©°qÑ(9¸!Ñ(<Ò<Ø (§¡¨qÑ 1ð !)§¡¨qÑ 1°!Ñ 4Ø (§¡¨qÑ 1°!Ñ 4´S¸³^Ð5EÐ Fð1˜HŸN™N¨1Ñ-ôO ˜Ÿ™Ó'¨1Ò,ØŸ™¨
°T×5FÑ5FÑ(FÔFðX "Ÿ_™_¨U¯[©[Ó9�
Ø'¨×):Ñ):Ð(:Ð(<Ð=�
à"Ÿo™o¨h¯n©nÓ=Ð>QÀ×@QÑ@QÐR�ÙØ—M’M¤S¨Ó%5Ñ5•MØ—M’M¤S¨Ó%5Ñ5•MÜ˜5Ÿ;™;Ó'¨1Ò,°·±¸R±ÀÑ1CÀtÇÁÒ1Và ŸO™OØ!ŸK™K¨™O¨AÑ.°Ñ<ð+˜Ÿ™ Bšð
 Ÿ™×*Ñ*¨D¯O©O¸[Ð+IÔJáØ˜‘F�AØ—N‘N 1 eÔ,ôS �h—n‘nÓ%¨Ö*ñS	-r   c                 ój   — g }|D ]  }|j                  t        |«      «       Œ dj                  |«      S )zºTake a list of patches and return a textual representation.

        Args:
          patches: Array of Patch objects.

        Returns:
          Text representation of patches.
        r   )r!   r3  rr   )r   r9  rs   r,  s       r   Úpatch_toTextzdiff_match_patch.patch_toTextd  s6   € ð ˆØò 	$ˆEØ�K‰Kœ˜E›
Õ#ð	$à�w‰w�t‹}Ðr   c                 óx  — g }|s|S |j                  d«      }t        |«      dk7  �r“t        j                  d|d   «      }|st	        d|d   z   «      ‚t        «       }|j                  |«       t        |j                  d«      «      |_	        |j                  d«      dk(  r|xj                  dz  c_	        d|_
        nP|j                  d«      dk(  rd|_
        n4|xj                  dz  c_	        t        |j                  d«      «      |_
        t        |j                  d	«      «      |_        |j                  d
«      dk(  r|xj                  dz  c_        d|_        nP|j                  d
«      dk(  rd|_        n4|xj                  dz  c_        t        |j                  d
«      «      |_        |d= t        |«      dk7  rë|d   r	|d   d   }nd}t        j                  j                  |d   dd «      }|dk(  r(|j                   j                  | j"                  |f«       nw|dk(  r(|j                   j                  | j$                  |f«       nJ|dk(  r(|j                   j                  | j&                  |f«       n|dk(  rn)|dk(  rnt	        d|›d|›�«      ‚|d= t        |«      dk7  rŒët        |«      dk7  r�Œ“|S )a  Parse a textual representation of patches and return a list of patch
        objects.

        Args:
          textline: Text representation of patches.

        Returns:
          Array of Patch objects.

        Raises:
          ValueError: If invalid input.
        rp   r   z$^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$zInvalid patch string: r   r-   r   Ú0r�   r   Nrö   r   ú ú@zInvalid patch mode: 'z'
)r  r1   Úrer¹   r   r5  r!   r  Úgroupr*  r)  r(  r+  rû   rü   r  r*   r/   r0   r   )r   Útextliner9  rs   Úmr,  Úsignrw   s           r   Úpatch_fromTextzdiff_match_patch.patch_fromTextr  sL  € ð ˆÙØˆNØ�~‰~˜dÓ#ˆÜ�$‹i˜1‹nÜ—‘Ð@À$ÀqÁ'ÓJˆAÙÜ Ð!9¸DÀ¹GÑ!CÓDÐDÜ“KˆEØ�N‰N˜5Ô!Ü˜qŸw™w q›z›?ˆEŒLØ�w‰w�q‹z˜RÒØ—’ Ñ!•Ø !�•Ø—‘˜“˜sÒ"Ø !�•à—’ Ñ!•Ü # A§G¡G¨A£J£�”ä˜qŸw™w q›z›?ˆEŒLØ�w‰w�q‹z˜RÒØ—’ Ñ!•Ø !�•Ø—‘˜“˜sÒ"Ø !�•à—’ Ñ!•Ü # A§G¡G¨A£J£�”à�Q�ä�d“)˜q’.Ø˜’7Ø ™7 1™:‘Dà�DÜ—|‘|×+Ñ+¨D°©G°A°B¨KÓ8�Ø˜3’;à—K‘K×&Ñ&¨×(8Ñ(8¸$Ð'?Õ@Ø˜S’[à—K‘K×&Ñ&¨×(8Ñ(8¸$Ð'?Õ@Ø˜S’[à—K‘K×&Ñ&¨¯©¸Ð'>Õ?Ø˜S’[àØ˜R’Zàõ %ÂtÉTÐ%RÓSÐSØ˜�Gô1 �d“)˜q“.ô9 �$‹i˜1Œnðj ˆr   )TN)NN)-Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r0   r/   r   r+   r    r4   r5   rO   rB   rC   r   r   r�   r3   rD   r£   r`  Úcompiler¶   r¸   rÖ   r"   rà   rè   rë   rî   ró   rþ   r  r  r  r  r0  r@  rD  rO  rF  rG  r[  re  © r   r   r   r   "   s  „ ñò
 ðD €KØ€KØ€Jó:òx<8ò|7òrfFòPò2=+ò~4òò8ò>(òTY@òvwòrqðh �2—:‘:˜kÓ*€LØ�R—Z‘Z Ó/€NòL*ò\y*òv1ò@ò6òòò4ò03ònò<kòZò$*3óXuònò*gòR8òt`-òDóFr   r   c                   ó   — e Zd ZdZd„ Zd„ Zy)r5  z'Class representing one patch operation.c                 óJ   — g | _         d| _        d| _        d| _        d| _        y)z(Initializes with an empty list of diffs.Nr   )r*   r*  r(  r)  r+  r   s    r   r   zpatch_obj.__init__¾  s%   € àˆŒ
ØˆŒØˆŒØˆŒØˆ�r   c                 óÀ  — | j                   dk(  rt        | j                  «      dz   }nY| j                   dk(  rt        | j                  dz   «      }n1t        | j                  dz   «      dz   t        | j                   «      z   }| j                  dk(  rt        | j                  «      dz   }nY| j                  dk(  rt        | j                  dz   «      }n1t        | j                  dz   «      dz   t        | j                  «      z   }d|d|dg}| j
                  D ]¶  \  }}|t        j                  k(  r|j                  d«       nI|t        j                  k(  r|j                  d	«       n$|t        j                  k(  r|j                  d
«       |j                  d«      }|j                  t        j                  j                  |d«      dz   «       Œ¸ dj                  |«      S )z­Emulate GNU diff's format.
        Header: @@ -382,8 +481,9 @@
        Indices are printed as 1-based, not 0-based.

        Returns:
          The GNU diff string.
        r   z,0r   ú,z@@ -z +z @@
rö   r   r^  rõ   r÷   rp   r   )r)  r3  r*  r+  r(  r*   r   r/   r!   r0   r   rú   rû   rü   rý   rr   )r   Úcoords1Úcoords2rs   rß   rç   s         r   Ú__str__zpatch_obj.__str__Æ  sƒ  € ð �<‰<˜1ÒÜ˜$Ÿ+™+Ó&¨Ñ-‰GØ�\‰\˜QÒÜ˜$Ÿ+™+¨™/Ó*‰Gä˜$Ÿ+™+¨™/Ó*¨SÑ0´3°t·|±|Ó3DÑDˆGØ�<‰<˜1ÒÜ˜$Ÿ+™+Ó&¨Ñ-‰GØ�\‰\˜QÒÜ˜$Ÿ+™+¨™/Ó*‰Gä˜$Ÿ+™+¨™/Ó*¨SÑ0´3°t·|±|Ó3DÑDˆGØ˜  w°Ð8ˆàŸ
™
ò 		O‰HˆB�ØÔ%×1Ñ1Ò1Ø—‘˜CÕ ØÔ'×3Ñ3Ò3Ø—‘˜CÕ ØÔ'×2Ñ2Ò2Ø—‘˜CÔ à—;‘;˜wÓ'ˆDØ�K‰KœŸ™×*Ñ*¨4Ð1EÓFÈÑMÕNð		Oð �w‰w�t‹}Ðr   N)rf  rg  rh  ri  r   rr  rk  r   r   r5  r5  »  s   „ Ù1òó r   r5  )	ri  Ú
__author__r`  r   r   Úurllib.parserû   r   r5  rk  r   r   ú<module>ru     s9   ðñð"ð /€
ã 	Û 
Û Û ÷Vñ V÷r<+ò +r   