8 códigos para extender las funcionalidades de WordPress

Hace mucho tiempo que no os pongo por aquí códigos para agregar nuevas funcionalidades a tu sitio web desarrollado con WordPress. En este ocasión te traigo 8 snippets que te vendrán de perlas, si lo que quieres es tener nuevas características en tu CMS. Por regla general, tendrás que agregar los códigos en el archivo functions.php del tema actual, y los que no, te lo indico igualmente.

Shortcode para mostrar archivos externos

Si debes mostrar el contenido de ficheros externos dentro de tus posts y páginas, puedes hacerlo mediante un shortcode. Para ello introduce el siguiente código dentro del functions.php de tu tema.

function show_file_func( $atts ) {
 extract( shortcode_atts( array(
 'file' => ''
 ), $atts ) );
 
 if ($file!='')
 return @file_get_contents($file);
}
 
add_shortcode( 'show_file', 'show_file_func' );

Así es cómo se utilizaría el shortcode.

[show_file file="https://google.com"]

Eliminar la imagen destacada cuando elimines un post

Este código hará que se elimine la imagen destacada asociada a un post, cuando el post en cuestión se elimine. Inserta este código dentro del fichero functions.php del tema.

add_action( 'before_delete_post', 'wps_remove_attachment_with_post', 10 );
function wps_remove_attachment_with_post($post_id) {
 if(has_post_thumbnail( $post_id ))
 {
 $attachment_id = get_post_thumbnail_id( $post_id );
 wp_delete_attachment($attachment_id, true);
 }
}

Definir una imagen por defecto para tus imágenes destacadas

Este código te permite definir una imagen por defecto para aquellos posts en los que no hayas añadido una imagen por defecto.

Debes pegar este código en donde quieres mostrar la imagen destacada, o si no la hay, la imagen por defecto. Por regla general, tendrás que agregarlo al index.php o al single.php. Edita la línea 4 y reemplaza la URL con la URL de tu imagen por defecto.

https://seox.es/wp-content/uploads/2017/10/unnamed-file-c.jpg if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else { ?>
https://seox.es/wp-content/uploads/2017/10/unnamed-file-c.jpg the_title(); ?>
https://seox.es/wp-content/uploads/2017/10/unnamed-file-c.jpg } ?>

Mover los scripts y las hojas de estilo al footer

Si lo que quieres es mejorar la velocidad de carga de tu sitio web, una muy buena idea es la de mover los scripts y las hojas de estilo al footer. En este ejemplo puedes ver cómo hacerlo en WordPress, pero cualquier desarrollador con un poco de experiencia sabrá cómo modificar el código para trasladar dichas inserciones al final del documento.

Primero, abre tu fichero functions.php y pega el siguiente código.

/**
 * Filter HTML code and leave allowed/disallowed tags only
 *
 * @param string $text Input HTML code.
 * @param string $tags Filtered tags.
 * @param bool $invert Define whether should leave or remove tags.
 * @return string Filtered tags
 */
function theme_strip_tags_content($text, $tags = '', $invert = false) {

preg_match_all( '/<(.+?)[s]*/?[s]*>/si', trim( $tags ), $tags );
 $tags = array_unique( $tags[1] );

if ( is_array( $tags ) AND count( $tags ) > 0 ) {
 if ( false == $invert ) {
 return preg_replace( '@<(?!(?:'. implode( '|', $tags ) .')b)(w+)b.*?>.*?@si', '', $text );
 }
 else {
 return preg_replace( '@<('. implode( '|', $tags ) .')b.*?>.*?@si', '', $text );
 }
 }
 elseif ( false == $invert ) {
 return preg_replace( '@<(w+)b.*?>.*?@si', '', $text );
 }

return $text;
}

/**
 * Generate script tags from given source code
 *
 * @param string $source HTML code.
 * @return string Filtered HTML code with script tags only
 */
function theme_insert_js($source) {

$out = '';

$fragment = new DOMDocument();
 $fragment->loadHTML( $source );

$xp = new DOMXPath( $fragment );
 $result = $xp->query( '//script' );

$scripts = array();
 $scripts_src = array();
 foreach ( $result as $key => $el ) {
 $src = $result->item( $key )->attributes->getNamedItem( 'src' )->value;
 if ( ! empty( $src ) ) {
 $scripts_src[] = $src;
 } else {
 $type = $result->item( $key )->attributes->getNamedItem( 'type' )->value;
 if ( empty( $type ) ) {
 $type = 'text/javascript';
 }

$scripts[$type][] = $el->nodeValue;
 }
 }

//used by inline code and rich snippets type like application/ld+json
 foreach ( $scripts as $key => $value ) {
 $out .= '';
 }

//external script
 foreach ( $scripts_src as $value ) {
 $out .= '';
 }

return $out;
}

Una vez hecho esto, edita el fichero header.php y reemplaza el tag wp_head() por esto:

https://seox.es/wp-content/uploads/2017/10/unnamed-file-c.jpg
ob_start();
wp_head();
$themeHead = ob_get_contents();
ob_end_clean();
define( 'HEAD_CONTENT', $themeHead );

$allowedTags = '';
print theme_strip_tags_content( HEAD_CONTENT, $allowedTags );
?></pre>
<p>Y finalmente, coloca el siguiente código dentro de tu archivo footer.php, justo antes del cierre del tag </body>.</p>
<pre>https://seox.es/wp-content/uploads/2017/10/unnamed-file-c.jpg theme_insert_js( HEAD_CONTENT ); ?></pre>
<h2><span class="ez-toc-section" id="Permitir_que_solo_el_autor_del_post_pueda_contestar_a_los_comentarios"></span>Permitir que solo el autor del post pueda contestar a los comentarios<span class="ez-toc-section-end"></span></h2>
<p>Si por alguna razón quieres que solo el autor del contenido pueda responder a los comentarios que ha generado y nadie más, puedes hacerlo mediante un sencillo código. Para ello, y tal como hemos hecho en otras ocasiones, pega el siguiente código dentro del fichero functions.php.</p>
<pre>add_action( 'pre_comment_on_post', 'wpq_pre_commenting' );

function wpq_pre_commenting( $pid ) {
 $parent_id = filter_input( INPUT_POST, 'comment_parent', FILTER_SANITIZE_NUMBER_INT );
 $post = get_post( $pid );
 $cuid = get_current_user_id();

if( ! is_null( $post ) && $post->post_author == $cuid && 0 == $parent_id ) {
 wp_die( 'Lo sentimos, solo el autor puede responder a los comentarios' );
 }
}</pre>
<h2><span class="ez-toc-section" id="Mostrar_la_fecha_de_la_ultima_modificacion_del_post"></span>Mostrar la fecha de la última modificación del post<span class="ez-toc-section-end"></span></h2>
<p><strong>Si actualizas tus posts frecuentemente, lo suyo, y lo más relevante, es mostrar la fecha de la última modificación de los mismos.</strong> Solo tienes que pegar este código donde quieras que se muestre la fecha. La función debe utilizarse dentro del loop.</p>
<pre><p>Última modificación: https://seox.es/wp-content/uploads/2017/10/unnamed-file-c.jpg the_modified_date(); ?></p></pre>
<h2><span class="ez-toc-section" id="Programar_tareas_del_cron_con_WordPress"></span>Programar tareas del cron con WordPress<span class="ez-toc-section-end"></span></h2>
<p><strong>Cron es una palabra técnica que se utiliza para aquellos comandos que se ejecutan a una hora programada o en intervalos regulares</strong>. Muchos servidores webs lo utilizan para realizar tareas de mantenimiento en el propio servidor, o, como he dicho antes, para ejecutar tareas programadas.</p>
<p>En WordPress también se utilizan para eventos programados, como por ejemplo vaciar la bandeja de spam de los comentarios. Aquí tienes un pequeño código que debes pegar en tu archivo functions.php, y te permitirá crear tareas que se ejecutarán mediante el cron de WordPress.</p>
<pre>https://seox.es/wp-content/uploads/2017/10/unnamed-file-c.jpg
add_action('my_hourly_event', 'do_this_hourly');

function my_activation() {
 if ( !wp_next_scheduled( 'my_hourly_event' ) ) {
 wp_schedule_event(time(), 'hourly', 'my_hourly_event');
 }
}
add_action('wp', 'my_activation');

