bpm-presentation/plugin/highlight/highlight.js

6 lines
926 KiB
JavaScript
Raw Normal View History

2022-01-19 21:19:28 -05:00
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).RevealHighlight=t()}(this,(function(){"use strict";function e(t){return e="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},e(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function a(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}function o(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=r(e);if(t){var i=r(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return o(this,n)}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var a,r,i=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(i.push(a.value),!t||i.length!==t);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}return i}(e,t)||_(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},m=function(e){return e&&e.Math==Math&&e},p=m("object"==typeof globalThis&&globalThis)||m("object"==typeof window&&window)||m("object"==typeof self&&self)||m("object"==typeof u&&u)||function(){return this}()||Function("return this")(),g={exports:{}},E=p,S=Object.defineProperty,b=function(e,t){try{S(E,e,{value:t,configurable:!0,writable:!0})}catch(n){E[e]=t}return t},f=b,T="__core-js_shared__",C=p[T]||f(T,{}),N=C;(g.exports=function(e,t){return N[e]||(N[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"});var R,v,O=function(e){try{return!!e()}catch(e){return!0}},h=!O((function(){var e=function(){}.bind();return"function"!=typeof e||e.has
2022-01-19 14:35:25 -05:00
/*!
* reveal.js plugin that adds syntax highlight support.
*/
2022-01-19 21:19:28 -05:00
var Zh={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",hljs:Xh,init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,Array.from(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){e.parentNode.classList.add("code-wrapper");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){Xh.highlightElement(e.currentTarget)}),!1)})),"function"==typeof t.beforeHighlight&&t.beforeHighlight(Xh),t.highlightOnLoad&&Array.from(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){Zh.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){Zh.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(Xh.highlightElement(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){Xh.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},n=Zh.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",Zh.serializeHighlightSteps([n])),r.classList.add("fragment"),e.parentNode.appendChild(r),Zh.highlightLines(r),"number"==typeof a?(r.setAttribute("data-fragment-index",a),a+=1):r.removeAttribute("data-fragment-index"),r.addEventListener("visible",Zh.scrollHighlightedLineIntoView.bind(Zh,r,t)),r.addEventListener("hidden",Zh.scrollHighlightedLineIntoView.bind(Zh,r.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",Zh.serializeHighlightSteps([n[0]]))}var r="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(r){r.addEventListener("visible",(function n(){Zh.scrollHighlightedLineIntoView(e,t,!0),r.removeEventListener("visible",n)}))}Zh.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)*Zh.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=Zh.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=[].sli