�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`�
Warning: session_start(): Session cannot be started after headers have already been sent in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 124

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 131

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 132

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 134

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 135

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 547

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 548

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 549

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 550

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 551
raisePhpLimits = (bool) $raisePhpLimits; $this->memoryLimit = 128 * 1048576; // 128MB in bytes $this->pcreBacktrackLimit = 1000 * 1000; $this->pcreRecursionLimit = 500 * 1000; $this->hexToNamedColorsMap = Colors::getHexToNamedMap(); $this->namedToHexColorsMap = Colors::getNamedToHexMap(); $this->namedToHexColorsRegex = sprintf( '/([:,( ])(%s)( |,|\)|;|$)/Si', implode('|', array_keys($this->namedToHexColorsMap)) ); $this->numRegex = sprintf('-?\d*\.?\d+%s?', $this->unitsGroupRegex); $this->setShortenZeroValuesRegexes(); } /** * Parses & minifies the given input CSS string * @param string $css * @return string */ public function run($css = '') { if (empty($css) || !is_string($css)) { return ''; } $this->resetRunProperties(); if ($this->raisePhpLimits) { $this->doRaisePhpLimits(); } return $this->minify($css); } /** * Sets whether to keep or remove sourcemap special comment. * Sourcemap comments are removed by default. * @param bool $keepSourceMapComment */ public function keepSourceMapComment($keepSourceMapComment = true) { $this->keepSourceMapComment = (bool) $keepSourceMapComment; } /** * Sets whether to keep or remove important comments. * Important comments outside of a declaration block are kept by default. * @param bool $removeImportantComments */ public function removeImportantComments($removeImportantComments = true) { $this->keepImportantComments = !(bool) $removeImportantComments; } /** * Sets the approximate column after which long lines will be splitted in the output * with a linebreak. * @param int $position */ public function setLineBreakPosition($position) { $this->linebreakPosition = (int) $position; } /** * Sets the memory limit for this script * @param int|string $limit */ public function setMemoryLimit($limit) { $this->memoryLimit = Utils::normalizeInt($limit); } /** * Sets the maximum execution time for this script * @param int|string $seconds */ public function setMaxExecutionTime($seconds) { $this->maxExecutionTime = (int) $seconds; } /** * Sets the PCRE backtrack limit for this script * @param int $limit */ public function setPcreBacktrackLimit($limit) { $this->pcreBacktrackLimit = (int) $limit; } /** * Sets the PCRE recursion limit for this script * @param int $limit */ public function setPcreRecursionLimit($limit) { $this->pcreRecursionLimit = (int) $limit; } /** * Builds regular expressions needed for shortening zero values */ private function setShortenZeroValuesRegexes() { $zeroRegex = '0'. $this->unitsGroupRegex; $numOrPosRegex = '('. $this->numRegex .'|top|left|bottom|right|center) '; $oneZeroSafeProperties = array( '(?:line-)?height', '(?:(?:min|max)-)?width', 'top', 'left', 'background-position', 'bottom', 'right', 'border(?:-(?:top|left|bottom|right))?(?:-width)?', 'border-(?:(?:top|bottom)-(?:left|right)-)?radius', 'column-(?:gap|width)', 'margin(?:-(?:top|left|bottom|right))?', 'outline-width', 'padding(?:-(?:top|left|bottom|right))?' ); // First zero regex $regex = '/(^|;)('. implode('|', $oneZeroSafeProperties) .'):%s/Si'; $this->shortenOneZeroesRegex = sprintf($regex, $zeroRegex); // Multiple zeroes regexes $regex = '/(^|;)(margin|padding|border-(?:width|radius)|background-position):%s/Si'; $this->shortenTwoZeroesRegex = sprintf($regex, $numOrPosRegex . $zeroRegex); $this->shortenThreeZeroesRegex = sprintf($regex, $numOrPosRegex . $numOrPosRegex . $zeroRegex); $this->shortenFourZeroesRegex = sprintf($regex, $numOrPosRegex . $numOrPosRegex . $numOrPosRegex . $zeroRegex); } /** * Resets properties whose value may change between runs */ private function resetRunProperties() { $this->comments = array(); $this->ruleBodies = array(); $this->preservedTokens = array(); } /** * Tries to configure PHP to use at least the suggested minimum settings * @return void */ private function doRaisePhpLimits() { $phpLimits = array( 'memory_limit' => $this->memoryLimit, 'max_execution_time' => $this->maxExecutionTime, 'pcre.backtrack_limit' => $this->pcreBacktrackLimit, 'pcre.recursion_limit' => $this->pcreRecursionLimit ); // If current settings are higher respect them. foreach ($phpLimits as $name => $suggested) { $current = Utils::normalizeInt(ini_get($name)); if ($current >= $suggested) { continue; } // memoryLimit exception: allow -1 for "no memory limit". if ($name === 'memory_limit' && $current === -1) { continue; } // maxExecutionTime exception: allow 0 for "no memory limit". if ($name === 'max_execution_time' && $current === 0) { continue; } ini_set($name, $suggested); } } /** * Registers a preserved token * @param string $token * @return string The token ID string */ private function registerPreservedToken($token) { $tokenId = sprintf(self::PRESERVED_TOKEN, count($this->preservedTokens)); $this->preservedTokens[$tokenId] = $token; return $tokenId; } /** * Registers a candidate comment token * @param string $comment * @return string The comment token ID string */ private function registerCommentToken($comment) { $tokenId = sprintf(self::COMMENT_TOKEN, count($this->comments)); $this->comments[$tokenId] = $comment; return $tokenId; } /** * Registers a rule body token * @param string $body the minified rule body * @return string The rule body token ID string */ private function registerRuleBodyToken($body) { if (empty($body)) { return ''; } $tokenId = sprintf(self::RULE_BODY_TOKEN, count($this->ruleBodies)); $this->ruleBodies[$tokenId] = $body; return $tokenId; } /** * Parses & minifies the given input CSS string * @param string $css * @return string */ private function minify($css) { // Process data urls $css = $this->processDataUrls($css); // Process comments $css = preg_replace_callback( '/(?processComments($css); // Process rule bodies $css = $this->processRuleBodies($css); // Process at-rules and selectors $css = $this->processAtRulesAndSelectors($css); // Restore preserved rule bodies before splitting $css = strtr($css, $this->ruleBodies); // Split long lines in output if required $css = $this->processLongLineSplitting($css); // Restore preserved comments and strings $css = strtr($css, $this->preservedTokens); return trim($css); } /** * Searches & replaces all data urls with tokens before we start compressing, * to avoid performance issues running some of the subsequent regexes against large string chunks. * @param string $css * @return string */ private function processDataUrls($css) { $ret = ''; $searchOffset = $substrOffset = 0; // Since we need to account for non-base64 data urls, we need to handle // ' and ) being part of the data string. while (preg_match('/url\(\s*(["\']?)data:/Si', $css, $m, PREG_OFFSET_CAPTURE, $searchOffset)) { $matchStartIndex = $m[0][1]; $dataStartIndex = $matchStartIndex + 4; // url( length $searchOffset = $matchStartIndex + strlen($m[0][0]); $terminator = $m[1][0]; // ', " or empty (not quoted) $terminatorRegex = '/(?registerPreservedToken(trim($token)) .')'; // No end terminator found, re-add the whole match. Should we throw/warn here? } else { $ret .= substr($css, $matchStartIndex, $searchOffset - $matchStartIndex); } $substrOffset = $searchOffset; } $ret .= substr($css, $substrOffset); return $ret; } /** * Registers all comments found as candidates to be preserved. * @param array $matches * @return string */ private function processCommentsCallback($matches) { return '/*'. $this->registerCommentToken($matches[1]) .'*/'; } /** * Preserves old IE Matrix string definition * @param array $matches * @return string */ private function processOldIeSpecificMatrixDefinitionCallback($matches) { return 'filter:progid:DXImageTransform.Microsoft.Matrix('. $this->registerPreservedToken($matches[1]) .')'; } /** * Preserves strings found * @param array $matches * @return string */ private function processStringsCallback($matches) { $match = $matches[0]; $quote = substr($match, 0, 1); $match = substr($match, 1, -1); // maybe the string contains a comment-like substring? // one, maybe more? put'em back then if (strpos($match, self::COMMENT_TOKEN_START) !== false) { $match = strtr($match, $this->comments); } // minify alpha opacity in filter strings $match = str_ireplace('progid:DXImageTransform.Microsoft.Alpha(Opacity=', 'alpha(opacity=', $match); return $quote . $this->registerPreservedToken($match) . $quote; } /** * Searches & replaces all import at-rule unquoted urls with tokens so URI reserved characters such as a semicolon * may be used safely in a URL. * @param array $matches * @return string */ private function processImportUnquotedUrlAtRulesCallback($matches) { return '@import url('. $this->registerPreservedToken($matches[1]) .')'. $matches[2]; } /** * Preserves or removes comments found. * @param string $css * @return string */ private function processComments($css) { foreach ($this->comments as $commentId => $comment) { $commentIdString = '/*'. $commentId .'*/'; // ! in the first position of the comment means preserve // so push to the preserved tokens keeping the ! if ($this->keepImportantComments && strpos($comment, '!') === 0) { $preservedTokenId = $this->registerPreservedToken($comment); // Put new lines before and after /*! important comments $css = str_replace($commentIdString, "\n/*$preservedTokenId*/\n", $css); continue; } // # sourceMappingURL= in the first position of the comment means sourcemap // so push to the preserved tokens if {$this->keepSourceMapComment} is truthy. if ($this->keepSourceMapComment && strpos($comment, '# sourceMappingURL=') === 0) { $preservedTokenId = $this->registerPreservedToken($comment); // Add new line before the sourcemap comment $css = str_replace($commentIdString, "\n/*$preservedTokenId*/", $css); continue; } // Keep empty comments after child selectors (IE7 hack) // e.g. html >/**/ body if (strlen($comment) === 0 && strpos($css, '>/*'.$commentId) !== false) { $css = str_replace($commentId, $this->registerPreservedToken(''), $css); continue; } // in all other cases kill the comment $css = str_replace($commentIdString, '', $css); } // Normalize whitespace again $css = preg_replace('/ +/S', ' ', $css); return $css; } /** * Finds, minifies & preserves all rule bodies. * @param string $css the whole stylesheet. * @return string */ private function processRuleBodies($css) { $ret = ''; $searchOffset = $substrOffset = 0; while (($blockStartPos = strpos($css, '{', $searchOffset)) !== false) { $blockEndPos = strpos($css, '}', $blockStartPos); $nextBlockStartPos = strpos($css, '{', $blockStartPos + 1); $ret .= substr($css, $substrOffset, $blockStartPos - $substrOffset); if ($nextBlockStartPos !== false && $nextBlockStartPos < $blockEndPos) { $ret .= substr($css, $blockStartPos, $nextBlockStartPos - $blockStartPos); $searchOffset = $nextBlockStartPos; } else { $ruleBody = substr($css, $blockStartPos + 1, $blockEndPos - $blockStartPos - 1); $ruleBodyToken = $this->registerRuleBodyToken($this->processRuleBody($ruleBody)); $ret .= '{'. $ruleBodyToken .'}'; $searchOffset = $blockEndPos + 1; } $substrOffset = $searchOffset; } $ret .= substr($css, $substrOffset); return $ret; } /** * Compresses non-group rule bodies. * @param string $body The rule body without curly braces * @return string */ private function processRuleBody($body) { $body = trim($body); // Remove spaces before the things that should not have spaces before them. $body = preg_replace('/ ([:=,)*\/;\n])/S', '$1', $body); // Remove the spaces after the things that should not have spaces after them. $body = preg_replace('/([:=,(*\/!;\n]) /S', '$1', $body); // Replace multiple semi-colons in a row by a single one $body = preg_replace('/;;+/S', ';', $body); // Remove semicolon before closing brace except when: // - The last property is prefixed with a `*` (lte IE7 hack) to avoid issues on Symbian S60 3.x browsers. if (!preg_match('/\*[a-z0-9-]+:[^;]+;$/Si', $body)) { $body = rtrim($body, ';'); } // Remove important comments inside a rule body (because they make no sense here). if (strpos($body, '/*') !== false) { $body = preg_replace('/\n?\/\*[A-Z0-9_]+\*\/\n?/S', '', $body); } // Empty rule body? Exit :) if (empty($body)) { return ''; } // Shorten font-weight values $body = preg_replace( array('/(font-weight:)bold\b/Si', '/(font-weight:)normal\b/Si'), array('${1}700', '${1}400'), $body ); // Shorten background property $body = preg_replace('/(background:)(?:none|transparent)( !|;|$)/Si', '${1}0 0$2', $body); // Shorten opacity IE filter $body = str_ireplace('progid:DXImageTransform.Microsoft.Alpha(Opacity=', 'alpha(opacity=', $body); // Shorten colors from rgb(51,102,153) to #336699, rgb(100%,0%,0%) to #ff0000 (sRGB color space) // Shorten colors from hsl(0, 100%, 50%) to #ff0000 (sRGB color space) // This makes it more likely that it'll get further compressed in the next step. $body = preg_replace_callback( '/(rgb|hsl)\(([0-9,.% -]+)\)(.|$)/Si', array($this, 'shortenHslAndRgbToHexCallback'), $body ); // Shorten colors from #AABBCC to #ABC or shorter color name: // - Look for hex colors which don't have a "=" in front of them (to avoid MSIE filters) $body = preg_replace_callback( '/(? #fff. // Run at least 2 times to cover most cases $body = preg_replace_callback( array($this->namedToHexColorsRegex, $this->namedToHexColorsRegex), array($this, 'shortenNamedColorsCallback'), $body ); // Replace positive sign from numbers before the leading space is removed. // +1.2em to 1.2em, +.8px to .8px, +2% to 2% $body = preg_replace('/([ :,(])\+(\.?\d+)/S', '$1$2', $body); // shorten ms to s $body = preg_replace_callback('/([ :,(])(-?)(\d{3,})ms/Si', function ($matches) { return $matches[1] . $matches[2] . ((int) $matches[3] / 1000) .'s'; }, $body); // Remove leading zeros from integer and float numbers. // 000.6 to .6, -0.8 to -.8, 0050 to 50, -01.05 to -1.05 $body = preg_replace('/([ :,(])(-?)0+([1-9]?\.?\d+)/S', '$1$2$3', $body); // Remove trailing zeros from float numbers. // -6.0100em to -6.01em, .0100 to .01, 1.200px to 1.2px $body = preg_replace('/([ :,(])(-?\d?\.\d+?)0+([^\d])/S', '$1$2$3', $body); // Remove trailing .0 -> -9.0 to -9 $body = preg_replace('/([ :,(])(-?\d+)\.0([^\d])/S', '$1$2$3', $body); // Replace 0 length numbers with 0 $body = preg_replace('/([ :,(])-?\.?0+([^\d])/S', '${1}0$2', $body); // Shorten zero values for safe properties only $body = preg_replace( array( $this->shortenOneZeroesRegex, $this->shortenTwoZeroesRegex, $this->shortenThreeZeroesRegex, $this->shortenFourZeroesRegex ), array( '$1$2:0', '$1$2:$3 0', '$1$2:$3 $4 0', '$1$2:$3 $4 $5 0' ), $body ); // Replace 0 0 0; or 0 0 0 0; with 0 0 for background-position property. $body = preg_replace('/(background-position):0(?: 0){2,3}( !|;|$)/Si', '$1:0 0$2', $body); // Shorten suitable shorthand properties with repeated values $body = preg_replace( array( '/(margin|padding|border-(?:width|radius)):('.$this->numRegex.')(?: \2)+( !|;|$)/Si', '/(border-(?:style|color)):([#a-z0-9]+)(?: \2)+( !|;|$)/Si' ), '$1:$2$3', $body ); $body = preg_replace( array( '/(margin|padding|border-(?:width|radius)):'. '('.$this->numRegex.') ('.$this->numRegex.') \2 \3( !|;|$)/Si', '/(border-(?:style|color)):([#a-z0-9]+) ([#a-z0-9]+) \2 \3( !|;|$)/Si' ), '$1:$2 $3$4', $body ); $body = preg_replace( array( '/(margin|padding|border-(?:width|radius)):'. '('.$this->numRegex.') ('.$this->numRegex.') ('.$this->numRegex.') \3( !|;|$)/Si', '/(border-(?:style|color)):([#a-z0-9]+) ([#a-z0-9]+) ([#a-z0-9]+) \3( !|;|$)/Si' ), '$1:$2 $3 $4$5', $body ); // Lowercase some common functions that can be values $body = preg_replace_callback( '/(?:attr|blur|brightness|circle|contrast|cubic-bezier|drop-shadow|ellipse|from|grayscale|'. 'hsla?|hue-rotate|inset|invert|local|minmax|opacity|perspective|polygon|rgba?|rect|repeat|saturate|sepia|'. 'steps|to|url|var|-webkit-gradient|'. '(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?(?:calc|(?:repeating-)?(?:linear|radial)-gradient))\(/Si', array($this, 'strtolowerCallback'), $body ); // Lowercase all uppercase properties $body = preg_replace_callback('/(?:^|;)[A-Z-]+:/S', array($this, 'strtolowerCallback'), $body); return $body; } /** * Compresses At-rules and selectors. * @param string $css the whole stylesheet with rule bodies tokenized. * @return string */ private function processAtRulesAndSelectors($css) { $charset = ''; $imports = ''; $namespaces = ''; // Remove spaces before the things that should not have spaces before them. $css = preg_replace('/ ([@{};>+)\]~=,\/\n])/S', '$1', $css); // Remove the spaces after the things that should not have spaces after them. $css = preg_replace('/([{}:;>+(\[~=,\/\n]) /S', '$1', $css); // Shorten shortable double colon (CSS3) pseudo-elements to single colon (CSS2) $css = preg_replace('/::(before|after|first-(?:line|letter))(\{|,)/Si', ':$1$2', $css); // Retain space for special IE6 cases $css = preg_replace_callback('/:first-(line|letter)(\{|,)/Si', function ($matches) { return ':first-'. strtolower($matches[1]) .' '. $matches[2]; }, $css); // Find a fraction that may used in some @media queries such as: (min-aspect-ratio: 1/1) // Add token to add the "/" back in later $css = preg_replace('/\(([a-z-]+):([0-9]+)\/([0-9]+)\)/Si', '($1:$2'. self::QUERY_FRACTION .'$3)', $css); // Remove empty rule blocks up to 2 levels deep. $css = preg_replace(array_fill(0, 2, '/(\{)[^{};\/\n]+\{\}/S'), '$1', $css); $css = preg_replace('/[^{};\/\n]+\{\}/S', '', $css); // Two important comments next to each other? Remove extra newline. if ($this->keepImportantComments) { $css = str_replace("\n\n", "\n", $css); } // Restore fraction $css = str_replace(self::QUERY_FRACTION, '/', $css); // Lowercase some popular @directives $css = preg_replace_callback( '/(?charsetRegex, $css, $matches)) { // Keep the first @charset at-rule found $charset = $matches[0]; // Delete all @charset at-rules $css = preg_replace($this->charsetRegex, '', $css); } // @import handling $css = preg_replace_callback($this->importRegex, function ($matches) use (&$imports) { // Keep all @import at-rules found for later $imports .= $matches[0]; // Delete all @import at-rules return ''; }, $css); // @namespace handling $css = preg_replace_callback($this->namespaceRegex, function ($matches) use (&$namespaces) { // Keep all @namespace at-rules found for later $namespaces .= $matches[0]; // Delete all @namespace at-rules return ''; }, $css); // Order critical at-rules: // 1. @charset first // 2. @imports below @charset // 3. @namespaces below @imports $css = $charset . $imports . $namespaces . $css; return $css; } /** * Splits long lines after a specific column. * * Some source control tools don't like it when files containing lines longer * than, say 8000 characters, are checked in. The linebreak option is used in * that case to split long lines after a specific column. * * @param string $css the whole stylesheet. * @return string */ private function processLongLineSplitting($css) { if ($this->linebreakPosition > 0) { $l = strlen($css); $offset = $this->linebreakPosition; while (preg_match('/(?linebreakPosition; $l += 1; if ($offset > $l) { break; } } } return $css; } /** * Converts hsl() & rgb() colors to HEX format. * @param $matches * @return string */ private function shortenHslAndRgbToHexCallback($matches) { $type = $matches[1]; $values = explode(',', $matches[2]); $terminator = $matches[3]; if ($type === 'hsl') { $values = Utils::hslToRgb($values); } $hexColors = Utils::rgbToHex($values); // Restore space after rgb() or hsl() function in some cases such as: // background-image: linear-gradient(to bottom, rgb(210,180,140) 10%, rgb(255,0,0) 90%); if (!empty($terminator) && !preg_match('/[ ,);]/S', $terminator)) { $terminator = ' '. $terminator; } return '#'. implode('', $hexColors) . $terminator; } /** * Compresses HEX color values of the form #AABBCC to #ABC or short color name. * @param $matches * @return string */ private function shortenHexColorsCallback($matches) { $hex = $matches[1]; // Shorten suitable 6 chars HEX colors if (strlen($hex) === 6 && preg_match('/^([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3$/Si', $hex, $m)) { $hex = $m[1] . $m[2] . $m[3]; } // Lowercase $hex = '#'. strtolower($hex); // Replace Hex colors with shorter color names $color = array_key_exists($hex, $this->hexToNamedColorsMap) ? $this->hexToNamedColorsMap[$hex] : $hex; return $color . $matches[2]; } /** * Shortens all named colors with a shorter HEX counterpart for a set of safe properties * e.g. white -> #fff * @param array $matches * @return string */ private function shortenNamedColorsCallback($matches) { return $matches[1] . $this->namedToHexColorsMap[strtolower($matches[2])] . $matches[3]; } /** * Makes a string lowercase * @param array $matches * @return string */ private function strtolowerCallback($matches) { return strtolower($matches[0]); } }