function do_this_hourly() {
 // hace algo cada hora
}
?></pre>
<h2><span class="ez-toc-section" id="Mostrar_un_aviso_en_los_posts_antiguos"></span>Mostrar un aviso en los posts antiguos<span class="ez-toc-section-end"></span></h2>
<p>Si en tu blog hablas sobre tecnología, lo más seguro es que tengas artículos antiguos que ya se habrán quedado desfasadillos. <strong>Puede ser muy buena idea, para aquellos posts viejos, mostrar a tus lectores un aviso que les indique que el post ya tiene un tiempo y que es posible que ya no sea muy útil.</strong></p>
<p>Pega el siguiente código en el fichero single.php, dentro del loop. Edita el aviso en la línea 7 por el aviso que quieras dar a tus usuarios.</p>
<pre><?
$ageunix = get_the_time('U');
$days_old_in_seconds = ((time() - $ageunix));
$days_old = (($days_old_in_seconds/86400));

if ($days_old > 365) {
 echo '<div class="disclaimer">OJO: Este artículo tiene más de un año y puede que ya esté anticuado</div>'; 
} 
?></pre>
<p>Y hasta aquí nuestro artículo en el que te hemos mostrado 8 códigos para extender las funcionalidades de WordPress. <strong>Espero que te haya gustado y, si te ha resultado útil, no dudes en compartirlo en redes sociales</strong>.</p>
<p>SIGUE LEYENDO...<br />
<a href="https://wpdirecto.com/8-codigos-extender-las-funcionalidades-wordpress/" target="_blank" rel="nofollow noopener">Ir a la fuente</a> / Author: Jorge López</p>
<hgroup>
<h2 class="hustle-modal-title"></h2>
</hgroup>
<table style="border-collapse: collapse; width: 98.665%; height: 263px;" border="1">
<tbody>
<tr style="height: 195px;">
<td style="width: 100%; height: 195px;">
<h2 class="hustle-modal-title" style="text-align: center;"><span class="ez-toc-section" id="VEO_lo_que_NO_SE_VE"></span><a href="https://seox.es/precios-seo/"><span style="font-size: 18pt;"><strong>VEO lo que NO SE VE</strong></span></a><span class="ez-toc-section-end"></span></h2>
 
<figure id="attachment_6123" aria-describedby="caption-attachment-6123" style="width: 411px" class="wp-caption aligncenter"><a href="https://seox.es/precios-seo/"><img loading="lazy" class="wp-image-6123 " title="seo o no seo" src="https://seox.es/wp-content/uploads/2018/01/seo-o-no-seo-717x1024.jpg" alt="seo o no seo precio seo" width="411" height="449" /></a><figcaption id="caption-attachment-6123" class="wp-caption-text">seo o no seo precio seo coste seo</figcaption></figure>
<p style="text-align: center;"><a href="https://seox.es/precios-seo-2019/"><span style="font-size: 18pt;"><strong>Más SEO, Más CLIENTES</strong></span></a></p>
<p style="text-align: center;">Posicionamiento SEO, Hosting Servidores SSD optimizados para WordPress, Diseño de páginas web WordPress</p>
<p style="text-align: center;">Primer ANÁLISIS SEO GRATIS! Envía un email con tu dominio a:</p>
<p style="text-align: center;"><a href="mailto:seox@seox.es">Josean | www.seox.es | seox@seox.es  |  656 545 123  </a><a href="https://seox.es/precios-seo/"><span style="font-size: 18pt;"><strong>🙂</strong></span></a></p>
</td>
</tr>
</tbody>
</table>
 
