
    hb                    \    d dl mZ d dlZd dlmZ ej                  rd dlmZ  G d d      Z	y)    )annotationsN)Locale)Durationc                  <    e Zd ZdZdddZ	 	 	 d	 	 	 	 	 	 	 	 	 ddZy)	DifferenceFormatterz1
    Handles formatting differences in text.
    c                8    t        j                  |      | _        y )N)r   load_locale)selflocales     s/var/www/html/retail-simulation-api/retail/lib/python3.12/site-packages/pendulum/formatting/difference_formatter.py__init__zDifferenceFormatter.__init__   s    {{6*    Nc                   || j                   nt        j                  |      }|j                  dkD  r%d}|j                  }|j                  dkD  r|dz  }n|j                  dk(  r%|j
                  dz  |j                  z   dkD  rd}d}n|j                  dkD  r5d}|j                  }|j
                  dz  |j                  z   d	k\  rr|dz  }nk|j
                  dkD  r%d
}|j
                  }|j                  dkD  r>|dz  }n7|j                  dkD  r%d}|j                  }|j                  dk\  r
|dz  }n|j                  dkD  rd}|j                  }n|j                  dkD  rd}|j                  }nd|j                  cxk  rdk  rn nd}|j                  }n|j                  d      }||rt        j                  t        |      S d}|j                  }	|r|	r|dz  }n|dz  }n|	r|dz  }n|dz  }t        j                  t        |j                  |      j                  |            S d}|j                  }|dk(  rd}|rd| }n|j                  }	|rd| }|	r|dz  }n|dz  }nd}|	r
|d| dz  }n	|d| dz  }|j                  |      }
|
s8d| d|j!                  |       }|j                  |      j                  |      }n#|
|j!                  |         j                  |      }d}|	r|dz  }n|dz  }t        j                  t        |j                  |      j                  |            S |d|j!                  |       z  }t        j                  t        |j                  |      j                  |            S )z
        Formats a difference.

        :param diff: The difference to format
        :param is_now: Whether the difference includes now
        :param absolute: Whether it's an absolute difference or not
        :param locale: The locale to use
        r   year               month   week   day   hourminute
   ;   secondzcustom.units.few_secondcustomz	.from_nowz.agoz.afterz.beforeztranslations.units.ztranslations.relative.z.futurez.pastzcustom.units_relative.)r
   r   r	   yearsmonthsweeksremaining_dayshoursminutesremaining_secondsgettcaststrinvertformatplural)r   diffis_nowabsoluter   unitcounttimekey	is_futuretranss              r   r0   zDifferenceFormatter.format   se    "(V[[5H::>DJJE{{Q
[[BDJJNT5H5H$HB#NDE[[1_DKKE

Q!4!44;
ZZ!^DJJE""Q&
  1$D''EzzR
ZZ!^DJJE\\ADLLE$((.B.D**E ::78D66#t,, KK	 {*v xy(vvc6::c?#9#9$#?@@..A:E'v.CI /tf59$C7NC .QtfG,,CQtfE?*C

3/vQv}}U7K6LMC!::c?11%8D u!56==eDD8OC9$Cvvc6::c?#9#9$#?@@6=='())vvc6::c?11%899r   )en)r   r.   returnNone)TFN)
r2   r   r3   boolr4   r>   r   zstr | Locale | Noner<   r.   )__name__
__module____qualname____doc__r   r0    r   r   r   r      sR    + &*|:|: |: 	|:
 $|: 
|:r   r   )

__future__r   typingr,   pendulum.locales.localer   TYPE_CHECKINGpendulumr   r   rC   r   r   <module>rI      s&    "  * ??!D: D:r   