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Aa,GAAS,SAAS,GAErC,EAAO,EAAa,GAAI,YAAa,cAAgB,EAAO,qBAC5D,EAAO,EAAa,GAAI,YAAa,eAAiB,EAAO,GAAS,qBAGlE,EAAO,IACP,GAAQ,GAGR,GAAQ,IACR,EAAO,EAGH,EAAK,cACL,EAAoB,EAAO,EAAK,aAG5C,IA6DA,EAAG,WAAW,aAAa,EAAW,GAGtC,EAAG,WAAW,YAAY,GAEnB,CACX,CA2Be,CAAgB,EAAQ,EACnC,IAII,KA3BJ,WACI,EAAM,SAAQ,SAAS,GACf,IAEA,EAAO,WAAW,OAElB,EAAO,WAAW,aAAa,EAAO,UAAW,GACjD,EAAO,WAAW,YAAY,GAEtC,GACJ,EAmBJ,CAGJ","file":"/npm/marquee@0.2.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/marquee@0.2.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function (root, factory) {\n    if (typeof exports === 'object') {\n        module.exports = factory(require('animator'), require('crel'), require('stylar'));\n    } else if (typeof define === 'function' && define.amd) {\n        define(['animator', 'crel', 'stylar'], factory);\n    } else {\n        root.marquee = factory(root.animator, root.crel, root.stylar);\n    }\n}(this, function(animator, crel, stylar){\n\n    function manifestUnicorn(el, options) {\n        // create a canvas for the el\n        var opts = options || {},\n            css = getComputedStyle(el),\n            container = crel('div', { class: el.className }),\n            width = parseFloat(css.width),\n            textValue,\n            textElements,\n            propName, propValue,\n            xPos = 0,\n            nextIncrementTick = 0,\n            speed = (opts.speed || 1000) / 1000;\n\n        // extract the properties that need to be set\n        for (propName in css) {\n            propValue = css.getPropertyCSSValue(propName);\n\n            if (propValue) {\n                container.style[propName] = propValue.cssText;\n            }\n        }\n\n        container.style.position = 'relative';\n        container._original = el;\n\n        textValue = (el.innerText || el.textContent);\n        textElements = [\n            crel('span', textValue),\n            crel('span', textValue)\n        ];\n\n        // initialise the text elements\n        textElements.forEach(function(text, index) {\n            text.style.font = [\n                css.fontVariant,\n                css.fontWeight,\n                css.fontSize,\n                css.fontFamily\n            ].join(' ');\n\n            text.style.position = 'absolute';\n            text.style.left = '0px';\n            text.style.top = '0px';\n            text.style.width = width + 'px';\n\n            container.appendChild(text);\n        });\n\n        container._animation = animator(function(tick) {\n            // update the xposition of the text\n            stylar(textElements[0], 'transform', 'translateX(' + xPos + 'px) translateZ(0)');\n            stylar(textElements[1], 'transform', 'translateX(' + (xPos + width) + 'px) translateZ(0)');\n\n            // increment the xpos\n            if (tick > nextIncrementTick) {\n                xPos -= speed;\n            }\n\n            if (xPos < -width) {\n                xPos = 0;\n\n                // if we have a freeze time then wait\n                if (opts.freezeDelay) {\n                    nextIncrementTick = tick + opts.freezeDelay;\n                }\n            }\n        });        \n\n        /*\n            newEl = crel(css.display.slice(0, 6) === 'inline' ? 'span' : 'div'),\n            canvas = document.createElement('canvas'),\n            context = canvas.getContext('2d'),\n            width = canvas.width = parseFloat(css.width),\n            height = canvas.height = parseFloat(css.height),\n            speed = (opts.speed || 1000) / 1000,\n            xPos = 0,\n            nextIncrementTick = 0,\n            metrics;\n\n        context.font = [\n            css.fontVariant,\n            css.fontWeight,\n            css.fontSize,\n            css.fontFamily\n        ].join(' ');\n\n        context.fillStyle = css.color;\n        context.textBaseline = 'middle';\n\n        // if we need to check the overflow, then measure the text\n        if (opts.checkOverflow) {\n            metrics = context.measureText(el.innerText);\n\n            // if the width \n            if (metrics.width < width) return;\n        }\n\n        // save the original node\n        canvas._original = el;\n\n        // create the animation\n        canvas._animation = animator(function(tick) {\n            var text = el.innerText;\n\n            context.clearRect(0, 0, width, height);\n\n            // draw the two marquee sections\n            context.fillText(text, xPos, height / 2);\n            context.fillText(text, xPos + width, height / 2);\n\n            // increment the xpos\n            if (tick > nextIncrementTick) {\n                xPos -= speed;\n            }\n\n            if (xPos < -width) {\n                xPos = 0;\n\n                // if we have a freeze time then wait\n                if (opts.freezeDelay) {\n                    nextIncrementTick = tick + opts.freezeDelay;\n                }\n            }\n        });\n        */\n\n        // add the canvas\n        el.parentNode.insertBefore(container, el);\n\n        // remove the element from the dom\n        el.parentNode.removeChild(el);\n\n        return container;\n    }\n\n    function marquee(targets, opts) {\n        var items;\n\n        function restoreItems() {\n            items.forEach(function(canvas) {\n                if (canvas) {\n                    // stop the animation\n                    canvas._animation.stop();\n\n                    canvas.parentNode.insertBefore(canvas._original, canvas);\n                    canvas.parentNode.removeChild(canvas);\n                }\n            });\n        }\n\n        // if the target is a string, then get qsa that puppy\n        if (typeof targets == 'string' || (targets instanceof String)) {\n            targets = [].slice.call(document.querySelectorAll(targets));\n        }\n\n        // ensure we have an array for targets\n        targets = [].concat(targets || []);\n\n        // iterate through the targets and make magic happen\n        items = targets.map(function(target) {\n            return manifestUnicorn(target, opts);\n        });\n\n        return {\n            items: items, \n            stop:  restoreItems\n        };\n    }\n\n    return marquee;\n}));"]}