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AY,EAAa,GAyHT,QAAd,EACF,EAAa,IACJ,IACT,EAAa,EAAY,SAAS,KAGpC,IAAI,EACJ,GAAI,GAAuB,EAAI,eAC7B,EAAI,SAAW,SACf,EAAI,aAAe,WACnB,EAAI,gBAAkB,WACtB,EAAI,QAAU,cACd,EAAI,gBAAkB,EAElB,IACF,EAAI,OAAS,EAAI,MAAQ,UAEtB,CACL,IAAI,EAhKN,SAAsB,GAEpB,OADiB,EAAc,GACX,EA8JP,CAAa,GACtB,GAAU,EAAQ,eACpB,EAAc,EAAS,EAAa,GAAU,IAIlD,OACE,SAAY,EACZ,QAAW","file":"/npm/clamp-js@0.7.0/clamp.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using UglifyJS v3.1.10.\n * Original file: /npm/clamp-js@0.7.0/clamp.js\n * \n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*!\n * Clamp.js 0.7.0\n *\n * Copyright 2011-2013, Joseph Schmitt http://joe.sh\n * Released under the WTFPL license\n * http://sam.zoy.org/wtfpl/\n */\n\n(function(root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD\n define([], factory);\n } else if (typeof exports === 'object') {\n // Node, CommonJS-like\n module.exports = factory();\n } else {\n // Browser globals\n root.$clamp = factory();\n }\n}(this, function() {\n /**\n * Clamps a text node.\n * @param {HTMLElement} element. Element containing the text node to clamp.\n * @param {Object} options. Options to pass to the clamper.\n */\n function clamp(element, options) {\n options = options || {};\n\n var self = this,\n win = window,\n opt = {\n clamp: options.clamp || 2,\n useNativeClamp: typeof(options.useNativeClamp) != 'undefined' ? options.useNativeClamp : true,\n splitOnChars: options.splitOnChars || ['.', '-', '–', '—', ' '], //Split on sentences (periods), hypens, en-dashes, em-dashes, and words (spaces).\n animate: options.animate || false,\n truncationChar: options.truncationChar || '…',\n truncationHTML: options.truncationHTML\n },\n\n sty = element.style,\n originalText = element.innerHTML,\n\n supportsNativeClamp = typeof(element.style.webkitLineClamp) != 'undefined',\n clampValue = opt.clamp,\n isCSSValue = clampValue.indexOf && (clampValue.indexOf('px') > -1 || clampValue.indexOf('em') > -1),\n truncationHTMLContainer;\n\n if (opt.truncationHTML) {\n truncationHTMLContainer = document.createElement('span');\n truncationHTMLContainer.innerHTML = opt.truncationHTML;\n }\n\n\n // UTILITY FUNCTIONS __________________________________________________________\n\n /**\n * Return the current style for an element.\n * @param {HTMLElement} elem The element to compute.\n * @param {string} prop The style property.\n * @returns {number}\n */\n function computeStyle(elem, prop) {\n if (!win.getComputedStyle) {\n win.getComputedStyle = function(el, pseudo) {\n this.el = el;\n this.getPropertyValue = function(prop) {\n var re = /(\\-([a-z]){1})/g;\n if (prop == 'float') prop = 'styleFloat';\n if (re.test(prop)) {\n prop = prop.replace(re, function() {\n return arguments[2].toUpperCase();\n });\n }\n return el.currentStyle && el.currentStyle[prop] ? el.currentStyle[prop] : null;\n };\n return this;\n };\n }\n\n return win.getComputedStyle(elem, null).getPropertyValue(prop);\n }\n\n /**\n * Returns the maximum number of lines of text that should be rendered based\n * on the current height of the element and the line-height of the text.\n */\n function getMaxLines(height) {\n var availHeight = height || element.clientHeight,\n lineHeight = getLineHeight(element);\n\n return Math.max(Math.floor(availHeight / lineHeight), 0);\n }\n\n /**\n * Returns the maximum height a given element should have based on the line-\n * height of the text and the given clamp value.\n */\n function getMaxHeight(clmp) {\n var lineHeight = getLineHeight(element);\n return lineHeight * clmp;\n }\n\n /**\n * Returns the line-height of an element as an integer.\n */\n function getLineHeight(elem) {\n var lh = computeStyle(elem, 'line-height');\n if (lh == 'normal') {\n // Normal line heights vary from browser to browser. The spec recommends\n // a value between 1.0 and 1.2 of the font size. Using 1.1 to split the diff.\n lh = parseInt(computeStyle(elem, 'font-size')) * 1.2;\n }\n return parseInt(lh);\n }\n\n\n // MEAT AND POTATOES (MMMM, POTATOES...) ______________________________________\n var splitOnChars = opt.splitOnChars.slice(0),\n splitChar = splitOnChars[0],\n chunks,\n lastChunk;\n\n /**\n * Gets an element's last child. That may be another node or a node's contents.\n */\n function getLastChild(elem) {\n //Current element has children, need to go deeper and get last child as a text node\n if (elem.lastChild.children && elem.lastChild.children.length > 0) {\n return getLastChild(Array.prototype.slice.call(elem.children).pop());\n }\n //This is the absolute last child, a text node, but something's wrong with it. Remove it and keep trying\n else if (!elem.lastChild || !elem.lastChild.nodeValue || elem.lastChild.nodeValue === '' || elem.lastChild.nodeValue == opt.truncationChar) {\n elem.lastChild.parentNode.removeChild(elem.lastChild);\n return getLastChild(element);\n }\n //This is the last child we want, return it\n else {\n return elem.lastChild;\n }\n }\n\n /**\n * Removes one character at a time from the text until its width or\n * height is beneath the passed-in max param.\n */\n function truncate(target, maxHeight) {\n if (!maxHeight) {\n return;\n }\n\n /**\n * Resets global variables.\n */\n function reset() {\n splitOnChars = opt.splitOnChars.slice(0);\n splitChar = splitOnChars[0];\n chunks = null;\n lastChunk = null;\n }\n\n var nodeValue = target.nodeValue.replace(opt.truncationChar, '');\n\n //Grab the next chunks\n if (!chunks) {\n //If there are more characters to try, grab the next one\n if (splitOnChars.length > 0) {\n splitChar = splitOnChars.shift();\n }\n //No characters to chunk by. Go character-by-character\n else {\n splitChar = '';\n }\n\n chunks = nodeValue.split(splitChar);\n }\n\n //If there are chunks left to remove, remove the last one and see if\n // the nodeValue fits.\n if (chunks.length > 1) {\n // console.log('chunks', chunks);\n lastChunk = chunks.pop();\n // console.log('lastChunk', lastChunk);\n applyEllipsis(target, chunks.join(splitChar));\n }\n //No more chunks can be removed using this character\n else {\n chunks = null;\n }\n\n //Insert the custom HTML before the truncation character\n if (truncationHTMLContainer) {\n target.nodeValue = target.nodeValue.replace(opt.truncationChar, '');\n element.innerHTML = target.nodeValue + ' ' + truncationHTMLContainer.innerHTML + opt.truncationChar;\n }\n\n //Search produced valid chunks\n if (chunks) {\n //It fits\n if (element.clientHeight <= maxHeight) {\n //There's still more characters to try splitting on, not quite done yet\n if (splitOnChars.length >= 0 && splitChar !== '') {\n applyEllipsis(target, chunks.join(splitChar) + splitChar + lastChunk);\n chunks = null;\n }\n //Finished!\n else {\n return element.innerHTML;\n }\n }\n }\n //No valid chunks produced\n else {\n //No valid chunks even when splitting by letter, time to move\n //on to the next node\n if (splitChar === '') {\n applyEllipsis(target, '');\n target = getLastChild(element);\n\n reset();\n }\n }\n\n //If you get here it means still too big, let's keep truncating\n if (opt.animate) {\n setTimeout(function() {\n truncate(target, maxHeight);\n }, opt.animate === true ? 10 : opt.animate);\n } else {\n return truncate(target, maxHeight);\n }\n }\n\n function applyEllipsis(elem, str) {\n elem.nodeValue = str + opt.truncationChar;\n }\n\n\n // CONSTRUCTOR ________________________________________________________________\n\n if (clampValue == 'auto') {\n clampValue = getMaxLines();\n } else if (isCSSValue) {\n clampValue = getMaxLines(parseInt(clampValue));\n }\n\n var clampedText;\n if (supportsNativeClamp && opt.useNativeClamp) {\n sty.overflow = 'hidden';\n sty.textOverflow = 'ellipsis';\n sty.webkitBoxOrient = 'vertical';\n sty.display = '-webkit-box';\n sty.webkitLineClamp = clampValue;\n\n if (isCSSValue) {\n sty.height = opt.clamp + 'px';\n }\n } else {\n var height = getMaxHeight(clampValue);\n if (height <= element.clientHeight) {\n clampedText = truncate(getLastChild(element), height);\n }\n }\n\n return {\n 'original': originalText,\n 'clamped': clampedText\n };\n }\n\n return clamp;\n}));\n"]}