<script type="text/phast" async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script type="text/phast">(adsbygoogle=window.adsbygoogle||[]).push({google_ad_client:"ca-pub-9028194652193024",enable_page_level_ads:true});</script>
<a href="http://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="nofollow noopener"><img loading="lazy" class="aligncenter" src="https://i.creativecommons.org/l/by-nc/4.0/88x31.png" alt="Licencia de Creative Commons" /></a>
<div id='jp-relatedposts' class='jp-relatedposts' >
<h3 class="jp-relatedposts-headline"><span class="ez-toc-section" id="Relacionado"></span><em>Relacionado</em><span class="ez-toc-section-end"></span></h3>
</div> </div>
<footer class="entry-meta entry-meta-footer">
<span class="cat-links cat-links-single">Publicado en <a href="https://seox.es/blog/wordpress/" rel="category tag">WordPress</a></span> </footer>
</div>
</article>
</div>
<div class="entry-author">
<div class="author-avatar">
</div>
<div class="author-heading">
<h2 class="author-title">Publicado por <span class="author-name"></span></h2>
</div>
<p class="author-bio">
<a class="author-link" href="https://seox.es/author/" rel="author">
Ver todas las publicaciones de </a>
</p>
</div>
<nav class="navigation post-navigation" role="navigation" aria-label="Entradas">
<h2 class="screen-reader-text">Navegación de entradas</h2>
<div class="nav-links"><div class="nav-previous"><a href="https://seox.es/selfpackaging-expansion-alemania/" rel="prev"><span class="meta-nav">Anterior</span> <span class="post-title">Selfpackaging, empresa dedicada a la venta online de packaging creativo y de diseño, aterriza en Alemania – Edisonews</span></a></div><div class="nav-next"><a href="https://seox.es/stripe-crecimiento-empresas/" rel="next"><span class="meta-nav">Siguiente</span> <span class="post-title">Las empresas que más rápido crecen en España lo hacen utilizando Stripe – Edisonews</span></a></div></div>
</nav>
</div>
</main>
</section>
</div>
</div>
</div>
</div>
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="site-info">
<div class="site-info-inside">
<div class="container">
<div class="row">
<div class="col">
<div class="credits-wrapper">
<div class="credits credits-blog">© Copyright 2021 – <a href="https://seox.es/">SEO Bilbao ☎ 656545123</a></div><div class="credits credits-designer">Cambium Theme por <a href="https://bestblogthemes.com" title="BestBlogThemes">BestBlogThemes</a> <span>⋅</span> Funciona con <a href="https://wordpress.org" title="WordPress">WordPress</a></div> </div>
</div>
</div>
</div>
</div>
</div>
</footer>
</div>
<div class="overlay-effect"></div>
seo - Search engines - Search engine - Optimization - Traffic - Engine optimization - Search engine optimization - Optimize - Digital marketing - Optimizing - Ppc - Organic search - Backlinks - Online marketing - Link building - Seo strategy - On page seo - Keyword research - Adwords - Search engine results - line presence - Webmaster - Pay per click - Serps - Sitemap - Seo services - Engine results - Marketing strategy - Search marketing - Pay per - Webmasters - Local seo - Internet marketing - Backlink - Mobile friendly - Google search console<script data-phast-original-src="https://seox.es/wp-content/themes/cambium/js/enquire.js?ver=2.1.6" data-phast-params='{"ref":"eR2PCP8dGw4"}' data-phast-original-type="text/javascript" type="text/phast" id="enquire-js"></script>
<script data-phast-original-src="https://seox.es/wp-content/themes/cambium/js/fitvids.js?ver=1.1" data-phast-params='{"ref":"tIQvkb0vQ5o"}' data-phast-original-type="text/javascript" type="text/phast" id="fitvids-js"></script>
<script data-phast-original-src="https://seox.es/wp-content/themes/cambium/js/hover-intent.js?ver=r7" data-phast-params='{"ref":"2_SVI4caU9c"}' data-phast-original-type="text/javascript" type="text/phast" id="hover-intent-js"></script>
<script data-phast-original-src="https://seox.es/wp-content/themes/cambium/js/superfish.js?ver=1.7.10" data-phast-params='{"ref":"B7PRMxCnwJo"}' data-phast-original-type="text/javascript" type="text/phast" id="superfish-js"></script>
<script data-phast-original-src="https://seox.es/wp-content/themes/cambium/js/custom.js?ver=1.0" data-phast-params='{"ref":"3XMtc9P_YGs"}' data-phast-original-type="text/javascript" type="text/phast" id="cambium-custom-js"></script>
<script data-phast-original-src="https://seox.es/wp-content/plugins/complianz-gdpr/assets/js/cookieconsent.min.js?ver=5.4.0" data-phast-params='{"ref":"E8iv0NsUkIg"}' data-phast-original-type="text/javascript" type="text/phast" id="cmplz-cookie-js"></script>
<script data-phast-original-src="https://seox.es/wp-content/plugins/complianz-gdpr/assets/js/postscribe.min.js?ver=5.4.0" data-phast-params='{"ref":"xn8LOAwxRao"}' data-phast-original-type="text/javascript" type="text/phast" id="cmplz-postscribe-js"></script>
<script data-phast-original-type="text/javascript" type="text/phast" id="cmplz-cookie-config-js-extra">var complianz={"static":"","is_multisite_root":"","set_cookies":[],"block_ajax_content":"","banner_version":"21","version":"5.4.0","a_b_testing":"","do_not_track":"","consenttype":"optin","region":"eu","geoip":"","categories":"","position":"bottom","title":"bottom minimal","theme":"minimal","checkbox_style":"square","use_categories":"no","use_categories_optinstats":"no","header":"","accept":"Todas las cookies","revoke":"Ajustes","dismiss":"S\u00f3lo funcional","dismiss_timeout":"10","use_custom_cookie_css":"","custom_css":".cc-window  \n\n \n\n \n\n \n\n \n\n\n\n#cmplz-consent-ui, #cmplz-post-consent-ui {} \n\n#cmplz-consent-ui .cmplz-consent-message {} \n\n#cmplz-consent-ui button, #cmplz-post-consent-ui button {}","readmore_optin":"Leer m\u00e1s","readmore_impressum":"Impressum","accept_informational":"Acepto","message_optout":"Utilizamos cookies para optimizar nuestro sitio web y nuestro servicio.","message_optin":"Utilizamos cookies para optimizar nuestro sitio web y nuestro servicio.","readmore_optout":"Cookie Statement (US)","readmore_optout_dnsmpi":"Do Not Sell My Personal Information","hide_revoke":"","disable_cookiebanner":"","banner_width":"","soft_cookiewall":"","type":"opt-in","layout":"basic","dismiss_on_scroll":"","dismiss_on_timeout":"","cookie_expiry":"365","nonce":"45b44210d6","url":"https:\/\/seox.es\/wp-json\/complianz\/v1\/?lang=es&locale=es_ES","set_cookies_on_root":"","cookie_domain":"","current_policy_id":"14","cookie_path":"\/","tcf_active":"","colorpalette_background_color":"#ff0000","colorpalette_background_border":"#ff0000","colorpalette_text_color":"#fff","colorpalette_text_hyperlink_color":"#fff","colorpalette_toggles_background":"#0073aa","colorpalette_toggles_bullet":"#fff","colorpalette_toggles_inactive":"#F56E28","colorpalette_border_radius":"0px 0px 0px 0px","border_width":"1px 1px 1px 1px","colorpalette_button_accept_background":"#fff","colorpalette_button_accept_border":"#fff","colorpalette_button_accept_text":"#ff0000","colorpalette_button_deny_background":"#ff0000","colorpalette_button_deny_border":"#ff0000","colorpalette_button_deny_text":"#fff","colorpalette_button_settings_background":"#fff","colorpalette_button_settings_border":"#fff","colorpalette_button_settings_text":"#ff0000","buttons_border_radius":"5px 5px 5px 5px","box_shadow":"","animation":"none","animation_fade":"","animation_slide":"","readmore_url":{"eu":"https:\/\/seox.es\/cookie-policy-eu\/"},"privacy_link":{"eu":""},"placeholdertext":"Haz clic para aceptar las cookies de marketing y activar este contenido"};</script>
<script data-phast-original-src="https://seox.es/wp-content/plugins/complianz-gdpr/assets/js/complianz.min.js?ver=5.4.0" data-phast-params='{"ref":"_CaHu4VNMK8"}' data-phast-original-type="text/javascript" type="text/phast" id="cmplz-cookie-config-js"></script>
<script data-phast-original-src="https://seox.es/wp-includes/js/wp-embed.min.js?ver=445e2759b2c51c902b097f6207ec0f24" data-phast-params='{"ref":"O874D04YRxs"}' data-phast-original-type="text/javascript" type="text/phast" id="wp-embed-js"></script>
<script data-phast-original-src="https://seox.es/wp-content/plugins/easy-table-of-contents/vendor/smooth-scroll/jquery.smooth-scroll.min.js?ver=2.2.0" data-phast-params='{"ref":"4kd1BjtFqM8"}' data-phast-original-type="text/javascript" type="text/phast" id="jquery-smooth-scroll-js"></script>
<script data-phast-original-src="https://seox.es/wp-content/plugins/easy-table-of-contents/vendor/js-cookie/js.cookie.min.js?ver=2.2.1" data-phast-params='{"ref":"17Qg2XbbRQg"}' data-phast-original-type="text/javascript" type="text/phast" id="js-cookie-js"></script>
<script data-phast-original-src="https://seox.es/wp-content/plugins/easy-table-of-contents/vendor/sticky-kit/jquery.sticky-kit.min.js?ver=1.9.2" data-phast-params='{"ref":"ojzn1EE6aTk"}' data-phast-original-type="text/javascript" type="text/phast" id="jquery-sticky-kit-js"></script>
<script data-phast-original-type="text/javascript" type="text/phast" id="ez-toc-js-js-extra">var ezTOC={"smooth_scroll":"1","visibility_hide_by_default":"","width":"600px","scroll_offset":"30"};</script>
<script data-phast-original-src="https://seox.es/wp-content/plugins/easy-table-of-contents/assets/js/front.min.js?ver=2.0.17-1616800712" data-phast-params='{"ref":"eUDtCs82tW8"}' data-phast-original-type="text/javascript" type="text/phast" id="ez-toc-js-js"></script>

