fossasia-22-renode/plugin/highlight/highlight.esm.js

6 lines
876 KiB
JavaScript
Raw Normal View History

var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var n=function(e){return e&&e.Math==Math&&e},a=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")(),r=function(e){try{return!!e()}catch(e){return!0}},i=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),o={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,l={f:s&&!o.call({1:2},1)?function(e){var t=s(this,e);return!!t&&t.enumerable}:o},c=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},_={}.toString,d=function(e){return _.call(e).slice(8,-1)},u="".split,m=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==d(e)?u.call(e,""):Object(e)}:Object,p=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},E=function(e){return m(p(e))},g=function(e){return"object"==typeof e?null!==e:"function"==typeof e},S=function(e,t){if(!g(e))return e;var n,a;if(t&&"function"==typeof(n=e.toString)&&!g(a=n.call(e)))return a;if("function"==typeof(n=e.valueOf)&&!g(a=n.call(e)))return a;if(!t&&"function"==typeof(n=e.toString)&&!g(a=n.call(e)))return a;throw TypeError("Can't convert object to primitive value")},b={}.hasOwnProperty,T=function(e,t){return b.call(e,t)},f=a.document,C=g(f)&&g(f.createElement),N=function(e){return C?f.createElement(e):{}},R=!i&&!r((function(){return 7!=Object.defineProperty(N("div"),"a",{get:function(){return 7}}).a})),O=Object.getOwnPropertyDescriptor,v={f:i?O:function(e,t){if(e=E(e),t=S(t,!0),R)try{return O(e,t)}catch(e){}if(T(e,t))return c(!l.f.call(e,t),e[t])}},h=function(e){if(!g(e))throw TypeError(String(e)+" is not an object");return e},I=Object.defineProperty,A={f:i?I:function(e,t,n){if(h(e),t=S(t,!0),h(n),R)try{return I(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},y=i?function(e,t,n){return A.f(e,t,c(1,n))}:function(e,t,n){return e[t]=n,e},D=function(e,t){try{y(a,e,t)}catch(n){a[e]=t}return t},M=a["__core-js_shared__"]||D("__core-js_shared__",{}),L=Function.toString;"function"!=typeof M.inspectSource&&(M.inspectSource=function(e){return L.call(e)});var x,w,P,k=M.inspectSource,U=a.WeakMap,F="function"==typeof U&&/native code/.test(k(U)),B=t((function(e){(e.exports=function(e,t){return M[e]||(M[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.7.0",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),G=0,Y=Math.random(),H=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++G+Y).toString(36)},V=B("keys"),q=function(e){return V[e]||(V[e]=H(e))},z={},$=a.WeakMap;if(F){var W=M.state||(M.state=new $),Q=W.get,K=W.has,j=W.set;x=function(e,t){return t.facade=e,j.call(W,e,t),t},w=function(e){return Q.call(W,e)||{}},P=function(e){return K.call(W,e)}}else{var X=q("state");z[X]=!0,x=function(e,t){return t.facade=e,y(e,X,t),t},w=function(e){return T(e,X)?e[X]:{}},P=function(e){return T(e,X)}}var Z={set:x,get:w,has:P,enforce:function(e){return P(e)?w(e):x(e,{})},getterFor:function(e){return function(t){var n;if(!g(t)||(n=w(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},J=t((function(e){var t=Z.get,n=Z.enforce,r=String(String).split("String");(e.exports=function(e,t,i,o){var s,l=!!o&&!!o.unsafe,c=!!o&&!!o.enumerable,_=!!o&&!!o.noTargetGet;"function"==typeof i&&("string"!=typeof t||T(i,"name")||y(i,"name",t),(s=n(i)).source||(s.source=r.join("string"==typeof t?t:""))),e!==a?(l?!_&&e[t]&&(c=!0):delete e[t],c?e[t]=i:y(e,t,i)):c?e[t]=i:D(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||k(this)}))})),ee=a,te=function(e)
/*!
* reveal.js plugin that adds syntax highlight support.
*/
var Ad={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",hljs:Id,init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){var n=e.querySelector('script[type="text/template"]');n&&(e.textContent=n.innerHTML),e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}function n(e){for(var t=e.split("\n"),n=0;n<t.length&&""===t[n].trim();n++)t.splice(n--,1);for(n=t.length-1;n>=0&&""===t[n].trim();n--)t.splice(n,1);return t.join("\n")}return function(e){var a=n(e.innerHTML).split("\n"),r=a.reduce((function(e,n){return n.length>0&&t(n).length>0&&e>n.length-t(n).length?n.length-t(n).length:e}),Number.POSITIVE_INFINITY);return a.map((function(e,t){return e.slice(r)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;")),e.addEventListener("focusout",(function(e){Id.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&Ad.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){Ad.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(Id.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){Id.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},n=Ad.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(n.length>1){var a=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof a||isNaN(a))&&(a=null),n.slice(1).forEach((function(n){var r=e.cloneNode(!0);r.setAttribute("data-line-numbers",Ad.serializeHighlightSteps([n])),r.classList.add("fragment"),e.parentNode.appendChild(r),Ad.highlightLines(r),"number"==typeof a?(r.setAttribute("data-fragment-index",a),a+=1):r.removeAttribute("data-fragment-index"),r.addEventListener("visible",Ad.scrollHighlightedLineIntoView.bind(Ad,r,t)),r.addEventListener("hidden",Ad.scrollHighlightedLineIntoView.bind(Ad,r.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",Ad.serializeHighlightSteps([n[0]]))}var r="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(r){r.addEventListener("visible",(function n(){Ad.scrollHighlightedLineIntoView(e,t,!0),r.removeEventListener("visible",n)}))}Ad.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,n){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var a=this.getHighlightedLineBounds(e),r=e.offsetHeight,i=getComputedStyle(e);r-=parseInt(i.paddingTop)+parseInt(i.paddingBottom);var o=e.scrollTop,s=a.top+(Math.min(a.bottom-a.top,r)-r)/2,l=e.querySelector(".hljs-ln");if(l&&(s+=l.offsetTop-parseInt(i.paddingTop)),s=Math.max(Math.min(s,e.scrollHeight-r),0),!0===n||o===s)e.scrollTop=s;else{if(e.scrollHeight<=r)return;var c=0;!function n(){c=Math.min(c+.02,1),e.scrollTop=o+(s-o)*Ad.easeInOutQuart(c),c<1&&(t.animationFrameID=requestAnimationFrame(n))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var n=t[0],a=t[t.length-1];return{top:n.offsetTop,bottom:a.offsetTop+a.offsetHeight}},highlightLines:function(e,t){var n=Ad.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));n.length&&n[0].forEach((function(t){var n=[];"number"==typeof t.end?n=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(n=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),n.length&&(n.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighl