-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshortcodes.js.map
7 lines (7 loc) · 72 KB
/
shortcodes.js.map
1
2
3
4
5
6
7
{
"version": 3,
"sources": ["node_modules/book-of-spells/src/parsers.mjs", "node_modules/book-of-spells/src/helpers.mjs", "node_modules/book-of-spells/src/dom.mjs", "src/lib/parsers.js", "src/lib/Shortcode.js", "src/shortcodes.js", "src/index.js"],
"sourcesContent": ["/** @module parsers */\n\n/**\n * Parse a string of attributes and return an object\n * \n * @param {string} str\n * @returns object\n * @example\n * parseAttributes('button text=\"Click me\" data='{\"key\": \\\"value\"}' class=\"btn btn-primary\"')\n * // => { button: null, text: 'Click me', data: '{\"key\": \"value\"}', class: 'btn btn-primary' }\n */\nexport function parseAttributes(str) {\n\tconst re = /\\s*(?:([a-z_]{1}[a-z0-9\\-_]*)=?(?:\"([^\"]+)\"|'([^']+)')*)\\s*/gi\n\tconst reWithoutValue = /^\\s*([a-z_]{1}[a-z0-9\\-_]*)\\s*$/i\n\tconst reHasValue = /^\\s*([a-z_]{1}[a-z0-9\\-_]*)=(\"[^\"]+\"|'[^']+')\\s*$/i\n\tconst reReplaceFirstAndLastQuote = /^[\"']|[\"']$/g\n\t\n\tconst res = {}\n\tconst match = str.match(re)\n\n\tfor (let i = 0; i < match.length; i++) {\n\t\tconst m = match[i]\n\t\tif (m === '') continue\n\n\t\tif (reWithoutValue.test(m)) {\n\t\t\tconst [, key] = m.match(reWithoutValue)\n\t\t\tres[key] = null\n\t\t\treWithoutValue.lastIndex = 0\n\t\t} else if (reHasValue.test(m)) {\n\t\t\tconst [, key, value] = m.match(reHasValue)\n\t\t\tres[key] = value.replace(reReplaceFirstAndLastQuote, '')\n\t\t\treReplaceFirstAndLastQuote.lastIndex = 0\n\t\t\treHasValue.lastIndex = 0\n\t\t}\n\t}\n\n\treturn res\n}\n", "/**\n * Shallow merges two objects together. Used to pass simple options to functions.\n * \n * @param {object} target The target object to merge into\n * @param {object} source The source object to merge from\n * @returns object The merged object\n * @example\n * const target = { foo: 'bar' }\n * const source = { bar: 'baz' }\n * shallowMerge(target, source) // { foo: 'bar', bar: 'baz' }\n */\nexport function shallowMerge(target, source) {\n for (const key in source) {\n target[key] = source[key]\n }\n}\n\n/**\n * Deep merge function that's mindful of arrays and objects\n * \n * @param {object} target The target object to merge into\n * @param {object} source The source object to merge from\n * @returns object The merged object\n * @example\n * const target = { foo: 'bar' }\n * const source = { bar: 'baz' }\n * deepMerge(target, source) // { foo: 'bar', bar: 'baz' }\n */\nexport function deepMerge(target, source) {\n if (isObject(source) && isObject(target)) {\n for (const key in source) {\n target[key] = deepMerge(target[key], source[key])\n }\n } else if (isArray(source) && isArray(target)) {\n for (let i = 0; i < source.length; i++) {\n target[i] = deepMerge(target[i], source[i])\n }\n } else {\n target = source\n }\n return target\n}\n\n/**\n * Deep clone function that's mindful of arrays and objects\n * \n * @param {object} o The object to clone\n * @returns object The cloned object\n * @example\n * const obj = { foo: 'bar' }\n * const clone = clone(obj)\n * clone.foo = 'baz'\n * console.log(obj.foo) // 'bar'\n * console.log(clone.foo) // 'baz'\n * console.log(obj === clone) // false\n * console.log(JSON.stringify(obj) === JSON.stringify(clone)) // true\n * @todo Check if faster than assign. This function is pretty old...\n */ \nexport function clone(o) {\n let res = null\n if (isArray(o)) {\n res = []\n for (const i in o) {\n res[i] = clone(o[i])\n }\n } else if (isObject(o)) {\n res = {}\n for (const i in o) {\n res[i] = clone(o[i])\n }\n } else {\n res = o\n }\n return res\n}\n\n/**\n * Check if an object is empty\n * \n * @param {object} o The object to check\n * @returns boolean True if the object is empty, false otherwise\n * @example\n * isEmptyObject({}) // => true\n * isEmptyObject({ foo: 'bar' }) // => false\n */\nexport function isEmptyObject(o) {\n for (const i in o) {\n return false\n }\n return true\n}\n\n/**\n * Check if an array is empty, substitute for Array.length === 0\n * \n * @param {array} o The array to check\n * @returns boolean True if the array is empty, false otherwise\n * @example\n * isEmptyArray([]) // => true\n * isEmptyArray([1, 2, 3]) // => false\n */\nexport function isEmptyArray(o) {\n return o.length === 0\n}\n\n/**\n * Check if a variable is empty\n * \n * @param {any} o The variable to check\n * @returns boolean True if the variable is empty, false otherwise\n * @example\n * isEmpty({}) // => true\n * isEmpty([]) // => true\n * isEmpty('') // => true\n * isEmpty(null) // => false\n * isEmpty(undefined) // => false\n * isEmpty(0) // => false\n */\nexport function isEmpty(o) {\n if (isObject(o)) {\n return isEmptyObject(o)\n } else if (isArray(o)) {\n return isEmptyArray(o)\n } else if (isString(o)) {\n return o === ''\n }\n return false\n}\n\n/**\n * Try to convert a string to a boolean\n * \n * @param {string} str The string to convert\n * @returns boolean The converted boolean or undefined if conversion failed\n * @example\n * stringToBoolean('true') // => true\n * stringToBoolean('false') // => false\n * stringToBoolean('foo') // => null\n */\nexport function stringToBoolean(str) {\n if (/^\\s*(true|false)\\s*$/i.test(str)) return str === 'true'\n}\n\n/**\n * Try to convert a string to a number\n * \n * @param {string} str The string to convert\n * @returns number The converted number or undefined if conversion failed\n * @example\n * stringToNumber('1') // => 1\n * stringToNumber('1.5') // => 1.5\n * stringToNumber('foo') // => null\n * stringToNumber('1foo') // => null\n */\nexport function stringToNumber(str) {\n if (/^\\s*\\d+\\s*$/.test(str)) return parseInt(str)\n if (/^\\s*[\\d.]+\\s*$/.test(str)) return parseFloat(str)\n}\n\n/**\n * Try to convert a string to an array\n * \n * @param {string} str The string to convert\n * @returns array The converted array or undefined if conversion failed\n * @example\n * stringToArray('[1, 2, 3]') // => [1, 2, 3]\n * stringToArray('foo') // => null\n * stringToArray('1') // => null\n * stringToArray('{\"foo\": \"bar\"}') // => null\n */\nexport function stringToArray(str) {\n if (!/^\\s*\\[.*\\]\\s*$/.test(str)) return\n try {\n return JSON.parse(str)\n } catch (e) {}\n}\n\n/**\n * Try to convert a string to an object\n * \n * @param {string} str The string to convert\n * @returns object The converted object or undefined if conversion failed\n * @example\n * stringToObject('{ \"foo\": \"bar\" }') // => { foo: 'bar' }\n * stringToObject('foo') // => null\n * stringToObject('1') // => null\n * stringToObject('[1, 2, 3]') // => null\n */\nexport function stringToObject(str) {\n if (!/^\\s*\\{.*\\}\\s*$/.test(str)) return\n try {\n return JSON.parse(str)\n } catch (e) {}\n}\n\n/**\n * Try to convert a string to a regex\n * \n * @param {string} str The string to convert\n * @returns regex The converted regex or undefined if conversion failed\n * @example\n * stringToRegex('/foo/i') // => /foo/i\n * stringToRegex('foo') // => null\n * stringToRegex('1') // => null\n */\nexport function stringToRegex(str) {\n if (!/^\\s*\\/.*\\/g?i?\\s*$/.test(str)) return\n try {\n return new RegExp(str)\n } catch (e) {}\n}\n\n/**\n * Try to convert a string to a primitive\n * \n * @param {string} str The string to convert\n * @returns {null|boolean|int|float|string} The converted primitive or input string if conversion failed\n * @example\n * stringToPrimitive('null') // => null\n * stringToPrimitive('true') // => true\n * stringToPrimitive('false') // => false\n * stringToPrimitive('1') // => 1\n * stringToPrimitive('1.5') // => 1.5\n * stringToPrimitive('foo') // => 'foo'\n * stringToPrimitive('1foo') // => '1foo'\n */\nexport function stringToPrimitive(str) {\n if (/^\\s*null\\s*$/.test(str)) return null\n const bool = stringToBoolean(str)\n if (bool !== undefined) return bool\n return stringToNumber(str) || str\n}\n\n/**\n * Try to convert a string to a data type\n * \n * @param {string} str The string to convert\n * @returns any The converted data type or input string if conversion failed\n * @example\n * stringToData('null') // => null\n * stringToData('true') // => true\n * stringToData('false') // => false\n * stringToData('1') // => 1\n * stringToData('1.5') // => 1.5\n * stringToData('foo') // => 'foo'\n * stringToData('1foo') // => '1foo'\n * stringToData('[1, 2, 3]') // => [1, 2, 3]\n * stringToData('{ \"foo\": \"bar\" }') // => { foo: 'bar' }\n * stringToData('/foo/i') // => /foo/i\n */\nexport function stringToType(str) {\n if (/^\\s*null\\s*$/.test(str)) return null\n const bool = stringToBoolean(str)\n if (bool !== undefined) return bool\n return stringToNumber(str) || stringToArray(str) || stringToObject(str) || stringToRegex(str) || str\n}\n\n/**\n * If provided variable is an object\n * \n * @param {any} o \n * @returns boolean\n * @example\n * isObject({}) // => true\n * isObject([]) // => false\n * isObject(null) // => false\n */\nexport function isObject(o) {\n return typeof o === 'object' && !Array.isArray(o) && o !== null\n}\n\n/**\n * If provided variable is an array. Just a wrapper for Array.isArray\n * \n * @param {any} o\n * @returns boolean\n * @example\n * isArray([]) // => true\n * isArray({}) // => false\n */\nexport function isArray(o) {\n return Array.isArray(o)\n}\n\n/**\n * If provided variable is a string. Just a wrapper for typeof === 'string'\n * \n * @param {any} o\n * @returns boolean\n * @example\n * isString('foo') // => true\n * isString({}) // => false\n */\nexport function isString(o) {\n return typeof o === 'string'\n}\n\n/**\n * If provided variable is a function, substitute for typeof === 'function'\n * \n * @param {any} o\n * @returns boolean\n * @example\n * isFunction(function() {}) // => true\n * isFunction({}) // => false\n */\nexport function isFunction(o) {\n return typeof o === 'function'\n}\n\n/**\n * If object property is a function\n * \n * @param {object} obj\n * @param {string} propertyName\n * @returns boolean\n * @example\n * const obj = { foo: 'bar', baz: function() {} }\n * propertyIsFunction(obj, 'foo') // => false\n * propertyIsFunction(obj, 'baz') // => true\n */\nexport function propertyIsFunction(obj, propertyName) {\n return obj.hasOwnProperty(propertyName) && isFunction(obj[propertyName])\n}\n\n/**\n * If object property is a string\n * \n * @param {object} obj\n * @param {string} propertyName\n * @returns boolean\n * @example\n * const obj = { foo: 'bar', baz: function() {} }\n * propertyIsString(obj, 'foo') // => true\n * propertyIsString(obj, 'baz') // => false\n */\nexport function propertyIsString(obj, propertyName) {\n return obj.hasOwnProperty(propertyName) && isString(obj[propertyName])\n}\n\n/**\n * Transforms a dash-case string to camelCase\n *\n * @param {string} str\n * @returns boolean\n * @example\n * transformDashToCamelCase('foo-bar') // => 'fooBar'\n * transformDashToCamelCase('foo-bar-baz') // => 'fooBarBaz'\n * transformDashToCamelCase('foo') // => 'foo'\n * transformDashToCamelCase('fooBarBaz-qux') // => 'fooBarBazQux'\n */\nexport function transformDashToCamelCase(str) {\n return str.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() });\n}\n\n/**\n * Maps an array of objects by a property name\n * \n * @param {array} arr\n * @param {string} propertyName\n * @returns object\n * @example\n * const arr = [{ foo: 'bar' }, { foo: 'baz' }]\n * mapByProperty(arr, 'foo') // => { bar: { foo: 'bar' }, baz: { foo: 'baz' } }\n */\nexport function mapByProperty(arr, propertyName) {\n const res = {}\n for (let i = 0; i < arr.length; i++) {\n res[arr[i][propertyName]] = arr[i]\n }\n return res\n}\n\n/**\n * Maps an array of objects by a property name to another property name\n * \n * @param {array} arr\n * @param {string} keyPropertyName\n * @param {string} valuePropertyName\n * @returns object\n * @example\n * const arr = [{ foo: 'bar', baz: 'qux' }, { foo: 'quux', baz: 'corge' }]\n * mapPropertyToProperty(arr, 'foo', 'baz') // => { bar: 'qux', quux: 'corge' }\n */\nexport function mapPropertyToProperty(arr, keyPropertyName, valuePropertyName) {\n const res = {}\n for (let i = 0; i < arr.length; i++) {\n res[arr[i][keyPropertyName]] = arr[i][valuePropertyName]\n }\n return res\n}\n\n/**\n * Remove accents from a string\n * \n * @param {string} inputString\n * @returns string\n * @example\n * removeAccents('\u00E1\u00E9\u00ED\u00F3\u00FA') // => 'aeiou'\n * removeAccents('\u00C1\u00C9\u00CD\u00D3\u00DA') // => 'AEIOU'\n * removeAccents('se\u00F1or') // => 'senor'\n * removeAccents('\u0152') // => 'OE'\n */\nexport function removeAccents(inputString) {\n return inputString.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '').replace(/\\\u0153/g, \"oe\").replace(/\\\u00E6/g, \"ae\").normalize('NFC')\n}\n\n/**\n * Strip HTML tags from a string\n * \n * @param {string} inputString\n * @returns string\n * @example\n * stripHTMLTags('<span>foo</span>') // => 'foo'\n * stripHTMLTags('<span>foo</span> <span>bar</span>') // => 'foo bar'\n */\nexport function stripHTMLTags(inputString) {\n return inputString.replace(/<[^>]*>/g, '')\n}\n\n/**\n * Slugify a string, e.g. 'Foo Bar' => 'foo-bar'. Similar to WordPress' sanitize_title(). Will remove accents and HTML tags.\n * \n * @param {string} str \n * @returns string\n * @example\n * slugify('Foo Bar') // => 'foo-bar'\n * slugify('Foo Bar <span>baz</span>') // => 'foo-bar-baz'\n */\nexport function slugify(str) {\n str = str.trim().toLowerCase()\n str = removeAccents(str)\n str = stripHTMLTags(str)\n return str.replace(/\\s+|\\.+|\\/+|\\\\+|\u2014+|\u2013+/g, '-').replace(/[^\\w0-9\\-]+/g, '').replace(/-{2,}/g, '-').replace(/^-|-$/g, '')\n}\n\n/**\n * Check if object has multiple properties\n * \n * @param {object} obj\n * @param {string|array} properties\n * @returns boolean\n * @example\n * const obj = { foo: 'bar', baz: 'qux' }\n * hasOwnProperties(obj, ['foo', 'baz']) // => true\n * hasOwnProperties(obj, ['foo', 'baz', 'qux']) // => false\n */\nexport function hasOwnProperties(obj, properties) {\n if(!isArray(properties)) properties = [properties]\n for (let i = 0; i < properties.length; i++) {\n if (!obj.hasOwnProperty(properties[i])) return false\n }\n return true\n}\n", "/** @module dom */\n\nimport { transformDashToCamelCase } from './helpers.mjs'\nimport { isArray, isString } from './helpers.mjs'\n\n/**\n * Checks if an element is empty\n * \n * @param {HTMLElement} element \n * @returns boolean\n * @example\n * document.body.innerHTML = `\n * <div id=\"empty-element\"></div>\n * <div id=\"non-empty-element1\">foo</div>\n * <div id=\"non-empty-element2\"><br></div>`\n * \n * isEmptyElement(document.getElementById('empty-element')) // => true\n * isEmptyElement(document.getElementById('non-empty-element1')) // => false\n * isEmptyElement(document.getElementById('non-empty-element2')) // => false\n */\nexport function isEmptyElement(element) {\n return element.innerHTML.trim() === ''\n}\n\n/**\n * Removes all elements matching a selector from the DOM\n * \n * @param {string|HTMLElement|Element} selector The selector to select elements to remove\n * @param {HTMLElement|Element} [from=document] The element to remove elements from\n * @example\n * document.body.innerHTML = `\n * <div id=\"foo\"></div>\n * <div id=\"bar\"></div>\n * <div id=\"baz\"></div>`\n * `\n * remove('#foo, #bar') // => removes #foo and #bar\n */\nexport function remove(selector, from = document) {\n const elements = query(selector, from)\n for (const element of elements) {\n element.remove()\n }\n}\n\n/**\n * Queries the DOM for a single element and returns it. Substitutes for `document.querySelector(selector)` and JQuery's `$(selector).first()`\n * \n * @param {string|HTMLElement|Element|Array<HTMLElement|Element>|NodeList} selector The selector to select an element\n * @param {HTMLElement|Element} [from=document] The element to query from\n * @returns {HTMLElement|Element}\n * @example\n * document.body.innerHTML = `\n * <div id=\"foo\"></div>\n * <div id=\"bar\"></div>\n * <div id=\"baz\"></div>`\n * \n * querySingle('#foo') // => <div id=\"foo\"></div>\n * querySingle(document.getElementById('foo')) // => <div id=\"foo\"></div>\n * querySingle(document.querySelector('#foo')) // => <div id=\"foo\"></div>\n */\nexport function querySingle(selector, from = document) {\n if (selector instanceof Element) return selector\n return from.querySelector(selector)\n}\n\n/**\n * Queries the DOM for elements and returns them. Substitutes for `document.querySelectorAll(selector)` and JQuery's `$(selector)`\n * \n * @param {string|HTMLElement|Element|Array<HTMLElement|Element>|NodeList} selector The selector to select elements\n * @param {HTMLElement|Element} [from=document] The element to query from\n * @returns {Array<Element>|NodeList}\n * @example\n * document.body.innerHTML = `\n * <div id=\"foo\"></div>\n * <div id=\"bar\"></div>\n * <div id=\"baz\"></div>`\n * \n * query('#foo') // => [<div id=\"foo\"></div>]\n * query(document.getElementById('foo')) // => [<div id=\"foo\"></div>]\n * query('div') // => [<div id=\"foo\"></div>, <div id=\"bar\"></div>, <div id=\"baz\"></div>]\n */\nexport function query(selector, from = document) {\n if (selector instanceof Array || selector instanceof NodeList) return selector\n if (selector instanceof Element) return [selector]\n if (from instanceof Element || from instanceof Document) return from.querySelectorAll(selector)\n if (isString(from)) from = query(from)\n if (!from instanceof Array && !from instanceof NodeList) return []\n const res = []\n for (const element of from) {\n res.push(...element.querySelectorAll(selector))\n }\n return res\n}\n\n/**\n * Sets element styles from passed object of styles. Can also transform dash-case to camelCase for CSS properties\n * \n * @param {HTMLElement} element The element to set styles on\n * @param {object} styles The object of styles to set\n * @param {boolean} transform Whether to transform dash-case to camelCase for CSS properties\n * @example\n * css(document.getElementById('foo'), { 'background-color': 'red', 'font-size': '16px' }, true) // => sets background-color and font-size\n * css(document.getElementById('foo'), { backgroundColor: 'red', fontSize: '16px' }) // => sets background-color and font-size\n */\nexport function css(element, styles, transform = false) {\n if (!element || !styles) return\n for (let property in styles) {\n if (transform) property = transformDashToCamelCase(property)\n element.style[property] = styles[property]\n }\n}\n\n/**\n * Decodes HTML entities in a string\n * \n * @param {string} html The HTML string to decode\n * @returns {string} The decoded HTML string\n * @example\n * decodeHTML('<div>foo</div>') // => '<div>foo</div>'\n * decodeHTML('<div>foo</div><div>bar</div>') // => '<div>foo</div><div>bar</div>'\n */\nexport function decodeHTML(html) {\n const txt = document.createElement('textarea')\n txt.innerHTML = html\n const res = txt.value\n txt.remove()\n return res\n}\n\n/**\n * Inserts an element before another element\n * \n * @param {HTMLElement} targetElement The element to insert before\n * @param {HTMLElement} newElement The element to insert\n * @example\n * const target = document.getElementById('target')\n * const newElement = document.createElement('div')\n * newElement.id = 'newElement'\n * insertBeforeElement(target, newElement)\n * // <div id=\"newElement\"></div>\n * // <div id=\"target\"></div>\n */\nexport function insertBeforeElement(targetElement, newElement) {\n if (!targetElement || !newElement) return\n targetElement.parentNode.insertBefore(newElement, targetElement);\n}\n\n/**\n * Toggles an attribute value on an element\n * \n * @param {HTMLElement} element The element to toggle the attribute on\n * @param {string} attribute The attribute to toggle\n * @param {string} on Default: 'true'\n * @param {string} off Default: 'false'\n * @example\n * toggleAttributeValue(element, 'aria-expanded', 'true', 'false')\n * toggleAttributeValue(element, 'aria-expanded')\n */\nexport function toggleAttributeValue(element, attribute, on = 'true', off = 'false') {\n if (!element.hasAttribute(attribute)) return\n\n if (element.getAttribute(attribute) === on) {\n element.setAttribute(attribute, off)\n } else {\n element.setAttribute(attribute, on)\n }\n}\n\n/**\n * Converts a duration string to milliseconds integer\n * \n * @param {string} duration The duration string to convert, e.g. '1s', '100ms', '0.5s'\n * @returns {number} The duration in milliseconds\n * @example\n * convertToMilliseconds('1s') // 1000\n * convertToMilliseconds('100ms') // 100\n * convertToMilliseconds('0.5s') // 500\n * convertToMilliseconds('0.5') // 0\n * convertToMilliseconds('foo') // 0\n */\nexport function cssTimeToMilliseconds(duration) {\n const regExp = new RegExp('([0-9.]+)([a-z]+)', 'i')\n const matches = regExp.exec(duration)\n if (!matches) return 0\n \n const unit = matches[2]\n switch (unit) {\n case 'ms':\n return parseFloat(matches[1])\n case 's':\n return parseFloat(matches[1]) * 1000\n default:\n return 0\n }\n}\n\n/**\n * Returns a map of transition properties and durations\n * \n * @param {HTMLElement} element The element to get the transition properties and durations from\n * @returns {object<string, number>} A map of transition properties and durations\n * @example\n * getTransitionDurations(element) // { height: 1000 } if transition in CSS is set to 'height 1s'\n * getTransitionDurations(element) // { height: 500, opacity: 1000 } if transition in CSS is set to 'height 0.5s, opacity 1s'\n */\nexport function getTransitionDurations(element) {\n if (!element) {}\n const styles = getComputedStyle(element)\n const transitionProperties = styles.getPropertyValue('transition-property').split(',')\n const transitionDurations = styles.getPropertyValue('transition-duration').split(',')\n \n const map = {}\n \n for (let i = 0; i < transitionProperties.length; i++) {\n const property = transitionProperties[i].trim()\n map[property] = transitionDurations.hasOwnProperty(i) ? cssTimeToMilliseconds(transitionDurations[i].trim()) : null\n }\n \n return map\n}\n\n/**\n * Check a list of elements if any of them matches a selector\n * \n * @param {Array<HTMLElement>|NodeList|HTMLElement} elements The elements to check\n * @param {string} selector The selector to check\n * @returns {boolean} True if any of the elements matches the selector, false otherwise\n * @example\n * document.body.innerHTML = `\n * <div id=\"foo\"></div>\n * <div id=\"bar\"></div>\n * <div id=\"baz\"></div>`\n * \n * matchesAny(document.querySelectorAll('div'), '#foo') // => true\n * matchesAny(document.querySelectorAll('div'), '#qux') // => false\n */\nexport function matchesAny(elements, selector) {\n if (!elements || !selector || !elements.length) return false\n if (elements instanceof Element) elements = [elements]\n if (isString(elements)) elements = query(elements)\n for (const element of elements) {\n if (element.matches(selector)) return true\n }\n return false\n}\n\n/**\n * Check a list of elements if all of them matches a selector\n * \n * @param {Array<HTMLElement>|NodeList|HTMLElement} elements The elements to check\n * @param {string} selector The selector to check\n * @returns {boolean} True if all of the elements matches the selector, false otherwise\n * @example\n * document.body.innerHTML = `\n * <div id=\"foo\"></div>\n * <div id=\"bar\"></div>\n * <div id=\"baz\"></div>`\n * \n * matchesAll(document.querySelectorAll('div'), 'div') // => true\n * matchesAll(document.querySelectorAll('div'), '#foo') // => false\n */\nexport function matchesAll(elements, selector) {\n if (!elements || !selector || !elements.length) return false\n if (elements instanceof Element) elements = [elements]\n if (isString(elements)) elements = query(elements)\n for (const element of elements) {\n if (!element.matches(selector)) return false\n }\n return true\n}\n\n\n/**\n * Detaches an element from the DOM and returns it\n * \n * @param {HTMLElement} element The element to detach\n * @example\n * detachElement(element)\n * // => element\n * console.log(element.parentNode) // => null\n */\nexport function detachElement(element) {\n if (element && element.parentNode) {\n element.parentNode.removeChild(element);\n }\n return element\n}\n\n/**\n * Gets table data from a table element, a simple regular table element, or a table like structure.\n * Useful for scraping data.\n * \n * @param {string} selector The selector to select the table element\n * @param {Array<string>|string|null} headers The headers to use for the data. If 'auto' is passed, the row containing th or the first row will be used as headers\n * @param {string} [rowSelector='tr'] The selector to select the rows\n * @param {string} [cellSelector='td'] The selector to select the cells\n * @returns {Array<object>} An array of objects with the properties as keys and the cell values as values\n * @example\n * document.body.innerHTML = `\n * <table id=\"table\">\n * <thead>\n * <tr>\n * <th>Foo</th>\n * <th>Bar</th>\n * </tr>\n * </thead>\n * <tbody>\n * <tr>\n * <td>Foo 1</td>\n * <td>Bar 1</td>\n * </tr> \n * <tr>\n * <td>Foo 2</td>\n * <td>Bar 2</td>\n * </tr>\n * </tbody>\n * </table>`\n * \n * getTableData('#table', ['foo', 'bar'])\n * // => [\n * // { foo: 'Foo 1', bar: 'Bar 1' },\n * // { foo: 'Foo 2', bar: 'Bar 2' }\n * // ]\n */\nexport function getTableData(selector, headers, rowSelector = 'tr', cellSelector = 'td', headerCellSelector = 'th') {\n const table = typeof selector === 'string' ? document.querySelector(selector) : selector\n const res = []\n const rows = table.querySelectorAll(rowSelector)\n let start = 0\n\n function iterateHeaders(arr) {\n if (!arr || !arr.length) return\n const res = []\n for (let i = 0; i < arr.length; i++) {\n res.push(arr[i].textContent.trim())\n }\n return res\n }\n\n if (headers && isString(headers) && headers === 'auto') {\n let headerCells = table.querySelectorAll(headerCellSelector)\n \n if (headerCells && headerCells.length) {\n headers = iterateHeaders(headerCells)\n } else {\n headers = iterateHeaders(rows[0].querySelectorAll(cellSelector))\n start = 1\n }\n }\n\n for (let i = start; i < rows.length; i++) {\n const row = rows[i]\n const cells = row.querySelectorAll(cellSelector)\n if (!cells || !cells.length) continue\n\n let rowData = []\n if (headers && isArray(headers) && headers.length) {\n rowData = {}\n for (let j = 0; j < headers.length; j++) {\n rowData[headers[j]] = cells[j] ? cells[j].textContent.trim() : null\n }\n } else {\n for (let j = 0; j < cells.length; j++) {\n rowData.push(cells[j].textContent.trim())\n }\n }\n res.push(rowData)\n }\n return res\n}\n", "/**\n * Get the shortcode content from a string if shortcode is present\n * \n * @param {string} string - The string to parse\n * @returns {string} - The shortcode content\n * @example\n * getShortcodeContent('[shortcode foo=\"bar\"]')\n * // => 'shortcode foo=\"bar\"'\n */\nexport function getShortcodeContent(str) {\n\tconst re = /\\[([^\\[\\]]+)\\]/i\n\tconst match = str.match(re)\n\treturn match ? match[1] : null\n}\n\n/**\n * Check if it is a specific closing tag from provided shortcode content (meaning without the brackets)\n * \n * @param {string} string - The string to parse, shortcode content without the brackets\n * @param {string} tag - The shortcode tag to check\n * @returns {boolean} - True if it is a specific closing tag, false otherwise\n * @example\n * const shortcodeTagContent = getShortcodeContent('[/ shortcode ]')\n * isSpecificClosingTag(shortcodeTagContent, 'shortcode')\n * // => true\n */\nexport function isSpecificClosingTag(str, tag) {\n\tconst re = new RegExp(`^\\\\/\\\\s*${tag}\\\\s*$`, 'i')\n\treturn re.test(str)\n}\n\n/**\n * Get the shortcode name from shortcode content\n * \n * @param {string} string - The string to parse, shortcode content without the brackets\n * @returns {string} - The shortcode name\n * @example\n * const testShortcodeTagContent = getShortcodeContent('[shortcode foo=\"bar\"]')\n * getShortcodeName(testShortcodeTagContent)\n * // => 'shortcode'\n */\nexport function getShortcodeName(str) {\n\tconst re = /^\\/?\\s*([a-z_]{1}[a-z0-9\\-_]*)\\s*/i\n\tconst match = str.match(re)\n\treturn match ? match[1] : null\n}\n", "import { clone, shallowMerge, propertyIsFunction, parseAttributes } from 'book-of-spells';\nimport { getShortcodeName } from './parsers';\n\nexport class Shortcode {\n\tconstructor(tag_content, descriptor, counter, opts) {\n\t\tconst name = getShortcodeName(tag_content)\n\t\tconst attributes = parseAttributes(tag_content)\n\t\tdelete attributes[name]\n\n\t\tthis.tag_content = tag_content\n\t\tthis.uid = `${name}-sc-${counter}`\n\t\tthis.name = name\n\t\tthis.attributes = attributes\n\t\tthis.descriptor = clone(descriptor)\n\t\tthis.content = []\n\t\tthis.counter = counter\n\t\tthis.classes = []\n\t\tthis.css = {}\n\t\tthis.options = {\n\t\t\tplacement_class_prefix: 'shortcode-landing',\n\t\t}\n\n\t\tif (opts) {\n\t\t\tshallowMerge(this.options, opts)\n\t\t}\n\t}\n\n\texecuteAttributes() {\n\t\tvar self = this\n\t\tconst fns = {}\n\n\t\tfns['header-class'] = function(shortcode_obj, value) {\n\t\t\tlet header = null\n\n\t\t\tif (shortcode_obj.descriptor.hasOwnProperty('header_selector') && shortcode_obj.descriptor.header_selector) {\n\t\t\t\theader = document.querySelector(shortcode_obj.descriptor.header_selector)\n\t\t\t}\n\n\t\t\tif (!header) header = document.querySelector('header')\n\t\t\tif (!header) header = document.querySelector('body')\n\n\t\t\theader.classList.add(value)\n\t\t}\n\n\t\tfns['body-class'] = function(shortcode_obj, value) {\n\t\t\tdocument.querySelector('body').classList.add(value)\n\t\t}\n\n\t\tfns['placement'] = function(shortcode_obj, value) {\n\t\t\tif (value === 'content') {\n\t\t\t\tshortcode_obj.descriptor.anchor = 'self'\n\t\t\t\treturn\n\t\t\t}\n\t\t\tshortcode_obj.descriptor.anchor = `.${self.options.placement_class_prefix}-${value}`\n\t\t}\n\n\t\tfns['background-color'] = function(shortcode_obj, value) {\n\t\t\tshortcode_obj.css['backgroundColor'] = value\n\t\t}\n\n\t\tfns['background-image'] = function(shortcode_obj, value) {\n\t\t\tshortcode_obj.css['backgroundImage'] = `url(${value})`\n\t\t}\n\n\t\tfns['color'] = function(shortcode_obj, attr) {\n\t\t\tshortcode_obj.css['color'] = attr\n\t\t}\n\n\t\t//Descriptor can carry custom attribute parsers. They can override the default ones\n\t\tif (this.descriptor.hasOwnProperty('attribute_parsers')) {\n\t\t\tfor (const k in this.descriptor.attribute_parsers) {\n\t\t\t\tif (propertyIsFunction(this.descriptor.attribute_parsers, k)) {\n\t\t\t\t\tfns[k] = this.descriptor.attribute_parsers[k]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const key in this.attributes) {\n\t\t\tconst value = this.attributes[key]\n\n\t\t\tif (fns.hasOwnProperty(key) && value) {\n\t\t\t\tfns[key](this, value)\n\t\t\t} else {\n\t\t\t\tthis.classes.push(key)\n\t\t\t}\n\t\t}\n\n\t\treturn this\n\t}\n}\n\nexport default Shortcode\n", "import { clone, shallowMerge, remove, insertBeforeElement, propertyIsFunction, css, isEmptyElement, decodeHTML, query, isFunction, hasOwnProperties, isObject, propertyIsString, isArray, transformDashToCamelCase, matchesAll, isString } from 'book-of-spells'\nimport { getShortcodeContent, isSpecificClosingTag, getShortcodeName } from './lib/parsers'\nimport { Shortcode } from './lib/Shortcode'\nimport { detachElement } from 'book-of-spells/src/dom.mjs'\n\nexport class Shortcodes {\n\tconstructor(options) {\n\t\tthis.descriptor_index = {}\n\t\tthis.exec_fns = {}\n\t\n\t\tthis.shopify_img_re = /^([a-z\\.:\\/]+\\.shopify\\.[a-z0-9\\/_\\-]+)(_[0-9]+x[0-9]*)(\\.[a-z]{3,4}.*)$/gi\n\t\tthis.shopify_img_replacer_re = /^([a-z\\.:\\/]+\\.shopify\\.[a-z0-9\\/_\\-]+)(\\.[a-z]{3,4}.*)$/gi\n\t\t\n\t\tthis.options = {\n\t\t\ttemplate_class: 'template',\n\t\t\tself_anchor_class: 'self-anchor',\n\t\t\tplacement_class_prefix: 'shortcode-landing',\n\t\t\tdetachElements: false,\n\t\t}\n\t\n\t\tif (options) {\n\t\t\tshallowMerge(this.options, options)\n\t\t}\n\t}\n\n\t/**\n\t * Shopify image link image size changer\n\t * \n\t * @param {string} src \n\t * @param {number} width \n\t * @returns string\n\t */\n\tshopifyImageLink(src, width) {\n\t\tconst pref = '$1'\n\t\tlet suf = '$2'\n\t\tif (!width) width = 100\n\t\tlet re = this.shopify_img_replacer_re\n\n\t\tif (!re.test(src)) return src\n\n\t\tif (this.shopify_img_re.test(src)) {\n\t\t\tsuf = '$3'\n\t\t\tre = this.shopify_img_re\n\t\t}\n\n\t\tconst replacement = `${pref}_${width}x${suf}`\n\t\treturn src.replace(re, replacement)\n\t}\n\n\t/**\n\t * Creates a self anchor element used for inserting shortcode in the DOM tree where it was found\n\t * \n\t * @param {HTMLElement} elem - Element to insert the anchor before\n\t * @param {string} custom_anchor_class - Custom class to add to the anchor if provided\n\t * @param {string} shortcode_name - Name of the shortcode, adds the shortcode-{shortcode_name} class to the anchor if provided\n\t * @param {number} counter - Counter of the shortcode, adds the sc{counter} class to the anchor if provided\n\t */\n\tcreateSelfAnchor(elem, custom_anchor_class, shortcode_name, counter) {\n\t\tconst self_anchor = document.createElement('div')\n\t\tconst classes = []\n\t\tif (custom_anchor_class) classes.push(custom_anchor_class)\n\t\tif (shortcode_name) classes.push(`shortcode-${shortcode_name}`)\n\t\tif (counter) classes.push(`${shortcode_name}-sc-${counter}`)\n\t\tself_anchor.className = classes.join(' ')\n\t\tinsertBeforeElement(elem, self_anchor)\n\n\t\treturn self_anchor\n\t}\n\n\t/**\n\t * Finds elements between the shortcodes makes a map of all shortcodes and their containing elements\n\t * \n\t * @param {HTMLElement} elem - Entry element to parse and find shortcodes in\n\t * @param {object} register - Object containing all registered shortcodes, used to check if the shortcode is registered\n\t * @param {string} self_anchor_class - Class to add to the self anchor element\n\t */\n\titerateNode(elem, register, self_anchor_class) {\n\t\tconst map = {}\n\t\tconst children = elem.children\n\t\tlet last_shortcode = null\n\t\tlet shortcode_counter = 0\n\t\tconst scheduleForDetachment = []\n\t\tconst scheduleForRemoval = []\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tconst child = children[i]\n\t\t\tlet match = null\n\t\t\t\n\t\t\t// check all elements for shortcodes except \"pre\" elements\n\t\t\tif (!(child instanceof HTMLPreElement || child.querySelector('pre'))) { //only if it's not \"pre\" element\n\t\t\t\tconst text = decodeHTML(child.textContent.trim())\n\t\t\t\tmatch = getShortcodeContent(text)\n\t\t\t\t// if the shortcode is not registered, treat it as a regular text\n\t\t\t\tif (match && !register.hasOwnProperty(getShortcodeName(match))) {\n\t\t\t\t\tmatch = null\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// when the shortcode tag is detected\n\t\t\tif (match) {\n\t\t\t\t// detect closing tag and remove it\n\t\t\t\tif (last_shortcode && isSpecificClosingTag(match, last_shortcode.name)) {\n\t\t\t\t\tlast_shortcode = null\n\t\t\t\t\tscheduleForRemoval.push(child)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tlast_shortcode = new Shortcode(match, clone(register[getShortcodeName(match)]), shortcode_counter)\n\t\t\t\tif (last_shortcode.descriptor.detachElements === undefined || last_shortcode.descriptor.detachElements === null) {\n\t\t\t\t\tlast_shortcode.descriptor.detachElements = this.options.detachElements\n\t\t\t\t}\n\t\t\t\tconst self_anchor = this.createSelfAnchor(child, self_anchor_class, last_shortcode.name, shortcode_counter)\n\n\t\t\t\tif (!map.hasOwnProperty(last_shortcode.uid)) {\n\t\t\t\t\tmap[last_shortcode.uid] = last_shortcode\n\t\t\t\t\tshortcode_counter++\n\t\t\t\t}\n\n\t\t\t\tmap[last_shortcode.uid].content.push(self_anchor)\n\t\t\t\tchild.remove()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t\n\t\t\tif (last_shortcode && last_shortcode.uid) {\n\t\t\t\tif (last_shortcode.descriptor.detachElements) scheduleForDetachment.push(child)\n\t\t\t\tmap[last_shortcode.uid].content.push(child)\n\t\t\t}\n\n\t\t\t//TODO: Shortcode object, since it holds the descriptor, should be able to know if it gathered enough elements\n\t\t}\n\t\t\n\t\tfor (let i = 0; i < scheduleForDetachment.length; i++) {\n\t\t\tdetachElement(scheduleForDetachment[i])\n\t\t}\n\n\t\tfor (let i = 0; i < scheduleForRemoval.length; i++) {\n\t\t\tscheduleForRemoval[i].remove()\n\t\t}\n\n\t\treturn map\n\t}\n}\n\n//if this isn't a God function I don't know what is... Wait, I know, it's a piece of terrible nonrefactored code!\n//FUCK ME.\nShortcodes.prototype.sortDOM = function(shortcode_obj) {\n\tconst descriptor = shortcode_obj.descriptor\n\tconst content = shortcode_obj.content\n\t\n\tconst reSubtag = /^\\s*\\{\\s*([a-z0-9\\-_\\s]+)\\s*\\}\\s*$/gi //subtag attributes. I guess subtags are used for item (\"slide\") delimiters\n\n\tconst item_tags = [] //collects attributes per \"slide\"\n\tconst elements = {} //sorted DOM per tag name\n\tconst other_than_rest = {}\n\tlet other_than_rest_count = 0\n\tlet first_element_key = null\n\tlet last_element_key = null\n\tlet max_element_key = null\n\n\tlet cycle_counter = 0\n\tlet subtag_first_flag = false\n\n\t//cycles are used for packaging the rest of elements in arrays\n\tfunction newCycle() {\n\t\tfillTheGaps()\n\t\tcycle_counter += 1\n\t}\n\n\t//rest has to be always present, it is a default collection of all undefined elements\n\telements.rest = []\n\n\tconst memo_block_template = {} //this will hold all the tag names from elements and remove the ones found, so we can generate empty states for the not found ones\n\tlet memo_block = {}\n\n\t// fill the gaps in the memo block with nulls. This is needed for the repeater. If the repeater is not filled with elements, it will not be processed?\n\tfunction fillTheGaps() {\n\t\tfor (const k in memo_block) {\n\t\t\telements[k].push(null)\n\t\t}\n\t\tmemo_block = newMemoBlock()\n\t}\n\n\t//clone temp memo_block\n\t// Memo block is used to check if all the elements are found. If not, the cycle is reset and the rest of the elements are packaged in arrays? (by copilot)\n\tfunction newMemoBlock() {\n\t\tres = {}\n\t\tfor (const k in memo_block_template) {\n\t\t\tres[k] = true\n\t\t}\n\t\treturn res\n\t}\n\n\t//extract other than rest\n\tif (descriptor.hasOwnProperty('elements')) {\n\t\tfor (const k in descriptor.elements) {\n\t\t\tif (k !== 'rest') {\n\t\t\t\tlast_element_key = k\n\t\t\t\tif (!elements.hasOwnProperty(k)) elements[k] = []\n\n\t\t\t\tif (first_element_key === null) first_element_key = k\n\n\t\t\t\tif (!other_than_rest.hasOwnProperty(k)) {\n\t\t\t\t\tother_than_rest[k] = true\n\t\t\t\t\tother_than_rest_count++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmemo_block_template[k] = true\n\t\t\tmemo_block[k] = true\n\t\t}\n\t}\n\n\tfor (let i = 0; i < content.length; i++) {\n\t\tlet item = content[i]\n\n\t\t//\u2757\uFE0FTODO: THIS CAN BE DONE IN THE SHORTCODE CLASS DURING CONSTRUCTION\n\t\tif (item.classList.contains(this.options.self_anchor_class)) {\n\t\t\tif (descriptor.anchor === 'self') descriptor.anchor = item\n\t\t\tcontinue\n\t\t}\n\n\t\t//if the contents are empty, with exclusion of images\n\t\tif (!item.matches('img') && isEmptyElement(item)) continue\n\n\t\tlet green_flag = false // \u2B07\uD83C\uDDF8\uD83C\uDDE6 if true, the iteration is over? (copilot said this not me) \n\n\t\t//check for subtags - they are used as item (\"slide\") delimiters\n\t\tif (descriptor.hasOwnProperty('item_template')) {\n\t\t\tvar text = item.textContent.trim()\n\t\t\tvar match = reSubtag.exec(text)\n\t\t\treSubtag.lastIndex = 0\n\n\t\t\tif (match && match.length > 1) {\n\t\t\t\tif (cycle_counter || subtag_first_flag) {\n\t\t\t\t\tnewCycle()\n\t\t\t\t}\n\n\t\t\t\titem_tags[cycle_counter] = match[1]\n\t\t\t\tsubtag_first_flag = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t//iterating found elements, sort defined\n\t\tif (other_than_rest_count) {\n\t\t\tfor (const k in other_than_rest) {\n\n\t\t\t\tif (elements[k].length === descriptor.elements[k].count) { //if the count of elements reatches set count skip iteration\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t//\u2757\uFE0FXXX: this is a temporary and very bad solution | this was written to be able to use images inside the ul/li as secondary images //XXX: WHAT IS THE USE CASE???\n\t\t\t\tif (k === 'img' && item.querySelectorAll('li').length) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tconst inner = item.querySelector(k) //gotta cover all the possible cases of undefined generated html\n\n\t\t\t\tif (item.matches(k) || inner) { //if element is found\n\t\t\t\t\tif (inner) item = inner\n\n\t\t\t\t\t// if an element is found that belongs to a memo block but it's already processed - this means a new cycle must begin\n\t\t\t\t\t// \uD83D\uDC46\uD83C\uDFFB WHAT THE FUCK?!?!?!\n\t\t\t\t\tif (descriptor.hasOwnProperty('item_template') && !memo_block.hasOwnProperty(k)) {\n\t\t\t\t\t\tnewCycle()\n\t\t\t\t\t}\n\n\t\t\t\t\telements[k].push(item)\n\n\t\t\t\t\tif (descriptor.hasOwnProperty('item_template')) {\n\t\t\t\t\t\tdelete memo_block[k]\n\t\t\t\t\t}\n\n\t\t\t\t\tgreen_flag = true // \u2B06\uD83C\uDDF8\uD83C\uDDE6 don't iterate the rest\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//iterating found elements, sort undefined = rest\n\t\tif (!green_flag) {\n\t\t\t//collecting other elements\n\t\t\tif (descriptor.hasOwnProperty('item_template')) { //if it is a repeater\n\t\t\t\tif (!elements.rest[cycle_counter]) {\n\t\t\t\t\tdelete memo_block['rest']\n\t\t\t\t\telements.rest[cycle_counter] = []\n\t\t\t\t}\n\t\t\t\telements.rest[cycle_counter].push(item)\n\t\t\t} else {\n\t\t\t\telements.rest.push(item)\n\t\t\t}\n\t\t}\n\t}\n\n\tif (descriptor.hasOwnProperty('item_template')) {\n\t\tfillTheGaps()\n\t}\n\n\n\t// calculate which element has the most entries = number of slides\n\t// this will be used as a slide delimiter later on\n\tlet max_count = null\n\n\tfor (const k in other_than_rest) {\n\t\tvar c = elements[k].length\n\n\t\tif (max_element_key === null) {\n\t\t\tmax_element_key = k\n\t\t\tmax_count = c\n\t\t} else {\n\t\t\tif (c > max_count) {\n\t\t\t\tmax_element_key = k\n\t\t\t\tmax_count = c\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { elements: elements,\n\t\titem_tags: item_tags,\n\t\tfirst_element_key: first_element_key,\n\t\tlast_element_key: last_element_key,\n\t\tmax_element_key: max_element_key\n\t}\n}\n\nShortcodes.prototype.constructElements = function(item, dest, props, shortcode_obj, num) {\n\tconst descriptor = shortcode_obj.descriptor\n\t// Extract DOM attributes\n\tconst extracted = props.extract ? this.extract(item, props.extract) : null\n\n\tif (!extracted) return\n\n\t// TODO: this should be optional, if the option for shopify is set do this.\n\tif (matchesAll(item, 'img') && extracted.hasOwnProperty('src')) {\n\t\tif (this.shopify_img_re.test(extracted.src)) {\n\t\t\textracted.src = extracted.src.replace(this.shopify_img_re, '$1$3')\n\t\t}\n\t}\n\n\tif (propertyIsFunction(props, 'parse_extracted')) {\n\t\tprops.parse(extracted, item, dest, props, shortcode_obj, num)\n\t} else if (propertyIsString(props, 'parse_extracted') && propertyIsFunction(window, props.parse_extracted)) {\n\t\twindow[props.parse_extracted](extracted, item, dest, props, shortcode_obj, num)\n\t}\n\n\tif (!props.hasOwnProperty('bind_extracted')) return\n\tif (!isArray(props.bind_extracted)) props.bind_extracted = [props.bind_extracted]\n\n\tif (props.hasOwnProperty('anchor_element')) {\n\t\tfinalDestination = query(props.anchor, dest)\n\t} else {\n\t\tfinalDestination = query(props.anchor, descriptor.anchor)\n\t}\n\n\tif (!finalDestination.length && matchesAll(dest, props.anchor)) finalDestination = dest\n\tif (!props.anchor) finalDestination = dest\n\tif (finalDestination instanceof Element) finalDestination = [finalDestination]\n\n\tfor (let i = 0; i < finalDestination.length; i++) {\n\t\tthis.bindElement(finalDestination[i], props.bind_extracted, extracted, props, shortcode_obj, num)\n\t}\n}\n\nShortcodes.prototype.construct = function(shortcode_obj) {\n\tlet template = null\n\n\tif (shortcode_obj.descriptor.hasOwnProperty('template')) {\n\t\ttemplate = this.getTemplate(shortcode_obj.descriptor.template)\n\t}\n\t\n\tconst sorted = this.sortDOM(shortcode_obj)\n\n\tif (shortcode_obj.descriptor.hasOwnProperty('item_template')) {\n\t\tfor (let i = 0; i < sorted.elements[sorted.max_element_key].length; i++) {\n\t\t\tconst item_template = this.getTemplate(shortcode_obj.descriptor.item_template)\n\t\t\tif (sorted.item_tags[i]) {\n\t\t\t\titem_template.classList.add(sorted.item_tags[i])\n\t\t\t}\n\n\t\t\tfor (const k in shortcode_obj.descriptor.elements) {\n\t\t\t\tvar props = shortcode_obj.descriptor.elements[k]\n\t\t\t\tif (sorted.elements[k][i]) { //if the element exists, may be an uneven number\n\t\t\t\t\tconst item = sorted.elements[k][i]\n\t\t\t\t\tthis.constructElements(item, item_template, props, shortcode_obj, i)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst dest = shortcode_obj.descriptor.hasOwnProperty('template') ? template.querySelectorAll(shortcode_obj.descriptor.item_anchor) : document.querySelectorAll(descriptor.anchor)\n\t\t\tthis.bindShortcode(item_template, dest, shortcode_obj.descriptor.bind_fn, shortcode_obj.descriptor.bind_property, shortcode_obj, i)\n\t\t}\n\t} else {\n\t\tif (shortcode_obj.descriptor.hasOwnProperty('elements')) {\n\t\t\tfor (const k in shortcode_obj.descriptor.elements) {\n\t\t\t\tvar props = shortcode_obj.descriptor.elements[k]\n\n\t\t\t\tif (sorted.elements.hasOwnProperty(k)) {\n\t\t\t\t\tfor (let i = 0; i < sorted.elements[k].length; i++) {\n\t\t\t\t\t\tconst item = sorted.elements[k][i]\n\t\t\t\t\t\tconst dest = shortcode_obj.descriptor.hasOwnProperty('template') ? template : document.querySelectorAll(shortcode_obj.descriptor.anchor)\n\t\t\t\t\t\tthis.constructElements(item, dest, props, shortcode_obj, i)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst dest = shortcode_obj.descriptor.hasOwnProperty('template') ? template : document.querySelectorAll(shortcode_obj.descriptor.anchor)\n\t\t\tthis.bindShortcode(sorted.elements.rest, dest, shortcode_obj.descriptor.bind_fn, shortcode_obj.descriptor.bind_property, shortcode_obj)\n\t\t}\n\t}\n\n\tif (shortcode_obj.descriptor.hasOwnProperty('template')) {\n\t\tthis.bindShortcode(template, shortcode_obj.descriptor.anchor, shortcode_obj.descriptor.bind_fn, shortcode_obj.descriptor.bind_property, shortcode_obj)\n\t\treturn template\n\t}\n\n\treturn document.querySelector(shortcode_obj.descriptor.anchor)\n}\n\nShortcodes.prototype.getTemplate = function(selector) {\n\tselector = [selector]\n\tif (this.options.template_class) {\n\t\tselector.push(`.${this.options.template_class}`)\n\t}\n\tconst template = document.querySelector(selector.join('')).cloneNode(true)\n\ttemplate.classList.remove(this.options.template_class)\n\ttemplate.removeAttribute('hidden')\n\ttemplate.removeAttribute('aria-hidden')\n\n\treturn template\n}\n\nShortcodes.prototype.register = function(shortcode_name, descriptor) {\n\tthis.descriptor_index[shortcode_name] = descriptor\n\tconst self = this\n\n\tthis.exec_fns[shortcode_name] = function(shortcode_obj) {\n\t\tshortcode_obj.executeAttributes()\n\n\t\t// execute preprocessing function\n\t\tif (propertyIsFunction(shortcode_obj.descriptor, 'pre')) {\n\t\t\tshortcode_obj.descriptor.pre(shortcode_obj)\n\t\t}\n\n\t\tconst template = self.construct(shortcode_obj)\n\n\t\tif (template) {\n\t\t\tif (shortcode_obj.classes.length) template.classList.add(shortcode_obj.classes.join(' '))\n\t\t\tcss(template, shortcode_obj.css)\n\t\t\ttemplate.classList.add('shortcode-js')\n\t\t}\n\t\t\n\t\t//TODO: per item callback? I forgot what I've meant by this\n\t\tif (propertyIsFunction(shortcode_obj.descriptor, 'callback')) {\n\t\t\tshortcode_obj.descriptor.callback(template, shortcode_obj)\n\t\t}\n\t}\n}\n\nShortcodes.prototype.execute = function(elem, callback) {\n\telem.style.visibility = 'hidden'\n\tconst shortcode_map = this.iterateNode(elem, this.descriptor_index, this.options.self_anchor_class)\n\n\tfor (const key in shortcode_map) {\n\t\tconst fn_name = shortcode_map[key].name\n\t\tif (this.exec_fns.hasOwnProperty(fn_name)) {\n\t\t\tthis.exec_fns[fn_name](shortcode_map[key])\n\t\t}\n\t}\n\n\telem.style.visibility = 'visible'\n\tif (callback) callback(shortcode_map, this.exec_fns)\n}\n\nShortcodes.prototype.clear = function() {\n\tremove('.shortcode-js')\n\tremove('.self-anchor')\n}\n\nShortcodes.prototype.reinitialize = function(elem, callback) {\n\tthis.clear()\n\tthis.execute(elem, callback)\n}\n\nShortcodes.prototype.bindElement = function(destination, properties, extracted, payload, additional_payload, num) {\n\tif (isString(destination)) destination = querySingle(destination)\n\tif (isString(properties)) properties = [properties]\n\n\tconst fns = {}\n\n\tfns['append'] = function(destination, property, extracted) {\n\t\tif (!extracted.hasOwnProperty('self')) return\n\t\tif (extracted.self instanceof HTMLElement) extracted.self = [extracted.self]\n\t\tfor (let i = 0; i < extracted.self.length; i++) {\n\t\t\tdestination.appendChild(extracted.self[i])\n\t\t}\n\t}\n\n\tfns['prepend'] = function(destination, property, extracted) {\n\t\tif (!extracted.hasOwnProperty('self')) return\n\t\tif (extracted.self instanceof HTMLElement) extracted.self = [extracted.self]\n\t\tfor (let i = 0; i < extracted.self.length; i++) {\n\t\t\tif (destination.firstChild) {\n\t\t\t\tdestination.insertBefore(extracted.self[i], destination.firstChild)\n\t\t\t} else {\n\t\t\t\tdestination.appendChild(extracted.self[i])\n\t\t\t}\n\t\t}\n\t}\n\n\tfns['html'] = function(destination, property, extracted) {\n\t\tif (!extracted.hasOwnProperty('html')) return\n\t\tdestination.innerHTML = extracted.html\n\t}\n\n\tfns['text'] = function(destination, property, extracted) {\n\t\tif (!extracted.hasOwnProperty('text')) return\n\t\tdestination.textContent = extracted.text\n\t}\n\n\tfns['style'] = function(destination, property, extracted) {\n\t\tif (!isArray(property)) property = [property]\n\n\t\tfor (let i = 0; i < property.length; i++) {\n\t\t\tif (!isObject(property[i]) || !hasOwnProperties(property[i], 'style_property', 'extracted_property')) continue\n\t\t\tconst camelCaseProp = transformDashToCamelCase(property[i].style_property)\n\t\t\tif (!extracted.hasOwnProperty(property[i].extracted_property)) continue\n\t\t\tlet extract = extracted[property[i].extracted_property]\n\t\t\tif (camelCaseProp === 'backgroundImage') {\n\t\t\t\textract = `url(${extract})`\n\t\t\t}\n\t\t\tdestination.style[camelCaseProp] = extract\n\t\t}\n\t}\n\n\tfor (let i = 0; i < properties.length; i++) {\n\t\tif (fns.hasOwnProperty(properties[i])) {\n\t\t\tfns[properties[i]](destination, properties[i], extracted)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isFunction(properties[i])) {\n\t\t\tproperties[i](destination, extracted, payload, additional_payload, num)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isObject(properties[i])) {\n\t\t\tfns['style'](destination, properties[i], extracted)\n\t\t\tcontinue\n\t\t}\n\n\t\tdestination.setAttribute(properties[i], extracted[properties[i]])\n\t}\n}\n\nShortcodes.prototype.bindShortcode = function(source, destination, function_name, property_name, payload, additional_payload) {\n\tif (typeof destination === 'string') destination = query(destination)\n\telse if (destination instanceof HTMLElement) destination = [destination]\n\n\tif (typeof source === 'string') source = query(source)\n\telse if (source instanceof HTMLElement) source = [source]\n\n\tif (isFunction(function_name)) {\n\t\tfunction_name(source, destination, property_name, payload, additional_payload)\n\t\treturn\n\t}\n\n\tconst fns = {}\n\n\tfns['style'] = function(source, destination, property_name, payload, additional_payload) {\n\t\tif (typeof property_name === 'string') property_name = [property_name]\n\n\t\tfor (let i = 0; i < property_name.length; i++) {\n\t\t\tconst propCamelCase = transformDashToCamelCase(property_name[i])\n\t\t\tdestination.style[propCamelCase] = source.style[propCamelCase]\n\t\t}\n\t}\n\n\tfns['html'] = function(source, destination, property_name, payload, additional_payload) {\n\t\tdestination.innerHTML = source.innerHTML\n\t}\n\n\tfns['text'] = function(source, destination, property_name, payload, additional_payload) {\n\t\tdestination.textContent = source.textContent\n\t}\n\n\tfns['prepend'] = function(source, destination, property_name, payload, additional_payload) {\n\t\tif (destination.firstChild) {\n\t\t\tdestination.insertBefore(source, destination.firstChild)\n\t\t} else {\n\t\t\tdestination.appendChild(source)\n\t\t}\n\t}\n\n\tfns['append'] = function(source, destination, property_name, payload, additional_payload) {\n\t\tdestination.appendChild(source)\n\t}\n\n\tif (destination.length) {\n\t\tfor (let i = 0; i < destination.length; i++) {\n\t\t\tfor (let j = 0; j < source.length; j++) {\n\t\t\t\tif (fns.hasOwnProperty(function_name)) {\n\t\t\t\t\tfns[function_name](source[j], destination[i], property_name, payload, additional_payload)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nShortcodes.prototype.extract = function(element, properties) {\n\tif (typeof element === 'string') element = querySingle(element)\n\n\tif (typeof properties === 'string') properties = [properties]\n\n\tconst fns = {}\n\tconst result = {}\n\n\tfns['html'] = function(element, property) {\n\t\tresult.html = element.innerHTML\n\t}\n\n\tfns['text'] = function(element, property) {\n\t\tresult.text = element.textContent\n\t}\n\n\tfns['self'] = function(element, property) {\n\t\tresult.self = element\n\t}\n\n\tfns['style'] = function(element, property) {\n\t\tif (!hasOwnProperties(properties[i], ['name', 'properties'])) return\n\t\tif (!property.name === 'style') return\n\t\tif (!isArray(property.properties)) property.properties = [property.properties]\n\n\t\tresult.style = {}\n\n\t\tfor (let i = 0; i < property.properties.length; i++) {\n\t\t\tconst camelCaseProp = transformDashToCamelCase(property.properties[i])\n\t\t\tresult.style[property.properties[i]] = element.style[camelCaseProp]\n\t\t}\n\t}\n\n\tfns['function'] = function(element, property) {\n\t\tif (!hasOwnProperties(property, ['name', 'extract_fn'])) return\n\t\tif (!isFunction(property.extract_fn)) return\n\t\tresult[property.name] = property.extract_fn(element)\n\t}\n\n\tfor (let i = 0; i < properties.length; i++) {\n\n\t\tif (fns.hasOwnProperty(properties[i])) {\n\t\t\tfns[properties[i]](element, properties[i])\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isObject(properties[i])) {\n\t\t\tfns['function'](element, properties[i])\n\t\t\tfns['style'](element, properties[i])\n\t\t\tcontinue\n\t\t}\n\n\t\tresult[properties[i]] = element.getAttribute(properties[i])\n\t}\n\n\treturn result\n}\n\nexport default Shortcodes\n", "import { Shortcodes } from './shortcodes'\n\nif (typeof window !== 'undefined') {\n window.Shortcodes = Shortcodes\n}\n"],
"mappings": ";;;AAWO,WAAS,gBAAgB,KAAK;AACpC,UAAM,KAAK;AACX,UAAM,iBAAiB;AACvB,UAAM,aAAa;AACnB,UAAM,6BAA6B;AAEnC,UAAMA,OAAM,CAAC;AACb,UAAM,QAAQ,IAAI,MAAM,EAAE;AAE1B,aAASC,KAAI,GAAGA,KAAI,MAAM,QAAQA,MAAK;AACtC,YAAM,IAAI,MAAMA,EAAC;AACjB,UAAI,MAAM;AAAI;AAEd,UAAI,eAAe,KAAK,CAAC,GAAG;AAC3B,cAAM,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,cAAc;AACtC,QAAAD,KAAI,GAAG,IAAI;AACX,uBAAe,YAAY;AAAA,MAC5B,WAAW,WAAW,KAAK,CAAC,GAAG;AAC9B,cAAM,CAAC,EAAE,KAAK,KAAK,IAAI,EAAE,MAAM,UAAU;AACzC,QAAAA,KAAI,GAAG,IAAI,MAAM,QAAQ,4BAA4B,EAAE;AACvD,mCAA2B,YAAY;AACvC,mBAAW,YAAY;AAAA,MACxB;AAAA,IACD;AAEA,WAAOA;AAAA,EACR;;;AC1BO,WAAS,aAAa,QAAQ,QAAQ;AAC3C,eAAW,OAAO,QAAQ;AACxB,aAAO,GAAG,IAAI,OAAO,GAAG;AAAA,IAC1B;AAAA,E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W,CAAC,GAAG,CAAC,QAAQ,YAAY,CAAC;AAAG;AAC9D,UAAI,CAAC,SAAS,SAAS;AAAS;AAChC,UAAI,CAAC,QAAQ,SAAS,UAAU;AAAG,iBAAS,aAAa,CAAC,SAAS,UAAU;AAE7E,aAAO,QAAQ,CAAC;AAEhB,eAASR,KAAI,GAAGA,KAAI,SAAS,WAAW,QAAQA,MAAK;AACpD,cAAM,gBAAgB,yBAAyB,SAAS,WAAWA,EAAC,CAAC;AACrE,eAAO,MAAM,SAAS,WAAWA,EAAC,CAAC,IAAIQ,SAAQ,MAAM,aAAa;AAAA,MACnE;AAAA,IACD;AAEA,QAAI,UAAU,IAAI,SAASA,UAAS,UAAU;AAC7C,UAAI,CAAC,iBAAiB,UAAU,CAAC,QAAQ,YAAY,CAAC;AAAG;AACzD,UAAI,CAAC,WAAW,SAAS,UAAU;AAAG;AACtC,aAAO,SAAS,IAAI,IAAI,SAAS,WAAWA,QAAO;AAAA,IACpD;AAEA,aAASR,KAAI,GAAGA,KAAI,WAAW,QAAQA,MAAK;AAE3C,UAAI,IAAI,eAAe,WAAWA,EAAC,CAAC,GAAG;AACtC,YAAI,WAAWA,EAAC,CAAC,EAAE,SAAS,WAAWA,EAAC,CAAC;AACzC;AAAA,MACD;AAEA,UAAI,SAAS,WAAWA,EAAC,CAAC,GAAG;AAC5B,YAAI,UAAU,EAAE,SAAS,WAAWA,EAAC,CAAC;AACtC,YAAI,OAAO,EAAE,SAAS,WAAWA,EAAC,CAAC;AACnC;AAAA,MACD;AAEA,aAAO,WAAWA,EAAC,CAAC,IAAI,QAAQ,aAAa,WAAWA,EAAC,CAAC;AAAA,IAC3D;AAEA,WAAO;AAAA,EACR;;;ACtpBA,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO,aAAa;AAAA,EACtB;",
"names": ["res", "i", "res", "i", "i", "res", "descriptor", "i", "descriptor", "destination", "extracted", "source", "property_name", "payload", "additional_payload", "element"]
}