mirror of https://github.com/jpanther/congo.git
11 lines
27 KiB
JavaScript
11 lines
27 KiB
JavaScript
|
e=this,t=function(){"use strict";function V(e,s){var t=Object.keys(e),n;return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),s&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),t.push.apply(t,n)),t}function u(n){for(var e=1,t;e<arguments.length;e++)t=null!=arguments[e]?arguments[e]:{},e%2?V(Object(t),!0).forEach(function(e){y(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):V(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))});return n}function w(e){return w="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},w(e)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R(s,n){for(var t=0,e;t<n.length;t++)e=n[t],e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(s,e.key,e)}function n(e,t,n){return t&&R(e.prototype,t),n&&R(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(t,"prototype",{value:Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),writable:!1}),e&&j(t,e)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function j(e,t){return j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},j(e,t)}function eu(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 function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}function c(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,s=p(e),o;return t?(o=p(this).constructor,n=Reflect.construct(s,arguments,o)):n=s.apply(this,arguments),eu(this,n)}}function l(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return g(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?g(e,n):void 0}}(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 g(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=n[t];return s}function o(e){return Array.isArray?Array.isArray(e):"[object Array]"===M(e)}function i(e){return"string"==typeof e}function z(e){return"number"==typeof e}function ec(e){return!0===e||!1===e||function(e){return T(e)&&null!==e}(e)&&"[object Boolean]"==M(e)}function T(e){return"object"===w(e)}function s(e){return null!=e}function E(e){return!e.trim().length}function M(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var ea=function(e){return"Invalid value for key ".concat(e)},eo=function(e){return"Pattern length exceeds max of ".concat(e,".")},A=Object.prototype.hasOwnProperty,es=function(){function e(o){var s=this,n;t(this,e),this._keys=[],this._keyMap={},n=0,o.forEach(function(t){var e=k(t);n+=e.weight,s._keys.push(e),s._keyMap[e.id]=e,n+=e.weight}),this._keys.fo
|
||
|
<a class="flex items-center px-3 py-2 rounded-md appearance-none bg-neutral-100 dark:bg-neutral-700 focus:bg-primary-100 hover:bg-primary-100 dark:hover:bg-primary-900 dark:focus:bg-primary-900 focus:outline-dotted focus:outline-transparent focus:outline-2" href="${t.item.permalink}" tabindex="0">
|
||
|
<div class="grow">
|
||
|
<div class="-mb-1 text-lg font-bold">${t.item.title}</div>
|
||
|
<div class="text-sm text-neutral-500 dark:text-neutral-400">${t.item.section}<span class="px-2 text-primary-500">·</span>${t.item.date}</span></div>
|
||
|
<div class="text-sm italic">${t.item.summary}</div>
|
||
|
</div>
|
||
|
<div class="ml-2 ltr:block rtl:hidden text-neutral-500">→</div>
|
||
|
<div class="mr-2 ltr:hidden rtl:block text-neutral-500">←</div>
|
||
|
</a>
|
||
|
</li>`}),hasResults=!0):(e="",hasResults=!1),output.innerHTML=e,t.length>0&&(first=output.firstChild.firstElementChild,last=output.lastChild.firstElementChild)}scriptBundle=document.getElementById("script-bundle"),copyText=scriptBundle?scriptBundle.getAttribute("data-copy"):"Copy",copiedText=scriptBundle?scriptBundle.getAttribute("data-copied"):"Copied";function createCopyButton(t){const e=document.createElement("button");e.className="copy-button",e.type="button",e.ariaLabel=copyText,e.innerText=copyText,e.addEventListener("click",()=>copyCodeToClipboard(e,t)),addCopyButtonToDom(e,t)}async function copyCodeToClipboard(n,e){const t=e.querySelector(":last-child > .chroma > code").innerText;try{result=await navigator.permissions.query({name:"clipboard-write"}),result.state=="granted"||result.state=="prompt"?await navigator.clipboard.writeText(t):copyCodeBlockExecCommand(t,e)}catch(n){copyCodeBlockExecCommand(t,e)}finally{codeWasCopied(n)}}function copyCodeBlockExecCommand(o,t){const e=document.createElement("textArea");e.contentEditable="true",e.readOnly="false",e.className="copy-textarea",e.value=o,t.insertBefore(e,t.firstChild);const n=document.createRange();n.selectNodeContents(e);const s=window.getSelection();s.removeAllRanges(),s.addRange(n),e.setSelectionRange(0,999999),document.execCommand("copy"),t.removeChild(e)}function codeWasCopied(e){e.blur(),e.innerText=copiedText,setTimeout(function(){e.innerText=copyText},2e3)}function addCopyButtonToDom(n,e){e.insertBefore(n,e.firstChild);const t=document.createElement("div");t.className="highlight-wrapper",e.parentNode.insertBefore(t,e),t.appendChild(e)}window.addEventListener("DOMContentLoaded",e=>{document.querySelectorAll(".highlight").forEach(e=>createCopyButton(e))})
|