<script type="text/plain" class="cmplz-script cmplz-stats">(function (i, s, o, g, r, a, m) {
    i['GoogleAnalyticsObject'] = r;
    i[r] = i[r] || function () {
        (i[r].q = i[r].q || []).push(arguments)
    }, i[r].l = 1 * new Date();
    a = s.createElement(o),
        m = s.getElementsByTagName(o)[0];
    a.async = 1;
    a.src = g;
    m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-86817549-4', {
	cookieFlags: 'secure;samesite=None'
});
ga('send', 'pageview', {
    'anonymizeIp': true
});</script><script type="text/plain" class="cmplz-script cmplz-stats" src='https://stats.wp.com/e-202138.js' defer></script>
<script type="text/phast">_stq=window._stq||[];_stq.push(['view',{v:'ext',j:'1:10.1',blog:'153359635',post:'3995',tz:'2',srv:'seox.es'}]);_stq.push(['clickTrackerInit','153359635','3995']);</script>
<script type="text/phast" data-dont-merge>var xhr = new XMLHttpRequest();xhr.open('GET', document.location.href);xhr.setRequestHeader('X-merge-assets', 'true');xhr.send(null);</script><script data-phast-compiled-js-names="ScriptsProxyService/rewrite-function.js,CSSInlining/ie-fallback.js,CSSInlining/inlined-css-retriever.js,ScriptsDeferring/scripts-loader.js,ScriptsDeferring/rewrite.js">(function phastScripts(phast){phast.scripts=[(function(){phast.config=JSON.parse(atob(phast.config));while(phast.scripts.length){phast.scripts.shift()()}
}),(function(){(function(a,b){typeof exports==="object"&&typeof module!=="undefined"?module.exports=b():typeof define==="function"&&define.amd?define(b):a.ES6Promise=b()})(phast,function(){"use strict";function c(ia){var ja=typeof ia;return ia!==null&&(ja==="object"||ja==="function")}function d(ka){return typeof ka==="function"}var e=void 0;if(Array.isArray){e=Array.isArray}else{e=function(la){return Object.prototype.toString.call(la)==="[object Array]"}}var f=e;var g=0;var h=void 0;var i=void 0;var j=function ma(na,oa){w[g]=na;w[g+1]=oa;g+=2;if(g===2){if(i){i(x)}else{z()}}};function k(pa){i=pa}function l(qa){j=qa}var m=typeof window!=="undefined"?window:undefined;var n=m||{};var o=n.MutationObserver||n.WebKitMutationObserver;var p=typeof self==="undefined"&&typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var q=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function r(){return function(){return process.nextTick(x)}}function s(){if(typeof h!=="undefined"){return function(){h(x)}}return v()}function t(){var ra=0;var sa=new o(x);var ta=document.createTextNode("");sa.observe(ta,{characterData:true});return function(){ta.data=ra=++ra%2}}function u(){var ua=new MessageChannel;ua.port1.onmessage=x;return function(){return ua.port2.postMessage(0)}}function v(){var va=setTimeout;return function(){return va(x,1)}}var w=new Array(1e3);function x(){for(var wa=0;wa<g;wa+=2){var xa=w[wa];var ya=w[wa+1];xa(ya);w[wa]=undefined;w[wa+1]=undefined}g=0}function y(){try{var za=Function("return this")().require("vertx");h=za.runOnLoop||za.runOnContext;return s()}catch(Aa){return v()}}var z=void 0;if(p){z=r()}else if(o){z=t()}else if(q){z=u()}else if(m===undefined&&typeof require==="function"){z=y()}else{z=v()}function A(Ba,Ca){var Da=this;var Ea=new this.constructor(D);if(Ea[C]===undefined){$(Ea)}var Fa=Da._state;if(Fa){var Ga=arguments[Fa-1];j(function(){return W(Fa,Ea,Ga,Da._result)})}else{T(Da,Ea,Ba,Ca)}return Ea}function B(Ha){var Ia=this;if(Ha&&typeof Ha==="object"&&Ha.constructor===Ia){return Ha}var Ja=new Ia(D);P(Ja,Ha);return Ja}var C=Math.random().toString(36).substring(2);function D(){}var E=void 0;var F=1;var G=2;var H={error:null};function I(){return new TypeError("You cannot resolve a promise with itself")}function J(){return new TypeError("A promises callback cannot return that same promise.")}function K(Ka){try{return Ka.then}catch(La){H.error=La;return H}}function L(Ma,Na,Oa,Pa){try{Ma.call(Na,Oa,Pa)}catch(Qa){return Qa}}function M(Ra,Sa,Ta){j(function(Ua){var Va=false;var Wa=L(Ta,Sa,function(Xa){if(Va){return}Va=true;if(Sa!==Xa){P(Ua,Xa)}else{R(Ua,Xa)}},function(Ya){if(Va){return}Va=true;S(Ua,Ya)},"Settle: "+(Ua._label||" unknown promise"));if(!Va&&Wa){Va=true;S(Ua,Wa)}},Ra)}function N(Za,$a){if($a._state===F){R(Za,$a._result)}else if($a._state===G){S(Za,$a._result)}else{T($a,undefined,function(_a){return P(Za,_a)},function(ab){return S(Za,ab)})}}function O(bb,cb,db){if(cb.constructor===bb.constructor&&db===A&&cb.constructor.resolve===B){N(bb,cb)}else{if(db===H){S(bb,H.error);H.error=null}else if(db===undefined){R(bb,cb)}else if(d(db)){M(bb,cb,db)}else{R(bb,cb)}}}function P(eb,fb){if(eb===fb){S(eb,I())}else if(c(fb)){O(eb,fb,K(fb))}else{R(eb,fb)}}function Q(gb){if(gb._onerror){gb._onerror(gb._result)}U(gb)}function R(hb,ib){if(hb._state!==E){return}hb._result=ib;hb._state=F;if(hb._subscribers.length!==0){j(U,hb)}}function S(jb,kb){if(jb._state!==E){return}jb._state=G;jb._result=kb;j(Q,jb)}function T(lb,mb,nb,ob){var pb=lb._subscribers;var qb=pb.length;lb._onerror=null;pb[qb]=mb;pb[qb+F]=nb;pb[qb+G]=ob;if(qb===0&&lb._state){j(U,lb)}}function U(rb){var sb=rb._subscribers;var tb=rb._state;if(sb.length===0){return}var ub=void 0,vb=void 0,wb=rb._result;for(var xb=0;xb<sb.length;xb+=3){ub=sb[xb];vb=sb[xb+tb];if(ub){W(tb,ub,vb,wb)}else{vb(wb)}}rb._subscribers.length=0}function V(yb,zb){try{return yb(zb)}catch(Ab){H.error=Ab;return H}}function W(Bb,Cb,Db,Eb){var Fb=d(Db),Gb=void 0,Hb=void 0,Ib=void 0,Jb=void 0;if(Fb){Gb=V(Db,Eb);if(Gb===H){Jb=true;Hb=Gb.error;Gb.error=null}else{Ib=true}if(Cb===Gb){S(Cb,J());return}}else{Gb=Eb;Ib=true}if(Cb._state!==E){}else if(Fb&&Ib){P(Cb,Gb)}else if(Jb){S(Cb,Hb)}else if(Bb===F){R(Cb,Gb)}else if(Bb===G){S(Cb,Gb)}}function X(Kb,Lb){try{Lb(function Mb(Nb){P(Kb,Nb)},function Ob(Pb){S(Kb,Pb)})}catch(Qb){S(Kb,Qb)}}var Y=0;function Z(){return Y++}function $(Rb){Rb[C]=Y++;Rb._state=undefined;Rb._result=undefined;Rb._subscribers=[]}function _(){return new Error("Array Methods must be provided an Array")}var aa=function(){function Sb(Tb,Ub){this._instanceConstructor=Tb;this.promise=new Tb(D);if(!this.promise[C]){$(this.promise)}if(f(Ub)){this.length=Ub.length;this._remaining=Ub.length;this._result=new Array(this.length);if(this.length===0){R(this.promise,this._result)}else{this.length=this.length||0;this._enumerate(Ub);if(this._remaining===0){R(this.promise,this._result)}}}else{S(this.promise,_())}}Sb.prototype._enumerate=function Vb(Wb){for(var Xb=0;this._state===E&&Xb<Wb.length;Xb++){this._eachEntry(Wb[Xb],Xb)}};Sb.prototype._eachEntry=function Yb(Zb,$b){var _b=this._instanceConstructor;var ac=_b.resolve;if(ac===B){var bc=K(Zb);if(bc===A&&Zb._state!==E){this._settledAt(Zb._state,$b,Zb._result)}else if(typeof bc!=="function"){this._remaining--;this._result[$b]=Zb}else if(_b===ga){var cc=new _b(D);O(cc,Zb,bc);this._willSettleAt(cc,$b)}else{this._willSettleAt(new _b(function(dc){return dc(Zb)}),$b)}}else{this._willSettleAt(ac(Zb),$b)}};Sb.prototype._settledAt=function ec(fc,gc,hc){var ic=this.promise;if(ic._state===E){this._remaining--;if(fc===G){S(ic,hc)}else{this._result[gc]=hc}}if(this._remaining===0){R(ic,this._result)}};Sb.prototype._willSettleAt=function jc(kc,lc){var mc=this;T(kc,undefined,function(nc){return mc._settledAt(F,lc,nc)},function(oc){return mc._settledAt(G,lc,oc)})};return Sb}();function ba(pc){return new aa(this,pc).promise}function ca(qc){var rc=this;if(!f(qc)){return new rc(function(sc,tc){return tc(new TypeError("You must pass an array to race."))})}else{return new rc(function(uc,vc){var wc=qc.length;for(var xc=0;xc<wc;xc++){rc.resolve(qc[xc]).then(uc,vc)}})}}function da(yc){var zc=this;var Ac=new zc(D);S(Ac,yc);return Ac}function ea(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function fa(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var ga=function(){function Bc(Cc){this[C]=Z();this._result=this._state=undefined;this._subscribers=[];if(D!==Cc){typeof Cc!=="function"&&ea();this instanceof Bc?X(this,Cc):fa()}}Bc.prototype.catch=function Dc(Ec){return this.then(null,Ec)};Bc.prototype.finally=function Fc(Gc){var Hc=this;var Ic=Hc.constructor;return Hc.then(function(Jc){return Ic.resolve(Gc()).then(function(){return Jc})},function(Kc){return Ic.resolve(Gc()).then(function(){throw Kc})})};return Bc}();ga.prototype.then=A;ga.all=ba;ga.race=ca;ga.resolve=B;ga.reject=da;ga._setScheduler=k;ga._setAsap=l;ga._asap=j;function ha(){var Lc=void 0;if(typeof global!=="undefined"){Lc=global}else if(typeof self!=="undefined"){Lc=self}else{try{Lc=Function("return this")()}catch(Oc){throw new Error("polyfill failed because global object is unavailable in this environment")}}var Mc=Lc.Promise;if(Mc){var Nc=null;try{Nc=Object.prototype.toString.call(Mc.resolve())}catch(Pc){}if(Nc==="[object Promise]"&&!Mc.cast){return}}Lc.Promise=ga}ga.polyfill=ha;ga.Promise=ga;return ga});
}),(function(){function murmurhash3_32_gc(a,b){var c,d,e,f,g,h,i,j,k,l;c=a.length&3;d=a.length-c;e=b;g=3432918353;i=461845907;l=0;while(l<d){k=a.charCodeAt(l)&255|(a.charCodeAt(++l)&255)<<8|(a.charCodeAt(++l)&255)<<16|(a.charCodeAt(++l)&255)<<24;++l;k=(k&65535)*g+(((k>>>16)*g&65535)<<16)&4294967295;k=k<<15|k>>>17;k=(k&65535)*i+(((k>>>16)*i&65535)<<16)&4294967295;e^=k;e=e<<13|e>>>19;f=(e&65535)*5+(((e>>>16)*5&65535)<<16)&4294967295;e=(f&65535)+27492+(((f>>>16)+58964&65535)<<16)}k=0;switch(c){case 3:k^=(a.charCodeAt(l+2)&255)<<16;case 2:k^=(a.charCodeAt(l+1)&255)<<8;case 1:k^=a.charCodeAt(l)&255;k=(k&65535)*g+(((k>>>16)*g&65535)<<16)&4294967295;k=k<<15|k>>>17;k=(k&65535)*i+(((k>>>16)*i&65535)<<16)&4294967295;e^=k}e^=a.length;e^=e>>>16;e=(e&65535)*2246822507+(((e>>>16)*2246822507&65535)<<16)&4294967295;e^=e>>>13;e=(e&65535)*3266489909+(((e>>>16)*3266489909&65535)<<16)&4294967295;e^=e>>>16;return e>>>0}phast.hash=murmurhash3_32_gc;
}),(function(){phast.buildServiceUrl=function(a,b){if(a.pathInfo){return appendPathInfo(a.serviceUrl,buildQuery(b))}else{return appendQueryString(a.serviceUrl,buildQuery(b))}};function buildQuery(c){if(typeof c==="string"){return c}var d=[];for(var e in c){if(c.hasOwnProperty(e)){d.push(encodeURIComponent(e)+"="+encodeURIComponent(c[e]))}}return d.join("&")}function appendPathInfo(f,g){var h=btoa(g).replace(/=/g,"").replace(/\//g,"_").replace(/\+/g,"-");var i=j(h+".q.js");return f.replace(/\?.*$/,"").replace(/\/__p__\.js$/,"")+"/"+i;function j(l){return k(k(l).match(/[\s\S]{1,255}/g).join("/"))}function k(m){return m.split("").reverse().join("")}}function appendQueryString(n,o){var p=n.indexOf("?")>-1?"&":"?";return n+p+o}
}),(function(){var Promise=phast.ES6Promise.Promise;phast.ResourceLoader=function(a,b){this.get=function(c){return b.get(c).then(function(d){if(typeof d!=="string"){throw new Error("response should be string")}return d}).catch(function(){var e=a.get(c);e.then(function(f){b.set(c,f)});return e})}};phast.ResourceLoader.RequestParams={};phast.ResourceLoader.RequestParams.FaultyParams={};phast.ResourceLoader.RequestParams.fromString=function(g){try{return JSON.parse(g)}catch(h){return phast.ResourceLoader.RequestParams.FaultyParams}};phast.ResourceLoader.BundlerServiceClient=function(i,j,k){var l=phast.ResourceLoader.BundlerServiceClient.RequestsPack;var m=l.PackItem;var n;this.get=function(q){if(q===phast.ResourceLoader.RequestParams.FaultyParams){return Promise.reject(new Error("Parameters did not parse as JSON"))}return new Promise(function(r,s){if(n===undefined){n=new l(j)}n.add(new m({success:r,error:s},q));setTimeout(o);if(n.toQuery().length>4500){console.log("[Phast] Resource loader: Pack got too big; flushing early...");o()}})};function o(){if(n===undefined){return}var t=n;n=undefined;p(t)}function p(u){var v=phast.buildServiceUrl({serviceUrl:i,pathInfo:k},"service=bundler&"+u.toQuery());var w=function(){console.error("[Phast] Request to bundler failed with status",y.status);console.log("URL:",v);u.handleError()};var x=function(){if(y.status>=200&&y.status<300){u.handleResponse(y.responseText)}else{u.handleError()}};var y=new XMLHttpRequest;y.open("GET",v);y.addEventListener("error",w);y.addEventListener("abort",w);y.addEventListener("load",x);y.send()}};phast.ResourceLoader.BundlerServiceClient.RequestsPack=function(z){var A={};this.getLength=function(){var F=0;for(var G in A){F++}return F};this.add=function(H){var I;if(H.params.token){I="token="+H.params.token}else if(H.params.ref){I="ref="+H.params.ref}else{I=""}if(!A[I]){A[I]={params:H.params,requests:[H.request]}}else{A[I].requests.push(H.request)}};this.toQuery=function(){var J=[],K=[],L="";B().forEach(function(M){var N,O;for(var P in A[M].params){if(P==="cacheMarker"){K.push(A[M].params.cacheMarker);continue}N=z[P]?z[P]:P;if(P==="strip-imports"){O=encodeURIComponent(N)}else if(P==="src"){O=encodeURIComponent(N)+"="+encodeURIComponent(C(A[M].params.src,L));L=A[M].params.src}else{O=encodeURIComponent(N)+"="+encodeURIComponent(A[M].params[P])}J.push(O)}});if(K.length>0){J.unshift("c="+phast.hash(K.join("|"),23045))}return E(J.join("&"))};function B(){return Object.keys(A).sort(function(R,S){return Q(R,S)?1:Q(S,R)?-1:0});function Q(T,U){if(typeof A[T].params.src!=="undefined"&&typeof A[U].params.src!=="undefined"){return A[T].params.src>A[U].params.src}return T>U}}function C(V,W){var X=0,Y=Math.pow(36,2)-1;while(X<W.length&&V[X]===W[X]){X++}X=Math.min(X,Y);return D(X)+""+V.substr(X)}function D(Z){var $=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];var _=Z%36;var aa=Math.floor((Z-_)/36);return $[aa]+$[_]}function E(ba){if(!/(^|&)s=/.test(ba)){return ba}return ba.replace(/(%..)|([A-M])|([N-Z])/gi,function(ca,da,ea,fa){if(da){return ca}return String.fromCharCode(ca.charCodeAt(0)+(ea?13:-13))})}this.handleResponse=function(ga){try{var ha=JSON.parse(ga)}catch(ja){this.handleError();return}var ia=B();if(ha.length!==ia.length){console.error("[Phast] Requested",ia.length,"items from bundler, but got",ha.length,"response(s)");this.handleError();return}ha.forEach(function(ka,la){if(ka.status===200){A[ia[la]].requests.forEach(function(ma){ma.success(ka.content)})}else{A[ia[la]].requests.forEach(function(na){na.error(new Error("Got from bundler: "+JSON.stringify(ka)))})}})}.bind(this);this.handleError=function(){for(var oa in A){A[oa].requests.forEach(function(pa){pa.error()})}}};phast.ResourceLoader.BundlerServiceClient.RequestsPack.PackItem=function(qa,ra){this.request=qa;this.params=ra};phast.ResourceLoader.IndexedDBStorage=function(sa){var ta=phast.ResourceLoader.IndexedDBStorage;var ua=ta.logPrefix;var va=ta.requestToPromise;var wa;Ba();this.get=function(Ca){return xa("readonly").then(function(Da){return va(Da.get(Ca)).catch(ya("reading from store"))})};this.store=function(Ea){return xa("readwrite").then(function(Fa){return va(Fa.put(Ea)).catch(ya("writing to store"))})};this.clear=function(){return xa("readwrite").then(function(Ga){return va(Ga.clear())})};this.iterateOnAll=function(Ha){return xa("readonly").then(function(Ia){return za(Ha,Ia.openCursor()).catch(ya("iterating on all"))})};function xa(Ja){return wa.get().then(function(Ka){try{return Ka.transaction(sa.storeName,Ja).objectStore(sa.storeName)}catch(La){console.error(ua,"Could not open store; recreating database:",La);Aa();throw La}})}function ya(Ma){return function(Na){console.error(ua,"Error "+Ma+":",Na);Aa();throw Na}}function za(Oa,Pa){return new Promise(function(Qa,Ra){Pa.onsuccess=function(Sa){var Ta=Sa.target.result;if(Ta){Oa(Ta.value);Ta.continue()}else{Qa()}};Pa.onerror=Ra})}function Aa(){var Ua=wa.dropDB().then(Ba);wa={get:function(){return Promise.reject(new Error("Database is being dropped and recreated"))},dropDB:function(){return Ua}}}function Ba(){wa=new phast.ResourceLoader.IndexedDBStorage.Connection(sa)}};phast.ResourceLoader.IndexedDBStorage.logPrefix="[Phast] Resource loader:";phast.ResourceLoader.IndexedDBStorage.requestToPromise=function(Va){return new Promise(function(Wa,Xa){Va.onsuccess=function(){Wa(Va.result)};Va.onerror=function(){Xa(Va.error)}})};phast.ResourceLoader.IndexedDBStorage.ConnectionParams=function(){this.dbName="phastResourcesCache";this.dbVersion=1;this.storeName="resources"};phast.ResourceLoader.IndexedDBStorage.StoredResource=function(Ya,Za){this.token=Ya;this.content=Za};phast.ResourceLoader.IndexedDBStorage.Connection=function($a){var _a=phast.ResourceLoader.IndexedDBStorage.logPrefix;var ab=phast.ResourceLoader.IndexedDBStorage.requestToPromise;var bb;this.get=cb;this.dropDB=db;function cb(){if(!bb){bb=eb($a)}return bb}function db(){return cb().then(function(gb){console.error(_a,"Dropping DB");gb.close();bb=null;return ab(window.indexedDB.deleteDatabase($a.dbName))})}function eb(hb){if(typeof window.indexedDB==="undefined"){return Promise.reject(new Error("IndexedDB is not available"))}var ib=window.indexedDB.open(hb.dbName,hb.dbVersion);ib.onupgradeneeded=function(){fb(ib.result,hb)};return ab(ib).then(function(jb){jb.onversionchange=function(){console.debug(_a,"Closing DB");jb.close();if(bb){bb=null}};return jb}).catch(function(kb){console.log(_a,"IndexedDB cache is not available. This is usually due to using private browsing mode.");throw kb})}function fb(lb,mb){lb.createObjectStore(mb.storeName,{keyPath:"token"})}};phast.ResourceLoader.StorageCache=function(nb,ob){var pb=phast.ResourceLoader.IndexedDBStorage.StoredResource;this.get=function(xb){return sb(rb(xb))};this.set=function(yb,zb){return tb(rb(yb),zb,false)};var qb=null;function rb(Ab){return JSON.stringify(Ab)}function sb(Bb){return ob.get(Bb).then(function(Cb){if(Cb){return Promise.resolve(Cb.content)}return Promise.resolve()})}function tb(Db,Eb,Fb){return wb().then(function(Gb){var Hb=Eb.length+Gb;if(Hb>nb.maxStorageSize){return Fb||Eb.length>nb.maxStorageSize?Promise.reject(new Error("Storage quota will be exceeded")):ub(Db,Eb)}qb=Hb;var Ib=new pb(Db,Eb);return ob.store(Ib)})}function ub(Jb,Kb){return vb().then(function(){return tb(Jb,Kb,true)})}function vb(){return ob.clear().then(function(){qb=0})}function wb(){if(qb!==null){return Promise.resolve(qb)}var Lb=0;return ob.iterateOnAll(function(Mb){Lb+=Mb.content.length}).then(function(){qb=Lb;return Promise.resolve(qb)})}};phast.ResourceLoader.StorageCache.StorageCacheParams=function(){this.maxStorageSize=4.5*1024*1024};phast.ResourceLoader.BlackholeCache=function(){this.get=function(){return Promise.reject()};this.set=function(){return Promise.reject()}};phast.ResourceLoader.make=function(Nb,Ob,Pb){var Qb=Sb();var Rb=new phast.ResourceLoader.BundlerServiceClient(Nb,Ob,Pb);return new phast.ResourceLoader(Rb,Qb);function Sb(){var Tb=window.navigator.userAgent;if(/safari/i.test(Tb)&&!/chrome|android/i.test(Tb)){console.log("[Phast] Not using IndexedDB cache on Safari");return new phast.ResourceLoader.BlackholeCache}else{var Ub=new phast.ResourceLoader.IndexedDBStorage.ConnectionParams;var Vb=new phast.ResourceLoader.IndexedDBStorage(Ub);var Wb=new phast.ResourceLoader.StorageCache.StorageCacheParams;return new phast.ResourceLoader.StorageCache(Wb,Vb)}}};
}),(function(){var Promise=phast.ES6Promise;phast.ResourceLoader.instance=phast.ResourceLoader.make(phast.config.resourcesLoader.serviceUrl,phast.config.resourcesLoader.shortParamsMappings,phast.config.resourcesLoader.pathInfo);phast.forEachSelectedElement=function(a,b){Array.prototype.forEach.call(window.document.querySelectorAll(a),b)};phast.once=function(c){var d=false;return function(){if(!d){d=true;c.apply(this,Array.prototype.slice(arguments))}}};phast.on=function(e,f){return new Promise(function(g){e.addEventListener(f,g)})};phast.wait=function(h){return new Promise(function(i){setTimeout(i,h)})};phast.on(document,"DOMContentLoaded").then(function(){var j,k;function l(n){return n&&n.nodeType===8&&/^\s*\[Phast\]/.test(n.textContent)}function m(o){while(o){if(l(o)){return o}o=o.nextSibling}return false}k=m(document.documentElement.nextSibling);if(k===false){k=m(document.body.firstChild)}if(k){j=k.textContent.replace(/^\s+|\s+$/g,"").split("\n");console.groupCollapsed(j.shift());console.log(j.join("\n"));console.groupEnd()}});phast.on(document,"DOMContentLoaded").then(function(){var p=performance.timing;var q=[];q.push(["Downloading phases:"]);q.push(["  Look up hostname in DNS            + %s ms",t(p.domainLookupEnd-p.fetchStart)]);q.push(["  Establish connection               + %s ms",t(p.connectEnd-p.domainLookupEnd)]);q.push(["  Send request                       + %s ms",t(p.requestStart-p.connectEnd)]);q.push(["  Receive first byte                 + %s ms",t(p.responseStart-p.requestStart)]);q.push(["  Download page                      + %s ms",t(p.responseEnd-p.responseStart)]);q.push([""]);q.push(["Totals:"]);q.push(["  Time to first byte                   %s ms",t(p.responseStart-p.fetchStart)]);q.push(["    (since request start)              %s ms",t(p.responseStart-p.requestStart)]);q.push(["  Total request time                   %s ms",t(p.responseEnd-p.fetchStart)]);q.push(["    (since request start)              %s ms",t(p.responseEnd-p.requestStart)]);q.push([" "]);var r=[];var s=[];q.forEach(function(u){r.push(u.shift());s=s.concat(u)});console.groupCollapsed("[Phast] Client-side performance metrics");console.log.apply(console,[r.join("\n")].concat(s));console.groupEnd();function t(v){v=""+v;while(v.length<4){v=" "+v}return v}});
}),(function(){var config=phast.config["script-proxy-service"];var urlPattern=/^(https?:)?\/\//;var cacheMarker=Math.floor((new Date).getTime()/1e3/config.urlRefreshTime);var whitelist=compileWhitelistPatterns(config.whitelist);phast.scripts.push(function(){overrideDOMMethod("appendChild");overrideDOMMethod("insertBefore")});function compileWhitelistPatterns(a){var b=/^(.)(.*)\1([a-z]*)$/i;var c=[];a.forEach(function(d){var e=b.exec(d);if(!e){window.console&&window.console.log("Phast: Not a pattern:",d);return}try{c.push(new RegExp(e[2],e[3]))}catch(f){window.console&&window.console.log("Phast: Failed to compile pattern:",d)}});return c}function checkWhitelist(g){for(var h=0;h<whitelist.length;h++){if(whitelist[h].exec(g)){return true}}return false}function overrideDOMMethod(i){var j=Element.prototype[i];var k=function(){var l=processNode(arguments[0]);var m=j.apply(this,arguments);l();return m};Element.prototype[i]=k;window.addEventListener("load",function(){if(Element.prototype[i]===k){delete Element.prototype[i]}})}function processNode(n){if(!n||n.nodeType!==Node.ELEMENT_NODE||n.tagName!=="SCRIPT"||!urlPattern.test(n.src)||n.src.substr(0,config.serviceUrl.length)===config.serviceUrl||!checkWhitelist(n.src)){return function(){}}var o=n.src;n.src=phast.buildServiceUrl(config,{service:"scripts",src:o,cacheMarker:cacheMarker});return function(){n.src=o}}
}),(function(){(function(){var a=function(){if(!("FontFace"in window)){return false}var b=new FontFace("t",'url( "data:font/woff2;base64,d09GMgABAAAAAADwAAoAAAAAAiQAAACoAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAALAogOAE2AiQDBgsGAAQgBSAHIBuDAciO1EZ3I/mL5/+5/rfPnTt9/9Qa8H4cUUZxaRbh36LiKJoVh61XGzw6ufkpoeZBW4KphwFYIJGHB4LAY4hby++gW+6N1EN94I49v86yCpUdYgqeZrOWN34CMQg2tAmthdli0eePIwAKNIIRS4AGZFzdX9lbBUAQlm//f262/61o8PlYO/D1/X4FrWFFgdCQD9DpGJSxmFyjOAGUU4P0qigcNb82GAAA" ) format( "woff2" )',{});b.load()["catch"](function(){});return b.status=="loading"||b.status=="loaded"}();if(a){return}console.log("[Phast] Browser does not support WOFF2, falling back to original stylesheets");Array.prototype.forEach.call(document.querySelectorAll("style[data-phast-ie-fallback-url]"),function(c){var d=document.createElement("link");if(c.hasAttribute("media")){d.setAttribute("media",c.getAttribute("media"))}d.setAttribute("rel","stylesheet");d.setAttribute("href",c.getAttribute("data-phast-ie-fallback-url"));c.parentNode.insertBefore(d,c);c.parentNode.removeChild(c)});Array.prototype.forEach.call(document.querySelectorAll("style[data-phast-nested-inlined]"),function(e){e.parentNode.removeChild(e)})})();
}),(function(){phast.stylesLoading=0;var resourceLoader=phast.ResourceLoader.instance;phast.forEachSelectedElement("style[data-phast-params]",function(a){var b=a.getAttribute("data-phast-params");var c=phast.ResourceLoader.RequestParams.fromString(b);phast.stylesLoading++;resourceLoader.get(c).then(function(d){a.textContent=d;a.removeAttribute("data-phast-params")}).catch(function(e){console.warn("[Phast] Failed to load CSS",c,e);var f=a.getAttribute("data-phast-original-src");if(!f){console.error("[Phast] No data-phast-original-src on <style>!",a);return}console.info("[Phast] Falling back to <link> element for",f);var g=document.createElement("link");g.href=f;g.media=a.media;g.rel="stylesheet";g.addEventListener("load",function(){if(a.parentNode){a.parentNode.removeChild(a)}});a.parentNode.insertBefore(g,a.nextSibling)}).finally(function(){phast.stylesLoading--;if(phast.stylesLoading===0&&phast.onStylesLoaded){phast.onStylesLoaded()}})});(function(){var h=[];phast.forEachSelectedElement("style[data-phast-original-id]",function(i){var j=i.getAttribute("data-phast-original-id");if(h[j]){return}h[j]=true;console.warn("[Phast] The style element with id",j,"has been split into multiple style tags due to @import statements and the id attribute has been removed. Normally, this does not cause any issues.")})})();
}),(function(){var Promise=phast.ES6Promise;var hasCurrentScript=!!document.currentScript;phast.ScriptsLoader={};phast.ScriptsLoader.getScriptsInExecutionOrder=function(a,b){var c=Array.prototype.slice.call(a.querySelectorAll('script[type="text/phast"]')).filter(g);var d=[],e=[];for(var f=0;f<c.length;f++){if(getSrc(c[f])!==undefined&&isDefer(c[f])){e.push(c[f])}else{d.push(c[f])}}return d.concat(e).map(function(j){return b.makeScriptFromElement(j)});function g(k){try{var l=phast.config.scriptsLoader.csp}catch(m){return true}if(l.nonce==null){return true}if(k.nonce===l.nonce){return true}try{h(l,k)}catch(n){console.error("Could not send CSP report due to error:",n)}if(l.reportOnly){console.warn("Script with missing or invalid nonce would not be executed (but report-only mode is enabled):",k);return true}console.warn("Script with missing or invalid nonce will not be executed:",k);return false}function h(o,p){if(!o.reportUri){return}var q={"blocked-uri":getSrc(p),disposition:o.reportOnly?"report":"enforce","document-uri":location.href,referrer:a.referrer,"script-sample":i(p),implementation:"phast"};var r={"csp-report":q};fetch(o.reportUri,{method:"POST",headers:{"Content-Type":"application/csp-report"},credentials:"same-origin",redirect:"error",keepalive:true,body:JSON.stringify(r)})}function i(s){if(!s.hasAttribute("src")){return s.textContent.substr(0,40)}}};phast.ScriptsLoader.executeScripts=function(t){var u=t.map(function(w){return w.init()});var v=Promise.resolve();t.forEach(function(x){v=phast.ScriptsLoader.chainScript(v,x)});return v.then(function(){return Promise.all(u).catch(function(){})})};phast.ScriptsLoader.chainScript=function(y,z){var A;try{if(z.describe){A=z.describe()}else{A="unknown script"}}catch(B){A="script.describe() failed"}return y.then(function(){var C=z.execute();C.then(function(){console.debug("✓",A)});return C}).catch(function(D){console.error("✘",A);if(D){console.log(D)}})};var insertBefore=window.Element.prototype.insertBefore;phast.ScriptsLoader.Utilities=function(E){this._document=E;var F=0;function G(Q){return new Promise(function(R){var S="PhastCompleteScript"+ ++F;var T=H(Q);var U=H(S+"()");window[S]=V;E.body.appendChild(T);E.body.appendChild(U);function V(){R();E.body.removeChild(T);E.body.removeChild(U);delete window[S]}})}function H(W){var X=E.createElement("script");X.textContent=W;X.nonce=phast.config.scriptsLoader.csp.nonce;return X}function I(Y){var Z=E.createElement(Y.nodeName);Array.prototype.forEach.call(Y.attributes,function($){Z.setAttribute($.nodeName,$.nodeValue)});return Z}function J(_){_.removeAttribute("data-phast-params");var aa={};Array.prototype.map.call(_.attributes,function(ba){return ba.nodeName}).map(function(ca){var da=ca.match(/^data-phast-original-(.*)/i);if(da){aa[da[1].toLowerCase()]=_.getAttribute(ca);_.removeAttribute(ca)}});Object.keys(aa).sort().map(function(ea){_.setAttribute(ea,aa[ea])});if(!("type"in aa)){_.removeAttribute("type")}}function K(fa,ga){return new Promise(function(ha,ia){var ja=ga.getAttribute("src");ga.addEventListener("load",ha);ga.addEventListener("error",ia);ga.removeAttribute("src");insertBefore.call(fa.parentNode,ga,fa);fa.parentNode.removeChild(fa);if(ja){ga.setAttribute("src",ja)}})}function L(ka,la){return N(ka,function(){return O(ka,function(){return G(la)})})}function M(ma,na){return N(na,function(){return K(ma,na)})}function N(oa,pa){var qa=oa.nextElementSibling;var ra=Promise.resolve();var sa;if(isAsync(oa)){sa="async"}else if(isDefer(oa)){sa="defer"}E.write=function(wa){if(sa){console.warn("document.write call from "+sa+" script ignored");return}ta(wa)};E.writeln=function(xa){if(sa){console.warn("document.writeln call from "+sa+" script ignored");return}ta(xa+"\n")};function ta(ya){var za=E.createElement("div");za.innerHTML=ya;var Aa=ua(za);if(qa&&qa.parentNode!==oa.parentNode){qa=oa.nextElementSibling}while(za.firstChild){oa.parentNode.insertBefore(za.firstChild,qa)}Aa.map(va)}function ua(Ba){return Array.prototype.slice.call(Ba.getElementsByTagName("script")).filter(function(Ca){var Da=Ca.getAttribute("type");return!Da||/^(text|application)\/javascript(;|$)/i.test(Da)})}function va(Ea){var Fa=new phast.ScriptsLoader.Scripts.Factory(E);var Ga=Fa.makeScriptFromElement(Ea);ra=phast.ScriptsLoader.chainScript(ra,Ga)}return pa().then(function(){return ra}).finally(function(){delete E.write;delete E.writeln})}function O(Ha,Ia){if(hasCurrentScript){try{Object.defineProperty(E,"currentScript",{configurable:true,get:function(){return Ha}})}catch(Ja){console.error("[Phast] Unable to override document.currentScript on this browser: ",Ja)}}return Ia().finally(function(){if(hasCurrentScript){delete E.currentScript}})}function P(Ka){var La=E.createElement("link");La.setAttribute("rel","preload");La.setAttribute("as","script");La.setAttribute("href",Ka);E.head.appendChild(La)}this.executeString=G;this.copyElement=I;this.restoreOriginals=J;this.replaceElement=K;this.writeProtectAndExecuteString=L;this.writeProtectAndReplaceElement=M;this.addPreload=P};phast.ScriptsLoader.Scripts={};phast.ScriptsLoader.Scripts.InlineScript=function(Ma,Na){this._utils=Ma;this._element=Na;this.init=function(){return Promise.resolve()};this.execute=function(){var Oa=Na.textContent.replace(/^\s*<!--.*\n/i,"");Ma.restoreOriginals(Na);return Ma.writeProtectAndExecuteString(Na,Oa)};this.describe=function(){return"inline script"}};phast.ScriptsLoader.Scripts.AsyncBrowserScript=function(Pa,Qa){var Ra;this._utils=Pa;this._element=Qa;this.init=function(){Pa.addPreload(getSrc(Qa));return new Promise(function(Sa){Ra=Sa})};this.execute=function(){var Ta=Pa.copyElement(Qa);Pa.restoreOriginals(Ta);Pa.replaceElement(Qa,Ta).then(Ra).catch(Ra);return Promise.resolve()};this.describe=function(){return"async script at "+getSrc(Qa)}};phast.ScriptsLoader.Scripts.SyncBrowserScript=function(Ua,Va){this._utils=Ua;this._element=Va;this.init=function(){Ua.addPreload(getSrc(Va));return Promise.resolve()};this.execute=function(){var Wa=Ua.copyElement(Va);Ua.restoreOriginals(Wa);return Ua.writeProtectAndReplaceElement(Va,Wa)};this.describe=function(){return"sync script at "+getSrc(Va)}};phast.ScriptsLoader.Scripts.AsyncAJAXScript=function(Xa,Ya,Za,$a){this._utils=Xa;this._element=Ya;this._fetch=Za;this._fallback=$a;var _a;var ab;this.init=function(){_a=Za(Ya);return new Promise(function(bb){ab=bb})};this.execute=function(){_a.then(function(cb){Xa.restoreOriginals(Ya);return Xa.writeProtectAndExecuteString(Ya,cb).then(ab)}).catch(function(){$a.init();return $a.execute().then(ab)});return Promise.resolve()};this.describe=function(){return"bundled async script at "+Ya.getAttribute("data-phast-original-src")}};phast.ScriptsLoader.Scripts.SyncAJAXScript=function(db,eb,fb,gb){this._utils=db;this._element=eb;this._fetch=fb;this._fallback=gb;var hb;this.init=function(){hb=fb(eb);return hb};this.execute=function(){return hb.then(function(ib){db.restoreOriginals(eb);return db.writeProtectAndExecuteString(eb,ib)}).catch(function(){gb.init();return gb.execute()})};this.describe=function(){return"bundled sync script at "+eb.getAttribute("data-phast-original-src")}};phast.ScriptsLoader.Scripts.Factory=function(jb,kb){var lb=phast.ScriptsLoader.Scripts;var mb=new phast.ScriptsLoader.Utilities(jb);this.makeScriptFromElement=function(pb){var qb;if(pb.getAttribute("data-phast-debug-force-method")&&window.location.host.match(/\.test$/)){return new(lb[pb.getAttribute("data-phast-debug-force-method")])(mb,pb)}if(nb(pb)){if(isAsync(pb)){qb=new lb.AsyncBrowserScript(mb,pb);return kb?new lb.AsyncAJAXScript(mb,pb,kb,qb):qb}qb=new lb.SyncBrowserScript(mb,pb);return kb?new lb.SyncAJAXScript(mb,pb,kb,qb):qb}if(ob(pb)){return new lb.InlineScript(mb,pb)}if(isAsync(pb)){return new lb.AsyncBrowserScript(mb,pb)}return new lb.SyncBrowserScript(mb,pb)};function nb(rb){return rb.hasAttribute("data-phast-params")}function ob(sb){return!sb.hasAttribute("src")}};function getSrc(tb){if(tb.hasAttribute("data-phast-original-src")){return tb.getAttribute("data-phast-original-src")}else if(tb.hasAttribute("src")){return tb.getAttribute("src")}}function isAsync(ub){return ub.hasAttribute("async")||ub.hasAttribute("data-phast-async")}function isDefer(vb){return vb.hasAttribute("defer")||vb.hasAttribute("data-phast-defer")}
}),(function(){var Promise=phast.ES6Promise;var go=phast.once(loadScripts);phast.on(document,"DOMContentLoaded").then(function(){if(phast.stylesLoading){phast.onStylesLoaded=go;setTimeout(go,4e3)}else{Promise.resolve().then(go)}});var loadFiltered=false;window.addEventListener("load",function(a){if(!loadFiltered){a.stopImmediatePropagation()}loadFiltered=true});document.addEventListener("readystatechange",function(b){if(document.readyState==="loading"){b.stopImmediatePropagation()}});var didSetTimeout=false;var originalSetTimeout=window.setTimeout;window.setTimeout=function(c,d){if(!d||d<0){didSetTimeout=true}return originalSetTimeout.apply(window,arguments)};function loadScripts(){var e=new phast.ScriptsLoader.Scripts.Factory(document,fetchScript);var f=phast.ScriptsLoader.getScriptsInExecutionOrder(document,e);if(f.length===0){return}setReadyState("loading");phast.ScriptsLoader.executeScripts(f).then(restoreReadyState)}function setReadyState(g){try{Object.defineProperty(document,"readyState",{configurable:true,get:function(){return g}})}catch(h){console.warn("[Phast] Unable to override document.readyState on this browser: ",h)}}function restoreReadyState(){i().then(function(){setReadyState("interactive");triggerEvent(document,"readystatechange");return i()}).then(function(){triggerEvent(document,"DOMContentLoaded");return i()}).then(function(){delete document["readyState"];triggerEvent(document,"readystatechange");if(loadFiltered){triggerEvent(window,"load")}loadFiltered=true});function i(){return new Promise(function(j){(function k(l){if(didSetTimeout&&l<10){didSetTimeout=false;originalSetTimeout.call(window,function(){k(l+1)})}else{requestAnimationFrame(j)}})(0)})}}function triggerEvent(m,n){var o=document.createEvent("Event");o.initEvent(n,true,true);m.dispatchEvent(o)}function fetchScript(p){return phast.ResourceLoader.instance.get(phast.ResourceLoader.RequestParams.fromString(p.getAttribute("data-phast-params")))}
})];(phast.scripts.shift())();})({"config":"eyJyZXNvdXJjZXNMb2FkZXIiOnsic2VydmljZVVybCI6Imh0dHBzOi8vc2VveC5lcy93cC1jb250ZW50L3BsdWdpbnMvcGhhc3RwcmVzcy9waGFzdC5waHAvX19wX18uanM/Iiwic2hvcnRQYXJhbXNNYXBwaW5ncyI6eyJzcmMiOiJzIiwic3RyaXAtaW1wb3J0cyI6ImkiLCJjYWNoZU1hcmtlciI6ImMiLCJ0b2tlbiI6InQiLCJpc1NjcmlwdCI6ImoiLCJyZWYiOiJyIn0sInBhdGhJbmZvIjp0cnVlfSwic2NyaXB0LXByb3h5LXNlcnZpY2UiOnsic2VydmljZVVybCI6Imh0dHBzOi8vc2VveC5lcy93cC1jb250ZW50L3BsdWdpbnMvcGhhc3RwcmVzcy9waGFzdC5waHAiLCJwYXRoSW5mbyI6dHJ1ZSwidXJsUmVmcmVzaFRpbWUiOjcyMDAsIndoaXRlbGlzdCI6WyJ+Xmh0dHBzPzovL3Nlb3hcXC5lcy9+Il19LCJzY3JpcHRzTG9hZGVyIjp7ImNzcCI6eyJub25jZSI6bnVsbCwicmVwb3J0T25seSI6ZmFsc2UsInJlcG9ydFVyaSI6bnVsbH19fQ=="});</script></body>
</html>
<!-- [Phast] Document optimized in 41ms -->