{"version":3,"file":"theme.js.map","sources":["../../../../js/mrare/util.js","../../../../js/mrare/chat.js","../../../../js/mrare/checklist.js","../../../../js/mrare/dropzone.js","../../../../js/mrare/filter.js","../../../../js/mrare/flatpickr.js","../../../../js/mrare/kanban.js","../../../../js/mrare/prism.js","../../../../js/mrare/index.js"],"sourcesContent":["//\n//\n// Util\n//\n// Medium Rare utility functions\n// v 1.2.0\n\nimport jQuery from 'jquery';\n\nconst mrUtil = (($) => {\n const VERSION = '1.2.0';\n\n const Tagname = {\n SCRIPT: 'script',\n };\n\n const Selector = {\n RECAPTCHA: '[data-recaptcha]',\n };\n\n // Activate tooltips\n $('body').tooltip({ selector: '[data-toggle=\"tooltip\"]', container: 'body' });\n\n // Activate popovers\n $('body').popover({ selector: '[data-toggle=\"popover\"]', container: 'body' });\n\n // Activate toasts\n $('.toast').toast();\n\n const Util = {\n\n version: VERSION,\n selector: Selector,\n\n activateIframeSrc(iframe) {\n const $iframe = $(iframe);\n if ($iframe.attr('data-src')) {\n $iframe.attr('src', $iframe.attr('data-src'));\n }\n },\n\n idleIframeSrc(iframe) {\n const $iframe = $(iframe);\n $iframe.attr('data-src', $iframe.attr('src')).attr('src', '');\n },\n\n forEach(array, callback, scope) {\n if (array) {\n if (array.length) {\n for (let i = 0; i < array.length; i += 1) {\n callback.call(scope, i, array[i]); // passes back stuff we need\n }\n } else if (array[0] || mrUtil.isElement(array)) { callback.call(scope, 0, array); }\n }\n },\n\n dedupArray(arr) {\n return arr.reduce((p, c) => {\n // create an identifying String from the object values\n const id = JSON.stringify(c);\n // if the JSON string is not found in the temp array\n // add the object to the output array\n // and add the key to the temp array\n if (p.temp.indexOf(id) === -1) {\n p.out.push(c);\n p.temp.push(id);\n }\n return p;\n // return the deduped array\n }, { temp: [], out: [] }).out;\n },\n\n isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n },\n\n getFuncFromString(funcName, context) {\n const findFunc = funcName || null;\n\n // if already a function, return\n if (typeof findFunc === 'function') return funcName;\n\n // if string, try to find function or method of object (of \"obj.func\" format)\n if (typeof findFunc === 'string') {\n if (!findFunc.length) return null;\n let target = context || window;\n const func = findFunc.split('.');\n while (func.length) {\n const ns = func.shift();\n if (typeof target[ns] === 'undefined') return null;\n target = target[ns];\n }\n if (typeof target === 'function') return target;\n }\n // return null if could not parse\n return null;\n },\n getScript(source, callback) {\n let script = document.createElement(Tagname.SCRIPT);\n const prior = document.getElementsByTagName(Tagname.SCRIPT)[0];\n script.async = 1;\n script.defer = 1;\n\n script.onreadystatechange = (_, isAbort) => {\n if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) {\n script.onload = null;\n script.onreadystatechange = null;\n script = undefined;\n\n if (!isAbort && callback && typeof callback === 'function') { callback(); }\n }\n };\n\n script.onload = script.onreadystatechange;\n\n script.src = source;\n prior.parentNode.insertBefore(script, prior);\n },\n };\n\n return Util;\n})(jQuery);\n\nexport default mrUtil;\n","//\n//\n// chat.js\n//\n// Initializes the autosize library and scrolls chat list to bottom\n//\n\n\nimport jQuery from 'jquery';\nimport autosize from 'autosize';\nimport mrUtil from './util';\n\nautosize(document.querySelectorAll('.chat-module-bottom textarea'));\n\n// Scrolls the chat-module-body to the bottom\n(($) => {\n $(window).on('load', () => {\n const lastChatItems = document.querySelectorAll('.media.chat-item:last-child');\n if (lastChatItems) {\n mrUtil.forEach(lastChatItems, (index, item) => {\n item.scrollIntoView();\n });\n }\n });\n})(jQuery);\n","//\n//\n// checklist.js\n//\n// Initializes the Shopify Draggable library on Checklist elements.\n//\n\nimport jQuery from 'jquery';\nimport Draggable from '@shopify/draggable/lib/draggable';\nimport SwapAnimation from '@shopify/draggable/lib/plugins';\nimport mrUtil from './util';\n\nconst mrAutoWidth = (($) => {\n /*\n Special Thanks to Lim Yuan Qing\n for autosize-input\n\n https://github.com/yuanqing/autosize-input\n\n The MIT License (MIT)\n Copyright (c) 2018 Lim Yuan Qing\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the \"Software\"),\n to deal in the Software without restriction, including without limitation\n the rights to use, copy, modify, merge, publish, distribute, sublicense,\n and/or sell copies of the Software, and to permit persons to whom the Software\n is furnished to do so, subject to the following conditions:\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n class AutoWidth {\n constructor(element, options) {\n this.element = element;\n const elementStyle = window.getComputedStyle(this.element);\n // prettier-ignore\n this.elementCssText = `box-sizing:${elementStyle.boxSizing}\n ;border-left:${elementStyle.borderLeftWidth} solid red \n ;border-right:${elementStyle.borderRightWidth} solid red\n ;font-family:${elementStyle.fontFamily}\n ;font-feature-settings:${elementStyle.fontFeatureSettings}\n ;font-kerning:${elementStyle.fontKerning}\n ;font-size:${elementStyle.fontSize}\n ;font-stretch:${elementStyle.fontStretch}\n ;font-style:${elementStyle.fontStyle}\n ;font-variant:${elementStyle.fontVariant}\n ;font-variant-caps:${elementStyle.fontVariantCaps}\n ;font-variant-ligatures:${elementStyle.fontVariantLigatures}\n ;font-variant-numeric:${elementStyle.fontVariantNumeric}\n ;font-weight:${elementStyle.fontWeight}\n ;letter-spacing:${elementStyle.letterSpacing}\n ;margin-left:${elementStyle.marginLeft}\n ;margin-right:${elementStyle.marginRight}\n ;padding-left:${elementStyle.paddingLeft}\n ;padding-right:${elementStyle.paddingRight}\n ;text-indent:${elementStyle.textIndent}\n ;text-transform:${elementStyle.textTransform};`;\n\n this.GHOST_ELEMENT_ID = '__autosizeInputGhost';\n\n element.addEventListener('input', AutoWidth.passWidth);\n element.addEventListener('keydown', AutoWidth.passWidth);\n element.addEventListener('cut', AutoWidth.passWidth);\n element.addEventListener('paste', AutoWidth.passWidth);\n\n this.extraPixels = (options && options.extraPixels) ? parseInt(options.extraPixels, 10) : 0;\n this.width = AutoWidth.setWidth(this);\n\n // Set `min-width` only if `options.minWidth` was set, and only if the initial\n // width is non-zero.\n if (options && options.minWidth && this.width !== '0px') {\n this.element.style.minWidth = this.width;\n }\n }\n\n static setWidth(input) {\n const string = input.element.value || input.element.getAttribute('placeholder') || '';\n // Check if the `ghostElement` exists. If no, create it.\n const ghostElement = document.getElementById(input.GHOST_ELEMENT_ID)\n || input.createGhostElement();\n // Copy all width-affecting styles to the `ghostElement`.\n ghostElement.style.cssText += input.elementCssText;\n ghostElement.innerHTML = AutoWidth.escapeSpecialCharacters(string);\n // Copy the width of `ghostElement` to `element`.\n let { width } = window.getComputedStyle(ghostElement);\n width = Math.ceil(width.replace('px', '')) + input.extraPixels;\n /* eslint-disable no-param-reassign */\n\n input.element.style.width = `${width}px`;\n return width;\n }\n\n static passWidth(evt) {\n const input = $(evt.target).data('autoWidth');\n AutoWidth.setWidth(input);\n }\n\n static mapSpecialCharacterToCharacterEntity(specialCharacter) {\n const characterEntities = {\n ' ': 'nbsp',\n '<': 'lt',\n '>': 'gt',\n };\n\n return `&${characterEntities[specialCharacter]};`;\n }\n\n static escapeSpecialCharacters(string) {\n return string.replace(/\\s/g, ' ').replace(//g, '>');\n }\n\n // Create `ghostElement`, with inline styles to hide it and ensure that the text is all\n // on a single line.\n createGhostElement() {\n const ghostElement = document.createElement('div');\n ghostElement.id = this.GHOST_ELEMENT_ID;\n ghostElement.style.cssText = 'display:inline-block;height:0;overflow:hidden;position:absolute;top:0;visibility:hidden;white-space:nowrap;';\n document.body.appendChild(ghostElement);\n return ghostElement;\n }\n }\n\n $(document).ready(() => {\n const checklistItems = document.querySelectorAll('form.checklist .custom-checkbox div input');\n\n if (checklistItems) {\n mrUtil.forEach(checklistItems, (index, item) => {\n $(item).data('autoWidth', new AutoWidth(item, { extraPixels: 3 }));\n\n item.addEventListener('keypress', (evt) => {\n if (evt.which === 13) {\n evt.preventDefault();\n }\n });\n });\n }\n });\n\n return AutoWidth;\n})(jQuery);\n\nconst mrChecklist = {\n sortableChecklists: new Draggable.Sortable(document.querySelectorAll('form.checklist, .drop-to-delete'), {\n plugins: [SwapAnimation],\n draggable: '.checklist > .row',\n handle: '.form-group > span > i',\n }),\n};\n\nexport { mrChecklist, mrAutoWidth };\n","//\n//\n// dropzone.js\n//\n// Initializes dropzone plugin on elements to facilitate drag/drop for uploads\n//\n\n\nimport jQuery from 'jquery';\n// import Dropzone from 'dropzone';\n\nwindow.Dropzone.autoDiscover = false;\n\n(($) => {\n $(() => {\n let template = `