From 939601c462f2db7421dbab3399acf48a003c8bf2 Mon Sep 17 00:00:00 2001 From: rebecca <802632-arkandos@users.noreply.gitlab.com> Date: Fri, 1 May 2026 01:03:09 +0200 Subject: [PATCH] update server-component runtime --- priv/static/off-topic.min.mjs | 6 +++--- priv/static/off-topic.mjs | 32 ++++++++++++++++++++++++-------- src/off_topic.gleam | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/priv/static/off-topic.min.mjs b/priv/static/off-topic.min.mjs index e533b83..5b7b0e8 100644 --- a/priv/static/off-topic.min.mjs +++ b/priv/static/off-topic.min.mjs @@ -1,3 +1,3 @@ -var de=e=>e.head,C=e=>e.tail;var Ce=5,ft=(1<i.removeEventListener(t,r)}function U(e){let t=()=>document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive",r=s=>{s!==n&&(e(s),n=s)},n=t();n!=="active"&&e(n);let i=new AbortController,o={capture:!0,signal:i.signal};return["pageshow","focus","blur","visibilitychange","resume"].forEach(s=>{window.addEventListener(s,()=>r(t()),o)}),window.addEventListener("freeze",()=>{r("frozen")},o),window.addEventListener("pagehide",s=>{r(s.persisted?"frozen":"terminated")},o),()=>i.abort()}function j(e){let t=()=>-new Date().getTimezoneOffset(),r=t();e(r);let n=setInterval(()=>{let i=t();i!==r&&(r=i,e(i))},6e4);return()=>clearInterval(n)}var D=ze(window,"online","offline",()=>navigator.onLine),F=ze(document.documentElement,"pointerenter","pointerleave",()=>document.documentElement.matches(":hover"));function R(e){let t=r=>{r.preventDefault(),e()};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)}function P(e,t){let r=!1,n=null,i=()=>{r&&(r=!1,t(!1)),clearTimeout(n),n=setTimeout(()=>{r=!0,t(!0)},e)},o=()=>{document.hidden||i()},s=["pointermove","pointerdown","keydown","scroll","wheel","resize"];for(let l of s)window.addEventListener(l,i,{passive:!0});return document.addEventListener("visibilitychange",o),i(),()=>{clearTimeout(n);for(let l of s)window.removeEventListener(l,i);document.removeEventListener("visibilitychange",o)}}function W(e){return I(null,window,"resize",()=>e(window.innerWidth,window.innerHeight))}function G(e){return I(null,window,"scroll",()=>e(window.scrollX,window.scrollY))}function V(e){return I(null,screen.orientation,"change",()=>e(screen.orientation.type))}function H(e){return I(null,window,"languagechange",()=>e(navigator.language))}function X(e,t,r){let n=[];Se(t,([s,l])=>{n.push([window.matchMedia(s),l])});let i=()=>n.find(([s])=>s.matches)?.[1]??e,o=()=>r(i());o();for(let[s]of n)s.addEventListener("change",o);return()=>{for(let[s]of n)s.removeEventListener("change",o)}}var K=Ee(localStorage),Y=Ee(sessionStorage);function Ee(e){return(t,r)=>{let n=e.getItem(t);return r(n!==null,n??""),b(window,"storage",o=>{if(o.storageArea===e&&o.key===t){let s=o.newValue;r(s!==null,s??"")}})}}function J(e,t,r){let n=u(e,r);if(!n)return c;let{width:i,height:o}=n.getBoundingClientRect();t(Math.round(i),Math.round(o));let s=new ResizeObserver(l=>{let{width:p,height:y}=l[0].contentRect;t(Math.round(p),Math.round(y))});return s.observe(n),()=>s.disconnect()}function Q(e,t,r){let n=u(e,r);if(!n)return c;let i=n.getBoundingClientRect();t(i.bottom>0&&i.right>0&&i.top{t(s[0].isIntersecting)});return o.observe(n),()=>o.disconnect()}function Z(e,t,r){let n=u(e,r);if(!n)return c;let i=()=>t(Math.round(n.scrollLeft),Math.round(n.scrollTop));return i(),n.addEventListener("scroll",i,{passive:!0}),()=>n.removeEventListener("scroll",i)}function ee(e){return document.title=e,c}function te(e,t){let r=document.head.querySelector(`meta[name="${CSS.escape(e)}"]`);return r||(r=document.createElement("meta"),r.setAttribute("name",e),document.head.appendChild(r)),r.setAttribute("content",t),c}function ne(e,t,r,n){let o=(n instanceof ShadowRoot?n.host:n)?.internals;if(o){let s=e==="role"?"role":"aria"+e.slice(5).replace(/-([a-z])/g,(l,p)=>p.toUpperCase()).replace(/^./,l=>l.toUpperCase());o[s]=t}return c}function re(e,t,r,n){let o=(n instanceof ShadowRoot?n.host:n)?.internals;return o&&(t?o.states.add(e):o.states.delete(e)),c}function ie(e,t,r,n){return(n instanceof ShadowRoot?n.host:n)?.internals?.setFormValue(e?t:void 0),c}function I(e,t,r,n){let i=u(t,e);return n(),b(i,r,n)}function ze(e,t,r,n){return i=>{i(n());let o=()=>i(!0),s=()=>i(!1);return e.addEventListener(t,o),e.addEventListener(r,s),()=>{e.removeEventListener(t,o),e.removeEventListener(r,s)}}}function c(){}function oe(e,t){t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}function se(e,t){t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}function le(e,t,r,n,i){u(e,i)?.scrollTo({left:t,top:r,behavior:n})}function fe(e,t,r,n,i){u(e,i)?.scrollIntoView({block:t,inline:r,behavior:n})}function ue(e,t){u(e,t)?.focus()}function ce(){document.activeElement?.blur()}var ae=class extends HTMLElement{#e=null;#t=new Map;connectedCallback(){this.#e=tt(this),this.#e&&(this.#e.addEventListener("off-topic:subscribe",this.#n),this.#e.addEventListener("off-topic:unsubscribe",this.#r),this.#e.addEventListener("off-topic:command",this.#i)),this.dispatchEvent(new CustomEvent("off-topic:mount"))}connectedMoveCallback(){}disconnectedCallback(){this.#e&&(this.#e.removeEventListener("off-topic:subscribe",this.#n),this.#e.removeEventListener("off-topic:unsubscribe",this.#r),this.#e=null),queueMicrotask(()=>{if(!this.isConnected){for(let t of this.#t.values())clearTimeout(t.delayTimeout),t.cleanup?.();this.#t.clear()}})}#n=t=>{let{detail:{tick:r,path:n,name:i,params:o,include:s,throttle:l=0,delay:p=0}}=t,y=`${r}:${n.join(":")}`;if(this.#t.has(y))return;let pe=window.OffTopic.subscriptions[i];if(!pe){console.warn(`off-topic: subscription '${i}' requested, but not registered`);return}let a={tick:r,path:n,params:o,cleanup:void 0,lastFired:0,lastThrottledData:void 0,delayTimeout:void 0},k=d=>{let _=Array.isArray(d)?d.map(ve=>Be(ve,s)):Be(d,s),S=new CustomEvent("off-topic:dispatch",{detail:{tick:r,path:n,message:_}});this.dispatchEvent(S)},Ae=(...d)=>{let _=d.length===1?d[0]:d;if(l>0){let S=Date.now();S>=a.lastFired+l&&(a.lastFired=S,a.lastThrottledData=_,k(_))}p>0&&(clearTimeout(a.delayTimeout),a.delayTimeout=setTimeout(()=>{_!==a.lastThrottledData&&k(_)},p)),!l&&!p&&k(_)};a.cleanup=pe(...o,Ae,this.#e),this.#t.set(y,a)};#r=t=>{let{detail:{tick:r,path:n}}=t,i=`${r}:${n.join(":")}`,o=this.#t.get(i);o&&(this.#t.delete(i),clearTimeout(o.delayTimeout),o.cleanup?.())};#i=t=>{let{detail:{name:r,params:n}}=t;window.OffTopic.commands[r]?.(...n,this.#e)}};function tt(e){for(;e!=null;){if(e instanceof ShadowRoot&&e.host.tagName.toLowerCase()==="lustre-server-component")return e.host;e=e.parentNode}return console.error(` is not mounted inside a Lustre server component and will not work! -If you are using lustre.start, you can use off_topic's effects directly and can remove this component.`),null}function Be(e,t){if(typeof e!="object")return e;let r={};for(let n of t){let i=n.split(".");for(let o=0,s=e,l=r;oe.head,O=e=>e.tail;var ke=5,ct=(1<i.removeEventListener(t,r)}function U(e){let t=()=>document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive",r=s=>{s!==n&&(e(s),n=s)},n=t();n!=="active"&&e(n);let i=new AbortController,o={capture:!0,signal:i.signal};return["pageshow","focus","blur","visibilitychange","resume"].forEach(s=>{window.addEventListener(s,()=>r(t()),o)}),window.addEventListener("freeze",()=>{r("frozen")},o),window.addEventListener("pagehide",s=>{r(s.persisted?"frozen":"terminated")},o),()=>i.abort()}function j(e){let t=()=>-new Date().getTimezoneOffset(),r=t();e(r);let n=setInterval(()=>{let i=t();i!==r&&(r=i,e(i))},6e4);return()=>clearInterval(n)}var et=ze(window,"online","offline",()=>navigator.onLine),D=ze(document.documentElement,"pointerenter","pointerleave",()=>document.documentElement.matches(":hover"));function F(e){let t=r=>{r.preventDefault(),e()};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)}function R(e,t){let r=!1,n=null,i=()=>{r&&(r=!1,t(!1)),clearTimeout(n),n=setTimeout(()=>{r=!0,t(!0)},e)},o=()=>{document.hidden||i()},s=["pointermove","pointerdown","keydown","scroll","wheel","resize"];for(let l of s)window.addEventListener(l,i,{passive:!0});return document.addEventListener("visibilitychange",o),i(),()=>{clearTimeout(n);for(let l of s)window.removeEventListener(l,i);document.removeEventListener("visibilitychange",o)}}function P(e){return I(null,window,"resize",()=>e(window.innerWidth,window.innerHeight))}function V(e){return I(null,window,"scroll",()=>e(window.scrollX,window.scrollY))}function W(e){return I(null,screen.orientation,"change",()=>e(screen.orientation.type))}function G(e){return I(null,window,"languagechange",()=>e(navigator.language))}function H(e,t,r){let n=[];Se(t,([s,l])=>{n.push([window.matchMedia(s),l])});let i=()=>n.find(([s])=>s.matches)?.[1]??e,o=()=>r(i());o();for(let[s]of n)s.addEventListener("change",o);return()=>{for(let[s]of n)s.removeEventListener("change",o)}}var X=Ee(localStorage),K=Ee(sessionStorage);function Ee(e){return(t,r)=>{let n=e.getItem(t);return r(n!==null,n??""),$(window,"storage",o=>{if(o.storageArea===e&&o.key===t){let s=o.newValue;r(s!==null,s??"")}})}}function Y(e,t,r){let n=u(e,r);if(!n)return c;let{width:i,height:o}=n.getBoundingClientRect();t(Math.round(i),Math.round(o));let s=new ResizeObserver(l=>{let{width:p,height:y}=l[0].contentRect;t(Math.round(p),Math.round(y))});return s.observe(n),()=>s.disconnect()}function J(e,t,r){let n=u(e,r);if(!n)return c;let i=n.getBoundingClientRect();t(i.bottom>0&&i.right>0&&i.top{t(s[0].isIntersecting)});return o.observe(n),()=>o.disconnect()}function Q(e,t,r){let n=u(e,r);if(!n)return c;let i=()=>t(Math.round(n.scrollLeft),Math.round(n.scrollTop));return i(),n.addEventListener("scroll",i,{passive:!0}),()=>n.removeEventListener("scroll",i)}function Z(e){return document.title=e,c}function ee(e,t){let r=document.head.querySelector(`meta[name="${CSS.escape(e)}"]`);return r||(r=document.createElement("meta"),r.setAttribute("name",e),document.head.appendChild(r)),r.setAttribute("content",t),c}function te(e){let t=e.split(" ");return document.body.classList.add(...t),()=>document.body.classList.remove(...t)}function ne(e,t,r,n){let o=(n instanceof ShadowRoot?n.host:n)?.internals;if(o){let s=e==="role"?"role":"aria"+e.slice(5).replace(/-([a-z])/g,(l,p)=>p.toUpperCase()).replace(/^./,l=>l.toUpperCase());o[s]=t}return c}function re(e,t,r,n){let o=(n instanceof ShadowRoot?n.host:n)?.internals;return o&&(t?o.states.add(e):o.states.delete(e)),c}function ie(e,t,r,n){return(n instanceof ShadowRoot?n.host:n)?.internals?.setFormValue(e?t:void 0),c}function I(e,t,r,n){let i=u(t,e);return n(),$(i,r,n)}function ze(e,t,r,n){return i=>{i(n());let o=()=>i(!0),s=()=>i(!1);return e.addEventListener(t,o),e.addEventListener(r,s),()=>{e.removeEventListener(t,o),e.removeEventListener(r,s)}}}function c(){}function Be(e,t,r,n){window.dispatchEvent(new StorageEvent("storage",{key:t,oldValue:r,newValue:n,storageArea:e,url:window.location.href}))}function oe(e,t,r){let n=r?localStorage.getItem(e):null;localStorage.setItem(e,t),r&&Be(localStorage,e,n,t)}function se(e,t,r){let n=r?sessionStorage.getItem(e):null;sessionStorage.setItem(e,t),r&&Be(sessionStorage,e,n,t)}function le(e,t,r,n,i){u(e,i)?.scrollTo({left:t,top:r,behavior:n})}function fe(e,t,r,n,i){u(e,i)?.scrollIntoView({block:t,inline:r,behavior:n})}function ue(e,t){u(e,t)?.focus()}function ce(){document.activeElement?.blur()}var ae=class extends HTMLElement{#e=null;#t=new Map;connectedCallback(){this.#e=rt(this),this.#e&&(this.#e.addEventListener("off-topic:subscribe",this.#n),this.#e.addEventListener("off-topic:unsubscribe",this.#r),this.#e.addEventListener("off-topic:command",this.#i)),this.dispatchEvent(new CustomEvent("off-topic:mount"))}connectedMoveCallback(){}disconnectedCallback(){this.#e&&(this.#e.removeEventListener("off-topic:subscribe",this.#n),this.#e.removeEventListener("off-topic:unsubscribe",this.#r),this.#e=null),queueMicrotask(()=>{if(!this.isConnected){for(let t of this.#t.values())clearTimeout(t.delayTimeout),t.cleanup?.();this.#t.clear()}})}#n=t=>{let{detail:{tick:r,path:n,name:i,params:o,include:s,throttle:l=0,delay:p=0}}=t,y=`${r}:${n.join(":")}`;if(this.#t.has(y))return;let pe=window.OffTopic.subscriptions[i];if(!pe){console.warn(`off-topic: subscription '${i}' requested, but not registered`);return}let a={tick:r,path:n,params:o,cleanup:void 0,lastFired:0,lastThrottledData:void 0,delayTimeout:void 0},C=d=>{let _=Array.isArray(d)?d.map(Ie=>Ae(Ie,s)):Ae(d,s),S=new CustomEvent("off-topic:dispatch",{detail:{tick:r,path:n,message:_}});this.dispatchEvent(S)},ve=(...d)=>{let _=d.length===1?d[0]:d;if(l>0){let S=Date.now();S>=a.lastFired+l&&(a.lastFired=S,a.lastThrottledData=_,C(_))}p>0&&(clearTimeout(a.delayTimeout),a.delayTimeout=setTimeout(()=>{_!==a.lastThrottledData&&C(_)},p)),!l&&!p&&C(_)};a.cleanup=pe(...o,ve,this.#e),this.#t.set(y,a)};#r=t=>{let{detail:{tick:r,path:n}}=t,i=`${r}:${n.join(":")}`,o=this.#t.get(i);o&&(this.#t.delete(i),clearTimeout(o.delayTimeout),o.cleanup?.())};#i=t=>{let{detail:{name:r,params:n}}=t;window.OffTopic.commands[r]?.(...n,this.#e)}};function rt(e){for(;e!=null;){if(e instanceof ShadowRoot&&e.host.tagName.toLowerCase()==="lustre-server-component")return e.host;e=e.parentNode}return console.error(` is not mounted inside a Lustre server component and will not work! +If you are using lustre.start, you can use off_topic's effects directly and can remove this component.`),null}function Ae(e,t){if(typeof e!="object")return e;let r={};for(let n of t){let i=n.split(".");for(let o=0,s=e,l=r;o document.body.classList.remove(...classes); +} function aria(name, value, _handler, root) { const host = root instanceof ShadowRoot ? root.host : root; const internals = host?.internals; @@ -332,13 +337,24 @@ function noop() { } // build/dev/javascript/off_topic/off_topic/internal/commands_ffi.mjs -function set_local_storage(key, value) { - if (value === null) localStorage.removeItem(key); - else localStorage.setItem(key, value); -} -function set_session_storage(key, value) { - if (value === null) sessionStorage.removeItem(key); - else sessionStorage.setItem(key, value); +function dispatchStorageEvent(storage2, key, oldValue, newValue) { + window.dispatchEvent(new StorageEvent("storage", { + key, + oldValue, + newValue, + storageArea: storage2, + url: window.location.href + })); +} +function set_local_storage(key, value, emit) { + const oldValue = emit ? localStorage.getItem(key) : null; + localStorage.setItem(key, value); + if (emit) dispatchStorageEvent(localStorage, key, oldValue, value); +} +function set_session_storage(key, value, emit) { + const oldValue = emit ? sessionStorage.getItem(key) : null; + sessionStorage.setItem(key, value); + if (emit) dispatchStorageEvent(sessionStorage, key, oldValue, value); } function scroll_to(selector, x, y, behavior, root) { resolveElement(selector, root)?.scrollTo({ left: x, top: y, behavior }); @@ -498,7 +514,6 @@ Object.assign(window.OffTopic.subscriptions, { "off-topic/media-query": media_query, "off-topic/window-hover": window_hover, "off-topic/here": here, - "off-topic/online": online, "off-topic/window-size": window_size, "off-topic/window-scroll": window_scroll, "off-topic/screen-orientation": screen_orientation, @@ -507,6 +522,7 @@ Object.assign(window.OffTopic.subscriptions, { "off-topic/session-storage": session_storage, "off-topic/title": title, "off-topic/meta": meta, + "off-topic/body-class": body_class, "off-topic/aria": aria, "off-topic/pseudo-state": pseudo_state, "off-topic/form-value": form_value, diff --git a/src/off_topic.gleam b/src/off_topic.gleam index 5552ec7..af8472c 100644 --- a/src/off_topic.gleam +++ b/src/off_topic.gleam @@ -264,7 +264,7 @@ pub fn script() -> Element(msg) { html.script( [attribute.type_("module")], // <> - "var de=e=>e.head,C=e=>e.tail;var Ce=5,ft=(1<i.removeEventListener(t,r)}function U(e){let t=()=>document.visibilityState===\"hidden\"?\"hidden\":document.hasFocus()?\"active\":\"passive\",r=s=>{s!==n&&(e(s),n=s)},n=t();n!==\"active\"&&e(n);let i=new AbortController,o={capture:!0,signal:i.signal};return[\"pageshow\",\"focus\",\"blur\",\"visibilitychange\",\"resume\"].forEach(s=>{window.addEventListener(s,()=>r(t()),o)}),window.addEventListener(\"freeze\",()=>{r(\"frozen\")},o),window.addEventListener(\"pagehide\",s=>{r(s.persisted?\"frozen\":\"terminated\")},o),()=>i.abort()}function j(e){let t=()=>-new Date().getTimezoneOffset(),r=t();e(r);let n=setInterval(()=>{let i=t();i!==r&&(r=i,e(i))},6e4);return()=>clearInterval(n)}var D=ze(window,\"online\",\"offline\",()=>navigator.onLine),F=ze(document.documentElement,\"pointerenter\",\"pointerleave\",()=>document.documentElement.matches(\":hover\"));function R(e){let t=r=>{r.preventDefault(),e()};return window.addEventListener(\"beforeunload\",t),()=>window.removeEventListener(\"beforeunload\",t)}function P(e,t){let r=!1,n=null,i=()=>{r&&(r=!1,t(!1)),clearTimeout(n),n=setTimeout(()=>{r=!0,t(!0)},e)},o=()=>{document.hidden||i()},s=[\"pointermove\",\"pointerdown\",\"keydown\",\"scroll\",\"wheel\",\"resize\"];for(let l of s)window.addEventListener(l,i,{passive:!0});return document.addEventListener(\"visibilitychange\",o),i(),()=>{clearTimeout(n);for(let l of s)window.removeEventListener(l,i);document.removeEventListener(\"visibilitychange\",o)}}function W(e){return I(null,window,\"resize\",()=>e(window.innerWidth,window.innerHeight))}function G(e){return I(null,window,\"scroll\",()=>e(window.scrollX,window.scrollY))}function V(e){return I(null,screen.orientation,\"change\",()=>e(screen.orientation.type))}function H(e){return I(null,window,\"languagechange\",()=>e(navigator.language))}function X(e,t,r){let n=[];Se(t,([s,l])=>{n.push([window.matchMedia(s),l])});let i=()=>n.find(([s])=>s.matches)?.[1]??e,o=()=>r(i());o();for(let[s]of n)s.addEventListener(\"change\",o);return()=>{for(let[s]of n)s.removeEventListener(\"change\",o)}}var K=Ee(localStorage),Y=Ee(sessionStorage);function Ee(e){return(t,r)=>{let n=e.getItem(t);return r(n!==null,n??\"\"),b(window,\"storage\",o=>{if(o.storageArea===e&&o.key===t){let s=o.newValue;r(s!==null,s??\"\")}})}}function J(e,t,r){let n=u(e,r);if(!n)return c;let{width:i,height:o}=n.getBoundingClientRect();t(Math.round(i),Math.round(o));let s=new ResizeObserver(l=>{let{width:p,height:y}=l[0].contentRect;t(Math.round(p),Math.round(y))});return s.observe(n),()=>s.disconnect()}function Q(e,t,r){let n=u(e,r);if(!n)return c;let i=n.getBoundingClientRect();t(i.bottom>0&&i.right>0&&i.top{t(s[0].isIntersecting)});return o.observe(n),()=>o.disconnect()}function Z(e,t,r){let n=u(e,r);if(!n)return c;let i=()=>t(Math.round(n.scrollLeft),Math.round(n.scrollTop));return i(),n.addEventListener(\"scroll\",i,{passive:!0}),()=>n.removeEventListener(\"scroll\",i)}function ee(e){return document.title=e,c}function te(e,t){let r=document.head.querySelector(`meta[name=\"${CSS.escape(e)}\"]`);return r||(r=document.createElement(\"meta\"),r.setAttribute(\"name\",e),document.head.appendChild(r)),r.setAttribute(\"content\",t),c}function ne(e,t,r,n){let o=(n instanceof ShadowRoot?n.host:n)?.internals;if(o){let s=e===\"role\"?\"role\":\"aria\"+e.slice(5).replace(/-([a-z])/g,(l,p)=>p.toUpperCase()).replace(/^./,l=>l.toUpperCase());o[s]=t}return c}function re(e,t,r,n){let o=(n instanceof ShadowRoot?n.host:n)?.internals;return o&&(t?o.states.add(e):o.states.delete(e)),c}function ie(e,t,r,n){return(n instanceof ShadowRoot?n.host:n)?.internals?.setFormValue(e?t:void 0),c}function I(e,t,r,n){let i=u(t,e);return n(),b(i,r,n)}function ze(e,t,r,n){return i=>{i(n());let o=()=>i(!0),s=()=>i(!1);return e.addEventListener(t,o),e.addEventListener(r,s),()=>{e.removeEventListener(t,o),e.removeEventListener(r,s)}}}function c(){}function oe(e,t){t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}function se(e,t){t===null?sessionStorage.removeItem(e):sessionStorage.setItem(e,t)}function le(e,t,r,n,i){u(e,i)?.scrollTo({left:t,top:r,behavior:n})}function fe(e,t,r,n,i){u(e,i)?.scrollIntoView({block:t,inline:r,behavior:n})}function ue(e,t){u(e,t)?.focus()}function ce(){document.activeElement?.blur()}var ae=class extends HTMLElement{#e=null;#t=new Map;connectedCallback(){this.#e=tt(this),this.#e&&(this.#e.addEventListener(\"off-topic:subscribe\",this.#n),this.#e.addEventListener(\"off-topic:unsubscribe\",this.#r),this.#e.addEventListener(\"off-topic:command\",this.#i)),this.dispatchEvent(new CustomEvent(\"off-topic:mount\"))}connectedMoveCallback(){}disconnectedCallback(){this.#e&&(this.#e.removeEventListener(\"off-topic:subscribe\",this.#n),this.#e.removeEventListener(\"off-topic:unsubscribe\",this.#r),this.#e=null),queueMicrotask(()=>{if(!this.isConnected){for(let t of this.#t.values())clearTimeout(t.delayTimeout),t.cleanup?.();this.#t.clear()}})}#n=t=>{let{detail:{tick:r,path:n,name:i,params:o,include:s,throttle:l=0,delay:p=0}}=t,y=`${r}:${n.join(\":\")}`;if(this.#t.has(y))return;let pe=window.OffTopic.subscriptions[i];if(!pe){console.warn(`off-topic: subscription '${i}' requested, but not registered`);return}let a={tick:r,path:n,params:o,cleanup:void 0,lastFired:0,lastThrottledData:void 0,delayTimeout:void 0},k=d=>{let _=Array.isArray(d)?d.map(ve=>Be(ve,s)):Be(d,s),S=new CustomEvent(\"off-topic:dispatch\",{detail:{tick:r,path:n,message:_}});this.dispatchEvent(S)},Ae=(...d)=>{let _=d.length===1?d[0]:d;if(l>0){let S=Date.now();S>=a.lastFired+l&&(a.lastFired=S,a.lastThrottledData=_,k(_))}p>0&&(clearTimeout(a.delayTimeout),a.delayTimeout=setTimeout(()=>{_!==a.lastThrottledData&&k(_)},p)),!l&&!p&&k(_)};a.cleanup=pe(...o,Ae,this.#e),this.#t.set(y,a)};#r=t=>{let{detail:{tick:r,path:n}}=t,i=`${r}:${n.join(\":\")}`,o=this.#t.get(i);o&&(this.#t.delete(i),clearTimeout(o.delayTimeout),o.cleanup?.())};#i=t=>{let{detail:{name:r,params:n}}=t;window.OffTopic.commands[r]?.(...n,this.#e)}};function tt(e){for(;e!=null;){if(e instanceof ShadowRoot&&e.host.tagName.toLowerCase()===\"lustre-server-component\")return e.host;e=e.parentNode}return console.error(` is not mounted inside a Lustre server component and will not work!\\nIf you are using lustre.start, you can use off_topic's effects directly and can remove this component.`),null}function Be(e,t){if(typeof e!=\"object\")return e;let r={};for(let n of t){let i=n.split(\".\");for(let o=0,s=e,l=r;oe.head,O=e=>e.tail;var ke=5,ct=(1<i.removeEventListener(t,r)}function U(e){let t=()=>document.visibilityState===\"hidden\"?\"hidden\":document.hasFocus()?\"active\":\"passive\",r=s=>{s!==n&&(e(s),n=s)},n=t();n!==\"active\"&&e(n);let i=new AbortController,o={capture:!0,signal:i.signal};return[\"pageshow\",\"focus\",\"blur\",\"visibilitychange\",\"resume\"].forEach(s=>{window.addEventListener(s,()=>r(t()),o)}),window.addEventListener(\"freeze\",()=>{r(\"frozen\")},o),window.addEventListener(\"pagehide\",s=>{r(s.persisted?\"frozen\":\"terminated\")},o),()=>i.abort()}function j(e){let t=()=>-new Date().getTimezoneOffset(),r=t();e(r);let n=setInterval(()=>{let i=t();i!==r&&(r=i,e(i))},6e4);return()=>clearInterval(n)}var et=ze(window,\"online\",\"offline\",()=>navigator.onLine),D=ze(document.documentElement,\"pointerenter\",\"pointerleave\",()=>document.documentElement.matches(\":hover\"));function F(e){let t=r=>{r.preventDefault(),e()};return window.addEventListener(\"beforeunload\",t),()=>window.removeEventListener(\"beforeunload\",t)}function R(e,t){let r=!1,n=null,i=()=>{r&&(r=!1,t(!1)),clearTimeout(n),n=setTimeout(()=>{r=!0,t(!0)},e)},o=()=>{document.hidden||i()},s=[\"pointermove\",\"pointerdown\",\"keydown\",\"scroll\",\"wheel\",\"resize\"];for(let l of s)window.addEventListener(l,i,{passive:!0});return document.addEventListener(\"visibilitychange\",o),i(),()=>{clearTimeout(n);for(let l of s)window.removeEventListener(l,i);document.removeEventListener(\"visibilitychange\",o)}}function P(e){return I(null,window,\"resize\",()=>e(window.innerWidth,window.innerHeight))}function V(e){return I(null,window,\"scroll\",()=>e(window.scrollX,window.scrollY))}function W(e){return I(null,screen.orientation,\"change\",()=>e(screen.orientation.type))}function G(e){return I(null,window,\"languagechange\",()=>e(navigator.language))}function H(e,t,r){let n=[];Se(t,([s,l])=>{n.push([window.matchMedia(s),l])});let i=()=>n.find(([s])=>s.matches)?.[1]??e,o=()=>r(i());o();for(let[s]of n)s.addEventListener(\"change\",o);return()=>{for(let[s]of n)s.removeEventListener(\"change\",o)}}var X=Ee(localStorage),K=Ee(sessionStorage);function Ee(e){return(t,r)=>{let n=e.getItem(t);return r(n!==null,n??\"\"),$(window,\"storage\",o=>{if(o.storageArea===e&&o.key===t){let s=o.newValue;r(s!==null,s??\"\")}})}}function Y(e,t,r){let n=u(e,r);if(!n)return c;let{width:i,height:o}=n.getBoundingClientRect();t(Math.round(i),Math.round(o));let s=new ResizeObserver(l=>{let{width:p,height:y}=l[0].contentRect;t(Math.round(p),Math.round(y))});return s.observe(n),()=>s.disconnect()}function J(e,t,r){let n=u(e,r);if(!n)return c;let i=n.getBoundingClientRect();t(i.bottom>0&&i.right>0&&i.top{t(s[0].isIntersecting)});return o.observe(n),()=>o.disconnect()}function Q(e,t,r){let n=u(e,r);if(!n)return c;let i=()=>t(Math.round(n.scrollLeft),Math.round(n.scrollTop));return i(),n.addEventListener(\"scroll\",i,{passive:!0}),()=>n.removeEventListener(\"scroll\",i)}function Z(e){return document.title=e,c}function ee(e,t){let r=document.head.querySelector(`meta[name=\"${CSS.escape(e)}\"]`);return r||(r=document.createElement(\"meta\"),r.setAttribute(\"name\",e),document.head.appendChild(r)),r.setAttribute(\"content\",t),c}function te(e){let t=e.split(\" \");return document.body.classList.add(...t),()=>document.body.classList.remove(...t)}function ne(e,t,r,n){let o=(n instanceof ShadowRoot?n.host:n)?.internals;if(o){let s=e===\"role\"?\"role\":\"aria\"+e.slice(5).replace(/-([a-z])/g,(l,p)=>p.toUpperCase()).replace(/^./,l=>l.toUpperCase());o[s]=t}return c}function re(e,t,r,n){let o=(n instanceof ShadowRoot?n.host:n)?.internals;return o&&(t?o.states.add(e):o.states.delete(e)),c}function ie(e,t,r,n){return(n instanceof ShadowRoot?n.host:n)?.internals?.setFormValue(e?t:void 0),c}function I(e,t,r,n){let i=u(t,e);return n(),$(i,r,n)}function ze(e,t,r,n){return i=>{i(n());let o=()=>i(!0),s=()=>i(!1);return e.addEventListener(t,o),e.addEventListener(r,s),()=>{e.removeEventListener(t,o),e.removeEventListener(r,s)}}}function c(){}function Be(e,t,r,n){window.dispatchEvent(new StorageEvent(\"storage\",{key:t,oldValue:r,newValue:n,storageArea:e,url:window.location.href}))}function oe(e,t,r){let n=r?localStorage.getItem(e):null;localStorage.setItem(e,t),r&&Be(localStorage,e,n,t)}function se(e,t,r){let n=r?sessionStorage.getItem(e):null;sessionStorage.setItem(e,t),r&&Be(sessionStorage,e,n,t)}function le(e,t,r,n,i){u(e,i)?.scrollTo({left:t,top:r,behavior:n})}function fe(e,t,r,n,i){u(e,i)?.scrollIntoView({block:t,inline:r,behavior:n})}function ue(e,t){u(e,t)?.focus()}function ce(){document.activeElement?.blur()}var ae=class extends HTMLElement{#e=null;#t=new Map;connectedCallback(){this.#e=rt(this),this.#e&&(this.#e.addEventListener(\"off-topic:subscribe\",this.#n),this.#e.addEventListener(\"off-topic:unsubscribe\",this.#r),this.#e.addEventListener(\"off-topic:command\",this.#i)),this.dispatchEvent(new CustomEvent(\"off-topic:mount\"))}connectedMoveCallback(){}disconnectedCallback(){this.#e&&(this.#e.removeEventListener(\"off-topic:subscribe\",this.#n),this.#e.removeEventListener(\"off-topic:unsubscribe\",this.#r),this.#e=null),queueMicrotask(()=>{if(!this.isConnected){for(let t of this.#t.values())clearTimeout(t.delayTimeout),t.cleanup?.();this.#t.clear()}})}#n=t=>{let{detail:{tick:r,path:n,name:i,params:o,include:s,throttle:l=0,delay:p=0}}=t,y=`${r}:${n.join(\":\")}`;if(this.#t.has(y))return;let pe=window.OffTopic.subscriptions[i];if(!pe){console.warn(`off-topic: subscription '${i}' requested, but not registered`);return}let a={tick:r,path:n,params:o,cleanup:void 0,lastFired:0,lastThrottledData:void 0,delayTimeout:void 0},C=d=>{let _=Array.isArray(d)?d.map(Ie=>Ae(Ie,s)):Ae(d,s),S=new CustomEvent(\"off-topic:dispatch\",{detail:{tick:r,path:n,message:_}});this.dispatchEvent(S)},ve=(...d)=>{let _=d.length===1?d[0]:d;if(l>0){let S=Date.now();S>=a.lastFired+l&&(a.lastFired=S,a.lastThrottledData=_,C(_))}p>0&&(clearTimeout(a.delayTimeout),a.delayTimeout=setTimeout(()=>{_!==a.lastThrottledData&&C(_)},p)),!l&&!p&&C(_)};a.cleanup=pe(...o,ve,this.#e),this.#t.set(y,a)};#r=t=>{let{detail:{tick:r,path:n}}=t,i=`${r}:${n.join(\":\")}`,o=this.#t.get(i);o&&(this.#t.delete(i),clearTimeout(o.delayTimeout),o.cleanup?.())};#i=t=>{let{detail:{name:r,params:n}}=t;window.OffTopic.commands[r]?.(...n,this.#e)}};function rt(e){for(;e!=null;){if(e instanceof ShadowRoot&&e.host.tagName.toLowerCase()===\"lustre-server-component\")return e.host;e=e.parentNode}return console.error(` is not mounted inside a Lustre server component and will not work!\\nIf you are using lustre.start, you can use off_topic's effects directly and can remove this component.`),null}function Ae(e,t){if(typeof e!=\"object\")return e;let r={};for(let n of t){let i=n.split(\".\");for(let o=0,s=e,l=r;o