ISO-Share/node_modules/zero-md/dist/zero-md.legacy.min.js
Aroy-Art 092042a42d
Some checks failed
Publish Docker rootless image / Push Docker image to Docker Hub (push) Failing after 38s
Publish Docker image / Push Docker image to Docker Hub (push) Failing after 41s
Add: npm zero-md package
2024-03-27 14:37:57 +01:00

2 lines
19 KiB
JavaScript

var ZeroMd=function(t){"use strict";function e(t,e,n){return e=f(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return p(t)}(t,r()?Reflect.construct(e,n||[],f(t).constructor):e.apply(t,n))}function r(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(r=function(){return!!t})()}function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){l(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(){i=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new _(n||[]);return o(a,"_invoke",{value:L(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var d="suspendedStart",p="suspendedYield",y="executing",v="completed",m={};function b(){}function g(){}function w(){}var k={};l(k,c,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(N([])));j&&j!==r&&n.call(j,c)&&(k=j);var O=w.prototype=b.prototype=Object.create(k);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function L(e,r,n){var o=d;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?v:p,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=w,o(O,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},E(P.prototype),l(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new P(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(O),l(O,s,"Generator"),l(O,c,(function(){return this})),l(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function a(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function c(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)}))}}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}function l(t,e,r){return(e=a(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function d(t){var e="function"==typeof Map?new Map:void 0;return d=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(r())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var i=new(t.bind.apply(t,o));return n&&h(i,n.prototype),i}(t,arguments,f(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,t)},d(t)}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function y(t){return function(t){if(Array.isArray(t))return t}(t)||m(t)||b(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 v(t){return function(t){if(Array.isArray(t))return g(t)}(t)||m(t)||b(t)||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 m(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function b(t,e){if(t){if("string"==typeof t)return g(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(t,e):void 0}}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var w=function(t){function r(t){var n,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(i=e(this,r)).version="2.5.4",i.config=o(o({markedUrl:"https://cdn.jsdelivr.net/gh/markedjs/marked@4/marked.min.js",prismUrl:[["https://cdn.jsdelivr.net/gh/PrismJS/prism@1/prism.min.js","data-manual"],"https://cdn.jsdelivr.net/gh/PrismJS/prism@1/plugins/autoloader/prism-autoloader.min.js"],cssUrls:["https://cdn.jsdelivr.net/gh/sindresorhus/github-markdown-css@4/github-markdown.min.css","https://cdn.jsdelivr.net/gh/PrismJS/prism@1/themes/prism.min.css"],hostCss:":host{display:block;position:relative;contain:content;}:host([hidden]){display:none;}"},t),window.ZeroMdConfig),i.root=i.hasAttribute("no-shadow")?p(i):i.attachShadow({mode:"open"}),(n=i.root).prepend.apply(n,v(i.makeNodes('<div class="markdown-styles"></div><div class="markdown-body"></div>'))),i.constructor.ready||(i.constructor.ready=Promise.all([!!window.marked||i.loadScript(i.config.markedUrl),!!window.Prism||i.loadScript(i.config.prismUrl)])),i.clicked=i.clicked.bind(p(i)),i.manualRender||i.render().then((function(){return setTimeout((function(){return i.goto(location.hash)}),250)})),i.observer=new MutationObserver((function(){i.observeChanges(),i.manualRender||i.render()})),i.observer.observe(p(i),{childList:!0}),i.observeChanges(),i}var n,a,c,l,f,d,m;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(r,t),n=r,a=[{key:"src",get:function(){return this.getAttribute("src")},set:function(t){this.reflect("src",t)}},{key:"manualRender",get:function(){return this.hasAttribute("manual-render")},set:function(t){this.reflect("manual-render",t)}},{key:"reflect",value:function(t,e){!1===e?this.removeAttribute(t):this.setAttribute(t,!0===e?"":e)}},{key:"attributeChangedCallback",value:function(t,e,r){"src"===t&&this.connected&&!this.manualRender&&r!==e&&this.render()}},{key:"observeChanges",value:function(){var t=this;this.querySelectorAll('template,script[type="text/markdown"]').forEach((function(e){t.observer.observe(e.content||e,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}))}},{key:"connectedCallback",value:function(){var t=this;this.connected=!0,this.fire("zero-md-connected",{},{bubbles:!1,composed:!1}),this.waitForReady().then((function(){t.fire("zero-md-ready")})),this.shadowRoot&&this.shadowRoot.addEventListener("click",this.clicked)}},{key:"disconnectedCallback",value:function(){this.connected=!1,this.shadowRoot&&this.shadowRoot.removeEventListener("click",this.clicked)}},{key:"waitForReady",value:function(){var t=this,e=this.connected||new Promise((function(e){t.addEventListener("zero-md-connected",(function t(){this.removeEventListener("zero-md-connected",t),e()}))}));return Promise.all([this.constructor.ready,e])}},{key:"fire",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{bubbles:!0,composed:!0};e.msg&&console.warn(e.msg),this.dispatchEvent(new CustomEvent(t,o({detail:o({node:this},e)},r)))}},{key:"tick",value:function(){return new Promise((function(t){return requestAnimationFrame(t)}))}},{key:"arrify",value:function(t){return t?Array.isArray(t)?t:[t]:[]}},{key:"onload",value:function(t){return new Promise((function(e,r){t.onload=e,t.onerror=function(t){return r(t.path?t.path[0]:t.composedPath()[0])}}))}},{key:"loadScript",value:function(t){var e=this;return Promise.all(this.arrify(t).map((function(t){var r=y(e.arrify(t)),n=r[0],o=r.slice(1),i=document.createElement("script");return i.src=n,i.async=!1,o.forEach((function(t){return i.setAttribute(t,"")})),e.onload(document.head.appendChild(i))})))}},{key:"goto",value:function(t){var e;try{e=this.root.querySelector(t)}catch(t){}e&&e.scrollIntoView()}},{key:"clicked",value:function(t){if(!(t.metaKey||t.ctrlKey||t.altKey||t.shiftKey||t.defaultPrevented)){var e=t.target.closest("a");e&&e.hash&&e.host===location.host&&e.pathname===location.pathname&&this.goto(e.hash)}}},{key:"dedent",value:function(t){var e=(t=t.replace(/^\n/,"")).match(/^\s+/);return e?t.replace(new RegExp("^".concat(e[0]),"gm"),""):t}},{key:"getBaseUrl",value:function(t){var e=document.createElement("a");return e.href=t,e.href.substring(0,e.href.lastIndexOf("/")+1)}},{key:"highlight",value:function(t){return new Promise((function(e){t.querySelectorAll('pre>code:not([class*="language-"])').forEach((function(t){var e=t.innerText.match(/^\s*</)?"markup":t.innerText.match(/^\s*(\$|#)/)?"bash":"js";t.classList.add("language-".concat(e))}));try{window.Prism.highlightAllUnder(t,!0,e())}catch(r){window.Prism.highlightAllUnder(t),e()}}))}},{key:"makeNodes",value:function(t){var e=document.createElement("template");return e.innerHTML=t,e.content.children}},{key:"buildStyles",value:function(){var t=this,e=function(e){var r=t.querySelector(e);return r?r.innerHTML||" ":""},r=this.arrify(this.config.cssUrls);return"<style>".concat(this.config.hostCss,"</style>").concat(e('template[data-merge="prepend"]')).concat(e("template:not([data-merge])")||r.reduce((function(t,e){return"".concat(t,'<link rel="stylesheet" href="').concat(e,'">')}),"")).concat(e('template[data-merge="append"]'))}},{key:"buildMd",value:(m=u(i().mark((function t(){var e,r,n,a=this,c=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=c.length>0&&void 0!==c[0]?c[0]:{},r=function(){var t=u(i().mark((function t(){var r,n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a.src){t.next=2;break}return t.abrupt("return","");case 2:return t.next=4,fetch(a.src);case 4:if(!(r=t.sent).ok){t.next=12;break}return t.next=8,r.text();case 8:return n=t.sent,t.abrupt("return",window.marked.parse(n,o({baseUrl:a.getBaseUrl(a.src)},e)));case 12:return a.fire("zero-md-error",{msg:"[zero-md] HTTP error ".concat(r.status," while fetching src"),status:r.status,src:a.src}),t.abrupt("return","");case 14:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),n=function(){var t=a.querySelector('script[type="text/markdown"]');if(!t)return"";var r=t.hasAttribute("data-dedent")?a.dedent(t.text):t.text;return window.marked.parse(r,e)},t.next=5,r();case 5:if(t.t0=t.sent,t.t0){t.next=8;break}t.t0=n();case 8:return t.abrupt("return",t.t0);case 9:case"end":return t.stop()}}),t)}))),function(){return m.apply(this,arguments)})},{key:"getHash",value:function(t){for(var e=5381,r=0;r<t.length;r++)e=(e<<5)+e^t.charCodeAt(r);return(e>>>0).toString(36)}},{key:"stampStyles",value:(d=u(i().mark((function t(e){var r,n,o,a,c=this;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.getHash(e),(n=this.root.querySelector(".markdown-styles")).getAttribute("data-hash")===r){t.next=11;break}return n.setAttribute("data-hash",r),o=this.makeNodes(e),a=v(o).filter((function(t){return"LINK"===t.tagName&&"stylesheet"===t.getAttribute("rel")})),n.innerHTML="",n.append.apply(n,v(o)),t.next=10,Promise.all(a.map((function(t){return c.onload(t)}))).catch((function(t){c.fire("zero-md-error",{msg:"[zero-md] An external stylesheet failed to load",status:void 0,src:t.href})}));case 10:return t.abrupt("return",!0);case 11:case"end":return t.stop()}}),t,this)}))),function(t){return d.apply(this,arguments)})},{key:"stampBody",value:(f=u(i().mark((function t(e,r){var n,o,a,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.arrify(r),o=this.getHash(e+JSON.stringify(n)),(a=this.root.querySelector(".markdown-body")).getAttribute("data-hash")===o){t.next=13;break}return a.setAttribute("data-hash",o),n.unshift("markdown-body"),a.setAttribute("class",n.join(" ")),c=this.makeNodes(e),a.innerHTML="",a.append.apply(a,v(c)),t.next=12,this.highlight(a);case 12:return t.abrupt("return",!0);case 13:case"end":return t.stop()}}),t,this)}))),function(t,e){return f.apply(this,arguments)})},{key:"render",value:(l=u(i().mark((function t(){var e,r,n,o,a=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=a.length>0&&void 0!==a[0]?a[0]:{},t.next=3,this.waitForReady();case 3:return r=this.buildMd(e),t.next=6,this.stampStyles(this.buildStyles());case 6:return n=t.sent,t.next=9,this.tick();case 9:return t.t0=this,t.next=12,r;case 12:return t.t1=t.sent,t.t2=e.classes,t.next=16,t.t0.stampBody.call(t.t0,t.t1,t.t2);case 16:o=t.sent,this.fire("zero-md-rendered",{node:this,stamped:{styles:n,body:o}});case 18:case"end":return t.stop()}}),t,this)}))),function(){return l.apply(this,arguments)})}],c=[{key:"observedAttributes",get:function(){return["src"]}}],a&&s(n.prototype,a),c&&s(n,c),Object.defineProperty(n,"prototype",{writable:!1}),r}(d(HTMLElement));return customElements.define("zero-md",w),t.ZeroMd=w,t}({});
//# sourceMappingURL=zero-md.legacy.min.js.map