From e1b50744e5fd2fac9323939dd7626eb23a68106b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Auswo=CC=88ger?= Date: Wed, 26 Jun 2024 20:26:23 +0200 Subject: [PATCH] Update to commit a95e53c24838c4d14fe726b1e1d1b39184bdfd38 --- collector.js | 7 +++++-- linter.js | 13 ++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/collector.js b/collector.js index e481736..0ae66c5 100644 --- a/collector.js +++ b/collector.js @@ -1016,9 +1016,9 @@ var RE_MEDIA_QUERY=/^(?:(only|not)?\s*(\\?\\0(?:\s*))?([_a-z][_a-z0-9-]*)(\\9?)? }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../util/setStyles":345,"./checkLazyImages":335,"./find":336,"./readData":338,"./readDimensions":339,"./readImages":340,"./readMarkup":341,"./readMediaQueries":342,"babel-polyfill":1}],338:[function(require,module,exports){ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=readData;var _parseMedia=require("../util/parseMedia"),_parseMedia2=_interopRequireDefault(_parseMedia);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function readData(e){var t=e.dom.img;return e.data={img:t&&{src:t.getAttribute("src"),srcset:parseSrcset(t.getAttribute("srcset")),sizes:parseSizes(t.getAttribute("sizes")),loading:t.getAttribute("loading")||void 0},sources:e.dom.sources.map(function(e){return{srcset:parseSrcset(e.getAttribute("srcset")),sizes:parseSizes(e.getAttribute("sizes")),media:(0,_parseMedia2.default)(e.getAttribute("media")),type:e.getAttribute("type")||void 0}})},e}function parseSrcset(e){if(!e)return[];var t=[];return e.replace(/,*(\S*?[^\s,])(?:\s,|,+\s|,?$|\s([^,]+)(?:,|$))/g,function(e,r,s){t.push({src:r,descriptor:s&&s.trim()})}),t}function parseSizes(e){return e?e.split(",").map(function(e){e=e.trim();var t=void 0;return{size:e=e.replace(/^\(.+?\)\s+/,function(e){return t=(0,_parseMedia2.default)(e.trim()),""}),media:t}}):[]} +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=readData;var _parseMedia=require("../util/parseMedia"),_parseMedia2=_interopRequireDefault(_parseMedia),_splitCommaSeparatedListOfComponentValues=require("../util/splitCommaSeparatedListOfComponentValues"),_splitCommaSeparatedListOfComponentValues2=_interopRequireDefault(_splitCommaSeparatedListOfComponentValues);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function readData(e){var t=e.dom.img;return e.data={img:t&&{src:t.getAttribute("src"),srcset:parseSrcset(t.getAttribute("srcset")),sizes:parseSizes(t.getAttribute("sizes")),loading:t.getAttribute("loading")||void 0},sources:e.dom.sources.map(function(e){return{srcset:parseSrcset(e.getAttribute("srcset")),sizes:parseSizes(e.getAttribute("sizes")),media:(0,_parseMedia2.default)(e.getAttribute("media")),type:e.getAttribute("type")||void 0}})},e}function parseSrcset(e){if(!e)return[];var t=[];return e.replace(/,*(\S*?[^\s,])(?:\s,|,+\s|,?$|\s([^,]+)(?:,|$))/g,function(e,r,s){t.push({src:r,descriptor:s&&s.trim()})}),t}function parseSizes(e){return e?(0,_splitCommaSeparatedListOfComponentValues2.default)(e).map(function(e){var t=void 0;return{size:e=e.trim().replace(/^(?:not\s+)?\(.+?\)(?:\s*(?:and|or)\s*\(.+?\))*\s+/,function(e){return t=(0,_parseMedia2.default)(e.trim()),""}),media:t}}):[]} -},{"../util/parseMedia":344}],339:[function(require,module,exports){ +},{"../util/parseMedia":344,"../util/splitCommaSeparatedListOfComponentValues":346}],339:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=readDimensions;var _setStyles=require("../util/setStyles"),_setStyles2=_interopRequireDefault(_setStyles);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var minWidth=300,maxWidth=3e3,stepSize=20,aspectRatios=[16/9,.75];function readDimensions(e,t,i){return new Promise(function(n){var d=e.contentWindow.document,o=0,s=aspectRatios[o],a=minWidth,r=Math.round(a/s);(0,_setStyles2.default)(e,{width:a+"px",height:r+"px"}),(0,_setStyles2.default)(d.documentElement,{overflow:"hidden"}),(0,_setStyles2.default)(d.body,{overflow:"hidden"});var m=d.createElement("img");"sizes"in m?(m.srcset="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 1w",m.sizes="100vw",(0,_setStyles2.default)(m,{position:"absolute",top:0,left:0,display:"block",width:"auto","max-width":"none","min-width":0,height:"auto","max-height":"none","min-height":0,border:0,padding:0}),d.body.appendChild(m)):m=void 0;var u=d.createElement("source"),l=d.createElement("picture");if("sizes"in u){u.srcset=m.srcset,u.sizes="50vw";for(var h=[],p=minWidth;p<=maxWidth;p+=2*stepSize)h.push(p);u.media=h.map(function(e){return"(width:"+e+"px)"}).join(","),l.appendChild(u),l.appendChild(m),d.body.appendChild(l)}else u=void 0,l=void 0;var c=Date.now(),f=!1;!function l(){var h=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now();i((a-minWidth)/(maxWidth-minWidth)/aspectRatios.length+o/aspectRatios.length,a+"x"+r);var p=a;if(u&&(a-minWidth)%(2*stepSize)==0&&(p/=2),m&&imageWidth(m)!==p&&!f)return a===minWidth&&Date.now()-c>5e3&&(f=!0),(0,_setStyles2.default)(d.body,{display:"none"}),d.body.offsetHeight,(0,_setStyles2.default)(d.body,{display:""}),void setTimeout(l,0);if(!t.reduce(function(e,t){return e&&(!t.dom.img||t.dom.img.complete)},!0))return t.map(function(e){e.dom.img&&(e.dom.img.loading="eager",e.dom.img.decoding="sync")}),void setTimeout(l,0);if(addDimensions(t,a+"x"+r),a+=stepSize,r=Math.round(a/s),a>maxWidth){if(!aspectRatios[++o])return i(1,maxWidth+"x"+Math.round(maxWidth/s)),void n();s=aspectRatios[o],a=minWidth,r=Math.round(a/s)}(0,_setStyles2.default)(e,{width:a+"px",height:r+"px"}),Date.now()-h>1e3/30?setTimeout(l,0):l(h)}()})}function addDimensions(e,t){e.forEach(function(e){return addDimension(e,t)})}function addDimension(e,t){e.dimensions=e.dimensions||{},e.dom.img&&(e.dimensions[t]=imageWidth(e.dom.img))}function imageWidth(e){var t=getComputedStyle(e);return e.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)} },{"../util/setStyles":345}],340:[function(require,module,exports){ @@ -1039,4 +1039,7 @@ var RE_MEDIA_QUERY=/^(?:(only|not)?\s*(\\?\\0(?:\s*))?([_a-z][_a-z0-9-]*)(\\9?)? },{"css-mq-parser":331}],345:[function(require,module,exports){ "use strict";function setStyles(e,t){var s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Object.keys(t).forEach(function(o){e.style.setProperty(o,t[o],s?"important":"")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=setStyles; +},{}],346:[function(require,module,exports){ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e){for(var t=/[,()"']/g,s=[],r=0,n=0,d=void 0;(d=t.exec(e))&&(","===d[0]&&0===n&&(s.push(e.substring(r,t.lastIndex-1).trim()),r=t.lastIndex),"("===d[0]&&++n,")"===d[0]&&n>0&&--n,'"'!==d[0]&&"'"!==d[0]||(t.lastIndex=e.indexOf(d[0],t.lastIndex),-1!==t.lastIndex)););return s.push(e.substring(r).trim()),s}; + },{}]},{},[334]); diff --git a/linter.js b/linter.js index 7e46f82..9155e1e 100644 --- a/linter.js +++ b/linter.js @@ -410,7 +410,7 @@ var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defau "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _slicedToArray=function(){return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,r){var t=[],i=!0,a=!1,n=void 0;try{for(var o,u=e[Symbol.iterator]();!(i=(o=u.next()).done)&&(t.push(o.value),!r||t.length!==r);i=!0);}catch(e){a=!0,n=e}finally{try{!i&&u.return&&u.return()}finally{if(a)throw n}}return t}(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();exports.default=function(e){var r=[],t=[],i={};Object.keys(e.dimensions).forEach(function(a){i[a.split("x")[0]]=!0;var n=e.dimensions[a],o={};(0,_allSources2.default)(e).forEach(function(i,u){var s=(0,_mediaToStringArray2.default)((0,_stripViewportQueries2.default)(i.media)).map(function(e){return(i.type||"image/*")+"|"+e});if(!s.reduce(function(e,r){return e||o[r]},!1)&&"image/svg+xml"!==i.type&&n&&(!i.media||(0,_mediaMatchesViewport2.default)(i.media,a))){s.forEach(function(e){o[e]=!0}),t[u]=t[u]||{},t[u][a]=n;var c=i.srcset.map(function(e){return e.src});if(i.src&&!i.srcset.filter(function(e){var r=e.descriptor,t=void 0===r?"1x":r;return"x"!==t.substr(-1)||"1x"===t}).length&&c.push(i.src),-1===c.map(function(r){return e.images[r].type}).indexOf("image/svg+xml")){var l=(e.images[c[0]]&&e.images[c[0]].size.width?e.images[c[0]].size.height/e.images[c[0]].size.width:1)||1,d=c.map(function(r){return e.images[r].size.width}).filter(Boolean).sort(function(e,r){var t=[e,r].map(function(e){return Math.abs((n*n*l-e*e*l)/1e6)}),i=_slicedToArray(t,2);return(e=i[0])-(r=i[1])})[0];if(d){var m=1-(nmegapixelGap/2&&(d20&&u.push([e,e]),u[u.length-1][1]=e,s=r});for(var c=0;c"+buildRecommendation(t[n],m,Object.keys(i).length),recommendationContext:e.data.img===a?"<img srcset="…">":"the "+humanReadableIndex(n)+" <source srcset="…">"})}})};var _error=require("../../util/error"),_error2=_interopRequireDefault(_error),_allSources=require("../../util/allSources"),_allSources2=_interopRequireDefault(_allSources),_mediaToStringArray=require("../../util/mediaToStringArray"),_mediaToStringArray2=_interopRequireDefault(_mediaToStringArray),_stripViewportQueries=require("../../util/stripViewportQueries"),_stripViewportQueries2=_interopRequireDefault(_stripViewportQueries),_mediaMatchesViewport=require("../../util/mediaMatchesViewport"),_mediaMatchesViewport2=_interopRequireDefault(_mediaMatchesViewport),_computeSrcsetWidths=require("../../util/computeSrcsetWidths"),_computeSrcsetWidths2=_interopRequireDefault(_computeSrcsetWidths);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _toConsumableArray(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r×"+Math.round(e*i)+""}).join(", ")} }).call(this)}).call(this,"/src/linter/images/missingFittingSrc.js") -},{"../../util/allSources":143,"../../util/computeSrcsetWidths":146,"../../util/error":147,"../../util/mediaMatchesViewport":150,"../../util/mediaToStringArray":151,"../../util/stripViewportQueries":155}],129:[function(require,module,exports){ +},{"../../util/allSources":143,"../../util/computeSrcsetWidths":146,"../../util/error":147,"../../util/mediaMatchesViewport":150,"../../util/mediaToStringArray":151,"../../util/stripViewportQueries":156}],129:[function(require,module,exports){ (function (__filename){(function (){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e){var r=e.images,a=!1,i={};(0,_allSources2.default)(e).forEach(function(e){if(!a){var t=[];e.src&&!e.srcset.length&&t.push(e.src),e.srcset.forEach(function(e){var r=e.src;return t.push(r)});var u=t.sort(function(e,a){return r[a].size.width-r[e].size.width}).reduce(function(e,a){return e||r[a].size.width&&r[a].hash&&a},!1);if(u){var s=e.type||"image/*";i[s]=i[s]||[],i[s].push({src:u,highDpi:isDpiQuery(e.media,!0),lowDpi:isDpiQuery(e.media,!1)}),"image/*"!==s||e.media||(a=!0)}}});var t={};Object.keys(i).forEach(function(a){i[a].forEach(function(u,s){var o=u.src,n=u.highDpi,h=u.lowDpi;i[a].forEach(function(a,i){var u=a.src,l=a.highDpi,c=a.lowDpi;!(i!==s&&o!==u&&(0,_hashDistance2.default)(r[o].hash,r[u].hash)1.1&&(r&&"min"===a&&!i||r&&"max"===a&&i||!r&&"max"===a&&!i||!r&&"min"===a&&i)&&(t=!0)}),t}).length}function computeDppx(e){if(e)return e.match(/^\d*\.?\d+dpi$/)?parseFloat(e)/96:e.match(/^\d*\.?\d+dpcm$/)?parseFloat(e)/96*2.54:e.match(/^\d*\.?\d+dppx$/)?parseFloat(e):void 0} @@ -430,7 +430,7 @@ var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defau "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};exports.default=function(e,t){var r=[];Object.keys(e.dimensions).forEach(function(t){var i=e.dimensions[t],o={};i&&(0,_allSources2.default)(e).forEach(function(e,u){var a=(0,_mediaToStringArray2.default)((0,_stripViewportQueries2.default)(e.media)).map(function(t){return(e.type||"image/*")+"|"+t});if(!a.reduce(function(e,t){return e||o[t]},!1)&&(!e.media||(0,_mediaMatchesViewport2.default)(e.media,t))&&(a.forEach(function(e){o[e]=!0}),e.sizes)){var n=!1;e.sizes.forEach(function(e,o){var a=e.size,s=e.media;if((0!==o||s||"auto"!==a)&&!n&&(!s||(0,_mediaMatchesViewport2.default)(s,t))){n=!0;var l=(0,_computeLength2.default)(a,t);(il+l*threshold+thresholdPx)&&(r[u]=r[u]||{},r[u][t]={viewport:t,targetWidth:l,imageWidth:i,size:a})}})}})}),(0,_allSources2.default)(e).forEach(function(i,o){if(r[o]){var u=r[o][["1280x720","1440x810","1000x563","320x427","480x270","1920x1080",Object.keys(r[o])[0]].filter(function(e){return r[o][e]})[0]],a=[],n=0;Object.keys(r[o]).forEach(function(e){var t=e.split("x")[0];Math.abs(n-t)>20&&a.push([e,e]),a[a.length-1][1]=e,n=t});for(var s=0;s"+_prismjs2.default.highlight(buildMarkup(e.markup),_prismjs2.default.languages.html,"html")+"";Object.keys(e.images).sort(function(e,t){return t.length-e.length}).forEach(function(t){s=s.replace(new RegExp("([>,\\s])("+t.replace(/&/g,"&").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")+")([<,\\s])","g"),'$1$2$3')}),o.innerHTML=s,r.appendChild(o)}else{var l=document.createElement("p");l.textContent="All checks passed.",r.appendChild(l),r.className+=" -passed"}return r}function buildMarkup(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:95,n=t+"<"+e.tag,a=(e.attributes||[]).map(function(e){var n=e.name,a=e.value;return("srcset"===n||"sizes"===n)&&-1!==a.indexOf(",")&&n.length+a.length+4*t.length+7>r&&(a="\n"+t+"\t\t"+a.trim().replace(/,\s+/g,",\n"+t+"\t\t")+"\n"+t+"\t"),n+'="'+a+'"'});a.length&&(a.join(" ").length+e.tag.length+4*t.length+3>r?n+="\n"+t+"\t"+a.join("\n"+t+"\t")+"\n"+t:n+=" "+a.join(" ")),n+=">";var i=(e.children||[]).map(function(e){return buildMarkup(e,t+"\t",r)}).join("\n");return i&&(n+="\n"+i+"\n"+t),"img"!==e.tag&&"source"!==e.tag&&(n+=""),n}function buildErrors(e,t){var r={};return e.errors&&e.errors.forEach(function(e){r[e.key]=r[e.key]||[],r[e.key].push(e)}),e.sources.forEach(function(e){e.errors&&e.errors.forEach(function(e){r[e.key]=r[e.key]||[],r[e.key].push(e)})}),e.img&&e.img.errors&&e.img.errors.forEach(function(e){r[e.key]=r[e.key]||[],r[e.key].push(e)}),Object.keys(r).map(function(e){return buildError(e,r[e],t)})}function buildError(e,t,r){var n=document.createElement("div"),a=document.createElement("h3");a.innerHTML=(0,_marked.marked)(t[0].msg).replace(/<\/?p>/gi,""),n.appendChild(a);var i=document.createElement("div");t.forEach(function(e){var t=e.key,n=e.data;return i.appendChild(buildErrorMessage(t,n,r))}),n.appendChild(i);var u=document.createElement("div");return u.innerHTML=(0,_marked.marked)((0,_getDocs2.default)(e,"text")),n.appendChild(u),n}function buildErrorMessage(e,t,r){var n=document.createElement("div"),a=(0,_getDocs2.default)(e,"Error template"),i=[];Object.keys(t).forEach(function(e){r[t[e]]&&(t[e+"Url"]=r[t[e]].url,t[e+"Type"]=r[t[e]].type,t[e+"Size"]=r[t[e]].size.width+"x"+r[t[e]].size.height,t[e+"Width"]=r[t[e]].size.width,t[e+"Height"]=r[t[e]].size.height,i.push(t[e]))});var u=shortenUrls(i);return i.forEach(function(e,n){Object.keys(t).forEach(function(a){r[t[a]]&&t[a]===e&&"Url"!==a.substr(-3)&&(t[a]=u[n])})}),Object.keys(t).forEach(function(e){a=a.split("{{"+e+"}}").join("number"==typeof t[e]?t[e]:t[e]||"​")}),n.innerHTML=(0,_marked.marked)(a),n}function shortenUrl(e,t){if(!e||e.length<=t)return e;var r="",n="",a="";for(-1!==(e=e.replace(/^https?:\/\/[^/]+\//gi,"")).indexOf("?")&&(r=e.substr(e.indexOf("?")),e=e.substr(0,e.indexOf("?")));e.length+r.length>=t&&-1!==e.indexOf("/");)e=e.substr(e.indexOf("/")+1),n="…/";for(;e.length+r.length>=t&&-1!==r.lastIndexOf("&");)r=r.substr(0,r.lastIndexOf("&")),a="…";return n+e+r+a}function shortenUrls(e){if(!e)return e;if(e.length<2)return e.map(function(e){return shortenUrl(e,32)});var t=e.map(function(e){return e.length}).sort(function(e,t){return t-e})[0];if(t<=32)return e;for(var r="",n=!1;!n;){r+=e[0][r.length];for(var a=0;a"+_prismjs2.default.highlight(buildMarkup(e.markup),_prismjs2.default.languages.html,"html")+"";Object.keys(e.images).sort(function(e,t){return t.length-e.length}).forEach(function(t){s=s.replace(new RegExp("([>,\\s])("+t.replace(/&/g,"&").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")+")([<,\\s])","g"),'$1$2$3')}),o.innerHTML=s,r.appendChild(o)}else{var l=document.createElement("p");l.textContent="All checks passed.",r.appendChild(l),r.className+=" -passed"}return r}function buildMarkup(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:95,n=t+"<"+e.tag,a=(e.attributes||[]).map(function(e){var n=e.name,a=e.value;return("srcset"===n||"sizes"===n)&&-1!==a.indexOf(",")&&n.length+a.length+4*t.length+7>r&&(a="sizes"===n?"\n"+t+"\t\t"+(0,_splitCommaSeparatedListOfComponentValues2.default)(a.trim()).join(",\n"+t+"\t\t")+"\n"+t+"\t":"\n"+t+"\t\t"+a.trim().replace(/,\s+/g,",\n"+t+"\t\t")+"\n"+t+"\t"),n+'="'+a+'"'});a.length&&(a.join(" ").length+e.tag.length+4*t.length+3>r?n+="\n"+t+"\t"+a.join("\n"+t+"\t")+"\n"+t:n+=" "+a.join(" ")),n+=">";var i=(e.children||[]).map(function(e){return buildMarkup(e,t+"\t",r)}).join("\n");return i&&(n+="\n"+i+"\n"+t),"img"!==e.tag&&"source"!==e.tag&&(n+=""),n}function buildErrors(e,t){var r={};return e.errors&&e.errors.forEach(function(e){r[e.key]=r[e.key]||[],r[e.key].push(e)}),e.sources.forEach(function(e){e.errors&&e.errors.forEach(function(e){r[e.key]=r[e.key]||[],r[e.key].push(e)})}),e.img&&e.img.errors&&e.img.errors.forEach(function(e){r[e.key]=r[e.key]||[],r[e.key].push(e)}),Object.keys(r).map(function(e){return buildError(e,r[e],t)})}function buildError(e,t,r){var n=document.createElement("div"),a=document.createElement("h3");a.innerHTML=(0,_marked.marked)(t[0].msg).replace(/<\/?p>/gi,""),n.appendChild(a);var i=document.createElement("div");t.forEach(function(e){var t=e.key,n=e.data;return i.appendChild(buildErrorMessage(t,n,r))}),n.appendChild(i);var u=document.createElement("div");return u.innerHTML=(0,_marked.marked)((0,_getDocs2.default)(e,"text")),n.appendChild(u),n}function buildErrorMessage(e,t,r){var n=document.createElement("div"),a=(0,_getDocs2.default)(e,"Error template"),i=[];Object.keys(t).forEach(function(e){r[t[e]]&&(t[e+"Url"]=r[t[e]].url,t[e+"Type"]=r[t[e]].type,t[e+"Size"]=r[t[e]].size.width+"x"+r[t[e]].size.height,t[e+"Width"]=r[t[e]].size.width,t[e+"Height"]=r[t[e]].size.height,i.push(t[e]))});var u=shortenUrls(i);return i.forEach(function(e,n){Object.keys(t).forEach(function(a){r[t[a]]&&t[a]===e&&"Url"!==a.substr(-3)&&(t[a]=u[n])})}),Object.keys(t).forEach(function(e){a=a.split("{{"+e+"}}").join("number"==typeof t[e]?t[e]:t[e]||"​")}),n.innerHTML=(0,_marked.marked)(a),n}function shortenUrl(e,t){if(!e||e.length<=t)return e;var r="",n="",a="";for(-1!==(e=e.replace(/^https?:\/\/[^/]+\//gi,"")).indexOf("?")&&(r=e.substr(e.indexOf("?")),e=e.substr(0,e.indexOf("?")));e.length+r.length>=t&&-1!==e.indexOf("/");)e=e.substr(e.indexOf("/")+1),n="…/";for(;e.length+r.length>=t&&-1!==r.lastIndexOf("&");)r=r.substr(0,r.lastIndexOf("&")),a="…";return n+e+r+a}function shortenUrls(e){if(!e)return e;if(e.length<2)return e.map(function(e){return shortenUrl(e,32)});var t=e.map(function(e){return e.length}).sort(function(e,t){return t-e})[0];if(t<=32)return e;for(var r="",n=!1;!n;){r+=e[0][r.length];for(var a=0;at*(1-threshold)&&e2&&void 0!==arguments[2]?arguments[2]:.02,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;if(!(r&&i&&o&&a))return!1;var n=Math.round(o/a*i),u=Math.round(r/i*a);return n>r*(1-h)-d&&no*(1-h)-d&&u0&&--n,'"'!==d[0]&&"'"!==d[0]||(t.lastIndex=e.indexOf(d[0],t.lastIndex),-1!==t.lastIndex)););return s.push(e.substring(r).trim()),s}; + +},{}],156:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e){return e&&"string"!=typeof e?(0,_cloneDeep2.default)(e).map(function(e){return e.expressions=e.expressions.filter(function(e){var t=e.feature;return-1===viewportFeatures.indexOf(t)}),!e.expressions.length&&"all"===e.type&&e.inverse&&(e.inverse=!1),e}):e};var _cloneDeep=require("lodash/cloneDeep"),_cloneDeep2=_interopRequireDefault(_cloneDeep);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var viewportFeatures=["width","height","aspect-ratio","orientation"]; },{"lodash/cloneDeep":93}]},{},[114]);