diff --git a/+/scripts/public/forms.js b/+/scripts/public/forms.js index 8f1b4f6ae..1569dd362 100644 --- a/+/scripts/public/forms.js +++ b/+/scripts/public/forms.js @@ -1,7 +1,7 @@ /** global: CustomEvent, FormData, GLSR, HTMLFormElement, StarRating */ import Recaptcha from './recaptcha.js'; -import StarRating from 'star-rating.js'; +import StarRating from '@/star-rating.js'; import Validation from './validation.js'; import { addRemoveClass, classListSelector } from './helpers.js'; diff --git a/+/scripts/site-reviews-admin.js b/+/scripts/site-reviews-admin.js index a6fffb215..4dcdcb9aa 100644 --- a/+/scripts/site-reviews-admin.js +++ b/+/scripts/site-reviews-admin.js @@ -12,7 +12,7 @@ import Prism from 'prismjs'; import Search from './admin/search.js'; import Sections from './admin/sections.js'; import Shortcode from './admin/shortcode.js'; -import StarRating from 'star-rating.js'; +import StarRating from '@/star-rating.js'; import Status from './admin/status.js'; import Sync from './admin/sync.js'; import Tabs from './admin/tabs.js'; diff --git a/+/scripts/star-rating.js/defaults.js b/+/scripts/star-rating.js/defaults.js new file mode 100644 index 000000000..184b174a2 --- /dev/null +++ b/+/scripts/star-rating.js/defaults.js @@ -0,0 +1,11 @@ +export const defaults = { + classNames: { + active: 'gl-active', + base: 'gl-star-rating', + selected: 'gl-selected', + }, + clearable: true, + maxStars: 10, + stars: null, + tooltip: 'Select a Rating', +}; diff --git a/+/scripts/star-rating.js/helpers.js b/+/scripts/star-rating.js/helpers.js new file mode 100644 index 000000000..4eb1902d9 --- /dev/null +++ b/+/scripts/star-rating.js/helpers.js @@ -0,0 +1,61 @@ +export const addRemoveClass = (el, bool, className) => { + el.classList[bool ? 'add' : 'remove'](className); +} + +export const createSpanEl = (attributes) => { + const el = document.createElement('span'); + attributes = attributes || {}; + for (let key in attributes) { + el.setAttribute(key, attributes[key]); + } + return el; +} + +export const inRange = (value, min, max) => { + return /^\d+$/.test(value) && min <= value && value <= max; +} + +export const insertSpanEl = (el, after, attributes) => { + const newEl = createSpanEl(attributes); + el.parentNode.insertBefore(newEl, after ? el.nextSibling : el); + return newEl; +} + +export const isEmpty = (el) => { + return null === el.getAttribute('value') || '' === el.value; +} + +export const merge = (...args) => { // adapted from https://github.com/firstandthird/aug + const results = {}; + args.forEach(prop => { + Object.keys(prop || {}).forEach(propName => { + if (args[0][propName] === undefined) return; // restrict keys to the defaults + const propValue = prop[propName]; + if (type(propValue) === 'Object' && type(results[propName]) === 'Object') { + results[propName] = merge(results[propName], propValue); + return; + } + results[propName] = propValue; + }); + }); + return results; +} + +export const type = (value) => { + return {}.toString.call(value).slice(8, -1); +}; + +export const values = (selectEl) => { + const values = []; + [].forEach.call(selectEl.options, (el) => { + const value = parseInt(el.value, 10) || 0; + if (value > 0) { + values.push({ + index: el.index, + text: el.text, + value: value, + }) + } + }); + return values.sort((a, b) => a.value - b.value); +} diff --git a/+/scripts/star-rating.js/index.js b/+/scripts/star-rating.js/index.js new file mode 100644 index 000000000..219cc366f --- /dev/null +++ b/+/scripts/star-rating.js/index.js @@ -0,0 +1,52 @@ +/**! + * Star Rating + * @version: 4.0.2 + * @author: Paul Ryley (http://geminilabs.io) + * @url: https://github.com/pryley/star-rating.js + * @license: MIT + */ + +import { defaults } from './defaults' +import { merge, type } from './helpers' +import { Widget } from './widget' + +class StarRating { + constructor (selector, props) { // (HTMLSelectElement|NodeList|string, object):void + this.destroy = this.destroy.bind(this); + this.rebuild = this.rebuild.bind(this); + this.widgets = []; + this.buildWidgets(selector, props); + } + + buildWidgets(selector, props) { // (HTMLSelectElement|NodeList|string, object):void + this.queryElements(selector).forEach(el => { + const options = merge(defaults, props, JSON.parse(el.getAttribute('data-options'))); + if ('SELECT' === el.tagName && !el.parentNode.classList.contains(options.classNames.base)) { + this.widgets.push(new Widget(el, options)); + } + }); + } + + destroy () { // ():void + this.widgets.forEach(widget => widget.destroy()); + } + + queryElements (selector) { // (HTMLSelectElement|NodeList|string):array + if ('HTMLSelectElement' === type(selector)) { + return [selector]; + } + if ('NodeList' === type(selector)) { + return [].slice.call(selector); + } + if ('String' === type(selector)) { + return [].slice.call(document.querySelectorAll(selector)) + } + return [] + } + + rebuild () { // ():void + this.widgets.forEach(widget => widget.build()); + } +} + +export default StarRating diff --git a/+/scripts/star-rating.js/widget.js b/+/scripts/star-rating.js/widget.js new file mode 100644 index 000000000..c93979b3d --- /dev/null +++ b/+/scripts/star-rating.js/widget.js @@ -0,0 +1,165 @@ +import { addRemoveClass, createSpanEl, inRange, insertSpanEl, isEmpty, values } from './helpers' +import { supportsPassiveEvents } from 'detect-it' + +export class Widget { + constructor (el, props) { // (HTMLElement, object):void + this.direction = window.getComputedStyle(el, null).getPropertyValue('direction'); + this.el = el; + this.events = { + change: this.onChange.bind(this), + keydown: this.onKeyDown.bind(this), + mousedown: this.onPointerDown.bind(this), + mouseleave: this.onPointerLeave.bind(this), + mousemove: this.onPointerMove.bind(this), + reset: this.onReset.bind(this), + touchend: this.onPointerDown.bind(this), + touchmove: this.onPointerMove.bind(this), + }; + this.indexActive = null; // the active span index + this.indexSelected = null; // the selected span index + this.props = props; + this.tick = null; + this.ticking = false; + this.values = values(el); + this.widgetEl = null; + if (inRange(this.values.length, 1, this.props.maxStars)) { + this.build(); + } else { + this.destroy(); + } + } + + build () { // ():void + this.destroy(); + this.buildWidget(); + this.changeIndexTo((this.indexSelected = this.selected()), true); // set the initial value + this.handleEvents('add'); + } + + buildWidget () { // ():void + const parentEl = insertSpanEl(this.el, false, { class: this.props.classNames.base }); + parentEl.appendChild(this.el); + parentEl.classList.add(this.props.classNames.base + '--' + this.direction); + const widgetEl = insertSpanEl(this.el, true, { class: this.props.classNames.base + '--stars' }); + this.values.forEach((item, index) => { + const el = createSpanEl({ 'data-index': index, 'data-value': item.value }); + if ('function' === typeof this.props.stars) { + this.props.stars.call(this, el, item, index); + } + [].forEach.call(el.children, el => el.style.pointerEvents = 'none'); + widgetEl.innerHTML += el.outerHTML; + }) + if (this.props.tooltip) { + widgetEl.setAttribute('role', 'tooltip'); + } + this.widgetEl = widgetEl; + } + + changeIndexTo (index, force) { // (int):void + if (this.indexActive !== index || force) { + this.widgetEl.childNodes.forEach((el, i) => { // i starts at zero + addRemoveClass(el, i <= index, this.props.classNames.active); + addRemoveClass(el, i === this.indexSelected, this.props.classNames.selected); + }); + if ('function' !== typeof this.props.stars) { // @v3 compat + this.widgetEl.classList.remove('s' + (10 * (this.indexActive + 1))); + this.widgetEl.classList.add('s' + (10 * (index + 1))); + } + if (this.props.tooltip) { + const label = index < 0 ? this.props.tooltip : this.values[index].text; + this.widgetEl.setAttribute('aria-label', label); + } + this.indexActive = index; + } + this.ticking = false; + } + + destroy () { // ():void + this.indexActive = null; // the active span index + this.indexSelected = this.selected(); // the selected span index + const wrapEl = this.el.parentNode; + if (wrapEl.classList.contains(this.props.classNames.base)) { + this.handleEvents('remove'); + wrapEl.parentNode.replaceChild(this.el, wrapEl); + } + } + + eventListener (el, action, events, items) { // (HTMLElement, string, array, object):void + events.forEach(ev => el[action + 'EventListener'](ev, this.events[ev], items || false)); + } + + handleEvents (action) { // (string):void + const formEl = this.el.closest('form'); + if (formEl && formEl.tagName === 'FORM') { + this.eventListener(formEl, action, ['reset']); + } + this.eventListener(this.el, action, ['change']); // always trigger the change event, even when SELECT is disabled + if ('add' === action && this.el.disabled) return; + this.eventListener(this.el, action, ['keydown']); + this.eventListener(this.widgetEl, action, ['mousedown', 'mouseleave', 'mousemove', 'touchend', 'touchmove'], + supportsPassiveEvents ? { passive: false } : false + ); + } + + indexFromEvent (ev) { // (MouseEvent|TouchEvent):void + const origin = ev.touches?.[0] || ev.changedTouches?.[0] || ev; + const el = document.elementFromPoint(origin.clientX, origin.clientY); + return parseInt(el.dataset.index || -1, 10); + } + + onChange () { // ():void + this.changeIndexTo(this.selected(), true); + } + + onKeyDown (ev) { // (KeyboardEvent):void + const key = ev.key.slice(5); + if (!~['Left', 'Right'].indexOf(key)) return; + let increment = key === 'Left' ? -1 : 1; + if (this.direction === 'rtl') { + increment *= -1; + } + const maxIndex = this.values.length - 1; + const minIndex = -1; + const index = Math.min(Math.max(this.selected() + increment, minIndex), maxIndex); + this.selectValue(index); + } + + onPointerDown (ev) { // (MouseEvent|TouchEvent):void + ev.preventDefault(); + this.el.focus(); // highlight the rating field + let index = this.indexFromEvent(ev); + if (this.props.clearable && index === this.indexSelected) { + index = -1; // remove the value + } + this.selectValue(index); + } + + onPointerLeave (ev) { // (MouseEvent):void + ev.preventDefault(); + cancelAnimationFrame(this.tick); + requestAnimationFrame(() => this.changeIndexTo(this.indexSelected)); + } + + onPointerMove (ev) { // (MouseEvent|TouchEvent):void + ev.preventDefault(); + if (!this.ticking) { + this.tick = requestAnimationFrame(() => this.changeIndexTo(this.indexFromEvent(ev))); + this.ticking = true; + } + } + + onReset () { // ():void + const index = this.el.querySelector('[selected]')?.index; + this.selectValue(this.values.findIndex(val => val.index === index)); + } + + selected () { // ():int + return this.values.findIndex(val => val.value === +this.el.value); // get the selected span index + } + + selectValue (index) { // (int):void + this.el.value = this.values[index]?.value || ''; // first set the value + this.indexSelected = this.selected(); // get the actual index from the selected value + this.el.dispatchEvent(new Event('change')); + } +} diff --git a/.babelrc b/.babelrc new file mode 100755 index 000000000..6fecc3b88 --- /dev/null +++ b/.babelrc @@ -0,0 +1,13 @@ +{ + "plugins": [ + "@babel/plugin-proposal-optional-chaining", + ["prismjs", { + "css": false, + "languages": ["javascript", "php", "html", "css"], + "plugins": ["line-numbers"] + }] + ], + "presets": [ + "@wordpress/default" + ] +} diff --git a/.gitignore b/.gitignore index 6f148775f..2656bccfa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .* +!.babelrc !.gitattributes !.gitignore !.jshintrc diff --git a/assets/scripts/site-reviews-admin.js b/assets/scripts/site-reviews-admin.js index 18617c943..983296563 100644 --- a/assets/scripts/site-reviews-admin.js +++ b/assets/scripts/site-reviews-admin.js @@ -1,2 +1,2 @@ /*! For license information please see site-reviews-admin.js.LICENSE.txt */ -!function(){var t={8:function(t){function i(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=i=function(t){return typeof t}:t.exports=i=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(e)}t.exports=i},9367:function(t,i){var e,n,s;n=[t,i],void 0===(s="function"==typeof(e=function(t,i){"use strict";var e,n,s="function"==typeof Map?new Map:(e=[],n=[],{has:function(t){return e.indexOf(t)>-1},get:function(t){return n[e.indexOf(t)]},set:function(t,i){-1===e.indexOf(t)&&(e.push(t),n.push(i))},delete:function(t){var i=e.indexOf(t);i>-1&&(e.splice(i,1),n.splice(i,1))}}),r=function(t){return new Event(t,{bubbles:!0})};try{new Event("test")}catch(t){r=function(t){var i=document.createEvent("Event");return i.initEvent(t,!0,!1),i}}function a(t){if(t&&t.nodeName&&"TEXTAREA"===t.nodeName&&!s.has(t)){var i=null,e=null,n=null,a=function(){t.clientWidth!==e&&d()},o=function(i){window.removeEventListener("resize",a,!1),t.removeEventListener("input",d,!1),t.removeEventListener("keyup",d,!1),t.removeEventListener("autosize:destroy",o,!1),t.removeEventListener("autosize:update",d,!1),Object.keys(i).forEach((function(e){t.style[e]=i[e]})),s.delete(t)}.bind(t,{height:t.style.height,resize:t.style.resize,overflowY:t.style.overflowY,overflowX:t.style.overflowX,wordWrap:t.style.wordWrap});t.addEventListener("autosize:destroy",o,!1),"onpropertychange"in t&&"oninput"in t&&t.addEventListener("keyup",d,!1),window.addEventListener("resize",a,!1),t.addEventListener("input",d,!1),t.addEventListener("autosize:update",d,!1),t.style.overflowX="hidden",t.style.wordWrap="break-word",s.set(t,{destroy:o,update:d}),c()}function c(){var e=window.getComputedStyle(t,null);"vertical"===e.resize?t.style.resize="none":"both"===e.resize&&(t.style.resize="horizontal"),i="content-box"===e.boxSizing?-(parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)):parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth),isNaN(i)&&(i=0),d()}function u(i){var e=t.style.width;t.style.width="0px",t.offsetWidth,t.style.width=e,t.style.overflowY=i}function l(t){for(var i=[];t&&t.parentNode&&t.parentNode instanceof Element;)t.parentNode.scrollTop&&i.push({node:t.parentNode,scrollTop:t.parentNode.scrollTop}),t=t.parentNode;return i}function h(){if(0!==t.scrollHeight){var n=l(t),s=document.documentElement&&document.documentElement.scrollTop;t.style.height="",t.style.height=t.scrollHeight+i+"px",e=t.clientWidth,n.forEach((function(t){t.node.scrollTop=t.scrollTop})),s&&(document.documentElement.scrollTop=s)}}function d(){h();var i=Math.round(parseFloat(t.style.height)),e=window.getComputedStyle(t,null),s="content-box"===e.boxSizing?Math.round(parseFloat(e.height)):t.offsetHeight;if(s]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}},8325:function(t,i,e){var n=function(t){var i=/\blang(?:uage)?-([\w-]+)\b/i,e=0,n={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function t(i){return i instanceof s?new s(i.type,t(i.content),i.alias):Array.isArray(i)?i.map(t):i.replace(/&/g,"&").replace(/=h.reach);j+=k.value.length,k=k.next){var x=k.value;if(i.length>t.length)return;if(!(x instanceof s)){var S,Q=1;if(m){if(!(S=r(_,j,t,v)))break;var F=S.index,z=S.index+S[0].length,A=j;for(A+=k.value.length;F>=A;)A+=(k=k.next).value.length;if(j=A-=k.value.length,k.value instanceof s)continue;for(var $=k;$!==i.tail&&(Ah.reach&&(h.reach=C);var E=k.prev;R&&(E=c(i,E,R),j+=R.length),u(i,E,Q),k=c(i,E,new s(d,y?n.tokenize(P,y):P,b,P)),L&&c(i,k,L),Q>1&&a(t,i,e,k.prev,j,{cause:d+","+p,reach:C})}}}}}function o(){var t={value:null,prev:null,next:null},i={value:null,prev:t,next:null};t.next=i,this.head=t,this.tail=i,this.length=0}function c(t,i,e){var n=i.next,s={value:e,prev:i,next:n};return i.next=s,n.prev=s,t.length++,s}function u(t,i,e){for(var n=i.next,s=0;s"+r.content+""},!t.document)return t.addEventListener?(n.disableWorkerMessageHandler||t.addEventListener("message",(function(i){var e=JSON.parse(i.data),s=e.language,r=e.code,a=e.immediateClose;t.postMessage(n.highlight(r,n.languages[s],s)),a&&t.close()}),!1),n):n;var l=n.util.currentScript();function h(){n.manual||n.highlightAll()}if(l&&(n.filename=l.src,l.hasAttribute("data-manual")&&(n.manual=!0)),!n.manual){var d=document.readyState;"loading"===d||"interactive"===d&&l&&l.defer?document.addEventListener("DOMContentLoaded",h):window.requestAnimationFrame?window.requestAnimationFrame(h):window.setTimeout(h,16)}return n}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});t.exports&&(t.exports=n),void 0!==e.g&&(e.g.Prism=n)},5251:function(){!function(t){var i=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:RegExp("[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+i.source+")*(?=\\s*\\{)"),string:{pattern:i,greedy:!0},property:/(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var e=t.languages.markup;e&&(e.tag.addInlined("style","css"),t.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/(^|["'\s])style\s*=\s*(?:"[^"]*"|'[^']*')/i,lookbehind:!0,inside:{"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{style:{pattern:/(["'])[\s\S]+(?=["']$)/,lookbehind:!0,alias:"language-css",inside:t.languages.css},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},"attr-name":/^style/i}}},e.tag))}(Prism)},9980:function(){Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\s*[\[$\w\xA0-\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-flags":/[a-z]+$/,"regex-delimiter":/^\/|\/$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.js=Prism.languages.javascript},6854:function(){!function(t){function i(t,i){return"___"+t.toUpperCase()+i+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(e,n,s,r){if(e.language===n){var a=e.tokenStack=[];e.code=e.code.replace(s,(function(t){if("function"==typeof r&&!r(t))return t;for(var s,o=a.length;-1!==e.code.indexOf(s=i(n,o));)++o;return a[o]=t,s})),e.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(e,n){if(e.language===n&&e.tokenStack){e.grammar=t.languages[n];var s=0,r=Object.keys(e.tokenStack);!function a(o){for(var c=0;c=r.length);c++){var u=o[c];if("string"==typeof u||u.content&&"string"==typeof u.content){var l=r[s],h=e.tokenStack[l],d="string"==typeof u?u:u.content,f=i(n,l),p=d.indexOf(f);if(p>-1){++s;var g=d.substring(0,p),y=new t.Token(n,t.tokenize(h,e.grammar),"language-"+n,h),v=d.substring(p+f.length),m=[];g&&m.push.apply(m,a([g])),m.push(y),v&&m.push.apply(m,a([v])),"string"==typeof u?o.splice.apply(o,[c,1].concat(m)):u.content=m}}else u.content&&a(u.content)}return o}(e.tokens)}}}})}(Prism)},4335:function(){Prism.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(t,i){var e={};e["language-"+i]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[i]},e.cdata=/^$/i;var n={"included-cdata":{pattern://i,inside:e}};n["language-"+i]={pattern:/[\s\S]+/,inside:Prism.languages[i]};var s={};s[t]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return t})),"i"),lookbehind:!0,greedy:!0,inside:n},Prism.languages.insertBefore("markup","cdata",s)}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml},9945:function(){!function(t){var i=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,e=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/,/\b(?:null)\b/i],n=/\b0b[01]+\b|\b0x[\da-f]+\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+)(?:e[+-]?\d+)?/i,s=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,r=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:i,variable:/\$+(?:\w+\b|(?={))/i,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},keyword:[{pattern:/(\(\s*)\b(?:bool|boolean|int|integer|float|string|object|array)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:bool|int|float|string|object|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*[a-z0-9_|]\|\s*)(?:null|false)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?[a-z0-9_|]\|\s*)(?:null|false)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|iterable|(?:null|false)(?=\s*\|))\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:null|false)\b/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},/\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|match|new|or|parent|print|private|protected|public|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i],"argument-name":/\b[a-z_]\w*(?=\s*:(?!:))/i,"class-name":[{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:e,function:/\w+\s*(?=\()/,property:{pattern:/(->)[\w]+/,lookbehind:!0},number:n,operator:s,punctuation:r};var a={pattern:/{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)*)/,lookbehind:!0,inside:t.languages.php},o=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:a}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:a}}];t.languages.insertBefore("php","variable",{string:o}),t.languages.insertBefore("php","variable",{attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=]$)/,lookbehind:!0,inside:{comment:i,string:o,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:e,number:n,operator:s,punctuation:r}},delimiter:{pattern:/^#\[|]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",(function(i){if(/<\?/.test(i.code)){t.languages["markup-templating"].buildPlaceholders(i,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/gi)}})),t.hooks.add("after-tokenize",(function(i){t.languages["markup-templating"].tokenizePlaceholders(i,"php")}))}(Prism)},8759:function(){!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var t="line-numbers",i=/\n(?!$)/g,e=Prism.plugins.lineNumbers={getLine:function(i,e){if("PRE"===i.tagName&&i.classList.contains(t)){var n=i.querySelector(".line-numbers-rows");if(n){var s=parseInt(i.getAttribute("data-start"),10)||1,r=s+(n.children.length-1);er&&(e=r);var a=e-s;return n.children[a]}}},resize:function(t){r([t])},assumeViewportIndependence:!0},n=function(t){return t?window.getComputedStyle?getComputedStyle(t):t.currentStyle||null:null},s=void 0;window.addEventListener("resize",(function(){e.assumeViewportIndependence&&s===window.innerWidth||(s=window.innerWidth,r(Array.prototype.slice.call(document.querySelectorAll("pre.line-numbers"))))})),Prism.hooks.add("complete",(function(e){if(e.code){var n=e.element,s=n.parentNode;if(s&&/pre/i.test(s.nodeName)&&!n.querySelector(".line-numbers-rows")&&Prism.util.isActive(n,t)){n.classList.remove(t),s.classList.add(t);var a,o=e.code.match(i),c=o?o.length+1:1,u=new Array(c+1).join("");(a=document.createElement("span")).setAttribute("aria-hidden","true"),a.className="line-numbers-rows",a.innerHTML=u,s.hasAttribute("data-start")&&(s.style.counterReset="linenumber "+(parseInt(s.getAttribute("data-start"),10)-1)),e.element.appendChild(a),r([s]),Prism.hooks.run("line-numbers",e)}}})),Prism.hooks.add("line-numbers",(function(t){t.plugins=t.plugins||{},t.plugins.lineNumbers=!0}))}function r(t){if(0!=(t=t.filter((function(t){var i=n(t)["white-space"];return"pre-wrap"===i||"pre-line"===i}))).length){var e=t.map((function(t){var e=t.querySelector("code"),n=t.querySelector(".line-numbers-rows");if(e&&n){var s=t.querySelector(".line-numbers-sizer"),r=e.textContent.split(i);s||((s=document.createElement("span")).className="line-numbers-sizer",e.appendChild(s)),s.innerHTML="0",s.style.display="block";var a=s.getBoundingClientRect().height;return s.innerHTML="",{element:t,lines:r,lineHeights:[],oneLinerHeight:a,sizer:s}}})).filter(Boolean);e.forEach((function(t){var i=t.sizer,e=t.lines,n=t.lineHeights,s=t.oneLinerHeight;n[e.length-1]=void 0,e.forEach((function(t,e){if(t&&t.length>1){var r=i.appendChild(document.createElement("span"));r.style.display="block",r.textContent=t}else n[e]=s}))})),e.forEach((function(t){for(var i=t.sizer,e=t.lineHeights,n=0,s=0;s

Unknown error.

')}))},t:function(t){this.event.preventDefault();var i=jQuery(this.event.currentTarget);i.is(":disabled")||(i.prop("disabled",!0),this.i(t,i))}};var s=n,r=e(9367),a=e.n(r),o=e(8),c=e.n(o),u=function(){"object"===c()(jQuery.wp)&&"function"==typeof jQuery.wp.wpColorPicker&&jQuery(document).find("input[type=text].color-picker-hex").each((function(){jQuery(this).wpColorPicker(jQuery(this).data("colorpicker")||{})}))},l=function(t){this.el=document.querySelector(t),this.el&&(this.depends=this.el.querySelectorAll("[data-depends]"),this.depends.length&&this.h())};l.prototype={p:function(t){var i=t.getAttribute("data-depends");if(i)try{return JSON.parse(i)}catch(t){return}},h:function(){for(var t=this.el.elements,i=0;i')),jQuery("#glsr-notices").html(t),jQuery(document).trigger("wp-updates-notice-added"))},h:function(){jQuery(".glsr-notice[data-dismiss]").on("click.wp-dismiss-notice",this.$.bind(this))},$:function(t){var i={};i[GLSR.nameprefix]={_action:"dismiss-notice",notice:jQuery(t.currentTarget).data("dismiss")},wp.ajax.post(GLSR.action,i)}};var g=p,y=function(){this.el=jQuery("#pinned-status-select"),this.el&&(this.cancel=jQuery("a.cancel-pinned-status"),this.cancel.on("click",this.P.bind(this)),this.edit=jQuery("a.edit-pinned-status"),this.edit.on("click",this.R.bind(this)),this.save=jQuery("a.save-pinned-status"),this.save.on("click",this.L.bind(this))),jQuery("td.column-is_pinned i.pin-review").on("click",this.C.bind(this))};y.prototype={G:function(){this.el.slideUp("fast"),this.edit.show().focus()},P:function(t){t.preventDefault(),this.G(),this.el.find("select").val("0"===jQuery("#hidden-pinned-status").val()?1:0)},R:function(t){t.preventDefault(),this.el.is(":hidden")&&(this.el.slideDown("fast",function(){this.el.find("select").focus()}.bind(this)),this.edit.hide())},L:function(t){t.preventDefault(),this.G(),this.target=t.currentTarget;var i={_action:"toggle-pinned",id:jQuery("#post_ID").val(),pinned:jQuery("#pinned-status").val()};new s(i).post(this.T.bind(this))},C:function(t){t.preventDefault(),this.target=t.currentTarget;var i={_action:"toggle-pinned",id:t.currentTarget.getAttribute("data-id")};jQuery(this.target).addClass("spinner is-active").removeClass("dashicons-sticky"),new s(i).post(this.O.bind(this))},T:function(t){jQuery("#pinned-status").val(0|!t.pinned),jQuery("#hidden-pinned-status").val(0|t.pinned),jQuery("#pinned-status-text").text(t.pinned?this.target.dataset.yes:this.target.dataset.no),GLSR.notices.add(t.notices)},O:function(t){this.target.classList[t.pinned?"add":"remove"]("pinned"),jQuery(this.target).removeClass("spinner is-active").addClass("dashicons-sticky")}};var v=y,m=function(){jQuery.each(GLSR.pointers,function(t,i){this.h(i)}.bind(this))};m.prototype={D:function(t){jQuery.post(GLSR.ajaxurl,{action:"dismiss-wp-pointer",pointer:t})},h:function(t){jQuery(t.target).pointer({content:t.options.content,position:t.options.position,close:this.D.bind(null,t.id)}).pointer("open").pointer("sendToTop"),jQuery(document).on("wp-window-resized",(function(){jQuery(t.target).pointer("reposition")}))}};var b=m,w=e(8325),k=e.n(w),j=(e(5433),e(4335),e(9980),e(6854),e(9945),e(5251),e(8759),function(t,i){this.el=jQuery(t),this.options=i,this.searchTerm=null,this.h()});j.prototype={defaults:{action:null,exclude:[],onInit:null,onResultClick:null,results:{},selected:-1,selectedClass:"glsr-selected-result",selectorEntries:".glsr-strings-table tbody",selectorResults:".glsr-search-results",selectorSearch:".glsr-search-input"},h:function(){this.options=jQuery.extend({},this.defaults,this.options),this.el.length&&(this.options.entriesEl=this.el.parent().find(this.options.selectorEntries),this.options.resultsEl=this.el.find(this.options.selectorResults),this.options.searchEl=this.el.find(this.options.selectorSearch),this.options.searchEl.attr("aria-describedby","live-search-desc"),"function"==typeof this.options.onInit&&this.options.onInit.call(this),this.I())},I:function(){this.options.searchEl.on("input",_.debounce(this.q.bind(this),500)),this.options.searchEl.on("keyup",this.M.bind(this)),this.options.searchEl.on("keydown keypress",(function(t){GLSR.keys.ENTER===t.which&&t.preventDefault()})),jQuery(document).on("click",this.N.bind(this)),jQuery(document).on("keydown",this.Z.bind(this))},W:function(){void 0!==this.searchRequest&&this.searchRequest.abort()},H:function(){this.W(),this.options.resultsEl.empty(),this.options.resultsEl.removeClass("is-active"),this.el.removeClass("is-active"),jQuery("body").removeClass("glsr-focus")},V:function(t){var i=this.options.entriesEl.children("tr").eq(t),e=this;i.find("td").css({backgroundColor:"#faafaa"}),i.fadeOut(350,(function(){jQuery(this).remove(),e.options.results={},e.B(),e.K()}))},U:function(t){jQuery("body").addClass("glsr-focus"),this.options.resultsEl.append(t),this.options.resultsEl.children("span").on("click",this.J.bind(this))},X:function(){this.options.entriesEl.on("click","a.delete",this.Y.bind(this)),this.options.entriesEl.sortable({items:"tr",tolerance:"pointer",start:function(t,i){i.placeholder.height(i.helper[0].scrollHeight)},sort:function(t,i){var e=t.pageY-jQuery(this).offsetParent().offset().top-i.helper.outerHeight(!0)/2;i.helper.css({top:e+"px"})}})},tt:function(t){this.options.selected+=t,this.options.results.removeClass(this.options.selectedClass),this.options.selected<0&&(this.options.selected=-1,this.options.searchEl.focus()),this.options.selected>=this.options.results.length&&(this.options.selected=this.options.results.length-1),this.options.selected>=0&&this.options.results.eq(this.options.selected).addClass(this.options.selectedClass).focus()},N:function(t){jQuery(t.target).find(this.el).length&&jQuery("body").hasClass("glsr-focus")&&this.H()},Z:function(t){if(!jQuery.isEmptyObject(this.options.results)){if(GLSR.keys.ESC===t.which&&this.H(),GLSR.keys.ENTER===t.which||GLSR.keys.SPACE===t.which){var i=this.options.resultsEl.find("."+this.options.selectedClass);i&&i.trigger("click")}GLSR.keys.UP===t.which&&(t.preventDefault(),this.tt(-1)),GLSR.keys.DOWN===t.which&&(t.preventDefault(),this.tt(1))}},Y:function(t){t.preventDefault(),this.V(jQuery(t.currentTarget).closest("tr").index())},J:function(t){t.preventDefault(),"function"==typeof this.options.onResultClick&&this.options.onResultClick.call(this,t),this.H()},q:function(t){if(this.W(),this.searchTerm===t.currentTarget.value&&this.options.results.length)return this.U(this.options.results);if(this.options.resultsEl.empty(),this.options.selected=-1,this.searchTerm=t.currentTarget.value,""===this.searchTerm)return this.it();this.el.addClass("is-active");var i={};i[GLSR.nameprefix]={_action:this.options.action,_nonce:this.el.find("#_search_nonce").val(),exclude:this.options.exclude,search:this.searchTerm},this.searchRequest=wp.ajax.post(GLSR.action,i).done(function(t){this.el.removeClass("is-active"),this.U(t.items?t.items:t.empty),this.options.results=this.options.resultsEl.children(),this.options.resultsEl.addClass("is-active"),delete this.searchRequest}.bind(this))},M:function(t){GLSR.keys.ESC===t.which&&this.it(),GLSR.keys.ENTER===t.which&&(this.q(t),t.preventDefault())},et:function(t){t.preventDefault();var i=jQuery(t.currentTarget).closest(".glsr-multibox-entry");i.find("a").css({color:"#c00"}),i.fadeOut("fast",(function(){i.remove()}))},B:function(){var t=this;this.options.exclude=[],this.options.entriesEl.children("tr").each((function(i){jQuery(this).find(".glsr-string-td2").children().filter(":input").each((function(){var e=jQuery(this),n=e.attr("name").replace(/\[\d+\]/i,"["+i+"]");e.attr("name",n),e.is("[data-id]")&&t.options.exclude.push({id:e.val()})}))}))},it:function(){this.H(),this.options.results={},this.options.searchEl.val("")},K:function(){var t=this.options.entriesEl.children().length>0?"remove":"add";this.options.entriesEl.parent()[t+"Class"]("glsr-hidden")}};var x=j,S=function(t){this.options=jQuery.extend({},this.defaults,t),this.tabs=document.querySelectorAll(this.options.tabSelector),this.tabs&&this.h()};S.prototype={defaults:{expandSelectors:".glsr-nav-view, .glsr-notice",tabSelector:".glsr-nav-tab"},h:function(){var t=this;[].forEach.call(t.tabs,function(i,e){i.addEventListener("click",t.$.bind(t)),i.addEventListener("touchend",t.$.bind(t))}.bind(t)),jQuery(t.options.expandSelectors).on("click","a",(function(){var i=jQuery(this).data("expand");localStorage.setItem("glsr-expand",i),t.nt(jQuery(i))})),jQuery(window).on("load",(function(){t.nt(jQuery(localStorage.getItem("glsr-expand")))}))},$:function(t){t.preventDefault(),this.st(t.currentTarget)},nt:function(t){if(t.length){var i=t.parent().parent();i.removeClass("collapsed"),this.rt(i),i.removeClass("collapsed"),t.parent().removeClass("closed").find(".glsr-accordion-trigger").attr("aria-expanded",!0),window.setTimeout((function(){t.parent()[0].scrollIntoView({behavior:"smooth",block:"center"}),localStorage.removeItem("glsr-expand")}),10)}},rt:function(t){var i=t.hasClass("collapsed")?"remove":"add";t[i+"Class"]("collapsed").find(".glsr-card.postbox")[i+"Class"]("closed").find(".glsr-accordion-trigger").attr("aria-expanded","add"!==i)},st:function(t){if(t.classList.contains("nav-tab-active")){var i=jQuery(t.getAttribute("href"));this.rt(i)}}};var Q=S,F=function(t){this.current=null,this.editor=null,this.create=function(t){if(this.editor=tinymce.get(t),this.editor){var i={_action:"mce-shortcode",shortcode:this.current};new s(i).post(this.at.bind(this))}};var i=document.querySelectorAll(t);i.length&&i.forEach(function(t){var i=t.querySelector("button"),e=t.querySelectorAll(".mce-menu-item");i&&e.length&&this.h(t,i,e)}.bind(this))};F.prototype={ot:{},ct:[],h:function(t,i,e){document.addEventListener("click",this.ut.bind(this,t,i)),i.addEventListener("click",this.lt.bind(this,t,i)),e.forEach(function(e){e.addEventListener("click",this.ht.bind(this,t,i))}.bind(this))},dt:function(){tinymce.execCommand("GLSR_Shortcode")},ft:function(){jQuery("#scTemp").length?this.dt():(jQuery("body").append('