mirror of
				https://github.com/Theodor-Springmann-Stiftung/musenalm.git
				synced 2025-10-31 18:25:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			800 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			800 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| var T = (r) => {
 | |
|   throw TypeError(r);
 | |
| };
 | |
| var _ = (r, t, e) => t.has(r) || T("Cannot " + e);
 | |
| var c = (r, t, e) => (_(r, t, "read from private field"), e ? e.call(r) : t.get(r)), l = (r, t, e) => t.has(r) ? T("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), u = (r, t, e, i) => (_(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e), g = (r, t, e) => (_(r, t, "access private method"), e);
 | |
| const k = "script[xslt-onload]", y = "xslt-template", S = "xslt-transformed", M = "filter-list", m = "filter-list-list", B = "filter-list-item", C = "filter-list-input", w = "filter-list-searchable", I = "scroll-button", q = "tool-tip", P = "abbrev-tooltips", R = "int-link", H = "popup-image", $ = "tab-list", O = "filter-pill", N = "image-reel";
 | |
| var d, b, E;
 | |
| class V {
 | |
|   constructor() {
 | |
|     l(this, b);
 | |
|     l(this, d);
 | |
|     u(this, d, /* @__PURE__ */ new Map());
 | |
|   }
 | |
|   setup() {
 | |
|     let t = htmx.findAll(k);
 | |
|     for (let e of t)
 | |
|       g(this, b, E).call(this, e);
 | |
|   }
 | |
|   hookupHTMX() {
 | |
|     htmx.on("htmx:load", (t) => {
 | |
|       this.setup();
 | |
|     });
 | |
|   }
 | |
| }
 | |
| d = new WeakMap(), b = new WeakSet(), E = function(t) {
 | |
|   if (t.getAttribute(S) === "true" || !t.hasAttribute(y))
 | |
|     return;
 | |
|   let e = "#" + t.getAttribute(y), i = c(this, d).get(e);
 | |
|   if (!i) {
 | |
|     let h = htmx.find(e);
 | |
|     if (h) {
 | |
|       let A = h.innerHTML ? new DOMParser().parseFromString(h.innerHTML, "application/xml") : h.contentDocument;
 | |
|       i = new XSLTProcessor(), i.importStylesheet(A), c(this, d).set(e, i);
 | |
|     } else
 | |
|       throw new Error("Unknown XSLT template: " + e);
 | |
|   }
 | |
|   let s = new DOMParser().parseFromString(t.innerHTML, "application/xml"), a = i.transformToFragment(s, document), n = new XMLSerializer().serializeToString(a);
 | |
|   t.outerHTML = n;
 | |
| };
 | |
| class F extends HTMLElement {
 | |
|   constructor() {
 | |
|     super(), this._value = "", this.render();
 | |
|   }
 | |
|   static get observedAttributes() {
 | |
|     return ["data-text", "data-queryparam", "data-value"];
 | |
|   }
 | |
|   set value(t) {
 | |
|     this.setAttribute("data-value", t);
 | |
|   }
 | |
|   get value() {
 | |
|     return this.getAttribute("data-value") || "";
 | |
|   }
 | |
|   set text(t) {
 | |
|     this.setAttribute("data-text", t);
 | |
|   }
 | |
|   get text() {
 | |
|     return this.getAttribute("data-text") || "";
 | |
|   }
 | |
|   set queryparam(t) {
 | |
|     this.setAttribute("data-queryparam", t);
 | |
|   }
 | |
|   get queryparam() {
 | |
|     return this.getAttribute("data-queryparam") || "";
 | |
|   }
 | |
|   connectedCallback() {
 | |
|     this._filter = this.text, this._queryparam = this.queryparam, this.render(), htmx.process(this);
 | |
|   }
 | |
|   attributeChangedCallback(t, e, i) {
 | |
|     e !== i && (t === "data-text" && (this._filter = i), t === "data-queryparam" && (this._queryparam = i), t === "data-value" && (this._value = i), this.render());
 | |
|   }
 | |
|   getURL() {
 | |
|     if (this._queryparam) {
 | |
|       let t = new URL(window.location), e = new URLSearchParams(t.search);
 | |
|       return e.delete(this._queryparam), e.delete("page"), t.search = e.toString(), t.toString();
 | |
|     }
 | |
|     return "#";
 | |
|   }
 | |
|   render() {
 | |
|     this.innerHTML = `
 | |
| 		<a href="${this.getURL()}" class="!no-underline block text-base" hx-target="#searchresults" hx-select="#searchresults" hx-indicator="body" hx-swap="outerHTML show:window:top">
 | |
| 			<div class="flex flex-row filter-pill rounded-lg bg-orange-100 hover:saturate-50 px-2.5">
 | |
| 				${this.renderIcon()}
 | |
| 				<div class="flex flex-row filter-pill-label-value !items-baseline text-slate-700">
 | |
| 					<div class="filter-pill-label font-bold mr-1.5 align-baseline">${this.text}</div>
 | |
| 					${this.renderValue()}
 | |
| 				</div>
 | |
| 			</div>
 | |
| 		</a>
 | |
| 		`;
 | |
|   }
 | |
|   renderIcon() {
 | |
|     return this.value === "true" || this.value === "false" ? `
 | |
| 			<div href="${this.getURL()}" class="filter-pill-close no-underline font-bold mr-1 text-orange-900 hover:text-orange-800">
 | |
| 				<i class="ri-close-circle-line"></i>
 | |
| 			</div>
 | |
| 		` : `<div
 | |
| 				href="${this.getURL()}"
 | |
| 				class="filter-pill-close no-underline font-bold mr-1 text-orange-900 hover:text-orange-800">
 | |
| 				<i class="ri-arrow-left-s-line"></i>
 | |
| 			</div>
 | |
| 			`;
 | |
|   }
 | |
|   renderValue() {
 | |
|     return this.value === "true" || this.value === "false" ? "" : `
 | |
| 			<div class="filter-pill-value">${this.value}</div>
 | |
| 		`;
 | |
|   }
 | |
| }
 | |
| var o, x, f, L;
 | |
| class U extends HTMLElement {
 | |
|   constructor() {
 | |
|     super();
 | |
|     l(this, f);
 | |
|     l(this, o, !1);
 | |
|     l(this, x, "");
 | |
|     this._items = [], this._url = "", this._filterstart = !1, this._placeholder = "Liste filtern...", this._queryparam = "", this._startparams = null, this.render();
 | |
|   }
 | |
|   static get observedAttributes() {
 | |
|     return ["data-url"];
 | |
|   }
 | |
|   set items(e) {
 | |
|     Array.isArray(e) && (this._items = e, this.render());
 | |
|   }
 | |
|   get items() {
 | |
|     return this._items;
 | |
|   }
 | |
|   connectedCallback() {
 | |
|     this._url = this.getAttribute("data-url") || "./", this._filterstart = this.getAttribute("data-filterstart") === "true", this._placeholder = this.getAttribute("data-placeholder") || "Liste filtern...", this._queryparam = this.getAttribute("data-queryparam") || "", this._queryparam, this._filterstart && u(this, o, !0), this.addEventListener("input", this.onInput.bind(this)), this.addEventListener("keydown", this.onEnter.bind(this)), this.addEventListener("focusin", this.onGainFocus.bind(this)), this.addEventListener("focusout", this.onLoseFocus.bind(this));
 | |
|   }
 | |
|   attributeChangedCallback(e, i, s) {
 | |
|     e === "data-url" && i !== s && (this._url = s, this.render()), e === "data-filterstart" && i !== s && (this._filterstart = s === "true", this.render()), e === "data-placeholder" && i !== s && (this._placeholder = s, this.render()), e === "data-queryparam" && i !== s && (this._queryparam = s, this.render());
 | |
|   }
 | |
|   onInput(e) {
 | |
|     e.target && e.target.tagName.toLowerCase() === "input" && (this._filter = e.target.value, this.renderList());
 | |
|   }
 | |
|   onGainFocus(e) {
 | |
|     e.target && e.target.tagName.toLowerCase() === "input" && (u(this, o, !1), this.renderList());
 | |
|   }
 | |
|   onLoseFocus(e) {
 | |
|     let i = this.querySelector("input");
 | |
|     if (e.target && e.target === i) {
 | |
|       if (relatedElement = e.relatedTarget, relatedElement && this.contains(relatedElement))
 | |
|         return;
 | |
|       i.value = "", this._filter = "", this._filterstart && u(this, o, !0), this.renderList();
 | |
|     }
 | |
|   }
 | |
|   onEnter(e) {
 | |
|     if (e.target && e.target.tagName.toLowerCase() === "input" && e.key === "Enter") {
 | |
|       e.preventDefault();
 | |
|       const i = this.querySelector("a");
 | |
|       i && i.click();
 | |
|     }
 | |
|   }
 | |
|   mark() {
 | |
|     if (typeof Mark != "function")
 | |
|       return;
 | |
|     let e = this.querySelector("#" + m);
 | |
|     if (!e)
 | |
|       return;
 | |
|     let i = new Mark(e.querySelectorAll("." + w));
 | |
|     this._filter && i.mark(this._filter, {
 | |
|       separateWordSearch: !0
 | |
|     });
 | |
|   }
 | |
|   // INFO: allows for setting a custom HREF of the list item
 | |
|   // The function takes the item as parameter fn(item) and should return a string.
 | |
|   setHREFFunc(e) {
 | |
|     this.getHREF = e, this.render();
 | |
|   }
 | |
|   // INFO: allows for setting a custom link text of the list item
 | |
|   // The function takes the item as parameter fn(item) and should return a string or
 | |
|   // an HTML template literal.
 | |
|   setLinkTextFunc(e) {
 | |
|     this.getLinkText = e, this.render();
 | |
|   }
 | |
|   // INFO: allows for setting the text that will be filtered for.
 | |
|   // The function takes the item as parameter fn(item) and should return a string.
 | |
|   setSearchTextFunc(e) {
 | |
|     this.getSearchText = e, this.render();
 | |
|   }
 | |
|   getHREF(e) {
 | |
|     if (e) {
 | |
|       if (!e.id)
 | |
|         return "";
 | |
|     } else return "";
 | |
|     return e.id;
 | |
|   }
 | |
|   getHREFEncoded(e) {
 | |
|     return encodeURIComponent(this.getHREF(e));
 | |
|   }
 | |
|   getSearchText(e) {
 | |
|     if (e) {
 | |
|       if (!e.name)
 | |
|         return "";
 | |
|     } else return "";
 | |
|     return e.name;
 | |
|   }
 | |
|   getLinkText(e) {
 | |
|     let i = this.getSearchText(e);
 | |
|     return i === "" ? "" : `<span class="${w}">${i}</span>`;
 | |
|   }
 | |
|   getURL(e) {
 | |
|     if (this._queryparam) {
 | |
|       let i = new URL(window.location), s = new URLSearchParams(i.search);
 | |
|       return s.set(this._queryparam, this.getHREF(e)), s.delete("page"), i.search = s.toString(), i.toString();
 | |
|     }
 | |
|     return this._url + this.getHREFEncoded(e);
 | |
|   }
 | |
|   renderList() {
 | |
|     let e = this.querySelector("#" + m);
 | |
|     e && (e.outerHTML = this.List()), this.mark();
 | |
|   }
 | |
|   render() {
 | |
|     this.innerHTML = `
 | |
|             <div class="font-serif text-base shadow-inner border border-stone-100">
 | |
| 							${this.Input()}
 | |
| 							${this.List()}
 | |
|             </div>
 | |
|         `, htmx && htmx.process(this);
 | |
|   }
 | |
|   ActiveDot(e) {
 | |
|     return g(this, f, L).call(this, e), "";
 | |
|   }
 | |
|   NoItems(e) {
 | |
|     return e.length === 0 ? '<div class="px-2 py-0.5 italic text-gray-500">Keine Einträge gefunden</div>' : "";
 | |
|   }
 | |
|   Input() {
 | |
|     return `
 | |
| 			<div class="flex w-full py-0.5 border-b border-zinc-600 bg-stone-50">
 | |
| 						<i class="ri-arrow-right-s-line pl-2"></i>
 | |
| 						<div class="grow">
 | |
| 						<input
 | |
| 								type="text"
 | |
| 								placeholder="${this._placeholder}"
 | |
| 								class="${C} w-full placeholder:italic px-2 py-0.5" />
 | |
| 						</div>
 | |
| 				</div>
 | |
| 				`;
 | |
|   }
 | |
|   List() {
 | |
|     let e = this._items;
 | |
|     if (this._filter)
 | |
|       if (this._filterstart)
 | |
|         e = this._items.filter((i) => this.getSearchText(i).toLowerCase().startsWith(this._filter.toLowerCase()));
 | |
|       else {
 | |
|         let i = this._filter.split(" ");
 | |
|         e = this._items.filter((s) => i.every((a) => this.getSearchText(s).toLowerCase().includes(a.toLowerCase())));
 | |
|       }
 | |
|     return `
 | |
| 							<div id="${m}" class="${m} pt-1 max-h-60 overflow-auto bg-stone-50 ${c(this, o) ? "hidden" : ""}">
 | |
| 								${e.map(
 | |
|       (i, s) => `
 | |
| 									<a
 | |
| 										href="${this.getURL(i)}"
 | |
| 										hx-indicator="body"
 | |
| 										hx-swap="outerHTML show:none"
 | |
| 										hx-select="main"
 | |
| 										hx-target="main"
 | |
| 										class="${B} block px-2.5 py-0.5 hover:bg-slate-200 no-underline ${s % 2 === 0 ? "bg-stone-100" : "bg-stone-50"}"
 | |
| 										${g(this, f, L).call(this, i) ? 'aria-current="page"' : ""}>
 | |
| 										${this.ActiveDot(i)}
 | |
| 										${this.getLinkText(i)}
 | |
| 									</a>
 | |
| 								`
 | |
|     ).join("")}
 | |
| 								${this.NoItems(e)}
 | |
| 							</div>
 | |
| 				`;
 | |
|   }
 | |
| }
 | |
| o = new WeakMap(), x = new WeakMap(), f = new WeakSet(), L = function(e) {
 | |
|   if (!e)
 | |
|     return !1;
 | |
|   let i = this.getHREF(e);
 | |
|   return i === "" ? !1 : this._queryparam && (new URLSearchParams(window.location.search).get(this._queryparam) || "") === i ? !0 : !!window.location.href.endsWith(i);
 | |
| };
 | |
| class D extends HTMLElement {
 | |
|   constructor() {
 | |
|     super(), this.handleScroll = this.handleScroll.bind(this), this.scrollToTop = this.scrollToTop.bind(this);
 | |
|   }
 | |
|   connectedCallback() {
 | |
|     this.innerHTML = `
 | |
|           <button
 | |
|             class="
 | |
|               scroll-to-top
 | |
|               fixed bottom-5 right-5
 | |
|               hidden
 | |
|               bg-gray-800 text-white
 | |
|               p-2
 | |
|               rounded-md
 | |
|               cursor-pointer
 | |
|               text-2xl
 | |
|               hover:opacity-80
 | |
|               transition-opacity
 | |
|               border-0
 | |
|             "
 | |
|             aria-label="Scroll to top"
 | |
|           >
 | |
| 					<i class="ri-arrow-up-double-line"></i>
 | |
|           </button>
 | |
|         `, this._button = this.querySelector(".scroll-to-top"), window.addEventListener("scroll", this.handleScroll), this._button.addEventListener("click", this.scrollToTop);
 | |
|   }
 | |
|   disconnectedCallback() {
 | |
|     window.removeEventListener("scroll", this.handleScroll), this._button.removeEventListener("click", this.scrollToTop);
 | |
|   }
 | |
|   handleScroll() {
 | |
|     (window.scrollY || document.documentElement.scrollTop) > 300 ? this._button.classList.remove("hidden") : this._button.classList.add("hidden");
 | |
|   }
 | |
|   scrollToTop() {
 | |
|     window.scrollTo({ top: 0, behavior: "smooth" });
 | |
|   }
 | |
| }
 | |
| class z extends HTMLElement {
 | |
|   static get observedAttributes() {
 | |
|     return ["position", "timeout"];
 | |
|   }
 | |
|   constructor() {
 | |
|     super(), this._tooltipBox = null, this._timeout = 200, this._hideTimeout = null, this._hiddenTimeout = null;
 | |
|   }
 | |
|   connectedCallback() {
 | |
|     this.classList.add(
 | |
|       "w-full",
 | |
|       "h-full",
 | |
|       "relative",
 | |
|       "block",
 | |
|       "leading-none",
 | |
|       "[&>*]:leading-normal"
 | |
|     );
 | |
|     const t = this.querySelector(".data-tip"), e = t ? t.innerHTML : "Tooltip";
 | |
|     t && t.classList.add("hidden"), this._tooltipBox = document.createElement("div"), this._tooltipBox.innerHTML = e, this._tooltipBox.className = [
 | |
|       "opacity-0",
 | |
|       "hidden",
 | |
|       "absolute",
 | |
|       "px-2",
 | |
|       "py-1",
 | |
|       "text-sm",
 | |
|       "text-white",
 | |
|       "bg-gray-900",
 | |
|       "rounded",
 | |
|       "shadow",
 | |
|       "z-10",
 | |
|       "whitespace-nowrap",
 | |
|       "transition-all",
 | |
|       "duration-200",
 | |
|       "font-sans"
 | |
|     ].join(" "), this.appendChild(this._tooltipBox), this._updatePosition(), this.addEventListener("mouseenter", () => this._showTooltip()), this.addEventListener("mouseleave", () => this._hideTooltip());
 | |
|   }
 | |
|   attributeChangedCallback(t, e, i) {
 | |
|     t === "position" && this._tooltipBox && this._updatePosition(), t === "timeout" && i && (this._timeout = parseInt(i) || 200);
 | |
|   }
 | |
|   _showTooltip() {
 | |
|     clearTimeout(this._hideTimeout), clearTimeout(this._hiddenTimeout), this._tooltipBox.classList.remove("hidden"), setTimeout(() => {
 | |
|       this._tooltipBox.classList.remove("opacity-0"), this._tooltipBox.classList.add("opacity-100");
 | |
|     }, 16);
 | |
|   }
 | |
|   _hideTooltip() {
 | |
|     this._hideTimeout = setTimeout(() => {
 | |
|       this._tooltipBox.classList.remove("opacity-100"), this._tooltipBox.classList.add("opacity-0"), this._hiddenTimeout = setTimeout(() => {
 | |
|         this._tooltipBox.classList.add("hidden");
 | |
|       }, this._timeout + 100);
 | |
|     }, this._timeout);
 | |
|   }
 | |
|   _updatePosition() {
 | |
|     switch (this._tooltipBox.classList.remove(
 | |
|       "bottom-full",
 | |
|       "left-1/2",
 | |
|       "-translate-x-1/2",
 | |
|       "mb-2",
 | |
|       // top
 | |
|       "top-full",
 | |
|       "mt-2",
 | |
|       // bottom
 | |
|       "right-full",
 | |
|       "-translate-y-1/2",
 | |
|       "mr-2",
 | |
|       "top-1/2",
 | |
|       // left
 | |
|       "left-full",
 | |
|       "ml-2"
 | |
|       // right
 | |
|     ), this.getAttribute("position") || "top") {
 | |
|       case "bottom":
 | |
|         this._tooltipBox.classList.add(
 | |
|           "top-full",
 | |
|           "left-1/2",
 | |
|           "transform",
 | |
|           "-translate-x-1/2",
 | |
|           "mt-0.5"
 | |
|         );
 | |
|         break;
 | |
|       case "left":
 | |
|         this._tooltipBox.classList.add(
 | |
|           "right-full",
 | |
|           "top-1/2",
 | |
|           "transform",
 | |
|           "-translate-y-1/2",
 | |
|           "mr-0.5"
 | |
|         );
 | |
|         break;
 | |
|       case "right":
 | |
|         this._tooltipBox.classList.add(
 | |
|           "left-full",
 | |
|           "top-1/2",
 | |
|           "transform",
 | |
|           "-translate-y-1/2",
 | |
|           "ml-0.5"
 | |
|         );
 | |
|         break;
 | |
|       case "top":
 | |
|       default:
 | |
|         this._tooltipBox.classList.add(
 | |
|           "bottom-full",
 | |
|           "left-1/2",
 | |
|           "transform",
 | |
|           "-translate-x-1/2",
 | |
|           "mb-0.5"
 | |
|         );
 | |
|     }
 | |
|   }
 | |
| }
 | |
| class G extends HTMLElement {
 | |
|   constructor() {
 | |
|     super(), this.overlay = null, this._others = null, this._thisindex = -1, this._preview = null, this._description = null, this._imageURL = "", this._hideDLButton = !1;
 | |
|   }
 | |
|   connectedCallback() {
 | |
|     this.classList.add("cursor-pointer"), this.classList.add("select-none"), this._imageURL = this.getAttribute("data-image-url") || "", this._hideDLButton = this.getAttribute("data-hide-dl-button") || !1, this._preview = this.querySelector("img"), this._description = this.querySelector(".image-description"), this._preview && this._preview.addEventListener("click", () => {
 | |
|       this.showOverlay();
 | |
|     });
 | |
|     let t = this.closest("image-reel, .image-reel");
 | |
|     t || (t = document), this._others = Array.from(t.querySelectorAll("popup-image:not(.hidden)")), this._thisindex = this._others.indexOf(this);
 | |
|   }
 | |
|   disconnectedCallback() {
 | |
|     this.overlay && this.overlay.parentNode && this.overlay.parentNode.removeChild(this.overlay);
 | |
|   }
 | |
|   Keys(t) {
 | |
|     t.repeat || (t.preventDefault(), t.key === "ArrowRight" ? this.next() : t.key === "ArrowLeft" ? this.prev() : t.key === "Escape" && this.hideOverlay());
 | |
|   }
 | |
|   next() {
 | |
|     this._others[this._thisindex + 1] ? (this.hideOverlay(), this._others[this._thisindex + 1].showOverlay()) : document.addEventListener("keydown", this.Keys.bind(this), { once: !0 });
 | |
|   }
 | |
|   prev() {
 | |
|     this._others[this._thisindex - 1] ? (this.hideOverlay(), this._others[this._thisindex - 1].showOverlay()) : document.addEventListener("keydown", this.Keys.bind(this), { once: !0 });
 | |
|   }
 | |
|   showOverlay() {
 | |
|     this.overlay = document.createElement("div"), this.overlay.classList.add(
 | |
|       "fixed",
 | |
|       "inset-0",
 | |
|       "z-50",
 | |
|       "bg-black/70",
 | |
|       "flex",
 | |
|       "items-center",
 | |
|       "justify-center",
 | |
|       "p-4"
 | |
|     ), this.overlay.innerHTML = `
 | |
|       <div class="relative w-max max-w-dvw max-h-dvh shadow-lg flex flex-col items-center justify-center gap-4">
 | |
| 				<div>
 | |
| 				<div class="absolute -right-16 text-white text-4xl flex flex-col">
 | |
| 					<button class="hover:text-gray-300 cursor-pointer focus:outline-none" aria-label="Close popup" id="closebutton">
 | |
| 						<i class="ri-close-fill text-4xl"></i>
 | |
| 					</button>
 | |
| 						${this.downloadButton()}
 | |
| 						${this.nextButton()}
 | |
| 						${this.prevButton()}
 | |
| 				</div>
 | |
|         <img
 | |
|           src="${this._imageURL}"
 | |
|           alt="Popup Image"
 | |
|           class="full max-h-[80vh] max-w-[80vw] object-contain block relative ${this.descriptionImgClass()}"
 | |
|         />
 | |
| 				${this.description()}
 | |
| 					</div>
 | |
|       </div>
 | |
|     `;
 | |
|     const t = this.overlay.querySelector("#closebutton");
 | |
|     t && t.addEventListener("click", () => {
 | |
|       this.hideOverlay();
 | |
|     });
 | |
|     const e = this.overlay.querySelector("#nextbtn");
 | |
|     e && e.addEventListener("click", this.next.bind(this));
 | |
|     const i = this.overlay.querySelector("#prevbtn");
 | |
|     i && i.addEventListener("click", this.prev.bind(this)), this.overlay.addEventListener("click", (s) => {
 | |
|       s.target === this.overlay && this.hideOverlay();
 | |
|     }), document.addEventListener("keydown", this.Keys.bind(this), { once: !0 }), document.body.appendChild(this.overlay);
 | |
|   }
 | |
|   descriptionImgClass() {
 | |
|     return this.description ? "" : "0";
 | |
|   }
 | |
|   nextButton() {
 | |
|     return this._others[this._thisindex + 1] ? `
 | |
| 			<tool-tip position="right">
 | |
| 			<button class="hover:text-gray-300 cursor-pointer focus:outline-none" aria-label="Next image" id="nextbtn">
 | |
| 				<i class="ri-arrow-right-box-line"></i>
 | |
| 			</button>
 | |
| 			<div class="data-tip">Nächstes Bild</div>
 | |
| 			</tool-tip>
 | |
| 		` : "";
 | |
|   }
 | |
|   prevButton() {
 | |
|     return this._others[this._thisindex - 1] ? `
 | |
| 			<tool-tip position="right">
 | |
| 			<button class="hover:text-gray-300 cursor-pointer focus:outline-none" aria-label="Previous image" id="prevbtn">
 | |
| 				<i class="ri-arrow-left-box-line"></i>
 | |
| 			</button>
 | |
| 			<div class="data-tip">Vorheriges Bild</div>
 | |
| 			</tool-tip>
 | |
| 		` : "";
 | |
|   }
 | |
|   description() {
 | |
|     return this._description ? `
 | |
|         <div class="font-serif text-left description-content mt-3 text-slate-900 ">
 | |
| 					<div class="max-w-[80ch] hyphens-auto px-6 py-2 bg-stone-50 shadow-lg">
 | |
|           ${this._description.innerHTML}
 | |
| 						</div>
 | |
|         </div>
 | |
| 			` : "";
 | |
|   }
 | |
|   downloadButton() {
 | |
|     return this._hideDLButton ? "" : `
 | |
| 					<tool-tip position="right">
 | |
| 					<a href="${this._imageURL}" target="_blank" class="text-white no-underline hover:text-gray-300"><i class="ri-file-download-line"></i></a>
 | |
| 					<div class="data-tip">Bild herunterladen</div>
 | |
| 					</tool-tip>
 | |
| 		`;
 | |
|   }
 | |
|   hideOverlay() {
 | |
|     this.overlay.parentNode.removeChild(this.overlay), this.overlay = null;
 | |
|   }
 | |
| }
 | |
| class K extends HTMLElement {
 | |
|   static get observedAttributes() {
 | |
|   }
 | |
|   constructor() {
 | |
|     super(), this._showall = !1, this.shown = -1, this._headings = [], this._contents = [];
 | |
|   }
 | |
|   connectedCallback() {
 | |
|     this._headings = Array.from(this.querySelectorAll(".tab-list-head")), this._contents = Array.from(this.querySelectorAll(".tab-list-panel")), this.hookupEvtHandlers(), this.hideDependent(), this._headings.length === 1 && this.expand(0);
 | |
|   }
 | |
|   expand(t) {
 | |
|     t < 0 || t >= this._headings.length || (this.shown = t, this._contents.forEach((e, i) => {
 | |
|       i === t ? (e.classList.remove("hidden"), this._headings[i].setAttribute("aria-pressed", "true")) : (e.classList.add("hidden"), this._headings[i].setAttribute("aria-pressed", "false"));
 | |
|     }));
 | |
|   }
 | |
|   hookupEvtHandlers() {
 | |
|     for (let t of this._headings)
 | |
|       t.addEventListener("click", this.handleTabClick.bind(this)), t.classList.add("cursor-pointer"), t.classList.add("select-none"), t.setAttribute("role", "button"), t.setAttribute("aria-pressed", "false"), t.setAttribute("tabindex", "0");
 | |
|     for (let t of this._contents)
 | |
|       t.classList.add("hidden");
 | |
|   }
 | |
|   restore() {
 | |
|     for (let t of this._headings)
 | |
|       t.classList.add("cursor-pointer"), t.classList.add("select-none"), t.setAttribute("role", "button"), t.setAttribute("aria-pressed", "false"), t.setAttribute("tabindex", "0"), t.classList.remove("pointer-events-none"), t.classList.remove("!text-slate-900");
 | |
|     for (let t of this._contents)
 | |
|       t.classList.add("hidden");
 | |
|   }
 | |
|   disable() {
 | |
|     for (let t of this._headings)
 | |
|       t.classList.remove("cursor-pointer"), t.classList.remove("select-none"), t.removeAttribute("role"), t.removeAttribute("aria-pressed"), t.removeAttribute("tabindex"), t.classList.add("pointer-events-none"), t.classList.add("!text-slate-900");
 | |
|   }
 | |
|   showAll() {
 | |
|     this._showall = !0, this.shown = -1, this.disable(), this._contents.forEach((t, e) => {
 | |
|       t.classList.remove("hidden");
 | |
|       let i = this._headings[e], s = i.querySelectorAll(".show-opened");
 | |
|       for (let n of s)
 | |
|         n.classList.add("hidden");
 | |
|       let a = i.querySelectorAll(".show-closed");
 | |
|       for (let n of a)
 | |
|         n.classList.add("hidden");
 | |
|     });
 | |
|   }
 | |
|   default() {
 | |
|     this._showall = !1, this.restore(), this.hideDependent();
 | |
|   }
 | |
|   hideDependent() {
 | |
|     if (this.shown < 0)
 | |
|       for (const t of this._headings)
 | |
|         this._hideAllDep(t, !1);
 | |
|     else
 | |
|       this._headings.forEach((t, e) => {
 | |
|         this._hideAllDep(t, e === this.shown);
 | |
|       });
 | |
|   }
 | |
|   _hideAllDep(t, e) {
 | |
|     const i = t.querySelectorAll(".show-closed");
 | |
|     for (let a of i)
 | |
|       e ? a.classList.add("hidden") : a.classList.remove("hidden");
 | |
|     const s = Array.from(t.querySelectorAll(".show-opened"));
 | |
|     for (let a of s)
 | |
|       e ? a.classList.remove("hidden") : a.classList.add("hidden");
 | |
|   }
 | |
|   handleTabClick(t) {
 | |
|     if (!t.target) {
 | |
|       console.warn("Invalid event target");
 | |
|       return;
 | |
|     }
 | |
|     const e = this.findParentWithClass(t.target, "tab-list-head");
 | |
|     if (!e) {
 | |
|       console.warn("No parent found with class 'tab-list-head'");
 | |
|       return;
 | |
|     }
 | |
|     const i = this._headings.indexOf(e);
 | |
|     i === this.shown ? (this._contents[i].classList.toggle("hidden"), this._headings[i].setAttribute("aria-pressed", "false"), this.shown = -1) : this.expand(i), this.hideDependent();
 | |
|   }
 | |
|   findParentWithClass(t, e) {
 | |
|     for (; t; ) {
 | |
|       if (t.classList && t.classList.contains(e))
 | |
|         return t;
 | |
|       t = t.parentElement;
 | |
|     }
 | |
|     return null;
 | |
|   }
 | |
| }
 | |
| class p extends HTMLElement {
 | |
|   static get observedAttributes() {
 | |
|     return ["data-text", "data-abbrevmap"];
 | |
|   }
 | |
|   static get defaultAbbrevMap() {
 | |
|     return {
 | |
|       "#": "Hinweis auf weitere Informationen in der Anmerkung.",
 | |
|       $: "vermutlich",
 | |
|       "+++": "Inhalte aus mehreren Almanachen interpoliert",
 | |
|       B: "Blatt",
 | |
|       BB: "Blätter",
 | |
|       C: "Corrigenda",
 | |
|       Diagr: "Diagramm",
 | |
|       G: "Graphik",
 | |
|       "G-Verz": "Verzeichnis der Kupfer u. ä.",
 | |
|       GG: "Graphiken",
 | |
|       Hrsg: "Herausgeber",
 | |
|       "I-Verz": "Inhaltsverzeichnis",
 | |
|       Kal: "Kalendarium",
 | |
|       Kr: "Karte",
 | |
|       MusB: "Musikbeigabe",
 | |
|       MusBB: "Musikbeigaben",
 | |
|       S: "Seite",
 | |
|       SS: "Seiten",
 | |
|       Sp: "Spiegel",
 | |
|       T: "Titel",
 | |
|       TG: "Titelgraphik, Titelportrait etc",
 | |
|       "TG r": "Titelgraphik, Titelportrait etc recto",
 | |
|       "TG v": "Titelgraphik, Titelportrait etc verso",
 | |
|       Tab: "Tabelle",
 | |
|       UG: "Umschlaggraphik",
 | |
|       "UG r": "Umschlaggraphik recto",
 | |
|       "UG v": "Umschlaggraphik verso",
 | |
|       VB: "Vorsatzblatt",
 | |
|       Vf: "Verfasser",
 | |
|       VrlgM: "Verlagsmitteilung",
 | |
|       Vrwrt: "Vorwort",
 | |
|       ar: "arabische Paginierung",
 | |
|       ar1: "erste arabische Paginierung",
 | |
|       ar2: "zweite arabische Paginierung",
 | |
|       ar3: "dritte arabische Paginierung",
 | |
|       ar4: "vierte arabische Paginierung",
 | |
|       ar5: "fünfte arabische Paginierung",
 | |
|       ar6: "sechste arabische Paginierung",
 | |
|       ar7: "siebte arabische Paginierung",
 | |
|       gA: "graphische Anleitung",
 | |
|       gT: "graphischer Titel",
 | |
|       gTzA: "graphische Tanzanleitung",
 | |
|       nT: "Nachtitel",
 | |
|       röm: "römische Paginierung",
 | |
|       röm1: "erste römische Paginierung",
 | |
|       röm2: "zweite römische Paginierung",
 | |
|       röm3: "dritte römische Paginierung",
 | |
|       röm4: "vierte römische Paginierung",
 | |
|       röm5: "fünfte römische Paginierung",
 | |
|       röm6: "sechste römische Paginierung",
 | |
|       röm7: "siebte römische Paginierung",
 | |
|       vT: "Vortitel",
 | |
|       zT: "Zwischentitel",
 | |
|       "§§": "Hinweis auf Mängel im Almanach (Beschädigungen, fehlende Graphiken, unvollständige Sammlungen etc) in der Anmerkung"
 | |
|     };
 | |
|   }
 | |
|   constructor() {
 | |
|     super(), this._abbrevMap = p.defaultAbbrevMap;
 | |
|   }
 | |
|   connectedCallback() {
 | |
|     this.render();
 | |
|   }
 | |
|   attributeChangedCallback(t, e, i) {
 | |
|     e !== i && (t === "data-abbrevmap" && this._parseAndSetAbbrevMap(i), this.render());
 | |
|   }
 | |
|   _parseAndSetAbbrevMap(t) {
 | |
|     if (!t) {
 | |
|       this._abbrevMap = p.defaultAbbrevMap;
 | |
|       return;
 | |
|     }
 | |
|     try {
 | |
|       this._abbrevMap = JSON.parse(t);
 | |
|     } catch {
 | |
|       this._abbrevMap = p.defaultAbbrevMap;
 | |
|     }
 | |
|   }
 | |
|   setAbbrevMap(t) {
 | |
|     typeof t == "object" && t !== null && (this._abbrevMap = t, this.render());
 | |
|   }
 | |
|   get text() {
 | |
|     return this.getAttribute("data-text") || "";
 | |
|   }
 | |
|   set text(t) {
 | |
|     this.setAttribute("data-text", t);
 | |
|   }
 | |
|   render() {
 | |
|     this.innerHTML = this.transformText(this.text, this._abbrevMap);
 | |
|   }
 | |
|   transformText(t, e) {
 | |
|     let i = "", s = 0;
 | |
|     for (; s < t.length; ) {
 | |
|       if (s > 0 && !this.isSpaceOrPunct(t[s - 1])) {
 | |
|         i += t[s], s++;
 | |
|         continue;
 | |
|       }
 | |
|       const a = this.findLongestAbbrevAt(t, s, e);
 | |
|       if (a) {
 | |
|         const { match: n, meaning: h } = a;
 | |
|         i += `
 | |
|             <tool-tip position="top" class="!inline" timeout="300">
 | |
|               <div class="data-tip p-2 text-sm text-white bg-gray-700 rounded shadow">
 | |
|                 ${h}
 | |
|               </div>
 | |
|               <span class="cursor-help text-blue-900 hover:text-slate-800">
 | |
|                 ${n}
 | |
|               </span>
 | |
|             </tool-tip>
 | |
|           `, s += n.length;
 | |
|       } else
 | |
|         i += t[s], s++;
 | |
|     }
 | |
|     return i;
 | |
|   }
 | |
|   findLongestAbbrevAt(t, e, i) {
 | |
|     let s = null, a = 0;
 | |
|     for (const n of Object.keys(i))
 | |
|       t.startsWith(n, e) && n.length > a && (s = n, a = n.length);
 | |
|     return s ? { match: s, meaning: i[s] } : null;
 | |
|   }
 | |
|   isSpaceOrPunct(t) {
 | |
|     return /\s|[.,;:!?]/.test(t);
 | |
|   }
 | |
| }
 | |
| class j extends HTMLElement {
 | |
|   constructor() {
 | |
|     super();
 | |
|   }
 | |
|   connectedCallback() {
 | |
|     this.style.cursor = "pointer", this.addEventListener("click", this.handleClick);
 | |
|   }
 | |
|   disconnectedCallback() {
 | |
|     this.removeEventListener("click", this.handleClick);
 | |
|   }
 | |
|   handleClick(t) {
 | |
|     const e = this.getAttribute("data-jump");
 | |
|     if (e) {
 | |
|       const i = document.querySelector(e);
 | |
|       i ? i.scrollIntoView({ behavior: "smooth" }) : console.warn(`No element found for selector: ${e}`);
 | |
|     }
 | |
|   }
 | |
| }
 | |
| var v;
 | |
| class X extends HTMLElement {
 | |
|   constructor() {
 | |
|     super();
 | |
|     l(this, v, 176);
 | |
|     this._images = [];
 | |
|   }
 | |
|   connectedCallback() {
 | |
|     this._images = Array.from(this.querySelectorAll(".primages")), this.calculateShownImages();
 | |
|     const e = new ResizeObserver((i, s) => {
 | |
|       this.calculateShownImages();
 | |
|     });
 | |
|     this._resizeObserver = e, e.observe(this);
 | |
|   }
 | |
|   disconnectedCallback() {
 | |
|     this._resizeObserver.unobserve(this);
 | |
|   }
 | |
|   calculateShownImages() {
 | |
|     const e = this.getBoundingClientRect();
 | |
|     console.log(e);
 | |
|     const i = Math.floor(e.width / (c(this, v) + 10));
 | |
|     for (let s = 0; s < this._images.length; s++)
 | |
|       s < i - 1 ? this._images[s].classList.remove("hidden") : this._images[s].classList.add("hidden");
 | |
|   }
 | |
| }
 | |
| v = new WeakMap();
 | |
| customElements.define(R, j);
 | |
| customElements.define(P, p);
 | |
| customElements.define(M, U);
 | |
| customElements.define(I, D);
 | |
| customElements.define(q, z);
 | |
| customElements.define(H, G);
 | |
| customElements.define($, K);
 | |
| customElements.define(O, F);
 | |
| customElements.define(N, X);
 | |
| export {
 | |
|   p as AbbreviationTooltips,
 | |
|   U as FilterList,
 | |
|   D as ScrollButton,
 | |
|   V as XSLTParseProcess
 | |
| };
 | 
